@@ -100,14 +100,6 @@ function summarizeChanges({prev, curr, prevSrc, currSrc}) {
100100 return a !== b ;
101101 }
102102 } ;
103- const isNewlyDeprecated = ( k ) => {
104- const isPrevDeprecated = prevNames . has ( k ) && isDeprecated ( prevSrc , k ) ;
105- const isCurrDeprecated = currNames . has ( k ) && isDeprecated ( currSrc , k ) ;
106- if ( isPrevDeprecated && ! isCurrDeprecated ) {
107- throw new Error ( `semconv export '${ k } ' was *un*-deprecated in this release!? Wassup?` ) ;
108- }
109- return ( ! isPrevDeprecated && isCurrDeprecated ) ;
110- } ;
111103
112104 // Determine changes.
113105 const changes = [ ] ;
@@ -120,9 +112,12 @@ function summarizeChanges({prev, curr, prevSrc, currSrc}) {
120112 } else if ( valChanged ( curr [ k ] , prev [ k ] ) ) {
121113 changes . push ( { type : 'changed' , k, v : curr [ k ] , prevV : prev [ k ] } ) ;
122114 } else {
123- const deprecatedResult = isNewlyDeprecated ( k ) ;
124- if ( deprecatedResult ) {
125- changes . push ( { type : 'deprecated' , k, v : curr [ k ] , deprecatedResult} ) ;
115+ const isPrevDeprecated = prevNames . has ( k ) && isDeprecated ( prevSrc , k ) ;
116+ const isCurrDeprecated = currNames . has ( k ) && isDeprecated ( currSrc , k ) ;
117+ if ( ! isPrevDeprecated && isCurrDeprecated ) {
118+ changes . push ( { type : 'deprecated' , k, v : curr [ k ] , deprecatedResult : isCurrDeprecated } ) ;
119+ } else if ( isPrevDeprecated && ! isCurrDeprecated ) {
120+ changes . push ( { type : 'undeprecated' , k, v : curr [ k ] } ) ;
126121 }
127122 }
128123 }
@@ -138,19 +133,21 @@ function summarizeChanges({prev, curr, prevSrc, currSrc}) {
138133 removed : [ ] ,
139134 changed : [ ] ,
140135 deprecated : [ ] ,
136+ undeprecated : [ ] ,
141137 added : [ ] ,
142138 }
143139 const execSummaryFromChangeType = {
144140 removed : null ,
145141 changed : null ,
146142 deprecated : null ,
143+ undeprecated : null ,
147144 added : null ,
148145 } ;
149146
150147 const removed = changes . filter ( ch => ch . type === 'removed' ) ;
151148 let summary = summaryFromChangeType . removed ;
152149 if ( removed . length ) {
153- execSummaryFromChangeType . removed = `${ removed . length } removed exports ` ;
150+ execSummaryFromChangeType . removed = `${ removed . length } removed export ${ removed . length === 1 ? '' : 's' } ` ;
154151 if ( summary . length ) { summary . push ( '' ) ; }
155152 let last ;
156153 const longest = removed . reduce ( ( acc , ch ) => Math . max ( acc , ch . k . length ) , 0 ) ;
@@ -168,7 +165,7 @@ function summarizeChanges({prev, curr, prevSrc, currSrc}) {
168165 const changed = changes . filter ( ch => ch . type === 'changed' ) ;
169166 summary = summaryFromChangeType . changed ;
170167 if ( changed . length ) {
171- execSummaryFromChangeType . changed = `${ changed . length } exported values changed` ;
168+ execSummaryFromChangeType . changed = `${ changed . length } exported value ${ changed . length === 1 ? '' : 's' } changed` ;
172169 if ( summary . length ) { summary . push ( '' ) ; }
173170 let last ;
174171 const longest = changed . reduce ( ( acc , ch ) => Math . max ( acc , ch . k . length ) , 0 ) ;
@@ -187,7 +184,7 @@ function summarizeChanges({prev, curr, prevSrc, currSrc}) {
187184 const deprecated = changes . filter ( ch => ch . type === 'deprecated' ) ;
188185 summary = summaryFromChangeType . deprecated ;
189186 if ( deprecated . length ) {
190- execSummaryFromChangeType . deprecated = `${ deprecated . length } newly deprecated exports ` ;
187+ execSummaryFromChangeType . deprecated = `${ deprecated . length } newly deprecated export ${ deprecated . length === 1 ? '' : 's' } ` ;
191188 if ( summary . length ) { summary . push ( '' ) ; }
192189 let last ;
193190 const longest = deprecated . reduce ( ( acc , ch ) => Math . max ( acc , ch . k . length ) , 0 ) ;
@@ -205,10 +202,27 @@ function summarizeChanges({prev, curr, prevSrc, currSrc}) {
205202 } ) ;
206203 }
207204
205+ const undeprecated = changes . filter ( ch => ch . type === 'undeprecated' ) ;
206+ summary = summaryFromChangeType . undeprecated ;
207+ if ( undeprecated . length ) {
208+ execSummaryFromChangeType . undeprecated = `${ undeprecated . length } newly undeprecated export${ undeprecated . length === 1 ? '' : 's' } ` ;
209+ if ( summary . length ) { summary . push ( '' ) ; }
210+ let last ;
211+ const longest = undeprecated . reduce ( ( acc , ch ) => Math . max ( acc , ch . k . length ) , 0 ) ;
212+ undeprecated . forEach ( ch => {
213+ if ( last && ch . ns !== last . ns ) { summary . push ( '' ) ; }
214+ const cindent = ' ' . repeat ( longest - ch . k . length + 1 ) ;
215+
216+ summary . push ( `${ ch . k } ${ cindent } // ${ ch . v } ` ) ;
217+
218+ last = ch ;
219+ } ) ;
220+ }
221+
208222 const added = changes . filter ( ch => ch . type === 'added' ) ;
209223 summary = summaryFromChangeType . added ;
210224 if ( added . length ) {
211- execSummaryFromChangeType . added = `${ added . length } added exports ` ;
225+ execSummaryFromChangeType . added = `${ added . length } added export ${ added . length === 1 ? '' : 's' } ` ;
212226 let last , lastAttr ;
213227 const longest = added . reduce ( ( acc , ch ) => Math . max ( acc , ch . k . length ) , 0 ) ;
214228 added . forEach ( ch => {
@@ -311,7 +325,7 @@ function semconvChangelogGen(aVer=undefined, bVer=undefined) {
311325 } ) ;
312326
313327 // Render the "change info" into a Markdown summary for the changelog.
314- const changeTypes = [ 'removed' , 'changed' , 'deprecated' , 'added' ] ;
328+ const changeTypes = [ 'removed' , 'changed' , 'deprecated' , 'undeprecated' , ' added'] ;
315329 let execSummaryFromChInfo = ( chInfo ) => {
316330 const parts = changeTypes
317331 . map ( chType => chInfo . execSummaryFromChangeType [ chType ] )
0 commit comments