@ -5,104 +5,104 @@
/***/ ( function ( _ _unused _webpack _module , exports , _ _nccwpck _require _ _ ) {
"use strict" ;
var _ _createBinding = ( this && this . _ _createBinding ) || ( Object . create ? ( function ( o , m , k , k2 ) {
if ( k2 === undefined ) k2 = k ;
Object . defineProperty ( o , k2 , { enumerable : true , get : function ( ) { return m [ k ] ; } } ) ;
} ) : ( function ( o , m , k , k2 ) {
if ( k2 === undefined ) k2 = k ;
o [ k2 ] = m [ k ] ;
} ) ) ;
var _ _setModuleDefault = ( this && this . _ _setModuleDefault ) || ( Object . create ? ( function ( o , v ) {
Object . defineProperty ( o , "default" , { enumerable : true , value : v } ) ;
} ) : function ( o , v ) {
o [ "default" ] = v ;
} ) ;
var _ _importStar = ( this && this . _ _importStar ) || function ( mod ) {
if ( mod && mod . _ _esModule ) return mod ;
var result = { } ;
if ( mod != null ) for ( var k in mod ) if ( k !== "default" && Object . prototype . hasOwnProperty . call ( mod , k ) ) _ _createBinding ( result , mod , k ) ;
_ _setModuleDefault ( result , mod ) ;
return result ;
} ;
Object . defineProperty ( exports , "__esModule" , ( { value : true } ) ) ;
exports . postMessageToSlack = exports . updateTag = exports . validateIfReleaseIsPublished = void 0 ;
const core = _ _importStar ( _ _nccwpck _require _ _ ( 2186 ) ) ;
const github _1 = _ _nccwpck _require _ _ ( 5438 ) ;
const http _client _1 = _ _nccwpck _require _ _ ( 9925 ) ;
async function findTag ( tag , octokitClient ) {
try {
const { data : foundTag } = await octokitClient . git . getRef ( {
... github _1 . context . repo ,
ref : ` tags/ ${ tag } `
} ) ;
return foundTag ;
}
catch ( err ) {
if ( err . status === 404 ) {
return null ;
}
else {
throw new Error ( ` Retrieving refs failed with the following error: ${ err } ` ) ;
}
}
}
async function getTagSHA ( tag , octokitClient ) {
const foundTag = await findTag ( tag , octokitClient ) ;
if ( ! foundTag ) {
throw new Error ( ` The ' ${ tag } ' tag does not exist in the remote repository ` ) ;
}
return foundTag . object . sha ;
}
async function validateIfReleaseIsPublished ( tag , octokitClient ) {
try {
const { data : foundRelease } = await octokitClient . repos . getReleaseByTag ( {
... github _1 . context . repo ,
tag
} ) ;
if ( foundRelease . prerelease ) {
throw new Error ( ` The ' ${ foundRelease . name } ' release is marked as pre-release. Updating tags for pre-release is not supported ` ) ;
}
}
catch ( err ) {
if ( err . status === 404 ) {
throw new Error ( ` No GitHub release found for the ${ tag } tag ` ) ;
}
else {
throw new Error ( ` Retrieving releases failed with the following error: ${ err } ` ) ;
}
}
}
exports . validateIfReleaseIsPublished = validateIfReleaseIsPublished ;
async function updateTag ( sourceTag , targetTag , octokitClient ) {
const sourceTagSHA = await getTagSHA ( sourceTag , octokitClient ) ;
const foundTargetTag = await findTag ( targetTag , octokitClient ) ;
const refName = ` tags/ ${ targetTag } ` ;
if ( foundTargetTag ) {
core . info ( ` Updating the ' ${ targetTag } ' tag to point to the ' ${ sourceTag } ' tag ` ) ;
await octokitClient . git . updateRef ( {
... github _1 . context . repo ,
ref : refName ,
sha : sourceTagSHA ,
force : true
} ) ;
}
else {
core . info ( ` Creating the ' ${ targetTag } ' tag from the ' ${ sourceTag } ' tag ` ) ;
await octokitClient . git . createRef ( {
... github _1 . context . repo ,
ref : ` refs/ ${ refName } ` ,
sha : sourceTagSHA
} ) ;
}
}
exports . updateTag = updateTag ;
async function postMessageToSlack ( slackWebhook , message ) {
const jsonData = { text : message } ;
const http = new http _client _1 . HttpClient ( ) ;
await http . postJson ( slackWebhook , jsonData ) ;
}
exports . postMessageToSlack = postMessageToSlack ;
var _ _createBinding = ( this && this . _ _createBinding ) || ( Object . create ? ( function ( o , m , k , k2 ) {
if ( k2 === undefined ) k2 = k ;
Object . defineProperty ( o , k2 , { enumerable : true , get : function ( ) { return m [ k ] ; } } ) ;
} ) : ( function ( o , m , k , k2 ) {
if ( k2 === undefined ) k2 = k ;
o [ k2 ] = m [ k ] ;
} ) ) ;
var _ _setModuleDefault = ( this && this . _ _setModuleDefault ) || ( Object . create ? ( function ( o , v ) {
Object . defineProperty ( o , "default" , { enumerable : true , value : v } ) ;
} ) : function ( o , v ) {
o [ "default" ] = v ;
} ) ;
var _ _importStar = ( this && this . _ _importStar ) || function ( mod ) {
if ( mod && mod . _ _esModule ) return mod ;
var result = { } ;
if ( mod != null ) for ( var k in mod ) if ( k !== "default" && Object . prototype . hasOwnProperty . call ( mod , k ) ) _ _createBinding ( result , mod , k ) ;
_ _setModuleDefault ( result , mod ) ;
return result ;
} ;
Object . defineProperty ( exports , "__esModule" , ( { value : true } ) ) ;
exports . postMessageToSlack = exports . updateTag = exports . validateIfReleaseIsPublished = void 0 ;
const core = _ _importStar ( _ _nccwpck _require _ _ ( 2186 ) ) ;
const github _1 = _ _nccwpck _require _ _ ( 5438 ) ;
const http _client _1 = _ _nccwpck _require _ _ ( 9925 ) ;
async function findTag ( tag , octokitClient ) {
try {
const { data : foundTag } = await octokitClient . git . getRef ( {
... github _1 . context . repo ,
ref : ` tags/ ${ tag } `
} ) ;
return foundTag ;
}
catch ( err ) {
if ( err . status === 404 ) {
return null ;
}
else {
throw new Error ( ` Retrieving refs failed with the following error: ${ err } ` ) ;
}
}
}
async function getTagSHA ( tag , octokitClient ) {
const foundTag = await findTag ( tag , octokitClient ) ;
if ( ! foundTag ) {
throw new Error ( ` The ' ${ tag } ' tag does not exist in the remote repository ` ) ;
}
return foundTag . object . sha ;
}
async function validateIfReleaseIsPublished ( tag , octokitClient ) {
try {
const { data : foundRelease } = await octokitClient . repos . getReleaseByTag ( {
... github _1 . context . repo ,
tag
} ) ;
if ( foundRelease . prerelease ) {
throw new Error ( ` The ' ${ foundRelease . name } ' release is marked as pre-release. Updating tags for pre-release is not supported ` ) ;
}
}
catch ( err ) {
if ( err . status === 404 ) {
throw new Error ( ` No GitHub release found for the ${ tag } tag ` ) ;
}
else {
throw new Error ( ` Retrieving releases failed with the following error: ${ err } ` ) ;
}
}
}
exports . validateIfReleaseIsPublished = validateIfReleaseIsPublished ;
async function updateTag ( sourceTag , targetTag , octokitClient ) {
const sourceTagSHA = await getTagSHA ( sourceTag , octokitClient ) ;
const foundTargetTag = await findTag ( targetTag , octokitClient ) ;
const refName = ` tags/ ${ targetTag } ` ;
if ( foundTargetTag ) {
core . info ( ` Updating the ' ${ targetTag } ' tag to point to the ' ${ sourceTag } ' tag ` ) ;
await octokitClient . git . updateRef ( {
... github _1 . context . repo ,
ref : refName ,
sha : sourceTagSHA ,
force : true
} ) ;
}
else {
core . info ( ` Creating the ' ${ targetTag } ' tag from the ' ${ sourceTag } ' tag ` ) ;
await octokitClient . git . createRef ( {
... github _1 . context . repo ,
ref : ` refs/ ${ refName } ` ,
sha : sourceTagSHA
} ) ;
}
}
exports . updateTag = updateTag ;
async function postMessageToSlack ( slackWebhook , message ) {
const jsonData = { text : message } ;
const http = new http _client _1 . HttpClient ( ) ;
await http . postJson ( slackWebhook , jsonData ) ;
}
exports . postMessageToSlack = postMessageToSlack ;
/***/ } ) ,
@ -111,59 +111,59 @@ exports.postMessageToSlack = postMessageToSlack;
/***/ ( function ( _ _unused _webpack _module , exports , _ _nccwpck _require _ _ ) {
"use strict" ;
var _ _createBinding = ( this && this . _ _createBinding ) || ( Object . create ? ( function ( o , m , k , k2 ) {
if ( k2 === undefined ) k2 = k ;
Object . defineProperty ( o , k2 , { enumerable : true , get : function ( ) { return m [ k ] ; } } ) ;
} ) : ( function ( o , m , k , k2 ) {
if ( k2 === undefined ) k2 = k ;
o [ k2 ] = m [ k ] ;
} ) ) ;
var _ _setModuleDefault = ( this && this . _ _setModuleDefault ) || ( Object . create ? ( function ( o , v ) {
Object . defineProperty ( o , "default" , { enumerable : true , value : v } ) ;
} ) : function ( o , v ) {
o [ "default" ] = v ;
} ) ;
var _ _importStar = ( this && this . _ _importStar ) || function ( mod ) {
if ( mod && mod . _ _esModule ) return mod ;
var result = { } ;
if ( mod != null ) for ( var k in mod ) if ( k !== "default" && Object . prototype . hasOwnProperty . call ( mod , k ) ) _ _createBinding ( result , mod , k ) ;
_ _setModuleDefault ( result , mod ) ;
return result ;
} ;
Object . defineProperty ( exports , "__esModule" , ( { value : true } ) ) ;
const core = _ _importStar ( _ _nccwpck _require _ _ ( 2186 ) ) ;
const github = _ _importStar ( _ _nccwpck _require _ _ ( 5438 ) ) ;
const github _1 = _ _nccwpck _require _ _ ( 5438 ) ;
const api _utils _1 = _ _nccwpck _require _ _ ( 2430 ) ;
const version _utils _1 = _ _nccwpck _require _ _ ( 1534 ) ;
async function run ( ) {
try {
const token = core . getInput ( 'token' ) ;
const octokitClient = github . getOctokit ( token ) ;
const sourceTagName = core . getInput ( 'source-tag' ) ;
version _utils _1 . validateSemverVersionFromTag ( sourceTagName ) ;
await api _utils _1 . validateIfReleaseIsPublished ( sourceTagName , octokitClient ) ;
const majorTag = version _utils _1 . getMajorTagFromFullTag ( sourceTagName ) ;
await api _utils _1 . updateTag ( sourceTagName , majorTag , octokitClient ) ;
core . setOutput ( 'major-tag' , majorTag ) ;
core . info ( ` The ' ${ majorTag } ' major tag now points to the ' ${ sourceTagName } ' tag ` ) ;
const slackMessage = ` The ${ majorTag } tag has been successfully updated for the ${ github _1 . context . repo . repo } action to include changes from ${ sourceTagName } ` ;
await reportStatusToSlack ( slackMessage ) ;
}
catch ( error ) {
core . setFailed ( error . message ) ;
const slackMessage = ` Failed to update a major tag for the ${ github _1 . context . repo . repo } action ` ;
await reportStatusToSlack ( slackMessage ) ;
}
}
async function reportStatusToSlack ( message ) {
const slackWebhook = core . getInput ( 'slack-webhook' ) ;
if ( slackWebhook ) {
await api _utils _1 . postMessageToSlack ( slackWebhook , message ) ;
}
}
run ( ) ;
var _ _createBinding = ( this && this . _ _createBinding ) || ( Object . create ? ( function ( o , m , k , k2 ) {
if ( k2 === undefined ) k2 = k ;
Object . defineProperty ( o , k2 , { enumerable : true , get : function ( ) { return m [ k ] ; } } ) ;
} ) : ( function ( o , m , k , k2 ) {
if ( k2 === undefined ) k2 = k ;
o [ k2 ] = m [ k ] ;
} ) ) ;
var _ _setModuleDefault = ( this && this . _ _setModuleDefault ) || ( Object . create ? ( function ( o , v ) {
Object . defineProperty ( o , "default" , { enumerable : true , value : v } ) ;
} ) : function ( o , v ) {
o [ "default" ] = v ;
} ) ;
var _ _importStar = ( this && this . _ _importStar ) || function ( mod ) {
if ( mod && mod . _ _esModule ) return mod ;
var result = { } ;
if ( mod != null ) for ( var k in mod ) if ( k !== "default" && Object . prototype . hasOwnProperty . call ( mod , k ) ) _ _createBinding ( result , mod , k ) ;
_ _setModuleDefault ( result , mod ) ;
return result ;
} ;
Object . defineProperty ( exports , "__esModule" , ( { value : true } ) ) ;
const core = _ _importStar ( _ _nccwpck _require _ _ ( 2186 ) ) ;
const github = _ _importStar ( _ _nccwpck _require _ _ ( 5438 ) ) ;
const github _1 = _ _nccwpck _require _ _ ( 5438 ) ;
const api _utils _1 = _ _nccwpck _require _ _ ( 2430 ) ;
const version _utils _1 = _ _nccwpck _require _ _ ( 1534 ) ;
async function run ( ) {
try {
const token = core . getInput ( 'token' ) ;
const octokitClient = github . getOctokit ( token ) ;
const sourceTagName = core . getInput ( 'source-tag' ) ;
version _utils _1 . validateSemverVersionFromTag ( sourceTagName ) ;
await api _utils _1 . validateIfReleaseIsPublished ( sourceTagName , octokitClient ) ;
const majorTag = version _utils _1 . getMajorTagFromFullTag ( sourceTagName ) ;
await api _utils _1 . updateTag ( sourceTagName , majorTag , octokitClient ) ;
core . setOutput ( 'major-tag' , majorTag ) ;
core . info ( ` The ' ${ majorTag } ' major tag now points to the ' ${ sourceTagName } ' tag ` ) ;
const slackMessage = ` The ${ majorTag } tag has been successfully updated for the ${ github _1 . context . repo . repo } action to include changes from ${ sourceTagName } ` ;
await reportStatusToSlack ( slackMessage ) ;
}
catch ( error ) {
core . setFailed ( error . message ) ;
const slackMessage = ` Failed to update a major tag for the ${ github _1 . context . repo . repo } action ` ;
await reportStatusToSlack ( slackMessage ) ;
}
}
async function reportStatusToSlack ( message ) {
const slackWebhook = core . getInput ( 'slack-webhook' ) ;
if ( slackWebhook ) {
await api _utils _1 . postMessageToSlack ( slackWebhook , message ) ;
}
}
run ( ) ;
/***/ } ) ,
@ -172,31 +172,31 @@ run();
/***/ ( function ( _ _unused _webpack _module , exports , _ _nccwpck _require _ _ ) {
"use strict" ;
var _ _importDefault = ( this && this . _ _importDefault ) || function ( mod ) {
return ( mod && mod . _ _esModule ) ? mod : { "default" : mod } ;
} ;
Object . defineProperty ( exports , "__esModule" , ( { value : true } ) ) ;
exports . validateSemverVersionFromTag = exports . getMajorTagFromFullTag = exports . isStableSemverVersion = void 0 ;
const parse _1 = _ _importDefault ( _ _nccwpck _require _ _ ( 5925 ) ) ;
function isStableSemverVersion ( version ) {
return version . prerelease . length === 0 ;
}
exports . isStableSemverVersion = isStableSemverVersion ;
function getMajorTagFromFullTag ( fullTag ) {
return fullTag . split ( '.' ) [ 0 ] ;
}
exports . getMajorTagFromFullTag = getMajorTagFromFullTag ;
function validateSemverVersionFromTag ( tag ) {
const semverVersion = parse _1 . default ( tag ) ;
if ( ! semverVersion ) {
throw new Error ( ` The ' ${ tag } ' doesn't satisfy semantic versioning specification ` ) ;
}
if ( ! isStableSemverVersion ( semverVersion ) ) {
throw new Error ( 'It is not allowed to specify pre-release version to update the major tag' ) ;
}
}
exports . validateSemverVersionFromTag = validateSemverVersionFromTag ;
var _ _importDefault = ( this && this . _ _importDefault ) || function ( mod ) {
return ( mod && mod . _ _esModule ) ? mod : { "default" : mod } ;
} ;
Object . defineProperty ( exports , "__esModule" , ( { value : true } ) ) ;
exports . validateSemverVersionFromTag = exports . getMajorTagFromFullTag = exports . isStableSemverVersion = void 0 ;
const parse _1 = _ _importDefault ( _ _nccwpck _require _ _ ( 5925 ) ) ;
function isStableSemverVersion ( version ) {
return version . prerelease . length === 0 ;
}
exports . isStableSemverVersion = isStableSemverVersion ;
function getMajorTagFromFullTag ( fullTag ) {
return fullTag . split ( '.' ) [ 0 ] ;
}
exports . getMajorTagFromFullTag = getMajorTagFromFullTag ;
function validateSemverVersionFromTag ( tag ) {
const semverVersion = parse _1 . default ( tag ) ;
if ( ! semverVersion ) {
throw new Error ( ` The ' ${ tag } ' doesn't satisfy semantic versioning specification ` ) ;
}
if ( ! isStableSemverVersion ( semverVersion ) ) {
throw new Error ( 'It is not allowed to specify pre-release version to update the major tag' ) ;
}
}
exports . validateSemverVersionFromTag = validateSemverVersionFromTag ;
/***/ } ) ,
@ -9327,7 +9327,7 @@ function onceStrict (fn) {
const debug = _ _nccwpck _require _ _ ( 427 )
const { MAX _LENGTH , MAX _SAFE _INTEGER } = _ _nccwpck _require _ _ ( 2293 )
const { re, t } = _ _nccwpck _require _ _ ( 9523 )
const { safeRe: re, t } = _ _nccwpck _require _ _ ( 9523 )
const parseOptions = _ _nccwpck _require _ _ ( 785 )
const { compareIdentifiers } = _ _nccwpck _require _ _ ( 2463 )
@ -9343,7 +9343,7 @@ class SemVer {
version = version . version
}
} else if ( typeof version !== 'string' ) {
throw new TypeError ( ` Invalid Version: ${ version } ` )
throw new TypeError ( ` Invalid version. Must be a string. Got type "${ typeof version } ". ` )
}
if ( version . length > MAX _LENGTH ) {
@ -9502,36 +9502,36 @@ class SemVer {
// preminor will bump the version up to the next minor release, and immediately
// down to pre-release. premajor and prepatch work the same way.
inc ( release , identifier ) {
inc ( release , identifier , identifierBase ) {
switch ( release ) {
case 'premajor' :
this . prerelease . length = 0
this . patch = 0
this . minor = 0
this . major ++
this . inc ( 'pre' , identifier )
this . inc ( 'pre' , identifier , identifierBase )
break
case 'preminor' :
this . prerelease . length = 0
this . patch = 0
this . minor ++
this . inc ( 'pre' , identifier )
this . inc ( 'pre' , identifier , identifierBase )
break
case 'prepatch' :
// If this is already a prerelease, it will bump to the next version
// drop any prereleases that might already exist, since they are not
// relevant at this point.
this . prerelease . length = 0
this . inc ( 'patch' , identifier )
this . inc ( 'pre' , identifier )
this . inc ( 'patch' , identifier , identifierBase )
this . inc ( 'pre' , identifier , identifierBase )
break
// If the input is a non-prerelease version, this acts the same as
// prepatch.
case 'prerelease' :
if ( this . prerelease . length === 0 ) {
this . inc ( 'patch' , identifier )
this . inc ( 'patch' , identifier , identifierBase )
}
this . inc ( 'pre' , identifier )
this . inc ( 'pre' , identifier , identifierBase )
break
case 'major' :
@ -9573,9 +9573,15 @@ class SemVer {
break
// This probably shouldn't be used publicly.
// 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
case 'pre' :
case 'pre' : {
const base = Number ( identifierBase ) ? 1 : 0
if ( ! identifier && identifierBase === false ) {
throw new Error ( 'invalid increment argument: identifier is empty' )
}
if ( this . prerelease . length === 0 ) {
this . prerelease = [ 0 ]
this . prerelease = [ base ]
} else {
let i = this . prerelease . length
while ( -- i >= 0 ) {
@ -9586,27 +9592,36 @@ class SemVer {
}
if ( i === - 1 ) {
// didn't increment anything
this . prerelease . push ( 0 )
if ( identifier === this . prerelease . join ( '.' ) && identifierBase === false ) {
throw new Error ( 'invalid increment argument: identifier already exists' )
}
this . prerelease . push ( base )
}
}
if ( identifier ) {
// 1.2.0-beta.1 bumps to 1.2.0-beta.2,
// 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
let prerelease = [ identifier , base ]
if ( identifierBase === false ) {
prerelease = [ identifier ]
}
if ( compareIdentifiers ( this . prerelease [ 0 ] , identifier ) === 0 ) {
if ( isNaN ( this . prerelease [ 1 ] ) ) {
this . prerelease = [ identifier , 0 ]
this . prerelease = prerelease
}
} else {
this . prerelease = [ identifier , 0 ]
this . prerelease = prerelease
}
}
break
}
default :
throw new Error ( ` invalid increment argument: ${ release } ` )
}
this . format ( )
this . raw = this . version
this . raw = this . format ( )
if ( this . build . length ) {
this . raw += ` + ${ this . build . join ( '.' ) } `
}
return this
}
}
@ -9619,35 +9634,18 @@ module.exports = SemVer
/***/ 5925 :
/***/ ( ( module , _ _unused _webpack _exports , _ _nccwpck _require _ _ ) => {
const { MAX _LENGTH } = _ _nccwpck _require _ _ ( 2293 )
const { re , t } = _ _nccwpck _require _ _ ( 9523 )
const SemVer = _ _nccwpck _require _ _ ( 8088 )
const parseOptions = _ _nccwpck _require _ _ ( 785 )
const parse = ( version , options ) => {
options = parseOptions ( options )
const parse = ( version , options , throwErrors = false ) => {
if ( version instanceof SemVer ) {
return version
}
if ( typeof version !== 'string' ) {
return null
}
if ( version . length > MAX _LENGTH ) {
return null
}
const r = options . loose ? re [ t . LOOSE ] : re [ t . FULL ]
if ( ! r . test ( version ) ) {
return null
}
try {
return new SemVer ( version , options )
} catch ( er ) {
return null
if ( ! throwErrors ) {
return null
}
throw er
}
}
@ -9670,11 +9668,29 @@ const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||
// Max safe segment length for coercion.
const MAX _SAFE _COMPONENT _LENGTH = 16
// Max safe length for a build identifier. The max length minus 6 characters for
// the shortest version with a build 0.0.0+BUILD.
const MAX _SAFE _BUILD _LENGTH = MAX _LENGTH - 6
const RELEASE _TYPES = [
'major' ,
'premajor' ,
'minor' ,
'preminor' ,
'patch' ,
'prepatch' ,
'prerelease' ,
]
module . exports = {
SEMVER _SPEC _VERSION ,
MAX _LENGTH ,
MAX _SAFE _INTEGER ,
MAX _SAFE _COMPONENT _LENGTH ,
MAX _SAFE _BUILD _LENGTH ,
MAX _SAFE _INTEGER ,
RELEASE _TYPES ,
SEMVER _SPEC _VERSION ,
FLAG _INCLUDE _PRERELEASE : 0b001 ,
FLAG _LOOSE : 0b010 ,
}
@ -9729,16 +9745,20 @@ module.exports = {
/***/ 785 :
/***/ ( ( module ) => {
// parse out just the options we care about so we always get a consistent
// obj with keys in a consistent order.
const opts = [ 'includePrerelease' , 'loose' , 'rtl' ]
const parseOptions = options =>
! options ? { }
: typeof options !== 'object' ? { loose : true }
: opts . filter ( k => options [ k ] ) . reduce ( ( o , k ) => {
o [ k ] = true
return o
} , { } )
// parse out just the options we care about
const looseOption = Object . freeze ( { loose : true } )
const emptyOpts = Object . freeze ( { } )
const parseOptions = options => {
if ( ! options ) {
return emptyOpts
}
if ( typeof options !== 'object' ) {
return looseOption
}
return options
}
module . exports = parseOptions
@ -9747,22 +9767,52 @@ module.exports = parseOptions
/***/ 9523 :
/***/ ( ( module , exports , _ _nccwpck _require _ _ ) => {
const { MAX _SAFE _COMPONENT _LENGTH } = _ _nccwpck _require _ _ ( 2293 )
const {
MAX _SAFE _COMPONENT _LENGTH ,
MAX _SAFE _BUILD _LENGTH ,
MAX _LENGTH ,
} = _ _nccwpck _require _ _ ( 2293 )
const debug = _ _nccwpck _require _ _ ( 427 )
exports = module . exports = { }
// The actual regexps go on exports.re
const re = exports . re = [ ]
const safeRe = exports . safeRe = [ ]
const src = exports . src = [ ]
const t = exports . t = { }
let R = 0
const LETTERDASHNUMBER = '[a-zA-Z0-9-]'
// Replace some greedy regex tokens to prevent regex dos issues. These regex are
// used internally via the safeRe object since all inputs in this library get
// normalized first to trim and collapse all extra whitespace. The original
// regexes are exported for userland consumption and lower level usage. A
// future breaking change could export the safer regex only with a note that
// all input should have extra whitespace removed.
const safeRegexReplacements = [
[ '\\s' , 1 ] ,
[ '\\d' , MAX _LENGTH ] ,
[ LETTERDASHNUMBER , MAX _SAFE _BUILD _LENGTH ] ,
]
const makeSafeRegex = ( value ) => {
for ( const [ token , max ] of safeRegexReplacements ) {
value = value
. split ( ` ${ token } * ` ) . join ( ` ${ token } {0, ${ max } } ` )
. split ( ` ${ token } + ` ) . join ( ` ${ token } {1, ${ max } } ` )
}
return value
}
const createToken = ( name , value , isGlobal ) => {
const safe = makeSafeRegex ( value )
const index = R ++
debug ( name , index , value )
t [ name ] = index
src [ index ] = value
re [ index ] = new RegExp ( value , isGlobal ? 'g' : undefined )
safeRe [ index ] = new RegExp ( safe , isGlobal ? 'g' : undefined )
}
// The following Regular Expressions can be used for tokenizing,
@ -9772,13 +9822,13 @@ const createToken = (name, value, isGlobal) => {
// A single `0`, or a non-zero digit followed by zero or more digits.
createToken ( 'NUMERICIDENTIFIER' , '0|[1-9]\\d*' )
createToken ( 'NUMERICIDENTIFIERLOOSE' , ' [0-9] +')
createToken ( 'NUMERICIDENTIFIERLOOSE' , ' \\d +')
// ## Non-numeric Identifier
// Zero or more digits, followed by a letter or hyphen, and then zero or
// more letters, digits, or hyphens.
createToken ( 'NONNUMERICIDENTIFIER' , '\\d*[a-zA-Z-][a-zA-Z0-9-]*' )
createToken ( 'NONNUMERICIDENTIFIER' , ` \\ d*[a-zA-Z-] ${ LETTERDASHNUMBER } * ` )
// ## Main Version
// Three dot-separated numeric identifiers.
@ -9813,7 +9863,7 @@ createToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]
// ## Build Metadata Identifier
// Any combination of digits, letters, or hyphens.
createToken ( 'BUILDIDENTIFIER' , '[0-9A-Za-z-]+' )
createToken ( 'BUILDIDENTIFIER' , ` ${ LETTERDASHNUMBER } + ` )
// ## Build Metadata
// Plus sign, followed by one or more period-separated build metadata