@@ -12,7 +12,7 @@ function makeUrl(repo, spec, tags, prefix, sha) {
1212 let version ;
1313 if ( ! spec )
1414 // Spec should already have defaulted to latest.
15- version = 'master ' ;
15+ version = 'HEAD ' ;
1616 else if ( tags [ spec ] ) version = tags [ spec ] ;
1717 // Matches npm tags like 'latest' or 'next'.
1818 // `spec` must match one of `meta.versions` as npm info call passed.
@@ -30,7 +30,7 @@ function makeUrl(repo, spec, tags, prefix, sha) {
3030
3131function makeClone ( repo , spec , tags , prefix ) {
3232 let version ;
33- if ( ! spec ) version = 'master ' ;
33+ if ( ! spec ) version = 'HEAD ' ;
3434 else version = ( prefix || '' ) + tags [ spec ] ;
3535 return {
3636 url : `${ repo } .git` ,
@@ -56,7 +56,27 @@ function getLookupTable(options) {
5656 if ( typeof options . lookup === 'string' ) {
5757 name = path . resolve ( process . cwd ( ) , options . lookup ) ;
5858 }
59- return require ( name ) ;
59+ const lookup = require ( name ) ;
60+
61+ // Backwards-compatibility: replace "master" key with "head".
62+ let warningEmitted = false ;
63+ for ( const moduleName of Object . keys ( lookup ) ) {
64+ const moduleConfig = lookup [ moduleName ] ;
65+ if ( moduleConfig . master !== undefined ) {
66+ if ( ! warningEmitted ) {
67+ process . emitWarning (
68+ 'The "master" key in lookup entries is deprecated. Use "head" instead. ' +
69+ `Found in "${ name } " for module "${ moduleName } ".` ,
70+ 'DeprecationWarning'
71+ ) ;
72+ warningEmitted = true ;
73+ }
74+ moduleConfig . head = moduleConfig . master ;
75+ delete moduleConfig . master ;
76+ }
77+ }
78+
79+ return lookup ;
6080 } catch ( err ) {
6181 return undefined ;
6282 }
@@ -107,7 +127,7 @@ function resolve(context) {
107127 if ( rep . useGitClone ) {
108128 const { url, ref } = makeClone (
109129 getRepo ( rep . repo , meta ) ,
110- rep . master ? null : detail . fetchSpec ,
130+ rep . head ? null : detail . fetchSpec ,
111131 meta [ 'dist-tags' ] ,
112132 rep . prefix
113133 ) ;
@@ -121,12 +141,12 @@ function resolve(context) {
121141 context . module . raw = url ;
122142 context . module . ref = ref ;
123143 } else {
124- const gitHead = rep . master || rep . ignoreGitHead ? null : meta . gitHead ;
144+ const gitHead = rep . head || rep . ignoreGitHead ? null : meta . gitHead ;
125145 const url = makeUrl (
126146 getRepo ( rep . repo , meta ) ,
127- rep . master ? null : detail . fetchSpec ,
147+ rep . head ? null : detail . fetchSpec ,
128148 meta [ 'dist-tags' ] ,
129- rep . master ? null : rep . prefix ,
149+ rep . head ? null : rep . prefix ,
130150 context . options . sha || rep . sha || gitHead
131151 ) ;
132152 context . emit (
0 commit comments