@wise/wds-codemods 1.0.0-experimental-0db39ee → 1.0.0-experimental-95d3c2e

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers-Du-iz0Iu.js","names":["list","list","exec","path","tableData: string[][]","semver","CONSOLE_ICONS","comparisons: Record<string, Record<string, string>>","failedTargetsNoPackage: string[]","list","path","ignorePattern: string | undefined","userPatterns: string","transformModules: Record<string, unknown>","fs","path","path","fs","answers: Answers","path","fs","CONSOLE_ICONS"],"sources":["../node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/constants.js","../node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/debug.js","../node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/re.js","../node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/parse-options.js","../node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/identifiers.js","../node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/semver.js","../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/parse.js","../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/valid.js","../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/clean.js","../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/inc.js","../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/diff.js","../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/major.js","../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/minor.js","../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/patch.js","../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/prerelease.js","../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/compare.js","../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/rcompare.js","../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/compare-loose.js","../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/compare-build.js","../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/sort.js","../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/rsort.js","../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/gt.js","../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/lt.js","../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/eq.js","../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/neq.js","../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/gte.js","../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/lte.js","../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/cmp.js","../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/coerce.js","../node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/lrucache.js","../node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/range.js","../node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/comparator.js","../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/satisfies.js","../node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/to-comparators.js","../node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/max-satisfying.js","../node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/min-satisfying.js","../node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/min-version.js","../node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/valid.js","../node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/outside.js","../node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/gtr.js","../node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/ltr.js","../node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/intersects.js","../node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/simplify.js","../node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/subset.js","../node_modules/.pnpm/semver@7.7.2/node_modules/semver/index.js","../src/controller/helpers/getCodemodConfig.ts","../src/controller/helpers/repository.ts","../src/controller/helpers/table.ts","../src/controller/helpers/dependencyChecks.ts","../src/controller/helpers/getOptions.ts","../src/controller/helpers/loadTransformModules.ts","../src/controller/helpers/reportManualReview.ts","../src/controller/helpers/runTransformPrompts.ts","../src/controller/helpers/validateClaudeConfig.ts"],"sourcesContent":["'use strict'\n\n// Note: this is the semver.org version of the spec that it implements\n// Not necessarily the package version of this code.\nconst SEMVER_SPEC_VERSION = '2.0.0'\n\nconst MAX_LENGTH = 256\nconst MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||\n/* istanbul ignore next */ 9007199254740991\n\n// Max safe segment length for coercion.\nconst MAX_SAFE_COMPONENT_LENGTH = 16\n\n// Max safe length for a build identifier. The max length minus 6 characters for\n// the shortest version with a build 0.0.0+BUILD.\nconst MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6\n\nconst RELEASE_TYPES = [\n 'major',\n 'premajor',\n 'minor',\n 'preminor',\n 'patch',\n 'prepatch',\n 'prerelease',\n]\n\nmodule.exports = {\n MAX_LENGTH,\n MAX_SAFE_COMPONENT_LENGTH,\n MAX_SAFE_BUILD_LENGTH,\n MAX_SAFE_INTEGER,\n RELEASE_TYPES,\n SEMVER_SPEC_VERSION,\n FLAG_INCLUDE_PRERELEASE: 0b001,\n FLAG_LOOSE: 0b010,\n}\n","'use strict'\n\nconst debug = (\n typeof process === 'object' &&\n process.env &&\n process.env.NODE_DEBUG &&\n /\\bsemver\\b/i.test(process.env.NODE_DEBUG)\n) ? (...args) => console.error('SEMVER', ...args)\n : () => {}\n\nmodule.exports = debug\n","'use strict'\n\nconst {\n MAX_SAFE_COMPONENT_LENGTH,\n MAX_SAFE_BUILD_LENGTH,\n MAX_LENGTH,\n} = require('./constants')\nconst debug = require('./debug')\nexports = module.exports = {}\n\n// The actual regexps go on exports.re\nconst re = exports.re = []\nconst safeRe = exports.safeRe = []\nconst src = exports.src = []\nconst safeSrc = exports.safeSrc = []\nconst t = exports.t = {}\nlet R = 0\n\nconst LETTERDASHNUMBER = '[a-zA-Z0-9-]'\n\n// Replace some greedy regex tokens to prevent regex dos issues. These regex are\n// used internally via the safeRe object since all inputs in this library get\n// normalized first to trim and collapse all extra whitespace. The original\n// regexes are exported for userland consumption and lower level usage. A\n// future breaking change could export the safer regex only with a note that\n// all input should have extra whitespace removed.\nconst safeRegexReplacements = [\n ['\\\\s', 1],\n ['\\\\d', MAX_LENGTH],\n [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH],\n]\n\nconst makeSafeRegex = (value) => {\n for (const [token, max] of safeRegexReplacements) {\n value = value\n .split(`${token}*`).join(`${token}{0,${max}}`)\n .split(`${token}+`).join(`${token}{1,${max}}`)\n }\n return value\n}\n\nconst createToken = (name, value, isGlobal) => {\n const safe = makeSafeRegex(value)\n const index = R++\n debug(name, index, value)\n t[name] = index\n src[index] = value\n safeSrc[index] = safe\n re[index] = new RegExp(value, isGlobal ? 'g' : undefined)\n safeRe[index] = new RegExp(safe, isGlobal ? 'g' : undefined)\n}\n\n// The following Regular Expressions can be used for tokenizing,\n// validating, and parsing SemVer version strings.\n\n// ## Numeric Identifier\n// A single `0`, or a non-zero digit followed by zero or more digits.\n\ncreateToken('NUMERICIDENTIFIER', '0|[1-9]\\\\d*')\ncreateToken('NUMERICIDENTIFIERLOOSE', '\\\\d+')\n\n// ## Non-numeric Identifier\n// Zero or more digits, followed by a letter or hyphen, and then zero or\n// more letters, digits, or hyphens.\n\ncreateToken('NONNUMERICIDENTIFIER', `\\\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`)\n\n// ## Main Version\n// Three dot-separated numeric identifiers.\n\ncreateToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\\\.` +\n `(${src[t.NUMERICIDENTIFIER]})\\\\.` +\n `(${src[t.NUMERICIDENTIFIER]})`)\n\ncreateToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\\\.` +\n `(${src[t.NUMERICIDENTIFIERLOOSE]})\\\\.` +\n `(${src[t.NUMERICIDENTIFIERLOOSE]})`)\n\n// ## Pre-release Version Identifier\n// A numeric identifier, or a non-numeric identifier.\n// Non-numberic identifiers include numberic identifiers but can be longer.\n// Therefore non-numberic identifiers must go first.\n\ncreateToken('PRERELEASEIDENTIFIER', `(?:${src[t.NONNUMERICIDENTIFIER]\n}|${src[t.NUMERICIDENTIFIER]})`)\n\ncreateToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NONNUMERICIDENTIFIER]\n}|${src[t.NUMERICIDENTIFIERLOOSE]})`)\n\n// ## Pre-release Version\n// Hyphen, followed by one or more dot-separated pre-release version\n// identifiers.\n\ncreateToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER]\n}(?:\\\\.${src[t.PRERELEASEIDENTIFIER]})*))`)\n\ncreateToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]\n}(?:\\\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`)\n\n// ## Build Metadata Identifier\n// Any combination of digits, letters, or hyphens.\n\ncreateToken('BUILDIDENTIFIER', `${LETTERDASHNUMBER}+`)\n\n// ## Build Metadata\n// Plus sign, followed by one or more period-separated build metadata\n// identifiers.\n\ncreateToken('BUILD', `(?:\\\\+(${src[t.BUILDIDENTIFIER]\n}(?:\\\\.${src[t.BUILDIDENTIFIER]})*))`)\n\n// ## Full Version String\n// A main version, followed optionally by a pre-release version and\n// build metadata.\n\n// Note that the only major, minor, patch, and pre-release sections of\n// the version string are capturing groups. The build metadata is not a\n// capturing group, because it should not ever be used in version\n// comparison.\n\ncreateToken('FULLPLAIN', `v?${src[t.MAINVERSION]\n}${src[t.PRERELEASE]}?${\n src[t.BUILD]}?`)\n\ncreateToken('FULL', `^${src[t.FULLPLAIN]}$`)\n\n// like full, but allows v1.2.3 and =1.2.3, which people do sometimes.\n// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty\n// common in the npm registry.\ncreateToken('LOOSEPLAIN', `[v=\\\\s]*${src[t.MAINVERSIONLOOSE]\n}${src[t.PRERELEASELOOSE]}?${\n src[t.BUILD]}?`)\n\ncreateToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`)\n\ncreateToken('GTLT', '((?:<|>)?=?)')\n\n// Something like \"2.*\" or \"1.2.x\".\n// Note that \"x.x\" is a valid xRange identifer, meaning \"any version\"\n// Only the first item is strictly required.\ncreateToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\\\*`)\ncreateToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\\\*`)\n\ncreateToken('XRANGEPLAIN', `[v=\\\\s]*(${src[t.XRANGEIDENTIFIER]})` +\n `(?:\\\\.(${src[t.XRANGEIDENTIFIER]})` +\n `(?:\\\\.(${src[t.XRANGEIDENTIFIER]})` +\n `(?:${src[t.PRERELEASE]})?${\n src[t.BUILD]}?` +\n `)?)?`)\n\ncreateToken('XRANGEPLAINLOOSE', `[v=\\\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` +\n `(?:\\\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +\n `(?:\\\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +\n `(?:${src[t.PRERELEASELOOSE]})?${\n src[t.BUILD]}?` +\n `)?)?`)\n\ncreateToken('XRANGE', `^${src[t.GTLT]}\\\\s*${src[t.XRANGEPLAIN]}$`)\ncreateToken('XRANGELOOSE', `^${src[t.GTLT]}\\\\s*${src[t.XRANGEPLAINLOOSE]}$`)\n\n// Coercion.\n// Extract anything that could conceivably be a part of a valid semver\ncreateToken('COERCEPLAIN', `${'(^|[^\\\\d])' +\n '(\\\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` +\n `(?:\\\\.(\\\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +\n `(?:\\\\.(\\\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`)\ncreateToken('COERCE', `${src[t.COERCEPLAIN]}(?:$|[^\\\\d])`)\ncreateToken('COERCEFULL', src[t.COERCEPLAIN] +\n `(?:${src[t.PRERELEASE]})?` +\n `(?:${src[t.BUILD]})?` +\n `(?:$|[^\\\\d])`)\ncreateToken('COERCERTL', src[t.COERCE], true)\ncreateToken('COERCERTLFULL', src[t.COERCEFULL], true)\n\n// Tilde ranges.\n// Meaning is \"reasonably at or greater than\"\ncreateToken('LONETILDE', '(?:~>?)')\n\ncreateToken('TILDETRIM', `(\\\\s*)${src[t.LONETILDE]}\\\\s+`, true)\nexports.tildeTrimReplace = '$1~'\n\ncreateToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`)\ncreateToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`)\n\n// Caret ranges.\n// Meaning is \"at least and backwards compatible with\"\ncreateToken('LONECARET', '(?:\\\\^)')\n\ncreateToken('CARETTRIM', `(\\\\s*)${src[t.LONECARET]}\\\\s+`, true)\nexports.caretTrimReplace = '$1^'\n\ncreateToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`)\ncreateToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`)\n\n// A simple gt/lt/eq thing, or just \"\" to indicate \"any version\"\ncreateToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\\\s*(${src[t.LOOSEPLAIN]})$|^$`)\ncreateToken('COMPARATOR', `^${src[t.GTLT]}\\\\s*(${src[t.FULLPLAIN]})$|^$`)\n\n// An expression to strip any whitespace between the gtlt and the thing\n// it modifies, so that `> 1.2.3` ==> `>1.2.3`\ncreateToken('COMPARATORTRIM', `(\\\\s*)${src[t.GTLT]\n}\\\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true)\nexports.comparatorTrimReplace = '$1$2$3'\n\n// Something like `1.2.3 - 1.2.4`\n// Note that these all use the loose form, because they'll be\n// checked against either the strict or loose comparator form\n// later.\ncreateToken('HYPHENRANGE', `^\\\\s*(${src[t.XRANGEPLAIN]})` +\n `\\\\s+-\\\\s+` +\n `(${src[t.XRANGEPLAIN]})` +\n `\\\\s*$`)\n\ncreateToken('HYPHENRANGELOOSE', `^\\\\s*(${src[t.XRANGEPLAINLOOSE]})` +\n `\\\\s+-\\\\s+` +\n `(${src[t.XRANGEPLAINLOOSE]})` +\n `\\\\s*$`)\n\n// Star ranges basically just allow anything at all.\ncreateToken('STAR', '(<|>)?=?\\\\s*\\\\*')\n// >=0.0.0 is like a star\ncreateToken('GTE0', '^\\\\s*>=\\\\s*0\\\\.0\\\\.0\\\\s*$')\ncreateToken('GTE0PRE', '^\\\\s*>=\\\\s*0\\\\.0\\\\.0-0\\\\s*$')\n","'use strict'\n\n// parse out just the options we care about\nconst looseOption = Object.freeze({ loose: true })\nconst emptyOpts = Object.freeze({ })\nconst parseOptions = options => {\n if (!options) {\n return emptyOpts\n }\n\n if (typeof options !== 'object') {\n return looseOption\n }\n\n return options\n}\nmodule.exports = parseOptions\n","'use strict'\n\nconst numeric = /^[0-9]+$/\nconst compareIdentifiers = (a, b) => {\n const anum = numeric.test(a)\n const bnum = numeric.test(b)\n\n if (anum && bnum) {\n a = +a\n b = +b\n }\n\n return a === b ? 0\n : (anum && !bnum) ? -1\n : (bnum && !anum) ? 1\n : a < b ? -1\n : 1\n}\n\nconst rcompareIdentifiers = (a, b) => compareIdentifiers(b, a)\n\nmodule.exports = {\n compareIdentifiers,\n rcompareIdentifiers,\n}\n","'use strict'\n\nconst debug = require('../internal/debug')\nconst { MAX_LENGTH, MAX_SAFE_INTEGER } = require('../internal/constants')\nconst { safeRe: re, t } = require('../internal/re')\n\nconst parseOptions = require('../internal/parse-options')\nconst { compareIdentifiers } = require('../internal/identifiers')\nclass SemVer {\n constructor (version, options) {\n options = parseOptions(options)\n\n if (version instanceof SemVer) {\n if (version.loose === !!options.loose &&\n version.includePrerelease === !!options.includePrerelease) {\n return version\n } else {\n version = version.version\n }\n } else if (typeof version !== 'string') {\n throw new TypeError(`Invalid version. Must be a string. Got type \"${typeof version}\".`)\n }\n\n if (version.length > MAX_LENGTH) {\n throw new TypeError(\n `version is longer than ${MAX_LENGTH} characters`\n )\n }\n\n debug('SemVer', version, options)\n this.options = options\n this.loose = !!options.loose\n // this isn't actually relevant for versions, but keep it so that we\n // don't run into trouble passing this.options around.\n this.includePrerelease = !!options.includePrerelease\n\n const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL])\n\n if (!m) {\n throw new TypeError(`Invalid Version: ${version}`)\n }\n\n this.raw = version\n\n // these are actually numbers\n this.major = +m[1]\n this.minor = +m[2]\n this.patch = +m[3]\n\n if (this.major > MAX_SAFE_INTEGER || this.major < 0) {\n throw new TypeError('Invalid major version')\n }\n\n if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {\n throw new TypeError('Invalid minor version')\n }\n\n if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {\n throw new TypeError('Invalid patch version')\n }\n\n // numberify any prerelease numeric ids\n if (!m[4]) {\n this.prerelease = []\n } else {\n this.prerelease = m[4].split('.').map((id) => {\n if (/^[0-9]+$/.test(id)) {\n const num = +id\n if (num >= 0 && num < MAX_SAFE_INTEGER) {\n return num\n }\n }\n return id\n })\n }\n\n this.build = m[5] ? m[5].split('.') : []\n this.format()\n }\n\n format () {\n this.version = `${this.major}.${this.minor}.${this.patch}`\n if (this.prerelease.length) {\n this.version += `-${this.prerelease.join('.')}`\n }\n return this.version\n }\n\n toString () {\n return this.version\n }\n\n compare (other) {\n debug('SemVer.compare', this.version, this.options, other)\n if (!(other instanceof SemVer)) {\n if (typeof other === 'string' && other === this.version) {\n return 0\n }\n other = new SemVer(other, this.options)\n }\n\n if (other.version === this.version) {\n return 0\n }\n\n return this.compareMain(other) || this.comparePre(other)\n }\n\n compareMain (other) {\n if (!(other instanceof SemVer)) {\n other = new SemVer(other, this.options)\n }\n\n return (\n compareIdentifiers(this.major, other.major) ||\n compareIdentifiers(this.minor, other.minor) ||\n compareIdentifiers(this.patch, other.patch)\n )\n }\n\n comparePre (other) {\n if (!(other instanceof SemVer)) {\n other = new SemVer(other, this.options)\n }\n\n // NOT having a prerelease is > having one\n if (this.prerelease.length && !other.prerelease.length) {\n return -1\n } else if (!this.prerelease.length && other.prerelease.length) {\n return 1\n } else if (!this.prerelease.length && !other.prerelease.length) {\n return 0\n }\n\n let i = 0\n do {\n const a = this.prerelease[i]\n const b = other.prerelease[i]\n debug('prerelease compare', i, a, b)\n if (a === undefined && b === undefined) {\n return 0\n } else if (b === undefined) {\n return 1\n } else if (a === undefined) {\n return -1\n } else if (a === b) {\n continue\n } else {\n return compareIdentifiers(a, b)\n }\n } while (++i)\n }\n\n compareBuild (other) {\n if (!(other instanceof SemVer)) {\n other = new SemVer(other, this.options)\n }\n\n let i = 0\n do {\n const a = this.build[i]\n const b = other.build[i]\n debug('build compare', i, a, b)\n if (a === undefined && b === undefined) {\n return 0\n } else if (b === undefined) {\n return 1\n } else if (a === undefined) {\n return -1\n } else if (a === b) {\n continue\n } else {\n return compareIdentifiers(a, b)\n }\n } while (++i)\n }\n\n // preminor will bump the version up to the next minor release, and immediately\n // down to pre-release. premajor and prepatch work the same way.\n inc (release, identifier, identifierBase) {\n if (release.startsWith('pre')) {\n if (!identifier && identifierBase === false) {\n throw new Error('invalid increment argument: identifier is empty')\n }\n // Avoid an invalid semver results\n if (identifier) {\n const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE])\n if (!match || match[1] !== identifier) {\n throw new Error(`invalid identifier: ${identifier}`)\n }\n }\n }\n\n switch (release) {\n case 'premajor':\n this.prerelease.length = 0\n this.patch = 0\n this.minor = 0\n this.major++\n this.inc('pre', identifier, identifierBase)\n break\n case 'preminor':\n this.prerelease.length = 0\n this.patch = 0\n this.minor++\n this.inc('pre', identifier, identifierBase)\n break\n case 'prepatch':\n // If this is already a prerelease, it will bump to the next version\n // drop any prereleases that might already exist, since they are not\n // relevant at this point.\n this.prerelease.length = 0\n this.inc('patch', identifier, identifierBase)\n this.inc('pre', identifier, identifierBase)\n break\n // If the input is a non-prerelease version, this acts the same as\n // prepatch.\n case 'prerelease':\n if (this.prerelease.length === 0) {\n this.inc('patch', identifier, identifierBase)\n }\n this.inc('pre', identifier, identifierBase)\n break\n case 'release':\n if (this.prerelease.length === 0) {\n throw new Error(`version ${this.raw} is not a prerelease`)\n }\n this.prerelease.length = 0\n break\n\n case 'major':\n // If this is a pre-major version, bump up to the same major version.\n // Otherwise increment major.\n // 1.0.0-5 bumps to 1.0.0\n // 1.1.0 bumps to 2.0.0\n if (\n this.minor !== 0 ||\n this.patch !== 0 ||\n this.prerelease.length === 0\n ) {\n this.major++\n }\n this.minor = 0\n this.patch = 0\n this.prerelease = []\n break\n case 'minor':\n // If this is a pre-minor version, bump up to the same minor version.\n // Otherwise increment minor.\n // 1.2.0-5 bumps to 1.2.0\n // 1.2.1 bumps to 1.3.0\n if (this.patch !== 0 || this.prerelease.length === 0) {\n this.minor++\n }\n this.patch = 0\n this.prerelease = []\n break\n case 'patch':\n // If this is not a pre-release version, it will increment the patch.\n // If it is a pre-release it will bump up to the same patch version.\n // 1.2.0-5 patches to 1.2.0\n // 1.2.0 patches to 1.2.1\n if (this.prerelease.length === 0) {\n this.patch++\n }\n this.prerelease = []\n break\n // This probably shouldn't be used publicly.\n // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.\n case 'pre': {\n const base = Number(identifierBase) ? 1 : 0\n\n if (this.prerelease.length === 0) {\n this.prerelease = [base]\n } else {\n let i = this.prerelease.length\n while (--i >= 0) {\n if (typeof this.prerelease[i] === 'number') {\n this.prerelease[i]++\n i = -2\n }\n }\n if (i === -1) {\n // didn't increment anything\n if (identifier === this.prerelease.join('.') && identifierBase === false) {\n throw new Error('invalid increment argument: identifier already exists')\n }\n this.prerelease.push(base)\n }\n }\n if (identifier) {\n // 1.2.0-beta.1 bumps to 1.2.0-beta.2,\n // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0\n let prerelease = [identifier, base]\n if (identifierBase === false) {\n prerelease = [identifier]\n }\n if (compareIdentifiers(this.prerelease[0], identifier) === 0) {\n if (isNaN(this.prerelease[1])) {\n this.prerelease = prerelease\n }\n } else {\n this.prerelease = prerelease\n }\n }\n break\n }\n default:\n throw new Error(`invalid increment argument: ${release}`)\n }\n this.raw = this.format()\n if (this.build.length) {\n this.raw += `+${this.build.join('.')}`\n }\n return this\n }\n}\n\nmodule.exports = SemVer\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst parse = (version, options, throwErrors = false) => {\n if (version instanceof SemVer) {\n return version\n }\n try {\n return new SemVer(version, options)\n } catch (er) {\n if (!throwErrors) {\n return null\n }\n throw er\n }\n}\n\nmodule.exports = parse\n","'use strict'\n\nconst parse = require('./parse')\nconst valid = (version, options) => {\n const v = parse(version, options)\n return v ? v.version : null\n}\nmodule.exports = valid\n","'use strict'\n\nconst parse = require('./parse')\nconst clean = (version, options) => {\n const s = parse(version.trim().replace(/^[=v]+/, ''), options)\n return s ? s.version : null\n}\nmodule.exports = clean\n","'use strict'\n\nconst SemVer = require('../classes/semver')\n\nconst inc = (version, release, options, identifier, identifierBase) => {\n if (typeof (options) === 'string') {\n identifierBase = identifier\n identifier = options\n options = undefined\n }\n\n try {\n return new SemVer(\n version instanceof SemVer ? version.version : version,\n options\n ).inc(release, identifier, identifierBase).version\n } catch (er) {\n return null\n }\n}\nmodule.exports = inc\n","'use strict'\n\nconst parse = require('./parse.js')\n\nconst diff = (version1, version2) => {\n const v1 = parse(version1, null, true)\n const v2 = parse(version2, null, true)\n const comparison = v1.compare(v2)\n\n if (comparison === 0) {\n return null\n }\n\n const v1Higher = comparison > 0\n const highVersion = v1Higher ? v1 : v2\n const lowVersion = v1Higher ? v2 : v1\n const highHasPre = !!highVersion.prerelease.length\n const lowHasPre = !!lowVersion.prerelease.length\n\n if (lowHasPre && !highHasPre) {\n // Going from prerelease -> no prerelease requires some special casing\n\n // If the low version has only a major, then it will always be a major\n // Some examples:\n // 1.0.0-1 -> 1.0.0\n // 1.0.0-1 -> 1.1.1\n // 1.0.0-1 -> 2.0.0\n if (!lowVersion.patch && !lowVersion.minor) {\n return 'major'\n }\n\n // If the main part has no difference\n if (lowVersion.compareMain(highVersion) === 0) {\n if (lowVersion.minor && !lowVersion.patch) {\n return 'minor'\n }\n return 'patch'\n }\n }\n\n // add the `pre` prefix if we are going to a prerelease version\n const prefix = highHasPre ? 'pre' : ''\n\n if (v1.major !== v2.major) {\n return prefix + 'major'\n }\n\n if (v1.minor !== v2.minor) {\n return prefix + 'minor'\n }\n\n if (v1.patch !== v2.patch) {\n return prefix + 'patch'\n }\n\n // high and low are preleases\n return 'prerelease'\n}\n\nmodule.exports = diff\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst major = (a, loose) => new SemVer(a, loose).major\nmodule.exports = major\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst minor = (a, loose) => new SemVer(a, loose).minor\nmodule.exports = minor\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst patch = (a, loose) => new SemVer(a, loose).patch\nmodule.exports = patch\n","'use strict'\n\nconst parse = require('./parse')\nconst prerelease = (version, options) => {\n const parsed = parse(version, options)\n return (parsed && parsed.prerelease.length) ? parsed.prerelease : null\n}\nmodule.exports = prerelease\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst compare = (a, b, loose) =>\n new SemVer(a, loose).compare(new SemVer(b, loose))\n\nmodule.exports = compare\n","'use strict'\n\nconst compare = require('./compare')\nconst rcompare = (a, b, loose) => compare(b, a, loose)\nmodule.exports = rcompare\n","'use strict'\n\nconst compare = require('./compare')\nconst compareLoose = (a, b) => compare(a, b, true)\nmodule.exports = compareLoose\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst compareBuild = (a, b, loose) => {\n const versionA = new SemVer(a, loose)\n const versionB = new SemVer(b, loose)\n return versionA.compare(versionB) || versionA.compareBuild(versionB)\n}\nmodule.exports = compareBuild\n","'use strict'\n\nconst compareBuild = require('./compare-build')\nconst sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose))\nmodule.exports = sort\n","'use strict'\n\nconst compareBuild = require('./compare-build')\nconst rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose))\nmodule.exports = rsort\n","'use strict'\n\nconst compare = require('./compare')\nconst gt = (a, b, loose) => compare(a, b, loose) > 0\nmodule.exports = gt\n","'use strict'\n\nconst compare = require('./compare')\nconst lt = (a, b, loose) => compare(a, b, loose) < 0\nmodule.exports = lt\n","'use strict'\n\nconst compare = require('./compare')\nconst eq = (a, b, loose) => compare(a, b, loose) === 0\nmodule.exports = eq\n","'use strict'\n\nconst compare = require('./compare')\nconst neq = (a, b, loose) => compare(a, b, loose) !== 0\nmodule.exports = neq\n","'use strict'\n\nconst compare = require('./compare')\nconst gte = (a, b, loose) => compare(a, b, loose) >= 0\nmodule.exports = gte\n","'use strict'\n\nconst compare = require('./compare')\nconst lte = (a, b, loose) => compare(a, b, loose) <= 0\nmodule.exports = lte\n","'use strict'\n\nconst eq = require('./eq')\nconst neq = require('./neq')\nconst gt = require('./gt')\nconst gte = require('./gte')\nconst lt = require('./lt')\nconst lte = require('./lte')\n\nconst cmp = (a, op, b, loose) => {\n switch (op) {\n case '===':\n if (typeof a === 'object') {\n a = a.version\n }\n if (typeof b === 'object') {\n b = b.version\n }\n return a === b\n\n case '!==':\n if (typeof a === 'object') {\n a = a.version\n }\n if (typeof b === 'object') {\n b = b.version\n }\n return a !== b\n\n case '':\n case '=':\n case '==':\n return eq(a, b, loose)\n\n case '!=':\n return neq(a, b, loose)\n\n case '>':\n return gt(a, b, loose)\n\n case '>=':\n return gte(a, b, loose)\n\n case '<':\n return lt(a, b, loose)\n\n case '<=':\n return lte(a, b, loose)\n\n default:\n throw new TypeError(`Invalid operator: ${op}`)\n }\n}\nmodule.exports = cmp\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst parse = require('./parse')\nconst { safeRe: re, t } = require('../internal/re')\n\nconst coerce = (version, options) => {\n if (version instanceof SemVer) {\n return version\n }\n\n if (typeof version === 'number') {\n version = String(version)\n }\n\n if (typeof version !== 'string') {\n return null\n }\n\n options = options || {}\n\n let match = null\n if (!options.rtl) {\n match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE])\n } else {\n // Find the right-most coercible string that does not share\n // a terminus with a more left-ward coercible string.\n // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4'\n // With includePrerelease option set, '1.2.3.4-rc' wants to coerce '2.3.4-rc', not '2.3.4'\n //\n // Walk through the string checking with a /g regexp\n // Manually set the index so as to pick up overlapping matches.\n // Stop when we get a match that ends at the string end, since no\n // coercible string can be more right-ward without the same terminus.\n const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL]\n let next\n while ((next = coerceRtlRegex.exec(version)) &&\n (!match || match.index + match[0].length !== version.length)\n ) {\n if (!match ||\n next.index + next[0].length !== match.index + match[0].length) {\n match = next\n }\n coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length\n }\n // leave it in a clean state\n coerceRtlRegex.lastIndex = -1\n }\n\n if (match === null) {\n return null\n }\n\n const major = match[2]\n const minor = match[3] || '0'\n const patch = match[4] || '0'\n const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : ''\n const build = options.includePrerelease && match[6] ? `+${match[6]}` : ''\n\n return parse(`${major}.${minor}.${patch}${prerelease}${build}`, options)\n}\nmodule.exports = coerce\n","'use strict'\n\nclass LRUCache {\n constructor () {\n this.max = 1000\n this.map = new Map()\n }\n\n get (key) {\n const value = this.map.get(key)\n if (value === undefined) {\n return undefined\n } else {\n // Remove the key from the map and add it to the end\n this.map.delete(key)\n this.map.set(key, value)\n return value\n }\n }\n\n delete (key) {\n return this.map.delete(key)\n }\n\n set (key, value) {\n const deleted = this.delete(key)\n\n if (!deleted && value !== undefined) {\n // If cache is full, delete the least recently used item\n if (this.map.size >= this.max) {\n const firstKey = this.map.keys().next().value\n this.delete(firstKey)\n }\n\n this.map.set(key, value)\n }\n\n return this\n }\n}\n\nmodule.exports = LRUCache\n","'use strict'\n\nconst SPACE_CHARACTERS = /\\s+/g\n\n// hoisted class for cyclic dependency\nclass Range {\n constructor (range, options) {\n options = parseOptions(options)\n\n if (range instanceof Range) {\n if (\n range.loose === !!options.loose &&\n range.includePrerelease === !!options.includePrerelease\n ) {\n return range\n } else {\n return new Range(range.raw, options)\n }\n }\n\n if (range instanceof Comparator) {\n // just put it in the set and return\n this.raw = range.value\n this.set = [[range]]\n this.formatted = undefined\n return this\n }\n\n this.options = options\n this.loose = !!options.loose\n this.includePrerelease = !!options.includePrerelease\n\n // First reduce all whitespace as much as possible so we do not have to rely\n // on potentially slow regexes like \\s*. This is then stored and used for\n // future error messages as well.\n this.raw = range.trim().replace(SPACE_CHARACTERS, ' ')\n\n // First, split on ||\n this.set = this.raw\n .split('||')\n // map the range to a 2d array of comparators\n .map(r => this.parseRange(r.trim()))\n // throw out any comparator lists that are empty\n // this generally means that it was not a valid range, which is allowed\n // in loose mode, but will still throw if the WHOLE range is invalid.\n .filter(c => c.length)\n\n if (!this.set.length) {\n throw new TypeError(`Invalid SemVer Range: ${this.raw}`)\n }\n\n // if we have any that are not the null set, throw out null sets.\n if (this.set.length > 1) {\n // keep the first one, in case they're all null sets\n const first = this.set[0]\n this.set = this.set.filter(c => !isNullSet(c[0]))\n if (this.set.length === 0) {\n this.set = [first]\n } else if (this.set.length > 1) {\n // if we have any that are *, then the range is just *\n for (const c of this.set) {\n if (c.length === 1 && isAny(c[0])) {\n this.set = [c]\n break\n }\n }\n }\n }\n\n this.formatted = undefined\n }\n\n get range () {\n if (this.formatted === undefined) {\n this.formatted = ''\n for (let i = 0; i < this.set.length; i++) {\n if (i > 0) {\n this.formatted += '||'\n }\n const comps = this.set[i]\n for (let k = 0; k < comps.length; k++) {\n if (k > 0) {\n this.formatted += ' '\n }\n this.formatted += comps[k].toString().trim()\n }\n }\n }\n return this.formatted\n }\n\n format () {\n return this.range\n }\n\n toString () {\n return this.range\n }\n\n parseRange (range) {\n // memoize range parsing for performance.\n // this is a very hot path, and fully deterministic.\n const memoOpts =\n (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) |\n (this.options.loose && FLAG_LOOSE)\n const memoKey = memoOpts + ':' + range\n const cached = cache.get(memoKey)\n if (cached) {\n return cached\n }\n\n const loose = this.options.loose\n // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`\n const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE]\n range = range.replace(hr, hyphenReplace(this.options.includePrerelease))\n debug('hyphen replace', range)\n\n // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`\n range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace)\n debug('comparator trim', range)\n\n // `~ 1.2.3` => `~1.2.3`\n range = range.replace(re[t.TILDETRIM], tildeTrimReplace)\n debug('tilde trim', range)\n\n // `^ 1.2.3` => `^1.2.3`\n range = range.replace(re[t.CARETTRIM], caretTrimReplace)\n debug('caret trim', range)\n\n // At this point, the range is completely trimmed and\n // ready to be split into comparators.\n\n let rangeList = range\n .split(' ')\n .map(comp => parseComparator(comp, this.options))\n .join(' ')\n .split(/\\s+/)\n // >=0.0.0 is equivalent to *\n .map(comp => replaceGTE0(comp, this.options))\n\n if (loose) {\n // in loose mode, throw out any that are not valid comparators\n rangeList = rangeList.filter(comp => {\n debug('loose invalid filter', comp, this.options)\n return !!comp.match(re[t.COMPARATORLOOSE])\n })\n }\n debug('range list', rangeList)\n\n // if any comparators are the null set, then replace with JUST null set\n // if more than one comparator, remove any * comparators\n // also, don't include the same comparator more than once\n const rangeMap = new Map()\n const comparators = rangeList.map(comp => new Comparator(comp, this.options))\n for (const comp of comparators) {\n if (isNullSet(comp)) {\n return [comp]\n }\n rangeMap.set(comp.value, comp)\n }\n if (rangeMap.size > 1 && rangeMap.has('')) {\n rangeMap.delete('')\n }\n\n const result = [...rangeMap.values()]\n cache.set(memoKey, result)\n return result\n }\n\n intersects (range, options) {\n if (!(range instanceof Range)) {\n throw new TypeError('a Range is required')\n }\n\n return this.set.some((thisComparators) => {\n return (\n isSatisfiable(thisComparators, options) &&\n range.set.some((rangeComparators) => {\n return (\n isSatisfiable(rangeComparators, options) &&\n thisComparators.every((thisComparator) => {\n return rangeComparators.every((rangeComparator) => {\n return thisComparator.intersects(rangeComparator, options)\n })\n })\n )\n })\n )\n })\n }\n\n // if ANY of the sets match ALL of its comparators, then pass\n test (version) {\n if (!version) {\n return false\n }\n\n if (typeof version === 'string') {\n try {\n version = new SemVer(version, this.options)\n } catch (er) {\n return false\n }\n }\n\n for (let i = 0; i < this.set.length; i++) {\n if (testSet(this.set[i], version, this.options)) {\n return true\n }\n }\n return false\n }\n}\n\nmodule.exports = Range\n\nconst LRU = require('../internal/lrucache')\nconst cache = new LRU()\n\nconst parseOptions = require('../internal/parse-options')\nconst Comparator = require('./comparator')\nconst debug = require('../internal/debug')\nconst SemVer = require('./semver')\nconst {\n safeRe: re,\n t,\n comparatorTrimReplace,\n tildeTrimReplace,\n caretTrimReplace,\n} = require('../internal/re')\nconst { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require('../internal/constants')\n\nconst isNullSet = c => c.value === '<0.0.0-0'\nconst isAny = c => c.value === ''\n\n// take a set of comparators and determine whether there\n// exists a version which can satisfy it\nconst isSatisfiable = (comparators, options) => {\n let result = true\n const remainingComparators = comparators.slice()\n let testComparator = remainingComparators.pop()\n\n while (result && remainingComparators.length) {\n result = remainingComparators.every((otherComparator) => {\n return testComparator.intersects(otherComparator, options)\n })\n\n testComparator = remainingComparators.pop()\n }\n\n return result\n}\n\n// comprised of xranges, tildes, stars, and gtlt's at this point.\n// already replaced the hyphen ranges\n// turn into a set of JUST comparators.\nconst parseComparator = (comp, options) => {\n debug('comp', comp, options)\n comp = replaceCarets(comp, options)\n debug('caret', comp)\n comp = replaceTildes(comp, options)\n debug('tildes', comp)\n comp = replaceXRanges(comp, options)\n debug('xrange', comp)\n comp = replaceStars(comp, options)\n debug('stars', comp)\n return comp\n}\n\nconst isX = id => !id || id.toLowerCase() === 'x' || id === '*'\n\n// ~, ~> --> * (any, kinda silly)\n// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0\n// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0\n// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0\n// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0\n// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0\n// ~0.0.1 --> >=0.0.1 <0.1.0-0\nconst replaceTildes = (comp, options) => {\n return comp\n .trim()\n .split(/\\s+/)\n .map((c) => replaceTilde(c, options))\n .join(' ')\n}\n\nconst replaceTilde = (comp, options) => {\n const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE]\n return comp.replace(r, (_, M, m, p, pr) => {\n debug('tilde', comp, _, M, m, p, pr)\n let ret\n\n if (isX(M)) {\n ret = ''\n } else if (isX(m)) {\n ret = `>=${M}.0.0 <${+M + 1}.0.0-0`\n } else if (isX(p)) {\n // ~1.2 == >=1.2.0 <1.3.0-0\n ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`\n } else if (pr) {\n debug('replaceTilde pr', pr)\n ret = `>=${M}.${m}.${p}-${pr\n } <${M}.${+m + 1}.0-0`\n } else {\n // ~1.2.3 == >=1.2.3 <1.3.0-0\n ret = `>=${M}.${m}.${p\n } <${M}.${+m + 1}.0-0`\n }\n\n debug('tilde return', ret)\n return ret\n })\n}\n\n// ^ --> * (any, kinda silly)\n// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0\n// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0\n// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0\n// ^1.2.3 --> >=1.2.3 <2.0.0-0\n// ^1.2.0 --> >=1.2.0 <2.0.0-0\n// ^0.0.1 --> >=0.0.1 <0.0.2-0\n// ^0.1.0 --> >=0.1.0 <0.2.0-0\nconst replaceCarets = (comp, options) => {\n return comp\n .trim()\n .split(/\\s+/)\n .map((c) => replaceCaret(c, options))\n .join(' ')\n}\n\nconst replaceCaret = (comp, options) => {\n debug('caret', comp, options)\n const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET]\n const z = options.includePrerelease ? '-0' : ''\n return comp.replace(r, (_, M, m, p, pr) => {\n debug('caret', comp, _, M, m, p, pr)\n let ret\n\n if (isX(M)) {\n ret = ''\n } else if (isX(m)) {\n ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`\n } else if (isX(p)) {\n if (M === '0') {\n ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`\n } else {\n ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`\n }\n } else if (pr) {\n debug('replaceCaret pr', pr)\n if (M === '0') {\n if (m === '0') {\n ret = `>=${M}.${m}.${p}-${pr\n } <${M}.${m}.${+p + 1}-0`\n } else {\n ret = `>=${M}.${m}.${p}-${pr\n } <${M}.${+m + 1}.0-0`\n }\n } else {\n ret = `>=${M}.${m}.${p}-${pr\n } <${+M + 1}.0.0-0`\n }\n } else {\n debug('no pr')\n if (M === '0') {\n if (m === '0') {\n ret = `>=${M}.${m}.${p\n }${z} <${M}.${m}.${+p + 1}-0`\n } else {\n ret = `>=${M}.${m}.${p\n }${z} <${M}.${+m + 1}.0-0`\n }\n } else {\n ret = `>=${M}.${m}.${p\n } <${+M + 1}.0.0-0`\n }\n }\n\n debug('caret return', ret)\n return ret\n })\n}\n\nconst replaceXRanges = (comp, options) => {\n debug('replaceXRanges', comp, options)\n return comp\n .split(/\\s+/)\n .map((c) => replaceXRange(c, options))\n .join(' ')\n}\n\nconst replaceXRange = (comp, options) => {\n comp = comp.trim()\n const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE]\n return comp.replace(r, (ret, gtlt, M, m, p, pr) => {\n debug('xRange', comp, ret, gtlt, M, m, p, pr)\n const xM = isX(M)\n const xm = xM || isX(m)\n const xp = xm || isX(p)\n const anyX = xp\n\n if (gtlt === '=' && anyX) {\n gtlt = ''\n }\n\n // if we're including prereleases in the match, then we need\n // to fix this to -0, the lowest possible prerelease value\n pr = options.includePrerelease ? '-0' : ''\n\n if (xM) {\n if (gtlt === '>' || gtlt === '<') {\n // nothing is allowed\n ret = '<0.0.0-0'\n } else {\n // nothing is forbidden\n ret = '*'\n }\n } else if (gtlt && anyX) {\n // we know patch is an x, because we have any x at all.\n // replace X with 0\n if (xm) {\n m = 0\n }\n p = 0\n\n if (gtlt === '>') {\n // >1 => >=2.0.0\n // >1.2 => >=1.3.0\n gtlt = '>='\n if (xm) {\n M = +M + 1\n m = 0\n p = 0\n } else {\n m = +m + 1\n p = 0\n }\n } else if (gtlt === '<=') {\n // <=0.7.x is actually <0.8.0, since any 0.7.x should\n // pass. Similarly, <=7.x is actually <8.0.0, etc.\n gtlt = '<'\n if (xm) {\n M = +M + 1\n } else {\n m = +m + 1\n }\n }\n\n if (gtlt === '<') {\n pr = '-0'\n }\n\n ret = `${gtlt + M}.${m}.${p}${pr}`\n } else if (xm) {\n ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`\n } else if (xp) {\n ret = `>=${M}.${m}.0${pr\n } <${M}.${+m + 1}.0-0`\n }\n\n debug('xRange return', ret)\n\n return ret\n })\n}\n\n// Because * is AND-ed with everything else in the comparator,\n// and '' means \"any version\", just remove the *s entirely.\nconst replaceStars = (comp, options) => {\n debug('replaceStars', comp, options)\n // Looseness is ignored here. star is always as loose as it gets!\n return comp\n .trim()\n .replace(re[t.STAR], '')\n}\n\nconst replaceGTE0 = (comp, options) => {\n debug('replaceGTE0', comp, options)\n return comp\n .trim()\n .replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '')\n}\n\n// This function is passed to string.replace(re[t.HYPHENRANGE])\n// M, m, patch, prerelease, build\n// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5\n// 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do\n// 1.2 - 3.4 => >=1.2.0 <3.5.0-0\n// TODO build?\nconst hyphenReplace = incPr => ($0,\n from, fM, fm, fp, fpr, fb,\n to, tM, tm, tp, tpr) => {\n if (isX(fM)) {\n from = ''\n } else if (isX(fm)) {\n from = `>=${fM}.0.0${incPr ? '-0' : ''}`\n } else if (isX(fp)) {\n from = `>=${fM}.${fm}.0${incPr ? '-0' : ''}`\n } else if (fpr) {\n from = `>=${from}`\n } else {\n from = `>=${from}${incPr ? '-0' : ''}`\n }\n\n if (isX(tM)) {\n to = ''\n } else if (isX(tm)) {\n to = `<${+tM + 1}.0.0-0`\n } else if (isX(tp)) {\n to = `<${tM}.${+tm + 1}.0-0`\n } else if (tpr) {\n to = `<=${tM}.${tm}.${tp}-${tpr}`\n } else if (incPr) {\n to = `<${tM}.${tm}.${+tp + 1}-0`\n } else {\n to = `<=${to}`\n }\n\n return `${from} ${to}`.trim()\n}\n\nconst testSet = (set, version, options) => {\n for (let i = 0; i < set.length; i++) {\n if (!set[i].test(version)) {\n return false\n }\n }\n\n if (version.prerelease.length && !options.includePrerelease) {\n // Find the set of versions that are allowed to have prereleases\n // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0\n // That should allow `1.2.3-pr.2` to pass.\n // However, `1.2.4-alpha.notready` should NOT be allowed,\n // even though it's within the range set by the comparators.\n for (let i = 0; i < set.length; i++) {\n debug(set[i].semver)\n if (set[i].semver === Comparator.ANY) {\n continue\n }\n\n if (set[i].semver.prerelease.length > 0) {\n const allowed = set[i].semver\n if (allowed.major === version.major &&\n allowed.minor === version.minor &&\n allowed.patch === version.patch) {\n return true\n }\n }\n }\n\n // Version has a -pre, but it's not one of the ones we like.\n return false\n }\n\n return true\n}\n","'use strict'\n\nconst ANY = Symbol('SemVer ANY')\n// hoisted class for cyclic dependency\nclass Comparator {\n static get ANY () {\n return ANY\n }\n\n constructor (comp, options) {\n options = parseOptions(options)\n\n if (comp instanceof Comparator) {\n if (comp.loose === !!options.loose) {\n return comp\n } else {\n comp = comp.value\n }\n }\n\n comp = comp.trim().split(/\\s+/).join(' ')\n debug('comparator', comp, options)\n this.options = options\n this.loose = !!options.loose\n this.parse(comp)\n\n if (this.semver === ANY) {\n this.value = ''\n } else {\n this.value = this.operator + this.semver.version\n }\n\n debug('comp', this)\n }\n\n parse (comp) {\n const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]\n const m = comp.match(r)\n\n if (!m) {\n throw new TypeError(`Invalid comparator: ${comp}`)\n }\n\n this.operator = m[1] !== undefined ? m[1] : ''\n if (this.operator === '=') {\n this.operator = ''\n }\n\n // if it literally is just '>' or '' then allow anything.\n if (!m[2]) {\n this.semver = ANY\n } else {\n this.semver = new SemVer(m[2], this.options.loose)\n }\n }\n\n toString () {\n return this.value\n }\n\n test (version) {\n debug('Comparator.test', version, this.options.loose)\n\n if (this.semver === ANY || version === ANY) {\n return true\n }\n\n if (typeof version === 'string') {\n try {\n version = new SemVer(version, this.options)\n } catch (er) {\n return false\n }\n }\n\n return cmp(version, this.operator, this.semver, this.options)\n }\n\n intersects (comp, options) {\n if (!(comp instanceof Comparator)) {\n throw new TypeError('a Comparator is required')\n }\n\n if (this.operator === '') {\n if (this.value === '') {\n return true\n }\n return new Range(comp.value, options).test(this.value)\n } else if (comp.operator === '') {\n if (comp.value === '') {\n return true\n }\n return new Range(this.value, options).test(comp.semver)\n }\n\n options = parseOptions(options)\n\n // Special cases where nothing can possibly be lower\n if (options.includePrerelease &&\n (this.value === '<0.0.0-0' || comp.value === '<0.0.0-0')) {\n return false\n }\n if (!options.includePrerelease &&\n (this.value.startsWith('<0.0.0') || comp.value.startsWith('<0.0.0'))) {\n return false\n }\n\n // Same direction increasing (> or >=)\n if (this.operator.startsWith('>') && comp.operator.startsWith('>')) {\n return true\n }\n // Same direction decreasing (< or <=)\n if (this.operator.startsWith('<') && comp.operator.startsWith('<')) {\n return true\n }\n // same SemVer and both sides are inclusive (<= or >=)\n if (\n (this.semver.version === comp.semver.version) &&\n this.operator.includes('=') && comp.operator.includes('=')) {\n return true\n }\n // opposite directions less than\n if (cmp(this.semver, '<', comp.semver, options) &&\n this.operator.startsWith('>') && comp.operator.startsWith('<')) {\n return true\n }\n // opposite directions greater than\n if (cmp(this.semver, '>', comp.semver, options) &&\n this.operator.startsWith('<') && comp.operator.startsWith('>')) {\n return true\n }\n return false\n }\n}\n\nmodule.exports = Comparator\n\nconst parseOptions = require('../internal/parse-options')\nconst { safeRe: re, t } = require('../internal/re')\nconst cmp = require('../functions/cmp')\nconst debug = require('../internal/debug')\nconst SemVer = require('./semver')\nconst Range = require('./range')\n","'use strict'\n\nconst Range = require('../classes/range')\nconst satisfies = (version, range, options) => {\n try {\n range = new Range(range, options)\n } catch (er) {\n return false\n }\n return range.test(version)\n}\nmodule.exports = satisfies\n","'use strict'\n\nconst Range = require('../classes/range')\n\n// Mostly just for testing and legacy API reasons\nconst toComparators = (range, options) =>\n new Range(range, options).set\n .map(comp => comp.map(c => c.value).join(' ').trim().split(' '))\n\nmodule.exports = toComparators\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst Range = require('../classes/range')\n\nconst maxSatisfying = (versions, range, options) => {\n let max = null\n let maxSV = null\n let rangeObj = null\n try {\n rangeObj = new Range(range, options)\n } catch (er) {\n return null\n }\n versions.forEach((v) => {\n if (rangeObj.test(v)) {\n // satisfies(v, range, options)\n if (!max || maxSV.compare(v) === -1) {\n // compare(max, v, true)\n max = v\n maxSV = new SemVer(max, options)\n }\n }\n })\n return max\n}\nmodule.exports = maxSatisfying\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst Range = require('../classes/range')\nconst minSatisfying = (versions, range, options) => {\n let min = null\n let minSV = null\n let rangeObj = null\n try {\n rangeObj = new Range(range, options)\n } catch (er) {\n return null\n }\n versions.forEach((v) => {\n if (rangeObj.test(v)) {\n // satisfies(v, range, options)\n if (!min || minSV.compare(v) === 1) {\n // compare(min, v, true)\n min = v\n minSV = new SemVer(min, options)\n }\n }\n })\n return min\n}\nmodule.exports = minSatisfying\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst Range = require('../classes/range')\nconst gt = require('../functions/gt')\n\nconst minVersion = (range, loose) => {\n range = new Range(range, loose)\n\n let minver = new SemVer('0.0.0')\n if (range.test(minver)) {\n return minver\n }\n\n minver = new SemVer('0.0.0-0')\n if (range.test(minver)) {\n return minver\n }\n\n minver = null\n for (let i = 0; i < range.set.length; ++i) {\n const comparators = range.set[i]\n\n let setMin = null\n comparators.forEach((comparator) => {\n // Clone to avoid manipulating the comparator's semver object.\n const compver = new SemVer(comparator.semver.version)\n switch (comparator.operator) {\n case '>':\n if (compver.prerelease.length === 0) {\n compver.patch++\n } else {\n compver.prerelease.push(0)\n }\n compver.raw = compver.format()\n /* fallthrough */\n case '':\n case '>=':\n if (!setMin || gt(compver, setMin)) {\n setMin = compver\n }\n break\n case '<':\n case '<=':\n /* Ignore maximum versions */\n break\n /* istanbul ignore next */\n default:\n throw new Error(`Unexpected operation: ${comparator.operator}`)\n }\n })\n if (setMin && (!minver || gt(minver, setMin))) {\n minver = setMin\n }\n }\n\n if (minver && range.test(minver)) {\n return minver\n }\n\n return null\n}\nmodule.exports = minVersion\n","'use strict'\n\nconst Range = require('../classes/range')\nconst validRange = (range, options) => {\n try {\n // Return '*' instead of '' so that truthiness works.\n // This will throw if it's invalid anyway\n return new Range(range, options).range || '*'\n } catch (er) {\n return null\n }\n}\nmodule.exports = validRange\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst Comparator = require('../classes/comparator')\nconst { ANY } = Comparator\nconst Range = require('../classes/range')\nconst satisfies = require('../functions/satisfies')\nconst gt = require('../functions/gt')\nconst lt = require('../functions/lt')\nconst lte = require('../functions/lte')\nconst gte = require('../functions/gte')\n\nconst outside = (version, range, hilo, options) => {\n version = new SemVer(version, options)\n range = new Range(range, options)\n\n let gtfn, ltefn, ltfn, comp, ecomp\n switch (hilo) {\n case '>':\n gtfn = gt\n ltefn = lte\n ltfn = lt\n comp = '>'\n ecomp = '>='\n break\n case '<':\n gtfn = lt\n ltefn = gte\n ltfn = gt\n comp = '<'\n ecomp = '<='\n break\n default:\n throw new TypeError('Must provide a hilo val of \"<\" or \">\"')\n }\n\n // If it satisfies the range it is not outside\n if (satisfies(version, range, options)) {\n return false\n }\n\n // From now on, variable terms are as if we're in \"gtr\" mode.\n // but note that everything is flipped for the \"ltr\" function.\n\n for (let i = 0; i < range.set.length; ++i) {\n const comparators = range.set[i]\n\n let high = null\n let low = null\n\n comparators.forEach((comparator) => {\n if (comparator.semver === ANY) {\n comparator = new Comparator('>=0.0.0')\n }\n high = high || comparator\n low = low || comparator\n if (gtfn(comparator.semver, high.semver, options)) {\n high = comparator\n } else if (ltfn(comparator.semver, low.semver, options)) {\n low = comparator\n }\n })\n\n // If the edge version comparator has a operator then our version\n // isn't outside it\n if (high.operator === comp || high.operator === ecomp) {\n return false\n }\n\n // If the lowest version comparator has an operator and our version\n // is less than it then it isn't higher than the range\n if ((!low.operator || low.operator === comp) &&\n ltefn(version, low.semver)) {\n return false\n } else if (low.operator === ecomp && ltfn(version, low.semver)) {\n return false\n }\n }\n return true\n}\n\nmodule.exports = outside\n","'use strict'\n\n// Determine if version is greater than all the versions possible in the range.\nconst outside = require('./outside')\nconst gtr = (version, range, options) => outside(version, range, '>', options)\nmodule.exports = gtr\n","'use strict'\n\nconst outside = require('./outside')\n// Determine if version is less than all the versions possible in the range\nconst ltr = (version, range, options) => outside(version, range, '<', options)\nmodule.exports = ltr\n","'use strict'\n\nconst Range = require('../classes/range')\nconst intersects = (r1, r2, options) => {\n r1 = new Range(r1, options)\n r2 = new Range(r2, options)\n return r1.intersects(r2, options)\n}\nmodule.exports = intersects\n","'use strict'\n\n// given a set of versions and a range, create a \"simplified\" range\n// that includes the same versions that the original range does\n// If the original range is shorter than the simplified one, return that.\nconst satisfies = require('../functions/satisfies.js')\nconst compare = require('../functions/compare.js')\nmodule.exports = (versions, range, options) => {\n const set = []\n let first = null\n let prev = null\n const v = versions.sort((a, b) => compare(a, b, options))\n for (const version of v) {\n const included = satisfies(version, range, options)\n if (included) {\n prev = version\n if (!first) {\n first = version\n }\n } else {\n if (prev) {\n set.push([first, prev])\n }\n prev = null\n first = null\n }\n }\n if (first) {\n set.push([first, null])\n }\n\n const ranges = []\n for (const [min, max] of set) {\n if (min === max) {\n ranges.push(min)\n } else if (!max && min === v[0]) {\n ranges.push('*')\n } else if (!max) {\n ranges.push(`>=${min}`)\n } else if (min === v[0]) {\n ranges.push(`<=${max}`)\n } else {\n ranges.push(`${min} - ${max}`)\n }\n }\n const simplified = ranges.join(' || ')\n const original = typeof range.raw === 'string' ? range.raw : String(range)\n return simplified.length < original.length ? simplified : range\n}\n","'use strict'\n\nconst Range = require('../classes/range.js')\nconst Comparator = require('../classes/comparator.js')\nconst { ANY } = Comparator\nconst satisfies = require('../functions/satisfies.js')\nconst compare = require('../functions/compare.js')\n\n// Complex range `r1 || r2 || ...` is a subset of `R1 || R2 || ...` iff:\n// - Every simple range `r1, r2, ...` is a null set, OR\n// - Every simple range `r1, r2, ...` which is not a null set is a subset of\n// some `R1, R2, ...`\n//\n// Simple range `c1 c2 ...` is a subset of simple range `C1 C2 ...` iff:\n// - If c is only the ANY comparator\n// - If C is only the ANY comparator, return true\n// - Else if in prerelease mode, return false\n// - else replace c with `[>=0.0.0]`\n// - If C is only the ANY comparator\n// - if in prerelease mode, return true\n// - else replace C with `[>=0.0.0]`\n// - Let EQ be the set of = comparators in c\n// - If EQ is more than one, return true (null set)\n// - Let GT be the highest > or >= comparator in c\n// - Let LT be the lowest < or <= comparator in c\n// - If GT and LT, and GT.semver > LT.semver, return true (null set)\n// - If any C is a = range, and GT or LT are set, return false\n// - If EQ\n// - If GT, and EQ does not satisfy GT, return true (null set)\n// - If LT, and EQ does not satisfy LT, return true (null set)\n// - If EQ satisfies every C, return true\n// - Else return false\n// - If GT\n// - If GT.semver is lower than any > or >= comp in C, return false\n// - If GT is >=, and GT.semver does not satisfy every C, return false\n// - If GT.semver has a prerelease, and not in prerelease mode\n// - If no C has a prerelease and the GT.semver tuple, return false\n// - If LT\n// - If LT.semver is greater than any < or <= comp in C, return false\n// - If LT is <=, and LT.semver does not satisfy every C, return false\n// - If GT.semver has a prerelease, and not in prerelease mode\n// - If no C has a prerelease and the LT.semver tuple, return false\n// - Else return true\n\nconst subset = (sub, dom, options = {}) => {\n if (sub === dom) {\n return true\n }\n\n sub = new Range(sub, options)\n dom = new Range(dom, options)\n let sawNonNull = false\n\n OUTER: for (const simpleSub of sub.set) {\n for (const simpleDom of dom.set) {\n const isSub = simpleSubset(simpleSub, simpleDom, options)\n sawNonNull = sawNonNull || isSub !== null\n if (isSub) {\n continue OUTER\n }\n }\n // the null set is a subset of everything, but null simple ranges in\n // a complex range should be ignored. so if we saw a non-null range,\n // then we know this isn't a subset, but if EVERY simple range was null,\n // then it is a subset.\n if (sawNonNull) {\n return false\n }\n }\n return true\n}\n\nconst minimumVersionWithPreRelease = [new Comparator('>=0.0.0-0')]\nconst minimumVersion = [new Comparator('>=0.0.0')]\n\nconst simpleSubset = (sub, dom, options) => {\n if (sub === dom) {\n return true\n }\n\n if (sub.length === 1 && sub[0].semver === ANY) {\n if (dom.length === 1 && dom[0].semver === ANY) {\n return true\n } else if (options.includePrerelease) {\n sub = minimumVersionWithPreRelease\n } else {\n sub = minimumVersion\n }\n }\n\n if (dom.length === 1 && dom[0].semver === ANY) {\n if (options.includePrerelease) {\n return true\n } else {\n dom = minimumVersion\n }\n }\n\n const eqSet = new Set()\n let gt, lt\n for (const c of sub) {\n if (c.operator === '>' || c.operator === '>=') {\n gt = higherGT(gt, c, options)\n } else if (c.operator === '<' || c.operator === '<=') {\n lt = lowerLT(lt, c, options)\n } else {\n eqSet.add(c.semver)\n }\n }\n\n if (eqSet.size > 1) {\n return null\n }\n\n let gtltComp\n if (gt && lt) {\n gtltComp = compare(gt.semver, lt.semver, options)\n if (gtltComp > 0) {\n return null\n } else if (gtltComp === 0 && (gt.operator !== '>=' || lt.operator !== '<=')) {\n return null\n }\n }\n\n // will iterate one or zero times\n for (const eq of eqSet) {\n if (gt && !satisfies(eq, String(gt), options)) {\n return null\n }\n\n if (lt && !satisfies(eq, String(lt), options)) {\n return null\n }\n\n for (const c of dom) {\n if (!satisfies(eq, String(c), options)) {\n return false\n }\n }\n\n return true\n }\n\n let higher, lower\n let hasDomLT, hasDomGT\n // if the subset has a prerelease, we need a comparator in the superset\n // with the same tuple and a prerelease, or it's not a subset\n let needDomLTPre = lt &&\n !options.includePrerelease &&\n lt.semver.prerelease.length ? lt.semver : false\n let needDomGTPre = gt &&\n !options.includePrerelease &&\n gt.semver.prerelease.length ? gt.semver : false\n // exception: <1.2.3-0 is the same as <1.2.3\n if (needDomLTPre && needDomLTPre.prerelease.length === 1 &&\n lt.operator === '<' && needDomLTPre.prerelease[0] === 0) {\n needDomLTPre = false\n }\n\n for (const c of dom) {\n hasDomGT = hasDomGT || c.operator === '>' || c.operator === '>='\n hasDomLT = hasDomLT || c.operator === '<' || c.operator === '<='\n if (gt) {\n if (needDomGTPre) {\n if (c.semver.prerelease && c.semver.prerelease.length &&\n c.semver.major === needDomGTPre.major &&\n c.semver.minor === needDomGTPre.minor &&\n c.semver.patch === needDomGTPre.patch) {\n needDomGTPre = false\n }\n }\n if (c.operator === '>' || c.operator === '>=') {\n higher = higherGT(gt, c, options)\n if (higher === c && higher !== gt) {\n return false\n }\n } else if (gt.operator === '>=' && !satisfies(gt.semver, String(c), options)) {\n return false\n }\n }\n if (lt) {\n if (needDomLTPre) {\n if (c.semver.prerelease && c.semver.prerelease.length &&\n c.semver.major === needDomLTPre.major &&\n c.semver.minor === needDomLTPre.minor &&\n c.semver.patch === needDomLTPre.patch) {\n needDomLTPre = false\n }\n }\n if (c.operator === '<' || c.operator === '<=') {\n lower = lowerLT(lt, c, options)\n if (lower === c && lower !== lt) {\n return false\n }\n } else if (lt.operator === '<=' && !satisfies(lt.semver, String(c), options)) {\n return false\n }\n }\n if (!c.operator && (lt || gt) && gtltComp !== 0) {\n return false\n }\n }\n\n // if there was a < or >, and nothing in the dom, then must be false\n // UNLESS it was limited by another range in the other direction.\n // Eg, >1.0.0 <1.0.1 is still a subset of <2.0.0\n if (gt && hasDomLT && !lt && gtltComp !== 0) {\n return false\n }\n\n if (lt && hasDomGT && !gt && gtltComp !== 0) {\n return false\n }\n\n // we needed a prerelease range in a specific tuple, but didn't get one\n // then this isn't a subset. eg >=1.2.3-pre is not a subset of >=1.0.0,\n // because it includes prereleases in the 1.2.3 tuple\n if (needDomGTPre || needDomLTPre) {\n return false\n }\n\n return true\n}\n\n// >=1.2.3 is lower than >1.2.3\nconst higherGT = (a, b, options) => {\n if (!a) {\n return b\n }\n const comp = compare(a.semver, b.semver, options)\n return comp > 0 ? a\n : comp < 0 ? b\n : b.operator === '>' && a.operator === '>=' ? b\n : a\n}\n\n// <=1.2.3 is higher than <1.2.3\nconst lowerLT = (a, b, options) => {\n if (!a) {\n return b\n }\n const comp = compare(a.semver, b.semver, options)\n return comp < 0 ? a\n : comp > 0 ? b\n : b.operator === '<' && a.operator === '<=' ? b\n : a\n}\n\nmodule.exports = subset\n","'use strict'\n\n// just pre-load all the stuff that index.js lazily exports\nconst internalRe = require('./internal/re')\nconst constants = require('./internal/constants')\nconst SemVer = require('./classes/semver')\nconst identifiers = require('./internal/identifiers')\nconst parse = require('./functions/parse')\nconst valid = require('./functions/valid')\nconst clean = require('./functions/clean')\nconst inc = require('./functions/inc')\nconst diff = require('./functions/diff')\nconst major = require('./functions/major')\nconst minor = require('./functions/minor')\nconst patch = require('./functions/patch')\nconst prerelease = require('./functions/prerelease')\nconst compare = require('./functions/compare')\nconst rcompare = require('./functions/rcompare')\nconst compareLoose = require('./functions/compare-loose')\nconst compareBuild = require('./functions/compare-build')\nconst sort = require('./functions/sort')\nconst rsort = require('./functions/rsort')\nconst gt = require('./functions/gt')\nconst lt = require('./functions/lt')\nconst eq = require('./functions/eq')\nconst neq = require('./functions/neq')\nconst gte = require('./functions/gte')\nconst lte = require('./functions/lte')\nconst cmp = require('./functions/cmp')\nconst coerce = require('./functions/coerce')\nconst Comparator = require('./classes/comparator')\nconst Range = require('./classes/range')\nconst satisfies = require('./functions/satisfies')\nconst toComparators = require('./ranges/to-comparators')\nconst maxSatisfying = require('./ranges/max-satisfying')\nconst minSatisfying = require('./ranges/min-satisfying')\nconst minVersion = require('./ranges/min-version')\nconst validRange = require('./ranges/valid')\nconst outside = require('./ranges/outside')\nconst gtr = require('./ranges/gtr')\nconst ltr = require('./ranges/ltr')\nconst intersects = require('./ranges/intersects')\nconst simplifyRange = require('./ranges/simplify')\nconst subset = require('./ranges/subset')\nmodule.exports = {\n parse,\n valid,\n clean,\n inc,\n diff,\n major,\n minor,\n patch,\n prerelease,\n compare,\n rcompare,\n compareLoose,\n compareBuild,\n sort,\n rsort,\n gt,\n lt,\n eq,\n neq,\n gte,\n lte,\n cmp,\n coerce,\n Comparator,\n Range,\n satisfies,\n toComparators,\n maxSatisfying,\n minSatisfying,\n minVersion,\n validRange,\n outside,\n gtr,\n ltr,\n intersects,\n simplifyRange,\n subset,\n SemVer,\n re: internalRe.re,\n src: internalRe.src,\n tokens: internalRe.t,\n SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,\n RELEASE_TYPES: constants.RELEASE_TYPES,\n compareIdentifiers: identifiers.compareIdentifiers,\n rcompareIdentifiers: identifiers.rcompareIdentifiers,\n}\n","import { readFileSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\n\nexport interface TransformerPromptChoice {\n name: string;\n value: string;\n}\n\nexport interface TransformerPrompt {\n key: string;\n type: 'select' | 'input' | 'confirm';\n message: string;\n default?: string | boolean;\n choices?: TransformerPromptChoice[];\n}\n\nexport interface TransformerConfig {\n prerequisites?: Record<string, string>;\n prompts?: TransformerPrompt[];\n type: 'jscodeshift' | 'claude';\n}\n\n/** Retrieves a JSON object from a file path, returning null if the file does not exist */\nexport const getJsonFromPath = <T>(baseDir: string, fileName: string): T => {\n const jsonPath = join(baseDir, fileName);\n\n try {\n const jsonContent = readFileSync(jsonPath, 'utf8');\n return JSON.parse(jsonContent) as T;\n } catch {\n throw new Error(`Error reading ${jsonPath}`);\n }\n};\n\nexport function getCodemodConfig(codemodPath: string): TransformerConfig {\n try {\n return getJsonFromPath<TransformerConfig>(dirname(codemodPath), 'config.json');\n } catch {\n throw new Error(`Error reading codemod config for ${codemodPath}`);\n }\n}\n","import { exec, execSync } from 'node:child_process';\nimport { existsSync } from 'node:fs';\nimport path from 'node:path';\nimport { promisify } from 'node:util';\n\nconst execAsync = promisify(exec);\n\n/**\n * Finds the root of the project by looking for the `.git` directory.\n */\nexport function findProjectRoot(): string {\n try {\n const gitRoot = execSync('git rev-parse --show-toplevel', {\n cwd: process.cwd(),\n encoding: 'utf8',\n stdio: ['ignore', 'pipe', 'ignore'],\n }).trim();\n\n return gitRoot && existsSync(gitRoot) ? gitRoot : '';\n } catch {\n return '';\n }\n}\n\n/**\n * Quick and dirty way of determining package roots based on\n * the presence of `package.json` files and them optimistically\n * containing a `@transferwise/components` string.\n * */\nexport async function findPackages(): Promise<string[]> {\n try {\n const { stdout } = await execAsync(\n [\n 'find ./',\n '-type f',\n '-name \"package.json\"',\n '-not -path \"*/node_modules/*\"',\n '|',\n 'xargs grep -l \"@transferwise/components\"',\n ].join(' '),\n {\n cwd: findProjectRoot(),\n encoding: 'utf8',\n },\n );\n\n const packages = stdout.trim().split('\\n').filter(Boolean).map(path.dirname);\n\n if (packages.length === 0) {\n throw new Error();\n }\n\n return packages;\n } catch {\n throw new Error('No suitable package roots found in the repository.');\n }\n}\n","/**\n * Renders an object as a table in terminal\n */\nexport const renderTable = (\n data: Record<string, Record<string, string>>,\n indexHeading = 'index',\n): void => {\n const firstEntry = Object.values(data)[0];\n if (!firstEntry) {\n console.info('No data to display');\n return;\n }\n\n const headings = [indexHeading, ...Object.keys(firstEntry)];\n const tableData: string[][] = [];\n\n Object.entries(data).forEach(([packageName, details]) => {\n tableData.push([packageName, ...Object.values(details)]);\n });\n\n const getDisplayWidth = (str: string): number => {\n // eslint-disable-next-line regexp/no-control-character\n return str.replace(/\\x1b\\[[0-9;]*m/gu, '').length;\n };\n\n const columnWidths = headings.map((heading, index) => {\n const maxDataWidth = Math.max(...tableData.map((row) => getDisplayWidth(row[index] || '')));\n return Math.max(heading.length, maxDataWidth);\n });\n\n const firstCellLine = '─'.repeat(columnWidths[0] + 2);\n const remainingLines = columnWidths.slice(1).map((width) => '─'.repeat(width + 2));\n const topSeparator = `┌${firstCellLine}┬${remainingLines.join('┬')}┐`;\n const midSeparator = `├${firstCellLine}┼${remainingLines.join('┼')}┤`;\n const endSeparator = `└${firstCellLine}┴${remainingLines.join('┴')}┘`;\n\n const formatRow = (cells: string[]) => {\n const formattedCells = cells.map((cell, index) => {\n const width = columnWidths[index];\n const displayWidth = getDisplayWidth(cell);\n const padding = width - displayWidth;\n return ` ${cell}${' '.repeat(Math.max(0, padding))} `;\n });\n return `│${formattedCells.join('│')}│`;\n };\n\n console.info(topSeparator);\n console.info(formatRow(headings));\n console.info(midSeparator);\n tableData.forEach((row) => {\n console.info(formatRow(row));\n });\n console.info(endSeparator);\n};\n","import { existsSync, readFileSync } from 'node:fs';\nimport { dirname, join, resolve } from 'node:path';\n\nimport semver from 'semver';\nimport type Spinnies from 'spinnies';\n\nimport { CONSOLE_ICONS } from '../../constants';\nimport { getCodemodConfig, getJsonFromPath } from './getCodemodConfig';\nimport { findProjectRoot } from './repository';\nimport { renderTable } from './table';\n\ninterface PackageJson {\n version?: string;\n dependencies?: Record<string, string>;\n peerDependencies?: Record<string, string>;\n [key: string]: Record<string, string> | string | undefined;\n}\n\n/**\n * Checks if the installed version satisfies the given version requirement.\n */\nfunction isVersionSatisfied(installedVersion: string, versionRequirement: string): boolean {\n if (!installedVersion) return false;\n\n if (semver.valid(installedVersion) && semver.satisfies(installedVersion, versionRequirement)) {\n return true;\n }\n\n const cleanVersion = semver.coerce(installedVersion);\n return cleanVersion ? semver.satisfies(cleanVersion.version, versionRequirement) : false;\n}\n\n/**\n * Retrieves the version of a dependency from node_modules of a specific package.\n */\nfunction getVersionFromNodeModules(packagePath: string, packageName: string): string {\n try {\n const nodeModulesPackageJson = join(packagePath, 'node_modules', packageName, 'package.json');\n if (!existsSync(nodeModulesPackageJson)) return '';\n\n const packageJson = JSON.parse(readFileSync(nodeModulesPackageJson, 'utf8')) as PackageJson;\n return packageJson.version || '';\n } catch {\n return '';\n }\n}\n\n/**\n * Finds the closest package.json by traversing up the directory tree\n */\nfunction findClosestPackageJson(currentPath: string): string | null {\n const resolvedPath = resolve(currentPath);\n const projectRoot = findProjectRoot();\n\n const packageJsonPath = join(resolvedPath, 'package.json');\n if (existsSync(packageJsonPath)) {\n return resolvedPath;\n }\n\n if (projectRoot && resolvedPath === projectRoot) {\n return null;\n }\n\n const parentPath = dirname(resolvedPath);\n if (parentPath === resolvedPath) {\n // Reached the root of the filesystem\n return null;\n }\n\n return findClosestPackageJson(parentPath);\n}\n\n/**\n * Assesses whether the given package meets the prerequisites defined in the codemod's config.json.\n */\nexport const assessPrerequisites = (packagePath: string, codemodPath: string): boolean => {\n try {\n const codemodConfig = getCodemodConfig(codemodPath);\n const resolvedPackagePath = resolve(process.cwd(), packagePath);\n\n const actualPackagePath = existsSync(join(resolvedPackagePath, 'package.json'))\n ? resolvedPackagePath\n : findClosestPackageJson(resolvedPackagePath);\n\n if (!actualPackagePath) {\n console.error(\n `${CONSOLE_ICONS.error} \\x1b[1mCould not find a package.json in or above ${packagePath}\\x1b[0m`,\n );\n return false;\n }\n\n if (actualPackagePath !== resolvedPackagePath) {\n console.info(\n `${CONSOLE_ICONS.info} Using package.json from ${actualPackagePath} for dependency checks`,\n );\n }\n\n const packageJson = getJsonFromPath<PackageJson>(actualPackagePath, 'package.json');\n\n if (!packageJson) {\n return false;\n }\n\n const { dependencies = {}, peerDependencies = {} } = packageJson;\n\n const comparisons: Record<string, Record<string, string>> = {};\n let isCompliant = true;\n\n if (codemodConfig?.prerequisites) {\n Object.entries(codemodConfig.prerequisites).forEach(([name, versionRequirement]) => {\n const nodeModulesVersion = getVersionFromNodeModules(actualPackagePath, name);\n const isDependencySatisfied = isVersionSatisfied(dependencies[name], versionRequirement);\n const isPeerDependencySatisfied = isVersionSatisfied(\n peerDependencies[name],\n versionRequirement,\n );\n const isInstalledSatisfied = isVersionSatisfied(nodeModulesVersion, versionRequirement);\n\n if ((!isDependencySatisfied && !isPeerDependencySatisfied) || !isInstalledSatisfied) {\n isCompliant = false;\n\n comparisons[name] = {\n required: versionRequirement,\n dependencies: isDependencySatisfied\n ? CONSOLE_ICONS.success\n : `${CONSOLE_ICONS.error} ${dependencies[name] || 'N/A'}`,\n peerDependencies: isPeerDependencySatisfied\n ? CONSOLE_ICONS.success\n : `${CONSOLE_ICONS.error} ${peerDependencies[name] || 'N/A'}`,\n node_modules: isInstalledSatisfied\n ? CONSOLE_ICONS.success\n : `${CONSOLE_ICONS.error} ${nodeModulesVersion || 'N/A'}`,\n };\n }\n });\n }\n\n if (!isCompliant) {\n console.info(\n `${CONSOLE_ICONS.error} \\x1b[31mPrerequisite check failed -\\x1b[0m \\x1b[2m${packagePath}\\x1b[0m`,\n );\n renderTable(comparisons, 'package');\n\n return false;\n }\n\n return true;\n } catch (error) {\n console.error('Cannot assess the state of prerequisites:', error);\n return false;\n }\n};\n\n/**\n * Batch prerequisite assessment across multiple target paths.\n * - Resolves each target to its effective package root (closest package.json)\n * - Deduplicates by package root and checks each unique root once\n * - Logs a concise summary; detailed table is logged by assessPrerequisites on failure\n */\nexport const assessPrerequisitesBatch = (\n targetPaths: string[],\n codemodPath: string,\n spinnies: Spinnies,\n): {\n allPassed: boolean;\n results: Map<string, boolean>;\n packageRootToTargets: Map<string, string[]>;\n failedPackageRoots: string[];\n failedTargetsNoPackage: string[];\n} => {\n const packageRootToTargets = new Map<string, string[]>();\n const failedTargetsNoPackage: string[] = [];\n\n for (const target of targetPaths) {\n const resolved = resolve(process.cwd(), target);\n const actual = existsSync(join(resolved, 'package.json'))\n ? resolved\n : findClosestPackageJson(resolved);\n if (actual) {\n const list = packageRootToTargets.get(actual) ?? [];\n list.push(target);\n packageRootToTargets.set(target, list);\n } else {\n failedTargetsNoPackage.push(target);\n }\n }\n\n let allPassed = true;\n const results = new Map<string, boolean>();\n\n for (const [pkgRoot] of packageRootToTargets.entries()) {\n // Run the existing single-check once per unique package root\n const passed = assessPrerequisites(pkgRoot, codemodPath);\n results.set(pkgRoot, passed);\n if (!passed) allPassed = false;\n }\n\n const totalTargets = targetPaths.length;\n const uniquePackages = packageRootToTargets.size;\n const passedCount = Array.from(results.values()).filter(Boolean).length;\n const failedCount = uniquePackages - passedCount;\n\n if (failedTargetsNoPackage.length || !passedCount) {\n if (!passedCount) {\n spinnies.fail('prerequisite-check', { text: 'All targets failed prerequisite checks' });\n } else {\n spinnies.fail('prerequisite-check', {\n text: `No package.json found for ${failedTargetsNoPackage.length} target${\n failedTargetsNoPackage.length !== 1 ? 's' : ''\n } (searching upwards to project root).`,\n });\n failedTargetsNoPackage.forEach((t) => console.error(`- ${t}`));\n }\n } else {\n const failedPart = failedCount > 0 ? `, \\x1b[31m${failedCount} failed\\x1b[0m` : '';\n\n spinnies.succeed('prerequisite-check', {\n text: `\\x1b[0mChecked ${totalTargets} target${totalTargets !== 1 ? 's' : ''} across ${uniquePackages} package${\n uniquePackages !== 1 ? 's' : ''\n }:\\x1b[0m \\x1b[32m${passedCount} passed\\x1b[0m${failedPart}`,\n });\n }\n\n const failedPackageRoots = Array.from(results.entries())\n .filter(([, ok]) => !ok)\n .map(([root]) => root);\n\n return { allPassed, results, packageRootToTargets, failedPackageRoots, failedTargetsNoPackage };\n};\n","import { existsSync, readdirSync, statSync } from 'node:fs';\nimport { join, relative } from 'node:path';\n\nimport { checkbox, confirm, input, search, select as list } from '@inquirer/prompts';\n\nimport type { CodemodOptions } from '../types';\n\n/**\n * if args are provided via CLI, log them to the console in\n * a formatted way matching Inquirer's style\n */\nexport const logToInquirer = (label: string, value?: string) => {\n const checkmark = '\\x1b[32m✔\\x1b[0m'; // Green checkmark\n const boldLabel = `\\x1b[1m${label}\\x1b[0m`; // Bold label\n const greenValue = `\\x1b[32m${value}\\x1b[0m`; // Green value\n\n console.info(`${checkmark} ${boldLabel} ${greenValue}`);\n};\n\n/**\n * Get all directories recursively for autocomplete\n */\nconst getDirectoryChoices = (rootPath: string, currentInput = '', maxDepth = 3): string[] => {\n const MAX_FILTERED_CHOICES = 10;\n const MAX_DEFAULT_CHOICES = 20;\n const SKIP_DIRS = new Set([\n 'node_modules',\n 'dist',\n 'build',\n 'coverage',\n '.git',\n '.next',\n '.nuxt',\n '.vscode',\n '.idea',\n ]);\n\n const choices = new Set<string>();\n choices.add('.');\n\n const scanDirectory = (dirPath: string, depth = 0): void => {\n if (depth >= maxDepth) return;\n\n try {\n const items = readdirSync(dirPath, { withFileTypes: true });\n\n for (const item of items) {\n if (!item.name.startsWith('.') && !SKIP_DIRS.has(item.name)) {\n if (item.isDirectory()) {\n const fullPath = join(dirPath, item.name);\n const relativePath = relative(rootPath, fullPath);\n\n if (relativePath && !relativePath.startsWith('..') && !relativePath.includes('..')) {\n choices.add(relativePath);\n scanDirectory(fullPath, depth + 1);\n }\n }\n }\n }\n } catch {\n // Silently ignore directories we can't read (permissions, etc.)\n }\n };\n\n scanDirectory(rootPath);\n\n const allChoices = Array.from(choices).sort();\n\n if (currentInput.trim()) {\n const inputLower = currentInput.toLowerCase();\n return allChoices\n .filter((choice) => choice.toLowerCase().includes(inputLower))\n .slice(0, MAX_FILTERED_CHOICES);\n }\n\n return allChoices.slice(0, MAX_DEFAULT_CHOICES);\n};\n\n/**\n * Lets user pick from available packages to run the codemod on\n */\nconst queryPackages = async (packages: string[]) => {\n const message = 'Path to run codemod on:';\n const nonRootPackages = packages.filter((pkg) => pkg !== '.' && pkg !== './');\n\n // root package only (single repo scenario)\n // This handles [\".\"], [\"./\"], and cases where only root exists\n if (packages.length === 1 && (packages[0] === '.' || packages[0] === './')) {\n const useCustomPath = await confirm({\n message: 'Do you want to target a specific folder instead of the entire project?',\n default: false,\n });\n\n if (useCustomPath) {\n const customPath = await search({\n message: 'Enter the folder path (relative to project root):',\n source: async (searchInput) => {\n const rootPath = process.cwd();\n const choices = getDirectoryChoices(rootPath, searchInput || '');\n\n return choices.map((choice) => ({\n name: choice === '.' ? '. (entire project)' : choice,\n value: choice,\n description:\n choice === '.' ? 'Target the entire project' : `Target ${choice} directory`,\n }));\n },\n validate: (path) => {\n if (!path?.trim()) return 'Path cannot be empty';\n const fullPath = join(process.cwd(), path);\n if (!existsSync(fullPath)) return 'Folder does not exist';\n if (!statSync(fullPath).isDirectory()) return 'Path must be a directory';\n return true;\n },\n });\n\n logToInquirer(message, customPath);\n return [customPath];\n }\n\n logToInquirer(message, packages[0] === './' ? '.' : packages[0]);\n return [packages[0] === './' ? '.' : packages[0]];\n }\n\n // multiple non-root packages (monorepo scenario)\n if (nonRootPackages.length >= 1) {\n return checkbox({\n required: true,\n message: 'Select packages to transform:',\n choices: nonRootPackages.map((file) => ({\n name: file,\n value: file,\n checked: true,\n })),\n });\n }\n\n return ['.'];\n};\n\n/**\n * Determine user choice between CLI arg and Inquirer prompt: codemod\n */\nconst determineTransformer = async ({\n candidate,\n transformFiles,\n}: {\n candidate: string;\n transformFiles: string[];\n}): Promise<string> => {\n const codemodMessage = 'Select codemod to run:';\n\n if (candidate && transformFiles.includes(candidate)) {\n logToInquirer(codemodMessage, candidate);\n return candidate;\n }\n\n return list({\n message: codemodMessage,\n choices: transformFiles.map((file) => ({ name: file, value: file })),\n });\n};\n\n/**\n * Determine user choice between CLI arg and Inquirer prompt: paths/packages to process\n */\nconst determinePaths = async ({\n candidate,\n root,\n packages,\n}: {\n candidate: string;\n root: string;\n packages: string[];\n}): Promise<string[]> => {\n const targetPaths = [];\n\n if (candidate && existsSync(join(root, candidate))) {\n logToInquirer('Path to run codemod on', candidate);\n targetPaths.push(candidate);\n }\n\n if (!targetPaths.length) {\n const packagesToProcess = await queryPackages(packages);\n targetPaths.push(...(packagesToProcess ?? []));\n }\n\n return targetPaths;\n};\n\n/**\n * Determine user choice between CLI arg and Inquirer prompt: dry mode\n */\nconst determineIsDryMode = async (args: string[]) => {\n const message = 'Run in dry mode (no changes written to files)?';\n if (args.includes('--dry') || args.includes('--dry-run')) {\n logToInquirer(message, 'Yes');\n return true;\n }\n\n return confirm({ message, default: false });\n};\n\n/**\n * Determine user choice between CLI arg and Inquirer prompt: print to CLI\n */\nconst determineIsPrint = async (args: string[]) => {\n const message = 'Print transformed source to console?';\n\n if (args.includes('--print')) {\n logToInquirer(message, 'Yes');\n return true;\n }\n\n return confirm({ message, default: false });\n};\n\nconst ALWAYS_IGNORED_FOLDERS = ['node_modules/**', '.next/**'];\n\n/**\n * Determine user choice between CLI arg and Inquirer prompt: ignore patterns\n */\nconst determineIgnorePatterns = async (args: string[]) => {\n const message = 'Enter ignore pattern(s) (comma separated) or leave empty:';\n const ignorePatternIndex = args.findIndex((arg) => arg === '--ignore-pattern');\n\n let ignorePattern: string | undefined;\n\n if (ignorePatternIndex !== -1 && args.length > ignorePatternIndex + 1) {\n ignorePattern = args[ignorePatternIndex + 1];\n }\n\n let userPatterns: string;\n if (ignorePattern) {\n logToInquirer(message, ignorePattern);\n userPatterns = ignorePattern;\n } else {\n userPatterns = await input({\n message,\n validate: () => true,\n });\n }\n\n const allPatterns = [...ALWAYS_IGNORED_FOLDERS];\n if (userPatterns && userPatterns.trim()) {\n allPatterns.push(...userPatterns.split(',').map((p) => p.trim()));\n }\n\n return allPatterns.join(',');\n};\n\n/**\n * Determine user choice between CLI arg and Inquirer prompt: gitignore\n */\nconst determineGitIgnore = async (args: string[]) => {\n const message = 'Respect .gitignore files?';\n\n if (args.includes('--gitignore')) {\n logToInquirer(message, 'Yes');\n return true;\n }\n\n if (args.includes('--no-gitignore')) {\n logToInquirer(message, 'No');\n return false;\n }\n\n return confirm({ message, default: true });\n};\n\ninterface OptionsParams {\n transformFiles: string[];\n packages: string[];\n root: string;\n preselectedTransformFile?: string;\n}\n\nasync function getOptions({\n transformFiles,\n packages,\n root,\n preselectedTransformFile,\n}: OptionsParams): Promise<CodemodOptions> {\n const args = process.argv.slice(2);\n\n if (preselectedTransformFile && args[0] === preselectedTransformFile) {\n args.shift();\n }\n\n const transformFile =\n preselectedTransformFile ||\n (await determineTransformer({ candidate: args[0] ?? '', transformFiles }));\n\n const pathCandidate = preselectedTransformFile ? (args[0] ?? '') : (args[1] ?? '');\n const targetPaths = await determinePaths({\n candidate: pathCandidate,\n root,\n packages,\n });\n\n const isDry = transformFile === 'button' ? await determineIsDryMode(args) : false;\n const isPrint = await determineIsPrint(args);\n const ignorePatterns =\n transformFile === 'list-item'\n ? ALWAYS_IGNORED_FOLDERS.join(',')\n : await determineIgnorePatterns(args);\n const useGitIgnore = transformFile === 'button' ? await determineGitIgnore(args) : true;\n\n return {\n transformFile,\n targetPaths,\n isDry,\n isPrint,\n ignorePatterns,\n useGitIgnore,\n };\n}\n\nexport default getOptions;\n","import { promises as fs, readdirSync } from 'node:fs';\nimport path from 'node:path';\n\ninterface TransformModule {\n default: {\n default: unknown;\n };\n}\n\n/**\n * Get list of available transform names without loading them\n */\nexport function listTransforms(transformsDir: string): string[] {\n const transformers = readdirSync(transformsDir);\n return transformers;\n}\n\nasync function loadTransformModules(transformsDir: string) {\n let transformModules: Record<string, unknown> = {};\n const transformers = await fs.readdir(transformsDir);\n\n const transformFiles = await Promise.all(\n transformers.map(async (name) => {\n const transformPath = path.join(transformsDir, name, 'transformer.js');\n const transformModule = (await import(transformPath)) as TransformModule;\n transformModules = { ...transformModules, [name]: transformModule.default.default };\n return name;\n }),\n );\n\n return { transformModules, transformFiles };\n}\n\nexport default loadTransformModules;\n","import fs from 'node:fs/promises';\nimport path from 'node:path';\n\nconst REPORT_PATH = path.resolve(process.cwd(), 'codemod-report.txt');\n\nconst reportManualReview = async (filePath: string, message: string): Promise<void> => {\n const lineMatch = /at line (\\d+)/u.exec(message);\n const lineNumber = lineMatch?.[1];\n\n const cleanMessage = message.replace(/ at line \\d+/u, '');\n const lineInfo = lineNumber ? `:${lineNumber}` : '';\n\n let isFirstEntry = false;\n let currentTransform: string | undefined;\n\n try {\n await fs.access(REPORT_PATH);\n const existingContent = await fs.readFile(REPORT_PATH, 'utf8');\n isFirstEntry = existingContent.trim() === '';\n } catch {\n isFirstEntry = true;\n }\n\n // Try to determine the current transform from the process arguments\n const args = process.argv;\n const transformIndex = args.findIndex((arg) => arg.endsWith('transformer.js'));\n if (transformIndex >= 0) {\n const transformPath = args[transformIndex];\n const transformDir = path.dirname(transformPath);\n currentTransform = path.basename(transformDir);\n }\n\n const content = `[${filePath}${lineInfo}] ${cleanMessage}\\n`;\n await fs.appendFile(REPORT_PATH, content, 'utf8');\n};\n\nexport default reportManualReview;\n","import { confirm, input, select } from '@inquirer/prompts';\n\nimport { getCodemodConfig, type TransformerPrompt } from './getCodemodConfig';\n\ntype Answers = Record<string, string | boolean>;\n\nasync function askPrompt(p: TransformerPrompt): Promise<string | boolean> {\n switch (p.type) {\n case 'select':\n return select({\n message: p.message,\n choices: (p.choices ?? []).map((c) => ({ name: c.name, value: c.value })),\n default: p.default as string | undefined,\n });\n case 'confirm':\n return confirm({\n message: p.message,\n default: typeof p.default === 'boolean' ? p.default : false,\n });\n case 'input':\n default:\n return input({\n message: p.message,\n default: (p.default as string) ?? '',\n });\n }\n}\n\nexport async function runTransformPrompts(codemodPath: string): Promise<Answers> {\n const config = getCodemodConfig(codemodPath);\n if (!config?.prompts?.length) return {};\n\n const answers: Answers = {};\n\n for (const prompt of config.prompts) {\n try {\n answers[prompt.key] = await askPrompt(prompt);\n } catch (error) {\n console.warn(\n `Failed to execute prompt \"${prompt.key}\": ${error instanceof Error ? error.message : String(error)}`,\n );\n\n if (prompt.default !== undefined) {\n console.info(`Using default value for \"${prompt.key}\": ${prompt.default}`);\n answers[prompt.key] = prompt.default;\n } else {\n console.info(`Skipping prompt \"${prompt.key}\" - no default value available`);\n }\n }\n }\n return answers;\n}\n","import fs from 'node:fs';\nimport path from 'node:path';\n\nimport { CONSOLE_ICONS } from '../../constants';\n\nconst CLAUDE_SETTINGS_FILE = '.claude/settings.json';\n\nexport function validateClaudeConfig(): void {\n const claudeSettingsPath = path.resolve(process.env.HOME || '', CLAUDE_SETTINGS_FILE);\n\n if (!fs.existsSync(claudeSettingsPath)) {\n throw new Error(\n `${CONSOLE_ICONS.error} Claude Code is not configured. Expected settings file at: ${claudeSettingsPath}. Please follow the setup instructions:\\n` +\n ` https://transferwise.atlassian.net/wiki/spaces/GenAIP/pages/3709765113/Configuring+Claude+Code\\n`,\n );\n }\n}\n"],"x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44],"mappings":";;;;;;;;;;;;;CAIA,MAAM,sBAAsB;CAE5B,MAAM,aAAa;CACnB,MAAM,mBAAmB,OAAO,oBACL;CAG3B,MAAM,4BAA4B;CAIlC,MAAM,wBAAwB,aAAa;CAE3C,MAAM,gBAAgB;EACpB;EACA;EACA;EACA;EACA;EACA;EACA;EACD;AAED,QAAO,UAAU;EACf;EACA;EACA;EACA;EACA;EACA;EACA,yBAAyB;EACzB,YAAY;EACb;;;;;;CClCD,MAAM,QACJ,OAAO,YAAY,YACnB,QAAQ,OACR,QAAQ,IAAI,cACZ,cAAc,KAAK,QAAQ,IAAI,WAAW,IACvC,GAAG,SAAS,QAAQ,MAAM,UAAU,GAAG,KAAK,SACvC;AAEV,QAAO,UAAU;;;;;;CCRjB,MAAM,EACJ,2BACA,uBACA;CAEF,MAAM;AACN,WAAU,OAAO,UAAU,EAAE;CAG7B,MAAM,KAAK,QAAQ,KAAK,EAAE;CAC1B,MAAM,SAAS,QAAQ,SAAS,EAAE;CAClC,MAAM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QAC1B,KAAI;AACF,UAAQ,OAAO,OAAO,MAAM,UAAU,OAAO;UACtC,OAAO;AACd,UAAQ,KACN,6BAA6B,OAAO,IAAI,KAAK,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,GACpG;AAED,MAAI,OAAO,YAAY,QAAW;AAChC,WAAQ,KAAK,4BAA4B,OAAO,IAAI,KAAK,OAAO,UAAU;AAC1E,WAAQ,OAAO,OAAO,OAAO;QAE7B,SAAQ,KAAK,oBAAoB,OAAO,IAAI,gCAAgC;;AAIlF,QAAO;;;;;AC7CT,MAAM,uBAAuB;AAE7B,SAAgB,uBAA6B;CAC3C,MAAM,qBAAqBC,kBAAK,QAAQ,QAAQ,IAAI,QAAQ,IAAI,qBAAqB;AAErF,KAAI,CAACC,gBAAG,WAAW,mBAAmB,CACpC,OAAM,IAAI,MACR,GAAGC,kCAAc,MAAM,6DAA6D,mBAAmB,8IAExG"}
package/dist/index.js CHANGED
@@ -1,59 +1,54 @@
1
1
  #!/usr/bin/env node
2
- const require_helpers = require('./helpers-C6KebpWf.js');
2
+ const require_constants = require('./constants-CcE2TmzN.js');
3
+ const require_transformer = require('./transformer-DakNFxg-.js');
4
+ const require_helpers = require('./helpers-Du-iz0Iu.js');
3
5
  let node_child_process = require("node:child_process");
4
6
  let node_fs_promises = require("node:fs/promises");
5
- node_fs_promises = require_helpers.__toESM(node_fs_promises);
7
+ node_fs_promises = require_constants.__toESM(node_fs_promises);
6
8
  let node_path = require("node:path");
7
- node_path = require_helpers.__toESM(node_path);
9
+ node_path = require_constants.__toESM(node_path);
8
10
  let node_url = require("node:url");
9
11
  let _inquirer_prompts = require("@inquirer/prompts");
12
+ let spinnies = require("spinnies");
13
+ spinnies = require_constants.__toESM(spinnies);
10
14
 
11
15
  //#region src/controller/index.ts
12
16
  let isDebug = false;
13
17
  const currentFilePath = (0, node_url.fileURLToPath)(require("url").pathToFileURL(__filename).href);
14
18
  const currentDirPath = node_path.default.dirname(currentFilePath);
15
- const ICONS = {
16
- info: "\x1B[34mℹ\x1B[0m",
17
- focus: "\x1B[34m➙\x1B[0m",
18
- success: "\x1B[32m✔\x1B[0m",
19
- warning: "\x1B[33m⚠\x1B[0m",
20
- error: "\x1B[31m✖\x1B[0m"
21
- };
22
19
  const resetReportFile = async (reportPath) => {
23
20
  try {
24
21
  await node_fs_promises.default.access(reportPath);
25
22
  await node_fs_promises.default.rm(reportPath);
26
- console.debug(`${ICONS.info} Removed existing report file${isDebug ? `: ${reportPath}` : "."}`);
23
+ console.debug(`${require_constants.CONSOLE_ICONS.info} Removed existing report file${isDebug ? `: ${reportPath}` : "."}`);
27
24
  } catch {
28
- console.debug(`${ICONS.info} No existing report file to remove${isDebug ? `: ${reportPath}` : "."}`);
25
+ console.debug(`${require_constants.CONSOLE_ICONS.info} No existing report file to remove${isDebug ? `: ${reportPath}` : "."}`);
29
26
  }
30
27
  };
31
28
  const summariseReportFile = async (reportPath) => {
32
29
  try {
33
30
  const lines = (await node_fs_promises.default.readFile(reportPath, "utf8")).split("\n").filter(Boolean);
34
- if (lines.length) console.debug(`\n⚠️ ${lines.length} manual review${lines.length > 1 ? "s are" : " is"} required. See ${reportPath} for details.`);
35
- else console.debug(`${ICONS.info} Report file exists but is empty${isDebug ? `: ${reportPath}` : "."}`);
31
+ if (lines.length) console.debug(`\n${require_constants.CONSOLE_ICONS.warning} ${lines.length} manual review${lines.length > 1 ? "s are" : " is"} required. See ${reportPath} for details.`);
32
+ else console.debug(`${require_constants.CONSOLE_ICONS.info} Report file exists but is empty${isDebug ? `: ${reportPath}` : "."}`);
36
33
  } catch {
37
- console.debug(`${ICONS.info} No report file generated - no manual reviews needed`);
34
+ console.debug(`${require_constants.CONSOLE_ICONS.info} No report file generated - no manual reviews needed`);
38
35
  }
39
36
  };
37
+ const log = (label, value) => {
38
+ if (typeof require_helpers.logToInquirer === "function") require_helpers.logToInquirer(label, value || "");
39
+ else console.info(label, value || "");
40
+ };
40
41
  async function runCodemod(transformsDir) {
42
+ const args = process.argv.slice(2);
43
+ const candidate = args[0];
44
+ isDebug = args.includes("--debug");
41
45
  try {
42
- const args = process.argv.slice(2);
43
- const candidate = args[0];
44
- isDebug = args.includes("--debug");
45
- const packages = require_helpers.findPackages();
46
- const reportPath = node_path.default.resolve(require_helpers.findProjectRoot(), "codemod-report.txt");
46
+ const root = require_helpers.findProjectRoot();
47
+ const packagesPromise = require_helpers.findPackages();
47
48
  const resolvedTransformsDir = transformsDir ?? node_path.default.resolve(currentDirPath, "../dist/transforms");
48
- if (isDebug) console.debug(`${ICONS.info} Resolved transforms directory: ${resolvedTransformsDir}`);
49
- await resetReportFile(reportPath);
50
- const { transformFiles } = await require_helpers.loadTransformModules_default(resolvedTransformsDir);
51
- const resolvedTransformNames = await Promise.all(transformFiles);
52
- if (resolvedTransformNames.length === 0) throw new Error(`${ICONS.error} No transform scripts found${isDebug ? ` in: ${resolvedTransformsDir}` : "."}`);
53
- const log = (label, value) => {
54
- if (typeof require_helpers.logToInquirer === "function") require_helpers.logToInquirer(label, value);
55
- else console.info(label, value);
56
- };
49
+ if (isDebug) console.debug(`${require_constants.CONSOLE_ICONS.info} Resolved transforms directory: ${resolvedTransformsDir}`);
50
+ const { transformFiles: resolvedTransformNames } = await require_helpers.loadTransformModules_default(resolvedTransformsDir);
51
+ if (resolvedTransformNames.length === 0) throw new Error(`${require_constants.CONSOLE_ICONS.error} No transform scripts found${isDebug ? ` in: ${resolvedTransformsDir}` : "."}`);
57
52
  let transformFile;
58
53
  if (candidate && resolvedTransformNames.includes(candidate)) {
59
54
  log("Select codemod to run:", candidate);
@@ -69,17 +64,56 @@ async function runCodemod(transformsDir) {
69
64
  log("Selected codemod:", transformFile);
70
65
  }
71
66
  const codemodPath = node_path.default.resolve(resolvedTransformsDir, transformFile, "transformer.js");
72
- if (isDebug) console.debug(`${ICONS.info} Resolved codemod path: ${codemodPath}`);
67
+ const codemodConfig = require_helpers.getCodemodConfig(codemodPath);
68
+ if (isDebug) console.debug(`${require_constants.CONSOLE_ICONS.info} Resolved codemod path: ${codemodPath}`);
69
+ if (codemodConfig?.type === "claude") require_helpers.validateClaudeConfig();
70
+ const spinnies$1 = new spinnies.default();
71
+ spinnies$1.add("loading-codemod", { text: `Loading codemod (${transformFile})...` });
72
+ const packages = await packagesPromise;
73
+ const reportPath = node_path.default.resolve(root, "codemod-report.txt");
74
+ spinnies$1.succeed("loading-codemod", { text: `Successfully loaded codemod: \x1b[2m${transformFile}\x1b[0m` });
75
+ if (codemodConfig?.type === "jscodeshift") await resetReportFile(reportPath);
73
76
  const promptAnswers = await require_helpers.runTransformPrompts(codemodPath);
74
77
  const options = await require_helpers.getOptions_default({
75
78
  packages,
76
- root: require_helpers.findProjectRoot(),
79
+ root,
77
80
  transformFiles: resolvedTransformNames,
78
81
  preselectedTransformFile: transformFile
79
82
  });
80
- options.targetPaths.map((targetPath) => {
81
- console.info(`${ICONS.focus} \x1b[1mProcessing:\x1b[0m \x1b[32m${targetPath}\x1b[0m`);
82
- if (require_helpers.assessPrerequisites(targetPath, codemodPath)) {
83
+ if (codemodConfig?.type === "claude") {
84
+ spinnies$1.add("prerequisite-check", { text: "Checking prerequisites..." });
85
+ const { allPassed, packageRootToTargets, failedPackageRoots } = require_helpers.assessPrerequisitesBatch(options.targetPaths, codemodPath, spinnies$1);
86
+ if (!allPassed) {
87
+ spinnies$1.add("prerequisite-partial-failure", {
88
+ text: "One or more packages failed prerequisite checks - these targets will be skipped:",
89
+ status: "fail"
90
+ });
91
+ for (const failedRoot of failedPackageRoots) {
92
+ const targets = packageRootToTargets.get(failedRoot) ?? [];
93
+ options.targetPaths = options.targetPaths.filter((targetPath) => !targets.includes(targetPath));
94
+ spinnies$1.add(`prerequisite-fail-${failedRoot}`, {
95
+ text: `- \x1b[2m\x1b[31m${failedRoot}\x1b[0m${targets.length > 0 && targets[0] !== failedRoot ? ` (targets: ${targets.join(", ")})` : ""}\x1b[0m`,
96
+ indent: 2,
97
+ status: "non-spinnable"
98
+ });
99
+ }
100
+ }
101
+ if (!options.targetPaths.length) {
102
+ spinnies$1.add("no-valid-targets", {
103
+ text: `${require_constants.CONSOLE_ICONS.error} No valid target paths remaining after prerequisite checks - exiting.`,
104
+ status: "fail"
105
+ });
106
+ spinnies$1.stopAll("fail");
107
+ spinnies$1.checkIfActiveSpinners();
108
+ return;
109
+ }
110
+ await require_transformer.transformer_default(options.targetPaths, isDebug);
111
+ } else {
112
+ spinnies$1.stopAll("succeed");
113
+ spinnies$1.checkIfActiveSpinners();
114
+ await Promise.all(options.targetPaths.map(async (targetPath) => {
115
+ console.info(`${require_constants.CONSOLE_ICONS.focus} \x1b[1mProcessing:\x1b[0m \x1b[32m${targetPath}\x1b[0m`);
116
+ if (!require_helpers.assessPrerequisites(targetPath, codemodPath)) return;
83
117
  const answerArgs = Object.entries(promptAnswers).map(([promptName, answerValue]) => `--${promptName}=${String(answerValue)}`);
84
118
  const command = `npx jscodeshift ${[
85
119
  "-t",
@@ -91,14 +125,14 @@ async function runCodemod(transformsDir) {
91
125
  options.useGitIgnore ? "--gitignore" : "",
92
126
  ...answerArgs
93
127
  ].filter(Boolean).join(" ")}`;
94
- if (isDebug) console.debug(`${ICONS.info} Running: ${command}`);
128
+ if (isDebug) console.debug(`${require_constants.CONSOLE_ICONS.info} Running: ${command}`);
95
129
  return (0, node_child_process.execSync)(command, { stdio: "inherit" });
96
- }
97
- });
98
- await summariseReportFile(reportPath);
130
+ }));
131
+ }
132
+ if (transformFile !== "list-item") await summariseReportFile(reportPath);
99
133
  } catch (error) {
100
- if (error instanceof Error) console.error(`${ICONS.error} Error running codemod:`, error.message);
101
- else console.error(`${ICONS.error} Error running codemod:`, error);
134
+ if (error instanceof Error) console.error(`${require_constants.CONSOLE_ICONS.error} Error running ${candidate} codemod:`, error.message);
135
+ else console.error(`${require_constants.CONSOLE_ICONS.error} Error running ${candidate} codemod:`, String(error));
102
136
  if (process.env.NODE_ENV !== "test") process.exit(1);
103
137
  }
104
138
  }
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["path","fs","findPackages","findProjectRoot","loadTransformModules","logToInquirer","transformFile: string","runTransformPrompts","getOptions","assessPrerequisites","error: unknown"],"sources":["../src/controller/index.ts","../src/index.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { execSync } from 'node:child_process';\nimport fs from 'node:fs/promises';\nimport path from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nimport { select as list } from '@inquirer/prompts';\n\nimport {\n assessPrerequisites,\n findPackages,\n findProjectRoot,\n getOptions,\n loadTransformModules,\n logToInquirer,\n runTransformPrompts,\n} from './helpers';\n\nlet isDebug = false;\nconst currentFilePath = fileURLToPath(import.meta.url);\nconst currentDirPath = path.dirname(currentFilePath);\nconst ICONS = {\n info: '\\x1b[34mℹ\\x1b[0m', // Blue info icon\n focus: '\\x1b[34m➙\\x1b[0m', // Blue arrow icon\n success: '\\x1b[32m✔\\x1b[0m', // Green checkmark\n warning: '\\x1b[33m⚠\\x1b[0m', // Yellow warning icon\n error: '\\x1b[31m✖\\x1b[0m', // Red cross icon\n};\n\nconst resetReportFile = async (reportPath: string) => {\n try {\n await fs.access(reportPath);\n await fs.rm(reportPath);\n console.debug(`${ICONS.info} Removed existing report file${isDebug ? `: ${reportPath}` : '.'}`);\n } catch {\n console.debug(\n `${ICONS.info} No existing report file to remove${isDebug ? `: ${reportPath}` : '.'}`,\n );\n }\n};\n\nconst summariseReportFile = async (reportPath: string) => {\n try {\n const reportContent = await fs.readFile(reportPath, 'utf8');\n const lines = reportContent.split('\\n').filter(Boolean);\n if (lines.length) {\n console.debug(\n `\\n⚠️ ${lines.length} manual review${lines.length > 1 ? 's are' : ' is'} required. See ${reportPath} for details.`,\n );\n } else {\n console.debug(\n `${ICONS.info} Report file exists but is empty${isDebug ? `: ${reportPath}` : '.'}`,\n );\n }\n } catch {\n console.debug(`${ICONS.info} No report file generated - no manual reviews needed`);\n }\n};\n\nasync function runCodemod(transformsDir?: string) {\n try {\n const args = process.argv.slice(2);\n const candidate = args[0];\n isDebug = args.includes('--debug');\n const packages = findPackages();\n const reportPath = path.resolve(findProjectRoot(), 'codemod-report.txt');\n const resolvedTransformsDir =\n transformsDir ?? path.resolve(currentDirPath, '../dist/transforms');\n\n if (isDebug) {\n console.debug(`${ICONS.info} Resolved transforms directory: ${resolvedTransformsDir}`);\n }\n\n await resetReportFile(reportPath);\n\n const { transformFiles } = await loadTransformModules(resolvedTransformsDir);\n\n const resolvedTransformNames = await Promise.all(transformFiles);\n if (resolvedTransformNames.length === 0) {\n throw new Error(\n `${ICONS.error} No transform scripts found${isDebug ? ` in: ${resolvedTransformsDir}` : '.'}`,\n );\n }\n\n const log = (label: string, value: string): void => {\n if (typeof logToInquirer === 'function') {\n logToInquirer(label, value);\n } else {\n console.info(label, value);\n }\n };\n\n let transformFile: string;\n\n if (candidate && resolvedTransformNames.includes(candidate)) {\n log('Select codemod to run:', candidate);\n transformFile = candidate;\n } else {\n transformFile = await list({\n message: 'Select codemod to run:',\n choices: resolvedTransformNames.map((name) => ({ name, value: name })),\n });\n log('Selected codemod:', transformFile);\n }\n\n const codemodPath = path.resolve(resolvedTransformsDir, transformFile, 'transformer.js');\n if (isDebug) {\n console.debug(`${ICONS.info} Resolved codemod path: ${codemodPath}`);\n }\n\n const promptAnswers = await runTransformPrompts(codemodPath);\n\n const options = await getOptions({\n packages,\n root: findProjectRoot(),\n transformFiles: resolvedTransformNames,\n preselectedTransformFile: transformFile,\n });\n\n options.targetPaths.map((targetPath) => {\n console.info(`${ICONS.focus} \\x1b[1mProcessing:\\x1b[0m \\x1b[32m${targetPath}\\x1b[0m`);\n\n const isCompliant = assessPrerequisites(targetPath, codemodPath);\n if (isCompliant) {\n const answerArgs = Object.entries(promptAnswers).map(\n ([promptName, answerValue]) => `--${promptName}=${String(answerValue)}`,\n );\n\n const argsList = [\n '-t',\n codemodPath,\n targetPath,\n options.isDry ? '--dry' : '',\n options.isPrint ? '--print' : '',\n options.ignorePatterns\n ? options.ignorePatterns\n .split(',')\n .map((pattern) => `--ignore-pattern=${pattern.trim()}`)\n .join(' ')\n : '',\n options.useGitIgnore ? '--gitignore' : '',\n ...answerArgs,\n ].filter(Boolean);\n\n const command = `npx jscodeshift ${argsList.join(' ')}`;\n if (isDebug) {\n console.debug(`${ICONS.info} Running: ${command}`);\n }\n return execSync(command, { stdio: 'inherit' });\n }\n return undefined;\n });\n\n await summariseReportFile(reportPath);\n } catch (error: unknown) {\n if (error instanceof Error) {\n console.error(`${ICONS.error} Error running codemod:`, error.message);\n } else {\n console.error(`${ICONS.error} Error running codemod:`, error);\n }\n if (process.env.NODE_ENV !== 'test') {\n process.exit(1);\n }\n }\n}\n\nexport { runCodemod };\n","#!/usr/bin/env node\nimport { runCodemod } from './controller';\n\nvoid runCodemod();\n"],"mappings":";;;;;;;;;;;AAmBA,IAAI,UAAU;AACd,MAAM,4FAAgD;AACtD,MAAM,iBAAiBA,kBAAK,QAAQ,gBAAgB;AACpD,MAAM,QAAQ;CACZ,MAAM;CACN,OAAO;CACP,SAAS;CACT,SAAS;CACT,OAAO;CACR;AAED,MAAM,kBAAkB,OAAO,eAAuB;AACpD,KAAI;AACF,QAAMC,yBAAG,OAAO,WAAW;AAC3B,QAAMA,yBAAG,GAAG,WAAW;AACvB,UAAQ,MAAM,GAAG,MAAM,KAAK,+BAA+B,UAAU,KAAK,eAAe,MAAM;SACzF;AACN,UAAQ,MACN,GAAG,MAAM,KAAK,oCAAoC,UAAU,KAAK,eAAe,MACjF;;;AAIL,MAAM,sBAAsB,OAAO,eAAuB;AACxD,KAAI;EAEF,MAAM,SADgB,MAAMA,yBAAG,SAAS,YAAY,OAAO,EAC/B,MAAM,KAAK,CAAC,OAAO,QAAQ;AACvD,MAAI,MAAM,OACR,SAAQ,MACN,SAAS,MAAM,OAAO,gBAAgB,MAAM,SAAS,IAAI,UAAU,MAAM,iBAAiB,WAAW,eACtG;MAED,SAAQ,MACN,GAAG,MAAM,KAAK,kCAAkC,UAAU,KAAK,eAAe,MAC/E;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A0B;GAC3B,CAAC;AAEF,UAAQ,YAAY,KAAK,eAAe;AACtC,WAAQ,KAAK,GAAG,MAAM,MAAM,sCAAsC,WAAW,SAAS;AAGtF,OADoBM,oCAAoB,YAAY,YAAY,EAC/C;IACf,MAAM,aAAa,OAAO,QAAQ,cAAc,CAAC,KAC9C,CAAC,YAAY,iBAAiB,KAAK,WAAW,GAAG,OAAO,YAAY,GACtE;IAkBD,MAAM,UAAU,mBAhBC;KACf;KACA;KACA;KACA,QAAQ,QAAQ,UAAU;KAC1B,QAAQ,UAAU,YAAY;KAC9B,QAAQ,iBACJ,QAAQ,eACL,MAAM,IAAI,CACV,KAAK,YAAY,oBAAoB,QAAQ,MAAM,GAAG,CACtD,KAAK,IAAI,GACZ;KACJ,QAAQ,eAAe,gBAAgB;KACvC,GAAG;KACJ,CAAC,OAAO,QAAQ,CAE2B,KAAK,IAAI;AACrD,QAAI,QACF,SAAQ,MAAM,GAAG,MAAM,KAAK,YAAY,UAAU;AAEpD,4CAAgB,SAAS,EAAE,OAAO,WAAW,CAAC;;IAGhD;AAEF,QAAM,oBAAoB,WAAW;UAC9BC,OAAgB;AACvB,MAAI,iBAAiB,MACnB,SAAQ,MAAM,GAAG,MAAM,MAAM,0BAA0B,MAAM,QAAQ;MAErE,SAAQ,MAAM,GAAG,MAAM,MAAM,0BAA0B,MAAM;AAE/D,MAAI,QAAQ,IAAI,aAAa,OAC3B,SAAQ,KAAK,EAAE;;;;;;AC/JhB,YAAY"}
1
+ {"version":3,"file":"index.js","names":["path","fs","CONSOLE_ICONS","logToInquirer","findProjectRoot","findPackages","loadTransformModules","transformFile: string","getCodemodConfig","spinnies","Spinnies","runTransformPrompts","getOptions","assessPrerequisitesBatch","transformer","assessPrerequisites","error: unknown"],"sources":["../src/controller/index.ts","../src/index.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { execSync } from 'node:child_process';\nimport fs from 'node:fs/promises';\nimport path from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nimport { select as list } from '@inquirer/prompts';\nimport Spinnies from 'spinnies';\n\nimport { CONSOLE_ICONS } from '../constants';\nimport transformer from '../transforms/list-item/transformer';\nimport {\n assessPrerequisites,\n assessPrerequisitesBatch,\n findPackages,\n findProjectRoot,\n getCodemodConfig,\n getOptions,\n loadTransformModules,\n logToInquirer,\n runTransformPrompts,\n validateClaudeConfig,\n} from './helpers';\n\nlet isDebug = false;\nconst currentFilePath = fileURLToPath(import.meta.url);\nconst currentDirPath = path.dirname(currentFilePath);\n\nconst resetReportFile = async (reportPath: string) => {\n try {\n await fs.access(reportPath);\n await fs.rm(reportPath);\n console.debug(\n `${CONSOLE_ICONS.info} Removed existing report file${isDebug ? `: ${reportPath}` : '.'}`,\n );\n } catch {\n console.debug(\n `${CONSOLE_ICONS.info} No existing report file to remove${isDebug ? `: ${reportPath}` : '.'}`,\n );\n }\n};\n\nconst summariseReportFile = async (reportPath: string) => {\n try {\n const reportContent = await fs.readFile(reportPath, 'utf8');\n const lines = reportContent.split('\\n').filter(Boolean);\n if (lines.length) {\n console.debug(\n `\\n${CONSOLE_ICONS.warning} ${lines.length} manual review${lines.length > 1 ? 's are' : ' is'} required. See ${reportPath} for details.`,\n );\n } else {\n console.debug(\n `${CONSOLE_ICONS.info} Report file exists but is empty${isDebug ? `: ${reportPath}` : '.'}`,\n );\n }\n } catch {\n console.debug(`${CONSOLE_ICONS.info} No report file generated - no manual reviews needed`);\n }\n};\n\nconst log = (label: string, value?: string): void => {\n if (typeof logToInquirer === 'function') {\n logToInquirer(label, value || '');\n } else {\n console.info(label, value || '');\n }\n};\n\nasync function runCodemod(transformsDir?: string) {\n const args = process.argv.slice(2);\n const candidate = args[0];\n isDebug = args.includes('--debug');\n\n try {\n const root = findProjectRoot();\n const packagesPromise = findPackages();\n const resolvedTransformsDir =\n transformsDir ?? path.resolve(currentDirPath, '../dist/transforms');\n\n if (isDebug) {\n console.debug(\n `${CONSOLE_ICONS.info} Resolved transforms directory: ${resolvedTransformsDir}`,\n );\n }\n\n const { transformFiles: resolvedTransformNames } =\n await loadTransformModules(resolvedTransformsDir);\n if (resolvedTransformNames.length === 0) {\n throw new Error(\n `${CONSOLE_ICONS.error} No transform scripts found${isDebug ? ` in: ${resolvedTransformsDir}` : '.'}`,\n );\n }\n\n let transformFile: string;\n\n if (candidate && resolvedTransformNames.includes(candidate)) {\n log('Select codemod to run:', candidate);\n transformFile = candidate;\n } else {\n transformFile = await list({\n message: 'Select codemod to run:',\n choices: resolvedTransformNames.map((name: string) => ({ name, value: name })),\n });\n log('Selected codemod:', transformFile);\n }\n\n const codemodPath = path.resolve(resolvedTransformsDir, transformFile, 'transformer.js');\n const codemodConfig = getCodemodConfig(codemodPath);\n if (isDebug) {\n console.debug(`${CONSOLE_ICONS.info} Resolved codemod path: ${codemodPath}`);\n }\n\n if (codemodConfig?.type === 'claude') {\n validateClaudeConfig();\n }\n\n const spinnies = new Spinnies();\n spinnies.add('loading-codemod', { text: `Loading codemod (${transformFile})...` });\n const packages = await packagesPromise;\n const reportPath = path.resolve(root, 'codemod-report.txt');\n spinnies.succeed('loading-codemod', {\n text: `Successfully loaded codemod: \\x1b[2m${transformFile}\\x1b[0m`,\n });\n\n if (codemodConfig?.type === 'jscodeshift') {\n await resetReportFile(reportPath);\n }\n\n const promptAnswers = await runTransformPrompts(codemodPath);\n const options = await getOptions({\n packages,\n root,\n transformFiles: resolvedTransformNames,\n preselectedTransformFile: transformFile,\n });\n\n // Handle ListItem transform differently as it uses Claude, not jscodeshift\n if (codemodConfig?.type === 'claude') {\n spinnies.add('prerequisite-check', { text: 'Checking prerequisites...' });\n // Fail-fast: check prerequisites for all target paths up-front\n const { allPassed, packageRootToTargets, failedPackageRoots } = assessPrerequisitesBatch(\n options.targetPaths,\n codemodPath,\n spinnies,\n );\n if (!allPassed) {\n spinnies.add('prerequisite-partial-failure', {\n text: 'One or more packages failed prerequisite checks - these targets will be skipped:',\n status: 'fail',\n });\n\n for (const failedRoot of failedPackageRoots) {\n const targets = packageRootToTargets.get(failedRoot) ?? [];\n // Filter out targets that belong to failed package roots\n options.targetPaths = options.targetPaths.filter(\n (targetPath) => !targets.includes(targetPath),\n );\n spinnies.add(`prerequisite-fail-${failedRoot}`, {\n text: `- \\x1b[2m\\x1b[31m${failedRoot}\\x1b[0m${targets.length > 0 && targets[0] !== failedRoot ? ` (targets: ${targets.join(', ')})` : ''}\\x1b[0m`,\n indent: 2,\n status: 'non-spinnable',\n });\n }\n }\n\n if (!options.targetPaths.length) {\n spinnies.add('no-valid-targets', {\n text: `${CONSOLE_ICONS.error} No valid target paths remaining after prerequisite checks - exiting.`,\n status: 'fail',\n });\n spinnies.stopAll('fail');\n spinnies.checkIfActiveSpinners();\n return;\n }\n\n await transformer(options.targetPaths, isDebug);\n } else {\n // Button codemod doesn't use spinnies\n spinnies.stopAll('succeed');\n spinnies.checkIfActiveSpinners();\n\n await Promise.all(\n options.targetPaths.map(async (targetPath) => {\n console.info(\n `${CONSOLE_ICONS.focus} \\x1b[1mProcessing:\\x1b[0m \\x1b[32m${targetPath}\\x1b[0m`,\n );\n\n // Check prerequisites for this target before running\n const ok = assessPrerequisites(targetPath, codemodPath);\n if (!ok) {\n return;\n }\n\n const answerArgs = Object.entries(promptAnswers).map(\n ([promptName, answerValue]) => `--${promptName}=${String(answerValue)}`,\n );\n\n const argsList = [\n '-t',\n codemodPath,\n targetPath,\n options.isDry ? '--dry' : '',\n options.isPrint ? '--print' : '',\n options.ignorePatterns\n ? options.ignorePatterns\n .split(',')\n .map((pattern) => `--ignore-pattern=${pattern.trim()}`)\n .join(' ')\n : '',\n options.useGitIgnore ? '--gitignore' : '',\n ...answerArgs,\n ].filter(Boolean);\n const command = `npx jscodeshift ${argsList.join(' ')}`;\n\n if (isDebug) {\n console.debug(`${CONSOLE_ICONS.info} Running: ${command}`);\n }\n\n return execSync(command, { stdio: 'inherit' });\n }),\n );\n }\n\n if (transformFile !== 'list-item') {\n await summariseReportFile(reportPath);\n }\n } catch (error: unknown) {\n if (error instanceof Error) {\n console.error(`${CONSOLE_ICONS.error} Error running ${candidate} codemod:`, error.message);\n } else {\n console.error(`${CONSOLE_ICONS.error} Error running ${candidate} codemod:`, String(error));\n }\n if (process.env.NODE_ENV !== 'test') {\n process.exit(1);\n }\n }\n}\n\nexport { runCodemod };\n","#!/usr/bin/env node\nimport { runCodemod } from './controller';\n\nvoid runCodemod();\n"],"mappings":";;;;;;;;;;;;;;;AAyBA,IAAI,UAAU;AACd,MAAM,4FAAgD;AACtD,MAAM,iBAAiBA,kBAAK,QAAQ,gBAAgB;AAEpD,MAAM,kBAAkB,OAAO,eAAuB;AACpD,KAAI;AACF,QAAMC,yBAAG,OAAO,WAAW;AAC3B,QAAMA,yBAAG,GAAG,WAAW;AACvB,UAAQ,MACN,GAAGC,gCAAc,KAAK,+BAA+B,UAAU,KAAK,eAAe,MACpF;SACK;AACN,UAAQ,MACN,GAAGA,gCAAc,KAAK,oCAAoC,UAAU,KAAK,eAAe,MACzF;;;AAIL,MAAM,sBAAsB,OAAO,eAAuB;AACxD,KAAI;EAEF,MAAM,SADgB,MAAMD,yBAAG,SAAS,YAAY,OAAO,EAC/B,MAAM,KAAK,CAAC,OAAO,QAAQ;AACvD,MAAI,MAAM,OACR,SAAQ,MACN,KAAKC,gCAAc,QAAQ,IAAI,MAAM,OAAO,gBAAgB,MAAM,SAAS,IAAI,UAAU,MAAM,iBAAiB,WAAW,eAC5H;MAED,SAAQ,MACN,GAAGA,gCAAc,KAAK,kCAAkC,UAAU,KAAK,eAAe,MACvF;SAEG;AACN,UAAQ,MAAM,GAAGA,gCAAc,KAAK,sDAAsD;;;AAI9F,MAAM,OAAO,OAAe,UAAyB;AACnD,KAAI,OAAOC,kCAAkB,WAC3B,+BAAc,OAAO,SAAS,GAAG;KAEjC,SAAQ,KAAK,OAAO,SAAS,GAAG;;AAIpC,eAAe,WAAW,eAAwB;CAChD,MAAM,OAAO,QAAQ,KAAK,MAAM,EAAE;CAClC,MAAM,YAAY,KAAK;AACvB,WAAU,K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