Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Standardize getModuleVersionChanges return type #176

Merged
merged 3 commits into from
Apr 11, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
27 changes: 14 additions & 13 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6340,7 +6340,7 @@ module.exports = SemVer

const SemVer = __nccwpck_require__(8088)
const parse = __nccwpck_require__(5925)
const {re, t} = __nccwpck_require__(9523)
const { re, t } = __nccwpck_require__(9523)

const coerce = (version, options) => {
if (version instanceof SemVer) {
Expand Down Expand Up @@ -6383,8 +6383,9 @@ const coerce = (version, options) => {
re[t.COERCERTL].lastIndex = -1
}

if (match === null)
if (match === null) {
return null
}

return parse(`${match[2]}.${match[3] || '0'}.${match[4] || '0'}`, options)
}
Expand Down Expand Up @@ -6448,7 +6449,7 @@ module.exports = eq
/***/ 5925:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {

const {MAX_LENGTH} = __nccwpck_require__(2293)
const { MAX_LENGTH } = __nccwpck_require__(2293)
const { re, t } = __nccwpck_require__(9523)
const SemVer = __nccwpck_require__(8088)

Expand Down Expand Up @@ -6507,7 +6508,7 @@ const SEMVER_SPEC_VERSION = '2.0.0'

const MAX_LENGTH = 256
const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||
/* istanbul ignore next */ 9007199254740991
/* istanbul ignore next */ 9007199254740991

// Max safe segment length for coercion.
const MAX_SAFE_COMPONENT_LENGTH = 16
Expand All @@ -6516,7 +6517,7 @@ module.exports = {
SEMVER_SPEC_VERSION,
MAX_LENGTH,
MAX_SAFE_INTEGER,
MAX_SAFE_COMPONENT_LENGTH
MAX_SAFE_COMPONENT_LENGTH,
}


Expand Down Expand Up @@ -6562,7 +6563,7 @@ const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a)

module.exports = {
compareIdentifiers,
rcompareIdentifiers
rcompareIdentifiers,
}


Expand All @@ -6577,9 +6578,9 @@ const opts = ['includePrerelease', 'loose', 'rtl']
const parseOptions = options =>
!options ? {}
: typeof options !== 'object' ? { loose: true }
: opts.filter(k => options[k]).reduce((options, k) => {
options[k] = true
return options
: opts.filter(k => options[k]).reduce((o, k) => {
o[k] = true
return o
}, {})
module.exports = parseOptions

Expand All @@ -6601,7 +6602,7 @@ let R = 0

const createToken = (name, value, isGlobal) => {
const index = R++
debug(index, value)
debug(name, index, value)
t[name] = index
src[index] = value
re[index] = new RegExp(value, isGlobal ? 'g' : undefined)
Expand Down Expand Up @@ -6769,8 +6770,8 @@ createToken('HYPHENRANGELOOSE', `^\\s*(${src[t.XRANGEPLAINLOOSE]})` +
// Star ranges basically just allow anything at all.
createToken('STAR', '(<|>)?=?\\s*\\*')
// >=0.0.0 is like a star
createToken('GTE0', '^\\s*>=\\s*0\.0\.0\\s*$')
createToken('GTE0PRE', '^\\s*>=\\s*0\.0\.0-0\\s*$')
createToken('GTE0', '^\\s*>=\\s*0\\.0\\.0\\s*$')
createToken('GTE0PRE', '^\\s*>=\\s*0\\.0\\.0-0\\s*$')


/***/ }),
Expand Down Expand Up @@ -9568,7 +9569,7 @@ const getModuleVersionChanges = (prDiff) => {
const parsedDiffFiles = parse(prDiff)
const packageJsonChanges = parsedDiffFiles.find((file) => file.newPath === 'package.json')
if (!packageJsonChanges) {
return false
return {}
}

const moduleChanges = {}
Expand Down
2 changes: 1 addition & 1 deletion src/moduleVersionChanges.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const getModuleVersionChanges = (prDiff) => {
const parsedDiffFiles = parse(prDiff)
const packageJsonChanges = parsedDiffFiles.find((file) => file.newPath === 'package.json')
if (!packageJsonChanges) {
return false
return {}
}

const moduleChanges = {}
Expand Down