diff --git a/.github/actions/changesets-fixed-version-bump/index.js b/.github/actions/changesets-fixed-version-bump/index.js index 9726af5cd9..2aac796283 100644 --- a/.github/actions/changesets-fixed-version-bump/index.js +++ b/.github/actions/changesets-fixed-version-bump/index.js @@ -3963,7 +3963,7 @@ var micromatch__default = /*#__PURE__*/_interopDefault(micromatch); var packageJson = { name: "@changesets/config", - version: "3.1.1", + version: "3.1.2", description: "Utilities for reading and parsing Changeset's config", main: "dist/changesets-config.cjs.js", module: "dist/changesets-config.esm.js", @@ -4013,159 +4013,125 @@ let defaultWrittenConfig = { updateInternalDependencies: "patch", ignore: [] }; - function flatten(arr) { return [].concat(...arr); } - function getNormalizedChangelogOption(thing) { if (thing === false) { return false; } - if (typeof thing === "string") { return [thing, null]; } - return thing; } - function getNormalizedCommitOption(thing) { if (thing === false) { return false; } - if (thing === true) { return ["@changesets/cli/commit", { skipCI: "version" }]; } - if (typeof thing === "string") { return [thing, null]; } - return thing; } - function getUnmatchedPatterns(listOfPackageNamesOrGlob, pkgNames) { return listOfPackageNamesOrGlob.filter(pkgNameOrGlob => !pkgNames.some(pkgName => micromatch__default["default"].isMatch(pkgName, pkgNameOrGlob))); } - const havePackageGroupsCorrectShape = pkgGroups => { return isArray(pkgGroups) && pkgGroups.every(arr => isArray(arr) && arr.every(pkgName => typeof pkgName === "string")); -}; // TODO: it might be possible to remove this if improvements to `Array.isArray` ever land -// related thread: github.com/microsoft/TypeScript/issues/36554 - +}; +// TODO: it might be possible to remove this if improvements to `Array.isArray` ever land +// related thread: github.com/microsoft/TypeScript/issues/36554 function isArray(arg) { return Array.isArray(arg); } - let read = async (cwd, packages) => { - var _packages; - - (_packages = packages) !== null && _packages !== void 0 ? _packages : packages = await getPackages.getPackages(cwd); + packages !== null && packages !== void 0 ? packages : packages = await getPackages.getPackages(cwd); let json = await fs__namespace.readJSON(path__default["default"].join(cwd, ".changeset", "config.json")); return parse(json, packages); }; let parse = (json, packages) => { var _json$changedFilePatt, _json$snapshot$prerel, _json$snapshot, _json$snapshot2, _json$___experimental, _json$___experimental2, _json$___experimental3, _json$___experimental4, _json$privatePackages, _json$privatePackages2; - let messages = []; let pkgNames = packages.packages.map(({ packageJson }) => packageJson.name); - if (json.changelog !== undefined && json.changelog !== false && typeof json.changelog !== "string" && !(isArray(json.changelog) && json.changelog.length === 2 && typeof json.changelog[0] === "string")) { messages.push(`The \`changelog\` option is set as ${JSON.stringify(json.changelog, null, 2)} when the only valid values are undefined, false, a module path(e.g. "@changesets/cli/changelog" or "./some-module") or a tuple with a module path and config for the changelog generator(e.g. ["@changesets/cli/changelog", { someOption: true }])`); } - let normalizedAccess = json.access; - if (json.access === "private") { normalizedAccess = "restricted"; logger.warn('The `access` option is set as "private", but this is actually not a valid value - the correct form is "restricted".'); } - if (normalizedAccess !== undefined && normalizedAccess !== "restricted" && normalizedAccess !== "public") { messages.push(`The \`access\` option is set as ${JSON.stringify(normalizedAccess, null, 2)} when the only valid values are undefined, "public" or "restricted"`); } - if (json.commit !== undefined && typeof json.commit !== "boolean" && typeof json.commit !== "string" && !(isArray(json.commit) && json.commit.length === 2 && typeof json.commit[0] === "string")) { messages.push(`The \`commit\` option is set as ${JSON.stringify(json.commit, null, 2)} when the only valid values are undefined or a boolean or a module path (e.g. "@changesets/cli/commit" or "./some-module") or a tuple with a module path and config for the commit message generator (e.g. ["@changesets/cli/commit", { "skipCI": "version" }])`); } - if (json.baseBranch !== undefined && typeof json.baseBranch !== "string") { messages.push(`The \`baseBranch\` option is set as ${JSON.stringify(json.baseBranch, null, 2)} but the \`baseBranch\` option can only be set as a string`); } - if (json.changedFilePatterns !== undefined && (!isArray(json.changedFilePatterns) || !json.changedFilePatterns.every(pattern => typeof pattern === "string"))) { messages.push(`The \`changedFilePatterns\` option is set as ${JSON.stringify(json.changedFilePatterns, null, 2)} but the \`changedFilePatterns\` option can only be set as an array of strings`); } - let fixed = []; - if (json.fixed !== undefined) { if (!havePackageGroupsCorrectShape(json.fixed)) { messages.push(`The \`fixed\` option is set as ${JSON.stringify(json.fixed, null, 2)} when the only valid values are undefined or an array of arrays of package names`); } else { let foundPkgNames = new Set(); let duplicatedPkgNames = new Set(); - for (let fixedGroup of json.fixed) { - messages.push(...getUnmatchedPatterns(fixedGroup, pkgNames).map(pkgOrGlob => `The package or glob expression "${pkgOrGlob}" specified in the \`fixed\` option does not match any package in the project. You may have misspelled the package name or provided an invalid glob expression. Note that glob expressions must be defined according to https://www.npmjs.com/package/micromatch.`)); + messages.push(...getUnmatchedPatterns(fixedGroup, pkgNames).map(pkgOrGlob => `The package or glob expression "${pkgOrGlob}" specified in the \`fixed\` option does not match any package in the project. You may have misspelled the package name or provided an invalid glob expression. Note that glob expressions must be defined according to https://www.npmjs.com/package/micromatch`)); let expandedFixedGroup = micromatch__default["default"](pkgNames, fixedGroup); fixed.push(expandedFixedGroup); - for (let fixedPkgName of expandedFixedGroup) { if (foundPkgNames.has(fixedPkgName)) { duplicatedPkgNames.add(fixedPkgName); } - foundPkgNames.add(fixedPkgName); } } - if (duplicatedPkgNames.size) { duplicatedPkgNames.forEach(pkgName => { - messages.push(`The package "${pkgName}" is defined in multiple sets of fixed packages. Packages can only be defined in a single set of fixed packages. If you are using glob expressions, make sure that they are valid according to https://www.npmjs.com/package/micromatch.`); + messages.push(`The package "${pkgName}" is defined in multiple sets of fixed packages. Packages can only be defined in a single set of fixed packages. If you are using glob expressions, make sure that they are valid according to https://www.npmjs.com/package/micromatch`); }); } } } - let linked = []; - if (json.linked !== undefined) { if (!havePackageGroupsCorrectShape(json.linked)) { messages.push(`The \`linked\` option is set as ${JSON.stringify(json.linked, null, 2)} when the only valid values are undefined or an array of arrays of package names`); } else { let foundPkgNames = new Set(); let duplicatedPkgNames = new Set(); - for (let linkedGroup of json.linked) { - messages.push(...getUnmatchedPatterns(linkedGroup, pkgNames).map(pkgOrGlob => `The package or glob expression "${pkgOrGlob}" specified in the \`linked\` option does not match any package in the project. You may have misspelled the package name or provided an invalid glob expression. Note that glob expressions must be defined according to https://www.npmjs.com/package/micromatch.`)); + messages.push(...getUnmatchedPatterns(linkedGroup, pkgNames).map(pkgOrGlob => `The package or glob expression "${pkgOrGlob}" specified in the \`linked\` option does not match any package in the project. You may have misspelled the package name or provided an invalid glob expression. Note that glob expressions must be defined according to https://www.npmjs.com/package/micromatch`)); let expandedLinkedGroup = micromatch__default["default"](pkgNames, linkedGroup); linked.push(expandedLinkedGroup); - for (let linkedPkgName of expandedLinkedGroup) { if (foundPkgNames.has(linkedPkgName)) { duplicatedPkgNames.add(linkedPkgName); } - foundPkgNames.add(linkedPkgName); } } - if (duplicatedPkgNames.size) { duplicatedPkgNames.forEach(pkgName => { - messages.push(`The package "${pkgName}" is defined in multiple sets of linked packages. Packages can only be defined in a single set of linked packages. If you are using glob expressions, make sure that they are valid according to https://www.npmjs.com/package/micromatch.`); + messages.push(`The package "${pkgName}" is defined in multiple sets of linked packages. Packages can only be defined in a single set of linked packages. If you are using glob expressions, make sure that they are valid according to https://www.npmjs.com/package/micromatch`); }); } } } - const allFixedPackages = new Set(flatten(fixed)); const allLinkedPackages = new Set(flatten(linked)); allFixedPackages.forEach(pkgName => { @@ -4173,22 +4139,21 @@ let parse = (json, packages) => { messages.push(`The package "${pkgName}" can be found in both fixed and linked groups. A package can only be either fixed or linked.`); } }); - if (json.updateInternalDependencies !== undefined && !["patch", "minor"].includes(json.updateInternalDependencies)) { messages.push(`The \`updateInternalDependencies\` option is set as ${JSON.stringify(json.updateInternalDependencies, null, 2)} but can only be 'patch' or 'minor'`); } - if (json.ignore) { if (!(isArray(json.ignore) && json.ignore.every(pkgName => typeof pkgName === "string"))) { messages.push(`The \`ignore\` option is set as ${JSON.stringify(json.ignore, null, 2)} when the only valid values are undefined or an array of package names`); } else { - messages.push(...getUnmatchedPatterns(json.ignore, pkgNames).map(pkgOrGlob => `The package or glob expression "${pkgOrGlob}" is specified in the \`ignore\` option but it is not found in the project. You may have misspelled the package name or provided an invalid glob expression. Note that glob expressions must be defined according to https://www.npmjs.com/package/micromatch.`)); // Validate that all dependents of ignored packages are listed in the ignore list - - const dependentsGraph = getDependentsGraph.getDependentsGraph(packages); + messages.push(...getUnmatchedPatterns(json.ignore, pkgNames).map(pkgOrGlob => `The package or glob expression "${pkgOrGlob}" is specified in the \`ignore\` option but it is not found in the project. You may have misspelled the package name or provided an invalid glob expression. Note that glob expressions must be defined according to https://www.npmjs.com/package/micromatch`)); + // Validate that all dependents of ignored packages are listed in the ignore list + const dependentsGraph = getDependentsGraph.getDependentsGraph(packages, { + bumpVersionsWithWorkspaceProtocolOnly: json.bumpVersionsWithWorkspaceProtocolOnly + }); for (const ignoredPackage of json.ignore) { const dependents = dependentsGraph.get(ignoredPackage) || []; - for (const dependent of dependents) { if (!json.ignore.includes(dependent)) { messages.push(`The package "${dependent}" depends on the ignored package "${ignoredPackage}", but "${dependent}" is not being ignored. Please add "${dependent}" to the \`ignore\` option.`); @@ -4197,53 +4162,42 @@ let parse = (json, packages) => { } } } - if (json.prettier !== undefined && typeof json.prettier !== "boolean") { messages.push(`The \`prettier\` option is set as ${JSON.stringify(json.prettier, null, 2)} when the only valid values are undefined or a boolean`); } - const { snapshot } = json; - if (snapshot !== undefined) { if (snapshot.useCalculatedVersion !== undefined && typeof snapshot.useCalculatedVersion !== "boolean") { messages.push(`The \`snapshot.useCalculatedVersion\` option is set as ${JSON.stringify(snapshot.useCalculatedVersion, null, 2)} when the only valid values are undefined or a boolean`); } - if (snapshot.prereleaseTemplate !== undefined && typeof snapshot.prereleaseTemplate !== "string") { messages.push(`The \`snapshot.prereleaseTemplate\` option is set as ${JSON.stringify(snapshot.prereleaseTemplate, null, 2)} when the only valid values are undefined, or a template string.`); } } - if (json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH !== undefined) { const { onlyUpdatePeerDependentsWhenOutOfRange, updateInternalDependents, useCalculatedVersionForSnapshots } = json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH; - if (onlyUpdatePeerDependentsWhenOutOfRange !== undefined && typeof onlyUpdatePeerDependentsWhenOutOfRange !== "boolean") { messages.push(`The \`onlyUpdatePeerDependentsWhenOutOfRange\` option is set as ${JSON.stringify(onlyUpdatePeerDependentsWhenOutOfRange, null, 2)} when the only valid values are undefined or a boolean`); } - if (updateInternalDependents !== undefined && !["always", "out-of-range"].includes(updateInternalDependents)) { messages.push(`The \`updateInternalDependents\` option is set as ${JSON.stringify(updateInternalDependents, null, 2)} but can only be 'always' or 'out-of-range'`); } - if (useCalculatedVersionForSnapshots && useCalculatedVersionForSnapshots !== undefined) { console.warn(`Experimental flag "useCalculatedVersionForSnapshots" is deprecated since snapshot feature became stable. Please use "snapshot.useCalculatedVersion" instead.`); - if (typeof useCalculatedVersionForSnapshots !== "boolean") { messages.push(`The \`useCalculatedVersionForSnapshots\` option is set as ${JSON.stringify(useCalculatedVersionForSnapshots, null, 2)} when the only valid values are undefined or a boolean`); } } } - if (messages.length) { throw new errors.ValidationError(`Some errors occurred when validating the changesets config:\n` + messages.join("\n")); } - let config = { changelog: getNormalizedChangelogOption(json.changelog === undefined ? defaultWrittenConfig.changelog : json.changelog), access: normalizedAccess === undefined ? defaultWrittenConfig.access : normalizedAccess, @@ -4276,11 +4230,9 @@ let parse = (json, packages) => { tag: false } }; - if (config.privatePackages.version === false && config.privatePackages.tag === true) { throw new errors.ValidationError(`The \`privatePackages.tag\` option is set to \`true\` but \`privatePackages.version\` is set to \`false\`. This is not allowed.`); } - return config; }; let fakePackage = { @@ -4958,7 +4910,7 @@ exports.warn = warn; Object.defineProperty(exports, "__esModule", ({ value: true })); -var yaml = __nccwpck_require__(5130); +var yaml = __nccwpck_require__(30677); function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; } @@ -4967,18 +4919,14 @@ var yaml__default = /*#__PURE__*/_interopDefault(yaml); const mdRegex = /\s*---([^]*?)\n\s*---(\s*(?:\n|$)[^]*)/; function parseChangesetFile(contents) { const execResult = mdRegex.exec(contents); - if (!execResult) { throw new Error(`could not parse changeset - invalid frontmatter: ${contents}`); } - let [, roughReleases, roughSummary] = execResult; let summary = roughSummary.trim(); let releases; - try { - const yamlStuff = yaml__default["default"].safeLoad(roughReleases); - + const yamlStuff = yaml__default["default"].load(roughReleases); if (yamlStuff) { releases = Object.entries(yamlStuff).map(([name, type]) => ({ name, @@ -4990,11 +4938,9 @@ function parseChangesetFile(contents) { } catch (e) { throw new Error(`could not parse changeset - invalid frontmatter: ${contents}`); } - if (!releases) { throw new Error(`could not parse changeset - unknown error: ${contents}`); } - return { releases, summary @@ -5006,5067 +4952,5232 @@ exports["default"] = parseChangesetFile; /***/ }), -/***/ 5130: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - -"use strict"; - - - -var yaml = __nccwpck_require__(8235); - - -module.exports = yaml; - - -/***/ }), - -/***/ 8235: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/***/ 37763: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; +Object.defineProperty(exports, "__esModule", ({ value: true })); -var loader = __nccwpck_require__(61977); -var dumper = __nccwpck_require__(21703); +var fs = __nccwpck_require__(41348); +var path = __nccwpck_require__(16928); +var getPackages = __nccwpck_require__(94941); +var errors = __nccwpck_require__(17789); +function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; } -function deprecated(name) { - return function () { - throw new Error('Function ' + name + ' is deprecated and cannot be used.'); - }; +function _interopNamespace(e) { + if (e && e.__esModule) return e; + var n = Object.create(null); + if (e) { + Object.keys(e).forEach(function (k) { + if (k !== 'default') { + var d = Object.getOwnPropertyDescriptor(e, k); + Object.defineProperty(n, k, d.get ? d : { + enumerable: true, + get: function () { return e[k]; } + }); + } + }); + } + n["default"] = e; + return Object.freeze(n); } +var fs__namespace = /*#__PURE__*/_interopNamespace(fs); +var path__default = /*#__PURE__*/_interopDefault(path); -module.exports.Type = __nccwpck_require__(88210); -module.exports.Schema = __nccwpck_require__(11253); -module.exports.FAILSAFE_SCHEMA = __nccwpck_require__(47177); -module.exports.JSON_SCHEMA = __nccwpck_require__(13046); -module.exports.CORE_SCHEMA = __nccwpck_require__(87875); -module.exports.DEFAULT_SAFE_SCHEMA = __nccwpck_require__(22919); -module.exports.DEFAULT_FULL_SCHEMA = __nccwpck_require__(17587); -module.exports.load = loader.load; -module.exports.loadAll = loader.loadAll; -module.exports.safeLoad = loader.safeLoad; -module.exports.safeLoadAll = loader.safeLoadAll; -module.exports.dump = dumper.dump; -module.exports.safeDump = dumper.safeDump; -module.exports.YAMLException = __nccwpck_require__(69125); - -// Deprecated schema names from JS-YAML 2.0.x -module.exports.MINIMAL_SCHEMA = __nccwpck_require__(47177); -module.exports.SAFE_SCHEMA = __nccwpck_require__(22919); -module.exports.DEFAULT_SCHEMA = __nccwpck_require__(17587); - -// Deprecated functions from JS-YAML 1.x.x -module.exports.scan = deprecated('scan'); -module.exports.parse = deprecated('parse'); -module.exports.compose = deprecated('compose'); -module.exports.addConstructor = deprecated('addConstructor'); +function _defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + return obj; +} -/***/ }), +function ownKeys(object, enumerableOnly) { + var keys = Object.keys(object); -/***/ 99999: -/***/ ((module) => { + if (Object.getOwnPropertySymbols) { + var symbols = Object.getOwnPropertySymbols(object); + if (enumerableOnly) symbols = symbols.filter(function (sym) { + return Object.getOwnPropertyDescriptor(object, sym).enumerable; + }); + keys.push.apply(keys, symbols); + } -"use strict"; + return keys; +} +function _objectSpread2(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i] != null ? arguments[i] : {}; + if (i % 2) { + ownKeys(Object(source), true).forEach(function (key) { + _defineProperty(target, key, source[key]); + }); + } else if (Object.getOwnPropertyDescriptors) { + Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); + } else { + ownKeys(Object(source)).forEach(function (key) { + Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); + }); + } + } -function isNothing(subject) { - return (typeof subject === 'undefined') || (subject === null); + return target; } +async function readPreState(cwd) { + let preStatePath = path__default["default"].resolve(cwd, ".changeset", "pre.json"); // TODO: verify that the pre state isn't broken -function isObject(subject) { - return (typeof subject === 'object') && (subject !== null); -} - + let preState; -function toArray(sequence) { - if (Array.isArray(sequence)) return sequence; - else if (isNothing(sequence)) return []; + try { + let contents = await fs__namespace.readFile(preStatePath, "utf8"); - return [ sequence ]; -} + try { + preState = JSON.parse(contents); + } catch (err) { + if (err instanceof SyntaxError) { + console.error("error parsing json:", contents); + } + throw err; + } + } catch (err) { + if (err.code !== "ENOENT") { + throw err; + } + } -function extend(target, source) { - var index, length, key, sourceKeys; + return preState; +} +async function exitPre(cwd) { + let preStatePath = path__default["default"].resolve(cwd, ".changeset", "pre.json"); // TODO: verify that the pre state isn't broken - if (source) { - sourceKeys = Object.keys(source); + let preState = await readPreState(cwd); - for (index = 0, length = sourceKeys.length; index < length; index += 1) { - key = sourceKeys[index]; - target[key] = source[key]; - } + if (preState === undefined) { + throw new errors.PreExitButNotInPreModeError(); } - return target; + await fs__namespace.outputFile(preStatePath, JSON.stringify(_objectSpread2(_objectSpread2({}, preState), {}, { + mode: "exit" + }), null, 2) + "\n"); } +async function enterPre(cwd, tag) { + var _preState$changesets; + let packages = await getPackages.getPackages(cwd); + let preStatePath = path__default["default"].resolve(packages.root.dir, ".changeset", "pre.json"); + let preState = await readPreState(packages.root.dir); // can't reenter if pre mode still exists, but we should allow exited pre mode to be reentered -function repeat(string, count) { - var result = '', cycle; - - for (cycle = 0; cycle < count; cycle += 1) { - result += string; + if ((preState === null || preState === void 0 ? void 0 : preState.mode) === "pre") { + throw new errors.PreEnterButInPreModeError(); } - return result; -} + let newPreState = { + mode: "pre", + tag, + initialVersions: {}, + changesets: (_preState$changesets = preState === null || preState === void 0 ? void 0 : preState.changesets) !== null && _preState$changesets !== void 0 ? _preState$changesets : [] + }; + for (let pkg of packages.packages) { + newPreState.initialVersions[pkg.packageJson.name] = pkg.packageJson.version; + } -function isNegativeZero(number) { - return (number === 0) && (Number.NEGATIVE_INFINITY === 1 / number); + await fs__namespace.outputFile(preStatePath, JSON.stringify(newPreState, null, 2) + "\n"); } - -module.exports.isNothing = isNothing; -module.exports.isObject = isObject; -module.exports.toArray = toArray; -module.exports.repeat = repeat; -module.exports.isNegativeZero = isNegativeZero; -module.exports.extend = extend; +exports.enterPre = enterPre; +exports.exitPre = exitPre; +exports.readPreState = readPreState; /***/ }), -/***/ 21703: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/***/ 74007: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -/*eslint-disable no-use-before-define*/ - -var common = __nccwpck_require__(99999); -var YAMLException = __nccwpck_require__(69125); -var DEFAULT_FULL_SCHEMA = __nccwpck_require__(17587); -var DEFAULT_SAFE_SCHEMA = __nccwpck_require__(22919); - -var _toString = Object.prototype.toString; -var _hasOwnProperty = Object.prototype.hasOwnProperty; +Object.defineProperty(exports, "__esModule", ({ value: true })); -var CHAR_TAB = 0x09; /* Tab */ -var CHAR_LINE_FEED = 0x0A; /* LF */ -var CHAR_CARRIAGE_RETURN = 0x0D; /* CR */ -var CHAR_SPACE = 0x20; /* Space */ -var CHAR_EXCLAMATION = 0x21; /* ! */ -var CHAR_DOUBLE_QUOTE = 0x22; /* " */ -var CHAR_SHARP = 0x23; /* # */ -var CHAR_PERCENT = 0x25; /* % */ -var CHAR_AMPERSAND = 0x26; /* & */ -var CHAR_SINGLE_QUOTE = 0x27; /* ' */ -var CHAR_ASTERISK = 0x2A; /* * */ -var CHAR_COMMA = 0x2C; /* , */ -var CHAR_MINUS = 0x2D; /* - */ -var CHAR_COLON = 0x3A; /* : */ -var CHAR_EQUALS = 0x3D; /* = */ -var CHAR_GREATER_THAN = 0x3E; /* > */ -var CHAR_QUESTION = 0x3F; /* ? */ -var CHAR_COMMERCIAL_AT = 0x40; /* @ */ -var CHAR_LEFT_SQUARE_BRACKET = 0x5B; /* [ */ -var CHAR_RIGHT_SQUARE_BRACKET = 0x5D; /* ] */ -var CHAR_GRAVE_ACCENT = 0x60; /* ` */ -var CHAR_LEFT_CURLY_BRACKET = 0x7B; /* { */ -var CHAR_VERTICAL_LINE = 0x7C; /* | */ -var CHAR_RIGHT_CURLY_BRACKET = 0x7D; /* } */ - -var ESCAPE_SEQUENCES = {}; - -ESCAPE_SEQUENCES[0x00] = '\\0'; -ESCAPE_SEQUENCES[0x07] = '\\a'; -ESCAPE_SEQUENCES[0x08] = '\\b'; -ESCAPE_SEQUENCES[0x09] = '\\t'; -ESCAPE_SEQUENCES[0x0A] = '\\n'; -ESCAPE_SEQUENCES[0x0B] = '\\v'; -ESCAPE_SEQUENCES[0x0C] = '\\f'; -ESCAPE_SEQUENCES[0x0D] = '\\r'; -ESCAPE_SEQUENCES[0x1B] = '\\e'; -ESCAPE_SEQUENCES[0x22] = '\\"'; -ESCAPE_SEQUENCES[0x5C] = '\\\\'; -ESCAPE_SEQUENCES[0x85] = '\\N'; -ESCAPE_SEQUENCES[0xA0] = '\\_'; -ESCAPE_SEQUENCES[0x2028] = '\\L'; -ESCAPE_SEQUENCES[0x2029] = '\\P'; - -var DEPRECATED_BOOLEANS_SYNTAX = [ - 'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON', - 'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF' -]; +var fs = __nccwpck_require__(41348); +var path = __nccwpck_require__(16928); +var parse = __nccwpck_require__(7751); +var git = __nccwpck_require__(59427); +var pc = __nccwpck_require__(96596); +var pFilter = __nccwpck_require__(97465); +var logger = __nccwpck_require__(68323); -function compileStyleMap(schema, map) { - var result, keys, index, length, tag, style, type; +function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; } - if (map === null) return {}; +function _interopNamespace(e) { + if (e && e.__esModule) return e; + var n = Object.create(null); + if (e) { + Object.keys(e).forEach(function (k) { + if (k !== 'default') { + var d = Object.getOwnPropertyDescriptor(e, k); + Object.defineProperty(n, k, d.get ? d : { + enumerable: true, + get: function () { return e[k]; } + }); + } + }); + } + n["default"] = e; + return Object.freeze(n); +} - result = {}; - keys = Object.keys(map); +var fs__namespace = /*#__PURE__*/_interopNamespace(fs); +var path__default = /*#__PURE__*/_interopDefault(path); +var parse__default = /*#__PURE__*/_interopDefault(parse); +var git__namespace = /*#__PURE__*/_interopNamespace(git); +var pc__default = /*#__PURE__*/_interopDefault(pc); +var pFilter__default = /*#__PURE__*/_interopDefault(pFilter); - for (index = 0, length = keys.length; index < length; index += 1) { - tag = keys[index]; - style = String(map[tag]); +function _toPrimitive(t, r) { + if ("object" != typeof t || !t) return t; + var e = t[Symbol.toPrimitive]; + if (void 0 !== e) { + var i = e.call(t, r || "default"); + if ("object" != typeof i) return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return ("string" === r ? String : Number)(t); +} - if (tag.slice(0, 2) === '!!') { - tag = 'tag:yaml.org,2002:' + tag.slice(2); - } - type = schema.compiledTypeMap['fallback'][tag]; +function _toPropertyKey(t) { + var i = _toPrimitive(t, "string"); + return "symbol" == typeof i ? i : i + ""; +} - if (type && _hasOwnProperty.call(type.styleAliases, style)) { - style = type.styleAliases[style]; - } +function _defineProperty(e, r, t) { + return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { + value: t, + enumerable: !0, + configurable: !0, + writable: !0 + }) : e[r] = t, e; +} - result[tag] = style; +function ownKeys(e, r) { + var t = Object.keys(e); + if (Object.getOwnPropertySymbols) { + var o = Object.getOwnPropertySymbols(e); + r && (o = o.filter(function (r) { + return Object.getOwnPropertyDescriptor(e, r).enumerable; + })), t.push.apply(t, o); } - - return result; + return t; +} +function _objectSpread2(e) { + for (var r = 1; r < arguments.length; r++) { + var t = null != arguments[r] ? arguments[r] : {}; + r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { + _defineProperty(e, r, t[r]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { + Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); + }); + } + return e; } -function encodeHex(character) { - var string, handle, length; +// THIS SHOULD BE REMOVED WHEN SUPPORT FOR CHANGESETS FROM V1 IS DROPPED - string = character.toString(16).toUpperCase(); +let importantSeparator = pc__default["default"].red("===============================IMPORTANT!==============================="); +let importantEnd = pc__default["default"].red("----------------------------------------------------------------------"); +async function getOldChangesets(changesetBase, dirs) { + // this needs to support just not dealing with dirs that aren't set up properly + let changesets = await pFilter__default["default"](dirs, async dir => (await fs__namespace.lstat(path__default["default"].join(changesetBase, dir))).isDirectory()); + const changesetContents = changesets.map(async changesetDir => { + const jsonPath = path__default["default"].join(changesetBase, changesetDir, "changes.json"); + const [summary, json] = await Promise.all([fs__namespace.readFile(path__default["default"].join(changesetBase, changesetDir, "changes.md"), "utf-8"), fs__namespace.readJson(jsonPath)]); + return { + releases: json.releases, + summary, + id: changesetDir + }; + }); + return Promise.all(changesetContents); +} - if (character <= 0xFF) { - handle = 'x'; - length = 2; - } else if (character <= 0xFFFF) { - handle = 'u'; - length = 4; - } else if (character <= 0xFFFFFFFF) { - handle = 'U'; - length = 8; - } else { - throw new YAMLException('code point within a string may not be greater than 0xFFFFFFFF'); +// this function only exists while we wait for v1 changesets to be obsoleted +// and should be deleted before v3 +async function getOldChangesetsAndWarn(changesetBase, dirs) { + let oldChangesets = await getOldChangesets(changesetBase, dirs); + if (oldChangesets.length === 0) { + return []; } + logger.warn(importantSeparator); + logger.warn("There were old changesets from version 1 found"); + logger.warn("These are being applied now but the dependents graph may have changed"); + logger.warn("Make sure you validate all your dependencies"); + logger.warn("In a future major version, we will no longer apply these old changesets, and will instead throw here"); + logger.warn(importantEnd); + return oldChangesets; +} - return '\\' + handle + common.repeat('0', length - string.length) + string; +async function filterChangesetsSinceRef(changesets, changesetBase, sinceRef) { + const newChangesets = await git__namespace.getChangedChangesetFilesSinceRef({ + cwd: changesetBase, + ref: sinceRef + }); + const newHashes = newChangesets.map(c => c.split("/").pop()); + return changesets.filter(dir => newHashes.includes(dir)); +} +async function getChangesets(cwd, sinceRef) { + let changesetBase = path__default["default"].join(cwd, ".changeset"); + let contents; + try { + contents = await fs__namespace["default"].readdir(changesetBase); + } catch (err) { + if (err.code === "ENOENT") { + throw new Error("There is no .changeset directory in this project"); + } + throw err; + } + if (sinceRef !== undefined) { + contents = await filterChangesetsSinceRef(contents, changesetBase, sinceRef); + } + let oldChangesetsPromise = getOldChangesetsAndWarn(changesetBase, contents); + let changesets = contents.filter(file => !file.startsWith(".") && file.endsWith(".md") && !/^README\.md$/i.test(file)); + const changesetContents = changesets.map(async file => { + const changeset = await fs__namespace["default"].readFile(path__default["default"].join(changesetBase, file), "utf-8"); + return _objectSpread2(_objectSpread2({}, parse__default["default"](changeset)), {}, { + id: file.replace(".md", "") + }); + }); + return [...(await oldChangesetsPromise), ...(await Promise.all(changesetContents))]; } -function State(options) { - this.schema = options['schema'] || DEFAULT_FULL_SCHEMA; - this.indent = Math.max(1, (options['indent'] || 2)); - this.noArrayIndent = options['noArrayIndent'] || false; - this.skipInvalid = options['skipInvalid'] || false; - this.flowLevel = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']); - this.styleMap = compileStyleMap(this.schema, options['styles'] || null); - this.sortKeys = options['sortKeys'] || false; - this.lineWidth = options['lineWidth'] || 80; - this.noRefs = options['noRefs'] || false; - this.noCompatMode = options['noCompatMode'] || false; - this.condenseFlow = options['condenseFlow'] || false; +exports["default"] = getChangesets; - this.implicitTypes = this.schema.compiledImplicit; - this.explicitTypes = this.schema.compiledExplicit; - this.tag = null; - this.result = ''; +/***/ }), - this.duplicates = []; - this.usedDuplicates = null; -} +/***/ 81435: +/***/ ((__unused_webpack_module, exports) => { -// Indents every line in a string. Empty lines (\n only) are not indented. -function indentString(string, spaces) { - var ind = common.repeat(' ', spaces), - position = 0, - next = -1, - result = '', - line, - length = string.length; +"use strict"; - while (position < length) { - next = string.indexOf('\n', position); - if (next === -1) { - line = string.slice(position); - position = length; - } else { - line = string.slice(position, next + 1); - position = next + 1; - } - if (line.length && line !== '\n') result += ind; +Object.defineProperty(exports, "__esModule", ({ value: true })); - result += line; +function shouldSkipPackage({ + packageJson +}, { + ignore, + allowPrivatePackages +}) { + if (ignore.includes(packageJson.name)) { + return true; } - return result; -} + if (packageJson.private && !allowPrivatePackages) { + return true; + } -function generateNextLine(state, level) { - return '\n' + common.repeat(' ', state.indent * level); + return !packageJson.version; } -function testImplicitResolving(state, str) { - var index, length, type; +exports.shouldSkipPackage = shouldSkipPackage; - for (index = 0, length = state.implicitTypes.length; index < length; index += 1) { - type = state.implicitTypes[index]; - if (type.resolve(str)) { - return true; - } - } +/***/ }), - return false; -} +/***/ 44248: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -// [33] s-white ::= s-space | s-tab -function isWhitespace(c) { - return c === CHAR_SPACE || c === CHAR_TAB; -} +"use strict"; -// Returns true if the character can be printed without escaping. -// From YAML 1.2: "any allowed characters known to be non-printable -// should also be escaped. [However,] This isn’t mandatory" -// Derived from nb-char - \t - #x85 - #xA0 - #x2028 - #x2029. -function isPrintable(c) { - return (0x00020 <= c && c <= 0x00007E) - || ((0x000A1 <= c && c <= 0x00D7FF) && c !== 0x2028 && c !== 0x2029) - || ((0x0E000 <= c && c <= 0x00FFFD) && c !== 0xFEFF /* BOM */) - || (0x10000 <= c && c <= 0x10FFFF); -} -// [34] ns-char ::= nb-char - s-white -// [27] nb-char ::= c-printable - b-char - c-byte-order-mark -// [26] b-char ::= b-line-feed | b-carriage-return -// [24] b-line-feed ::= #xA /* LF */ -// [25] b-carriage-return ::= #xD /* CR */ -// [3] c-byte-order-mark ::= #xFEFF -function isNsChar(c) { - return isPrintable(c) && !isWhitespace(c) - // byte-order-mark - && c !== 0xFEFF - // b-char - && c !== CHAR_CARRIAGE_RETURN - && c !== CHAR_LINE_FEED; -} +Object.defineProperty(exports, "__esModule", ({ value: true })); -// Simplified test for values allowed after the first character in plain style. -function isPlainSafe(c, prev) { - // Uses a subset of nb-char - c-flow-indicator - ":" - "#" - // where nb-char ::= c-printable - b-char - c-byte-order-mark. - return isPrintable(c) && c !== 0xFEFF - // - c-flow-indicator - && c !== CHAR_COMMA - && c !== CHAR_LEFT_SQUARE_BRACKET - && c !== CHAR_RIGHT_SQUARE_BRACKET - && c !== CHAR_LEFT_CURLY_BRACKET - && c !== CHAR_RIGHT_CURLY_BRACKET - // - ":" - "#" - // /* An ns-char preceding */ "#" - && c !== CHAR_COLON - && ((c !== CHAR_SHARP) || (prev && isNsChar(prev))); -} +function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } -// Simplified test for values allowed as the first character in plain style. -function isPlainSafeFirst(c) { - // Uses a subset of ns-char - c-indicator - // where ns-char = nb-char - s-white. - return isPrintable(c) && c !== 0xFEFF - && !isWhitespace(c) // - s-white - // - (c-indicator ::= - // “-” | “?” | “:” | “,” | “[” | “]” | “{” | “}” - && c !== CHAR_MINUS - && c !== CHAR_QUESTION - && c !== CHAR_COLON - && c !== CHAR_COMMA - && c !== CHAR_LEFT_SQUARE_BRACKET - && c !== CHAR_RIGHT_SQUARE_BRACKET - && c !== CHAR_LEFT_CURLY_BRACKET - && c !== CHAR_RIGHT_CURLY_BRACKET - // | “#” | “&” | “*” | “!” | “|” | “=” | “>” | “'” | “"” - && c !== CHAR_SHARP - && c !== CHAR_AMPERSAND - && c !== CHAR_ASTERISK - && c !== CHAR_EXCLAMATION - && c !== CHAR_VERTICAL_LINE - && c !== CHAR_EQUALS - && c !== CHAR_GREATER_THAN - && c !== CHAR_SINGLE_QUOTE - && c !== CHAR_DOUBLE_QUOTE - // | “%” | “@” | “`”) - && c !== CHAR_PERCENT - && c !== CHAR_COMMERCIAL_AT - && c !== CHAR_GRAVE_ACCENT; -} +var _regeneratorRuntime = _interopDefault(__nccwpck_require__(65907)); +var _asyncToGenerator = _interopDefault(__nccwpck_require__(67584)); +var _classCallCheck = _interopDefault(__nccwpck_require__(33446)); +var _possibleConstructorReturn = _interopDefault(__nccwpck_require__(83855)); +var _getPrototypeOf = _interopDefault(__nccwpck_require__(55989)); +var _inherits = _interopDefault(__nccwpck_require__(87406)); +var _wrapNativeSuper = _interopDefault(__nccwpck_require__(16318)); +var findUp = __nccwpck_require__(81179); +var findUp__default = _interopDefault(findUp); +var path = _interopDefault(__nccwpck_require__(16928)); +var fs = _interopDefault(__nccwpck_require__(97298)); -// Determines whether block indentation indicator is required. -function needIndentIndicator(string) { - var leadingSpaceRe = /^\n* /; - return leadingSpaceRe.test(string); -} +var NoPkgJsonFound = +/*#__PURE__*/ +function (_Error) { + _inherits(NoPkgJsonFound, _Error); -var STYLE_PLAIN = 1, - STYLE_SINGLE = 2, - STYLE_LITERAL = 3, - STYLE_FOLDED = 4, - STYLE_DOUBLE = 5; + function NoPkgJsonFound(directory) { + var _this; -// Determines which scalar styles are possible and returns the preferred style. -// lineWidth = -1 => no limit. -// Pre-conditions: str.length > 0. -// Post-conditions: -// STYLE_PLAIN or STYLE_SINGLE => no \n are in the string. -// STYLE_LITERAL => no lines are suitable for folding (or lineWidth is -1). -// STYLE_FOLDED => a line > lineWidth and can be folded (and lineWidth != -1). -function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType) { - var i; - var char, prev_char; - var hasLineBreak = false; - var hasFoldableLine = false; // only checked if shouldTrackWidth - var shouldTrackWidth = lineWidth !== -1; - var previousLineBreak = -1; // count the first line correctly - var plain = isPlainSafeFirst(string.charCodeAt(0)) - && !isWhitespace(string.charCodeAt(string.length - 1)); + _classCallCheck(this, NoPkgJsonFound); - if (singleLineOnly) { - // Case: no block styles. - // Check for disallowed characters to rule out plain and single. - for (i = 0; i < string.length; i++) { - char = string.charCodeAt(i); - if (!isPrintable(char)) { - return STYLE_DOUBLE; - } - prev_char = i > 0 ? string.charCodeAt(i - 1) : null; - plain = plain && isPlainSafe(char, prev_char); - } - } else { - // Case: block styles permitted. - for (i = 0; i < string.length; i++) { - char = string.charCodeAt(i); - if (char === CHAR_LINE_FEED) { - hasLineBreak = true; - // Check if any line can be folded. - if (shouldTrackWidth) { - hasFoldableLine = hasFoldableLine || - // Foldable line = too long, and not more-indented. - (i - previousLineBreak - 1 > lineWidth && - string[previousLineBreak + 1] !== ' '); - previousLineBreak = i; - } - } else if (!isPrintable(char)) { - return STYLE_DOUBLE; - } - prev_char = i > 0 ? string.charCodeAt(i - 1) : null; - plain = plain && isPlainSafe(char, prev_char); - } - // in case the end is missing a \n - hasFoldableLine = hasFoldableLine || (shouldTrackWidth && - (i - previousLineBreak - 1 > lineWidth && - string[previousLineBreak + 1] !== ' ')); - } - // Although every style can represent \n without escaping, prefer block styles - // for multiline, since they're more readable and they don't add empty lines. - // Also prefer folding a super-long line. - if (!hasLineBreak && !hasFoldableLine) { - // Strings interpretable as another type have to be quoted; - // e.g. the string 'true' vs. the boolean true. - return plain && !testAmbiguousType(string) - ? STYLE_PLAIN : STYLE_SINGLE; - } - // Edge case: block indentation indicator can only have one digit. - if (indentPerLevel > 9 && needIndentIndicator(string)) { - return STYLE_DOUBLE; + _this = _possibleConstructorReturn(this, _getPrototypeOf(NoPkgJsonFound).call(this, "No package.json could be found upwards from the directory ".concat(directory))); + _this.directory = directory; + return _this; } - // At this point we know block styles are valid. - // Prefer literal style unless we want to fold. - return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL; + + return NoPkgJsonFound; +}(_wrapNativeSuper(Error)); + +function hasWorkspacesConfiguredViaPkgJson(_x, _x2) { + return _hasWorkspacesConfiguredViaPkgJson.apply(this, arguments); } -// Note: line breaking/folding is implemented for only the folded style. -// NB. We drop the last trailing newline (if any) of a returned block scalar -// since the dumper adds its own newline. This always works: -// • No ending newline => unaffected; already using strip "-" chomping. -// • Ending newline => removed then restored. -// Importantly, this keeps the "+" chomp indicator from gaining an extra line. -function writeScalar(state, string, level, iskey) { - state.dump = (function () { - if (string.length === 0) { - return "''"; - } - if (!state.noCompatMode && - DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1) { - return "'" + string + "'"; - } +function _hasWorkspacesConfiguredViaPkgJson() { + _hasWorkspacesConfiguredViaPkgJson = _asyncToGenerator( + /*#__PURE__*/ + _regeneratorRuntime.mark(function _callee(directory, firstPkgJsonDirRef) { + var pkgJson; + return _regeneratorRuntime.wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + _context.prev = 0; + _context.next = 3; + return fs.readJson(path.join(directory, "package.json")); - var indent = state.indent * Math.max(1, level); // no 0-indent scalars - // As indentation gets deeper, let the width decrease monotonically - // to the lower bound min(state.lineWidth, 40). - // Note that this implies - // state.lineWidth ≤ 40 + state.indent: width is fixed at the lower bound. - // state.lineWidth > 40 + state.indent: width decreases until the lower bound. - // This behaves better than a constant minimum width which disallows narrower options, - // or an indent threshold which causes the width to suddenly increase. - var lineWidth = state.lineWidth === -1 - ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent); + case 3: + pkgJson = _context.sent; - // Without knowing if keys are implicit/explicit, assume implicit for safety. - var singleLineOnly = iskey - // No block styles in flow mode. - || (state.flowLevel > -1 && level >= state.flowLevel); - function testAmbiguity(string) { - return testImplicitResolving(state, string); - } - - switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth, testAmbiguity)) { - case STYLE_PLAIN: - return string; - case STYLE_SINGLE: - return "'" + string.replace(/'/g, "''") + "'"; - case STYLE_LITERAL: - return '|' + blockHeader(string, state.indent) - + dropEndingNewline(indentString(string, indent)); - case STYLE_FOLDED: - return '>' + blockHeader(string, state.indent) - + dropEndingNewline(indentString(foldString(string, lineWidth), indent)); - case STYLE_DOUBLE: - return '"' + escapeString(string, lineWidth) + '"'; - default: - throw new YAMLException('impossible error: invalid scalar style'); - } - }()); -} + if (firstPkgJsonDirRef.current === undefined) { + firstPkgJsonDirRef.current = directory; + } -// Pre-conditions: string is valid for a block scalar, 1 <= indentPerLevel <= 9. -function blockHeader(string, indentPerLevel) { - var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : ''; + if (!(pkgJson.workspaces || pkgJson.bolt)) { + _context.next = 7; + break; + } - // note the special case: the string '\n' counts as a "trailing" empty line. - var clip = string[string.length - 1] === '\n'; - var keep = clip && (string[string.length - 2] === '\n' || string === '\n'); - var chomp = keep ? '+' : (clip ? '' : '-'); + return _context.abrupt("return", directory); - return indentIndicator + chomp + '\n'; -} + case 7: + _context.next = 13; + break; -// (See the note for writeScalar.) -function dropEndingNewline(string) { - return string[string.length - 1] === '\n' ? string.slice(0, -1) : string; -} + case 9: + _context.prev = 9; + _context.t0 = _context["catch"](0); -// Note: a long line without a suitable break point will exceed the width limit. -// Pre-conditions: every char in str isPrintable, str.length > 0, width > 0. -function foldString(string, width) { - // In folded style, $k$ consecutive newlines output as $k+1$ newlines— - // unless they're before or after a more-indented line, or at the very - // beginning or end, in which case $k$ maps to $k$. - // Therefore, parse each chunk as newline(s) followed by a content line. - var lineRe = /(\n+)([^\n]*)/g; + if (!(_context.t0.code !== "ENOENT")) { + _context.next = 13; + break; + } - // first line (possibly an empty line) - var result = (function () { - var nextLF = string.indexOf('\n'); - nextLF = nextLF !== -1 ? nextLF : string.length; - lineRe.lastIndex = nextLF; - return foldLine(string.slice(0, nextLF), width); - }()); - // If we haven't reached the first content line yet, don't add an extra \n. - var prevMoreIndented = string[0] === '\n' || string[0] === ' '; - var moreIndented; + throw _context.t0; - // rest of the lines - var match; - while ((match = lineRe.exec(string))) { - var prefix = match[1], line = match[2]; - moreIndented = (line[0] === ' '); - result += prefix - + (!prevMoreIndented && !moreIndented && line !== '' - ? '\n' : '') - + foldLine(line, width); - prevMoreIndented = moreIndented; - } + case 13: + case "end": + return _context.stop(); + } + } + }, _callee, null, [[0, 9]]); + })); + return _hasWorkspacesConfiguredViaPkgJson.apply(this, arguments); +} - return result; +function hasWorkspacesConfiguredViaLerna(_x3) { + return _hasWorkspacesConfiguredViaLerna.apply(this, arguments); } -// Greedy line breaking. -// Picks the longest line under the limit each time, -// otherwise settles for the shortest line over the limit. -// NB. More-indented lines *cannot* be folded, as that would add an extra \n. -function foldLine(line, width) { - if (line === '' || line[0] === ' ') return line; +function _hasWorkspacesConfiguredViaLerna() { + _hasWorkspacesConfiguredViaLerna = _asyncToGenerator( + /*#__PURE__*/ + _regeneratorRuntime.mark(function _callee2(directory) { + var lernaJson; + return _regeneratorRuntime.wrap(function _callee2$(_context2) { + while (1) { + switch (_context2.prev = _context2.next) { + case 0: + _context2.prev = 0; + _context2.next = 3; + return fs.readJson(path.join(directory, "lerna.json")); - // Since a more-indented line adds a \n, breaks can't be followed by a space. - var breakRe = / [^ ]/g; // note: the match index will always be <= length-2. - var match; - // start is an inclusive index. end, curr, and next are exclusive. - var start = 0, end, curr = 0, next = 0; - var result = ''; + case 3: + lernaJson = _context2.sent; - // Invariants: 0 <= start <= length-1. - // 0 <= curr <= next <= max(0, length-2). curr - start <= width. - // Inside the loop: - // A match implies length >= 2, so curr and next are <= length-2. - while ((match = breakRe.exec(line))) { - next = match.index; - // maintain invariant: curr - start <= width - if (next - start > width) { - end = (curr > start) ? curr : next; // derive end <= length-2 - result += '\n' + line.slice(start, end); - // skip the space that was output as \n - start = end + 1; // derive start <= length-1 - } - curr = next; - } + if (!(lernaJson.useWorkspaces !== true)) { + _context2.next = 6; + break; + } - // By the invariants, start <= length-1, so there is something left over. - // It is either the whole string or a part starting from non-whitespace. - result += '\n'; - // Insert a break if the remainder is too long and there is a break available. - if (line.length - start > width && curr > start) { - result += line.slice(start, curr) + '\n' + line.slice(curr + 1); - } else { - result += line.slice(start); - } + return _context2.abrupt("return", directory); - return result.slice(1); // drop extra \n joiner -} + case 6: + _context2.next = 12; + break; -// Escapes a double-quoted string. -function escapeString(string) { - var result = ''; - var char, nextChar; - var escapeSeq; + case 8: + _context2.prev = 8; + _context2.t0 = _context2["catch"](0); - for (var i = 0; i < string.length; i++) { - char = string.charCodeAt(i); - // Check for surrogate pairs (reference Unicode 3.0 section "3.7 Surrogates"). - if (char >= 0xD800 && char <= 0xDBFF/* high surrogate */) { - nextChar = string.charCodeAt(i + 1); - if (nextChar >= 0xDC00 && nextChar <= 0xDFFF/* low surrogate */) { - // Combine the surrogate pair and store it escaped. - result += encodeHex((char - 0xD800) * 0x400 + nextChar - 0xDC00 + 0x10000); - // Advance index one extra since we already used that char here. - i++; continue; + if (!(_context2.t0.code !== "ENOENT")) { + _context2.next = 12; + break; + } + + throw _context2.t0; + + case 12: + case "end": + return _context2.stop(); + } } - } - escapeSeq = ESCAPE_SEQUENCES[char]; - result += !escapeSeq && isPrintable(char) - ? string[i] - : escapeSeq || encodeHex(char); - } + }, _callee2, null, [[0, 8]]); + })); + return _hasWorkspacesConfiguredViaLerna.apply(this, arguments); +} - return result; +function hasWorkspacesConfiguredViaPnpm(_x4) { + return _hasWorkspacesConfiguredViaPnpm.apply(this, arguments); } -function writeFlowSequence(state, level, object) { - var _result = '', - _tag = state.tag, - index, - length; +function _hasWorkspacesConfiguredViaPnpm() { + _hasWorkspacesConfiguredViaPnpm = _asyncToGenerator( + /*#__PURE__*/ + _regeneratorRuntime.mark(function _callee3(directory) { + var pnpmWorkspacesFileExists; + return _regeneratorRuntime.wrap(function _callee3$(_context3) { + while (1) { + switch (_context3.prev = _context3.next) { + case 0: + _context3.next = 2; + return fs.exists(path.join(directory, "pnpm-workspace.yaml")); - for (index = 0, length = object.length; index < length; index += 1) { - // Write only valid elements. - if (writeNode(state, level, object[index], false, false)) { - if (index !== 0) _result += ',' + (!state.condenseFlow ? ' ' : ''); - _result += state.dump; - } - } + case 2: + pnpmWorkspacesFileExists = _context3.sent; - state.tag = _tag; - state.dump = '[' + _result + ']'; -} + if (!pnpmWorkspacesFileExists) { + _context3.next = 5; + break; + } -function writeBlockSequence(state, level, object, compact) { - var _result = '', - _tag = state.tag, - index, - length; + return _context3.abrupt("return", directory); - for (index = 0, length = object.length; index < length; index += 1) { - // Write only valid elements. - if (writeNode(state, level + 1, object[index], true, true)) { - if (!compact || index !== 0) { - _result += generateNextLine(state, level); + case 5: + case "end": + return _context3.stop(); + } } + }, _callee3); + })); + return _hasWorkspacesConfiguredViaPnpm.apply(this, arguments); +} - if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { - _result += '-'; - } else { - _result += '- '; - } +function findRoot(_x5) { + return _findRoot.apply(this, arguments); +} - _result += state.dump; - } - } - - state.tag = _tag; - state.dump = _result || '[]'; // Empty sequence if no valid values. -} +function _findRoot() { + _findRoot = _asyncToGenerator( + /*#__PURE__*/ + _regeneratorRuntime.mark(function _callee4(cwd) { + var firstPkgJsonDirRef, dir; + return _regeneratorRuntime.wrap(function _callee4$(_context4) { + while (1) { + switch (_context4.prev = _context4.next) { + case 0: + firstPkgJsonDirRef = { + current: undefined + }; + _context4.next = 3; + return findUp__default(function (directory) { + return Promise.all([hasWorkspacesConfiguredViaLerna(directory), hasWorkspacesConfiguredViaPkgJson(directory, firstPkgJsonDirRef), hasWorkspacesConfiguredViaPnpm(directory)]).then(function (x) { + return x.find(function (dir) { + return dir; + }); + }); + }, { + cwd: cwd, + type: "directory" + }); -function writeFlowMapping(state, level, object) { - var _result = '', - _tag = state.tag, - objectKeyList = Object.keys(object), - index, - length, - objectKey, - objectValue, - pairBuffer; + case 3: + dir = _context4.sent; - for (index = 0, length = objectKeyList.length; index < length; index += 1) { + if (!(firstPkgJsonDirRef.current === undefined)) { + _context4.next = 6; + break; + } - pairBuffer = ''; - if (index !== 0) pairBuffer += ', '; + throw new NoPkgJsonFound(cwd); - if (state.condenseFlow) pairBuffer += '"'; + case 6: + if (!(dir === undefined)) { + _context4.next = 8; + break; + } - objectKey = objectKeyList[index]; - objectValue = object[objectKey]; + return _context4.abrupt("return", firstPkgJsonDirRef.current); - if (!writeNode(state, level, objectKey, false, false)) { - continue; // Skip this pair because of invalid key; - } + case 8: + return _context4.abrupt("return", dir); - if (state.dump.length > 1024) pairBuffer += '? '; + case 9: + case "end": + return _context4.stop(); + } + } + }, _callee4); + })); + return _findRoot.apply(this, arguments); +} - pairBuffer += state.dump + (state.condenseFlow ? '"' : '') + ':' + (state.condenseFlow ? '' : ' '); +function hasWorkspacesConfiguredViaPkgJsonSync(directory, firstPkgJsonDirRef) { + try { + var pkgJson = fs.readJsonSync(path.join(directory, "package.json")); - if (!writeNode(state, level, objectValue, false, false)) { - continue; // Skip this pair because of invalid value. + if (firstPkgJsonDirRef.current === undefined) { + firstPkgJsonDirRef.current = directory; } - pairBuffer += state.dump; - - // Both key and value are valid. - _result += pairBuffer; + if (pkgJson.workspaces || pkgJson.bolt) { + return directory; + } + } catch (err) { + if (err.code !== "ENOENT") { + throw err; + } } - - state.tag = _tag; - state.dump = '{' + _result + '}'; } -function writeBlockMapping(state, level, object, compact) { - var _result = '', - _tag = state.tag, - objectKeyList = Object.keys(object), - index, - length, - objectKey, - objectValue, - explicitPair, - pairBuffer; +function hasWorkspacesConfiguredViaLernaSync(directory) { + try { + var lernaJson = fs.readJsonSync(path.join(directory, "lerna.json")); - // Allow sorting keys so that the output file is deterministic - if (state.sortKeys === true) { - // Default sorting - objectKeyList.sort(); - } else if (typeof state.sortKeys === 'function') { - // Custom sort function - objectKeyList.sort(state.sortKeys); - } else if (state.sortKeys) { - // Something is wrong - throw new YAMLException('sortKeys must be a boolean or a function'); + if (lernaJson.useWorkspaces !== true) { + return directory; + } + } catch (err) { + if (err.code !== "ENOENT") { + throw err; + } } +} - for (index = 0, length = objectKeyList.length; index < length; index += 1) { - pairBuffer = ''; +function hasWorkspacesConfiguredViaPnpmSync(directory) { + // @ts-ignore + var pnpmWorkspacesFileExists = fs.existsSync(path.join(directory, "pnpm-workspace.yaml")); - if (!compact || index !== 0) { - pairBuffer += generateNextLine(state, level); - } + if (pnpmWorkspacesFileExists) { + return directory; + } +} - objectKey = objectKeyList[index]; - objectValue = object[objectKey]; +function findRootSync(cwd) { + var firstPkgJsonDirRef = { + current: undefined + }; + var dir = findUp.sync(function (directory) { + return [hasWorkspacesConfiguredViaLernaSync(directory), hasWorkspacesConfiguredViaPkgJsonSync(directory, firstPkgJsonDirRef), hasWorkspacesConfiguredViaPnpmSync(directory)].find(function (dir) { + return dir; + }); + }, { + cwd: cwd, + type: "directory" + }); - if (!writeNode(state, level + 1, objectKey, true, true, true)) { - continue; // Skip this pair because of invalid key. - } + if (firstPkgJsonDirRef.current === undefined) { + throw new NoPkgJsonFound(cwd); + } - explicitPair = (state.tag !== null && state.tag !== '?') || - (state.dump && state.dump.length > 1024); + if (dir === undefined) { + return firstPkgJsonDirRef.current; + } - if (explicitPair) { - if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { - pairBuffer += '?'; - } else { - pairBuffer += '? '; - } - } + return dir; +} - pairBuffer += state.dump; +exports.NoPkgJsonFound = NoPkgJsonFound; +exports.findRoot = findRoot; +exports.findRootSync = findRootSync; - if (explicitPair) { - pairBuffer += generateNextLine(state, level); - } - if (!writeNode(state, level + 1, objectValue, true, explicitPair)) { - continue; // Skip this pair because of invalid value. - } +/***/ }), - if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { - pairBuffer += ':'; - } else { - pairBuffer += ': '; - } +/***/ 67805: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - pairBuffer += state.dump; +"use strict"; - // Both key and value are valid. - _result += pairBuffer; - } - state.tag = _tag; - state.dump = _result || '{}'; // Empty mapping if no valid pairs. +if (process.env.NODE_ENV === "production") { + module.exports = __nccwpck_require__(4530); +} else { + module.exports = __nccwpck_require__(44248); } -function detectType(state, object, explicit) { - var _result, typeList, index, length, type, style; - - typeList = explicit ? state.explicitTypes : state.implicitTypes; - for (index = 0, length = typeList.length; index < length; index += 1) { - type = typeList[index]; +/***/ }), - if ((type.instanceOf || type.predicate) && - (!type.instanceOf || ((typeof object === 'object') && (object instanceof type.instanceOf))) && - (!type.predicate || type.predicate(object))) { +/***/ 4530: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - state.tag = explicit ? type.tag : '?'; +"use strict"; - if (type.represent) { - style = state.styleMap[type.tag] || type.defaultStyle; - if (_toString.call(type.represent) === '[object Function]') { - _result = type.represent(object, style); - } else if (_hasOwnProperty.call(type.represent, style)) { - _result = type.represent[style](object, style); - } else { - throw new YAMLException('!<' + type.tag + '> tag resolver accepts not "' + style + '" style'); - } +function _interopDefault(ex) { + return ex && "object" == typeof ex && "default" in ex ? ex.default : ex; +} - state.dump = _result; - } +Object.defineProperty(exports, "__esModule", ({ + value: !0 +})); - return true; - } +var _regeneratorRuntime = _interopDefault(__nccwpck_require__(65907)), _asyncToGenerator = _interopDefault(__nccwpck_require__(67584)), _classCallCheck = _interopDefault(__nccwpck_require__(33446)), _possibleConstructorReturn = _interopDefault(__nccwpck_require__(83855)), _getPrototypeOf = _interopDefault(__nccwpck_require__(55989)), _inherits = _interopDefault(__nccwpck_require__(87406)), _wrapNativeSuper = _interopDefault(__nccwpck_require__(16318)), findUp = __nccwpck_require__(81179), findUp__default = _interopDefault(findUp), path = _interopDefault(__nccwpck_require__(16928)), fs = _interopDefault(__nccwpck_require__(97298)), NoPkgJsonFound = function(_Error) { + function NoPkgJsonFound(directory) { + var _this; + return _classCallCheck(this, NoPkgJsonFound), (_this = _possibleConstructorReturn(this, _getPrototypeOf(NoPkgJsonFound).call(this, "No package.json could be found upwards from the directory ".concat(directory)))).directory = directory, + _this; } + return _inherits(NoPkgJsonFound, _Error), NoPkgJsonFound; +}(_wrapNativeSuper(Error)); - return false; +function hasWorkspacesConfiguredViaPkgJson(_x, _x2) { + return _hasWorkspacesConfiguredViaPkgJson.apply(this, arguments); } -// Serializes `object` and writes it to global `result`. -// Returns true on success, or false on invalid object. -// -function writeNode(state, level, object, block, compact, iskey) { - state.tag = null; - state.dump = object; - - if (!detectType(state, object, false)) { - detectType(state, object, true); - } - - var type = _toString.call(state.dump); - - if (block) { - block = (state.flowLevel < 0 || state.flowLevel > level); - } - - var objectOrArray = type === '[object Object]' || type === '[object Array]', - duplicateIndex, - duplicate; +function _hasWorkspacesConfiguredViaPkgJson() { + return (_hasWorkspacesConfiguredViaPkgJson = _asyncToGenerator(_regeneratorRuntime.mark(function _callee(directory, firstPkgJsonDirRef) { + var pkgJson; + return _regeneratorRuntime.wrap(function(_context) { + for (;;) switch (_context.prev = _context.next) { + case 0: + return _context.prev = 0, _context.next = 3, fs.readJson(path.join(directory, "package.json")); - if (objectOrArray) { - duplicateIndex = state.duplicates.indexOf(object); - duplicate = duplicateIndex !== -1; - } + case 3: + if (pkgJson = _context.sent, void 0 === firstPkgJsonDirRef.current && (firstPkgJsonDirRef.current = directory), + !pkgJson.workspaces && !pkgJson.bolt) { + _context.next = 7; + break; + } + return _context.abrupt("return", directory); - if ((state.tag !== null && state.tag !== '?') || duplicate || (state.indent !== 2 && level > 0)) { - compact = false; - } + case 7: + _context.next = 13; + break; - if (duplicate && state.usedDuplicates[duplicateIndex]) { - state.dump = '*ref_' + duplicateIndex; - } else { - if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) { - state.usedDuplicates[duplicateIndex] = true; - } - if (type === '[object Object]') { - if (block && (Object.keys(state.dump).length !== 0)) { - writeBlockMapping(state, level, state.dump, compact); - if (duplicate) { - state.dump = '&ref_' + duplicateIndex + state.dump; - } - } else { - writeFlowMapping(state, level, state.dump); - if (duplicate) { - state.dump = '&ref_' + duplicateIndex + ' ' + state.dump; + case 9: + if (_context.prev = 9, _context.t0 = _context.catch(0), "ENOENT" === _context.t0.code) { + _context.next = 13; + break; } + throw _context.t0; + + case 13: + case "end": + return _context.stop(); } - } else if (type === '[object Array]') { - var arrayLevel = (state.noArrayIndent && (level > 0)) ? level - 1 : level; - if (block && (state.dump.length !== 0)) { - writeBlockSequence(state, arrayLevel, state.dump, compact); - if (duplicate) { - state.dump = '&ref_' + duplicateIndex + state.dump; + }, _callee, null, [ [ 0, 9 ] ]); + }))).apply(this, arguments); +} + +function hasWorkspacesConfiguredViaLerna(_x3) { + return _hasWorkspacesConfiguredViaLerna.apply(this, arguments); +} + +function _hasWorkspacesConfiguredViaLerna() { + return (_hasWorkspacesConfiguredViaLerna = _asyncToGenerator(_regeneratorRuntime.mark(function _callee2(directory) { + return _regeneratorRuntime.wrap(function(_context2) { + for (;;) switch (_context2.prev = _context2.next) { + case 0: + return _context2.prev = 0, _context2.next = 3, fs.readJson(path.join(directory, "lerna.json")); + + case 3: + if (!0 === _context2.sent.useWorkspaces) { + _context2.next = 6; + break; } - } else { - writeFlowSequence(state, arrayLevel, state.dump); - if (duplicate) { - state.dump = '&ref_' + duplicateIndex + ' ' + state.dump; + return _context2.abrupt("return", directory); + + case 6: + _context2.next = 12; + break; + + case 8: + if (_context2.prev = 8, _context2.t0 = _context2.catch(0), "ENOENT" === _context2.t0.code) { + _context2.next = 12; + break; } - } - } else if (type === '[object String]') { - if (state.tag !== '?') { - writeScalar(state, state.dump, level, iskey); - } - } else { - if (state.skipInvalid) return false; - throw new YAMLException('unacceptable kind of an object to dump ' + type); - } + throw _context2.t0; - if (state.tag !== null && state.tag !== '?') { - state.dump = '!<' + state.tag + '> ' + state.dump; - } - } + case 12: + case "end": + return _context2.stop(); + } + }, _callee2, null, [ [ 0, 8 ] ]); + }))).apply(this, arguments); +} - return true; +function hasWorkspacesConfiguredViaPnpm(_x4) { + return _hasWorkspacesConfiguredViaPnpm.apply(this, arguments); } -function getDuplicateReferences(object, state) { - var objects = [], - duplicatesIndexes = [], - index, - length; +function _hasWorkspacesConfiguredViaPnpm() { + return (_hasWorkspacesConfiguredViaPnpm = _asyncToGenerator(_regeneratorRuntime.mark(function _callee3(directory) { + return _regeneratorRuntime.wrap(function(_context3) { + for (;;) switch (_context3.prev = _context3.next) { + case 0: + return _context3.next = 2, fs.exists(path.join(directory, "pnpm-workspace.yaml")); - inspectNode(object, objects, duplicatesIndexes); + case 2: + if (!_context3.sent) { + _context3.next = 5; + break; + } + return _context3.abrupt("return", directory); - for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) { - state.duplicates.push(objects[duplicatesIndexes[index]]); - } - state.usedDuplicates = new Array(length); + case 5: + case "end": + return _context3.stop(); + } + }, _callee3); + }))).apply(this, arguments); } -function inspectNode(object, objects, duplicatesIndexes) { - var objectKeyList, - index, - length; +function findRoot(_x5) { + return _findRoot.apply(this, arguments); +} - if (object !== null && typeof object === 'object') { - index = objects.indexOf(object); - if (index !== -1) { - if (duplicatesIndexes.indexOf(index) === -1) { - duplicatesIndexes.push(index); - } - } else { - objects.push(object); +function _findRoot() { + return (_findRoot = _asyncToGenerator(_regeneratorRuntime.mark(function _callee4(cwd) { + var firstPkgJsonDirRef, dir; + return _regeneratorRuntime.wrap(function(_context4) { + for (;;) switch (_context4.prev = _context4.next) { + case 0: + return firstPkgJsonDirRef = { + current: void 0 + }, _context4.next = 3, findUp__default(function(directory) { + return Promise.all([ hasWorkspacesConfiguredViaLerna(directory), hasWorkspacesConfiguredViaPkgJson(directory, firstPkgJsonDirRef), hasWorkspacesConfiguredViaPnpm(directory) ]).then(function(x) { + return x.find(function(dir) { + return dir; + }); + }); + }, { + cwd: cwd, + type: "directory" + }); - if (Array.isArray(object)) { - for (index = 0, length = object.length; index < length; index += 1) { - inspectNode(object[index], objects, duplicatesIndexes); + case 3: + if (dir = _context4.sent, void 0 !== firstPkgJsonDirRef.current) { + _context4.next = 6; + break; } - } else { - objectKeyList = Object.keys(object); + throw new NoPkgJsonFound(cwd); - for (index = 0, length = objectKeyList.length; index < length; index += 1) { - inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes); + case 6: + if (void 0 !== dir) { + _context4.next = 8; + break; } - } - } - } -} + return _context4.abrupt("return", firstPkgJsonDirRef.current); -function dump(input, options) { - options = options || {}; + case 8: + return _context4.abrupt("return", dir); - var state = new State(options); + case 9: + case "end": + return _context4.stop(); + } + }, _callee4); + }))).apply(this, arguments); +} - if (!state.noRefs) getDuplicateReferences(input, state); +function hasWorkspacesConfiguredViaPkgJsonSync(directory, firstPkgJsonDirRef) { + try { + var pkgJson = fs.readJsonSync(path.join(directory, "package.json")); + if (void 0 === firstPkgJsonDirRef.current && (firstPkgJsonDirRef.current = directory), + pkgJson.workspaces || pkgJson.bolt) return directory; + } catch (err) { + if ("ENOENT" !== err.code) throw err; + } +} - if (writeNode(state, 0, input, true, true)) return state.dump + '\n'; +function hasWorkspacesConfiguredViaLernaSync(directory) { + try { + if (!0 !== fs.readJsonSync(path.join(directory, "lerna.json")).useWorkspaces) return directory; + } catch (err) { + if ("ENOENT" !== err.code) throw err; + } +} - return ''; +function hasWorkspacesConfiguredViaPnpmSync(directory) { + if (fs.existsSync(path.join(directory, "pnpm-workspace.yaml"))) return directory; } -function safeDump(input, options) { - return dump(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options)); +function findRootSync(cwd) { + var firstPkgJsonDirRef = { + current: void 0 + }, dir = findUp.sync(function(directory) { + return [ hasWorkspacesConfiguredViaLernaSync(directory), hasWorkspacesConfiguredViaPkgJsonSync(directory, firstPkgJsonDirRef), hasWorkspacesConfiguredViaPnpmSync(directory) ].find(function(dir) { + return dir; + }); + }, { + cwd: cwd, + type: "directory" + }); + if (void 0 === firstPkgJsonDirRef.current) throw new NoPkgJsonFound(cwd); + return void 0 === dir ? firstPkgJsonDirRef.current : dir; } -module.exports.dump = dump; -module.exports.safeDump = safeDump; +exports.NoPkgJsonFound = NoPkgJsonFound, exports.findRoot = findRoot, exports.findRootSync = findRootSync; /***/ }), -/***/ 69125: -/***/ ((module) => { +/***/ 39969: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -// YAML error class. http://stackoverflow.com/questions/8458984 -// -function YAMLException(reason, mark) { - // Super constructor - Error.call(this); +const fs = __nccwpck_require__(61404) +const path = __nccwpck_require__(16928) +const mkdirpSync = (__nccwpck_require__(20559).mkdirsSync) +const utimesSync = (__nccwpck_require__(84420).utimesMillisSync) +const stat = __nccwpck_require__(76821) - this.name = 'YAMLException'; - this.reason = reason; - this.mark = mark; - this.message = (this.reason || '(unknown reason)') + (this.mark ? ' ' + this.mark.toString() : ''); +function copySync (src, dest, opts) { + if (typeof opts === 'function') { + opts = { filter: opts } + } - // Include stack trace in error object - if (Error.captureStackTrace) { - // Chrome and NodeJS - Error.captureStackTrace(this, this.constructor); - } else { - // FF, IE 10+ and Safari 6+. Fallback for others - this.stack = (new Error()).stack || ''; + opts = opts || {} + opts.clobber = 'clobber' in opts ? !!opts.clobber : true // default to true for now + opts.overwrite = 'overwrite' in opts ? !!opts.overwrite : opts.clobber // overwrite falls back to clobber + + // Warn about using preserveTimestamps on 32-bit node + if (opts.preserveTimestamps && process.arch === 'ia32') { + console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n + see https://github.com/jprichardson/node-fs-extra/issues/269`) } + + const { srcStat, destStat } = stat.checkPathsSync(src, dest, 'copy') + stat.checkParentPathsSync(src, srcStat, dest, 'copy') + return handleFilterAndCopy(destStat, src, dest, opts) } +function handleFilterAndCopy (destStat, src, dest, opts) { + if (opts.filter && !opts.filter(src, dest)) return + const destParent = path.dirname(dest) + if (!fs.existsSync(destParent)) mkdirpSync(destParent) + return startCopy(destStat, src, dest, opts) +} -// Inherit from Error -YAMLException.prototype = Object.create(Error.prototype); -YAMLException.prototype.constructor = YAMLException; +function startCopy (destStat, src, dest, opts) { + if (opts.filter && !opts.filter(src, dest)) return + return getStats(destStat, src, dest, opts) +} +function getStats (destStat, src, dest, opts) { + const statSync = opts.dereference ? fs.statSync : fs.lstatSync + const srcStat = statSync(src) -YAMLException.prototype.toString = function toString(compact) { - var result = this.name + ': '; + if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts) + else if (srcStat.isFile() || + srcStat.isCharacterDevice() || + srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts) + else if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts) +} - result += this.reason || '(unknown reason)'; +function onFile (srcStat, destStat, src, dest, opts) { + if (!destStat) return copyFile(srcStat, src, dest, opts) + return mayCopyFile(srcStat, src, dest, opts) +} - if (!compact && this.mark) { - result += ' ' + this.mark.toString(); +function mayCopyFile (srcStat, src, dest, opts) { + if (opts.overwrite) { + fs.unlinkSync(dest) + return copyFile(srcStat, src, dest, opts) + } else if (opts.errorOnExist) { + throw new Error(`'${dest}' already exists`) } +} - return result; -}; +function copyFile (srcStat, src, dest, opts) { + if (typeof fs.copyFileSync === 'function') { + fs.copyFileSync(src, dest) + fs.chmodSync(dest, srcStat.mode) + if (opts.preserveTimestamps) { + return utimesSync(dest, srcStat.atime, srcStat.mtime) + } + return + } + return copyFileFallback(srcStat, src, dest, opts) +} +function copyFileFallback (srcStat, src, dest, opts) { + const BUF_LENGTH = 64 * 1024 + const _buff = __nccwpck_require__(26445)(BUF_LENGTH) -module.exports = YAMLException; + const fdr = fs.openSync(src, 'r') + const fdw = fs.openSync(dest, 'w', srcStat.mode) + let pos = 0 + while (pos < srcStat.size) { + const bytesRead = fs.readSync(fdr, _buff, 0, BUF_LENGTH, pos) + fs.writeSync(fdw, _buff, 0, bytesRead) + pos += bytesRead + } -/***/ }), + if (opts.preserveTimestamps) fs.futimesSync(fdw, srcStat.atime, srcStat.mtime) -/***/ 61977: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + fs.closeSync(fdr) + fs.closeSync(fdw) +} -"use strict"; +function onDir (srcStat, destStat, src, dest, opts) { + if (!destStat) return mkDirAndCopy(srcStat, src, dest, opts) + if (destStat && !destStat.isDirectory()) { + throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`) + } + return copyDir(src, dest, opts) +} +function mkDirAndCopy (srcStat, src, dest, opts) { + fs.mkdirSync(dest) + copyDir(src, dest, opts) + return fs.chmodSync(dest, srcStat.mode) +} -/*eslint-disable max-len,no-use-before-define*/ +function copyDir (src, dest, opts) { + fs.readdirSync(src).forEach(item => copyDirItem(item, src, dest, opts)) +} -var common = __nccwpck_require__(99999); -var YAMLException = __nccwpck_require__(69125); -var Mark = __nccwpck_require__(28227); -var DEFAULT_SAFE_SCHEMA = __nccwpck_require__(22919); -var DEFAULT_FULL_SCHEMA = __nccwpck_require__(17587); +function copyDirItem (item, src, dest, opts) { + const srcItem = path.join(src, item) + const destItem = path.join(dest, item) + const { destStat } = stat.checkPathsSync(srcItem, destItem, 'copy') + return startCopy(destStat, srcItem, destItem, opts) +} +function onLink (destStat, src, dest, opts) { + let resolvedSrc = fs.readlinkSync(src) + if (opts.dereference) { + resolvedSrc = path.resolve(process.cwd(), resolvedSrc) + } -var _hasOwnProperty = Object.prototype.hasOwnProperty; + if (!destStat) { + return fs.symlinkSync(resolvedSrc, dest) + } else { + let resolvedDest + try { + resolvedDest = fs.readlinkSync(dest) + } catch (err) { + // dest exists and is a regular file or directory, + // Windows may throw UNKNOWN error. If dest already exists, + // fs throws error anyway, so no need to guard against it here. + if (err.code === 'EINVAL' || err.code === 'UNKNOWN') return fs.symlinkSync(resolvedSrc, dest) + throw err + } + 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}'.`) + } + // prevent copy if src is a subdir of dest since unlinking + // dest in this case would result in removing src contents + // and therefore a broken symlink would be created. + if (fs.statSync(dest).isDirectory() && stat.isSrcSubdir(resolvedDest, resolvedSrc)) { + throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`) + } + return copyLink(resolvedSrc, dest) + } +} -var CONTEXT_FLOW_IN = 1; -var CONTEXT_FLOW_OUT = 2; -var CONTEXT_BLOCK_IN = 3; -var CONTEXT_BLOCK_OUT = 4; +function copyLink (resolvedSrc, dest) { + fs.unlinkSync(dest) + return fs.symlinkSync(resolvedSrc, dest) +} +module.exports = copySync -var CHOMPING_CLIP = 1; -var CHOMPING_STRIP = 2; -var CHOMPING_KEEP = 3; +/***/ }), -var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; -var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/; -var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/; -var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i; -var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i; +/***/ 52726: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +"use strict"; -function _class(obj) { return Object.prototype.toString.call(obj); } -function is_EOL(c) { - return (c === 0x0A/* LF */) || (c === 0x0D/* CR */); +module.exports = { + copySync: __nccwpck_require__(39969) } -function is_WHITE_SPACE(c) { - return (c === 0x09/* Tab */) || (c === 0x20/* Space */); -} -function is_WS_OR_EOL(c) { - return (c === 0x09/* Tab */) || - (c === 0x20/* Space */) || - (c === 0x0A/* LF */) || - (c === 0x0D/* CR */); -} +/***/ }), -function is_FLOW_INDICATOR(c) { - return c === 0x2C/* , */ || - c === 0x5B/* [ */ || - c === 0x5D/* ] */ || - c === 0x7B/* { */ || - c === 0x7D/* } */; -} +/***/ 76137: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -function fromHexCode(c) { - var lc; +"use strict"; - if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { - return c - 0x30; - } - /*eslint-disable no-bitwise*/ - lc = c | 0x20; +const fs = __nccwpck_require__(61404) +const path = __nccwpck_require__(16928) +const mkdirp = (__nccwpck_require__(20559).mkdirs) +const pathExists = (__nccwpck_require__(85615).pathExists) +const utimes = (__nccwpck_require__(84420).utimesMillis) +const stat = __nccwpck_require__(76821) - if ((0x61/* a */ <= lc) && (lc <= 0x66/* f */)) { - return lc - 0x61 + 10; +function copy (src, dest, opts, cb) { + if (typeof opts === 'function' && !cb) { + cb = opts + opts = {} + } else if (typeof opts === 'function') { + opts = { filter: opts } } - return -1; -} + cb = cb || function () {} + opts = opts || {} -function escapedHexLen(c) { - if (c === 0x78/* x */) { return 2; } - if (c === 0x75/* u */) { return 4; } - if (c === 0x55/* U */) { return 8; } - return 0; -} + opts.clobber = 'clobber' in opts ? !!opts.clobber : true // default to true for now + opts.overwrite = 'overwrite' in opts ? !!opts.overwrite : opts.clobber // overwrite falls back to clobber -function fromDecimalCode(c) { - if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { - return c - 0x30; + // Warn about using preserveTimestamps on 32-bit node + if (opts.preserveTimestamps && process.arch === 'ia32') { + console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n + see https://github.com/jprichardson/node-fs-extra/issues/269`) } - return -1; -} - -function simpleEscapeSequence(c) { - /* eslint-disable indent */ - return (c === 0x30/* 0 */) ? '\x00' : - (c === 0x61/* a */) ? '\x07' : - (c === 0x62/* b */) ? '\x08' : - (c === 0x74/* t */) ? '\x09' : - (c === 0x09/* Tab */) ? '\x09' : - (c === 0x6E/* n */) ? '\x0A' : - (c === 0x76/* v */) ? '\x0B' : - (c === 0x66/* f */) ? '\x0C' : - (c === 0x72/* r */) ? '\x0D' : - (c === 0x65/* e */) ? '\x1B' : - (c === 0x20/* Space */) ? ' ' : - (c === 0x22/* " */) ? '\x22' : - (c === 0x2F/* / */) ? '/' : - (c === 0x5C/* \ */) ? '\x5C' : - (c === 0x4E/* N */) ? '\x85' : - (c === 0x5F/* _ */) ? '\xA0' : - (c === 0x4C/* L */) ? '\u2028' : - (c === 0x50/* P */) ? '\u2029' : ''; + stat.checkPaths(src, dest, 'copy', (err, stats) => { + if (err) return cb(err) + const { srcStat, destStat } = stats + stat.checkParentPaths(src, srcStat, dest, 'copy', err => { + if (err) return cb(err) + if (opts.filter) return handleFilter(checkParentDir, destStat, src, dest, opts, cb) + return checkParentDir(destStat, src, dest, opts, cb) + }) + }) } -function charFromCodepoint(c) { - if (c <= 0xFFFF) { - return String.fromCharCode(c); - } - // Encode UTF-16 surrogate pair - // https://en.wikipedia.org/wiki/UTF-16#Code_points_U.2B010000_to_U.2B10FFFF - return String.fromCharCode( - ((c - 0x010000) >> 10) + 0xD800, - ((c - 0x010000) & 0x03FF) + 0xDC00 - ); +function checkParentDir (destStat, src, dest, opts, cb) { + const destParent = path.dirname(dest) + pathExists(destParent, (err, dirExists) => { + if (err) return cb(err) + if (dirExists) return startCopy(destStat, src, dest, opts, cb) + mkdirp(destParent, err => { + if (err) return cb(err) + return startCopy(destStat, src, dest, opts, cb) + }) + }) } -var simpleEscapeCheck = new Array(256); // integer, for fast access -var simpleEscapeMap = new Array(256); -for (var i = 0; i < 256; i++) { - simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0; - simpleEscapeMap[i] = simpleEscapeSequence(i); +function handleFilter (onInclude, destStat, src, dest, opts, cb) { + Promise.resolve(opts.filter(src, dest)).then(include => { + if (include) return onInclude(destStat, src, dest, opts, cb) + return cb() + }, error => cb(error)) } +function startCopy (destStat, src, dest, opts, cb) { + if (opts.filter) return handleFilter(getStats, destStat, src, dest, opts, cb) + return getStats(destStat, src, dest, opts, cb) +} -function State(input, options) { - this.input = input; - - this.filename = options['filename'] || null; - this.schema = options['schema'] || DEFAULT_FULL_SCHEMA; - this.onWarning = options['onWarning'] || null; - this.legacy = options['legacy'] || false; - this.json = options['json'] || false; - this.listener = options['listener'] || null; - - this.implicitTypes = this.schema.compiledImplicit; - this.typeMap = this.schema.compiledTypeMap; - - this.length = input.length; - this.position = 0; - this.line = 0; - this.lineStart = 0; - this.lineIndent = 0; +function getStats (destStat, src, dest, opts, cb) { + const stat = opts.dereference ? fs.stat : fs.lstat + stat(src, (err, srcStat) => { + if (err) return cb(err) - this.documents = []; + 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) + }) +} - /* - this.version; - this.checkLineBreaks; - this.tagMap; - this.anchorMap; - this.tag; - this.anchor; - this.kind; - this.result;*/ +function onFile (srcStat, destStat, src, dest, opts, cb) { + if (!destStat) return copyFile(srcStat, src, dest, opts, cb) + return mayCopyFile(srcStat, src, dest, opts, cb) +} +function mayCopyFile (srcStat, src, dest, opts, cb) { + if (opts.overwrite) { + fs.unlink(dest, err => { + if (err) return cb(err) + return copyFile(srcStat, src, dest, opts, cb) + }) + } else if (opts.errorOnExist) { + return cb(new Error(`'${dest}' already exists`)) + } else return cb() } +function copyFile (srcStat, src, dest, opts, cb) { + if (typeof fs.copyFile === 'function') { + return fs.copyFile(src, dest, err => { + if (err) return cb(err) + return setDestModeAndTimestamps(srcStat, dest, opts, cb) + }) + } + return copyFileFallback(srcStat, src, dest, opts, cb) +} -function generateError(state, message) { - return new YAMLException( - message, - new Mark(state.filename, state.input, state.position, state.line, (state.position - state.lineStart))); +function copyFileFallback (srcStat, src, dest, opts, cb) { + const rs = fs.createReadStream(src) + rs.on('error', err => cb(err)).once('open', () => { + const ws = fs.createWriteStream(dest, { mode: srcStat.mode }) + ws.on('error', err => cb(err)) + .on('open', () => rs.pipe(ws)) + .once('close', () => setDestModeAndTimestamps(srcStat, dest, opts, cb)) + }) } -function throwError(state, message) { - throw generateError(state, message); +function setDestModeAndTimestamps (srcStat, dest, opts, cb) { + fs.chmod(dest, srcStat.mode, err => { + if (err) return cb(err) + if (opts.preserveTimestamps) { + return utimes(dest, srcStat.atime, srcStat.mtime, cb) + } + return cb() + }) } -function throwWarning(state, message) { - if (state.onWarning) { - state.onWarning.call(null, generateError(state, message)); +function onDir (srcStat, destStat, src, dest, opts, cb) { + if (!destStat) return mkDirAndCopy(srcStat, src, dest, opts, cb) + if (destStat && !destStat.isDirectory()) { + return cb(new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`)) } + return copyDir(src, dest, opts, cb) } +function mkDirAndCopy (srcStat, src, dest, opts, cb) { + fs.mkdir(dest, err => { + if (err) return cb(err) + copyDir(src, dest, opts, err => { + if (err) return cb(err) + return fs.chmod(dest, srcStat.mode, cb) + }) + }) +} -var directiveHandlers = { - - YAML: function handleYamlDirective(state, name, args) { +function copyDir (src, dest, opts, cb) { + fs.readdir(src, (err, items) => { + if (err) return cb(err) + return copyDirItems(items, src, dest, opts, cb) + }) +} - var match, major, minor; +function copyDirItems (items, src, dest, opts, cb) { + const item = items.pop() + if (!item) return cb() + return copyDirItem(items, item, src, dest, opts, cb) +} - if (state.version !== null) { - throwError(state, 'duplication of %YAML directive'); - } +function copyDirItem (items, item, src, dest, opts, cb) { + const srcItem = path.join(src, item) + const destItem = path.join(dest, item) + stat.checkPaths(srcItem, destItem, 'copy', (err, stats) => { + if (err) return cb(err) + const { destStat } = stats + startCopy(destStat, srcItem, destItem, opts, err => { + if (err) return cb(err) + return copyDirItems(items, src, dest, opts, cb) + }) + }) +} - if (args.length !== 1) { - throwError(state, 'YAML directive accepts exactly one argument'); +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) } - match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]); + if (!destStat) { + return fs.symlink(resolvedSrc, dest, cb) + } else { + fs.readlink(dest, (err, resolvedDest) => { + if (err) { + // dest exists and is a regular file or directory, + // Windows may throw UNKNOWN error. If dest already exists, + // fs throws error anyway, so no need to guard against it here. + if (err.code === 'EINVAL' || err.code === 'UNKNOWN') return fs.symlink(resolvedSrc, dest, cb) + return cb(err) + } + 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 (match === null) { - throwError(state, 'ill-formed argument of the YAML directive'); + // do not copy if src is a subdir of dest since unlinking + // dest in this case would result in removing src contents + // and therefore a broken symlink would be created. + if (destStat.isDirectory() && stat.isSrcSubdir(resolvedDest, resolvedSrc)) { + return cb(new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`)) + } + return copyLink(resolvedSrc, dest, cb) + }) } + }) +} - major = parseInt(match[1], 10); - minor = parseInt(match[2], 10); - - if (major !== 1) { - throwError(state, 'unacceptable YAML version of the document'); - } +function copyLink (resolvedSrc, dest, cb) { + fs.unlink(dest, err => { + if (err) return cb(err) + return fs.symlink(resolvedSrc, dest, cb) + }) +} - state.version = args[0]; - state.checkLineBreaks = (minor < 2); +module.exports = copy - if (minor !== 1 && minor !== 2) { - throwWarning(state, 'unsupported YAML version of the document'); - } - }, - TAG: function handleTagDirective(state, name, args) { +/***/ }), - var handle, prefix; +/***/ 61454: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - if (args.length !== 2) { - throwError(state, 'TAG directive accepts exactly two arguments'); - } +"use strict"; - handle = args[0]; - prefix = args[1]; - if (!PATTERN_TAG_HANDLE.test(handle)) { - throwError(state, 'ill-formed tag handle (first argument) of the TAG directive'); - } - - if (_hasOwnProperty.call(state.tagMap, handle)) { - throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle'); - } - - if (!PATTERN_TAG_URI.test(prefix)) { - throwError(state, 'ill-formed tag prefix (second argument) of the TAG directive'); - } - - state.tagMap[handle] = prefix; - } -}; +const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) +module.exports = { + copy: u(__nccwpck_require__(76137)) +} -function captureSegment(state, start, end, checkJson) { - var _position, _length, _character, _result; +/***/ }), - if (start < end) { - _result = state.input.slice(start, end); +/***/ 50312: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - if (checkJson) { - for (_position = 0, _length = _result.length; _position < _length; _position += 1) { - _character = _result.charCodeAt(_position); - if (!(_character === 0x09 || - (0x20 <= _character && _character <= 0x10FFFF))) { - throwError(state, 'expected valid JSON character'); - } - } - } else if (PATTERN_NON_PRINTABLE.test(_result)) { - throwError(state, 'the stream contains non-printable characters'); - } +"use strict"; - state.result += _result; - } -} -function mergeMappings(state, destination, source, overridableKeys) { - var sourceKeys, key, index, quantity; +const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) +const fs = __nccwpck_require__(61404) +const path = __nccwpck_require__(16928) +const mkdir = __nccwpck_require__(20559) +const remove = __nccwpck_require__(75419) - if (!common.isObject(source)) { - throwError(state, 'cannot merge mappings; the provided source object is unacceptable'); - } +const emptyDir = u(function emptyDir (dir, callback) { + callback = callback || function () {} + fs.readdir(dir, (err, items) => { + if (err) return mkdir.mkdirs(dir, callback) - sourceKeys = Object.keys(source); + items = items.map(item => path.join(dir, item)) - for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) { - key = sourceKeys[index]; + deleteItem() - if (!_hasOwnProperty.call(destination, key)) { - destination[key] = source[key]; - overridableKeys[key] = true; + function deleteItem () { + const item = items.pop() + if (!item) return callback() + remove.remove(item, err => { + if (err) return callback(err) + deleteItem() + }) } + }) +}) + +function emptyDirSync (dir) { + let items + try { + items = fs.readdirSync(dir) + } catch (err) { + return mkdir.mkdirsSync(dir) } -} -function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startPos) { - var index, quantity; + items.forEach(item => { + item = path.join(dir, item) + remove.removeSync(item) + }) +} - // The output is a plain object here, so keys can only be strings. - // We need to convert keyNode to a string, but doing so can hang the process - // (deeply nested arrays that explode exponentially using aliases). - if (Array.isArray(keyNode)) { - keyNode = Array.prototype.slice.call(keyNode); +module.exports = { + emptyDirSync, + emptydirSync: emptyDirSync, + emptyDir, + emptydir: emptyDir +} - for (index = 0, quantity = keyNode.length; index < quantity; index += 1) { - if (Array.isArray(keyNode[index])) { - throwError(state, 'nested arrays are not supported inside keys'); - } - if (typeof keyNode === 'object' && _class(keyNode[index]) === '[object Object]') { - keyNode[index] = '[object Object]'; - } - } - } +/***/ }), - // Avoid code execution in load() via toString property - // (still use its own toString for arrays, timestamps, - // and whatever user schema extensions happen to have @@toStringTag) - if (typeof keyNode === 'object' && _class(keyNode) === '[object Object]') { - keyNode = '[object Object]'; - } +/***/ 90403: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +"use strict"; - keyNode = String(keyNode); - if (_result === null) { - _result = {}; - } +const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) +const path = __nccwpck_require__(16928) +const fs = __nccwpck_require__(61404) +const mkdir = __nccwpck_require__(20559) +const pathExists = (__nccwpck_require__(85615).pathExists) - if (keyTag === 'tag:yaml.org,2002:merge') { - if (Array.isArray(valueNode)) { - for (index = 0, quantity = valueNode.length; index < quantity; index += 1) { - mergeMappings(state, _result, valueNode[index], overridableKeys); - } - } else { - mergeMappings(state, _result, valueNode, overridableKeys); - } - } else { - if (!state.json && - !_hasOwnProperty.call(overridableKeys, keyNode) && - _hasOwnProperty.call(_result, keyNode)) { - state.line = startLine || state.line; - state.position = startPos || state.position; - throwError(state, 'duplicated mapping key'); - } - _result[keyNode] = valueNode; - delete overridableKeys[keyNode]; +function createFile (file, callback) { + function makeFile () { + fs.writeFile(file, '', err => { + if (err) return callback(err) + callback() + }) } - return _result; + fs.stat(file, (err, stats) => { // eslint-disable-line handle-callback-err + if (!err && stats.isFile()) return callback() + const dir = path.dirname(file) + pathExists(dir, (err, dirExists) => { + if (err) return callback(err) + if (dirExists) return makeFile() + mkdir.mkdirs(dir, err => { + if (err) return callback(err) + makeFile() + }) + }) + }) } -function readLineBreak(state) { - var ch; - - ch = state.input.charCodeAt(state.position); +function createFileSync (file) { + let stats + try { + stats = fs.statSync(file) + } catch (e) {} + if (stats && stats.isFile()) return - if (ch === 0x0A/* LF */) { - state.position++; - } else if (ch === 0x0D/* CR */) { - state.position++; - if (state.input.charCodeAt(state.position) === 0x0A/* LF */) { - state.position++; - } - } else { - throwError(state, 'a line break is expected'); + const dir = path.dirname(file) + if (!fs.existsSync(dir)) { + mkdir.mkdirsSync(dir) } - state.line += 1; - state.lineStart = state.position; + fs.writeFileSync(file, '') } -function skipSeparationSpace(state, allowComments, checkIndent) { - var lineBreaks = 0, - ch = state.input.charCodeAt(state.position); +module.exports = { + createFile: u(createFile), + createFileSync +} - while (ch !== 0) { - while (is_WHITE_SPACE(ch)) { - ch = state.input.charCodeAt(++state.position); - } - if (allowComments && ch === 0x23/* # */) { - do { - ch = state.input.charCodeAt(++state.position); - } while (ch !== 0x0A/* LF */ && ch !== 0x0D/* CR */ && ch !== 0); - } +/***/ }), - if (is_EOL(ch)) { - readLineBreak(state); +/***/ 70785: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - ch = state.input.charCodeAt(state.position); - lineBreaks++; - state.lineIndent = 0; +"use strict"; - while (ch === 0x20/* Space */) { - state.lineIndent++; - ch = state.input.charCodeAt(++state.position); - } - } else { - break; - } - } - if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) { - throwWarning(state, 'deficient indentation'); - } +const file = __nccwpck_require__(90403) +const link = __nccwpck_require__(47421) +const symlink = __nccwpck_require__(8318) - return lineBreaks; +module.exports = { + // file + createFile: file.createFile, + createFileSync: file.createFileSync, + ensureFile: file.createFile, + ensureFileSync: file.createFileSync, + // link + createLink: link.createLink, + createLinkSync: link.createLinkSync, + ensureLink: link.createLink, + ensureLinkSync: link.createLinkSync, + // symlink + createSymlink: symlink.createSymlink, + createSymlinkSync: symlink.createSymlinkSync, + ensureSymlink: symlink.createSymlink, + ensureSymlinkSync: symlink.createSymlinkSync } -function testDocumentSeparator(state) { - var _position = state.position, - ch; - ch = state.input.charCodeAt(_position); +/***/ }), - // Condition state.position === state.lineStart is tested - // in parent on each call, for efficiency. No needs to test here again. - if ((ch === 0x2D/* - */ || ch === 0x2E/* . */) && - ch === state.input.charCodeAt(_position + 1) && - ch === state.input.charCodeAt(_position + 2)) { +/***/ 47421: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - _position += 3; - - ch = state.input.charCodeAt(_position); +"use strict"; - if (ch === 0 || is_WS_OR_EOL(ch)) { - return true; - } - } - return false; -} +const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) +const path = __nccwpck_require__(16928) +const fs = __nccwpck_require__(61404) +const mkdir = __nccwpck_require__(20559) +const pathExists = (__nccwpck_require__(85615).pathExists) -function writeFoldedLines(state, count) { - if (count === 1) { - state.result += ' '; - } else if (count > 1) { - state.result += common.repeat('\n', count - 1); +function createLink (srcpath, dstpath, callback) { + function makeLink (srcpath, dstpath) { + fs.link(srcpath, dstpath, err => { + if (err) return callback(err) + callback(null) + }) } -} + pathExists(dstpath, (err, destinationExists) => { + if (err) return callback(err) + if (destinationExists) return callback(null) + fs.lstat(srcpath, (err) => { + if (err) { + err.message = err.message.replace('lstat', 'ensureLink') + return callback(err) + } -function readPlainScalar(state, nodeIndent, withinFlowCollection) { - var preceding, - following, - captureStart, - captureEnd, - hasPendingContent, - _line, - _lineStart, - _lineIndent, - _kind = state.kind, - _result = state.result, - ch; + const dir = path.dirname(dstpath) + pathExists(dir, (err, dirExists) => { + if (err) return callback(err) + if (dirExists) return makeLink(srcpath, dstpath) + mkdir.mkdirs(dir, err => { + if (err) return callback(err) + makeLink(srcpath, dstpath) + }) + }) + }) + }) +} - ch = state.input.charCodeAt(state.position); +function createLinkSync (srcpath, dstpath) { + const destinationExists = fs.existsSync(dstpath) + if (destinationExists) return undefined - if (is_WS_OR_EOL(ch) || - is_FLOW_INDICATOR(ch) || - ch === 0x23/* # */ || - ch === 0x26/* & */ || - ch === 0x2A/* * */ || - ch === 0x21/* ! */ || - ch === 0x7C/* | */ || - ch === 0x3E/* > */ || - ch === 0x27/* ' */ || - ch === 0x22/* " */ || - ch === 0x25/* % */ || - ch === 0x40/* @ */ || - ch === 0x60/* ` */) { - return false; + try { + fs.lstatSync(srcpath) + } catch (err) { + err.message = err.message.replace('lstat', 'ensureLink') + throw err } - if (ch === 0x3F/* ? */ || ch === 0x2D/* - */) { - following = state.input.charCodeAt(state.position + 1); + const dir = path.dirname(dstpath) + const dirExists = fs.existsSync(dir) + if (dirExists) return fs.linkSync(srcpath, dstpath) + mkdir.mkdirsSync(dir) - if (is_WS_OR_EOL(following) || - withinFlowCollection && is_FLOW_INDICATOR(following)) { - return false; - } - } + return fs.linkSync(srcpath, dstpath) +} - state.kind = 'scalar'; - state.result = ''; - captureStart = captureEnd = state.position; - hasPendingContent = false; +module.exports = { + createLink: u(createLink), + createLinkSync +} - while (ch !== 0) { - if (ch === 0x3A/* : */) { - following = state.input.charCodeAt(state.position + 1); - if (is_WS_OR_EOL(following) || - withinFlowCollection && is_FLOW_INDICATOR(following)) { - break; - } +/***/ }), - } else if (ch === 0x23/* # */) { - preceding = state.input.charCodeAt(state.position - 1); +/***/ 51923: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - if (is_WS_OR_EOL(preceding)) { - break; - } +"use strict"; - } else if ((state.position === state.lineStart && testDocumentSeparator(state)) || - withinFlowCollection && is_FLOW_INDICATOR(ch)) { - break; - } else if (is_EOL(ch)) { - _line = state.line; - _lineStart = state.lineStart; - _lineIndent = state.lineIndent; - skipSeparationSpace(state, false, -1); +const path = __nccwpck_require__(16928) +const fs = __nccwpck_require__(61404) +const pathExists = (__nccwpck_require__(85615).pathExists) - if (state.lineIndent >= nodeIndent) { - hasPendingContent = true; - ch = state.input.charCodeAt(state.position); - continue; +/** + * Function that returns two types of paths, one relative to symlink, and one + * relative to the current working directory. Checks if path is absolute or + * relative. If the path is relative, this function checks if the path is + * relative to symlink or relative to current working directory. This is an + * initiative to find a smarter `srcpath` to supply when building symlinks. + * This allows you to determine which path to use out of one of three possible + * types of source paths. The first is an absolute path. This is detected by + * `path.isAbsolute()`. When an absolute path is provided, it is checked to + * see if it exists. If it does it's used, if not an error is returned + * (callback)/ thrown (sync). The other two options for `srcpath` are a + * relative url. By default Node's `fs.symlink` works by creating a symlink + * using `dstpath` and expects the `srcpath` to be relative to the newly + * created symlink. If you provide a `srcpath` that does not exist on the file + * system it results in a broken symlink. To minimize this, the function + * checks to see if the 'relative to symlink' source file exists, and if it + * does it will use it. If it does not, it checks if there's a file that + * exists that is relative to the current working directory, if does its used. + * This preserves the expectations of the original fs.symlink spec and adds + * the ability to pass in `relative to current working direcotry` paths. + */ + +function symlinkPaths (srcpath, dstpath, callback) { + if (path.isAbsolute(srcpath)) { + return fs.lstat(srcpath, (err) => { + if (err) { + err.message = err.message.replace('lstat', 'ensureSymlink') + return callback(err) + } + return callback(null, { + 'toCwd': srcpath, + 'toDst': srcpath + }) + }) + } else { + const dstdir = path.dirname(dstpath) + const relativeToDst = path.join(dstdir, srcpath) + return pathExists(relativeToDst, (err, exists) => { + if (err) return callback(err) + if (exists) { + return callback(null, { + 'toCwd': relativeToDst, + 'toDst': srcpath + }) } else { - state.position = captureEnd; - state.line = _line; - state.lineStart = _lineStart; - state.lineIndent = _lineIndent; - break; + return fs.lstat(srcpath, (err) => { + if (err) { + err.message = err.message.replace('lstat', 'ensureSymlink') + return callback(err) + } + return callback(null, { + 'toCwd': srcpath, + 'toDst': path.relative(dstdir, srcpath) + }) + }) } - } + }) + } +} - if (hasPendingContent) { - captureSegment(state, captureStart, captureEnd, false); - writeFoldedLines(state, state.line - _line); - captureStart = captureEnd = state.position; - hasPendingContent = false; +function symlinkPathsSync (srcpath, dstpath) { + let exists + if (path.isAbsolute(srcpath)) { + exists = fs.existsSync(srcpath) + if (!exists) throw new Error('absolute srcpath does not exist') + return { + 'toCwd': srcpath, + 'toDst': srcpath } - - if (!is_WHITE_SPACE(ch)) { - captureEnd = state.position + 1; + } 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) + } } - - ch = state.input.charCodeAt(++state.position); } +} - captureSegment(state, captureStart, captureEnd, false); +module.exports = { + symlinkPaths, + symlinkPathsSync +} - if (state.result) { - return true; - } - state.kind = _kind; - state.result = _result; - return false; -} +/***/ }), -function readSingleQuotedScalar(state, nodeIndent) { - var ch, - captureStart, captureEnd; +/***/ 87303: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - ch = state.input.charCodeAt(state.position); +"use strict"; - if (ch !== 0x27/* ' */) { - return false; - } - state.kind = 'scalar'; - state.result = ''; - state.position++; - captureStart = captureEnd = state.position; - - while ((ch = state.input.charCodeAt(state.position)) !== 0) { - if (ch === 0x27/* ' */) { - captureSegment(state, captureStart, state.position, true); - ch = state.input.charCodeAt(++state.position); - - if (ch === 0x27/* ' */) { - captureStart = state.position; - state.position++; - captureEnd = state.position; - } else { - return true; - } +const fs = __nccwpck_require__(61404) - } else if (is_EOL(ch)) { - captureSegment(state, captureStart, captureEnd, true); - writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); - captureStart = captureEnd = state.position; +function symlinkType (srcpath, type, callback) { + callback = (typeof type === 'function') ? type : callback + type = (typeof type === 'function') ? false : type + if (type) return callback(null, type) + fs.lstat(srcpath, (err, stats) => { + if (err) return callback(null, 'file') + type = (stats && stats.isDirectory()) ? 'dir' : 'file' + callback(null, type) + }) +} - } else if (state.position === state.lineStart && testDocumentSeparator(state)) { - throwError(state, 'unexpected end of the document within a single quoted scalar'); +function symlinkTypeSync (srcpath, type) { + let stats - } else { - state.position++; - captureEnd = state.position; - } + if (type) return type + try { + stats = fs.lstatSync(srcpath) + } catch (e) { + return 'file' } + return (stats && stats.isDirectory()) ? 'dir' : 'file' +} - throwError(state, 'unexpected end of the stream within a single quoted scalar'); +module.exports = { + symlinkType, + symlinkTypeSync } -function readDoubleQuotedScalar(state, nodeIndent) { - var captureStart, - captureEnd, - hexLength, - hexResult, - tmp, - ch; - ch = state.input.charCodeAt(state.position); +/***/ }), - if (ch !== 0x22/* " */) { - return false; - } +/***/ 8318: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - state.kind = 'scalar'; - state.result = ''; - state.position++; - captureStart = captureEnd = state.position; +"use strict"; - while ((ch = state.input.charCodeAt(state.position)) !== 0) { - if (ch === 0x22/* " */) { - captureSegment(state, captureStart, state.position, true); - state.position++; - return true; - } else if (ch === 0x5C/* \ */) { - captureSegment(state, captureStart, state.position, true); - ch = state.input.charCodeAt(++state.position); +const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) +const path = __nccwpck_require__(16928) +const fs = __nccwpck_require__(61404) +const _mkdirs = __nccwpck_require__(20559) +const mkdirs = _mkdirs.mkdirs +const mkdirsSync = _mkdirs.mkdirsSync - if (is_EOL(ch)) { - skipSeparationSpace(state, false, nodeIndent); +const _symlinkPaths = __nccwpck_require__(51923) +const symlinkPaths = _symlinkPaths.symlinkPaths +const symlinkPathsSync = _symlinkPaths.symlinkPathsSync - // TODO: rework to inline fn with no type cast? - } else if (ch < 256 && simpleEscapeCheck[ch]) { - state.result += simpleEscapeMap[ch]; - state.position++; +const _symlinkType = __nccwpck_require__(87303) +const symlinkType = _symlinkType.symlinkType +const symlinkTypeSync = _symlinkType.symlinkTypeSync - } else if ((tmp = escapedHexLen(ch)) > 0) { - hexLength = tmp; - hexResult = 0; +const pathExists = (__nccwpck_require__(85615).pathExists) - for (; hexLength > 0; hexLength--) { - ch = state.input.charCodeAt(++state.position); +function createSymlink (srcpath, dstpath, type, callback) { + callback = (typeof type === 'function') ? type : callback + type = (typeof type === 'function') ? false : type - if ((tmp = fromHexCode(ch)) >= 0) { - hexResult = (hexResult << 4) + tmp; + pathExists(dstpath, (err, destinationExists) => { + if (err) return callback(err) + if (destinationExists) return callback(null) + symlinkPaths(srcpath, dstpath, (err, relative) => { + if (err) return callback(err) + srcpath = relative.toDst + symlinkType(relative.toCwd, type, (err, type) => { + if (err) return callback(err) + const dir = path.dirname(dstpath) + pathExists(dir, (err, dirExists) => { + if (err) return callback(err) + if (dirExists) return fs.symlink(srcpath, dstpath, type, callback) + mkdirs(dir, err => { + if (err) return callback(err) + fs.symlink(srcpath, dstpath, type, callback) + }) + }) + }) + }) + }) +} - } else { - throwError(state, 'expected hexadecimal character'); - } - } +function createSymlinkSync (srcpath, dstpath, type) { + const destinationExists = fs.existsSync(dstpath) + if (destinationExists) return undefined - state.result += charFromCodepoint(hexResult); + const relative = symlinkPathsSync(srcpath, dstpath) + srcpath = relative.toDst + type = symlinkTypeSync(relative.toCwd, type) + const dir = path.dirname(dstpath) + const exists = fs.existsSync(dir) + if (exists) return fs.symlinkSync(srcpath, dstpath, type) + mkdirsSync(dir) + return fs.symlinkSync(srcpath, dstpath, type) +} - state.position++; +module.exports = { + createSymlink: u(createSymlink), + createSymlinkSync +} - } else { - throwError(state, 'unknown escape sequence'); - } - captureStart = captureEnd = state.position; +/***/ }), - } else if (is_EOL(ch)) { - captureSegment(state, captureStart, captureEnd, true); - writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); - captureStart = captureEnd = state.position; +/***/ 93628: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - } else if (state.position === state.lineStart && testDocumentSeparator(state)) { - throwError(state, 'unexpected end of the document within a double quoted scalar'); +"use strict"; - } else { - state.position++; - captureEnd = state.position; - } +// This is adapted from https://github.com/normalize/mz +// Copyright (c) 2014-2016 Jonathan Ong me@jongleberry.com and Contributors +const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) +const fs = __nccwpck_require__(61404) + +const api = [ + 'access', + 'appendFile', + 'chmod', + 'chown', + 'close', + 'copyFile', + 'fchmod', + 'fchown', + 'fdatasync', + 'fstat', + 'fsync', + 'ftruncate', + 'futimes', + 'lchown', + 'lchmod', + 'link', + 'lstat', + 'mkdir', + 'mkdtemp', + 'open', + 'readFile', + 'readdir', + 'readlink', + 'realpath', + 'rename', + 'rmdir', + 'stat', + 'symlink', + 'truncate', + 'unlink', + 'utimes', + 'writeFile' +].filter(key => { + // Some commands are not available on some systems. Ex: + // fs.copyFile was added in Node.js v8.5.0 + // fs.mkdtemp was added in Node.js v5.10.0 + // fs.lchown is not available on at least some Linux + return typeof fs[key] === 'function' +}) + +// Export all keys: +Object.keys(fs).forEach(key => { + if (key === 'promises') { + // fs.promises is a getter property that triggers ExperimentalWarning + // Don't re-export it here, the getter is defined in "lib/index.js" + return } + exports[key] = fs[key] +}) - throwError(state, 'unexpected end of the stream within a double quoted scalar'); -} +// Universalify async methods: +api.forEach(method => { + exports[method] = u(fs[method]) +}) -function readFlowCollection(state, nodeIndent) { - var readNext = true, - _line, - _tag = state.tag, - _result, - _anchor = state.anchor, - following, - terminator, - isPair, - isExplicitPair, - isMapping, - overridableKeys = {}, - keyNode, - keyTag, - valueNode, - ch; +// We differ from mz/fs in that we still ship the old, broken, fs.exists() +// since we are a drop-in replacement for the native module +exports.exists = function (filename, callback) { + if (typeof callback === 'function') { + return fs.exists(filename, callback) + } + return new Promise(resolve => { + return fs.exists(filename, resolve) + }) +} - ch = state.input.charCodeAt(state.position); +// fs.read() & fs.write need special treatment due to multiple callback args - if (ch === 0x5B/* [ */) { - terminator = 0x5D;/* ] */ - isMapping = false; - _result = []; - } else if (ch === 0x7B/* { */) { - terminator = 0x7D;/* } */ - isMapping = true; - _result = {}; - } else { - return false; +exports.read = function (fd, buffer, offset, length, position, callback) { + if (typeof callback === 'function') { + return fs.read(fd, buffer, offset, length, position, callback) } + return new Promise((resolve, reject) => { + fs.read(fd, buffer, offset, length, position, (err, bytesRead, buffer) => { + if (err) return reject(err) + resolve({ bytesRead, buffer }) + }) + }) +} - if (state.anchor !== null) { - state.anchorMap[state.anchor] = _result; +// Function signature can be +// fs.write(fd, buffer[, offset[, length[, position]]], callback) +// OR +// fs.write(fd, string[, position[, encoding]], callback) +// We need to handle both cases, so we use ...args +exports.write = function (fd, buffer, ...args) { + if (typeof args[args.length - 1] === 'function') { + return fs.write(fd, buffer, ...args) } - ch = state.input.charCodeAt(++state.position); + return new Promise((resolve, reject) => { + fs.write(fd, buffer, ...args, (err, bytesWritten, buffer) => { + if (err) return reject(err) + resolve({ bytesWritten, buffer }) + }) + }) +} - while (ch !== 0) { - skipSeparationSpace(state, true, nodeIndent); +// fs.realpath.native only available in Node v9.2+ +if (typeof fs.realpath.native === 'function') { + exports.realpath.native = u(fs.realpath.native) +} - ch = state.input.charCodeAt(state.position); - if (ch === terminator) { - state.position++; - state.tag = _tag; - state.anchor = _anchor; - state.kind = isMapping ? 'mapping' : 'sequence'; - state.result = _result; - return true; - } else if (!readNext) { - throwError(state, 'missed comma between flow collection entries'); - } +/***/ }), - keyTag = keyNode = valueNode = null; - isPair = isExplicitPair = false; +/***/ 97298: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - if (ch === 0x3F/* ? */) { - following = state.input.charCodeAt(state.position + 1); +"use strict"; - if (is_WS_OR_EOL(following)) { - isPair = isExplicitPair = true; - state.position++; - skipSeparationSpace(state, true, nodeIndent); - } - } - _line = state.line; - composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); - keyTag = state.tag; - keyNode = state.result; - skipSeparationSpace(state, true, nodeIndent); +module.exports = Object.assign( + {}, + // Export promiseified graceful-fs: + __nccwpck_require__(93628), + // Export extra methods: + __nccwpck_require__(52726), + __nccwpck_require__(61454), + __nccwpck_require__(50312), + __nccwpck_require__(70785), + __nccwpck_require__(5705), + __nccwpck_require__(20559), + __nccwpck_require__(96542), + __nccwpck_require__(59190), + __nccwpck_require__(76698), + __nccwpck_require__(85615), + __nccwpck_require__(75419) +) - ch = state.input.charCodeAt(state.position); +// Export fs.promises as a getter property so that we don't trigger +// ExperimentalWarning before fs.promises is actually accessed. +const fs = __nccwpck_require__(79896) +if (Object.getOwnPropertyDescriptor(fs, 'promises')) { + Object.defineProperty(module.exports, "promises", ({ + get () { return fs.promises } + })) +} - if ((isExplicitPair || state.line === _line) && ch === 0x3A/* : */) { - isPair = true; - ch = state.input.charCodeAt(++state.position); - skipSeparationSpace(state, true, nodeIndent); - composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); - valueNode = state.result; - } - if (isMapping) { - storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode); - } else if (isPair) { - _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode)); - } else { - _result.push(keyNode); - } +/***/ }), - skipSeparationSpace(state, true, nodeIndent); +/***/ 5705: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - ch = state.input.charCodeAt(state.position); +"use strict"; - if (ch === 0x2C/* , */) { - readNext = true; - ch = state.input.charCodeAt(++state.position); - } else { - readNext = false; - } - } - throwError(state, 'unexpected end of the stream within a flow collection'); -} +const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) +const jsonFile = __nccwpck_require__(53373) -function readBlockScalar(state, nodeIndent) { - var captureStart, - folding, - chomping = CHOMPING_CLIP, - didReadContent = false, - detectedIndent = false, - textIndent = nodeIndent, - emptyLines = 0, - atMoreIndented = false, - tmp, - ch; +jsonFile.outputJson = u(__nccwpck_require__(50859)) +jsonFile.outputJsonSync = __nccwpck_require__(29083) +// aliases +jsonFile.outputJSON = jsonFile.outputJson +jsonFile.outputJSONSync = jsonFile.outputJsonSync +jsonFile.writeJSON = jsonFile.writeJson +jsonFile.writeJSONSync = jsonFile.writeJsonSync +jsonFile.readJSON = jsonFile.readJson +jsonFile.readJSONSync = jsonFile.readJsonSync - ch = state.input.charCodeAt(state.position); +module.exports = jsonFile - if (ch === 0x7C/* | */) { - folding = false; - } else if (ch === 0x3E/* > */) { - folding = true; - } else { - return false; - } - state.kind = 'scalar'; - state.result = ''; +/***/ }), - while (ch !== 0) { - ch = state.input.charCodeAt(++state.position); +/***/ 53373: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - if (ch === 0x2B/* + */ || ch === 0x2D/* - */) { - if (CHOMPING_CLIP === chomping) { - chomping = (ch === 0x2B/* + */) ? CHOMPING_KEEP : CHOMPING_STRIP; - } else { - throwError(state, 'repeat of a chomping mode identifier'); - } +"use strict"; - } else if ((tmp = fromDecimalCode(ch)) >= 0) { - if (tmp === 0) { - throwError(state, 'bad explicit indentation width of a block scalar; it cannot be less than one'); - } else if (!detectedIndent) { - textIndent = nodeIndent + tmp - 1; - detectedIndent = true; - } else { - throwError(state, 'repeat of an indentation width identifier'); - } - } else { - break; - } - } +const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) +const jsonFile = __nccwpck_require__(93588) - if (is_WHITE_SPACE(ch)) { - do { ch = state.input.charCodeAt(++state.position); } - while (is_WHITE_SPACE(ch)); +module.exports = { + // jsonfile exports + readJson: u(jsonFile.readFile), + readJsonSync: jsonFile.readFileSync, + writeJson: u(jsonFile.writeFile), + writeJsonSync: jsonFile.writeFileSync +} - if (ch === 0x23/* # */) { - do { ch = state.input.charCodeAt(++state.position); } - while (!is_EOL(ch) && (ch !== 0)); - } - } - while (ch !== 0) { - readLineBreak(state); - state.lineIndent = 0; +/***/ }), - ch = state.input.charCodeAt(state.position); +/***/ 29083: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - while ((!detectedIndent || state.lineIndent < textIndent) && - (ch === 0x20/* Space */)) { - state.lineIndent++; - ch = state.input.charCodeAt(++state.position); - } +"use strict"; - if (!detectedIndent && state.lineIndent > textIndent) { - textIndent = state.lineIndent; - } - if (is_EOL(ch)) { - emptyLines++; - continue; - } +const fs = __nccwpck_require__(61404) +const path = __nccwpck_require__(16928) +const mkdir = __nccwpck_require__(20559) +const jsonFile = __nccwpck_require__(53373) - // End of the scalar. - if (state.lineIndent < textIndent) { +function outputJsonSync (file, data, options) { + const dir = path.dirname(file) - // Perform the chomping. - if (chomping === CHOMPING_KEEP) { - state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); - } else if (chomping === CHOMPING_CLIP) { - if (didReadContent) { // i.e. only if the scalar is not empty. - state.result += '\n'; - } - } + if (!fs.existsSync(dir)) { + mkdir.mkdirsSync(dir) + } - // Break this `while` cycle and go to the funciton's epilogue. - break; - } + jsonFile.writeJsonSync(file, data, options) +} - // Folded style: use fancy rules to handle line breaks. - if (folding) { +module.exports = outputJsonSync - // Lines starting with white space characters (more-indented lines) are not folded. - if (is_WHITE_SPACE(ch)) { - atMoreIndented = true; - // except for the first content line (cf. Example 8.1) - state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); - // End of more-indented block. - } else if (atMoreIndented) { - atMoreIndented = false; - state.result += common.repeat('\n', emptyLines + 1); - - // Just one line break - perceive as the same line. - } else if (emptyLines === 0) { - if (didReadContent) { // i.e. only if we have already read some scalar content. - state.result += ' '; - } +/***/ }), - // Several line breaks - perceive as different lines. - } else { - state.result += common.repeat('\n', emptyLines); - } +/***/ 50859: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - // Literal style: just add exact number of line breaks between content lines. - } else { - // Keep all line breaks except the header line break. - state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); - } +"use strict"; - didReadContent = true; - detectedIndent = true; - emptyLines = 0; - captureStart = state.position; - while (!is_EOL(ch) && (ch !== 0)) { - ch = state.input.charCodeAt(++state.position); - } +const path = __nccwpck_require__(16928) +const mkdir = __nccwpck_require__(20559) +const pathExists = (__nccwpck_require__(85615).pathExists) +const jsonFile = __nccwpck_require__(53373) - captureSegment(state, captureStart, state.position, false); +function outputJson (file, data, options, callback) { + if (typeof options === 'function') { + callback = options + options = {} } - return true; -} + const dir = path.dirname(file) -function readBlockSequence(state, nodeIndent) { - var _line, - _tag = state.tag, - _anchor = state.anchor, - _result = [], - following, - detected = false, - ch; + pathExists(dir, (err, itDoes) => { + if (err) return callback(err) + if (itDoes) return jsonFile.writeJson(file, data, options, callback) - if (state.anchor !== null) { - state.anchorMap[state.anchor] = _result; - } + mkdir.mkdirs(dir, err => { + if (err) return callback(err) + jsonFile.writeJson(file, data, options, callback) + }) + }) +} - ch = state.input.charCodeAt(state.position); +module.exports = outputJson - while (ch !== 0) { - if (ch !== 0x2D/* - */) { - break; - } +/***/ }), - following = state.input.charCodeAt(state.position + 1); +/***/ 20559: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - if (!is_WS_OR_EOL(following)) { - break; - } +"use strict"; - detected = true; - state.position++; +const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) +const mkdirs = u(__nccwpck_require__(80515)) +const mkdirsSync = __nccwpck_require__(36275) - if (skipSeparationSpace(state, true, -1)) { - if (state.lineIndent <= nodeIndent) { - _result.push(null); - ch = state.input.charCodeAt(state.position); - continue; - } - } +module.exports = { + mkdirs, + mkdirsSync, + // alias + mkdirp: mkdirs, + mkdirpSync: mkdirsSync, + ensureDir: mkdirs, + ensureDirSync: mkdirsSync +} - _line = state.line; - composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true); - _result.push(state.result); - skipSeparationSpace(state, true, -1); - ch = state.input.charCodeAt(state.position); +/***/ }), - if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) { - throwError(state, 'bad indentation of a sequence entry'); - } else if (state.lineIndent < nodeIndent) { - break; - } - } +/***/ 36275: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - if (detected) { - state.tag = _tag; - state.anchor = _anchor; - state.kind = 'sequence'; - state.result = _result; - return true; - } - return false; -} +"use strict"; -function readBlockMapping(state, nodeIndent, flowIndent) { - var following, - allowCompact, - _line, - _pos, - _tag = state.tag, - _anchor = state.anchor, - _result = {}, - overridableKeys = {}, - keyTag = null, - keyNode = null, - valueNode = null, - atExplicitKey = false, - detected = false, - ch; - if (state.anchor !== null) { - state.anchorMap[state.anchor] = _result; - } +const fs = __nccwpck_require__(61404) +const path = __nccwpck_require__(16928) +const invalidWin32Path = (__nccwpck_require__(59672).invalidWin32Path) - ch = state.input.charCodeAt(state.position); +const o777 = parseInt('0777', 8) - while (ch !== 0) { - following = state.input.charCodeAt(state.position + 1); - _line = state.line; // Save the current line. - _pos = state.position; +function mkdirsSync (p, opts, made) { + if (!opts || typeof opts !== 'object') { + opts = { mode: opts } + } - // - // Explicit notation case. There are two separate blocks: - // first for the key (denoted by "?") and second for the value (denoted by ":") - // - if ((ch === 0x3F/* ? */ || ch === 0x3A/* : */) && is_WS_OR_EOL(following)) { + let mode = opts.mode + const xfs = opts.fs || fs - if (ch === 0x3F/* ? */) { - if (atExplicitKey) { - storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null); - keyTag = keyNode = valueNode = null; - } + if (process.platform === 'win32' && invalidWin32Path(p)) { + const errInval = new Error(p + ' contains invalid WIN32 path characters.') + errInval.code = 'EINVAL' + throw errInval + } - detected = true; - atExplicitKey = true; - allowCompact = true; + if (mode === undefined) { + mode = o777 & (~process.umask()) + } + if (!made) made = null - } else if (atExplicitKey) { - // i.e. 0x3A/* : */ === character after the explicit key. - atExplicitKey = false; - allowCompact = true; + p = path.resolve(p) - } else { - throwError(state, 'incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line'); + try { + xfs.mkdirSync(p, mode) + made = made || p + } catch (err0) { + if (err0.code === 'ENOENT') { + if (path.dirname(p) === p) throw err0 + made = mkdirsSync(path.dirname(p), opts, made) + mkdirsSync(p, opts, made) + } else { + // In the case of any other error, just see if there's a dir there + // already. If so, then hooray! If not, then something is borked. + let stat + try { + stat = xfs.statSync(p) + } catch (err1) { + throw err0 } + if (!stat.isDirectory()) throw err0 + } + } - state.position += 1; - ch = following; - - // - // Implicit notation case. Flow-style node as the key first, then ":", and the value. - // - } else if (composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) { + return made +} - if (state.line === _line) { - ch = state.input.charCodeAt(state.position); +module.exports = mkdirsSync - while (is_WHITE_SPACE(ch)) { - ch = state.input.charCodeAt(++state.position); - } - if (ch === 0x3A/* : */) { - ch = state.input.charCodeAt(++state.position); +/***/ }), - if (!is_WS_OR_EOL(ch)) { - throwError(state, 'a whitespace character is expected after the key-value separator within a block mapping'); - } +/***/ 80515: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - if (atExplicitKey) { - storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null); - keyTag = keyNode = valueNode = null; - } +"use strict"; - detected = true; - atExplicitKey = false; - allowCompact = false; - keyTag = state.tag; - keyNode = state.result; - } else if (detected) { - throwError(state, 'can not read an implicit mapping pair; a colon is missed'); +const fs = __nccwpck_require__(61404) +const path = __nccwpck_require__(16928) +const invalidWin32Path = (__nccwpck_require__(59672).invalidWin32Path) - } else { - state.tag = _tag; - state.anchor = _anchor; - return true; // Keep the result of `composeNode`. - } +const o777 = parseInt('0777', 8) - } else if (detected) { - throwError(state, 'can not read a block mapping entry; a multiline key may not be an implicit key'); +function mkdirs (p, opts, callback, made) { + if (typeof opts === 'function') { + callback = opts + opts = {} + } else if (!opts || typeof opts !== 'object') { + opts = { mode: opts } + } - } else { - state.tag = _tag; - state.anchor = _anchor; - return true; // Keep the result of `composeNode`. - } + if (process.platform === 'win32' && invalidWin32Path(p)) { + const errInval = new Error(p + ' contains invalid WIN32 path characters.') + errInval.code = 'EINVAL' + return callback(errInval) + } - } else { - break; // Reading is done. Go to the epilogue. - } + let mode = opts.mode + const xfs = opts.fs || fs - // - // Common reading code for both explicit and implicit notations. - // - if (state.line === _line || state.lineIndent > nodeIndent) { - if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) { - if (atExplicitKey) { - keyNode = state.result; - } else { - valueNode = state.result; - } - } + if (mode === undefined) { + mode = o777 & (~process.umask()) + } + if (!made) made = null - if (!atExplicitKey) { - storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _pos); - keyTag = keyNode = valueNode = null; - } + callback = callback || function () {} + p = path.resolve(p) - skipSeparationSpace(state, true, -1); - ch = state.input.charCodeAt(state.position); + xfs.mkdir(p, mode, er => { + if (!er) { + made = made || p + return callback(null, made) } + switch (er.code) { + case 'ENOENT': + if (path.dirname(p) === p) return callback(er) + mkdirs(path.dirname(p), opts, (er, made) => { + if (er) callback(er, made) + else mkdirs(p, opts, callback, made) + }) + break - if (state.lineIndent > nodeIndent && (ch !== 0)) { - throwError(state, 'bad indentation of a mapping entry'); - } else if (state.lineIndent < nodeIndent) { - break; + // In the case of any other error, just see if there's a dir + // there already. If so, then hooray! If not, then something + // is borked. + default: + xfs.stat(p, (er2, stat) => { + // if the stat fails, then that's super weird. + // let the original error be the failure reason. + if (er2 || !stat.isDirectory()) callback(er, made) + else callback(null, made) + }) + break } - } - - // - // Epilogue. - // + }) +} - // Special case: last mapping's node contains only the key in explicit notation. - if (atExplicitKey) { - storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null); - } +module.exports = mkdirs - // Expose the resulting mapping. - if (detected) { - state.tag = _tag; - state.anchor = _anchor; - state.kind = 'mapping'; - state.result = _result; - } - return detected; -} +/***/ }), -function readTagProperty(state) { - var _position, - isVerbatim = false, - isNamed = false, - tagHandle, - tagName, - ch; +/***/ 59672: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - ch = state.input.charCodeAt(state.position); +"use strict"; - if (ch !== 0x21/* ! */) return false; - if (state.tag !== null) { - throwError(state, 'duplication of a tag property'); - } +const path = __nccwpck_require__(16928) - ch = state.input.charCodeAt(++state.position); +// get drive on windows +function getRootPath (p) { + p = path.normalize(path.resolve(p)).split(path.sep) + if (p.length > 0) return p[0] + return null +} - if (ch === 0x3C/* < */) { - isVerbatim = true; - ch = state.input.charCodeAt(++state.position); +// http://stackoverflow.com/a/62888/10333 contains more accurate +// TODO: expand to include the rest +const INVALID_PATH_CHARS = /[<>:"|?*]/ - } else if (ch === 0x21/* ! */) { - isNamed = true; - tagHandle = '!!'; - ch = state.input.charCodeAt(++state.position); +function invalidWin32Path (p) { + const rp = getRootPath(p) + p = p.replace(rp, '') + return INVALID_PATH_CHARS.test(p) +} - } else { - tagHandle = '!'; - } +module.exports = { + getRootPath, + invalidWin32Path +} - _position = state.position; - if (isVerbatim) { - do { ch = state.input.charCodeAt(++state.position); } - while (ch !== 0 && ch !== 0x3E/* > */); +/***/ }), - if (state.position < state.length) { - tagName = state.input.slice(_position, state.position); - ch = state.input.charCodeAt(++state.position); - } else { - throwError(state, 'unexpected end of the stream within a verbatim tag'); - } - } else { - while (ch !== 0 && !is_WS_OR_EOL(ch)) { +/***/ 96542: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - if (ch === 0x21/* ! */) { - if (!isNamed) { - tagHandle = state.input.slice(_position - 1, state.position + 1); +"use strict"; - if (!PATTERN_TAG_HANDLE.test(tagHandle)) { - throwError(state, 'named tag handle cannot contain such characters'); - } - isNamed = true; - _position = state.position + 1; - } else { - throwError(state, 'tag suffix cannot contain exclamation marks'); - } - } +module.exports = { + moveSync: __nccwpck_require__(38345) +} - ch = state.input.charCodeAt(++state.position); - } - tagName = state.input.slice(_position, state.position); +/***/ }), - if (PATTERN_FLOW_INDICATORS.test(tagName)) { - throwError(state, 'tag suffix cannot contain flow indicator characters'); - } - } +/***/ 38345: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - if (tagName && !PATTERN_TAG_URI.test(tagName)) { - throwError(state, 'tag name cannot contain such characters: ' + tagName); - } +"use strict"; - if (isVerbatim) { - state.tag = tagName; - } else if (_hasOwnProperty.call(state.tagMap, tagHandle)) { - state.tag = state.tagMap[tagHandle] + tagName; +const fs = __nccwpck_require__(61404) +const path = __nccwpck_require__(16928) +const copySync = (__nccwpck_require__(52726).copySync) +const removeSync = (__nccwpck_require__(75419).removeSync) +const mkdirpSync = (__nccwpck_require__(20559).mkdirpSync) +const stat = __nccwpck_require__(76821) - } else if (tagHandle === '!') { - state.tag = '!' + tagName; +function moveSync (src, dest, opts) { + opts = opts || {} + const overwrite = opts.overwrite || opts.clobber || false - } else if (tagHandle === '!!') { - state.tag = 'tag:yaml.org,2002:' + tagName; + const { srcStat } = stat.checkPathsSync(src, dest, 'move') + stat.checkParentPathsSync(src, srcStat, dest, 'move') + mkdirpSync(path.dirname(dest)) + return doRename(src, dest, overwrite) +} - } else { - throwError(state, 'undeclared tag handle "' + tagHandle + '"'); +function doRename (src, dest, overwrite) { + if (overwrite) { + removeSync(dest) + return rename(src, dest, overwrite) } + if (fs.existsSync(dest)) throw new Error('dest already exists.') + return rename(src, dest, overwrite) +} - return true; +function rename (src, dest, overwrite) { + try { + fs.renameSync(src, dest) + } catch (err) { + if (err.code !== 'EXDEV') throw err + return moveAcrossDevice(src, dest, overwrite) + } } -function readAnchorProperty(state) { - var _position, - ch; +function moveAcrossDevice (src, dest, overwrite) { + const opts = { + overwrite, + errorOnExist: true + } + copySync(src, dest, opts) + return removeSync(src) +} - ch = state.input.charCodeAt(state.position); +module.exports = moveSync - if (ch !== 0x26/* & */) return false; - if (state.anchor !== null) { - throwError(state, 'duplication of an anchor property'); - } +/***/ }), - ch = state.input.charCodeAt(++state.position); - _position = state.position; +/***/ 59190: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { - ch = state.input.charCodeAt(++state.position); - } +"use strict"; - if (state.position === _position) { - throwError(state, 'name of an anchor node must contain at least one character'); - } - state.anchor = state.input.slice(_position, state.position); - return true; +const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) +module.exports = { + move: u(__nccwpck_require__(15569)) } -function readAlias(state) { - var _position, alias, - ch; - ch = state.input.charCodeAt(state.position); +/***/ }), - if (ch !== 0x2A/* * */) return false; +/***/ 15569: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - ch = state.input.charCodeAt(++state.position); - _position = state.position; +"use strict"; - while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { - ch = state.input.charCodeAt(++state.position); - } - if (state.position === _position) { - throwError(state, 'name of an alias node must contain at least one character'); +const fs = __nccwpck_require__(61404) +const path = __nccwpck_require__(16928) +const copy = (__nccwpck_require__(61454).copy) +const remove = (__nccwpck_require__(75419).remove) +const mkdirp = (__nccwpck_require__(20559).mkdirp) +const pathExists = (__nccwpck_require__(85615).pathExists) +const stat = __nccwpck_require__(76821) + +function move (src, dest, opts, cb) { + if (typeof opts === 'function') { + cb = opts + opts = {} } - alias = state.input.slice(_position, state.position); + const overwrite = opts.overwrite || opts.clobber || false - if (!_hasOwnProperty.call(state.anchorMap, alias)) { - throwError(state, 'unidentified alias "' + alias + '"'); - } + stat.checkPaths(src, dest, 'move', (err, stats) => { + if (err) return cb(err) + const { srcStat } = stats + stat.checkParentPaths(src, srcStat, dest, 'move', err => { + if (err) return cb(err) + mkdirp(path.dirname(dest), err => { + if (err) return cb(err) + return doRename(src, dest, overwrite, cb) + }) + }) + }) +} - state.result = state.anchorMap[alias]; - skipSeparationSpace(state, true, -1); - return true; +function doRename (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 composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) { - var allowBlockStyles, - allowBlockScalars, - allowBlockCollections, - indentStatus = 1, // 1: this>parent, 0: this=parent, -1: this { + if (!err) return cb() + if (err.code !== 'EXDEV') return cb(err) + return moveAcrossDevice(src, dest, overwrite, cb) + }) +} - if (state.listener !== null) { - state.listener('open', state); +function moveAcrossDevice (src, dest, overwrite, cb) { + const opts = { + overwrite, + errorOnExist: true } + copy(src, dest, opts, err => { + if (err) return cb(err) + return remove(src, cb) + }) +} - state.tag = null; - state.anchor = null; - state.kind = null; - state.result = null; +module.exports = move - allowBlockStyles = allowBlockScalars = allowBlockCollections = - CONTEXT_BLOCK_OUT === nodeContext || - CONTEXT_BLOCK_IN === nodeContext; - if (allowToSeek) { - if (skipSeparationSpace(state, true, -1)) { - atNewLine = true; +/***/ }), - if (state.lineIndent > parentIndent) { - indentStatus = 1; - } else if (state.lineIndent === parentIndent) { - indentStatus = 0; - } else if (state.lineIndent < parentIndent) { - indentStatus = -1; - } - } - } +/***/ 76698: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - if (indentStatus === 1) { - while (readTagProperty(state) || readAnchorProperty(state)) { - if (skipSeparationSpace(state, true, -1)) { - atNewLine = true; - allowBlockCollections = allowBlockStyles; +"use strict"; - if (state.lineIndent > parentIndent) { - indentStatus = 1; - } else if (state.lineIndent === parentIndent) { - indentStatus = 0; - } else if (state.lineIndent < parentIndent) { - indentStatus = -1; - } - } else { - allowBlockCollections = false; - } - } - } - if (allowBlockCollections) { - allowBlockCollections = atNewLine || allowCompact; +const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) +const fs = __nccwpck_require__(61404) +const path = __nccwpck_require__(16928) +const mkdir = __nccwpck_require__(20559) +const pathExists = (__nccwpck_require__(85615).pathExists) + +function outputFile (file, data, encoding, callback) { + if (typeof encoding === 'function') { + callback = encoding + encoding = 'utf8' } - if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) { - if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) { - flowIndent = parentIndent; - } else { - flowIndent = parentIndent + 1; - } + const dir = path.dirname(file) + pathExists(dir, (err, itDoes) => { + if (err) return callback(err) + if (itDoes) return fs.writeFile(file, data, encoding, callback) - blockIndent = state.position - state.lineStart; + mkdir.mkdirs(dir, err => { + if (err) return callback(err) - if (indentStatus === 1) { - if (allowBlockCollections && - (readBlockSequence(state, blockIndent) || - readBlockMapping(state, blockIndent, flowIndent)) || - readFlowCollection(state, flowIndent)) { - hasContent = true; - } else { - if ((allowBlockScalars && readBlockScalar(state, flowIndent)) || - readSingleQuotedScalar(state, flowIndent) || - readDoubleQuotedScalar(state, flowIndent)) { - hasContent = true; + fs.writeFile(file, data, encoding, callback) + }) + }) +} - } else if (readAlias(state)) { - hasContent = true; +function outputFileSync (file, ...args) { + const dir = path.dirname(file) + if (fs.existsSync(dir)) { + return fs.writeFileSync(file, ...args) + } + mkdir.mkdirsSync(dir) + fs.writeFileSync(file, ...args) +} - if (state.tag !== null || state.anchor !== null) { - throwError(state, 'alias node should not have any properties'); - } +module.exports = { + outputFile: u(outputFile), + outputFileSync +} - } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) { - hasContent = true; - if (state.tag === null) { - state.tag = '?'; - } - } +/***/ }), - if (state.anchor !== null) { - state.anchorMap[state.anchor] = state.result; - } - } - } else if (indentStatus === 0) { - // Special case: block sequences are allowed to have same indentation level as the parent. - // http://www.yaml.org/spec/1.2/spec.html#id2799784 - hasContent = allowBlockCollections && readBlockSequence(state, blockIndent); - } - } +/***/ 85615: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - if (state.tag !== null && state.tag !== '!') { - if (state.tag === '?') { - // Implicit resolving is not allowed for non-scalar types, and '?' - // non-specific tag is only automatically assigned to plain scalars. - // - // We only need to check kind conformity in case user explicitly assigns '?' - // tag, for example like this: "! [0]" - // - if (state.result !== null && state.kind !== 'scalar') { - throwError(state, 'unacceptable node kind for ! tag; it should be "scalar", not "' + state.kind + '"'); - } +"use strict"; - for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) { - type = state.implicitTypes[typeIndex]; +const u = (__nccwpck_require__(92977)/* .fromPromise */ .z) +const fs = __nccwpck_require__(93628) - if (type.resolve(state.result)) { // `state.result` updated in resolver if matched - state.result = type.construct(state.result); - state.tag = type.tag; - if (state.anchor !== null) { - state.anchorMap[state.anchor] = state.result; - } - break; - } - } - } else if (_hasOwnProperty.call(state.typeMap[state.kind || 'fallback'], state.tag)) { - type = state.typeMap[state.kind || 'fallback'][state.tag]; +function pathExists (path) { + return fs.access(path).then(() => true).catch(() => false) +} - if (state.result !== null && type.kind !== state.kind) { - throwError(state, 'unacceptable node kind for !<' + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"'); - } +module.exports = { + pathExists: u(pathExists), + pathExistsSync: fs.existsSync +} - if (!type.resolve(state.result)) { // `state.result` updated in resolver if matched - throwError(state, 'cannot resolve a node with !<' + state.tag + '> explicit tag'); - } else { - state.result = type.construct(state.result); - if (state.anchor !== null) { - state.anchorMap[state.anchor] = state.result; - } - } - } else { - throwError(state, 'unknown tag !<' + state.tag + '>'); - } - } - if (state.listener !== null) { - state.listener('close', state); - } - return state.tag !== null || state.anchor !== null || hasContent; -} +/***/ }), -function readDocument(state) { - var documentStart = state.position, - _position, - directiveName, - directiveArgs, - hasDirectives = false, - ch; - - state.version = null; - state.checkLineBreaks = state.legacy; - state.tagMap = {}; - state.anchorMap = {}; - - while ((ch = state.input.charCodeAt(state.position)) !== 0) { - skipSeparationSpace(state, true, -1); - - ch = state.input.charCodeAt(state.position); - - if (state.lineIndent > 0 || ch !== 0x25/* % */) { - break; - } +/***/ 75419: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - hasDirectives = true; - ch = state.input.charCodeAt(++state.position); - _position = state.position; +"use strict"; - while (ch !== 0 && !is_WS_OR_EOL(ch)) { - ch = state.input.charCodeAt(++state.position); - } - directiveName = state.input.slice(_position, state.position); - directiveArgs = []; +const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) +const rimraf = __nccwpck_require__(82058) - if (directiveName.length < 1) { - throwError(state, 'directive name must not be less than one character in length'); - } +module.exports = { + remove: u(rimraf), + removeSync: rimraf.sync +} - while (ch !== 0) { - while (is_WHITE_SPACE(ch)) { - ch = state.input.charCodeAt(++state.position); - } - if (ch === 0x23/* # */) { - do { ch = state.input.charCodeAt(++state.position); } - while (ch !== 0 && !is_EOL(ch)); - break; - } +/***/ }), - if (is_EOL(ch)) break; +/***/ 82058: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - _position = state.position; +"use strict"; - while (ch !== 0 && !is_WS_OR_EOL(ch)) { - ch = state.input.charCodeAt(++state.position); - } - directiveArgs.push(state.input.slice(_position, state.position)); - } +const fs = __nccwpck_require__(61404) +const path = __nccwpck_require__(16928) +const assert = __nccwpck_require__(42613) - if (ch !== 0) readLineBreak(state); +const isWindows = (process.platform === 'win32') - if (_hasOwnProperty.call(directiveHandlers, directiveName)) { - directiveHandlers[directiveName](state, directiveName, directiveArgs); - } else { - throwWarning(state, 'unknown document directive "' + directiveName + '"'); - } - } +function defaults (options) { + const methods = [ + 'unlink', + 'chmod', + 'stat', + 'lstat', + 'rmdir', + 'readdir' + ] + methods.forEach(m => { + options[m] = options[m] || fs[m] + m = m + 'Sync' + options[m] = options[m] || fs[m] + }) - skipSeparationSpace(state, true, -1); + options.maxBusyTries = options.maxBusyTries || 3 +} - if (state.lineIndent === 0 && - state.input.charCodeAt(state.position) === 0x2D/* - */ && - state.input.charCodeAt(state.position + 1) === 0x2D/* - */ && - state.input.charCodeAt(state.position + 2) === 0x2D/* - */) { - state.position += 3; - skipSeparationSpace(state, true, -1); +function rimraf (p, options, cb) { + let busyTries = 0 - } else if (hasDirectives) { - throwError(state, 'directives end mark is expected'); + if (typeof options === 'function') { + cb = options + options = {} } - composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true); - skipSeparationSpace(state, true, -1); - - if (state.checkLineBreaks && - PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) { - throwWarning(state, 'non-ASCII line breaks are interpreted as content'); - } + assert(p, 'rimraf: missing path') + assert.strictEqual(typeof p, 'string', 'rimraf: path should be a string') + assert.strictEqual(typeof cb, 'function', 'rimraf: callback function required') + assert(options, 'rimraf: invalid options argument provided') + assert.strictEqual(typeof options, 'object', 'rimraf: options should be object') - state.documents.push(state.result); + defaults(options) - if (state.position === state.lineStart && testDocumentSeparator(state)) { + rimraf_(p, options, function CB (er) { + if (er) { + if ((er.code === 'EBUSY' || er.code === 'ENOTEMPTY' || er.code === 'EPERM') && + busyTries < options.maxBusyTries) { + busyTries++ + const time = busyTries * 100 + // try again, with the same exact callback as this one. + return setTimeout(() => rimraf_(p, options, CB), time) + } - if (state.input.charCodeAt(state.position) === 0x2E/* . */) { - state.position += 3; - skipSeparationSpace(state, true, -1); + // already gone + if (er.code === 'ENOENT') er = null } - return; - } - if (state.position < (state.length - 1)) { - throwError(state, 'end of the stream or a document separator is expected'); - } else { - return; - } + cb(er) + }) } +// Two possible strategies. +// 1. Assume it's a file. unlink it, then do the dir stuff on EPERM or EISDIR +// 2. Assume it's a directory. readdir, then do the file stuff on ENOTDIR +// +// Both result in an extra syscall when you guess wrong. However, there +// are likely far more normal files in the world than directories. This +// is based on the assumption that a the average number of files per +// directory is >= 1. +// +// If anyone ever complains about this, then I guess the strategy could +// be made configurable somehow. But until then, YAGNI. +function rimraf_ (p, options, cb) { + assert(p) + assert(options) + assert(typeof cb === 'function') -function loadDocuments(input, options) { - input = String(input); - options = options || {}; - - if (input.length !== 0) { - - // Add tailing `\n` if not exists - if (input.charCodeAt(input.length - 1) !== 0x0A/* LF */ && - input.charCodeAt(input.length - 1) !== 0x0D/* CR */) { - input += '\n'; + // sunos lets the root user unlink directories, which is... weird. + // so we have to lstat here and make sure it's not a dir. + options.lstat(p, (er, st) => { + if (er && er.code === 'ENOENT') { + return cb(null) } - // Strip BOM - if (input.charCodeAt(0) === 0xFEFF) { - input = input.slice(1); + // Windows can EPERM on stat. Life is suffering. + if (er && er.code === 'EPERM' && isWindows) { + return fixWinEPERM(p, options, er, cb) } - } - - var state = new State(input, options); - - var nullpos = input.indexOf('\0'); - - if (nullpos !== -1) { - state.position = nullpos; - throwError(state, 'null byte is not allowed in input'); - } - // Use 0 as string terminator. That significantly simplifies bounds check. - state.input += '\0'; + if (st && st.isDirectory()) { + return rmdir(p, options, er, cb) + } - while (state.input.charCodeAt(state.position) === 0x20/* Space */) { - state.lineIndent += 1; - state.position += 1; - } + options.unlink(p, er => { + if (er) { + if (er.code === 'ENOENT') { + return cb(null) + } + if (er.code === 'EPERM') { + return (isWindows) + ? fixWinEPERM(p, options, er, cb) + : rmdir(p, options, er, cb) + } + if (er.code === 'EISDIR') { + return rmdir(p, options, er, cb) + } + } + return cb(er) + }) + }) +} - while (state.position < (state.length - 1)) { - readDocument(state); +function fixWinEPERM (p, options, er, cb) { + assert(p) + assert(options) + assert(typeof cb === 'function') + if (er) { + assert(er instanceof Error) } - return state.documents; + options.chmod(p, 0o666, er2 => { + if (er2) { + cb(er2.code === 'ENOENT' ? null : er) + } else { + options.stat(p, (er3, stats) => { + if (er3) { + cb(er3.code === 'ENOENT' ? null : er) + } else if (stats.isDirectory()) { + rmdir(p, options, er, cb) + } else { + options.unlink(p, cb) + } + }) + } + }) } +function fixWinEPERMSync (p, options, er) { + let stats -function loadAll(input, iterator, options) { - if (iterator !== null && typeof iterator === 'object' && typeof options === 'undefined') { - options = iterator; - iterator = null; + assert(p) + assert(options) + if (er) { + assert(er instanceof Error) } - var documents = loadDocuments(input, options); + try { + options.chmodSync(p, 0o666) + } catch (er2) { + if (er2.code === 'ENOENT') { + return + } else { + throw er + } + } - if (typeof iterator !== 'function') { - return documents; - } - - for (var index = 0, length = documents.length; index < length; index += 1) { - iterator(documents[index]); + try { + stats = options.statSync(p) + } catch (er3) { + if (er3.code === 'ENOENT') { + return + } else { + throw er + } } -} - - -function load(input, options) { - var documents = loadDocuments(input, options); - if (documents.length === 0) { - /*eslint-disable no-undefined*/ - return undefined; - } else if (documents.length === 1) { - return documents[0]; + if (stats.isDirectory()) { + rmdirSync(p, options, er) + } else { + options.unlinkSync(p) } - throw new YAMLException('expected a single document in the stream, but found more'); } - -function safeLoadAll(input, iterator, options) { - if (typeof iterator === 'object' && iterator !== null && typeof options === 'undefined') { - options = iterator; - iterator = null; +function rmdir (p, options, originalEr, cb) { + assert(p) + assert(options) + if (originalEr) { + assert(originalEr instanceof Error) } + assert(typeof cb === 'function') - return loadAll(input, iterator, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options)); -} - - -function safeLoad(input, options) { - return load(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options)); + // try to rmdir first, and only readdir on ENOTEMPTY or EEXIST (SunOS) + // if we guessed wrong, and it's not a directory, then + // raise the original error. + options.rmdir(p, er => { + if (er && (er.code === 'ENOTEMPTY' || er.code === 'EEXIST' || er.code === 'EPERM')) { + rmkids(p, options, cb) + } else if (er && er.code === 'ENOTDIR') { + cb(originalEr) + } else { + cb(er) + } + }) } +function rmkids (p, options, cb) { + assert(p) + assert(options) + assert(typeof cb === 'function') -module.exports.loadAll = loadAll; -module.exports.load = load; -module.exports.safeLoadAll = safeLoadAll; -module.exports.safeLoad = safeLoad; - - -/***/ }), - -/***/ 28227: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - -"use strict"; - - + options.readdir(p, (er, files) => { + if (er) return cb(er) -var common = __nccwpck_require__(99999); + let n = files.length + let errState + if (n === 0) return options.rmdir(p, cb) -function Mark(name, buffer, position, line, column) { - this.name = name; - this.buffer = buffer; - this.position = position; - this.line = line; - this.column = column; + files.forEach(f => { + rimraf(path.join(p, f), options, er => { + if (errState) { + return + } + if (er) return cb(errState = er) + if (--n === 0) { + options.rmdir(p, cb) + } + }) + }) + }) } +// this looks simpler, and is strictly *faster*, but will +// tie up the JavaScript thread and fail on excessively +// deep directory trees. +function rimrafSync (p, options) { + let st -Mark.prototype.getSnippet = function getSnippet(indent, maxLength) { - var head, start, tail, end, snippet; + options = options || {} + defaults(options) - if (!this.buffer) return null; + assert(p, 'rimraf: missing path') + assert.strictEqual(typeof p, 'string', 'rimraf: path should be a string') + assert(options, 'rimraf: missing options') + assert.strictEqual(typeof options, 'object', 'rimraf: options should be object') - indent = indent || 4; - maxLength = maxLength || 75; + try { + st = options.lstatSync(p) + } catch (er) { + if (er.code === 'ENOENT') { + return + } - head = ''; - start = this.position; + // Windows can EPERM on stat. Life is suffering. + if (er.code === 'EPERM' && isWindows) { + fixWinEPERMSync(p, options, er) + } + } - while (start > 0 && '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(start - 1)) === -1) { - start -= 1; - if (this.position - start > (maxLength / 2 - 1)) { - head = ' ... '; - start += 5; - break; + try { + // sunos lets the root user unlink directories, which is... weird. + if (st && st.isDirectory()) { + rmdirSync(p, options, null) + } else { + options.unlinkSync(p) + } + } catch (er) { + if (er.code === 'ENOENT') { + return + } else if (er.code === 'EPERM') { + return isWindows ? fixWinEPERMSync(p, options, er) : rmdirSync(p, options, er) + } else if (er.code !== 'EISDIR') { + throw er } + rmdirSync(p, options, er) } +} - tail = ''; - end = this.position; +function rmdirSync (p, options, originalEr) { + assert(p) + assert(options) + if (originalEr) { + assert(originalEr instanceof Error) + } - while (end < this.buffer.length && '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(end)) === -1) { - end += 1; - if (end - this.position > (maxLength / 2 - 1)) { - tail = ' ... '; - end -= 5; - break; + try { + options.rmdirSync(p) + } catch (er) { + if (er.code === 'ENOTDIR') { + throw originalEr + } else if (er.code === 'ENOTEMPTY' || er.code === 'EEXIST' || er.code === 'EPERM') { + rmkidsSync(p, options) + } else if (er.code !== 'ENOENT') { + throw er } } +} - snippet = this.buffer.slice(start, end); +function rmkidsSync (p, options) { + assert(p) + assert(options) + options.readdirSync(p).forEach(f => rimrafSync(path.join(p, f), options)) - return common.repeat(' ', indent) + head + snippet + tail + '\n' + - common.repeat(' ', indent + this.position - start + head.length) + '^'; -}; + if (isWindows) { + // We only end up here once we got ENOTEMPTY at least once, and + // at this point, we are guaranteed to have removed all the kids. + // So, we know that it won't be ENOENT or ENOTDIR or anything else. + // try really hard to delete stuff on windows, because it has a + // PROFOUNDLY annoying habit of not closing handles promptly when + // files are deleted, resulting in spurious ENOTEMPTY errors. + const startTime = Date.now() + do { + try { + const ret = options.rmdirSync(p, options) + return ret + } catch (er) { } + } while (Date.now() - startTime < 500) // give up after 500ms + } else { + const ret = options.rmdirSync(p, options) + return ret + } +} +module.exports = rimraf +rimraf.sync = rimrafSync -Mark.prototype.toString = function toString(compact) { - var snippet, where = ''; - if (this.name) { - where += 'in "' + this.name + '" '; - } +/***/ }), - where += 'at line ' + (this.line + 1) + ', column ' + (this.column + 1); +/***/ 26445: +/***/ ((module) => { - if (!compact) { - snippet = this.getSnippet(); +"use strict"; - if (snippet) { - where += ':\n' + snippet; +/* eslint-disable node/no-deprecated-api */ +module.exports = function (size) { + if (typeof Buffer.allocUnsafe === 'function') { + try { + return Buffer.allocUnsafe(size) + } catch (e) { + return new Buffer(size) } } - - return where; -}; - - -module.exports = Mark; + return new Buffer(size) +} /***/ }), -/***/ 11253: +/***/ 76821: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -/*eslint-disable max-len*/ +const fs = __nccwpck_require__(61404) +const path = __nccwpck_require__(16928) -var common = __nccwpck_require__(99999); -var YAMLException = __nccwpck_require__(69125); -var Type = __nccwpck_require__(88210); +const NODE_VERSION_MAJOR_WITH_BIGINT = 10 +const NODE_VERSION_MINOR_WITH_BIGINT = 5 +const NODE_VERSION_PATCH_WITH_BIGINT = 0 +const nodeVersion = process.versions.node.split('.') +const nodeVersionMajor = Number.parseInt(nodeVersion[0], 10) +const nodeVersionMinor = Number.parseInt(nodeVersion[1], 10) +const nodeVersionPatch = Number.parseInt(nodeVersion[2], 10) +function nodeSupportsBigInt () { + if (nodeVersionMajor > NODE_VERSION_MAJOR_WITH_BIGINT) { + return true + } else if (nodeVersionMajor === NODE_VERSION_MAJOR_WITH_BIGINT) { + if (nodeVersionMinor > NODE_VERSION_MINOR_WITH_BIGINT) { + return true + } else if (nodeVersionMinor === NODE_VERSION_MINOR_WITH_BIGINT) { + if (nodeVersionPatch >= NODE_VERSION_PATCH_WITH_BIGINT) { + return true + } + } + } + return false +} -function compileList(schema, name, result) { - var exclude = []; - - schema.include.forEach(function (includedSchema) { - result = compileList(includedSchema, name, result); - }); - - schema[name].forEach(function (currentType) { - result.forEach(function (previousType, previousIndex) { - if (previousType.tag === currentType.tag && previousType.kind === currentType.kind) { - exclude.push(previousIndex); - } - }); - - result.push(currentType); - }); - - return result.filter(function (type, index) { - return exclude.indexOf(index) === -1; - }); +function getStats (src, dest, cb) { + if (nodeSupportsBigInt()) { + fs.stat(src, { bigint: true }, (err, srcStat) => { + if (err) return cb(err) + fs.stat(dest, { bigint: true }, (err, destStat) => { + if (err) { + if (err.code === 'ENOENT') return cb(null, { srcStat, destStat: null }) + return cb(err) + } + return cb(null, { srcStat, destStat }) + }) + }) + } else { + fs.stat(src, (err, srcStat) => { + if (err) return cb(err) + fs.stat(dest, (err, destStat) => { + if (err) { + if (err.code === 'ENOENT') return cb(null, { srcStat, destStat: null }) + return cb(err) + } + return cb(null, { srcStat, destStat }) + }) + }) + } } - -function compileMap(/* lists... */) { - var result = { - scalar: {}, - sequence: {}, - mapping: {}, - fallback: {} - }, index, length; - - function collectType(type) { - result[type.kind][type.tag] = result['fallback'][type.tag] = type; +function getStatsSync (src, dest) { + let srcStat, destStat + if (nodeSupportsBigInt()) { + srcStat = fs.statSync(src, { bigint: true }) + } else { + srcStat = fs.statSync(src) } - - for (index = 0, length = arguments.length; index < length; index += 1) { - arguments[index].forEach(collectType); + try { + if (nodeSupportsBigInt()) { + destStat = fs.statSync(dest, { bigint: true }) + } else { + destStat = fs.statSync(dest) + } + } catch (err) { + if (err.code === 'ENOENT') return { srcStat, destStat: null } + throw err } - return result; + return { srcStat, destStat } } - -function Schema(definition) { - this.include = definition.include || []; - this.implicit = definition.implicit || []; - this.explicit = definition.explicit || []; - - this.implicit.forEach(function (type) { - if (type.loadKind && type.loadKind !== 'scalar') { - throw new YAMLException('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.'); +function checkPaths (src, dest, funcName, cb) { + getStats(src, dest, (err, stats) => { + if (err) return cb(err) + const { srcStat, destStat } = stats + if (destStat && destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev) { + return cb(new Error('Source and destination must not be the same.')) } - }); - - this.compiledImplicit = compileList(this, 'implicit', []); - this.compiledExplicit = compileList(this, 'explicit', []); - this.compiledTypeMap = compileMap(this.compiledImplicit, this.compiledExplicit); + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + return cb(new Error(errMsg(src, dest, funcName))) + } + return cb(null, { srcStat, destStat }) + }) } - -Schema.DEFAULT = null; - - -Schema.create = function createSchema() { - var schemas, types; - - switch (arguments.length) { - case 1: - schemas = Schema.DEFAULT; - types = arguments[0]; - break; - - case 2: - schemas = arguments[0]; - types = arguments[1]; - break; - - default: - throw new YAMLException('Wrong number of arguments for Schema.create function'); +function checkPathsSync (src, dest, funcName) { + const { srcStat, destStat } = getStatsSync(src, dest) + if (destStat && destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev) { + throw new Error('Source and destination must not be the same.') } + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + throw new Error(errMsg(src, dest, funcName)) + } + return { srcStat, destStat } +} - schemas = common.toArray(schemas); - types = common.toArray(types); - - if (!schemas.every(function (schema) { return schema instanceof Schema; })) { - throw new YAMLException('Specified list of super schemas (or a single Schema object) contains a non-Schema object.'); +// recursively check if dest parent is a subdirectory of src. +// It works for all file types including symlinks since it +// checks the src and dest inodes. It starts from the deepest +// parent and stops once it reaches the src parent or the root path. +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 cb() + if (nodeSupportsBigInt()) { + fs.stat(destParent, { bigint: true }, (err, destStat) => { + if (err) { + if (err.code === 'ENOENT') return cb() + return cb(err) + } + if (destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev) { + return cb(new Error(errMsg(src, dest, funcName))) + } + return checkParentPaths(src, srcStat, destParent, funcName, cb) + }) + } else { + fs.stat(destParent, (err, destStat) => { + if (err) { + if (err.code === 'ENOENT') return cb() + return cb(err) + } + if (destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev) { + return cb(new Error(errMsg(src, dest, funcName))) + } + return checkParentPaths(src, srcStat, destParent, funcName, cb) + }) } +} - if (!types.every(function (type) { return type instanceof Type; })) { - throw new YAMLException('Specified list of YAML types (or a single Type object) contains a non-Type object.'); +function checkParentPathsSync (src, srcStat, dest, funcName) { + const srcParent = path.resolve(path.dirname(src)) + const destParent = path.resolve(path.dirname(dest)) + if (destParent === srcParent || destParent === path.parse(destParent).root) return + let destStat + try { + if (nodeSupportsBigInt()) { + destStat = fs.statSync(destParent, { bigint: true }) + } else { + destStat = fs.statSync(destParent) + } + } catch (err) { + if (err.code === 'ENOENT') return + throw err } + if (destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev) { + throw new Error(errMsg(src, dest, funcName)) + } + return checkParentPathsSync(src, srcStat, destParent, funcName) +} - return new Schema({ - include: schemas, - explicit: types - }); -}; +// return true if dest is a subdir of src, otherwise false. +// It only checks the path strings. +function isSrcSubdir (src, dest) { + const srcArr = path.resolve(src).split(path.sep).filter(i => i) + const destArr = path.resolve(dest).split(path.sep).filter(i => i) + return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true) +} +function errMsg (src, dest, funcName) { + return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.` +} -module.exports = Schema; +module.exports = { + checkPaths, + checkPathsSync, + checkParentPaths, + checkParentPathsSync, + isSrcSubdir +} /***/ }), -/***/ 87875: +/***/ 84420: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -// Standard YAML's Core schema. -// http://www.yaml.org/spec/1.2/spec.html#id2804923 -// -// NOTE: JS-YAML does not support schema-specific tag resolution restrictions. -// So, Core schema has no distinctions from JSON schema is JS-YAML. - +const fs = __nccwpck_require__(61404) +const os = __nccwpck_require__(70857) +const path = __nccwpck_require__(16928) +// HFS, ext{2,3}, FAT do not, Node.js v0.10 does not +function hasMillisResSync () { + let tmpfile = path.join('millis-test-sync' + Date.now().toString() + Math.random().toString().slice(2)) + tmpfile = path.join(os.tmpdir(), tmpfile) -var Schema = __nccwpck_require__(11253); - - -module.exports = new Schema({ - include: [ - __nccwpck_require__(13046) - ] -}); - - -/***/ }), - -/***/ 17587: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - -"use strict"; -// JS-YAML's default schema for `load` function. -// It is not described in the YAML specification. -// -// This schema is based on JS-YAML's default safe schema and includes -// JavaScript-specific types: !!js/undefined, !!js/regexp and !!js/function. -// -// Also this schema is used as default base schema at `Schema.create` function. - + // 550 millis past UNIX epoch + const d = new Date(1435410243862) + fs.writeFileSync(tmpfile, 'https://github.com/jprichardson/node-fs-extra/pull/141') + const fd = fs.openSync(tmpfile, 'r+') + fs.futimesSync(fd, d, d) + fs.closeSync(fd) + return fs.statSync(tmpfile).mtime > 1435410243000 +} +function hasMillisRes (callback) { + let tmpfile = path.join('millis-test' + Date.now().toString() + Math.random().toString().slice(2)) + tmpfile = path.join(os.tmpdir(), tmpfile) + // 550 millis past UNIX epoch + const d = new Date(1435410243862) + fs.writeFile(tmpfile, 'https://github.com/jprichardson/node-fs-extra/pull/141', err => { + if (err) return callback(err) + fs.open(tmpfile, 'r+', (err, fd) => { + if (err) return callback(err) + fs.futimes(fd, d, d, err => { + if (err) return callback(err) + fs.close(fd, err => { + if (err) return callback(err) + fs.stat(tmpfile, (err, stats) => { + if (err) return callback(err) + callback(null, stats.mtime > 1435410243000) + }) + }) + }) + }) + }) +} +function timeRemoveMillis (timestamp) { + if (typeof timestamp === 'number') { + return Math.floor(timestamp / 1000) * 1000 + } else if (timestamp instanceof Date) { + return new Date(Math.floor(timestamp.getTime() / 1000) * 1000) + } else { + throw new Error('fs-extra: timeRemoveMillis() unknown parameter type') + } +} -var Schema = __nccwpck_require__(11253); +function utimesMillis (path, atime, mtime, callback) { + // if (!HAS_MILLIS_RES) return fs.utimes(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+') + fs.futimesSync(fd, atime, mtime) + return fs.closeSync(fd) +} -module.exports = Schema.DEFAULT = new Schema({ - include: [ - __nccwpck_require__(22919) - ], - explicit: [ - __nccwpck_require__(6561), - __nccwpck_require__(26996), - __nccwpck_require__(3737) - ] -}); +module.exports = { + hasMillisRes, + hasMillisResSync, + timeRemoveMillis, + utimesMillis, + utimesMillisSync +} /***/ }), -/***/ 22919: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/***/ 16792: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -// JS-YAML's default schema for `safeLoad` function. -// It is not described in the YAML specification. -// -// This schema is based on standard YAML's Core schema and includes most of -// extra types described at YAML tag repository. (http://yaml.org/type/) - - +Object.defineProperty(exports, "__esModule", ({ value: true })); -var Schema = __nccwpck_require__(11253); +function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } +var _regeneratorRuntime = _interopDefault(__nccwpck_require__(65907)); +var _asyncToGenerator = _interopDefault(__nccwpck_require__(67584)); +var _classCallCheck = _interopDefault(__nccwpck_require__(33446)); +var _possibleConstructorReturn = _interopDefault(__nccwpck_require__(83855)); +var _getPrototypeOf = _interopDefault(__nccwpck_require__(55989)); +var _inherits = _interopDefault(__nccwpck_require__(87406)); +var _wrapNativeSuper = _interopDefault(__nccwpck_require__(16318)); +var fs = _interopDefault(__nccwpck_require__(5810)); +var path = _interopDefault(__nccwpck_require__(16928)); +var globby = __nccwpck_require__(46127); +var globby__default = _interopDefault(globby); +var readYamlFile = __nccwpck_require__(64109); +var readYamlFile__default = _interopDefault(readYamlFile); +var findRoot = __nccwpck_require__(67805); -module.exports = new Schema({ - include: [ - __nccwpck_require__(87875) - ], - implicit: [ - __nccwpck_require__(61757), - __nccwpck_require__(23557) - ], - explicit: [ - __nccwpck_require__(64304), - __nccwpck_require__(81300), - __nccwpck_require__(84144), - __nccwpck_require__(29821) - ] -}); +var PackageJsonMissingNameError = +/*#__PURE__*/ +function (_Error) { + _inherits(PackageJsonMissingNameError, _Error); + function PackageJsonMissingNameError(directories) { + var _this; -/***/ }), + _classCallCheck(this, PackageJsonMissingNameError); -/***/ 47177: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + _this = _possibleConstructorReturn(this, _getPrototypeOf(PackageJsonMissingNameError).call(this, "The following package.jsons are missing the \"name\" field:\n".concat(directories.join("\n")))); + _this.directories = directories; + return _this; + } -"use strict"; -// Standard YAML's Failsafe schema. -// http://www.yaml.org/spec/1.2/spec.html#id2802346 + return PackageJsonMissingNameError; +}(_wrapNativeSuper(Error)); +function getPackages(_x) { + return _getPackages.apply(this, arguments); +} +function _getPackages() { + _getPackages = _asyncToGenerator( + /*#__PURE__*/ + _regeneratorRuntime.mark(function _callee(dir) { + var cwd, pkg, tool, manifest, lernaJson, root, relativeDirectories, directories, pkgJsonsMissingNameField, results; + return _regeneratorRuntime.wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + _context.next = 2; + return findRoot.findRoot(dir); + case 2: + cwd = _context.sent; + _context.next = 5; + return fs.readJson(path.join(cwd, "package.json")); + case 5: + pkg = _context.sent; + if (!pkg.workspaces) { + _context.next = 10; + break; + } -var Schema = __nccwpck_require__(11253); + if (Array.isArray(pkg.workspaces)) { + tool = { + type: "yarn", + packageGlobs: pkg.workspaces + }; + } else if (pkg.workspaces.packages) { + tool = { + type: "yarn", + packageGlobs: pkg.workspaces.packages + }; + } + _context.next = 37; + break; -module.exports = new Schema({ - explicit: [ - __nccwpck_require__(19286), - __nccwpck_require__(19058), - __nccwpck_require__(61619) - ] -}); + case 10: + if (!(pkg.bolt && pkg.bolt.workspaces)) { + _context.next = 14; + break; + } + tool = { + type: "bolt", + packageGlobs: pkg.bolt.workspaces + }; + _context.next = 37; + break; -/***/ }), + case 14: + _context.prev = 14; + _context.next = 17; + return readYamlFile__default(path.join(cwd, "pnpm-workspace.yaml")); -/***/ 13046: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + case 17: + manifest = _context.sent; -"use strict"; -// Standard YAML's JSON schema. -// http://www.yaml.org/spec/1.2/spec.html#id2803231 -// -// NOTE: JS-YAML does not support schema-specific tag resolution restrictions. -// So, this schema is not such strict as defined in the YAML specification. -// It allows numbers in binary notaion, use `Null` and `NULL` as `null`, etc. + if (manifest && manifest.packages) { + tool = { + type: "pnpm", + packageGlobs: manifest.packages + }; + } + _context.next = 25; + break; + case 21: + _context.prev = 21; + _context.t0 = _context["catch"](14); + if (!(_context.t0.code !== "ENOENT")) { + _context.next = 25; + break; + } + throw _context.t0; -var Schema = __nccwpck_require__(11253); + case 25: + if (tool) { + _context.next = 37; + break; + } + _context.prev = 26; + _context.next = 29; + return fs.readJson(path.join(cwd, "lerna.json")); -module.exports = new Schema({ - include: [ - __nccwpck_require__(47177) - ], - implicit: [ - __nccwpck_require__(30280), - __nccwpck_require__(4353), - __nccwpck_require__(8696), - __nccwpck_require__(23079) - ] -}); + case 29: + lernaJson = _context.sent; + if (lernaJson) { + tool = { + type: "lerna", + packageGlobs: lernaJson.packages || ["packages/*"] + }; + } -/***/ }), + _context.next = 37; + break; -/***/ 88210: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + case 33: + _context.prev = 33; + _context.t1 = _context["catch"](26); -"use strict"; + if (!(_context.t1.code !== "ENOENT")) { + _context.next = 37; + break; + } + throw _context.t1; -var YAMLException = __nccwpck_require__(69125); + case 37: + if (tool) { + _context.next = 42; + break; + } -var TYPE_CONSTRUCTOR_OPTIONS = [ - 'kind', - 'resolve', - 'construct', - 'instanceOf', - 'predicate', - 'represent', - 'defaultStyle', - 'styleAliases' -]; + root = { + dir: cwd, + packageJson: pkg + }; -var YAML_NODE_KINDS = [ - 'scalar', - 'sequence', - 'mapping' -]; + if (pkg.name) { + _context.next = 41; + break; + } -function compileStyleAliases(map) { - var result = {}; + throw new PackageJsonMissingNameError(["package.json"]); - if (map !== null) { - Object.keys(map).forEach(function (style) { - map[style].forEach(function (alias) { - result[String(alias)] = style; - }); - }); - } - - return result; -} - -function Type(tag, options) { - options = options || {}; + case 41: + return _context.abrupt("return", { + tool: "root", + root: root, + packages: [root] + }); - Object.keys(options).forEach(function (name) { - if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) { - throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.'); - } - }); + case 42: + _context.next = 44; + return globby__default(tool.packageGlobs, { + cwd: cwd, + onlyDirectories: true, + expandDirectories: false, + ignore: ["**/node_modules"] + }); - // TODO: Add tag format check. - this.tag = tag; - this.kind = options['kind'] || null; - this.resolve = options['resolve'] || function () { return true; }; - this.construct = options['construct'] || function (data) { return data; }; - this.instanceOf = options['instanceOf'] || null; - this.predicate = options['predicate'] || null; - this.represent = options['represent'] || null; - this.defaultStyle = options['defaultStyle'] || null; - this.styleAliases = compileStyleAliases(options['styleAliases'] || null); + case 44: + relativeDirectories = _context.sent; + directories = relativeDirectories.map(function (p) { + return path.resolve(cwd, p); + }); + pkgJsonsMissingNameField = []; + _context.next = 49; + return Promise.all(directories.sort().map(function (dir) { + return fs.readJson(path.join(dir, "package.json")).then(function (packageJson) { + if (!packageJson.name) { + pkgJsonsMissingNameField.push(path.relative(cwd, path.join(dir, "package.json"))); + } - if (YAML_NODE_KINDS.indexOf(this.kind) === -1) { - throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.'); - } -} + return { + packageJson: packageJson, + dir: dir + }; + })["catch"](function (err) { + if (err.code === "ENOENT") { + return null; + } -module.exports = Type; + throw err; + }); + })); + case 49: + _context.t2 = function (x) { + return x; + }; -/***/ }), + results = _context.sent.filter(_context.t2); -/***/ 64304: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + if (!(pkgJsonsMissingNameField.length !== 0)) { + _context.next = 54; + break; + } -"use strict"; + pkgJsonsMissingNameField.sort(); + throw new PackageJsonMissingNameError(pkgJsonsMissingNameField); + case 54: + return _context.abrupt("return", { + tool: tool.type, + root: { + dir: cwd, + packageJson: pkg + }, + packages: results + }); -/*eslint-disable no-bitwise*/ + case 55: + case "end": + return _context.stop(); + } + } + }, _callee, null, [[14, 21], [26, 33]]); + })); + return _getPackages.apply(this, arguments); +} -var NodeBuffer; +function getPackagesSync(dir) { + var cwd = findRoot.findRootSync(dir); + var pkg = fs.readJsonSync(path.join(cwd, "package.json")); + var tool; -try { - // A trick for browserified version, to not include `Buffer` shim - var _require = require; - NodeBuffer = _require('buffer').Buffer; -} catch (__) {} + if (pkg.workspaces) { + if (Array.isArray(pkg.workspaces)) { + tool = { + type: "yarn", + packageGlobs: pkg.workspaces + }; + } else if (pkg.workspaces.packages) { + tool = { + type: "yarn", + packageGlobs: pkg.workspaces.packages + }; + } + } else if (pkg.bolt && pkg.bolt.workspaces) { + tool = { + type: "bolt", + packageGlobs: pkg.bolt.workspaces + }; + } else { + try { + var manifest = readYamlFile.sync(path.join(cwd, "pnpm-workspace.yaml")); -var Type = __nccwpck_require__(88210); + if (manifest && manifest.packages) { + tool = { + type: "pnpm", + packageGlobs: manifest.packages + }; + } + } catch (err) { + if (err.code !== "ENOENT") { + throw err; + } + } + if (!tool) { + try { + var lernaJson = fs.readJsonSync(path.join(cwd, "lerna.json")); -// [ 64, 65, 66 ] -> [ padding, CR, LF ] -var BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r'; + if (lernaJson) { + tool = { + type: "lerna", + packageGlobs: lernaJson.packages || ["packages/*"] + }; + } + } catch (err) { + if (err.code !== "ENOENT") { + throw err; + } + } + } + } + if (!tool) { + var root = { + dir: cwd, + packageJson: pkg + }; -function resolveYamlBinary(data) { - if (data === null) return false; + if (!pkg.name) { + throw new PackageJsonMissingNameError(["package.json"]); + } - var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP; + return { + tool: "root", + root: root, + packages: [root] + }; + } - // Convert one by one. - for (idx = 0; idx < max; idx++) { - code = map.indexOf(data.charAt(idx)); + var relativeDirectories = globby.sync(tool.packageGlobs, { + cwd: cwd, + onlyDirectories: true, + expandDirectories: false, + ignore: ["**/node_modules"] + }); + var directories = relativeDirectories.map(function (p) { + return path.resolve(cwd, p); + }); + var pkgJsonsMissingNameField = []; + var results = directories.sort().map(function (dir) { + try { + var packageJson = fs.readJsonSync(path.join(dir, "package.json")); - // Skip CR/LF - if (code > 64) continue; + if (!packageJson.name) { + pkgJsonsMissingNameField.push(path.relative(cwd, path.join(dir, "package.json"))); + } - // Fail on illegal characters - if (code < 0) return false; + return { + packageJson: packageJson, + dir: dir + }; + } catch (err) { + if (err.code === "ENOENT") return null; + throw err; + } + }).filter(function (x) { + return x; + }); - bitlen += 6; + if (pkgJsonsMissingNameField.length !== 0) { + pkgJsonsMissingNameField.sort(); + throw new PackageJsonMissingNameError(pkgJsonsMissingNameField); } - // If there are any bits left, source was corrupted - return (bitlen % 8) === 0; + return { + tool: tool.type, + root: { + dir: cwd, + packageJson: pkg + }, + packages: results + }; } -function constructYamlBinary(data) { - var idx, tailbits, - input = data.replace(/[\r\n=]/g, ''), // remove CR/LF & padding to simplify scan - max = input.length, - map = BASE64_MAP, - bits = 0, - result = []; +exports.PackageJsonMissingNameError = PackageJsonMissingNameError; +exports.getPackages = getPackages; +exports.getPackagesSync = getPackagesSync; - // Collect by 6*4 bits (3 bytes) - for (idx = 0; idx < max; idx++) { - if ((idx % 4 === 0) && idx) { - result.push((bits >> 16) & 0xFF); - result.push((bits >> 8) & 0xFF); - result.push(bits & 0xFF); - } +/***/ }), - bits = (bits << 6) | map.indexOf(input.charAt(idx)); - } +/***/ 94941: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - // Dump tail +"use strict"; - tailbits = (max % 4) * 6; - if (tailbits === 0) { - result.push((bits >> 16) & 0xFF); - result.push((bits >> 8) & 0xFF); - result.push(bits & 0xFF); - } else if (tailbits === 18) { - result.push((bits >> 10) & 0xFF); - result.push((bits >> 2) & 0xFF); - } else if (tailbits === 12) { - result.push((bits >> 4) & 0xFF); - } - - // Wrap into Buffer for NodeJS and leave Array for browser - if (NodeBuffer) { - // Support node 6.+ Buffer API when available - return NodeBuffer.from ? NodeBuffer.from(result) : new NodeBuffer(result); - } - - return result; +if (process.env.NODE_ENV === "production") { + module.exports = __nccwpck_require__(61042); +} else { + module.exports = __nccwpck_require__(16792); } -function representYamlBinary(object /*, style*/) { - var result = '', bits = 0, idx, tail, - max = object.length, - map = BASE64_MAP; - - // Convert every three bytes to 4 ASCII characters. - - for (idx = 0; idx < max; idx++) { - if ((idx % 3 === 0) && idx) { - result += map[(bits >> 18) & 0x3F]; - result += map[(bits >> 12) & 0x3F]; - result += map[(bits >> 6) & 0x3F]; - result += map[bits & 0x3F]; - } - bits = (bits << 8) + object[idx]; - } +/***/ }), - // Dump tail +/***/ 61042: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - tail = max % 3; +"use strict"; - if (tail === 0) { - result += map[(bits >> 18) & 0x3F]; - result += map[(bits >> 12) & 0x3F]; - result += map[(bits >> 6) & 0x3F]; - result += map[bits & 0x3F]; - } else if (tail === 2) { - result += map[(bits >> 10) & 0x3F]; - result += map[(bits >> 4) & 0x3F]; - result += map[(bits << 2) & 0x3F]; - result += map[64]; - } else if (tail === 1) { - result += map[(bits >> 2) & 0x3F]; - result += map[(bits << 4) & 0x3F]; - result += map[64]; - result += map[64]; - } - return result; +function _interopDefault(ex) { + return ex && "object" == typeof ex && "default" in ex ? ex.default : ex; } -function isBinary(object) { - return NodeBuffer && NodeBuffer.isBuffer(object); -} +Object.defineProperty(exports, "__esModule", ({ + value: !0 +})); -module.exports = new Type('tag:yaml.org,2002:binary', { - kind: 'scalar', - resolve: resolveYamlBinary, - construct: constructYamlBinary, - predicate: isBinary, - represent: representYamlBinary -}); +var _regeneratorRuntime = _interopDefault(__nccwpck_require__(65907)), _asyncToGenerator = _interopDefault(__nccwpck_require__(67584)), _classCallCheck = _interopDefault(__nccwpck_require__(33446)), _possibleConstructorReturn = _interopDefault(__nccwpck_require__(83855)), _getPrototypeOf = _interopDefault(__nccwpck_require__(55989)), _inherits = _interopDefault(__nccwpck_require__(87406)), _wrapNativeSuper = _interopDefault(__nccwpck_require__(16318)), fs = _interopDefault(__nccwpck_require__(5810)), path = _interopDefault(__nccwpck_require__(16928)), globby = __nccwpck_require__(46127), globby__default = _interopDefault(globby), readYamlFile = __nccwpck_require__(64109), readYamlFile__default = _interopDefault(readYamlFile), findRoot = __nccwpck_require__(67805), PackageJsonMissingNameError = function(_Error) { + function PackageJsonMissingNameError(directories) { + var _this; + return _classCallCheck(this, PackageJsonMissingNameError), (_this = _possibleConstructorReturn(this, _getPrototypeOf(PackageJsonMissingNameError).call(this, 'The following package.jsons are missing the "name" field:\n'.concat(directories.join("\n"))))).directories = directories, + _this; + } + return _inherits(PackageJsonMissingNameError, _Error), PackageJsonMissingNameError; +}(_wrapNativeSuper(Error)); +function getPackages(_x) { + return _getPackages.apply(this, arguments); +} -/***/ }), +function _getPackages() { + return (_getPackages = _asyncToGenerator(_regeneratorRuntime.mark(function _callee(dir) { + var cwd, pkg, tool, manifest, lernaJson, root, relativeDirectories, directories, pkgJsonsMissingNameField, results; + return _regeneratorRuntime.wrap(function(_context) { + for (;;) switch (_context.prev = _context.next) { + case 0: + return _context.next = 2, findRoot.findRoot(dir); -/***/ 4353: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + case 2: + return cwd = _context.sent, _context.next = 5, fs.readJson(path.join(cwd, "package.json")); -"use strict"; + case 5: + if (!(pkg = _context.sent).workspaces) { + _context.next = 10; + break; + } + Array.isArray(pkg.workspaces) ? tool = { + type: "yarn", + packageGlobs: pkg.workspaces + } : pkg.workspaces.packages && (tool = { + type: "yarn", + packageGlobs: pkg.workspaces.packages + }), _context.next = 37; + break; + case 10: + if (!pkg.bolt || !pkg.bolt.workspaces) { + _context.next = 14; + break; + } + tool = { + type: "bolt", + packageGlobs: pkg.bolt.workspaces + }, _context.next = 37; + break; -var Type = __nccwpck_require__(88210); + case 14: + return _context.prev = 14, _context.next = 17, readYamlFile__default(path.join(cwd, "pnpm-workspace.yaml")); -function resolveYamlBoolean(data) { - if (data === null) return false; + case 17: + (manifest = _context.sent) && manifest.packages && (tool = { + type: "pnpm", + packageGlobs: manifest.packages + }), _context.next = 25; + break; - var max = data.length; + case 21: + if (_context.prev = 21, _context.t0 = _context.catch(14), "ENOENT" === _context.t0.code) { + _context.next = 25; + break; + } + throw _context.t0; - return (max === 4 && (data === 'true' || data === 'True' || data === 'TRUE')) || - (max === 5 && (data === 'false' || data === 'False' || data === 'FALSE')); -} + case 25: + if (tool) { + _context.next = 37; + break; + } + return _context.prev = 26, _context.next = 29, fs.readJson(path.join(cwd, "lerna.json")); -function constructYamlBoolean(data) { - return data === 'true' || - data === 'True' || - data === 'TRUE'; -} + case 29: + (lernaJson = _context.sent) && (tool = { + type: "lerna", + packageGlobs: lernaJson.packages || [ "packages/*" ] + }), _context.next = 37; + break; -function isBoolean(object) { - return Object.prototype.toString.call(object) === '[object Boolean]'; -} + case 33: + if (_context.prev = 33, _context.t1 = _context.catch(26), "ENOENT" === _context.t1.code) { + _context.next = 37; + break; + } + throw _context.t1; -module.exports = new Type('tag:yaml.org,2002:bool', { - kind: 'scalar', - resolve: resolveYamlBoolean, - construct: constructYamlBoolean, - predicate: isBoolean, - represent: { - lowercase: function (object) { return object ? 'true' : 'false'; }, - uppercase: function (object) { return object ? 'TRUE' : 'FALSE'; }, - camelcase: function (object) { return object ? 'True' : 'False'; } - }, - defaultStyle: 'lowercase' -}); + case 37: + if (tool) { + _context.next = 42; + break; + } + if (root = { + dir: cwd, + packageJson: pkg + }, pkg.name) { + _context.next = 41; + break; + } + throw new PackageJsonMissingNameError([ "package.json" ]); + case 41: + return _context.abrupt("return", { + tool: "root", + root: root, + packages: [ root ] + }); -/***/ }), + case 42: + return _context.next = 44, globby__default(tool.packageGlobs, { + cwd: cwd, + onlyDirectories: !0, + expandDirectories: !1, + ignore: [ "**/node_modules" ] + }); -/***/ 23079: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + case 44: + return relativeDirectories = _context.sent, directories = relativeDirectories.map(function(p) { + return path.resolve(cwd, p); + }), pkgJsonsMissingNameField = [], _context.next = 49, Promise.all(directories.sort().map(function(dir) { + return fs.readJson(path.join(dir, "package.json")).then(function(packageJson) { + return packageJson.name || pkgJsonsMissingNameField.push(path.relative(cwd, path.join(dir, "package.json"))), + { + packageJson: packageJson, + dir: dir + }; + }).catch(function(err) { + if ("ENOENT" === err.code) return null; + throw err; + }); + })); -"use strict"; + case 49: + if (_context.t2 = function(x) { + return x; + }, results = _context.sent.filter(_context.t2), 0 === pkgJsonsMissingNameField.length) { + _context.next = 54; + break; + } + throw pkgJsonsMissingNameField.sort(), new PackageJsonMissingNameError(pkgJsonsMissingNameField); + case 54: + return _context.abrupt("return", { + tool: tool.type, + root: { + dir: cwd, + packageJson: pkg + }, + packages: results + }); -var common = __nccwpck_require__(99999); -var Type = __nccwpck_require__(88210); + case 55: + case "end": + return _context.stop(); + } + }, _callee, null, [ [ 14, 21 ], [ 26, 33 ] ]); + }))).apply(this, arguments); +} -var YAML_FLOAT_PATTERN = new RegExp( - // 2.5e4, 2.5 and integers - '^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?' + - // .2e4, .2 - // special case, seems not from spec - '|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?' + - // 20:59 - '|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*' + - // .inf - '|[-+]?\\.(?:inf|Inf|INF)' + - // .nan - '|\\.(?:nan|NaN|NAN))$'); - -function resolveYamlFloat(data) { - if (data === null) return false; - - if (!YAML_FLOAT_PATTERN.test(data) || - // Quick hack to not allow integers end with `_` - // Probably should update regexp & check speed - data[data.length - 1] === '_') { - return false; +function getPackagesSync(dir) { + var tool, cwd = findRoot.findRootSync(dir), pkg = fs.readJsonSync(path.join(cwd, "package.json")); + if (pkg.workspaces) Array.isArray(pkg.workspaces) ? tool = { + type: "yarn", + packageGlobs: pkg.workspaces + } : pkg.workspaces.packages && (tool = { + type: "yarn", + packageGlobs: pkg.workspaces.packages + }); else if (pkg.bolt && pkg.bolt.workspaces) tool = { + type: "bolt", + packageGlobs: pkg.bolt.workspaces + }; else { + try { + var manifest = readYamlFile.sync(path.join(cwd, "pnpm-workspace.yaml")); + manifest && manifest.packages && (tool = { + type: "pnpm", + packageGlobs: manifest.packages + }); + } catch (err) { + if ("ENOENT" !== err.code) throw err; + } + if (!tool) try { + var lernaJson = fs.readJsonSync(path.join(cwd, "lerna.json")); + lernaJson && (tool = { + type: "lerna", + packageGlobs: lernaJson.packages || [ "packages/*" ] + }); + } catch (err) { + if ("ENOENT" !== err.code) throw err; + } } - - return true; + if (!tool) { + var root = { + dir: cwd, + packageJson: pkg + }; + if (!pkg.name) throw new PackageJsonMissingNameError([ "package.json" ]); + return { + tool: "root", + root: root, + packages: [ root ] + }; + } + var directories = globby.sync(tool.packageGlobs, { + cwd: cwd, + onlyDirectories: !0, + expandDirectories: !1, + ignore: [ "**/node_modules" ] + }).map(function(p) { + return path.resolve(cwd, p); + }), pkgJsonsMissingNameField = [], results = directories.sort().map(function(dir) { + try { + var packageJson = fs.readJsonSync(path.join(dir, "package.json")); + return packageJson.name || pkgJsonsMissingNameField.push(path.relative(cwd, path.join(dir, "package.json"))), + { + packageJson: packageJson, + dir: dir + }; + } catch (err) { + if ("ENOENT" === err.code) return null; + throw err; + } + }).filter(function(x) { + return x; + }); + if (0 !== pkgJsonsMissingNameField.length) throw pkgJsonsMissingNameField.sort(), + new PackageJsonMissingNameError(pkgJsonsMissingNameField); + return { + tool: tool.type, + root: { + dir: cwd, + packageJson: pkg + }, + packages: results + }; } -function constructYamlFloat(data) { - var value, sign, base, digits; - - value = data.replace(/_/g, '').toLowerCase(); - sign = value[0] === '-' ? -1 : 1; - digits = []; - - if ('+-'.indexOf(value[0]) >= 0) { - value = value.slice(1); - } +exports.PackageJsonMissingNameError = PackageJsonMissingNameError, exports.getPackages = getPackages, +exports.getPackagesSync = getPackagesSync; - if (value === '.inf') { - return (sign === 1) ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY; - } else if (value === '.nan') { - return NaN; +/***/ }), - } else if (value.indexOf(':') >= 0) { - value.split(':').forEach(function (v) { - digits.unshift(parseFloat(v, 10)); - }); +/***/ 94145: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - value = 0.0; - base = 1; +"use strict"; - digits.forEach(function (d) { - value += d * base; - base *= 60; - }); - return sign * value; +const fs = __nccwpck_require__(61404) +const path = __nccwpck_require__(16928) +const mkdirpSync = (__nccwpck_require__(77999).mkdirsSync) +const utimesSync = (__nccwpck_require__(12804).utimesMillisSync) +const stat = __nccwpck_require__(91349) +function copySync (src, dest, opts) { + if (typeof opts === 'function') { + opts = { filter: opts } } - return sign * parseFloat(value, 10); -} + opts = opts || {} + opts.clobber = 'clobber' in opts ? !!opts.clobber : true // default to true for now + opts.overwrite = 'overwrite' in opts ? !!opts.overwrite : opts.clobber // overwrite falls back to clobber -var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/; + // Warn about using preserveTimestamps on 32-bit node + if (opts.preserveTimestamps && process.arch === 'ia32') { + console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n + see https://github.com/jprichardson/node-fs-extra/issues/269`) + } -function representYamlFloat(object, style) { - var res; + const { srcStat, destStat } = stat.checkPathsSync(src, dest, 'copy') + stat.checkParentPathsSync(src, srcStat, dest, 'copy') + return handleFilterAndCopy(destStat, src, dest, opts) +} - if (isNaN(object)) { - switch (style) { - case 'lowercase': return '.nan'; - case 'uppercase': return '.NAN'; - case 'camelcase': return '.NaN'; - } - } else if (Number.POSITIVE_INFINITY === object) { - switch (style) { - case 'lowercase': return '.inf'; - case 'uppercase': return '.INF'; - case 'camelcase': return '.Inf'; - } - } else if (Number.NEGATIVE_INFINITY === object) { - switch (style) { - case 'lowercase': return '-.inf'; - case 'uppercase': return '-.INF'; - case 'camelcase': return '-.Inf'; - } - } else if (common.isNegativeZero(object)) { - return '-0.0'; - } +function handleFilterAndCopy (destStat, src, dest, opts) { + if (opts.filter && !opts.filter(src, dest)) return + const destParent = path.dirname(dest) + if (!fs.existsSync(destParent)) mkdirpSync(destParent) + return startCopy(destStat, src, dest, opts) +} - res = object.toString(10); +function startCopy (destStat, src, dest, opts) { + if (opts.filter && !opts.filter(src, dest)) return + return getStats(destStat, src, dest, opts) +} - // JS stringifier can build scientific format without dots: 5e-100, - // while YAML requres dot: 5.e-100. Fix it with simple hack +function getStats (destStat, src, dest, opts) { + const statSync = opts.dereference ? fs.statSync : fs.lstatSync + const srcStat = statSync(src) - return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace('e', '.e') : res; + if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts) + else if (srcStat.isFile() || + srcStat.isCharacterDevice() || + srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts) + else if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts) } -function isFloat(object) { - return (Object.prototype.toString.call(object) === '[object Number]') && - (object % 1 !== 0 || common.isNegativeZero(object)); +function onFile (srcStat, destStat, src, dest, opts) { + if (!destStat) return copyFile(srcStat, src, dest, opts) + return mayCopyFile(srcStat, src, dest, opts) } -module.exports = new Type('tag:yaml.org,2002:float', { - kind: 'scalar', - resolve: resolveYamlFloat, - construct: constructYamlFloat, - predicate: isFloat, - represent: representYamlFloat, - defaultStyle: 'lowercase' -}); +function mayCopyFile (srcStat, src, dest, opts) { + if (opts.overwrite) { + fs.unlinkSync(dest) + return copyFile(srcStat, src, dest, opts) + } else if (opts.errorOnExist) { + throw new Error(`'${dest}' already exists`) + } +} +function copyFile (srcStat, src, dest, opts) { + if (typeof fs.copyFileSync === 'function') { + fs.copyFileSync(src, dest) + fs.chmodSync(dest, srcStat.mode) + if (opts.preserveTimestamps) { + return utimesSync(dest, srcStat.atime, srcStat.mtime) + } + return + } + return copyFileFallback(srcStat, src, dest, opts) +} -/***/ }), +function copyFileFallback (srcStat, src, dest, opts) { + const BUF_LENGTH = 64 * 1024 + const _buff = __nccwpck_require__(44973)(BUF_LENGTH) -/***/ 8696: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + const fdr = fs.openSync(src, 'r') + const fdw = fs.openSync(dest, 'w', srcStat.mode) + let pos = 0 -"use strict"; + while (pos < srcStat.size) { + const bytesRead = fs.readSync(fdr, _buff, 0, BUF_LENGTH, pos) + fs.writeSync(fdw, _buff, 0, bytesRead) + pos += bytesRead + } + if (opts.preserveTimestamps) fs.futimesSync(fdw, srcStat.atime, srcStat.mtime) -var common = __nccwpck_require__(99999); -var Type = __nccwpck_require__(88210); + fs.closeSync(fdr) + fs.closeSync(fdw) +} -function isHexCode(c) { - return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) || - ((0x41/* A */ <= c) && (c <= 0x46/* F */)) || - ((0x61/* a */ <= c) && (c <= 0x66/* f */)); +function onDir (srcStat, destStat, src, dest, opts) { + if (!destStat) return mkDirAndCopy(srcStat, src, dest, opts) + if (destStat && !destStat.isDirectory()) { + throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`) + } + return copyDir(src, dest, opts) } -function isOctCode(c) { - return ((0x30/* 0 */ <= c) && (c <= 0x37/* 7 */)); +function mkDirAndCopy (srcStat, src, dest, opts) { + fs.mkdirSync(dest) + copyDir(src, dest, opts) + return fs.chmodSync(dest, srcStat.mode) } -function isDecCode(c) { - return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)); +function copyDir (src, dest, opts) { + fs.readdirSync(src).forEach(item => copyDirItem(item, src, dest, opts)) } -function resolveYamlInteger(data) { - if (data === null) return false; - - var max = data.length, - index = 0, - hasDigits = false, - ch; - - if (!max) return false; - - ch = data[index]; +function copyDirItem (item, src, dest, opts) { + const srcItem = path.join(src, item) + const destItem = path.join(dest, item) + const { destStat } = stat.checkPathsSync(srcItem, destItem, 'copy') + return startCopy(destStat, srcItem, destItem, opts) +} - // sign - if (ch === '-' || ch === '+') { - ch = data[++index]; +function onLink (destStat, src, dest, opts) { + let resolvedSrc = fs.readlinkSync(src) + if (opts.dereference) { + resolvedSrc = path.resolve(process.cwd(), resolvedSrc) } - if (ch === '0') { - // 0 - if (index + 1 === max) return true; - ch = data[++index]; - - // base 2, base 8, base 16 - - if (ch === 'b') { - // base 2 - index++; - - for (; index < max; index++) { - ch = data[index]; - if (ch === '_') continue; - if (ch !== '0' && ch !== '1') return false; - hasDigits = true; - } - return hasDigits && ch !== '_'; + if (!destStat) { + return fs.symlinkSync(resolvedSrc, dest) + } else { + let resolvedDest + try { + resolvedDest = fs.readlinkSync(dest) + } catch (err) { + // dest exists and is a regular file or directory, + // Windows may throw UNKNOWN error. If dest already exists, + // fs throws error anyway, so no need to guard against it here. + if (err.code === 'EINVAL' || err.code === 'UNKNOWN') return fs.symlinkSync(resolvedSrc, dest) + throw err } - - - if (ch === 'x') { - // base 16 - index++; - - for (; index < max; index++) { - ch = data[index]; - if (ch === '_') continue; - if (!isHexCode(data.charCodeAt(index))) return false; - hasDigits = true; - } - return hasDigits && ch !== '_'; + 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}'.`) } - // base 8 - for (; index < max; index++) { - ch = data[index]; - if (ch === '_') continue; - if (!isOctCode(data.charCodeAt(index))) return false; - hasDigits = true; + // prevent copy if src is a subdir of dest since unlinking + // dest in this case would result in removing src contents + // and therefore a broken symlink would be created. + if (fs.statSync(dest).isDirectory() && stat.isSrcSubdir(resolvedDest, resolvedSrc)) { + throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`) } - return hasDigits && ch !== '_'; + return copyLink(resolvedSrc, dest) } +} - // base 10 (except 0) or base 60 +function copyLink (resolvedSrc, dest) { + fs.unlinkSync(dest) + return fs.symlinkSync(resolvedSrc, dest) +} - // value should not start with `_`; - if (ch === '_') return false; +module.exports = copySync - for (; index < max; index++) { - ch = data[index]; - if (ch === '_') continue; - if (ch === ':') break; - if (!isDecCode(data.charCodeAt(index))) { - return false; - } - hasDigits = true; - } - // Should have digits and should not end with `_` - if (!hasDigits || ch === '_') return false; +/***/ }), - // if !base60 - done; - if (ch !== ':') return true; +/***/ 36278: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - // base60 almost not used, no needs to optimize - return /^(:[0-5]?[0-9])+$/.test(data.slice(index)); -} +"use strict"; -function constructYamlInteger(data) { - var value = data, sign = 1, ch, base, digits = []; - if (value.indexOf('_') !== -1) { - value = value.replace(/_/g, ''); - } +module.exports = { + copySync: __nccwpck_require__(94145) +} - ch = value[0]; - if (ch === '-' || ch === '+') { - if (ch === '-') sign = -1; - value = value.slice(1); - ch = value[0]; - } +/***/ }), - if (value === '0') return 0; +/***/ 65737: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - if (ch === '0') { - if (value[1] === 'b') return sign * parseInt(value.slice(2), 2); - if (value[1] === 'x') return sign * parseInt(value, 16); - return sign * parseInt(value, 8); - } +"use strict"; - if (value.indexOf(':') !== -1) { - value.split(':').forEach(function (v) { - digits.unshift(parseInt(v, 10)); - }); - value = 0; - base = 1; +const fs = __nccwpck_require__(61404) +const path = __nccwpck_require__(16928) +const mkdirp = (__nccwpck_require__(77999).mkdirs) +const pathExists = (__nccwpck_require__(53647).pathExists) +const utimes = (__nccwpck_require__(12804).utimesMillis) +const stat = __nccwpck_require__(91349) - digits.forEach(function (d) { - value += (d * base); - base *= 60; - }); +function copy (src, dest, opts, cb) { + if (typeof opts === 'function' && !cb) { + cb = opts + opts = {} + } else if (typeof opts === 'function') { + opts = { filter: opts } + } - return sign * value; + cb = cb || function () {} + opts = opts || {} + + opts.clobber = 'clobber' in opts ? !!opts.clobber : true // default to true for now + opts.overwrite = 'overwrite' in opts ? !!opts.overwrite : opts.clobber // overwrite falls back to clobber + // Warn about using preserveTimestamps on 32-bit node + if (opts.preserveTimestamps && process.arch === 'ia32') { + console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n + see https://github.com/jprichardson/node-fs-extra/issues/269`) } - return sign * parseInt(value, 10); + stat.checkPaths(src, dest, 'copy', (err, stats) => { + if (err) return cb(err) + const { srcStat, destStat } = stats + stat.checkParentPaths(src, srcStat, dest, 'copy', err => { + if (err) return cb(err) + if (opts.filter) return handleFilter(checkParentDir, destStat, src, dest, opts, cb) + return checkParentDir(destStat, src, dest, opts, cb) + }) + }) } -function isInteger(object) { - return (Object.prototype.toString.call(object)) === '[object Number]' && - (object % 1 === 0 && !common.isNegativeZero(object)); +function checkParentDir (destStat, src, dest, opts, cb) { + const destParent = path.dirname(dest) + pathExists(destParent, (err, dirExists) => { + if (err) return cb(err) + if (dirExists) return startCopy(destStat, src, dest, opts, cb) + mkdirp(destParent, err => { + if (err) return cb(err) + return startCopy(destStat, src, dest, opts, cb) + }) + }) } -module.exports = new Type('tag:yaml.org,2002:int', { - kind: 'scalar', - resolve: resolveYamlInteger, - construct: constructYamlInteger, - predicate: isInteger, - represent: { - binary: function (obj) { return obj >= 0 ? '0b' + obj.toString(2) : '-0b' + obj.toString(2).slice(1); }, - octal: function (obj) { return obj >= 0 ? '0' + obj.toString(8) : '-0' + obj.toString(8).slice(1); }, - decimal: function (obj) { return obj.toString(10); }, - /* eslint-disable max-len */ - hexadecimal: function (obj) { return obj >= 0 ? '0x' + obj.toString(16).toUpperCase() : '-0x' + obj.toString(16).toUpperCase().slice(1); } - }, - defaultStyle: 'decimal', - styleAliases: { - binary: [ 2, 'bin' ], - octal: [ 8, 'oct' ], - decimal: [ 10, 'dec' ], - hexadecimal: [ 16, 'hex' ] - } -}); - +function handleFilter (onInclude, destStat, src, dest, opts, cb) { + Promise.resolve(opts.filter(src, dest)).then(include => { + if (include) return onInclude(destStat, src, dest, opts, cb) + return cb() + }, error => cb(error)) +} -/***/ }), +function startCopy (destStat, src, dest, opts, cb) { + if (opts.filter) return handleFilter(getStats, destStat, src, dest, opts, cb) + return getStats(destStat, src, dest, opts, cb) +} -/***/ 3737: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +function getStats (destStat, src, dest, opts, cb) { + const stat = opts.dereference ? fs.stat : fs.lstat + stat(src, (err, srcStat) => { + if (err) return cb(err) -"use strict"; + 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) + }) +} +function onFile (srcStat, destStat, src, dest, opts, cb) { + if (!destStat) return copyFile(srcStat, src, dest, opts, cb) + return mayCopyFile(srcStat, src, dest, opts, cb) +} -var esprima; +function mayCopyFile (srcStat, src, dest, opts, cb) { + if (opts.overwrite) { + fs.unlink(dest, err => { + if (err) return cb(err) + return copyFile(srcStat, src, dest, opts, cb) + }) + } else if (opts.errorOnExist) { + return cb(new Error(`'${dest}' already exists`)) + } else return cb() +} -// Browserified version does not have esprima -// -// 1. For node.js just require module as deps -// 2. For browser try to require mudule via external AMD system. -// If not found - try to fallback to window.esprima. If not -// found too - then fail to parse. -// -try { - // workaround to exclude package from browserify list. - var _require = require; - esprima = _require('esprima'); -} catch (_) { - /* eslint-disable no-redeclare */ - /* global window */ - if (typeof window !== 'undefined') esprima = window.esprima; +function copyFile (srcStat, src, dest, opts, cb) { + if (typeof fs.copyFile === 'function') { + return fs.copyFile(src, dest, err => { + if (err) return cb(err) + return setDestModeAndTimestamps(srcStat, dest, opts, cb) + }) + } + return copyFileFallback(srcStat, src, dest, opts, cb) } -var Type = __nccwpck_require__(88210); - -function resolveJavascriptFunction(data) { - if (data === null) return false; - - try { - var source = '(' + data + ')', - ast = esprima.parse(source, { range: true }); +function copyFileFallback (srcStat, src, dest, opts, cb) { + const rs = fs.createReadStream(src) + rs.on('error', err => cb(err)).once('open', () => { + const ws = fs.createWriteStream(dest, { mode: srcStat.mode }) + ws.on('error', err => cb(err)) + .on('open', () => rs.pipe(ws)) + .once('close', () => setDestModeAndTimestamps(srcStat, dest, opts, cb)) + }) +} - if (ast.type !== 'Program' || - ast.body.length !== 1 || - ast.body[0].type !== 'ExpressionStatement' || - (ast.body[0].expression.type !== 'ArrowFunctionExpression' && - ast.body[0].expression.type !== 'FunctionExpression')) { - return false; +function setDestModeAndTimestamps (srcStat, dest, opts, cb) { + fs.chmod(dest, srcStat.mode, err => { + if (err) return cb(err) + if (opts.preserveTimestamps) { + return utimes(dest, srcStat.atime, srcStat.mtime, cb) } - - return true; - } catch (err) { - return false; - } + return cb() + }) } -function constructJavascriptFunction(data) { - /*jslint evil:true*/ - - var source = '(' + data + ')', - ast = esprima.parse(source, { range: true }), - params = [], - body; - - if (ast.type !== 'Program' || - ast.body.length !== 1 || - ast.body[0].type !== 'ExpressionStatement' || - (ast.body[0].expression.type !== 'ArrowFunctionExpression' && - ast.body[0].expression.type !== 'FunctionExpression')) { - throw new Error('Failed to resolve function'); - } - - ast.body[0].expression.params.forEach(function (param) { - params.push(param.name); - }); - - body = ast.body[0].expression.body.range; - - // Esprima's ranges include the first '{' and the last '}' characters on - // function expressions. So cut them out. - if (ast.body[0].expression.body.type === 'BlockStatement') { - /*eslint-disable no-new-func*/ - return new Function(params, source.slice(body[0] + 1, body[1] - 1)); +function onDir (srcStat, destStat, src, dest, opts, cb) { + if (!destStat) return mkDirAndCopy(srcStat, src, dest, opts, cb) + if (destStat && !destStat.isDirectory()) { + return cb(new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`)) } - // ES6 arrow functions can omit the BlockStatement. In that case, just return - // the body. - /*eslint-disable no-new-func*/ - return new Function(params, 'return ' + source.slice(body[0], body[1])); + return copyDir(src, dest, opts, cb) } -function representJavascriptFunction(object /*, style*/) { - return object.toString(); +function mkDirAndCopy (srcStat, src, dest, opts, cb) { + fs.mkdir(dest, err => { + if (err) return cb(err) + copyDir(src, dest, opts, err => { + if (err) return cb(err) + return fs.chmod(dest, srcStat.mode, cb) + }) + }) } -function isFunction(object) { - return Object.prototype.toString.call(object) === '[object Function]'; +function copyDir (src, dest, opts, cb) { + fs.readdir(src, (err, items) => { + if (err) return cb(err) + return copyDirItems(items, src, dest, opts, cb) + }) } -module.exports = new Type('tag:yaml.org,2002:js/function', { - kind: 'scalar', - resolve: resolveJavascriptFunction, - construct: constructJavascriptFunction, - predicate: isFunction, - represent: representJavascriptFunction -}); - - -/***/ }), - -/***/ 26996: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - -"use strict"; - - -var Type = __nccwpck_require__(88210); - -function resolveJavascriptRegExp(data) { - if (data === null) return false; - if (data.length === 0) return false; - - var regexp = data, - tail = /\/([gim]*)$/.exec(data), - modifiers = ''; - - // if regexp starts with '/' it can have modifiers and must be properly closed - // `/foo/gim` - modifiers tail can be maximum 3 chars - if (regexp[0] === '/') { - if (tail) modifiers = tail[1]; - - if (modifiers.length > 3) return false; - // if expression starts with /, is should be properly terminated - if (regexp[regexp.length - modifiers.length - 1] !== '/') return false; - } - - return true; +function copyDirItems (items, src, dest, opts, cb) { + const item = items.pop() + if (!item) return cb() + return copyDirItem(items, item, src, dest, opts, cb) } -function constructJavascriptRegExp(data) { - var regexp = data, - tail = /\/([gim]*)$/.exec(data), - modifiers = ''; - - // `/foo/gim` - tail can be maximum 4 chars - if (regexp[0] === '/') { - if (tail) modifiers = tail[1]; - regexp = regexp.slice(1, regexp.length - modifiers.length - 1); - } - - return new RegExp(regexp, modifiers); +function copyDirItem (items, item, src, dest, opts, cb) { + const srcItem = path.join(src, item) + const destItem = path.join(dest, item) + stat.checkPaths(srcItem, destItem, 'copy', (err, stats) => { + if (err) return cb(err) + const { destStat } = stats + startCopy(destStat, srcItem, destItem, opts, err => { + if (err) return cb(err) + return copyDirItems(items, src, dest, opts, cb) + }) + }) } -function representJavascriptRegExp(object /*, style*/) { - var result = '/' + object.source + '/'; +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 (object.global) result += 'g'; - if (object.multiline) result += 'm'; - if (object.ignoreCase) result += 'i'; + if (!destStat) { + return fs.symlink(resolvedSrc, dest, cb) + } else { + fs.readlink(dest, (err, resolvedDest) => { + if (err) { + // dest exists and is a regular file or directory, + // Windows may throw UNKNOWN error. If dest already exists, + // fs throws error anyway, so no need to guard against it here. + if (err.code === 'EINVAL' || err.code === 'UNKNOWN') return fs.symlink(resolvedSrc, dest, cb) + return cb(err) + } + 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}'.`)) + } - return result; + // do not copy if src is a subdir of dest since unlinking + // dest in this case would result in removing src contents + // and therefore a broken symlink would be created. + if (destStat.isDirectory() && stat.isSrcSubdir(resolvedDest, resolvedSrc)) { + return cb(new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`)) + } + return copyLink(resolvedSrc, dest, cb) + }) + } + }) } -function isRegExp(object) { - return Object.prototype.toString.call(object) === '[object RegExp]'; +function copyLink (resolvedSrc, dest, cb) { + fs.unlink(dest, err => { + if (err) return cb(err) + return fs.symlink(resolvedSrc, dest, cb) + }) } -module.exports = new Type('tag:yaml.org,2002:js/regexp', { - kind: 'scalar', - resolve: resolveJavascriptRegExp, - construct: constructJavascriptRegExp, - predicate: isRegExp, - represent: representJavascriptRegExp -}); +module.exports = copy /***/ }), -/***/ 6561: +/***/ 32558: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -var Type = __nccwpck_require__(88210); - -function resolveJavascriptUndefined() { - return true; -} - -function constructJavascriptUndefined() { - /*eslint-disable no-undefined*/ - return undefined; -} - -function representJavascriptUndefined() { - return ''; -} - -function isUndefined(object) { - return typeof object === 'undefined'; +const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) +module.exports = { + copy: u(__nccwpck_require__(65737)) } -module.exports = new Type('tag:yaml.org,2002:js/undefined', { - kind: 'scalar', - resolve: resolveJavascriptUndefined, - construct: constructJavascriptUndefined, - predicate: isUndefined, - represent: representJavascriptUndefined -}); - /***/ }), -/***/ 61619: +/***/ 77032: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -var Type = __nccwpck_require__(88210); - -module.exports = new Type('tag:yaml.org,2002:map', { - kind: 'mapping', - construct: function (data) { return data !== null ? data : {}; } -}); - +const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) +const fs = __nccwpck_require__(61404) +const path = __nccwpck_require__(16928) +const mkdir = __nccwpck_require__(77999) +const remove = __nccwpck_require__(84507) -/***/ }), +const emptyDir = u(function emptyDir (dir, callback) { + callback = callback || function () {} + fs.readdir(dir, (err, items) => { + if (err) return mkdir.mkdirs(dir, callback) -/***/ 23557: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + items = items.map(item => path.join(dir, item)) -"use strict"; + deleteItem() + function deleteItem () { + const item = items.pop() + if (!item) return callback() + remove.remove(item, err => { + if (err) return callback(err) + deleteItem() + }) + } + }) +}) -var Type = __nccwpck_require__(88210); +function emptyDirSync (dir) { + let items + try { + items = fs.readdirSync(dir) + } catch (err) { + return mkdir.mkdirsSync(dir) + } -function resolveYamlMerge(data) { - return data === '<<' || data === null; + items.forEach(item => { + item = path.join(dir, item) + remove.removeSync(item) + }) } -module.exports = new Type('tag:yaml.org,2002:merge', { - kind: 'scalar', - resolve: resolveYamlMerge -}); +module.exports = { + emptyDirSync, + emptydirSync: emptyDirSync, + emptyDir, + emptydir: emptyDir +} /***/ }), -/***/ 30280: +/***/ 17731: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -var Type = __nccwpck_require__(88210); - -function resolveYamlNull(data) { - if (data === null) return true; +const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) +const path = __nccwpck_require__(16928) +const fs = __nccwpck_require__(61404) +const mkdir = __nccwpck_require__(77999) +const pathExists = (__nccwpck_require__(53647).pathExists) - var max = data.length; +function createFile (file, callback) { + function makeFile () { + fs.writeFile(file, '', err => { + if (err) return callback(err) + callback() + }) + } - return (max === 1 && data === '~') || - (max === 4 && (data === 'null' || data === 'Null' || data === 'NULL')); + fs.stat(file, (err, stats) => { // eslint-disable-line handle-callback-err + if (!err && stats.isFile()) return callback() + const dir = path.dirname(file) + pathExists(dir, (err, dirExists) => { + if (err) return callback(err) + if (dirExists) return makeFile() + mkdir.mkdirs(dir, err => { + if (err) return callback(err) + makeFile() + }) + }) + }) } -function constructYamlNull() { - return null; -} +function createFileSync (file) { + let stats + try { + stats = fs.statSync(file) + } catch (e) {} + if (stats && stats.isFile()) return -function isNull(object) { - return object === null; + const dir = path.dirname(file) + if (!fs.existsSync(dir)) { + mkdir.mkdirsSync(dir) + } + + fs.writeFileSync(file, '') } -module.exports = new Type('tag:yaml.org,2002:null', { - kind: 'scalar', - resolve: resolveYamlNull, - construct: constructYamlNull, - predicate: isNull, - represent: { - canonical: function () { return '~'; }, - lowercase: function () { return 'null'; }, - uppercase: function () { return 'NULL'; }, - camelcase: function () { return 'Null'; } - }, - defaultStyle: 'lowercase' -}); +module.exports = { + createFile: u(createFile), + createFileSync +} /***/ }), -/***/ 81300: +/***/ 25985: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -var Type = __nccwpck_require__(88210); - -var _hasOwnProperty = Object.prototype.hasOwnProperty; -var _toString = Object.prototype.toString; - -function resolveYamlOmap(data) { - if (data === null) return true; - - var objectKeys = [], index, length, pair, pairKey, pairHasKey, - object = data; - - for (index = 0, length = object.length; index < length; index += 1) { - pair = object[index]; - pairHasKey = false; - - if (_toString.call(pair) !== '[object Object]') return false; - - for (pairKey in pair) { - if (_hasOwnProperty.call(pair, pairKey)) { - if (!pairHasKey) pairHasKey = true; - else return false; - } - } - - if (!pairHasKey) return false; - - if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey); - else return false; - } - - return true; -} +const file = __nccwpck_require__(17731) +const link = __nccwpck_require__(8381) +const symlink = __nccwpck_require__(12062) -function constructYamlOmap(data) { - return data !== null ? data : []; +module.exports = { + // file + createFile: file.createFile, + createFileSync: file.createFileSync, + ensureFile: file.createFile, + ensureFileSync: file.createFileSync, + // link + createLink: link.createLink, + createLinkSync: link.createLinkSync, + ensureLink: link.createLink, + ensureLinkSync: link.createLinkSync, + // symlink + createSymlink: symlink.createSymlink, + createSymlinkSync: symlink.createSymlinkSync, + ensureSymlink: symlink.createSymlink, + ensureSymlinkSync: symlink.createSymlinkSync } -module.exports = new Type('tag:yaml.org,2002:omap', { - kind: 'sequence', - resolve: resolveYamlOmap, - construct: constructYamlOmap -}); - /***/ }), -/***/ 84144: +/***/ 8381: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -var Type = __nccwpck_require__(88210); - -var _toString = Object.prototype.toString; - -function resolveYamlPairs(data) { - if (data === null) return true; - - var index, length, pair, keys, result, - object = data; - - result = new Array(object.length); +const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) +const path = __nccwpck_require__(16928) +const fs = __nccwpck_require__(61404) +const mkdir = __nccwpck_require__(77999) +const pathExists = (__nccwpck_require__(53647).pathExists) - for (index = 0, length = object.length; index < length; index += 1) { - pair = object[index]; +function createLink (srcpath, dstpath, callback) { + function makeLink (srcpath, dstpath) { + fs.link(srcpath, dstpath, err => { + if (err) return callback(err) + callback(null) + }) + } - if (_toString.call(pair) !== '[object Object]') return false; + pathExists(dstpath, (err, destinationExists) => { + if (err) return callback(err) + if (destinationExists) return callback(null) + fs.lstat(srcpath, (err) => { + if (err) { + err.message = err.message.replace('lstat', 'ensureLink') + return callback(err) + } - keys = Object.keys(pair); + const dir = path.dirname(dstpath) + pathExists(dir, (err, dirExists) => { + if (err) return callback(err) + if (dirExists) return makeLink(srcpath, dstpath) + mkdir.mkdirs(dir, err => { + if (err) return callback(err) + makeLink(srcpath, dstpath) + }) + }) + }) + }) +} - if (keys.length !== 1) return false; +function createLinkSync (srcpath, dstpath) { + const destinationExists = fs.existsSync(dstpath) + if (destinationExists) return undefined - result[index] = [ keys[0], pair[keys[0]] ]; + try { + fs.lstatSync(srcpath) + } catch (err) { + err.message = err.message.replace('lstat', 'ensureLink') + throw err } - return true; + const dir = path.dirname(dstpath) + const dirExists = fs.existsSync(dir) + if (dirExists) return fs.linkSync(srcpath, dstpath) + mkdir.mkdirsSync(dir) + + return fs.linkSync(srcpath, dstpath) } -function constructYamlPairs(data) { - if (data === null) return []; +module.exports = { + createLink: u(createLink), + createLinkSync +} - var index, length, pair, keys, result, - object = data; - result = new Array(object.length); +/***/ }), - for (index = 0, length = object.length; index < length; index += 1) { - pair = object[index]; +/***/ 37363: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - keys = Object.keys(pair); +"use strict"; - result[index] = [ keys[0], pair[keys[0]] ]; - } - return result; -} - -module.exports = new Type('tag:yaml.org,2002:pairs', { - kind: 'sequence', - resolve: resolveYamlPairs, - construct: constructYamlPairs -}); - - -/***/ }), - -/***/ 19058: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +const path = __nccwpck_require__(16928) +const fs = __nccwpck_require__(61404) +const pathExists = (__nccwpck_require__(53647).pathExists) -"use strict"; +/** + * Function that returns two types of paths, one relative to symlink, and one + * relative to the current working directory. Checks if path is absolute or + * relative. If the path is relative, this function checks if the path is + * relative to symlink or relative to current working directory. This is an + * initiative to find a smarter `srcpath` to supply when building symlinks. + * This allows you to determine which path to use out of one of three possible + * types of source paths. The first is an absolute path. This is detected by + * `path.isAbsolute()`. When an absolute path is provided, it is checked to + * see if it exists. If it does it's used, if not an error is returned + * (callback)/ thrown (sync). The other two options for `srcpath` are a + * relative url. By default Node's `fs.symlink` works by creating a symlink + * using `dstpath` and expects the `srcpath` to be relative to the newly + * created symlink. If you provide a `srcpath` that does not exist on the file + * system it results in a broken symlink. To minimize this, the function + * checks to see if the 'relative to symlink' source file exists, and if it + * does it will use it. If it does not, it checks if there's a file that + * exists that is relative to the current working directory, if does its used. + * This preserves the expectations of the original fs.symlink spec and adds + * the ability to pass in `relative to current working direcotry` paths. + */ +function symlinkPaths (srcpath, dstpath, callback) { + if (path.isAbsolute(srcpath)) { + return fs.lstat(srcpath, (err) => { + if (err) { + err.message = err.message.replace('lstat', 'ensureSymlink') + return callback(err) + } + return callback(null, { + 'toCwd': srcpath, + 'toDst': srcpath + }) + }) + } else { + const dstdir = path.dirname(dstpath) + const relativeToDst = path.join(dstdir, srcpath) + return pathExists(relativeToDst, (err, exists) => { + if (err) return callback(err) + if (exists) { + return callback(null, { + 'toCwd': relativeToDst, + 'toDst': srcpath + }) + } else { + return fs.lstat(srcpath, (err) => { + if (err) { + err.message = err.message.replace('lstat', 'ensureSymlink') + return callback(err) + } + return callback(null, { + 'toCwd': srcpath, + 'toDst': path.relative(dstdir, srcpath) + }) + }) + } + }) + } +} -var Type = __nccwpck_require__(88210); +function symlinkPathsSync (srcpath, dstpath) { + let exists + if (path.isAbsolute(srcpath)) { + 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) + } + } + } +} -module.exports = new Type('tag:yaml.org,2002:seq', { - kind: 'sequence', - construct: function (data) { return data !== null ? data : []; } -}); +module.exports = { + symlinkPaths, + symlinkPathsSync +} /***/ }), -/***/ 29821: +/***/ 93959: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -var Type = __nccwpck_require__(88210); - -var _hasOwnProperty = Object.prototype.hasOwnProperty; +const fs = __nccwpck_require__(61404) -function resolveYamlSet(data) { - if (data === null) return true; +function symlinkType (srcpath, type, callback) { + callback = (typeof type === 'function') ? type : callback + type = (typeof type === 'function') ? false : type + if (type) return callback(null, type) + fs.lstat(srcpath, (err, stats) => { + if (err) return callback(null, 'file') + type = (stats && stats.isDirectory()) ? 'dir' : 'file' + callback(null, type) + }) +} - var key, object = data; +function symlinkTypeSync (srcpath, type) { + let stats - for (key in object) { - if (_hasOwnProperty.call(object, key)) { - if (object[key] !== null) return false; - } + if (type) return type + try { + stats = fs.lstatSync(srcpath) + } catch (e) { + return 'file' } - - return true; + return (stats && stats.isDirectory()) ? 'dir' : 'file' } -function constructYamlSet(data) { - return data !== null ? data : {}; +module.exports = { + symlinkType, + symlinkTypeSync } -module.exports = new Type('tag:yaml.org,2002:set', { - kind: 'mapping', - resolve: resolveYamlSet, - construct: constructYamlSet -}); - /***/ }), -/***/ 19286: +/***/ 12062: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -var Type = __nccwpck_require__(88210); - -module.exports = new Type('tag:yaml.org,2002:str', { - kind: 'scalar', - construct: function (data) { return data !== null ? data : ''; } -}); - +const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) +const path = __nccwpck_require__(16928) +const fs = __nccwpck_require__(61404) +const _mkdirs = __nccwpck_require__(77999) +const mkdirs = _mkdirs.mkdirs +const mkdirsSync = _mkdirs.mkdirsSync -/***/ }), +const _symlinkPaths = __nccwpck_require__(37363) +const symlinkPaths = _symlinkPaths.symlinkPaths +const symlinkPathsSync = _symlinkPaths.symlinkPathsSync -/***/ 61757: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +const _symlinkType = __nccwpck_require__(93959) +const symlinkType = _symlinkType.symlinkType +const symlinkTypeSync = _symlinkType.symlinkTypeSync -"use strict"; +const pathExists = (__nccwpck_require__(53647).pathExists) +function createSymlink (srcpath, dstpath, type, callback) { + callback = (typeof type === 'function') ? type : callback + type = (typeof type === 'function') ? false : type -var Type = __nccwpck_require__(88210); + pathExists(dstpath, (err, destinationExists) => { + if (err) return callback(err) + if (destinationExists) return callback(null) + symlinkPaths(srcpath, dstpath, (err, relative) => { + if (err) return callback(err) + srcpath = relative.toDst + symlinkType(relative.toCwd, type, (err, type) => { + if (err) return callback(err) + const dir = path.dirname(dstpath) + pathExists(dir, (err, dirExists) => { + if (err) return callback(err) + if (dirExists) return fs.symlink(srcpath, dstpath, type, callback) + mkdirs(dir, err => { + if (err) return callback(err) + fs.symlink(srcpath, dstpath, type, callback) + }) + }) + }) + }) + }) +} -var YAML_DATE_REGEXP = new RegExp( - '^([0-9][0-9][0-9][0-9])' + // [1] year - '-([0-9][0-9])' + // [2] month - '-([0-9][0-9])$'); // [3] day +function createSymlinkSync (srcpath, dstpath, type) { + const destinationExists = fs.existsSync(dstpath) + if (destinationExists) return undefined -var YAML_TIMESTAMP_REGEXP = new RegExp( - '^([0-9][0-9][0-9][0-9])' + // [1] year - '-([0-9][0-9]?)' + // [2] month - '-([0-9][0-9]?)' + // [3] day - '(?:[Tt]|[ \\t]+)' + // ... - '([0-9][0-9]?)' + // [4] hour - ':([0-9][0-9])' + // [5] minute - ':([0-9][0-9])' + // [6] second - '(?:\\.([0-9]*))?' + // [7] fraction - '(?:[ \\t]*(Z|([-+])([0-9][0-9]?)' + // [8] tz [9] tz_sign [10] tz_hour - '(?::([0-9][0-9]))?))?$'); // [11] tz_minute + const relative = symlinkPathsSync(srcpath, dstpath) + srcpath = relative.toDst + type = symlinkTypeSync(relative.toCwd, type) + const dir = path.dirname(dstpath) + const exists = fs.existsSync(dir) + if (exists) return fs.symlinkSync(srcpath, dstpath, type) + mkdirsSync(dir) + return fs.symlinkSync(srcpath, dstpath, type) +} -function resolveYamlTimestamp(data) { - if (data === null) return false; - if (YAML_DATE_REGEXP.exec(data) !== null) return true; - if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true; - return false; +module.exports = { + createSymlink: u(createSymlink), + createSymlinkSync } -function constructYamlTimestamp(data) { - var match, year, month, day, hour, minute, second, fraction = 0, - delta = null, tz_hour, tz_minute, date; - match = YAML_DATE_REGEXP.exec(data); - if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data); +/***/ }), - if (match === null) throw new Error('Date resolve error'); +/***/ 58684: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - // match: [1] year [2] month [3] day +"use strict"; - year = +(match[1]); - month = +(match[2]) - 1; // JS month starts with 0 - day = +(match[3]); +// This is adapted from https://github.com/normalize/mz +// Copyright (c) 2014-2016 Jonathan Ong me@jongleberry.com and Contributors +const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) +const fs = __nccwpck_require__(61404) - if (!match[4]) { // no hour - return new Date(Date.UTC(year, month, day)); - } +const api = [ + 'access', + 'appendFile', + 'chmod', + 'chown', + 'close', + 'copyFile', + 'fchmod', + 'fchown', + 'fdatasync', + 'fstat', + 'fsync', + 'ftruncate', + 'futimes', + 'lchown', + 'lchmod', + 'link', + 'lstat', + 'mkdir', + 'mkdtemp', + 'open', + 'readFile', + 'readdir', + 'readlink', + 'realpath', + 'rename', + 'rmdir', + 'stat', + 'symlink', + 'truncate', + 'unlink', + 'utimes', + 'writeFile' +].filter(key => { + // Some commands are not available on some systems. Ex: + // fs.copyFile was added in Node.js v8.5.0 + // fs.mkdtemp was added in Node.js v5.10.0 + // fs.lchown is not available on at least some Linux + return typeof fs[key] === 'function' +}) - // match: [4] hour [5] minute [6] second [7] fraction +// Export all keys: +Object.keys(fs).forEach(key => { + if (key === 'promises') { + // fs.promises is a getter property that triggers ExperimentalWarning + // Don't re-export it here, the getter is defined in "lib/index.js" + return + } + exports[key] = fs[key] +}) - hour = +(match[4]); - minute = +(match[5]); - second = +(match[6]); +// Universalify async methods: +api.forEach(method => { + exports[method] = u(fs[method]) +}) - if (match[7]) { - fraction = match[7].slice(0, 3); - while (fraction.length < 3) { // milli-seconds - fraction += '0'; - } - fraction = +fraction; +// We differ from mz/fs in that we still ship the old, broken, fs.exists() +// since we are a drop-in replacement for the native module +exports.exists = function (filename, callback) { + if (typeof callback === 'function') { + return fs.exists(filename, callback) } + return new Promise(resolve => { + return fs.exists(filename, resolve) + }) +} - // match: [8] tz [9] tz_sign [10] tz_hour [11] tz_minute +// fs.read() & fs.write need special treatment due to multiple callback args - if (match[9]) { - tz_hour = +(match[10]); - tz_minute = +(match[11] || 0); - delta = (tz_hour * 60 + tz_minute) * 60000; // delta in mili-seconds - if (match[9] === '-') delta = -delta; +exports.read = function (fd, buffer, offset, length, position, callback) { + if (typeof callback === 'function') { + return fs.read(fd, buffer, offset, length, position, callback) } + return new Promise((resolve, reject) => { + fs.read(fd, buffer, offset, length, position, (err, bytesRead, buffer) => { + if (err) return reject(err) + resolve({ bytesRead, buffer }) + }) + }) +} - date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction)); - - if (delta) date.setTime(date.getTime() - delta); +// Function signature can be +// fs.write(fd, buffer[, offset[, length[, position]]], callback) +// OR +// fs.write(fd, string[, position[, encoding]], callback) +// We need to handle both cases, so we use ...args +exports.write = function (fd, buffer, ...args) { + if (typeof args[args.length - 1] === 'function') { + return fs.write(fd, buffer, ...args) + } - return date; + return new Promise((resolve, reject) => { + fs.write(fd, buffer, ...args, (err, bytesWritten, buffer) => { + if (err) return reject(err) + resolve({ bytesWritten, buffer }) + }) + }) } -function representYamlTimestamp(object /*, style*/) { - return object.toISOString(); +// fs.realpath.native only available in Node v9.2+ +if (typeof fs.realpath.native === 'function') { + exports.realpath.native = u(fs.realpath.native) } -module.exports = new Type('tag:yaml.org,2002:timestamp', { - kind: 'scalar', - resolve: resolveYamlTimestamp, - construct: constructYamlTimestamp, - instanceOf: Date, - represent: representYamlTimestamp -}); - /***/ }), -/***/ 37763: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ 5810: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -Object.defineProperty(exports, "__esModule", ({ value: true })); - -var fs = __nccwpck_require__(41348); -var path = __nccwpck_require__(16928); -var getPackages = __nccwpck_require__(94941); -var errors = __nccwpck_require__(17789); - -function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; } +module.exports = Object.assign( + {}, + // Export promiseified graceful-fs: + __nccwpck_require__(58684), + // Export extra methods: + __nccwpck_require__(36278), + __nccwpck_require__(32558), + __nccwpck_require__(77032), + __nccwpck_require__(25985), + __nccwpck_require__(60457), + __nccwpck_require__(77999), + __nccwpck_require__(3262), + __nccwpck_require__(59926), + __nccwpck_require__(78778), + __nccwpck_require__(53647), + __nccwpck_require__(84507) +) -function _interopNamespace(e) { - if (e && e.__esModule) return e; - var n = Object.create(null); - if (e) { - Object.keys(e).forEach(function (k) { - if (k !== 'default') { - var d = Object.getOwnPropertyDescriptor(e, k); - Object.defineProperty(n, k, d.get ? d : { - enumerable: true, - get: function () { return e[k]; } - }); - } - }); - } - n["default"] = e; - return Object.freeze(n); +// Export fs.promises as a getter property so that we don't trigger +// ExperimentalWarning before fs.promises is actually accessed. +const fs = __nccwpck_require__(79896) +if (Object.getOwnPropertyDescriptor(fs, 'promises')) { + Object.defineProperty(module.exports, "promises", ({ + get () { return fs.promises } + })) } -var fs__namespace = /*#__PURE__*/_interopNamespace(fs); -var path__default = /*#__PURE__*/_interopDefault(path); -function _defineProperty(obj, key, value) { - if (key in obj) { - Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - } else { - obj[key] = value; - } +/***/ }), - return obj; -} +/***/ 60457: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -function ownKeys(object, enumerableOnly) { - var keys = Object.keys(object); +"use strict"; - if (Object.getOwnPropertySymbols) { - var symbols = Object.getOwnPropertySymbols(object); - if (enumerableOnly) symbols = symbols.filter(function (sym) { - return Object.getOwnPropertyDescriptor(object, sym).enumerable; - }); - keys.push.apply(keys, symbols); - } - return keys; -} +const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) +const jsonFile = __nccwpck_require__(46333) -function _objectSpread2(target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i] != null ? arguments[i] : {}; +jsonFile.outputJson = u(__nccwpck_require__(49483)) +jsonFile.outputJsonSync = __nccwpck_require__(74363) +// aliases +jsonFile.outputJSON = jsonFile.outputJson +jsonFile.outputJSONSync = jsonFile.outputJsonSync +jsonFile.writeJSON = jsonFile.writeJson +jsonFile.writeJSONSync = jsonFile.writeJsonSync +jsonFile.readJSON = jsonFile.readJson +jsonFile.readJSONSync = jsonFile.readJsonSync - if (i % 2) { - ownKeys(Object(source), true).forEach(function (key) { - _defineProperty(target, key, source[key]); - }); - } else if (Object.getOwnPropertyDescriptors) { - Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); - } else { - ownKeys(Object(source)).forEach(function (key) { - Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); - }); - } - } +module.exports = jsonFile - return target; -} -async function readPreState(cwd) { - let preStatePath = path__default["default"].resolve(cwd, ".changeset", "pre.json"); // TODO: verify that the pre state isn't broken +/***/ }), - let preState; +/***/ 46333: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - try { - let contents = await fs__namespace.readFile(preStatePath, "utf8"); +"use strict"; - try { - preState = JSON.parse(contents); - } catch (err) { - if (err instanceof SyntaxError) { - console.error("error parsing json:", contents); - } - throw err; - } - } catch (err) { - if (err.code !== "ENOENT") { - throw err; - } - } +const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) +const jsonFile = __nccwpck_require__(93588) - return preState; +module.exports = { + // jsonfile exports + readJson: u(jsonFile.readFile), + readJsonSync: jsonFile.readFileSync, + writeJson: u(jsonFile.writeFile), + writeJsonSync: jsonFile.writeFileSync } -async function exitPre(cwd) { - let preStatePath = path__default["default"].resolve(cwd, ".changeset", "pre.json"); // TODO: verify that the pre state isn't broken - let preState = await readPreState(cwd); - if (preState === undefined) { - throw new errors.PreExitButNotInPreModeError(); - } +/***/ }), - await fs__namespace.outputFile(preStatePath, JSON.stringify(_objectSpread2(_objectSpread2({}, preState), {}, { - mode: "exit" - }), null, 2) + "\n"); -} -async function enterPre(cwd, tag) { - var _preState$changesets; +/***/ 74363: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - let packages = await getPackages.getPackages(cwd); - let preStatePath = path__default["default"].resolve(packages.root.dir, ".changeset", "pre.json"); - let preState = await readPreState(packages.root.dir); // can't reenter if pre mode still exists, but we should allow exited pre mode to be reentered +"use strict"; - if ((preState === null || preState === void 0 ? void 0 : preState.mode) === "pre") { - throw new errors.PreEnterButInPreModeError(); - } - let newPreState = { - mode: "pre", - tag, - initialVersions: {}, - changesets: (_preState$changesets = preState === null || preState === void 0 ? void 0 : preState.changesets) !== null && _preState$changesets !== void 0 ? _preState$changesets : [] - }; +const fs = __nccwpck_require__(61404) +const path = __nccwpck_require__(16928) +const mkdir = __nccwpck_require__(77999) +const jsonFile = __nccwpck_require__(46333) - for (let pkg of packages.packages) { - newPreState.initialVersions[pkg.packageJson.name] = pkg.packageJson.version; +function outputJsonSync (file, data, options) { + const dir = path.dirname(file) + + if (!fs.existsSync(dir)) { + mkdir.mkdirsSync(dir) } - await fs__namespace.outputFile(preStatePath, JSON.stringify(newPreState, null, 2) + "\n"); + jsonFile.writeJsonSync(file, data, options) } -exports.enterPre = enterPre; -exports.exitPre = exitPre; -exports.readPreState = readPreState; +module.exports = outputJsonSync /***/ }), -/***/ 74007: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ 49483: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -Object.defineProperty(exports, "__esModule", ({ value: true })); - -var fs = __nccwpck_require__(41348); -var path = __nccwpck_require__(16928); -var parse = __nccwpck_require__(7751); -var git = __nccwpck_require__(59427); -var pc = __nccwpck_require__(96596); -var pFilter = __nccwpck_require__(97465); -var logger = __nccwpck_require__(68323); - -function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; } +const path = __nccwpck_require__(16928) +const mkdir = __nccwpck_require__(77999) +const pathExists = (__nccwpck_require__(53647).pathExists) +const jsonFile = __nccwpck_require__(46333) -function _interopNamespace(e) { - if (e && e.__esModule) return e; - var n = Object.create(null); - if (e) { - Object.keys(e).forEach(function (k) { - if (k !== 'default') { - var d = Object.getOwnPropertyDescriptor(e, k); - Object.defineProperty(n, k, d.get ? d : { - enumerable: true, - get: function () { return e[k]; } - }); - } - }); +function outputJson (file, data, options, callback) { + if (typeof options === 'function') { + callback = options + options = {} } - n["default"] = e; - return Object.freeze(n); -} -var fs__namespace = /*#__PURE__*/_interopNamespace(fs); -var path__default = /*#__PURE__*/_interopDefault(path); -var parse__default = /*#__PURE__*/_interopDefault(parse); -var git__namespace = /*#__PURE__*/_interopNamespace(git); -var pc__default = /*#__PURE__*/_interopDefault(pc); -var pFilter__default = /*#__PURE__*/_interopDefault(pFilter); + const dir = path.dirname(file) -function _toPrimitive(t, r) { - if ("object" != typeof t || !t) return t; - var e = t[Symbol.toPrimitive]; - if (void 0 !== e) { - var i = e.call(t, r || "default"); - if ("object" != typeof i) return i; - throw new TypeError("@@toPrimitive must return a primitive value."); - } - return ("string" === r ? String : Number)(t); -} + pathExists(dir, (err, itDoes) => { + if (err) return callback(err) + if (itDoes) return jsonFile.writeJson(file, data, options, callback) -function _toPropertyKey(t) { - var i = _toPrimitive(t, "string"); - return "symbol" == typeof i ? i : i + ""; + mkdir.mkdirs(dir, err => { + if (err) return callback(err) + jsonFile.writeJson(file, data, options, callback) + }) + }) } -function _defineProperty(e, r, t) { - return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { - value: t, - enumerable: !0, - configurable: !0, - writable: !0 - }) : e[r] = t, e; -} +module.exports = outputJson -function ownKeys(e, r) { - var t = Object.keys(e); - if (Object.getOwnPropertySymbols) { - var o = Object.getOwnPropertySymbols(e); - r && (o = o.filter(function (r) { - return Object.getOwnPropertyDescriptor(e, r).enumerable; - })), t.push.apply(t, o); - } - return t; -} -function _objectSpread2(e) { - for (var r = 1; r < arguments.length; r++) { - var t = null != arguments[r] ? arguments[r] : {}; - r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { - _defineProperty(e, r, t[r]); - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { - Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); - }); - } - return e; -} -// THIS SHOULD BE REMOVED WHEN SUPPORT FOR CHANGESETS FROM V1 IS DROPPED +/***/ }), -let importantSeparator = pc__default["default"].red("===============================IMPORTANT!==============================="); -let importantEnd = pc__default["default"].red("----------------------------------------------------------------------"); -async function getOldChangesets(changesetBase, dirs) { - // this needs to support just not dealing with dirs that aren't set up properly - let changesets = await pFilter__default["default"](dirs, async dir => (await fs__namespace.lstat(path__default["default"].join(changesetBase, dir))).isDirectory()); - const changesetContents = changesets.map(async changesetDir => { - const jsonPath = path__default["default"].join(changesetBase, changesetDir, "changes.json"); - const [summary, json] = await Promise.all([fs__namespace.readFile(path__default["default"].join(changesetBase, changesetDir, "changes.md"), "utf-8"), fs__namespace.readJson(jsonPath)]); - return { - releases: json.releases, - summary, - id: changesetDir - }; - }); - return Promise.all(changesetContents); -} +/***/ 77999: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -// this function only exists while we wait for v1 changesets to be obsoleted -// and should be deleted before v3 -async function getOldChangesetsAndWarn(changesetBase, dirs) { - let oldChangesets = await getOldChangesets(changesetBase, dirs); - if (oldChangesets.length === 0) { - return []; - } - logger.warn(importantSeparator); - logger.warn("There were old changesets from version 1 found"); - logger.warn("These are being applied now but the dependents graph may have changed"); - logger.warn("Make sure you validate all your dependencies"); - logger.warn("In a future major version, we will no longer apply these old changesets, and will instead throw here"); - logger.warn(importantEnd); - return oldChangesets; -} +"use strict"; -async function filterChangesetsSinceRef(changesets, changesetBase, sinceRef) { - const newChangesets = await git__namespace.getChangedChangesetFilesSinceRef({ - cwd: changesetBase, - ref: sinceRef - }); - const newHashes = newChangesets.map(c => c.split("/").pop()); - return changesets.filter(dir => newHashes.includes(dir)); -} -async function getChangesets(cwd, sinceRef) { - let changesetBase = path__default["default"].join(cwd, ".changeset"); - let contents; - try { - contents = await fs__namespace["default"].readdir(changesetBase); - } catch (err) { - if (err.code === "ENOENT") { - throw new Error("There is no .changeset directory in this project"); - } - throw err; - } - if (sinceRef !== undefined) { - contents = await filterChangesetsSinceRef(contents, changesetBase, sinceRef); - } - let oldChangesetsPromise = getOldChangesetsAndWarn(changesetBase, contents); - let changesets = contents.filter(file => !file.startsWith(".") && file.endsWith(".md") && !/^README\.md$/i.test(file)); - const changesetContents = changesets.map(async file => { - const changeset = await fs__namespace["default"].readFile(path__default["default"].join(changesetBase, file), "utf-8"); - return _objectSpread2(_objectSpread2({}, parse__default["default"](changeset)), {}, { - id: file.replace(".md", "") - }); - }); - return [...(await oldChangesetsPromise), ...(await Promise.all(changesetContents))]; -} +const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) +const mkdirs = u(__nccwpck_require__(40931)) +const mkdirsSync = __nccwpck_require__(6419) -exports["default"] = getChangesets; +module.exports = { + mkdirs, + mkdirsSync, + // alias + mkdirp: mkdirs, + mkdirpSync: mkdirsSync, + ensureDir: mkdirs, + ensureDirSync: mkdirsSync +} /***/ }), -/***/ 81435: -/***/ ((__unused_webpack_module, exports) => { +/***/ 6419: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -Object.defineProperty(exports, "__esModule", ({ value: true })); +const fs = __nccwpck_require__(61404) +const path = __nccwpck_require__(16928) +const invalidWin32Path = (__nccwpck_require__(62936).invalidWin32Path) -function shouldSkipPackage({ - packageJson -}, { - ignore, - allowPrivatePackages -}) { - if (ignore.includes(packageJson.name)) { - return true; - } +const o777 = parseInt('0777', 8) - if (packageJson.private && !allowPrivatePackages) { - return true; +function mkdirsSync (p, opts, made) { + if (!opts || typeof opts !== 'object') { + opts = { mode: opts } } - return !packageJson.version; -} - -exports.shouldSkipPackage = shouldSkipPackage; + let mode = opts.mode + const xfs = opts.fs || fs + + if (process.platform === 'win32' && invalidWin32Path(p)) { + const errInval = new Error(p + ' contains invalid WIN32 path characters.') + errInval.code = 'EINVAL' + throw errInval + } + + if (mode === undefined) { + mode = o777 & (~process.umask()) + } + if (!made) made = null + + p = path.resolve(p) + + try { + xfs.mkdirSync(p, mode) + made = made || p + } catch (err0) { + if (err0.code === 'ENOENT') { + if (path.dirname(p) === p) throw err0 + made = mkdirsSync(path.dirname(p), opts, made) + mkdirsSync(p, opts, made) + } else { + // In the case of any other error, just see if there's a dir there + // already. If so, then hooray! If not, then something is borked. + let stat + try { + stat = xfs.statSync(p) + } catch (err1) { + throw err0 + } + if (!stat.isDirectory()) throw err0 + } + } + + return made +} + +module.exports = mkdirsSync /***/ }), -/***/ 44248: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ 40931: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -Object.defineProperty(exports, "__esModule", ({ value: true })); - -function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } +const fs = __nccwpck_require__(61404) +const path = __nccwpck_require__(16928) +const invalidWin32Path = (__nccwpck_require__(62936).invalidWin32Path) -var _regeneratorRuntime = _interopDefault(__nccwpck_require__(65907)); -var _asyncToGenerator = _interopDefault(__nccwpck_require__(67584)); -var _classCallCheck = _interopDefault(__nccwpck_require__(33446)); -var _possibleConstructorReturn = _interopDefault(__nccwpck_require__(83855)); -var _getPrototypeOf = _interopDefault(__nccwpck_require__(55989)); -var _inherits = _interopDefault(__nccwpck_require__(87406)); -var _wrapNativeSuper = _interopDefault(__nccwpck_require__(16318)); -var findUp = __nccwpck_require__(81179); -var findUp__default = _interopDefault(findUp); -var path = _interopDefault(__nccwpck_require__(16928)); -var fs = _interopDefault(__nccwpck_require__(97298)); +const o777 = parseInt('0777', 8) -var NoPkgJsonFound = -/*#__PURE__*/ -function (_Error) { - _inherits(NoPkgJsonFound, _Error); +function mkdirs (p, opts, callback, made) { + if (typeof opts === 'function') { + callback = opts + opts = {} + } else if (!opts || typeof opts !== 'object') { + opts = { mode: opts } + } - function NoPkgJsonFound(directory) { - var _this; + if (process.platform === 'win32' && invalidWin32Path(p)) { + const errInval = new Error(p + ' contains invalid WIN32 path characters.') + errInval.code = 'EINVAL' + return callback(errInval) + } - _classCallCheck(this, NoPkgJsonFound); + let mode = opts.mode + const xfs = opts.fs || fs - _this = _possibleConstructorReturn(this, _getPrototypeOf(NoPkgJsonFound).call(this, "No package.json could be found upwards from the directory ".concat(directory))); - _this.directory = directory; - return _this; + if (mode === undefined) { + mode = o777 & (~process.umask()) } + if (!made) made = null - return NoPkgJsonFound; -}(_wrapNativeSuper(Error)); + callback = callback || function () {} + p = path.resolve(p) -function hasWorkspacesConfiguredViaPkgJson(_x, _x2) { - return _hasWorkspacesConfiguredViaPkgJson.apply(this, arguments); + xfs.mkdir(p, mode, er => { + if (!er) { + made = made || p + return callback(null, made) + } + switch (er.code) { + case 'ENOENT': + if (path.dirname(p) === p) return callback(er) + mkdirs(path.dirname(p), opts, (er, made) => { + if (er) callback(er, made) + else mkdirs(p, opts, callback, made) + }) + break + + // In the case of any other error, just see if there's a dir + // there already. If so, then hooray! If not, then something + // is borked. + default: + xfs.stat(p, (er2, stat) => { + // if the stat fails, then that's super weird. + // let the original error be the failure reason. + if (er2 || !stat.isDirectory()) callback(er, made) + else callback(null, made) + }) + break + } + }) } -function _hasWorkspacesConfiguredViaPkgJson() { - _hasWorkspacesConfiguredViaPkgJson = _asyncToGenerator( - /*#__PURE__*/ - _regeneratorRuntime.mark(function _callee(directory, firstPkgJsonDirRef) { - var pkgJson; - return _regeneratorRuntime.wrap(function _callee$(_context) { - while (1) { - switch (_context.prev = _context.next) { - case 0: - _context.prev = 0; - _context.next = 3; - return fs.readJson(path.join(directory, "package.json")); +module.exports = mkdirs - case 3: - pkgJson = _context.sent; - if (firstPkgJsonDirRef.current === undefined) { - firstPkgJsonDirRef.current = directory; - } +/***/ }), - if (!(pkgJson.workspaces || pkgJson.bolt)) { - _context.next = 7; - break; - } +/***/ 62936: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - return _context.abrupt("return", directory); +"use strict"; - case 7: - _context.next = 13; - break; - case 9: - _context.prev = 9; - _context.t0 = _context["catch"](0); +const path = __nccwpck_require__(16928) - if (!(_context.t0.code !== "ENOENT")) { - _context.next = 13; - break; - } +// get drive on windows +function getRootPath (p) { + p = path.normalize(path.resolve(p)).split(path.sep) + if (p.length > 0) return p[0] + return null +} - throw _context.t0; +// http://stackoverflow.com/a/62888/10333 contains more accurate +// TODO: expand to include the rest +const INVALID_PATH_CHARS = /[<>:"|?*]/ - case 13: - case "end": - return _context.stop(); - } - } - }, _callee, null, [[0, 9]]); - })); - return _hasWorkspacesConfiguredViaPkgJson.apply(this, arguments); +function invalidWin32Path (p) { + const rp = getRootPath(p) + p = p.replace(rp, '') + return INVALID_PATH_CHARS.test(p) } -function hasWorkspacesConfiguredViaLerna(_x3) { - return _hasWorkspacesConfiguredViaLerna.apply(this, arguments); +module.exports = { + getRootPath, + invalidWin32Path } -function _hasWorkspacesConfiguredViaLerna() { - _hasWorkspacesConfiguredViaLerna = _asyncToGenerator( - /*#__PURE__*/ - _regeneratorRuntime.mark(function _callee2(directory) { - var lernaJson; - return _regeneratorRuntime.wrap(function _callee2$(_context2) { - while (1) { - switch (_context2.prev = _context2.next) { - case 0: - _context2.prev = 0; - _context2.next = 3; - return fs.readJson(path.join(directory, "lerna.json")); - - case 3: - lernaJson = _context2.sent; - if (!(lernaJson.useWorkspaces !== true)) { - _context2.next = 6; - break; - } +/***/ }), - return _context2.abrupt("return", directory); +/***/ 3262: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - case 6: - _context2.next = 12; - break; +"use strict"; - case 8: - _context2.prev = 8; - _context2.t0 = _context2["catch"](0); - if (!(_context2.t0.code !== "ENOENT")) { - _context2.next = 12; - break; - } +module.exports = { + moveSync: __nccwpck_require__(80041) +} - throw _context2.t0; - case 12: - case "end": - return _context2.stop(); - } - } - }, _callee2, null, [[0, 8]]); - })); - return _hasWorkspacesConfiguredViaLerna.apply(this, arguments); -} +/***/ }), -function hasWorkspacesConfiguredViaPnpm(_x4) { - return _hasWorkspacesConfiguredViaPnpm.apply(this, arguments); -} +/***/ 80041: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -function _hasWorkspacesConfiguredViaPnpm() { - _hasWorkspacesConfiguredViaPnpm = _asyncToGenerator( - /*#__PURE__*/ - _regeneratorRuntime.mark(function _callee3(directory) { - var pnpmWorkspacesFileExists; - return _regeneratorRuntime.wrap(function _callee3$(_context3) { - while (1) { - switch (_context3.prev = _context3.next) { - case 0: - _context3.next = 2; - return fs.exists(path.join(directory, "pnpm-workspace.yaml")); +"use strict"; - case 2: - pnpmWorkspacesFileExists = _context3.sent; - if (!pnpmWorkspacesFileExists) { - _context3.next = 5; - break; - } +const fs = __nccwpck_require__(61404) +const path = __nccwpck_require__(16928) +const copySync = (__nccwpck_require__(36278).copySync) +const removeSync = (__nccwpck_require__(84507).removeSync) +const mkdirpSync = (__nccwpck_require__(77999).mkdirpSync) +const stat = __nccwpck_require__(91349) - return _context3.abrupt("return", directory); +function moveSync (src, dest, opts) { + opts = opts || {} + const overwrite = opts.overwrite || opts.clobber || false - case 5: - case "end": - return _context3.stop(); - } - } - }, _callee3); - })); - return _hasWorkspacesConfiguredViaPnpm.apply(this, arguments); + const { srcStat } = stat.checkPathsSync(src, dest, 'move') + stat.checkParentPathsSync(src, srcStat, dest, 'move') + mkdirpSync(path.dirname(dest)) + return doRename(src, dest, overwrite) } -function findRoot(_x5) { - return _findRoot.apply(this, arguments); +function doRename (src, dest, overwrite) { + if (overwrite) { + removeSync(dest) + return rename(src, dest, overwrite) + } + if (fs.existsSync(dest)) throw new Error('dest already exists.') + return rename(src, dest, overwrite) } -function _findRoot() { - _findRoot = _asyncToGenerator( - /*#__PURE__*/ - _regeneratorRuntime.mark(function _callee4(cwd) { - var firstPkgJsonDirRef, dir; - return _regeneratorRuntime.wrap(function _callee4$(_context4) { - while (1) { - switch (_context4.prev = _context4.next) { - case 0: - firstPkgJsonDirRef = { - current: undefined - }; - _context4.next = 3; - return findUp__default(function (directory) { - return Promise.all([hasWorkspacesConfiguredViaLerna(directory), hasWorkspacesConfiguredViaPkgJson(directory, firstPkgJsonDirRef), hasWorkspacesConfiguredViaPnpm(directory)]).then(function (x) { - return x.find(function (dir) { - return dir; - }); - }); - }, { - cwd: cwd, - type: "directory" - }); +function rename (src, dest, overwrite) { + try { + fs.renameSync(src, dest) + } catch (err) { + if (err.code !== 'EXDEV') throw err + return moveAcrossDevice(src, dest, overwrite) + } +} - case 3: - dir = _context4.sent; +function moveAcrossDevice (src, dest, overwrite) { + const opts = { + overwrite, + errorOnExist: true + } + copySync(src, dest, opts) + return removeSync(src) +} - if (!(firstPkgJsonDirRef.current === undefined)) { - _context4.next = 6; - break; - } +module.exports = moveSync - throw new NoPkgJsonFound(cwd); - case 6: - if (!(dir === undefined)) { - _context4.next = 8; - break; - } +/***/ }), - return _context4.abrupt("return", firstPkgJsonDirRef.current); +/***/ 59926: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - case 8: - return _context4.abrupt("return", dir); +"use strict"; - case 9: - case "end": - return _context4.stop(); - } - } - }, _callee4); - })); - return _findRoot.apply(this, arguments); + +const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) +module.exports = { + move: u(__nccwpck_require__(35825)) } -function hasWorkspacesConfiguredViaPkgJsonSync(directory, firstPkgJsonDirRef) { - try { - var pkgJson = fs.readJsonSync(path.join(directory, "package.json")); - if (firstPkgJsonDirRef.current === undefined) { - firstPkgJsonDirRef.current = directory; - } +/***/ }), - if (pkgJson.workspaces || pkgJson.bolt) { - return directory; - } - } catch (err) { - if (err.code !== "ENOENT") { - throw err; - } - } -} +/***/ 35825: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -function hasWorkspacesConfiguredViaLernaSync(directory) { - try { - var lernaJson = fs.readJsonSync(path.join(directory, "lerna.json")); +"use strict"; - if (lernaJson.useWorkspaces !== true) { - return directory; - } - } catch (err) { - if (err.code !== "ENOENT") { - throw err; - } - } -} -function hasWorkspacesConfiguredViaPnpmSync(directory) { - // @ts-ignore - var pnpmWorkspacesFileExists = fs.existsSync(path.join(directory, "pnpm-workspace.yaml")); +const fs = __nccwpck_require__(61404) +const path = __nccwpck_require__(16928) +const copy = (__nccwpck_require__(32558).copy) +const remove = (__nccwpck_require__(84507).remove) +const mkdirp = (__nccwpck_require__(77999).mkdirp) +const pathExists = (__nccwpck_require__(53647).pathExists) +const stat = __nccwpck_require__(91349) - if (pnpmWorkspacesFileExists) { - return directory; +function move (src, dest, opts, cb) { + if (typeof opts === 'function') { + cb = opts + opts = {} } -} -function findRootSync(cwd) { - var firstPkgJsonDirRef = { - current: undefined - }; - var dir = findUp.sync(function (directory) { - return [hasWorkspacesConfiguredViaLernaSync(directory), hasWorkspacesConfiguredViaPkgJsonSync(directory, firstPkgJsonDirRef), hasWorkspacesConfiguredViaPnpmSync(directory)].find(function (dir) { - return dir; - }); - }, { - cwd: cwd, - type: "directory" - }); + const overwrite = opts.overwrite || opts.clobber || false - if (firstPkgJsonDirRef.current === undefined) { - throw new NoPkgJsonFound(cwd); - } + stat.checkPaths(src, dest, 'move', (err, stats) => { + if (err) return cb(err) + const { srcStat } = stats + stat.checkParentPaths(src, srcStat, dest, 'move', err => { + if (err) return cb(err) + mkdirp(path.dirname(dest), err => { + if (err) return cb(err) + return doRename(src, dest, overwrite, cb) + }) + }) + }) +} - if (dir === undefined) { - return firstPkgJsonDirRef.current; +function doRename (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) + }) +} - return dir; +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) + }) } -exports.NoPkgJsonFound = NoPkgJsonFound; -exports.findRoot = findRoot; -exports.findRootSync = findRootSync; +function moveAcrossDevice (src, dest, overwrite, cb) { + const opts = { + overwrite, + errorOnExist: true + } + copy(src, dest, opts, err => { + if (err) return cb(err) + return remove(src, cb) + }) +} + +module.exports = move /***/ }), -/***/ 67805: +/***/ 78778: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -if (process.env.NODE_ENV === "production") { - module.exports = __nccwpck_require__(4530); -} else { - module.exports = __nccwpck_require__(44248); -} - - -/***/ }), +const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) +const fs = __nccwpck_require__(61404) +const path = __nccwpck_require__(16928) +const mkdir = __nccwpck_require__(77999) +const pathExists = (__nccwpck_require__(53647).pathExists) -/***/ 4530: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +function outputFile (file, data, encoding, callback) { + if (typeof encoding === 'function') { + callback = encoding + encoding = 'utf8' + } -"use strict"; + 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, err => { + if (err) return callback(err) -function _interopDefault(ex) { - return ex && "object" == typeof ex && "default" in ex ? ex.default : ex; + fs.writeFile(file, data, encoding, callback) + }) + }) } -Object.defineProperty(exports, "__esModule", ({ - value: !0 -})); - -var _regeneratorRuntime = _interopDefault(__nccwpck_require__(65907)), _asyncToGenerator = _interopDefault(__nccwpck_require__(67584)), _classCallCheck = _interopDefault(__nccwpck_require__(33446)), _possibleConstructorReturn = _interopDefault(__nccwpck_require__(83855)), _getPrototypeOf = _interopDefault(__nccwpck_require__(55989)), _inherits = _interopDefault(__nccwpck_require__(87406)), _wrapNativeSuper = _interopDefault(__nccwpck_require__(16318)), findUp = __nccwpck_require__(81179), findUp__default = _interopDefault(findUp), path = _interopDefault(__nccwpck_require__(16928)), fs = _interopDefault(__nccwpck_require__(97298)), NoPkgJsonFound = function(_Error) { - function NoPkgJsonFound(directory) { - var _this; - return _classCallCheck(this, NoPkgJsonFound), (_this = _possibleConstructorReturn(this, _getPrototypeOf(NoPkgJsonFound).call(this, "No package.json could be found upwards from the directory ".concat(directory)))).directory = directory, - _this; +function outputFileSync (file, ...args) { + const dir = path.dirname(file) + if (fs.existsSync(dir)) { + return fs.writeFileSync(file, ...args) } - return _inherits(NoPkgJsonFound, _Error), NoPkgJsonFound; -}(_wrapNativeSuper(Error)); - -function hasWorkspacesConfiguredViaPkgJson(_x, _x2) { - return _hasWorkspacesConfiguredViaPkgJson.apply(this, arguments); -} - -function _hasWorkspacesConfiguredViaPkgJson() { - return (_hasWorkspacesConfiguredViaPkgJson = _asyncToGenerator(_regeneratorRuntime.mark(function _callee(directory, firstPkgJsonDirRef) { - var pkgJson; - return _regeneratorRuntime.wrap(function(_context) { - for (;;) switch (_context.prev = _context.next) { - case 0: - return _context.prev = 0, _context.next = 3, fs.readJson(path.join(directory, "package.json")); - - case 3: - if (pkgJson = _context.sent, void 0 === firstPkgJsonDirRef.current && (firstPkgJsonDirRef.current = directory), - !pkgJson.workspaces && !pkgJson.bolt) { - _context.next = 7; - break; - } - return _context.abrupt("return", directory); - - case 7: - _context.next = 13; - break; - - case 9: - if (_context.prev = 9, _context.t0 = _context.catch(0), "ENOENT" === _context.t0.code) { - _context.next = 13; - break; - } - throw _context.t0; - - case 13: - case "end": - return _context.stop(); - } - }, _callee, null, [ [ 0, 9 ] ]); - }))).apply(this, arguments); + mkdir.mkdirsSync(dir) + fs.writeFileSync(file, ...args) } -function hasWorkspacesConfiguredViaLerna(_x3) { - return _hasWorkspacesConfiguredViaLerna.apply(this, arguments); +module.exports = { + outputFile: u(outputFile), + outputFileSync } -function _hasWorkspacesConfiguredViaLerna() { - return (_hasWorkspacesConfiguredViaLerna = _asyncToGenerator(_regeneratorRuntime.mark(function _callee2(directory) { - return _regeneratorRuntime.wrap(function(_context2) { - for (;;) switch (_context2.prev = _context2.next) { - case 0: - return _context2.prev = 0, _context2.next = 3, fs.readJson(path.join(directory, "lerna.json")); - - case 3: - if (!0 === _context2.sent.useWorkspaces) { - _context2.next = 6; - break; - } - return _context2.abrupt("return", directory); - - case 6: - _context2.next = 12; - break; - - case 8: - if (_context2.prev = 8, _context2.t0 = _context2.catch(0), "ENOENT" === _context2.t0.code) { - _context2.next = 12; - break; - } - throw _context2.t0; - case 12: - case "end": - return _context2.stop(); - } - }, _callee2, null, [ [ 0, 8 ] ]); - }))).apply(this, arguments); -} +/***/ }), -function hasWorkspacesConfiguredViaPnpm(_x4) { - return _hasWorkspacesConfiguredViaPnpm.apply(this, arguments); -} +/***/ 53647: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -function _hasWorkspacesConfiguredViaPnpm() { - return (_hasWorkspacesConfiguredViaPnpm = _asyncToGenerator(_regeneratorRuntime.mark(function _callee3(directory) { - return _regeneratorRuntime.wrap(function(_context3) { - for (;;) switch (_context3.prev = _context3.next) { - case 0: - return _context3.next = 2, fs.exists(path.join(directory, "pnpm-workspace.yaml")); +"use strict"; - case 2: - if (!_context3.sent) { - _context3.next = 5; - break; - } - return _context3.abrupt("return", directory); +const u = (__nccwpck_require__(92977)/* .fromPromise */ .z) +const fs = __nccwpck_require__(58684) - case 5: - case "end": - return _context3.stop(); - } - }, _callee3); - }))).apply(this, arguments); +function pathExists (path) { + return fs.access(path).then(() => true).catch(() => false) } -function findRoot(_x5) { - return _findRoot.apply(this, arguments); +module.exports = { + pathExists: u(pathExists), + pathExistsSync: fs.existsSync } -function _findRoot() { - return (_findRoot = _asyncToGenerator(_regeneratorRuntime.mark(function _callee4(cwd) { - var firstPkgJsonDirRef, dir; - return _regeneratorRuntime.wrap(function(_context4) { - for (;;) switch (_context4.prev = _context4.next) { - case 0: - return firstPkgJsonDirRef = { - current: void 0 - }, _context4.next = 3, findUp__default(function(directory) { - return Promise.all([ hasWorkspacesConfiguredViaLerna(directory), hasWorkspacesConfiguredViaPkgJson(directory, firstPkgJsonDirRef), hasWorkspacesConfiguredViaPnpm(directory) ]).then(function(x) { - return x.find(function(dir) { - return dir; - }); - }); - }, { - cwd: cwd, - type: "directory" - }); - - case 3: - if (dir = _context4.sent, void 0 !== firstPkgJsonDirRef.current) { - _context4.next = 6; - break; - } - throw new NoPkgJsonFound(cwd); - - case 6: - if (void 0 !== dir) { - _context4.next = 8; - break; - } - return _context4.abrupt("return", firstPkgJsonDirRef.current); - case 8: - return _context4.abrupt("return", dir); +/***/ }), - case 9: - case "end": - return _context4.stop(); - } - }, _callee4); - }))).apply(this, arguments); -} +/***/ 84507: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -function hasWorkspacesConfiguredViaPkgJsonSync(directory, firstPkgJsonDirRef) { - try { - var pkgJson = fs.readJsonSync(path.join(directory, "package.json")); - if (void 0 === firstPkgJsonDirRef.current && (firstPkgJsonDirRef.current = directory), - pkgJson.workspaces || pkgJson.bolt) return directory; - } catch (err) { - if ("ENOENT" !== err.code) throw err; - } -} +"use strict"; -function hasWorkspacesConfiguredViaLernaSync(directory) { - try { - if (!0 !== fs.readJsonSync(path.join(directory, "lerna.json")).useWorkspaces) return directory; - } catch (err) { - if ("ENOENT" !== err.code) throw err; - } -} -function hasWorkspacesConfiguredViaPnpmSync(directory) { - if (fs.existsSync(path.join(directory, "pnpm-workspace.yaml"))) return directory; -} +const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) +const rimraf = __nccwpck_require__(92170) -function findRootSync(cwd) { - var firstPkgJsonDirRef = { - current: void 0 - }, dir = findUp.sync(function(directory) { - return [ hasWorkspacesConfiguredViaLernaSync(directory), hasWorkspacesConfiguredViaPkgJsonSync(directory, firstPkgJsonDirRef), hasWorkspacesConfiguredViaPnpmSync(directory) ].find(function(dir) { - return dir; - }); - }, { - cwd: cwd, - type: "directory" - }); - if (void 0 === firstPkgJsonDirRef.current) throw new NoPkgJsonFound(cwd); - return void 0 === dir ? firstPkgJsonDirRef.current : dir; +module.exports = { + remove: u(rimraf), + removeSync: rimraf.sync } -exports.NoPkgJsonFound = NoPkgJsonFound, exports.findRoot = findRoot, exports.findRootSync = findRootSync; - /***/ }), -/***/ 39969: +/***/ 92170: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; @@ -10074,15338 +10185,15120 @@ exports.NoPkgJsonFound = NoPkgJsonFound, exports.findRoot = findRoot, exports.fi const fs = __nccwpck_require__(61404) const path = __nccwpck_require__(16928) -const mkdirpSync = (__nccwpck_require__(20559).mkdirsSync) -const utimesSync = (__nccwpck_require__(84420).utimesMillisSync) -const stat = __nccwpck_require__(76821) - -function copySync (src, dest, opts) { - if (typeof opts === 'function') { - opts = { filter: opts } - } - - opts = opts || {} - opts.clobber = 'clobber' in opts ? !!opts.clobber : true // default to true for now - opts.overwrite = 'overwrite' in opts ? !!opts.overwrite : opts.clobber // overwrite falls back to clobber +const assert = __nccwpck_require__(42613) - // Warn about using preserveTimestamps on 32-bit node - if (opts.preserveTimestamps && process.arch === 'ia32') { - console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n - see https://github.com/jprichardson/node-fs-extra/issues/269`) - } +const isWindows = (process.platform === 'win32') - const { srcStat, destStat } = stat.checkPathsSync(src, dest, 'copy') - stat.checkParentPathsSync(src, srcStat, dest, 'copy') - return handleFilterAndCopy(destStat, src, dest, opts) -} +function defaults (options) { + const methods = [ + 'unlink', + 'chmod', + 'stat', + 'lstat', + 'rmdir', + 'readdir' + ] + methods.forEach(m => { + options[m] = options[m] || fs[m] + m = m + 'Sync' + options[m] = options[m] || fs[m] + }) -function handleFilterAndCopy (destStat, src, dest, opts) { - if (opts.filter && !opts.filter(src, dest)) return - const destParent = path.dirname(dest) - if (!fs.existsSync(destParent)) mkdirpSync(destParent) - return startCopy(destStat, src, dest, opts) + options.maxBusyTries = options.maxBusyTries || 3 } -function startCopy (destStat, src, dest, opts) { - if (opts.filter && !opts.filter(src, dest)) return - return getStats(destStat, src, dest, opts) -} +function rimraf (p, options, cb) { + let busyTries = 0 -function getStats (destStat, src, dest, opts) { - const statSync = opts.dereference ? fs.statSync : fs.lstatSync - const srcStat = statSync(src) + if (typeof options === 'function') { + cb = options + options = {} + } - if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts) - else if (srcStat.isFile() || - srcStat.isCharacterDevice() || - srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts) - else if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts) -} + assert(p, 'rimraf: missing path') + assert.strictEqual(typeof p, 'string', 'rimraf: path should be a string') + assert.strictEqual(typeof cb, 'function', 'rimraf: callback function required') + assert(options, 'rimraf: invalid options argument provided') + assert.strictEqual(typeof options, 'object', 'rimraf: options should be object') -function onFile (srcStat, destStat, src, dest, opts) { - if (!destStat) return copyFile(srcStat, src, dest, opts) - return mayCopyFile(srcStat, src, dest, opts) -} + defaults(options) -function mayCopyFile (srcStat, src, dest, opts) { - if (opts.overwrite) { - fs.unlinkSync(dest) - return copyFile(srcStat, src, dest, opts) - } else if (opts.errorOnExist) { - throw new Error(`'${dest}' already exists`) - } -} + rimraf_(p, options, function CB (er) { + if (er) { + if ((er.code === 'EBUSY' || er.code === 'ENOTEMPTY' || er.code === 'EPERM') && + busyTries < options.maxBusyTries) { + busyTries++ + const time = busyTries * 100 + // try again, with the same exact callback as this one. + return setTimeout(() => rimraf_(p, options, CB), time) + } -function copyFile (srcStat, src, dest, opts) { - if (typeof fs.copyFileSync === 'function') { - fs.copyFileSync(src, dest) - fs.chmodSync(dest, srcStat.mode) - if (opts.preserveTimestamps) { - return utimesSync(dest, srcStat.atime, srcStat.mtime) + // already gone + if (er.code === 'ENOENT') er = null } - return - } - return copyFileFallback(srcStat, src, dest, opts) + + cb(er) + }) } -function copyFileFallback (srcStat, src, dest, opts) { - const BUF_LENGTH = 64 * 1024 - const _buff = __nccwpck_require__(26445)(BUF_LENGTH) +// Two possible strategies. +// 1. Assume it's a file. unlink it, then do the dir stuff on EPERM or EISDIR +// 2. Assume it's a directory. readdir, then do the file stuff on ENOTDIR +// +// Both result in an extra syscall when you guess wrong. However, there +// are likely far more normal files in the world than directories. This +// is based on the assumption that a the average number of files per +// directory is >= 1. +// +// If anyone ever complains about this, then I guess the strategy could +// be made configurable somehow. But until then, YAGNI. +function rimraf_ (p, options, cb) { + assert(p) + assert(options) + assert(typeof cb === 'function') - const fdr = fs.openSync(src, 'r') - const fdw = fs.openSync(dest, 'w', srcStat.mode) - let pos = 0 + // sunos lets the root user unlink directories, which is... weird. + // so we have to lstat here and make sure it's not a dir. + options.lstat(p, (er, st) => { + if (er && er.code === 'ENOENT') { + return cb(null) + } - while (pos < srcStat.size) { - const bytesRead = fs.readSync(fdr, _buff, 0, BUF_LENGTH, pos) - fs.writeSync(fdw, _buff, 0, bytesRead) - pos += bytesRead - } + // Windows can EPERM on stat. Life is suffering. + if (er && er.code === 'EPERM' && isWindows) { + return fixWinEPERM(p, options, er, cb) + } - if (opts.preserveTimestamps) fs.futimesSync(fdw, srcStat.atime, srcStat.mtime) + if (st && st.isDirectory()) { + return rmdir(p, options, er, cb) + } - fs.closeSync(fdr) - fs.closeSync(fdw) + options.unlink(p, er => { + if (er) { + if (er.code === 'ENOENT') { + return cb(null) + } + if (er.code === 'EPERM') { + return (isWindows) + ? fixWinEPERM(p, options, er, cb) + : rmdir(p, options, er, cb) + } + if (er.code === 'EISDIR') { + return rmdir(p, options, er, cb) + } + } + return cb(er) + }) + }) } -function onDir (srcStat, destStat, src, dest, opts) { - if (!destStat) return mkDirAndCopy(srcStat, src, dest, opts) - if (destStat && !destStat.isDirectory()) { - throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`) +function fixWinEPERM (p, options, er, cb) { + assert(p) + assert(options) + assert(typeof cb === 'function') + if (er) { + assert(er instanceof Error) } - return copyDir(src, dest, opts) -} - -function mkDirAndCopy (srcStat, src, dest, opts) { - fs.mkdirSync(dest) - copyDir(src, dest, opts) - return fs.chmodSync(dest, srcStat.mode) -} -function copyDir (src, dest, opts) { - fs.readdirSync(src).forEach(item => copyDirItem(item, src, dest, opts)) + options.chmod(p, 0o666, er2 => { + if (er2) { + cb(er2.code === 'ENOENT' ? null : er) + } else { + options.stat(p, (er3, stats) => { + if (er3) { + cb(er3.code === 'ENOENT' ? null : er) + } else if (stats.isDirectory()) { + rmdir(p, options, er, cb) + } else { + options.unlink(p, cb) + } + }) + } + }) } -function copyDirItem (item, src, dest, opts) { - const srcItem = path.join(src, item) - const destItem = path.join(dest, item) - const { destStat } = stat.checkPathsSync(srcItem, destItem, 'copy') - return startCopy(destStat, srcItem, destItem, opts) -} +function fixWinEPERMSync (p, options, er) { + let stats -function onLink (destStat, src, dest, opts) { - let resolvedSrc = fs.readlinkSync(src) - if (opts.dereference) { - resolvedSrc = path.resolve(process.cwd(), resolvedSrc) + assert(p) + assert(options) + if (er) { + assert(er instanceof Error) } - if (!destStat) { - return fs.symlinkSync(resolvedSrc, dest) - } else { - let resolvedDest - try { - resolvedDest = fs.readlinkSync(dest) - } catch (err) { - // dest exists and is a regular file or directory, - // Windows may throw UNKNOWN error. If dest already exists, - // fs throws error anyway, so no need to guard against it here. - if (err.code === 'EINVAL' || err.code === 'UNKNOWN') return fs.symlinkSync(resolvedSrc, dest) - throw err - } - 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}'.`) + try { + options.chmodSync(p, 0o666) + } catch (er2) { + if (er2.code === 'ENOENT') { + return + } else { + throw er } + } - // prevent copy if src is a subdir of dest since unlinking - // dest in this case would result in removing src contents - // and therefore a broken symlink would be created. - if (fs.statSync(dest).isDirectory() && stat.isSrcSubdir(resolvedDest, resolvedSrc)) { - throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`) + try { + stats = options.statSync(p) + } catch (er3) { + if (er3.code === 'ENOENT') { + return + } else { + throw er } - return copyLink(resolvedSrc, dest) } -} -function copyLink (resolvedSrc, dest) { - fs.unlinkSync(dest) - return fs.symlinkSync(resolvedSrc, dest) + if (stats.isDirectory()) { + rmdirSync(p, options, er) + } else { + options.unlinkSync(p) + } } -module.exports = copySync - - -/***/ }), - -/***/ 52726: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - -"use strict"; - +function rmdir (p, options, originalEr, cb) { + assert(p) + assert(options) + if (originalEr) { + assert(originalEr instanceof Error) + } + assert(typeof cb === 'function') -module.exports = { - copySync: __nccwpck_require__(39969) + // try to rmdir first, and only readdir on ENOTEMPTY or EEXIST (SunOS) + // if we guessed wrong, and it's not a directory, then + // raise the original error. + options.rmdir(p, er => { + if (er && (er.code === 'ENOTEMPTY' || er.code === 'EEXIST' || er.code === 'EPERM')) { + rmkids(p, options, cb) + } else if (er && er.code === 'ENOTDIR') { + cb(originalEr) + } else { + cb(er) + } + }) } +function rmkids (p, options, cb) { + assert(p) + assert(options) + assert(typeof cb === 'function') -/***/ }), + options.readdir(p, (er, files) => { + if (er) return cb(er) -/***/ 76137: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + let n = files.length + let errState -"use strict"; + if (n === 0) return options.rmdir(p, cb) + files.forEach(f => { + rimraf(path.join(p, f), options, er => { + if (errState) { + return + } + if (er) return cb(errState = er) + if (--n === 0) { + options.rmdir(p, cb) + } + }) + }) + }) +} -const fs = __nccwpck_require__(61404) -const path = __nccwpck_require__(16928) -const mkdirp = (__nccwpck_require__(20559).mkdirs) -const pathExists = (__nccwpck_require__(85615).pathExists) -const utimes = (__nccwpck_require__(84420).utimesMillis) -const stat = __nccwpck_require__(76821) +// this looks simpler, and is strictly *faster*, but will +// tie up the JavaScript thread and fail on excessively +// deep directory trees. +function rimrafSync (p, options) { + let st -function copy (src, dest, opts, cb) { - if (typeof opts === 'function' && !cb) { - cb = opts - opts = {} - } else if (typeof opts === 'function') { - opts = { filter: opts } - } + options = options || {} + defaults(options) - cb = cb || function () {} - opts = opts || {} + assert(p, 'rimraf: missing path') + assert.strictEqual(typeof p, 'string', 'rimraf: path should be a string') + assert(options, 'rimraf: missing options') + assert.strictEqual(typeof options, 'object', 'rimraf: options should be object') - opts.clobber = 'clobber' in opts ? !!opts.clobber : true // default to true for now - opts.overwrite = 'overwrite' in opts ? !!opts.overwrite : opts.clobber // overwrite falls back to clobber + try { + st = options.lstatSync(p) + } catch (er) { + if (er.code === 'ENOENT') { + return + } - // Warn about using preserveTimestamps on 32-bit node - if (opts.preserveTimestamps && process.arch === 'ia32') { - console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n - see https://github.com/jprichardson/node-fs-extra/issues/269`) + // Windows can EPERM on stat. Life is suffering. + if (er.code === 'EPERM' && isWindows) { + fixWinEPERMSync(p, options, er) + } } - stat.checkPaths(src, dest, 'copy', (err, stats) => { - if (err) return cb(err) - const { srcStat, destStat } = stats - stat.checkParentPaths(src, srcStat, dest, 'copy', err => { - if (err) return cb(err) - if (opts.filter) return handleFilter(checkParentDir, destStat, src, dest, opts, cb) - return checkParentDir(destStat, src, dest, opts, cb) - }) - }) -} - -function checkParentDir (destStat, src, dest, opts, cb) { - const destParent = path.dirname(dest) - pathExists(destParent, (err, dirExists) => { - if (err) return cb(err) - if (dirExists) return startCopy(destStat, src, dest, opts, cb) - mkdirp(destParent, err => { - if (err) return cb(err) - return startCopy(destStat, src, dest, opts, cb) - }) - }) + try { + // sunos lets the root user unlink directories, which is... weird. + if (st && st.isDirectory()) { + rmdirSync(p, options, null) + } else { + options.unlinkSync(p) + } + } catch (er) { + if (er.code === 'ENOENT') { + return + } else if (er.code === 'EPERM') { + return isWindows ? fixWinEPERMSync(p, options, er) : rmdirSync(p, options, er) + } else if (er.code !== 'EISDIR') { + throw er + } + rmdirSync(p, options, er) + } } -function handleFilter (onInclude, destStat, src, dest, opts, cb) { - Promise.resolve(opts.filter(src, dest)).then(include => { - if (include) return onInclude(destStat, src, dest, opts, cb) - return cb() - }, error => cb(error)) -} +function rmdirSync (p, options, originalEr) { + assert(p) + assert(options) + if (originalEr) { + assert(originalEr instanceof Error) + } -function startCopy (destStat, src, dest, opts, cb) { - if (opts.filter) return handleFilter(getStats, destStat, src, dest, opts, cb) - return getStats(destStat, src, dest, opts, cb) + try { + options.rmdirSync(p) + } catch (er) { + if (er.code === 'ENOTDIR') { + throw originalEr + } else if (er.code === 'ENOTEMPTY' || er.code === 'EEXIST' || er.code === 'EPERM') { + rmkidsSync(p, options) + } else if (er.code !== 'ENOENT') { + throw er + } + } } -function getStats (destStat, src, dest, opts, cb) { - const stat = opts.dereference ? fs.stat : fs.lstat - stat(src, (err, srcStat) => { - if (err) return cb(err) +function rmkidsSync (p, options) { + assert(p) + assert(options) + options.readdirSync(p).forEach(f => rimrafSync(path.join(p, f), options)) - 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) - }) + if (isWindows) { + // We only end up here once we got ENOTEMPTY at least once, and + // at this point, we are guaranteed to have removed all the kids. + // So, we know that it won't be ENOENT or ENOTDIR or anything else. + // try really hard to delete stuff on windows, because it has a + // PROFOUNDLY annoying habit of not closing handles promptly when + // files are deleted, resulting in spurious ENOTEMPTY errors. + const startTime = Date.now() + do { + try { + const ret = options.rmdirSync(p, options) + return ret + } catch (er) { } + } while (Date.now() - startTime < 500) // give up after 500ms + } else { + const ret = options.rmdirSync(p, options) + return ret + } } -function onFile (srcStat, destStat, src, dest, opts, cb) { - if (!destStat) return copyFile(srcStat, src, dest, opts, cb) - return mayCopyFile(srcStat, src, dest, opts, cb) -} +module.exports = rimraf +rimraf.sync = rimrafSync -function mayCopyFile (srcStat, src, dest, opts, cb) { - if (opts.overwrite) { - fs.unlink(dest, err => { - if (err) return cb(err) - return copyFile(srcStat, src, dest, opts, cb) - }) - } else if (opts.errorOnExist) { - return cb(new Error(`'${dest}' already exists`)) - } else return cb() -} -function copyFile (srcStat, src, dest, opts, cb) { - if (typeof fs.copyFile === 'function') { - return fs.copyFile(src, dest, err => { - if (err) return cb(err) - return setDestModeAndTimestamps(srcStat, dest, opts, cb) - }) - } - return copyFileFallback(srcStat, src, dest, opts, cb) -} +/***/ }), -function copyFileFallback (srcStat, src, dest, opts, cb) { - const rs = fs.createReadStream(src) - rs.on('error', err => cb(err)).once('open', () => { - const ws = fs.createWriteStream(dest, { mode: srcStat.mode }) - ws.on('error', err => cb(err)) - .on('open', () => rs.pipe(ws)) - .once('close', () => setDestModeAndTimestamps(srcStat, dest, opts, cb)) - }) -} +/***/ 44973: +/***/ ((module) => { -function setDestModeAndTimestamps (srcStat, dest, opts, cb) { - fs.chmod(dest, srcStat.mode, err => { - if (err) return cb(err) - if (opts.preserveTimestamps) { - return utimes(dest, srcStat.atime, srcStat.mtime, cb) - } - return cb() - }) -} +"use strict"; -function onDir (srcStat, destStat, src, dest, opts, cb) { - if (!destStat) return mkDirAndCopy(srcStat, src, dest, opts, cb) - if (destStat && !destStat.isDirectory()) { - return cb(new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`)) +/* eslint-disable node/no-deprecated-api */ +module.exports = function (size) { + if (typeof Buffer.allocUnsafe === 'function') { + try { + return Buffer.allocUnsafe(size) + } catch (e) { + return new Buffer(size) + } } - return copyDir(src, dest, opts, cb) + return new Buffer(size) } -function mkDirAndCopy (srcStat, src, dest, opts, cb) { - fs.mkdir(dest, err => { - if (err) return cb(err) - copyDir(src, dest, opts, err => { - if (err) return cb(err) - return fs.chmod(dest, srcStat.mode, 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) -} +/***/ 91349: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -function copyDirItem (items, item, src, dest, opts, cb) { - const srcItem = path.join(src, item) - const destItem = path.join(dest, item) - stat.checkPaths(srcItem, destItem, 'copy', (err, stats) => { - if (err) return cb(err) - const { destStat } = stats - startCopy(destStat, srcItem, destItem, opts, err => { - if (err) return cb(err) - return copyDirItems(items, src, dest, opts, cb) - }) - }) -} +"use strict"; -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, (err, resolvedDest) => { +const fs = __nccwpck_require__(61404) +const path = __nccwpck_require__(16928) + +const NODE_VERSION_MAJOR_WITH_BIGINT = 10 +const NODE_VERSION_MINOR_WITH_BIGINT = 5 +const NODE_VERSION_PATCH_WITH_BIGINT = 0 +const nodeVersion = process.versions.node.split('.') +const nodeVersionMajor = Number.parseInt(nodeVersion[0], 10) +const nodeVersionMinor = Number.parseInt(nodeVersion[1], 10) +const nodeVersionPatch = Number.parseInt(nodeVersion[2], 10) + +function nodeSupportsBigInt () { + if (nodeVersionMajor > NODE_VERSION_MAJOR_WITH_BIGINT) { + return true + } else if (nodeVersionMajor === NODE_VERSION_MAJOR_WITH_BIGINT) { + if (nodeVersionMinor > NODE_VERSION_MINOR_WITH_BIGINT) { + return true + } else if (nodeVersionMinor === NODE_VERSION_MINOR_WITH_BIGINT) { + if (nodeVersionPatch >= NODE_VERSION_PATCH_WITH_BIGINT) { + return true + } + } + } + return false +} + +function getStats (src, dest, cb) { + if (nodeSupportsBigInt()) { + fs.stat(src, { bigint: true }, (err, srcStat) => { + if (err) return cb(err) + fs.stat(dest, { bigint: true }, (err, destStat) => { if (err) { - // dest exists and is a regular file or directory, - // Windows may throw UNKNOWN error. If dest already exists, - // fs throws error anyway, so no need to guard against it here. - if (err.code === 'EINVAL' || err.code === 'UNKNOWN') return fs.symlink(resolvedSrc, dest, cb) + if (err.code === 'ENOENT') return cb(null, { srcStat, destStat: null }) return cb(err) } - 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}'.`)) - } - - // do not copy if src is a subdir of dest since unlinking - // dest in this case would result in removing src contents - // and therefore a broken symlink would be created. - if (destStat.isDirectory() && stat.isSrcSubdir(resolvedDest, resolvedSrc)) { - return cb(new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`)) + return cb(null, { srcStat, destStat }) + }) + }) + } else { + fs.stat(src, (err, srcStat) => { + if (err) return cb(err) + fs.stat(dest, (err, destStat) => { + if (err) { + if (err.code === 'ENOENT') return cb(null, { srcStat, destStat: null }) + return cb(err) } - return copyLink(resolvedSrc, dest, cb) + return cb(null, { srcStat, destStat }) }) + }) + } +} + +function getStatsSync (src, dest) { + let srcStat, destStat + if (nodeSupportsBigInt()) { + srcStat = fs.statSync(src, { bigint: true }) + } else { + srcStat = fs.statSync(src) + } + try { + if (nodeSupportsBigInt()) { + destStat = fs.statSync(dest, { bigint: true }) + } else { + destStat = fs.statSync(dest) } - }) + } catch (err) { + if (err.code === 'ENOENT') return { srcStat, destStat: null } + throw err + } + return { srcStat, destStat } } -function copyLink (resolvedSrc, dest, cb) { - fs.unlink(dest, err => { +function checkPaths (src, dest, funcName, cb) { + getStats(src, dest, (err, stats) => { if (err) return cb(err) - return fs.symlink(resolvedSrc, dest, cb) + const { srcStat, destStat } = stats + if (destStat && destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev) { + return cb(new Error('Source and destination must not be the same.')) + } + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + return cb(new Error(errMsg(src, dest, funcName))) + } + return cb(null, { srcStat, destStat }) }) } -module.exports = copy - +function checkPathsSync (src, dest, funcName) { + const { srcStat, destStat } = getStatsSync(src, dest) + if (destStat && destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev) { + throw new Error('Source and destination must not be the same.') + } + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + throw new Error(errMsg(src, dest, funcName)) + } + return { srcStat, destStat } +} -/***/ }), +// recursively check if dest parent is a subdirectory of src. +// It works for all file types including symlinks since it +// checks the src and dest inodes. It starts from the deepest +// parent and stops once it reaches the src parent or the root path. +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 cb() + if (nodeSupportsBigInt()) { + fs.stat(destParent, { bigint: true }, (err, destStat) => { + if (err) { + if (err.code === 'ENOENT') return cb() + return cb(err) + } + if (destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev) { + return cb(new Error(errMsg(src, dest, funcName))) + } + return checkParentPaths(src, srcStat, destParent, funcName, cb) + }) + } else { + fs.stat(destParent, (err, destStat) => { + if (err) { + if (err.code === 'ENOENT') return cb() + return cb(err) + } + if (destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev) { + return cb(new Error(errMsg(src, dest, funcName))) + } + return checkParentPaths(src, srcStat, destParent, funcName, cb) + }) + } +} -/***/ 61454: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +function checkParentPathsSync (src, srcStat, dest, funcName) { + const srcParent = path.resolve(path.dirname(src)) + const destParent = path.resolve(path.dirname(dest)) + if (destParent === srcParent || destParent === path.parse(destParent).root) return + let destStat + try { + if (nodeSupportsBigInt()) { + destStat = fs.statSync(destParent, { bigint: true }) + } else { + destStat = fs.statSync(destParent) + } + } catch (err) { + if (err.code === 'ENOENT') return + throw err + } + if (destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev) { + throw new Error(errMsg(src, dest, funcName)) + } + return checkParentPathsSync(src, srcStat, destParent, funcName) +} -"use strict"; +// return true if dest is a subdir of src, otherwise false. +// It only checks the path strings. +function isSrcSubdir (src, dest) { + const srcArr = path.resolve(src).split(path.sep).filter(i => i) + const destArr = path.resolve(dest).split(path.sep).filter(i => i) + return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true) +} +function errMsg (src, dest, funcName) { + return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.` +} -const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) module.exports = { - copy: u(__nccwpck_require__(76137)) + checkPaths, + checkPathsSync, + checkParentPaths, + checkParentPathsSync, + isSrcSubdir } /***/ }), -/***/ 50312: +/***/ 12804: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) const fs = __nccwpck_require__(61404) +const os = __nccwpck_require__(70857) const path = __nccwpck_require__(16928) -const mkdir = __nccwpck_require__(20559) -const remove = __nccwpck_require__(75419) -const emptyDir = u(function emptyDir (dir, callback) { - callback = callback || function () {} - fs.readdir(dir, (err, items) => { - if (err) return mkdir.mkdirs(dir, callback) +// HFS, ext{2,3}, FAT do not, Node.js v0.10 does not +function hasMillisResSync () { + let tmpfile = path.join('millis-test-sync' + Date.now().toString() + Math.random().toString().slice(2)) + tmpfile = path.join(os.tmpdir(), tmpfile) - items = items.map(item => path.join(dir, item)) + // 550 millis past UNIX epoch + const d = new Date(1435410243862) + fs.writeFileSync(tmpfile, 'https://github.com/jprichardson/node-fs-extra/pull/141') + const fd = fs.openSync(tmpfile, 'r+') + fs.futimesSync(fd, d, d) + fs.closeSync(fd) + return fs.statSync(tmpfile).mtime > 1435410243000 +} - deleteItem() +function hasMillisRes (callback) { + let tmpfile = path.join('millis-test' + Date.now().toString() + Math.random().toString().slice(2)) + tmpfile = path.join(os.tmpdir(), tmpfile) - function deleteItem () { - const item = items.pop() - if (!item) return callback() - remove.remove(item, err => { + // 550 millis past UNIX epoch + const d = new Date(1435410243862) + fs.writeFile(tmpfile, 'https://github.com/jprichardson/node-fs-extra/pull/141', err => { + if (err) return callback(err) + fs.open(tmpfile, 'r+', (err, fd) => { + if (err) return callback(err) + fs.futimes(fd, d, d, err => { if (err) return callback(err) - deleteItem() + fs.close(fd, err => { + if (err) return callback(err) + fs.stat(tmpfile, (err, stats) => { + if (err) return callback(err) + callback(null, stats.mtime > 1435410243000) + }) + }) }) - } + }) }) -}) +} -function emptyDirSync (dir) { - let items - try { - items = fs.readdirSync(dir) - } catch (err) { - return mkdir.mkdirsSync(dir) +function timeRemoveMillis (timestamp) { + if (typeof timestamp === 'number') { + return Math.floor(timestamp / 1000) * 1000 + } else if (timestamp instanceof Date) { + return new Date(Math.floor(timestamp.getTime() / 1000) * 1000) + } else { + throw new Error('fs-extra: timeRemoveMillis() unknown parameter type') } - - items.forEach(item => { - item = path.join(dir, item) - remove.removeSync(item) - }) } -module.exports = { - emptyDirSync, - emptydirSync: emptyDirSync, - emptyDir, - emptydir: emptyDir -} - - -/***/ }), - -/***/ 90403: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - -"use strict"; - - -const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) -const path = __nccwpck_require__(16928) -const fs = __nccwpck_require__(61404) -const mkdir = __nccwpck_require__(20559) -const pathExists = (__nccwpck_require__(85615).pathExists) - -function createFile (file, callback) { - function makeFile () { - fs.writeFile(file, '', err => { - if (err) return callback(err) - callback() - }) - } - - fs.stat(file, (err, stats) => { // eslint-disable-line handle-callback-err - if (!err && stats.isFile()) return callback() - const dir = path.dirname(file) - pathExists(dir, (err, dirExists) => { - if (err) return callback(err) - if (dirExists) return makeFile() - mkdir.mkdirs(dir, err => { - if (err) return callback(err) - makeFile() +function utimesMillis (path, atime, mtime, callback) { + // if (!HAS_MILLIS_RES) return fs.utimes(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 createFileSync (file) { - let stats - try { - stats = fs.statSync(file) - } catch (e) {} - if (stats && stats.isFile()) return - - const dir = path.dirname(file) - if (!fs.existsSync(dir)) { - mkdir.mkdirsSync(dir) - } - - fs.writeFileSync(file, '') +function utimesMillisSync (path, atime, mtime) { + const fd = fs.openSync(path, 'r+') + fs.futimesSync(fd, atime, mtime) + return fs.closeSync(fd) } module.exports = { - createFile: u(createFile), - createFileSync + hasMillisRes, + hasMillisResSync, + timeRemoveMillis, + utimesMillis, + utimesMillisSync } /***/ }), -/***/ 70785: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/***/ 69988: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; - -const file = __nccwpck_require__(90403) -const link = __nccwpck_require__(47421) -const symlink = __nccwpck_require__(8318) - -module.exports = { - // file - createFile: file.createFile, - createFileSync: file.createFileSync, - ensureFile: file.createFile, - ensureFileSync: file.createFileSync, - // link - createLink: link.createLink, - createLinkSync: link.createLinkSync, - ensureLink: link.createLink, - ensureLinkSync: link.createLinkSync, - // symlink - createSymlink: symlink.createSymlink, - createSymlinkSync: symlink.createSymlinkSync, - ensureSymlink: symlink.createSymlink, - ensureSymlinkSync: symlink.createSymlinkSync +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0; +const fs = __nccwpck_require__(79896); +exports.FILE_SYSTEM_ADAPTER = { + lstat: fs.lstat, + stat: fs.stat, + lstatSync: fs.lstatSync, + statSync: fs.statSync, + readdir: fs.readdir, + readdirSync: fs.readdirSync +}; +function createFileSystemAdapter(fsMethods) { + if (fsMethods === undefined) { + return exports.FILE_SYSTEM_ADAPTER; + } + return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods); } +exports.createFileSystemAdapter = createFileSystemAdapter; /***/ }), -/***/ 47421: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/***/ 9459: +/***/ ((__unused_webpack_module, exports) => { "use strict"; - -const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) -const path = __nccwpck_require__(16928) -const fs = __nccwpck_require__(61404) -const mkdir = __nccwpck_require__(20559) -const pathExists = (__nccwpck_require__(85615).pathExists) - -function createLink (srcpath, dstpath, callback) { - function makeLink (srcpath, dstpath) { - fs.link(srcpath, dstpath, err => { - if (err) return callback(err) - callback(null) - }) - } - - pathExists(dstpath, (err, destinationExists) => { - if (err) return callback(err) - if (destinationExists) return callback(null) - fs.lstat(srcpath, (err) => { - if (err) { - err.message = err.message.replace('lstat', 'ensureLink') - return callback(err) - } - - const dir = path.dirname(dstpath) - pathExists(dir, (err, dirExists) => { - if (err) return callback(err) - if (dirExists) return makeLink(srcpath, dstpath) - mkdir.mkdirs(dir, err => { - if (err) return callback(err) - makeLink(srcpath, dstpath) - }) - }) - }) - }) +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.IS_SUPPORT_READDIR_WITH_FILE_TYPES = void 0; +const NODE_PROCESS_VERSION_PARTS = process.versions.node.split('.'); +if (NODE_PROCESS_VERSION_PARTS[0] === undefined || NODE_PROCESS_VERSION_PARTS[1] === undefined) { + throw new Error(`Unexpected behavior. The 'process.versions.node' variable has invalid value: ${process.versions.node}`); } +const MAJOR_VERSION = Number.parseInt(NODE_PROCESS_VERSION_PARTS[0], 10); +const MINOR_VERSION = Number.parseInt(NODE_PROCESS_VERSION_PARTS[1], 10); +const SUPPORTED_MAJOR_VERSION = 10; +const SUPPORTED_MINOR_VERSION = 10; +const IS_MATCHED_BY_MAJOR = MAJOR_VERSION > SUPPORTED_MAJOR_VERSION; +const IS_MATCHED_BY_MAJOR_AND_MINOR = MAJOR_VERSION === SUPPORTED_MAJOR_VERSION && MINOR_VERSION >= SUPPORTED_MINOR_VERSION; +/** + * IS `true` for Node.js 10.10 and greater. + */ +exports.IS_SUPPORT_READDIR_WITH_FILE_TYPES = IS_MATCHED_BY_MAJOR || IS_MATCHED_BY_MAJOR_AND_MINOR; -function createLinkSync (srcpath, dstpath) { - const destinationExists = fs.existsSync(dstpath) - if (destinationExists) return undefined - try { - fs.lstatSync(srcpath) - } catch (err) { - err.message = err.message.replace('lstat', 'ensureLink') - throw err - } +/***/ }), - const dir = path.dirname(dstpath) - const dirExists = fs.existsSync(dir) - if (dirExists) return fs.linkSync(srcpath, dstpath) - mkdir.mkdirsSync(dir) +/***/ 44482: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - return fs.linkSync(srcpath, dstpath) -} +"use strict"; -module.exports = { - createLink: u(createLink), - createLinkSync +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Settings = exports.scandirSync = exports.scandir = void 0; +const async = __nccwpck_require__(69359); +const sync = __nccwpck_require__(79588); +const settings_1 = __nccwpck_require__(42321); +exports.Settings = settings_1.default; +function scandir(path, optionsOrSettingsOrCallback, callback) { + if (typeof optionsOrSettingsOrCallback === 'function') { + async.read(path, getSettings(), optionsOrSettingsOrCallback); + return; + } + async.read(path, getSettings(optionsOrSettingsOrCallback), callback); +} +exports.scandir = scandir; +function scandirSync(path, optionsOrSettings) { + const settings = getSettings(optionsOrSettings); + return sync.read(path, settings); +} +exports.scandirSync = scandirSync; +function getSettings(settingsOrOptions = {}) { + if (settingsOrOptions instanceof settings_1.default) { + return settingsOrOptions; + } + return new settings_1.default(settingsOrOptions); } /***/ }), -/***/ 51923: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/***/ 69359: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; - -const path = __nccwpck_require__(16928) -const fs = __nccwpck_require__(61404) -const pathExists = (__nccwpck_require__(85615).pathExists) - -/** - * Function that returns two types of paths, one relative to symlink, and one - * relative to the current working directory. Checks if path is absolute or - * relative. If the path is relative, this function checks if the path is - * relative to symlink or relative to current working directory. This is an - * initiative to find a smarter `srcpath` to supply when building symlinks. - * This allows you to determine which path to use out of one of three possible - * types of source paths. The first is an absolute path. This is detected by - * `path.isAbsolute()`. When an absolute path is provided, it is checked to - * see if it exists. If it does it's used, if not an error is returned - * (callback)/ thrown (sync). The other two options for `srcpath` are a - * relative url. By default Node's `fs.symlink` works by creating a symlink - * using `dstpath` and expects the `srcpath` to be relative to the newly - * created symlink. If you provide a `srcpath` that does not exist on the file - * system it results in a broken symlink. To minimize this, the function - * checks to see if the 'relative to symlink' source file exists, and if it - * does it will use it. If it does not, it checks if there's a file that - * exists that is relative to the current working directory, if does its used. - * This preserves the expectations of the original fs.symlink spec and adds - * the ability to pass in `relative to current working direcotry` paths. - */ - -function symlinkPaths (srcpath, dstpath, callback) { - if (path.isAbsolute(srcpath)) { - return fs.lstat(srcpath, (err) => { - if (err) { - err.message = err.message.replace('lstat', 'ensureSymlink') - return callback(err) - } - return callback(null, { - 'toCwd': srcpath, - 'toDst': srcpath - }) - }) - } else { - const dstdir = path.dirname(dstpath) - const relativeToDst = path.join(dstdir, srcpath) - return pathExists(relativeToDst, (err, exists) => { - if (err) return callback(err) - if (exists) { - return callback(null, { - 'toCwd': relativeToDst, - 'toDst': srcpath - }) - } else { - return fs.lstat(srcpath, (err) => { - if (err) { - err.message = err.message.replace('lstat', 'ensureSymlink') - return callback(err) - } - return callback(null, { - 'toCwd': srcpath, - 'toDst': path.relative(dstdir, srcpath) - }) - }) - } - }) - } -} - -function symlinkPathsSync (srcpath, dstpath) { - let exists - if (path.isAbsolute(srcpath)) { - 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) - } +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.readdir = exports.readdirWithFileTypes = exports.read = void 0; +const fsStat = __nccwpck_require__(80794); +const rpl = __nccwpck_require__(90347); +const constants_1 = __nccwpck_require__(9459); +const utils = __nccwpck_require__(76556); +const common = __nccwpck_require__(7254); +function read(directory, settings, callback) { + if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) { + readdirWithFileTypes(directory, settings, callback); + return; } - } + readdir(directory, settings, callback); } - -module.exports = { - symlinkPaths, - symlinkPathsSync +exports.read = read; +function readdirWithFileTypes(directory, settings, callback) { + settings.fs.readdir(directory, { withFileTypes: true }, (readdirError, dirents) => { + if (readdirError !== null) { + callFailureCallback(callback, readdirError); + return; + } + const entries = dirents.map((dirent) => ({ + dirent, + name: dirent.name, + path: common.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator) + })); + if (!settings.followSymbolicLinks) { + callSuccessCallback(callback, entries); + return; + } + const tasks = entries.map((entry) => makeRplTaskEntry(entry, settings)); + rpl(tasks, (rplError, rplEntries) => { + if (rplError !== null) { + callFailureCallback(callback, rplError); + return; + } + callSuccessCallback(callback, rplEntries); + }); + }); +} +exports.readdirWithFileTypes = readdirWithFileTypes; +function makeRplTaskEntry(entry, settings) { + return (done) => { + if (!entry.dirent.isSymbolicLink()) { + done(null, entry); + return; + } + settings.fs.stat(entry.path, (statError, stats) => { + if (statError !== null) { + if (settings.throwErrorOnBrokenSymbolicLink) { + done(statError); + return; + } + done(null, entry); + return; + } + entry.dirent = utils.fs.createDirentFromStats(entry.name, stats); + done(null, entry); + }); + }; +} +function readdir(directory, settings, callback) { + settings.fs.readdir(directory, (readdirError, names) => { + if (readdirError !== null) { + callFailureCallback(callback, readdirError); + return; + } + const tasks = names.map((name) => { + const path = common.joinPathSegments(directory, name, settings.pathSegmentSeparator); + return (done) => { + fsStat.stat(path, settings.fsStatSettings, (error, stats) => { + if (error !== null) { + done(error); + return; + } + const entry = { + name, + path, + dirent: utils.fs.createDirentFromStats(name, stats) + }; + if (settings.stats) { + entry.stats = stats; + } + done(null, entry); + }); + }; + }); + rpl(tasks, (rplError, entries) => { + if (rplError !== null) { + callFailureCallback(callback, rplError); + return; + } + callSuccessCallback(callback, entries); + }); + }); +} +exports.readdir = readdir; +function callFailureCallback(callback, error) { + callback(error); +} +function callSuccessCallback(callback, result) { + callback(null, result); } /***/ }), -/***/ 87303: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/***/ 7254: +/***/ ((__unused_webpack_module, exports) => { "use strict"; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.joinPathSegments = void 0; +function joinPathSegments(a, b, separator) { + /** + * The correct handling of cases when the first segment is a root (`/`, `C:/`) or UNC path (`//?/C:/`). + */ + if (a.endsWith(separator)) { + return a + b; + } + return a + separator + b; +} +exports.joinPathSegments = joinPathSegments; -const fs = __nccwpck_require__(61404) -function symlinkType (srcpath, type, callback) { - callback = (typeof type === 'function') ? type : callback - type = (typeof type === 'function') ? false : type - if (type) return callback(null, type) - fs.lstat(srcpath, (err, stats) => { - if (err) return callback(null, 'file') - type = (stats && stats.isDirectory()) ? 'dir' : 'file' - callback(null, type) - }) -} +/***/ }), -function symlinkTypeSync (srcpath, type) { - let stats +/***/ 79588: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - if (type) return type - try { - stats = fs.lstatSync(srcpath) - } catch (e) { - return 'file' - } - return (stats && stats.isDirectory()) ? 'dir' : 'file' -} +"use strict"; -module.exports = { - symlinkType, - symlinkTypeSync +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.readdir = exports.readdirWithFileTypes = exports.read = void 0; +const fsStat = __nccwpck_require__(80794); +const constants_1 = __nccwpck_require__(9459); +const utils = __nccwpck_require__(76556); +const common = __nccwpck_require__(7254); +function read(directory, settings) { + if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) { + return readdirWithFileTypes(directory, settings); + } + return readdir(directory, settings); +} +exports.read = read; +function readdirWithFileTypes(directory, settings) { + const dirents = settings.fs.readdirSync(directory, { withFileTypes: true }); + return dirents.map((dirent) => { + const entry = { + dirent, + name: dirent.name, + path: common.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator) + }; + if (entry.dirent.isSymbolicLink() && settings.followSymbolicLinks) { + try { + const stats = settings.fs.statSync(entry.path); + entry.dirent = utils.fs.createDirentFromStats(entry.name, stats); + } + catch (error) { + if (settings.throwErrorOnBrokenSymbolicLink) { + throw error; + } + } + } + return entry; + }); +} +exports.readdirWithFileTypes = readdirWithFileTypes; +function readdir(directory, settings) { + const names = settings.fs.readdirSync(directory); + return names.map((name) => { + const entryPath = common.joinPathSegments(directory, name, settings.pathSegmentSeparator); + const stats = fsStat.statSync(entryPath, settings.fsStatSettings); + const entry = { + name, + path: entryPath, + dirent: utils.fs.createDirentFromStats(name, stats) + }; + if (settings.stats) { + entry.stats = stats; + } + return entry; + }); } +exports.readdir = readdir; /***/ }), -/***/ 8318: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/***/ 42321: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; +Object.defineProperty(exports, "__esModule", ({ value: true })); +const path = __nccwpck_require__(16928); +const fsStat = __nccwpck_require__(80794); +const fs = __nccwpck_require__(69988); +class Settings { + constructor(_options = {}) { + this._options = _options; + this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false); + this.fs = fs.createFileSystemAdapter(this._options.fs); + this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path.sep); + this.stats = this._getValue(this._options.stats, false); + this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true); + this.fsStatSettings = new fsStat.Settings({ + followSymbolicLink: this.followSymbolicLinks, + fs: this.fs, + throwErrorOnBrokenSymbolicLink: this.throwErrorOnBrokenSymbolicLink + }); + } + _getValue(option, value) { + return option !== null && option !== void 0 ? option : value; + } +} +exports["default"] = Settings; -const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) -const path = __nccwpck_require__(16928) -const fs = __nccwpck_require__(61404) -const _mkdirs = __nccwpck_require__(20559) -const mkdirs = _mkdirs.mkdirs -const mkdirsSync = _mkdirs.mkdirsSync - -const _symlinkPaths = __nccwpck_require__(51923) -const symlinkPaths = _symlinkPaths.symlinkPaths -const symlinkPathsSync = _symlinkPaths.symlinkPathsSync - -const _symlinkType = __nccwpck_require__(87303) -const symlinkType = _symlinkType.symlinkType -const symlinkTypeSync = _symlinkType.symlinkTypeSync - -const pathExists = (__nccwpck_require__(85615).pathExists) -function createSymlink (srcpath, dstpath, type, callback) { - callback = (typeof type === 'function') ? type : callback - type = (typeof type === 'function') ? false : type +/***/ }), - pathExists(dstpath, (err, destinationExists) => { - if (err) return callback(err) - if (destinationExists) return callback(null) - symlinkPaths(srcpath, dstpath, (err, relative) => { - if (err) return callback(err) - srcpath = relative.toDst - symlinkType(relative.toCwd, type, (err, type) => { - if (err) return callback(err) - const dir = path.dirname(dstpath) - pathExists(dir, (err, dirExists) => { - if (err) return callback(err) - if (dirExists) return fs.symlink(srcpath, dstpath, type, callback) - mkdirs(dir, err => { - if (err) return callback(err) - fs.symlink(srcpath, dstpath, type, callback) - }) - }) - }) - }) - }) -} +/***/ 52789: +/***/ ((__unused_webpack_module, exports) => { -function createSymlinkSync (srcpath, dstpath, type) { - const destinationExists = fs.existsSync(dstpath) - if (destinationExists) return undefined +"use strict"; - const relative = symlinkPathsSync(srcpath, dstpath) - srcpath = relative.toDst - type = symlinkTypeSync(relative.toCwd, type) - const dir = path.dirname(dstpath) - const exists = fs.existsSync(dir) - if (exists) return fs.symlinkSync(srcpath, dstpath, type) - mkdirsSync(dir) - return fs.symlinkSync(srcpath, dstpath, type) +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.createDirentFromStats = void 0; +class DirentFromStats { + constructor(name, stats) { + this.name = name; + this.isBlockDevice = stats.isBlockDevice.bind(stats); + this.isCharacterDevice = stats.isCharacterDevice.bind(stats); + this.isDirectory = stats.isDirectory.bind(stats); + this.isFIFO = stats.isFIFO.bind(stats); + this.isFile = stats.isFile.bind(stats); + this.isSocket = stats.isSocket.bind(stats); + this.isSymbolicLink = stats.isSymbolicLink.bind(stats); + } } - -module.exports = { - createSymlink: u(createSymlink), - createSymlinkSync +function createDirentFromStats(name, stats) { + return new DirentFromStats(name, stats); } +exports.createDirentFromStats = createDirentFromStats; /***/ }), -/***/ 93628: +/***/ 76556: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -// This is adapted from https://github.com/normalize/mz -// Copyright (c) 2014-2016 Jonathan Ong me@jongleberry.com and Contributors -const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) -const fs = __nccwpck_require__(61404) +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.fs = void 0; +const fs = __nccwpck_require__(52789); +exports.fs = fs; -const api = [ - 'access', - 'appendFile', - 'chmod', - 'chown', - 'close', - 'copyFile', - 'fchmod', - 'fchown', - 'fdatasync', - 'fstat', - 'fsync', - 'ftruncate', - 'futimes', - 'lchown', - 'lchmod', - 'link', - 'lstat', - 'mkdir', - 'mkdtemp', - 'open', - 'readFile', - 'readdir', - 'readlink', - 'realpath', - 'rename', - 'rmdir', - 'stat', - 'symlink', - 'truncate', - 'unlink', - 'utimes', - 'writeFile' -].filter(key => { - // Some commands are not available on some systems. Ex: - // fs.copyFile was added in Node.js v8.5.0 - // fs.mkdtemp was added in Node.js v5.10.0 - // fs.lchown is not available on at least some Linux - return typeof fs[key] === 'function' -}) -// Export all keys: -Object.keys(fs).forEach(key => { - if (key === 'promises') { - // fs.promises is a getter property that triggers ExperimentalWarning - // Don't re-export it here, the getter is defined in "lib/index.js" - return - } - exports[key] = fs[key] -}) +/***/ }), -// Universalify async methods: -api.forEach(method => { - exports[method] = u(fs[method]) -}) +/***/ 94076: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -// We differ from mz/fs in that we still ship the old, broken, fs.exists() -// since we are a drop-in replacement for the native module -exports.exists = function (filename, callback) { - if (typeof callback === 'function') { - return fs.exists(filename, callback) - } - return new Promise(resolve => { - return fs.exists(filename, resolve) - }) +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0; +const fs = __nccwpck_require__(79896); +exports.FILE_SYSTEM_ADAPTER = { + lstat: fs.lstat, + stat: fs.stat, + lstatSync: fs.lstatSync, + statSync: fs.statSync +}; +function createFileSystemAdapter(fsMethods) { + if (fsMethods === undefined) { + return exports.FILE_SYSTEM_ADAPTER; + } + return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods); } +exports.createFileSystemAdapter = createFileSystemAdapter; -// fs.read() & fs.write need special treatment due to multiple callback args -exports.read = function (fd, buffer, offset, length, position, callback) { - if (typeof callback === 'function') { - return fs.read(fd, buffer, offset, length, position, callback) - } - return new Promise((resolve, reject) => { - fs.read(fd, buffer, offset, length, position, (err, bytesRead, buffer) => { - if (err) return reject(err) - resolve({ bytesRead, buffer }) - }) - }) -} +/***/ }), -// Function signature can be -// fs.write(fd, buffer[, offset[, length[, position]]], callback) -// OR -// fs.write(fd, string[, position[, encoding]], callback) -// We need to handle both cases, so we use ...args -exports.write = function (fd, buffer, ...args) { - if (typeof args[args.length - 1] === 'function') { - return fs.write(fd, buffer, ...args) - } +/***/ 80794: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - return new Promise((resolve, reject) => { - fs.write(fd, buffer, ...args, (err, bytesWritten, buffer) => { - if (err) return reject(err) - resolve({ bytesWritten, buffer }) - }) - }) -} +"use strict"; -// fs.realpath.native only available in Node v9.2+ -if (typeof fs.realpath.native === 'function') { - exports.realpath.native = u(fs.realpath.native) +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.statSync = exports.stat = exports.Settings = void 0; +const async = __nccwpck_require__(36103); +const sync = __nccwpck_require__(40652); +const settings_1 = __nccwpck_require__(65897); +exports.Settings = settings_1.default; +function stat(path, optionsOrSettingsOrCallback, callback) { + if (typeof optionsOrSettingsOrCallback === 'function') { + async.read(path, getSettings(), optionsOrSettingsOrCallback); + return; + } + async.read(path, getSettings(optionsOrSettingsOrCallback), callback); +} +exports.stat = stat; +function statSync(path, optionsOrSettings) { + const settings = getSettings(optionsOrSettings); + return sync.read(path, settings); +} +exports.statSync = statSync; +function getSettings(settingsOrOptions = {}) { + if (settingsOrOptions instanceof settings_1.default) { + return settingsOrOptions; + } + return new settings_1.default(settingsOrOptions); } /***/ }), -/***/ 97298: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/***/ 36103: +/***/ ((__unused_webpack_module, exports) => { "use strict"; - -module.exports = Object.assign( - {}, - // Export promiseified graceful-fs: - __nccwpck_require__(93628), - // Export extra methods: - __nccwpck_require__(52726), - __nccwpck_require__(61454), - __nccwpck_require__(50312), - __nccwpck_require__(70785), - __nccwpck_require__(5705), - __nccwpck_require__(20559), - __nccwpck_require__(96542), - __nccwpck_require__(59190), - __nccwpck_require__(76698), - __nccwpck_require__(85615), - __nccwpck_require__(75419) -) - -// Export fs.promises as a getter property so that we don't trigger -// ExperimentalWarning before fs.promises is actually accessed. -const fs = __nccwpck_require__(79896) -if (Object.getOwnPropertyDescriptor(fs, 'promises')) { - Object.defineProperty(module.exports, "promises", ({ - get () { return fs.promises } - })) +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.read = void 0; +function read(path, settings, callback) { + settings.fs.lstat(path, (lstatError, lstat) => { + if (lstatError !== null) { + callFailureCallback(callback, lstatError); + return; + } + if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) { + callSuccessCallback(callback, lstat); + return; + } + settings.fs.stat(path, (statError, stat) => { + if (statError !== null) { + if (settings.throwErrorOnBrokenSymbolicLink) { + callFailureCallback(callback, statError); + return; + } + callSuccessCallback(callback, lstat); + return; + } + if (settings.markSymbolicLink) { + stat.isSymbolicLink = () => true; + } + callSuccessCallback(callback, stat); + }); + }); +} +exports.read = read; +function callFailureCallback(callback, error) { + callback(error); +} +function callSuccessCallback(callback, result) { + callback(null, result); } /***/ }), -/***/ 5705: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - -"use strict"; - - -const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) -const jsonFile = __nccwpck_require__(53373) - -jsonFile.outputJson = u(__nccwpck_require__(50859)) -jsonFile.outputJsonSync = __nccwpck_require__(29083) -// aliases -jsonFile.outputJSON = jsonFile.outputJson -jsonFile.outputJSONSync = jsonFile.outputJsonSync -jsonFile.writeJSON = jsonFile.writeJson -jsonFile.writeJSONSync = jsonFile.writeJsonSync -jsonFile.readJSON = jsonFile.readJson -jsonFile.readJSONSync = jsonFile.readJsonSync - -module.exports = jsonFile - - -/***/ }), - -/***/ 53373: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/***/ 40652: +/***/ ((__unused_webpack_module, exports) => { "use strict"; - -const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) -const jsonFile = __nccwpck_require__(93588) - -module.exports = { - // jsonfile exports - readJson: u(jsonFile.readFile), - readJsonSync: jsonFile.readFileSync, - writeJson: u(jsonFile.writeFile), - writeJsonSync: jsonFile.writeFileSync +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.read = void 0; +function read(path, settings) { + const lstat = settings.fs.lstatSync(path); + if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) { + return lstat; + } + try { + const stat = settings.fs.statSync(path); + if (settings.markSymbolicLink) { + stat.isSymbolicLink = () => true; + } + return stat; + } + catch (error) { + if (!settings.throwErrorOnBrokenSymbolicLink) { + return lstat; + } + throw error; + } } +exports.read = read; /***/ }), -/***/ 29083: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/***/ 65897: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; - -const fs = __nccwpck_require__(61404) -const path = __nccwpck_require__(16928) -const mkdir = __nccwpck_require__(20559) -const jsonFile = __nccwpck_require__(53373) - -function outputJsonSync (file, data, options) { - const dir = path.dirname(file) - - if (!fs.existsSync(dir)) { - mkdir.mkdirsSync(dir) - } - - jsonFile.writeJsonSync(file, data, options) +Object.defineProperty(exports, "__esModule", ({ value: true })); +const fs = __nccwpck_require__(94076); +class Settings { + constructor(_options = {}) { + this._options = _options; + this.followSymbolicLink = this._getValue(this._options.followSymbolicLink, true); + this.fs = fs.createFileSystemAdapter(this._options.fs); + this.markSymbolicLink = this._getValue(this._options.markSymbolicLink, false); + this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true); + } + _getValue(option, value) { + return option !== null && option !== void 0 ? option : value; + } } - -module.exports = outputJsonSync +exports["default"] = Settings; /***/ }), -/***/ 50859: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/***/ 83989: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; - -const path = __nccwpck_require__(16928) -const mkdir = __nccwpck_require__(20559) -const pathExists = (__nccwpck_require__(85615).pathExists) -const jsonFile = __nccwpck_require__(53373) - -function outputJson (file, data, options, callback) { - if (typeof options === 'function') { - callback = options - options = {} - } - - const dir = path.dirname(file) - - pathExists(dir, (err, itDoes) => { - if (err) return callback(err) - if (itDoes) return jsonFile.writeJson(file, data, options, callback) - - mkdir.mkdirs(dir, err => { - if (err) return callback(err) - jsonFile.writeJson(file, data, options, callback) - }) - }) +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Settings = exports.walkStream = exports.walkSync = exports.walk = void 0; +const async_1 = __nccwpck_require__(51316); +const stream_1 = __nccwpck_require__(10390); +const sync_1 = __nccwpck_require__(37405); +const settings_1 = __nccwpck_require__(74520); +exports.Settings = settings_1.default; +function walk(directory, optionsOrSettingsOrCallback, callback) { + if (typeof optionsOrSettingsOrCallback === 'function') { + new async_1.default(directory, getSettings()).read(optionsOrSettingsOrCallback); + return; + } + new async_1.default(directory, getSettings(optionsOrSettingsOrCallback)).read(callback); +} +exports.walk = walk; +function walkSync(directory, optionsOrSettings) { + const settings = getSettings(optionsOrSettings); + const provider = new sync_1.default(directory, settings); + return provider.read(); +} +exports.walkSync = walkSync; +function walkStream(directory, optionsOrSettings) { + const settings = getSettings(optionsOrSettings); + const provider = new stream_1.default(directory, settings); + return provider.read(); +} +exports.walkStream = walkStream; +function getSettings(settingsOrOptions = {}) { + if (settingsOrOptions instanceof settings_1.default) { + return settingsOrOptions; + } + return new settings_1.default(settingsOrOptions); } - -module.exports = outputJson /***/ }), -/***/ 20559: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/***/ 51316: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) -const mkdirs = u(__nccwpck_require__(80515)) -const mkdirsSync = __nccwpck_require__(36275) - -module.exports = { - mkdirs, - mkdirsSync, - // alias - mkdirp: mkdirs, - mkdirpSync: mkdirsSync, - ensureDir: mkdirs, - ensureDirSync: mkdirsSync +Object.defineProperty(exports, "__esModule", ({ value: true })); +const async_1 = __nccwpck_require__(59134); +class AsyncProvider { + constructor(_root, _settings) { + this._root = _root; + this._settings = _settings; + this._reader = new async_1.default(this._root, this._settings); + this._storage = []; + } + read(callback) { + this._reader.onError((error) => { + callFailureCallback(callback, error); + }); + this._reader.onEntry((entry) => { + this._storage.push(entry); + }); + this._reader.onEnd(() => { + callSuccessCallback(callback, this._storage); + }); + this._reader.read(); + } +} +exports["default"] = AsyncProvider; +function callFailureCallback(callback, error) { + callback(error); +} +function callSuccessCallback(callback, entries) { + callback(null, entries); } /***/ }), -/***/ 36275: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/***/ 10390: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; - -const fs = __nccwpck_require__(61404) -const path = __nccwpck_require__(16928) -const invalidWin32Path = (__nccwpck_require__(59672).invalidWin32Path) - -const o777 = parseInt('0777', 8) - -function mkdirsSync (p, opts, made) { - if (!opts || typeof opts !== 'object') { - opts = { mode: opts } - } - - let mode = opts.mode - const xfs = opts.fs || fs - - if (process.platform === 'win32' && invalidWin32Path(p)) { - const errInval = new Error(p + ' contains invalid WIN32 path characters.') - errInval.code = 'EINVAL' - throw errInval - } - - if (mode === undefined) { - mode = o777 & (~process.umask()) - } - if (!made) made = null - - p = path.resolve(p) - - try { - xfs.mkdirSync(p, mode) - made = made || p - } catch (err0) { - if (err0.code === 'ENOENT') { - if (path.dirname(p) === p) throw err0 - made = mkdirsSync(path.dirname(p), opts, made) - mkdirsSync(p, opts, made) - } else { - // In the case of any other error, just see if there's a dir there - // already. If so, then hooray! If not, then something is borked. - let stat - try { - stat = xfs.statSync(p) - } catch (err1) { - throw err0 - } - if (!stat.isDirectory()) throw err0 +Object.defineProperty(exports, "__esModule", ({ value: true })); +const stream_1 = __nccwpck_require__(2203); +const async_1 = __nccwpck_require__(59134); +class StreamProvider { + constructor(_root, _settings) { + this._root = _root; + this._settings = _settings; + this._reader = new async_1.default(this._root, this._settings); + this._stream = new stream_1.Readable({ + objectMode: true, + read: () => { }, + destroy: () => { + if (!this._reader.isDestroyed) { + this._reader.destroy(); + } + } + }); + } + read() { + this._reader.onError((error) => { + this._stream.emit('error', error); + }); + this._reader.onEntry((entry) => { + this._stream.push(entry); + }); + this._reader.onEnd(() => { + this._stream.push(null); + }); + this._reader.read(); + return this._stream; } - } - - return made } - -module.exports = mkdirsSync +exports["default"] = StreamProvider; /***/ }), -/***/ 80515: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/***/ 37405: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; +Object.defineProperty(exports, "__esModule", ({ value: true })); +const sync_1 = __nccwpck_require__(63339); +class SyncProvider { + constructor(_root, _settings) { + this._root = _root; + this._settings = _settings; + this._reader = new sync_1.default(this._root, this._settings); + } + read() { + return this._reader.read(); + } +} +exports["default"] = SyncProvider; -const fs = __nccwpck_require__(61404) -const path = __nccwpck_require__(16928) -const invalidWin32Path = (__nccwpck_require__(59672).invalidWin32Path) - -const o777 = parseInt('0777', 8) - -function mkdirs (p, opts, callback, made) { - if (typeof opts === 'function') { - callback = opts - opts = {} - } else if (!opts || typeof opts !== 'object') { - opts = { mode: opts } - } - - if (process.platform === 'win32' && invalidWin32Path(p)) { - const errInval = new Error(p + ' contains invalid WIN32 path characters.') - errInval.code = 'EINVAL' - return callback(errInval) - } - let mode = opts.mode - const xfs = opts.fs || fs +/***/ }), - if (mode === undefined) { - mode = o777 & (~process.umask()) - } - if (!made) made = null +/***/ 59134: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - callback = callback || function () {} - p = path.resolve(p) +"use strict"; - xfs.mkdir(p, mode, er => { - if (!er) { - made = made || p - return callback(null, made) +Object.defineProperty(exports, "__esModule", ({ value: true })); +const events_1 = __nccwpck_require__(24434); +const fsScandir = __nccwpck_require__(44482); +const fastq = __nccwpck_require__(64898); +const common = __nccwpck_require__(90757); +const reader_1 = __nccwpck_require__(94739); +class AsyncReader extends reader_1.default { + constructor(_root, _settings) { + super(_root, _settings); + this._settings = _settings; + this._scandir = fsScandir.scandir; + this._emitter = new events_1.EventEmitter(); + this._queue = fastq(this._worker.bind(this), this._settings.concurrency); + this._isFatalError = false; + this._isDestroyed = false; + this._queue.drain = () => { + if (!this._isFatalError) { + this._emitter.emit('end'); + } + }; } - switch (er.code) { - case 'ENOENT': - if (path.dirname(p) === p) return callback(er) - mkdirs(path.dirname(p), opts, (er, made) => { - if (er) callback(er, made) - else mkdirs(p, opts, callback, made) - }) - break - - // In the case of any other error, just see if there's a dir - // there already. If so, then hooray! If not, then something - // is borked. - default: - xfs.stat(p, (er2, stat) => { - // if the stat fails, then that's super weird. - // let the original error be the failure reason. - if (er2 || !stat.isDirectory()) callback(er, made) - else callback(null, made) - }) - break + read() { + this._isFatalError = false; + this._isDestroyed = false; + setImmediate(() => { + this._pushToQueue(this._root, this._settings.basePath); + }); + return this._emitter; + } + get isDestroyed() { + return this._isDestroyed; + } + destroy() { + if (this._isDestroyed) { + throw new Error('The reader is already destroyed'); + } + this._isDestroyed = true; + this._queue.killAndDrain(); + } + onEntry(callback) { + this._emitter.on('entry', callback); + } + onError(callback) { + this._emitter.once('error', callback); + } + onEnd(callback) { + this._emitter.once('end', callback); + } + _pushToQueue(directory, base) { + const queueItem = { directory, base }; + this._queue.push(queueItem, (error) => { + if (error !== null) { + this._handleError(error); + } + }); + } + _worker(item, done) { + this._scandir(item.directory, this._settings.fsScandirSettings, (error, entries) => { + if (error !== null) { + done(error, undefined); + return; + } + for (const entry of entries) { + this._handleEntry(entry, item.base); + } + done(null, undefined); + }); + } + _handleError(error) { + if (this._isDestroyed || !common.isFatalError(this._settings, error)) { + return; + } + this._isFatalError = true; + this._isDestroyed = true; + this._emitter.emit('error', error); + } + _handleEntry(entry, base) { + if (this._isDestroyed || this._isFatalError) { + return; + } + const fullpath = entry.path; + if (base !== undefined) { + entry.path = common.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator); + } + if (common.isAppliedFilter(this._settings.entryFilter, entry)) { + this._emitEntry(entry); + } + if (entry.dirent.isDirectory() && common.isAppliedFilter(this._settings.deepFilter, entry)) { + this._pushToQueue(fullpath, base === undefined ? undefined : entry.path); + } + } + _emitEntry(entry) { + this._emitter.emit('entry', entry); } - }) } - -module.exports = mkdirs +exports["default"] = AsyncReader; /***/ }), -/***/ 59672: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/***/ 90757: +/***/ ((__unused_webpack_module, exports) => { "use strict"; - -const path = __nccwpck_require__(16928) - -// get drive on windows -function getRootPath (p) { - p = path.normalize(path.resolve(p)).split(path.sep) - if (p.length > 0) return p[0] - return null +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.joinPathSegments = exports.replacePathSegmentSeparator = exports.isAppliedFilter = exports.isFatalError = void 0; +function isFatalError(settings, error) { + if (settings.errorFilter === null) { + return true; + } + return !settings.errorFilter(error); } - -// http://stackoverflow.com/a/62888/10333 contains more accurate -// TODO: expand to include the rest -const INVALID_PATH_CHARS = /[<>:"|?*]/ - -function invalidWin32Path (p) { - const rp = getRootPath(p) - p = p.replace(rp, '') - return INVALID_PATH_CHARS.test(p) +exports.isFatalError = isFatalError; +function isAppliedFilter(filter, value) { + return filter === null || filter(value); } - -module.exports = { - getRootPath, - invalidWin32Path +exports.isAppliedFilter = isAppliedFilter; +function replacePathSegmentSeparator(filepath, separator) { + return filepath.split(/[/\\]/).join(separator); +} +exports.replacePathSegmentSeparator = replacePathSegmentSeparator; +function joinPathSegments(a, b, separator) { + if (a === '') { + return b; + } + /** + * The correct handling of cases when the first segment is a root (`/`, `C:/`) or UNC path (`//?/C:/`). + */ + if (a.endsWith(separator)) { + return a + b; + } + return a + separator + b; } +exports.joinPathSegments = joinPathSegments; /***/ }), -/***/ 96542: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/***/ 94739: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; - -module.exports = { - moveSync: __nccwpck_require__(38345) +Object.defineProperty(exports, "__esModule", ({ value: true })); +const common = __nccwpck_require__(90757); +class Reader { + constructor(_root, _settings) { + this._root = _root; + this._settings = _settings; + this._root = common.replacePathSegmentSeparator(_root, _settings.pathSegmentSeparator); + } } +exports["default"] = Reader; /***/ }), -/***/ 38345: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/***/ 63339: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; +Object.defineProperty(exports, "__esModule", ({ value: true })); +const fsScandir = __nccwpck_require__(44482); +const common = __nccwpck_require__(90757); +const reader_1 = __nccwpck_require__(94739); +class SyncReader extends reader_1.default { + constructor() { + super(...arguments); + this._scandir = fsScandir.scandirSync; + this._storage = []; + this._queue = new Set(); + } + read() { + this._pushToQueue(this._root, this._settings.basePath); + this._handleQueue(); + return this._storage; + } + _pushToQueue(directory, base) { + this._queue.add({ directory, base }); + } + _handleQueue() { + for (const item of this._queue.values()) { + this._handleDirectory(item.directory, item.base); + } + } + _handleDirectory(directory, base) { + try { + const entries = this._scandir(directory, this._settings.fsScandirSettings); + for (const entry of entries) { + this._handleEntry(entry, base); + } + } + catch (error) { + this._handleError(error); + } + } + _handleError(error) { + if (!common.isFatalError(this._settings, error)) { + return; + } + throw error; + } + _handleEntry(entry, base) { + const fullpath = entry.path; + if (base !== undefined) { + entry.path = common.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator); + } + if (common.isAppliedFilter(this._settings.entryFilter, entry)) { + this._pushToStorage(entry); + } + if (entry.dirent.isDirectory() && common.isAppliedFilter(this._settings.deepFilter, entry)) { + this._pushToQueue(fullpath, base === undefined ? undefined : entry.path); + } + } + _pushToStorage(entry) { + this._storage.push(entry); + } +} +exports["default"] = SyncReader; -const fs = __nccwpck_require__(61404) -const path = __nccwpck_require__(16928) -const copySync = (__nccwpck_require__(52726).copySync) -const removeSync = (__nccwpck_require__(75419).removeSync) -const mkdirpSync = (__nccwpck_require__(20559).mkdirpSync) -const stat = __nccwpck_require__(76821) -function moveSync (src, dest, opts) { - opts = opts || {} - const overwrite = opts.overwrite || opts.clobber || false +/***/ }), - const { srcStat } = stat.checkPathsSync(src, dest, 'move') - stat.checkParentPathsSync(src, srcStat, dest, 'move') - mkdirpSync(path.dirname(dest)) - return doRename(src, dest, overwrite) -} +/***/ 74520: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -function doRename (src, dest, overwrite) { - if (overwrite) { - removeSync(dest) - return rename(src, dest, overwrite) - } - if (fs.existsSync(dest)) throw new Error('dest already exists.') - return rename(src, dest, overwrite) -} +"use strict"; -function rename (src, dest, overwrite) { - try { - fs.renameSync(src, dest) - } catch (err) { - if (err.code !== 'EXDEV') throw err - return moveAcrossDevice(src, dest, overwrite) - } +Object.defineProperty(exports, "__esModule", ({ value: true })); +const path = __nccwpck_require__(16928); +const fsScandir = __nccwpck_require__(44482); +class Settings { + constructor(_options = {}) { + this._options = _options; + this.basePath = this._getValue(this._options.basePath, undefined); + this.concurrency = this._getValue(this._options.concurrency, Number.POSITIVE_INFINITY); + this.deepFilter = this._getValue(this._options.deepFilter, null); + this.entryFilter = this._getValue(this._options.entryFilter, null); + this.errorFilter = this._getValue(this._options.errorFilter, null); + this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path.sep); + this.fsScandirSettings = new fsScandir.Settings({ + followSymbolicLinks: this._options.followSymbolicLinks, + fs: this._options.fs, + pathSegmentSeparator: this._options.pathSegmentSeparator, + stats: this._options.stats, + throwErrorOnBrokenSymbolicLink: this._options.throwErrorOnBrokenSymbolicLink + }); + } + _getValue(option, value) { + return option !== null && option !== void 0 ? option : value; + } } +exports["default"] = Settings; -function moveAcrossDevice (src, dest, overwrite) { - const opts = { - overwrite, - errorOnExist: true - } - copySync(src, dest, opts) - return removeSync(src) -} -module.exports = moveSync +/***/ }), + +/***/ 71187: +/***/ ((module) => { + +"use strict"; + + +module.exports = (...arguments_) => { + return [...new Set([].concat(...arguments_))]; +}; /***/ }), -/***/ 59190: +/***/ 88843: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; +const path = __nccwpck_require__(16928) +const isWindows = __nccwpck_require__(65196) + +module.exports = isWindows() ? winResolve : path.resolve -const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) -module.exports = { - move: u(__nccwpck_require__(15569)) +function winResolve (p) { + if (arguments.length === 0) return path.resolve() + if (typeof p !== 'string') { + return path.resolve(p) + } + // c: => C: + if (p[1] === ':') { + const cc = p[0].charCodeAt() + if (cc < 65 || cc > 90) { + p = `${p[0].toUpperCase()}${p.substr(1)}` + } + } + // On Windows path.resolve('C:') returns C:\Users\ + // We resolve C: to C: + if (p.endsWith(':')) { + return p + } + return path.resolve(p) } /***/ }), -/***/ 15569: +/***/ 37120: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -const fs = __nccwpck_require__(61404) -const path = __nccwpck_require__(16928) -const copy = (__nccwpck_require__(61454).copy) -const remove = (__nccwpck_require__(75419).remove) -const mkdirp = (__nccwpck_require__(20559).mkdirp) -const pathExists = (__nccwpck_require__(85615).pathExists) -const stat = __nccwpck_require__(76821) +const stringify = __nccwpck_require__(40641); +const compile = __nccwpck_require__(26453); +const expand = __nccwpck_require__(6374); +const parse = __nccwpck_require__(35583); -function move (src, dest, opts, cb) { - if (typeof opts === 'function') { - cb = opts - opts = {} - } +/** + * Expand the given pattern or create a regex-compatible string. + * + * ```js + * const braces = require('braces'); + * console.log(braces('{a,b,c}', { compile: true })); //=> ['(a|b|c)'] + * console.log(braces('{a,b,c}')); //=> ['a', 'b', 'c'] + * ``` + * @param {String} `str` + * @param {Object} `options` + * @return {String} + * @api public + */ - const overwrite = opts.overwrite || opts.clobber || false - - stat.checkPaths(src, dest, 'move', (err, stats) => { - if (err) return cb(err) - const { srcStat } = stats - stat.checkParentPaths(src, srcStat, dest, 'move', err => { - if (err) return cb(err) - mkdirp(path.dirname(dest), err => { - if (err) return cb(err) - return doRename(src, dest, overwrite, cb) - }) - }) - }) -} +const braces = (input, options = {}) => { + let output = []; -function doRename (src, dest, overwrite, cb) { - if (overwrite) { - return remove(dest, err => { - if (err) return cb(err) - return rename(src, dest, overwrite, cb) - }) + if (Array.isArray(input)) { + for (const pattern of input) { + const result = braces.create(pattern, options); + if (Array.isArray(result)) { + output.push(...result); + } else { + output.push(result); + } + } + } else { + output = [].concat(braces.create(input, options)); } - 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) - }) -} -function moveAcrossDevice (src, dest, overwrite, cb) { - const opts = { - overwrite, - errorOnExist: true + if (options && options.expand === true && options.nodupes === true) { + output = [...new Set(output)]; } - copy(src, dest, opts, err => { - if (err) return cb(err) - return remove(src, cb) - }) -} - -module.exports = move - + return output; +}; -/***/ }), +/** + * Parse the given `str` with the given `options`. + * + * ```js + * // braces.parse(pattern, [, options]); + * const ast = braces.parse('a/{b,c}/d'); + * console.log(ast); + * ``` + * @param {String} pattern Brace pattern to parse + * @param {Object} options + * @return {Object} Returns an AST + * @api public + */ -/***/ 76698: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +braces.parse = (input, options = {}) => parse(input, options); -"use strict"; +/** + * Creates a braces string from an AST, or an AST node. + * + * ```js + * const braces = require('braces'); + * let ast = braces.parse('foo/{a,b}/bar'); + * console.log(stringify(ast.nodes[2])); //=> '{a,b}' + * ``` + * @param {String} `input` Brace pattern or AST. + * @param {Object} `options` + * @return {Array} Returns an array of expanded values. + * @api public + */ +braces.stringify = (input, options = {}) => { + if (typeof input === 'string') { + return stringify(braces.parse(input, options), options); + } + return stringify(input, options); +}; -const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) -const fs = __nccwpck_require__(61404) -const path = __nccwpck_require__(16928) -const mkdir = __nccwpck_require__(20559) -const pathExists = (__nccwpck_require__(85615).pathExists) +/** + * Compiles a brace pattern into a regex-compatible, optimized string. + * This method is called by the main [braces](#braces) function by default. + * + * ```js + * const braces = require('braces'); + * console.log(braces.compile('a/{b,c}/d')); + * //=> ['a/(b|c)/d'] + * ``` + * @param {String} `input` Brace pattern or AST. + * @param {Object} `options` + * @return {Array} Returns an array of expanded values. + * @api public + */ -function outputFile (file, data, encoding, callback) { - if (typeof encoding === 'function') { - callback = encoding - encoding = 'utf8' +braces.compile = (input, options = {}) => { + if (typeof input === 'string') { + input = braces.parse(input, options); } + return compile(input, options); +}; - const dir = path.dirname(file) - pathExists(dir, (err, itDoes) => { - if (err) return callback(err) - if (itDoes) return fs.writeFile(file, data, encoding, callback) +/** + * Expands a brace pattern into an array. This method is called by the + * main [braces](#braces) function when `options.expand` is true. Before + * using this method it's recommended that you read the [performance notes](#performance)) + * and advantages of using [.compile](#compile) instead. + * + * ```js + * const braces = require('braces'); + * console.log(braces.expand('a/{b,c}/d')); + * //=> ['a/b/d', 'a/c/d']; + * ``` + * @param {String} `pattern` Brace pattern + * @param {Object} `options` + * @return {Array} Returns an array of expanded values. + * @api public + */ - mkdir.mkdirs(dir, err => { - if (err) return callback(err) +braces.expand = (input, options = {}) => { + if (typeof input === 'string') { + input = braces.parse(input, options); + } - fs.writeFile(file, data, encoding, callback) - }) - }) -} + let result = expand(input, options); -function outputFileSync (file, ...args) { - const dir = path.dirname(file) - if (fs.existsSync(dir)) { - return fs.writeFileSync(file, ...args) + // filter out empty strings if specified + if (options.noempty === true) { + result = result.filter(Boolean); } - mkdir.mkdirsSync(dir) - fs.writeFileSync(file, ...args) -} - -module.exports = { - outputFile: u(outputFile), - outputFileSync -} + // filter out duplicates if specified + if (options.nodupes === true) { + result = [...new Set(result)]; + } -/***/ }), + return result; +}; -/***/ 85615: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/** + * Processes a brace pattern and returns either an expanded array + * (if `options.expand` is true), a highly optimized regex-compatible string. + * This method is called by the main [braces](#braces) function. + * + * ```js + * const braces = require('braces'); + * console.log(braces.create('user-{200..300}/project-{a,b,c}-{1..10}')) + * //=> 'user-(20[0-9]|2[1-9][0-9]|300)/project-(a|b|c)-([1-9]|10)' + * ``` + * @param {String} `pattern` Brace pattern + * @param {Object} `options` + * @return {Array} Returns an array of expanded values. + * @api public + */ -"use strict"; +braces.create = (input, options = {}) => { + if (input === '' || input.length < 3) { + return [input]; + } -const u = (__nccwpck_require__(92977)/* .fromPromise */ .z) -const fs = __nccwpck_require__(93628) + return options.expand !== true + ? braces.compile(input, options) + : braces.expand(input, options); +}; -function pathExists (path) { - return fs.access(path).then(() => true).catch(() => false) -} +/** + * Expose "braces" + */ -module.exports = { - pathExists: u(pathExists), - pathExistsSync: fs.existsSync -} +module.exports = braces; /***/ }), -/***/ 75419: +/***/ 26453: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) -const rimraf = __nccwpck_require__(82058) +const fill = __nccwpck_require__(9073); +const utils = __nccwpck_require__(60837); -module.exports = { - remove: u(rimraf), - removeSync: rimraf.sync -} +const compile = (ast, options = {}) => { + const walk = (node, parent = {}) => { + const invalidBlock = utils.isInvalidBrace(parent); + const invalidNode = node.invalid === true && options.escapeInvalid === true; + const invalid = invalidBlock === true || invalidNode === true; + const prefix = options.escapeInvalid === true ? '\\' : ''; + let output = ''; + if (node.isOpen === true) { + return prefix + node.value; + } -/***/ }), + if (node.isClose === true) { + console.log('node.isClose', prefix, node.value); + return prefix + node.value; + } -/***/ 82058: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + if (node.type === 'open') { + return invalid ? prefix + node.value : '('; + } -"use strict"; + if (node.type === 'close') { + return invalid ? prefix + node.value : ')'; + } + if (node.type === 'comma') { + return node.prev.type === 'comma' ? '' : invalid ? node.value : '|'; + } -const fs = __nccwpck_require__(61404) -const path = __nccwpck_require__(16928) -const assert = __nccwpck_require__(42613) + if (node.value) { + return node.value; + } -const isWindows = (process.platform === 'win32') + if (node.nodes && node.ranges > 0) { + const args = utils.reduce(node.nodes); + const range = fill(...args, { ...options, wrap: false, toRegex: true, strictZeros: true }); -function defaults (options) { - const methods = [ - 'unlink', - 'chmod', - 'stat', - 'lstat', - 'rmdir', - 'readdir' - ] - methods.forEach(m => { - options[m] = options[m] || fs[m] - m = m + 'Sync' - options[m] = options[m] || fs[m] - }) + if (range.length !== 0) { + return args.length > 1 && range.length > 1 ? `(${range})` : range; + } + } - options.maxBusyTries = options.maxBusyTries || 3 -} + if (node.nodes) { + for (const child of node.nodes) { + output += walk(child, node); + } + } -function rimraf (p, options, cb) { - let busyTries = 0 + return output; + }; - if (typeof options === 'function') { - cb = options - options = {} - } + return walk(ast); +}; - assert(p, 'rimraf: missing path') - assert.strictEqual(typeof p, 'string', 'rimraf: path should be a string') - assert.strictEqual(typeof cb, 'function', 'rimraf: callback function required') - assert(options, 'rimraf: invalid options argument provided') - assert.strictEqual(typeof options, 'object', 'rimraf: options should be object') +module.exports = compile; - defaults(options) - rimraf_(p, options, function CB (er) { - if (er) { - if ((er.code === 'EBUSY' || er.code === 'ENOTEMPTY' || er.code === 'EPERM') && - busyTries < options.maxBusyTries) { - busyTries++ - const time = busyTries * 100 - // try again, with the same exact callback as this one. - return setTimeout(() => rimraf_(p, options, CB), time) - } +/***/ }), - // already gone - if (er.code === 'ENOENT') er = null - } +/***/ 57201: +/***/ ((module) => { - cb(er) - }) -} +"use strict"; -// Two possible strategies. -// 1. Assume it's a file. unlink it, then do the dir stuff on EPERM or EISDIR -// 2. Assume it's a directory. readdir, then do the file stuff on ENOTDIR -// -// Both result in an extra syscall when you guess wrong. However, there -// are likely far more normal files in the world than directories. This -// is based on the assumption that a the average number of files per -// directory is >= 1. -// -// If anyone ever complains about this, then I guess the strategy could -// be made configurable somehow. But until then, YAGNI. -function rimraf_ (p, options, cb) { - assert(p) - assert(options) - assert(typeof cb === 'function') - // sunos lets the root user unlink directories, which is... weird. - // so we have to lstat here and make sure it's not a dir. - options.lstat(p, (er, st) => { - if (er && er.code === 'ENOENT') { - return cb(null) - } +module.exports = { + MAX_LENGTH: 10000, - // Windows can EPERM on stat. Life is suffering. - if (er && er.code === 'EPERM' && isWindows) { - return fixWinEPERM(p, options, er, cb) - } + // Digits + CHAR_0: '0', /* 0 */ + CHAR_9: '9', /* 9 */ - if (st && st.isDirectory()) { - return rmdir(p, options, er, cb) - } + // Alphabet chars. + CHAR_UPPERCASE_A: 'A', /* A */ + CHAR_LOWERCASE_A: 'a', /* a */ + CHAR_UPPERCASE_Z: 'Z', /* Z */ + CHAR_LOWERCASE_Z: 'z', /* z */ - options.unlink(p, er => { - if (er) { - if (er.code === 'ENOENT') { - return cb(null) - } - if (er.code === 'EPERM') { - return (isWindows) - ? fixWinEPERM(p, options, er, cb) - : rmdir(p, options, er, cb) - } - if (er.code === 'EISDIR') { - return rmdir(p, options, er, cb) - } - } - return cb(er) - }) - }) -} + CHAR_LEFT_PARENTHESES: '(', /* ( */ + CHAR_RIGHT_PARENTHESES: ')', /* ) */ -function fixWinEPERM (p, options, er, cb) { - assert(p) - assert(options) - assert(typeof cb === 'function') - if (er) { - assert(er instanceof Error) - } + CHAR_ASTERISK: '*', /* * */ - options.chmod(p, 0o666, er2 => { - if (er2) { - cb(er2.code === 'ENOENT' ? null : er) - } else { - options.stat(p, (er3, stats) => { - if (er3) { - cb(er3.code === 'ENOENT' ? null : er) - } else if (stats.isDirectory()) { - rmdir(p, options, er, cb) - } else { - options.unlink(p, cb) - } - }) - } - }) -} + // Non-alphabetic chars. + CHAR_AMPERSAND: '&', /* & */ + CHAR_AT: '@', /* @ */ + CHAR_BACKSLASH: '\\', /* \ */ + CHAR_BACKTICK: '`', /* ` */ + CHAR_CARRIAGE_RETURN: '\r', /* \r */ + CHAR_CIRCUMFLEX_ACCENT: '^', /* ^ */ + CHAR_COLON: ':', /* : */ + CHAR_COMMA: ',', /* , */ + CHAR_DOLLAR: '$', /* . */ + CHAR_DOT: '.', /* . */ + CHAR_DOUBLE_QUOTE: '"', /* " */ + CHAR_EQUAL: '=', /* = */ + CHAR_EXCLAMATION_MARK: '!', /* ! */ + CHAR_FORM_FEED: '\f', /* \f */ + CHAR_FORWARD_SLASH: '/', /* / */ + CHAR_HASH: '#', /* # */ + CHAR_HYPHEN_MINUS: '-', /* - */ + CHAR_LEFT_ANGLE_BRACKET: '<', /* < */ + CHAR_LEFT_CURLY_BRACE: '{', /* { */ + CHAR_LEFT_SQUARE_BRACKET: '[', /* [ */ + CHAR_LINE_FEED: '\n', /* \n */ + CHAR_NO_BREAK_SPACE: '\u00A0', /* \u00A0 */ + CHAR_PERCENT: '%', /* % */ + CHAR_PLUS: '+', /* + */ + CHAR_QUESTION_MARK: '?', /* ? */ + CHAR_RIGHT_ANGLE_BRACKET: '>', /* > */ + CHAR_RIGHT_CURLY_BRACE: '}', /* } */ + CHAR_RIGHT_SQUARE_BRACKET: ']', /* ] */ + CHAR_SEMICOLON: ';', /* ; */ + CHAR_SINGLE_QUOTE: '\'', /* ' */ + CHAR_SPACE: ' ', /* */ + CHAR_TAB: '\t', /* \t */ + CHAR_UNDERSCORE: '_', /* _ */ + CHAR_VERTICAL_LINE: '|', /* | */ + CHAR_ZERO_WIDTH_NOBREAK_SPACE: '\uFEFF' /* \uFEFF */ +}; -function fixWinEPERMSync (p, options, er) { - let stats - assert(p) - assert(options) - if (er) { - assert(er instanceof Error) - } +/***/ }), - try { - options.chmodSync(p, 0o666) - } catch (er2) { - if (er2.code === 'ENOENT') { - return - } else { - throw er - } +/***/ 6374: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const fill = __nccwpck_require__(9073); +const stringify = __nccwpck_require__(40641); +const utils = __nccwpck_require__(60837); + +const append = (queue = '', stash = '', enclose = false) => { + const result = []; + + queue = [].concat(queue); + stash = [].concat(stash); + + if (!stash.length) return queue; + if (!queue.length) { + return enclose ? utils.flatten(stash).map(ele => `{${ele}}`) : stash; } - try { - stats = options.statSync(p) - } catch (er3) { - if (er3.code === 'ENOENT') { - return + for (const item of queue) { + if (Array.isArray(item)) { + for (const value of item) { + result.push(append(value, stash, enclose)); + } } else { - throw er + for (let ele of stash) { + if (enclose === true && typeof ele === 'string') ele = `{${ele}}`; + result.push(Array.isArray(ele) ? append(item, ele, enclose) : item + ele); + } } } + return utils.flatten(result); +}; - if (stats.isDirectory()) { - rmdirSync(p, options, er) - } else { - options.unlinkSync(p) - } -} +const expand = (ast, options = {}) => { + const rangeLimit = options.rangeLimit === undefined ? 1000 : options.rangeLimit; -function rmdir (p, options, originalEr, cb) { - assert(p) - assert(options) - if (originalEr) { - assert(originalEr instanceof Error) - } - assert(typeof cb === 'function') + const walk = (node, parent = {}) => { + node.queue = []; - // try to rmdir first, and only readdir on ENOTEMPTY or EEXIST (SunOS) - // if we guessed wrong, and it's not a directory, then - // raise the original error. - options.rmdir(p, er => { - if (er && (er.code === 'ENOTEMPTY' || er.code === 'EEXIST' || er.code === 'EPERM')) { - rmkids(p, options, cb) - } else if (er && er.code === 'ENOTDIR') { - cb(originalEr) - } else { - cb(er) - } - }) -} + let p = parent; + let q = parent.queue; -function rmkids (p, options, cb) { - assert(p) - assert(options) - assert(typeof cb === 'function') + while (p.type !== 'brace' && p.type !== 'root' && p.parent) { + p = p.parent; + q = p.queue; + } - options.readdir(p, (er, files) => { - if (er) return cb(er) + if (node.invalid || node.dollar) { + q.push(append(q.pop(), stringify(node, options))); + return; + } - let n = files.length - let errState + if (node.type === 'brace' && node.invalid !== true && node.nodes.length === 2) { + q.push(append(q.pop(), ['{}'])); + return; + } - if (n === 0) return options.rmdir(p, cb) + if (node.nodes && node.ranges > 0) { + const args = utils.reduce(node.nodes); - files.forEach(f => { - rimraf(path.join(p, f), options, er => { - if (errState) { - return - } - if (er) return cb(errState = er) - if (--n === 0) { - options.rmdir(p, cb) - } - }) - }) - }) -} + if (utils.exceedsLimit(...args, options.step, rangeLimit)) { + throw new RangeError('expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.'); + } -// this looks simpler, and is strictly *faster*, but will -// tie up the JavaScript thread and fail on excessively -// deep directory trees. -function rimrafSync (p, options) { - let st + let range = fill(...args, options); + if (range.length === 0) { + range = stringify(node, options); + } - options = options || {} - defaults(options) + q.push(append(q.pop(), range)); + node.nodes = []; + return; + } - assert(p, 'rimraf: missing path') - assert.strictEqual(typeof p, 'string', 'rimraf: path should be a string') - assert(options, 'rimraf: missing options') - assert.strictEqual(typeof options, 'object', 'rimraf: options should be object') + const enclose = utils.encloseBrace(node); + let queue = node.queue; + let block = node; - try { - st = options.lstatSync(p) - } catch (er) { - if (er.code === 'ENOENT') { - return + while (block.type !== 'brace' && block.type !== 'root' && block.parent) { + block = block.parent; + queue = block.queue; } - // Windows can EPERM on stat. Life is suffering. - if (er.code === 'EPERM' && isWindows) { - fixWinEPERMSync(p, options, er) - } - } + for (let i = 0; i < node.nodes.length; i++) { + const child = node.nodes[i]; - try { - // sunos lets the root user unlink directories, which is... weird. - if (st && st.isDirectory()) { - rmdirSync(p, options, null) - } else { - options.unlinkSync(p) - } - } catch (er) { - if (er.code === 'ENOENT') { - return - } else if (er.code === 'EPERM') { - return isWindows ? fixWinEPERMSync(p, options, er) : rmdirSync(p, options, er) - } else if (er.code !== 'EISDIR') { - throw er - } - rmdirSync(p, options, er) - } -} + if (child.type === 'comma' && node.type === 'brace') { + if (i === 1) queue.push(''); + queue.push(''); + continue; + } -function rmdirSync (p, options, originalEr) { - assert(p) - assert(options) - if (originalEr) { - assert(originalEr instanceof Error) - } + if (child.type === 'close') { + q.push(append(q.pop(), queue, enclose)); + continue; + } - try { - options.rmdirSync(p) - } catch (er) { - if (er.code === 'ENOTDIR') { - throw originalEr - } else if (er.code === 'ENOTEMPTY' || er.code === 'EEXIST' || er.code === 'EPERM') { - rmkidsSync(p, options) - } else if (er.code !== 'ENOENT') { - throw er + if (child.value && child.type !== 'open') { + queue.push(append(queue.pop(), child.value)); + continue; + } + + if (child.nodes) { + walk(child, node); + } } - } -} -function rmkidsSync (p, options) { - assert(p) - assert(options) - options.readdirSync(p).forEach(f => rimrafSync(path.join(p, f), options)) + return queue; + }; - if (isWindows) { - // We only end up here once we got ENOTEMPTY at least once, and - // at this point, we are guaranteed to have removed all the kids. - // So, we know that it won't be ENOENT or ENOTDIR or anything else. - // try really hard to delete stuff on windows, because it has a - // PROFOUNDLY annoying habit of not closing handles promptly when - // files are deleted, resulting in spurious ENOTEMPTY errors. - const startTime = Date.now() - do { - try { - const ret = options.rmdirSync(p, options) - return ret - } catch (er) { } - } while (Date.now() - startTime < 500) // give up after 500ms - } else { - const ret = options.rmdirSync(p, options) - return ret - } -} + return utils.flatten(walk(ast)); +}; -module.exports = rimraf -rimraf.sync = rimrafSync +module.exports = expand; /***/ }), -/***/ 26445: -/***/ ((module) => { +/***/ 35583: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -/* eslint-disable node/no-deprecated-api */ -module.exports = function (size) { - if (typeof Buffer.allocUnsafe === 'function') { - try { - return Buffer.allocUnsafe(size) - } catch (e) { - return new Buffer(size) - } - } - return new Buffer(size) -} - -/***/ }), - -/***/ 76821: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +const stringify = __nccwpck_require__(40641); -"use strict"; +/** + * Constants + */ +const { + MAX_LENGTH, + CHAR_BACKSLASH, /* \ */ + CHAR_BACKTICK, /* ` */ + CHAR_COMMA, /* , */ + CHAR_DOT, /* . */ + CHAR_LEFT_PARENTHESES, /* ( */ + CHAR_RIGHT_PARENTHESES, /* ) */ + CHAR_LEFT_CURLY_BRACE, /* { */ + CHAR_RIGHT_CURLY_BRACE, /* } */ + CHAR_LEFT_SQUARE_BRACKET, /* [ */ + CHAR_RIGHT_SQUARE_BRACKET, /* ] */ + CHAR_DOUBLE_QUOTE, /* " */ + CHAR_SINGLE_QUOTE, /* ' */ + CHAR_NO_BREAK_SPACE, + CHAR_ZERO_WIDTH_NOBREAK_SPACE +} = __nccwpck_require__(57201); -const fs = __nccwpck_require__(61404) -const path = __nccwpck_require__(16928) +/** + * parse + */ -const NODE_VERSION_MAJOR_WITH_BIGINT = 10 -const NODE_VERSION_MINOR_WITH_BIGINT = 5 -const NODE_VERSION_PATCH_WITH_BIGINT = 0 -const nodeVersion = process.versions.node.split('.') -const nodeVersionMajor = Number.parseInt(nodeVersion[0], 10) -const nodeVersionMinor = Number.parseInt(nodeVersion[1], 10) -const nodeVersionPatch = Number.parseInt(nodeVersion[2], 10) +const parse = (input, options = {}) => { + if (typeof input !== 'string') { + throw new TypeError('Expected a string'); + } -function nodeSupportsBigInt () { - if (nodeVersionMajor > NODE_VERSION_MAJOR_WITH_BIGINT) { - return true - } else if (nodeVersionMajor === NODE_VERSION_MAJOR_WITH_BIGINT) { - if (nodeVersionMinor > NODE_VERSION_MINOR_WITH_BIGINT) { - return true - } else if (nodeVersionMinor === NODE_VERSION_MINOR_WITH_BIGINT) { - if (nodeVersionPatch >= NODE_VERSION_PATCH_WITH_BIGINT) { - return true - } - } + const opts = options || {}; + const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH; + if (input.length > max) { + throw new SyntaxError(`Input length (${input.length}), exceeds max characters (${max})`); } - return false -} -function getStats (src, dest, cb) { - if (nodeSupportsBigInt()) { - fs.stat(src, { bigint: true }, (err, srcStat) => { - if (err) return cb(err) - fs.stat(dest, { bigint: true }, (err, destStat) => { - if (err) { - if (err.code === 'ENOENT') return cb(null, { srcStat, destStat: null }) - return cb(err) - } - return cb(null, { srcStat, destStat }) - }) - }) - } else { - fs.stat(src, (err, srcStat) => { - if (err) return cb(err) - fs.stat(dest, (err, destStat) => { - if (err) { - if (err.code === 'ENOENT') return cb(null, { srcStat, destStat: null }) - return cb(err) - } - return cb(null, { srcStat, destStat }) - }) - }) - } -} + const ast = { type: 'root', input, nodes: [] }; + const stack = [ast]; + let block = ast; + let prev = ast; + let brackets = 0; + const length = input.length; + let index = 0; + let depth = 0; + let value; -function getStatsSync (src, dest) { - let srcStat, destStat - if (nodeSupportsBigInt()) { - srcStat = fs.statSync(src, { bigint: true }) - } else { - srcStat = fs.statSync(src) - } - try { - if (nodeSupportsBigInt()) { - destStat = fs.statSync(dest, { bigint: true }) - } else { - destStat = fs.statSync(dest) - } - } catch (err) { - if (err.code === 'ENOENT') return { srcStat, destStat: null } - throw err - } - return { srcStat, destStat } -} + /** + * Helpers + */ -function checkPaths (src, dest, funcName, cb) { - getStats(src, dest, (err, stats) => { - if (err) return cb(err) - const { srcStat, destStat } = stats - if (destStat && destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev) { - return cb(new Error('Source and destination must not be the same.')) + const advance = () => input[index++]; + const push = node => { + if (node.type === 'text' && prev.type === 'dot') { + prev.type = 'text'; } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - return cb(new Error(errMsg(src, dest, funcName))) + + if (prev && prev.type === 'text' && node.type === 'text') { + prev.value += node.value; + return; } - return cb(null, { srcStat, destStat }) - }) -} -function checkPathsSync (src, dest, funcName) { - const { srcStat, destStat } = getStatsSync(src, dest) - if (destStat && destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev) { - throw new Error('Source and destination must not be the same.') - } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - throw new Error(errMsg(src, dest, funcName)) - } - return { srcStat, destStat } -} + block.nodes.push(node); + node.parent = block; + node.prev = prev; + prev = node; + return node; + }; -// recursively check if dest parent is a subdirectory of src. -// It works for all file types including symlinks since it -// checks the src and dest inodes. It starts from the deepest -// parent and stops once it reaches the src parent or the root path. -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 cb() - if (nodeSupportsBigInt()) { - fs.stat(destParent, { bigint: true }, (err, destStat) => { - if (err) { - if (err.code === 'ENOENT') return cb() - return cb(err) - } - if (destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev) { - return cb(new Error(errMsg(src, dest, funcName))) - } - return checkParentPaths(src, srcStat, destParent, funcName, cb) - }) - } else { - fs.stat(destParent, (err, destStat) => { - if (err) { - if (err.code === 'ENOENT') return cb() - return cb(err) - } - if (destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev) { - return cb(new Error(errMsg(src, dest, funcName))) - } - return checkParentPaths(src, srcStat, destParent, funcName, cb) - }) - } -} + push({ type: 'bos' }); -function checkParentPathsSync (src, srcStat, dest, funcName) { - const srcParent = path.resolve(path.dirname(src)) - const destParent = path.resolve(path.dirname(dest)) - if (destParent === srcParent || destParent === path.parse(destParent).root) return - let destStat - try { - if (nodeSupportsBigInt()) { - destStat = fs.statSync(destParent, { bigint: true }) - } else { - destStat = fs.statSync(destParent) - } - } catch (err) { - if (err.code === 'ENOENT') return - throw err - } - if (destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev) { - throw new Error(errMsg(src, dest, funcName)) - } - return checkParentPathsSync(src, srcStat, destParent, funcName) -} + while (index < length) { + block = stack[stack.length - 1]; + value = advance(); -// return true if dest is a subdir of src, otherwise false. -// It only checks the path strings. -function isSrcSubdir (src, dest) { - const srcArr = path.resolve(src).split(path.sep).filter(i => i) - const destArr = path.resolve(dest).split(path.sep).filter(i => i) - return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true) -} + /** + * Invalid chars + */ -function errMsg (src, dest, funcName) { - return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.` -} + if (value === CHAR_ZERO_WIDTH_NOBREAK_SPACE || value === CHAR_NO_BREAK_SPACE) { + continue; + } -module.exports = { - checkPaths, - checkPathsSync, - checkParentPaths, - checkParentPathsSync, - isSrcSubdir -} + /** + * Escaped chars + */ + if (value === CHAR_BACKSLASH) { + push({ type: 'text', value: (options.keepEscaping ? value : '') + advance() }); + continue; + } -/***/ }), + /** + * Right square bracket (literal): ']' + */ -/***/ 84420: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + if (value === CHAR_RIGHT_SQUARE_BRACKET) { + push({ type: 'text', value: '\\' + value }); + continue; + } -"use strict"; + /** + * Left square bracket: '[' + */ + if (value === CHAR_LEFT_SQUARE_BRACKET) { + brackets++; -const fs = __nccwpck_require__(61404) -const os = __nccwpck_require__(70857) -const path = __nccwpck_require__(16928) + let next; -// HFS, ext{2,3}, FAT do not, Node.js v0.10 does not -function hasMillisResSync () { - let tmpfile = path.join('millis-test-sync' + Date.now().toString() + Math.random().toString().slice(2)) - tmpfile = path.join(os.tmpdir(), tmpfile) + while (index < length && (next = advance())) { + value += next; - // 550 millis past UNIX epoch - const d = new Date(1435410243862) - fs.writeFileSync(tmpfile, 'https://github.com/jprichardson/node-fs-extra/pull/141') - const fd = fs.openSync(tmpfile, 'r+') - fs.futimesSync(fd, d, d) - fs.closeSync(fd) - return fs.statSync(tmpfile).mtime > 1435410243000 -} + if (next === CHAR_LEFT_SQUARE_BRACKET) { + brackets++; + continue; + } -function hasMillisRes (callback) { - let tmpfile = path.join('millis-test' + Date.now().toString() + Math.random().toString().slice(2)) - tmpfile = path.join(os.tmpdir(), tmpfile) + if (next === CHAR_BACKSLASH) { + value += advance(); + continue; + } - // 550 millis past UNIX epoch - const d = new Date(1435410243862) - fs.writeFile(tmpfile, 'https://github.com/jprichardson/node-fs-extra/pull/141', err => { - if (err) return callback(err) - fs.open(tmpfile, 'r+', (err, fd) => { - if (err) return callback(err) - fs.futimes(fd, d, d, err => { - if (err) return callback(err) - fs.close(fd, err => { - if (err) return callback(err) - fs.stat(tmpfile, (err, stats) => { - if (err) return callback(err) - callback(null, stats.mtime > 1435410243000) - }) - }) - }) - }) - }) -} + if (next === CHAR_RIGHT_SQUARE_BRACKET) { + brackets--; -function timeRemoveMillis (timestamp) { - if (typeof timestamp === 'number') { - return Math.floor(timestamp / 1000) * 1000 - } else if (timestamp instanceof Date) { - return new Date(Math.floor(timestamp.getTime() / 1000) * 1000) - } else { - throw new Error('fs-extra: timeRemoveMillis() unknown parameter type') - } -} + if (brackets === 0) { + break; + } + } + } -function utimesMillis (path, atime, mtime, callback) { - // if (!HAS_MILLIS_RES) return fs.utimes(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) - }) - }) - }) -} + push({ type: 'text', value }); + continue; + } -function utimesMillisSync (path, atime, mtime) { - const fd = fs.openSync(path, 'r+') - fs.futimesSync(fd, atime, mtime) - return fs.closeSync(fd) -} + /** + * Parentheses + */ -module.exports = { - hasMillisRes, - hasMillisResSync, - timeRemoveMillis, - utimesMillis, - utimesMillisSync -} + if (value === CHAR_LEFT_PARENTHESES) { + block = push({ type: 'paren', nodes: [] }); + stack.push(block); + push({ type: 'text', value }); + continue; + } + if (value === CHAR_RIGHT_PARENTHESES) { + if (block.type !== 'paren') { + push({ type: 'text', value }); + continue; + } + block = stack.pop(); + push({ type: 'text', value }); + block = stack[stack.length - 1]; + continue; + } -/***/ }), + /** + * Quotes: '|"|` + */ -/***/ 16792: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + if (value === CHAR_DOUBLE_QUOTE || value === CHAR_SINGLE_QUOTE || value === CHAR_BACKTICK) { + const open = value; + let next; -"use strict"; + if (options.keepQuotes !== true) { + value = ''; + } + while (index < length && (next = advance())) { + if (next === CHAR_BACKSLASH) { + value += next + advance(); + continue; + } -Object.defineProperty(exports, "__esModule", ({ value: true })); + if (next === open) { + if (options.keepQuotes === true) value += next; + break; + } -function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } + value += next; + } -var _regeneratorRuntime = _interopDefault(__nccwpck_require__(65907)); -var _asyncToGenerator = _interopDefault(__nccwpck_require__(67584)); -var _classCallCheck = _interopDefault(__nccwpck_require__(33446)); -var _possibleConstructorReturn = _interopDefault(__nccwpck_require__(83855)); -var _getPrototypeOf = _interopDefault(__nccwpck_require__(55989)); -var _inherits = _interopDefault(__nccwpck_require__(87406)); -var _wrapNativeSuper = _interopDefault(__nccwpck_require__(16318)); -var fs = _interopDefault(__nccwpck_require__(5810)); -var path = _interopDefault(__nccwpck_require__(16928)); -var globby = __nccwpck_require__(46127); -var globby__default = _interopDefault(globby); -var readYamlFile = __nccwpck_require__(64109); -var readYamlFile__default = _interopDefault(readYamlFile); -var findRoot = __nccwpck_require__(67805); + push({ type: 'text', value }); + continue; + } -var PackageJsonMissingNameError = -/*#__PURE__*/ -function (_Error) { - _inherits(PackageJsonMissingNameError, _Error); + /** + * Left curly brace: '{' + */ - function PackageJsonMissingNameError(directories) { - var _this; + if (value === CHAR_LEFT_CURLY_BRACE) { + depth++; - _classCallCheck(this, PackageJsonMissingNameError); + const dollar = prev.value && prev.value.slice(-1) === '$' || block.dollar === true; + const brace = { + type: 'brace', + open: true, + close: false, + dollar, + depth, + commas: 0, + ranges: 0, + nodes: [] + }; - _this = _possibleConstructorReturn(this, _getPrototypeOf(PackageJsonMissingNameError).call(this, "The following package.jsons are missing the \"name\" field:\n".concat(directories.join("\n")))); - _this.directories = directories; - return _this; - } + block = push(brace); + stack.push(block); + push({ type: 'open', value }); + continue; + } - return PackageJsonMissingNameError; -}(_wrapNativeSuper(Error)); -function getPackages(_x) { - return _getPackages.apply(this, arguments); -} + /** + * Right curly brace: '}' + */ -function _getPackages() { - _getPackages = _asyncToGenerator( - /*#__PURE__*/ - _regeneratorRuntime.mark(function _callee(dir) { - var cwd, pkg, tool, manifest, lernaJson, root, relativeDirectories, directories, pkgJsonsMissingNameField, results; - return _regeneratorRuntime.wrap(function _callee$(_context) { - while (1) { - switch (_context.prev = _context.next) { - case 0: - _context.next = 2; - return findRoot.findRoot(dir); + if (value === CHAR_RIGHT_CURLY_BRACE) { + if (block.type !== 'brace') { + push({ type: 'text', value }); + continue; + } - case 2: - cwd = _context.sent; - _context.next = 5; - return fs.readJson(path.join(cwd, "package.json")); + const type = 'close'; + block = stack.pop(); + block.close = true; - case 5: - pkg = _context.sent; + push({ type, value }); + depth--; - if (!pkg.workspaces) { - _context.next = 10; - break; - } + block = stack[stack.length - 1]; + continue; + } - if (Array.isArray(pkg.workspaces)) { - tool = { - type: "yarn", - packageGlobs: pkg.workspaces - }; - } else if (pkg.workspaces.packages) { - tool = { - type: "yarn", - packageGlobs: pkg.workspaces.packages - }; - } + /** + * Comma: ',' + */ - _context.next = 37; - break; + if (value === CHAR_COMMA && depth > 0) { + if (block.ranges > 0) { + block.ranges = 0; + const open = block.nodes.shift(); + block.nodes = [open, { type: 'text', value: stringify(block) }]; + } - case 10: - if (!(pkg.bolt && pkg.bolt.workspaces)) { - _context.next = 14; - break; - } + push({ type: 'comma', value }); + block.commas++; + continue; + } - tool = { - type: "bolt", - packageGlobs: pkg.bolt.workspaces - }; - _context.next = 37; - break; + /** + * Dot: '.' + */ - case 14: - _context.prev = 14; - _context.next = 17; - return readYamlFile__default(path.join(cwd, "pnpm-workspace.yaml")); + if (value === CHAR_DOT && depth > 0 && block.commas === 0) { + const siblings = block.nodes; - case 17: - manifest = _context.sent; + if (depth === 0 || siblings.length === 0) { + push({ type: 'text', value }); + continue; + } - if (manifest && manifest.packages) { - tool = { - type: "pnpm", - packageGlobs: manifest.packages - }; - } + if (prev.type === 'dot') { + block.range = []; + prev.value += value; + prev.type = 'range'; - _context.next = 25; - break; + if (block.nodes.length !== 3 && block.nodes.length !== 5) { + block.invalid = true; + block.ranges = 0; + prev.type = 'text'; + continue; + } - case 21: - _context.prev = 21; - _context.t0 = _context["catch"](14); + block.ranges++; + block.args = []; + continue; + } - if (!(_context.t0.code !== "ENOENT")) { - _context.next = 25; - break; - } + if (prev.type === 'range') { + siblings.pop(); - throw _context.t0; + const before = siblings[siblings.length - 1]; + before.value += prev.value + value; + prev = before; + block.ranges--; + continue; + } - case 25: - if (tool) { - _context.next = 37; - break; - } + push({ type: 'dot', value }); + continue; + } - _context.prev = 26; - _context.next = 29; - return fs.readJson(path.join(cwd, "lerna.json")); + /** + * Text + */ - case 29: - lernaJson = _context.sent; + push({ type: 'text', value }); + } - if (lernaJson) { - tool = { - type: "lerna", - packageGlobs: lernaJson.packages || ["packages/*"] - }; - } + // Mark imbalanced braces and brackets as invalid + do { + block = stack.pop(); - _context.next = 37; - break; + if (block.type !== 'root') { + block.nodes.forEach(node => { + if (!node.nodes) { + if (node.type === 'open') node.isOpen = true; + if (node.type === 'close') node.isClose = true; + if (!node.nodes) node.type = 'text'; + node.invalid = true; + } + }); - case 33: - _context.prev = 33; - _context.t1 = _context["catch"](26); + // get the location of the block on parent.nodes (block's siblings) + const parent = stack[stack.length - 1]; + const index = parent.nodes.indexOf(block); + // replace the (invalid) block with it's nodes + parent.nodes.splice(index, 1, ...block.nodes); + } + } while (stack.length > 0); - if (!(_context.t1.code !== "ENOENT")) { - _context.next = 37; - break; - } + push({ type: 'eos' }); + return ast; +}; - throw _context.t1; +module.exports = parse; - case 37: - if (tool) { - _context.next = 42; - break; - } - root = { - dir: cwd, - packageJson: pkg - }; +/***/ }), - if (pkg.name) { - _context.next = 41; - break; - } +/***/ 40641: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - throw new PackageJsonMissingNameError(["package.json"]); +"use strict"; - case 41: - return _context.abrupt("return", { - tool: "root", - root: root, - packages: [root] - }); - case 42: - _context.next = 44; - return globby__default(tool.packageGlobs, { - cwd: cwd, - onlyDirectories: true, - expandDirectories: false, - ignore: ["**/node_modules"] - }); +const utils = __nccwpck_require__(60837); - case 44: - relativeDirectories = _context.sent; - directories = relativeDirectories.map(function (p) { - return path.resolve(cwd, p); - }); - pkgJsonsMissingNameField = []; - _context.next = 49; - return Promise.all(directories.sort().map(function (dir) { - return fs.readJson(path.join(dir, "package.json")).then(function (packageJson) { - if (!packageJson.name) { - pkgJsonsMissingNameField.push(path.relative(cwd, path.join(dir, "package.json"))); - } +module.exports = (ast, options = {}) => { + const stringify = (node, parent = {}) => { + const invalidBlock = options.escapeInvalid && utils.isInvalidBrace(parent); + const invalidNode = node.invalid === true && options.escapeInvalid === true; + let output = ''; - return { - packageJson: packageJson, - dir: dir - }; - })["catch"](function (err) { - if (err.code === "ENOENT") { - return null; - } + if (node.value) { + if ((invalidBlock || invalidNode) && utils.isOpenOrClose(node)) { + return '\\' + node.value; + } + return node.value; + } - throw err; - }); - })); + if (node.value) { + return node.value; + } - case 49: - _context.t2 = function (x) { - return x; - }; + if (node.nodes) { + for (const child of node.nodes) { + output += stringify(child); + } + } + return output; + }; - results = _context.sent.filter(_context.t2); + return stringify(ast); +}; - if (!(pkgJsonsMissingNameField.length !== 0)) { - _context.next = 54; - break; - } - pkgJsonsMissingNameField.sort(); - throw new PackageJsonMissingNameError(pkgJsonsMissingNameField); - case 54: - return _context.abrupt("return", { - tool: tool.type, - root: { - dir: cwd, - packageJson: pkg - }, - packages: results - }); +/***/ }), - case 55: - case "end": - return _context.stop(); - } - } - }, _callee, null, [[14, 21], [26, 33]]); - })); - return _getPackages.apply(this, arguments); -} +/***/ 60837: +/***/ ((__unused_webpack_module, exports) => { -function getPackagesSync(dir) { - var cwd = findRoot.findRootSync(dir); - var pkg = fs.readJsonSync(path.join(cwd, "package.json")); - var tool; +"use strict"; - if (pkg.workspaces) { - if (Array.isArray(pkg.workspaces)) { - tool = { - type: "yarn", - packageGlobs: pkg.workspaces - }; - } else if (pkg.workspaces.packages) { - tool = { - type: "yarn", - packageGlobs: pkg.workspaces.packages - }; - } - } else if (pkg.bolt && pkg.bolt.workspaces) { - tool = { - type: "bolt", - packageGlobs: pkg.bolt.workspaces - }; - } else { - try { - var manifest = readYamlFile.sync(path.join(cwd, "pnpm-workspace.yaml")); - if (manifest && manifest.packages) { - tool = { - type: "pnpm", - packageGlobs: manifest.packages - }; - } - } catch (err) { - if (err.code !== "ENOENT") { - throw err; - } - } +exports.isInteger = num => { + if (typeof num === 'number') { + return Number.isInteger(num); + } + if (typeof num === 'string' && num.trim() !== '') { + return Number.isInteger(Number(num)); + } + return false; +}; - if (!tool) { - try { - var lernaJson = fs.readJsonSync(path.join(cwd, "lerna.json")); +/** + * Find a node of the given type + */ - if (lernaJson) { - tool = { - type: "lerna", - packageGlobs: lernaJson.packages || ["packages/*"] - }; - } - } catch (err) { - if (err.code !== "ENOENT") { - throw err; - } - } - } - } +exports.find = (node, type) => node.nodes.find(node => node.type === type); - if (!tool) { - var root = { - dir: cwd, - packageJson: pkg - }; +/** + * Find a node of the given type + */ - if (!pkg.name) { - throw new PackageJsonMissingNameError(["package.json"]); - } +exports.exceedsLimit = (min, max, step = 1, limit) => { + if (limit === false) return false; + if (!exports.isInteger(min) || !exports.isInteger(max)) return false; + return ((Number(max) - Number(min)) / Number(step)) >= limit; +}; - return { - tool: "root", - root: root, - packages: [root] - }; - } +/** + * Escape the given node with '\\' before node.value + */ - var relativeDirectories = globby.sync(tool.packageGlobs, { - cwd: cwd, - onlyDirectories: true, - expandDirectories: false, - ignore: ["**/node_modules"] - }); - var directories = relativeDirectories.map(function (p) { - return path.resolve(cwd, p); - }); - var pkgJsonsMissingNameField = []; - var results = directories.sort().map(function (dir) { - try { - var packageJson = fs.readJsonSync(path.join(dir, "package.json")); - - if (!packageJson.name) { - pkgJsonsMissingNameField.push(path.relative(cwd, path.join(dir, "package.json"))); - } +exports.escapeNode = (block, n = 0, type) => { + const node = block.nodes[n]; + if (!node) return; - return { - packageJson: packageJson, - dir: dir - }; - } catch (err) { - if (err.code === "ENOENT") return null; - throw err; + if ((type && node.type === type) || node.type === 'open' || node.type === 'close') { + if (node.escaped !== true) { + node.value = '\\' + node.value; + node.escaped = true; } - }).filter(function (x) { - return x; - }); + } +}; - if (pkgJsonsMissingNameField.length !== 0) { - pkgJsonsMissingNameField.sort(); - throw new PackageJsonMissingNameError(pkgJsonsMissingNameField); +/** + * Returns true if the given brace node should be enclosed in literal braces + */ + +exports.encloseBrace = node => { + if (node.type !== 'brace') return false; + if ((node.commas >> 0 + node.ranges >> 0) === 0) { + node.invalid = true; + return true; } + return false; +}; - return { - tool: tool.type, - root: { - dir: cwd, - packageJson: pkg - }, - packages: results - }; -} +/** + * Returns true if a brace node is invalid. + */ -exports.PackageJsonMissingNameError = PackageJsonMissingNameError; -exports.getPackages = getPackages; -exports.getPackagesSync = getPackagesSync; +exports.isInvalidBrace = block => { + if (block.type !== 'brace') return false; + if (block.invalid === true || block.dollar) return true; + if ((block.commas >> 0 + block.ranges >> 0) === 0) { + block.invalid = true; + return true; + } + if (block.open !== true || block.close !== true) { + block.invalid = true; + return true; + } + return false; +}; +/** + * Returns true if a node is an open or close node + */ -/***/ }), +exports.isOpenOrClose = node => { + if (node.type === 'open' || node.type === 'close') { + return true; + } + return node.open === true || node.close === true; +}; -/***/ 94941: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/** + * Reduce an array of text nodes. + */ -"use strict"; +exports.reduce = nodes => nodes.reduce((acc, node) => { + if (node.type === 'text') acc.push(node.value); + if (node.type === 'range') node.type = 'text'; + return acc; +}, []); + +/** + * Flatten an array + */ +exports.flatten = (...args) => { + const result = []; -if (process.env.NODE_ENV === "production") { - module.exports = __nccwpck_require__(61042); -} else { - module.exports = __nccwpck_require__(16792); -} + const flat = arr => { + for (let i = 0; i < arr.length; i++) { + const ele = arr[i]; + + if (Array.isArray(ele)) { + flat(ele); + continue; + } + + if (ele !== undefined) { + result.push(ele); + } + } + return result; + }; + + flat(args); + return result; +}; /***/ }), -/***/ 61042: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ 24422: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -function _interopDefault(ex) { - return ex && "object" == typeof ex && "default" in ex ? ex.default : ex; -} +const cp = __nccwpck_require__(35317); +const parse = __nccwpck_require__(57641); +const enoent = __nccwpck_require__(43609); -Object.defineProperty(exports, "__esModule", ({ - value: !0 -})); +function spawn(command, args, options) { + // Parse the arguments + const parsed = parse(command, args, options); -var _regeneratorRuntime = _interopDefault(__nccwpck_require__(65907)), _asyncToGenerator = _interopDefault(__nccwpck_require__(67584)), _classCallCheck = _interopDefault(__nccwpck_require__(33446)), _possibleConstructorReturn = _interopDefault(__nccwpck_require__(83855)), _getPrototypeOf = _interopDefault(__nccwpck_require__(55989)), _inherits = _interopDefault(__nccwpck_require__(87406)), _wrapNativeSuper = _interopDefault(__nccwpck_require__(16318)), fs = _interopDefault(__nccwpck_require__(5810)), path = _interopDefault(__nccwpck_require__(16928)), globby = __nccwpck_require__(46127), globby__default = _interopDefault(globby), readYamlFile = __nccwpck_require__(64109), readYamlFile__default = _interopDefault(readYamlFile), findRoot = __nccwpck_require__(67805), PackageJsonMissingNameError = function(_Error) { - function PackageJsonMissingNameError(directories) { - var _this; - return _classCallCheck(this, PackageJsonMissingNameError), (_this = _possibleConstructorReturn(this, _getPrototypeOf(PackageJsonMissingNameError).call(this, 'The following package.jsons are missing the "name" field:\n'.concat(directories.join("\n"))))).directories = directories, - _this; - } - return _inherits(PackageJsonMissingNameError, _Error), PackageJsonMissingNameError; -}(_wrapNativeSuper(Error)); + // Spawn the child process + const spawned = cp.spawn(parsed.command, parsed.args, parsed.options); -function getPackages(_x) { - return _getPackages.apply(this, arguments); + // Hook into child process "exit" event to emit an error if the command + // does not exists, see: https://github.com/IndigoUnited/node-cross-spawn/issues/16 + enoent.hookChildProcess(spawned, parsed); + + return spawned; } -function _getPackages() { - return (_getPackages = _asyncToGenerator(_regeneratorRuntime.mark(function _callee(dir) { - var cwd, pkg, tool, manifest, lernaJson, root, relativeDirectories, directories, pkgJsonsMissingNameField, results; - return _regeneratorRuntime.wrap(function(_context) { - for (;;) switch (_context.prev = _context.next) { - case 0: - return _context.next = 2, findRoot.findRoot(dir); +function spawnSync(command, args, options) { + // Parse the arguments + const parsed = parse(command, args, options); - case 2: - return cwd = _context.sent, _context.next = 5, fs.readJson(path.join(cwd, "package.json")); + // Spawn the child process + const result = cp.spawnSync(parsed.command, parsed.args, parsed.options); - case 5: - if (!(pkg = _context.sent).workspaces) { - _context.next = 10; - break; - } - Array.isArray(pkg.workspaces) ? tool = { - type: "yarn", - packageGlobs: pkg.workspaces - } : pkg.workspaces.packages && (tool = { - type: "yarn", - packageGlobs: pkg.workspaces.packages - }), _context.next = 37; - break; + // Analyze if the command does not exist, see: https://github.com/IndigoUnited/node-cross-spawn/issues/16 + result.error = result.error || enoent.verifyENOENTSync(result.status, parsed); - case 10: - if (!pkg.bolt || !pkg.bolt.workspaces) { - _context.next = 14; - break; - } - tool = { - type: "bolt", - packageGlobs: pkg.bolt.workspaces - }, _context.next = 37; - break; + return result; +} - case 14: - return _context.prev = 14, _context.next = 17, readYamlFile__default(path.join(cwd, "pnpm-workspace.yaml")); +module.exports = spawn; +module.exports.spawn = spawn; +module.exports.sync = spawnSync; - case 17: - (manifest = _context.sent) && manifest.packages && (tool = { - type: "pnpm", - packageGlobs: manifest.packages - }), _context.next = 25; - break; +module.exports._parse = parse; +module.exports._enoent = enoent; - case 21: - if (_context.prev = 21, _context.t0 = _context.catch(14), "ENOENT" === _context.t0.code) { - _context.next = 25; - break; - } - throw _context.t0; - case 25: - if (tool) { - _context.next = 37; - break; - } - return _context.prev = 26, _context.next = 29, fs.readJson(path.join(cwd, "lerna.json")); +/***/ }), - case 29: - (lernaJson = _context.sent) && (tool = { - type: "lerna", - packageGlobs: lernaJson.packages || [ "packages/*" ] - }), _context.next = 37; - break; +/***/ 43609: +/***/ ((module) => { - case 33: - if (_context.prev = 33, _context.t1 = _context.catch(26), "ENOENT" === _context.t1.code) { - _context.next = 37; - break; - } - throw _context.t1; +"use strict"; - case 37: - if (tool) { - _context.next = 42; - break; - } - if (root = { - dir: cwd, - packageJson: pkg - }, pkg.name) { - _context.next = 41; - break; - } - throw new PackageJsonMissingNameError([ "package.json" ]); - case 41: - return _context.abrupt("return", { - tool: "root", - root: root, - packages: [ root ] - }); +const isWin = process.platform === 'win32'; - case 42: - return _context.next = 44, globby__default(tool.packageGlobs, { - cwd: cwd, - onlyDirectories: !0, - expandDirectories: !1, - ignore: [ "**/node_modules" ] - }); +function notFoundError(original, syscall) { + return Object.assign(new Error(`${syscall} ${original.command} ENOENT`), { + code: 'ENOENT', + errno: 'ENOENT', + syscall: `${syscall} ${original.command}`, + path: original.command, + spawnargs: original.args, + }); +} - case 44: - return relativeDirectories = _context.sent, directories = relativeDirectories.map(function(p) { - return path.resolve(cwd, p); - }), pkgJsonsMissingNameField = [], _context.next = 49, Promise.all(directories.sort().map(function(dir) { - return fs.readJson(path.join(dir, "package.json")).then(function(packageJson) { - return packageJson.name || pkgJsonsMissingNameField.push(path.relative(cwd, path.join(dir, "package.json"))), - { - packageJson: packageJson, - dir: dir - }; - }).catch(function(err) { - if ("ENOENT" === err.code) return null; - throw err; - }); - })); +function hookChildProcess(cp, parsed) { + if (!isWin) { + return; + } - case 49: - if (_context.t2 = function(x) { - return x; - }, results = _context.sent.filter(_context.t2), 0 === pkgJsonsMissingNameField.length) { - _context.next = 54; - break; - } - throw pkgJsonsMissingNameField.sort(), new PackageJsonMissingNameError(pkgJsonsMissingNameField); + const originalEmit = cp.emit; - case 54: - return _context.abrupt("return", { - tool: tool.type, - root: { - dir: cwd, - packageJson: pkg - }, - packages: results - }); + cp.emit = function (name, arg1) { + // If emitting "exit" event and exit code is 1, we need to check if + // the command exists and emit an "error" instead + // See https://github.com/IndigoUnited/node-cross-spawn/issues/16 + if (name === 'exit') { + const err = verifyENOENT(arg1, parsed); - case 55: - case "end": - return _context.stop(); - } - }, _callee, null, [ [ 14, 21 ], [ 26, 33 ] ]); - }))).apply(this, arguments); + if (err) { + return originalEmit.call(cp, 'error', err); + } + } + + return originalEmit.apply(cp, arguments); // eslint-disable-line prefer-rest-params + }; } -function getPackagesSync(dir) { - var tool, cwd = findRoot.findRootSync(dir), pkg = fs.readJsonSync(path.join(cwd, "package.json")); - if (pkg.workspaces) Array.isArray(pkg.workspaces) ? tool = { - type: "yarn", - packageGlobs: pkg.workspaces - } : pkg.workspaces.packages && (tool = { - type: "yarn", - packageGlobs: pkg.workspaces.packages - }); else if (pkg.bolt && pkg.bolt.workspaces) tool = { - type: "bolt", - packageGlobs: pkg.bolt.workspaces - }; else { - try { - var manifest = readYamlFile.sync(path.join(cwd, "pnpm-workspace.yaml")); - manifest && manifest.packages && (tool = { - type: "pnpm", - packageGlobs: manifest.packages - }); - } catch (err) { - if ("ENOENT" !== err.code) throw err; - } - if (!tool) try { - var lernaJson = fs.readJsonSync(path.join(cwd, "lerna.json")); - lernaJson && (tool = { - type: "lerna", - packageGlobs: lernaJson.packages || [ "packages/*" ] - }); - } catch (err) { - if ("ENOENT" !== err.code) throw err; +function verifyENOENT(status, parsed) { + if (isWin && status === 1 && !parsed.file) { + return notFoundError(parsed.original, 'spawn'); } - } - if (!tool) { - var root = { - dir: cwd, - packageJson: pkg - }; - if (!pkg.name) throw new PackageJsonMissingNameError([ "package.json" ]); - return { - tool: "root", - root: root, - packages: [ root ] - }; - } - var directories = globby.sync(tool.packageGlobs, { - cwd: cwd, - onlyDirectories: !0, - expandDirectories: !1, - ignore: [ "**/node_modules" ] - }).map(function(p) { - return path.resolve(cwd, p); - }), pkgJsonsMissingNameField = [], results = directories.sort().map(function(dir) { - try { - var packageJson = fs.readJsonSync(path.join(dir, "package.json")); - return packageJson.name || pkgJsonsMissingNameField.push(path.relative(cwd, path.join(dir, "package.json"))), - { - packageJson: packageJson, - dir: dir - }; - } catch (err) { - if ("ENOENT" === err.code) return null; - throw err; + + return null; +} + +function verifyENOENTSync(status, parsed) { + if (isWin && status === 1 && !parsed.file) { + return notFoundError(parsed.original, 'spawnSync'); } - }).filter(function(x) { - return x; - }); - if (0 !== pkgJsonsMissingNameField.length) throw pkgJsonsMissingNameField.sort(), - new PackageJsonMissingNameError(pkgJsonsMissingNameField); - return { - tool: tool.type, - root: { - dir: cwd, - packageJson: pkg - }, - packages: results - }; + + return null; } -exports.PackageJsonMissingNameError = PackageJsonMissingNameError, exports.getPackages = getPackages, -exports.getPackagesSync = getPackagesSync; +module.exports = { + hookChildProcess, + verifyENOENT, + verifyENOENTSync, + notFoundError, +}; /***/ }), -/***/ 94145: +/***/ 57641: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -const fs = __nccwpck_require__(61404) -const path = __nccwpck_require__(16928) -const mkdirpSync = (__nccwpck_require__(77999).mkdirsSync) -const utimesSync = (__nccwpck_require__(12804).utimesMillisSync) -const stat = __nccwpck_require__(91349) +const path = __nccwpck_require__(16928); +const resolveCommand = __nccwpck_require__(71998); +const escape = __nccwpck_require__(30528); +const readShebang = __nccwpck_require__(38115); -function copySync (src, dest, opts) { - if (typeof opts === 'function') { - opts = { filter: opts } - } +const isWin = process.platform === 'win32'; +const isExecutableRegExp = /\.(?:com|exe)$/i; +const isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i; - opts = opts || {} - opts.clobber = 'clobber' in opts ? !!opts.clobber : true // default to true for now - opts.overwrite = 'overwrite' in opts ? !!opts.overwrite : opts.clobber // overwrite falls back to clobber +function detectShebang(parsed) { + parsed.file = resolveCommand(parsed); - // Warn about using preserveTimestamps on 32-bit node - if (opts.preserveTimestamps && process.arch === 'ia32') { - console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n - see https://github.com/jprichardson/node-fs-extra/issues/269`) - } + const shebang = parsed.file && readShebang(parsed.file); - const { srcStat, destStat } = stat.checkPathsSync(src, dest, 'copy') - stat.checkParentPathsSync(src, srcStat, dest, 'copy') - return handleFilterAndCopy(destStat, src, dest, opts) -} + if (shebang) { + parsed.args.unshift(parsed.file); + parsed.command = shebang; -function handleFilterAndCopy (destStat, src, dest, opts) { - if (opts.filter && !opts.filter(src, dest)) return - const destParent = path.dirname(dest) - if (!fs.existsSync(destParent)) mkdirpSync(destParent) - return startCopy(destStat, src, dest, opts) -} + return resolveCommand(parsed); + } -function startCopy (destStat, src, dest, opts) { - if (opts.filter && !opts.filter(src, dest)) return - return getStats(destStat, src, dest, opts) + return parsed.file; } -function getStats (destStat, src, dest, opts) { - const statSync = opts.dereference ? fs.statSync : fs.lstatSync - const srcStat = statSync(src) +function parseNonShell(parsed) { + if (!isWin) { + return parsed; + } - if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts) - else if (srcStat.isFile() || - srcStat.isCharacterDevice() || - srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts) - else if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts) -} + // Detect & add support for shebangs + const commandFile = detectShebang(parsed); -function onFile (srcStat, destStat, src, dest, opts) { - if (!destStat) return copyFile(srcStat, src, dest, opts) - return mayCopyFile(srcStat, src, dest, opts) -} + // We don't need a shell if the command filename is an executable + const needsShell = !isExecutableRegExp.test(commandFile); -function mayCopyFile (srcStat, src, dest, opts) { - if (opts.overwrite) { - fs.unlinkSync(dest) - return copyFile(srcStat, src, dest, opts) - } else if (opts.errorOnExist) { - throw new Error(`'${dest}' already exists`) - } -} + // If a shell is required, use cmd.exe and take care of escaping everything correctly + // Note that `forceShell` is an hidden option used only in tests + if (parsed.options.forceShell || needsShell) { + // Need to double escape meta chars if the command is a cmd-shim located in `node_modules/.bin/` + // The cmd-shim simply calls execute the package bin file with NodeJS, proxying any argument + // Because the escape of metachars with ^ gets interpreted when the cmd.exe is first called, + // we need to double escape them + const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile); -function copyFile (srcStat, src, dest, opts) { - if (typeof fs.copyFileSync === 'function') { - fs.copyFileSync(src, dest) - fs.chmodSync(dest, srcStat.mode) - if (opts.preserveTimestamps) { - return utimesSync(dest, srcStat.atime, srcStat.mtime) + // Normalize posix paths into OS compatible paths (e.g.: foo/bar -> foo\bar) + // This is necessary otherwise it will always fail with ENOENT in those cases + parsed.command = path.normalize(parsed.command); + + // Escape command & arguments + parsed.command = escape.command(parsed.command); + parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars)); + + const shellCommand = [parsed.command].concat(parsed.args).join(' '); + + parsed.args = ['/d', '/s', '/c', `"${shellCommand}"`]; + parsed.command = process.env.comspec || 'cmd.exe'; + parsed.options.windowsVerbatimArguments = true; // Tell node's spawn that the arguments are already escaped } - return - } - return copyFileFallback(srcStat, src, dest, opts) -} -function copyFileFallback (srcStat, src, dest, opts) { - const BUF_LENGTH = 64 * 1024 - const _buff = __nccwpck_require__(44973)(BUF_LENGTH) + return parsed; +} - const fdr = fs.openSync(src, 'r') - const fdw = fs.openSync(dest, 'w', srcStat.mode) - let pos = 0 +function parse(command, args, options) { + // Normalize arguments, similar to nodejs + if (args && !Array.isArray(args)) { + options = args; + args = null; + } - while (pos < srcStat.size) { - const bytesRead = fs.readSync(fdr, _buff, 0, BUF_LENGTH, pos) - fs.writeSync(fdw, _buff, 0, bytesRead) - pos += bytesRead - } + args = args ? args.slice(0) : []; // Clone array to avoid changing the original + options = Object.assign({}, options); // Clone object to avoid changing the original - if (opts.preserveTimestamps) fs.futimesSync(fdw, srcStat.atime, srcStat.mtime) + // Build our parsed object + const parsed = { + command, + args, + options, + file: undefined, + original: { + command, + args, + }, + }; - fs.closeSync(fdr) - fs.closeSync(fdw) + // Delegate further parsing to shell or non-shell + return options.shell ? parsed : parseNonShell(parsed); } -function onDir (srcStat, destStat, src, dest, opts) { - if (!destStat) return mkDirAndCopy(srcStat, src, dest, opts) - if (destStat && !destStat.isDirectory()) { - throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`) - } - return copyDir(src, dest, opts) -} +module.exports = parse; -function mkDirAndCopy (srcStat, src, dest, opts) { - fs.mkdirSync(dest) - copyDir(src, dest, opts) - return fs.chmodSync(dest, srcStat.mode) -} -function copyDir (src, dest, opts) { - fs.readdirSync(src).forEach(item => copyDirItem(item, src, dest, opts)) -} +/***/ }), -function copyDirItem (item, src, dest, opts) { - const srcItem = path.join(src, item) - const destItem = path.join(dest, item) - const { destStat } = stat.checkPathsSync(srcItem, destItem, 'copy') - return startCopy(destStat, srcItem, destItem, opts) -} +/***/ 30528: +/***/ ((module) => { -function onLink (destStat, src, dest, opts) { - let resolvedSrc = fs.readlinkSync(src) - if (opts.dereference) { - resolvedSrc = path.resolve(process.cwd(), resolvedSrc) - } +"use strict"; - if (!destStat) { - return fs.symlinkSync(resolvedSrc, dest) - } else { - let resolvedDest - try { - resolvedDest = fs.readlinkSync(dest) - } catch (err) { - // dest exists and is a regular file or directory, - // Windows may throw UNKNOWN error. If dest already exists, - // fs throws error anyway, so no need to guard against it here. - if (err.code === 'EINVAL' || err.code === 'UNKNOWN') return fs.symlinkSync(resolvedSrc, dest) - throw err - } - 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}'.`) - } - // prevent copy if src is a subdir of dest since unlinking - // dest in this case would result in removing src contents - // and therefore a broken symlink would be created. - if (fs.statSync(dest).isDirectory() && stat.isSrcSubdir(resolvedDest, resolvedSrc)) { - throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`) - } - return copyLink(resolvedSrc, dest) - } -} +// See http://www.robvanderwoude.com/escapechars.php +const metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g; -function copyLink (resolvedSrc, dest) { - fs.unlinkSync(dest) - return fs.symlinkSync(resolvedSrc, dest) +function escapeCommand(arg) { + // Escape meta chars + arg = arg.replace(metaCharsRegExp, '^$1'); + + return arg; } -module.exports = copySync +function escapeArgument(arg, doubleEscapeMetaChars) { + // Convert to string + arg = `${arg}`; + // Algorithm below is based on https://qntm.org/cmd + // It's slightly altered to disable JS backtracking to avoid hanging on specially crafted input + // Please see https://github.com/moxystudio/node-cross-spawn/pull/160 for more information -/***/ }), + // Sequence of backslashes followed by a double quote: + // double up all the backslashes and escape the double quote + arg = arg.replace(/(?=(\\+?)?)\1"/g, '$1$1\\"'); -/***/ 36278: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + // Sequence of backslashes followed by the end of the string + // (which will become a double quote later): + // double up all the backslashes + arg = arg.replace(/(?=(\\+?)?)\1$/, '$1$1'); -"use strict"; + // All other backslashes occur literally + // Quote the whole thing: + arg = `"${arg}"`; -module.exports = { - copySync: __nccwpck_require__(94145) + // Escape meta chars + arg = arg.replace(metaCharsRegExp, '^$1'); + + // Double escape meta chars if necessary + if (doubleEscapeMetaChars) { + arg = arg.replace(metaCharsRegExp, '^$1'); + } + + return arg; } +module.exports.command = escapeCommand; +module.exports.argument = escapeArgument; + /***/ }), -/***/ 65737: +/***/ 38115: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -const fs = __nccwpck_require__(61404) -const path = __nccwpck_require__(16928) -const mkdirp = (__nccwpck_require__(77999).mkdirs) -const pathExists = (__nccwpck_require__(53647).pathExists) -const utimes = (__nccwpck_require__(12804).utimesMillis) -const stat = __nccwpck_require__(91349) - -function copy (src, dest, opts, cb) { - if (typeof opts === 'function' && !cb) { - cb = opts - opts = {} - } else if (typeof opts === 'function') { - opts = { filter: opts } - } +const fs = __nccwpck_require__(79896); +const shebangCommand = __nccwpck_require__(72668); - cb = cb || function () {} - opts = opts || {} +function readShebang(command) { + // Read the first 150 bytes from the file + const size = 150; + const buffer = Buffer.alloc(size); - opts.clobber = 'clobber' in opts ? !!opts.clobber : true // default to true for now - opts.overwrite = 'overwrite' in opts ? !!opts.overwrite : opts.clobber // overwrite falls back to clobber + let fd; - // Warn about using preserveTimestamps on 32-bit node - if (opts.preserveTimestamps && process.arch === 'ia32') { - console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n - see https://github.com/jprichardson/node-fs-extra/issues/269`) - } + try { + fd = fs.openSync(command, 'r'); + fs.readSync(fd, buffer, 0, size, 0); + fs.closeSync(fd); + } catch (e) { /* Empty */ } - stat.checkPaths(src, dest, 'copy', (err, stats) => { - if (err) return cb(err) - const { srcStat, destStat } = stats - stat.checkParentPaths(src, srcStat, dest, 'copy', err => { - if (err) return cb(err) - if (opts.filter) return handleFilter(checkParentDir, destStat, src, dest, opts, cb) - return checkParentDir(destStat, src, dest, opts, cb) - }) - }) + // Attempt to extract shebang (null is returned if not a shebang) + return shebangCommand(buffer.toString()); } -function checkParentDir (destStat, src, dest, opts, cb) { - const destParent = path.dirname(dest) - pathExists(destParent, (err, dirExists) => { - if (err) return cb(err) - if (dirExists) return startCopy(destStat, src, dest, opts, cb) - mkdirp(destParent, err => { - if (err) return cb(err) - return startCopy(destStat, src, dest, opts, cb) - }) - }) -} +module.exports = readShebang; -function handleFilter (onInclude, destStat, src, dest, opts, cb) { - Promise.resolve(opts.filter(src, dest)).then(include => { - if (include) return onInclude(destStat, src, dest, opts, cb) - return cb() - }, error => cb(error)) -} -function startCopy (destStat, src, dest, opts, cb) { - if (opts.filter) return handleFilter(getStats, destStat, src, dest, opts, cb) - return getStats(destStat, src, dest, opts, cb) -} +/***/ }), -function getStats (destStat, src, dest, opts, cb) { - const stat = opts.dereference ? fs.stat : fs.lstat - stat(src, (err, srcStat) => { - if (err) return cb(err) +/***/ 71998: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - 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) - }) -} +"use strict"; -function onFile (srcStat, destStat, src, dest, opts, cb) { - if (!destStat) return copyFile(srcStat, src, dest, opts, cb) - return mayCopyFile(srcStat, src, dest, opts, cb) -} -function mayCopyFile (srcStat, src, dest, opts, cb) { - if (opts.overwrite) { - fs.unlink(dest, err => { - if (err) return cb(err) - return copyFile(srcStat, src, dest, opts, cb) - }) - } else if (opts.errorOnExist) { - return cb(new Error(`'${dest}' already exists`)) - } else return cb() -} - -function copyFile (srcStat, src, dest, opts, cb) { - if (typeof fs.copyFile === 'function') { - return fs.copyFile(src, dest, err => { - if (err) return cb(err) - return setDestModeAndTimestamps(srcStat, dest, opts, cb) - }) - } - return copyFileFallback(srcStat, src, dest, opts, cb) -} +const path = __nccwpck_require__(16928); +const which = __nccwpck_require__(13340); +const getPathKey = __nccwpck_require__(50661); -function copyFileFallback (srcStat, src, dest, opts, cb) { - const rs = fs.createReadStream(src) - rs.on('error', err => cb(err)).once('open', () => { - const ws = fs.createWriteStream(dest, { mode: srcStat.mode }) - ws.on('error', err => cb(err)) - .on('open', () => rs.pipe(ws)) - .once('close', () => setDestModeAndTimestamps(srcStat, dest, opts, cb)) - }) -} +function resolveCommandAttempt(parsed, withoutPathExt) { + const env = parsed.options.env || process.env; + const cwd = process.cwd(); + const hasCustomCwd = parsed.options.cwd != null; + // Worker threads do not have process.chdir() + const shouldSwitchCwd = hasCustomCwd && process.chdir !== undefined && !process.chdir.disabled; -function setDestModeAndTimestamps (srcStat, dest, opts, cb) { - fs.chmod(dest, srcStat.mode, err => { - if (err) return cb(err) - if (opts.preserveTimestamps) { - return utimes(dest, srcStat.atime, srcStat.mtime, cb) + // If a custom `cwd` was specified, we need to change the process cwd + // because `which` will do stat calls but does not support a custom cwd + if (shouldSwitchCwd) { + try { + process.chdir(parsed.options.cwd); + } catch (err) { + /* Empty */ + } } - return cb() - }) -} - -function onDir (srcStat, destStat, src, dest, opts, cb) { - if (!destStat) return mkDirAndCopy(srcStat, src, dest, opts, cb) - if (destStat && !destStat.isDirectory()) { - return cb(new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`)) - } - return copyDir(src, dest, opts, cb) -} - -function mkDirAndCopy (srcStat, src, dest, opts, cb) { - fs.mkdir(dest, err => { - if (err) return cb(err) - copyDir(src, dest, opts, err => { - if (err) return cb(err) - return fs.chmod(dest, srcStat.mode, 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) - stat.checkPaths(srcItem, destItem, 'copy', (err, stats) => { - if (err) return cb(err) - const { destStat } = stats - startCopy(destStat, srcItem, destItem, opts, err => { - if (err) return cb(err) - return copyDirItems(items, src, dest, opts, cb) - }) - }) -} -function onLink (destStat, src, dest, opts, cb) { - fs.readlink(src, (err, resolvedSrc) => { - if (err) return cb(err) - if (opts.dereference) { - resolvedSrc = path.resolve(process.cwd(), resolvedSrc) - } + let resolved; - if (!destStat) { - return fs.symlink(resolvedSrc, dest, cb) - } else { - fs.readlink(dest, (err, resolvedDest) => { - if (err) { - // dest exists and is a regular file or directory, - // Windows may throw UNKNOWN error. If dest already exists, - // fs throws error anyway, so no need to guard against it here. - if (err.code === 'EINVAL' || err.code === 'UNKNOWN') return fs.symlink(resolvedSrc, dest, cb) - return cb(err) - } - 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}'.`)) + try { + resolved = which.sync(parsed.command, { + path: env[getPathKey({ env })], + pathExt: withoutPathExt ? path.delimiter : undefined, + }); + } catch (e) { + /* Empty */ + } finally { + if (shouldSwitchCwd) { + process.chdir(cwd); } + } - // do not copy if src is a subdir of dest since unlinking - // dest in this case would result in removing src contents - // and therefore a broken symlink would be created. - if (destStat.isDirectory() && stat.isSrcSubdir(resolvedDest, resolvedSrc)) { - return cb(new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`)) - } - return copyLink(resolvedSrc, dest, cb) - }) + // If we successfully resolved, ensure that an absolute path is returned + // Note that when a custom `cwd` was used, we need to resolve to an absolute path based on it + if (resolved) { + resolved = path.resolve(hasCustomCwd ? parsed.options.cwd : '', resolved); } - }) + + return resolved; } -function copyLink (resolvedSrc, dest, cb) { - fs.unlink(dest, err => { - if (err) return cb(err) - return fs.symlink(resolvedSrc, dest, cb) - }) +function resolveCommand(parsed) { + return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true); } -module.exports = copy +module.exports = resolveCommand; /***/ }), -/***/ 32558: +/***/ 70804: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; +const path = __nccwpck_require__(16928); +const pathType = __nccwpck_require__(34754); -const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) -module.exports = { - copy: u(__nccwpck_require__(65737)) -} +const getExtensions = extensions => extensions.length > 1 ? `{${extensions.join(',')}}` : extensions[0]; +const getPath = (filepath, cwd) => { + const pth = filepath[0] === '!' ? filepath.slice(1) : filepath; + return path.isAbsolute(pth) ? pth : path.join(cwd, pth); +}; -/***/ }), +const addExtensions = (file, extensions) => { + if (path.extname(file)) { + return `**/${file}`; + } -/***/ 77032: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + return `**/${file}.${getExtensions(extensions)}`; +}; -"use strict"; +const getGlob = (directory, options) => { + if (options.files && !Array.isArray(options.files)) { + throw new TypeError(`Expected \`files\` to be of type \`Array\` but received type \`${typeof options.files}\``); + } + if (options.extensions && !Array.isArray(options.extensions)) { + throw new TypeError(`Expected \`extensions\` to be of type \`Array\` but received type \`${typeof options.extensions}\``); + } -const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) -const fs = __nccwpck_require__(61404) -const path = __nccwpck_require__(16928) -const mkdir = __nccwpck_require__(77999) -const remove = __nccwpck_require__(84507) + if (options.files && options.extensions) { + return options.files.map(x => path.posix.join(directory, addExtensions(x, options.extensions))); + } -const emptyDir = u(function emptyDir (dir, callback) { - callback = callback || function () {} - fs.readdir(dir, (err, items) => { - if (err) return mkdir.mkdirs(dir, callback) + if (options.files) { + return options.files.map(x => path.posix.join(directory, `**/${x}`)); + } - items = items.map(item => path.join(dir, item)) + if (options.extensions) { + return [path.posix.join(directory, `**/*.${getExtensions(options.extensions)}`)]; + } - deleteItem() + return [path.posix.join(directory, '**')]; +}; - function deleteItem () { - const item = items.pop() - if (!item) return callback() - remove.remove(item, err => { - if (err) return callback(err) - deleteItem() - }) - } - }) -}) +module.exports = async (input, options) => { + options = { + cwd: process.cwd(), + ...options + }; -function emptyDirSync (dir) { - let items - try { - items = fs.readdirSync(dir) - } catch (err) { - return mkdir.mkdirsSync(dir) - } + if (typeof options.cwd !== 'string') { + throw new TypeError(`Expected \`cwd\` to be of type \`string\` but received type \`${typeof options.cwd}\``); + } - items.forEach(item => { - item = path.join(dir, item) - remove.removeSync(item) - }) -} + const globs = await Promise.all([].concat(input).map(async x => { + const isDirectory = await pathType.isDirectory(getPath(x, options.cwd)); + return isDirectory ? getGlob(x, options) : x; + })); -module.exports = { - emptyDirSync, - emptydirSync: emptyDirSync, - emptyDir, - emptydir: emptyDir -} + return [].concat.apply([], globs); // eslint-disable-line prefer-spread +}; +module.exports.sync = (input, options) => { + options = { + cwd: process.cwd(), + ...options + }; -/***/ }), + if (typeof options.cwd !== 'string') { + throw new TypeError(`Expected \`cwd\` to be of type \`string\` but received type \`${typeof options.cwd}\``); + } -/***/ 17731: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + const globs = [].concat(input).map(x => pathType.isDirectorySync(getPath(x, options.cwd)) ? getGlob(x, options) : x); -"use strict"; + return [].concat.apply([], globs); // eslint-disable-line prefer-spread +}; -const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) -const path = __nccwpck_require__(16928) -const fs = __nccwpck_require__(61404) -const mkdir = __nccwpck_require__(77999) -const pathExists = (__nccwpck_require__(53647).pathExists) +/***/ }), -function createFile (file, callback) { - function makeFile () { - fs.writeFile(file, '', err => { - if (err) return callback(err) - callback() - }) - } +/***/ 66096: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - fs.stat(file, (err, stats) => { // eslint-disable-line handle-callback-err - if (!err && stats.isFile()) return callback() - const dir = path.dirname(file) - pathExists(dir, (err, dirExists) => { - if (err) return callback(err) - if (dirExists) return makeFile() - mkdir.mkdirs(dir, err => { - if (err) return callback(err) - makeFile() - }) - }) - }) -} +"use strict"; -function createFileSync (file) { - let stats - try { - stats = fs.statSync(file) - } catch (e) {} - if (stats && stats.isFile()) return +const path = __nccwpck_require__(16928); +const childProcess = __nccwpck_require__(35317); +const crossSpawn = __nccwpck_require__(24422); +const stripFinalNewline = __nccwpck_require__(68282); +const npmRunPath = __nccwpck_require__(87079); +const onetime = __nccwpck_require__(82405); +const makeError = __nccwpck_require__(46406); +const normalizeStdio = __nccwpck_require__(58729); +const {spawnedKill, spawnedCancel, setupTimeout, validateTimeout, setExitHandler} = __nccwpck_require__(98638); +const {handleInput, getSpawnedResult, makeAllStream, validateInputSync} = __nccwpck_require__(41762); +const {mergePromise, getSpawnedPromise} = __nccwpck_require__(98529); +const {joinCommand, parseCommand, getEscapedCommand} = __nccwpck_require__(32849); - const dir = path.dirname(file) - if (!fs.existsSync(dir)) { - mkdir.mkdirsSync(dir) - } +const DEFAULT_MAX_BUFFER = 1000 * 1000 * 100; - fs.writeFileSync(file, '') -} +const getEnv = ({env: envOption, extendEnv, preferLocal, localDir, execPath}) => { + const env = extendEnv ? {...process.env, ...envOption} : envOption; -module.exports = { - createFile: u(createFile), - createFileSync -} + if (preferLocal) { + return npmRunPath.env({env, cwd: localDir, execPath}); + } + return env; +}; -/***/ }), +const handleArguments = (file, args, options = {}) => { + const parsed = crossSpawn._parse(file, args, options); + file = parsed.command; + args = parsed.args; + options = parsed.options; -/***/ 25985: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + options = { + maxBuffer: DEFAULT_MAX_BUFFER, + buffer: true, + stripFinalNewline: true, + extendEnv: true, + preferLocal: false, + localDir: options.cwd || process.cwd(), + execPath: process.execPath, + encoding: 'utf8', + reject: true, + cleanup: true, + all: false, + windowsHide: true, + ...options + }; -"use strict"; + options.env = getEnv(options); + options.stdio = normalizeStdio(options); -const file = __nccwpck_require__(17731) -const link = __nccwpck_require__(8381) -const symlink = __nccwpck_require__(12062) + if (process.platform === 'win32' && path.basename(file, '.exe') === 'cmd') { + // #116 + args.unshift('/q'); + } -module.exports = { - // file - createFile: file.createFile, - createFileSync: file.createFileSync, - ensureFile: file.createFile, - ensureFileSync: file.createFileSync, - // link - createLink: link.createLink, - createLinkSync: link.createLinkSync, - ensureLink: link.createLink, - ensureLinkSync: link.createLinkSync, - // symlink - createSymlink: symlink.createSymlink, - createSymlinkSync: symlink.createSymlinkSync, - ensureSymlink: symlink.createSymlink, - ensureSymlinkSync: symlink.createSymlinkSync -} + return {file, args, options, parsed}; +}; +const handleOutput = (options, value, error) => { + if (typeof value !== 'string' && !Buffer.isBuffer(value)) { + // When `execa.sync()` errors, we normalize it to '' to mimic `execa()` + return error === undefined ? undefined : ''; + } -/***/ }), + if (options.stripFinalNewline) { + return stripFinalNewline(value); + } -/***/ 8381: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + return value; +}; -"use strict"; +const execa = (file, args, options) => { + const parsed = handleArguments(file, args, options); + const command = joinCommand(file, args); + const escapedCommand = getEscapedCommand(file, args); + validateTimeout(parsed.options); -const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) -const path = __nccwpck_require__(16928) -const fs = __nccwpck_require__(61404) -const mkdir = __nccwpck_require__(77999) -const pathExists = (__nccwpck_require__(53647).pathExists) + let spawned; + try { + spawned = childProcess.spawn(parsed.file, parsed.args, parsed.options); + } catch (error) { + // Ensure the returned error is always both a promise and a child process + const dummySpawned = new childProcess.ChildProcess(); + const errorPromise = Promise.reject(makeError({ + error, + stdout: '', + stderr: '', + all: '', + command, + escapedCommand, + parsed, + timedOut: false, + isCanceled: false, + killed: false + })); + return mergePromise(dummySpawned, errorPromise); + } -function createLink (srcpath, dstpath, callback) { - function makeLink (srcpath, dstpath) { - fs.link(srcpath, dstpath, err => { - if (err) return callback(err) - callback(null) - }) - } + const spawnedPromise = getSpawnedPromise(spawned); + const timedPromise = setupTimeout(spawned, parsed.options, spawnedPromise); + const processDone = setExitHandler(spawned, parsed.options, timedPromise); - pathExists(dstpath, (err, destinationExists) => { - if (err) return callback(err) - if (destinationExists) return callback(null) - fs.lstat(srcpath, (err) => { - if (err) { - err.message = err.message.replace('lstat', 'ensureLink') - return callback(err) - } + const context = {isCanceled: false}; - const dir = path.dirname(dstpath) - pathExists(dir, (err, dirExists) => { - if (err) return callback(err) - if (dirExists) return makeLink(srcpath, dstpath) - mkdir.mkdirs(dir, err => { - if (err) return callback(err) - makeLink(srcpath, dstpath) - }) - }) - }) - }) -} + spawned.kill = spawnedKill.bind(null, spawned.kill.bind(spawned)); + spawned.cancel = spawnedCancel.bind(null, spawned, context); -function createLinkSync (srcpath, dstpath) { - const destinationExists = fs.existsSync(dstpath) - if (destinationExists) return undefined + const handlePromise = async () => { + const [{error, exitCode, signal, timedOut}, stdoutResult, stderrResult, allResult] = await getSpawnedResult(spawned, parsed.options, processDone); + const stdout = handleOutput(parsed.options, stdoutResult); + const stderr = handleOutput(parsed.options, stderrResult); + const all = handleOutput(parsed.options, allResult); - try { - fs.lstatSync(srcpath) - } catch (err) { - err.message = err.message.replace('lstat', 'ensureLink') - throw err - } + if (error || exitCode !== 0 || signal !== null) { + const returnedError = makeError({ + error, + exitCode, + signal, + stdout, + stderr, + all, + command, + escapedCommand, + parsed, + timedOut, + isCanceled: context.isCanceled, + killed: spawned.killed + }); - const dir = path.dirname(dstpath) - const dirExists = fs.existsSync(dir) - if (dirExists) return fs.linkSync(srcpath, dstpath) - mkdir.mkdirsSync(dir) + if (!parsed.options.reject) { + return returnedError; + } - return fs.linkSync(srcpath, dstpath) -} + throw returnedError; + } -module.exports = { - createLink: u(createLink), - createLinkSync -} + return { + command, + escapedCommand, + exitCode: 0, + stdout, + stderr, + all, + failed: false, + timedOut: false, + isCanceled: false, + killed: false + }; + }; + const handlePromiseOnce = onetime(handlePromise); -/***/ }), + handleInput(spawned, parsed.options.input); -/***/ 37363: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - -"use strict"; + spawned.all = makeAllStream(spawned, parsed.options); + return mergePromise(spawned, handlePromiseOnce); +}; -const path = __nccwpck_require__(16928) -const fs = __nccwpck_require__(61404) -const pathExists = (__nccwpck_require__(53647).pathExists) +module.exports = execa; -/** - * Function that returns two types of paths, one relative to symlink, and one - * relative to the current working directory. Checks if path is absolute or - * relative. If the path is relative, this function checks if the path is - * relative to symlink or relative to current working directory. This is an - * initiative to find a smarter `srcpath` to supply when building symlinks. - * This allows you to determine which path to use out of one of three possible - * types of source paths. The first is an absolute path. This is detected by - * `path.isAbsolute()`. When an absolute path is provided, it is checked to - * see if it exists. If it does it's used, if not an error is returned - * (callback)/ thrown (sync). The other two options for `srcpath` are a - * relative url. By default Node's `fs.symlink` works by creating a symlink - * using `dstpath` and expects the `srcpath` to be relative to the newly - * created symlink. If you provide a `srcpath` that does not exist on the file - * system it results in a broken symlink. To minimize this, the function - * checks to see if the 'relative to symlink' source file exists, and if it - * does it will use it. If it does not, it checks if there's a file that - * exists that is relative to the current working directory, if does its used. - * This preserves the expectations of the original fs.symlink spec and adds - * the ability to pass in `relative to current working direcotry` paths. - */ +module.exports.sync = (file, args, options) => { + const parsed = handleArguments(file, args, options); + const command = joinCommand(file, args); + const escapedCommand = getEscapedCommand(file, args); -function symlinkPaths (srcpath, dstpath, callback) { - if (path.isAbsolute(srcpath)) { - return fs.lstat(srcpath, (err) => { - if (err) { - err.message = err.message.replace('lstat', 'ensureSymlink') - return callback(err) - } - return callback(null, { - 'toCwd': srcpath, - 'toDst': srcpath - }) - }) - } else { - const dstdir = path.dirname(dstpath) - const relativeToDst = path.join(dstdir, srcpath) - return pathExists(relativeToDst, (err, exists) => { - if (err) return callback(err) - if (exists) { - return callback(null, { - 'toCwd': relativeToDst, - 'toDst': srcpath - }) - } else { - return fs.lstat(srcpath, (err) => { - if (err) { - err.message = err.message.replace('lstat', 'ensureSymlink') - return callback(err) - } - return callback(null, { - 'toCwd': srcpath, - 'toDst': path.relative(dstdir, srcpath) - }) - }) - } - }) - } -} + validateInputSync(parsed.options); -function symlinkPathsSync (srcpath, dstpath) { - let exists - if (path.isAbsolute(srcpath)) { - 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) - } - } - } -} + let result; + try { + result = childProcess.spawnSync(parsed.file, parsed.args, parsed.options); + } catch (error) { + throw makeError({ + error, + stdout: '', + stderr: '', + all: '', + command, + escapedCommand, + parsed, + timedOut: false, + isCanceled: false, + killed: false + }); + } -module.exports = { - symlinkPaths, - symlinkPathsSync -} + const stdout = handleOutput(parsed.options, result.stdout, result.error); + const stderr = handleOutput(parsed.options, result.stderr, result.error); + if (result.error || result.status !== 0 || result.signal !== null) { + const error = makeError({ + stdout, + stderr, + error: result.error, + signal: result.signal, + exitCode: result.status, + command, + escapedCommand, + parsed, + timedOut: result.error && result.error.code === 'ETIMEDOUT', + isCanceled: false, + killed: result.signal !== null + }); -/***/ }), + if (!parsed.options.reject) { + return error; + } -/***/ 93959: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + throw error; + } -"use strict"; + return { + command, + escapedCommand, + exitCode: 0, + stdout, + stderr, + failed: false, + timedOut: false, + isCanceled: false, + killed: false + }; +}; +module.exports.command = (command, options) => { + const [file, ...args] = parseCommand(command); + return execa(file, args, options); +}; -const fs = __nccwpck_require__(61404) +module.exports.commandSync = (command, options) => { + const [file, ...args] = parseCommand(command); + return execa.sync(file, args, options); +}; -function symlinkType (srcpath, type, callback) { - callback = (typeof type === 'function') ? type : callback - type = (typeof type === 'function') ? false : type - if (type) return callback(null, type) - fs.lstat(srcpath, (err, stats) => { - if (err) return callback(null, 'file') - type = (stats && stats.isDirectory()) ? 'dir' : 'file' - callback(null, type) - }) -} +module.exports.node = (scriptPath, args, options = {}) => { + if (args && !Array.isArray(args) && typeof args === 'object') { + options = args; + args = []; + } -function symlinkTypeSync (srcpath, type) { - let stats + const stdio = normalizeStdio.node(options); + const defaultExecArgv = process.execArgv.filter(arg => !arg.startsWith('--inspect')); - if (type) return type - try { - stats = fs.lstatSync(srcpath) - } catch (e) { - return 'file' - } - return (stats && stats.isDirectory()) ? 'dir' : 'file' -} + const { + nodePath = process.execPath, + nodeOptions = defaultExecArgv + } = options; -module.exports = { - symlinkType, - symlinkTypeSync -} + return execa( + nodePath, + [ + ...nodeOptions, + scriptPath, + ...(Array.isArray(args) ? args : []) + ], + { + ...options, + stdin: undefined, + stdout: undefined, + stderr: undefined, + stdio, + shell: false + } + ); +}; /***/ }), -/***/ 12062: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/***/ 32849: +/***/ ((module) => { "use strict"; +const normalizeArgs = (file, args = []) => { + if (!Array.isArray(args)) { + return [file]; + } -const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) -const path = __nccwpck_require__(16928) -const fs = __nccwpck_require__(61404) -const _mkdirs = __nccwpck_require__(77999) -const mkdirs = _mkdirs.mkdirs -const mkdirsSync = _mkdirs.mkdirsSync - -const _symlinkPaths = __nccwpck_require__(37363) -const symlinkPaths = _symlinkPaths.symlinkPaths -const symlinkPathsSync = _symlinkPaths.symlinkPathsSync + return [file, ...args]; +}; -const _symlinkType = __nccwpck_require__(93959) -const symlinkType = _symlinkType.symlinkType -const symlinkTypeSync = _symlinkType.symlinkTypeSync +const NO_ESCAPE_REGEXP = /^[\w.-]+$/; +const DOUBLE_QUOTES_REGEXP = /"/g; -const pathExists = (__nccwpck_require__(53647).pathExists) +const escapeArg = arg => { + if (typeof arg !== 'string' || NO_ESCAPE_REGEXP.test(arg)) { + return arg; + } -function createSymlink (srcpath, dstpath, type, callback) { - callback = (typeof type === 'function') ? type : callback - type = (typeof type === 'function') ? false : type + return `"${arg.replace(DOUBLE_QUOTES_REGEXP, '\\"')}"`; +}; - pathExists(dstpath, (err, destinationExists) => { - if (err) return callback(err) - if (destinationExists) return callback(null) - symlinkPaths(srcpath, dstpath, (err, relative) => { - if (err) return callback(err) - srcpath = relative.toDst - symlinkType(relative.toCwd, type, (err, type) => { - if (err) return callback(err) - const dir = path.dirname(dstpath) - pathExists(dir, (err, dirExists) => { - if (err) return callback(err) - if (dirExists) return fs.symlink(srcpath, dstpath, type, callback) - mkdirs(dir, err => { - if (err) return callback(err) - fs.symlink(srcpath, dstpath, type, callback) - }) - }) - }) - }) - }) -} +const joinCommand = (file, args) => { + return normalizeArgs(file, args).join(' '); +}; -function createSymlinkSync (srcpath, dstpath, type) { - const destinationExists = fs.existsSync(dstpath) - if (destinationExists) return undefined +const getEscapedCommand = (file, args) => { + return normalizeArgs(file, args).map(arg => escapeArg(arg)).join(' '); +}; - const relative = symlinkPathsSync(srcpath, dstpath) - srcpath = relative.toDst - type = symlinkTypeSync(relative.toCwd, type) - const dir = path.dirname(dstpath) - const exists = fs.existsSync(dir) - if (exists) return fs.symlinkSync(srcpath, dstpath, type) - mkdirsSync(dir) - return fs.symlinkSync(srcpath, dstpath, type) -} +const SPACES_REGEXP = / +/g; + +// Handle `execa.command()` +const parseCommand = command => { + const tokens = []; + for (const token of command.trim().split(SPACES_REGEXP)) { + // Allow spaces to be escaped by a backslash if not meant as a delimiter + const previousToken = tokens[tokens.length - 1]; + if (previousToken && previousToken.endsWith('\\')) { + // Merge previous token with current one + tokens[tokens.length - 1] = `${previousToken.slice(0, -1)} ${token}`; + } else { + tokens.push(token); + } + } + + return tokens; +}; module.exports = { - createSymlink: u(createSymlink), - createSymlinkSync -} + joinCommand, + getEscapedCommand, + parseCommand +}; /***/ }), -/***/ 58684: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ 46406: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -// This is adapted from https://github.com/normalize/mz -// Copyright (c) 2014-2016 Jonathan Ong me@jongleberry.com and Contributors -const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) -const fs = __nccwpck_require__(61404) +const {signalsByName} = __nccwpck_require__(76594); -const api = [ - 'access', - 'appendFile', - 'chmod', - 'chown', - 'close', - 'copyFile', - 'fchmod', - 'fchown', - 'fdatasync', - 'fstat', - 'fsync', - 'ftruncate', - 'futimes', - 'lchown', - 'lchmod', - 'link', - 'lstat', - 'mkdir', - 'mkdtemp', - 'open', - 'readFile', - 'readdir', - 'readlink', - 'realpath', - 'rename', - 'rmdir', - 'stat', - 'symlink', - 'truncate', - 'unlink', - 'utimes', - 'writeFile' -].filter(key => { - // Some commands are not available on some systems. Ex: - // fs.copyFile was added in Node.js v8.5.0 - // fs.mkdtemp was added in Node.js v5.10.0 - // fs.lchown is not available on at least some Linux - return typeof fs[key] === 'function' -}) +const getErrorPrefix = ({timedOut, timeout, errorCode, signal, signalDescription, exitCode, isCanceled}) => { + if (timedOut) { + return `timed out after ${timeout} milliseconds`; + } -// Export all keys: -Object.keys(fs).forEach(key => { - if (key === 'promises') { - // fs.promises is a getter property that triggers ExperimentalWarning - // Don't re-export it here, the getter is defined in "lib/index.js" - return - } - exports[key] = fs[key] -}) + if (isCanceled) { + return 'was canceled'; + } -// Universalify async methods: -api.forEach(method => { - exports[method] = u(fs[method]) -}) + if (errorCode !== undefined) { + return `failed with ${errorCode}`; + } -// We differ from mz/fs in that we still ship the old, broken, fs.exists() -// since we are a drop-in replacement for the native module -exports.exists = function (filename, callback) { - if (typeof callback === 'function') { - return fs.exists(filename, callback) - } - return new Promise(resolve => { - return fs.exists(filename, resolve) - }) -} + if (signal !== undefined) { + return `was killed with ${signal} (${signalDescription})`; + } -// fs.read() & fs.write need special treatment due to multiple callback args + if (exitCode !== undefined) { + return `failed with exit code ${exitCode}`; + } -exports.read = function (fd, buffer, offset, length, position, callback) { - if (typeof callback === 'function') { - return fs.read(fd, buffer, offset, length, position, callback) - } - return new Promise((resolve, reject) => { - fs.read(fd, buffer, offset, length, position, (err, bytesRead, buffer) => { - if (err) return reject(err) - resolve({ bytesRead, buffer }) - }) - }) -} + return 'failed'; +}; -// Function signature can be -// fs.write(fd, buffer[, offset[, length[, position]]], callback) -// OR -// fs.write(fd, string[, position[, encoding]], callback) -// We need to handle both cases, so we use ...args -exports.write = function (fd, buffer, ...args) { - if (typeof args[args.length - 1] === 'function') { - return fs.write(fd, buffer, ...args) - } +const makeError = ({ + stdout, + stderr, + all, + error, + signal, + exitCode, + command, + escapedCommand, + timedOut, + isCanceled, + killed, + parsed: {options: {timeout}} +}) => { + // `signal` and `exitCode` emitted on `spawned.on('exit')` event can be `null`. + // We normalize them to `undefined` + exitCode = exitCode === null ? undefined : exitCode; + signal = signal === null ? undefined : signal; + const signalDescription = signal === undefined ? undefined : signalsByName[signal].description; - return new Promise((resolve, reject) => { - fs.write(fd, buffer, ...args, (err, bytesWritten, buffer) => { - if (err) return reject(err) - resolve({ bytesWritten, buffer }) - }) - }) -} + const errorCode = error && error.code; -// fs.realpath.native only available in Node v9.2+ -if (typeof fs.realpath.native === 'function') { - exports.realpath.native = u(fs.realpath.native) -} + const prefix = getErrorPrefix({timedOut, timeout, errorCode, signal, signalDescription, exitCode, isCanceled}); + const execaMessage = `Command ${prefix}: ${command}`; + const isError = Object.prototype.toString.call(error) === '[object Error]'; + const shortMessage = isError ? `${execaMessage}\n${error.message}` : execaMessage; + const message = [shortMessage, stderr, stdout].filter(Boolean).join('\n'); + + if (isError) { + error.originalMessage = error.message; + error.message = message; + } else { + error = new Error(message); + } + + error.shortMessage = shortMessage; + error.command = command; + error.escapedCommand = escapedCommand; + error.exitCode = exitCode; + error.signal = signal; + error.signalDescription = signalDescription; + error.stdout = stdout; + error.stderr = stderr; + + if (all !== undefined) { + error.all = all; + } + + if ('bufferedData' in error) { + delete error.bufferedData; + } + + error.failed = true; + error.timedOut = Boolean(timedOut); + error.isCanceled = isCanceled; + error.killed = killed && !timedOut; + + return error; +}; + +module.exports = makeError; /***/ }), -/***/ 5810: +/***/ 98638: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; +const os = __nccwpck_require__(70857); +const onExit = __nccwpck_require__(791); -module.exports = Object.assign( - {}, - // Export promiseified graceful-fs: - __nccwpck_require__(58684), - // Export extra methods: - __nccwpck_require__(36278), - __nccwpck_require__(32558), - __nccwpck_require__(77032), - __nccwpck_require__(25985), - __nccwpck_require__(60457), - __nccwpck_require__(77999), - __nccwpck_require__(3262), - __nccwpck_require__(59926), - __nccwpck_require__(78778), - __nccwpck_require__(53647), - __nccwpck_require__(84507) -) - -// Export fs.promises as a getter property so that we don't trigger -// ExperimentalWarning before fs.promises is actually accessed. -const fs = __nccwpck_require__(79896) -if (Object.getOwnPropertyDescriptor(fs, 'promises')) { - Object.defineProperty(module.exports, "promises", ({ - get () { return fs.promises } - })) -} - +const DEFAULT_FORCE_KILL_TIMEOUT = 1000 * 5; -/***/ }), +// Monkey-patches `childProcess.kill()` to add `forceKillAfterTimeout` behavior +const spawnedKill = (kill, signal = 'SIGTERM', options = {}) => { + const killResult = kill(signal); + setKillTimeout(kill, signal, options, killResult); + return killResult; +}; -/***/ 60457: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +const setKillTimeout = (kill, signal, options, killResult) => { + if (!shouldForceKill(signal, options, killResult)) { + return; + } -"use strict"; + const timeout = getForceKillAfterTimeout(options); + const t = setTimeout(() => { + kill('SIGKILL'); + }, timeout); + // Guarded because there's no `.unref()` when `execa` is used in the renderer + // process in Electron. This cannot be tested since we don't run tests in + // Electron. + // istanbul ignore else + if (t.unref) { + t.unref(); + } +}; -const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) -const jsonFile = __nccwpck_require__(46333) +const shouldForceKill = (signal, {forceKillAfterTimeout}, killResult) => { + return isSigterm(signal) && forceKillAfterTimeout !== false && killResult; +}; -jsonFile.outputJson = u(__nccwpck_require__(49483)) -jsonFile.outputJsonSync = __nccwpck_require__(74363) -// aliases -jsonFile.outputJSON = jsonFile.outputJson -jsonFile.outputJSONSync = jsonFile.outputJsonSync -jsonFile.writeJSON = jsonFile.writeJson -jsonFile.writeJSONSync = jsonFile.writeJsonSync -jsonFile.readJSON = jsonFile.readJson -jsonFile.readJSONSync = jsonFile.readJsonSync +const isSigterm = signal => { + return signal === os.constants.signals.SIGTERM || + (typeof signal === 'string' && signal.toUpperCase() === 'SIGTERM'); +}; -module.exports = jsonFile +const getForceKillAfterTimeout = ({forceKillAfterTimeout = true}) => { + if (forceKillAfterTimeout === true) { + return DEFAULT_FORCE_KILL_TIMEOUT; + } + if (!Number.isFinite(forceKillAfterTimeout) || forceKillAfterTimeout < 0) { + throw new TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${forceKillAfterTimeout}\` (${typeof forceKillAfterTimeout})`); + } -/***/ }), + return forceKillAfterTimeout; +}; -/***/ 46333: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +// `childProcess.cancel()` +const spawnedCancel = (spawned, context) => { + const killResult = spawned.kill(); -"use strict"; + if (killResult) { + context.isCanceled = true; + } +}; +const timeoutKill = (spawned, signal, reject) => { + spawned.kill(signal); + reject(Object.assign(new Error('Timed out'), {timedOut: true, signal})); +}; -const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) -const jsonFile = __nccwpck_require__(93588) +// `timeout` option handling +const setupTimeout = (spawned, {timeout, killSignal = 'SIGTERM'}, spawnedPromise) => { + if (timeout === 0 || timeout === undefined) { + return spawnedPromise; + } -module.exports = { - // jsonfile exports - readJson: u(jsonFile.readFile), - readJsonSync: jsonFile.readFileSync, - writeJson: u(jsonFile.writeFile), - writeJsonSync: jsonFile.writeFileSync -} + let timeoutId; + const timeoutPromise = new Promise((resolve, reject) => { + timeoutId = setTimeout(() => { + timeoutKill(spawned, killSignal, reject); + }, timeout); + }); + const safeSpawnedPromise = spawnedPromise.finally(() => { + clearTimeout(timeoutId); + }); -/***/ }), + return Promise.race([timeoutPromise, safeSpawnedPromise]); +}; -/***/ 74363: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +const validateTimeout = ({timeout}) => { + if (timeout !== undefined && (!Number.isFinite(timeout) || timeout < 0)) { + throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${timeout}\` (${typeof timeout})`); + } +}; -"use strict"; +// `cleanup` option handling +const setExitHandler = async (spawned, {cleanup, detached}, timedPromise) => { + if (!cleanup || detached) { + return timedPromise; + } + const removeExitHandler = onExit(() => { + spawned.kill(); + }); -const fs = __nccwpck_require__(61404) -const path = __nccwpck_require__(16928) -const mkdir = __nccwpck_require__(77999) -const jsonFile = __nccwpck_require__(46333) + return timedPromise.finally(() => { + removeExitHandler(); + }); +}; -function outputJsonSync (file, data, options) { - const dir = path.dirname(file) +module.exports = { + spawnedKill, + spawnedCancel, + setupTimeout, + validateTimeout, + setExitHandler +}; - if (!fs.existsSync(dir)) { - mkdir.mkdirsSync(dir) - } - jsonFile.writeJsonSync(file, data, options) -} +/***/ }), -module.exports = outputJsonSync +/***/ 98529: +/***/ ((module) => { +"use strict"; -/***/ }), -/***/ 49483: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +const nativePromisePrototype = (async () => {})().constructor.prototype; +const descriptors = ['then', 'catch', 'finally'].map(property => [ + property, + Reflect.getOwnPropertyDescriptor(nativePromisePrototype, property) +]); -"use strict"; +// The return value is a mixin of `childProcess` and `Promise` +const mergePromise = (spawned, promise) => { + for (const [property, descriptor] of descriptors) { + // Starting the main `promise` is deferred to avoid consuming streams + const value = typeof promise === 'function' ? + (...args) => Reflect.apply(descriptor.value, promise(), args) : + descriptor.value.bind(promise); + Reflect.defineProperty(spawned, property, {...descriptor, value}); + } -const path = __nccwpck_require__(16928) -const mkdir = __nccwpck_require__(77999) -const pathExists = (__nccwpck_require__(53647).pathExists) -const jsonFile = __nccwpck_require__(46333) + return spawned; +}; -function outputJson (file, data, options, callback) { - if (typeof options === 'function') { - callback = options - options = {} - } +// Use promises instead of `child_process` events +const getSpawnedPromise = spawned => { + return new Promise((resolve, reject) => { + spawned.on('exit', (exitCode, signal) => { + resolve({exitCode, signal}); + }); - const dir = path.dirname(file) + spawned.on('error', error => { + reject(error); + }); - pathExists(dir, (err, itDoes) => { - if (err) return callback(err) - if (itDoes) return jsonFile.writeJson(file, data, options, callback) + if (spawned.stdin) { + spawned.stdin.on('error', error => { + reject(error); + }); + } + }); +}; - mkdir.mkdirs(dir, err => { - if (err) return callback(err) - jsonFile.writeJson(file, data, options, callback) - }) - }) -} +module.exports = { + mergePromise, + getSpawnedPromise +}; -module.exports = outputJson /***/ }), -/***/ 77999: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/***/ 58729: +/***/ ((module) => { "use strict"; -const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) -const mkdirs = u(__nccwpck_require__(40931)) -const mkdirsSync = __nccwpck_require__(6419) +const aliases = ['stdin', 'stdout', 'stderr']; -module.exports = { - mkdirs, - mkdirsSync, - // alias - mkdirp: mkdirs, - mkdirpSync: mkdirsSync, - ensureDir: mkdirs, - ensureDirSync: mkdirsSync -} +const hasAlias = options => aliases.some(alias => options[alias] !== undefined); +const normalizeStdio = options => { + if (!options) { + return; + } -/***/ }), + const {stdio} = options; -/***/ 6419: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + if (stdio === undefined) { + return aliases.map(alias => options[alias]); + } -"use strict"; + if (hasAlias(options)) { + throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${aliases.map(alias => `\`${alias}\``).join(', ')}`); + } + if (typeof stdio === 'string') { + return stdio; + } -const fs = __nccwpck_require__(61404) -const path = __nccwpck_require__(16928) -const invalidWin32Path = (__nccwpck_require__(62936).invalidWin32Path) - -const o777 = parseInt('0777', 8) - -function mkdirsSync (p, opts, made) { - if (!opts || typeof opts !== 'object') { - opts = { mode: opts } - } + if (!Array.isArray(stdio)) { + throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof stdio}\``); + } - let mode = opts.mode - const xfs = opts.fs || fs + const length = Math.max(stdio.length, aliases.length); + return Array.from({length}, (value, index) => stdio[index]); +}; - if (process.platform === 'win32' && invalidWin32Path(p)) { - const errInval = new Error(p + ' contains invalid WIN32 path characters.') - errInval.code = 'EINVAL' - throw errInval - } +module.exports = normalizeStdio; - if (mode === undefined) { - mode = o777 & (~process.umask()) - } - if (!made) made = null +// `ipc` is pushed unless it is already present +module.exports.node = options => { + const stdio = normalizeStdio(options); - p = path.resolve(p) + if (stdio === 'ipc') { + return 'ipc'; + } - try { - xfs.mkdirSync(p, mode) - made = made || p - } catch (err0) { - if (err0.code === 'ENOENT') { - if (path.dirname(p) === p) throw err0 - made = mkdirsSync(path.dirname(p), opts, made) - mkdirsSync(p, opts, made) - } else { - // In the case of any other error, just see if there's a dir there - // already. If so, then hooray! If not, then something is borked. - let stat - try { - stat = xfs.statSync(p) - } catch (err1) { - throw err0 - } - if (!stat.isDirectory()) throw err0 - } - } + if (stdio === undefined || typeof stdio === 'string') { + return [stdio, stdio, stdio, 'ipc']; + } - return made -} + if (stdio.includes('ipc')) { + return stdio; + } -module.exports = mkdirsSync + return [...stdio, 'ipc']; +}; /***/ }), -/***/ 40931: +/***/ 41762: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; +const isStream = __nccwpck_require__(81011); +const getStream = __nccwpck_require__(91559); +const mergeStream = __nccwpck_require__(22655); -const fs = __nccwpck_require__(61404) -const path = __nccwpck_require__(16928) -const invalidWin32Path = (__nccwpck_require__(62936).invalidWin32Path) - -const o777 = parseInt('0777', 8) - -function mkdirs (p, opts, callback, made) { - if (typeof opts === 'function') { - callback = opts - opts = {} - } else if (!opts || typeof opts !== 'object') { - opts = { mode: opts } - } - - if (process.platform === 'win32' && invalidWin32Path(p)) { - const errInval = new Error(p + ' contains invalid WIN32 path characters.') - errInval.code = 'EINVAL' - return callback(errInval) - } +// `input` option +const handleInput = (spawned, input) => { + // Checking for stdin is workaround for https://github.com/nodejs/node/issues/26852 + // @todo remove `|| spawned.stdin === undefined` once we drop support for Node.js <=12.2.0 + if (input === undefined || spawned.stdin === undefined) { + return; + } - let mode = opts.mode - const xfs = opts.fs || fs + if (isStream(input)) { + input.pipe(spawned.stdin); + } else { + spawned.stdin.end(input); + } +}; - if (mode === undefined) { - mode = o777 & (~process.umask()) - } - if (!made) made = null +// `all` interleaves `stdout` and `stderr` +const makeAllStream = (spawned, {all}) => { + if (!all || (!spawned.stdout && !spawned.stderr)) { + return; + } - callback = callback || function () {} - p = path.resolve(p) + const mixed = mergeStream(); - xfs.mkdir(p, mode, er => { - if (!er) { - made = made || p - return callback(null, made) - } - switch (er.code) { - case 'ENOENT': - if (path.dirname(p) === p) return callback(er) - mkdirs(path.dirname(p), opts, (er, made) => { - if (er) callback(er, made) - else mkdirs(p, opts, callback, made) - }) - break + if (spawned.stdout) { + mixed.add(spawned.stdout); + } - // In the case of any other error, just see if there's a dir - // there already. If so, then hooray! If not, then something - // is borked. - default: - xfs.stat(p, (er2, stat) => { - // if the stat fails, then that's super weird. - // let the original error be the failure reason. - if (er2 || !stat.isDirectory()) callback(er, made) - else callback(null, made) - }) - break - } - }) -} + if (spawned.stderr) { + mixed.add(spawned.stderr); + } -module.exports = mkdirs + return mixed; +}; +// On failure, `result.stdout|stderr|all` should contain the currently buffered stream +const getBufferedData = async (stream, streamPromise) => { + if (!stream) { + return; + } -/***/ }), + stream.destroy(); -/***/ 62936: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + try { + return await streamPromise; + } catch (error) { + return error.bufferedData; + } +}; -"use strict"; +const getStreamPromise = (stream, {encoding, buffer, maxBuffer}) => { + if (!stream || !buffer) { + return; + } + if (encoding) { + return getStream(stream, {encoding, maxBuffer}); + } -const path = __nccwpck_require__(16928) + return getStream.buffer(stream, {maxBuffer}); +}; -// get drive on windows -function getRootPath (p) { - p = path.normalize(path.resolve(p)).split(path.sep) - if (p.length > 0) return p[0] - return null -} +// Retrieve result of child process: exit code, signal, error, streams (stdout/stderr/all) +const getSpawnedResult = async ({stdout, stderr, all}, {encoding, buffer, maxBuffer}, processDone) => { + const stdoutPromise = getStreamPromise(stdout, {encoding, buffer, maxBuffer}); + const stderrPromise = getStreamPromise(stderr, {encoding, buffer, maxBuffer}); + const allPromise = getStreamPromise(all, {encoding, buffer, maxBuffer: maxBuffer * 2}); -// http://stackoverflow.com/a/62888/10333 contains more accurate -// TODO: expand to include the rest -const INVALID_PATH_CHARS = /[<>:"|?*]/ + try { + return await Promise.all([processDone, stdoutPromise, stderrPromise, allPromise]); + } catch (error) { + return Promise.all([ + {error, signal: error.signal, timedOut: error.timedOut}, + getBufferedData(stdout, stdoutPromise), + getBufferedData(stderr, stderrPromise), + getBufferedData(all, allPromise) + ]); + } +}; -function invalidWin32Path (p) { - const rp = getRootPath(p) - p = p.replace(rp, '') - return INVALID_PATH_CHARS.test(p) -} +const validateInputSync = ({input}) => { + if (isStream(input)) { + throw new TypeError('The `input` option cannot be a stream in sync mode'); + } +}; module.exports = { - getRootPath, - invalidWin32Path -} - - -/***/ }), - -/***/ 3262: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - -"use strict"; - + handleInput, + makeAllStream, + getSpawnedResult, + validateInputSync +}; -module.exports = { - moveSync: __nccwpck_require__(80041) -} /***/ }), -/***/ 80041: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/***/ 75522: +/***/ (function(__unused_webpack_module, exports) { "use strict"; - -const fs = __nccwpck_require__(61404) -const path = __nccwpck_require__(16928) -const copySync = (__nccwpck_require__(36278).copySync) -const removeSync = (__nccwpck_require__(84507).removeSync) -const mkdirpSync = (__nccwpck_require__(77999).mkdirpSync) -const stat = __nccwpck_require__(91349) - -function moveSync (src, dest, opts) { - opts = opts || {} - const overwrite = opts.overwrite || opts.clobber || false - - const { srcStat } = stat.checkPathsSync(src, dest, 'move') - stat.checkParentPathsSync(src, srcStat, dest, 'move') - mkdirpSync(path.dirname(dest)) - return doRename(src, dest, overwrite) -} - -function doRename (src, dest, overwrite) { - if (overwrite) { - removeSync(dest) - return rename(src, dest, overwrite) - } - if (fs.existsSync(dest)) throw new Error('dest already exists.') - return rename(src, dest, overwrite) -} - -function rename (src, dest, overwrite) { - try { - fs.renameSync(src, dest) - } catch (err) { - if (err.code !== 'EXDEV') throw err - return moveAcrossDevice(src, dest, overwrite) - } -} - -function moveAcrossDevice (src, dest, overwrite) { - const opts = { - overwrite, - errorOnExist: true - } - copySync(src, dest, opts) - return removeSync(src) -} - -module.exports = moveSync - +var __extends = (this && this.__extends) || (function () { + var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", ({ value: true })); +var ExtendableError = /** @class */ (function (_super) { + __extends(ExtendableError, _super); + function ExtendableError(message) { + var _newTarget = this.constructor; + if (message === void 0) { message = ''; } + var _this = _super.call(this, message) || this; + _this.message = message; + Object.setPrototypeOf(_this, _newTarget.prototype); + delete _this.stack; + _this.name = _newTarget.name; + _this._error = new Error(); + return _this; + } + Object.defineProperty(ExtendableError.prototype, "stack", { + get: function () { + if (this._stack) { + return this._stack; + } + var prototype = Object.getPrototypeOf(this); + var depth = 1; + loop: while (prototype) { + switch (prototype) { + case ExtendableError.prototype: + break loop; + case Object.prototype: + depth = 1; + break loop; + default: + depth++; + break; + } + prototype = Object.getPrototypeOf(prototype); + } + var stackLines = (this._error.stack || '').match(/.+/g) || []; + var nameLine = this.name; + if (this.message) { + nameLine += ": " + this.message; + } + stackLines.splice(0, depth + 1, nameLine); + return this._stack = stackLines.join('\n'); + }, + enumerable: true, + configurable: true + }); + return ExtendableError; +}(Error)); +exports.ExtendableError = ExtendableError; +exports["default"] = ExtendableError; +//# sourceMappingURL=index.js.map /***/ }), -/***/ 59926: +/***/ 10484: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; - -const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) -module.exports = { - move: u(__nccwpck_require__(35825)) +const taskManager = __nccwpck_require__(12123); +const async_1 = __nccwpck_require__(95649); +const stream_1 = __nccwpck_require__(80613); +const sync_1 = __nccwpck_require__(81850); +const settings_1 = __nccwpck_require__(34763); +const utils = __nccwpck_require__(1062); +async function FastGlob(source, options) { + assertPatternsInput(source); + const works = getWorks(source, async_1.default, options); + const result = await Promise.all(works); + return utils.array.flatten(result); +} +// https://github.com/typescript-eslint/typescript-eslint/issues/60 +// eslint-disable-next-line no-redeclare +(function (FastGlob) { + FastGlob.glob = FastGlob; + FastGlob.globSync = sync; + FastGlob.globStream = stream; + FastGlob.async = FastGlob; + function sync(source, options) { + assertPatternsInput(source); + const works = getWorks(source, sync_1.default, options); + return utils.array.flatten(works); + } + FastGlob.sync = sync; + function stream(source, options) { + assertPatternsInput(source); + const works = getWorks(source, stream_1.default, options); + /** + * The stream returned by the provider cannot work with an asynchronous iterator. + * To support asynchronous iterators, regardless of the number of tasks, we always multiplex streams. + * This affects performance (+25%). I don't see best solution right now. + */ + return utils.stream.merge(works); + } + FastGlob.stream = stream; + function generateTasks(source, options) { + assertPatternsInput(source); + const patterns = [].concat(source); + const settings = new settings_1.default(options); + return taskManager.generate(patterns, settings); + } + FastGlob.generateTasks = generateTasks; + function isDynamicPattern(source, options) { + assertPatternsInput(source); + const settings = new settings_1.default(options); + return utils.pattern.isDynamicPattern(source, settings); + } + FastGlob.isDynamicPattern = isDynamicPattern; + function escapePath(source) { + assertPatternsInput(source); + return utils.path.escape(source); + } + FastGlob.escapePath = escapePath; + function convertPathToPattern(source) { + assertPatternsInput(source); + return utils.path.convertPathToPattern(source); + } + FastGlob.convertPathToPattern = convertPathToPattern; + let posix; + (function (posix) { + function escapePath(source) { + assertPatternsInput(source); + return utils.path.escapePosixPath(source); + } + posix.escapePath = escapePath; + function convertPathToPattern(source) { + assertPatternsInput(source); + return utils.path.convertPosixPathToPattern(source); + } + posix.convertPathToPattern = convertPathToPattern; + })(posix = FastGlob.posix || (FastGlob.posix = {})); + let win32; + (function (win32) { + function escapePath(source) { + assertPatternsInput(source); + return utils.path.escapeWindowsPath(source); + } + win32.escapePath = escapePath; + function convertPathToPattern(source) { + assertPatternsInput(source); + return utils.path.convertWindowsPathToPattern(source); + } + win32.convertPathToPattern = convertPathToPattern; + })(win32 = FastGlob.win32 || (FastGlob.win32 = {})); +})(FastGlob || (FastGlob = {})); +function getWorks(source, _Provider, options) { + const patterns = [].concat(source); + const settings = new settings_1.default(options); + const tasks = taskManager.generate(patterns, settings); + const provider = new _Provider(settings); + return tasks.map(provider.read, provider); +} +function assertPatternsInput(input) { + const source = [].concat(input); + const isValidSource = source.every((item) => utils.string.isString(item) && !utils.string.isEmpty(item)); + if (!isValidSource) { + throw new TypeError('Patterns must be a string (non empty) or an array of strings'); + } } +module.exports = FastGlob; /***/ }), -/***/ 35825: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/***/ 12123: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; - -const fs = __nccwpck_require__(61404) -const path = __nccwpck_require__(16928) -const copy = (__nccwpck_require__(32558).copy) -const remove = (__nccwpck_require__(84507).remove) -const mkdirp = (__nccwpck_require__(77999).mkdirp) -const pathExists = (__nccwpck_require__(53647).pathExists) -const stat = __nccwpck_require__(91349) - -function move (src, dest, opts, cb) { - if (typeof opts === 'function') { - cb = opts - opts = {} - } - - const overwrite = opts.overwrite || opts.clobber || false - - stat.checkPaths(src, dest, 'move', (err, stats) => { - if (err) return cb(err) - const { srcStat } = stats - stat.checkParentPaths(src, srcStat, dest, 'move', err => { - if (err) return cb(err) - mkdirp(path.dirname(dest), err => { - if (err) return cb(err) - return doRename(src, dest, overwrite, cb) - }) - }) - }) -} - -function doRename (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) - }) +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.convertPatternGroupToTask = exports.convertPatternGroupsToTasks = exports.groupPatternsByBaseDirectory = exports.getNegativePatternsAsPositive = exports.getPositivePatterns = exports.convertPatternsToTasks = exports.generate = void 0; +const utils = __nccwpck_require__(1062); +function generate(input, settings) { + const patterns = processPatterns(input, settings); + const ignore = processPatterns(settings.ignore, settings); + const positivePatterns = getPositivePatterns(patterns); + const negativePatterns = getNegativePatternsAsPositive(patterns, ignore); + const staticPatterns = positivePatterns.filter((pattern) => utils.pattern.isStaticPattern(pattern, settings)); + const dynamicPatterns = positivePatterns.filter((pattern) => utils.pattern.isDynamicPattern(pattern, settings)); + const staticTasks = convertPatternsToTasks(staticPatterns, negativePatterns, /* dynamic */ false); + const dynamicTasks = convertPatternsToTasks(dynamicPatterns, negativePatterns, /* dynamic */ true); + return staticTasks.concat(dynamicTasks); } - -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) - }) +exports.generate = generate; +function processPatterns(input, settings) { + let patterns = input; + /** + * The original pattern like `{,*,**,a/*}` can lead to problems checking the depth when matching entry + * and some problems with the micromatch package (see fast-glob issues: #365, #394). + * + * To solve this problem, we expand all patterns containing brace expansion. This can lead to a slight slowdown + * in matching in the case of a large set of patterns after expansion. + */ + if (settings.braceExpansion) { + patterns = utils.pattern.expandPatternsWithBraceExpansion(patterns); + } + /** + * If the `baseNameMatch` option is enabled, we must add globstar to patterns, so that they can be used + * at any nesting level. + * + * We do this here, because otherwise we have to complicate the filtering logic. For example, we need to change + * the pattern in the filter before creating a regular expression. There is no need to change the patterns + * in the application. Only on the input. + */ + if (settings.baseNameMatch) { + patterns = patterns.map((pattern) => pattern.includes('/') ? pattern : `**/${pattern}`); + } + /** + * This method also removes duplicate slashes that may have been in the pattern or formed as a result of expansion. + */ + return patterns.map((pattern) => utils.pattern.removeDuplicateSlashes(pattern)); } - -function moveAcrossDevice (src, dest, overwrite, cb) { - const opts = { - overwrite, - errorOnExist: true - } - copy(src, dest, opts, err => { - if (err) return cb(err) - return remove(src, cb) - }) +/** + * Returns tasks grouped by basic pattern directories. + * + * Patterns that can be found inside (`./`) and outside (`../`) the current directory are handled separately. + * This is necessary because directory traversal starts at the base directory and goes deeper. + */ +function convertPatternsToTasks(positive, negative, dynamic) { + const tasks = []; + const patternsOutsideCurrentDirectory = utils.pattern.getPatternsOutsideCurrentDirectory(positive); + const patternsInsideCurrentDirectory = utils.pattern.getPatternsInsideCurrentDirectory(positive); + const outsideCurrentDirectoryGroup = groupPatternsByBaseDirectory(patternsOutsideCurrentDirectory); + const insideCurrentDirectoryGroup = groupPatternsByBaseDirectory(patternsInsideCurrentDirectory); + tasks.push(...convertPatternGroupsToTasks(outsideCurrentDirectoryGroup, negative, dynamic)); + /* + * For the sake of reducing future accesses to the file system, we merge all tasks within the current directory + * into a global task, if at least one pattern refers to the root (`.`). In this case, the global task covers the rest. + */ + if ('.' in insideCurrentDirectoryGroup) { + tasks.push(convertPatternGroupToTask('.', patternsInsideCurrentDirectory, negative, dynamic)); + } + else { + tasks.push(...convertPatternGroupsToTasks(insideCurrentDirectoryGroup, negative, dynamic)); + } + return tasks; } - -module.exports = move +exports.convertPatternsToTasks = convertPatternsToTasks; +function getPositivePatterns(patterns) { + return utils.pattern.getPositivePatterns(patterns); +} +exports.getPositivePatterns = getPositivePatterns; +function getNegativePatternsAsPositive(patterns, ignore) { + const negative = utils.pattern.getNegativePatterns(patterns).concat(ignore); + const positive = negative.map(utils.pattern.convertToPositivePattern); + return positive; +} +exports.getNegativePatternsAsPositive = getNegativePatternsAsPositive; +function groupPatternsByBaseDirectory(patterns) { + const group = {}; + return patterns.reduce((collection, pattern) => { + const base = utils.pattern.getBaseDirectory(pattern); + if (base in collection) { + collection[base].push(pattern); + } + else { + collection[base] = [pattern]; + } + return collection; + }, group); +} +exports.groupPatternsByBaseDirectory = groupPatternsByBaseDirectory; +function convertPatternGroupsToTasks(positive, negative, dynamic) { + return Object.keys(positive).map((base) => { + return convertPatternGroupToTask(base, positive[base], negative, dynamic); + }); +} +exports.convertPatternGroupsToTasks = convertPatternGroupsToTasks; +function convertPatternGroupToTask(base, positive, negative, dynamic) { + return { + dynamic, + positive, + negative, + base, + patterns: [].concat(positive, negative.map(utils.pattern.convertToNegativePattern)) + }; +} +exports.convertPatternGroupToTask = convertPatternGroupToTask; /***/ }), -/***/ 78778: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/***/ 95649: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; - -const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) -const fs = __nccwpck_require__(61404) -const path = __nccwpck_require__(16928) -const mkdir = __nccwpck_require__(77999) -const pathExists = (__nccwpck_require__(53647).pathExists) - -function outputFile (file, data, encoding, callback) { - if (typeof encoding === 'function') { - callback = encoding - encoding = 'utf8' - } - - 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, err => { - if (err) return callback(err) - - fs.writeFile(file, data, encoding, callback) - }) - }) -} - -function outputFileSync (file, ...args) { - const dir = path.dirname(file) - if (fs.existsSync(dir)) { - return fs.writeFileSync(file, ...args) - } - mkdir.mkdirsSync(dir) - fs.writeFileSync(file, ...args) -} - -module.exports = { - outputFile: u(outputFile), - outputFileSync +Object.defineProperty(exports, "__esModule", ({ value: true })); +const async_1 = __nccwpck_require__(79439); +const provider_1 = __nccwpck_require__(5420); +class ProviderAsync extends provider_1.default { + constructor() { + super(...arguments); + this._reader = new async_1.default(this._settings); + } + async read(task) { + const root = this._getRootDirectory(task); + const options = this._getReaderOptions(task); + const entries = await this.api(root, task, options); + return entries.map((entry) => options.transform(entry)); + } + api(root, task, options) { + if (task.dynamic) { + return this._reader.dynamic(root, options); + } + return this._reader.static(task.patterns, options); + } } +exports["default"] = ProviderAsync; /***/ }), -/***/ 53647: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/***/ 26595: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -const u = (__nccwpck_require__(92977)/* .fromPromise */ .z) -const fs = __nccwpck_require__(58684) - -function pathExists (path) { - return fs.access(path).then(() => true).catch(() => false) -} - -module.exports = { - pathExists: u(pathExists), - pathExistsSync: fs.existsSync +Object.defineProperty(exports, "__esModule", ({ value: true })); +const utils = __nccwpck_require__(1062); +const partial_1 = __nccwpck_require__(62600); +class DeepFilter { + constructor(_settings, _micromatchOptions) { + this._settings = _settings; + this._micromatchOptions = _micromatchOptions; + } + getFilter(basePath, positive, negative) { + const matcher = this._getMatcher(positive); + const negativeRe = this._getNegativePatternsRe(negative); + return (entry) => this._filter(basePath, entry, matcher, negativeRe); + } + _getMatcher(patterns) { + return new partial_1.default(patterns, this._settings, this._micromatchOptions); + } + _getNegativePatternsRe(patterns) { + const affectDepthOfReadingPatterns = patterns.filter(utils.pattern.isAffectDepthOfReadingPattern); + return utils.pattern.convertPatternsToRe(affectDepthOfReadingPatterns, this._micromatchOptions); + } + _filter(basePath, entry, matcher, negativeRe) { + if (this._isSkippedByDeep(basePath, entry.path)) { + return false; + } + if (this._isSkippedSymbolicLink(entry)) { + return false; + } + const filepath = utils.path.removeLeadingDotSegment(entry.path); + if (this._isSkippedByPositivePatterns(filepath, matcher)) { + return false; + } + return this._isSkippedByNegativePatterns(filepath, negativeRe); + } + _isSkippedByDeep(basePath, entryPath) { + /** + * Avoid unnecessary depth calculations when it doesn't matter. + */ + if (this._settings.deep === Infinity) { + return false; + } + return this._getEntryLevel(basePath, entryPath) >= this._settings.deep; + } + _getEntryLevel(basePath, entryPath) { + const entryPathDepth = entryPath.split('/').length; + if (basePath === '') { + return entryPathDepth; + } + const basePathDepth = basePath.split('/').length; + return entryPathDepth - basePathDepth; + } + _isSkippedSymbolicLink(entry) { + return !this._settings.followSymbolicLinks && entry.dirent.isSymbolicLink(); + } + _isSkippedByPositivePatterns(entryPath, matcher) { + return !this._settings.baseNameMatch && !matcher.match(entryPath); + } + _isSkippedByNegativePatterns(entryPath, patternsRe) { + return !utils.pattern.matchAny(entryPath, patternsRe); + } } +exports["default"] = DeepFilter; /***/ }), -/***/ 84507: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/***/ 94193: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; - -const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) -const rimraf = __nccwpck_require__(92170) - -module.exports = { - remove: u(rimraf), - removeSync: rimraf.sync +Object.defineProperty(exports, "__esModule", ({ value: true })); +const utils = __nccwpck_require__(1062); +class EntryFilter { + constructor(_settings, _micromatchOptions) { + this._settings = _settings; + this._micromatchOptions = _micromatchOptions; + this.index = new Map(); + } + getFilter(positive, negative) { + const [absoluteNegative, relativeNegative] = utils.pattern.partitionAbsoluteAndRelative(negative); + const patterns = { + positive: { + all: utils.pattern.convertPatternsToRe(positive, this._micromatchOptions) + }, + negative: { + absolute: utils.pattern.convertPatternsToRe(absoluteNegative, Object.assign(Object.assign({}, this._micromatchOptions), { dot: true })), + relative: utils.pattern.convertPatternsToRe(relativeNegative, Object.assign(Object.assign({}, this._micromatchOptions), { dot: true })) + } + }; + return (entry) => this._filter(entry, patterns); + } + _filter(entry, patterns) { + const filepath = utils.path.removeLeadingDotSegment(entry.path); + if (this._settings.unique && this._isDuplicateEntry(filepath)) { + return false; + } + if (this._onlyFileFilter(entry) || this._onlyDirectoryFilter(entry)) { + return false; + } + const isMatched = this._isMatchToPatternsSet(filepath, patterns, entry.dirent.isDirectory()); + if (this._settings.unique && isMatched) { + this._createIndexRecord(filepath); + } + return isMatched; + } + _isDuplicateEntry(filepath) { + return this.index.has(filepath); + } + _createIndexRecord(filepath) { + this.index.set(filepath, undefined); + } + _onlyFileFilter(entry) { + return this._settings.onlyFiles && !entry.dirent.isFile(); + } + _onlyDirectoryFilter(entry) { + return this._settings.onlyDirectories && !entry.dirent.isDirectory(); + } + _isMatchToPatternsSet(filepath, patterns, isDirectory) { + const isMatched = this._isMatchToPatterns(filepath, patterns.positive.all, isDirectory); + if (!isMatched) { + return false; + } + const isMatchedByRelativeNegative = this._isMatchToPatterns(filepath, patterns.negative.relative, isDirectory); + if (isMatchedByRelativeNegative) { + return false; + } + const isMatchedByAbsoluteNegative = this._isMatchToAbsoluteNegative(filepath, patterns.negative.absolute, isDirectory); + if (isMatchedByAbsoluteNegative) { + return false; + } + return true; + } + _isMatchToAbsoluteNegative(filepath, patternsRe, isDirectory) { + if (patternsRe.length === 0) { + return false; + } + const fullpath = utils.path.makeAbsolute(this._settings.cwd, filepath); + return this._isMatchToPatterns(fullpath, patternsRe, isDirectory); + } + _isMatchToPatterns(filepath, patternsRe, isDirectory) { + if (patternsRe.length === 0) { + return false; + } + // Trying to match files and directories by patterns. + const isMatched = utils.pattern.matchAny(filepath, patternsRe); + // A pattern with a trailling slash can be used for directory matching. + // To apply such pattern, we need to add a tralling slash to the path. + if (!isMatched && isDirectory) { + return utils.pattern.matchAny(filepath + '/', patternsRe); + } + return isMatched; + } } +exports["default"] = EntryFilter; /***/ }), -/***/ 92170: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/***/ 94591: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; +Object.defineProperty(exports, "__esModule", ({ value: true })); +const utils = __nccwpck_require__(1062); +class ErrorFilter { + constructor(_settings) { + this._settings = _settings; + } + getFilter() { + return (error) => this._isNonFatalError(error); + } + _isNonFatalError(error) { + return utils.errno.isEnoentCodeError(error) || this._settings.suppressErrors; + } +} +exports["default"] = ErrorFilter; -const fs = __nccwpck_require__(61404) -const path = __nccwpck_require__(16928) -const assert = __nccwpck_require__(42613) -const isWindows = (process.platform === 'win32') +/***/ }), -function defaults (options) { - const methods = [ - 'unlink', - 'chmod', - 'stat', - 'lstat', - 'rmdir', - 'readdir' - ] - methods.forEach(m => { - options[m] = options[m] || fs[m] - m = m + 'Sync' - options[m] = options[m] || fs[m] - }) +/***/ 61703: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - options.maxBusyTries = options.maxBusyTries || 3 -} +"use strict"; -function rimraf (p, options, cb) { - let busyTries = 0 +Object.defineProperty(exports, "__esModule", ({ value: true })); +const utils = __nccwpck_require__(1062); +class Matcher { + constructor(_patterns, _settings, _micromatchOptions) { + this._patterns = _patterns; + this._settings = _settings; + this._micromatchOptions = _micromatchOptions; + this._storage = []; + this._fillStorage(); + } + _fillStorage() { + for (const pattern of this._patterns) { + const segments = this._getPatternSegments(pattern); + const sections = this._splitSegmentsIntoSections(segments); + this._storage.push({ + complete: sections.length <= 1, + pattern, + segments, + sections + }); + } + } + _getPatternSegments(pattern) { + const parts = utils.pattern.getPatternParts(pattern, this._micromatchOptions); + return parts.map((part) => { + const dynamic = utils.pattern.isDynamicPattern(part, this._settings); + if (!dynamic) { + return { + dynamic: false, + pattern: part + }; + } + return { + dynamic: true, + pattern: part, + patternRe: utils.pattern.makeRe(part, this._micromatchOptions) + }; + }); + } + _splitSegmentsIntoSections(segments) { + return utils.array.splitWhen(segments, (segment) => segment.dynamic && utils.pattern.hasGlobStar(segment.pattern)); + } +} +exports["default"] = Matcher; - if (typeof options === 'function') { - cb = options - options = {} - } - assert(p, 'rimraf: missing path') - assert.strictEqual(typeof p, 'string', 'rimraf: path should be a string') - assert.strictEqual(typeof cb, 'function', 'rimraf: callback function required') - assert(options, 'rimraf: invalid options argument provided') - assert.strictEqual(typeof options, 'object', 'rimraf: options should be object') +/***/ }), - defaults(options) +/***/ 62600: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - rimraf_(p, options, function CB (er) { - if (er) { - if ((er.code === 'EBUSY' || er.code === 'ENOTEMPTY' || er.code === 'EPERM') && - busyTries < options.maxBusyTries) { - busyTries++ - const time = busyTries * 100 - // try again, with the same exact callback as this one. - return setTimeout(() => rimraf_(p, options, CB), time) - } +"use strict"; - // already gone - if (er.code === 'ENOENT') er = null +Object.defineProperty(exports, "__esModule", ({ value: true })); +const matcher_1 = __nccwpck_require__(61703); +class PartialMatcher extends matcher_1.default { + match(filepath) { + const parts = filepath.split('/'); + const levels = parts.length; + const patterns = this._storage.filter((info) => !info.complete || info.segments.length > levels); + for (const pattern of patterns) { + const section = pattern.sections[0]; + /** + * In this case, the pattern has a globstar and we must read all directories unconditionally, + * but only if the level has reached the end of the first group. + * + * fixtures/{a,b}/** + * ^ true/false ^ always true + */ + if (!pattern.complete && levels > section.length) { + return true; + } + const match = parts.every((part, index) => { + const segment = pattern.segments[index]; + if (segment.dynamic && segment.patternRe.test(part)) { + return true; + } + if (!segment.dynamic && segment.pattern === part) { + return true; + } + return false; + }); + if (match) { + return true; + } + } + return false; } - - cb(er) - }) } +exports["default"] = PartialMatcher; -// Two possible strategies. -// 1. Assume it's a file. unlink it, then do the dir stuff on EPERM or EISDIR -// 2. Assume it's a directory. readdir, then do the file stuff on ENOTDIR -// -// Both result in an extra syscall when you guess wrong. However, there -// are likely far more normal files in the world than directories. This -// is based on the assumption that a the average number of files per -// directory is >= 1. -// -// If anyone ever complains about this, then I guess the strategy could -// be made configurable somehow. But until then, YAGNI. -function rimraf_ (p, options, cb) { - assert(p) - assert(options) - assert(typeof cb === 'function') - // sunos lets the root user unlink directories, which is... weird. - // so we have to lstat here and make sure it's not a dir. - options.lstat(p, (er, st) => { - if (er && er.code === 'ENOENT') { - return cb(null) - } +/***/ }), - // Windows can EPERM on stat. Life is suffering. - if (er && er.code === 'EPERM' && isWindows) { - return fixWinEPERM(p, options, er, cb) - } +/***/ 5420: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - if (st && st.isDirectory()) { - return rmdir(p, options, er, cb) - } +"use strict"; - options.unlink(p, er => { - if (er) { - if (er.code === 'ENOENT') { - return cb(null) - } - if (er.code === 'EPERM') { - return (isWindows) - ? fixWinEPERM(p, options, er, cb) - : rmdir(p, options, er, cb) - } - if (er.code === 'EISDIR') { - return rmdir(p, options, er, cb) - } - } - return cb(er) - }) - }) +Object.defineProperty(exports, "__esModule", ({ value: true })); +const path = __nccwpck_require__(16928); +const deep_1 = __nccwpck_require__(26595); +const entry_1 = __nccwpck_require__(94193); +const error_1 = __nccwpck_require__(94591); +const entry_2 = __nccwpck_require__(33826); +class Provider { + constructor(_settings) { + this._settings = _settings; + this.errorFilter = new error_1.default(this._settings); + this.entryFilter = new entry_1.default(this._settings, this._getMicromatchOptions()); + this.deepFilter = new deep_1.default(this._settings, this._getMicromatchOptions()); + this.entryTransformer = new entry_2.default(this._settings); + } + _getRootDirectory(task) { + return path.resolve(this._settings.cwd, task.base); + } + _getReaderOptions(task) { + const basePath = task.base === '.' ? '' : task.base; + return { + basePath, + pathSegmentSeparator: '/', + concurrency: this._settings.concurrency, + deepFilter: this.deepFilter.getFilter(basePath, task.positive, task.negative), + entryFilter: this.entryFilter.getFilter(task.positive, task.negative), + errorFilter: this.errorFilter.getFilter(), + followSymbolicLinks: this._settings.followSymbolicLinks, + fs: this._settings.fs, + stats: this._settings.stats, + throwErrorOnBrokenSymbolicLink: this._settings.throwErrorOnBrokenSymbolicLink, + transform: this.entryTransformer.getTransformer() + }; + } + _getMicromatchOptions() { + return { + dot: this._settings.dot, + matchBase: this._settings.baseNameMatch, + nobrace: !this._settings.braceExpansion, + nocase: !this._settings.caseSensitiveMatch, + noext: !this._settings.extglob, + noglobstar: !this._settings.globstar, + posix: true, + strictSlashes: false + }; + } } +exports["default"] = Provider; -function fixWinEPERM (p, options, er, cb) { - assert(p) - assert(options) - assert(typeof cb === 'function') - if (er) { - assert(er instanceof Error) - } - options.chmod(p, 0o666, er2 => { - if (er2) { - cb(er2.code === 'ENOENT' ? null : er) - } else { - options.stat(p, (er3, stats) => { - if (er3) { - cb(er3.code === 'ENOENT' ? null : er) - } else if (stats.isDirectory()) { - rmdir(p, options, er, cb) - } else { - options.unlink(p, cb) - } - }) - } - }) -} +/***/ }), -function fixWinEPERMSync (p, options, er) { - let stats +/***/ 80613: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - assert(p) - assert(options) - if (er) { - assert(er instanceof Error) - } +"use strict"; - try { - options.chmodSync(p, 0o666) - } catch (er2) { - if (er2.code === 'ENOENT') { - return - } else { - throw er +Object.defineProperty(exports, "__esModule", ({ value: true })); +const stream_1 = __nccwpck_require__(2203); +const stream_2 = __nccwpck_require__(89491); +const provider_1 = __nccwpck_require__(5420); +class ProviderStream extends provider_1.default { + constructor() { + super(...arguments); + this._reader = new stream_2.default(this._settings); } - } - - try { - stats = options.statSync(p) - } catch (er3) { - if (er3.code === 'ENOENT') { - return - } else { - throw er + read(task) { + const root = this._getRootDirectory(task); + const options = this._getReaderOptions(task); + const source = this.api(root, task, options); + const destination = new stream_1.Readable({ objectMode: true, read: () => { } }); + source + .once('error', (error) => destination.emit('error', error)) + .on('data', (entry) => destination.emit('data', options.transform(entry))) + .once('end', () => destination.emit('end')); + destination + .once('close', () => source.destroy()); + return destination; + } + api(root, task, options) { + if (task.dynamic) { + return this._reader.dynamic(root, options); + } + return this._reader.static(task.patterns, options); } - } - - if (stats.isDirectory()) { - rmdirSync(p, options, er) - } else { - options.unlinkSync(p) - } } +exports["default"] = ProviderStream; -function rmdir (p, options, originalEr, cb) { - assert(p) - assert(options) - if (originalEr) { - assert(originalEr instanceof Error) - } - assert(typeof cb === 'function') - // try to rmdir first, and only readdir on ENOTEMPTY or EEXIST (SunOS) - // if we guessed wrong, and it's not a directory, then - // raise the original error. - options.rmdir(p, er => { - if (er && (er.code === 'ENOTEMPTY' || er.code === 'EEXIST' || er.code === 'EPERM')) { - rmkids(p, options, cb) - } else if (er && er.code === 'ENOTDIR') { - cb(originalEr) - } else { - cb(er) +/***/ }), + +/***/ 81850: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +const sync_1 = __nccwpck_require__(95908); +const provider_1 = __nccwpck_require__(5420); +class ProviderSync extends provider_1.default { + constructor() { + super(...arguments); + this._reader = new sync_1.default(this._settings); + } + read(task) { + const root = this._getRootDirectory(task); + const options = this._getReaderOptions(task); + const entries = this.api(root, task, options); + return entries.map(options.transform); + } + api(root, task, options) { + if (task.dynamic) { + return this._reader.dynamic(root, options); + } + return this._reader.static(task.patterns, options); } - }) } +exports["default"] = ProviderSync; -function rmkids (p, options, cb) { - assert(p) - assert(options) - assert(typeof cb === 'function') - options.readdir(p, (er, files) => { - if (er) return cb(er) +/***/ }), - let n = files.length - let errState +/***/ 33826: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - if (n === 0) return options.rmdir(p, cb) +"use strict"; - files.forEach(f => { - rimraf(path.join(p, f), options, er => { - if (errState) { - return +Object.defineProperty(exports, "__esModule", ({ value: true })); +const utils = __nccwpck_require__(1062); +class EntryTransformer { + constructor(_settings) { + this._settings = _settings; + } + getTransformer() { + return (entry) => this._transform(entry); + } + _transform(entry) { + let filepath = entry.path; + if (this._settings.absolute) { + filepath = utils.path.makeAbsolute(this._settings.cwd, filepath); + filepath = utils.path.unixify(filepath); } - if (er) return cb(errState = er) - if (--n === 0) { - options.rmdir(p, cb) + if (this._settings.markDirectories && entry.dirent.isDirectory()) { + filepath += '/'; } - }) - }) - }) + if (!this._settings.objectMode) { + return filepath; + } + return Object.assign(Object.assign({}, entry), { path: filepath }); + } } +exports["default"] = EntryTransformer; -// this looks simpler, and is strictly *faster*, but will -// tie up the JavaScript thread and fail on excessively -// deep directory trees. -function rimrafSync (p, options) { - let st - options = options || {} - defaults(options) +/***/ }), - assert(p, 'rimraf: missing path') - assert.strictEqual(typeof p, 'string', 'rimraf: path should be a string') - assert(options, 'rimraf: missing options') - assert.strictEqual(typeof options, 'object', 'rimraf: options should be object') +/***/ 79439: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - try { - st = options.lstatSync(p) - } catch (er) { - if (er.code === 'ENOENT') { - return - } +"use strict"; - // Windows can EPERM on stat. Life is suffering. - if (er.code === 'EPERM' && isWindows) { - fixWinEPERMSync(p, options, er) +Object.defineProperty(exports, "__esModule", ({ value: true })); +const fsWalk = __nccwpck_require__(83989); +const reader_1 = __nccwpck_require__(79692); +const stream_1 = __nccwpck_require__(89491); +class ReaderAsync extends reader_1.default { + constructor() { + super(...arguments); + this._walkAsync = fsWalk.walk; + this._readerStream = new stream_1.default(this._settings); } - } - - try { - // sunos lets the root user unlink directories, which is... weird. - if (st && st.isDirectory()) { - rmdirSync(p, options, null) - } else { - options.unlinkSync(p) + dynamic(root, options) { + return new Promise((resolve, reject) => { + this._walkAsync(root, options, (error, entries) => { + if (error === null) { + resolve(entries); + } + else { + reject(error); + } + }); + }); } - } catch (er) { - if (er.code === 'ENOENT') { - return - } else if (er.code === 'EPERM') { - return isWindows ? fixWinEPERMSync(p, options, er) : rmdirSync(p, options, er) - } else if (er.code !== 'EISDIR') { - throw er + async static(patterns, options) { + const entries = []; + const stream = this._readerStream.static(patterns, options); + // After #235, replace it with an asynchronous iterator. + return new Promise((resolve, reject) => { + stream.once('error', reject); + stream.on('data', (entry) => entries.push(entry)); + stream.once('end', () => resolve(entries)); + }); } - rmdirSync(p, options, er) - } } +exports["default"] = ReaderAsync; -function rmdirSync (p, options, originalEr) { - assert(p) - assert(options) - if (originalEr) { - assert(originalEr instanceof Error) - } - try { - options.rmdirSync(p) - } catch (er) { - if (er.code === 'ENOTDIR') { - throw originalEr - } else if (er.code === 'ENOTEMPTY' || er.code === 'EEXIST' || er.code === 'EPERM') { - rmkidsSync(p, options) - } else if (er.code !== 'ENOENT') { - throw er - } - } -} +/***/ }), -function rmkidsSync (p, options) { - assert(p) - assert(options) - options.readdirSync(p).forEach(f => rimrafSync(path.join(p, f), options)) +/***/ 79692: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - if (isWindows) { - // We only end up here once we got ENOTEMPTY at least once, and - // at this point, we are guaranteed to have removed all the kids. - // So, we know that it won't be ENOENT or ENOTDIR or anything else. - // try really hard to delete stuff on windows, because it has a - // PROFOUNDLY annoying habit of not closing handles promptly when - // files are deleted, resulting in spurious ENOTEMPTY errors. - const startTime = Date.now() - do { - try { - const ret = options.rmdirSync(p, options) - return ret - } catch (er) { } - } while (Date.now() - startTime < 500) // give up after 500ms - } else { - const ret = options.rmdirSync(p, options) - return ret - } -} +"use strict"; -module.exports = rimraf -rimraf.sync = rimrafSync +Object.defineProperty(exports, "__esModule", ({ value: true })); +const path = __nccwpck_require__(16928); +const fsStat = __nccwpck_require__(80794); +const utils = __nccwpck_require__(1062); +class Reader { + constructor(_settings) { + this._settings = _settings; + this._fsStatSettings = new fsStat.Settings({ + followSymbolicLink: this._settings.followSymbolicLinks, + fs: this._settings.fs, + throwErrorOnBrokenSymbolicLink: this._settings.followSymbolicLinks + }); + } + _getFullEntryPath(filepath) { + return path.resolve(this._settings.cwd, filepath); + } + _makeEntry(stats, pattern) { + const entry = { + name: pattern, + path: pattern, + dirent: utils.fs.createDirentFromStats(pattern, stats) + }; + if (this._settings.stats) { + entry.stats = stats; + } + return entry; + } + _isFatalError(error) { + return !utils.errno.isEnoentCodeError(error) && !this._settings.suppressErrors; + } +} +exports["default"] = Reader; /***/ }), -/***/ 44973: -/***/ ((module) => { +/***/ 89491: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -/* eslint-disable node/no-deprecated-api */ -module.exports = function (size) { - if (typeof Buffer.allocUnsafe === 'function') { - try { - return Buffer.allocUnsafe(size) - } catch (e) { - return new Buffer(size) +Object.defineProperty(exports, "__esModule", ({ value: true })); +const stream_1 = __nccwpck_require__(2203); +const fsStat = __nccwpck_require__(80794); +const fsWalk = __nccwpck_require__(83989); +const reader_1 = __nccwpck_require__(79692); +class ReaderStream extends reader_1.default { + constructor() { + super(...arguments); + this._walkStream = fsWalk.walkStream; + this._stat = fsStat.stat; + } + dynamic(root, options) { + return this._walkStream(root, options); + } + static(patterns, options) { + const filepaths = patterns.map(this._getFullEntryPath, this); + const stream = new stream_1.PassThrough({ objectMode: true }); + stream._write = (index, _enc, done) => { + return this._getEntry(filepaths[index], patterns[index], options) + .then((entry) => { + if (entry !== null && options.entryFilter(entry)) { + stream.push(entry); + } + if (index === filepaths.length - 1) { + stream.end(); + } + done(); + }) + .catch(done); + }; + for (let i = 0; i < filepaths.length; i++) { + stream.write(i); + } + return stream; + } + _getEntry(filepath, pattern, options) { + return this._getStat(filepath) + .then((stats) => this._makeEntry(stats, pattern)) + .catch((error) => { + if (options.errorFilter(error)) { + return null; + } + throw error; + }); + } + _getStat(filepath) { + return new Promise((resolve, reject) => { + this._stat(filepath, this._fsStatSettings, (error, stats) => { + return error === null ? resolve(stats) : reject(error); + }); + }); } - } - return new Buffer(size) } +exports["default"] = ReaderStream; /***/ }), -/***/ 91349: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/***/ 95908: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; +Object.defineProperty(exports, "__esModule", ({ value: true })); +const fsStat = __nccwpck_require__(80794); +const fsWalk = __nccwpck_require__(83989); +const reader_1 = __nccwpck_require__(79692); +class ReaderSync extends reader_1.default { + constructor() { + super(...arguments); + this._walkSync = fsWalk.walkSync; + this._statSync = fsStat.statSync; + } + dynamic(root, options) { + return this._walkSync(root, options); + } + static(patterns, options) { + const entries = []; + for (const pattern of patterns) { + const filepath = this._getFullEntryPath(pattern); + const entry = this._getEntry(filepath, pattern, options); + if (entry === null || !options.entryFilter(entry)) { + continue; + } + entries.push(entry); + } + return entries; + } + _getEntry(filepath, pattern, options) { + try { + const stats = this._getStat(filepath); + return this._makeEntry(stats, pattern); + } + catch (error) { + if (options.errorFilter(error)) { + return null; + } + throw error; + } + } + _getStat(filepath) { + return this._statSync(filepath, this._fsStatSettings); + } +} +exports["default"] = ReaderSync; -const fs = __nccwpck_require__(61404) -const path = __nccwpck_require__(16928) -const NODE_VERSION_MAJOR_WITH_BIGINT = 10 -const NODE_VERSION_MINOR_WITH_BIGINT = 5 -const NODE_VERSION_PATCH_WITH_BIGINT = 0 -const nodeVersion = process.versions.node.split('.') -const nodeVersionMajor = Number.parseInt(nodeVersion[0], 10) -const nodeVersionMinor = Number.parseInt(nodeVersion[1], 10) -const nodeVersionPatch = Number.parseInt(nodeVersion[2], 10) +/***/ }), -function nodeSupportsBigInt () { - if (nodeVersionMajor > NODE_VERSION_MAJOR_WITH_BIGINT) { - return true - } else if (nodeVersionMajor === NODE_VERSION_MAJOR_WITH_BIGINT) { - if (nodeVersionMinor > NODE_VERSION_MINOR_WITH_BIGINT) { - return true - } else if (nodeVersionMinor === NODE_VERSION_MINOR_WITH_BIGINT) { - if (nodeVersionPatch >= NODE_VERSION_PATCH_WITH_BIGINT) { - return true - } - } - } - return false -} +/***/ 34763: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -function getStats (src, dest, cb) { - if (nodeSupportsBigInt()) { - fs.stat(src, { bigint: true }, (err, srcStat) => { - if (err) return cb(err) - fs.stat(dest, { bigint: true }, (err, destStat) => { - if (err) { - if (err.code === 'ENOENT') return cb(null, { srcStat, destStat: null }) - return cb(err) +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.DEFAULT_FILE_SYSTEM_ADAPTER = void 0; +const fs = __nccwpck_require__(79896); +const os = __nccwpck_require__(70857); +/** + * The `os.cpus` method can return zero. We expect the number of cores to be greater than zero. + * https://github.com/nodejs/node/blob/7faeddf23a98c53896f8b574a6e66589e8fb1eb8/lib/os.js#L106-L107 + */ +const CPU_COUNT = Math.max(os.cpus().length, 1); +exports.DEFAULT_FILE_SYSTEM_ADAPTER = { + lstat: fs.lstat, + lstatSync: fs.lstatSync, + stat: fs.stat, + statSync: fs.statSync, + readdir: fs.readdir, + readdirSync: fs.readdirSync +}; +class Settings { + constructor(_options = {}) { + this._options = _options; + this.absolute = this._getValue(this._options.absolute, false); + this.baseNameMatch = this._getValue(this._options.baseNameMatch, false); + this.braceExpansion = this._getValue(this._options.braceExpansion, true); + this.caseSensitiveMatch = this._getValue(this._options.caseSensitiveMatch, true); + this.concurrency = this._getValue(this._options.concurrency, CPU_COUNT); + this.cwd = this._getValue(this._options.cwd, process.cwd()); + this.deep = this._getValue(this._options.deep, Infinity); + this.dot = this._getValue(this._options.dot, false); + this.extglob = this._getValue(this._options.extglob, true); + this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, true); + this.fs = this._getFileSystemMethods(this._options.fs); + this.globstar = this._getValue(this._options.globstar, true); + this.ignore = this._getValue(this._options.ignore, []); + this.markDirectories = this._getValue(this._options.markDirectories, false); + this.objectMode = this._getValue(this._options.objectMode, false); + this.onlyDirectories = this._getValue(this._options.onlyDirectories, false); + this.onlyFiles = this._getValue(this._options.onlyFiles, true); + this.stats = this._getValue(this._options.stats, false); + this.suppressErrors = this._getValue(this._options.suppressErrors, false); + this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, false); + this.unique = this._getValue(this._options.unique, true); + if (this.onlyDirectories) { + this.onlyFiles = false; } - return cb(null, { srcStat, destStat }) - }) - }) - } else { - fs.stat(src, (err, srcStat) => { - if (err) return cb(err) - fs.stat(dest, (err, destStat) => { - if (err) { - if (err.code === 'ENOENT') return cb(null, { srcStat, destStat: null }) - return cb(err) + if (this.stats) { + this.objectMode = true; } - return cb(null, { srcStat, destStat }) - }) - }) - } -} - -function getStatsSync (src, dest) { - let srcStat, destStat - if (nodeSupportsBigInt()) { - srcStat = fs.statSync(src, { bigint: true }) - } else { - srcStat = fs.statSync(src) - } - try { - if (nodeSupportsBigInt()) { - destStat = fs.statSync(dest, { bigint: true }) - } else { - destStat = fs.statSync(dest) + // Remove the cast to the array in the next major (#404). + this.ignore = [].concat(this.ignore); } - } catch (err) { - if (err.code === 'ENOENT') return { srcStat, destStat: null } - throw err - } - return { srcStat, destStat } -} - -function checkPaths (src, dest, funcName, cb) { - getStats(src, dest, (err, stats) => { - if (err) return cb(err) - const { srcStat, destStat } = stats - if (destStat && destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev) { - return cb(new Error('Source and destination must not be the same.')) + _getValue(option, value) { + return option === undefined ? value : option; } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - return cb(new Error(errMsg(src, dest, funcName))) + _getFileSystemMethods(methods = {}) { + return Object.assign(Object.assign({}, exports.DEFAULT_FILE_SYSTEM_ADAPTER), methods); } - return cb(null, { srcStat, destStat }) - }) } +exports["default"] = Settings; -function checkPathsSync (src, dest, funcName) { - const { srcStat, destStat } = getStatsSync(src, dest) - if (destStat && destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev) { - throw new Error('Source and destination must not be the same.') - } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - throw new Error(errMsg(src, dest, funcName)) - } - return { srcStat, destStat } -} -// recursively check if dest parent is a subdirectory of src. -// It works for all file types including symlinks since it -// checks the src and dest inodes. It starts from the deepest -// parent and stops once it reaches the src parent or the root path. -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 cb() - if (nodeSupportsBigInt()) { - fs.stat(destParent, { bigint: true }, (err, destStat) => { - if (err) { - if (err.code === 'ENOENT') return cb() - return cb(err) - } - if (destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev) { - return cb(new Error(errMsg(src, dest, funcName))) - } - return checkParentPaths(src, srcStat, destParent, funcName, cb) - }) - } else { - fs.stat(destParent, (err, destStat) => { - if (err) { - if (err.code === 'ENOENT') return cb() - return cb(err) - } - if (destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev) { - 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)) - const destParent = path.resolve(path.dirname(dest)) - if (destParent === srcParent || destParent === path.parse(destParent).root) return - let destStat - try { - if (nodeSupportsBigInt()) { - destStat = fs.statSync(destParent, { bigint: true }) - } else { - destStat = fs.statSync(destParent) - } - } catch (err) { - if (err.code === 'ENOENT') return - throw err - } - if (destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev) { - throw new Error(errMsg(src, dest, funcName)) - } - return checkParentPathsSync(src, srcStat, destParent, funcName) -} +/***/ 14811: +/***/ ((__unused_webpack_module, exports) => { -// return true if dest is a subdir of src, otherwise false. -// It only checks the path strings. -function isSrcSubdir (src, dest) { - const srcArr = path.resolve(src).split(path.sep).filter(i => i) - const destArr = path.resolve(dest).split(path.sep).filter(i => i) - return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true) -} +"use strict"; -function errMsg (src, dest, funcName) { - return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.` +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.splitWhen = exports.flatten = void 0; +function flatten(items) { + return items.reduce((collection, item) => [].concat(collection, item), []); } - -module.exports = { - checkPaths, - checkPathsSync, - checkParentPaths, - checkParentPathsSync, - isSrcSubdir +exports.flatten = flatten; +function splitWhen(items, predicate) { + const result = [[]]; + let groupIndex = 0; + for (const item of items) { + if (predicate(item)) { + groupIndex++; + result[groupIndex] = []; + } + else { + result[groupIndex].push(item); + } + } + return result; } +exports.splitWhen = splitWhen; /***/ }), -/***/ 12804: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/***/ 49738: +/***/ ((__unused_webpack_module, exports) => { "use strict"; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.isEnoentCodeError = void 0; +function isEnoentCodeError(error) { + return error.code === 'ENOENT'; +} +exports.isEnoentCodeError = isEnoentCodeError; -const fs = __nccwpck_require__(61404) -const os = __nccwpck_require__(70857) -const path = __nccwpck_require__(16928) -// HFS, ext{2,3}, FAT do not, Node.js v0.10 does not -function hasMillisResSync () { - let tmpfile = path.join('millis-test-sync' + Date.now().toString() + Math.random().toString().slice(2)) - tmpfile = path.join(os.tmpdir(), tmpfile) +/***/ }), - // 550 millis past UNIX epoch - const d = new Date(1435410243862) - fs.writeFileSync(tmpfile, 'https://github.com/jprichardson/node-fs-extra/pull/141') - const fd = fs.openSync(tmpfile, 'r+') - fs.futimesSync(fd, d, d) - fs.closeSync(fd) - return fs.statSync(tmpfile).mtime > 1435410243000 -} - -function hasMillisRes (callback) { - let tmpfile = path.join('millis-test' + Date.now().toString() + Math.random().toString().slice(2)) - tmpfile = path.join(os.tmpdir(), tmpfile) - - // 550 millis past UNIX epoch - const d = new Date(1435410243862) - fs.writeFile(tmpfile, 'https://github.com/jprichardson/node-fs-extra/pull/141', err => { - if (err) return callback(err) - fs.open(tmpfile, 'r+', (err, fd) => { - if (err) return callback(err) - fs.futimes(fd, d, d, err => { - if (err) return callback(err) - fs.close(fd, err => { - if (err) return callback(err) - fs.stat(tmpfile, (err, stats) => { - if (err) return callback(err) - callback(null, stats.mtime > 1435410243000) - }) - }) - }) - }) - }) -} - -function timeRemoveMillis (timestamp) { - if (typeof timestamp === 'number') { - return Math.floor(timestamp / 1000) * 1000 - } else if (timestamp instanceof Date) { - return new Date(Math.floor(timestamp.getTime() / 1000) * 1000) - } else { - throw new Error('fs-extra: timeRemoveMillis() unknown parameter type') - } -} - -function utimesMillis (path, atime, mtime, callback) { - // if (!HAS_MILLIS_RES) return fs.utimes(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+') - fs.futimesSync(fd, atime, mtime) - return fs.closeSync(fd) -} - -module.exports = { - hasMillisRes, - hasMillisResSync, - timeRemoveMillis, - utimesMillis, - utimesMillisSync -} - - -/***/ }), - -/***/ 69988: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ 70271: +/***/ ((__unused_webpack_module, exports) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0; -const fs = __nccwpck_require__(79896); -exports.FILE_SYSTEM_ADAPTER = { - lstat: fs.lstat, - stat: fs.stat, - lstatSync: fs.lstatSync, - statSync: fs.statSync, - readdir: fs.readdir, - readdirSync: fs.readdirSync -}; -function createFileSystemAdapter(fsMethods) { - if (fsMethods === undefined) { - return exports.FILE_SYSTEM_ADAPTER; +exports.createDirentFromStats = void 0; +class DirentFromStats { + constructor(name, stats) { + this.name = name; + this.isBlockDevice = stats.isBlockDevice.bind(stats); + this.isCharacterDevice = stats.isCharacterDevice.bind(stats); + this.isDirectory = stats.isDirectory.bind(stats); + this.isFIFO = stats.isFIFO.bind(stats); + this.isFile = stats.isFile.bind(stats); + this.isSocket = stats.isSocket.bind(stats); + this.isSymbolicLink = stats.isSymbolicLink.bind(stats); } - return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods); } -exports.createFileSystemAdapter = createFileSystemAdapter; +function createDirentFromStats(name, stats) { + return new DirentFromStats(name, stats); +} +exports.createDirentFromStats = createDirentFromStats; /***/ }), -/***/ 9459: -/***/ ((__unused_webpack_module, exports) => { +/***/ 1062: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.IS_SUPPORT_READDIR_WITH_FILE_TYPES = void 0; -const NODE_PROCESS_VERSION_PARTS = process.versions.node.split('.'); -if (NODE_PROCESS_VERSION_PARTS[0] === undefined || NODE_PROCESS_VERSION_PARTS[1] === undefined) { - throw new Error(`Unexpected behavior. The 'process.versions.node' variable has invalid value: ${process.versions.node}`); -} -const MAJOR_VERSION = Number.parseInt(NODE_PROCESS_VERSION_PARTS[0], 10); -const MINOR_VERSION = Number.parseInt(NODE_PROCESS_VERSION_PARTS[1], 10); -const SUPPORTED_MAJOR_VERSION = 10; -const SUPPORTED_MINOR_VERSION = 10; -const IS_MATCHED_BY_MAJOR = MAJOR_VERSION > SUPPORTED_MAJOR_VERSION; -const IS_MATCHED_BY_MAJOR_AND_MINOR = MAJOR_VERSION === SUPPORTED_MAJOR_VERSION && MINOR_VERSION >= SUPPORTED_MINOR_VERSION; -/** - * IS `true` for Node.js 10.10 and greater. - */ -exports.IS_SUPPORT_READDIR_WITH_FILE_TYPES = IS_MATCHED_BY_MAJOR || IS_MATCHED_BY_MAJOR_AND_MINOR; +exports.string = exports.stream = exports.pattern = exports.path = exports.fs = exports.errno = exports.array = void 0; +const array = __nccwpck_require__(14811); +exports.array = array; +const errno = __nccwpck_require__(49738); +exports.errno = errno; +const fs = __nccwpck_require__(70271); +exports.fs = fs; +const path = __nccwpck_require__(9519); +exports.path = path; +const pattern = __nccwpck_require__(37044); +exports.pattern = pattern; +const stream = __nccwpck_require__(13732); +exports.stream = stream; +const string = __nccwpck_require__(55589); +exports.string = string; /***/ }), -/***/ 44482: +/***/ 9519: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.Settings = exports.scandirSync = exports.scandir = void 0; -const async = __nccwpck_require__(69359); -const sync = __nccwpck_require__(79588); -const settings_1 = __nccwpck_require__(42321); -exports.Settings = settings_1.default; -function scandir(path, optionsOrSettingsOrCallback, callback) { - if (typeof optionsOrSettingsOrCallback === 'function') { - async.read(path, getSettings(), optionsOrSettingsOrCallback); - return; - } - async.read(path, getSettings(optionsOrSettingsOrCallback), callback); +exports.convertPosixPathToPattern = exports.convertWindowsPathToPattern = exports.convertPathToPattern = exports.escapePosixPath = exports.escapeWindowsPath = exports.escape = exports.removeLeadingDotSegment = exports.makeAbsolute = exports.unixify = void 0; +const os = __nccwpck_require__(70857); +const path = __nccwpck_require__(16928); +const IS_WINDOWS_PLATFORM = os.platform() === 'win32'; +const LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2; // ./ or .\\ +/** + * All non-escaped special characters. + * Posix: ()*?[]{|}, !+@ before (, ! at the beginning, \\ before non-special characters. + * Windows: (){}[], !+@ before (, ! at the beginning. + */ +const POSIX_UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()*?[\]{|}]|^!|[!+@](?=\()|\\(?![!()*+?@[\]{|}]))/g; +const WINDOWS_UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()[\]{}]|^!|[!+@](?=\())/g; +/** + * The device path (\\.\ or \\?\). + * https://learn.microsoft.com/en-us/dotnet/standard/io/file-path-formats#dos-device-paths + */ +const DOS_DEVICE_PATH_RE = /^\\\\([.?])/; +/** + * All backslashes except those escaping special characters. + * Windows: !()+@{} + * https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file#naming-conventions + */ +const WINDOWS_BACKSLASHES_RE = /\\(?![!()+@[\]{}])/g; +/** + * Designed to work only with simple paths: `dir\\file`. + */ +function unixify(filepath) { + return filepath.replace(/\\/g, '/'); } -exports.scandir = scandir; -function scandirSync(path, optionsOrSettings) { - const settings = getSettings(optionsOrSettings); - return sync.read(path, settings); +exports.unixify = unixify; +function makeAbsolute(cwd, filepath) { + return path.resolve(cwd, filepath); } -exports.scandirSync = scandirSync; -function getSettings(settingsOrOptions = {}) { - if (settingsOrOptions instanceof settings_1.default) { - return settingsOrOptions; +exports.makeAbsolute = makeAbsolute; +function removeLeadingDotSegment(entry) { + // We do not use `startsWith` because this is 10x slower than current implementation for some cases. + // eslint-disable-next-line @typescript-eslint/prefer-string-starts-ends-with + if (entry.charAt(0) === '.') { + const secondCharactery = entry.charAt(1); + if (secondCharactery === '/' || secondCharactery === '\\') { + return entry.slice(LEADING_DOT_SEGMENT_CHARACTERS_COUNT); + } } - return new settings_1.default(settingsOrOptions); + return entry; +} +exports.removeLeadingDotSegment = removeLeadingDotSegment; +exports.escape = IS_WINDOWS_PLATFORM ? escapeWindowsPath : escapePosixPath; +function escapeWindowsPath(pattern) { + return pattern.replace(WINDOWS_UNESCAPED_GLOB_SYMBOLS_RE, '\\$2'); +} +exports.escapeWindowsPath = escapeWindowsPath; +function escapePosixPath(pattern) { + return pattern.replace(POSIX_UNESCAPED_GLOB_SYMBOLS_RE, '\\$2'); +} +exports.escapePosixPath = escapePosixPath; +exports.convertPathToPattern = IS_WINDOWS_PLATFORM ? convertWindowsPathToPattern : convertPosixPathToPattern; +function convertWindowsPathToPattern(filepath) { + return escapeWindowsPath(filepath) + .replace(DOS_DEVICE_PATH_RE, '//$1') + .replace(WINDOWS_BACKSLASHES_RE, '/'); +} +exports.convertWindowsPathToPattern = convertWindowsPathToPattern; +function convertPosixPathToPattern(filepath) { + return escapePosixPath(filepath); } +exports.convertPosixPathToPattern = convertPosixPathToPattern; /***/ }), -/***/ 69359: +/***/ 37044: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.readdir = exports.readdirWithFileTypes = exports.read = void 0; -const fsStat = __nccwpck_require__(80794); -const rpl = __nccwpck_require__(90347); -const constants_1 = __nccwpck_require__(9459); -const utils = __nccwpck_require__(76556); -const common = __nccwpck_require__(7254); -function read(directory, settings, callback) { - if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) { - readdirWithFileTypes(directory, settings, callback); - return; - } - readdir(directory, settings, callback); +exports.isAbsolute = exports.partitionAbsoluteAndRelative = exports.removeDuplicateSlashes = exports.matchAny = exports.convertPatternsToRe = exports.makeRe = exports.getPatternParts = exports.expandBraceExpansion = exports.expandPatternsWithBraceExpansion = exports.isAffectDepthOfReadingPattern = exports.endsWithSlashGlobStar = exports.hasGlobStar = exports.getBaseDirectory = exports.isPatternRelatedToParentDirectory = exports.getPatternsOutsideCurrentDirectory = exports.getPatternsInsideCurrentDirectory = exports.getPositivePatterns = exports.getNegativePatterns = exports.isPositivePattern = exports.isNegativePattern = exports.convertToNegativePattern = exports.convertToPositivePattern = exports.isDynamicPattern = exports.isStaticPattern = void 0; +const path = __nccwpck_require__(16928); +const globParent = __nccwpck_require__(62437); +const micromatch = __nccwpck_require__(77805); +const GLOBSTAR = '**'; +const ESCAPE_SYMBOL = '\\'; +const COMMON_GLOB_SYMBOLS_RE = /[*?]|^!/; +const REGEX_CHARACTER_CLASS_SYMBOLS_RE = /\[[^[]*]/; +const REGEX_GROUP_SYMBOLS_RE = /(?:^|[^!*+?@])\([^(]*\|[^|]*\)/; +const GLOB_EXTENSION_SYMBOLS_RE = /[!*+?@]\([^(]*\)/; +const BRACE_EXPANSION_SEPARATORS_RE = /,|\.\./; +/** + * Matches a sequence of two or more consecutive slashes, excluding the first two slashes at the beginning of the string. + * The latter is due to the presence of the device path at the beginning of the UNC path. + */ +const DOUBLE_SLASH_RE = /(?!^)\/{2,}/g; +function isStaticPattern(pattern, options = {}) { + return !isDynamicPattern(pattern, options); } -exports.read = read; -function readdirWithFileTypes(directory, settings, callback) { - settings.fs.readdir(directory, { withFileTypes: true }, (readdirError, dirents) => { - if (readdirError !== null) { - callFailureCallback(callback, readdirError); - return; - } - const entries = dirents.map((dirent) => ({ - dirent, - name: dirent.name, - path: common.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator) - })); - if (!settings.followSymbolicLinks) { - callSuccessCallback(callback, entries); - return; - } - const tasks = entries.map((entry) => makeRplTaskEntry(entry, settings)); - rpl(tasks, (rplError, rplEntries) => { - if (rplError !== null) { - callFailureCallback(callback, rplError); - return; - } - callSuccessCallback(callback, rplEntries); - }); - }); -} -exports.readdirWithFileTypes = readdirWithFileTypes; -function makeRplTaskEntry(entry, settings) { - return (done) => { - if (!entry.dirent.isSymbolicLink()) { - done(null, entry); - return; - } - settings.fs.stat(entry.path, (statError, stats) => { - if (statError !== null) { - if (settings.throwErrorOnBrokenSymbolicLink) { - done(statError); - return; - } - done(null, entry); - return; - } - entry.dirent = utils.fs.createDirentFromStats(entry.name, stats); - done(null, entry); - }); - }; -} -function readdir(directory, settings, callback) { - settings.fs.readdir(directory, (readdirError, names) => { - if (readdirError !== null) { - callFailureCallback(callback, readdirError); - return; - } - const tasks = names.map((name) => { - const path = common.joinPathSegments(directory, name, settings.pathSegmentSeparator); - return (done) => { - fsStat.stat(path, settings.fsStatSettings, (error, stats) => { - if (error !== null) { - done(error); - return; - } - const entry = { - name, - path, - dirent: utils.fs.createDirentFromStats(name, stats) - }; - if (settings.stats) { - entry.stats = stats; - } - done(null, entry); - }); - }; - }); - rpl(tasks, (rplError, entries) => { - if (rplError !== null) { - callFailureCallback(callback, rplError); - return; - } - callSuccessCallback(callback, entries); - }); - }); -} -exports.readdir = readdir; -function callFailureCallback(callback, error) { - callback(error); -} -function callSuccessCallback(callback, result) { - callback(null, result); -} - - -/***/ }), - -/***/ 7254: -/***/ ((__unused_webpack_module, exports) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.joinPathSegments = void 0; -function joinPathSegments(a, b, separator) { +exports.isStaticPattern = isStaticPattern; +function isDynamicPattern(pattern, options = {}) { /** - * The correct handling of cases when the first segment is a root (`/`, `C:/`) or UNC path (`//?/C:/`). + * A special case with an empty string is necessary for matching patterns that start with a forward slash. + * An empty string cannot be a dynamic pattern. + * For example, the pattern `/lib/*` will be spread into parts: '', 'lib', '*'. */ - if (a.endsWith(separator)) { - return a + b; + if (pattern === '') { + return false; } - return a + separator + b; -} -exports.joinPathSegments = joinPathSegments; - - -/***/ }), - -/***/ 79588: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.readdir = exports.readdirWithFileTypes = exports.read = void 0; -const fsStat = __nccwpck_require__(80794); -const constants_1 = __nccwpck_require__(9459); -const utils = __nccwpck_require__(76556); -const common = __nccwpck_require__(7254); -function read(directory, settings) { - if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) { - return readdirWithFileTypes(directory, settings); + /** + * When the `caseSensitiveMatch` option is disabled, all patterns must be marked as dynamic, because we cannot check + * filepath directly (without read directory). + */ + if (options.caseSensitiveMatch === false || pattern.includes(ESCAPE_SYMBOL)) { + return true; } - return readdir(directory, settings); -} -exports.read = read; -function readdirWithFileTypes(directory, settings) { - const dirents = settings.fs.readdirSync(directory, { withFileTypes: true }); - return dirents.map((dirent) => { - const entry = { - dirent, - name: dirent.name, - path: common.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator) - }; - if (entry.dirent.isSymbolicLink() && settings.followSymbolicLinks) { - try { - const stats = settings.fs.statSync(entry.path); - entry.dirent = utils.fs.createDirentFromStats(entry.name, stats); - } - catch (error) { - if (settings.throwErrorOnBrokenSymbolicLink) { - throw error; - } - } - } - return entry; - }); -} -exports.readdirWithFileTypes = readdirWithFileTypes; -function readdir(directory, settings) { - const names = settings.fs.readdirSync(directory); - return names.map((name) => { - const entryPath = common.joinPathSegments(directory, name, settings.pathSegmentSeparator); - const stats = fsStat.statSync(entryPath, settings.fsStatSettings); - const entry = { - name, - path: entryPath, - dirent: utils.fs.createDirentFromStats(name, stats) - }; - if (settings.stats) { - entry.stats = stats; - } - return entry; - }); -} -exports.readdir = readdir; - - -/***/ }), - -/***/ 42321: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -const path = __nccwpck_require__(16928); -const fsStat = __nccwpck_require__(80794); -const fs = __nccwpck_require__(69988); -class Settings { - constructor(_options = {}) { - this._options = _options; - this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false); - this.fs = fs.createFileSystemAdapter(this._options.fs); - this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path.sep); - this.stats = this._getValue(this._options.stats, false); - this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true); - this.fsStatSettings = new fsStat.Settings({ - followSymbolicLink: this.followSymbolicLinks, - fs: this.fs, - throwErrorOnBrokenSymbolicLink: this.throwErrorOnBrokenSymbolicLink - }); + if (COMMON_GLOB_SYMBOLS_RE.test(pattern) || REGEX_CHARACTER_CLASS_SYMBOLS_RE.test(pattern) || REGEX_GROUP_SYMBOLS_RE.test(pattern)) { + return true; } - _getValue(option, value) { - return option !== null && option !== void 0 ? option : value; + if (options.extglob !== false && GLOB_EXTENSION_SYMBOLS_RE.test(pattern)) { + return true; + } + if (options.braceExpansion !== false && hasBraceExpansion(pattern)) { + return true; } + return false; } -exports["default"] = Settings; - - -/***/ }), - -/***/ 52789: -/***/ ((__unused_webpack_module, exports) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.createDirentFromStats = void 0; -class DirentFromStats { - constructor(name, stats) { - this.name = name; - this.isBlockDevice = stats.isBlockDevice.bind(stats); - this.isCharacterDevice = stats.isCharacterDevice.bind(stats); - this.isDirectory = stats.isDirectory.bind(stats); - this.isFIFO = stats.isFIFO.bind(stats); - this.isFile = stats.isFile.bind(stats); - this.isSocket = stats.isSocket.bind(stats); - this.isSymbolicLink = stats.isSymbolicLink.bind(stats); +exports.isDynamicPattern = isDynamicPattern; +function hasBraceExpansion(pattern) { + const openingBraceIndex = pattern.indexOf('{'); + if (openingBraceIndex === -1) { + return false; + } + const closingBraceIndex = pattern.indexOf('}', openingBraceIndex + 1); + if (closingBraceIndex === -1) { + return false; } + const braceContent = pattern.slice(openingBraceIndex, closingBraceIndex); + return BRACE_EXPANSION_SEPARATORS_RE.test(braceContent); } -function createDirentFromStats(name, stats) { - return new DirentFromStats(name, stats); +function convertToPositivePattern(pattern) { + return isNegativePattern(pattern) ? pattern.slice(1) : pattern; } -exports.createDirentFromStats = createDirentFromStats; - - -/***/ }), - -/***/ 76556: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.fs = void 0; -const fs = __nccwpck_require__(52789); -exports.fs = fs; - - -/***/ }), - -/***/ 94076: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0; -const fs = __nccwpck_require__(79896); -exports.FILE_SYSTEM_ADAPTER = { - lstat: fs.lstat, - stat: fs.stat, - lstatSync: fs.lstatSync, - statSync: fs.statSync -}; -function createFileSystemAdapter(fsMethods) { - if (fsMethods === undefined) { - return exports.FILE_SYSTEM_ADAPTER; +exports.convertToPositivePattern = convertToPositivePattern; +function convertToNegativePattern(pattern) { + return '!' + pattern; +} +exports.convertToNegativePattern = convertToNegativePattern; +function isNegativePattern(pattern) { + return pattern.startsWith('!') && pattern[1] !== '('; +} +exports.isNegativePattern = isNegativePattern; +function isPositivePattern(pattern) { + return !isNegativePattern(pattern); +} +exports.isPositivePattern = isPositivePattern; +function getNegativePatterns(patterns) { + return patterns.filter(isNegativePattern); +} +exports.getNegativePatterns = getNegativePatterns; +function getPositivePatterns(patterns) { + return patterns.filter(isPositivePattern); +} +exports.getPositivePatterns = getPositivePatterns; +/** + * Returns patterns that can be applied inside the current directory. + * + * @example + * // ['./*', '*', 'a/*'] + * getPatternsInsideCurrentDirectory(['./*', '*', 'a/*', '../*', './../*']) + */ +function getPatternsInsideCurrentDirectory(patterns) { + return patterns.filter((pattern) => !isPatternRelatedToParentDirectory(pattern)); +} +exports.getPatternsInsideCurrentDirectory = getPatternsInsideCurrentDirectory; +/** + * Returns patterns to be expanded relative to (outside) the current directory. + * + * @example + * // ['../*', './../*'] + * getPatternsInsideCurrentDirectory(['./*', '*', 'a/*', '../*', './../*']) + */ +function getPatternsOutsideCurrentDirectory(patterns) { + return patterns.filter(isPatternRelatedToParentDirectory); +} +exports.getPatternsOutsideCurrentDirectory = getPatternsOutsideCurrentDirectory; +function isPatternRelatedToParentDirectory(pattern) { + return pattern.startsWith('..') || pattern.startsWith('./..'); +} +exports.isPatternRelatedToParentDirectory = isPatternRelatedToParentDirectory; +function getBaseDirectory(pattern) { + return globParent(pattern, { flipBackslashes: false }); +} +exports.getBaseDirectory = getBaseDirectory; +function hasGlobStar(pattern) { + return pattern.includes(GLOBSTAR); +} +exports.hasGlobStar = hasGlobStar; +function endsWithSlashGlobStar(pattern) { + return pattern.endsWith('/' + GLOBSTAR); +} +exports.endsWithSlashGlobStar = endsWithSlashGlobStar; +function isAffectDepthOfReadingPattern(pattern) { + const basename = path.basename(pattern); + return endsWithSlashGlobStar(pattern) || isStaticPattern(basename); +} +exports.isAffectDepthOfReadingPattern = isAffectDepthOfReadingPattern; +function expandPatternsWithBraceExpansion(patterns) { + return patterns.reduce((collection, pattern) => { + return collection.concat(expandBraceExpansion(pattern)); + }, []); +} +exports.expandPatternsWithBraceExpansion = expandPatternsWithBraceExpansion; +function expandBraceExpansion(pattern) { + const patterns = micromatch.braces(pattern, { expand: true, nodupes: true, keepEscaping: true }); + /** + * Sort the patterns by length so that the same depth patterns are processed side by side. + * `a/{b,}/{c,}/*` – `['a///*', 'a/b//*', 'a//c/*', 'a/b/c/*']` + */ + patterns.sort((a, b) => a.length - b.length); + /** + * Micromatch can return an empty string in the case of patterns like `{a,}`. + */ + return patterns.filter((pattern) => pattern !== ''); +} +exports.expandBraceExpansion = expandBraceExpansion; +function getPatternParts(pattern, options) { + let { parts } = micromatch.scan(pattern, Object.assign(Object.assign({}, options), { parts: true })); + /** + * The scan method returns an empty array in some cases. + * See micromatch/picomatch#58 for more details. + */ + if (parts.length === 0) { + parts = [pattern]; } - return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods); + /** + * The scan method does not return an empty part for the pattern with a forward slash. + * This is another part of micromatch/picomatch#58. + */ + if (parts[0].startsWith('/')) { + parts[0] = parts[0].slice(1); + parts.unshift(''); + } + return parts; } -exports.createFileSystemAdapter = createFileSystemAdapter; +exports.getPatternParts = getPatternParts; +function makeRe(pattern, options) { + return micromatch.makeRe(pattern, options); +} +exports.makeRe = makeRe; +function convertPatternsToRe(patterns, options) { + return patterns.map((pattern) => makeRe(pattern, options)); +} +exports.convertPatternsToRe = convertPatternsToRe; +function matchAny(entry, patternsRe) { + return patternsRe.some((patternRe) => patternRe.test(entry)); +} +exports.matchAny = matchAny; +/** + * This package only works with forward slashes as a path separator. + * Because of this, we cannot use the standard `path.normalize` method, because on Windows platform it will use of backslashes. + */ +function removeDuplicateSlashes(pattern) { + return pattern.replace(DOUBLE_SLASH_RE, '/'); +} +exports.removeDuplicateSlashes = removeDuplicateSlashes; +function partitionAbsoluteAndRelative(patterns) { + const absolute = []; + const relative = []; + for (const pattern of patterns) { + if (isAbsolute(pattern)) { + absolute.push(pattern); + } + else { + relative.push(pattern); + } + } + return [absolute, relative]; +} +exports.partitionAbsoluteAndRelative = partitionAbsoluteAndRelative; +function isAbsolute(pattern) { + return path.isAbsolute(pattern); +} +exports.isAbsolute = isAbsolute; /***/ }), -/***/ 80794: +/***/ 13732: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.statSync = exports.stat = exports.Settings = void 0; -const async = __nccwpck_require__(36103); -const sync = __nccwpck_require__(40652); -const settings_1 = __nccwpck_require__(65897); -exports.Settings = settings_1.default; -function stat(path, optionsOrSettingsOrCallback, callback) { - if (typeof optionsOrSettingsOrCallback === 'function') { - async.read(path, getSettings(), optionsOrSettingsOrCallback); - return; - } - async.read(path, getSettings(optionsOrSettingsOrCallback), callback); -} -exports.stat = stat; -function statSync(path, optionsOrSettings) { - const settings = getSettings(optionsOrSettings); - return sync.read(path, settings); +exports.merge = void 0; +const merge2 = __nccwpck_require__(26606); +function merge(streams) { + const mergedStream = merge2(streams); + streams.forEach((stream) => { + stream.once('error', (error) => mergedStream.emit('error', error)); + }); + mergedStream.once('close', () => propagateCloseEventToSources(streams)); + mergedStream.once('end', () => propagateCloseEventToSources(streams)); + return mergedStream; } -exports.statSync = statSync; -function getSettings(settingsOrOptions = {}) { - if (settingsOrOptions instanceof settings_1.default) { - return settingsOrOptions; - } - return new settings_1.default(settingsOrOptions); +exports.merge = merge; +function propagateCloseEventToSources(streams) { + streams.forEach((stream) => stream.emit('close')); } /***/ }), -/***/ 36103: +/***/ 55589: /***/ ((__unused_webpack_module, exports) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.read = void 0; -function read(path, settings, callback) { - settings.fs.lstat(path, (lstatError, lstat) => { - if (lstatError !== null) { - callFailureCallback(callback, lstatError); - return; - } - if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) { - callSuccessCallback(callback, lstat); - return; - } - settings.fs.stat(path, (statError, stat) => { - if (statError !== null) { - if (settings.throwErrorOnBrokenSymbolicLink) { - callFailureCallback(callback, statError); - return; - } - callSuccessCallback(callback, lstat); - return; - } - if (settings.markSymbolicLink) { - stat.isSymbolicLink = () => true; - } - callSuccessCallback(callback, stat); - }); - }); -} -exports.read = read; -function callFailureCallback(callback, error) { - callback(error); +exports.isEmpty = exports.isString = void 0; +function isString(input) { + return typeof input === 'string'; } -function callSuccessCallback(callback, result) { - callback(null, result); +exports.isString = isString; +function isEmpty(input) { + return input === ''; } +exports.isEmpty = isEmpty; /***/ }), -/***/ 40652: -/***/ ((__unused_webpack_module, exports) => { +/***/ 64898: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.read = void 0; -function read(path, settings) { - const lstat = settings.fs.lstatSync(path); - if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) { - return lstat; - } - try { - const stat = settings.fs.statSync(path); - if (settings.markSymbolicLink) { - stat.isSymbolicLink = () => true; - } - return stat; - } - catch (error) { - if (!settings.throwErrorOnBrokenSymbolicLink) { - return lstat; - } - throw error; - } -} -exports.read = read; - -/***/ }), +/* eslint-disable no-var */ -/***/ 65897: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +var reusify = __nccwpck_require__(14088) -"use strict"; +function fastqueue (context, worker, _concurrency) { + if (typeof context === 'function') { + _concurrency = worker + worker = context + context = null + } -Object.defineProperty(exports, "__esModule", ({ value: true })); -const fs = __nccwpck_require__(94076); -class Settings { - constructor(_options = {}) { - this._options = _options; - this.followSymbolicLink = this._getValue(this._options.followSymbolicLink, true); - this.fs = fs.createFileSystemAdapter(this._options.fs); - this.markSymbolicLink = this._getValue(this._options.markSymbolicLink, false); - this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true); - } - _getValue(option, value) { - return option !== null && option !== void 0 ? option : value; - } -} -exports["default"] = Settings; + if (!(_concurrency >= 1)) { + throw new Error('fastqueue concurrency must be equal to or greater than 1') + } + var cache = reusify(Task) + var queueHead = null + var queueTail = null + var _running = 0 + var errorHandler = null -/***/ }), + var self = { + push: push, + drain: noop, + saturated: noop, + pause: pause, + paused: false, -/***/ 83989: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + get concurrency () { + return _concurrency + }, + set concurrency (value) { + if (!(value >= 1)) { + throw new Error('fastqueue concurrency must be equal to or greater than 1') + } + _concurrency = value -"use strict"; + if (self.paused) return + for (; queueHead && _running < _concurrency;) { + _running++ + release() + } + }, -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.Settings = exports.walkStream = exports.walkSync = exports.walk = void 0; -const async_1 = __nccwpck_require__(51316); -const stream_1 = __nccwpck_require__(10390); -const sync_1 = __nccwpck_require__(37405); -const settings_1 = __nccwpck_require__(74520); -exports.Settings = settings_1.default; -function walk(directory, optionsOrSettingsOrCallback, callback) { - if (typeof optionsOrSettingsOrCallback === 'function') { - new async_1.default(directory, getSettings()).read(optionsOrSettingsOrCallback); - return; - } - new async_1.default(directory, getSettings(optionsOrSettingsOrCallback)).read(callback); -} -exports.walk = walk; -function walkSync(directory, optionsOrSettings) { - const settings = getSettings(optionsOrSettings); - const provider = new sync_1.default(directory, settings); - return provider.read(); -} -exports.walkSync = walkSync; -function walkStream(directory, optionsOrSettings) { - const settings = getSettings(optionsOrSettings); - const provider = new stream_1.default(directory, settings); - return provider.read(); -} -exports.walkStream = walkStream; -function getSettings(settingsOrOptions = {}) { - if (settingsOrOptions instanceof settings_1.default) { - return settingsOrOptions; - } - return new settings_1.default(settingsOrOptions); -} + running: running, + resume: resume, + idle: idle, + length: length, + getQueue: getQueue, + unshift: unshift, + empty: noop, + kill: kill, + killAndDrain: killAndDrain, + error: error + } + return self -/***/ }), + function running () { + return _running + } -/***/ 51316: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + function pause () { + self.paused = true + } -"use strict"; + function length () { + var current = queueHead + var counter = 0 -Object.defineProperty(exports, "__esModule", ({ value: true })); -const async_1 = __nccwpck_require__(59134); -class AsyncProvider { - constructor(_root, _settings) { - this._root = _root; - this._settings = _settings; - this._reader = new async_1.default(this._root, this._settings); - this._storage = []; - } - read(callback) { - this._reader.onError((error) => { - callFailureCallback(callback, error); - }); - this._reader.onEntry((entry) => { - this._storage.push(entry); - }); - this._reader.onEnd(() => { - callSuccessCallback(callback, this._storage); - }); - this._reader.read(); + while (current) { + current = current.next + counter++ } -} -exports["default"] = AsyncProvider; -function callFailureCallback(callback, error) { - callback(error); -} -function callSuccessCallback(callback, entries) { - callback(null, entries); -} + return counter + } -/***/ }), - -/***/ 10390: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; + function getQueue () { + var current = queueHead + var tasks = [] -Object.defineProperty(exports, "__esModule", ({ value: true })); -const stream_1 = __nccwpck_require__(2203); -const async_1 = __nccwpck_require__(59134); -class StreamProvider { - constructor(_root, _settings) { - this._root = _root; - this._settings = _settings; - this._reader = new async_1.default(this._root, this._settings); - this._stream = new stream_1.Readable({ - objectMode: true, - read: () => { }, - destroy: () => { - if (!this._reader.isDestroyed) { - this._reader.destroy(); - } - } - }); - } - read() { - this._reader.onError((error) => { - this._stream.emit('error', error); - }); - this._reader.onEntry((entry) => { - this._stream.push(entry); - }); - this._reader.onEnd(() => { - this._stream.push(null); - }); - this._reader.read(); - return this._stream; + while (current) { + tasks.push(current.value) + current = current.next } -} -exports["default"] = StreamProvider; - - -/***/ }), - -/***/ 37405: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -"use strict"; + return tasks + } -Object.defineProperty(exports, "__esModule", ({ value: true })); -const sync_1 = __nccwpck_require__(63339); -class SyncProvider { - constructor(_root, _settings) { - this._root = _root; - this._settings = _settings; - this._reader = new sync_1.default(this._root, this._settings); + function resume () { + if (!self.paused) return + self.paused = false + if (queueHead === null) { + _running++ + release() + return } - read() { - return this._reader.read(); + for (; queueHead && _running < _concurrency;) { + _running++ + release() } -} -exports["default"] = SyncProvider; - + } -/***/ }), + function idle () { + return _running === 0 && self.length() === 0 + } -/***/ 59134: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + function push (value, done) { + var current = cache.get() -"use strict"; + current.context = context + current.release = release + current.value = value + current.callback = done || noop + current.errorHandler = errorHandler -Object.defineProperty(exports, "__esModule", ({ value: true })); -const events_1 = __nccwpck_require__(24434); -const fsScandir = __nccwpck_require__(44482); -const fastq = __nccwpck_require__(64898); -const common = __nccwpck_require__(90757); -const reader_1 = __nccwpck_require__(94739); -class AsyncReader extends reader_1.default { - constructor(_root, _settings) { - super(_root, _settings); - this._settings = _settings; - this._scandir = fsScandir.scandir; - this._emitter = new events_1.EventEmitter(); - this._queue = fastq(this._worker.bind(this), this._settings.concurrency); - this._isFatalError = false; - this._isDestroyed = false; - this._queue.drain = () => { - if (!this._isFatalError) { - this._emitter.emit('end'); - } - }; - } - read() { - this._isFatalError = false; - this._isDestroyed = false; - setImmediate(() => { - this._pushToQueue(this._root, this._settings.basePath); - }); - return this._emitter; - } - get isDestroyed() { - return this._isDestroyed; - } - destroy() { - if (this._isDestroyed) { - throw new Error('The reader is already destroyed'); - } - this._isDestroyed = true; - this._queue.killAndDrain(); - } - onEntry(callback) { - this._emitter.on('entry', callback); - } - onError(callback) { - this._emitter.once('error', callback); - } - onEnd(callback) { - this._emitter.once('end', callback); - } - _pushToQueue(directory, base) { - const queueItem = { directory, base }; - this._queue.push(queueItem, (error) => { - if (error !== null) { - this._handleError(error); - } - }); + if (_running >= _concurrency || self.paused) { + if (queueTail) { + queueTail.next = current + queueTail = current + } else { + queueHead = current + queueTail = current + self.saturated() + } + } else { + _running++ + worker.call(context, current.value, current.worked) } - _worker(item, done) { - this._scandir(item.directory, this._settings.fsScandirSettings, (error, entries) => { - if (error !== null) { - done(error, undefined); - return; - } - for (const entry of entries) { - this._handleEntry(entry, item.base); - } - done(null, undefined); - }); + } + + function unshift (value, done) { + var current = cache.get() + + current.context = context + current.release = release + current.value = value + current.callback = done || noop + current.errorHandler = errorHandler + + if (_running >= _concurrency || self.paused) { + if (queueHead) { + current.next = queueHead + queueHead = current + } else { + queueHead = current + queueTail = current + self.saturated() + } + } else { + _running++ + worker.call(context, current.value, current.worked) } - _handleError(error) { - if (this._isDestroyed || !common.isFatalError(this._settings, error)) { - return; - } - this._isFatalError = true; - this._isDestroyed = true; - this._emitter.emit('error', error); + } + + function release (holder) { + if (holder) { + cache.release(holder) } - _handleEntry(entry, base) { - if (this._isDestroyed || this._isFatalError) { - return; - } - const fullpath = entry.path; - if (base !== undefined) { - entry.path = common.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator); - } - if (common.isAppliedFilter(this._settings.entryFilter, entry)) { - this._emitEntry(entry); + var next = queueHead + if (next && _running <= _concurrency) { + if (!self.paused) { + if (queueTail === queueHead) { + queueTail = null } - if (entry.dirent.isDirectory() && common.isAppliedFilter(this._settings.deepFilter, entry)) { - this._pushToQueue(fullpath, base === undefined ? undefined : entry.path); + queueHead = next.next + next.next = null + worker.call(context, next.value, next.worked) + if (queueTail === null) { + self.empty() } + } else { + _running-- + } + } else if (--_running === 0) { + self.drain() } - _emitEntry(entry) { - this._emitter.emit('entry', entry); - } -} -exports["default"] = AsyncReader; - - -/***/ }), + } -/***/ 90757: -/***/ ((__unused_webpack_module, exports) => { + function kill () { + queueHead = null + queueTail = null + self.drain = noop + } -"use strict"; + function killAndDrain () { + queueHead = null + queueTail = null + self.drain() + self.drain = noop + } -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.joinPathSegments = exports.replacePathSegmentSeparator = exports.isAppliedFilter = exports.isFatalError = void 0; -function isFatalError(settings, error) { - if (settings.errorFilter === null) { - return true; - } - return !settings.errorFilter(error); -} -exports.isFatalError = isFatalError; -function isAppliedFilter(filter, value) { - return filter === null || filter(value); -} -exports.isAppliedFilter = isAppliedFilter; -function replacePathSegmentSeparator(filepath, separator) { - return filepath.split(/[/\\]/).join(separator); -} -exports.replacePathSegmentSeparator = replacePathSegmentSeparator; -function joinPathSegments(a, b, separator) { - if (a === '') { - return b; - } - /** - * The correct handling of cases when the first segment is a root (`/`, `C:/`) or UNC path (`//?/C:/`). - */ - if (a.endsWith(separator)) { - return a + b; - } - return a + separator + b; + function error (handler) { + errorHandler = handler + } } -exports.joinPathSegments = joinPathSegments; - -/***/ }), +function noop () {} -/***/ 94739: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +function Task () { + this.value = null + this.callback = noop + this.next = null + this.release = noop + this.context = null + this.errorHandler = null -"use strict"; + var self = this -Object.defineProperty(exports, "__esModule", ({ value: true })); -const common = __nccwpck_require__(90757); -class Reader { - constructor(_root, _settings) { - this._root = _root; - this._settings = _settings; - this._root = common.replacePathSegmentSeparator(_root, _settings.pathSegmentSeparator); + this.worked = function worked (err, result) { + var callback = self.callback + var errorHandler = self.errorHandler + var val = self.value + self.value = null + self.callback = noop + if (self.errorHandler) { + errorHandler(err, val) } + callback.call(self.context, err, result) + self.release(self) + } } -exports["default"] = Reader; +function queueAsPromised (context, worker, _concurrency) { + if (typeof context === 'function') { + _concurrency = worker + worker = context + context = null + } -/***/ }), + function asyncWrapper (arg, cb) { + worker.call(this, arg) + .then(function (res) { + cb(null, res) + }, cb) + } -/***/ 63339: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + var queue = fastqueue(context, asyncWrapper, _concurrency) -"use strict"; + var pushCb = queue.push + var unshiftCb = queue.unshift -Object.defineProperty(exports, "__esModule", ({ value: true })); -const fsScandir = __nccwpck_require__(44482); -const common = __nccwpck_require__(90757); -const reader_1 = __nccwpck_require__(94739); -class SyncReader extends reader_1.default { - constructor() { - super(...arguments); - this._scandir = fsScandir.scandirSync; - this._storage = []; - this._queue = new Set(); - } - read() { - this._pushToQueue(this._root, this._settings.basePath); - this._handleQueue(); - return this._storage; - } - _pushToQueue(directory, base) { - this._queue.add({ directory, base }); - } - _handleQueue() { - for (const item of this._queue.values()) { - this._handleDirectory(item.directory, item.base); - } - } - _handleDirectory(directory, base) { - try { - const entries = this._scandir(directory, this._settings.fsScandirSettings); - for (const entry of entries) { - this._handleEntry(entry, base); - } - } - catch (error) { - this._handleError(error); - } - } - _handleError(error) { - if (!common.isFatalError(this._settings, error)) { - return; - } - throw error; - } - _handleEntry(entry, base) { - const fullpath = entry.path; - if (base !== undefined) { - entry.path = common.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator); - } - if (common.isAppliedFilter(this._settings.entryFilter, entry)) { - this._pushToStorage(entry); - } - if (entry.dirent.isDirectory() && common.isAppliedFilter(this._settings.deepFilter, entry)) { - this._pushToQueue(fullpath, base === undefined ? undefined : entry.path); + queue.push = push + queue.unshift = unshift + queue.drained = drained + + return queue + + function push (value) { + var p = new Promise(function (resolve, reject) { + pushCb(value, function (err, result) { + if (err) { + reject(err) + return } - } - _pushToStorage(entry) { - this._storage.push(entry); - } -} -exports["default"] = SyncReader; + resolve(result) + }) + }) + + // Let's fork the promise chain to + // make the error bubble up to the user but + // not lead to a unhandledRejection + p.catch(noop) + return p + } -/***/ }), + function unshift (value) { + var p = new Promise(function (resolve, reject) { + unshiftCb(value, function (err, result) { + if (err) { + reject(err) + return + } + resolve(result) + }) + }) -/***/ 74520: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + // Let's fork the promise chain to + // make the error bubble up to the user but + // not lead to a unhandledRejection + p.catch(noop) -"use strict"; + return p + } -Object.defineProperty(exports, "__esModule", ({ value: true })); -const path = __nccwpck_require__(16928); -const fsScandir = __nccwpck_require__(44482); -class Settings { - constructor(_options = {}) { - this._options = _options; - this.basePath = this._getValue(this._options.basePath, undefined); - this.concurrency = this._getValue(this._options.concurrency, Number.POSITIVE_INFINITY); - this.deepFilter = this._getValue(this._options.deepFilter, null); - this.entryFilter = this._getValue(this._options.entryFilter, null); - this.errorFilter = this._getValue(this._options.errorFilter, null); - this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path.sep); - this.fsScandirSettings = new fsScandir.Settings({ - followSymbolicLinks: this._options.followSymbolicLinks, - fs: this._options.fs, - pathSegmentSeparator: this._options.pathSegmentSeparator, - stats: this._options.stats, - throwErrorOnBrokenSymbolicLink: this._options.throwErrorOnBrokenSymbolicLink - }); - } - _getValue(option, value) { - return option !== null && option !== void 0 ? option : value; - } + function drained () { + var p = new Promise(function (resolve) { + process.nextTick(function () { + if (queue.idle()) { + resolve() + } else { + var previousDrain = queue.drain + queue.drain = function () { + if (typeof previousDrain === 'function') previousDrain() + resolve() + queue.drain = previousDrain + } + } + }) + }) + + return p + } } -exports["default"] = Settings; + +module.exports = fastqueue +module.exports.promise = queueAsPromised /***/ }), -/***/ 71187: -/***/ ((module) => { +/***/ 9073: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; +/*! + * fill-range + * + * Copyright (c) 2014-present, Jon Schlinkert. + * Licensed under the MIT License. + */ -module.exports = (...arguments_) => { - return [...new Set([].concat(...arguments_))]; -}; +const util = __nccwpck_require__(39023); +const toRegexRange = __nccwpck_require__(54395); -/***/ }), +const isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val); -/***/ 88843: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +const transform = toNumber => { + return value => toNumber === true ? Number(value) : String(value); +}; -"use strict"; +const isValidValue = value => { + return typeof value === 'number' || (typeof value === 'string' && value !== ''); +}; -const path = __nccwpck_require__(16928) -const isWindows = __nccwpck_require__(65196) +const isNumber = num => Number.isInteger(+num); -module.exports = isWindows() ? winResolve : path.resolve +const zeros = input => { + let value = `${input}`; + let index = -1; + if (value[0] === '-') value = value.slice(1); + if (value === '0') return false; + while (value[++index] === '0'); + return index > 0; +}; -function winResolve (p) { - if (arguments.length === 0) return path.resolve() - if (typeof p !== 'string') { - return path.resolve(p) +const stringify = (start, end, options) => { + if (typeof start === 'string' || typeof end === 'string') { + return true; } - // c: => C: - if (p[1] === ':') { - const cc = p[0].charCodeAt() - if (cc < 65 || cc > 90) { - p = `${p[0].toUpperCase()}${p.substr(1)}` - } + return options.stringify === true; +}; + +const pad = (input, maxLength, toNumber) => { + if (maxLength > 0) { + let dash = input[0] === '-' ? '-' : ''; + if (dash) input = input.slice(1); + input = (dash + input.padStart(dash ? maxLength - 1 : maxLength, '0')); } - // On Windows path.resolve('C:') returns C:\Users\ - // We resolve C: to C: - if (p.endsWith(':')) { - return p + if (toNumber === false) { + return String(input); } - return path.resolve(p) -} + return input; +}; +const toMaxLen = (input, maxLength) => { + let negative = input[0] === '-' ? '-' : ''; + if (negative) { + input = input.slice(1); + maxLength--; + } + while (input.length < maxLength) input = '0' + input; + return negative ? ('-' + input) : input; +}; -/***/ }), +const toSequence = (parts, options, maxLen) => { + parts.negatives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0); + parts.positives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0); -/***/ 37120: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + let prefix = options.capture ? '' : '?:'; + let positives = ''; + let negatives = ''; + let result; -"use strict"; + if (parts.positives.length) { + positives = parts.positives.map(v => toMaxLen(String(v), maxLen)).join('|'); + } + if (parts.negatives.length) { + negatives = `-(${prefix}${parts.negatives.map(v => toMaxLen(String(v), maxLen)).join('|')})`; + } -const stringify = __nccwpck_require__(40641); -const compile = __nccwpck_require__(26453); -const expand = __nccwpck_require__(6374); -const parse = __nccwpck_require__(35583); + if (positives && negatives) { + result = `${positives}|${negatives}`; + } else { + result = positives || negatives; + } -/** - * Expand the given pattern or create a regex-compatible string. - * - * ```js - * const braces = require('braces'); - * console.log(braces('{a,b,c}', { compile: true })); //=> ['(a|b|c)'] - * console.log(braces('{a,b,c}')); //=> ['a', 'b', 'c'] - * ``` - * @param {String} `str` - * @param {Object} `options` - * @return {String} - * @api public - */ + if (options.wrap) { + return `(${prefix}${result})`; + } -const braces = (input, options = {}) => { - let output = []; + return result; +}; - if (Array.isArray(input)) { - for (const pattern of input) { - const result = braces.create(pattern, options); - if (Array.isArray(result)) { - output.push(...result); - } else { - output.push(result); - } - } - } else { - output = [].concat(braces.create(input, options)); +const toRange = (a, b, isNumbers, options) => { + if (isNumbers) { + return toRegexRange(a, b, { wrap: false, ...options }); } - if (options && options.expand === true && options.nodupes === true) { - output = [...new Set(output)]; - } - return output; + let start = String.fromCharCode(a); + if (a === b) return start; + + let stop = String.fromCharCode(b); + return `[${start}-${stop}]`; }; -/** - * Parse the given `str` with the given `options`. - * - * ```js - * // braces.parse(pattern, [, options]); - * const ast = braces.parse('a/{b,c}/d'); - * console.log(ast); - * ``` - * @param {String} pattern Brace pattern to parse - * @param {Object} options - * @return {Object} Returns an AST - * @api public - */ +const toRegex = (start, end, options) => { + if (Array.isArray(start)) { + let wrap = options.wrap === true; + let prefix = options.capture ? '' : '?:'; + return wrap ? `(${prefix}${start.join('|')})` : start.join('|'); + } + return toRegexRange(start, end, options); +}; -braces.parse = (input, options = {}) => parse(input, options); +const rangeError = (...args) => { + return new RangeError('Invalid range arguments: ' + util.inspect(...args)); +}; -/** - * Creates a braces string from an AST, or an AST node. - * - * ```js - * const braces = require('braces'); - * let ast = braces.parse('foo/{a,b}/bar'); - * console.log(stringify(ast.nodes[2])); //=> '{a,b}' - * ``` - * @param {String} `input` Brace pattern or AST. - * @param {Object} `options` - * @return {Array} Returns an array of expanded values. - * @api public - */ +const invalidRange = (start, end, options) => { + if (options.strictRanges === true) throw rangeError([start, end]); + return []; +}; -braces.stringify = (input, options = {}) => { - if (typeof input === 'string') { - return stringify(braces.parse(input, options), options); +const invalidStep = (step, options) => { + if (options.strictRanges === true) { + throw new TypeError(`Expected step "${step}" to be a number`); } - return stringify(input, options); + return []; }; -/** - * Compiles a brace pattern into a regex-compatible, optimized string. - * This method is called by the main [braces](#braces) function by default. - * - * ```js - * const braces = require('braces'); - * console.log(braces.compile('a/{b,c}/d')); - * //=> ['a/(b|c)/d'] - * ``` - * @param {String} `input` Brace pattern or AST. - * @param {Object} `options` - * @return {Array} Returns an array of expanded values. - * @api public - */ +const fillNumbers = (start, end, step = 1, options = {}) => { + let a = Number(start); + let b = Number(end); -braces.compile = (input, options = {}) => { - if (typeof input === 'string') { - input = braces.parse(input, options); + if (!Number.isInteger(a) || !Number.isInteger(b)) { + if (options.strictRanges === true) throw rangeError([start, end]); + return []; } - return compile(input, options); -}; -/** - * Expands a brace pattern into an array. This method is called by the - * main [braces](#braces) function when `options.expand` is true. Before - * using this method it's recommended that you read the [performance notes](#performance)) - * and advantages of using [.compile](#compile) instead. - * - * ```js - * const braces = require('braces'); - * console.log(braces.expand('a/{b,c}/d')); - * //=> ['a/b/d', 'a/c/d']; - * ``` - * @param {String} `pattern` Brace pattern - * @param {Object} `options` - * @return {Array} Returns an array of expanded values. - * @api public - */ + // fix negative zero + if (a === 0) a = 0; + if (b === 0) b = 0; -braces.expand = (input, options = {}) => { - if (typeof input === 'string') { - input = braces.parse(input, options); + let descending = a > b; + let startString = String(start); + let endString = String(end); + let stepString = String(step); + step = Math.max(Math.abs(step), 1); + + let padded = zeros(startString) || zeros(endString) || zeros(stepString); + let maxLen = padded ? Math.max(startString.length, endString.length, stepString.length) : 0; + let toNumber = padded === false && stringify(start, end, options) === false; + let format = options.transform || transform(toNumber); + + if (options.toRegex && step === 1) { + return toRange(toMaxLen(start, maxLen), toMaxLen(end, maxLen), true, options); } - let result = expand(input, options); + let parts = { negatives: [], positives: [] }; + let push = num => parts[num < 0 ? 'negatives' : 'positives'].push(Math.abs(num)); + let range = []; + let index = 0; - // filter out empty strings if specified - if (options.noempty === true) { - result = result.filter(Boolean); + while (descending ? a >= b : a <= b) { + if (options.toRegex === true && step > 1) { + push(a); + } else { + range.push(pad(format(a, index), maxLen, toNumber)); + } + a = descending ? a - step : a + step; + index++; } - // filter out duplicates if specified - if (options.nodupes === true) { - result = [...new Set(result)]; + if (options.toRegex === true) { + return step > 1 + ? toSequence(parts, options, maxLen) + : toRegex(range, null, { wrap: false, ...options }); } - return result; + return range; }; -/** - * Processes a brace pattern and returns either an expanded array - * (if `options.expand` is true), a highly optimized regex-compatible string. - * This method is called by the main [braces](#braces) function. - * - * ```js - * const braces = require('braces'); - * console.log(braces.create('user-{200..300}/project-{a,b,c}-{1..10}')) - * //=> 'user-(20[0-9]|2[1-9][0-9]|300)/project-(a|b|c)-([1-9]|10)' - * ``` - * @param {String} `pattern` Brace pattern - * @param {Object} `options` - * @return {Array} Returns an array of expanded values. - * @api public - */ +const fillLetters = (start, end, step = 1, options = {}) => { + if ((!isNumber(start) && start.length > 1) || (!isNumber(end) && end.length > 1)) { + return invalidRange(start, end, options); + } -braces.create = (input, options = {}) => { - if (input === '' || input.length < 3) { - return [input]; + let format = options.transform || (val => String.fromCharCode(val)); + let a = `${start}`.charCodeAt(0); + let b = `${end}`.charCodeAt(0); + + let descending = a > b; + let min = Math.min(a, b); + let max = Math.max(a, b); + + if (options.toRegex && step === 1) { + return toRange(min, max, false, options); } - return options.expand !== true - ? braces.compile(input, options) - : braces.expand(input, options); + let range = []; + let index = 0; + + while (descending ? a >= b : a <= b) { + range.push(format(a, index)); + a = descending ? a - step : a + step; + index++; + } + + if (options.toRegex === true) { + return toRegex(range, null, { wrap: false, options }); + } + + return range; }; -/** - * Expose "braces" - */ +const fill = (start, end, step, options = {}) => { + if (end == null && isValidValue(start)) { + return [start]; + } -module.exports = braces; + if (!isValidValue(start) || !isValidValue(end)) { + return invalidRange(start, end, options); + } + + if (typeof step === 'function') { + return fill(start, end, 1, { transform: step }); + } + + if (isObject(step)) { + return fill(start, end, 0, step); + } + + let opts = { ...options }; + if (opts.capture === true) opts.wrap = true; + step = step || opts.step || 1; + + if (!isNumber(step)) { + if (step != null && !isObject(step)) return invalidStep(step, opts); + return fill(start, end, 1, step); + } + + if (isNumber(start) && isNumber(end)) { + return fillNumbers(start, end, step, opts); + } + + return fillLetters(start, end, Math.max(Math.abs(step), 1), opts); +}; + +module.exports = fill; /***/ }), -/***/ 26453: +/***/ 81179: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; +const path = __nccwpck_require__(16928); +const locatePath = __nccwpck_require__(58146); +const pathExists = __nccwpck_require__(25802); -const fill = __nccwpck_require__(9073); -const utils = __nccwpck_require__(60837); +const stop = Symbol('findUp.stop'); -const compile = (ast, options = {}) => { - const walk = (node, parent = {}) => { - const invalidBlock = utils.isInvalidBrace(parent); - const invalidNode = node.invalid === true && options.escapeInvalid === true; - const invalid = invalidBlock === true || invalidNode === true; - const prefix = options.escapeInvalid === true ? '\\' : ''; - let output = ''; - - if (node.isOpen === true) { - return prefix + node.value; - } - - if (node.isClose === true) { - console.log('node.isClose', prefix, node.value); - return prefix + node.value; - } - - if (node.type === 'open') { - return invalid ? prefix + node.value : '('; - } +module.exports = async (name, options = {}) => { + let directory = path.resolve(options.cwd || ''); + const {root} = path.parse(directory); + const paths = [].concat(name); - if (node.type === 'close') { - return invalid ? prefix + node.value : ')'; - } + const runMatcher = async locateOptions => { + if (typeof name !== 'function') { + return locatePath(paths, locateOptions); + } - if (node.type === 'comma') { - return node.prev.type === 'comma' ? '' : invalid ? node.value : '|'; - } + const foundPath = await name(locateOptions.cwd); + if (typeof foundPath === 'string') { + return locatePath([foundPath], locateOptions); + } - if (node.value) { - return node.value; - } + return foundPath; + }; - if (node.nodes && node.ranges > 0) { - const args = utils.reduce(node.nodes); - const range = fill(...args, { ...options, wrap: false, toRegex: true, strictZeros: true }); + // eslint-disable-next-line no-constant-condition + while (true) { + // eslint-disable-next-line no-await-in-loop + const foundPath = await runMatcher({...options, cwd: directory}); - if (range.length !== 0) { - return args.length > 1 && range.length > 1 ? `(${range})` : range; - } - } + if (foundPath === stop) { + return; + } - if (node.nodes) { - for (const child of node.nodes) { - output += walk(child, node); - } - } + if (foundPath) { + return path.resolve(directory, foundPath); + } - return output; - }; + if (directory === root) { + return; + } - return walk(ast); + directory = path.dirname(directory); + } }; -module.exports = compile; +module.exports.sync = (name, options = {}) => { + let directory = path.resolve(options.cwd || ''); + const {root} = path.parse(directory); + const paths = [].concat(name); + const runMatcher = locateOptions => { + if (typeof name !== 'function') { + return locatePath.sync(paths, locateOptions); + } -/***/ }), + const foundPath = name(locateOptions.cwd); + if (typeof foundPath === 'string') { + return locatePath.sync([foundPath], locateOptions); + } -/***/ 57201: -/***/ ((module) => { + return foundPath; + }; -"use strict"; + // eslint-disable-next-line no-constant-condition + while (true) { + const foundPath = runMatcher({...options, cwd: directory}); + if (foundPath === stop) { + return; + } -module.exports = { - MAX_LENGTH: 10000, + if (foundPath) { + return path.resolve(directory, foundPath); + } - // Digits - CHAR_0: '0', /* 0 */ - CHAR_9: '9', /* 9 */ + if (directory === root) { + return; + } - // Alphabet chars. - CHAR_UPPERCASE_A: 'A', /* A */ - CHAR_LOWERCASE_A: 'a', /* a */ - CHAR_UPPERCASE_Z: 'Z', /* Z */ - CHAR_LOWERCASE_Z: 'z', /* z */ + directory = path.dirname(directory); + } +}; - CHAR_LEFT_PARENTHESES: '(', /* ( */ - CHAR_RIGHT_PARENTHESES: ')', /* ) */ +module.exports.exists = pathExists; - CHAR_ASTERISK: '*', /* * */ +module.exports.sync.exists = pathExists.sync; - // Non-alphabetic chars. - CHAR_AMPERSAND: '&', /* & */ - CHAR_AT: '@', /* @ */ - CHAR_BACKSLASH: '\\', /* \ */ - CHAR_BACKTICK: '`', /* ` */ - CHAR_CARRIAGE_RETURN: '\r', /* \r */ - CHAR_CIRCUMFLEX_ACCENT: '^', /* ^ */ - CHAR_COLON: ':', /* : */ - CHAR_COMMA: ',', /* , */ - CHAR_DOLLAR: '$', /* . */ - CHAR_DOT: '.', /* . */ - CHAR_DOUBLE_QUOTE: '"', /* " */ - CHAR_EQUAL: '=', /* = */ - CHAR_EXCLAMATION_MARK: '!', /* ! */ - CHAR_FORM_FEED: '\f', /* \f */ - CHAR_FORWARD_SLASH: '/', /* / */ - CHAR_HASH: '#', /* # */ - CHAR_HYPHEN_MINUS: '-', /* - */ - CHAR_LEFT_ANGLE_BRACKET: '<', /* < */ - CHAR_LEFT_CURLY_BRACE: '{', /* { */ - CHAR_LEFT_SQUARE_BRACKET: '[', /* [ */ - CHAR_LINE_FEED: '\n', /* \n */ - CHAR_NO_BREAK_SPACE: '\u00A0', /* \u00A0 */ - CHAR_PERCENT: '%', /* % */ - CHAR_PLUS: '+', /* + */ - CHAR_QUESTION_MARK: '?', /* ? */ - CHAR_RIGHT_ANGLE_BRACKET: '>', /* > */ - CHAR_RIGHT_CURLY_BRACE: '}', /* } */ - CHAR_RIGHT_SQUARE_BRACKET: ']', /* ] */ - CHAR_SEMICOLON: ';', /* ; */ - CHAR_SINGLE_QUOTE: '\'', /* ' */ - CHAR_SPACE: ' ', /* */ - CHAR_TAB: '\t', /* \t */ - CHAR_UNDERSCORE: '_', /* _ */ - CHAR_VERTICAL_LINE: '|', /* | */ - CHAR_ZERO_WIDTH_NOBREAK_SPACE: '\uFEFF' /* \uFEFF */ -}; +module.exports.stop = stop; /***/ }), -/***/ 6374: +/***/ 60979: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -const fill = __nccwpck_require__(9073); -const stringify = __nccwpck_require__(40641); -const utils = __nccwpck_require__(60837); - -const append = (queue = '', stash = '', enclose = false) => { - const result = []; +const fs = __nccwpck_require__(61404) +const path = __nccwpck_require__(16928) +const mkdirpSync = (__nccwpck_require__(36813).mkdirsSync) +const utimesSync = (__nccwpck_require__(51226).utimesMillisSync) - queue = [].concat(queue); - stash = [].concat(stash); +const notExist = Symbol('notExist') - if (!stash.length) return queue; - if (!queue.length) { - return enclose ? utils.flatten(stash).map(ele => `{${ele}}`) : stash; +function copySync (src, dest, opts) { + if (typeof opts === 'function') { + opts = {filter: opts} } - for (const item of queue) { - if (Array.isArray(item)) { - for (const value of item) { - result.push(append(value, stash, enclose)); - } - } else { - for (let ele of stash) { - if (enclose === true && typeof ele === 'string') ele = `{${ele}}`; - result.push(Array.isArray(ele) ? append(item, ele, enclose) : item + ele); - } - } + opts = opts || {} + opts.clobber = 'clobber' in opts ? !!opts.clobber : true // default to true for now + opts.overwrite = 'overwrite' in opts ? !!opts.overwrite : opts.clobber // overwrite falls back to clobber + + // Warn about using preserveTimestamps on 32-bit node + if (opts.preserveTimestamps && process.arch === 'ia32') { + console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n + see https://github.com/jprichardson/node-fs-extra/issues/269`) } - return utils.flatten(result); -}; -const expand = (ast, options = {}) => { - const rangeLimit = options.rangeLimit === undefined ? 1000 : options.rangeLimit; + const destStat = checkPaths(src, dest) - const walk = (node, parent = {}) => { - node.queue = []; + if (opts.filter && !opts.filter(src, dest)) return - let p = parent; - let q = parent.queue; + const destParent = path.dirname(dest) + if (!fs.existsSync(destParent)) mkdirpSync(destParent) + return startCopy(destStat, src, dest, opts) +} - while (p.type !== 'brace' && p.type !== 'root' && p.parent) { - p = p.parent; - q = p.queue; - } +function startCopy (destStat, src, dest, opts) { + if (opts.filter && !opts.filter(src, dest)) return + return getStats(destStat, src, dest, opts) +} - if (node.invalid || node.dollar) { - q.push(append(q.pop(), stringify(node, options))); - return; - } +function getStats (destStat, src, dest, opts) { + const statSync = opts.dereference ? fs.statSync : fs.lstatSync + const srcStat = statSync(src) - if (node.type === 'brace' && node.invalid !== true && node.nodes.length === 2) { - q.push(append(q.pop(), ['{}'])); - return; - } + if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts) + else if (srcStat.isFile() || + srcStat.isCharacterDevice() || + srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts) + else if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts) +} - if (node.nodes && node.ranges > 0) { - const args = utils.reduce(node.nodes); +function onFile (srcStat, destStat, src, dest, opts) { + if (destStat === notExist) return copyFile(srcStat, src, dest, opts) + return mayCopyFile(srcStat, src, dest, opts) +} - if (utils.exceedsLimit(...args, options.step, rangeLimit)) { - throw new RangeError('expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.'); - } +function mayCopyFile (srcStat, src, dest, opts) { + if (opts.overwrite) { + fs.unlinkSync(dest) + return copyFile(srcStat, src, dest, opts) + } else if (opts.errorOnExist) { + throw new Error(`'${dest}' already exists`) + } +} - let range = fill(...args, options); - if (range.length === 0) { - range = stringify(node, options); - } - - q.push(append(q.pop(), range)); - node.nodes = []; - return; - } - - const enclose = utils.encloseBrace(node); - let queue = node.queue; - let block = node; - - while (block.type !== 'brace' && block.type !== 'root' && block.parent) { - block = block.parent; - queue = block.queue; +function copyFile (srcStat, src, dest, opts) { + if (typeof fs.copyFileSync === 'function') { + fs.copyFileSync(src, dest) + fs.chmodSync(dest, srcStat.mode) + if (opts.preserveTimestamps) { + return utimesSync(dest, srcStat.atime, srcStat.mtime) } + return + } + return copyFileFallback(srcStat, src, dest, opts) +} - for (let i = 0; i < node.nodes.length; i++) { - const child = node.nodes[i]; - - if (child.type === 'comma' && node.type === 'brace') { - if (i === 1) queue.push(''); - queue.push(''); - continue; - } - - if (child.type === 'close') { - q.push(append(q.pop(), queue, enclose)); - continue; - } +function copyFileFallback (srcStat, src, dest, opts) { + const BUF_LENGTH = 64 * 1024 + const _buff = __nccwpck_require__(79463)(BUF_LENGTH) - if (child.value && child.type !== 'open') { - queue.push(append(queue.pop(), child.value)); - continue; - } + const fdr = fs.openSync(src, 'r') + const fdw = fs.openSync(dest, 'w', srcStat.mode) + let pos = 0 - if (child.nodes) { - walk(child, node); - } - } + while (pos < srcStat.size) { + const bytesRead = fs.readSync(fdr, _buff, 0, BUF_LENGTH, pos) + fs.writeSync(fdw, _buff, 0, bytesRead) + pos += bytesRead + } - return queue; - }; + if (opts.preserveTimestamps) fs.futimesSync(fdw, srcStat.atime, srcStat.mtime) - return utils.flatten(walk(ast)); -}; + fs.closeSync(fdr) + fs.closeSync(fdw) +} -module.exports = expand; +function onDir (srcStat, destStat, src, dest, opts) { + if (destStat === notExist) return mkDirAndCopy(srcStat, src, dest, opts) + if (destStat && !destStat.isDirectory()) { + throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`) + } + return copyDir(src, dest, opts) +} +function mkDirAndCopy (srcStat, src, dest, opts) { + fs.mkdirSync(dest) + copyDir(src, dest, opts) + return fs.chmodSync(dest, srcStat.mode) +} -/***/ }), +function copyDir (src, dest, opts) { + fs.readdirSync(src).forEach(item => copyDirItem(item, src, dest, opts)) +} -/***/ 35583: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +function copyDirItem (item, src, dest, opts) { + const srcItem = path.join(src, item) + const destItem = path.join(dest, item) + const destStat = checkPaths(srcItem, destItem) + return startCopy(destStat, srcItem, destItem, opts) +} -"use strict"; +function onLink (destStat, src, dest, opts) { + let resolvedSrc = fs.readlinkSync(src) + if (opts.dereference) { + resolvedSrc = path.resolve(process.cwd(), resolvedSrc) + } -const stringify = __nccwpck_require__(40641); + if (destStat === notExist) { + return fs.symlinkSync(resolvedSrc, dest) + } else { + let resolvedDest + try { + resolvedDest = fs.readlinkSync(dest) + } catch (err) { + // dest exists and is a regular file or directory, + // Windows may throw UNKNOWN error. If dest already exists, + // fs throws error anyway, so no need to guard against it here. + if (err.code === 'EINVAL' || err.code === 'UNKNOWN') return fs.symlinkSync(resolvedSrc, dest) + throw err + } + if (opts.dereference) { + resolvedDest = path.resolve(process.cwd(), resolvedDest) + } + if (isSrcSubdir(resolvedSrc, resolvedDest)) { + throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`) + } -/** - * Constants - */ + // prevent copy if src is a subdir of dest since unlinking + // dest in this case would result in removing src contents + // and therefore a broken symlink would be created. + if (fs.statSync(dest).isDirectory() && isSrcSubdir(resolvedDest, resolvedSrc)) { + throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`) + } + return copyLink(resolvedSrc, dest) + } +} -const { - MAX_LENGTH, - CHAR_BACKSLASH, /* \ */ - CHAR_BACKTICK, /* ` */ - CHAR_COMMA, /* , */ - CHAR_DOT, /* . */ - CHAR_LEFT_PARENTHESES, /* ( */ - CHAR_RIGHT_PARENTHESES, /* ) */ - CHAR_LEFT_CURLY_BRACE, /* { */ - CHAR_RIGHT_CURLY_BRACE, /* } */ - CHAR_LEFT_SQUARE_BRACKET, /* [ */ - CHAR_RIGHT_SQUARE_BRACKET, /* ] */ - CHAR_DOUBLE_QUOTE, /* " */ - CHAR_SINGLE_QUOTE, /* ' */ - CHAR_NO_BREAK_SPACE, - CHAR_ZERO_WIDTH_NOBREAK_SPACE -} = __nccwpck_require__(57201); +function copyLink (resolvedSrc, dest) { + fs.unlinkSync(dest) + return fs.symlinkSync(resolvedSrc, dest) +} -/** - * parse - */ +// return true if dest is a subdir of src, otherwise false. +function isSrcSubdir (src, dest) { + const srcArray = path.resolve(src).split(path.sep) + const destArray = path.resolve(dest).split(path.sep) + return srcArray.reduce((acc, current, i) => acc && destArray[i] === current, true) +} -const parse = (input, options = {}) => { - if (typeof input !== 'string') { - throw new TypeError('Expected a string'); +function checkStats (src, dest) { + const srcStat = fs.statSync(src) + let destStat + try { + destStat = fs.statSync(dest) + } catch (err) { + if (err.code === 'ENOENT') return {srcStat, destStat: notExist} + throw err } + return {srcStat, destStat} +} - const opts = options || {}; - const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH; - if (input.length > max) { - throw new SyntaxError(`Input length (${input.length}), exceeds max characters (${max})`); +function checkPaths (src, dest) { + const {srcStat, destStat} = checkStats(src, dest) + if (destStat.ino && destStat.ino === srcStat.ino) { + throw new Error('Source and destination must not be the same.') } + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + throw new Error(`Cannot copy '${src}' to a subdirectory of itself, '${dest}'.`) + } + return destStat +} - const ast = { type: 'root', input, nodes: [] }; - const stack = [ast]; - let block = ast; - let prev = ast; - let brackets = 0; - const length = input.length; - let index = 0; - let depth = 0; - let value; +module.exports = copySync - /** - * Helpers - */ - const advance = () => input[index++]; - const push = node => { - if (node.type === 'text' && prev.type === 'dot') { - prev.type = 'text'; - } +/***/ }), - if (prev && prev.type === 'text' && node.type === 'text') { - prev.value += node.value; - return; - } +/***/ 32864: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - block.nodes.push(node); - node.parent = block; - node.prev = prev; - prev = node; - return node; - }; +"use strict"; - push({ type: 'bos' }); - while (index < length) { - block = stack[stack.length - 1]; - value = advance(); +module.exports = { + copySync: __nccwpck_require__(60979) +} - /** - * Invalid chars - */ - if (value === CHAR_ZERO_WIDTH_NOBREAK_SPACE || value === CHAR_NO_BREAK_SPACE) { - continue; - } +/***/ }), - /** - * Escaped chars - */ +/***/ 14027: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - if (value === CHAR_BACKSLASH) { - push({ type: 'text', value: (options.keepEscaping ? value : '') + advance() }); - continue; - } +"use strict"; - /** - * Right square bracket (literal): ']' - */ - if (value === CHAR_RIGHT_SQUARE_BRACKET) { - push({ type: 'text', value: '\\' + value }); - continue; - } +const fs = __nccwpck_require__(61404) +const path = __nccwpck_require__(16928) +const mkdirp = (__nccwpck_require__(36813).mkdirs) +const pathExists = (__nccwpck_require__(26949).pathExists) +const utimes = (__nccwpck_require__(51226).utimesMillis) - /** - * Left square bracket: '[' - */ - - if (value === CHAR_LEFT_SQUARE_BRACKET) { - brackets++; - - let next; - - while (index < length && (next = advance())) { - value += next; +const notExist = Symbol('notExist') - if (next === CHAR_LEFT_SQUARE_BRACKET) { - brackets++; - continue; - } +function copy (src, dest, opts, cb) { + if (typeof opts === 'function' && !cb) { + cb = opts + opts = {} + } else if (typeof opts === 'function') { + opts = {filter: opts} + } - if (next === CHAR_BACKSLASH) { - value += advance(); - continue; - } + cb = cb || function () {} + opts = opts || {} - if (next === CHAR_RIGHT_SQUARE_BRACKET) { - brackets--; + opts.clobber = 'clobber' in opts ? !!opts.clobber : true // default to true for now + opts.overwrite = 'overwrite' in opts ? !!opts.overwrite : opts.clobber // overwrite falls back to clobber - if (brackets === 0) { - break; - } - } - } + // Warn about using preserveTimestamps on 32-bit node + if (opts.preserveTimestamps && process.arch === 'ia32') { + console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n + see https://github.com/jprichardson/node-fs-extra/issues/269`) + } - push({ type: 'text', value }); - continue; - } + checkPaths(src, dest, (err, destStat) => { + if (err) return cb(err) + if (opts.filter) return handleFilter(checkParentDir, destStat, src, dest, opts, cb) + return checkParentDir(destStat, src, dest, opts, cb) + }) +} - /** - * Parentheses - */ +function checkParentDir (destStat, src, dest, opts, cb) { + const destParent = path.dirname(dest) + pathExists(destParent, (err, dirExists) => { + if (err) return cb(err) + if (dirExists) return startCopy(destStat, src, dest, opts, cb) + mkdirp(destParent, err => { + if (err) return cb(err) + return startCopy(destStat, src, dest, opts, cb) + }) + }) +} - if (value === CHAR_LEFT_PARENTHESES) { - block = push({ type: 'paren', nodes: [] }); - stack.push(block); - push({ type: 'text', value }); - continue; +function handleFilter (onInclude, destStat, src, dest, opts, cb) { + Promise.resolve(opts.filter(src, dest)).then(include => { + if (include) { + if (destStat) return onInclude(destStat, src, dest, opts, cb) + return onInclude(src, dest, opts, cb) } + return cb() + }, error => cb(error)) +} - if (value === CHAR_RIGHT_PARENTHESES) { - if (block.type !== 'paren') { - push({ type: 'text', value }); - continue; - } - block = stack.pop(); - push({ type: 'text', value }); - block = stack[stack.length - 1]; - continue; - } +function startCopy (destStat, src, dest, opts, cb) { + if (opts.filter) return handleFilter(getStats, destStat, src, dest, opts, cb) + return getStats(destStat, src, dest, opts, cb) +} - /** - * Quotes: '|"|` - */ +function getStats (destStat, src, dest, opts, cb) { + const stat = opts.dereference ? fs.stat : fs.lstat + stat(src, (err, srcStat) => { + if (err) return cb(err) - if (value === CHAR_DOUBLE_QUOTE || value === CHAR_SINGLE_QUOTE || value === CHAR_BACKTICK) { - const open = value; - let next; + 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) + }) +} - if (options.keepQuotes !== true) { - value = ''; - } +function onFile (srcStat, destStat, src, dest, opts, cb) { + if (destStat === notExist) return copyFile(srcStat, src, dest, opts, cb) + return mayCopyFile(srcStat, src, dest, opts, cb) +} - while (index < length && (next = advance())) { - if (next === CHAR_BACKSLASH) { - value += next + advance(); - continue; - } +function mayCopyFile (srcStat, src, dest, opts, cb) { + if (opts.overwrite) { + fs.unlink(dest, err => { + if (err) return cb(err) + return copyFile(srcStat, src, dest, opts, cb) + }) + } else if (opts.errorOnExist) { + return cb(new Error(`'${dest}' already exists`)) + } else return cb() +} - if (next === open) { - if (options.keepQuotes === true) value += next; - break; - } +function copyFile (srcStat, src, dest, opts, cb) { + if (typeof fs.copyFile === 'function') { + return fs.copyFile(src, dest, err => { + if (err) return cb(err) + return setDestModeAndTimestamps(srcStat, dest, opts, cb) + }) + } + return copyFileFallback(srcStat, src, dest, opts, cb) +} - value += next; - } +function copyFileFallback (srcStat, src, dest, opts, cb) { + const rs = fs.createReadStream(src) + rs.on('error', err => cb(err)).once('open', () => { + const ws = fs.createWriteStream(dest, { mode: srcStat.mode }) + ws.on('error', err => cb(err)) + .on('open', () => rs.pipe(ws)) + .once('close', () => setDestModeAndTimestamps(srcStat, dest, opts, cb)) + }) +} - push({ type: 'text', value }); - continue; +function setDestModeAndTimestamps (srcStat, dest, opts, cb) { + fs.chmod(dest, srcStat.mode, err => { + if (err) return cb(err) + if (opts.preserveTimestamps) { + return utimes(dest, srcStat.atime, srcStat.mtime, cb) } + return cb() + }) +} - /** - * Left curly brace: '{' - */ - - if (value === CHAR_LEFT_CURLY_BRACE) { - depth++; - - const dollar = prev.value && prev.value.slice(-1) === '$' || block.dollar === true; - const brace = { - type: 'brace', - open: true, - close: false, - dollar, - depth, - commas: 0, - ranges: 0, - nodes: [] - }; +function onDir (srcStat, destStat, src, dest, opts, cb) { + if (destStat === notExist) return mkDirAndCopy(srcStat, src, dest, opts, cb) + if (destStat && !destStat.isDirectory()) { + return cb(new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`)) + } + return copyDir(src, dest, opts, cb) +} - block = push(brace); - stack.push(block); - push({ type: 'open', value }); - continue; - } +function mkDirAndCopy (srcStat, src, dest, opts, cb) { + fs.mkdir(dest, err => { + if (err) return cb(err) + copyDir(src, dest, opts, err => { + if (err) return cb(err) + return fs.chmod(dest, srcStat.mode, cb) + }) + }) +} - /** - * Right curly brace: '}' - */ +function copyDir (src, dest, opts, cb) { + fs.readdir(src, (err, items) => { + if (err) return cb(err) + return copyDirItems(items, src, dest, opts, cb) + }) +} - if (value === CHAR_RIGHT_CURLY_BRACE) { - if (block.type !== 'brace') { - push({ type: 'text', value }); - continue; - } +function copyDirItems (items, src, dest, opts, cb) { + const item = items.pop() + if (!item) return cb() + return copyDirItem(items, item, src, dest, opts, cb) +} - const type = 'close'; - block = stack.pop(); - block.close = true; +function copyDirItem (items, item, src, dest, opts, cb) { + const srcItem = path.join(src, item) + const destItem = path.join(dest, item) + checkPaths(srcItem, destItem, (err, destStat) => { + if (err) return cb(err) + startCopy(destStat, srcItem, destItem, opts, err => { + if (err) return cb(err) + return copyDirItems(items, src, dest, opts, cb) + }) + }) +} - push({ type, value }); - depth--; +function onLink (destStat, src, dest, opts, cb) { + fs.readlink(src, (err, resolvedSrc) => { + if (err) return cb(err) - block = stack[stack.length - 1]; - continue; + if (opts.dereference) { + resolvedSrc = path.resolve(process.cwd(), resolvedSrc) } - /** - * Comma: ',' - */ - - if (value === CHAR_COMMA && depth > 0) { - if (block.ranges > 0) { - block.ranges = 0; - const open = block.nodes.shift(); - block.nodes = [open, { type: 'text', value: stringify(block) }]; - } - - push({ type: 'comma', value }); - block.commas++; - continue; - } - - /** - * Dot: '.' - */ - - if (value === CHAR_DOT && depth > 0 && block.commas === 0) { - const siblings = block.nodes; - - if (depth === 0 || siblings.length === 0) { - push({ type: 'text', value }); - continue; - } - - if (prev.type === 'dot') { - block.range = []; - prev.value += value; - prev.type = 'range'; + if (destStat === notExist) { + return fs.symlink(resolvedSrc, dest, cb) + } else { + fs.readlink(dest, (err, resolvedDest) => { + if (err) { + // dest exists and is a regular file or directory, + // Windows may throw UNKNOWN error. If dest already exists, + // fs throws error anyway, so no need to guard against it here. + if (err.code === 'EINVAL' || err.code === 'UNKNOWN') return fs.symlink(resolvedSrc, dest, cb) + return cb(err) + } + if (opts.dereference) { + resolvedDest = path.resolve(process.cwd(), resolvedDest) + } + if (isSrcSubdir(resolvedSrc, resolvedDest)) { + return cb(new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`)) + } - if (block.nodes.length !== 3 && block.nodes.length !== 5) { - block.invalid = true; - block.ranges = 0; - prev.type = 'text'; - continue; + // do not copy if src is a subdir of dest since unlinking + // dest in this case would result in removing src contents + // and therefore a broken symlink would be created. + if (destStat.isDirectory() && isSrcSubdir(resolvedDest, resolvedSrc)) { + return cb(new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`)) } + return copyLink(resolvedSrc, dest, cb) + }) + } + }) +} - block.ranges++; - block.args = []; - continue; - } +function copyLink (resolvedSrc, dest, cb) { + fs.unlink(dest, err => { + if (err) return cb(err) + return fs.symlink(resolvedSrc, dest, cb) + }) +} - if (prev.type === 'range') { - siblings.pop(); +// return true if dest is a subdir of src, otherwise false. +function isSrcSubdir (src, dest) { + const srcArray = path.resolve(src).split(path.sep) + const destArray = path.resolve(dest).split(path.sep) + return srcArray.reduce((acc, current, i) => acc && destArray[i] === current, true) +} - const before = siblings[siblings.length - 1]; - before.value += prev.value + value; - prev = before; - block.ranges--; - continue; +function checkStats (src, dest, cb) { + fs.stat(src, (err, srcStat) => { + if (err) return cb(err) + fs.stat(dest, (err, destStat) => { + if (err) { + if (err.code === 'ENOENT') return cb(null, {srcStat, destStat: notExist}) + return cb(err) } + return cb(null, {srcStat, destStat}) + }) + }) +} - push({ type: 'dot', value }); - continue; +function checkPaths (src, dest, cb) { + checkStats(src, dest, (err, stats) => { + if (err) return cb(err) + const {srcStat, destStat} = stats + if (destStat.ino && destStat.ino === srcStat.ino) { + return cb(new Error('Source and destination must not be the same.')) + } + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + return cb(new Error(`Cannot copy '${src}' to a subdirectory of itself, '${dest}'.`)) } + return cb(null, destStat) + }) +} - /** - * Text - */ +module.exports = copy - push({ type: 'text', value }); - } - // Mark imbalanced braces and brackets as invalid - do { - block = stack.pop(); +/***/ }), - if (block.type !== 'root') { - block.nodes.forEach(node => { - if (!node.nodes) { - if (node.type === 'open') node.isOpen = true; - if (node.type === 'close') node.isClose = true; - if (!node.nodes) node.type = 'text'; - node.invalid = true; - } - }); +/***/ 80424: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - // get the location of the block on parent.nodes (block's siblings) - const parent = stack[stack.length - 1]; - const index = parent.nodes.indexOf(block); - // replace the (invalid) block with it's nodes - parent.nodes.splice(index, 1, ...block.nodes); - } - } while (stack.length > 0); +"use strict"; - push({ type: 'eos' }); - return ast; -}; -module.exports = parse; +const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) +module.exports = { + copy: u(__nccwpck_require__(14027)) +} /***/ }), -/***/ 40641: +/***/ 70198: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -const utils = __nccwpck_require__(60837); +const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) +const fs = __nccwpck_require__(79896) +const path = __nccwpck_require__(16928) +const mkdir = __nccwpck_require__(36813) +const remove = __nccwpck_require__(63073) -module.exports = (ast, options = {}) => { - const stringify = (node, parent = {}) => { - const invalidBlock = options.escapeInvalid && utils.isInvalidBrace(parent); - const invalidNode = node.invalid === true && options.escapeInvalid === true; - let output = ''; +const emptyDir = u(function emptyDir (dir, callback) { + callback = callback || function () {} + fs.readdir(dir, (err, items) => { + if (err) return mkdir.mkdirs(dir, callback) - if (node.value) { - if ((invalidBlock || invalidNode) && utils.isOpenOrClose(node)) { - return '\\' + node.value; - } - return node.value; - } + items = items.map(item => path.join(dir, item)) - if (node.value) { - return node.value; - } + deleteItem() - if (node.nodes) { - for (const child of node.nodes) { - output += stringify(child); - } + function deleteItem () { + const item = items.pop() + if (!item) return callback() + remove.remove(item, err => { + if (err) return callback(err) + deleteItem() + }) } - return output; - }; + }) +}) - return stringify(ast); -}; +function emptyDirSync (dir) { + let items + try { + items = fs.readdirSync(dir) + } catch (err) { + return mkdir.mkdirsSync(dir) + } + + items.forEach(item => { + item = path.join(dir, item) + remove.removeSync(item) + }) +} +module.exports = { + emptyDirSync, + emptydirSync: emptyDirSync, + emptyDir, + emptydir: emptyDir +} /***/ }), -/***/ 60837: -/***/ ((__unused_webpack_module, exports) => { +/***/ 93693: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -exports.isInteger = num => { - if (typeof num === 'number') { - return Number.isInteger(num); - } - if (typeof num === 'string' && num.trim() !== '') { - return Number.isInteger(Number(num)); +const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) +const path = __nccwpck_require__(16928) +const fs = __nccwpck_require__(61404) +const mkdir = __nccwpck_require__(36813) +const pathExists = (__nccwpck_require__(26949).pathExists) + +function createFile (file, callback) { + function makeFile () { + fs.writeFile(file, '', err => { + if (err) return callback(err) + callback() + }) } - return false; -}; -/** - * Find a node of the given type - */ + fs.stat(file, (err, stats) => { // eslint-disable-line handle-callback-err + if (!err && stats.isFile()) return callback() + const dir = path.dirname(file) + pathExists(dir, (err, dirExists) => { + if (err) return callback(err) + if (dirExists) return makeFile() + mkdir.mkdirs(dir, err => { + if (err) return callback(err) + makeFile() + }) + }) + }) +} -exports.find = (node, type) => node.nodes.find(node => node.type === type); +function createFileSync (file) { + let stats + try { + stats = fs.statSync(file) + } catch (e) {} + if (stats && stats.isFile()) return -/** - * Find a node of the given type - */ + const dir = path.dirname(file) + if (!fs.existsSync(dir)) { + mkdir.mkdirsSync(dir) + } -exports.exceedsLimit = (min, max, step = 1, limit) => { - if (limit === false) return false; - if (!exports.isInteger(min) || !exports.isInteger(max)) return false; - return ((Number(max) - Number(min)) / Number(step)) >= limit; -}; - -/** - * Escape the given node with '\\' before node.value - */ - -exports.escapeNode = (block, n = 0, type) => { - const node = block.nodes[n]; - if (!node) return; - - if ((type && node.type === type) || node.type === 'open' || node.type === 'close') { - if (node.escaped !== true) { - node.value = '\\' + node.value; - node.escaped = true; - } - } -}; - -/** - * Returns true if the given brace node should be enclosed in literal braces - */ - -exports.encloseBrace = node => { - if (node.type !== 'brace') return false; - if ((node.commas >> 0 + node.ranges >> 0) === 0) { - node.invalid = true; - return true; - } - return false; -}; - -/** - * Returns true if a brace node is invalid. - */ - -exports.isInvalidBrace = block => { - if (block.type !== 'brace') return false; - if (block.invalid === true || block.dollar) return true; - if ((block.commas >> 0 + block.ranges >> 0) === 0) { - block.invalid = true; - return true; - } - if (block.open !== true || block.close !== true) { - block.invalid = true; - return true; - } - return false; -}; - -/** - * Returns true if a node is an open or close node - */ - -exports.isOpenOrClose = node => { - if (node.type === 'open' || node.type === 'close') { - return true; - } - return node.open === true || node.close === true; -}; + fs.writeFileSync(file, '') +} -/** - * Reduce an array of text nodes. - */ +module.exports = { + createFile: u(createFile), + createFileSync +} -exports.reduce = nodes => nodes.reduce((acc, node) => { - if (node.type === 'text') acc.push(node.value); - if (node.type === 'range') node.type = 'text'; - return acc; -}, []); -/** - * Flatten an array - */ +/***/ }), -exports.flatten = (...args) => { - const result = []; +/***/ 44895: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - const flat = arr => { - for (let i = 0; i < arr.length; i++) { - const ele = arr[i]; +"use strict"; - if (Array.isArray(ele)) { - flat(ele); - continue; - } - if (ele !== undefined) { - result.push(ele); - } - } - return result; - }; +const file = __nccwpck_require__(93693) +const link = __nccwpck_require__(1147) +const symlink = __nccwpck_require__(15788) - flat(args); - return result; -}; +module.exports = { + // file + createFile: file.createFile, + createFileSync: file.createFileSync, + ensureFile: file.createFile, + ensureFileSync: file.createFileSync, + // link + createLink: link.createLink, + createLinkSync: link.createLinkSync, + ensureLink: link.createLink, + ensureLinkSync: link.createLinkSync, + // symlink + createSymlink: symlink.createSymlink, + createSymlinkSync: symlink.createSymlinkSync, + ensureSymlink: symlink.createSymlink, + ensureSymlinkSync: symlink.createSymlinkSync +} /***/ }), -/***/ 24422: +/***/ 1147: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -const cp = __nccwpck_require__(35317); -const parse = __nccwpck_require__(57641); -const enoent = __nccwpck_require__(43609); - -function spawn(command, args, options) { - // Parse the arguments - const parsed = parse(command, args, options); +const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) +const path = __nccwpck_require__(16928) +const fs = __nccwpck_require__(61404) +const mkdir = __nccwpck_require__(36813) +const pathExists = (__nccwpck_require__(26949).pathExists) - // Spawn the child process - const spawned = cp.spawn(parsed.command, parsed.args, parsed.options); +function createLink (srcpath, dstpath, callback) { + function makeLink (srcpath, dstpath) { + fs.link(srcpath, dstpath, err => { + if (err) return callback(err) + callback(null) + }) + } - // Hook into child process "exit" event to emit an error if the command - // does not exists, see: https://github.com/IndigoUnited/node-cross-spawn/issues/16 - enoent.hookChildProcess(spawned, parsed); + pathExists(dstpath, (err, destinationExists) => { + if (err) return callback(err) + if (destinationExists) return callback(null) + fs.lstat(srcpath, (err) => { + if (err) { + err.message = err.message.replace('lstat', 'ensureLink') + return callback(err) + } - return spawned; + const dir = path.dirname(dstpath) + pathExists(dir, (err, dirExists) => { + if (err) return callback(err) + if (dirExists) return makeLink(srcpath, dstpath) + mkdir.mkdirs(dir, err => { + if (err) return callback(err) + makeLink(srcpath, dstpath) + }) + }) + }) + }) } -function spawnSync(command, args, options) { - // Parse the arguments - const parsed = parse(command, args, options); +function createLinkSync (srcpath, dstpath) { + const destinationExists = fs.existsSync(dstpath) + if (destinationExists) return undefined - // Spawn the child process - const result = cp.spawnSync(parsed.command, parsed.args, parsed.options); + try { + fs.lstatSync(srcpath) + } catch (err) { + err.message = err.message.replace('lstat', 'ensureLink') + throw err + } - // Analyze if the command does not exist, see: https://github.com/IndigoUnited/node-cross-spawn/issues/16 - result.error = result.error || enoent.verifyENOENTSync(result.status, parsed); + const dir = path.dirname(dstpath) + const dirExists = fs.existsSync(dir) + if (dirExists) return fs.linkSync(srcpath, dstpath) + mkdir.mkdirsSync(dir) - return result; + return fs.linkSync(srcpath, dstpath) } -module.exports = spawn; -module.exports.spawn = spawn; -module.exports.sync = spawnSync; - -module.exports._parse = parse; -module.exports._enoent = enoent; +module.exports = { + createLink: u(createLink), + createLinkSync +} /***/ }), -/***/ 43609: -/***/ ((module) => { +/***/ 59933: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -const isWin = process.platform === 'win32'; - -function notFoundError(original, syscall) { - return Object.assign(new Error(`${syscall} ${original.command} ENOENT`), { - code: 'ENOENT', - errno: 'ENOENT', - syscall: `${syscall} ${original.command}`, - path: original.command, - spawnargs: original.args, - }); -} - -function hookChildProcess(cp, parsed) { - if (!isWin) { - return; - } - - const originalEmit = cp.emit; - - cp.emit = function (name, arg1) { - // If emitting "exit" event and exit code is 1, we need to check if - // the command exists and emit an "error" instead - // See https://github.com/IndigoUnited/node-cross-spawn/issues/16 - if (name === 'exit') { - const err = verifyENOENT(arg1, parsed); +const path = __nccwpck_require__(16928) +const fs = __nccwpck_require__(61404) +const pathExists = (__nccwpck_require__(26949).pathExists) - if (err) { - return originalEmit.call(cp, 'error', err); - } - } +/** + * Function that returns two types of paths, one relative to symlink, and one + * relative to the current working directory. Checks if path is absolute or + * relative. If the path is relative, this function checks if the path is + * relative to symlink or relative to current working directory. This is an + * initiative to find a smarter `srcpath` to supply when building symlinks. + * This allows you to determine which path to use out of one of three possible + * types of source paths. The first is an absolute path. This is detected by + * `path.isAbsolute()`. When an absolute path is provided, it is checked to + * see if it exists. If it does it's used, if not an error is returned + * (callback)/ thrown (sync). The other two options for `srcpath` are a + * relative url. By default Node's `fs.symlink` works by creating a symlink + * using `dstpath` and expects the `srcpath` to be relative to the newly + * created symlink. If you provide a `srcpath` that does not exist on the file + * system it results in a broken symlink. To minimize this, the function + * checks to see if the 'relative to symlink' source file exists, and if it + * does it will use it. If it does not, it checks if there's a file that + * exists that is relative to the current working directory, if does its used. + * This preserves the expectations of the original fs.symlink spec and adds + * the ability to pass in `relative to current working direcotry` paths. + */ - return originalEmit.apply(cp, arguments); // eslint-disable-line prefer-rest-params - }; +function symlinkPaths (srcpath, dstpath, callback) { + if (path.isAbsolute(srcpath)) { + return fs.lstat(srcpath, (err) => { + if (err) { + err.message = err.message.replace('lstat', 'ensureSymlink') + return callback(err) + } + return callback(null, { + 'toCwd': srcpath, + 'toDst': srcpath + }) + }) + } else { + const dstdir = path.dirname(dstpath) + const relativeToDst = path.join(dstdir, srcpath) + return pathExists(relativeToDst, (err, exists) => { + if (err) return callback(err) + if (exists) { + return callback(null, { + 'toCwd': relativeToDst, + 'toDst': srcpath + }) + } else { + return fs.lstat(srcpath, (err) => { + if (err) { + err.message = err.message.replace('lstat', 'ensureSymlink') + return callback(err) + } + return callback(null, { + 'toCwd': srcpath, + 'toDst': path.relative(dstdir, srcpath) + }) + }) + } + }) + } } -function verifyENOENT(status, parsed) { - if (isWin && status === 1 && !parsed.file) { - return notFoundError(parsed.original, 'spawn'); +function symlinkPathsSync (srcpath, dstpath) { + let exists + if (path.isAbsolute(srcpath)) { + exists = fs.existsSync(srcpath) + if (!exists) throw new Error('absolute srcpath does not exist') + return { + 'toCwd': srcpath, + 'toDst': srcpath } - - return null; -} - -function verifyENOENTSync(status, parsed) { - if (isWin && status === 1 && !parsed.file) { - return notFoundError(parsed.original, 'spawnSync'); + } 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) + } } - - return null; + } } module.exports = { - hookChildProcess, - verifyENOENT, - verifyENOENTSync, - notFoundError, -}; + symlinkPaths, + symlinkPathsSync +} /***/ }), -/***/ 57641: +/***/ 17489: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -const path = __nccwpck_require__(16928); -const resolveCommand = __nccwpck_require__(71998); -const escape = __nccwpck_require__(30528); -const readShebang = __nccwpck_require__(38115); - -const isWin = process.platform === 'win32'; -const isExecutableRegExp = /\.(?:com|exe)$/i; -const isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i; - -function detectShebang(parsed) { - parsed.file = resolveCommand(parsed); +const fs = __nccwpck_require__(61404) - const shebang = parsed.file && readShebang(parsed.file); +function symlinkType (srcpath, type, callback) { + callback = (typeof type === 'function') ? type : callback + type = (typeof type === 'function') ? false : type + if (type) return callback(null, type) + fs.lstat(srcpath, (err, stats) => { + if (err) return callback(null, 'file') + type = (stats && stats.isDirectory()) ? 'dir' : 'file' + callback(null, type) + }) +} - if (shebang) { - parsed.args.unshift(parsed.file); - parsed.command = shebang; +function symlinkTypeSync (srcpath, type) { + let stats - return resolveCommand(parsed); - } + if (type) return type + try { + stats = fs.lstatSync(srcpath) + } catch (e) { + return 'file' + } + return (stats && stats.isDirectory()) ? 'dir' : 'file' +} - return parsed.file; +module.exports = { + symlinkType, + symlinkTypeSync } -function parseNonShell(parsed) { - if (!isWin) { - return parsed; - } - // Detect & add support for shebangs - const commandFile = detectShebang(parsed); +/***/ }), - // We don't need a shell if the command filename is an executable - const needsShell = !isExecutableRegExp.test(commandFile); +/***/ 15788: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - // If a shell is required, use cmd.exe and take care of escaping everything correctly - // Note that `forceShell` is an hidden option used only in tests - if (parsed.options.forceShell || needsShell) { - // Need to double escape meta chars if the command is a cmd-shim located in `node_modules/.bin/` - // The cmd-shim simply calls execute the package bin file with NodeJS, proxying any argument - // Because the escape of metachars with ^ gets interpreted when the cmd.exe is first called, - // we need to double escape them - const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile); +"use strict"; - // Normalize posix paths into OS compatible paths (e.g.: foo/bar -> foo\bar) - // This is necessary otherwise it will always fail with ENOENT in those cases - parsed.command = path.normalize(parsed.command); - // Escape command & arguments - parsed.command = escape.command(parsed.command); - parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars)); +const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) +const path = __nccwpck_require__(16928) +const fs = __nccwpck_require__(61404) +const _mkdirs = __nccwpck_require__(36813) +const mkdirs = _mkdirs.mkdirs +const mkdirsSync = _mkdirs.mkdirsSync - const shellCommand = [parsed.command].concat(parsed.args).join(' '); +const _symlinkPaths = __nccwpck_require__(59933) +const symlinkPaths = _symlinkPaths.symlinkPaths +const symlinkPathsSync = _symlinkPaths.symlinkPathsSync - parsed.args = ['/d', '/s', '/c', `"${shellCommand}"`]; - parsed.command = process.env.comspec || 'cmd.exe'; - parsed.options.windowsVerbatimArguments = true; // Tell node's spawn that the arguments are already escaped - } +const _symlinkType = __nccwpck_require__(17489) +const symlinkType = _symlinkType.symlinkType +const symlinkTypeSync = _symlinkType.symlinkTypeSync - return parsed; -} +const pathExists = (__nccwpck_require__(26949).pathExists) -function parse(command, args, options) { - // Normalize arguments, similar to nodejs - if (args && !Array.isArray(args)) { - options = args; - args = null; - } +function createSymlink (srcpath, dstpath, type, callback) { + callback = (typeof type === 'function') ? type : callback + type = (typeof type === 'function') ? false : type - args = args ? args.slice(0) : []; // Clone array to avoid changing the original - options = Object.assign({}, options); // Clone object to avoid changing the original + pathExists(dstpath, (err, destinationExists) => { + if (err) return callback(err) + if (destinationExists) return callback(null) + symlinkPaths(srcpath, dstpath, (err, relative) => { + if (err) return callback(err) + srcpath = relative.toDst + symlinkType(relative.toCwd, type, (err, type) => { + if (err) return callback(err) + const dir = path.dirname(dstpath) + pathExists(dir, (err, dirExists) => { + if (err) return callback(err) + if (dirExists) return fs.symlink(srcpath, dstpath, type, callback) + mkdirs(dir, err => { + if (err) return callback(err) + fs.symlink(srcpath, dstpath, type, callback) + }) + }) + }) + }) + }) +} - // Build our parsed object - const parsed = { - command, - args, - options, - file: undefined, - original: { - command, - args, - }, - }; +function createSymlinkSync (srcpath, dstpath, type) { + const destinationExists = fs.existsSync(dstpath) + if (destinationExists) return undefined - // Delegate further parsing to shell or non-shell - return options.shell ? parsed : parseNonShell(parsed); + const relative = symlinkPathsSync(srcpath, dstpath) + srcpath = relative.toDst + type = symlinkTypeSync(relative.toCwd, type) + const dir = path.dirname(dstpath) + const exists = fs.existsSync(dir) + if (exists) return fs.symlinkSync(srcpath, dstpath, type) + mkdirsSync(dir) + return fs.symlinkSync(srcpath, dstpath, type) } -module.exports = parse; +module.exports = { + createSymlink: u(createSymlink), + createSymlinkSync +} /***/ }), -/***/ 30528: -/***/ ((module) => { +/***/ 9238: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; +// This is adapted from https://github.com/normalize/mz +// Copyright (c) 2014-2016 Jonathan Ong me@jongleberry.com and Contributors +const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) +const fs = __nccwpck_require__(61404) -// See http://www.robvanderwoude.com/escapechars.php -const metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g; - -function escapeCommand(arg) { - // Escape meta chars - arg = arg.replace(metaCharsRegExp, '^$1'); - - return arg; -} - -function escapeArgument(arg, doubleEscapeMetaChars) { - // Convert to string - arg = `${arg}`; - - // Algorithm below is based on https://qntm.org/cmd - // It's slightly altered to disable JS backtracking to avoid hanging on specially crafted input - // Please see https://github.com/moxystudio/node-cross-spawn/pull/160 for more information +const api = [ + 'access', + 'appendFile', + 'chmod', + 'chown', + 'close', + 'copyFile', + 'fchmod', + 'fchown', + 'fdatasync', + 'fstat', + 'fsync', + 'ftruncate', + 'futimes', + 'lchown', + 'lchmod', + 'link', + 'lstat', + 'mkdir', + 'mkdtemp', + 'open', + 'readFile', + 'readdir', + 'readlink', + 'realpath', + 'rename', + 'rmdir', + 'stat', + 'symlink', + 'truncate', + 'unlink', + 'utimes', + 'writeFile' +].filter(key => { + // Some commands are not available on some systems. Ex: + // fs.copyFile was added in Node.js v8.5.0 + // fs.mkdtemp was added in Node.js v5.10.0 + // fs.lchown is not available on at least some Linux + return typeof fs[key] === 'function' +}) - // Sequence of backslashes followed by a double quote: - // double up all the backslashes and escape the double quote - arg = arg.replace(/(?=(\\+?)?)\1"/g, '$1$1\\"'); +// Export all keys: +Object.keys(fs).forEach(key => { + if (key === 'promises') { + // fs.promises is a getter property that triggers ExperimentalWarning + // Don't re-export it here, the getter is defined in "lib/index.js" + return + } + exports[key] = fs[key] +}) - // Sequence of backslashes followed by the end of the string - // (which will become a double quote later): - // double up all the backslashes - arg = arg.replace(/(?=(\\+?)?)\1$/, '$1$1'); +// Universalify async methods: +api.forEach(method => { + exports[method] = u(fs[method]) +}) - // All other backslashes occur literally +// We differ from mz/fs in that we still ship the old, broken, fs.exists() +// since we are a drop-in replacement for the native module +exports.exists = function (filename, callback) { + if (typeof callback === 'function') { + return fs.exists(filename, callback) + } + return new Promise(resolve => { + return fs.exists(filename, resolve) + }) +} - // Quote the whole thing: - arg = `"${arg}"`; +// fs.read() & fs.write need special treatment due to multiple callback args - // Escape meta chars - arg = arg.replace(metaCharsRegExp, '^$1'); +exports.read = function (fd, buffer, offset, length, position, callback) { + if (typeof callback === 'function') { + return fs.read(fd, buffer, offset, length, position, callback) + } + return new Promise((resolve, reject) => { + fs.read(fd, buffer, offset, length, position, (err, bytesRead, buffer) => { + if (err) return reject(err) + resolve({ bytesRead, buffer }) + }) + }) +} - // Double escape meta chars if necessary - if (doubleEscapeMetaChars) { - arg = arg.replace(metaCharsRegExp, '^$1'); - } +// Function signature can be +// fs.write(fd, buffer[, offset[, length[, position]]], callback) +// OR +// fs.write(fd, string[, position[, encoding]], callback) +// We need to handle both cases, so we use ...args +exports.write = function (fd, buffer, ...args) { + if (typeof args[args.length - 1] === 'function') { + return fs.write(fd, buffer, ...args) + } - return arg; + return new Promise((resolve, reject) => { + fs.write(fd, buffer, ...args, (err, bytesWritten, buffer) => { + if (err) return reject(err) + resolve({ bytesWritten, buffer }) + }) + }) } -module.exports.command = escapeCommand; -module.exports.argument = escapeArgument; - /***/ }), -/***/ 38115: +/***/ 41348: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -const fs = __nccwpck_require__(79896); -const shebangCommand = __nccwpck_require__(72668); +module.exports = Object.assign( + {}, + // Export promiseified graceful-fs: + __nccwpck_require__(9238), + // Export extra methods: + __nccwpck_require__(32864), + __nccwpck_require__(80424), + __nccwpck_require__(70198), + __nccwpck_require__(44895), + __nccwpck_require__(25219), + __nccwpck_require__(36813), + __nccwpck_require__(57744), + __nccwpck_require__(95256), + __nccwpck_require__(14552), + __nccwpck_require__(26949), + __nccwpck_require__(63073) +) -function readShebang(command) { - // Read the first 150 bytes from the file - const size = 150; - const buffer = Buffer.alloc(size); +// Export fs.promises as a getter property so that we don't trigger +// ExperimentalWarning before fs.promises is actually accessed. +const fs = __nccwpck_require__(79896) +if (Object.getOwnPropertyDescriptor(fs, 'promises')) { + Object.defineProperty(module.exports, "promises", ({ + get () { return fs.promises } + })) +} - let fd; - try { - fd = fs.openSync(command, 'r'); - fs.readSync(fd, buffer, 0, size, 0); - fs.closeSync(fd); - } catch (e) { /* Empty */ } +/***/ }), - // Attempt to extract shebang (null is returned if not a shebang) - return shebangCommand(buffer.toString()); -} +/***/ 25219: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -module.exports = readShebang; +"use strict"; + + +const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) +const jsonFile = __nccwpck_require__(81891) + +jsonFile.outputJson = u(__nccwpck_require__(7597)) +jsonFile.outputJsonSync = __nccwpck_require__(56917) +// aliases +jsonFile.outputJSON = jsonFile.outputJson +jsonFile.outputJSONSync = jsonFile.outputJsonSync +jsonFile.writeJSON = jsonFile.writeJson +jsonFile.writeJSONSync = jsonFile.writeJsonSync +jsonFile.readJSON = jsonFile.readJson +jsonFile.readJSONSync = jsonFile.readJsonSync + +module.exports = jsonFile /***/ }), -/***/ 71998: +/***/ 81891: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -const path = __nccwpck_require__(16928); -const which = __nccwpck_require__(13340); -const getPathKey = __nccwpck_require__(50661); +const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) +const jsonFile = __nccwpck_require__(93588) -function resolveCommandAttempt(parsed, withoutPathExt) { - const env = parsed.options.env || process.env; - const cwd = process.cwd(); - const hasCustomCwd = parsed.options.cwd != null; - // Worker threads do not have process.chdir() - const shouldSwitchCwd = hasCustomCwd && process.chdir !== undefined && !process.chdir.disabled; +module.exports = { + // jsonfile exports + readJson: u(jsonFile.readFile), + readJsonSync: jsonFile.readFileSync, + writeJson: u(jsonFile.writeFile), + writeJsonSync: jsonFile.writeFileSync +} - // If a custom `cwd` was specified, we need to change the process cwd - // because `which` will do stat calls but does not support a custom cwd - if (shouldSwitchCwd) { - try { - process.chdir(parsed.options.cwd); - } catch (err) { - /* Empty */ - } - } - let resolved; +/***/ }), - try { - resolved = which.sync(parsed.command, { - path: env[getPathKey({ env })], - pathExt: withoutPathExt ? path.delimiter : undefined, - }); - } catch (e) { - /* Empty */ - } finally { - if (shouldSwitchCwd) { - process.chdir(cwd); - } - } +/***/ 56917: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - // If we successfully resolved, ensure that an absolute path is returned - // Note that when a custom `cwd` was used, we need to resolve to an absolute path based on it - if (resolved) { - resolved = path.resolve(hasCustomCwd ? parsed.options.cwd : '', resolved); - } +"use strict"; - return resolved; -} -function resolveCommand(parsed) { - return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true); +const fs = __nccwpck_require__(61404) +const path = __nccwpck_require__(16928) +const mkdir = __nccwpck_require__(36813) +const jsonFile = __nccwpck_require__(81891) + +function outputJsonSync (file, data, options) { + const dir = path.dirname(file) + + if (!fs.existsSync(dir)) { + mkdir.mkdirsSync(dir) + } + + jsonFile.writeJsonSync(file, data, options) } -module.exports = resolveCommand; +module.exports = outputJsonSync /***/ }), -/***/ 70804: +/***/ 7597: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -const path = __nccwpck_require__(16928); -const pathType = __nccwpck_require__(34754); -const getExtensions = extensions => extensions.length > 1 ? `{${extensions.join(',')}}` : extensions[0]; +const path = __nccwpck_require__(16928) +const mkdir = __nccwpck_require__(36813) +const pathExists = (__nccwpck_require__(26949).pathExists) +const jsonFile = __nccwpck_require__(81891) -const getPath = (filepath, cwd) => { - const pth = filepath[0] === '!' ? filepath.slice(1) : filepath; - return path.isAbsolute(pth) ? pth : path.join(cwd, pth); -}; - -const addExtensions = (file, extensions) => { - if (path.extname(file)) { - return `**/${file}`; - } - - return `**/${file}.${getExtensions(extensions)}`; -}; - -const getGlob = (directory, options) => { - if (options.files && !Array.isArray(options.files)) { - throw new TypeError(`Expected \`files\` to be of type \`Array\` but received type \`${typeof options.files}\``); - } - - if (options.extensions && !Array.isArray(options.extensions)) { - throw new TypeError(`Expected \`extensions\` to be of type \`Array\` but received type \`${typeof options.extensions}\``); - } - - if (options.files && options.extensions) { - return options.files.map(x => path.posix.join(directory, addExtensions(x, options.extensions))); - } - - if (options.files) { - return options.files.map(x => path.posix.join(directory, `**/${x}`)); - } +function outputJson (file, data, options, callback) { + if (typeof options === 'function') { + callback = options + options = {} + } - if (options.extensions) { - return [path.posix.join(directory, `**/*.${getExtensions(options.extensions)}`)]; - } + const dir = path.dirname(file) - return [path.posix.join(directory, '**')]; -}; + pathExists(dir, (err, itDoes) => { + if (err) return callback(err) + if (itDoes) return jsonFile.writeJson(file, data, options, callback) -module.exports = async (input, options) => { - options = { - cwd: process.cwd(), - ...options - }; + mkdir.mkdirs(dir, err => { + if (err) return callback(err) + jsonFile.writeJson(file, data, options, callback) + }) + }) +} - if (typeof options.cwd !== 'string') { - throw new TypeError(`Expected \`cwd\` to be of type \`string\` but received type \`${typeof options.cwd}\``); - } +module.exports = outputJson - const globs = await Promise.all([].concat(input).map(async x => { - const isDirectory = await pathType.isDirectory(getPath(x, options.cwd)); - return isDirectory ? getGlob(x, options) : x; - })); - return [].concat.apply([], globs); // eslint-disable-line prefer-spread -}; +/***/ }), -module.exports.sync = (input, options) => { - options = { - cwd: process.cwd(), - ...options - }; +/***/ 36813: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - if (typeof options.cwd !== 'string') { - throw new TypeError(`Expected \`cwd\` to be of type \`string\` but received type \`${typeof options.cwd}\``); - } +"use strict"; - const globs = [].concat(input).map(x => pathType.isDirectorySync(getPath(x, options.cwd)) ? getGlob(x, options) : x); +const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) +const mkdirs = u(__nccwpck_require__(71781)) +const mkdirsSync = __nccwpck_require__(28173) - return [].concat.apply([], globs); // eslint-disable-line prefer-spread -}; +module.exports = { + mkdirs, + mkdirsSync, + // alias + mkdirp: mkdirs, + mkdirpSync: mkdirsSync, + ensureDir: mkdirs, + ensureDirSync: mkdirsSync +} /***/ }), -/***/ 66096: +/***/ 28173: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -const path = __nccwpck_require__(16928); -const childProcess = __nccwpck_require__(35317); -const crossSpawn = __nccwpck_require__(24422); -const stripFinalNewline = __nccwpck_require__(68282); -const npmRunPath = __nccwpck_require__(87079); -const onetime = __nccwpck_require__(82405); -const makeError = __nccwpck_require__(46406); -const normalizeStdio = __nccwpck_require__(58729); -const {spawnedKill, spawnedCancel, setupTimeout, validateTimeout, setExitHandler} = __nccwpck_require__(98638); -const {handleInput, getSpawnedResult, makeAllStream, validateInputSync} = __nccwpck_require__(41762); -const {mergePromise, getSpawnedPromise} = __nccwpck_require__(98529); -const {joinCommand, parseCommand, getEscapedCommand} = __nccwpck_require__(32849); -const DEFAULT_MAX_BUFFER = 1000 * 1000 * 100; +const fs = __nccwpck_require__(61404) +const path = __nccwpck_require__(16928) +const invalidWin32Path = (__nccwpck_require__(38882).invalidWin32Path) -const getEnv = ({env: envOption, extendEnv, preferLocal, localDir, execPath}) => { - const env = extendEnv ? {...process.env, ...envOption} : envOption; +const o777 = parseInt('0777', 8) - if (preferLocal) { - return npmRunPath.env({env, cwd: localDir, execPath}); - } +function mkdirsSync (p, opts, made) { + if (!opts || typeof opts !== 'object') { + opts = { mode: opts } + } - return env; -}; + let mode = opts.mode + const xfs = opts.fs || fs -const handleArguments = (file, args, options = {}) => { - const parsed = crossSpawn._parse(file, args, options); - file = parsed.command; - args = parsed.args; - options = parsed.options; + if (process.platform === 'win32' && invalidWin32Path(p)) { + const errInval = new Error(p + ' contains invalid WIN32 path characters.') + errInval.code = 'EINVAL' + throw errInval + } - options = { - maxBuffer: DEFAULT_MAX_BUFFER, - buffer: true, - stripFinalNewline: true, - extendEnv: true, - preferLocal: false, - localDir: options.cwd || process.cwd(), - execPath: process.execPath, - encoding: 'utf8', - reject: true, - cleanup: true, - all: false, - windowsHide: true, - ...options - }; + if (mode === undefined) { + mode = o777 & (~process.umask()) + } + if (!made) made = null - options.env = getEnv(options); + p = path.resolve(p) - options.stdio = normalizeStdio(options); + try { + xfs.mkdirSync(p, mode) + made = made || p + } catch (err0) { + if (err0.code === 'ENOENT') { + if (path.dirname(p) === p) throw err0 + made = mkdirsSync(path.dirname(p), opts, made) + mkdirsSync(p, opts, made) + } else { + // In the case of any other error, just see if there's a dir there + // already. If so, then hooray! If not, then something is borked. + let stat + try { + stat = xfs.statSync(p) + } catch (err1) { + throw err0 + } + if (!stat.isDirectory()) throw err0 + } + } - if (process.platform === 'win32' && path.basename(file, '.exe') === 'cmd') { - // #116 - args.unshift('/q'); - } + return made +} - return {file, args, options, parsed}; -}; +module.exports = mkdirsSync -const handleOutput = (options, value, error) => { - if (typeof value !== 'string' && !Buffer.isBuffer(value)) { - // When `execa.sync()` errors, we normalize it to '' to mimic `execa()` - return error === undefined ? undefined : ''; - } - if (options.stripFinalNewline) { - return stripFinalNewline(value); - } +/***/ }), - return value; -}; +/***/ 71781: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const execa = (file, args, options) => { - const parsed = handleArguments(file, args, options); - const command = joinCommand(file, args); - const escapedCommand = getEscapedCommand(file, args); +"use strict"; - validateTimeout(parsed.options); - let spawned; - try { - spawned = childProcess.spawn(parsed.file, parsed.args, parsed.options); - } catch (error) { - // Ensure the returned error is always both a promise and a child process - const dummySpawned = new childProcess.ChildProcess(); - const errorPromise = Promise.reject(makeError({ - error, - stdout: '', - stderr: '', - all: '', - command, - escapedCommand, - parsed, - timedOut: false, - isCanceled: false, - killed: false - })); - return mergePromise(dummySpawned, errorPromise); - } +const fs = __nccwpck_require__(61404) +const path = __nccwpck_require__(16928) +const invalidWin32Path = (__nccwpck_require__(38882).invalidWin32Path) - const spawnedPromise = getSpawnedPromise(spawned); - const timedPromise = setupTimeout(spawned, parsed.options, spawnedPromise); - const processDone = setExitHandler(spawned, parsed.options, timedPromise); +const o777 = parseInt('0777', 8) - const context = {isCanceled: false}; +function mkdirs (p, opts, callback, made) { + if (typeof opts === 'function') { + callback = opts + opts = {} + } else if (!opts || typeof opts !== 'object') { + opts = { mode: opts } + } - spawned.kill = spawnedKill.bind(null, spawned.kill.bind(spawned)); - spawned.cancel = spawnedCancel.bind(null, spawned, context); + if (process.platform === 'win32' && invalidWin32Path(p)) { + const errInval = new Error(p + ' contains invalid WIN32 path characters.') + errInval.code = 'EINVAL' + return callback(errInval) + } - const handlePromise = async () => { - const [{error, exitCode, signal, timedOut}, stdoutResult, stderrResult, allResult] = await getSpawnedResult(spawned, parsed.options, processDone); - const stdout = handleOutput(parsed.options, stdoutResult); - const stderr = handleOutput(parsed.options, stderrResult); - const all = handleOutput(parsed.options, allResult); + let mode = opts.mode + const xfs = opts.fs || fs - if (error || exitCode !== 0 || signal !== null) { - const returnedError = makeError({ - error, - exitCode, - signal, - stdout, - stderr, - all, - command, - escapedCommand, - parsed, - timedOut, - isCanceled: context.isCanceled, - killed: spawned.killed - }); + if (mode === undefined) { + mode = o777 & (~process.umask()) + } + if (!made) made = null - if (!parsed.options.reject) { - return returnedError; - } + callback = callback || function () {} + p = path.resolve(p) - throw returnedError; - } + xfs.mkdir(p, mode, er => { + if (!er) { + made = made || p + return callback(null, made) + } + switch (er.code) { + case 'ENOENT': + if (path.dirname(p) === p) return callback(er) + mkdirs(path.dirname(p), opts, (er, made) => { + if (er) callback(er, made) + else mkdirs(p, opts, callback, made) + }) + break - return { - command, - escapedCommand, - exitCode: 0, - stdout, - stderr, - all, - failed: false, - timedOut: false, - isCanceled: false, - killed: false - }; - }; + // In the case of any other error, just see if there's a dir + // there already. If so, then hooray! If not, then something + // is borked. + default: + xfs.stat(p, (er2, stat) => { + // if the stat fails, then that's super weird. + // let the original error be the failure reason. + if (er2 || !stat.isDirectory()) callback(er, made) + else callback(null, made) + }) + break + } + }) +} - const handlePromiseOnce = onetime(handlePromise); +module.exports = mkdirs - handleInput(spawned, parsed.options.input); - spawned.all = makeAllStream(spawned, parsed.options); +/***/ }), - return mergePromise(spawned, handlePromiseOnce); -}; +/***/ 38882: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -module.exports = execa; +"use strict"; -module.exports.sync = (file, args, options) => { - const parsed = handleArguments(file, args, options); - const command = joinCommand(file, args); - const escapedCommand = getEscapedCommand(file, args); - validateInputSync(parsed.options); +const path = __nccwpck_require__(16928) - let result; - try { - result = childProcess.spawnSync(parsed.file, parsed.args, parsed.options); - } catch (error) { - throw makeError({ - error, - stdout: '', - stderr: '', - all: '', - command, - escapedCommand, - parsed, - timedOut: false, - isCanceled: false, - killed: false - }); - } +// get drive on windows +function getRootPath (p) { + p = path.normalize(path.resolve(p)).split(path.sep) + if (p.length > 0) return p[0] + return null +} - const stdout = handleOutput(parsed.options, result.stdout, result.error); - const stderr = handleOutput(parsed.options, result.stderr, result.error); +// http://stackoverflow.com/a/62888/10333 contains more accurate +// TODO: expand to include the rest +const INVALID_PATH_CHARS = /[<>:"|?*]/ - if (result.error || result.status !== 0 || result.signal !== null) { - const error = makeError({ - stdout, - stderr, - error: result.error, - signal: result.signal, - exitCode: result.status, - command, - escapedCommand, - parsed, - timedOut: result.error && result.error.code === 'ETIMEDOUT', - isCanceled: false, - killed: result.signal !== null - }); +function invalidWin32Path (p) { + const rp = getRootPath(p) + p = p.replace(rp, '') + return INVALID_PATH_CHARS.test(p) +} - if (!parsed.options.reject) { - return error; - } +module.exports = { + getRootPath, + invalidWin32Path +} - throw error; - } - return { - command, - escapedCommand, - exitCode: 0, - stdout, - stderr, - failed: false, - timedOut: false, - isCanceled: false, - killed: false - }; -}; +/***/ }), -module.exports.command = (command, options) => { - const [file, ...args] = parseCommand(command); - return execa(file, args, options); -}; +/***/ 57744: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -module.exports.commandSync = (command, options) => { - const [file, ...args] = parseCommand(command); - return execa.sync(file, args, options); -}; +"use strict"; -module.exports.node = (scriptPath, args, options = {}) => { - if (args && !Array.isArray(args) && typeof args === 'object') { - options = args; - args = []; - } - const stdio = normalizeStdio.node(options); - const defaultExecArgv = process.execArgv.filter(arg => !arg.startsWith('--inspect')); +const fs = __nccwpck_require__(61404) +const path = __nccwpck_require__(16928) +const copySync = (__nccwpck_require__(32864).copySync) +const removeSync = (__nccwpck_require__(63073).removeSync) +const mkdirpSync = (__nccwpck_require__(36813).mkdirsSync) +const buffer = __nccwpck_require__(79463) - const { - nodePath = process.execPath, - nodeOptions = defaultExecArgv - } = options; +function moveSync (src, dest, options) { + options = options || {} + const overwrite = options.overwrite || options.clobber || false - return execa( - nodePath, - [ - ...nodeOptions, - scriptPath, - ...(Array.isArray(args) ? args : []) - ], - { - ...options, - stdin: undefined, - stdout: undefined, - stderr: undefined, - stdio, - shell: false - } - ); -}; + src = path.resolve(src) + dest = path.resolve(dest) + if (src === dest) return fs.accessSync(src) -/***/ }), + if (isSrcSubdir(src, dest)) throw new Error(`Cannot move '${src}' into itself '${dest}'.`) -/***/ 32849: -/***/ ((module) => { + mkdirpSync(path.dirname(dest)) + tryRenameSync() -"use strict"; + function tryRenameSync () { + if (overwrite) { + try { + return fs.renameSync(src, dest) + } catch (err) { + if (err.code === 'ENOTEMPTY' || err.code === 'EEXIST' || err.code === 'EPERM') { + removeSync(dest) + options.overwrite = false // just overwriteed it, no need to do it again + return moveSync(src, dest, options) + } -const normalizeArgs = (file, args = []) => { - if (!Array.isArray(args)) { - return [file]; - } + if (err.code !== 'EXDEV') throw err + return moveSyncAcrossDevice(src, dest, overwrite) + } + } else { + try { + fs.linkSync(src, dest) + return fs.unlinkSync(src) + } catch (err) { + if (err.code === 'EXDEV' || err.code === 'EISDIR' || err.code === 'EPERM' || err.code === 'ENOTSUP') { + return moveSyncAcrossDevice(src, dest, overwrite) + } + throw err + } + } + } +} - return [file, ...args]; -}; +function moveSyncAcrossDevice (src, dest, overwrite) { + const stat = fs.statSync(src) -const NO_ESCAPE_REGEXP = /^[\w.-]+$/; -const DOUBLE_QUOTES_REGEXP = /"/g; + if (stat.isDirectory()) { + return moveDirSyncAcrossDevice(src, dest, overwrite) + } else { + return moveFileSyncAcrossDevice(src, dest, overwrite) + } +} -const escapeArg = arg => { - if (typeof arg !== 'string' || NO_ESCAPE_REGEXP.test(arg)) { - return arg; - } +function moveFileSyncAcrossDevice (src, dest, overwrite) { + const BUF_LENGTH = 64 * 1024 + const _buff = buffer(BUF_LENGTH) - return `"${arg.replace(DOUBLE_QUOTES_REGEXP, '\\"')}"`; -}; + const flags = overwrite ? 'w' : 'wx' -const joinCommand = (file, args) => { - return normalizeArgs(file, args).join(' '); -}; + const fdr = fs.openSync(src, 'r') + const stat = fs.fstatSync(fdr) + const fdw = fs.openSync(dest, flags, stat.mode) + let pos = 0 -const getEscapedCommand = (file, args) => { - return normalizeArgs(file, args).map(arg => escapeArg(arg)).join(' '); -}; + while (pos < stat.size) { + const bytesRead = fs.readSync(fdr, _buff, 0, BUF_LENGTH, pos) + fs.writeSync(fdw, _buff, 0, bytesRead) + pos += bytesRead + } -const SPACES_REGEXP = / +/g; + fs.closeSync(fdr) + fs.closeSync(fdw) + return fs.unlinkSync(src) +} -// Handle `execa.command()` -const parseCommand = command => { - const tokens = []; - for (const token of command.trim().split(SPACES_REGEXP)) { - // Allow spaces to be escaped by a backslash if not meant as a delimiter - const previousToken = tokens[tokens.length - 1]; - if (previousToken && previousToken.endsWith('\\')) { - // Merge previous token with current one - tokens[tokens.length - 1] = `${previousToken.slice(0, -1)} ${token}`; - } else { - tokens.push(token); - } - } +function moveDirSyncAcrossDevice (src, dest, overwrite) { + const options = { + overwrite: false + } - return tokens; -}; + if (overwrite) { + removeSync(dest) + tryCopySync() + } else { + tryCopySync() + } + + function tryCopySync () { + copySync(src, dest, options) + return removeSync(src) + } +} + +// return true if dest is a subdir of src, otherwise false. +// extract dest base dir and check if that is the same as src basename +function isSrcSubdir (src, dest) { + try { + return fs.statSync(src).isDirectory() && + src !== dest && + dest.indexOf(src) > -1 && + dest.split(path.dirname(src) + path.sep)[1].split(path.sep)[0] === path.basename(src) + } catch (e) { + return false + } +} module.exports = { - joinCommand, - getEscapedCommand, - parseCommand -}; + moveSync +} /***/ }), -/***/ 46406: +/***/ 95256: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -const {signalsByName} = __nccwpck_require__(76594); - -const getErrorPrefix = ({timedOut, timeout, errorCode, signal, signalDescription, exitCode, isCanceled}) => { - if (timedOut) { - return `timed out after ${timeout} milliseconds`; - } - - if (isCanceled) { - return 'was canceled'; - } - if (errorCode !== undefined) { - return `failed with ${errorCode}`; - } +const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) +const fs = __nccwpck_require__(61404) +const path = __nccwpck_require__(16928) +const copy = (__nccwpck_require__(80424).copy) +const remove = (__nccwpck_require__(63073).remove) +const mkdirp = (__nccwpck_require__(36813).mkdirp) +const pathExists = (__nccwpck_require__(26949).pathExists) - if (signal !== undefined) { - return `was killed with ${signal} (${signalDescription})`; - } +function move (src, dest, opts, cb) { + if (typeof opts === 'function') { + cb = opts + opts = {} + } - if (exitCode !== undefined) { - return `failed with exit code ${exitCode}`; - } + const overwrite = opts.overwrite || opts.clobber || false - return 'failed'; -}; + src = path.resolve(src) + dest = path.resolve(dest) -const makeError = ({ - stdout, - stderr, - all, - error, - signal, - exitCode, - command, - escapedCommand, - timedOut, - isCanceled, - killed, - parsed: {options: {timeout}} -}) => { - // `signal` and `exitCode` emitted on `spawned.on('exit')` event can be `null`. - // We normalize them to `undefined` - exitCode = exitCode === null ? undefined : exitCode; - signal = signal === null ? undefined : signal; - const signalDescription = signal === undefined ? undefined : signalsByName[signal].description; + if (src === dest) return fs.access(src, cb) - const errorCode = error && error.code; + fs.stat(src, (err, st) => { + if (err) return cb(err) - const prefix = getErrorPrefix({timedOut, timeout, errorCode, signal, signalDescription, exitCode, isCanceled}); - const execaMessage = `Command ${prefix}: ${command}`; - const isError = Object.prototype.toString.call(error) === '[object Error]'; - const shortMessage = isError ? `${execaMessage}\n${error.message}` : execaMessage; - const message = [shortMessage, stderr, stdout].filter(Boolean).join('\n'); + if (st.isDirectory() && isSrcSubdir(src, dest)) { + return cb(new Error(`Cannot move '${src}' to a subdirectory of itself, '${dest}'.`)) + } + mkdirp(path.dirname(dest), err => { + if (err) return cb(err) + return doRename(src, dest, overwrite, cb) + }) + }) +} - if (isError) { - error.originalMessage = error.message; - error.message = message; - } else { - error = new Error(message); - } +function doRename (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) + }) +} - error.shortMessage = shortMessage; - error.command = command; - error.escapedCommand = escapedCommand; - error.exitCode = exitCode; - error.signal = signal; - error.signalDescription = signalDescription; - error.stdout = stdout; - error.stderr = stderr; +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) + }) +} - if (all !== undefined) { - error.all = all; - } +function moveAcrossDevice (src, dest, overwrite, cb) { + const opts = { + overwrite, + errorOnExist: true + } - if ('bufferedData' in error) { - delete error.bufferedData; - } + copy(src, dest, opts, err => { + if (err) return cb(err) + return remove(src, cb) + }) +} - error.failed = true; - error.timedOut = Boolean(timedOut); - error.isCanceled = isCanceled; - error.killed = killed && !timedOut; +function isSrcSubdir (src, dest) { + const srcArray = src.split(path.sep) + const destArray = dest.split(path.sep) - return error; -}; + return srcArray.reduce((acc, current, i) => { + return acc && destArray[i] === current + }, true) +} -module.exports = makeError; +module.exports = { + move: u(move) +} /***/ }), -/***/ 98638: +/***/ 14552: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -const os = __nccwpck_require__(70857); -const onExit = __nccwpck_require__(791); -const DEFAULT_FORCE_KILL_TIMEOUT = 1000 * 5; +const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) +const fs = __nccwpck_require__(61404) +const path = __nccwpck_require__(16928) +const mkdir = __nccwpck_require__(36813) +const pathExists = (__nccwpck_require__(26949).pathExists) -// Monkey-patches `childProcess.kill()` to add `forceKillAfterTimeout` behavior -const spawnedKill = (kill, signal = 'SIGTERM', options = {}) => { - const killResult = kill(signal); - setKillTimeout(kill, signal, options, killResult); - return killResult; -}; +function outputFile (file, data, encoding, callback) { + if (typeof encoding === 'function') { + callback = encoding + encoding = 'utf8' + } -const setKillTimeout = (kill, signal, options, killResult) => { - if (!shouldForceKill(signal, options, killResult)) { - return; - } + const dir = path.dirname(file) + pathExists(dir, (err, itDoes) => { + if (err) return callback(err) + if (itDoes) return fs.writeFile(file, data, encoding, callback) - const timeout = getForceKillAfterTimeout(options); - const t = setTimeout(() => { - kill('SIGKILL'); - }, timeout); + mkdir.mkdirs(dir, err => { + if (err) return callback(err) - // Guarded because there's no `.unref()` when `execa` is used in the renderer - // process in Electron. This cannot be tested since we don't run tests in - // Electron. - // istanbul ignore else - if (t.unref) { - t.unref(); - } -}; - -const shouldForceKill = (signal, {forceKillAfterTimeout}, killResult) => { - return isSigterm(signal) && forceKillAfterTimeout !== false && killResult; -}; + fs.writeFile(file, data, encoding, callback) + }) + }) +} -const isSigterm = signal => { - return signal === os.constants.signals.SIGTERM || - (typeof signal === 'string' && signal.toUpperCase() === 'SIGTERM'); -}; +function outputFileSync (file, ...args) { + const dir = path.dirname(file) + if (fs.existsSync(dir)) { + return fs.writeFileSync(file, ...args) + } + mkdir.mkdirsSync(dir) + fs.writeFileSync(file, ...args) +} -const getForceKillAfterTimeout = ({forceKillAfterTimeout = true}) => { - if (forceKillAfterTimeout === true) { - return DEFAULT_FORCE_KILL_TIMEOUT; - } +module.exports = { + outputFile: u(outputFile), + outputFileSync +} - if (!Number.isFinite(forceKillAfterTimeout) || forceKillAfterTimeout < 0) { - throw new TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${forceKillAfterTimeout}\` (${typeof forceKillAfterTimeout})`); - } - return forceKillAfterTimeout; -}; +/***/ }), -// `childProcess.cancel()` -const spawnedCancel = (spawned, context) => { - const killResult = spawned.kill(); +/***/ 26949: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - if (killResult) { - context.isCanceled = true; - } -}; +"use strict"; -const timeoutKill = (spawned, signal, reject) => { - spawned.kill(signal); - reject(Object.assign(new Error('Timed out'), {timedOut: true, signal})); -}; +const u = (__nccwpck_require__(92977)/* .fromPromise */ .z) +const fs = __nccwpck_require__(9238) -// `timeout` option handling -const setupTimeout = (spawned, {timeout, killSignal = 'SIGTERM'}, spawnedPromise) => { - if (timeout === 0 || timeout === undefined) { - return spawnedPromise; - } +function pathExists (path) { + return fs.access(path).then(() => true).catch(() => false) +} - let timeoutId; - const timeoutPromise = new Promise((resolve, reject) => { - timeoutId = setTimeout(() => { - timeoutKill(spawned, killSignal, reject); - }, timeout); - }); +module.exports = { + pathExists: u(pathExists), + pathExistsSync: fs.existsSync +} - const safeSpawnedPromise = spawnedPromise.finally(() => { - clearTimeout(timeoutId); - }); - return Promise.race([timeoutPromise, safeSpawnedPromise]); -}; +/***/ }), -const validateTimeout = ({timeout}) => { - if (timeout !== undefined && (!Number.isFinite(timeout) || timeout < 0)) { - throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${timeout}\` (${typeof timeout})`); - } -}; +/***/ 63073: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -// `cleanup` option handling -const setExitHandler = async (spawned, {cleanup, detached}, timedPromise) => { - if (!cleanup || detached) { - return timedPromise; - } +"use strict"; - const removeExitHandler = onExit(() => { - spawned.kill(); - }); - return timedPromise.finally(() => { - removeExitHandler(); - }); -}; +const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) +const rimraf = __nccwpck_require__(95228) module.exports = { - spawnedKill, - spawnedCancel, - setupTimeout, - validateTimeout, - setExitHandler -}; + remove: u(rimraf), + removeSync: rimraf.sync +} /***/ }), -/***/ 98529: -/***/ ((module) => { +/***/ 95228: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -const nativePromisePrototype = (async () => {})().constructor.prototype; -const descriptors = ['then', 'catch', 'finally'].map(property => [ - property, - Reflect.getOwnPropertyDescriptor(nativePromisePrototype, property) -]); +const fs = __nccwpck_require__(61404) +const path = __nccwpck_require__(16928) +const assert = __nccwpck_require__(42613) -// The return value is a mixin of `childProcess` and `Promise` -const mergePromise = (spawned, promise) => { - for (const [property, descriptor] of descriptors) { - // Starting the main `promise` is deferred to avoid consuming streams - const value = typeof promise === 'function' ? - (...args) => Reflect.apply(descriptor.value, promise(), args) : - descriptor.value.bind(promise); +const isWindows = (process.platform === 'win32') - Reflect.defineProperty(spawned, property, {...descriptor, value}); - } +function defaults (options) { + const methods = [ + 'unlink', + 'chmod', + 'stat', + 'lstat', + 'rmdir', + 'readdir' + ] + methods.forEach(m => { + options[m] = options[m] || fs[m] + m = m + 'Sync' + options[m] = options[m] || fs[m] + }) - return spawned; -}; + options.maxBusyTries = options.maxBusyTries || 3 +} -// Use promises instead of `child_process` events -const getSpawnedPromise = spawned => { - return new Promise((resolve, reject) => { - spawned.on('exit', (exitCode, signal) => { - resolve({exitCode, signal}); - }); +function rimraf (p, options, cb) { + let busyTries = 0 - spawned.on('error', error => { - reject(error); - }); + if (typeof options === 'function') { + cb = options + options = {} + } - if (spawned.stdin) { - spawned.stdin.on('error', error => { - reject(error); - }); - } - }); -}; + assert(p, 'rimraf: missing path') + assert.strictEqual(typeof p, 'string', 'rimraf: path should be a string') + assert.strictEqual(typeof cb, 'function', 'rimraf: callback function required') + assert(options, 'rimraf: invalid options argument provided') + assert.strictEqual(typeof options, 'object', 'rimraf: options should be object') -module.exports = { - mergePromise, - getSpawnedPromise -}; + defaults(options) + rimraf_(p, options, function CB (er) { + if (er) { + if ((er.code === 'EBUSY' || er.code === 'ENOTEMPTY' || er.code === 'EPERM') && + busyTries < options.maxBusyTries) { + busyTries++ + const time = busyTries * 100 + // try again, with the same exact callback as this one. + return setTimeout(() => rimraf_(p, options, CB), time) + } + // already gone + if (er.code === 'ENOENT') er = null + } -/***/ }), + cb(er) + }) +} -/***/ 58729: -/***/ ((module) => { +// Two possible strategies. +// 1. Assume it's a file. unlink it, then do the dir stuff on EPERM or EISDIR +// 2. Assume it's a directory. readdir, then do the file stuff on ENOTDIR +// +// Both result in an extra syscall when you guess wrong. However, there +// are likely far more normal files in the world than directories. This +// is based on the assumption that a the average number of files per +// directory is >= 1. +// +// If anyone ever complains about this, then I guess the strategy could +// be made configurable somehow. But until then, YAGNI. +function rimraf_ (p, options, cb) { + assert(p) + assert(options) + assert(typeof cb === 'function') -"use strict"; + // sunos lets the root user unlink directories, which is... weird. + // so we have to lstat here and make sure it's not a dir. + options.lstat(p, (er, st) => { + if (er && er.code === 'ENOENT') { + return cb(null) + } -const aliases = ['stdin', 'stdout', 'stderr']; + // Windows can EPERM on stat. Life is suffering. + if (er && er.code === 'EPERM' && isWindows) { + return fixWinEPERM(p, options, er, cb) + } -const hasAlias = options => aliases.some(alias => options[alias] !== undefined); + if (st && st.isDirectory()) { + return rmdir(p, options, er, cb) + } -const normalizeStdio = options => { - if (!options) { - return; - } + options.unlink(p, er => { + if (er) { + if (er.code === 'ENOENT') { + return cb(null) + } + if (er.code === 'EPERM') { + return (isWindows) + ? fixWinEPERM(p, options, er, cb) + : rmdir(p, options, er, cb) + } + if (er.code === 'EISDIR') { + return rmdir(p, options, er, cb) + } + } + return cb(er) + }) + }) +} - const {stdio} = options; +function fixWinEPERM (p, options, er, cb) { + assert(p) + assert(options) + assert(typeof cb === 'function') + if (er) { + assert(er instanceof Error) + } - if (stdio === undefined) { - return aliases.map(alias => options[alias]); - } + options.chmod(p, 0o666, er2 => { + if (er2) { + cb(er2.code === 'ENOENT' ? null : er) + } else { + options.stat(p, (er3, stats) => { + if (er3) { + cb(er3.code === 'ENOENT' ? null : er) + } else if (stats.isDirectory()) { + rmdir(p, options, er, cb) + } else { + options.unlink(p, cb) + } + }) + } + }) +} - if (hasAlias(options)) { - throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${aliases.map(alias => `\`${alias}\``).join(', ')}`); - } +function fixWinEPERMSync (p, options, er) { + let stats - if (typeof stdio === 'string') { - return stdio; - } + assert(p) + assert(options) + if (er) { + assert(er instanceof Error) + } - if (!Array.isArray(stdio)) { - throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof stdio}\``); - } + try { + options.chmodSync(p, 0o666) + } catch (er2) { + if (er2.code === 'ENOENT') { + return + } else { + throw er + } + } - const length = Math.max(stdio.length, aliases.length); - return Array.from({length}, (value, index) => stdio[index]); -}; + try { + stats = options.statSync(p) + } catch (er3) { + if (er3.code === 'ENOENT') { + return + } else { + throw er + } + } -module.exports = normalizeStdio; + if (stats.isDirectory()) { + rmdirSync(p, options, er) + } else { + options.unlinkSync(p) + } +} -// `ipc` is pushed unless it is already present -module.exports.node = options => { - const stdio = normalizeStdio(options); +function rmdir (p, options, originalEr, cb) { + assert(p) + assert(options) + if (originalEr) { + assert(originalEr instanceof Error) + } + assert(typeof cb === 'function') - if (stdio === 'ipc') { - return 'ipc'; - } + // try to rmdir first, and only readdir on ENOTEMPTY or EEXIST (SunOS) + // if we guessed wrong, and it's not a directory, then + // raise the original error. + options.rmdir(p, er => { + if (er && (er.code === 'ENOTEMPTY' || er.code === 'EEXIST' || er.code === 'EPERM')) { + rmkids(p, options, cb) + } else if (er && er.code === 'ENOTDIR') { + cb(originalEr) + } else { + cb(er) + } + }) +} - if (stdio === undefined || typeof stdio === 'string') { - return [stdio, stdio, stdio, 'ipc']; - } +function rmkids (p, options, cb) { + assert(p) + assert(options) + assert(typeof cb === 'function') - if (stdio.includes('ipc')) { - return stdio; - } + options.readdir(p, (er, files) => { + if (er) return cb(er) - return [...stdio, 'ipc']; -}; + let n = files.length + let errState + if (n === 0) return options.rmdir(p, cb) -/***/ }), + files.forEach(f => { + rimraf(path.join(p, f), options, er => { + if (errState) { + return + } + if (er) return cb(errState = er) + if (--n === 0) { + options.rmdir(p, cb) + } + }) + }) + }) +} -/***/ 41762: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +// this looks simpler, and is strictly *faster*, but will +// tie up the JavaScript thread and fail on excessively +// deep directory trees. +function rimrafSync (p, options) { + let st -"use strict"; + options = options || {} + defaults(options) -const isStream = __nccwpck_require__(81011); -const getStream = __nccwpck_require__(91559); -const mergeStream = __nccwpck_require__(22655); + assert(p, 'rimraf: missing path') + assert.strictEqual(typeof p, 'string', 'rimraf: path should be a string') + assert(options, 'rimraf: missing options') + assert.strictEqual(typeof options, 'object', 'rimraf: options should be object') -// `input` option -const handleInput = (spawned, input) => { - // Checking for stdin is workaround for https://github.com/nodejs/node/issues/26852 - // @todo remove `|| spawned.stdin === undefined` once we drop support for Node.js <=12.2.0 - if (input === undefined || spawned.stdin === undefined) { - return; - } + try { + st = options.lstatSync(p) + } catch (er) { + if (er.code === 'ENOENT') { + return + } - if (isStream(input)) { - input.pipe(spawned.stdin); - } else { - spawned.stdin.end(input); - } -}; + // Windows can EPERM on stat. Life is suffering. + if (er.code === 'EPERM' && isWindows) { + fixWinEPERMSync(p, options, er) + } + } -// `all` interleaves `stdout` and `stderr` -const makeAllStream = (spawned, {all}) => { - if (!all || (!spawned.stdout && !spawned.stderr)) { - return; - } + try { + // sunos lets the root user unlink directories, which is... weird. + if (st && st.isDirectory()) { + rmdirSync(p, options, null) + } else { + options.unlinkSync(p) + } + } catch (er) { + if (er.code === 'ENOENT') { + return + } else if (er.code === 'EPERM') { + return isWindows ? fixWinEPERMSync(p, options, er) : rmdirSync(p, options, er) + } else if (er.code !== 'EISDIR') { + throw er + } + rmdirSync(p, options, er) + } +} - const mixed = mergeStream(); +function rmdirSync (p, options, originalEr) { + assert(p) + assert(options) + if (originalEr) { + assert(originalEr instanceof Error) + } - if (spawned.stdout) { - mixed.add(spawned.stdout); - } + try { + options.rmdirSync(p) + } catch (er) { + if (er.code === 'ENOTDIR') { + throw originalEr + } else if (er.code === 'ENOTEMPTY' || er.code === 'EEXIST' || er.code === 'EPERM') { + rmkidsSync(p, options) + } else if (er.code !== 'ENOENT') { + throw er + } + } +} - if (spawned.stderr) { - mixed.add(spawned.stderr); - } +function rmkidsSync (p, options) { + assert(p) + assert(options) + options.readdirSync(p).forEach(f => rimrafSync(path.join(p, f), options)) - return mixed; -}; + if (isWindows) { + // We only end up here once we got ENOTEMPTY at least once, and + // at this point, we are guaranteed to have removed all the kids. + // So, we know that it won't be ENOENT or ENOTDIR or anything else. + // try really hard to delete stuff on windows, because it has a + // PROFOUNDLY annoying habit of not closing handles promptly when + // files are deleted, resulting in spurious ENOTEMPTY errors. + const startTime = Date.now() + do { + try { + const ret = options.rmdirSync(p, options) + return ret + } catch (er) { } + } while (Date.now() - startTime < 500) // give up after 500ms + } else { + const ret = options.rmdirSync(p, options) + return ret + } +} -// On failure, `result.stdout|stderr|all` should contain the currently buffered stream -const getBufferedData = async (stream, streamPromise) => { - if (!stream) { - return; - } +module.exports = rimraf +rimraf.sync = rimrafSync - stream.destroy(); - try { - return await streamPromise; - } catch (error) { - return error.bufferedData; - } -}; +/***/ }), -const getStreamPromise = (stream, {encoding, buffer, maxBuffer}) => { - if (!stream || !buffer) { - return; - } +/***/ 79463: +/***/ ((module) => { - if (encoding) { - return getStream(stream, {encoding, maxBuffer}); - } +"use strict"; - return getStream.buffer(stream, {maxBuffer}); -}; +/* eslint-disable node/no-deprecated-api */ +module.exports = function (size) { + if (typeof Buffer.allocUnsafe === 'function') { + try { + return Buffer.allocUnsafe(size) + } catch (e) { + return new Buffer(size) + } + } + return new Buffer(size) +} -// Retrieve result of child process: exit code, signal, error, streams (stdout/stderr/all) -const getSpawnedResult = async ({stdout, stderr, all}, {encoding, buffer, maxBuffer}, processDone) => { - const stdoutPromise = getStreamPromise(stdout, {encoding, buffer, maxBuffer}); - const stderrPromise = getStreamPromise(stderr, {encoding, buffer, maxBuffer}); - const allPromise = getStreamPromise(all, {encoding, buffer, maxBuffer: maxBuffer * 2}); - try { - return await Promise.all([processDone, stdoutPromise, stderrPromise, allPromise]); - } catch (error) { - return Promise.all([ - {error, signal: error.signal, timedOut: error.timedOut}, - getBufferedData(stdout, stdoutPromise), - getBufferedData(stderr, stderrPromise), - getBufferedData(all, allPromise) - ]); - } -}; +/***/ }), -const validateInputSync = ({input}) => { - if (isStream(input)) { - throw new TypeError('The `input` option cannot be a stream in sync mode'); - } -}; +/***/ 51226: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -module.exports = { - handleInput, - makeAllStream, - getSpawnedResult, - validateInputSync -}; +"use strict"; + + +const fs = __nccwpck_require__(61404) +const os = __nccwpck_require__(70857) +const path = __nccwpck_require__(16928) + +// HFS, ext{2,3}, FAT do not, Node.js v0.10 does not +function hasMillisResSync () { + let tmpfile = path.join('millis-test-sync' + Date.now().toString() + Math.random().toString().slice(2)) + tmpfile = path.join(os.tmpdir(), tmpfile) + + // 550 millis past UNIX epoch + const d = new Date(1435410243862) + fs.writeFileSync(tmpfile, 'https://github.com/jprichardson/node-fs-extra/pull/141') + const fd = fs.openSync(tmpfile, 'r+') + fs.futimesSync(fd, d, d) + fs.closeSync(fd) + return fs.statSync(tmpfile).mtime > 1435410243000 +} + +function hasMillisRes (callback) { + let tmpfile = path.join('millis-test' + Date.now().toString() + Math.random().toString().slice(2)) + tmpfile = path.join(os.tmpdir(), tmpfile) + + // 550 millis past UNIX epoch + const d = new Date(1435410243862) + fs.writeFile(tmpfile, 'https://github.com/jprichardson/node-fs-extra/pull/141', err => { + if (err) return callback(err) + fs.open(tmpfile, 'r+', (err, fd) => { + if (err) return callback(err) + fs.futimes(fd, d, d, err => { + if (err) return callback(err) + fs.close(fd, err => { + if (err) return callback(err) + fs.stat(tmpfile, (err, stats) => { + if (err) return callback(err) + callback(null, stats.mtime > 1435410243000) + }) + }) + }) + }) + }) +} + +function timeRemoveMillis (timestamp) { + if (typeof timestamp === 'number') { + return Math.floor(timestamp / 1000) * 1000 + } else if (timestamp instanceof Date) { + return new Date(Math.floor(timestamp.getTime() / 1000) * 1000) + } else { + throw new Error('fs-extra: timeRemoveMillis() unknown parameter type') + } +} + +function utimesMillis (path, atime, mtime, callback) { + // if (!HAS_MILLIS_RES) return fs.utimes(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+') + fs.futimesSync(fd, atime, mtime) + return fs.closeSync(fd) +} + +module.exports = { + hasMillisRes, + hasMillisResSync, + timeRemoveMillis, + utimesMillis, + utimesMillisSync +} /***/ }), -/***/ 75522: -/***/ (function(__unused_webpack_module, exports) { +/***/ 95338: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", ({ value: true })); -var ExtendableError = /** @class */ (function (_super) { - __extends(ExtendableError, _super); - function ExtendableError(message) { - var _newTarget = this.constructor; - if (message === void 0) { message = ''; } - var _this = _super.call(this, message) || this; - _this.message = message; - Object.setPrototypeOf(_this, _newTarget.prototype); - delete _this.stack; - _this.name = _newTarget.name; - _this._error = new Error(); - return _this; - } - Object.defineProperty(ExtendableError.prototype, "stack", { - get: function () { - if (this._stack) { - return this._stack; - } - var prototype = Object.getPrototypeOf(this); - var depth = 1; - loop: while (prototype) { - switch (prototype) { - case ExtendableError.prototype: - break loop; - case Object.prototype: - depth = 1; - break loop; - default: - depth++; - break; - } - prototype = Object.getPrototypeOf(prototype); - } - var stackLines = (this._error.stack || '').match(/.+/g) || []; - var nameLine = this.name; - if (this.message) { - nameLine += ": " + this.message; - } - stackLines.splice(0, depth + 1, nameLine); - return this._stack = stackLines.join('\n'); - }, - enumerable: true, - configurable: true - }); - return ExtendableError; -}(Error)); -exports.ExtendableError = ExtendableError; -exports["default"] = ExtendableError; -//# sourceMappingURL=index.js.map +const {PassThrough: PassThroughStream} = __nccwpck_require__(2203); + +module.exports = options => { + options = {...options}; + + const {array} = options; + let {encoding} = options; + const isBuffer = encoding === 'buffer'; + let objectMode = false; + + if (array) { + objectMode = !(encoding || isBuffer); + } else { + encoding = encoding || 'utf8'; + } + + if (isBuffer) { + encoding = null; + } + + const stream = new PassThroughStream({objectMode}); + + if (encoding) { + stream.setEncoding(encoding); + } + + let length = 0; + const chunks = []; + + stream.on('data', chunk => { + chunks.push(chunk); + + if (objectMode) { + length = chunks.length; + } else { + length += chunk.length; + } + }); + + stream.getBufferedValue = () => { + if (array) { + return chunks; + } + + return isBuffer ? Buffer.concat(chunks, length) : chunks.join(''); + }; + + stream.getBufferedLength = () => length; + + return stream; +}; + /***/ }), -/***/ 10484: +/***/ 91559: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -const taskManager = __nccwpck_require__(12123); -const async_1 = __nccwpck_require__(95649); -const stream_1 = __nccwpck_require__(80613); -const sync_1 = __nccwpck_require__(81850); -const settings_1 = __nccwpck_require__(34763); -const utils = __nccwpck_require__(1062); -async function FastGlob(source, options) { - assertPatternsInput(source); - const works = getWorks(source, async_1.default, options); - const result = await Promise.all(works); - return utils.array.flatten(result); -} -// https://github.com/typescript-eslint/typescript-eslint/issues/60 -// eslint-disable-next-line no-redeclare -(function (FastGlob) { - FastGlob.glob = FastGlob; - FastGlob.globSync = sync; - FastGlob.globStream = stream; - FastGlob.async = FastGlob; - function sync(source, options) { - assertPatternsInput(source); - const works = getWorks(source, sync_1.default, options); - return utils.array.flatten(works); - } - FastGlob.sync = sync; - function stream(source, options) { - assertPatternsInput(source); - const works = getWorks(source, stream_1.default, options); - /** - * The stream returned by the provider cannot work with an asynchronous iterator. - * To support asynchronous iterators, regardless of the number of tasks, we always multiplex streams. - * This affects performance (+25%). I don't see best solution right now. - */ - return utils.stream.merge(works); - } - FastGlob.stream = stream; - function generateTasks(source, options) { - assertPatternsInput(source); - const patterns = [].concat(source); - const settings = new settings_1.default(options); - return taskManager.generate(patterns, settings); - } - FastGlob.generateTasks = generateTasks; - function isDynamicPattern(source, options) { - assertPatternsInput(source); - const settings = new settings_1.default(options); - return utils.pattern.isDynamicPattern(source, settings); - } - FastGlob.isDynamicPattern = isDynamicPattern; - function escapePath(source) { - assertPatternsInput(source); - return utils.path.escape(source); - } - FastGlob.escapePath = escapePath; - function convertPathToPattern(source) { - assertPatternsInput(source); - return utils.path.convertPathToPattern(source); - } - FastGlob.convertPathToPattern = convertPathToPattern; - let posix; - (function (posix) { - function escapePath(source) { - assertPatternsInput(source); - return utils.path.escapePosixPath(source); - } - posix.escapePath = escapePath; - function convertPathToPattern(source) { - assertPatternsInput(source); - return utils.path.convertPosixPathToPattern(source); - } - posix.convertPathToPattern = convertPathToPattern; - })(posix = FastGlob.posix || (FastGlob.posix = {})); - let win32; - (function (win32) { - function escapePath(source) { - assertPatternsInput(source); - return utils.path.escapeWindowsPath(source); - } - win32.escapePath = escapePath; - function convertPathToPattern(source) { - assertPatternsInput(source); - return utils.path.convertWindowsPathToPattern(source); - } - win32.convertPathToPattern = convertPathToPattern; - })(win32 = FastGlob.win32 || (FastGlob.win32 = {})); -})(FastGlob || (FastGlob = {})); -function getWorks(source, _Provider, options) { - const patterns = [].concat(source); - const settings = new settings_1.default(options); - const tasks = taskManager.generate(patterns, settings); - const provider = new _Provider(settings); - return tasks.map(provider.read, provider); -} -function assertPatternsInput(input) { - const source = [].concat(input); - const isValidSource = source.every((item) => utils.string.isString(item) && !utils.string.isEmpty(item)); - if (!isValidSource) { - throw new TypeError('Patterns must be a string (non empty) or an array of strings'); - } +const {constants: BufferConstants} = __nccwpck_require__(20181); +const stream = __nccwpck_require__(2203); +const {promisify} = __nccwpck_require__(39023); +const bufferStream = __nccwpck_require__(95338); + +const streamPipelinePromisified = promisify(stream.pipeline); + +class MaxBufferError extends Error { + constructor() { + super('maxBuffer exceeded'); + this.name = 'MaxBufferError'; + } } -module.exports = FastGlob; +async function getStream(inputStream, options) { + if (!inputStream) { + throw new Error('Expected a stream'); + } -/***/ }), + options = { + maxBuffer: Infinity, + ...options + }; -/***/ 12123: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + const {maxBuffer} = options; + const stream = bufferStream(options); -"use strict"; + await new Promise((resolve, reject) => { + const rejectPromise = error => { + // Don't retrieve an oversized buffer. + if (error && stream.getBufferedLength() <= BufferConstants.MAX_LENGTH) { + error.bufferedData = stream.getBufferedValue(); + } -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.convertPatternGroupToTask = exports.convertPatternGroupsToTasks = exports.groupPatternsByBaseDirectory = exports.getNegativePatternsAsPositive = exports.getPositivePatterns = exports.convertPatternsToTasks = exports.generate = void 0; -const utils = __nccwpck_require__(1062); -function generate(input, settings) { - const patterns = processPatterns(input, settings); - const ignore = processPatterns(settings.ignore, settings); - const positivePatterns = getPositivePatterns(patterns); - const negativePatterns = getNegativePatternsAsPositive(patterns, ignore); - const staticPatterns = positivePatterns.filter((pattern) => utils.pattern.isStaticPattern(pattern, settings)); - const dynamicPatterns = positivePatterns.filter((pattern) => utils.pattern.isDynamicPattern(pattern, settings)); - const staticTasks = convertPatternsToTasks(staticPatterns, negativePatterns, /* dynamic */ false); - const dynamicTasks = convertPatternsToTasks(dynamicPatterns, negativePatterns, /* dynamic */ true); - return staticTasks.concat(dynamicTasks); -} -exports.generate = generate; -function processPatterns(input, settings) { - let patterns = input; - /** - * The original pattern like `{,*,**,a/*}` can lead to problems checking the depth when matching entry - * and some problems with the micromatch package (see fast-glob issues: #365, #394). - * - * To solve this problem, we expand all patterns containing brace expansion. This can lead to a slight slowdown - * in matching in the case of a large set of patterns after expansion. - */ - if (settings.braceExpansion) { - patterns = utils.pattern.expandPatternsWithBraceExpansion(patterns); - } - /** - * If the `baseNameMatch` option is enabled, we must add globstar to patterns, so that they can be used - * at any nesting level. - * - * We do this here, because otherwise we have to complicate the filtering logic. For example, we need to change - * the pattern in the filter before creating a regular expression. There is no need to change the patterns - * in the application. Only on the input. - */ - if (settings.baseNameMatch) { - patterns = patterns.map((pattern) => pattern.includes('/') ? pattern : `**/${pattern}`); - } - /** - * This method also removes duplicate slashes that may have been in the pattern or formed as a result of expansion. - */ - return patterns.map((pattern) => utils.pattern.removeDuplicateSlashes(pattern)); -} -/** - * Returns tasks grouped by basic pattern directories. - * - * Patterns that can be found inside (`./`) and outside (`../`) the current directory are handled separately. - * This is necessary because directory traversal starts at the base directory and goes deeper. - */ -function convertPatternsToTasks(positive, negative, dynamic) { - const tasks = []; - const patternsOutsideCurrentDirectory = utils.pattern.getPatternsOutsideCurrentDirectory(positive); - const patternsInsideCurrentDirectory = utils.pattern.getPatternsInsideCurrentDirectory(positive); - const outsideCurrentDirectoryGroup = groupPatternsByBaseDirectory(patternsOutsideCurrentDirectory); - const insideCurrentDirectoryGroup = groupPatternsByBaseDirectory(patternsInsideCurrentDirectory); - tasks.push(...convertPatternGroupsToTasks(outsideCurrentDirectoryGroup, negative, dynamic)); - /* - * For the sake of reducing future accesses to the file system, we merge all tasks within the current directory - * into a global task, if at least one pattern refers to the root (`.`). In this case, the global task covers the rest. - */ - if ('.' in insideCurrentDirectoryGroup) { - tasks.push(convertPatternGroupToTask('.', patternsInsideCurrentDirectory, negative, dynamic)); - } - else { - tasks.push(...convertPatternGroupsToTasks(insideCurrentDirectoryGroup, negative, dynamic)); - } - return tasks; -} -exports.convertPatternsToTasks = convertPatternsToTasks; -function getPositivePatterns(patterns) { - return utils.pattern.getPositivePatterns(patterns); -} -exports.getPositivePatterns = getPositivePatterns; -function getNegativePatternsAsPositive(patterns, ignore) { - const negative = utils.pattern.getNegativePatterns(patterns).concat(ignore); - const positive = negative.map(utils.pattern.convertToPositivePattern); - return positive; -} -exports.getNegativePatternsAsPositive = getNegativePatternsAsPositive; -function groupPatternsByBaseDirectory(patterns) { - const group = {}; - return patterns.reduce((collection, pattern) => { - const base = utils.pattern.getBaseDirectory(pattern); - if (base in collection) { - collection[base].push(pattern); - } - else { - collection[base] = [pattern]; - } - return collection; - }, group); -} -exports.groupPatternsByBaseDirectory = groupPatternsByBaseDirectory; -function convertPatternGroupsToTasks(positive, negative, dynamic) { - return Object.keys(positive).map((base) => { - return convertPatternGroupToTask(base, positive[base], negative, dynamic); - }); -} -exports.convertPatternGroupsToTasks = convertPatternGroupsToTasks; -function convertPatternGroupToTask(base, positive, negative, dynamic) { - return { - dynamic, - positive, - negative, - base, - patterns: [].concat(positive, negative.map(utils.pattern.convertToNegativePattern)) - }; + reject(error); + }; + + (async () => { + try { + await streamPipelinePromisified(inputStream, stream); + resolve(); + } catch (error) { + rejectPromise(error); + } + })(); + + stream.on('data', () => { + if (stream.getBufferedLength() > maxBuffer) { + rejectPromise(new MaxBufferError()); + } + }); + }); + + return stream.getBufferedValue(); } -exports.convertPatternGroupToTask = convertPatternGroupToTask; + +module.exports = getStream; +module.exports.buffer = (stream, options) => getStream(stream, {...options, encoding: 'buffer'}); +module.exports.array = (stream, options) => getStream(stream, {...options, array: true}); +module.exports.MaxBufferError = MaxBufferError; /***/ }), -/***/ 95649: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ 62437: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -Object.defineProperty(exports, "__esModule", ({ value: true })); -const async_1 = __nccwpck_require__(79439); -const provider_1 = __nccwpck_require__(5420); -class ProviderAsync extends provider_1.default { - constructor() { - super(...arguments); - this._reader = new async_1.default(this._settings); - } - async read(task) { - const root = this._getRootDirectory(task); - const options = this._getReaderOptions(task); - const entries = await this.api(root, task, options); - return entries.map((entry) => options.transform(entry)); - } - api(root, task, options) { - if (task.dynamic) { - return this._reader.dynamic(root, options); - } - return this._reader.static(task.patterns, options); - } -} -exports["default"] = ProviderAsync; - - -/***/ }), -/***/ 26595: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +var isGlob = __nccwpck_require__(11753); +var pathPosixDirname = (__nccwpck_require__(16928).posix).dirname; +var isWin32 = (__nccwpck_require__(70857).platform)() === 'win32'; -"use strict"; +var slash = '/'; +var backslash = /\\/g; +var enclosure = /[\{\[].*[\}\]]$/; +var globby = /(^|[^\\])([\{\[]|\([^\)]+$)/; +var escaped = /\\([\!\*\?\|\[\]\(\)\{\}])/g; -Object.defineProperty(exports, "__esModule", ({ value: true })); -const utils = __nccwpck_require__(1062); -const partial_1 = __nccwpck_require__(62600); -class DeepFilter { - constructor(_settings, _micromatchOptions) { - this._settings = _settings; - this._micromatchOptions = _micromatchOptions; - } - getFilter(basePath, positive, negative) { - const matcher = this._getMatcher(positive); - const negativeRe = this._getNegativePatternsRe(negative); - return (entry) => this._filter(basePath, entry, matcher, negativeRe); - } - _getMatcher(patterns) { - return new partial_1.default(patterns, this._settings, this._micromatchOptions); - } - _getNegativePatternsRe(patterns) { - const affectDepthOfReadingPatterns = patterns.filter(utils.pattern.isAffectDepthOfReadingPattern); - return utils.pattern.convertPatternsToRe(affectDepthOfReadingPatterns, this._micromatchOptions); - } - _filter(basePath, entry, matcher, negativeRe) { - if (this._isSkippedByDeep(basePath, entry.path)) { - return false; - } - if (this._isSkippedSymbolicLink(entry)) { - return false; - } - const filepath = utils.path.removeLeadingDotSegment(entry.path); - if (this._isSkippedByPositivePatterns(filepath, matcher)) { - return false; - } - return this._isSkippedByNegativePatterns(filepath, negativeRe); - } - _isSkippedByDeep(basePath, entryPath) { - /** - * Avoid unnecessary depth calculations when it doesn't matter. - */ - if (this._settings.deep === Infinity) { - return false; - } - return this._getEntryLevel(basePath, entryPath) >= this._settings.deep; - } - _getEntryLevel(basePath, entryPath) { - const entryPathDepth = entryPath.split('/').length; - if (basePath === '') { - return entryPathDepth; - } - const basePathDepth = basePath.split('/').length; - return entryPathDepth - basePathDepth; - } - _isSkippedSymbolicLink(entry) { - return !this._settings.followSymbolicLinks && entry.dirent.isSymbolicLink(); - } - _isSkippedByPositivePatterns(entryPath, matcher) { - return !this._settings.baseNameMatch && !matcher.match(entryPath); - } - _isSkippedByNegativePatterns(entryPath, patternsRe) { - return !utils.pattern.matchAny(entryPath, patternsRe); - } -} -exports["default"] = DeepFilter; +/** + * @param {string} str + * @param {Object} opts + * @param {boolean} [opts.flipBackslashes=true] + * @returns {string} + */ +module.exports = function globParent(str, opts) { + var options = Object.assign({ flipBackslashes: true }, opts); + // flip windows path separators + if (options.flipBackslashes && isWin32 && str.indexOf(slash) < 0) { + str = str.replace(backslash, slash); + } -/***/ }), + // special case for strings ending in enclosure containing path separator + if (enclosure.test(str)) { + str += slash; + } -/***/ 94193: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + // preserves full path in case of trailing path separator + str += 'a'; -"use strict"; + // remove path parts that are globby + do { + str = pathPosixDirname(str); + } while (isGlob(str) || globby.test(str)); -Object.defineProperty(exports, "__esModule", ({ value: true })); -const utils = __nccwpck_require__(1062); -class EntryFilter { - constructor(_settings, _micromatchOptions) { - this._settings = _settings; - this._micromatchOptions = _micromatchOptions; - this.index = new Map(); - } - getFilter(positive, negative) { - const [absoluteNegative, relativeNegative] = utils.pattern.partitionAbsoluteAndRelative(negative); - const patterns = { - positive: { - all: utils.pattern.convertPatternsToRe(positive, this._micromatchOptions) - }, - negative: { - absolute: utils.pattern.convertPatternsToRe(absoluteNegative, Object.assign(Object.assign({}, this._micromatchOptions), { dot: true })), - relative: utils.pattern.convertPatternsToRe(relativeNegative, Object.assign(Object.assign({}, this._micromatchOptions), { dot: true })) - } - }; - return (entry) => this._filter(entry, patterns); - } - _filter(entry, patterns) { - const filepath = utils.path.removeLeadingDotSegment(entry.path); - if (this._settings.unique && this._isDuplicateEntry(filepath)) { - return false; - } - if (this._onlyFileFilter(entry) || this._onlyDirectoryFilter(entry)) { - return false; - } - const isMatched = this._isMatchToPatternsSet(filepath, patterns, entry.dirent.isDirectory()); - if (this._settings.unique && isMatched) { - this._createIndexRecord(filepath); - } - return isMatched; - } - _isDuplicateEntry(filepath) { - return this.index.has(filepath); - } - _createIndexRecord(filepath) { - this.index.set(filepath, undefined); - } - _onlyFileFilter(entry) { - return this._settings.onlyFiles && !entry.dirent.isFile(); - } - _onlyDirectoryFilter(entry) { - return this._settings.onlyDirectories && !entry.dirent.isDirectory(); - } - _isMatchToPatternsSet(filepath, patterns, isDirectory) { - const isMatched = this._isMatchToPatterns(filepath, patterns.positive.all, isDirectory); - if (!isMatched) { - return false; - } - const isMatchedByRelativeNegative = this._isMatchToPatterns(filepath, patterns.negative.relative, isDirectory); - if (isMatchedByRelativeNegative) { - return false; - } - const isMatchedByAbsoluteNegative = this._isMatchToAbsoluteNegative(filepath, patterns.negative.absolute, isDirectory); - if (isMatchedByAbsoluteNegative) { - return false; - } - return true; - } - _isMatchToAbsoluteNegative(filepath, patternsRe, isDirectory) { - if (patternsRe.length === 0) { - return false; - } - const fullpath = utils.path.makeAbsolute(this._settings.cwd, filepath); - return this._isMatchToPatterns(fullpath, patternsRe, isDirectory); - } - _isMatchToPatterns(filepath, patternsRe, isDirectory) { - if (patternsRe.length === 0) { - return false; - } - // Trying to match files and directories by patterns. - const isMatched = utils.pattern.matchAny(filepath, patternsRe); - // A pattern with a trailling slash can be used for directory matching. - // To apply such pattern, we need to add a tralling slash to the path. - if (!isMatched && isDirectory) { - return utils.pattern.matchAny(filepath + '/', patternsRe); - } - return isMatched; - } -} -exports["default"] = EntryFilter; + // remove escape chars and return result + return str.replace(escaped, '$1'); +}; /***/ }), -/***/ 94591: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ 86353: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -Object.defineProperty(exports, "__esModule", ({ value: true })); -const utils = __nccwpck_require__(1062); -class ErrorFilter { - constructor(_settings) { - this._settings = _settings; - } - getFilter() { - return (error) => this._isNonFatalError(error); - } - _isNonFatalError(error) { - return utils.errno.isEnoentCodeError(error) || this._settings.suppressErrors; - } -} -exports["default"] = ErrorFilter; +const {promisify} = __nccwpck_require__(39023); +const fs = __nccwpck_require__(79896); +const path = __nccwpck_require__(16928); +const fastGlob = __nccwpck_require__(10484); +const gitIgnore = __nccwpck_require__(64134); +const slash = __nccwpck_require__(85737); +const DEFAULT_IGNORE = [ + '**/node_modules/**', + '**/flow-typed/**', + '**/coverage/**', + '**/.git' +]; -/***/ }), +const readFileP = promisify(fs.readFile); -/***/ 61703: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +const mapGitIgnorePatternTo = base => ignore => { + if (ignore.startsWith('!')) { + return '!' + path.posix.join(base, ignore.slice(1)); + } -"use strict"; + return path.posix.join(base, ignore); +}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -const utils = __nccwpck_require__(1062); -class Matcher { - constructor(_patterns, _settings, _micromatchOptions) { - this._patterns = _patterns; - this._settings = _settings; - this._micromatchOptions = _micromatchOptions; - this._storage = []; - this._fillStorage(); - } - _fillStorage() { - for (const pattern of this._patterns) { - const segments = this._getPatternSegments(pattern); - const sections = this._splitSegmentsIntoSections(segments); - this._storage.push({ - complete: sections.length <= 1, - pattern, - segments, - sections - }); - } - } - _getPatternSegments(pattern) { - const parts = utils.pattern.getPatternParts(pattern, this._micromatchOptions); - return parts.map((part) => { - const dynamic = utils.pattern.isDynamicPattern(part, this._settings); - if (!dynamic) { - return { - dynamic: false, - pattern: part - }; - } - return { - dynamic: true, - pattern: part, - patternRe: utils.pattern.makeRe(part, this._micromatchOptions) - }; - }); - } - _splitSegmentsIntoSections(segments) { - return utils.array.splitWhen(segments, (segment) => segment.dynamic && utils.pattern.hasGlobStar(segment.pattern)); - } -} -exports["default"] = Matcher; +const parseGitIgnore = (content, options) => { + const base = slash(path.relative(options.cwd, path.dirname(options.fileName))); + return content + .split(/\r?\n/) + .filter(Boolean) + .filter(line => !line.startsWith('#')) + .map(mapGitIgnorePatternTo(base)); +}; -/***/ }), +const reduceIgnore = files => { + const ignores = gitIgnore(); + for (const file of files) { + ignores.add(parseGitIgnore(file.content, { + cwd: file.cwd, + fileName: file.filePath + })); + } -/***/ 62600: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + return ignores; +}; -"use strict"; +const ensureAbsolutePathForCwd = (cwd, p) => { + cwd = slash(cwd); + if (path.isAbsolute(p)) { + if (slash(p).startsWith(cwd)) { + return p; + } -Object.defineProperty(exports, "__esModule", ({ value: true })); -const matcher_1 = __nccwpck_require__(61703); -class PartialMatcher extends matcher_1.default { - match(filepath) { - const parts = filepath.split('/'); - const levels = parts.length; - const patterns = this._storage.filter((info) => !info.complete || info.segments.length > levels); - for (const pattern of patterns) { - const section = pattern.sections[0]; - /** - * In this case, the pattern has a globstar and we must read all directories unconditionally, - * but only if the level has reached the end of the first group. - * - * fixtures/{a,b}/** - * ^ true/false ^ always true - */ - if (!pattern.complete && levels > section.length) { - return true; - } - const match = parts.every((part, index) => { - const segment = pattern.segments[index]; - if (segment.dynamic && segment.patternRe.test(part)) { - return true; - } - if (!segment.dynamic && segment.pattern === part) { - return true; - } - return false; - }); - if (match) { - return true; - } - } - return false; - } -} -exports["default"] = PartialMatcher; + throw new Error(`Path ${p} is not in cwd ${cwd}`); + } + return path.join(cwd, p); +}; -/***/ }), +const getIsIgnoredPredecate = (ignores, cwd) => { + return p => ignores.ignores(slash(path.relative(cwd, ensureAbsolutePathForCwd(cwd, p.path || p)))); +}; -/***/ 5420: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +const getFile = async (file, cwd) => { + const filePath = path.join(cwd, file); + const content = await readFileP(filePath, 'utf8'); -"use strict"; + return { + cwd, + filePath, + content + }; +}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -const path = __nccwpck_require__(16928); -const deep_1 = __nccwpck_require__(26595); -const entry_1 = __nccwpck_require__(94193); -const error_1 = __nccwpck_require__(94591); -const entry_2 = __nccwpck_require__(33826); -class Provider { - constructor(_settings) { - this._settings = _settings; - this.errorFilter = new error_1.default(this._settings); - this.entryFilter = new entry_1.default(this._settings, this._getMicromatchOptions()); - this.deepFilter = new deep_1.default(this._settings, this._getMicromatchOptions()); - this.entryTransformer = new entry_2.default(this._settings); - } - _getRootDirectory(task) { - return path.resolve(this._settings.cwd, task.base); - } - _getReaderOptions(task) { - const basePath = task.base === '.' ? '' : task.base; - return { - basePath, - pathSegmentSeparator: '/', - concurrency: this._settings.concurrency, - deepFilter: this.deepFilter.getFilter(basePath, task.positive, task.negative), - entryFilter: this.entryFilter.getFilter(task.positive, task.negative), - errorFilter: this.errorFilter.getFilter(), - followSymbolicLinks: this._settings.followSymbolicLinks, - fs: this._settings.fs, - stats: this._settings.stats, - throwErrorOnBrokenSymbolicLink: this._settings.throwErrorOnBrokenSymbolicLink, - transform: this.entryTransformer.getTransformer() - }; - } - _getMicromatchOptions() { - return { - dot: this._settings.dot, - matchBase: this._settings.baseNameMatch, - nobrace: !this._settings.braceExpansion, - nocase: !this._settings.caseSensitiveMatch, - noext: !this._settings.extglob, - noglobstar: !this._settings.globstar, - posix: true, - strictSlashes: false - }; - } -} -exports["default"] = Provider; +const getFileSync = (file, cwd) => { + const filePath = path.join(cwd, file); + const content = fs.readFileSync(filePath, 'utf8'); + return { + cwd, + filePath, + content + }; +}; -/***/ }), +const normalizeOptions = ({ + ignore = [], + cwd = slash(process.cwd()) +} = {}) => { + return {ignore, cwd}; +}; -/***/ 80613: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +module.exports = async options => { + options = normalizeOptions(options); -"use strict"; + const paths = await fastGlob('**/.gitignore', { + ignore: DEFAULT_IGNORE.concat(options.ignore), + cwd: options.cwd + }); -Object.defineProperty(exports, "__esModule", ({ value: true })); -const stream_1 = __nccwpck_require__(2203); -const stream_2 = __nccwpck_require__(89491); -const provider_1 = __nccwpck_require__(5420); -class ProviderStream extends provider_1.default { - constructor() { - super(...arguments); - this._reader = new stream_2.default(this._settings); - } - read(task) { - const root = this._getRootDirectory(task); - const options = this._getReaderOptions(task); - const source = this.api(root, task, options); - const destination = new stream_1.Readable({ objectMode: true, read: () => { } }); - source - .once('error', (error) => destination.emit('error', error)) - .on('data', (entry) => destination.emit('data', options.transform(entry))) - .once('end', () => destination.emit('end')); - destination - .once('close', () => source.destroy()); - return destination; - } - api(root, task, options) { - if (task.dynamic) { - return this._reader.dynamic(root, options); - } - return this._reader.static(task.patterns, options); - } -} -exports["default"] = ProviderStream; + const files = await Promise.all(paths.map(file => getFile(file, options.cwd))); + const ignores = reduceIgnore(files); + + return getIsIgnoredPredecate(ignores, options.cwd); +}; + +module.exports.sync = options => { + options = normalizeOptions(options); + + const paths = fastGlob.sync('**/.gitignore', { + ignore: DEFAULT_IGNORE.concat(options.ignore), + cwd: options.cwd + }); + + const files = paths.map(file => getFileSync(file, options.cwd)); + const ignores = reduceIgnore(files); + + return getIsIgnoredPredecate(ignores, options.cwd); +}; /***/ }), -/***/ 81850: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ 46127: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -Object.defineProperty(exports, "__esModule", ({ value: true })); -const sync_1 = __nccwpck_require__(95908); -const provider_1 = __nccwpck_require__(5420); -class ProviderSync extends provider_1.default { - constructor() { - super(...arguments); - this._reader = new sync_1.default(this._settings); - } - read(task) { - const root = this._getRootDirectory(task); - const options = this._getReaderOptions(task); - const entries = this.api(root, task, options); - return entries.map(options.transform); - } - api(root, task, options) { - if (task.dynamic) { - return this._reader.dynamic(root, options); - } - return this._reader.static(task.patterns, options); - } -} -exports["default"] = ProviderSync; - +const fs = __nccwpck_require__(79896); +const arrayUnion = __nccwpck_require__(71187); +const merge2 = __nccwpck_require__(26606); +const fastGlob = __nccwpck_require__(10484); +const dirGlob = __nccwpck_require__(70804); +const gitignore = __nccwpck_require__(86353); +const {FilterStream, UniqueStream} = __nccwpck_require__(57211); -/***/ }), +const DEFAULT_FILTER = () => false; -/***/ 33826: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +const isNegative = pattern => pattern[0] === '!'; -"use strict"; +const assertPatternsInput = patterns => { + if (!patterns.every(pattern => typeof pattern === 'string')) { + throw new TypeError('Patterns must be a string or an array of strings'); + } +}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -const utils = __nccwpck_require__(1062); -class EntryTransformer { - constructor(_settings) { - this._settings = _settings; - } - getTransformer() { - return (entry) => this._transform(entry); - } - _transform(entry) { - let filepath = entry.path; - if (this._settings.absolute) { - filepath = utils.path.makeAbsolute(this._settings.cwd, filepath); - filepath = utils.path.unixify(filepath); - } - if (this._settings.markDirectories && entry.dirent.isDirectory()) { - filepath += '/'; - } - if (!this._settings.objectMode) { - return filepath; - } - return Object.assign(Object.assign({}, entry), { path: filepath }); - } -} -exports["default"] = EntryTransformer; +const checkCwdOption = (options = {}) => { + if (!options.cwd) { + return; + } + let stat; + try { + stat = fs.statSync(options.cwd); + } catch { + return; + } -/***/ }), + if (!stat.isDirectory()) { + throw new Error('The `cwd` option must be a path to a directory'); + } +}; -/***/ 79439: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +const getPathString = p => p.stats instanceof fs.Stats ? p.path : p; -"use strict"; +const generateGlobTasks = (patterns, taskOptions) => { + patterns = arrayUnion([].concat(patterns)); + assertPatternsInput(patterns); + checkCwdOption(taskOptions); -Object.defineProperty(exports, "__esModule", ({ value: true })); -const fsWalk = __nccwpck_require__(83989); -const reader_1 = __nccwpck_require__(79692); -const stream_1 = __nccwpck_require__(89491); -class ReaderAsync extends reader_1.default { - constructor() { - super(...arguments); - this._walkAsync = fsWalk.walk; - this._readerStream = new stream_1.default(this._settings); - } - dynamic(root, options) { - return new Promise((resolve, reject) => { - this._walkAsync(root, options, (error, entries) => { - if (error === null) { - resolve(entries); - } - else { - reject(error); - } - }); - }); - } - async static(patterns, options) { - const entries = []; - const stream = this._readerStream.static(patterns, options); - // After #235, replace it with an asynchronous iterator. - return new Promise((resolve, reject) => { - stream.once('error', reject); - stream.on('data', (entry) => entries.push(entry)); - stream.once('end', () => resolve(entries)); - }); - } -} -exports["default"] = ReaderAsync; + const globTasks = []; + taskOptions = { + ignore: [], + expandDirectories: true, + ...taskOptions + }; -/***/ }), + for (const [index, pattern] of patterns.entries()) { + if (isNegative(pattern)) { + continue; + } -/***/ 79692: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + const ignore = patterns + .slice(index) + .filter(pattern => isNegative(pattern)) + .map(pattern => pattern.slice(1)); -"use strict"; + const options = { + ...taskOptions, + ignore: taskOptions.ignore.concat(ignore) + }; -Object.defineProperty(exports, "__esModule", ({ value: true })); -const path = __nccwpck_require__(16928); -const fsStat = __nccwpck_require__(80794); -const utils = __nccwpck_require__(1062); -class Reader { - constructor(_settings) { - this._settings = _settings; - this._fsStatSettings = new fsStat.Settings({ - followSymbolicLink: this._settings.followSymbolicLinks, - fs: this._settings.fs, - throwErrorOnBrokenSymbolicLink: this._settings.followSymbolicLinks - }); - } - _getFullEntryPath(filepath) { - return path.resolve(this._settings.cwd, filepath); - } - _makeEntry(stats, pattern) { - const entry = { - name: pattern, - path: pattern, - dirent: utils.fs.createDirentFromStats(pattern, stats) - }; - if (this._settings.stats) { - entry.stats = stats; - } - return entry; - } - _isFatalError(error) { - return !utils.errno.isEnoentCodeError(error) && !this._settings.suppressErrors; - } -} -exports["default"] = Reader; + globTasks.push({pattern, options}); + } + return globTasks; +}; -/***/ }), +const globDirs = (task, fn) => { + let options = {}; + if (task.options.cwd) { + options.cwd = task.options.cwd; + } -/***/ 89491: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + if (Array.isArray(task.options.expandDirectories)) { + options = { + ...options, + files: task.options.expandDirectories + }; + } else if (typeof task.options.expandDirectories === 'object') { + options = { + ...options, + ...task.options.expandDirectories + }; + } -"use strict"; + return fn(task.pattern, options); +}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -const stream_1 = __nccwpck_require__(2203); -const fsStat = __nccwpck_require__(80794); -const fsWalk = __nccwpck_require__(83989); -const reader_1 = __nccwpck_require__(79692); -class ReaderStream extends reader_1.default { - constructor() { - super(...arguments); - this._walkStream = fsWalk.walkStream; - this._stat = fsStat.stat; - } - dynamic(root, options) { - return this._walkStream(root, options); - } - static(patterns, options) { - const filepaths = patterns.map(this._getFullEntryPath, this); - const stream = new stream_1.PassThrough({ objectMode: true }); - stream._write = (index, _enc, done) => { - return this._getEntry(filepaths[index], patterns[index], options) - .then((entry) => { - if (entry !== null && options.entryFilter(entry)) { - stream.push(entry); - } - if (index === filepaths.length - 1) { - stream.end(); - } - done(); - }) - .catch(done); - }; - for (let i = 0; i < filepaths.length; i++) { - stream.write(i); - } - return stream; - } - _getEntry(filepath, pattern, options) { - return this._getStat(filepath) - .then((stats) => this._makeEntry(stats, pattern)) - .catch((error) => { - if (options.errorFilter(error)) { - return null; - } - throw error; - }); - } - _getStat(filepath) { - return new Promise((resolve, reject) => { - this._stat(filepath, this._fsStatSettings, (error, stats) => { - return error === null ? resolve(stats) : reject(error); - }); - }); - } -} -exports["default"] = ReaderStream; +const getPattern = (task, fn) => task.options.expandDirectories ? globDirs(task, fn) : [task.pattern]; +const getFilterSync = options => { + return options && options.gitignore ? + gitignore.sync({cwd: options.cwd, ignore: options.ignore}) : + DEFAULT_FILTER; +}; -/***/ }), - -/***/ 95908: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +const globToTask = task => glob => { + const {options} = task; + if (options.ignore && Array.isArray(options.ignore) && options.expandDirectories) { + options.ignore = dirGlob.sync(options.ignore); + } -"use strict"; + return { + pattern: glob, + options + }; +}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -const fsStat = __nccwpck_require__(80794); -const fsWalk = __nccwpck_require__(83989); -const reader_1 = __nccwpck_require__(79692); -class ReaderSync extends reader_1.default { - constructor() { - super(...arguments); - this._walkSync = fsWalk.walkSync; - this._statSync = fsStat.statSync; - } - dynamic(root, options) { - return this._walkSync(root, options); - } - static(patterns, options) { - const entries = []; - for (const pattern of patterns) { - const filepath = this._getFullEntryPath(pattern); - const entry = this._getEntry(filepath, pattern, options); - if (entry === null || !options.entryFilter(entry)) { - continue; - } - entries.push(entry); - } - return entries; - } - _getEntry(filepath, pattern, options) { - try { - const stats = this._getStat(filepath); - return this._makeEntry(stats, pattern); - } - catch (error) { - if (options.errorFilter(error)) { - return null; - } - throw error; - } - } - _getStat(filepath) { - return this._statSync(filepath, this._fsStatSettings); - } -} -exports["default"] = ReaderSync; +module.exports = async (patterns, options) => { + const globTasks = generateGlobTasks(patterns, options); + const getFilter = async () => { + return options && options.gitignore ? + gitignore({cwd: options.cwd, ignore: options.ignore}) : + DEFAULT_FILTER; + }; -/***/ }), + const getTasks = async () => { + const tasks = await Promise.all(globTasks.map(async task => { + const globs = await getPattern(task, dirGlob); + return Promise.all(globs.map(globToTask(task))); + })); -/***/ 34763: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + return arrayUnion(...tasks); + }; -"use strict"; + const [filter, tasks] = await Promise.all([getFilter(), getTasks()]); + const paths = await Promise.all(tasks.map(task => fastGlob(task.pattern, task.options))); -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.DEFAULT_FILE_SYSTEM_ADAPTER = void 0; -const fs = __nccwpck_require__(79896); -const os = __nccwpck_require__(70857); -/** - * The `os.cpus` method can return zero. We expect the number of cores to be greater than zero. - * https://github.com/nodejs/node/blob/7faeddf23a98c53896f8b574a6e66589e8fb1eb8/lib/os.js#L106-L107 - */ -const CPU_COUNT = Math.max(os.cpus().length, 1); -exports.DEFAULT_FILE_SYSTEM_ADAPTER = { - lstat: fs.lstat, - lstatSync: fs.lstatSync, - stat: fs.stat, - statSync: fs.statSync, - readdir: fs.readdir, - readdirSync: fs.readdirSync + return arrayUnion(...paths).filter(path_ => !filter(getPathString(path_))); }; -class Settings { - constructor(_options = {}) { - this._options = _options; - this.absolute = this._getValue(this._options.absolute, false); - this.baseNameMatch = this._getValue(this._options.baseNameMatch, false); - this.braceExpansion = this._getValue(this._options.braceExpansion, true); - this.caseSensitiveMatch = this._getValue(this._options.caseSensitiveMatch, true); - this.concurrency = this._getValue(this._options.concurrency, CPU_COUNT); - this.cwd = this._getValue(this._options.cwd, process.cwd()); - this.deep = this._getValue(this._options.deep, Infinity); - this.dot = this._getValue(this._options.dot, false); - this.extglob = this._getValue(this._options.extglob, true); - this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, true); - this.fs = this._getFileSystemMethods(this._options.fs); - this.globstar = this._getValue(this._options.globstar, true); - this.ignore = this._getValue(this._options.ignore, []); - this.markDirectories = this._getValue(this._options.markDirectories, false); - this.objectMode = this._getValue(this._options.objectMode, false); - this.onlyDirectories = this._getValue(this._options.onlyDirectories, false); - this.onlyFiles = this._getValue(this._options.onlyFiles, true); - this.stats = this._getValue(this._options.stats, false); - this.suppressErrors = this._getValue(this._options.suppressErrors, false); - this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, false); - this.unique = this._getValue(this._options.unique, true); - if (this.onlyDirectories) { - this.onlyFiles = false; - } - if (this.stats) { - this.objectMode = true; - } - // Remove the cast to the array in the next major (#404). - this.ignore = [].concat(this.ignore); - } - _getValue(option, value) { - return option === undefined ? value : option; - } - _getFileSystemMethods(methods = {}) { - return Object.assign(Object.assign({}, exports.DEFAULT_FILE_SYSTEM_ADAPTER), methods); - } -} -exports["default"] = Settings; +module.exports.sync = (patterns, options) => { + const globTasks = generateGlobTasks(patterns, options); -/***/ }), + const tasks = []; + for (const task of globTasks) { + const newTask = getPattern(task, dirGlob.sync).map(globToTask(task)); + tasks.push(...newTask); + } -/***/ 14811: -/***/ ((__unused_webpack_module, exports) => { + const filter = getFilterSync(options); -"use strict"; + let matches = []; + for (const task of tasks) { + matches = arrayUnion(matches, fastGlob.sync(task.pattern, task.options)); + } -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.splitWhen = exports.flatten = void 0; -function flatten(items) { - return items.reduce((collection, item) => [].concat(collection, item), []); -} -exports.flatten = flatten; -function splitWhen(items, predicate) { - const result = [[]]; - let groupIndex = 0; - for (const item of items) { - if (predicate(item)) { - groupIndex++; - result[groupIndex] = []; - } - else { - result[groupIndex].push(item); - } - } - return result; -} -exports.splitWhen = splitWhen; + return matches.filter(path_ => !filter(path_)); +}; +module.exports.stream = (patterns, options) => { + const globTasks = generateGlobTasks(patterns, options); -/***/ }), + const tasks = []; + for (const task of globTasks) { + const newTask = getPattern(task, dirGlob.sync).map(globToTask(task)); + tasks.push(...newTask); + } -/***/ 49738: -/***/ ((__unused_webpack_module, exports) => { + const filter = getFilterSync(options); + const filterStream = new FilterStream(p => !filter(p)); + const uniqueStream = new UniqueStream(); -"use strict"; + return merge2(tasks.map(task => fastGlob.stream(task.pattern, task.options))) + .pipe(filterStream) + .pipe(uniqueStream); +}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.isEnoentCodeError = void 0; -function isEnoentCodeError(error) { - return error.code === 'ENOENT'; -} -exports.isEnoentCodeError = isEnoentCodeError; +module.exports.generateGlobTasks = generateGlobTasks; + +module.exports.hasMagic = (patterns, options) => [] + .concat(patterns) + .some(pattern => fastGlob.isDynamicPattern(pattern, options)); + +module.exports.gitignore = gitignore; /***/ }), -/***/ 70271: -/***/ ((__unused_webpack_module, exports) => { +/***/ 57211: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.createDirentFromStats = void 0; -class DirentFromStats { - constructor(name, stats) { - this.name = name; - this.isBlockDevice = stats.isBlockDevice.bind(stats); - this.isCharacterDevice = stats.isCharacterDevice.bind(stats); - this.isDirectory = stats.isDirectory.bind(stats); - this.isFIFO = stats.isFIFO.bind(stats); - this.isFile = stats.isFile.bind(stats); - this.isSocket = stats.isSocket.bind(stats); - this.isSymbolicLink = stats.isSymbolicLink.bind(stats); - } -} -function createDirentFromStats(name, stats) { - return new DirentFromStats(name, stats); +const {Transform} = __nccwpck_require__(2203); + +class ObjectTransform extends Transform { + constructor() { + super({ + objectMode: true + }); + } } -exports.createDirentFromStats = createDirentFromStats; +class FilterStream extends ObjectTransform { + constructor(filter) { + super(); + this._filter = filter; + } -/***/ }), + _transform(data, encoding, callback) { + if (this._filter(data)) { + this.push(data); + } -/***/ 1062: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + callback(); + } +} -"use strict"; +class UniqueStream extends ObjectTransform { + constructor() { + super(); + this._pushed = new Set(); + } -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.string = exports.stream = exports.pattern = exports.path = exports.fs = exports.errno = exports.array = void 0; -const array = __nccwpck_require__(14811); -exports.array = array; -const errno = __nccwpck_require__(49738); -exports.errno = errno; -const fs = __nccwpck_require__(70271); -exports.fs = fs; -const path = __nccwpck_require__(9519); -exports.path = path; -const pattern = __nccwpck_require__(37044); -exports.pattern = pattern; -const stream = __nccwpck_require__(13732); -exports.stream = stream; -const string = __nccwpck_require__(55589); -exports.string = string; + _transform(data, encoding, callback) { + if (!this._pushed.has(data)) { + this.push(data); + this._pushed.add(data); + } + + callback(); + } +} + +module.exports = { + FilterStream, + UniqueStream +}; /***/ }), -/***/ 9519: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ 7472: +/***/ ((module) => { "use strict"; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.convertPosixPathToPattern = exports.convertWindowsPathToPattern = exports.convertPathToPattern = exports.escapePosixPath = exports.escapeWindowsPath = exports.escape = exports.removeLeadingDotSegment = exports.makeAbsolute = exports.unixify = void 0; -const os = __nccwpck_require__(70857); -const path = __nccwpck_require__(16928); -const IS_WINDOWS_PLATFORM = os.platform() === 'win32'; -const LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2; // ./ or .\\ -/** - * All non-escaped special characters. - * Posix: ()*?[]{|}, !+@ before (, ! at the beginning, \\ before non-special characters. - * Windows: (){}[], !+@ before (, ! at the beginning. - */ -const POSIX_UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()*?[\]{|}]|^!|[!+@](?=\()|\\(?![!()*+?@[\]{|}]))/g; -const WINDOWS_UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()[\]{}]|^!|[!+@](?=\())/g; -/** - * The device path (\\.\ or \\?\). - * https://learn.microsoft.com/en-us/dotnet/standard/io/file-path-formats#dos-device-paths - */ -const DOS_DEVICE_PATH_RE = /^\\\\([.?])/; -/** - * All backslashes except those escaping special characters. - * Windows: !()+@{} - * https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file#naming-conventions - */ -const WINDOWS_BACKSLASHES_RE = /\\(?![!()+@[\]{}])/g; -/** - * Designed to work only with simple paths: `dir\\file`. - */ -function unixify(filepath) { - return filepath.replace(/\\/g, '/'); -} -exports.unixify = unixify; -function makeAbsolute(cwd, filepath) { - return path.resolve(cwd, filepath); -} -exports.makeAbsolute = makeAbsolute; -function removeLeadingDotSegment(entry) { - // We do not use `startsWith` because this is 10x slower than current implementation for some cases. - // eslint-disable-next-line @typescript-eslint/prefer-string-starts-ends-with - if (entry.charAt(0) === '.') { - const secondCharactery = entry.charAt(1); - if (secondCharactery === '/' || secondCharactery === '\\') { - return entry.slice(LEADING_DOT_SEGMENT_CHARACTERS_COUNT); - } - } - return entry; -} -exports.removeLeadingDotSegment = removeLeadingDotSegment; -exports.escape = IS_WINDOWS_PLATFORM ? escapeWindowsPath : escapePosixPath; -function escapeWindowsPath(pattern) { - return pattern.replace(WINDOWS_UNESCAPED_GLOB_SYMBOLS_RE, '\\$2'); -} -exports.escapeWindowsPath = escapeWindowsPath; -function escapePosixPath(pattern) { - return pattern.replace(POSIX_UNESCAPED_GLOB_SYMBOLS_RE, '\\$2'); -} -exports.escapePosixPath = escapePosixPath; -exports.convertPathToPattern = IS_WINDOWS_PLATFORM ? convertWindowsPathToPattern : convertPosixPathToPattern; -function convertWindowsPathToPattern(filepath) { - return escapeWindowsPath(filepath) - .replace(DOS_DEVICE_PATH_RE, '//$1') - .replace(WINDOWS_BACKSLASHES_RE, '/'); + +module.exports = clone + +var getPrototypeOf = Object.getPrototypeOf || function (obj) { + return obj.__proto__ } -exports.convertWindowsPathToPattern = convertWindowsPathToPattern; -function convertPosixPathToPattern(filepath) { - return escapePosixPath(filepath); + +function clone (obj) { + if (obj === null || typeof obj !== 'object') + return obj + + if (obj instanceof Object) + var copy = { __proto__: getPrototypeOf(obj) } + else + var copy = Object.create(null) + + Object.getOwnPropertyNames(obj).forEach(function (key) { + Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key)) + }) + + return copy } -exports.convertPosixPathToPattern = convertPosixPathToPattern; /***/ }), -/***/ 37044: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ 61404: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -"use strict"; +var fs = __nccwpck_require__(79896) +var polyfills = __nccwpck_require__(83545) +var legacy = __nccwpck_require__(52674) +var clone = __nccwpck_require__(7472) -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.isAbsolute = exports.partitionAbsoluteAndRelative = exports.removeDuplicateSlashes = exports.matchAny = exports.convertPatternsToRe = exports.makeRe = exports.getPatternParts = exports.expandBraceExpansion = exports.expandPatternsWithBraceExpansion = exports.isAffectDepthOfReadingPattern = exports.endsWithSlashGlobStar = exports.hasGlobStar = exports.getBaseDirectory = exports.isPatternRelatedToParentDirectory = exports.getPatternsOutsideCurrentDirectory = exports.getPatternsInsideCurrentDirectory = exports.getPositivePatterns = exports.getNegativePatterns = exports.isPositivePattern = exports.isNegativePattern = exports.convertToNegativePattern = exports.convertToPositivePattern = exports.isDynamicPattern = exports.isStaticPattern = void 0; -const path = __nccwpck_require__(16928); -const globParent = __nccwpck_require__(62437); -const micromatch = __nccwpck_require__(77805); -const GLOBSTAR = '**'; -const ESCAPE_SYMBOL = '\\'; -const COMMON_GLOB_SYMBOLS_RE = /[*?]|^!/; -const REGEX_CHARACTER_CLASS_SYMBOLS_RE = /\[[^[]*]/; -const REGEX_GROUP_SYMBOLS_RE = /(?:^|[^!*+?@])\([^(]*\|[^|]*\)/; -const GLOB_EXTENSION_SYMBOLS_RE = /[!*+?@]\([^(]*\)/; -const BRACE_EXPANSION_SEPARATORS_RE = /,|\.\./; -/** - * Matches a sequence of two or more consecutive slashes, excluding the first two slashes at the beginning of the string. - * The latter is due to the presence of the device path at the beginning of the UNC path. - */ -const DOUBLE_SLASH_RE = /(?!^)\/{2,}/g; -function isStaticPattern(pattern, options = {}) { - return !isDynamicPattern(pattern, options); +var util = __nccwpck_require__(39023) + +/* istanbul ignore next - node 0.x polyfill */ +var gracefulQueue +var previousSymbol + +/* istanbul ignore else - node 0.x polyfill */ +if (typeof Symbol === 'function' && typeof Symbol.for === 'function') { + gracefulQueue = Symbol.for('graceful-fs.queue') + // This is used in testing by future versions + previousSymbol = Symbol.for('graceful-fs.previous') +} else { + gracefulQueue = '___graceful-fs.queue' + previousSymbol = '___graceful-fs.previous' } -exports.isStaticPattern = isStaticPattern; -function isDynamicPattern(pattern, options = {}) { - /** - * A special case with an empty string is necessary for matching patterns that start with a forward slash. - * An empty string cannot be a dynamic pattern. - * For example, the pattern `/lib/*` will be spread into parts: '', 'lib', '*'. - */ - if (pattern === '') { - return false; - } - /** - * When the `caseSensitiveMatch` option is disabled, all patterns must be marked as dynamic, because we cannot check - * filepath directly (without read directory). - */ - if (options.caseSensitiveMatch === false || pattern.includes(ESCAPE_SYMBOL)) { - return true; - } - if (COMMON_GLOB_SYMBOLS_RE.test(pattern) || REGEX_CHARACTER_CLASS_SYMBOLS_RE.test(pattern) || REGEX_GROUP_SYMBOLS_RE.test(pattern)) { - return true; - } - if (options.extglob !== false && GLOB_EXTENSION_SYMBOLS_RE.test(pattern)) { - return true; - } - if (options.braceExpansion !== false && hasBraceExpansion(pattern)) { - return true; + +function noop () {} + +function publishQueue(context, queue) { + Object.defineProperty(context, gracefulQueue, { + get: function() { + return queue } - return false; + }) } -exports.isDynamicPattern = isDynamicPattern; -function hasBraceExpansion(pattern) { - const openingBraceIndex = pattern.indexOf('{'); - if (openingBraceIndex === -1) { - return false; + +var debug = noop +if (util.debuglog) + debug = util.debuglog('gfs4') +else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) + debug = function() { + var m = util.format.apply(util, arguments) + m = 'GFS4: ' + m.split(/\n/).join('\nGFS4: ') + console.error(m) + } + +// Once time initialization +if (!fs[gracefulQueue]) { + // This queue can be shared by multiple loaded instances + var queue = global[gracefulQueue] || [] + publishQueue(fs, queue) + + // Patch fs.close/closeSync to shared queue version, because we need + // to retry() whenever a close happens *anywhere* in the program. + // This is essential when multiple graceful-fs instances are + // in play at the same time. + fs.close = (function (fs$close) { + function close (fd, cb) { + return fs$close.call(fs, fd, function (err) { + // This function uses the graceful-fs shared queue + if (!err) { + resetQueue() + } + + if (typeof cb === 'function') + cb.apply(this, arguments) + }) } - const closingBraceIndex = pattern.indexOf('}', openingBraceIndex + 1); - if (closingBraceIndex === -1) { - return false; + + Object.defineProperty(close, previousSymbol, { + value: fs$close + }) + return close + })(fs.close) + + fs.closeSync = (function (fs$closeSync) { + function closeSync (fd) { + // This function uses the graceful-fs shared queue + fs$closeSync.apply(fs, arguments) + resetQueue() } - const braceContent = pattern.slice(openingBraceIndex, closingBraceIndex); - return BRACE_EXPANSION_SEPARATORS_RE.test(braceContent); -} -function convertToPositivePattern(pattern) { - return isNegativePattern(pattern) ? pattern.slice(1) : pattern; -} -exports.convertToPositivePattern = convertToPositivePattern; -function convertToNegativePattern(pattern) { - return '!' + pattern; -} -exports.convertToNegativePattern = convertToNegativePattern; -function isNegativePattern(pattern) { - return pattern.startsWith('!') && pattern[1] !== '('; -} -exports.isNegativePattern = isNegativePattern; -function isPositivePattern(pattern) { - return !isNegativePattern(pattern); -} -exports.isPositivePattern = isPositivePattern; -function getNegativePatterns(patterns) { - return patterns.filter(isNegativePattern); -} -exports.getNegativePatterns = getNegativePatterns; -function getPositivePatterns(patterns) { - return patterns.filter(isPositivePattern); -} -exports.getPositivePatterns = getPositivePatterns; -/** - * Returns patterns that can be applied inside the current directory. - * - * @example - * // ['./*', '*', 'a/*'] - * getPatternsInsideCurrentDirectory(['./*', '*', 'a/*', '../*', './../*']) - */ -function getPatternsInsideCurrentDirectory(patterns) { - return patterns.filter((pattern) => !isPatternRelatedToParentDirectory(pattern)); -} -exports.getPatternsInsideCurrentDirectory = getPatternsInsideCurrentDirectory; -/** - * Returns patterns to be expanded relative to (outside) the current directory. - * - * @example - * // ['../*', './../*'] - * getPatternsInsideCurrentDirectory(['./*', '*', 'a/*', '../*', './../*']) - */ -function getPatternsOutsideCurrentDirectory(patterns) { - return patterns.filter(isPatternRelatedToParentDirectory); -} -exports.getPatternsOutsideCurrentDirectory = getPatternsOutsideCurrentDirectory; -function isPatternRelatedToParentDirectory(pattern) { - return pattern.startsWith('..') || pattern.startsWith('./..'); -} -exports.isPatternRelatedToParentDirectory = isPatternRelatedToParentDirectory; -function getBaseDirectory(pattern) { - return globParent(pattern, { flipBackslashes: false }); -} -exports.getBaseDirectory = getBaseDirectory; -function hasGlobStar(pattern) { - return pattern.includes(GLOBSTAR); -} -exports.hasGlobStar = hasGlobStar; -function endsWithSlashGlobStar(pattern) { - return pattern.endsWith('/' + GLOBSTAR); -} -exports.endsWithSlashGlobStar = endsWithSlashGlobStar; -function isAffectDepthOfReadingPattern(pattern) { - const basename = path.basename(pattern); - return endsWithSlashGlobStar(pattern) || isStaticPattern(basename); + + Object.defineProperty(closeSync, previousSymbol, { + value: fs$closeSync + }) + return closeSync + })(fs.closeSync) + + if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) { + process.on('exit', function() { + debug(fs[gracefulQueue]) + __nccwpck_require__(42613).equal(fs[gracefulQueue].length, 0) + }) + } } -exports.isAffectDepthOfReadingPattern = isAffectDepthOfReadingPattern; -function expandPatternsWithBraceExpansion(patterns) { - return patterns.reduce((collection, pattern) => { - return collection.concat(expandBraceExpansion(pattern)); - }, []); + +if (!global[gracefulQueue]) { + publishQueue(global, fs[gracefulQueue]); } -exports.expandPatternsWithBraceExpansion = expandPatternsWithBraceExpansion; -function expandBraceExpansion(pattern) { - const patterns = micromatch.braces(pattern, { expand: true, nodupes: true, keepEscaping: true }); - /** - * Sort the patterns by length so that the same depth patterns are processed side by side. - * `a/{b,}/{c,}/*` – `['a///*', 'a/b//*', 'a//c/*', 'a/b/c/*']` - */ - patterns.sort((a, b) => a.length - b.length); - /** - * Micromatch can return an empty string in the case of patterns like `{a,}`. - */ - return patterns.filter((pattern) => pattern !== ''); + +module.exports = patch(clone(fs)) +if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) { + module.exports = patch(fs) + fs.__patched = true; } -exports.expandBraceExpansion = expandBraceExpansion; -function getPatternParts(pattern, options) { - let { parts } = micromatch.scan(pattern, Object.assign(Object.assign({}, options), { parts: true })); - /** - * The scan method returns an empty array in some cases. - * See micromatch/picomatch#58 for more details. - */ - if (parts.length === 0) { - parts = [pattern]; + +function patch (fs) { + // Everything that references the open() function needs to be in here + polyfills(fs) + fs.gracefulify = patch + + fs.createReadStream = createReadStream + fs.createWriteStream = createWriteStream + var fs$readFile = fs.readFile + fs.readFile = readFile + function readFile (path, options, cb) { + if (typeof options === 'function') + cb = options, options = null + + return go$readFile(path, options, cb) + + function go$readFile (path, options, cb, startTime) { + return fs$readFile(path, options, function (err) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$readFile, [path, options, cb], err, startTime || Date.now(), Date.now()]) + else { + if (typeof cb === 'function') + cb.apply(this, arguments) + } + }) } - /** - * The scan method does not return an empty part for the pattern with a forward slash. - * This is another part of micromatch/picomatch#58. - */ - if (parts[0].startsWith('/')) { - parts[0] = parts[0].slice(1); - parts.unshift(''); + } + + var fs$writeFile = fs.writeFile + fs.writeFile = writeFile + function writeFile (path, data, options, cb) { + if (typeof options === 'function') + cb = options, options = null + + return go$writeFile(path, data, options, cb) + + function go$writeFile (path, data, options, cb, startTime) { + return fs$writeFile(path, data, options, function (err) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$writeFile, [path, data, options, cb], err, startTime || Date.now(), Date.now()]) + else { + if (typeof cb === 'function') + cb.apply(this, arguments) + } + }) } - return parts; -} -exports.getPatternParts = getPatternParts; -function makeRe(pattern, options) { - return micromatch.makeRe(pattern, options); -} -exports.makeRe = makeRe; -function convertPatternsToRe(patterns, options) { - return patterns.map((pattern) => makeRe(pattern, options)); -} -exports.convertPatternsToRe = convertPatternsToRe; -function matchAny(entry, patternsRe) { - return patternsRe.some((patternRe) => patternRe.test(entry)); -} -exports.matchAny = matchAny; -/** - * This package only works with forward slashes as a path separator. - * Because of this, we cannot use the standard `path.normalize` method, because on Windows platform it will use of backslashes. - */ -function removeDuplicateSlashes(pattern) { - return pattern.replace(DOUBLE_SLASH_RE, '/'); -} -exports.removeDuplicateSlashes = removeDuplicateSlashes; -function partitionAbsoluteAndRelative(patterns) { - const absolute = []; - const relative = []; - for (const pattern of patterns) { - if (isAbsolute(pattern)) { - absolute.push(pattern); + } + + var fs$appendFile = fs.appendFile + if (fs$appendFile) + fs.appendFile = appendFile + function appendFile (path, data, options, cb) { + if (typeof options === 'function') + cb = options, options = null + + return go$appendFile(path, data, options, cb) + + function go$appendFile (path, data, options, cb, startTime) { + return fs$appendFile(path, data, options, function (err) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$appendFile, [path, data, options, cb], err, startTime || Date.now(), Date.now()]) + else { + if (typeof cb === 'function') + cb.apply(this, arguments) } + }) + } + } + + var fs$copyFile = fs.copyFile + if (fs$copyFile) + fs.copyFile = copyFile + function copyFile (src, dest, flags, cb) { + if (typeof flags === 'function') { + cb = flags + flags = 0 + } + return go$copyFile(src, dest, flags, cb) + + function go$copyFile (src, dest, flags, cb, startTime) { + return fs$copyFile(src, dest, flags, function (err) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$copyFile, [src, dest, flags, cb], err, startTime || Date.now(), Date.now()]) else { - relative.push(pattern); + if (typeof cb === 'function') + cb.apply(this, arguments) } + }) } - return [absolute, relative]; -} -exports.partitionAbsoluteAndRelative = partitionAbsoluteAndRelative; -function isAbsolute(pattern) { - return path.isAbsolute(pattern); -} -exports.isAbsolute = isAbsolute; + } + + var fs$readdir = fs.readdir + fs.readdir = readdir + var noReaddirOptionVersions = /^v[0-5]\./ + function readdir (path, options, cb) { + if (typeof options === 'function') + cb = options, options = null + + var go$readdir = noReaddirOptionVersions.test(process.version) + ? function go$readdir (path, options, cb, startTime) { + return fs$readdir(path, fs$readdirCallback( + path, options, cb, startTime + )) + } + : function go$readdir (path, options, cb, startTime) { + return fs$readdir(path, options, fs$readdirCallback( + path, options, cb, startTime + )) + } + + return go$readdir(path, options, cb) + + function fs$readdirCallback (path, options, cb, startTime) { + return function (err, files) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([ + go$readdir, + [path, options, cb], + err, + startTime || Date.now(), + Date.now() + ]) + else { + if (files && files.sort) + files.sort() + + if (typeof cb === 'function') + cb.call(this, err, files) + } + } + } + } + + if (process.version.substr(0, 4) === 'v0.8') { + var legStreams = legacy(fs) + ReadStream = legStreams.ReadStream + WriteStream = legStreams.WriteStream + } + + var fs$ReadStream = fs.ReadStream + if (fs$ReadStream) { + ReadStream.prototype = Object.create(fs$ReadStream.prototype) + ReadStream.prototype.open = ReadStream$open + } + + var fs$WriteStream = fs.WriteStream + if (fs$WriteStream) { + WriteStream.prototype = Object.create(fs$WriteStream.prototype) + WriteStream.prototype.open = WriteStream$open + } + + Object.defineProperty(fs, 'ReadStream', { + get: function () { + return ReadStream + }, + set: function (val) { + ReadStream = val + }, + enumerable: true, + configurable: true + }) + Object.defineProperty(fs, 'WriteStream', { + get: function () { + return WriteStream + }, + set: function (val) { + WriteStream = val + }, + enumerable: true, + configurable: true + }) + + // legacy names + var FileReadStream = ReadStream + Object.defineProperty(fs, 'FileReadStream', { + get: function () { + return FileReadStream + }, + set: function (val) { + FileReadStream = val + }, + enumerable: true, + configurable: true + }) + var FileWriteStream = WriteStream + Object.defineProperty(fs, 'FileWriteStream', { + get: function () { + return FileWriteStream + }, + set: function (val) { + FileWriteStream = val + }, + enumerable: true, + configurable: true + }) + + function ReadStream (path, options) { + if (this instanceof ReadStream) + return fs$ReadStream.apply(this, arguments), this + else + return ReadStream.apply(Object.create(ReadStream.prototype), arguments) + } + + function ReadStream$open () { + var that = this + open(that.path, that.flags, that.mode, function (err, fd) { + if (err) { + if (that.autoClose) + that.destroy() + + that.emit('error', err) + } else { + that.fd = fd + that.emit('open', fd) + that.read() + } + }) + } + + function WriteStream (path, options) { + if (this instanceof WriteStream) + return fs$WriteStream.apply(this, arguments), this + else + return WriteStream.apply(Object.create(WriteStream.prototype), arguments) + } + + function WriteStream$open () { + var that = this + open(that.path, that.flags, that.mode, function (err, fd) { + if (err) { + that.destroy() + that.emit('error', err) + } else { + that.fd = fd + that.emit('open', fd) + } + }) + } + + function createReadStream (path, options) { + return new fs.ReadStream(path, options) + } + + function createWriteStream (path, options) { + return new fs.WriteStream(path, options) + } + + var fs$open = fs.open + fs.open = open + function open (path, flags, mode, cb) { + if (typeof mode === 'function') + cb = mode, mode = null + + return go$open(path, flags, mode, cb) + + function go$open (path, flags, mode, cb, startTime) { + return fs$open(path, flags, mode, function (err, fd) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$open, [path, flags, mode, cb], err, startTime || Date.now(), Date.now()]) + else { + if (typeof cb === 'function') + cb.apply(this, arguments) + } + }) + } + } + + return fs +} + +function enqueue (elem) { + debug('ENQUEUE', elem[0].name, elem[1]) + fs[gracefulQueue].push(elem) + retry() +} + +// keep track of the timeout between retry() calls +var retryTimer + +// reset the startTime and lastTime to now +// this resets the start of the 60 second overall timeout as well as the +// delay between attempts so that we'll retry these jobs sooner +function resetQueue () { + var now = Date.now() + for (var i = 0; i < fs[gracefulQueue].length; ++i) { + // entries that are only a length of 2 are from an older version, don't + // bother modifying those since they'll be retried anyway. + if (fs[gracefulQueue][i].length > 2) { + fs[gracefulQueue][i][3] = now // startTime + fs[gracefulQueue][i][4] = now // lastTime + } + } + // call retry to make sure we're actively processing the queue + retry() +} + +function retry () { + // clear the timer and remove it to help prevent unintended concurrency + clearTimeout(retryTimer) + retryTimer = undefined + + if (fs[gracefulQueue].length === 0) + return + + var elem = fs[gracefulQueue].shift() + var fn = elem[0] + var args = elem[1] + // these items may be unset if they were added by an older graceful-fs + var err = elem[2] + var startTime = elem[3] + var lastTime = elem[4] + + // if we don't have a startTime we have no way of knowing if we've waited + // long enough, so go ahead and retry this item now + if (startTime === undefined) { + debug('RETRY', fn.name, args) + fn.apply(null, args) + } else if (Date.now() - startTime >= 60000) { + // it's been more than 60 seconds total, bail now + debug('TIMEOUT', fn.name, args) + var cb = args.pop() + if (typeof cb === 'function') + cb.call(null, err) + } else { + // the amount of time between the last attempt and right now + var sinceAttempt = Date.now() - lastTime + // the amount of time between when we first tried, and when we last tried + // rounded up to at least 1 + var sinceStart = Math.max(lastTime - startTime, 1) + // backoff. wait longer than the total time we've been retrying, but only + // up to a maximum of 100ms + var desiredDelay = Math.min(sinceStart * 1.2, 100) + // it's been long enough since the last retry, do it again + if (sinceAttempt >= desiredDelay) { + debug('RETRY', fn.name, args) + fn.apply(null, args.concat([startTime])) + } else { + // if we can't do this job yet, push it to the end of the queue + // and let the next iteration check again + fs[gracefulQueue].push(elem) + } + } + + // schedule our next run if one isn't already scheduled + if (retryTimer === undefined) { + retryTimer = setTimeout(retry, 0) + } +} + + +/***/ }), + +/***/ 52674: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +var Stream = (__nccwpck_require__(2203).Stream) + +module.exports = legacy + +function legacy (fs) { + return { + ReadStream: ReadStream, + WriteStream: WriteStream + } + + function ReadStream (path, options) { + if (!(this instanceof ReadStream)) return new ReadStream(path, options); + + Stream.call(this); + + var self = this; + + this.path = path; + this.fd = null; + this.readable = true; + this.paused = false; + + this.flags = 'r'; + this.mode = 438; /*=0666*/ + this.bufferSize = 64 * 1024; + + options = options || {}; + + // Mixin options into this + var keys = Object.keys(options); + for (var index = 0, length = keys.length; index < length; index++) { + var key = keys[index]; + this[key] = options[key]; + } + + if (this.encoding) this.setEncoding(this.encoding); + + if (this.start !== undefined) { + if ('number' !== typeof this.start) { + throw TypeError('start must be a Number'); + } + if (this.end === undefined) { + this.end = Infinity; + } else if ('number' !== typeof this.end) { + throw TypeError('end must be a Number'); + } + + if (this.start > this.end) { + throw new Error('start must be <= end'); + } + + this.pos = this.start; + } + + if (this.fd !== null) { + process.nextTick(function() { + self._read(); + }); + return; + } + + fs.open(this.path, this.flags, this.mode, function (err, fd) { + if (err) { + self.emit('error', err); + self.readable = false; + return; + } + + self.fd = fd; + self.emit('open', fd); + self._read(); + }) + } + + function WriteStream (path, options) { + if (!(this instanceof WriteStream)) return new WriteStream(path, options); + + Stream.call(this); + + this.path = path; + this.fd = null; + this.writable = true; + + this.flags = 'w'; + this.encoding = 'binary'; + this.mode = 438; /*=0666*/ + this.bytesWritten = 0; + + options = options || {}; + + // Mixin options into this + var keys = Object.keys(options); + for (var index = 0, length = keys.length; index < length; index++) { + var key = keys[index]; + this[key] = options[key]; + } + + if (this.start !== undefined) { + if ('number' !== typeof this.start) { + throw TypeError('start must be a Number'); + } + if (this.start < 0) { + throw new Error('start must be >= zero'); + } + + this.pos = this.start; + } + + this.busy = false; + this._queue = []; + + if (this.fd === null) { + this._open = fs.open; + this._queue.push([this._open, this.path, this.flags, this.mode, undefined]); + this.flush(); + } + } +} + + +/***/ }), + +/***/ 83545: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +var constants = __nccwpck_require__(49140) + +var origCwd = process.cwd +var cwd = null + +var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform + +process.cwd = function() { + if (!cwd) + cwd = origCwd.call(process) + return cwd +} +try { + process.cwd() +} catch (er) {} + +// This check is needed until node.js 12 is required +if (typeof process.chdir === 'function') { + var chdir = process.chdir + process.chdir = function (d) { + cwd = null + chdir.call(process, d) + } + if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir) +} + +module.exports = patch + +function patch (fs) { + // (re-)implement some things that are known busted or missing. + + // lchmod, broken prior to 0.6.2 + // back-port the fix here. + if (constants.hasOwnProperty('O_SYMLINK') && + process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) { + patchLchmod(fs) + } + + // lutimes implementation, or no-op + if (!fs.lutimes) { + patchLutimes(fs) + } + + // https://github.com/isaacs/node-graceful-fs/issues/4 + // Chown should not fail on einval or eperm if non-root. + // It should not fail on enosys ever, as this just indicates + // that a fs doesn't support the intended operation. + + fs.chown = chownFix(fs.chown) + fs.fchown = chownFix(fs.fchown) + fs.lchown = chownFix(fs.lchown) + + fs.chmod = chmodFix(fs.chmod) + fs.fchmod = chmodFix(fs.fchmod) + fs.lchmod = chmodFix(fs.lchmod) + + fs.chownSync = chownFixSync(fs.chownSync) + fs.fchownSync = chownFixSync(fs.fchownSync) + fs.lchownSync = chownFixSync(fs.lchownSync) + + fs.chmodSync = chmodFixSync(fs.chmodSync) + fs.fchmodSync = chmodFixSync(fs.fchmodSync) + fs.lchmodSync = chmodFixSync(fs.lchmodSync) + + fs.stat = statFix(fs.stat) + fs.fstat = statFix(fs.fstat) + fs.lstat = statFix(fs.lstat) + + fs.statSync = statFixSync(fs.statSync) + fs.fstatSync = statFixSync(fs.fstatSync) + fs.lstatSync = statFixSync(fs.lstatSync) + + // if lchmod/lchown do not exist, then make them no-ops + if (fs.chmod && !fs.lchmod) { + fs.lchmod = function (path, mode, cb) { + if (cb) process.nextTick(cb) + } + fs.lchmodSync = function () {} + } + if (fs.chown && !fs.lchown) { + fs.lchown = function (path, uid, gid, cb) { + if (cb) process.nextTick(cb) + } + fs.lchownSync = function () {} + } + + // on Windows, A/V software can lock the directory, causing this + // to fail with an EACCES or EPERM if the directory contains newly + // created files. Try again on failure, for up to 60 seconds. + + // Set the timeout this long because some Windows Anti-Virus, such as Parity + // bit9, may lock files for up to a minute, causing npm package install + // failures. Also, take care to yield the scheduler. Windows scheduling gives + // CPU to a busy looping process, which can cause the program causing the lock + // contention to be starved of CPU by node, so the contention doesn't resolve. + if (platform === "win32") { + fs.rename = typeof fs.rename !== 'function' ? fs.rename + : (function (fs$rename) { + function rename (from, to, cb) { + var start = Date.now() + var backoff = 0; + fs$rename(from, to, function CB (er) { + if (er + && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") + && Date.now() - start < 60000) { + setTimeout(function() { + fs.stat(to, function (stater, st) { + if (stater && stater.code === "ENOENT") + fs$rename(from, to, CB); + else + cb(er) + }) + }, backoff) + if (backoff < 100) + backoff += 10; + return; + } + if (cb) cb(er) + }) + } + if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename) + return rename + })(fs.rename) + } + + // if read() returns EAGAIN, then just try it again. + fs.read = typeof fs.read !== 'function' ? fs.read + : (function (fs$read) { + function read (fd, buffer, offset, length, position, callback_) { + var callback + if (callback_ && typeof callback_ === 'function') { + var eagCounter = 0 + callback = function (er, _, __) { + if (er && er.code === 'EAGAIN' && eagCounter < 10) { + eagCounter ++ + return fs$read.call(fs, fd, buffer, offset, length, position, callback) + } + callback_.apply(this, arguments) + } + } + return fs$read.call(fs, fd, buffer, offset, length, position, callback) + } + + // This ensures `util.promisify` works as it does for native `fs.read`. + if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read) + return read + })(fs.read) + + fs.readSync = typeof fs.readSync !== 'function' ? fs.readSync + : (function (fs$readSync) { return function (fd, buffer, offset, length, position) { + var eagCounter = 0 + while (true) { + try { + return fs$readSync.call(fs, fd, buffer, offset, length, position) + } catch (er) { + if (er.code === 'EAGAIN' && eagCounter < 10) { + eagCounter ++ + continue + } + throw er + } + } + }})(fs.readSync) + + function patchLchmod (fs) { + fs.lchmod = function (path, mode, callback) { + fs.open( path + , constants.O_WRONLY | constants.O_SYMLINK + , mode + , function (err, fd) { + if (err) { + if (callback) callback(err) + return + } + // prefer to return the chmod error, if one occurs, + // but still try to close, and report closing errors if they occur. + fs.fchmod(fd, mode, function (err) { + fs.close(fd, function(err2) { + if (callback) callback(err || err2) + }) + }) + }) + } + + fs.lchmodSync = function (path, mode) { + var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode) + + // prefer to return the chmod error, if one occurs, + // but still try to close, and report closing errors if they occur. + var threw = true + var ret + try { + ret = fs.fchmodSync(fd, mode) + threw = false + } finally { + if (threw) { + try { + fs.closeSync(fd) + } catch (er) {} + } else { + fs.closeSync(fd) + } + } + return ret + } + } + + function patchLutimes (fs) { + if (constants.hasOwnProperty("O_SYMLINK") && fs.futimes) { + fs.lutimes = function (path, at, mt, cb) { + fs.open(path, constants.O_SYMLINK, function (er, fd) { + if (er) { + if (cb) cb(er) + return + } + fs.futimes(fd, at, mt, function (er) { + fs.close(fd, function (er2) { + if (cb) cb(er || er2) + }) + }) + }) + } + + fs.lutimesSync = function (path, at, mt) { + var fd = fs.openSync(path, constants.O_SYMLINK) + var ret + var threw = true + try { + ret = fs.futimesSync(fd, at, mt) + threw = false + } finally { + if (threw) { + try { + fs.closeSync(fd) + } catch (er) {} + } else { + fs.closeSync(fd) + } + } + return ret + } + + } else if (fs.futimes) { + fs.lutimes = function (_a, _b, _c, cb) { if (cb) process.nextTick(cb) } + fs.lutimesSync = function () {} + } + } + + function chmodFix (orig) { + if (!orig) return orig + return function (target, mode, cb) { + return orig.call(fs, target, mode, function (er) { + if (chownErOk(er)) er = null + if (cb) cb.apply(this, arguments) + }) + } + } + + function chmodFixSync (orig) { + if (!orig) return orig + return function (target, mode) { + try { + return orig.call(fs, target, mode) + } catch (er) { + if (!chownErOk(er)) throw er + } + } + } + + + function chownFix (orig) { + if (!orig) return orig + return function (target, uid, gid, cb) { + return orig.call(fs, target, uid, gid, function (er) { + if (chownErOk(er)) er = null + if (cb) cb.apply(this, arguments) + }) + } + } + + function chownFixSync (orig) { + if (!orig) return orig + return function (target, uid, gid) { + try { + return orig.call(fs, target, uid, gid) + } catch (er) { + if (!chownErOk(er)) throw er + } + } + } + + function statFix (orig) { + if (!orig) return orig + // Older versions of Node erroneously returned signed integers for + // uid + gid. + return function (target, options, cb) { + if (typeof options === 'function') { + cb = options + options = null + } + function callback (er, stats) { + if (stats) { + if (stats.uid < 0) stats.uid += 0x100000000 + if (stats.gid < 0) stats.gid += 0x100000000 + } + if (cb) cb.apply(this, arguments) + } + return options ? orig.call(fs, target, options, callback) + : orig.call(fs, target, callback) + } + } + + function statFixSync (orig) { + if (!orig) return orig + // Older versions of Node erroneously returned signed integers for + // uid + gid. + return function (target, options) { + var stats = options ? orig.call(fs, target, options) + : orig.call(fs, target) + if (stats) { + if (stats.uid < 0) stats.uid += 0x100000000 + if (stats.gid < 0) stats.gid += 0x100000000 + } + return stats; + } + } + + // ENOSYS means that the fs doesn't support the op. Just ignore + // that, because it doesn't matter. + // + // if there's no getuid, or if getuid() is something other + // than 0, and the error is EINVAL or EPERM, then just ignore + // it. + // + // This specific case is a silent failure in cp, install, tar, + // and most other unix tools that manage permissions. + // + // When running as root, or if other types of errors are + // encountered, then it's strict. + function chownErOk (er) { + if (!er) + return true + + if (er.code === "ENOSYS") + return true + + var nonroot = !process.getuid || process.getuid() !== 0 + if (nonroot) { + if (er.code === "EINVAL" || er.code === "EPERM") + return true + } + + return false + } +} + + +/***/ }), + +/***/ 73456: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; +Object.defineProperty(exports, "__esModule", ({value:true}));exports.SIGNALS=void 0; + +const SIGNALS=[ +{ +name:"SIGHUP", +number:1, +action:"terminate", +description:"Terminal closed", +standard:"posix"}, + +{ +name:"SIGINT", +number:2, +action:"terminate", +description:"User interruption with CTRL-C", +standard:"ansi"}, + +{ +name:"SIGQUIT", +number:3, +action:"core", +description:"User interruption with CTRL-\\", +standard:"posix"}, +{ +name:"SIGILL", +number:4, +action:"core", +description:"Invalid machine instruction", +standard:"ansi"}, -/***/ }), +{ +name:"SIGTRAP", +number:5, +action:"core", +description:"Debugger breakpoint", +standard:"posix"}, -/***/ 13732: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +{ +name:"SIGABRT", +number:6, +action:"core", +description:"Aborted", +standard:"ansi"}, -"use strict"; +{ +name:"SIGIOT", +number:6, +action:"core", +description:"Aborted", +standard:"bsd"}, -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.merge = void 0; -const merge2 = __nccwpck_require__(26606); -function merge(streams) { - const mergedStream = merge2(streams); - streams.forEach((stream) => { - stream.once('error', (error) => mergedStream.emit('error', error)); - }); - mergedStream.once('close', () => propagateCloseEventToSources(streams)); - mergedStream.once('end', () => propagateCloseEventToSources(streams)); - return mergedStream; -} -exports.merge = merge; -function propagateCloseEventToSources(streams) { - streams.forEach((stream) => stream.emit('close')); -} +{ +name:"SIGBUS", +number:7, +action:"core", +description: +"Bus error due to misaligned, non-existing address or paging error", +standard:"bsd"}, +{ +name:"SIGEMT", +number:7, +action:"terminate", +description:"Command should be emulated but is not implemented", +standard:"other"}, -/***/ }), +{ +name:"SIGFPE", +number:8, +action:"core", +description:"Floating point arithmetic error", +standard:"ansi"}, -/***/ 55589: -/***/ ((__unused_webpack_module, exports) => { +{ +name:"SIGKILL", +number:9, +action:"terminate", +description:"Forced termination", +standard:"posix", +forced:true}, -"use strict"; +{ +name:"SIGUSR1", +number:10, +action:"terminate", +description:"Application-specific signal", +standard:"posix"}, -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.isEmpty = exports.isString = void 0; -function isString(input) { - return typeof input === 'string'; -} -exports.isString = isString; -function isEmpty(input) { - return input === ''; -} -exports.isEmpty = isEmpty; +{ +name:"SIGSEGV", +number:11, +action:"core", +description:"Segmentation fault", +standard:"ansi"}, +{ +name:"SIGUSR2", +number:12, +action:"terminate", +description:"Application-specific signal", +standard:"posix"}, -/***/ }), +{ +name:"SIGPIPE", +number:13, +action:"terminate", +description:"Broken pipe or socket", +standard:"posix"}, -/***/ 64898: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +{ +name:"SIGALRM", +number:14, +action:"terminate", +description:"Timeout or timer", +standard:"posix"}, -"use strict"; +{ +name:"SIGTERM", +number:15, +action:"terminate", +description:"Termination", +standard:"ansi"}, +{ +name:"SIGSTKFLT", +number:16, +action:"terminate", +description:"Stack is empty or overflowed", +standard:"other"}, -/* eslint-disable no-var */ +{ +name:"SIGCHLD", +number:17, +action:"ignore", +description:"Child process terminated, paused or unpaused", +standard:"posix"}, -var reusify = __nccwpck_require__(14088) +{ +name:"SIGCLD", +number:17, +action:"ignore", +description:"Child process terminated, paused or unpaused", +standard:"other"}, -function fastqueue (context, worker, _concurrency) { - if (typeof context === 'function') { - _concurrency = worker - worker = context - context = null - } +{ +name:"SIGCONT", +number:18, +action:"unpause", +description:"Unpaused", +standard:"posix", +forced:true}, + +{ +name:"SIGSTOP", +number:19, +action:"pause", +description:"Paused", +standard:"posix", +forced:true}, + +{ +name:"SIGTSTP", +number:20, +action:"pause", +description:"Paused using CTRL-Z or \"suspend\"", +standard:"posix"}, + +{ +name:"SIGTTIN", +number:21, +action:"pause", +description:"Background process cannot read terminal input", +standard:"posix"}, + +{ +name:"SIGBREAK", +number:21, +action:"terminate", +description:"User interruption with CTRL-BREAK", +standard:"other"}, + +{ +name:"SIGTTOU", +number:22, +action:"pause", +description:"Background process cannot write to terminal output", +standard:"posix"}, + +{ +name:"SIGURG", +number:23, +action:"ignore", +description:"Socket received out-of-band data", +standard:"bsd"}, + +{ +name:"SIGXCPU", +number:24, +action:"core", +description:"Process timed out", +standard:"bsd"}, + +{ +name:"SIGXFSZ", +number:25, +action:"core", +description:"File too big", +standard:"bsd"}, + +{ +name:"SIGVTALRM", +number:26, +action:"terminate", +description:"Timeout or timer", +standard:"bsd"}, + +{ +name:"SIGPROF", +number:27, +action:"terminate", +description:"Timeout or timer", +standard:"bsd"}, + +{ +name:"SIGWINCH", +number:28, +action:"ignore", +description:"Terminal window size changed", +standard:"bsd"}, + +{ +name:"SIGIO", +number:29, +action:"terminate", +description:"I/O is available", +standard:"other"}, + +{ +name:"SIGPOLL", +number:29, +action:"terminate", +description:"Watched event", +standard:"other"}, + +{ +name:"SIGINFO", +number:29, +action:"ignore", +description:"Request for process information", +standard:"other"}, - if (!(_concurrency >= 1)) { - throw new Error('fastqueue concurrency must be equal to or greater than 1') - } +{ +name:"SIGPWR", +number:30, +action:"terminate", +description:"Device running out of power", +standard:"systemv"}, - var cache = reusify(Task) - var queueHead = null - var queueTail = null - var _running = 0 - var errorHandler = null +{ +name:"SIGSYS", +number:31, +action:"core", +description:"Invalid system call", +standard:"other"}, - var self = { - push: push, - drain: noop, - saturated: noop, - pause: pause, - paused: false, +{ +name:"SIGUNUSED", +number:31, +action:"terminate", +description:"Invalid system call", +standard:"other"}];exports.SIGNALS=SIGNALS; +//# sourceMappingURL=core.js.map - get concurrency () { - return _concurrency - }, - set concurrency (value) { - if (!(value >= 1)) { - throw new Error('fastqueue concurrency must be equal to or greater than 1') - } - _concurrency = value +/***/ }), - if (self.paused) return - for (; queueHead && _running < _concurrency;) { - _running++ - release() - } - }, +/***/ 76594: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - running: running, - resume: resume, - idle: idle, - length: length, - getQueue: getQueue, - unshift: unshift, - empty: noop, - kill: kill, - killAndDrain: killAndDrain, - error: error - } +"use strict"; +Object.defineProperty(exports, "__esModule", ({value:true}));exports.signalsByNumber=exports.signalsByName=void 0;var _os=__nccwpck_require__(70857); - return self +var _signals=__nccwpck_require__(5690); +var _realtime=__nccwpck_require__(86946); - function running () { - return _running - } - function pause () { - self.paused = true - } - function length () { - var current = queueHead - var counter = 0 +const getSignalsByName=function(){ +const signals=(0,_signals.getSignals)(); +return signals.reduce(getSignalByName,{}); +}; - while (current) { - current = current.next - counter++ - } +const getSignalByName=function( +signalByNameMemo, +{name,number,description,supported,action,forced,standard}) +{ +return{ +...signalByNameMemo, +[name]:{name,number,description,supported,action,forced,standard}}; - return counter - } +}; - function getQueue () { - var current = queueHead - var tasks = [] +const signalsByName=getSignalsByName();exports.signalsByName=signalsByName; - while (current) { - tasks.push(current.value) - current = current.next - } - return tasks - } - function resume () { - if (!self.paused) return - self.paused = false - if (queueHead === null) { - _running++ - release() - return - } - for (; queueHead && _running < _concurrency;) { - _running++ - release() - } - } - function idle () { - return _running === 0 && self.length() === 0 - } +const getSignalsByNumber=function(){ +const signals=(0,_signals.getSignals)(); +const length=_realtime.SIGRTMAX+1; +const signalsA=Array.from({length},(value,number)=> +getSignalByNumber(number,signals)); - function push (value, done) { - var current = cache.get() +return Object.assign({},...signalsA); +}; - current.context = context - current.release = release - current.value = value - current.callback = done || noop - current.errorHandler = errorHandler +const getSignalByNumber=function(number,signals){ +const signal=findSignalByNumber(number,signals); - if (_running >= _concurrency || self.paused) { - if (queueTail) { - queueTail.next = current - queueTail = current - } else { - queueHead = current - queueTail = current - self.saturated() - } - } else { - _running++ - worker.call(context, current.value, current.worked) - } - } +if(signal===undefined){ +return{}; +} - function unshift (value, done) { - var current = cache.get() +const{name,description,supported,action,forced,standard}=signal; +return{ +[number]:{ +name, +number, +description, +supported, +action, +forced, +standard}}; - current.context = context - current.release = release - current.value = value - current.callback = done || noop - current.errorHandler = errorHandler - if (_running >= _concurrency || self.paused) { - if (queueHead) { - current.next = queueHead - queueHead = current - } else { - queueHead = current - queueTail = current - self.saturated() - } - } else { - _running++ - worker.call(context, current.value, current.worked) - } - } +}; - function release (holder) { - if (holder) { - cache.release(holder) - } - var next = queueHead - if (next && _running <= _concurrency) { - if (!self.paused) { - if (queueTail === queueHead) { - queueTail = null - } - queueHead = next.next - next.next = null - worker.call(context, next.value, next.worked) - if (queueTail === null) { - self.empty() - } - } else { - _running-- - } - } else if (--_running === 0) { - self.drain() - } - } - function kill () { - queueHead = null - queueTail = null - self.drain = noop - } - function killAndDrain () { - queueHead = null - queueTail = null - self.drain() - self.drain = noop - } +const findSignalByNumber=function(number,signals){ +const signal=signals.find(({name})=>_os.constants.signals[name]===number); - function error (handler) { - errorHandler = handler - } +if(signal!==undefined){ +return signal; } -function noop () {} +return signals.find(signalA=>signalA.number===number); +}; -function Task () { - this.value = null - this.callback = noop - this.next = null - this.release = noop - this.context = null - this.errorHandler = null +const signalsByNumber=getSignalsByNumber();exports.signalsByNumber=signalsByNumber; +//# sourceMappingURL=main.js.map - var self = this +/***/ }), - this.worked = function worked (err, result) { - var callback = self.callback - var errorHandler = self.errorHandler - var val = self.value - self.value = null - self.callback = noop - if (self.errorHandler) { - errorHandler(err, val) - } - callback.call(self.context, err, result) - self.release(self) - } -} +/***/ 86946: +/***/ ((__unused_webpack_module, exports) => { -function queueAsPromised (context, worker, _concurrency) { - if (typeof context === 'function') { - _concurrency = worker - worker = context - context = null - } +"use strict"; +Object.defineProperty(exports, "__esModule", ({value:true}));exports.SIGRTMAX=exports.getRealtimeSignals=void 0; +const getRealtimeSignals=function(){ +const length=SIGRTMAX-SIGRTMIN+1; +return Array.from({length},getRealtimeSignal); +};exports.getRealtimeSignals=getRealtimeSignals; - function asyncWrapper (arg, cb) { - worker.call(this, arg) - .then(function (res) { - cb(null, res) - }, cb) - } +const getRealtimeSignal=function(value,index){ +return{ +name:`SIGRT${index+1}`, +number:SIGRTMIN+index, +action:"terminate", +description:"Application-specific signal (realtime)", +standard:"posix"}; - var queue = fastqueue(context, asyncWrapper, _concurrency) +}; - var pushCb = queue.push - var unshiftCb = queue.unshift +const SIGRTMIN=34; +const SIGRTMAX=64;exports.SIGRTMAX=SIGRTMAX; +//# sourceMappingURL=realtime.js.map - queue.push = push - queue.unshift = unshift - queue.drained = drained +/***/ }), - return queue +/***/ 5690: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - function push (value) { - var p = new Promise(function (resolve, reject) { - pushCb(value, function (err, result) { - if (err) { - reject(err) - return - } - resolve(result) - }) - }) +"use strict"; +Object.defineProperty(exports, "__esModule", ({value:true}));exports.getSignals=void 0;var _os=__nccwpck_require__(70857); - // Let's fork the promise chain to - // make the error bubble up to the user but - // not lead to a unhandledRejection - p.catch(noop) +var _core=__nccwpck_require__(73456); +var _realtime=__nccwpck_require__(86946); - return p - } - function unshift (value) { - var p = new Promise(function (resolve, reject) { - unshiftCb(value, function (err, result) { - if (err) { - reject(err) - return - } - resolve(result) - }) - }) - // Let's fork the promise chain to - // make the error bubble up to the user but - // not lead to a unhandledRejection - p.catch(noop) +const getSignals=function(){ +const realtimeSignals=(0,_realtime.getRealtimeSignals)(); +const signals=[..._core.SIGNALS,...realtimeSignals].map(normalizeSignal); +return signals; +};exports.getSignals=getSignals; + + - return p - } - function drained () { - var p = new Promise(function (resolve) { - process.nextTick(function () { - if (queue.idle()) { - resolve() - } else { - var previousDrain = queue.drain - queue.drain = function () { - if (typeof previousDrain === 'function') previousDrain() - resolve() - queue.drain = previousDrain - } - } - }) - }) - return p - } -} -module.exports = fastqueue -module.exports.promise = queueAsPromised +const normalizeSignal=function({ +name, +number:defaultNumber, +description, +action, +forced=false, +standard}) +{ +const{ +signals:{[name]:constantSignal}}= +_os.constants; +const supported=constantSignal!==undefined; +const number=supported?constantSignal:defaultNumber; +return{name,number,description,supported,action,forced,standard}; +}; +//# sourceMappingURL=signals.js.map /***/ }), -/***/ 9073: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/***/ 64134: +/***/ ((module) => { -"use strict"; -/*! - * fill-range - * - * Copyright (c) 2014-present, Jon Schlinkert. - * Licensed under the MIT License. - */ +// A simple implementation of make-array +function makeArray (subject) { + return Array.isArray(subject) + ? subject + : [subject] +} +const EMPTY = '' +const SPACE = ' ' +const ESCAPE = '\\' +const REGEX_TEST_BLANK_LINE = /^\s+$/ +const REGEX_INVALID_TRAILING_BACKSLASH = /(?:[^\\]|^)\\$/ +const REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION = /^\\!/ +const REGEX_REPLACE_LEADING_EXCAPED_HASH = /^\\#/ +const REGEX_SPLITALL_CRLF = /\r?\n/g +// /foo, +// ./foo, +// ../foo, +// . +// .. +const REGEX_TEST_INVALID_PATH = /^\.*\/|^\.+$/ +const SLASH = '/' -const util = __nccwpck_require__(39023); -const toRegexRange = __nccwpck_require__(54395); +// Do not use ternary expression here, since "istanbul ignore next" is buggy +let TMP_KEY_IGNORE = 'node-ignore' +/* istanbul ignore else */ +if (typeof Symbol !== 'undefined') { + TMP_KEY_IGNORE = Symbol.for('node-ignore') +} +const KEY_IGNORE = TMP_KEY_IGNORE -const isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val); +const define = (object, key, value) => + Object.defineProperty(object, key, {value}) -const transform = toNumber => { - return value => toNumber === true ? Number(value) : String(value); -}; +const REGEX_REGEXP_RANGE = /([0-z])-([0-z])/g -const isValidValue = value => { - return typeof value === 'number' || (typeof value === 'string' && value !== ''); -}; +const RETURN_FALSE = () => false -const isNumber = num => Number.isInteger(+num); +// Sanitize the range of a regular expression +// The cases are complicated, see test cases for details +const sanitizeRange = range => range.replace( + REGEX_REGEXP_RANGE, + (match, from, to) => from.charCodeAt(0) <= to.charCodeAt(0) + ? match + // Invalid range (out of order) which is ok for gitignore rules but + // fatal for JavaScript regular expression, so eliminate it. + : EMPTY +) -const zeros = input => { - let value = `${input}`; - let index = -1; - if (value[0] === '-') value = value.slice(1); - if (value === '0') return false; - while (value[++index] === '0'); - return index > 0; -}; +// See fixtures #59 +const cleanRangeBackSlash = slashes => { + const {length} = slashes + return slashes.slice(0, length - length % 2) +} -const stringify = (start, end, options) => { - if (typeof start === 'string' || typeof end === 'string') { - return true; - } - return options.stringify === true; -}; +// > If the pattern ends with a slash, +// > it is removed for the purpose of the following description, +// > but it would only find a match with a directory. +// > In other words, foo/ will match a directory foo and paths underneath it, +// > but will not match a regular file or a symbolic link foo +// > (this is consistent with the way how pathspec works in general in Git). +// '`foo/`' will not match regular file '`foo`' or symbolic link '`foo`' +// -> ignore-rules will not deal with it, because it costs extra `fs.stat` call +// you could use option `mark: true` with `glob` -const pad = (input, maxLength, toNumber) => { - if (maxLength > 0) { - let dash = input[0] === '-' ? '-' : ''; - if (dash) input = input.slice(1); - input = (dash + input.padStart(dash ? maxLength - 1 : maxLength, '0')); - } - if (toNumber === false) { - return String(input); - } - return input; -}; +// '`foo/`' should not continue with the '`..`' +const REPLACERS = [ -const toMaxLen = (input, maxLength) => { - let negative = input[0] === '-' ? '-' : ''; - if (negative) { - input = input.slice(1); - maxLength--; - } - while (input.length < maxLength) input = '0' + input; - return negative ? ('-' + input) : input; -}; + [ + // remove BOM + // TODO: + // Other similar zero-width characters? + /^\uFEFF/, + () => EMPTY + ], -const toSequence = (parts, options, maxLen) => { - parts.negatives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0); - parts.positives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0); + // > Trailing spaces are ignored unless they are quoted with backslash ("\") + [ + // (a\ ) -> (a ) + // (a ) -> (a) + // (a ) -> (a) + // (a \ ) -> (a ) + /((?:\\\\)*?)(\\?\s+)$/, + (_, m1, m2) => m1 + ( + m2.indexOf('\\') === 0 + ? SPACE + : EMPTY + ) + ], - let prefix = options.capture ? '' : '?:'; - let positives = ''; - let negatives = ''; - let result; + // replace (\ ) with ' ' + // (\ ) -> ' ' + // (\\ ) -> '\\ ' + // (\\\ ) -> '\\ ' + [ + /(\\+?)\s/g, + (_, m1) => { + const {length} = m1 + return m1.slice(0, length - length % 2) + SPACE + } + ], - if (parts.positives.length) { - positives = parts.positives.map(v => toMaxLen(String(v), maxLen)).join('|'); - } + // Escape metacharacters + // which is written down by users but means special for regular expressions. - if (parts.negatives.length) { - negatives = `-(${prefix}${parts.negatives.map(v => toMaxLen(String(v), maxLen)).join('|')})`; - } + // > There are 12 characters with special meanings: + // > - the backslash \, + // > - the caret ^, + // > - the dollar sign $, + // > - the period or dot ., + // > - the vertical bar or pipe symbol |, + // > - the question mark ?, + // > - the asterisk or star *, + // > - the plus sign +, + // > - the opening parenthesis (, + // > - the closing parenthesis ), + // > - and the opening square bracket [, + // > - the opening curly brace {, + // > These special characters are often called "metacharacters". + [ + /[\\$.|*+(){^]/g, + match => `\\${match}` + ], - if (positives && negatives) { - result = `${positives}|${negatives}`; - } else { - result = positives || negatives; - } + [ + // > a question mark (?) matches a single character + /(?!\\)\?/g, + () => '[^/]' + ], - if (options.wrap) { - return `(${prefix}${result})`; - } + // leading slash + [ - return result; -}; + // > A leading slash matches the beginning of the pathname. + // > For example, "/*.c" matches "cat-file.c" but not "mozilla-sha1/sha1.c". + // A leading slash matches the beginning of the pathname + /^\//, + () => '^' + ], -const toRange = (a, b, isNumbers, options) => { - if (isNumbers) { - return toRegexRange(a, b, { wrap: false, ...options }); - } + // replace special metacharacter slash after the leading slash + [ + /\//g, + () => '\\/' + ], - let start = String.fromCharCode(a); - if (a === b) return start; + [ + // > A leading "**" followed by a slash means match in all directories. + // > For example, "**/foo" matches file or directory "foo" anywhere, + // > the same as pattern "foo". + // > "**/foo/bar" matches file or directory "bar" anywhere that is directly + // > under directory "foo". + // Notice that the '*'s have been replaced as '\\*' + /^\^*\\\*\\\*\\\//, - let stop = String.fromCharCode(b); - return `[${start}-${stop}]`; -}; + // '**/foo' <-> 'foo' + () => '^(?:.*\\/)?' + ], -const toRegex = (start, end, options) => { - if (Array.isArray(start)) { - let wrap = options.wrap === true; - let prefix = options.capture ? '' : '?:'; - return wrap ? `(${prefix}${start.join('|')})` : start.join('|'); - } - return toRegexRange(start, end, options); -}; + // starting + [ + // there will be no leading '/' + // (which has been replaced by section "leading slash") + // If starts with '**', adding a '^' to the regular expression also works + /^(?=[^^])/, + function startingReplacer () { + // If has a slash `/` at the beginning or middle + return !/\/(?!$)/.test(this) + // > Prior to 2.22.1 + // > If the pattern does not contain a slash /, + // > Git treats it as a shell glob pattern + // Actually, if there is only a trailing slash, + // git also treats it as a shell glob pattern -const rangeError = (...args) => { - return new RangeError('Invalid range arguments: ' + util.inspect(...args)); -}; + // After 2.22.1 (compatible but clearer) + // > If there is a separator at the beginning or middle (or both) + // > of the pattern, then the pattern is relative to the directory + // > level of the particular .gitignore file itself. + // > Otherwise the pattern may also match at any level below + // > the .gitignore level. + ? '(?:^|\\/)' -const invalidRange = (start, end, options) => { - if (options.strictRanges === true) throw rangeError([start, end]); - return []; -}; + // > Otherwise, Git treats the pattern as a shell glob suitable for + // > consumption by fnmatch(3) + : '^' + } + ], -const invalidStep = (step, options) => { - if (options.strictRanges === true) { - throw new TypeError(`Expected step "${step}" to be a number`); - } - return []; -}; + // two globstars + [ + // Use lookahead assertions so that we could match more than one `'/**'` + /\\\/\\\*\\\*(?=\\\/|$)/g, -const fillNumbers = (start, end, step = 1, options = {}) => { - let a = Number(start); - let b = Number(end); + // Zero, one or several directories + // should not use '*', or it will be replaced by the next replacer - if (!Number.isInteger(a) || !Number.isInteger(b)) { - if (options.strictRanges === true) throw rangeError([start, end]); - return []; - } + // Check if it is not the last `'/**'` + (_, index, str) => index + 6 < str.length - // fix negative zero - if (a === 0) a = 0; - if (b === 0) b = 0; + // case: /**/ + // > A slash followed by two consecutive asterisks then a slash matches + // > zero or more directories. + // > For example, "a/**/b" matches "a/b", "a/x/b", "a/x/y/b" and so on. + // '/**/' + ? '(?:\\/[^\\/]+)*' - let descending = a > b; - let startString = String(start); - let endString = String(end); - let stepString = String(step); - step = Math.max(Math.abs(step), 1); + // case: /** + // > A trailing `"/**"` matches everything inside. - let padded = zeros(startString) || zeros(endString) || zeros(stepString); - let maxLen = padded ? Math.max(startString.length, endString.length, stepString.length) : 0; - let toNumber = padded === false && stringify(start, end, options) === false; - let format = options.transform || transform(toNumber); + // #21: everything inside but it should not include the current folder + : '\\/.+' + ], - if (options.toRegex && step === 1) { - return toRange(toMaxLen(start, maxLen), toMaxLen(end, maxLen), true, options); - } + // normal intermediate wildcards + [ + // Never replace escaped '*' + // ignore rule '\*' will match the path '*' - let parts = { negatives: [], positives: [] }; - let push = num => parts[num < 0 ? 'negatives' : 'positives'].push(Math.abs(num)); - let range = []; - let index = 0; + // 'abc.*/' -> go + // 'abc.*' -> skip this rule, + // coz trailing single wildcard will be handed by [trailing wildcard] + /(^|[^\\]+)(\\\*)+(?=.+)/g, - while (descending ? a >= b : a <= b) { - if (options.toRegex === true && step > 1) { - push(a); - } else { - range.push(pad(format(a, index), maxLen, toNumber)); + // '*.js' matches '.js' + // '*.js' doesn't match 'abc' + (_, p1, p2) => { + // 1. + // > An asterisk "*" matches anything except a slash. + // 2. + // > Other consecutive asterisks are considered regular asterisks + // > and will match according to the previous rules. + const unescaped = p2.replace(/\\\*/g, '[^\\/]*') + return p1 + unescaped } - a = descending ? a - step : a + step; - index++; - } - - if (options.toRegex === true) { - return step > 1 - ? toSequence(parts, options, maxLen) - : toRegex(range, null, { wrap: false, ...options }); - } - - return range; -}; + ], -const fillLetters = (start, end, step = 1, options = {}) => { - if ((!isNumber(start) && start.length > 1) || (!isNumber(end) && end.length > 1)) { - return invalidRange(start, end, options); - } + [ + // unescape, revert step 3 except for back slash + // For example, if a user escape a '\\*', + // after step 3, the result will be '\\\\\\*' + /\\\\\\(?=[$.|*+(){^])/g, + () => ESCAPE + ], - let format = options.transform || (val => String.fromCharCode(val)); - let a = `${start}`.charCodeAt(0); - let b = `${end}`.charCodeAt(0); + [ + // '\\\\' -> '\\' + /\\\\/g, + () => ESCAPE + ], - let descending = a > b; - let min = Math.min(a, b); - let max = Math.max(a, b); + [ + // > The range notation, e.g. [a-zA-Z], + // > can be used to match one of the characters in a range. - if (options.toRegex && step === 1) { - return toRange(min, max, false, options); - } + // `\` is escaped by step 3 + /(\\)?\[([^\]/]*?)(\\*)($|\])/g, + (match, leadEscape, range, endEscape, close) => leadEscape === ESCAPE + // '\\[bar]' -> '\\\\[bar\\]' + ? `\\[${range}${cleanRangeBackSlash(endEscape)}${close}` + : close === ']' + ? endEscape.length % 2 === 0 + // A normal case, and it is a range notation + // '[bar]' + // '[bar\\\\]' + ? `[${sanitizeRange(range)}${endEscape}]` + // Invalid range notaton + // '[bar\\]' -> '[bar\\\\]' + : '[]' + : '[]' + ], - let range = []; - let index = 0; + // ending + [ + // 'js' will not match 'js.' + // 'ab' will not match 'abc' + /(?:[^*])$/, - while (descending ? a >= b : a <= b) { - range.push(format(a, index)); - a = descending ? a - step : a + step; - index++; - } + // WTF! + // https://git-scm.com/docs/gitignore + // changes in [2.22.1](https://git-scm.com/docs/gitignore/2.22.1) + // which re-fixes #24, #38 - if (options.toRegex === true) { - return toRegex(range, null, { wrap: false, options }); - } + // > If there is a separator at the end of the pattern then the pattern + // > will only match directories, otherwise the pattern can match both + // > files and directories. - return range; -}; + // 'js*' will not match 'a.js' + // 'js/' will not match 'a.js' + // 'js' will match 'a.js' and 'a.js/' + match => /\/$/.test(match) + // foo/ will not match 'foo' + ? `${match}$` + // foo matches 'foo' and 'foo/' + : `${match}(?=$|\\/$)` + ], -const fill = (start, end, step, options = {}) => { - if (end == null && isValidValue(start)) { - return [start]; - } + // trailing wildcard + [ + /(\^|\\\/)?\\\*$/, + (_, p1) => { + const prefix = p1 + // '\^': + // '/*' does not match EMPTY + // '/*' does not match everything - if (!isValidValue(start) || !isValidValue(end)) { - return invalidRange(start, end, options); - } + // '\\\/': + // 'abc/*' does not match 'abc/' + ? `${p1}[^/]+` - if (typeof step === 'function') { - return fill(start, end, 1, { transform: step }); - } + // 'a*' matches 'a' + // 'a*' matches 'aa' + : '[^/]*' - if (isObject(step)) { - return fill(start, end, 0, step); - } + return `${prefix}(?=$|\\/$)` + } + ], +] - let opts = { ...options }; - if (opts.capture === true) opts.wrap = true; - step = step || opts.step || 1; +// A simple cache, because an ignore rule only has only one certain meaning +const regexCache = Object.create(null) - if (!isNumber(step)) { - if (step != null && !isObject(step)) return invalidStep(step, opts); - return fill(start, end, 1, step); - } +// @param {pattern} +const makeRegex = (pattern, ignoreCase) => { + let source = regexCache[pattern] - if (isNumber(start) && isNumber(end)) { - return fillNumbers(start, end, step, opts); + if (!source) { + source = REPLACERS.reduce( + (prev, [matcher, replacer]) => + prev.replace(matcher, replacer.bind(pattern)), + pattern + ) + regexCache[pattern] = source } - return fillLetters(start, end, Math.max(Math.abs(step), 1), opts); -}; - -module.exports = fill; - - -/***/ }), + return ignoreCase + ? new RegExp(source, 'i') + : new RegExp(source) +} -/***/ 81179: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +const isString = subject => typeof subject === 'string' -"use strict"; +// > A blank line matches no files, so it can serve as a separator for readability. +const checkPattern = pattern => pattern + && isString(pattern) + && !REGEX_TEST_BLANK_LINE.test(pattern) + && !REGEX_INVALID_TRAILING_BACKSLASH.test(pattern) -const path = __nccwpck_require__(16928); -const locatePath = __nccwpck_require__(58146); -const pathExists = __nccwpck_require__(25802); + // > A line starting with # serves as a comment. + && pattern.indexOf('#') !== 0 -const stop = Symbol('findUp.stop'); +const splitPattern = pattern => pattern.split(REGEX_SPLITALL_CRLF) -module.exports = async (name, options = {}) => { - let directory = path.resolve(options.cwd || ''); - const {root} = path.parse(directory); - const paths = [].concat(name); +class IgnoreRule { + constructor ( + origin, + pattern, + negative, + regex + ) { + this.origin = origin + this.pattern = pattern + this.negative = negative + this.regex = regex + } +} - const runMatcher = async locateOptions => { - if (typeof name !== 'function') { - return locatePath(paths, locateOptions); - } +const createRule = (pattern, ignoreCase) => { + const origin = pattern + let negative = false - const foundPath = await name(locateOptions.cwd); - if (typeof foundPath === 'string') { - return locatePath([foundPath], locateOptions); - } + // > An optional prefix "!" which negates the pattern; + if (pattern.indexOf('!') === 0) { + negative = true + pattern = pattern.substr(1) + } - return foundPath; - }; + pattern = pattern + // > Put a backslash ("\") in front of the first "!" for patterns that + // > begin with a literal "!", for example, `"\!important!.txt"`. + .replace(REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION, '!') + // > Put a backslash ("\") in front of the first hash for patterns that + // > begin with a hash. + .replace(REGEX_REPLACE_LEADING_EXCAPED_HASH, '#') - // eslint-disable-next-line no-constant-condition - while (true) { - // eslint-disable-next-line no-await-in-loop - const foundPath = await runMatcher({...options, cwd: directory}); + const regex = makeRegex(pattern, ignoreCase) - if (foundPath === stop) { - return; - } + return new IgnoreRule( + origin, + pattern, + negative, + regex + ) +} - if (foundPath) { - return path.resolve(directory, foundPath); - } +const throwError = (message, Ctor) => { + throw new Ctor(message) +} - if (directory === root) { - return; - } +const checkPath = (path, originalPath, doThrow) => { + if (!isString(path)) { + return doThrow( + `path must be a string, but got \`${originalPath}\``, + TypeError + ) + } - directory = path.dirname(directory); - } -}; + // We don't know if we should ignore EMPTY, so throw + if (!path) { + return doThrow(`path must not be empty`, TypeError) + } -module.exports.sync = (name, options = {}) => { - let directory = path.resolve(options.cwd || ''); - const {root} = path.parse(directory); - const paths = [].concat(name); + // Check if it is a relative path + if (checkPath.isNotRelative(path)) { + const r = '`path.relative()`d' + return doThrow( + `path should be a ${r} string, but got "${originalPath}"`, + RangeError + ) + } - const runMatcher = locateOptions => { - if (typeof name !== 'function') { - return locatePath.sync(paths, locateOptions); - } + return true +} - const foundPath = name(locateOptions.cwd); - if (typeof foundPath === 'string') { - return locatePath.sync([foundPath], locateOptions); - } +const isNotRelative = path => REGEX_TEST_INVALID_PATH.test(path) - return foundPath; - }; +checkPath.isNotRelative = isNotRelative +checkPath.convert = p => p - // eslint-disable-next-line no-constant-condition - while (true) { - const foundPath = runMatcher({...options, cwd: directory}); +class Ignore { + constructor ({ + ignorecase = true, + ignoreCase = ignorecase, + allowRelativePaths = false + } = {}) { + define(this, KEY_IGNORE, true) - if (foundPath === stop) { - return; - } + this._rules = [] + this._ignoreCase = ignoreCase + this._allowRelativePaths = allowRelativePaths + this._initCache() + } - if (foundPath) { - return path.resolve(directory, foundPath); - } + _initCache () { + this._ignoreCache = Object.create(null) + this._testCache = Object.create(null) + } - if (directory === root) { - return; - } + _addPattern (pattern) { + // #32 + if (pattern && pattern[KEY_IGNORE]) { + this._rules = this._rules.concat(pattern._rules) + this._added = true + return + } - directory = path.dirname(directory); - } -}; + if (checkPattern(pattern)) { + const rule = createRule(pattern, this._ignoreCase) + this._added = true + this._rules.push(rule) + } + } -module.exports.exists = pathExists; + // @param {Array | string | Ignore} pattern + add (pattern) { + this._added = false -module.exports.sync.exists = pathExists.sync; + makeArray( + isString(pattern) + ? splitPattern(pattern) + : pattern + ).forEach(this._addPattern, this) -module.exports.stop = stop; + // Some rules have just added to the ignore, + // making the behavior changed. + if (this._added) { + this._initCache() + } + return this + } -/***/ }), + // legacy + addPattern (pattern) { + return this.add(pattern) + } -/***/ 60979: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + // | ignored : unignored + // negative | 0:0 | 0:1 | 1:0 | 1:1 + // -------- | ------- | ------- | ------- | -------- + // 0 | TEST | TEST | SKIP | X + // 1 | TESTIF | SKIP | TEST | X -"use strict"; + // - SKIP: always skip + // - TEST: always test + // - TESTIF: only test if checkUnignored + // - X: that never happen + // @param {boolean} whether should check if the path is unignored, + // setting `checkUnignored` to `false` could reduce additional + // path matching. -const fs = __nccwpck_require__(61404) -const path = __nccwpck_require__(16928) -const mkdirpSync = (__nccwpck_require__(36813).mkdirsSync) -const utimesSync = (__nccwpck_require__(51226).utimesMillisSync) + // @returns {TestResult} true if a file is ignored + _testOne (path, checkUnignored) { + let ignored = false + let unignored = false -const notExist = Symbol('notExist') + this._rules.forEach(rule => { + const {negative} = rule + if ( + unignored === negative && ignored !== unignored + || negative && !ignored && !unignored && !checkUnignored + ) { + return + } -function copySync (src, dest, opts) { - if (typeof opts === 'function') { - opts = {filter: opts} - } + const matched = rule.regex.test(path) - opts = opts || {} - opts.clobber = 'clobber' in opts ? !!opts.clobber : true // default to true for now - opts.overwrite = 'overwrite' in opts ? !!opts.overwrite : opts.clobber // overwrite falls back to clobber + if (matched) { + ignored = !negative + unignored = negative + } + }) - // Warn about using preserveTimestamps on 32-bit node - if (opts.preserveTimestamps && process.arch === 'ia32') { - console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n - see https://github.com/jprichardson/node-fs-extra/issues/269`) + return { + ignored, + unignored + } } - const destStat = checkPaths(src, dest) - - if (opts.filter && !opts.filter(src, dest)) return - - const destParent = path.dirname(dest) - if (!fs.existsSync(destParent)) mkdirpSync(destParent) - return startCopy(destStat, src, dest, opts) -} + // @returns {TestResult} + _test (originalPath, cache, checkUnignored, slices) { + const path = originalPath + // Supports nullable path + && checkPath.convert(originalPath) -function startCopy (destStat, src, dest, opts) { - if (opts.filter && !opts.filter(src, dest)) return - return getStats(destStat, src, dest, opts) -} + checkPath( + path, + originalPath, + this._allowRelativePaths + ? RETURN_FALSE + : throwError + ) -function getStats (destStat, src, dest, opts) { - const statSync = opts.dereference ? fs.statSync : fs.lstatSync - const srcStat = statSync(src) + return this._t(path, cache, checkUnignored, slices) + } - if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts) - else if (srcStat.isFile() || - srcStat.isCharacterDevice() || - srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts) - else if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts) -} + _t (path, cache, checkUnignored, slices) { + if (path in cache) { + return cache[path] + } -function onFile (srcStat, destStat, src, dest, opts) { - if (destStat === notExist) return copyFile(srcStat, src, dest, opts) - return mayCopyFile(srcStat, src, dest, opts) -} + if (!slices) { + // path/to/a.js + // ['path', 'to', 'a.js'] + slices = path.split(SLASH) + } -function mayCopyFile (srcStat, src, dest, opts) { - if (opts.overwrite) { - fs.unlinkSync(dest) - return copyFile(srcStat, src, dest, opts) - } else if (opts.errorOnExist) { - throw new Error(`'${dest}' already exists`) - } -} + slices.pop() -function copyFile (srcStat, src, dest, opts) { - if (typeof fs.copyFileSync === 'function') { - fs.copyFileSync(src, dest) - fs.chmodSync(dest, srcStat.mode) - if (opts.preserveTimestamps) { - return utimesSync(dest, srcStat.atime, srcStat.mtime) + // If the path has no parent directory, just test it + if (!slices.length) { + return cache[path] = this._testOne(path, checkUnignored) } - return - } - return copyFileFallback(srcStat, src, dest, opts) -} -function copyFileFallback (srcStat, src, dest, opts) { - const BUF_LENGTH = 64 * 1024 - const _buff = __nccwpck_require__(79463)(BUF_LENGTH) + const parent = this._t( + slices.join(SLASH) + SLASH, + cache, + checkUnignored, + slices + ) - const fdr = fs.openSync(src, 'r') - const fdw = fs.openSync(dest, 'w', srcStat.mode) - let pos = 0 + // If the path contains a parent directory, check the parent first + return cache[path] = parent.ignored + // > It is not possible to re-include a file if a parent directory of + // > that file is excluded. + ? parent + : this._testOne(path, checkUnignored) + } - while (pos < srcStat.size) { - const bytesRead = fs.readSync(fdr, _buff, 0, BUF_LENGTH, pos) - fs.writeSync(fdw, _buff, 0, bytesRead) - pos += bytesRead + ignores (path) { + return this._test(path, this._ignoreCache, false).ignored } - if (opts.preserveTimestamps) fs.futimesSync(fdw, srcStat.atime, srcStat.mtime) + createFilter () { + return path => !this.ignores(path) + } - fs.closeSync(fdr) - fs.closeSync(fdw) -} + filter (paths) { + return makeArray(paths).filter(this.createFilter()) + } -function onDir (srcStat, destStat, src, dest, opts) { - if (destStat === notExist) return mkDirAndCopy(srcStat, src, dest, opts) - if (destStat && !destStat.isDirectory()) { - throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`) + // @returns {TestResult} + test (path) { + return this._test(path, this._testCache, true) } - return copyDir(src, dest, opts) } -function mkDirAndCopy (srcStat, src, dest, opts) { - fs.mkdirSync(dest) - copyDir(src, dest, opts) - return fs.chmodSync(dest, srcStat.mode) -} +const factory = options => new Ignore(options) -function copyDir (src, dest, opts) { - fs.readdirSync(src).forEach(item => copyDirItem(item, src, dest, opts)) -} +const isPathValid = path => + checkPath(path && checkPath.convert(path), path, RETURN_FALSE) -function copyDirItem (item, src, dest, opts) { - const srcItem = path.join(src, item) - const destItem = path.join(dest, item) - const destStat = checkPaths(srcItem, destItem) - return startCopy(destStat, srcItem, destItem, opts) -} +factory.isPathValid = isPathValid -function onLink (destStat, src, dest, opts) { - let resolvedSrc = fs.readlinkSync(src) +// Fixes typescript +factory.default = factory - if (opts.dereference) { - resolvedSrc = path.resolve(process.cwd(), resolvedSrc) - } +module.exports = factory - if (destStat === notExist) { - return fs.symlinkSync(resolvedSrc, dest) - } else { - let resolvedDest - try { - resolvedDest = fs.readlinkSync(dest) - } catch (err) { - // dest exists and is a regular file or directory, - // Windows may throw UNKNOWN error. If dest already exists, - // fs throws error anyway, so no need to guard against it here. - if (err.code === 'EINVAL' || err.code === 'UNKNOWN') return fs.symlinkSync(resolvedSrc, dest) - throw err - } - if (opts.dereference) { - resolvedDest = path.resolve(process.cwd(), resolvedDest) - } - if (isSrcSubdir(resolvedSrc, resolvedDest)) { - throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`) - } +// Windows +// -------------------------------------------------------------- +/* istanbul ignore if */ +if ( + // Detect `process` so that it can run in browsers. + typeof process !== 'undefined' + && ( + process.env && process.env.IGNORE_TEST_WIN32 + || process.platform === 'win32' + ) +) { + /* eslint no-control-regex: "off" */ + const makePosix = str => /^\\\\\?\\/.test(str) + || /["<>|\u0000-\u001F]+/u.test(str) + ? str + : str.replace(/\\/g, '/') - // prevent copy if src is a subdir of dest since unlinking - // dest in this case would result in removing src contents - // and therefore a broken symlink would be created. - if (fs.statSync(dest).isDirectory() && isSrcSubdir(resolvedDest, resolvedSrc)) { - throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`) - } - return copyLink(resolvedSrc, dest) - } -} + checkPath.convert = makePosix -function copyLink (resolvedSrc, dest) { - fs.unlinkSync(dest) - return fs.symlinkSync(resolvedSrc, dest) + // 'C:\\foo' <- 'C:\\foo' has been converted to 'C:/' + // 'd:\\foo' + const REGIX_IS_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i + checkPath.isNotRelative = path => + REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path) + || isNotRelative(path) } -// return true if dest is a subdir of src, otherwise false. -function isSrcSubdir (src, dest) { - const srcArray = path.resolve(src).split(path.sep) - const destArray = path.resolve(dest).split(path.sep) - return srcArray.reduce((acc, current, i) => acc && destArray[i] === current, true) -} -function checkStats (src, dest) { - const srcStat = fs.statSync(src) - let destStat - try { - destStat = fs.statSync(dest) - } catch (err) { - if (err.code === 'ENOENT') return {srcStat, destStat: notExist} - throw err - } - return {srcStat, destStat} -} +/***/ }), -function checkPaths (src, dest) { - const {srcStat, destStat} = checkStats(src, dest) - if (destStat.ino && destStat.ino === srcStat.ino) { - throw new Error('Source and destination must not be the same.') +/***/ 17280: +/***/ ((module) => { + +/*! + * is-extglob + * + * Copyright (c) 2014-2016, Jon Schlinkert. + * Licensed under the MIT License. + */ + +module.exports = function isExtglob(str) { + if (typeof str !== 'string' || str === '') { + return false; } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - throw new Error(`Cannot copy '${src}' to a subdirectory of itself, '${dest}'.`) + + var match; + while ((match = /(\\).|([@?!+*]\(.*\))/g.exec(str))) { + if (match[2]) return true; + str = str.slice(match.index + match[0].length); } - return destStat -} -module.exports = copySync + return false; +}; /***/ }), -/***/ 32864: +/***/ 11753: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -"use strict"; - +/*! + * is-glob + * + * Copyright (c) 2014-2017, Jon Schlinkert. + * Released under the MIT License. + */ -module.exports = { - copySync: __nccwpck_require__(60979) -} +var isExtglob = __nccwpck_require__(17280); +var chars = { '{': '}', '(': ')', '[': ']'}; +var strictCheck = function(str) { + if (str[0] === '!') { + return true; + } + var index = 0; + var pipeIndex = -2; + var closeSquareIndex = -2; + var closeCurlyIndex = -2; + var closeParenIndex = -2; + var backSlashIndex = -2; + while (index < str.length) { + if (str[index] === '*') { + return true; + } + if (str[index + 1] === '?' && /[\].+)]/.test(str[index])) { + return true; + } -/***/ }), + if (closeSquareIndex !== -1 && str[index] === '[' && str[index + 1] !== ']') { + if (closeSquareIndex < index) { + closeSquareIndex = str.indexOf(']', index); + } + if (closeSquareIndex > index) { + if (backSlashIndex === -1 || backSlashIndex > closeSquareIndex) { + return true; + } + backSlashIndex = str.indexOf('\\', index); + if (backSlashIndex === -1 || backSlashIndex > closeSquareIndex) { + return true; + } + } + } -/***/ 14027: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + if (closeCurlyIndex !== -1 && str[index] === '{' && str[index + 1] !== '}') { + closeCurlyIndex = str.indexOf('}', index); + if (closeCurlyIndex > index) { + backSlashIndex = str.indexOf('\\', index); + if (backSlashIndex === -1 || backSlashIndex > closeCurlyIndex) { + return true; + } + } + } -"use strict"; + if (closeParenIndex !== -1 && str[index] === '(' && str[index + 1] === '?' && /[:!=]/.test(str[index + 2]) && str[index + 3] !== ')') { + closeParenIndex = str.indexOf(')', index); + if (closeParenIndex > index) { + backSlashIndex = str.indexOf('\\', index); + if (backSlashIndex === -1 || backSlashIndex > closeParenIndex) { + return true; + } + } + } + if (pipeIndex !== -1 && str[index] === '(' && str[index + 1] !== '|') { + if (pipeIndex < index) { + pipeIndex = str.indexOf('|', index); + } + if (pipeIndex !== -1 && str[pipeIndex + 1] !== ')') { + closeParenIndex = str.indexOf(')', pipeIndex); + if (closeParenIndex > pipeIndex) { + backSlashIndex = str.indexOf('\\', pipeIndex); + if (backSlashIndex === -1 || backSlashIndex > closeParenIndex) { + return true; + } + } + } + } -const fs = __nccwpck_require__(61404) -const path = __nccwpck_require__(16928) -const mkdirp = (__nccwpck_require__(36813).mkdirs) -const pathExists = (__nccwpck_require__(26949).pathExists) -const utimes = (__nccwpck_require__(51226).utimesMillis) + if (str[index] === '\\') { + var open = str[index + 1]; + index += 2; + var close = chars[open]; -const notExist = Symbol('notExist') + if (close) { + var n = str.indexOf(close, index); + if (n !== -1) { + index = n + 1; + } + } -function copy (src, dest, opts, cb) { - if (typeof opts === 'function' && !cb) { - cb = opts - opts = {} - } else if (typeof opts === 'function') { - opts = {filter: opts} + if (str[index] === '!') { + return true; + } + } else { + index++; + } } + return false; +}; - cb = cb || function () {} - opts = opts || {} - - opts.clobber = 'clobber' in opts ? !!opts.clobber : true // default to true for now - opts.overwrite = 'overwrite' in opts ? !!opts.overwrite : opts.clobber // overwrite falls back to clobber - - // Warn about using preserveTimestamps on 32-bit node - if (opts.preserveTimestamps && process.arch === 'ia32') { - console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n - see https://github.com/jprichardson/node-fs-extra/issues/269`) +var relaxedCheck = function(str) { + if (str[0] === '!') { + return true; } + var index = 0; + while (index < str.length) { + if (/[*?{}()[\]]/.test(str[index])) { + return true; + } - checkPaths(src, dest, (err, destStat) => { - if (err) return cb(err) - if (opts.filter) return handleFilter(checkParentDir, destStat, src, dest, opts, cb) - return checkParentDir(destStat, src, dest, opts, cb) - }) -} + if (str[index] === '\\') { + var open = str[index + 1]; + index += 2; + var close = chars[open]; -function checkParentDir (destStat, src, dest, opts, cb) { - const destParent = path.dirname(dest) - pathExists(destParent, (err, dirExists) => { - if (err) return cb(err) - if (dirExists) return startCopy(destStat, src, dest, opts, cb) - mkdirp(destParent, err => { - if (err) return cb(err) - return startCopy(destStat, src, dest, opts, cb) - }) - }) -} + if (close) { + var n = str.indexOf(close, index); + if (n !== -1) { + index = n + 1; + } + } -function handleFilter (onInclude, destStat, src, dest, opts, cb) { - Promise.resolve(opts.filter(src, dest)).then(include => { - if (include) { - if (destStat) return onInclude(destStat, src, dest, opts, cb) - return onInclude(src, dest, opts, cb) + if (str[index] === '!') { + return true; + } + } else { + index++; } - return cb() - }, error => cb(error)) -} + } + return false; +}; -function startCopy (destStat, src, dest, opts, cb) { - if (opts.filter) return handleFilter(getStats, destStat, src, dest, opts, cb) - return getStats(destStat, src, dest, opts, cb) -} +module.exports = function isGlob(str, options) { + if (typeof str !== 'string' || str === '') { + return false; + } + + if (isExtglob(str)) { + return true; + } -function getStats (destStat, src, dest, opts, cb) { - const stat = opts.dereference ? fs.stat : fs.lstat - stat(src, (err, srcStat) => { - if (err) return cb(err) + var check = strictCheck; - 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) - }) -} + // optionally relax check + if (options && options.strict === false) { + check = relaxedCheck; + } -function onFile (srcStat, destStat, src, dest, opts, cb) { - if (destStat === notExist) return copyFile(srcStat, src, dest, opts, cb) - return mayCopyFile(srcStat, src, dest, opts, cb) -} + return check(str); +}; -function mayCopyFile (srcStat, src, dest, opts, cb) { - if (opts.overwrite) { - fs.unlink(dest, err => { - if (err) return cb(err) - return copyFile(srcStat, src, dest, opts, cb) - }) - } else if (opts.errorOnExist) { - return cb(new Error(`'${dest}' already exists`)) - } else return cb() -} -function copyFile (srcStat, src, dest, opts, cb) { - if (typeof fs.copyFile === 'function') { - return fs.copyFile(src, dest, err => { - if (err) return cb(err) - return setDestModeAndTimestamps(srcStat, dest, opts, cb) - }) - } - return copyFileFallback(srcStat, src, dest, opts, cb) -} +/***/ }), -function copyFileFallback (srcStat, src, dest, opts, cb) { - const rs = fs.createReadStream(src) - rs.on('error', err => cb(err)).once('open', () => { - const ws = fs.createWriteStream(dest, { mode: srcStat.mode }) - ws.on('error', err => cb(err)) - .on('open', () => rs.pipe(ws)) - .once('close', () => setDestModeAndTimestamps(srcStat, dest, opts, cb)) - }) -} +/***/ 97850: +/***/ ((module) => { -function setDestModeAndTimestamps (srcStat, dest, opts, cb) { - fs.chmod(dest, srcStat.mode, err => { - if (err) return cb(err) - if (opts.preserveTimestamps) { - return utimes(dest, srcStat.atime, srcStat.mtime, cb) - } - return cb() - }) -} +"use strict"; +/*! + * is-number + * + * Copyright (c) 2014-present, Jon Schlinkert. + * Released under the MIT License. + */ -function onDir (srcStat, destStat, src, dest, opts, cb) { - if (destStat === notExist) return mkDirAndCopy(srcStat, src, dest, opts, cb) - if (destStat && !destStat.isDirectory()) { - return cb(new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`)) - } - return copyDir(src, dest, opts, cb) -} -function mkDirAndCopy (srcStat, src, dest, opts, cb) { - fs.mkdir(dest, err => { - if (err) return cb(err) - copyDir(src, dest, opts, err => { - if (err) return cb(err) - return fs.chmod(dest, srcStat.mode, cb) - }) - }) -} -function copyDir (src, dest, opts, cb) { - fs.readdir(src, (err, items) => { - if (err) return cb(err) - return copyDirItems(items, src, dest, opts, cb) - }) -} +module.exports = function(num) { + if (typeof num === 'number') { + return num - num === 0; + } + if (typeof num === 'string' && num.trim() !== '') { + return Number.isFinite ? Number.isFinite(+num) : isFinite(+num); + } + return false; +}; -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) - checkPaths(srcItem, destItem, (err, destStat) => { - if (err) return cb(err) - startCopy(destStat, srcItem, destItem, opts, err => { - if (err) return cb(err) - return copyDirItems(items, src, dest, opts, cb) - }) - }) -} +/***/ }), -function onLink (destStat, src, dest, opts, cb) { - fs.readlink(src, (err, resolvedSrc) => { - if (err) return cb(err) +/***/ 81011: +/***/ ((module) => { - if (opts.dereference) { - resolvedSrc = path.resolve(process.cwd(), resolvedSrc) - } +"use strict"; - if (destStat === notExist) { - return fs.symlink(resolvedSrc, dest, cb) - } else { - fs.readlink(dest, (err, resolvedDest) => { - if (err) { - // dest exists and is a regular file or directory, - // Windows may throw UNKNOWN error. If dest already exists, - // fs throws error anyway, so no need to guard against it here. - if (err.code === 'EINVAL' || err.code === 'UNKNOWN') return fs.symlink(resolvedSrc, dest, cb) - return cb(err) - } - if (opts.dereference) { - resolvedDest = path.resolve(process.cwd(), resolvedDest) - } - if (isSrcSubdir(resolvedSrc, resolvedDest)) { - return cb(new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`)) - } - // do not copy if src is a subdir of dest since unlinking - // dest in this case would result in removing src contents - // and therefore a broken symlink would be created. - if (destStat.isDirectory() && isSrcSubdir(resolvedDest, resolvedSrc)) { - return cb(new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`)) - } - return copyLink(resolvedSrc, dest, cb) - }) - } - }) -} +const isStream = stream => + stream !== null && + typeof stream === 'object' && + typeof stream.pipe === 'function'; -function copyLink (resolvedSrc, dest, cb) { - fs.unlink(dest, err => { - if (err) return cb(err) - return fs.symlink(resolvedSrc, dest, cb) - }) -} +isStream.writable = stream => + isStream(stream) && + stream.writable !== false && + typeof stream._write === 'function' && + typeof stream._writableState === 'object'; -// return true if dest is a subdir of src, otherwise false. -function isSrcSubdir (src, dest) { - const srcArray = path.resolve(src).split(path.sep) - const destArray = path.resolve(dest).split(path.sep) - return srcArray.reduce((acc, current, i) => acc && destArray[i] === current, true) -} +isStream.readable = stream => + isStream(stream) && + stream.readable !== false && + typeof stream._read === 'function' && + typeof stream._readableState === 'object'; -function checkStats (src, dest, cb) { - fs.stat(src, (err, srcStat) => { - if (err) return cb(err) - fs.stat(dest, (err, destStat) => { - if (err) { - if (err.code === 'ENOENT') return cb(null, {srcStat, destStat: notExist}) - return cb(err) - } - return cb(null, {srcStat, destStat}) - }) - }) -} +isStream.duplex = stream => + isStream.writable(stream) && + isStream.readable(stream); -function checkPaths (src, dest, cb) { - checkStats(src, dest, (err, stats) => { - if (err) return cb(err) - const {srcStat, destStat} = stats - if (destStat.ino && destStat.ino === srcStat.ino) { - return cb(new Error('Source and destination must not be the same.')) - } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - return cb(new Error(`Cannot copy '${src}' to a subdirectory of itself, '${dest}'.`)) - } - return cb(null, destStat) - }) -} +isStream.transform = stream => + isStream.duplex(stream) && + typeof stream._transform === 'function'; -module.exports = copy +module.exports = isStream; /***/ }), -/***/ 80424: +/***/ 46390: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; +const betterPathResolve = __nccwpck_require__(88843) +const path = __nccwpck_require__(16928) -const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) -module.exports = { - copy: u(__nccwpck_require__(14027)) +function isSubdir (parentDir, subdir) { + const rParent = `${betterPathResolve(parentDir)}${path.sep}` + const rDir = `${betterPathResolve(subdir)}${path.sep}` + return rDir.startsWith(rParent) +} + +isSubdir.strict = function isSubdirStrict (parentDir, subdir) { + const rParent = `${betterPathResolve(parentDir)}${path.sep}` + const rDir = `${betterPathResolve(subdir)}${path.sep}` + return rDir !== rParent && rDir.startsWith(rParent) } +module.exports = isSubdir + + +/***/ }), + +/***/ 65196: +/***/ ((module, exports) => { + +/*! + * is-windows + * + * Copyright © 2015-2018, Jon Schlinkert. + * Released under the MIT License. + */ + +(function(factory) { + if (exports && typeof exports === 'object' && "object" !== 'undefined') { + module.exports = factory(); + } else if (typeof define === 'function' && define.amd) { + define([], factory); + } else if (typeof window !== 'undefined') { + window.isWindows = factory(); + } else if (typeof global !== 'undefined') { + global.isWindows = factory(); + } else if (typeof self !== 'undefined') { + self.isWindows = factory(); + } else { + this.isWindows = factory(); + } +})(function() { + 'use strict'; + return function isWindows() { + return process && (process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE)); + }; +}); + /***/ }), -/***/ 70198: +/***/ 49648: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -"use strict"; - - -const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) -const fs = __nccwpck_require__(79896) -const path = __nccwpck_require__(16928) -const mkdir = __nccwpck_require__(36813) -const remove = __nccwpck_require__(63073) - -const emptyDir = u(function emptyDir (dir, callback) { - callback = callback || function () {} - fs.readdir(dir, (err, items) => { - if (err) return mkdir.mkdirs(dir, callback) +var fs = __nccwpck_require__(79896) +var core +if (process.platform === 'win32' || global.TESTING_WINDOWS) { + core = __nccwpck_require__(73117) +} else { + core = __nccwpck_require__(98341) +} - items = items.map(item => path.join(dir, item)) +module.exports = isexe +isexe.sync = sync - deleteItem() +function isexe (path, options, cb) { + if (typeof options === 'function') { + cb = options + options = {} + } - function deleteItem () { - const item = items.pop() - if (!item) return callback() - remove.remove(item, err => { - if (err) return callback(err) - deleteItem() - }) + if (!cb) { + if (typeof Promise !== 'function') { + throw new TypeError('callback not provided') } - }) -}) -function emptyDirSync (dir) { - let items - try { - items = fs.readdirSync(dir) - } catch (err) { - return mkdir.mkdirsSync(dir) + return new Promise(function (resolve, reject) { + isexe(path, options || {}, function (er, is) { + if (er) { + reject(er) + } else { + resolve(is) + } + }) + }) } - items.forEach(item => { - item = path.join(dir, item) - remove.removeSync(item) + core(path, options || {}, function (er, is) { + // ignore EACCES because that just means we aren't allowed to run it + if (er) { + if (er.code === 'EACCES' || options && options.ignoreErrors) { + er = null + is = false + } + } + cb(er, is) }) } -module.exports = { - emptyDirSync, - emptydirSync: emptyDirSync, - emptyDir, - emptydir: emptyDir +function sync (path, options) { + // my kingdom for a filtered catch + try { + return core.sync(path, options || {}) + } catch (er) { + if (options && options.ignoreErrors || er.code === 'EACCES') { + return false + } else { + throw er + } + } } /***/ }), -/***/ 93693: +/***/ 98341: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -"use strict"; - - -const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) -const path = __nccwpck_require__(16928) -const fs = __nccwpck_require__(61404) -const mkdir = __nccwpck_require__(36813) -const pathExists = (__nccwpck_require__(26949).pathExists) +module.exports = isexe +isexe.sync = sync -function createFile (file, callback) { - function makeFile () { - fs.writeFile(file, '', err => { - if (err) return callback(err) - callback() - }) - } +var fs = __nccwpck_require__(79896) - fs.stat(file, (err, stats) => { // eslint-disable-line handle-callback-err - if (!err && stats.isFile()) return callback() - const dir = path.dirname(file) - pathExists(dir, (err, dirExists) => { - if (err) return callback(err) - if (dirExists) return makeFile() - mkdir.mkdirs(dir, err => { - if (err) return callback(err) - makeFile() - }) - }) +function isexe (path, options, cb) { + fs.stat(path, function (er, stat) { + cb(er, er ? false : checkStat(stat, options)) }) } -function createFileSync (file) { - let stats - try { - stats = fs.statSync(file) - } catch (e) {} - if (stats && stats.isFile()) return - - const dir = path.dirname(file) - if (!fs.existsSync(dir)) { - mkdir.mkdirsSync(dir) - } - - fs.writeFileSync(file, '') +function sync (path, options) { + return checkStat(fs.statSync(path), options) } -module.exports = { - createFile: u(createFile), - createFileSync +function checkStat (stat, options) { + return stat.isFile() && checkMode(stat, options) } +function checkMode (stat, options) { + var mod = stat.mode + var uid = stat.uid + var gid = stat.gid -/***/ }), - -/***/ 44895: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - -"use strict"; + var myUid = options.uid !== undefined ? + options.uid : process.getuid && process.getuid() + var myGid = options.gid !== undefined ? + options.gid : process.getgid && process.getgid() + var u = parseInt('100', 8) + var g = parseInt('010', 8) + var o = parseInt('001', 8) + var ug = u | g -const file = __nccwpck_require__(93693) -const link = __nccwpck_require__(1147) -const symlink = __nccwpck_require__(15788) + var ret = (mod & o) || + (mod & g) && gid === myGid || + (mod & u) && uid === myUid || + (mod & ug) && myUid === 0 -module.exports = { - // file - createFile: file.createFile, - createFileSync: file.createFileSync, - ensureFile: file.createFile, - ensureFileSync: file.createFileSync, - // link - createLink: link.createLink, - createLinkSync: link.createLinkSync, - ensureLink: link.createLink, - ensureLinkSync: link.createLinkSync, - // symlink - createSymlink: symlink.createSymlink, - createSymlinkSync: symlink.createSymlinkSync, - ensureSymlink: symlink.createSymlink, - ensureSymlinkSync: symlink.createSymlinkSync + return ret } /***/ }), -/***/ 1147: +/***/ 73117: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -"use strict"; +module.exports = isexe +isexe.sync = sync +var fs = __nccwpck_require__(79896) -const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) -const path = __nccwpck_require__(16928) -const fs = __nccwpck_require__(61404) -const mkdir = __nccwpck_require__(36813) -const pathExists = (__nccwpck_require__(26949).pathExists) +function checkPathExt (path, options) { + var pathext = options.pathExt !== undefined ? + options.pathExt : process.env.PATHEXT -function createLink (srcpath, dstpath, callback) { - function makeLink (srcpath, dstpath) { - fs.link(srcpath, dstpath, err => { - if (err) return callback(err) - callback(null) - }) + if (!pathext) { + return true } - pathExists(dstpath, (err, destinationExists) => { - if (err) return callback(err) - if (destinationExists) return callback(null) - fs.lstat(srcpath, (err) => { - if (err) { - err.message = err.message.replace('lstat', 'ensureLink') - return callback(err) - } - - const dir = path.dirname(dstpath) - pathExists(dir, (err, dirExists) => { - if (err) return callback(err) - if (dirExists) return makeLink(srcpath, dstpath) - mkdir.mkdirs(dir, err => { - if (err) return callback(err) - makeLink(srcpath, dstpath) - }) - }) - }) - }) -} - -function createLinkSync (srcpath, dstpath) { - const destinationExists = fs.existsSync(dstpath) - if (destinationExists) return undefined - - try { - fs.lstatSync(srcpath) - } catch (err) { - err.message = err.message.replace('lstat', 'ensureLink') - throw err + pathext = pathext.split(';') + if (pathext.indexOf('') !== -1) { + return true + } + for (var i = 0; i < pathext.length; i++) { + var p = pathext[i].toLowerCase() + if (p && path.substr(-p.length).toLowerCase() === p) { + return true + } } + return false +} - const dir = path.dirname(dstpath) - const dirExists = fs.existsSync(dir) - if (dirExists) return fs.linkSync(srcpath, dstpath) - mkdir.mkdirsSync(dir) +function checkStat (stat, path, options) { + if (!stat.isSymbolicLink() && !stat.isFile()) { + return false + } + return checkPathExt(path, options) +} - return fs.linkSync(srcpath, dstpath) +function isexe (path, options, cb) { + fs.stat(path, function (er, stat) { + cb(er, er ? false : checkStat(stat, path, options)) + }) } -module.exports = { - createLink: u(createLink), - createLinkSync +function sync (path, options) { + return checkStat(fs.statSync(path), path, options) } /***/ }), -/***/ 59933: +/***/ 30677: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -const path = __nccwpck_require__(16928) -const fs = __nccwpck_require__(61404) -const pathExists = (__nccwpck_require__(26949).pathExists) -/** - * Function that returns two types of paths, one relative to symlink, and one - * relative to the current working directory. Checks if path is absolute or - * relative. If the path is relative, this function checks if the path is - * relative to symlink or relative to current working directory. This is an - * initiative to find a smarter `srcpath` to supply when building symlinks. - * This allows you to determine which path to use out of one of three possible - * types of source paths. The first is an absolute path. This is detected by - * `path.isAbsolute()`. When an absolute path is provided, it is checked to - * see if it exists. If it does it's used, if not an error is returned - * (callback)/ thrown (sync). The other two options for `srcpath` are a - * relative url. By default Node's `fs.symlink` works by creating a symlink - * using `dstpath` and expects the `srcpath` to be relative to the newly - * created symlink. If you provide a `srcpath` that does not exist on the file - * system it results in a broken symlink. To minimize this, the function - * checks to see if the 'relative to symlink' source file exists, and if it - * does it will use it. If it does not, it checks if there's a file that - * exists that is relative to the current working directory, if does its used. - * This preserves the expectations of the original fs.symlink spec and adds - * the ability to pass in `relative to current working direcotry` paths. - */ +var loader = __nccwpck_require__(50586); +var dumper = __nccwpck_require__(46904); -function symlinkPaths (srcpath, dstpath, callback) { - if (path.isAbsolute(srcpath)) { - return fs.lstat(srcpath, (err) => { - if (err) { - err.message = err.message.replace('lstat', 'ensureSymlink') - return callback(err) - } - return callback(null, { - 'toCwd': srcpath, - 'toDst': srcpath - }) - }) - } else { - const dstdir = path.dirname(dstpath) - const relativeToDst = path.join(dstdir, srcpath) - return pathExists(relativeToDst, (err, exists) => { - if (err) return callback(err) - if (exists) { - return callback(null, { - 'toCwd': relativeToDst, - 'toDst': srcpath - }) - } else { - return fs.lstat(srcpath, (err) => { - if (err) { - err.message = err.message.replace('lstat', 'ensureSymlink') - return callback(err) - } - return callback(null, { - 'toCwd': srcpath, - 'toDst': path.relative(dstdir, srcpath) - }) - }) - } - }) - } -} -function symlinkPathsSync (srcpath, dstpath) { - let exists - if (path.isAbsolute(srcpath)) { - 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) - } - } - } +function renamed(from, to) { + return function () { + throw new Error('Function yaml.' + from + ' is removed in js-yaml 4. ' + + 'Use yaml.' + to + ' instead, which is now safe by default.'); + }; } -module.exports = { - symlinkPaths, - symlinkPathsSync -} + +module.exports.Type = __nccwpck_require__(1089); +module.exports.Schema = __nccwpck_require__(59610); +module.exports.FAILSAFE_SCHEMA = __nccwpck_require__(82420); +module.exports.JSON_SCHEMA = __nccwpck_require__(98971); +module.exports.CORE_SCHEMA = __nccwpck_require__(52254); +module.exports.DEFAULT_SCHEMA = __nccwpck_require__(7436); +module.exports.load = loader.load; +module.exports.loadAll = loader.loadAll; +module.exports.dump = dumper.dump; +module.exports.YAMLException = __nccwpck_require__(2828); + +// Re-export all types in case user wants to create custom schema +module.exports.types = { + binary: __nccwpck_require__(1113), + float: __nccwpck_require__(83492), + map: __nccwpck_require__(88432), + null: __nccwpck_require__(77177), + pairs: __nccwpck_require__(33884), + set: __nccwpck_require__(25098), + timestamp: __nccwpck_require__(35298), + bool: __nccwpck_require__(97300), + int: __nccwpck_require__(99491), + merge: __nccwpck_require__(70954), + omap: __nccwpck_require__(28677), + seq: __nccwpck_require__(43733), + str: __nccwpck_require__(41845) +}; + +// Removed functions from JS-YAML 3.0.x +module.exports.safeLoad = renamed('safeLoad', 'load'); +module.exports.safeLoadAll = renamed('safeLoadAll', 'loadAll'); +module.exports.safeDump = renamed('safeDump', 'dump'); /***/ }), -/***/ 17489: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/***/ 23324: +/***/ ((module) => { "use strict"; -const fs = __nccwpck_require__(61404) -function symlinkType (srcpath, type, callback) { - callback = (typeof type === 'function') ? type : callback - type = (typeof type === 'function') ? false : type - if (type) return callback(null, type) - fs.lstat(srcpath, (err, stats) => { - if (err) return callback(null, 'file') - type = (stats && stats.isDirectory()) ? 'dir' : 'file' - callback(null, type) - }) +function isNothing(subject) { + return (typeof subject === 'undefined') || (subject === null); } -function symlinkTypeSync (srcpath, type) { - let stats - if (type) return type - try { - stats = fs.lstatSync(srcpath) - } catch (e) { - return 'file' - } - return (stats && stats.isDirectory()) ? 'dir' : 'file' +function isObject(subject) { + return (typeof subject === 'object') && (subject !== null); } -module.exports = { - symlinkType, - symlinkTypeSync + +function toArray(sequence) { + if (Array.isArray(sequence)) return sequence; + else if (isNothing(sequence)) return []; + + return [ sequence ]; } -/***/ }), +function extend(target, source) { + var index, length, key, sourceKeys; -/***/ 15788: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + if (source) { + sourceKeys = Object.keys(source); -"use strict"; + for (index = 0, length = sourceKeys.length; index < length; index += 1) { + key = sourceKeys[index]; + target[key] = source[key]; + } + } + return target; +} -const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) -const path = __nccwpck_require__(16928) -const fs = __nccwpck_require__(61404) -const _mkdirs = __nccwpck_require__(36813) -const mkdirs = _mkdirs.mkdirs -const mkdirsSync = _mkdirs.mkdirsSync -const _symlinkPaths = __nccwpck_require__(59933) -const symlinkPaths = _symlinkPaths.symlinkPaths -const symlinkPathsSync = _symlinkPaths.symlinkPathsSync +function repeat(string, count) { + var result = '', cycle; -const _symlinkType = __nccwpck_require__(17489) -const symlinkType = _symlinkType.symlinkType -const symlinkTypeSync = _symlinkType.symlinkTypeSync + for (cycle = 0; cycle < count; cycle += 1) { + result += string; + } -const pathExists = (__nccwpck_require__(26949).pathExists) + return result; +} -function createSymlink (srcpath, dstpath, type, callback) { - callback = (typeof type === 'function') ? type : callback - type = (typeof type === 'function') ? false : type - pathExists(dstpath, (err, destinationExists) => { - if (err) return callback(err) - if (destinationExists) return callback(null) - symlinkPaths(srcpath, dstpath, (err, relative) => { - if (err) return callback(err) - srcpath = relative.toDst - symlinkType(relative.toCwd, type, (err, type) => { - if (err) return callback(err) - const dir = path.dirname(dstpath) - pathExists(dir, (err, dirExists) => { - if (err) return callback(err) - if (dirExists) return fs.symlink(srcpath, dstpath, type, callback) - mkdirs(dir, err => { - if (err) return callback(err) - fs.symlink(srcpath, dstpath, type, callback) - }) - }) - }) - }) - }) +function isNegativeZero(number) { + return (number === 0) && (Number.NEGATIVE_INFINITY === 1 / number); } -function createSymlinkSync (srcpath, dstpath, type) { - const destinationExists = fs.existsSync(dstpath) - if (destinationExists) return undefined - const relative = symlinkPathsSync(srcpath, dstpath) - srcpath = relative.toDst - type = symlinkTypeSync(relative.toCwd, type) - const dir = path.dirname(dstpath) - const exists = fs.existsSync(dir) - if (exists) return fs.symlinkSync(srcpath, dstpath, type) - mkdirsSync(dir) - return fs.symlinkSync(srcpath, dstpath, type) -} +module.exports.isNothing = isNothing; +module.exports.isObject = isObject; +module.exports.toArray = toArray; +module.exports.repeat = repeat; +module.exports.isNegativeZero = isNegativeZero; +module.exports.extend = extend; + + +/***/ }), + +/***/ 46904: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +/*eslint-disable no-use-before-define*/ + +var common = __nccwpck_require__(23324); +var YAMLException = __nccwpck_require__(2828); +var DEFAULT_SCHEMA = __nccwpck_require__(7436); + +var _toString = Object.prototype.toString; +var _hasOwnProperty = Object.prototype.hasOwnProperty; + +var CHAR_BOM = 0xFEFF; +var CHAR_TAB = 0x09; /* Tab */ +var CHAR_LINE_FEED = 0x0A; /* LF */ +var CHAR_CARRIAGE_RETURN = 0x0D; /* CR */ +var CHAR_SPACE = 0x20; /* Space */ +var CHAR_EXCLAMATION = 0x21; /* ! */ +var CHAR_DOUBLE_QUOTE = 0x22; /* " */ +var CHAR_SHARP = 0x23; /* # */ +var CHAR_PERCENT = 0x25; /* % */ +var CHAR_AMPERSAND = 0x26; /* & */ +var CHAR_SINGLE_QUOTE = 0x27; /* ' */ +var CHAR_ASTERISK = 0x2A; /* * */ +var CHAR_COMMA = 0x2C; /* , */ +var CHAR_MINUS = 0x2D; /* - */ +var CHAR_COLON = 0x3A; /* : */ +var CHAR_EQUALS = 0x3D; /* = */ +var CHAR_GREATER_THAN = 0x3E; /* > */ +var CHAR_QUESTION = 0x3F; /* ? */ +var CHAR_COMMERCIAL_AT = 0x40; /* @ */ +var CHAR_LEFT_SQUARE_BRACKET = 0x5B; /* [ */ +var CHAR_RIGHT_SQUARE_BRACKET = 0x5D; /* ] */ +var CHAR_GRAVE_ACCENT = 0x60; /* ` */ +var CHAR_LEFT_CURLY_BRACKET = 0x7B; /* { */ +var CHAR_VERTICAL_LINE = 0x7C; /* | */ +var CHAR_RIGHT_CURLY_BRACKET = 0x7D; /* } */ + +var ESCAPE_SEQUENCES = {}; -module.exports = { - createSymlink: u(createSymlink), - createSymlinkSync -} +ESCAPE_SEQUENCES[0x00] = '\\0'; +ESCAPE_SEQUENCES[0x07] = '\\a'; +ESCAPE_SEQUENCES[0x08] = '\\b'; +ESCAPE_SEQUENCES[0x09] = '\\t'; +ESCAPE_SEQUENCES[0x0A] = '\\n'; +ESCAPE_SEQUENCES[0x0B] = '\\v'; +ESCAPE_SEQUENCES[0x0C] = '\\f'; +ESCAPE_SEQUENCES[0x0D] = '\\r'; +ESCAPE_SEQUENCES[0x1B] = '\\e'; +ESCAPE_SEQUENCES[0x22] = '\\"'; +ESCAPE_SEQUENCES[0x5C] = '\\\\'; +ESCAPE_SEQUENCES[0x85] = '\\N'; +ESCAPE_SEQUENCES[0xA0] = '\\_'; +ESCAPE_SEQUENCES[0x2028] = '\\L'; +ESCAPE_SEQUENCES[0x2029] = '\\P'; +var DEPRECATED_BOOLEANS_SYNTAX = [ + 'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON', + 'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF' +]; -/***/ }), +var DEPRECATED_BASE60_SYNTAX = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/; -/***/ 9238: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +function compileStyleMap(schema, map) { + var result, keys, index, length, tag, style, type; -"use strict"; + if (map === null) return {}; -// This is adapted from https://github.com/normalize/mz -// Copyright (c) 2014-2016 Jonathan Ong me@jongleberry.com and Contributors -const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) -const fs = __nccwpck_require__(61404) + result = {}; + keys = Object.keys(map); -const api = [ - 'access', - 'appendFile', - 'chmod', - 'chown', - 'close', - 'copyFile', - 'fchmod', - 'fchown', - 'fdatasync', - 'fstat', - 'fsync', - 'ftruncate', - 'futimes', - 'lchown', - 'lchmod', - 'link', - 'lstat', - 'mkdir', - 'mkdtemp', - 'open', - 'readFile', - 'readdir', - 'readlink', - 'realpath', - 'rename', - 'rmdir', - 'stat', - 'symlink', - 'truncate', - 'unlink', - 'utimes', - 'writeFile' -].filter(key => { - // Some commands are not available on some systems. Ex: - // fs.copyFile was added in Node.js v8.5.0 - // fs.mkdtemp was added in Node.js v5.10.0 - // fs.lchown is not available on at least some Linux - return typeof fs[key] === 'function' -}) + for (index = 0, length = keys.length; index < length; index += 1) { + tag = keys[index]; + style = String(map[tag]); -// Export all keys: -Object.keys(fs).forEach(key => { - if (key === 'promises') { - // fs.promises is a getter property that triggers ExperimentalWarning - // Don't re-export it here, the getter is defined in "lib/index.js" - return - } - exports[key] = fs[key] -}) + if (tag.slice(0, 2) === '!!') { + tag = 'tag:yaml.org,2002:' + tag.slice(2); + } + type = schema.compiledTypeMap['fallback'][tag]; -// Universalify async methods: -api.forEach(method => { - exports[method] = u(fs[method]) -}) + if (type && _hasOwnProperty.call(type.styleAliases, style)) { + style = type.styleAliases[style]; + } -// We differ from mz/fs in that we still ship the old, broken, fs.exists() -// since we are a drop-in replacement for the native module -exports.exists = function (filename, callback) { - if (typeof callback === 'function') { - return fs.exists(filename, callback) + result[tag] = style; } - return new Promise(resolve => { - return fs.exists(filename, resolve) - }) + + return result; } -// fs.read() & fs.write need special treatment due to multiple callback args +function encodeHex(character) { + var string, handle, length; -exports.read = function (fd, buffer, offset, length, position, callback) { - if (typeof callback === 'function') { - return fs.read(fd, buffer, offset, length, position, callback) - } - return new Promise((resolve, reject) => { - fs.read(fd, buffer, offset, length, position, (err, bytesRead, buffer) => { - if (err) return reject(err) - resolve({ bytesRead, buffer }) - }) - }) -} + string = character.toString(16).toUpperCase(); -// Function signature can be -// fs.write(fd, buffer[, offset[, length[, position]]], callback) -// OR -// fs.write(fd, string[, position[, encoding]], callback) -// We need to handle both cases, so we use ...args -exports.write = function (fd, buffer, ...args) { - if (typeof args[args.length - 1] === 'function') { - return fs.write(fd, buffer, ...args) + if (character <= 0xFF) { + handle = 'x'; + length = 2; + } else if (character <= 0xFFFF) { + handle = 'u'; + length = 4; + } else if (character <= 0xFFFFFFFF) { + handle = 'U'; + length = 8; + } else { + throw new YAMLException('code point within a string may not be greater than 0xFFFFFFFF'); } - return new Promise((resolve, reject) => { - fs.write(fd, buffer, ...args, (err, bytesWritten, buffer) => { - if (err) return reject(err) - resolve({ bytesWritten, buffer }) - }) - }) + return '\\' + handle + common.repeat('0', length - string.length) + string; } -/***/ }), - -/***/ 41348: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +var QUOTING_TYPE_SINGLE = 1, + QUOTING_TYPE_DOUBLE = 2; -"use strict"; +function State(options) { + this.schema = options['schema'] || DEFAULT_SCHEMA; + this.indent = Math.max(1, (options['indent'] || 2)); + this.noArrayIndent = options['noArrayIndent'] || false; + this.skipInvalid = options['skipInvalid'] || false; + this.flowLevel = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']); + this.styleMap = compileStyleMap(this.schema, options['styles'] || null); + this.sortKeys = options['sortKeys'] || false; + this.lineWidth = options['lineWidth'] || 80; + this.noRefs = options['noRefs'] || false; + this.noCompatMode = options['noCompatMode'] || false; + this.condenseFlow = options['condenseFlow'] || false; + this.quotingType = options['quotingType'] === '"' ? QUOTING_TYPE_DOUBLE : QUOTING_TYPE_SINGLE; + this.forceQuotes = options['forceQuotes'] || false; + this.replacer = typeof options['replacer'] === 'function' ? options['replacer'] : null; + this.implicitTypes = this.schema.compiledImplicit; + this.explicitTypes = this.schema.compiledExplicit; -module.exports = Object.assign( - {}, - // Export promiseified graceful-fs: - __nccwpck_require__(9238), - // Export extra methods: - __nccwpck_require__(32864), - __nccwpck_require__(80424), - __nccwpck_require__(70198), - __nccwpck_require__(44895), - __nccwpck_require__(25219), - __nccwpck_require__(36813), - __nccwpck_require__(57744), - __nccwpck_require__(95256), - __nccwpck_require__(14552), - __nccwpck_require__(26949), - __nccwpck_require__(63073) -) + this.tag = null; + this.result = ''; -// Export fs.promises as a getter property so that we don't trigger -// ExperimentalWarning before fs.promises is actually accessed. -const fs = __nccwpck_require__(79896) -if (Object.getOwnPropertyDescriptor(fs, 'promises')) { - Object.defineProperty(module.exports, "promises", ({ - get () { return fs.promises } - })) + this.duplicates = []; + this.usedDuplicates = null; } +// Indents every line in a string. Empty lines (\n only) are not indented. +function indentString(string, spaces) { + var ind = common.repeat(' ', spaces), + position = 0, + next = -1, + result = '', + line, + length = string.length; -/***/ }), - -/***/ 25219: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + while (position < length) { + next = string.indexOf('\n', position); + if (next === -1) { + line = string.slice(position); + position = length; + } else { + line = string.slice(position, next + 1); + position = next + 1; + } -"use strict"; + if (line.length && line !== '\n') result += ind; + result += line; + } -const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) -const jsonFile = __nccwpck_require__(81891) + return result; +} -jsonFile.outputJson = u(__nccwpck_require__(7597)) -jsonFile.outputJsonSync = __nccwpck_require__(56917) -// aliases -jsonFile.outputJSON = jsonFile.outputJson -jsonFile.outputJSONSync = jsonFile.outputJsonSync -jsonFile.writeJSON = jsonFile.writeJson -jsonFile.writeJSONSync = jsonFile.writeJsonSync -jsonFile.readJSON = jsonFile.readJson -jsonFile.readJSONSync = jsonFile.readJsonSync +function generateNextLine(state, level) { + return '\n' + common.repeat(' ', state.indent * level); +} -module.exports = jsonFile +function testImplicitResolving(state, str) { + var index, length, type; + for (index = 0, length = state.implicitTypes.length; index < length; index += 1) { + type = state.implicitTypes[index]; -/***/ }), + if (type.resolve(str)) { + return true; + } + } -/***/ 81891: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + return false; +} -"use strict"; +// [33] s-white ::= s-space | s-tab +function isWhitespace(c) { + return c === CHAR_SPACE || c === CHAR_TAB; +} +// Returns true if the character can be printed without escaping. +// From YAML 1.2: "any allowed characters known to be non-printable +// should also be escaped. [However,] This isn’t mandatory" +// Derived from nb-char - \t - #x85 - #xA0 - #x2028 - #x2029. +function isPrintable(c) { + return (0x00020 <= c && c <= 0x00007E) + || ((0x000A1 <= c && c <= 0x00D7FF) && c !== 0x2028 && c !== 0x2029) + || ((0x0E000 <= c && c <= 0x00FFFD) && c !== CHAR_BOM) + || (0x10000 <= c && c <= 0x10FFFF); +} -const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) -const jsonFile = __nccwpck_require__(93588) +// [34] ns-char ::= nb-char - s-white +// [27] nb-char ::= c-printable - b-char - c-byte-order-mark +// [26] b-char ::= b-line-feed | b-carriage-return +// Including s-white (for some reason, examples doesn't match specs in this aspect) +// ns-char ::= c-printable - b-line-feed - b-carriage-return - c-byte-order-mark +function isNsCharOrWhitespace(c) { + return isPrintable(c) + && c !== CHAR_BOM + // - b-char + && c !== CHAR_CARRIAGE_RETURN + && c !== CHAR_LINE_FEED; +} -module.exports = { - // jsonfile exports - readJson: u(jsonFile.readFile), - readJsonSync: jsonFile.readFileSync, - writeJson: u(jsonFile.writeFile), - writeJsonSync: jsonFile.writeFileSync +// [127] ns-plain-safe(c) ::= c = flow-out ⇒ ns-plain-safe-out +// c = flow-in ⇒ ns-plain-safe-in +// c = block-key ⇒ ns-plain-safe-out +// c = flow-key ⇒ ns-plain-safe-in +// [128] ns-plain-safe-out ::= ns-char +// [129] ns-plain-safe-in ::= ns-char - c-flow-indicator +// [130] ns-plain-char(c) ::= ( ns-plain-safe(c) - “:” - “#” ) +// | ( /* An ns-char preceding */ “#” ) +// | ( “:” /* Followed by an ns-plain-safe(c) */ ) +function isPlainSafe(c, prev, inblock) { + var cIsNsCharOrWhitespace = isNsCharOrWhitespace(c); + var cIsNsChar = cIsNsCharOrWhitespace && !isWhitespace(c); + return ( + // ns-plain-safe + inblock ? // c = flow-in + cIsNsCharOrWhitespace + : cIsNsCharOrWhitespace + // - c-flow-indicator + && c !== CHAR_COMMA + && c !== CHAR_LEFT_SQUARE_BRACKET + && c !== CHAR_RIGHT_SQUARE_BRACKET + && c !== CHAR_LEFT_CURLY_BRACKET + && c !== CHAR_RIGHT_CURLY_BRACKET + ) + // ns-plain-char + && c !== CHAR_SHARP // false on '#' + && !(prev === CHAR_COLON && !cIsNsChar) // false on ': ' + || (isNsCharOrWhitespace(prev) && !isWhitespace(prev) && c === CHAR_SHARP) // change to true on '[^ ]#' + || (prev === CHAR_COLON && cIsNsChar); // change to true on ':[^ ]' } +// Simplified test for values allowed as the first character in plain style. +function isPlainSafeFirst(c) { + // Uses a subset of ns-char - c-indicator + // where ns-char = nb-char - s-white. + // No support of ( ( “?” | “:” | “-” ) /* Followed by an ns-plain-safe(c)) */ ) part + return isPrintable(c) && c !== CHAR_BOM + && !isWhitespace(c) // - s-white + // - (c-indicator ::= + // “-” | “?” | “:” | “,” | “[” | “]” | “{” | “}” + && c !== CHAR_MINUS + && c !== CHAR_QUESTION + && c !== CHAR_COLON + && c !== CHAR_COMMA + && c !== CHAR_LEFT_SQUARE_BRACKET + && c !== CHAR_RIGHT_SQUARE_BRACKET + && c !== CHAR_LEFT_CURLY_BRACKET + && c !== CHAR_RIGHT_CURLY_BRACKET + // | “#” | “&” | “*” | “!” | “|” | “=” | “>” | “'” | “"” + && c !== CHAR_SHARP + && c !== CHAR_AMPERSAND + && c !== CHAR_ASTERISK + && c !== CHAR_EXCLAMATION + && c !== CHAR_VERTICAL_LINE + && c !== CHAR_EQUALS + && c !== CHAR_GREATER_THAN + && c !== CHAR_SINGLE_QUOTE + && c !== CHAR_DOUBLE_QUOTE + // | “%” | “@” | “`”) + && c !== CHAR_PERCENT + && c !== CHAR_COMMERCIAL_AT + && c !== CHAR_GRAVE_ACCENT; +} -/***/ }), +// Simplified test for values allowed as the last character in plain style. +function isPlainSafeLast(c) { + // just not whitespace or colon, it will be checked to be plain character later + return !isWhitespace(c) && c !== CHAR_COLON; +} -/***/ 56917: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +// Same as 'string'.codePointAt(pos), but works in older browsers. +function codePointAt(string, pos) { + var first = string.charCodeAt(pos), second; + if (first >= 0xD800 && first <= 0xDBFF && pos + 1 < string.length) { + second = string.charCodeAt(pos + 1); + if (second >= 0xDC00 && second <= 0xDFFF) { + // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae + return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000; + } + } + return first; +} -"use strict"; +// Determines whether block indentation indicator is required. +function needIndentIndicator(string) { + var leadingSpaceRe = /^\n* /; + return leadingSpaceRe.test(string); +} +var STYLE_PLAIN = 1, + STYLE_SINGLE = 2, + STYLE_LITERAL = 3, + STYLE_FOLDED = 4, + STYLE_DOUBLE = 5; -const fs = __nccwpck_require__(61404) -const path = __nccwpck_require__(16928) -const mkdir = __nccwpck_require__(36813) -const jsonFile = __nccwpck_require__(81891) +// Determines which scalar styles are possible and returns the preferred style. +// lineWidth = -1 => no limit. +// Pre-conditions: str.length > 0. +// Post-conditions: +// STYLE_PLAIN or STYLE_SINGLE => no \n are in the string. +// STYLE_LITERAL => no lines are suitable for folding (or lineWidth is -1). +// STYLE_FOLDED => a line > lineWidth and can be folded (and lineWidth != -1). +function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, + testAmbiguousType, quotingType, forceQuotes, inblock) { -function outputJsonSync (file, data, options) { - const dir = path.dirname(file) + var i; + var char = 0; + var prevChar = null; + var hasLineBreak = false; + var hasFoldableLine = false; // only checked if shouldTrackWidth + var shouldTrackWidth = lineWidth !== -1; + var previousLineBreak = -1; // count the first line correctly + var plain = isPlainSafeFirst(codePointAt(string, 0)) + && isPlainSafeLast(codePointAt(string, string.length - 1)); - if (!fs.existsSync(dir)) { - mkdir.mkdirsSync(dir) + if (singleLineOnly || forceQuotes) { + // Case: no block styles. + // Check for disallowed characters to rule out plain and single. + for (i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) { + char = codePointAt(string, i); + if (!isPrintable(char)) { + return STYLE_DOUBLE; + } + plain = plain && isPlainSafe(char, prevChar, inblock); + prevChar = char; + } + } else { + // Case: block styles permitted. + for (i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) { + char = codePointAt(string, i); + if (char === CHAR_LINE_FEED) { + hasLineBreak = true; + // Check if any line can be folded. + if (shouldTrackWidth) { + hasFoldableLine = hasFoldableLine || + // Foldable line = too long, and not more-indented. + (i - previousLineBreak - 1 > lineWidth && + string[previousLineBreak + 1] !== ' '); + previousLineBreak = i; + } + } else if (!isPrintable(char)) { + return STYLE_DOUBLE; + } + plain = plain && isPlainSafe(char, prevChar, inblock); + prevChar = char; + } + // in case the end is missing a \n + hasFoldableLine = hasFoldableLine || (shouldTrackWidth && + (i - previousLineBreak - 1 > lineWidth && + string[previousLineBreak + 1] !== ' ')); } - - jsonFile.writeJsonSync(file, data, options) + // Although every style can represent \n without escaping, prefer block styles + // for multiline, since they're more readable and they don't add empty lines. + // Also prefer folding a super-long line. + if (!hasLineBreak && !hasFoldableLine) { + // Strings interpretable as another type have to be quoted; + // e.g. the string 'true' vs. the boolean true. + if (plain && !forceQuotes && !testAmbiguousType(string)) { + return STYLE_PLAIN; + } + return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE; + } + // Edge case: block indentation indicator can only have one digit. + if (indentPerLevel > 9 && needIndentIndicator(string)) { + return STYLE_DOUBLE; + } + // At this point we know block styles are valid. + // Prefer literal style unless we want to fold. + if (!forceQuotes) { + return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL; + } + return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE; } -module.exports = outputJsonSync +// Note: line breaking/folding is implemented for only the folded style. +// NB. We drop the last trailing newline (if any) of a returned block scalar +// since the dumper adds its own newline. This always works: +// • No ending newline => unaffected; already using strip "-" chomping. +// • Ending newline => removed then restored. +// Importantly, this keeps the "+" chomp indicator from gaining an extra line. +function writeScalar(state, string, level, iskey, inblock) { + state.dump = (function () { + if (string.length === 0) { + return state.quotingType === QUOTING_TYPE_DOUBLE ? '""' : "''"; + } + if (!state.noCompatMode) { + if (DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1 || DEPRECATED_BASE60_SYNTAX.test(string)) { + return state.quotingType === QUOTING_TYPE_DOUBLE ? ('"' + string + '"') : ("'" + string + "'"); + } + } + var indent = state.indent * Math.max(1, level); // no 0-indent scalars + // As indentation gets deeper, let the width decrease monotonically + // to the lower bound min(state.lineWidth, 40). + // Note that this implies + // state.lineWidth ≤ 40 + state.indent: width is fixed at the lower bound. + // state.lineWidth > 40 + state.indent: width decreases until the lower bound. + // This behaves better than a constant minimum width which disallows narrower options, + // or an indent threshold which causes the width to suddenly increase. + var lineWidth = state.lineWidth === -1 + ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent); -/***/ }), + // Without knowing if keys are implicit/explicit, assume implicit for safety. + var singleLineOnly = iskey + // No block styles in flow mode. + || (state.flowLevel > -1 && level >= state.flowLevel); + function testAmbiguity(string) { + return testImplicitResolving(state, string); + } -/***/ 7597: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth, + testAmbiguity, state.quotingType, state.forceQuotes && !iskey, inblock)) { -"use strict"; + case STYLE_PLAIN: + return string; + case STYLE_SINGLE: + return "'" + string.replace(/'/g, "''") + "'"; + case STYLE_LITERAL: + return '|' + blockHeader(string, state.indent) + + dropEndingNewline(indentString(string, indent)); + case STYLE_FOLDED: + return '>' + blockHeader(string, state.indent) + + dropEndingNewline(indentString(foldString(string, lineWidth), indent)); + case STYLE_DOUBLE: + return '"' + escapeString(string, lineWidth) + '"'; + default: + throw new YAMLException('impossible error: invalid scalar style'); + } + }()); +} +// Pre-conditions: string is valid for a block scalar, 1 <= indentPerLevel <= 9. +function blockHeader(string, indentPerLevel) { + var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : ''; -const path = __nccwpck_require__(16928) -const mkdir = __nccwpck_require__(36813) -const pathExists = (__nccwpck_require__(26949).pathExists) -const jsonFile = __nccwpck_require__(81891) + // note the special case: the string '\n' counts as a "trailing" empty line. + var clip = string[string.length - 1] === '\n'; + var keep = clip && (string[string.length - 2] === '\n' || string === '\n'); + var chomp = keep ? '+' : (clip ? '' : '-'); -function outputJson (file, data, options, callback) { - if (typeof options === 'function') { - callback = options - options = {} + return indentIndicator + chomp + '\n'; +} + +// (See the note for writeScalar.) +function dropEndingNewline(string) { + return string[string.length - 1] === '\n' ? string.slice(0, -1) : string; +} + +// Note: a long line without a suitable break point will exceed the width limit. +// Pre-conditions: every char in str isPrintable, str.length > 0, width > 0. +function foldString(string, width) { + // In folded style, $k$ consecutive newlines output as $k+1$ newlines— + // unless they're before or after a more-indented line, or at the very + // beginning or end, in which case $k$ maps to $k$. + // Therefore, parse each chunk as newline(s) followed by a content line. + var lineRe = /(\n+)([^\n]*)/g; + + // first line (possibly an empty line) + var result = (function () { + var nextLF = string.indexOf('\n'); + nextLF = nextLF !== -1 ? nextLF : string.length; + lineRe.lastIndex = nextLF; + return foldLine(string.slice(0, nextLF), width); + }()); + // If we haven't reached the first content line yet, don't add an extra \n. + var prevMoreIndented = string[0] === '\n' || string[0] === ' '; + var moreIndented; + + // rest of the lines + var match; + while ((match = lineRe.exec(string))) { + var prefix = match[1], line = match[2]; + moreIndented = (line[0] === ' '); + result += prefix + + (!prevMoreIndented && !moreIndented && line !== '' + ? '\n' : '') + + foldLine(line, width); + prevMoreIndented = moreIndented; } - const dir = path.dirname(file) + return result; +} - pathExists(dir, (err, itDoes) => { - if (err) return callback(err) - if (itDoes) return jsonFile.writeJson(file, data, options, callback) +// Greedy line breaking. +// Picks the longest line under the limit each time, +// otherwise settles for the shortest line over the limit. +// NB. More-indented lines *cannot* be folded, as that would add an extra \n. +function foldLine(line, width) { + if (line === '' || line[0] === ' ') return line; - mkdir.mkdirs(dir, err => { - if (err) return callback(err) - jsonFile.writeJson(file, data, options, callback) - }) - }) -} + // Since a more-indented line adds a \n, breaks can't be followed by a space. + var breakRe = / [^ ]/g; // note: the match index will always be <= length-2. + var match; + // start is an inclusive index. end, curr, and next are exclusive. + var start = 0, end, curr = 0, next = 0; + var result = ''; -module.exports = outputJson + // Invariants: 0 <= start <= length-1. + // 0 <= curr <= next <= max(0, length-2). curr - start <= width. + // Inside the loop: + // A match implies length >= 2, so curr and next are <= length-2. + while ((match = breakRe.exec(line))) { + next = match.index; + // maintain invariant: curr - start <= width + if (next - start > width) { + end = (curr > start) ? curr : next; // derive end <= length-2 + result += '\n' + line.slice(start, end); + // skip the space that was output as \n + start = end + 1; // derive start <= length-1 + } + curr = next; + } + // By the invariants, start <= length-1, so there is something left over. + // It is either the whole string or a part starting from non-whitespace. + result += '\n'; + // Insert a break if the remainder is too long and there is a break available. + if (line.length - start > width && curr > start) { + result += line.slice(start, curr) + '\n' + line.slice(curr + 1); + } else { + result += line.slice(start); + } -/***/ }), + return result.slice(1); // drop extra \n joiner +} -/***/ 36813: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +// Escapes a double-quoted string. +function escapeString(string) { + var result = ''; + var char = 0; + var escapeSeq; -"use strict"; + for (var i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) { + char = codePointAt(string, i); + escapeSeq = ESCAPE_SEQUENCES[char]; -const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) -const mkdirs = u(__nccwpck_require__(71781)) -const mkdirsSync = __nccwpck_require__(28173) + if (!escapeSeq && isPrintable(char)) { + result += string[i]; + if (char >= 0x10000) result += string[i + 1]; + } else { + result += escapeSeq || encodeHex(char); + } + } -module.exports = { - mkdirs, - mkdirsSync, - // alias - mkdirp: mkdirs, - mkdirpSync: mkdirsSync, - ensureDir: mkdirs, - ensureDirSync: mkdirsSync + return result; } +function writeFlowSequence(state, level, object) { + var _result = '', + _tag = state.tag, + index, + length, + value; -/***/ }), - -/***/ 28173: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + for (index = 0, length = object.length; index < length; index += 1) { + value = object[index]; -"use strict"; + if (state.replacer) { + value = state.replacer.call(object, String(index), value); + } + // Write only valid elements, put null instead of invalid elements. + if (writeNode(state, level, value, false, false) || + (typeof value === 'undefined' && + writeNode(state, level, null, false, false))) { -const fs = __nccwpck_require__(61404) -const path = __nccwpck_require__(16928) -const invalidWin32Path = (__nccwpck_require__(38882).invalidWin32Path) + if (_result !== '') _result += ',' + (!state.condenseFlow ? ' ' : ''); + _result += state.dump; + } + } -const o777 = parseInt('0777', 8) + state.tag = _tag; + state.dump = '[' + _result + ']'; +} -function mkdirsSync (p, opts, made) { - if (!opts || typeof opts !== 'object') { - opts = { mode: opts } - } +function writeBlockSequence(state, level, object, compact) { + var _result = '', + _tag = state.tag, + index, + length, + value; - let mode = opts.mode - const xfs = opts.fs || fs + for (index = 0, length = object.length; index < length; index += 1) { + value = object[index]; - if (process.platform === 'win32' && invalidWin32Path(p)) { - const errInval = new Error(p + ' contains invalid WIN32 path characters.') - errInval.code = 'EINVAL' - throw errInval - } + if (state.replacer) { + value = state.replacer.call(object, String(index), value); + } - if (mode === undefined) { - mode = o777 & (~process.umask()) - } - if (!made) made = null + // Write only valid elements, put null instead of invalid elements. + if (writeNode(state, level + 1, value, true, true, false, true) || + (typeof value === 'undefined' && + writeNode(state, level + 1, null, true, true, false, true))) { - p = path.resolve(p) + if (!compact || _result !== '') { + _result += generateNextLine(state, level); + } - try { - xfs.mkdirSync(p, mode) - made = made || p - } catch (err0) { - if (err0.code === 'ENOENT') { - if (path.dirname(p) === p) throw err0 - made = mkdirsSync(path.dirname(p), opts, made) - mkdirsSync(p, opts, made) - } else { - // In the case of any other error, just see if there's a dir there - // already. If so, then hooray! If not, then something is borked. - let stat - try { - stat = xfs.statSync(p) - } catch (err1) { - throw err0 + if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { + _result += '-'; + } else { + _result += '- '; } - if (!stat.isDirectory()) throw err0 + + _result += state.dump; } } - return made + state.tag = _tag; + state.dump = _result || '[]'; // Empty sequence if no valid values. } -module.exports = mkdirsSync +function writeFlowMapping(state, level, object) { + var _result = '', + _tag = state.tag, + objectKeyList = Object.keys(object), + index, + length, + objectKey, + objectValue, + pairBuffer; + for (index = 0, length = objectKeyList.length; index < length; index += 1) { -/***/ }), + pairBuffer = ''; + if (_result !== '') pairBuffer += ', '; -/***/ 71781: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + if (state.condenseFlow) pairBuffer += '"'; -"use strict"; + objectKey = objectKeyList[index]; + objectValue = object[objectKey]; + if (state.replacer) { + objectValue = state.replacer.call(object, objectKey, objectValue); + } -const fs = __nccwpck_require__(61404) -const path = __nccwpck_require__(16928) -const invalidWin32Path = (__nccwpck_require__(38882).invalidWin32Path) + if (!writeNode(state, level, objectKey, false, false)) { + continue; // Skip this pair because of invalid key; + } -const o777 = parseInt('0777', 8) + if (state.dump.length > 1024) pairBuffer += '? '; -function mkdirs (p, opts, callback, made) { - if (typeof opts === 'function') { - callback = opts - opts = {} - } else if (!opts || typeof opts !== 'object') { - opts = { mode: opts } - } + pairBuffer += state.dump + (state.condenseFlow ? '"' : '') + ':' + (state.condenseFlow ? '' : ' '); - if (process.platform === 'win32' && invalidWin32Path(p)) { - const errInval = new Error(p + ' contains invalid WIN32 path characters.') - errInval.code = 'EINVAL' - return callback(errInval) - } + if (!writeNode(state, level, objectValue, false, false)) { + continue; // Skip this pair because of invalid value. + } - let mode = opts.mode - const xfs = opts.fs || fs + pairBuffer += state.dump; - if (mode === undefined) { - mode = o777 & (~process.umask()) + // Both key and value are valid. + _result += pairBuffer; } - if (!made) made = null - - callback = callback || function () {} - p = path.resolve(p) - - xfs.mkdir(p, mode, er => { - if (!er) { - made = made || p - return callback(null, made) - } - switch (er.code) { - case 'ENOENT': - if (path.dirname(p) === p) return callback(er) - mkdirs(path.dirname(p), opts, (er, made) => { - if (er) callback(er, made) - else mkdirs(p, opts, callback, made) - }) - break - // In the case of any other error, just see if there's a dir - // there already. If so, then hooray! If not, then something - // is borked. - default: - xfs.stat(p, (er2, stat) => { - // if the stat fails, then that's super weird. - // let the original error be the failure reason. - if (er2 || !stat.isDirectory()) callback(er, made) - else callback(null, made) - }) - break - } - }) + state.tag = _tag; + state.dump = '{' + _result + '}'; } -module.exports = mkdirs +function writeBlockMapping(state, level, object, compact) { + var _result = '', + _tag = state.tag, + objectKeyList = Object.keys(object), + index, + length, + objectKey, + objectValue, + explicitPair, + pairBuffer; + // Allow sorting keys so that the output file is deterministic + if (state.sortKeys === true) { + // Default sorting + objectKeyList.sort(); + } else if (typeof state.sortKeys === 'function') { + // Custom sort function + objectKeyList.sort(state.sortKeys); + } else if (state.sortKeys) { + // Something is wrong + throw new YAMLException('sortKeys must be a boolean or a function'); + } -/***/ }), + for (index = 0, length = objectKeyList.length; index < length; index += 1) { + pairBuffer = ''; -/***/ 38882: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + if (!compact || _result !== '') { + pairBuffer += generateNextLine(state, level); + } -"use strict"; + objectKey = objectKeyList[index]; + objectValue = object[objectKey]; + if (state.replacer) { + objectValue = state.replacer.call(object, objectKey, objectValue); + } -const path = __nccwpck_require__(16928) + if (!writeNode(state, level + 1, objectKey, true, true, true)) { + continue; // Skip this pair because of invalid key. + } -// get drive on windows -function getRootPath (p) { - p = path.normalize(path.resolve(p)).split(path.sep) - if (p.length > 0) return p[0] - return null -} + explicitPair = (state.tag !== null && state.tag !== '?') || + (state.dump && state.dump.length > 1024); -// http://stackoverflow.com/a/62888/10333 contains more accurate -// TODO: expand to include the rest -const INVALID_PATH_CHARS = /[<>:"|?*]/ + if (explicitPair) { + if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { + pairBuffer += '?'; + } else { + pairBuffer += '? '; + } + } -function invalidWin32Path (p) { - const rp = getRootPath(p) - p = p.replace(rp, '') - return INVALID_PATH_CHARS.test(p) -} + pairBuffer += state.dump; -module.exports = { - getRootPath, - invalidWin32Path -} + if (explicitPair) { + pairBuffer += generateNextLine(state, level); + } + if (!writeNode(state, level + 1, objectValue, true, explicitPair)) { + continue; // Skip this pair because of invalid value. + } -/***/ }), + if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { + pairBuffer += ':'; + } else { + pairBuffer += ': '; + } -/***/ 57744: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + pairBuffer += state.dump; -"use strict"; + // Both key and value are valid. + _result += pairBuffer; + } + state.tag = _tag; + state.dump = _result || '{}'; // Empty mapping if no valid pairs. +} -const fs = __nccwpck_require__(61404) -const path = __nccwpck_require__(16928) -const copySync = (__nccwpck_require__(32864).copySync) -const removeSync = (__nccwpck_require__(63073).removeSync) -const mkdirpSync = (__nccwpck_require__(36813).mkdirsSync) -const buffer = __nccwpck_require__(79463) +function detectType(state, object, explicit) { + var _result, typeList, index, length, type, style; -function moveSync (src, dest, options) { - options = options || {} - const overwrite = options.overwrite || options.clobber || false + typeList = explicit ? state.explicitTypes : state.implicitTypes; - src = path.resolve(src) - dest = path.resolve(dest) + for (index = 0, length = typeList.length; index < length; index += 1) { + type = typeList[index]; - if (src === dest) return fs.accessSync(src) + if ((type.instanceOf || type.predicate) && + (!type.instanceOf || ((typeof object === 'object') && (object instanceof type.instanceOf))) && + (!type.predicate || type.predicate(object))) { - if (isSrcSubdir(src, dest)) throw new Error(`Cannot move '${src}' into itself '${dest}'.`) + if (explicit) { + if (type.multi && type.representName) { + state.tag = type.representName(object); + } else { + state.tag = type.tag; + } + } else { + state.tag = '?'; + } - mkdirpSync(path.dirname(dest)) - tryRenameSync() + if (type.represent) { + style = state.styleMap[type.tag] || type.defaultStyle; - function tryRenameSync () { - if (overwrite) { - try { - return fs.renameSync(src, dest) - } catch (err) { - if (err.code === 'ENOTEMPTY' || err.code === 'EEXIST' || err.code === 'EPERM') { - removeSync(dest) - options.overwrite = false // just overwriteed it, no need to do it again - return moveSync(src, dest, options) + if (_toString.call(type.represent) === '[object Function]') { + _result = type.represent(object, style); + } else if (_hasOwnProperty.call(type.represent, style)) { + _result = type.represent[style](object, style); + } else { + throw new YAMLException('!<' + type.tag + '> tag resolver accepts not "' + style + '" style'); } - if (err.code !== 'EXDEV') throw err - return moveSyncAcrossDevice(src, dest, overwrite) - } - } else { - try { - fs.linkSync(src, dest) - return fs.unlinkSync(src) - } catch (err) { - if (err.code === 'EXDEV' || err.code === 'EISDIR' || err.code === 'EPERM' || err.code === 'ENOTSUP') { - return moveSyncAcrossDevice(src, dest, overwrite) - } - throw err + state.dump = _result; } + + return true; } } + + return false; } -function moveSyncAcrossDevice (src, dest, overwrite) { - const stat = fs.statSync(src) +// Serializes `object` and writes it to global `result`. +// Returns true on success, or false on invalid object. +// +function writeNode(state, level, object, block, compact, iskey, isblockseq) { + state.tag = null; + state.dump = object; - if (stat.isDirectory()) { - return moveDirSyncAcrossDevice(src, dest, overwrite) - } else { - return moveFileSyncAcrossDevice(src, dest, overwrite) + if (!detectType(state, object, false)) { + detectType(state, object, true); } -} -function moveFileSyncAcrossDevice (src, dest, overwrite) { - const BUF_LENGTH = 64 * 1024 - const _buff = buffer(BUF_LENGTH) + var type = _toString.call(state.dump); + var inblock = block; + var tagStr; - const flags = overwrite ? 'w' : 'wx' + if (block) { + block = (state.flowLevel < 0 || state.flowLevel > level); + } - const fdr = fs.openSync(src, 'r') - const stat = fs.fstatSync(fdr) - const fdw = fs.openSync(dest, flags, stat.mode) - let pos = 0 + var objectOrArray = type === '[object Object]' || type === '[object Array]', + duplicateIndex, + duplicate; - while (pos < stat.size) { - const bytesRead = fs.readSync(fdr, _buff, 0, BUF_LENGTH, pos) - fs.writeSync(fdw, _buff, 0, bytesRead) - pos += bytesRead + if (objectOrArray) { + duplicateIndex = state.duplicates.indexOf(object); + duplicate = duplicateIndex !== -1; } - fs.closeSync(fdr) - fs.closeSync(fdw) - return fs.unlinkSync(src) -} - -function moveDirSyncAcrossDevice (src, dest, overwrite) { - const options = { - overwrite: false + if ((state.tag !== null && state.tag !== '?') || duplicate || (state.indent !== 2 && level > 0)) { + compact = false; } - if (overwrite) { - removeSync(dest) - tryCopySync() + if (duplicate && state.usedDuplicates[duplicateIndex]) { + state.dump = '*ref_' + duplicateIndex; } else { - tryCopySync() - } + if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) { + state.usedDuplicates[duplicateIndex] = true; + } + if (type === '[object Object]') { + if (block && (Object.keys(state.dump).length !== 0)) { + writeBlockMapping(state, level, state.dump, compact); + if (duplicate) { + state.dump = '&ref_' + duplicateIndex + state.dump; + } + } else { + writeFlowMapping(state, level, state.dump); + if (duplicate) { + state.dump = '&ref_' + duplicateIndex + ' ' + state.dump; + } + } + } else if (type === '[object Array]') { + if (block && (state.dump.length !== 0)) { + if (state.noArrayIndent && !isblockseq && level > 0) { + writeBlockSequence(state, level - 1, state.dump, compact); + } else { + writeBlockSequence(state, level, state.dump, compact); + } + if (duplicate) { + state.dump = '&ref_' + duplicateIndex + state.dump; + } + } else { + writeFlowSequence(state, level, state.dump); + if (duplicate) { + state.dump = '&ref_' + duplicateIndex + ' ' + state.dump; + } + } + } else if (type === '[object String]') { + if (state.tag !== '?') { + writeScalar(state, state.dump, level, iskey, inblock); + } + } else if (type === '[object Undefined]') { + return false; + } else { + if (state.skipInvalid) return false; + throw new YAMLException('unacceptable kind of an object to dump ' + type); + } - function tryCopySync () { - copySync(src, dest, options) - return removeSync(src) - } -} + if (state.tag !== null && state.tag !== '?') { + // Need to encode all characters except those allowed by the spec: + // + // [35] ns-dec-digit ::= [#x30-#x39] /* 0-9 */ + // [36] ns-hex-digit ::= ns-dec-digit + // | [#x41-#x46] /* A-F */ | [#x61-#x66] /* a-f */ + // [37] ns-ascii-letter ::= [#x41-#x5A] /* A-Z */ | [#x61-#x7A] /* a-z */ + // [38] ns-word-char ::= ns-dec-digit | ns-ascii-letter | “-” + // [39] ns-uri-char ::= “%” ns-hex-digit ns-hex-digit | ns-word-char | “#” + // | “;” | “/” | “?” | “:” | “@” | “&” | “=” | “+” | “$” | “,” + // | “_” | “.” | “!” | “~” | “*” | “'” | “(” | “)” | “[” | “]” + // + // Also need to encode '!' because it has special meaning (end of tag prefix). + // + tagStr = encodeURI( + state.tag[0] === '!' ? state.tag.slice(1) : state.tag + ).replace(/!/g, '%21'); + + if (state.tag[0] === '!') { + tagStr = '!' + tagStr; + } else if (tagStr.slice(0, 18) === 'tag:yaml.org,2002:') { + tagStr = '!!' + tagStr.slice(18); + } else { + tagStr = '!<' + tagStr + '>'; + } -// return true if dest is a subdir of src, otherwise false. -// extract dest base dir and check if that is the same as src basename -function isSrcSubdir (src, dest) { - try { - return fs.statSync(src).isDirectory() && - src !== dest && - dest.indexOf(src) > -1 && - dest.split(path.dirname(src) + path.sep)[1].split(path.sep)[0] === path.basename(src) - } catch (e) { - return false + state.dump = tagStr + ' ' + state.dump; + } } -} -module.exports = { - moveSync + return true; } +function getDuplicateReferences(object, state) { + var objects = [], + duplicatesIndexes = [], + index, + length; -/***/ }), - -/***/ 95256: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - -"use strict"; - - -const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) -const fs = __nccwpck_require__(61404) -const path = __nccwpck_require__(16928) -const copy = (__nccwpck_require__(80424).copy) -const remove = (__nccwpck_require__(63073).remove) -const mkdirp = (__nccwpck_require__(36813).mkdirp) -const pathExists = (__nccwpck_require__(26949).pathExists) + inspectNode(object, objects, duplicatesIndexes); -function move (src, dest, opts, cb) { - if (typeof opts === 'function') { - cb = opts - opts = {} + for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) { + state.duplicates.push(objects[duplicatesIndexes[index]]); } + state.usedDuplicates = new Array(length); +} - const overwrite = opts.overwrite || opts.clobber || false - - src = path.resolve(src) - dest = path.resolve(dest) +function inspectNode(object, objects, duplicatesIndexes) { + var objectKeyList, + index, + length; - if (src === dest) return fs.access(src, cb) + if (object !== null && typeof object === 'object') { + index = objects.indexOf(object); + if (index !== -1) { + if (duplicatesIndexes.indexOf(index) === -1) { + duplicatesIndexes.push(index); + } + } else { + objects.push(object); - fs.stat(src, (err, st) => { - if (err) return cb(err) + if (Array.isArray(object)) { + for (index = 0, length = object.length; index < length; index += 1) { + inspectNode(object[index], objects, duplicatesIndexes); + } + } else { + objectKeyList = Object.keys(object); - if (st.isDirectory() && isSrcSubdir(src, dest)) { - return cb(new Error(`Cannot move '${src}' to a subdirectory of itself, '${dest}'.`)) + for (index = 0, length = objectKeyList.length; index < length; index += 1) { + inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes); + } + } } - mkdirp(path.dirname(dest), err => { - if (err) return cb(err) - return doRename(src, dest, overwrite, cb) - }) - }) -} - -function doRename (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) - }) -} +function dump(input, options) { + options = options || {}; -function moveAcrossDevice (src, dest, overwrite, cb) { - const opts = { - overwrite, - errorOnExist: true - } + var state = new State(options); - copy(src, dest, opts, err => { - if (err) return cb(err) - return remove(src, cb) - }) -} + if (!state.noRefs) getDuplicateReferences(input, state); -function isSrcSubdir (src, dest) { - const srcArray = src.split(path.sep) - const destArray = dest.split(path.sep) + var value = input; - return srcArray.reduce((acc, current, i) => { - return acc && destArray[i] === current - }, true) -} + if (state.replacer) { + value = state.replacer.call({ '': value }, '', value); + } -module.exports = { - move: u(move) + if (writeNode(state, 0, value, true, true)) return state.dump + '\n'; + + return ''; } +module.exports.dump = dump; + /***/ }), -/***/ 14552: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/***/ 2828: +/***/ ((module) => { "use strict"; +// YAML error class. http://stackoverflow.com/questions/8458984 +// -const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) -const fs = __nccwpck_require__(61404) -const path = __nccwpck_require__(16928) -const mkdir = __nccwpck_require__(36813) -const pathExists = (__nccwpck_require__(26949).pathExists) -function outputFile (file, data, encoding, callback) { - if (typeof encoding === 'function') { - callback = encoding - encoding = 'utf8' - } +function formatError(exception, compact) { + var where = '', message = exception.reason || '(unknown reason)'; - const dir = path.dirname(file) - pathExists(dir, (err, itDoes) => { - if (err) return callback(err) - if (itDoes) return fs.writeFile(file, data, encoding, callback) + if (!exception.mark) return message; - mkdir.mkdirs(dir, err => { - if (err) return callback(err) + if (exception.mark.name) { + where += 'in "' + exception.mark.name + '" '; + } - fs.writeFile(file, data, encoding, callback) - }) - }) -} + where += '(' + (exception.mark.line + 1) + ':' + (exception.mark.column + 1) + ')'; -function outputFileSync (file, ...args) { - const dir = path.dirname(file) - if (fs.existsSync(dir)) { - return fs.writeFileSync(file, ...args) + if (!compact && exception.mark.snippet) { + where += '\n\n' + exception.mark.snippet; } - mkdir.mkdirsSync(dir) - fs.writeFileSync(file, ...args) -} -module.exports = { - outputFile: u(outputFile), - outputFileSync + return message + ' ' + where; } -/***/ }), - -/***/ 26949: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - -"use strict"; - -const u = (__nccwpck_require__(92977)/* .fromPromise */ .z) -const fs = __nccwpck_require__(9238) +function YAMLException(reason, mark) { + // Super constructor + Error.call(this); -function pathExists (path) { - return fs.access(path).then(() => true).catch(() => false) -} + this.name = 'YAMLException'; + this.reason = reason; + this.mark = mark; + this.message = formatError(this, false); -module.exports = { - pathExists: u(pathExists), - pathExistsSync: fs.existsSync + // Include stack trace in error object + if (Error.captureStackTrace) { + // Chrome and NodeJS + Error.captureStackTrace(this, this.constructor); + } else { + // FF, IE 10+ and Safari 6+. Fallback for others + this.stack = (new Error()).stack || ''; + } } -/***/ }), - -/***/ 63073: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +// Inherit from Error +YAMLException.prototype = Object.create(Error.prototype); +YAMLException.prototype.constructor = YAMLException; -"use strict"; +YAMLException.prototype.toString = function toString(compact) { + return this.name + ': ' + formatError(this, compact); +}; -const u = (__nccwpck_require__(92977)/* .fromCallback */ .S) -const rimraf = __nccwpck_require__(95228) -module.exports = { - remove: u(rimraf), - removeSync: rimraf.sync -} +module.exports = YAMLException; /***/ }), -/***/ 95228: +/***/ 50586: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -const fs = __nccwpck_require__(61404) -const path = __nccwpck_require__(16928) -const assert = __nccwpck_require__(42613) - -const isWindows = (process.platform === 'win32') - -function defaults (options) { - const methods = [ - 'unlink', - 'chmod', - 'stat', - 'lstat', - 'rmdir', - 'readdir' - ] - methods.forEach(m => { - options[m] = options[m] || fs[m] - m = m + 'Sync' - options[m] = options[m] || fs[m] - }) - - options.maxBusyTries = options.maxBusyTries || 3 -} - -function rimraf (p, options, cb) { - let busyTries = 0 +/*eslint-disable max-len,no-use-before-define*/ - if (typeof options === 'function') { - cb = options - options = {} - } +var common = __nccwpck_require__(23324); +var YAMLException = __nccwpck_require__(2828); +var makeSnippet = __nccwpck_require__(50732); +var DEFAULT_SCHEMA = __nccwpck_require__(7436); - assert(p, 'rimraf: missing path') - assert.strictEqual(typeof p, 'string', 'rimraf: path should be a string') - assert.strictEqual(typeof cb, 'function', 'rimraf: callback function required') - assert(options, 'rimraf: invalid options argument provided') - assert.strictEqual(typeof options, 'object', 'rimraf: options should be object') - defaults(options) +var _hasOwnProperty = Object.prototype.hasOwnProperty; - rimraf_(p, options, function CB (er) { - if (er) { - if ((er.code === 'EBUSY' || er.code === 'ENOTEMPTY' || er.code === 'EPERM') && - busyTries < options.maxBusyTries) { - busyTries++ - const time = busyTries * 100 - // try again, with the same exact callback as this one. - return setTimeout(() => rimraf_(p, options, CB), time) - } - // already gone - if (er.code === 'ENOENT') er = null - } +var CONTEXT_FLOW_IN = 1; +var CONTEXT_FLOW_OUT = 2; +var CONTEXT_BLOCK_IN = 3; +var CONTEXT_BLOCK_OUT = 4; - cb(er) - }) -} -// Two possible strategies. -// 1. Assume it's a file. unlink it, then do the dir stuff on EPERM or EISDIR -// 2. Assume it's a directory. readdir, then do the file stuff on ENOTDIR -// -// Both result in an extra syscall when you guess wrong. However, there -// are likely far more normal files in the world than directories. This -// is based on the assumption that a the average number of files per -// directory is >= 1. -// -// If anyone ever complains about this, then I guess the strategy could -// be made configurable somehow. But until then, YAGNI. -function rimraf_ (p, options, cb) { - assert(p) - assert(options) - assert(typeof cb === 'function') +var CHOMPING_CLIP = 1; +var CHOMPING_STRIP = 2; +var CHOMPING_KEEP = 3; - // sunos lets the root user unlink directories, which is... weird. - // so we have to lstat here and make sure it's not a dir. - options.lstat(p, (er, st) => { - if (er && er.code === 'ENOENT') { - return cb(null) - } - // Windows can EPERM on stat. Life is suffering. - if (er && er.code === 'EPERM' && isWindows) { - return fixWinEPERM(p, options, er, cb) - } +var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; +var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/; +var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/; +var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i; +var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i; - if (st && st.isDirectory()) { - return rmdir(p, options, er, cb) - } - options.unlink(p, er => { - if (er) { - if (er.code === 'ENOENT') { - return cb(null) - } - if (er.code === 'EPERM') { - return (isWindows) - ? fixWinEPERM(p, options, er, cb) - : rmdir(p, options, er, cb) - } - if (er.code === 'EISDIR') { - return rmdir(p, options, er, cb) - } - } - return cb(er) - }) - }) +function _class(obj) { return Object.prototype.toString.call(obj); } + +function is_EOL(c) { + return (c === 0x0A/* LF */) || (c === 0x0D/* CR */); } -function fixWinEPERM (p, options, er, cb) { - assert(p) - assert(options) - assert(typeof cb === 'function') - if (er) { - assert(er instanceof Error) - } +function is_WHITE_SPACE(c) { + return (c === 0x09/* Tab */) || (c === 0x20/* Space */); +} - options.chmod(p, 0o666, er2 => { - if (er2) { - cb(er2.code === 'ENOENT' ? null : er) - } else { - options.stat(p, (er3, stats) => { - if (er3) { - cb(er3.code === 'ENOENT' ? null : er) - } else if (stats.isDirectory()) { - rmdir(p, options, er, cb) - } else { - options.unlink(p, cb) - } - }) - } - }) +function is_WS_OR_EOL(c) { + return (c === 0x09/* Tab */) || + (c === 0x20/* Space */) || + (c === 0x0A/* LF */) || + (c === 0x0D/* CR */); } -function fixWinEPERMSync (p, options, er) { - let stats +function is_FLOW_INDICATOR(c) { + return c === 0x2C/* , */ || + c === 0x5B/* [ */ || + c === 0x5D/* ] */ || + c === 0x7B/* { */ || + c === 0x7D/* } */; +} - assert(p) - assert(options) - if (er) { - assert(er instanceof Error) - } +function fromHexCode(c) { + var lc; - try { - options.chmodSync(p, 0o666) - } catch (er2) { - if (er2.code === 'ENOENT') { - return - } else { - throw er - } + if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { + return c - 0x30; } - try { - stats = options.statSync(p) - } catch (er3) { - if (er3.code === 'ENOENT') { - return - } else { - throw er - } + /*eslint-disable no-bitwise*/ + lc = c | 0x20; + + if ((0x61/* a */ <= lc) && (lc <= 0x66/* f */)) { + return lc - 0x61 + 10; } - if (stats.isDirectory()) { - rmdirSync(p, options, er) - } else { - options.unlinkSync(p) + return -1; +} + +function escapedHexLen(c) { + if (c === 0x78/* x */) { return 2; } + if (c === 0x75/* u */) { return 4; } + if (c === 0x55/* U */) { return 8; } + return 0; +} + +function fromDecimalCode(c) { + if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { + return c - 0x30; } + + return -1; } -function rmdir (p, options, originalEr, cb) { - assert(p) - assert(options) - if (originalEr) { - assert(originalEr instanceof Error) +function simpleEscapeSequence(c) { + /* eslint-disable indent */ + return (c === 0x30/* 0 */) ? '\x00' : + (c === 0x61/* a */) ? '\x07' : + (c === 0x62/* b */) ? '\x08' : + (c === 0x74/* t */) ? '\x09' : + (c === 0x09/* Tab */) ? '\x09' : + (c === 0x6E/* n */) ? '\x0A' : + (c === 0x76/* v */) ? '\x0B' : + (c === 0x66/* f */) ? '\x0C' : + (c === 0x72/* r */) ? '\x0D' : + (c === 0x65/* e */) ? '\x1B' : + (c === 0x20/* Space */) ? ' ' : + (c === 0x22/* " */) ? '\x22' : + (c === 0x2F/* / */) ? '/' : + (c === 0x5C/* \ */) ? '\x5C' : + (c === 0x4E/* N */) ? '\x85' : + (c === 0x5F/* _ */) ? '\xA0' : + (c === 0x4C/* L */) ? '\u2028' : + (c === 0x50/* P */) ? '\u2029' : ''; +} + +function charFromCodepoint(c) { + if (c <= 0xFFFF) { + return String.fromCharCode(c); } - assert(typeof cb === 'function') + // Encode UTF-16 surrogate pair + // https://en.wikipedia.org/wiki/UTF-16#Code_points_U.2B010000_to_U.2B10FFFF + return String.fromCharCode( + ((c - 0x010000) >> 10) + 0xD800, + ((c - 0x010000) & 0x03FF) + 0xDC00 + ); +} - // try to rmdir first, and only readdir on ENOTEMPTY or EEXIST (SunOS) - // if we guessed wrong, and it's not a directory, then - // raise the original error. - options.rmdir(p, er => { - if (er && (er.code === 'ENOTEMPTY' || er.code === 'EEXIST' || er.code === 'EPERM')) { - rmkids(p, options, cb) - } else if (er && er.code === 'ENOTDIR') { - cb(originalEr) - } else { - cb(er) - } - }) +// set a property of a literal object, while protecting against prototype pollution, +// see https://github.com/nodeca/js-yaml/issues/164 for more details +function setProperty(object, key, value) { + // used for this specific key only because Object.defineProperty is slow + if (key === '__proto__') { + Object.defineProperty(object, key, { + configurable: true, + enumerable: true, + writable: true, + value: value + }); + } else { + object[key] = value; + } } -function rmkids (p, options, cb) { - assert(p) - assert(options) - assert(typeof cb === 'function') +var simpleEscapeCheck = new Array(256); // integer, for fast access +var simpleEscapeMap = new Array(256); +for (var i = 0; i < 256; i++) { + simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0; + simpleEscapeMap[i] = simpleEscapeSequence(i); +} - options.readdir(p, (er, files) => { - if (er) return cb(er) - let n = files.length - let errState +function State(input, options) { + this.input = input; - if (n === 0) return options.rmdir(p, cb) + this.filename = options['filename'] || null; + this.schema = options['schema'] || DEFAULT_SCHEMA; + this.onWarning = options['onWarning'] || null; + // (Hidden) Remove? makes the loader to expect YAML 1.1 documents + // if such documents have no explicit %YAML directive + this.legacy = options['legacy'] || false; - files.forEach(f => { - rimraf(path.join(p, f), options, er => { - if (errState) { - return - } - if (er) return cb(errState = er) - if (--n === 0) { - options.rmdir(p, cb) - } - }) - }) - }) -} + this.json = options['json'] || false; + this.listener = options['listener'] || null; -// this looks simpler, and is strictly *faster*, but will -// tie up the JavaScript thread and fail on excessively -// deep directory trees. -function rimrafSync (p, options) { - let st + this.implicitTypes = this.schema.compiledImplicit; + this.typeMap = this.schema.compiledTypeMap; - options = options || {} - defaults(options) + this.length = input.length; + this.position = 0; + this.line = 0; + this.lineStart = 0; + this.lineIndent = 0; - assert(p, 'rimraf: missing path') - assert.strictEqual(typeof p, 'string', 'rimraf: path should be a string') - assert(options, 'rimraf: missing options') - assert.strictEqual(typeof options, 'object', 'rimraf: options should be object') + // position of first leading tab in the current line, + // used to make sure there are no tabs in the indentation + this.firstTabInLine = -1; - try { - st = options.lstatSync(p) - } catch (er) { - if (er.code === 'ENOENT') { - return - } + this.documents = []; - // Windows can EPERM on stat. Life is suffering. - if (er.code === 'EPERM' && isWindows) { - fixWinEPERMSync(p, options, er) - } - } + /* + this.version; + this.checkLineBreaks; + this.tagMap; + this.anchorMap; + this.tag; + this.anchor; + this.kind; + this.result;*/ - try { - // sunos lets the root user unlink directories, which is... weird. - if (st && st.isDirectory()) { - rmdirSync(p, options, null) - } else { - options.unlinkSync(p) - } - } catch (er) { - if (er.code === 'ENOENT') { - return - } else if (er.code === 'EPERM') { - return isWindows ? fixWinEPERMSync(p, options, er) : rmdirSync(p, options, er) - } else if (er.code !== 'EISDIR') { - throw er - } - rmdirSync(p, options, er) - } } -function rmdirSync (p, options, originalEr) { - assert(p) - assert(options) - if (originalEr) { - assert(originalEr instanceof Error) - } - try { - options.rmdirSync(p) - } catch (er) { - if (er.code === 'ENOTDIR') { - throw originalEr - } else if (er.code === 'ENOTEMPTY' || er.code === 'EEXIST' || er.code === 'EPERM') { - rmkidsSync(p, options) - } else if (er.code !== 'ENOENT') { - throw er - } - } +function generateError(state, message) { + var mark = { + name: state.filename, + buffer: state.input.slice(0, -1), // omit trailing \0 + position: state.position, + line: state.line, + column: state.position - state.lineStart + }; + + mark.snippet = makeSnippet(mark); + + return new YAMLException(message, mark); } -function rmkidsSync (p, options) { - assert(p) - assert(options) - options.readdirSync(p).forEach(f => rimrafSync(path.join(p, f), options)) +function throwError(state, message) { + throw generateError(state, message); +} - if (isWindows) { - // We only end up here once we got ENOTEMPTY at least once, and - // at this point, we are guaranteed to have removed all the kids. - // So, we know that it won't be ENOENT or ENOTDIR or anything else. - // try really hard to delete stuff on windows, because it has a - // PROFOUNDLY annoying habit of not closing handles promptly when - // files are deleted, resulting in spurious ENOTEMPTY errors. - const startTime = Date.now() - do { - try { - const ret = options.rmdirSync(p, options) - return ret - } catch (er) { } - } while (Date.now() - startTime < 500) // give up after 500ms - } else { - const ret = options.rmdirSync(p, options) - return ret +function throwWarning(state, message) { + if (state.onWarning) { + state.onWarning.call(null, generateError(state, message)); } } -module.exports = rimraf -rimraf.sync = rimrafSync - -/***/ }), +var directiveHandlers = { -/***/ 79463: -/***/ ((module) => { + YAML: function handleYamlDirective(state, name, args) { -"use strict"; + var match, major, minor; -/* eslint-disable node/no-deprecated-api */ -module.exports = function (size) { - if (typeof Buffer.allocUnsafe === 'function') { - try { - return Buffer.allocUnsafe(size) - } catch (e) { - return new Buffer(size) + if (state.version !== null) { + throwError(state, 'duplication of %YAML directive'); } - } - return new Buffer(size) -} - -/***/ }), + if (args.length !== 1) { + throwError(state, 'YAML directive accepts exactly one argument'); + } -/***/ 51226: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]); -"use strict"; + if (match === null) { + throwError(state, 'ill-formed argument of the YAML directive'); + } + major = parseInt(match[1], 10); + minor = parseInt(match[2], 10); -const fs = __nccwpck_require__(61404) -const os = __nccwpck_require__(70857) -const path = __nccwpck_require__(16928) + if (major !== 1) { + throwError(state, 'unacceptable YAML version of the document'); + } -// HFS, ext{2,3}, FAT do not, Node.js v0.10 does not -function hasMillisResSync () { - let tmpfile = path.join('millis-test-sync' + Date.now().toString() + Math.random().toString().slice(2)) - tmpfile = path.join(os.tmpdir(), tmpfile) + state.version = args[0]; + state.checkLineBreaks = (minor < 2); - // 550 millis past UNIX epoch - const d = new Date(1435410243862) - fs.writeFileSync(tmpfile, 'https://github.com/jprichardson/node-fs-extra/pull/141') - const fd = fs.openSync(tmpfile, 'r+') - fs.futimesSync(fd, d, d) - fs.closeSync(fd) - return fs.statSync(tmpfile).mtime > 1435410243000 -} + if (minor !== 1 && minor !== 2) { + throwWarning(state, 'unsupported YAML version of the document'); + } + }, -function hasMillisRes (callback) { - let tmpfile = path.join('millis-test' + Date.now().toString() + Math.random().toString().slice(2)) - tmpfile = path.join(os.tmpdir(), tmpfile) + TAG: function handleTagDirective(state, name, args) { - // 550 millis past UNIX epoch - const d = new Date(1435410243862) - fs.writeFile(tmpfile, 'https://github.com/jprichardson/node-fs-extra/pull/141', err => { - if (err) return callback(err) - fs.open(tmpfile, 'r+', (err, fd) => { - if (err) return callback(err) - fs.futimes(fd, d, d, err => { - if (err) return callback(err) - fs.close(fd, err => { - if (err) return callback(err) - fs.stat(tmpfile, (err, stats) => { - if (err) return callback(err) - callback(null, stats.mtime > 1435410243000) - }) - }) - }) - }) - }) -} + var handle, prefix; -function timeRemoveMillis (timestamp) { - if (typeof timestamp === 'number') { - return Math.floor(timestamp / 1000) * 1000 - } else if (timestamp instanceof Date) { - return new Date(Math.floor(timestamp.getTime() / 1000) * 1000) - } else { - throw new Error('fs-extra: timeRemoveMillis() unknown parameter type') - } -} + if (args.length !== 2) { + throwError(state, 'TAG directive accepts exactly two arguments'); + } -function utimesMillis (path, atime, mtime, callback) { - // if (!HAS_MILLIS_RES) return fs.utimes(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) - }) - }) - }) -} + handle = args[0]; + prefix = args[1]; -function utimesMillisSync (path, atime, mtime) { - const fd = fs.openSync(path, 'r+') - fs.futimesSync(fd, atime, mtime) - return fs.closeSync(fd) -} + if (!PATTERN_TAG_HANDLE.test(handle)) { + throwError(state, 'ill-formed tag handle (first argument) of the TAG directive'); + } -module.exports = { - hasMillisRes, - hasMillisResSync, - timeRemoveMillis, - utimesMillis, - utimesMillisSync -} + if (_hasOwnProperty.call(state.tagMap, handle)) { + throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle'); + } + if (!PATTERN_TAG_URI.test(prefix)) { + throwError(state, 'ill-formed tag prefix (second argument) of the TAG directive'); + } -/***/ }), + try { + prefix = decodeURIComponent(prefix); + } catch (err) { + throwError(state, 'tag prefix is malformed: ' + prefix); + } -/***/ 95338: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + state.tagMap[handle] = prefix; + } +}; -"use strict"; -const {PassThrough: PassThroughStream} = __nccwpck_require__(2203); +function captureSegment(state, start, end, checkJson) { + var _position, _length, _character, _result; -module.exports = options => { - options = {...options}; + if (start < end) { + _result = state.input.slice(start, end); - const {array} = options; - let {encoding} = options; - const isBuffer = encoding === 'buffer'; - let objectMode = false; + if (checkJson) { + for (_position = 0, _length = _result.length; _position < _length; _position += 1) { + _character = _result.charCodeAt(_position); + if (!(_character === 0x09 || + (0x20 <= _character && _character <= 0x10FFFF))) { + throwError(state, 'expected valid JSON character'); + } + } + } else if (PATTERN_NON_PRINTABLE.test(_result)) { + throwError(state, 'the stream contains non-printable characters'); + } - if (array) { - objectMode = !(encoding || isBuffer); - } else { - encoding = encoding || 'utf8'; - } + state.result += _result; + } +} - if (isBuffer) { - encoding = null; - } +function mergeMappings(state, destination, source, overridableKeys) { + var sourceKeys, key, index, quantity; - const stream = new PassThroughStream({objectMode}); + if (!common.isObject(source)) { + throwError(state, 'cannot merge mappings; the provided source object is unacceptable'); + } - if (encoding) { - stream.setEncoding(encoding); - } + sourceKeys = Object.keys(source); - let length = 0; - const chunks = []; + for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) { + key = sourceKeys[index]; - stream.on('data', chunk => { - chunks.push(chunk); + if (!_hasOwnProperty.call(destination, key)) { + setProperty(destination, key, source[key]); + overridableKeys[key] = true; + } + } +} - if (objectMode) { - length = chunks.length; - } else { - length += chunk.length; - } - }); +function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, + startLine, startLineStart, startPos) { - stream.getBufferedValue = () => { - if (array) { - return chunks; - } + var index, quantity; - return isBuffer ? Buffer.concat(chunks, length) : chunks.join(''); - }; + // The output is a plain object here, so keys can only be strings. + // We need to convert keyNode to a string, but doing so can hang the process + // (deeply nested arrays that explode exponentially using aliases). + if (Array.isArray(keyNode)) { + keyNode = Array.prototype.slice.call(keyNode); - stream.getBufferedLength = () => length; + for (index = 0, quantity = keyNode.length; index < quantity; index += 1) { + if (Array.isArray(keyNode[index])) { + throwError(state, 'nested arrays are not supported inside keys'); + } - return stream; -}; + if (typeof keyNode === 'object' && _class(keyNode[index]) === '[object Object]') { + keyNode[index] = '[object Object]'; + } + } + } + // Avoid code execution in load() via toString property + // (still use its own toString for arrays, timestamps, + // and whatever user schema extensions happen to have @@toStringTag) + if (typeof keyNode === 'object' && _class(keyNode) === '[object Object]') { + keyNode = '[object Object]'; + } -/***/ }), -/***/ 91559: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + keyNode = String(keyNode); -"use strict"; + if (_result === null) { + _result = {}; + } -const {constants: BufferConstants} = __nccwpck_require__(20181); -const stream = __nccwpck_require__(2203); -const {promisify} = __nccwpck_require__(39023); -const bufferStream = __nccwpck_require__(95338); + if (keyTag === 'tag:yaml.org,2002:merge') { + if (Array.isArray(valueNode)) { + for (index = 0, quantity = valueNode.length; index < quantity; index += 1) { + mergeMappings(state, _result, valueNode[index], overridableKeys); + } + } else { + mergeMappings(state, _result, valueNode, overridableKeys); + } + } else { + if (!state.json && + !_hasOwnProperty.call(overridableKeys, keyNode) && + _hasOwnProperty.call(_result, keyNode)) { + state.line = startLine || state.line; + state.lineStart = startLineStart || state.lineStart; + state.position = startPos || state.position; + throwError(state, 'duplicated mapping key'); + } -const streamPipelinePromisified = promisify(stream.pipeline); + setProperty(_result, keyNode, valueNode); + delete overridableKeys[keyNode]; + } -class MaxBufferError extends Error { - constructor() { - super('maxBuffer exceeded'); - this.name = 'MaxBufferError'; - } + return _result; } -async function getStream(inputStream, options) { - if (!inputStream) { - throw new Error('Expected a stream'); - } +function readLineBreak(state) { + var ch; - options = { - maxBuffer: Infinity, - ...options - }; + ch = state.input.charCodeAt(state.position); - const {maxBuffer} = options; - const stream = bufferStream(options); + if (ch === 0x0A/* LF */) { + state.position++; + } else if (ch === 0x0D/* CR */) { + state.position++; + if (state.input.charCodeAt(state.position) === 0x0A/* LF */) { + state.position++; + } + } else { + throwError(state, 'a line break is expected'); + } - await new Promise((resolve, reject) => { - const rejectPromise = error => { - // Don't retrieve an oversized buffer. - if (error && stream.getBufferedLength() <= BufferConstants.MAX_LENGTH) { - error.bufferedData = stream.getBufferedValue(); - } + state.line += 1; + state.lineStart = state.position; + state.firstTabInLine = -1; +} - reject(error); - }; +function skipSeparationSpace(state, allowComments, checkIndent) { + var lineBreaks = 0, + ch = state.input.charCodeAt(state.position); - (async () => { - try { - await streamPipelinePromisified(inputStream, stream); - resolve(); - } catch (error) { - rejectPromise(error); - } - })(); + while (ch !== 0) { + while (is_WHITE_SPACE(ch)) { + if (ch === 0x09/* Tab */ && state.firstTabInLine === -1) { + state.firstTabInLine = state.position; + } + ch = state.input.charCodeAt(++state.position); + } - stream.on('data', () => { - if (stream.getBufferedLength() > maxBuffer) { - rejectPromise(new MaxBufferError()); - } - }); - }); + if (allowComments && ch === 0x23/* # */) { + do { + ch = state.input.charCodeAt(++state.position); + } while (ch !== 0x0A/* LF */ && ch !== 0x0D/* CR */ && ch !== 0); + } - return stream.getBufferedValue(); -} + if (is_EOL(ch)) { + readLineBreak(state); -module.exports = getStream; -module.exports.buffer = (stream, options) => getStream(stream, {...options, encoding: 'buffer'}); -module.exports.array = (stream, options) => getStream(stream, {...options, array: true}); -module.exports.MaxBufferError = MaxBufferError; + ch = state.input.charCodeAt(state.position); + lineBreaks++; + state.lineIndent = 0; + while (ch === 0x20/* Space */) { + state.lineIndent++; + ch = state.input.charCodeAt(++state.position); + } + } else { + break; + } + } -/***/ }), + if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) { + throwWarning(state, 'deficient indentation'); + } -/***/ 62437: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + return lineBreaks; +} -"use strict"; +function testDocumentSeparator(state) { + var _position = state.position, + ch; + ch = state.input.charCodeAt(_position); -var isGlob = __nccwpck_require__(11753); -var pathPosixDirname = (__nccwpck_require__(16928).posix).dirname; -var isWin32 = (__nccwpck_require__(70857).platform)() === 'win32'; + // Condition state.position === state.lineStart is tested + // in parent on each call, for efficiency. No needs to test here again. + if ((ch === 0x2D/* - */ || ch === 0x2E/* . */) && + ch === state.input.charCodeAt(_position + 1) && + ch === state.input.charCodeAt(_position + 2)) { -var slash = '/'; -var backslash = /\\/g; -var enclosure = /[\{\[].*[\}\]]$/; -var globby = /(^|[^\\])([\{\[]|\([^\)]+$)/; -var escaped = /\\([\!\*\?\|\[\]\(\)\{\}])/g; + _position += 3; -/** - * @param {string} str - * @param {Object} opts - * @param {boolean} [opts.flipBackslashes=true] - * @returns {string} - */ -module.exports = function globParent(str, opts) { - var options = Object.assign({ flipBackslashes: true }, opts); + ch = state.input.charCodeAt(_position); - // flip windows path separators - if (options.flipBackslashes && isWin32 && str.indexOf(slash) < 0) { - str = str.replace(backslash, slash); + if (ch === 0 || is_WS_OR_EOL(ch)) { + return true; + } } - // special case for strings ending in enclosure containing path separator - if (enclosure.test(str)) { - str += slash; - } + return false; +} - // preserves full path in case of trailing path separator - str += 'a'; +function writeFoldedLines(state, count) { + if (count === 1) { + state.result += ' '; + } else if (count > 1) { + state.result += common.repeat('\n', count - 1); + } +} - // remove path parts that are globby - do { - str = pathPosixDirname(str); - } while (isGlob(str) || globby.test(str)); - // remove escape chars and return result - return str.replace(escaped, '$1'); -}; +function readPlainScalar(state, nodeIndent, withinFlowCollection) { + var preceding, + following, + captureStart, + captureEnd, + hasPendingContent, + _line, + _lineStart, + _lineIndent, + _kind = state.kind, + _result = state.result, + ch; + ch = state.input.charCodeAt(state.position); -/***/ }), + if (is_WS_OR_EOL(ch) || + is_FLOW_INDICATOR(ch) || + ch === 0x23/* # */ || + ch === 0x26/* & */ || + ch === 0x2A/* * */ || + ch === 0x21/* ! */ || + ch === 0x7C/* | */ || + ch === 0x3E/* > */ || + ch === 0x27/* ' */ || + ch === 0x22/* " */ || + ch === 0x25/* % */ || + ch === 0x40/* @ */ || + ch === 0x60/* ` */) { + return false; + } -/***/ 86353: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + if (ch === 0x3F/* ? */ || ch === 0x2D/* - */) { + following = state.input.charCodeAt(state.position + 1); -"use strict"; + if (is_WS_OR_EOL(following) || + withinFlowCollection && is_FLOW_INDICATOR(following)) { + return false; + } + } -const {promisify} = __nccwpck_require__(39023); -const fs = __nccwpck_require__(79896); -const path = __nccwpck_require__(16928); -const fastGlob = __nccwpck_require__(10484); -const gitIgnore = __nccwpck_require__(64134); -const slash = __nccwpck_require__(85737); + state.kind = 'scalar'; + state.result = ''; + captureStart = captureEnd = state.position; + hasPendingContent = false; -const DEFAULT_IGNORE = [ - '**/node_modules/**', - '**/flow-typed/**', - '**/coverage/**', - '**/.git' -]; + while (ch !== 0) { + if (ch === 0x3A/* : */) { + following = state.input.charCodeAt(state.position + 1); -const readFileP = promisify(fs.readFile); + if (is_WS_OR_EOL(following) || + withinFlowCollection && is_FLOW_INDICATOR(following)) { + break; + } -const mapGitIgnorePatternTo = base => ignore => { - if (ignore.startsWith('!')) { - return '!' + path.posix.join(base, ignore.slice(1)); - } + } else if (ch === 0x23/* # */) { + preceding = state.input.charCodeAt(state.position - 1); - return path.posix.join(base, ignore); -}; + if (is_WS_OR_EOL(preceding)) { + break; + } -const parseGitIgnore = (content, options) => { - const base = slash(path.relative(options.cwd, path.dirname(options.fileName))); + } else if ((state.position === state.lineStart && testDocumentSeparator(state)) || + withinFlowCollection && is_FLOW_INDICATOR(ch)) { + break; - return content - .split(/\r?\n/) - .filter(Boolean) - .filter(line => !line.startsWith('#')) - .map(mapGitIgnorePatternTo(base)); -}; + } else if (is_EOL(ch)) { + _line = state.line; + _lineStart = state.lineStart; + _lineIndent = state.lineIndent; + skipSeparationSpace(state, false, -1); -const reduceIgnore = files => { - const ignores = gitIgnore(); - for (const file of files) { - ignores.add(parseGitIgnore(file.content, { - cwd: file.cwd, - fileName: file.filePath - })); - } + if (state.lineIndent >= nodeIndent) { + hasPendingContent = true; + ch = state.input.charCodeAt(state.position); + continue; + } else { + state.position = captureEnd; + state.line = _line; + state.lineStart = _lineStart; + state.lineIndent = _lineIndent; + break; + } + } - return ignores; -}; + if (hasPendingContent) { + captureSegment(state, captureStart, captureEnd, false); + writeFoldedLines(state, state.line - _line); + captureStart = captureEnd = state.position; + hasPendingContent = false; + } -const ensureAbsolutePathForCwd = (cwd, p) => { - cwd = slash(cwd); - if (path.isAbsolute(p)) { - if (slash(p).startsWith(cwd)) { - return p; - } + if (!is_WHITE_SPACE(ch)) { + captureEnd = state.position + 1; + } - throw new Error(`Path ${p} is not in cwd ${cwd}`); - } + ch = state.input.charCodeAt(++state.position); + } - return path.join(cwd, p); -}; + captureSegment(state, captureStart, captureEnd, false); -const getIsIgnoredPredecate = (ignores, cwd) => { - return p => ignores.ignores(slash(path.relative(cwd, ensureAbsolutePathForCwd(cwd, p.path || p)))); -}; + if (state.result) { + return true; + } -const getFile = async (file, cwd) => { - const filePath = path.join(cwd, file); - const content = await readFileP(filePath, 'utf8'); + state.kind = _kind; + state.result = _result; + return false; +} - return { - cwd, - filePath, - content - }; -}; +function readSingleQuotedScalar(state, nodeIndent) { + var ch, + captureStart, captureEnd; -const getFileSync = (file, cwd) => { - const filePath = path.join(cwd, file); - const content = fs.readFileSync(filePath, 'utf8'); + ch = state.input.charCodeAt(state.position); - return { - cwd, - filePath, - content - }; -}; + if (ch !== 0x27/* ' */) { + return false; + } -const normalizeOptions = ({ - ignore = [], - cwd = slash(process.cwd()) -} = {}) => { - return {ignore, cwd}; -}; + state.kind = 'scalar'; + state.result = ''; + state.position++; + captureStart = captureEnd = state.position; -module.exports = async options => { - options = normalizeOptions(options); + while ((ch = state.input.charCodeAt(state.position)) !== 0) { + if (ch === 0x27/* ' */) { + captureSegment(state, captureStart, state.position, true); + ch = state.input.charCodeAt(++state.position); - const paths = await fastGlob('**/.gitignore', { - ignore: DEFAULT_IGNORE.concat(options.ignore), - cwd: options.cwd - }); + if (ch === 0x27/* ' */) { + captureStart = state.position; + state.position++; + captureEnd = state.position; + } else { + return true; + } - const files = await Promise.all(paths.map(file => getFile(file, options.cwd))); - const ignores = reduceIgnore(files); + } else if (is_EOL(ch)) { + captureSegment(state, captureStart, captureEnd, true); + writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); + captureStart = captureEnd = state.position; - return getIsIgnoredPredecate(ignores, options.cwd); -}; + } else if (state.position === state.lineStart && testDocumentSeparator(state)) { + throwError(state, 'unexpected end of the document within a single quoted scalar'); -module.exports.sync = options => { - options = normalizeOptions(options); + } else { + state.position++; + captureEnd = state.position; + } + } - const paths = fastGlob.sync('**/.gitignore', { - ignore: DEFAULT_IGNORE.concat(options.ignore), - cwd: options.cwd - }); + throwError(state, 'unexpected end of the stream within a single quoted scalar'); +} - const files = paths.map(file => getFileSync(file, options.cwd)); - const ignores = reduceIgnore(files); +function readDoubleQuotedScalar(state, nodeIndent) { + var captureStart, + captureEnd, + hexLength, + hexResult, + tmp, + ch; - return getIsIgnoredPredecate(ignores, options.cwd); -}; + ch = state.input.charCodeAt(state.position); + if (ch !== 0x22/* " */) { + return false; + } -/***/ }), + state.kind = 'scalar'; + state.result = ''; + state.position++; + captureStart = captureEnd = state.position; -/***/ 46127: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + while ((ch = state.input.charCodeAt(state.position)) !== 0) { + if (ch === 0x22/* " */) { + captureSegment(state, captureStart, state.position, true); + state.position++; + return true; -"use strict"; + } else if (ch === 0x5C/* \ */) { + captureSegment(state, captureStart, state.position, true); + ch = state.input.charCodeAt(++state.position); -const fs = __nccwpck_require__(79896); -const arrayUnion = __nccwpck_require__(71187); -const merge2 = __nccwpck_require__(26606); -const fastGlob = __nccwpck_require__(10484); -const dirGlob = __nccwpck_require__(70804); -const gitignore = __nccwpck_require__(86353); -const {FilterStream, UniqueStream} = __nccwpck_require__(57211); + if (is_EOL(ch)) { + skipSeparationSpace(state, false, nodeIndent); -const DEFAULT_FILTER = () => false; + // TODO: rework to inline fn with no type cast? + } else if (ch < 256 && simpleEscapeCheck[ch]) { + state.result += simpleEscapeMap[ch]; + state.position++; -const isNegative = pattern => pattern[0] === '!'; + } else if ((tmp = escapedHexLen(ch)) > 0) { + hexLength = tmp; + hexResult = 0; -const assertPatternsInput = patterns => { - if (!patterns.every(pattern => typeof pattern === 'string')) { - throw new TypeError('Patterns must be a string or an array of strings'); - } -}; + for (; hexLength > 0; hexLength--) { + ch = state.input.charCodeAt(++state.position); -const checkCwdOption = (options = {}) => { - if (!options.cwd) { - return; - } + if ((tmp = fromHexCode(ch)) >= 0) { + hexResult = (hexResult << 4) + tmp; - let stat; - try { - stat = fs.statSync(options.cwd); - } catch { - return; - } + } else { + throwError(state, 'expected hexadecimal character'); + } + } - if (!stat.isDirectory()) { - throw new Error('The `cwd` option must be a path to a directory'); - } -}; + state.result += charFromCodepoint(hexResult); -const getPathString = p => p.stats instanceof fs.Stats ? p.path : p; + state.position++; -const generateGlobTasks = (patterns, taskOptions) => { - patterns = arrayUnion([].concat(patterns)); - assertPatternsInput(patterns); - checkCwdOption(taskOptions); + } else { + throwError(state, 'unknown escape sequence'); + } - const globTasks = []; + captureStart = captureEnd = state.position; - taskOptions = { - ignore: [], - expandDirectories: true, - ...taskOptions - }; + } else if (is_EOL(ch)) { + captureSegment(state, captureStart, captureEnd, true); + writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); + captureStart = captureEnd = state.position; - for (const [index, pattern] of patterns.entries()) { - if (isNegative(pattern)) { - continue; - } + } else if (state.position === state.lineStart && testDocumentSeparator(state)) { + throwError(state, 'unexpected end of the document within a double quoted scalar'); - const ignore = patterns - .slice(index) - .filter(pattern => isNegative(pattern)) - .map(pattern => pattern.slice(1)); + } else { + state.position++; + captureEnd = state.position; + } + } - const options = { - ...taskOptions, - ignore: taskOptions.ignore.concat(ignore) - }; + throwError(state, 'unexpected end of the stream within a double quoted scalar'); +} - globTasks.push({pattern, options}); - } +function readFlowCollection(state, nodeIndent) { + var readNext = true, + _line, + _lineStart, + _pos, + _tag = state.tag, + _result, + _anchor = state.anchor, + following, + terminator, + isPair, + isExplicitPair, + isMapping, + overridableKeys = Object.create(null), + keyNode, + keyTag, + valueNode, + ch; - return globTasks; -}; + ch = state.input.charCodeAt(state.position); -const globDirs = (task, fn) => { - let options = {}; - if (task.options.cwd) { - options.cwd = task.options.cwd; - } + if (ch === 0x5B/* [ */) { + terminator = 0x5D;/* ] */ + isMapping = false; + _result = []; + } else if (ch === 0x7B/* { */) { + terminator = 0x7D;/* } */ + isMapping = true; + _result = {}; + } else { + return false; + } - if (Array.isArray(task.options.expandDirectories)) { - options = { - ...options, - files: task.options.expandDirectories - }; - } else if (typeof task.options.expandDirectories === 'object') { - options = { - ...options, - ...task.options.expandDirectories - }; - } + if (state.anchor !== null) { + state.anchorMap[state.anchor] = _result; + } - return fn(task.pattern, options); -}; + ch = state.input.charCodeAt(++state.position); -const getPattern = (task, fn) => task.options.expandDirectories ? globDirs(task, fn) : [task.pattern]; + while (ch !== 0) { + skipSeparationSpace(state, true, nodeIndent); -const getFilterSync = options => { - return options && options.gitignore ? - gitignore.sync({cwd: options.cwd, ignore: options.ignore}) : - DEFAULT_FILTER; -}; + ch = state.input.charCodeAt(state.position); -const globToTask = task => glob => { - const {options} = task; - if (options.ignore && Array.isArray(options.ignore) && options.expandDirectories) { - options.ignore = dirGlob.sync(options.ignore); - } + if (ch === terminator) { + state.position++; + state.tag = _tag; + state.anchor = _anchor; + state.kind = isMapping ? 'mapping' : 'sequence'; + state.result = _result; + return true; + } else if (!readNext) { + throwError(state, 'missed comma between flow collection entries'); + } else if (ch === 0x2C/* , */) { + // "flow collection entries can never be completely empty", as per YAML 1.2, section 7.4 + throwError(state, "expected the node content, but found ','"); + } - return { - pattern: glob, - options - }; -}; + keyTag = keyNode = valueNode = null; + isPair = isExplicitPair = false; -module.exports = async (patterns, options) => { - const globTasks = generateGlobTasks(patterns, options); + if (ch === 0x3F/* ? */) { + following = state.input.charCodeAt(state.position + 1); - const getFilter = async () => { - return options && options.gitignore ? - gitignore({cwd: options.cwd, ignore: options.ignore}) : - DEFAULT_FILTER; - }; + if (is_WS_OR_EOL(following)) { + isPair = isExplicitPair = true; + state.position++; + skipSeparationSpace(state, true, nodeIndent); + } + } - const getTasks = async () => { - const tasks = await Promise.all(globTasks.map(async task => { - const globs = await getPattern(task, dirGlob); - return Promise.all(globs.map(globToTask(task))); - })); + _line = state.line; // Save the current line. + _lineStart = state.lineStart; + _pos = state.position; + composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); + keyTag = state.tag; + keyNode = state.result; + skipSeparationSpace(state, true, nodeIndent); - return arrayUnion(...tasks); - }; + ch = state.input.charCodeAt(state.position); - const [filter, tasks] = await Promise.all([getFilter(), getTasks()]); - const paths = await Promise.all(tasks.map(task => fastGlob(task.pattern, task.options))); + if ((isExplicitPair || state.line === _line) && ch === 0x3A/* : */) { + isPair = true; + ch = state.input.charCodeAt(++state.position); + skipSeparationSpace(state, true, nodeIndent); + composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); + valueNode = state.result; + } - return arrayUnion(...paths).filter(path_ => !filter(getPathString(path_))); -}; + if (isMapping) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos); + } else if (isPair) { + _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos)); + } else { + _result.push(keyNode); + } -module.exports.sync = (patterns, options) => { - const globTasks = generateGlobTasks(patterns, options); + skipSeparationSpace(state, true, nodeIndent); - const tasks = []; - for (const task of globTasks) { - const newTask = getPattern(task, dirGlob.sync).map(globToTask(task)); - tasks.push(...newTask); - } + ch = state.input.charCodeAt(state.position); - const filter = getFilterSync(options); + if (ch === 0x2C/* , */) { + readNext = true; + ch = state.input.charCodeAt(++state.position); + } else { + readNext = false; + } + } - let matches = []; - for (const task of tasks) { - matches = arrayUnion(matches, fastGlob.sync(task.pattern, task.options)); - } + throwError(state, 'unexpected end of the stream within a flow collection'); +} - return matches.filter(path_ => !filter(path_)); -}; +function readBlockScalar(state, nodeIndent) { + var captureStart, + folding, + chomping = CHOMPING_CLIP, + didReadContent = false, + detectedIndent = false, + textIndent = nodeIndent, + emptyLines = 0, + atMoreIndented = false, + tmp, + ch; -module.exports.stream = (patterns, options) => { - const globTasks = generateGlobTasks(patterns, options); + ch = state.input.charCodeAt(state.position); - const tasks = []; - for (const task of globTasks) { - const newTask = getPattern(task, dirGlob.sync).map(globToTask(task)); - tasks.push(...newTask); - } + if (ch === 0x7C/* | */) { + folding = false; + } else if (ch === 0x3E/* > */) { + folding = true; + } else { + return false; + } - const filter = getFilterSync(options); - const filterStream = new FilterStream(p => !filter(p)); - const uniqueStream = new UniqueStream(); + state.kind = 'scalar'; + state.result = ''; - return merge2(tasks.map(task => fastGlob.stream(task.pattern, task.options))) - .pipe(filterStream) - .pipe(uniqueStream); -}; + while (ch !== 0) { + ch = state.input.charCodeAt(++state.position); -module.exports.generateGlobTasks = generateGlobTasks; + if (ch === 0x2B/* + */ || ch === 0x2D/* - */) { + if (CHOMPING_CLIP === chomping) { + chomping = (ch === 0x2B/* + */) ? CHOMPING_KEEP : CHOMPING_STRIP; + } else { + throwError(state, 'repeat of a chomping mode identifier'); + } -module.exports.hasMagic = (patterns, options) => [] - .concat(patterns) - .some(pattern => fastGlob.isDynamicPattern(pattern, options)); + } else if ((tmp = fromDecimalCode(ch)) >= 0) { + if (tmp === 0) { + throwError(state, 'bad explicit indentation width of a block scalar; it cannot be less than one'); + } else if (!detectedIndent) { + textIndent = nodeIndent + tmp - 1; + detectedIndent = true; + } else { + throwError(state, 'repeat of an indentation width identifier'); + } -module.exports.gitignore = gitignore; + } else { + break; + } + } + if (is_WHITE_SPACE(ch)) { + do { ch = state.input.charCodeAt(++state.position); } + while (is_WHITE_SPACE(ch)); -/***/ }), + if (ch === 0x23/* # */) { + do { ch = state.input.charCodeAt(++state.position); } + while (!is_EOL(ch) && (ch !== 0)); + } + } -/***/ 57211: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + while (ch !== 0) { + readLineBreak(state); + state.lineIndent = 0; -"use strict"; + ch = state.input.charCodeAt(state.position); -const {Transform} = __nccwpck_require__(2203); + while ((!detectedIndent || state.lineIndent < textIndent) && + (ch === 0x20/* Space */)) { + state.lineIndent++; + ch = state.input.charCodeAt(++state.position); + } -class ObjectTransform extends Transform { - constructor() { - super({ - objectMode: true - }); - } -} + if (!detectedIndent && state.lineIndent > textIndent) { + textIndent = state.lineIndent; + } -class FilterStream extends ObjectTransform { - constructor(filter) { - super(); - this._filter = filter; - } + if (is_EOL(ch)) { + emptyLines++; + continue; + } - _transform(data, encoding, callback) { - if (this._filter(data)) { - this.push(data); - } + // End of the scalar. + if (state.lineIndent < textIndent) { - callback(); - } -} + // Perform the chomping. + if (chomping === CHOMPING_KEEP) { + state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); + } else if (chomping === CHOMPING_CLIP) { + if (didReadContent) { // i.e. only if the scalar is not empty. + state.result += '\n'; + } + } -class UniqueStream extends ObjectTransform { - constructor() { - super(); - this._pushed = new Set(); - } + // Break this `while` cycle and go to the funciton's epilogue. + break; + } - _transform(data, encoding, callback) { - if (!this._pushed.has(data)) { - this.push(data); - this._pushed.add(data); - } + // Folded style: use fancy rules to handle line breaks. + if (folding) { - callback(); - } -} + // Lines starting with white space characters (more-indented lines) are not folded. + if (is_WHITE_SPACE(ch)) { + atMoreIndented = true; + // except for the first content line (cf. Example 8.1) + state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); -module.exports = { - FilterStream, - UniqueStream -}; + // End of more-indented block. + } else if (atMoreIndented) { + atMoreIndented = false; + state.result += common.repeat('\n', emptyLines + 1); + // Just one line break - perceive as the same line. + } else if (emptyLines === 0) { + if (didReadContent) { // i.e. only if we have already read some scalar content. + state.result += ' '; + } -/***/ }), + // Several line breaks - perceive as different lines. + } else { + state.result += common.repeat('\n', emptyLines); + } -/***/ 7472: -/***/ ((module) => { + // Literal style: just add exact number of line breaks between content lines. + } else { + // Keep all line breaks except the header line break. + state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); + } -"use strict"; + didReadContent = true; + detectedIndent = true; + emptyLines = 0; + captureStart = state.position; + while (!is_EOL(ch) && (ch !== 0)) { + ch = state.input.charCodeAt(++state.position); + } -module.exports = clone + captureSegment(state, captureStart, state.position, false); + } -var getPrototypeOf = Object.getPrototypeOf || function (obj) { - return obj.__proto__ + return true; } -function clone (obj) { - if (obj === null || typeof obj !== 'object') - return obj +function readBlockSequence(state, nodeIndent) { + var _line, + _tag = state.tag, + _anchor = state.anchor, + _result = [], + following, + detected = false, + ch; - if (obj instanceof Object) - var copy = { __proto__: getPrototypeOf(obj) } - else - var copy = Object.create(null) + // there is a leading tab before this token, so it can't be a block sequence/mapping; + // it can still be flow sequence/mapping or a scalar + if (state.firstTabInLine !== -1) return false; - Object.getOwnPropertyNames(obj).forEach(function (key) { - Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key)) - }) + if (state.anchor !== null) { + state.anchorMap[state.anchor] = _result; + } - return copy -} + ch = state.input.charCodeAt(state.position); + while (ch !== 0) { + if (state.firstTabInLine !== -1) { + state.position = state.firstTabInLine; + throwError(state, 'tab characters must not be used in indentation'); + } -/***/ }), + if (ch !== 0x2D/* - */) { + break; + } -/***/ 61404: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + following = state.input.charCodeAt(state.position + 1); -var fs = __nccwpck_require__(79896) -var polyfills = __nccwpck_require__(83545) -var legacy = __nccwpck_require__(52674) -var clone = __nccwpck_require__(7472) + if (!is_WS_OR_EOL(following)) { + break; + } -var util = __nccwpck_require__(39023) + detected = true; + state.position++; -/* istanbul ignore next - node 0.x polyfill */ -var gracefulQueue -var previousSymbol + if (skipSeparationSpace(state, true, -1)) { + if (state.lineIndent <= nodeIndent) { + _result.push(null); + ch = state.input.charCodeAt(state.position); + continue; + } + } -/* istanbul ignore else - node 0.x polyfill */ -if (typeof Symbol === 'function' && typeof Symbol.for === 'function') { - gracefulQueue = Symbol.for('graceful-fs.queue') - // This is used in testing by future versions - previousSymbol = Symbol.for('graceful-fs.previous') -} else { - gracefulQueue = '___graceful-fs.queue' - previousSymbol = '___graceful-fs.previous' -} + _line = state.line; + composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true); + _result.push(state.result); + skipSeparationSpace(state, true, -1); -function noop () {} + ch = state.input.charCodeAt(state.position); -function publishQueue(context, queue) { - Object.defineProperty(context, gracefulQueue, { - get: function() { - return queue + if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) { + throwError(state, 'bad indentation of a sequence entry'); + } else if (state.lineIndent < nodeIndent) { + break; } - }) -} + } -var debug = noop -if (util.debuglog) - debug = util.debuglog('gfs4') -else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) - debug = function() { - var m = util.format.apply(util, arguments) - m = 'GFS4: ' + m.split(/\n/).join('\nGFS4: ') - console.error(m) + if (detected) { + state.tag = _tag; + state.anchor = _anchor; + state.kind = 'sequence'; + state.result = _result; + return true; } + return false; +} -// Once time initialization -if (!fs[gracefulQueue]) { - // This queue can be shared by multiple loaded instances - var queue = global[gracefulQueue] || [] - publishQueue(fs, queue) +function readBlockMapping(state, nodeIndent, flowIndent) { + var following, + allowCompact, + _line, + _keyLine, + _keyLineStart, + _keyPos, + _tag = state.tag, + _anchor = state.anchor, + _result = {}, + overridableKeys = Object.create(null), + keyTag = null, + keyNode = null, + valueNode = null, + atExplicitKey = false, + detected = false, + ch; - // Patch fs.close/closeSync to shared queue version, because we need - // to retry() whenever a close happens *anywhere* in the program. - // This is essential when multiple graceful-fs instances are - // in play at the same time. - fs.close = (function (fs$close) { - function close (fd, cb) { - return fs$close.call(fs, fd, function (err) { - // This function uses the graceful-fs shared queue - if (!err) { - resetQueue() - } + // there is a leading tab before this token, so it can't be a block sequence/mapping; + // it can still be flow sequence/mapping or a scalar + if (state.firstTabInLine !== -1) return false; + + if (state.anchor !== null) { + state.anchorMap[state.anchor] = _result; + } - if (typeof cb === 'function') - cb.apply(this, arguments) - }) + ch = state.input.charCodeAt(state.position); + + while (ch !== 0) { + if (!atExplicitKey && state.firstTabInLine !== -1) { + state.position = state.firstTabInLine; + throwError(state, 'tab characters must not be used in indentation'); } - Object.defineProperty(close, previousSymbol, { - value: fs$close - }) - return close - })(fs.close) + following = state.input.charCodeAt(state.position + 1); + _line = state.line; // Save the current line. - fs.closeSync = (function (fs$closeSync) { - function closeSync (fd) { - // This function uses the graceful-fs shared queue - fs$closeSync.apply(fs, arguments) - resetQueue() - } + // + // Explicit notation case. There are two separate blocks: + // first for the key (denoted by "?") and second for the value (denoted by ":") + // + if ((ch === 0x3F/* ? */ || ch === 0x3A/* : */) && is_WS_OR_EOL(following)) { - Object.defineProperty(closeSync, previousSymbol, { - value: fs$closeSync - }) - return closeSync - })(fs.closeSync) + if (ch === 0x3F/* ? */) { + if (atExplicitKey) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos); + keyTag = keyNode = valueNode = null; + } - if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) { - process.on('exit', function() { - debug(fs[gracefulQueue]) - __nccwpck_require__(42613).equal(fs[gracefulQueue].length, 0) - }) - } -} + detected = true; + atExplicitKey = true; + allowCompact = true; -if (!global[gracefulQueue]) { - publishQueue(global, fs[gracefulQueue]); -} + } else if (atExplicitKey) { + // i.e. 0x3A/* : */ === character after the explicit key. + atExplicitKey = false; + allowCompact = true; -module.exports = patch(clone(fs)) -if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) { - module.exports = patch(fs) - fs.__patched = true; -} + } else { + throwError(state, 'incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line'); + } -function patch (fs) { - // Everything that references the open() function needs to be in here - polyfills(fs) - fs.gracefulify = patch + state.position += 1; + ch = following; - fs.createReadStream = createReadStream - fs.createWriteStream = createWriteStream - var fs$readFile = fs.readFile - fs.readFile = readFile - function readFile (path, options, cb) { - if (typeof options === 'function') - cb = options, options = null + // + // Implicit notation case. Flow-style node as the key first, then ":", and the value. + // + } else { + _keyLine = state.line; + _keyLineStart = state.lineStart; + _keyPos = state.position; - return go$readFile(path, options, cb) + if (!composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) { + // Neither implicit nor explicit notation. + // Reading is done. Go to the epilogue. + break; + } - function go$readFile (path, options, cb, startTime) { - return fs$readFile(path, options, function (err) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$readFile, [path, options, cb], err, startTime || Date.now(), Date.now()]) - else { - if (typeof cb === 'function') - cb.apply(this, arguments) + if (state.line === _line) { + ch = state.input.charCodeAt(state.position); + + while (is_WHITE_SPACE(ch)) { + ch = state.input.charCodeAt(++state.position); } - }) - } - } - var fs$writeFile = fs.writeFile - fs.writeFile = writeFile - function writeFile (path, data, options, cb) { - if (typeof options === 'function') - cb = options, options = null + if (ch === 0x3A/* : */) { + ch = state.input.charCodeAt(++state.position); - return go$writeFile(path, data, options, cb) + if (!is_WS_OR_EOL(ch)) { + throwError(state, 'a whitespace character is expected after the key-value separator within a block mapping'); + } - function go$writeFile (path, data, options, cb, startTime) { - return fs$writeFile(path, data, options, function (err) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$writeFile, [path, data, options, cb], err, startTime || Date.now(), Date.now()]) - else { - if (typeof cb === 'function') - cb.apply(this, arguments) - } - }) - } - } + if (atExplicitKey) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos); + keyTag = keyNode = valueNode = null; + } - var fs$appendFile = fs.appendFile - if (fs$appendFile) - fs.appendFile = appendFile - function appendFile (path, data, options, cb) { - if (typeof options === 'function') - cb = options, options = null + detected = true; + atExplicitKey = false; + allowCompact = false; + keyTag = state.tag; + keyNode = state.result; - return go$appendFile(path, data, options, cb) + } else if (detected) { + throwError(state, 'can not read an implicit mapping pair; a colon is missed'); - function go$appendFile (path, data, options, cb, startTime) { - return fs$appendFile(path, data, options, function (err) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$appendFile, [path, data, options, cb], err, startTime || Date.now(), Date.now()]) - else { - if (typeof cb === 'function') - cb.apply(this, arguments) + } else { + state.tag = _tag; + state.anchor = _anchor; + return true; // Keep the result of `composeNode`. } - }) - } - } - var fs$copyFile = fs.copyFile - if (fs$copyFile) - fs.copyFile = copyFile - function copyFile (src, dest, flags, cb) { - if (typeof flags === 'function') { - cb = flags - flags = 0 - } - return go$copyFile(src, dest, flags, cb) + } else if (detected) { + throwError(state, 'can not read a block mapping entry; a multiline key may not be an implicit key'); - function go$copyFile (src, dest, flags, cb, startTime) { - return fs$copyFile(src, dest, flags, function (err) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$copyFile, [src, dest, flags, cb], err, startTime || Date.now(), Date.now()]) - else { - if (typeof cb === 'function') - cb.apply(this, arguments) - } - }) + } else { + state.tag = _tag; + state.anchor = _anchor; + return true; // Keep the result of `composeNode`. + } } - } - - var fs$readdir = fs.readdir - fs.readdir = readdir - var noReaddirOptionVersions = /^v[0-5]\./ - function readdir (path, options, cb) { - if (typeof options === 'function') - cb = options, options = null - var go$readdir = noReaddirOptionVersions.test(process.version) - ? function go$readdir (path, options, cb, startTime) { - return fs$readdir(path, fs$readdirCallback( - path, options, cb, startTime - )) + // + // Common reading code for both explicit and implicit notations. + // + if (state.line === _line || state.lineIndent > nodeIndent) { + if (atExplicitKey) { + _keyLine = state.line; + _keyLineStart = state.lineStart; + _keyPos = state.position; } - : function go$readdir (path, options, cb, startTime) { - return fs$readdir(path, options, fs$readdirCallback( - path, options, cb, startTime - )) + + if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) { + if (atExplicitKey) { + keyNode = state.result; + } else { + valueNode = state.result; + } } - return go$readdir(path, options, cb) + if (!atExplicitKey) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _keyLine, _keyLineStart, _keyPos); + keyTag = keyNode = valueNode = null; + } - function fs$readdirCallback (path, options, cb, startTime) { - return function (err, files) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([ - go$readdir, - [path, options, cb], - err, - startTime || Date.now(), - Date.now() - ]) - else { - if (files && files.sort) - files.sort() + skipSeparationSpace(state, true, -1); + ch = state.input.charCodeAt(state.position); + } - if (typeof cb === 'function') - cb.call(this, err, files) - } - } + if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) { + throwError(state, 'bad indentation of a mapping entry'); + } else if (state.lineIndent < nodeIndent) { + break; } } - if (process.version.substr(0, 4) === 'v0.8') { - var legStreams = legacy(fs) - ReadStream = legStreams.ReadStream - WriteStream = legStreams.WriteStream - } + // + // Epilogue. + // + + // Special case: last mapping's node contains only the key in explicit notation. + if (atExplicitKey) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos); + } + + // Expose the resulting mapping. + if (detected) { + state.tag = _tag; + state.anchor = _anchor; + state.kind = 'mapping'; + state.result = _result; + } + + return detected; +} + +function readTagProperty(state) { + var _position, + isVerbatim = false, + isNamed = false, + tagHandle, + tagName, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch !== 0x21/* ! */) return false; - var fs$ReadStream = fs.ReadStream - if (fs$ReadStream) { - ReadStream.prototype = Object.create(fs$ReadStream.prototype) - ReadStream.prototype.open = ReadStream$open + if (state.tag !== null) { + throwError(state, 'duplication of a tag property'); } - var fs$WriteStream = fs.WriteStream - if (fs$WriteStream) { - WriteStream.prototype = Object.create(fs$WriteStream.prototype) - WriteStream.prototype.open = WriteStream$open - } + ch = state.input.charCodeAt(++state.position); - Object.defineProperty(fs, 'ReadStream', { - get: function () { - return ReadStream - }, - set: function (val) { - ReadStream = val - }, - enumerable: true, - configurable: true - }) - Object.defineProperty(fs, 'WriteStream', { - get: function () { - return WriteStream - }, - set: function (val) { - WriteStream = val - }, - enumerable: true, - configurable: true - }) + if (ch === 0x3C/* < */) { + isVerbatim = true; + ch = state.input.charCodeAt(++state.position); - // legacy names - var FileReadStream = ReadStream - Object.defineProperty(fs, 'FileReadStream', { - get: function () { - return FileReadStream - }, - set: function (val) { - FileReadStream = val - }, - enumerable: true, - configurable: true - }) - var FileWriteStream = WriteStream - Object.defineProperty(fs, 'FileWriteStream', { - get: function () { - return FileWriteStream - }, - set: function (val) { - FileWriteStream = val - }, - enumerable: true, - configurable: true - }) + } else if (ch === 0x21/* ! */) { + isNamed = true; + tagHandle = '!!'; + ch = state.input.charCodeAt(++state.position); - function ReadStream (path, options) { - if (this instanceof ReadStream) - return fs$ReadStream.apply(this, arguments), this - else - return ReadStream.apply(Object.create(ReadStream.prototype), arguments) + } else { + tagHandle = '!'; } - function ReadStream$open () { - var that = this - open(that.path, that.flags, that.mode, function (err, fd) { - if (err) { - if (that.autoClose) - that.destroy() + _position = state.position; - that.emit('error', err) - } else { - that.fd = fd - that.emit('open', fd) - that.read() - } - }) - } + if (isVerbatim) { + do { ch = state.input.charCodeAt(++state.position); } + while (ch !== 0 && ch !== 0x3E/* > */); - function WriteStream (path, options) { - if (this instanceof WriteStream) - return fs$WriteStream.apply(this, arguments), this - else - return WriteStream.apply(Object.create(WriteStream.prototype), arguments) - } + if (state.position < state.length) { + tagName = state.input.slice(_position, state.position); + ch = state.input.charCodeAt(++state.position); + } else { + throwError(state, 'unexpected end of the stream within a verbatim tag'); + } + } else { + while (ch !== 0 && !is_WS_OR_EOL(ch)) { - function WriteStream$open () { - var that = this - open(that.path, that.flags, that.mode, function (err, fd) { - if (err) { - that.destroy() - that.emit('error', err) - } else { - that.fd = fd - that.emit('open', fd) + if (ch === 0x21/* ! */) { + if (!isNamed) { + tagHandle = state.input.slice(_position - 1, state.position + 1); + + if (!PATTERN_TAG_HANDLE.test(tagHandle)) { + throwError(state, 'named tag handle cannot contain such characters'); + } + + isNamed = true; + _position = state.position + 1; + } else { + throwError(state, 'tag suffix cannot contain exclamation marks'); + } } - }) + + ch = state.input.charCodeAt(++state.position); + } + + tagName = state.input.slice(_position, state.position); + + if (PATTERN_FLOW_INDICATORS.test(tagName)) { + throwError(state, 'tag suffix cannot contain flow indicator characters'); + } } - function createReadStream (path, options) { - return new fs.ReadStream(path, options) + if (tagName && !PATTERN_TAG_URI.test(tagName)) { + throwError(state, 'tag name cannot contain such characters: ' + tagName); } - function createWriteStream (path, options) { - return new fs.WriteStream(path, options) + try { + tagName = decodeURIComponent(tagName); + } catch (err) { + throwError(state, 'tag name is malformed: ' + tagName); } - var fs$open = fs.open - fs.open = open - function open (path, flags, mode, cb) { - if (typeof mode === 'function') - cb = mode, mode = null + if (isVerbatim) { + state.tag = tagName; - return go$open(path, flags, mode, cb) + } else if (_hasOwnProperty.call(state.tagMap, tagHandle)) { + state.tag = state.tagMap[tagHandle] + tagName; - function go$open (path, flags, mode, cb, startTime) { - return fs$open(path, flags, mode, function (err, fd) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$open, [path, flags, mode, cb], err, startTime || Date.now(), Date.now()]) - else { - if (typeof cb === 'function') - cb.apply(this, arguments) - } - }) - } + } else if (tagHandle === '!') { + state.tag = '!' + tagName; + + } else if (tagHandle === '!!') { + state.tag = 'tag:yaml.org,2002:' + tagName; + + } else { + throwError(state, 'undeclared tag handle "' + tagHandle + '"'); } - return fs + return true; } -function enqueue (elem) { - debug('ENQUEUE', elem[0].name, elem[1]) - fs[gracefulQueue].push(elem) - retry() -} +function readAnchorProperty(state) { + var _position, + ch; -// keep track of the timeout between retry() calls -var retryTimer + ch = state.input.charCodeAt(state.position); -// reset the startTime and lastTime to now -// this resets the start of the 60 second overall timeout as well as the -// delay between attempts so that we'll retry these jobs sooner -function resetQueue () { - var now = Date.now() - for (var i = 0; i < fs[gracefulQueue].length; ++i) { - // entries that are only a length of 2 are from an older version, don't - // bother modifying those since they'll be retried anyway. - if (fs[gracefulQueue][i].length > 2) { - fs[gracefulQueue][i][3] = now // startTime - fs[gracefulQueue][i][4] = now // lastTime - } - } - // call retry to make sure we're actively processing the queue - retry() -} + if (ch !== 0x26/* & */) return false; -function retry () { - // clear the timer and remove it to help prevent unintended concurrency - clearTimeout(retryTimer) - retryTimer = undefined + if (state.anchor !== null) { + throwError(state, 'duplication of an anchor property'); + } - if (fs[gracefulQueue].length === 0) - return + ch = state.input.charCodeAt(++state.position); + _position = state.position; - var elem = fs[gracefulQueue].shift() - var fn = elem[0] - var args = elem[1] - // these items may be unset if they were added by an older graceful-fs - var err = elem[2] - var startTime = elem[3] - var lastTime = elem[4] + while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { + ch = state.input.charCodeAt(++state.position); + } - // if we don't have a startTime we have no way of knowing if we've waited - // long enough, so go ahead and retry this item now - if (startTime === undefined) { - debug('RETRY', fn.name, args) - fn.apply(null, args) - } else if (Date.now() - startTime >= 60000) { - // it's been more than 60 seconds total, bail now - debug('TIMEOUT', fn.name, args) - var cb = args.pop() - if (typeof cb === 'function') - cb.call(null, err) - } else { - // the amount of time between the last attempt and right now - var sinceAttempt = Date.now() - lastTime - // the amount of time between when we first tried, and when we last tried - // rounded up to at least 1 - var sinceStart = Math.max(lastTime - startTime, 1) - // backoff. wait longer than the total time we've been retrying, but only - // up to a maximum of 100ms - var desiredDelay = Math.min(sinceStart * 1.2, 100) - // it's been long enough since the last retry, do it again - if (sinceAttempt >= desiredDelay) { - debug('RETRY', fn.name, args) - fn.apply(null, args.concat([startTime])) - } else { - // if we can't do this job yet, push it to the end of the queue - // and let the next iteration check again - fs[gracefulQueue].push(elem) - } + if (state.position === _position) { + throwError(state, 'name of an anchor node must contain at least one character'); } - // schedule our next run if one isn't already scheduled - if (retryTimer === undefined) { - retryTimer = setTimeout(retry, 0) - } + state.anchor = state.input.slice(_position, state.position); + return true; } +function readAlias(state) { + var _position, alias, + ch; -/***/ }), - -/***/ 52674: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + ch = state.input.charCodeAt(state.position); -var Stream = (__nccwpck_require__(2203).Stream) + if (ch !== 0x2A/* * */) return false; -module.exports = legacy + ch = state.input.charCodeAt(++state.position); + _position = state.position; -function legacy (fs) { - return { - ReadStream: ReadStream, - WriteStream: WriteStream + while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { + ch = state.input.charCodeAt(++state.position); } - function ReadStream (path, options) { - if (!(this instanceof ReadStream)) return new ReadStream(path, options); + if (state.position === _position) { + throwError(state, 'name of an alias node must contain at least one character'); + } - Stream.call(this); + alias = state.input.slice(_position, state.position); - var self = this; + if (!_hasOwnProperty.call(state.anchorMap, alias)) { + throwError(state, 'unidentified alias "' + alias + '"'); + } - this.path = path; - this.fd = null; - this.readable = true; - this.paused = false; + state.result = state.anchorMap[alias]; + skipSeparationSpace(state, true, -1); + return true; +} - this.flags = 'r'; - this.mode = 438; /*=0666*/ - this.bufferSize = 64 * 1024; +function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) { + var allowBlockStyles, + allowBlockScalars, + allowBlockCollections, + indentStatus = 1, // 1: this>parent, 0: this=parent, -1: this this.end) { - throw new Error('start must be <= end'); + if (state.lineIndent > parentIndent) { + indentStatus = 1; + } else if (state.lineIndent === parentIndent) { + indentStatus = 0; + } else if (state.lineIndent < parentIndent) { + indentStatus = -1; } - - this.pos = this.start; } + } - if (this.fd !== null) { - process.nextTick(function() { - self._read(); - }); - return; - } + if (indentStatus === 1) { + while (readTagProperty(state) || readAnchorProperty(state)) { + if (skipSeparationSpace(state, true, -1)) { + atNewLine = true; + allowBlockCollections = allowBlockStyles; - fs.open(this.path, this.flags, this.mode, function (err, fd) { - if (err) { - self.emit('error', err); - self.readable = false; - return; + if (state.lineIndent > parentIndent) { + indentStatus = 1; + } else if (state.lineIndent === parentIndent) { + indentStatus = 0; + } else if (state.lineIndent < parentIndent) { + indentStatus = -1; + } + } else { + allowBlockCollections = false; } - - self.fd = fd; - self.emit('open', fd); - self._read(); - }) + } } - function WriteStream (path, options) { - if (!(this instanceof WriteStream)) return new WriteStream(path, options); - - Stream.call(this); + if (allowBlockCollections) { + allowBlockCollections = atNewLine || allowCompact; + } - this.path = path; - this.fd = null; - this.writable = true; + if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) { + if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) { + flowIndent = parentIndent; + } else { + flowIndent = parentIndent + 1; + } - this.flags = 'w'; - this.encoding = 'binary'; - this.mode = 438; /*=0666*/ - this.bytesWritten = 0; + blockIndent = state.position - state.lineStart; - options = options || {}; + if (indentStatus === 1) { + if (allowBlockCollections && + (readBlockSequence(state, blockIndent) || + readBlockMapping(state, blockIndent, flowIndent)) || + readFlowCollection(state, flowIndent)) { + hasContent = true; + } else { + if ((allowBlockScalars && readBlockScalar(state, flowIndent)) || + readSingleQuotedScalar(state, flowIndent) || + readDoubleQuotedScalar(state, flowIndent)) { + hasContent = true; - // Mixin options into this - var keys = Object.keys(options); - for (var index = 0, length = keys.length; index < length; index++) { - var key = keys[index]; - this[key] = options[key]; - } + } else if (readAlias(state)) { + hasContent = true; - if (this.start !== undefined) { - if ('number' !== typeof this.start) { - throw TypeError('start must be a Number'); - } - if (this.start < 0) { - throw new Error('start must be >= zero'); - } + if (state.tag !== null || state.anchor !== null) { + throwError(state, 'alias node should not have any properties'); + } - this.pos = this.start; - } + } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) { + hasContent = true; - this.busy = false; - this._queue = []; + if (state.tag === null) { + state.tag = '?'; + } + } - if (this.fd === null) { - this._open = fs.open; - this._queue.push([this._open, this.path, this.flags, this.mode, undefined]); - this.flush(); + if (state.anchor !== null) { + state.anchorMap[state.anchor] = state.result; + } + } + } else if (indentStatus === 0) { + // Special case: block sequences are allowed to have same indentation level as the parent. + // http://www.yaml.org/spec/1.2/spec.html#id2799784 + hasContent = allowBlockCollections && readBlockSequence(state, blockIndent); } } -} - - -/***/ }), - -/***/ 83545: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -var constants = __nccwpck_require__(49140) - -var origCwd = process.cwd -var cwd = null + if (state.tag === null) { + if (state.anchor !== null) { + state.anchorMap[state.anchor] = state.result; + } -var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform + } else if (state.tag === '?') { + // Implicit resolving is not allowed for non-scalar types, and '?' + // non-specific tag is only automatically assigned to plain scalars. + // + // We only need to check kind conformity in case user explicitly assigns '?' + // tag, for example like this: "! [0]" + // + if (state.result !== null && state.kind !== 'scalar') { + throwError(state, 'unacceptable node kind for ! tag; it should be "scalar", not "' + state.kind + '"'); + } -process.cwd = function() { - if (!cwd) - cwd = origCwd.call(process) - return cwd -} -try { - process.cwd() -} catch (er) {} + for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) { + type = state.implicitTypes[typeIndex]; -// This check is needed until node.js 12 is required -if (typeof process.chdir === 'function') { - var chdir = process.chdir - process.chdir = function (d) { - cwd = null - chdir.call(process, d) - } - if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir) -} + if (type.resolve(state.result)) { // `state.result` updated in resolver if matched + state.result = type.construct(state.result); + state.tag = type.tag; + if (state.anchor !== null) { + state.anchorMap[state.anchor] = state.result; + } + break; + } + } + } else if (state.tag !== '!') { + if (_hasOwnProperty.call(state.typeMap[state.kind || 'fallback'], state.tag)) { + type = state.typeMap[state.kind || 'fallback'][state.tag]; + } else { + // looking for multi type + type = null; + typeList = state.typeMap.multi[state.kind || 'fallback']; -module.exports = patch + for (typeIndex = 0, typeQuantity = typeList.length; typeIndex < typeQuantity; typeIndex += 1) { + if (state.tag.slice(0, typeList[typeIndex].tag.length) === typeList[typeIndex].tag) { + type = typeList[typeIndex]; + break; + } + } + } -function patch (fs) { - // (re-)implement some things that are known busted or missing. + if (!type) { + throwError(state, 'unknown tag !<' + state.tag + '>'); + } - // lchmod, broken prior to 0.6.2 - // back-port the fix here. - if (constants.hasOwnProperty('O_SYMLINK') && - process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) { - patchLchmod(fs) - } + if (state.result !== null && type.kind !== state.kind) { + throwError(state, 'unacceptable node kind for !<' + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"'); + } - // lutimes implementation, or no-op - if (!fs.lutimes) { - patchLutimes(fs) + if (!type.resolve(state.result, state.tag)) { // `state.result` updated in resolver if matched + throwError(state, 'cannot resolve a node with !<' + state.tag + '> explicit tag'); + } else { + state.result = type.construct(state.result, state.tag); + if (state.anchor !== null) { + state.anchorMap[state.anchor] = state.result; + } + } } - // https://github.com/isaacs/node-graceful-fs/issues/4 - // Chown should not fail on einval or eperm if non-root. - // It should not fail on enosys ever, as this just indicates - // that a fs doesn't support the intended operation. + if (state.listener !== null) { + state.listener('close', state); + } + return state.tag !== null || state.anchor !== null || hasContent; +} - fs.chown = chownFix(fs.chown) - fs.fchown = chownFix(fs.fchown) - fs.lchown = chownFix(fs.lchown) +function readDocument(state) { + var documentStart = state.position, + _position, + directiveName, + directiveArgs, + hasDirectives = false, + ch; - fs.chmod = chmodFix(fs.chmod) - fs.fchmod = chmodFix(fs.fchmod) - fs.lchmod = chmodFix(fs.lchmod) + state.version = null; + state.checkLineBreaks = state.legacy; + state.tagMap = Object.create(null); + state.anchorMap = Object.create(null); - fs.chownSync = chownFixSync(fs.chownSync) - fs.fchownSync = chownFixSync(fs.fchownSync) - fs.lchownSync = chownFixSync(fs.lchownSync) + while ((ch = state.input.charCodeAt(state.position)) !== 0) { + skipSeparationSpace(state, true, -1); - fs.chmodSync = chmodFixSync(fs.chmodSync) - fs.fchmodSync = chmodFixSync(fs.fchmodSync) - fs.lchmodSync = chmodFixSync(fs.lchmodSync) + ch = state.input.charCodeAt(state.position); - fs.stat = statFix(fs.stat) - fs.fstat = statFix(fs.fstat) - fs.lstat = statFix(fs.lstat) + if (state.lineIndent > 0 || ch !== 0x25/* % */) { + break; + } - fs.statSync = statFixSync(fs.statSync) - fs.fstatSync = statFixSync(fs.fstatSync) - fs.lstatSync = statFixSync(fs.lstatSync) + hasDirectives = true; + ch = state.input.charCodeAt(++state.position); + _position = state.position; - // if lchmod/lchown do not exist, then make them no-ops - if (fs.chmod && !fs.lchmod) { - fs.lchmod = function (path, mode, cb) { - if (cb) process.nextTick(cb) - } - fs.lchmodSync = function () {} - } - if (fs.chown && !fs.lchown) { - fs.lchown = function (path, uid, gid, cb) { - if (cb) process.nextTick(cb) + while (ch !== 0 && !is_WS_OR_EOL(ch)) { + ch = state.input.charCodeAt(++state.position); } - fs.lchownSync = function () {} - } - // on Windows, A/V software can lock the directory, causing this - // to fail with an EACCES or EPERM if the directory contains newly - // created files. Try again on failure, for up to 60 seconds. + directiveName = state.input.slice(_position, state.position); + directiveArgs = []; - // Set the timeout this long because some Windows Anti-Virus, such as Parity - // bit9, may lock files for up to a minute, causing npm package install - // failures. Also, take care to yield the scheduler. Windows scheduling gives - // CPU to a busy looping process, which can cause the program causing the lock - // contention to be starved of CPU by node, so the contention doesn't resolve. - if (platform === "win32") { - fs.rename = typeof fs.rename !== 'function' ? fs.rename - : (function (fs$rename) { - function rename (from, to, cb) { - var start = Date.now() - var backoff = 0; - fs$rename(from, to, function CB (er) { - if (er - && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") - && Date.now() - start < 60000) { - setTimeout(function() { - fs.stat(to, function (stater, st) { - if (stater && stater.code === "ENOENT") - fs$rename(from, to, CB); - else - cb(er) - }) - }, backoff) - if (backoff < 100) - backoff += 10; - return; - } - if (cb) cb(er) - }) + if (directiveName.length < 1) { + throwError(state, 'directive name must not be less than one character in length'); + } + + while (ch !== 0) { + while (is_WHITE_SPACE(ch)) { + ch = state.input.charCodeAt(++state.position); } - if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename) - return rename - })(fs.rename) - } - // if read() returns EAGAIN, then just try it again. - fs.read = typeof fs.read !== 'function' ? fs.read - : (function (fs$read) { - function read (fd, buffer, offset, length, position, callback_) { - var callback - if (callback_ && typeof callback_ === 'function') { - var eagCounter = 0 - callback = function (er, _, __) { - if (er && er.code === 'EAGAIN' && eagCounter < 10) { - eagCounter ++ - return fs$read.call(fs, fd, buffer, offset, length, position, callback) - } - callback_.apply(this, arguments) - } + if (ch === 0x23/* # */) { + do { ch = state.input.charCodeAt(++state.position); } + while (ch !== 0 && !is_EOL(ch)); + break; } - return fs$read.call(fs, fd, buffer, offset, length, position, callback) - } - // This ensures `util.promisify` works as it does for native `fs.read`. - if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read) - return read - })(fs.read) + if (is_EOL(ch)) break; - fs.readSync = typeof fs.readSync !== 'function' ? fs.readSync - : (function (fs$readSync) { return function (fd, buffer, offset, length, position) { - var eagCounter = 0 - while (true) { - try { - return fs$readSync.call(fs, fd, buffer, offset, length, position) - } catch (er) { - if (er.code === 'EAGAIN' && eagCounter < 10) { - eagCounter ++ - continue - } - throw er + _position = state.position; + + while (ch !== 0 && !is_WS_OR_EOL(ch)) { + ch = state.input.charCodeAt(++state.position); } - } - }})(fs.readSync) - function patchLchmod (fs) { - fs.lchmod = function (path, mode, callback) { - fs.open( path - , constants.O_WRONLY | constants.O_SYMLINK - , mode - , function (err, fd) { - if (err) { - if (callback) callback(err) - return - } - // prefer to return the chmod error, if one occurs, - // but still try to close, and report closing errors if they occur. - fs.fchmod(fd, mode, function (err) { - fs.close(fd, function(err2) { - if (callback) callback(err || err2) - }) - }) - }) + directiveArgs.push(state.input.slice(_position, state.position)); } - fs.lchmodSync = function (path, mode) { - var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode) + if (ch !== 0) readLineBreak(state); - // prefer to return the chmod error, if one occurs, - // but still try to close, and report closing errors if they occur. - var threw = true - var ret - try { - ret = fs.fchmodSync(fd, mode) - threw = false - } finally { - if (threw) { - try { - fs.closeSync(fd) - } catch (er) {} - } else { - fs.closeSync(fd) - } - } - return ret + if (_hasOwnProperty.call(directiveHandlers, directiveName)) { + directiveHandlers[directiveName](state, directiveName, directiveArgs); + } else { + throwWarning(state, 'unknown document directive "' + directiveName + '"'); } } - function patchLutimes (fs) { - if (constants.hasOwnProperty("O_SYMLINK") && fs.futimes) { - fs.lutimes = function (path, at, mt, cb) { - fs.open(path, constants.O_SYMLINK, function (er, fd) { - if (er) { - if (cb) cb(er) - return - } - fs.futimes(fd, at, mt, function (er) { - fs.close(fd, function (er2) { - if (cb) cb(er || er2) - }) - }) - }) - } + skipSeparationSpace(state, true, -1); - fs.lutimesSync = function (path, at, mt) { - var fd = fs.openSync(path, constants.O_SYMLINK) - var ret - var threw = true - try { - ret = fs.futimesSync(fd, at, mt) - threw = false - } finally { - if (threw) { - try { - fs.closeSync(fd) - } catch (er) {} - } else { - fs.closeSync(fd) - } - } - return ret - } + if (state.lineIndent === 0 && + state.input.charCodeAt(state.position) === 0x2D/* - */ && + state.input.charCodeAt(state.position + 1) === 0x2D/* - */ && + state.input.charCodeAt(state.position + 2) === 0x2D/* - */) { + state.position += 3; + skipSeparationSpace(state, true, -1); + + } else if (hasDirectives) { + throwError(state, 'directives end mark is expected'); + } + + composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true); + skipSeparationSpace(state, true, -1); + + if (state.checkLineBreaks && + PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) { + throwWarning(state, 'non-ASCII line breaks are interpreted as content'); + } + + state.documents.push(state.result); - } else if (fs.futimes) { - fs.lutimes = function (_a, _b, _c, cb) { if (cb) process.nextTick(cb) } - fs.lutimesSync = function () {} + if (state.position === state.lineStart && testDocumentSeparator(state)) { + + if (state.input.charCodeAt(state.position) === 0x2E/* . */) { + state.position += 3; + skipSeparationSpace(state, true, -1); } + return; } - function chmodFix (orig) { - if (!orig) return orig - return function (target, mode, cb) { - return orig.call(fs, target, mode, function (er) { - if (chownErOk(er)) er = null - if (cb) cb.apply(this, arguments) - }) - } + if (state.position < (state.length - 1)) { + throwError(state, 'end of the stream or a document separator is expected'); + } else { + return; } +} - function chmodFixSync (orig) { - if (!orig) return orig - return function (target, mode) { - try { - return orig.call(fs, target, mode) - } catch (er) { - if (!chownErOk(er)) throw er - } + +function loadDocuments(input, options) { + input = String(input); + options = options || {}; + + if (input.length !== 0) { + + // Add tailing `\n` if not exists + if (input.charCodeAt(input.length - 1) !== 0x0A/* LF */ && + input.charCodeAt(input.length - 1) !== 0x0D/* CR */) { + input += '\n'; + } + + // Strip BOM + if (input.charCodeAt(0) === 0xFEFF) { + input = input.slice(1); } } + var state = new State(input, options); + + var nullpos = input.indexOf('\0'); - function chownFix (orig) { - if (!orig) return orig - return function (target, uid, gid, cb) { - return orig.call(fs, target, uid, gid, function (er) { - if (chownErOk(er)) er = null - if (cb) cb.apply(this, arguments) - }) - } + if (nullpos !== -1) { + state.position = nullpos; + throwError(state, 'null byte is not allowed in input'); } - function chownFixSync (orig) { - if (!orig) return orig - return function (target, uid, gid) { - try { - return orig.call(fs, target, uid, gid) - } catch (er) { - if (!chownErOk(er)) throw er - } - } + // Use 0 as string terminator. That significantly simplifies bounds check. + state.input += '\0'; + + while (state.input.charCodeAt(state.position) === 0x20/* Space */) { + state.lineIndent += 1; + state.position += 1; } - function statFix (orig) { - if (!orig) return orig - // Older versions of Node erroneously returned signed integers for - // uid + gid. - return function (target, options, cb) { - if (typeof options === 'function') { - cb = options - options = null - } - function callback (er, stats) { - if (stats) { - if (stats.uid < 0) stats.uid += 0x100000000 - if (stats.gid < 0) stats.gid += 0x100000000 - } - if (cb) cb.apply(this, arguments) - } - return options ? orig.call(fs, target, options, callback) - : orig.call(fs, target, callback) - } + while (state.position < (state.length - 1)) { + readDocument(state); } - function statFixSync (orig) { - if (!orig) return orig - // Older versions of Node erroneously returned signed integers for - // uid + gid. - return function (target, options) { - var stats = options ? orig.call(fs, target, options) - : orig.call(fs, target) - if (stats) { - if (stats.uid < 0) stats.uid += 0x100000000 - if (stats.gid < 0) stats.gid += 0x100000000 - } - return stats; - } + return state.documents; +} + + +function loadAll(input, iterator, options) { + if (iterator !== null && typeof iterator === 'object' && typeof options === 'undefined') { + options = iterator; + iterator = null; } - // ENOSYS means that the fs doesn't support the op. Just ignore - // that, because it doesn't matter. - // - // if there's no getuid, or if getuid() is something other - // than 0, and the error is EINVAL or EPERM, then just ignore - // it. - // - // This specific case is a silent failure in cp, install, tar, - // and most other unix tools that manage permissions. - // - // When running as root, or if other types of errors are - // encountered, then it's strict. - function chownErOk (er) { - if (!er) - return true + var documents = loadDocuments(input, options); - if (er.code === "ENOSYS") - return true + if (typeof iterator !== 'function') { + return documents; + } - var nonroot = !process.getuid || process.getuid() !== 0 - if (nonroot) { - if (er.code === "EINVAL" || er.code === "EPERM") - return true - } + for (var index = 0, length = documents.length; index < length; index += 1) { + iterator(documents[index]); + } +} - return false + +function load(input, options) { + var documents = loadDocuments(input, options); + + if (documents.length === 0) { + /*eslint-disable no-undefined*/ + return undefined; + } else if (documents.length === 1) { + return documents[0]; } + throw new YAMLException('expected a single document in the stream, but found more'); } +module.exports.loadAll = loadAll; +module.exports.load = load; + + /***/ }), -/***/ 73456: -/***/ ((__unused_webpack_module, exports) => { +/***/ 59610: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -Object.defineProperty(exports, "__esModule", ({value:true}));exports.SIGNALS=void 0; -const SIGNALS=[ -{ -name:"SIGHUP", -number:1, -action:"terminate", -description:"Terminal closed", -standard:"posix"}, -{ -name:"SIGINT", -number:2, -action:"terminate", -description:"User interruption with CTRL-C", -standard:"ansi"}, +/*eslint-disable max-len*/ -{ -name:"SIGQUIT", -number:3, -action:"core", -description:"User interruption with CTRL-\\", -standard:"posix"}, +var YAMLException = __nccwpck_require__(2828); +var Type = __nccwpck_require__(1089); -{ -name:"SIGILL", -number:4, -action:"core", -description:"Invalid machine instruction", -standard:"ansi"}, -{ -name:"SIGTRAP", -number:5, -action:"core", -description:"Debugger breakpoint", -standard:"posix"}, +function compileList(schema, name) { + var result = []; -{ -name:"SIGABRT", -number:6, -action:"core", -description:"Aborted", -standard:"ansi"}, + schema[name].forEach(function (currentType) { + var newIndex = result.length; -{ -name:"SIGIOT", -number:6, -action:"core", -description:"Aborted", -standard:"bsd"}, + result.forEach(function (previousType, previousIndex) { + if (previousType.tag === currentType.tag && + previousType.kind === currentType.kind && + previousType.multi === currentType.multi) { -{ -name:"SIGBUS", -number:7, -action:"core", -description: -"Bus error due to misaligned, non-existing address or paging error", -standard:"bsd"}, + newIndex = previousIndex; + } + }); -{ -name:"SIGEMT", -number:7, -action:"terminate", -description:"Command should be emulated but is not implemented", -standard:"other"}, + result[newIndex] = currentType; + }); -{ -name:"SIGFPE", -number:8, -action:"core", -description:"Floating point arithmetic error", -standard:"ansi"}, + return result; +} -{ -name:"SIGKILL", -number:9, -action:"terminate", -description:"Forced termination", -standard:"posix", -forced:true}, -{ -name:"SIGUSR1", -number:10, -action:"terminate", -description:"Application-specific signal", -standard:"posix"}, +function compileMap(/* lists... */) { + var result = { + scalar: {}, + sequence: {}, + mapping: {}, + fallback: {}, + multi: { + scalar: [], + sequence: [], + mapping: [], + fallback: [] + } + }, index, length; + + function collectType(type) { + if (type.multi) { + result.multi[type.kind].push(type); + result.multi['fallback'].push(type); + } else { + result[type.kind][type.tag] = result['fallback'][type.tag] = type; + } + } + + for (index = 0, length = arguments.length; index < length; index += 1) { + arguments[index].forEach(collectType); + } + return result; +} + -{ -name:"SIGSEGV", -number:11, -action:"core", -description:"Segmentation fault", -standard:"ansi"}, +function Schema(definition) { + return this.extend(definition); +} -{ -name:"SIGUSR2", -number:12, -action:"terminate", -description:"Application-specific signal", -standard:"posix"}, -{ -name:"SIGPIPE", -number:13, -action:"terminate", -description:"Broken pipe or socket", -standard:"posix"}, +Schema.prototype.extend = function extend(definition) { + var implicit = []; + var explicit = []; -{ -name:"SIGALRM", -number:14, -action:"terminate", -description:"Timeout or timer", -standard:"posix"}, + if (definition instanceof Type) { + // Schema.extend(type) + explicit.push(definition); -{ -name:"SIGTERM", -number:15, -action:"terminate", -description:"Termination", -standard:"ansi"}, + } else if (Array.isArray(definition)) { + // Schema.extend([ type1, type2, ... ]) + explicit = explicit.concat(definition); -{ -name:"SIGSTKFLT", -number:16, -action:"terminate", -description:"Stack is empty or overflowed", -standard:"other"}, + } else if (definition && (Array.isArray(definition.implicit) || Array.isArray(definition.explicit))) { + // Schema.extend({ explicit: [ type1, type2, ... ], implicit: [ type1, type2, ... ] }) + if (definition.implicit) implicit = implicit.concat(definition.implicit); + if (definition.explicit) explicit = explicit.concat(definition.explicit); -{ -name:"SIGCHLD", -number:17, -action:"ignore", -description:"Child process terminated, paused or unpaused", -standard:"posix"}, + } else { + throw new YAMLException('Schema.extend argument should be a Type, [ Type ], ' + + 'or a schema definition ({ implicit: [...], explicit: [...] })'); + } -{ -name:"SIGCLD", -number:17, -action:"ignore", -description:"Child process terminated, paused or unpaused", -standard:"other"}, + implicit.forEach(function (type) { + if (!(type instanceof Type)) { + throw new YAMLException('Specified list of YAML types (or a single Type object) contains a non-Type object.'); + } -{ -name:"SIGCONT", -number:18, -action:"unpause", -description:"Unpaused", -standard:"posix", -forced:true}, + if (type.loadKind && type.loadKind !== 'scalar') { + throw new YAMLException('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.'); + } -{ -name:"SIGSTOP", -number:19, -action:"pause", -description:"Paused", -standard:"posix", -forced:true}, + if (type.multi) { + throw new YAMLException('There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.'); + } + }); -{ -name:"SIGTSTP", -number:20, -action:"pause", -description:"Paused using CTRL-Z or \"suspend\"", -standard:"posix"}, + explicit.forEach(function (type) { + if (!(type instanceof Type)) { + throw new YAMLException('Specified list of YAML types (or a single Type object) contains a non-Type object.'); + } + }); -{ -name:"SIGTTIN", -number:21, -action:"pause", -description:"Background process cannot read terminal input", -standard:"posix"}, + var result = Object.create(Schema.prototype); -{ -name:"SIGBREAK", -number:21, -action:"terminate", -description:"User interruption with CTRL-BREAK", -standard:"other"}, + result.implicit = (this.implicit || []).concat(implicit); + result.explicit = (this.explicit || []).concat(explicit); -{ -name:"SIGTTOU", -number:22, -action:"pause", -description:"Background process cannot write to terminal output", -standard:"posix"}, + result.compiledImplicit = compileList(result, 'implicit'); + result.compiledExplicit = compileList(result, 'explicit'); + result.compiledTypeMap = compileMap(result.compiledImplicit, result.compiledExplicit); -{ -name:"SIGURG", -number:23, -action:"ignore", -description:"Socket received out-of-band data", -standard:"bsd"}, + return result; +}; -{ -name:"SIGXCPU", -number:24, -action:"core", -description:"Process timed out", -standard:"bsd"}, -{ -name:"SIGXFSZ", -number:25, -action:"core", -description:"File too big", -standard:"bsd"}, +module.exports = Schema; -{ -name:"SIGVTALRM", -number:26, -action:"terminate", -description:"Timeout or timer", -standard:"bsd"}, -{ -name:"SIGPROF", -number:27, -action:"terminate", -description:"Timeout or timer", -standard:"bsd"}, +/***/ }), -{ -name:"SIGWINCH", -number:28, -action:"ignore", -description:"Terminal window size changed", -standard:"bsd"}, +/***/ 52254: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -{ -name:"SIGIO", -number:29, -action:"terminate", -description:"I/O is available", -standard:"other"}, +"use strict"; +// Standard YAML's Core schema. +// http://www.yaml.org/spec/1.2/spec.html#id2804923 +// +// NOTE: JS-YAML does not support schema-specific tag resolution restrictions. +// So, Core schema has no distinctions from JSON schema is JS-YAML. -{ -name:"SIGPOLL", -number:29, -action:"terminate", -description:"Watched event", -standard:"other"}, -{ -name:"SIGINFO", -number:29, -action:"ignore", -description:"Request for process information", -standard:"other"}, -{ -name:"SIGPWR", -number:30, -action:"terminate", -description:"Device running out of power", -standard:"systemv"}, -{ -name:"SIGSYS", -number:31, -action:"core", -description:"Invalid system call", -standard:"other"}, -{ -name:"SIGUNUSED", -number:31, -action:"terminate", -description:"Invalid system call", -standard:"other"}];exports.SIGNALS=SIGNALS; -//# sourceMappingURL=core.js.map +module.exports = __nccwpck_require__(98971); + /***/ }), -/***/ 76594: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ 7436: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -Object.defineProperty(exports, "__esModule", ({value:true}));exports.signalsByNumber=exports.signalsByName=void 0;var _os=__nccwpck_require__(70857); +// JS-YAML's default schema for `safeLoad` function. +// It is not described in the YAML specification. +// +// This schema is based on standard YAML's Core schema and includes most of +// extra types described at YAML tag repository. (http://yaml.org/type/) -var _signals=__nccwpck_require__(5690); -var _realtime=__nccwpck_require__(86946); -const getSignalsByName=function(){ -const signals=(0,_signals.getSignals)(); -return signals.reduce(getSignalByName,{}); -}; -const getSignalByName=function( -signalByNameMemo, -{name,number,description,supported,action,forced,standard}) -{ -return{ -...signalByNameMemo, -[name]:{name,number,description,supported,action,forced,standard}}; +module.exports = (__nccwpck_require__(52254).extend)({ + implicit: [ + __nccwpck_require__(35298), + __nccwpck_require__(70954) + ], + explicit: [ + __nccwpck_require__(1113), + __nccwpck_require__(28677), + __nccwpck_require__(33884), + __nccwpck_require__(25098) + ] +}); -}; -const signalsByName=getSignalsByName();exports.signalsByName=signalsByName; +/***/ }), +/***/ 82420: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +"use strict"; +// Standard YAML's Failsafe schema. +// http://www.yaml.org/spec/1.2/spec.html#id2802346 -const getSignalsByNumber=function(){ -const signals=(0,_signals.getSignals)(); -const length=_realtime.SIGRTMAX+1; -const signalsA=Array.from({length},(value,number)=> -getSignalByNumber(number,signals)); -return Object.assign({},...signalsA); -}; -const getSignalByNumber=function(number,signals){ -const signal=findSignalByNumber(number,signals); -if(signal===undefined){ -return{}; -} +var Schema = __nccwpck_require__(59610); + + +module.exports = new Schema({ + explicit: [ + __nccwpck_require__(41845), + __nccwpck_require__(43733), + __nccwpck_require__(88432) + ] +}); -const{name,description,supported,action,forced,standard}=signal; -return{ -[number]:{ -name, -number, -description, -supported, -action, -forced, -standard}}; +/***/ }), -}; +/***/ 98971: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +"use strict"; +// Standard YAML's JSON schema. +// http://www.yaml.org/spec/1.2/spec.html#id2803231 +// +// NOTE: JS-YAML does not support schema-specific tag resolution restrictions. +// So, this schema is not such strict as defined in the YAML specification. +// It allows numbers in binary notaion, use `Null` and `NULL` as `null`, etc. -const findSignalByNumber=function(number,signals){ -const signal=signals.find(({name})=>_os.constants.signals[name]===number); -if(signal!==undefined){ -return signal; -} -return signals.find(signalA=>signalA.number===number); -}; -const signalsByNumber=getSignalsByNumber();exports.signalsByNumber=signalsByNumber; -//# sourceMappingURL=main.js.map +module.exports = (__nccwpck_require__(82420).extend)({ + implicit: [ + __nccwpck_require__(77177), + __nccwpck_require__(97300), + __nccwpck_require__(99491), + __nccwpck_require__(83492) + ] +}); + /***/ }), -/***/ 86946: -/***/ ((__unused_webpack_module, exports) => { +/***/ 50732: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -Object.defineProperty(exports, "__esModule", ({value:true}));exports.SIGRTMAX=exports.getRealtimeSignals=void 0; -const getRealtimeSignals=function(){ -const length=SIGRTMAX-SIGRTMIN+1; -return Array.from({length},getRealtimeSignal); -};exports.getRealtimeSignals=getRealtimeSignals; -const getRealtimeSignal=function(value,index){ -return{ -name:`SIGRT${index+1}`, -number:SIGRTMIN+index, -action:"terminate", -description:"Application-specific signal (realtime)", -standard:"posix"}; -}; -const SIGRTMIN=34; -const SIGRTMAX=64;exports.SIGRTMAX=SIGRTMAX; -//# sourceMappingURL=realtime.js.map +var common = __nccwpck_require__(23324); -/***/ }), -/***/ 5690: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +// get snippet for a single line, respecting maxLength +function getLine(buffer, lineStart, lineEnd, position, maxLineLength) { + var head = ''; + var tail = ''; + var maxHalfLength = Math.floor(maxLineLength / 2) - 1; -"use strict"; -Object.defineProperty(exports, "__esModule", ({value:true}));exports.getSignals=void 0;var _os=__nccwpck_require__(70857); + if (position - lineStart > maxHalfLength) { + head = ' ... '; + lineStart = position - maxHalfLength + head.length; + } -var _core=__nccwpck_require__(73456); -var _realtime=__nccwpck_require__(86946); + if (lineEnd - position > maxHalfLength) { + tail = ' ...'; + lineEnd = position + maxHalfLength - tail.length; + } + return { + str: head + buffer.slice(lineStart, lineEnd).replace(/\t/g, '→') + tail, + pos: position - lineStart + head.length // relative position + }; +} -const getSignals=function(){ -const realtimeSignals=(0,_realtime.getRealtimeSignals)(); -const signals=[..._core.SIGNALS,...realtimeSignals].map(normalizeSignal); -return signals; -};exports.getSignals=getSignals; +function padStart(string, max) { + return common.repeat(' ', max - string.length) + string; +} +function makeSnippet(mark, options) { + options = Object.create(options || null); + if (!mark.buffer) return null; + if (!options.maxLength) options.maxLength = 79; + if (typeof options.indent !== 'number') options.indent = 1; + if (typeof options.linesBefore !== 'number') options.linesBefore = 3; + if (typeof options.linesAfter !== 'number') options.linesAfter = 2; + var re = /\r?\n|\r|\0/g; + var lineStarts = [ 0 ]; + var lineEnds = []; + var match; + var foundLineNo = -1; + while ((match = re.exec(mark.buffer))) { + lineEnds.push(match.index); + lineStarts.push(match.index + match[0].length); -const normalizeSignal=function({ -name, -number:defaultNumber, -description, -action, -forced=false, -standard}) -{ -const{ -signals:{[name]:constantSignal}}= -_os.constants; -const supported=constantSignal!==undefined; -const number=supported?constantSignal:defaultNumber; -return{name,number,description,supported,action,forced,standard}; -}; -//# sourceMappingURL=signals.js.map + if (mark.position <= match.index && foundLineNo < 0) { + foundLineNo = lineStarts.length - 2; + } + } -/***/ }), + if (foundLineNo < 0) foundLineNo = lineStarts.length - 1; -/***/ 64134: -/***/ ((module) => { + var result = '', i, line; + var lineNoLength = Math.min(mark.line + options.linesAfter, lineEnds.length).toString().length; + var maxLineLength = options.maxLength - (options.indent + lineNoLength + 3); -// A simple implementation of make-array -function makeArray (subject) { - return Array.isArray(subject) - ? subject - : [subject] + for (i = 1; i <= options.linesBefore; i++) { + if (foundLineNo - i < 0) break; + line = getLine( + mark.buffer, + lineStarts[foundLineNo - i], + lineEnds[foundLineNo - i], + mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i]), + maxLineLength + ); + result = common.repeat(' ', options.indent) + padStart((mark.line - i + 1).toString(), lineNoLength) + + ' | ' + line.str + '\n' + result; + } + + line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength); + result += common.repeat(' ', options.indent) + padStart((mark.line + 1).toString(), lineNoLength) + + ' | ' + line.str + '\n'; + result += common.repeat('-', options.indent + lineNoLength + 3 + line.pos) + '^' + '\n'; + + for (i = 1; i <= options.linesAfter; i++) { + if (foundLineNo + i >= lineEnds.length) break; + line = getLine( + mark.buffer, + lineStarts[foundLineNo + i], + lineEnds[foundLineNo + i], + mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i]), + maxLineLength + ); + result += common.repeat(' ', options.indent) + padStart((mark.line + i + 1).toString(), lineNoLength) + + ' | ' + line.str + '\n'; + } + + return result.replace(/\n$/, ''); } -const EMPTY = '' -const SPACE = ' ' -const ESCAPE = '\\' -const REGEX_TEST_BLANK_LINE = /^\s+$/ -const REGEX_INVALID_TRAILING_BACKSLASH = /(?:[^\\]|^)\\$/ -const REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION = /^\\!/ -const REGEX_REPLACE_LEADING_EXCAPED_HASH = /^\\#/ -const REGEX_SPLITALL_CRLF = /\r?\n/g -// /foo, -// ./foo, -// ../foo, -// . -// .. -const REGEX_TEST_INVALID_PATH = /^\.*\/|^\.+$/ -const SLASH = '/' +module.exports = makeSnippet; -// Do not use ternary expression here, since "istanbul ignore next" is buggy -let TMP_KEY_IGNORE = 'node-ignore' -/* istanbul ignore else */ -if (typeof Symbol !== 'undefined') { - TMP_KEY_IGNORE = Symbol.for('node-ignore') -} -const KEY_IGNORE = TMP_KEY_IGNORE -const define = (object, key, value) => - Object.defineProperty(object, key, {value}) +/***/ }), -const REGEX_REGEXP_RANGE = /([0-z])-([0-z])/g +/***/ 1089: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const RETURN_FALSE = () => false +"use strict"; -// Sanitize the range of a regular expression -// The cases are complicated, see test cases for details -const sanitizeRange = range => range.replace( - REGEX_REGEXP_RANGE, - (match, from, to) => from.charCodeAt(0) <= to.charCodeAt(0) - ? match - // Invalid range (out of order) which is ok for gitignore rules but - // fatal for JavaScript regular expression, so eliminate it. - : EMPTY -) -// See fixtures #59 -const cleanRangeBackSlash = slashes => { - const {length} = slashes - return slashes.slice(0, length - length % 2) -} +var YAMLException = __nccwpck_require__(2828); -// > If the pattern ends with a slash, -// > it is removed for the purpose of the following description, -// > but it would only find a match with a directory. -// > In other words, foo/ will match a directory foo and paths underneath it, -// > but will not match a regular file or a symbolic link foo -// > (this is consistent with the way how pathspec works in general in Git). -// '`foo/`' will not match regular file '`foo`' or symbolic link '`foo`' -// -> ignore-rules will not deal with it, because it costs extra `fs.stat` call -// you could use option `mark: true` with `glob` +var TYPE_CONSTRUCTOR_OPTIONS = [ + 'kind', + 'multi', + 'resolve', + 'construct', + 'instanceOf', + 'predicate', + 'represent', + 'representName', + 'defaultStyle', + 'styleAliases' +]; -// '`foo/`' should not continue with the '`..`' -const REPLACERS = [ +var YAML_NODE_KINDS = [ + 'scalar', + 'sequence', + 'mapping' +]; - [ - // remove BOM - // TODO: - // Other similar zero-width characters? - /^\uFEFF/, - () => EMPTY - ], +function compileStyleAliases(map) { + var result = {}; - // > Trailing spaces are ignored unless they are quoted with backslash ("\") - [ - // (a\ ) -> (a ) - // (a ) -> (a) - // (a ) -> (a) - // (a \ ) -> (a ) - /((?:\\\\)*?)(\\?\s+)$/, - (_, m1, m2) => m1 + ( - m2.indexOf('\\') === 0 - ? SPACE - : EMPTY - ) - ], + if (map !== null) { + Object.keys(map).forEach(function (style) { + map[style].forEach(function (alias) { + result[String(alias)] = style; + }); + }); + } - // replace (\ ) with ' ' - // (\ ) -> ' ' - // (\\ ) -> '\\ ' - // (\\\ ) -> '\\ ' - [ - /(\\+?)\s/g, - (_, m1) => { - const {length} = m1 - return m1.slice(0, length - length % 2) + SPACE + return result; +} + +function Type(tag, options) { + options = options || {}; + + Object.keys(options).forEach(function (name) { + if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) { + throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.'); } - ], + }); - // Escape metacharacters - // which is written down by users but means special for regular expressions. + // TODO: Add tag format check. + this.options = options; // keep original options in case user wants to extend this type later + this.tag = tag; + this.kind = options['kind'] || null; + this.resolve = options['resolve'] || function () { return true; }; + this.construct = options['construct'] || function (data) { return data; }; + this.instanceOf = options['instanceOf'] || null; + this.predicate = options['predicate'] || null; + this.represent = options['represent'] || null; + this.representName = options['representName'] || null; + this.defaultStyle = options['defaultStyle'] || null; + this.multi = options['multi'] || false; + this.styleAliases = compileStyleAliases(options['styleAliases'] || null); - // > There are 12 characters with special meanings: - // > - the backslash \, - // > - the caret ^, - // > - the dollar sign $, - // > - the period or dot ., - // > - the vertical bar or pipe symbol |, - // > - the question mark ?, - // > - the asterisk or star *, - // > - the plus sign +, - // > - the opening parenthesis (, - // > - the closing parenthesis ), - // > - and the opening square bracket [, - // > - the opening curly brace {, - // > These special characters are often called "metacharacters". - [ - /[\\$.|*+(){^]/g, - match => `\\${match}` - ], + if (YAML_NODE_KINDS.indexOf(this.kind) === -1) { + throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.'); + } +} - [ - // > a question mark (?) matches a single character - /(?!\\)\?/g, - () => '[^/]' - ], +module.exports = Type; - // leading slash - [ - // > A leading slash matches the beginning of the pathname. - // > For example, "/*.c" matches "cat-file.c" but not "mozilla-sha1/sha1.c". - // A leading slash matches the beginning of the pathname - /^\//, - () => '^' - ], +/***/ }), - // replace special metacharacter slash after the leading slash - [ - /\//g, - () => '\\/' - ], +/***/ 1113: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - [ - // > A leading "**" followed by a slash means match in all directories. - // > For example, "**/foo" matches file or directory "foo" anywhere, - // > the same as pattern "foo". - // > "**/foo/bar" matches file or directory "bar" anywhere that is directly - // > under directory "foo". - // Notice that the '*'s have been replaced as '\\*' - /^\^*\\\*\\\*\\\//, +"use strict"; - // '**/foo' <-> 'foo' - () => '^(?:.*\\/)?' - ], - // starting - [ - // there will be no leading '/' - // (which has been replaced by section "leading slash") - // If starts with '**', adding a '^' to the regular expression also works - /^(?=[^^])/, - function startingReplacer () { - // If has a slash `/` at the beginning or middle - return !/\/(?!$)/.test(this) - // > Prior to 2.22.1 - // > If the pattern does not contain a slash /, - // > Git treats it as a shell glob pattern - // Actually, if there is only a trailing slash, - // git also treats it as a shell glob pattern +/*eslint-disable no-bitwise*/ - // After 2.22.1 (compatible but clearer) - // > If there is a separator at the beginning or middle (or both) - // > of the pattern, then the pattern is relative to the directory - // > level of the particular .gitignore file itself. - // > Otherwise the pattern may also match at any level below - // > the .gitignore level. - ? '(?:^|\\/)' - // > Otherwise, Git treats the pattern as a shell glob suitable for - // > consumption by fnmatch(3) - : '^' - } - ], +var Type = __nccwpck_require__(1089); - // two globstars - [ - // Use lookahead assertions so that we could match more than one `'/**'` - /\\\/\\\*\\\*(?=\\\/|$)/g, - // Zero, one or several directories - // should not use '*', or it will be replaced by the next replacer +// [ 64, 65, 66 ] -> [ padding, CR, LF ] +var BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r'; - // Check if it is not the last `'/**'` - (_, index, str) => index + 6 < str.length - // case: /**/ - // > A slash followed by two consecutive asterisks then a slash matches - // > zero or more directories. - // > For example, "a/**/b" matches "a/b", "a/x/b", "a/x/y/b" and so on. - // '/**/' - ? '(?:\\/[^\\/]+)*' +function resolveYamlBinary(data) { + if (data === null) return false; - // case: /** - // > A trailing `"/**"` matches everything inside. + var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP; - // #21: everything inside but it should not include the current folder - : '\\/.+' - ], + // Convert one by one. + for (idx = 0; idx < max; idx++) { + code = map.indexOf(data.charAt(idx)); - // normal intermediate wildcards - [ - // Never replace escaped '*' - // ignore rule '\*' will match the path '*' + // Skip CR/LF + if (code > 64) continue; - // 'abc.*/' -> go - // 'abc.*' -> skip this rule, - // coz trailing single wildcard will be handed by [trailing wildcard] - /(^|[^\\]+)(\\\*)+(?=.+)/g, + // Fail on illegal characters + if (code < 0) return false; - // '*.js' matches '.js' - // '*.js' doesn't match 'abc' - (_, p1, p2) => { - // 1. - // > An asterisk "*" matches anything except a slash. - // 2. - // > Other consecutive asterisks are considered regular asterisks - // > and will match according to the previous rules. - const unescaped = p2.replace(/\\\*/g, '[^\\/]*') - return p1 + unescaped - } - ], + bitlen += 6; + } - [ - // unescape, revert step 3 except for back slash - // For example, if a user escape a '\\*', - // after step 3, the result will be '\\\\\\*' - /\\\\\\(?=[$.|*+(){^])/g, - () => ESCAPE - ], + // If there are any bits left, source was corrupted + return (bitlen % 8) === 0; +} - [ - // '\\\\' -> '\\' - /\\\\/g, - () => ESCAPE - ], +function constructYamlBinary(data) { + var idx, tailbits, + input = data.replace(/[\r\n=]/g, ''), // remove CR/LF & padding to simplify scan + max = input.length, + map = BASE64_MAP, + bits = 0, + result = []; - [ - // > The range notation, e.g. [a-zA-Z], - // > can be used to match one of the characters in a range. + // Collect by 6*4 bits (3 bytes) - // `\` is escaped by step 3 - /(\\)?\[([^\]/]*?)(\\*)($|\])/g, - (match, leadEscape, range, endEscape, close) => leadEscape === ESCAPE - // '\\[bar]' -> '\\\\[bar\\]' - ? `\\[${range}${cleanRangeBackSlash(endEscape)}${close}` - : close === ']' - ? endEscape.length % 2 === 0 - // A normal case, and it is a range notation - // '[bar]' - // '[bar\\\\]' - ? `[${sanitizeRange(range)}${endEscape}]` - // Invalid range notaton - // '[bar\\]' -> '[bar\\\\]' - : '[]' - : '[]' - ], + for (idx = 0; idx < max; idx++) { + if ((idx % 4 === 0) && idx) { + result.push((bits >> 16) & 0xFF); + result.push((bits >> 8) & 0xFF); + result.push(bits & 0xFF); + } - // ending - [ - // 'js' will not match 'js.' - // 'ab' will not match 'abc' - /(?:[^*])$/, + bits = (bits << 6) | map.indexOf(input.charAt(idx)); + } - // WTF! - // https://git-scm.com/docs/gitignore - // changes in [2.22.1](https://git-scm.com/docs/gitignore/2.22.1) - // which re-fixes #24, #38 + // Dump tail - // > If there is a separator at the end of the pattern then the pattern - // > will only match directories, otherwise the pattern can match both - // > files and directories. + tailbits = (max % 4) * 6; - // 'js*' will not match 'a.js' - // 'js/' will not match 'a.js' - // 'js' will match 'a.js' and 'a.js/' - match => /\/$/.test(match) - // foo/ will not match 'foo' - ? `${match}$` - // foo matches 'foo' and 'foo/' - : `${match}(?=$|\\/$)` - ], + if (tailbits === 0) { + result.push((bits >> 16) & 0xFF); + result.push((bits >> 8) & 0xFF); + result.push(bits & 0xFF); + } else if (tailbits === 18) { + result.push((bits >> 10) & 0xFF); + result.push((bits >> 2) & 0xFF); + } else if (tailbits === 12) { + result.push((bits >> 4) & 0xFF); + } - // trailing wildcard - [ - /(\^|\\\/)?\\\*$/, - (_, p1) => { - const prefix = p1 - // '\^': - // '/*' does not match EMPTY - // '/*' does not match everything + return new Uint8Array(result); +} - // '\\\/': - // 'abc/*' does not match 'abc/' - ? `${p1}[^/]+` +function representYamlBinary(object /*, style*/) { + var result = '', bits = 0, idx, tail, + max = object.length, + map = BASE64_MAP; - // 'a*' matches 'a' - // 'a*' matches 'aa' - : '[^/]*' + // Convert every three bytes to 4 ASCII characters. - return `${prefix}(?=$|\\/$)` + for (idx = 0; idx < max; idx++) { + if ((idx % 3 === 0) && idx) { + result += map[(bits >> 18) & 0x3F]; + result += map[(bits >> 12) & 0x3F]; + result += map[(bits >> 6) & 0x3F]; + result += map[bits & 0x3F]; } - ], -] -// A simple cache, because an ignore rule only has only one certain meaning -const regexCache = Object.create(null) + bits = (bits << 8) + object[idx]; + } -// @param {pattern} -const makeRegex = (pattern, ignoreCase) => { - let source = regexCache[pattern] + // Dump tail - if (!source) { - source = REPLACERS.reduce( - (prev, [matcher, replacer]) => - prev.replace(matcher, replacer.bind(pattern)), - pattern - ) - regexCache[pattern] = source + tail = max % 3; + + if (tail === 0) { + result += map[(bits >> 18) & 0x3F]; + result += map[(bits >> 12) & 0x3F]; + result += map[(bits >> 6) & 0x3F]; + result += map[bits & 0x3F]; + } else if (tail === 2) { + result += map[(bits >> 10) & 0x3F]; + result += map[(bits >> 4) & 0x3F]; + result += map[(bits << 2) & 0x3F]; + result += map[64]; + } else if (tail === 1) { + result += map[(bits >> 2) & 0x3F]; + result += map[(bits << 4) & 0x3F]; + result += map[64]; + result += map[64]; } - return ignoreCase - ? new RegExp(source, 'i') - : new RegExp(source) + return result; } -const isString = subject => typeof subject === 'string' +function isBinary(obj) { + return Object.prototype.toString.call(obj) === '[object Uint8Array]'; +} -// > A blank line matches no files, so it can serve as a separator for readability. -const checkPattern = pattern => pattern - && isString(pattern) - && !REGEX_TEST_BLANK_LINE.test(pattern) - && !REGEX_INVALID_TRAILING_BACKSLASH.test(pattern) +module.exports = new Type('tag:yaml.org,2002:binary', { + kind: 'scalar', + resolve: resolveYamlBinary, + construct: constructYamlBinary, + predicate: isBinary, + represent: representYamlBinary +}); - // > A line starting with # serves as a comment. - && pattern.indexOf('#') !== 0 -const splitPattern = pattern => pattern.split(REGEX_SPLITALL_CRLF) +/***/ }), -class IgnoreRule { - constructor ( - origin, - pattern, - negative, - regex - ) { - this.origin = origin - this.pattern = pattern - this.negative = negative - this.regex = regex - } -} +/***/ 97300: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const createRule = (pattern, ignoreCase) => { - const origin = pattern - let negative = false +"use strict"; - // > An optional prefix "!" which negates the pattern; - if (pattern.indexOf('!') === 0) { - negative = true - pattern = pattern.substr(1) - } - pattern = pattern - // > Put a backslash ("\") in front of the first "!" for patterns that - // > begin with a literal "!", for example, `"\!important!.txt"`. - .replace(REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION, '!') - // > Put a backslash ("\") in front of the first hash for patterns that - // > begin with a hash. - .replace(REGEX_REPLACE_LEADING_EXCAPED_HASH, '#') +var Type = __nccwpck_require__(1089); - const regex = makeRegex(pattern, ignoreCase) +function resolveYamlBoolean(data) { + if (data === null) return false; - return new IgnoreRule( - origin, - pattern, - negative, - regex - ) + var max = data.length; + + return (max === 4 && (data === 'true' || data === 'True' || data === 'TRUE')) || + (max === 5 && (data === 'false' || data === 'False' || data === 'FALSE')); } -const throwError = (message, Ctor) => { - throw new Ctor(message) +function constructYamlBoolean(data) { + return data === 'true' || + data === 'True' || + data === 'TRUE'; } -const checkPath = (path, originalPath, doThrow) => { - if (!isString(path)) { - return doThrow( - `path must be a string, but got \`${originalPath}\``, - TypeError - ) - } +function isBoolean(object) { + return Object.prototype.toString.call(object) === '[object Boolean]'; +} - // We don't know if we should ignore EMPTY, so throw - if (!path) { - return doThrow(`path must not be empty`, TypeError) - } +module.exports = new Type('tag:yaml.org,2002:bool', { + kind: 'scalar', + resolve: resolveYamlBoolean, + construct: constructYamlBoolean, + predicate: isBoolean, + represent: { + lowercase: function (object) { return object ? 'true' : 'false'; }, + uppercase: function (object) { return object ? 'TRUE' : 'FALSE'; }, + camelcase: function (object) { return object ? 'True' : 'False'; } + }, + defaultStyle: 'lowercase' +}); - // Check if it is a relative path - if (checkPath.isNotRelative(path)) { - const r = '`path.relative()`d' - return doThrow( - `path should be a ${r} string, but got "${originalPath}"`, - RangeError - ) - } - return true -} +/***/ }), -const isNotRelative = path => REGEX_TEST_INVALID_PATH.test(path) +/***/ 83492: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -checkPath.isNotRelative = isNotRelative -checkPath.convert = p => p +"use strict"; -class Ignore { - constructor ({ - ignorecase = true, - ignoreCase = ignorecase, - allowRelativePaths = false - } = {}) { - define(this, KEY_IGNORE, true) - this._rules = [] - this._ignoreCase = ignoreCase - this._allowRelativePaths = allowRelativePaths - this._initCache() - } +var common = __nccwpck_require__(23324); +var Type = __nccwpck_require__(1089); - _initCache () { - this._ignoreCache = Object.create(null) - this._testCache = Object.create(null) - } +var YAML_FLOAT_PATTERN = new RegExp( + // 2.5e4, 2.5 and integers + '^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?' + + // .2e4, .2 + // special case, seems not from spec + '|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?' + + // .inf + '|[-+]?\\.(?:inf|Inf|INF)' + + // .nan + '|\\.(?:nan|NaN|NAN))$'); - _addPattern (pattern) { - // #32 - if (pattern && pattern[KEY_IGNORE]) { - this._rules = this._rules.concat(pattern._rules) - this._added = true - return - } +function resolveYamlFloat(data) { + if (data === null) return false; - if (checkPattern(pattern)) { - const rule = createRule(pattern, this._ignoreCase) - this._added = true - this._rules.push(rule) - } + if (!YAML_FLOAT_PATTERN.test(data) || + // Quick hack to not allow integers end with `_` + // Probably should update regexp & check speed + data[data.length - 1] === '_') { + return false; } - // @param {Array | string | Ignore} pattern - add (pattern) { - this._added = false + return true; +} - makeArray( - isString(pattern) - ? splitPattern(pattern) - : pattern - ).forEach(this._addPattern, this) +function constructYamlFloat(data) { + var value, sign; - // Some rules have just added to the ignore, - // making the behavior changed. - if (this._added) { - this._initCache() - } + value = data.replace(/_/g, '').toLowerCase(); + sign = value[0] === '-' ? -1 : 1; - return this + if ('+-'.indexOf(value[0]) >= 0) { + value = value.slice(1); } - // legacy - addPattern (pattern) { - return this.add(pattern) + if (value === '.inf') { + return (sign === 1) ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY; + + } else if (value === '.nan') { + return NaN; } + return sign * parseFloat(value, 10); +} - // | ignored : unignored - // negative | 0:0 | 0:1 | 1:0 | 1:1 - // -------- | ------- | ------- | ------- | -------- - // 0 | TEST | TEST | SKIP | X - // 1 | TESTIF | SKIP | TEST | X - // - SKIP: always skip - // - TEST: always test - // - TESTIF: only test if checkUnignored - // - X: that never happen +var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/; - // @param {boolean} whether should check if the path is unignored, - // setting `checkUnignored` to `false` could reduce additional - // path matching. +function representYamlFloat(object, style) { + var res; - // @returns {TestResult} true if a file is ignored - _testOne (path, checkUnignored) { - let ignored = false - let unignored = false + if (isNaN(object)) { + switch (style) { + case 'lowercase': return '.nan'; + case 'uppercase': return '.NAN'; + case 'camelcase': return '.NaN'; + } + } else if (Number.POSITIVE_INFINITY === object) { + switch (style) { + case 'lowercase': return '.inf'; + case 'uppercase': return '.INF'; + case 'camelcase': return '.Inf'; + } + } else if (Number.NEGATIVE_INFINITY === object) { + switch (style) { + case 'lowercase': return '-.inf'; + case 'uppercase': return '-.INF'; + case 'camelcase': return '-.Inf'; + } + } else if (common.isNegativeZero(object)) { + return '-0.0'; + } - this._rules.forEach(rule => { - const {negative} = rule - if ( - unignored === negative && ignored !== unignored - || negative && !ignored && !unignored && !checkUnignored - ) { - return - } + res = object.toString(10); - const matched = rule.regex.test(path) + // JS stringifier can build scientific format without dots: 5e-100, + // while YAML requres dot: 5.e-100. Fix it with simple hack - if (matched) { - ignored = !negative - unignored = negative - } - }) + return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace('e', '.e') : res; +} - return { - ignored, - unignored - } - } +function isFloat(object) { + return (Object.prototype.toString.call(object) === '[object Number]') && + (object % 1 !== 0 || common.isNegativeZero(object)); +} - // @returns {TestResult} - _test (originalPath, cache, checkUnignored, slices) { - const path = originalPath - // Supports nullable path - && checkPath.convert(originalPath) +module.exports = new Type('tag:yaml.org,2002:float', { + kind: 'scalar', + resolve: resolveYamlFloat, + construct: constructYamlFloat, + predicate: isFloat, + represent: representYamlFloat, + defaultStyle: 'lowercase' +}); - checkPath( - path, - originalPath, - this._allowRelativePaths - ? RETURN_FALSE - : throwError - ) - return this._t(path, cache, checkUnignored, slices) - } +/***/ }), - _t (path, cache, checkUnignored, slices) { - if (path in cache) { - return cache[path] - } +/***/ 99491: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - if (!slices) { - // path/to/a.js - // ['path', 'to', 'a.js'] - slices = path.split(SLASH) - } +"use strict"; - slices.pop() - // If the path has no parent directory, just test it - if (!slices.length) { - return cache[path] = this._testOne(path, checkUnignored) - } +var common = __nccwpck_require__(23324); +var Type = __nccwpck_require__(1089); - const parent = this._t( - slices.join(SLASH) + SLASH, - cache, - checkUnignored, - slices - ) +function isHexCode(c) { + return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) || + ((0x41/* A */ <= c) && (c <= 0x46/* F */)) || + ((0x61/* a */ <= c) && (c <= 0x66/* f */)); +} - // If the path contains a parent directory, check the parent first - return cache[path] = parent.ignored - // > It is not possible to re-include a file if a parent directory of - // > that file is excluded. - ? parent - : this._testOne(path, checkUnignored) - } +function isOctCode(c) { + return ((0x30/* 0 */ <= c) && (c <= 0x37/* 7 */)); +} - ignores (path) { - return this._test(path, this._ignoreCache, false).ignored - } +function isDecCode(c) { + return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)); +} - createFilter () { - return path => !this.ignores(path) - } +function resolveYamlInteger(data) { + if (data === null) return false; - filter (paths) { - return makeArray(paths).filter(this.createFilter()) - } + var max = data.length, + index = 0, + hasDigits = false, + ch; - // @returns {TestResult} - test (path) { - return this._test(path, this._testCache, true) + if (!max) return false; + + ch = data[index]; + + // sign + if (ch === '-' || ch === '+') { + ch = data[++index]; } -} -const factory = options => new Ignore(options) + if (ch === '0') { + // 0 + if (index + 1 === max) return true; + ch = data[++index]; -const isPathValid = path => - checkPath(path && checkPath.convert(path), path, RETURN_FALSE) + // base 2, base 8, base 16 -factory.isPathValid = isPathValid + if (ch === 'b') { + // base 2 + index++; -// Fixes typescript -factory.default = factory + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') continue; + if (ch !== '0' && ch !== '1') return false; + hasDigits = true; + } + return hasDigits && ch !== '_'; + } -module.exports = factory -// Windows -// -------------------------------------------------------------- -/* istanbul ignore if */ -if ( - // Detect `process` so that it can run in browsers. - typeof process !== 'undefined' - && ( - process.env && process.env.IGNORE_TEST_WIN32 - || process.platform === 'win32' - ) -) { - /* eslint no-control-regex: "off" */ - const makePosix = str => /^\\\\\?\\/.test(str) - || /["<>|\u0000-\u001F]+/u.test(str) - ? str - : str.replace(/\\/g, '/') + if (ch === 'x') { + // base 16 + index++; - checkPath.convert = makePosix + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') continue; + if (!isHexCode(data.charCodeAt(index))) return false; + hasDigits = true; + } + return hasDigits && ch !== '_'; + } - // 'C:\\foo' <- 'C:\\foo' has been converted to 'C:/' - // 'd:\\foo' - const REGIX_IS_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i - checkPath.isNotRelative = path => - REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path) - || isNotRelative(path) -} + if (ch === 'o') { + // base 8 + index++; -/***/ }), + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') continue; + if (!isOctCode(data.charCodeAt(index))) return false; + hasDigits = true; + } + return hasDigits && ch !== '_'; + } + } -/***/ 17280: -/***/ ((module) => { + // base 10 (except 0) -/*! - * is-extglob - * - * Copyright (c) 2014-2016, Jon Schlinkert. - * Licensed under the MIT License. - */ + // value should not start with `_`; + if (ch === '_') return false; -module.exports = function isExtglob(str) { - if (typeof str !== 'string' || str === '') { - return false; + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') continue; + if (!isDecCode(data.charCodeAt(index))) { + return false; + } + hasDigits = true; } - var match; - while ((match = /(\\).|([@?!+*]\(.*\))/g.exec(str))) { - if (match[2]) return true; - str = str.slice(match.index + match[0].length); - } + // Should have digits and should not end with `_` + if (!hasDigits || ch === '_') return false; - return false; -}; + return true; +} +function constructYamlInteger(data) { + var value = data, sign = 1, ch; -/***/ }), + if (value.indexOf('_') !== -1) { + value = value.replace(/_/g, ''); + } -/***/ 11753: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + ch = value[0]; -/*! - * is-glob - * - * Copyright (c) 2014-2017, Jon Schlinkert. - * Released under the MIT License. - */ + if (ch === '-' || ch === '+') { + if (ch === '-') sign = -1; + value = value.slice(1); + ch = value[0]; + } -var isExtglob = __nccwpck_require__(17280); -var chars = { '{': '}', '(': ')', '[': ']'}; -var strictCheck = function(str) { - if (str[0] === '!') { - return true; + if (value === '0') return 0; + + if (ch === '0') { + if (value[1] === 'b') return sign * parseInt(value.slice(2), 2); + if (value[1] === 'x') return sign * parseInt(value.slice(2), 16); + if (value[1] === 'o') return sign * parseInt(value.slice(2), 8); } - var index = 0; - var pipeIndex = -2; - var closeSquareIndex = -2; - var closeCurlyIndex = -2; - var closeParenIndex = -2; - var backSlashIndex = -2; - while (index < str.length) { - if (str[index] === '*') { - return true; - } - if (str[index + 1] === '?' && /[\].+)]/.test(str[index])) { - return true; - } + return sign * parseInt(value, 10); +} - if (closeSquareIndex !== -1 && str[index] === '[' && str[index + 1] !== ']') { - if (closeSquareIndex < index) { - closeSquareIndex = str.indexOf(']', index); - } - if (closeSquareIndex > index) { - if (backSlashIndex === -1 || backSlashIndex > closeSquareIndex) { - return true; - } - backSlashIndex = str.indexOf('\\', index); - if (backSlashIndex === -1 || backSlashIndex > closeSquareIndex) { - return true; - } - } - } +function isInteger(object) { + return (Object.prototype.toString.call(object)) === '[object Number]' && + (object % 1 === 0 && !common.isNegativeZero(object)); +} - if (closeCurlyIndex !== -1 && str[index] === '{' && str[index + 1] !== '}') { - closeCurlyIndex = str.indexOf('}', index); - if (closeCurlyIndex > index) { - backSlashIndex = str.indexOf('\\', index); - if (backSlashIndex === -1 || backSlashIndex > closeCurlyIndex) { - return true; - } - } - } +module.exports = new Type('tag:yaml.org,2002:int', { + kind: 'scalar', + resolve: resolveYamlInteger, + construct: constructYamlInteger, + predicate: isInteger, + represent: { + binary: function (obj) { return obj >= 0 ? '0b' + obj.toString(2) : '-0b' + obj.toString(2).slice(1); }, + octal: function (obj) { return obj >= 0 ? '0o' + obj.toString(8) : '-0o' + obj.toString(8).slice(1); }, + decimal: function (obj) { return obj.toString(10); }, + /* eslint-disable max-len */ + hexadecimal: function (obj) { return obj >= 0 ? '0x' + obj.toString(16).toUpperCase() : '-0x' + obj.toString(16).toUpperCase().slice(1); } + }, + defaultStyle: 'decimal', + styleAliases: { + binary: [ 2, 'bin' ], + octal: [ 8, 'oct' ], + decimal: [ 10, 'dec' ], + hexadecimal: [ 16, 'hex' ] + } +}); - if (closeParenIndex !== -1 && str[index] === '(' && str[index + 1] === '?' && /[:!=]/.test(str[index + 2]) && str[index + 3] !== ')') { - closeParenIndex = str.indexOf(')', index); - if (closeParenIndex > index) { - backSlashIndex = str.indexOf('\\', index); - if (backSlashIndex === -1 || backSlashIndex > closeParenIndex) { - return true; - } - } - } - if (pipeIndex !== -1 && str[index] === '(' && str[index + 1] !== '|') { - if (pipeIndex < index) { - pipeIndex = str.indexOf('|', index); - } - if (pipeIndex !== -1 && str[pipeIndex + 1] !== ')') { - closeParenIndex = str.indexOf(')', pipeIndex); - if (closeParenIndex > pipeIndex) { - backSlashIndex = str.indexOf('\\', pipeIndex); - if (backSlashIndex === -1 || backSlashIndex > closeParenIndex) { - return true; - } - } - } - } +/***/ }), - if (str[index] === '\\') { - var open = str[index + 1]; - index += 2; - var close = chars[open]; +/***/ 88432: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - if (close) { - var n = str.indexOf(close, index); - if (n !== -1) { - index = n + 1; - } - } +"use strict"; - if (str[index] === '!') { - return true; - } - } else { - index++; - } - } - return false; -}; -var relaxedCheck = function(str) { - if (str[0] === '!') { - return true; - } - var index = 0; - while (index < str.length) { - if (/[*?{}()[\]]/.test(str[index])) { - return true; - } +var Type = __nccwpck_require__(1089); - if (str[index] === '\\') { - var open = str[index + 1]; - index += 2; - var close = chars[open]; +module.exports = new Type('tag:yaml.org,2002:map', { + kind: 'mapping', + construct: function (data) { return data !== null ? data : {}; } +}); - if (close) { - var n = str.indexOf(close, index); - if (n !== -1) { - index = n + 1; - } - } - if (str[index] === '!') { - return true; - } - } else { - index++; - } - } - return false; -}; +/***/ }), -module.exports = function isGlob(str, options) { - if (typeof str !== 'string' || str === '') { - return false; - } +/***/ 70954: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - if (isExtglob(str)) { - return true; - } +"use strict"; - var check = strictCheck; - // optionally relax check - if (options && options.strict === false) { - check = relaxedCheck; - } +var Type = __nccwpck_require__(1089); - return check(str); -}; +function resolveYamlMerge(data) { + return data === '<<' || data === null; +} + +module.exports = new Type('tag:yaml.org,2002:merge', { + kind: 'scalar', + resolve: resolveYamlMerge +}); /***/ }), -/***/ 97850: -/***/ ((module) => { +/***/ 77177: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -/*! - * is-number - * - * Copyright (c) 2014-present, Jon Schlinkert. - * Released under the MIT License. - */ +var Type = __nccwpck_require__(1089); -module.exports = function(num) { - if (typeof num === 'number') { - return num - num === 0; - } - if (typeof num === 'string' && num.trim() !== '') { - return Number.isFinite ? Number.isFinite(+num) : isFinite(+num); - } - return false; -}; +function resolveYamlNull(data) { + if (data === null) return true; + + var max = data.length; + + return (max === 1 && data === '~') || + (max === 4 && (data === 'null' || data === 'Null' || data === 'NULL')); +} + +function constructYamlNull() { + return null; +} + +function isNull(object) { + return object === null; +} + +module.exports = new Type('tag:yaml.org,2002:null', { + kind: 'scalar', + resolve: resolveYamlNull, + construct: constructYamlNull, + predicate: isNull, + represent: { + canonical: function () { return '~'; }, + lowercase: function () { return 'null'; }, + uppercase: function () { return 'NULL'; }, + camelcase: function () { return 'Null'; }, + empty: function () { return ''; } + }, + defaultStyle: 'lowercase' +}); /***/ }), -/***/ 81011: -/***/ ((module) => { +/***/ 28677: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -const isStream = stream => - stream !== null && - typeof stream === 'object' && - typeof stream.pipe === 'function'; +var Type = __nccwpck_require__(1089); -isStream.writable = stream => - isStream(stream) && - stream.writable !== false && - typeof stream._write === 'function' && - typeof stream._writableState === 'object'; +var _hasOwnProperty = Object.prototype.hasOwnProperty; +var _toString = Object.prototype.toString; -isStream.readable = stream => - isStream(stream) && - stream.readable !== false && - typeof stream._read === 'function' && - typeof stream._readableState === 'object'; +function resolveYamlOmap(data) { + if (data === null) return true; -isStream.duplex = stream => - isStream.writable(stream) && - isStream.readable(stream); + var objectKeys = [], index, length, pair, pairKey, pairHasKey, + object = data; -isStream.transform = stream => - isStream.duplex(stream) && - typeof stream._transform === 'function'; + for (index = 0, length = object.length; index < length; index += 1) { + pair = object[index]; + pairHasKey = false; -module.exports = isStream; + if (_toString.call(pair) !== '[object Object]') return false; + + for (pairKey in pair) { + if (_hasOwnProperty.call(pair, pairKey)) { + if (!pairHasKey) pairHasKey = true; + else return false; + } + } + + if (!pairHasKey) return false; + + if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey); + else return false; + } + + return true; +} + +function constructYamlOmap(data) { + return data !== null ? data : []; +} + +module.exports = new Type('tag:yaml.org,2002:omap', { + kind: 'sequence', + resolve: resolveYamlOmap, + construct: constructYamlOmap +}); /***/ }), -/***/ 46390: +/***/ 33884: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -const betterPathResolve = __nccwpck_require__(88843) -const path = __nccwpck_require__(16928) -function isSubdir (parentDir, subdir) { - const rParent = `${betterPathResolve(parentDir)}${path.sep}` - const rDir = `${betterPathResolve(subdir)}${path.sep}` - return rDir.startsWith(rParent) +var Type = __nccwpck_require__(1089); + +var _toString = Object.prototype.toString; + +function resolveYamlPairs(data) { + if (data === null) return true; + + var index, length, pair, keys, result, + object = data; + + result = new Array(object.length); + + for (index = 0, length = object.length; index < length; index += 1) { + pair = object[index]; + + if (_toString.call(pair) !== '[object Object]') return false; + + keys = Object.keys(pair); + + if (keys.length !== 1) return false; + + result[index] = [ keys[0], pair[keys[0]] ]; + } + + return true; } -isSubdir.strict = function isSubdirStrict (parentDir, subdir) { - const rParent = `${betterPathResolve(parentDir)}${path.sep}` - const rDir = `${betterPathResolve(subdir)}${path.sep}` - return rDir !== rParent && rDir.startsWith(rParent) +function constructYamlPairs(data) { + if (data === null) return []; + + var index, length, pair, keys, result, + object = data; + + result = new Array(object.length); + + for (index = 0, length = object.length; index < length; index += 1) { + pair = object[index]; + + keys = Object.keys(pair); + + result[index] = [ keys[0], pair[keys[0]] ]; + } + + return result; } -module.exports = isSubdir +module.exports = new Type('tag:yaml.org,2002:pairs', { + kind: 'sequence', + resolve: resolveYamlPairs, + construct: constructYamlPairs +}); /***/ }), -/***/ 65196: -/***/ ((module, exports) => { +/***/ 43733: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -/*! - * is-windows - * - * Copyright © 2015-2018, Jon Schlinkert. - * Released under the MIT License. - */ +"use strict"; -(function(factory) { - if (exports && typeof exports === 'object' && "object" !== 'undefined') { - module.exports = factory(); - } else if (typeof define === 'function' && define.amd) { - define([], factory); - } else if (typeof window !== 'undefined') { - window.isWindows = factory(); - } else if (typeof global !== 'undefined') { - global.isWindows = factory(); - } else if (typeof self !== 'undefined') { - self.isWindows = factory(); - } else { - this.isWindows = factory(); - } -})(function() { - 'use strict'; - return function isWindows() { - return process && (process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE)); - }; + +var Type = __nccwpck_require__(1089); + +module.exports = new Type('tag:yaml.org,2002:seq', { + kind: 'sequence', + construct: function (data) { return data !== null ? data : []; } }); /***/ }), -/***/ 49648: +/***/ 25098: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -var fs = __nccwpck_require__(79896) -var core -if (process.platform === 'win32' || global.TESTING_WINDOWS) { - core = __nccwpck_require__(73117) -} else { - core = __nccwpck_require__(98341) -} +"use strict"; -module.exports = isexe -isexe.sync = sync -function isexe (path, options, cb) { - if (typeof options === 'function') { - cb = options - options = {} - } +var Type = __nccwpck_require__(1089); - if (!cb) { - if (typeof Promise !== 'function') { - throw new TypeError('callback not provided') - } +var _hasOwnProperty = Object.prototype.hasOwnProperty; - return new Promise(function (resolve, reject) { - isexe(path, options || {}, function (er, is) { - if (er) { - reject(er) - } else { - resolve(is) - } - }) - }) - } +function resolveYamlSet(data) { + if (data === null) return true; - core(path, options || {}, function (er, is) { - // ignore EACCES because that just means we aren't allowed to run it - if (er) { - if (er.code === 'EACCES' || options && options.ignoreErrors) { - er = null - is = false - } - } - cb(er, is) - }) -} + var key, object = data; -function sync (path, options) { - // my kingdom for a filtered catch - try { - return core.sync(path, options || {}) - } catch (er) { - if (options && options.ignoreErrors || er.code === 'EACCES') { - return false - } else { - throw er + for (key in object) { + if (_hasOwnProperty.call(object, key)) { + if (object[key] !== null) return false; } } + + return true; +} + +function constructYamlSet(data) { + return data !== null ? data : {}; } +module.exports = new Type('tag:yaml.org,2002:set', { + kind: 'mapping', + resolve: resolveYamlSet, + construct: constructYamlSet +}); + /***/ }), -/***/ 98341: +/***/ 41845: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -module.exports = isexe -isexe.sync = sync +"use strict"; -var fs = __nccwpck_require__(79896) -function isexe (path, options, cb) { - fs.stat(path, function (er, stat) { - cb(er, er ? false : checkStat(stat, options)) - }) -} +var Type = __nccwpck_require__(1089); -function sync (path, options) { - return checkStat(fs.statSync(path), options) -} +module.exports = new Type('tag:yaml.org,2002:str', { + kind: 'scalar', + construct: function (data) { return data !== null ? data : ''; } +}); -function checkStat (stat, options) { - return stat.isFile() && checkMode(stat, options) -} -function checkMode (stat, options) { - var mod = stat.mode - var uid = stat.uid - var gid = stat.gid +/***/ }), - var myUid = options.uid !== undefined ? - options.uid : process.getuid && process.getuid() - var myGid = options.gid !== undefined ? - options.gid : process.getgid && process.getgid() +/***/ 35298: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - var u = parseInt('100', 8) - var g = parseInt('010', 8) - var o = parseInt('001', 8) - var ug = u | g +"use strict"; - var ret = (mod & o) || - (mod & g) && gid === myGid || - (mod & u) && uid === myUid || - (mod & ug) && myUid === 0 - return ret -} +var Type = __nccwpck_require__(1089); +var YAML_DATE_REGEXP = new RegExp( + '^([0-9][0-9][0-9][0-9])' + // [1] year + '-([0-9][0-9])' + // [2] month + '-([0-9][0-9])$'); // [3] day -/***/ }), +var YAML_TIMESTAMP_REGEXP = new RegExp( + '^([0-9][0-9][0-9][0-9])' + // [1] year + '-([0-9][0-9]?)' + // [2] month + '-([0-9][0-9]?)' + // [3] day + '(?:[Tt]|[ \\t]+)' + // ... + '([0-9][0-9]?)' + // [4] hour + ':([0-9][0-9])' + // [5] minute + ':([0-9][0-9])' + // [6] second + '(?:\\.([0-9]*))?' + // [7] fraction + '(?:[ \\t]*(Z|([-+])([0-9][0-9]?)' + // [8] tz [9] tz_sign [10] tz_hour + '(?::([0-9][0-9]))?))?$'); // [11] tz_minute -/***/ 73117: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +function resolveYamlTimestamp(data) { + if (data === null) return false; + if (YAML_DATE_REGEXP.exec(data) !== null) return true; + if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true; + return false; +} -module.exports = isexe -isexe.sync = sync +function constructYamlTimestamp(data) { + var match, year, month, day, hour, minute, second, fraction = 0, + delta = null, tz_hour, tz_minute, date; -var fs = __nccwpck_require__(79896) + match = YAML_DATE_REGEXP.exec(data); + if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data); -function checkPathExt (path, options) { - var pathext = options.pathExt !== undefined ? - options.pathExt : process.env.PATHEXT + if (match === null) throw new Error('Date resolve error'); - if (!pathext) { - return true - } + // match: [1] year [2] month [3] day - pathext = pathext.split(';') - if (pathext.indexOf('') !== -1) { - return true + year = +(match[1]); + month = +(match[2]) - 1; // JS month starts with 0 + day = +(match[3]); + + if (!match[4]) { // no hour + return new Date(Date.UTC(year, month, day)); } - for (var i = 0; i < pathext.length; i++) { - var p = pathext[i].toLowerCase() - if (p && path.substr(-p.length).toLowerCase() === p) { - return true + + // match: [4] hour [5] minute [6] second [7] fraction + + hour = +(match[4]); + minute = +(match[5]); + second = +(match[6]); + + if (match[7]) { + fraction = match[7].slice(0, 3); + while (fraction.length < 3) { // milli-seconds + fraction += '0'; } + fraction = +fraction; } - return false -} -function checkStat (stat, path, options) { - if (!stat.isSymbolicLink() && !stat.isFile()) { - return false + // match: [8] tz [9] tz_sign [10] tz_hour [11] tz_minute + + if (match[9]) { + tz_hour = +(match[10]); + tz_minute = +(match[11] || 0); + delta = (tz_hour * 60 + tz_minute) * 60000; // delta in mili-seconds + if (match[9] === '-') delta = -delta; } - return checkPathExt(path, options) -} -function isexe (path, options, cb) { - fs.stat(path, function (er, stat) { - cb(er, er ? false : checkStat(stat, path, options)) - }) + date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction)); + + if (delta) date.setTime(date.getTime() - delta); + + return date; } -function sync (path, options) { - return checkStat(fs.statSync(path), path, options) +function representYamlTimestamp(object /*, style*/) { + return object.toISOString(); } +module.exports = new Type('tag:yaml.org,2002:timestamp', { + kind: 'scalar', + resolve: resolveYamlTimestamp, + construct: constructYamlTimestamp, + instanceOf: Date, + represent: representYamlTimestamp +}); + /***/ }), diff --git a/build-packages/changesets-fixed-version-bump/package.json b/build-packages/changesets-fixed-version-bump/package.json index 134a842134..3971fdaebf 100644 --- a/build-packages/changesets-fixed-version-bump/package.json +++ b/build-packages/changesets-fixed-version-bump/package.json @@ -14,7 +14,7 @@ }, "dependencies": { "@actions/core": "^1.11.1", - "@changesets/get-release-plan": "^4.0.11", + "@changesets/get-release-plan": "^4.0.14", "execa": "^5.0.0", "semver": "^7.7.2" }, diff --git a/yarn.lock b/yarn.lock index f722713c5b..a0d7a115f3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -470,10 +470,10 @@ spawndamnit "^3.0.1" term-size "^2.1.0" -"@changesets/config@^3.1.1": - version "3.1.1" - resolved "https://registry.npmjs.org/@changesets/config/-/config-3.1.1.tgz#3e5b1f74236a4552c5f4eddf2bd05a43a0b71160" - integrity sha512-bd+3Ap2TKXxljCggI0mKPfzCQKeV/TU4yO2h2C6vAihIo8tzseAn2e7klSuiyYYXvgu53zMN1OeYMIQkaQoWnA== +"@changesets/config@^3.1.1", "@changesets/config@^3.1.2": + version "3.1.2" + resolved "https://registry.npmjs.org/@changesets/config/-/config-3.1.2.tgz#7d04d531285766f8f7ae03648e0b4a97c71aa9b3" + integrity sha512-CYiRhA4bWKemdYi/uwImjPxqWNpqGPNbEBdX1BdONALFIDK7MCUj6FPkzD+z9gJcvDFUQJn9aDVf4UG7OT6Kog== dependencies: "@changesets/errors" "^0.2.0" "@changesets/get-dependents-graph" "^2.1.3" @@ -500,15 +500,15 @@ picocolors "^1.1.0" semver "^7.5.3" -"@changesets/get-release-plan@^4.0.11", "@changesets/get-release-plan@^4.0.13": - version "4.0.13" - resolved "https://registry.npmjs.org/@changesets/get-release-plan/-/get-release-plan-4.0.13.tgz#02e2d9b89a3911bfc4bf1dafe237098b4b7454e9" - integrity sha512-DWG1pus72FcNeXkM12tx+xtExyH/c9I1z+2aXlObH3i9YA7+WZEVaiHzHl03thpvAgWTRaH64MpfHxozfF7Dvg== +"@changesets/get-release-plan@^4.0.13", "@changesets/get-release-plan@^4.0.14": + version "4.0.14" + resolved "https://registry.npmjs.org/@changesets/get-release-plan/-/get-release-plan-4.0.14.tgz#4b03a13f7f8107d1a91500cdf020a6181af2ad32" + integrity sha512-yjZMHpUHgl4Xl5gRlolVuxDkm4HgSJqT93Ri1Uz8kGrQb+5iJ8dkXJ20M2j/Y4iV5QzS2c5SeTxVSKX+2eMI0g== dependencies: "@changesets/assemble-release-plan" "^6.0.9" - "@changesets/config" "^3.1.1" + "@changesets/config" "^3.1.2" "@changesets/pre" "^2.0.2" - "@changesets/read" "^0.6.5" + "@changesets/read" "^0.6.6" "@changesets/types" "^6.1.0" "@manypkg/get-packages" "^1.1.3" @@ -535,13 +535,13 @@ dependencies: picocolors "^1.1.0" -"@changesets/parse@^0.4.1": - version "0.4.1" - resolved "https://registry.npmjs.org/@changesets/parse/-/parse-0.4.1.tgz#18ba51d2eb784d27469034f06344f8fdcba586df" - integrity sha512-iwksMs5Bf/wUItfcg+OXrEpravm5rEd9Bf4oyIPL4kVTmJQ7PNDSd6MDYkpSJR1pn7tz/k8Zf2DhTCqX08Ou+Q== +"@changesets/parse@^0.4.2": + version "0.4.2" + resolved "https://registry.npmjs.org/@changesets/parse/-/parse-0.4.2.tgz#d31f6e87fe8b3b404e44b1ffd8bb0caa24094a2f" + integrity sha512-Uo5MC5mfg4OM0jU3up66fmSn6/NE9INK+8/Vn/7sMVcdWg46zfbvvUSjD9EMonVqPi9fbrJH9SXHn48Tr1f2yA== dependencies: "@changesets/types" "^6.1.0" - js-yaml "^3.13.1" + js-yaml "^4.1.1" "@changesets/pre@^2.0.2": version "2.0.2" @@ -553,14 +553,14 @@ "@manypkg/get-packages" "^1.1.3" fs-extra "^7.0.1" -"@changesets/read@^0.6.5": - version "0.6.5" - resolved "https://registry.npmjs.org/@changesets/read/-/read-0.6.5.tgz#7a68457e6356d3df187aa18e388f1b8dba3d2156" - integrity sha512-UPzNGhsSjHD3Veb0xO/MwvasGe8eMyNrR/sT9gR8Q3DhOQZirgKhhXv/8hVsI0QpPjR004Z9iFxoJU6in3uGMg== +"@changesets/read@^0.6.5", "@changesets/read@^0.6.6": + version "0.6.6" + resolved "https://registry.npmjs.org/@changesets/read/-/read-0.6.6.tgz#0097f5d9e9693fae3ca0e3265a5bee5eab614b36" + integrity sha512-P5QaN9hJSQQKJShzzpBT13FzOSPyHbqdoIBUd2DJdgvnECCyO6LmAOWSV+O8se2TaZJVwSXjL+v9yhb+a9JeJg== dependencies: "@changesets/git" "^3.0.4" "@changesets/logger" "^0.1.1" - "@changesets/parse" "^0.4.1" + "@changesets/parse" "^0.4.2" "@changesets/types" "^6.1.0" fs-extra "^7.0.1" p-filter "^2.1.0"