@@ -29,7 +29,7 @@ import { exitWithError } from './error.js';
2929import { handleLintConfig } from '../commands/lint.js' ;
3030
3131import type { Config , Oas3Definition , Oas2Definition , Exact } from '@redocly/openapi-core' ;
32- import type { Totals , Entrypoint , OutputExtensions , CommandOptions } from '../types.js' ;
32+ import type { Totals , Entrypoint , OutputExtension , CommandOptions } from '../types.js' ;
3333
3434const globPromise = promisify ( glob . glob ) ;
3535
@@ -179,7 +179,7 @@ export class CircularJSONNotSupportedError extends Error {
179179 }
180180}
181181
182- export function dumpBundle ( obj : any , format : OutputExtensions , dereference ?: boolean ) : string {
182+ export function dumpBundle ( obj : any , format : OutputExtension , dereference ?: boolean ) : string {
183183 if ( format === 'json' ) {
184184 try {
185185 return JSON . stringify ( obj , null , 2 ) ;
@@ -271,10 +271,10 @@ export function writeJson(data: unknown, filename: string) {
271271 fs . writeFileSync ( filename , content ) ;
272272}
273273
274- export function getAndValidateFileExtension ( fileName : string ) : NonNullable < OutputExtensions > {
274+ export function getAndValidateFileExtension ( fileName : string ) : NonNullable < OutputExtension > {
275275 const ext = fileName . split ( '.' ) . pop ( ) ;
276- if ( outputExtensions . includes ( ext as OutputExtensions ) ) {
277- return ext as OutputExtensions ;
276+ if ( outputExtensions . includes ( ext as OutputExtension ) ) {
277+ return ext as OutputExtension ;
278278 }
279279 logger . warn ( `Unsupported file extension: ${ ext } . Using yaml.\n` ) ;
280280 return 'yaml' ;
@@ -369,7 +369,7 @@ export function getOutputFileName({
369369 entrypoint : string ;
370370 output ?: string ;
371371 argvOutput ?: string ;
372- ext ?: OutputExtensions ;
372+ ext ?: OutputExtension ;
373373 entries : number ;
374374} ) {
375375 let outputFile = output || argvOutput ;
@@ -378,16 +378,16 @@ export function getOutputFileName({
378378 }
379379
380380 if ( entries > 1 && argvOutput ) {
381- ext = ext || ( extname ( entrypoint ) . substring ( 1 ) as OutputExtensions ) ;
381+ ext = ext || ( extname ( entrypoint ) . substring ( 1 ) as OutputExtension ) ;
382382 if ( ! outputExtensions . includes ( ext ) ) {
383383 throw new Error ( `Invalid file extension: ${ ext } .` ) ;
384384 }
385385 outputFile = join ( argvOutput , basename ( entrypoint , extname ( entrypoint ) ) ) + '.' + ext ;
386386 } else {
387387 ext =
388388 ext ||
389- ( extname ( outputFile ) . substring ( 1 ) as OutputExtensions ) ||
390- ( extname ( entrypoint ) . substring ( 1 ) as OutputExtensions ) ;
389+ ( extname ( outputFile ) . substring ( 1 ) as OutputExtension ) ||
390+ ( extname ( entrypoint ) . substring ( 1 ) as OutputExtension ) ;
391391 if ( ! outputExtensions . includes ( ext ) ) {
392392 throw new Error ( `Invalid file extension: ${ ext } .` ) ;
393393 }
0 commit comments