From a7deb5c12dc7c05be6eb271c8e86b38934c95719 Mon Sep 17 00:00:00 2001 From: Ferdi Koomen Date: Sun, 24 May 2020 11:19:40 +0200 Subject: [PATCH] - Added correct precompile using handlebars and custom plugin - Updated tests to provide dummy templates out of the box --- jest.config.js | 5 +- package.json | 23 ++- precompile.js | 32 --- rollup.config.js | 67 ++++++ src/openApi/v2/parser/getModel.ts | 4 +- src/openApi/v2/parser/getModelProperties.ts | 6 +- src/openApi/v2/parser/sortByRequired.ts | 2 +- src/openApi/v3/parser/getModel.ts | 4 +- src/openApi/v3/parser/getModelProperties.ts | 6 +- src/openApi/v3/parser/sortByRequired.ts | 2 +- src/templates/{model.hbs => exportModel.hbs} | 0 .../{schema.hbs => exportSchema.hbs} | 0 .../{service.hbs => exportService.hbs} | 0 src/typings/hbs.d.ts | 17 ++ src/utils/readHandlebarsTemplate.ts | 11 - src/utils/readHandlebarsTemplates.ts | 96 +++++---- src/utils/writeClient.ts | 2 +- test/__snapshots__/index.spec.js.snap | 106 +++++----- test/index.js | 4 +- tsconfig.json | 6 +- yarn.lock | 191 +++++++++++++++++- 21 files changed, 413 insertions(+), 171 deletions(-) delete mode 100644 precompile.js create mode 100644 rollup.config.js rename src/templates/{model.hbs => exportModel.hbs} (100%) rename src/templates/{schema.hbs => exportSchema.hbs} (100%) rename src/templates/{service.hbs => exportService.hbs} (100%) create mode 100644 src/typings/hbs.d.ts delete mode 100644 src/utils/readHandlebarsTemplate.ts diff --git a/jest.config.js b/jest.config.js index 07b14b50..93b52c1b 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,10 +1,13 @@ module.exports = { testRegex: '\\.spec\\.(ts|js)$', testEnvironment: 'node', + moduleNameMapper: { + '\\.hbs$': '/src/templates/__mocks__/index.js', + }, collectCoverageFrom: [ 'src/**/*.ts', '!src/**/*.d.ts', '!src/templates/**', '!**/node_modules/**', - ] + ], }; diff --git a/package.json b/package.json index 1d69823e..eba36c76 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openapi-typescript-codegen", - "version": "0.3.0", + "version": "0.3.1", "description": "NodeJS library that generates Typescript or Javascript clients based on the OpenAPI specification.", "author": "Ferdi Koomen", "homepage": "https://github.com/ferdikoomen/openapi-typescript-codegen", @@ -40,18 +40,16 @@ "files": [ "bin/index.js", "dist/index.js", - "dist/**/*.js", - "src/templates/**/*.js", "src/templates/**/*.ts" ], "scripts": { - "clean": "rimraf ./dist ./src/**/*.js ./test/result ./coverage", - "build": "tsc && node ./precompile.js", - "run": "npm run build && node ./test/index.js", - "test": "npm run build && jest", - "test:update": "npm run build && jest --updateSnapshot", - "test:watch": "npm run build && jest --watch", - "test:coverage": "npm run builds && jest --coverage", + "clean": "rimraf ./dist ./test/result ./coverage", + "build": "rollup --config", + "run": "node ./test/index.js", + "test": "jest", + "test:update": "jest --updateSnapshot", + "test:watch": "jest --watch", + "test:coverage": "jest --coverage", "eslint": "eslint \"./src/**/*.ts\"", "eslint:fix": "eslint \"./src/**/*.ts\" --fix", "prettier": "prettier \"./src/**/*.ts\" --check", @@ -71,6 +69,8 @@ "@babel/core": "7.9.6", "@babel/preset-env": "7.9.6", "@babel/preset-typescript": "7.9.0", + "@rollup/plugin-commonjs": "12.0.0", + "@rollup/plugin-node-resolve": "8.0.0", "@types/jest": "25.2.2", "@types/js-yaml": "3.12.4", "@types/mkdirp": "1.0.0", @@ -87,6 +87,9 @@ "jest": "26.0.1", "jest-cli": "26.0.1", "prettier": "2.0.5", + "rollup": "2.10.9", + "rollup-plugin-terser": "6.0.1", + "rollup-plugin-typescript2": "0.27.1", "typescript": "3.9.2" } } diff --git a/precompile.js b/precompile.js deleted file mode 100644 index a447eda2..00000000 --- a/precompile.js +++ /dev/null @@ -1,32 +0,0 @@ -'use strict'; - -const Handlebars = require('handlebars'); -const glob = require('glob'); -const fs = require('fs'); -const os = require('os'); - -glob.sync('./src/templates/**/*.hbs').forEach(file => { - // Read handlebars template as string - const template = fs.readFileSync(file, 'utf8').toString().trim(); - - // Precompile template to spec file, according to Handlebars this spec - // should be readable by a client, however it does not contain an export. - const templateSpec = Handlebars.precompile(template, { - strict: true, - noEscape: true, - preventIndent: true, - knownHelpersOnly: true, - knownHelpers: { - equals: true, - notEquals: true, - }, - }); - - // Wrap the spec with an export statement, so we can import this using require. - const module = `'use strict'${os.EOL}module.exports = ${templateSpec};`; - - // Write javascript module, this is the file we will import in the generator. - // This is much faster because we dont need to compile templates on the fly, - // plus we can load the handlebars/runtime which is quite lightweight. - fs.writeFileSync(file.replace('.hbs', '.js'), module); -}); diff --git a/rollup.config.js b/rollup.config.js new file mode 100644 index 00000000..a650a26b --- /dev/null +++ b/rollup.config.js @@ -0,0 +1,67 @@ +'use strict'; + +const commonjs = require('@rollup/plugin-commonjs'); +const { nodeResolve } = require('@rollup/plugin-node-resolve'); +const { terser } = require('rollup-plugin-terser'); +const typescript = require('rollup-plugin-typescript2'); +const handlebars = require('handlebars'); +const path = require('path'); +const fs = require('fs'); + +const pkg = require('./package.json'); +const external = Object.keys(pkg.dependencies); + +/** + * Custom plugin to parse handlebar imports and precompile + * the template on the fly. This reduces runtime by about + * half on large projects. + */ +function handlebarsPlugin() { + return { + resolveId(file, importer) { + if (file.endsWith('.hbs')) { + return path.resolve(path.dirname(importer), file); + } + return null; + }, + load(file) { + if (file.endsWith('.hbs')) { + const template = fs.readFileSync(file, 'utf8').toString().trim(); + const templateSpec = handlebars.precompile(template, { + strict: true, + noEscape: true, + preventIndent: true, + knownHelpersOnly: true, + knownHelpers: { + equals: true, + notEquals: true, + }, + }); + return `export default ${templateSpec};`; + } + return null; + }, + }; +} + +export default { + input: './src/index.ts', + output: { + file: './dist/index.js', + format: 'cjs', + }, + external: ['fs', 'os', ...external], + plugins: [ + handlebarsPlugin(), + typescript({ + clean: true, + }), + nodeResolve(), + commonjs(), + terser({ + output: { + comments: false, + }, + }), + ], +}; diff --git a/src/openApi/v2/parser/getModel.ts b/src/openApi/v2/parser/getModel.ts index 223f0930..dc516af4 100644 --- a/src/openApi/v2/parser/getModel.ts +++ b/src/openApi/v2/parser/getModel.ts @@ -133,7 +133,7 @@ export function getModel(openApi: OpenApi, definition: OpenApiSchema, isDefiniti model.imports.push(parentRef.base); } if (parent.type === 'object' && parent.properties) { - const properties = getModelProperties(openApi, parent); + const properties = getModelProperties(openApi, parent, getModel); properties.forEach(property => { model.properties.push(property); model.imports.push(...property.imports); @@ -146,7 +146,7 @@ export function getModel(openApi: OpenApi, definition: OpenApiSchema, isDefiniti } if (definition.properties) { - const properties = getModelProperties(openApi, definition); + const properties = getModelProperties(openApi, definition, getModel); properties.forEach(property => { model.properties.push(property); model.imports.push(...property.imports); diff --git a/src/openApi/v2/parser/getModelProperties.ts b/src/openApi/v2/parser/getModelProperties.ts index 363621f5..fe8f1d51 100644 --- a/src/openApi/v2/parser/getModelProperties.ts +++ b/src/openApi/v2/parser/getModelProperties.ts @@ -2,10 +2,12 @@ import { Model } from '../../../client/interfaces/Model'; import { OpenApi } from '../interfaces/OpenApi'; import { OpenApiSchema } from '../interfaces/OpenApiSchema'; import { getComment } from './getComment'; -import { getModel } from './getModel'; import { getType } from './getType'; -export function getModelProperties(openApi: OpenApi, definition: OpenApiSchema): Model[] { +// Fix for circular dependency between getModel and getModelProperties +export type GetModel = (openApi: OpenApi, definition: OpenApiSchema, isDefinition?: boolean, name?: string) => Model; + +export function getModelProperties(openApi: OpenApi, definition: OpenApiSchema, getModel: GetModel): Model[] { const models: Model[] = []; for (const propertyName in definition.properties) { if (definition.properties.hasOwnProperty(propertyName)) { diff --git a/src/openApi/v2/parser/sortByRequired.ts b/src/openApi/v2/parser/sortByRequired.ts index bb29ec45..6737ae2f 100644 --- a/src/openApi/v2/parser/sortByRequired.ts +++ b/src/openApi/v2/parser/sortByRequired.ts @@ -2,7 +2,7 @@ import { OperationParameter } from '../../../client/interfaces/OperationParamete export function sortByRequired(a: OperationParameter, b: OperationParameter): number { const aNeedsValue = a.isRequired && a.default === undefined; - const bNeedsValue = a.isRequired && a.default === undefined; + const bNeedsValue = b.isRequired && b.default === undefined; if (aNeedsValue && !bNeedsValue) return -1; if (!aNeedsValue && bNeedsValue) return 1; return 0; diff --git a/src/openApi/v3/parser/getModel.ts b/src/openApi/v3/parser/getModel.ts index b63737af..b0251ce0 100644 --- a/src/openApi/v3/parser/getModel.ts +++ b/src/openApi/v3/parser/getModel.ts @@ -154,7 +154,7 @@ export function getModel(openApi: OpenApi, definition: OpenApiSchema, isDefiniti model.imports.push(parentRef.base); } if (parent.type === 'object' && parent.properties) { - const properties = getModelProperties(openApi, parent); + const properties = getModelProperties(openApi, parent, getModel); properties.forEach(property => { model.properties.push(property); model.imports.push(...property.imports); @@ -167,7 +167,7 @@ export function getModel(openApi: OpenApi, definition: OpenApiSchema, isDefiniti } if (definition.properties) { - const properties = getModelProperties(openApi, definition); + const properties = getModelProperties(openApi, definition, getModel); properties.forEach(property => { model.properties.push(property); model.imports.push(...property.imports); diff --git a/src/openApi/v3/parser/getModelProperties.ts b/src/openApi/v3/parser/getModelProperties.ts index 55131337..5a5e4c2c 100644 --- a/src/openApi/v3/parser/getModelProperties.ts +++ b/src/openApi/v3/parser/getModelProperties.ts @@ -2,10 +2,12 @@ import { Model } from '../../../client/interfaces/Model'; import { OpenApi } from '../interfaces/OpenApi'; import { OpenApiSchema } from '../interfaces/OpenApiSchema'; import { getComment } from './getComment'; -import { getModel } from './getModel'; import { getType } from './getType'; -export function getModelProperties(openApi: OpenApi, definition: OpenApiSchema): Model[] { +// Fix for circular dependency between getModel and getModelProperties +export type GetModel = (openApi: OpenApi, definition: OpenApiSchema, isDefinition?: boolean, name?: string) => Model; + +export function getModelProperties(openApi: OpenApi, definition: OpenApiSchema, getModel: GetModel): Model[] { const models: Model[] = []; for (const propertyName in definition.properties) { if (definition.properties.hasOwnProperty(propertyName)) { diff --git a/src/openApi/v3/parser/sortByRequired.ts b/src/openApi/v3/parser/sortByRequired.ts index bb29ec45..6737ae2f 100644 --- a/src/openApi/v3/parser/sortByRequired.ts +++ b/src/openApi/v3/parser/sortByRequired.ts @@ -2,7 +2,7 @@ import { OperationParameter } from '../../../client/interfaces/OperationParamete export function sortByRequired(a: OperationParameter, b: OperationParameter): number { const aNeedsValue = a.isRequired && a.default === undefined; - const bNeedsValue = a.isRequired && a.default === undefined; + const bNeedsValue = b.isRequired && b.default === undefined; if (aNeedsValue && !bNeedsValue) return -1; if (!aNeedsValue && bNeedsValue) return 1; return 0; diff --git a/src/templates/model.hbs b/src/templates/exportModel.hbs similarity index 100% rename from src/templates/model.hbs rename to src/templates/exportModel.hbs diff --git a/src/templates/schema.hbs b/src/templates/exportSchema.hbs similarity index 100% rename from src/templates/schema.hbs rename to src/templates/exportSchema.hbs diff --git a/src/templates/service.hbs b/src/templates/exportService.hbs similarity index 100% rename from src/templates/service.hbs rename to src/templates/exportService.hbs diff --git a/src/typings/hbs.d.ts b/src/typings/hbs.d.ts new file mode 100644 index 00000000..5e6b066b --- /dev/null +++ b/src/typings/hbs.d.ts @@ -0,0 +1,17 @@ +/** + * We precompile the handlebar templates during the build process, + * however in the source code we want to reference these templates + * by importing the hbs files directly. Of course this is not allowed + * by Typescript, so we need to provide some declaration for these + * types. + * @see: build.js for more information + */ +declare module '*.hbs' { + export default { + compiler: [8, '>= 4.3.0'], + useData: true, + main: function (container, depth0, helpers, partials, data) { + return ''; + }, + }; +} diff --git a/src/utils/readHandlebarsTemplate.ts b/src/utils/readHandlebarsTemplate.ts deleted file mode 100644 index 64b4d0b4..00000000 --- a/src/utils/readHandlebarsTemplate.ts +++ /dev/null @@ -1,11 +0,0 @@ -import * as Handlebars from 'handlebars/runtime'; - -/** - * Read and compile the Handlebars template. - * @param filePath - */ -export function readHandlebarsTemplate(filePath: string): Handlebars.TemplateDelegate { - const template = require(filePath); - - return Handlebars.template(template); -} diff --git a/src/utils/readHandlebarsTemplates.ts b/src/utils/readHandlebarsTemplates.ts index 61041ea6..d8e5592a 100644 --- a/src/utils/readHandlebarsTemplates.ts +++ b/src/utils/readHandlebarsTemplates.ts @@ -1,13 +1,34 @@ import * as Handlebars from 'handlebars/runtime'; -import * as path from 'path'; -import { readHandlebarsTemplate } from './readHandlebarsTemplate'; +import $OpenAPI from '../templates/core/OpenAPI.hbs'; +import $exportModel from '../templates/exportModel.hbs'; +import $exportSchema from '../templates/exportSchema.hbs'; +import $exportService from '../templates/exportService.hbs'; +import $index from '../templates/index.hbs'; +import $exportEnum from '../templates/partials/exportEnum.hbs'; +import $exportInterface from '../templates/partials/exportInterface.hbs'; +import $exportType from '../templates/partials/exportType.hbs'; +import $extends from '../templates/partials/extends.hbs'; +import $isNullable from '../templates/partials/isNullable.hbs'; +import $isReadOnly from '../templates/partials/isReadOnly.hbs'; +import $isRequired from '../templates/partials/isRequired.hbs'; +import $parameters from '../templates/partials/parameters.hbs'; +import $result from '../templates/partials/result.hbs'; +import $schema from '../templates/partials/schema.hbs'; +import $schemaArray from '../templates/partials/schemaArray.hbs'; +import $schemaDictionary from '../templates/partials/schemaDictionary.hbs'; +import $schemaEnum from '../templates/partials/schemaEnum.hbs'; +import $schemaGeneric from '../templates/partials/schemaGeneric.hbs'; +import $schemaInterface from '../templates/partials/schemaInterface.hbs'; +import $type from '../templates/partials/type.hbs'; +import $typeArray from '../templates/partials/typeArray.hbs'; +import $typeDictionary from '../templates/partials/typeDictionary.hbs'; +import $typeEnum from '../templates/partials/typeEnum.hbs'; +import $typeGeneric from '../templates/partials/typeGeneric.hbs'; +import $typeInterface from '../templates/partials/typeInterface.hbs'; +import $typeReference from '../templates/partials/typeReference.hbs'; import { registerHandlebarHelpers } from './registerHandlebarHelpers'; -function resolveTemplate(filePath: string): string { - return path.resolve(__dirname, `../../src/templates/${filePath}`); -} - export interface Templates { index: Handlebars.TemplateDelegate; model: Handlebars.TemplateDelegate; @@ -24,44 +45,35 @@ export function readHandlebarsTemplates(): Templates { registerHandlebarHelpers(); const templates: Templates = { - index: readHandlebarsTemplate(resolveTemplate('index.js')), - model: readHandlebarsTemplate(resolveTemplate('model.js')), - schema: readHandlebarsTemplate(resolveTemplate('schema.js')), - service: readHandlebarsTemplate(resolveTemplate('service.js')), - settings: readHandlebarsTemplate(resolveTemplate('core/OpenAPI.js')), + index: Handlebars.template($index), + model: Handlebars.template($exportModel), + schema: Handlebars.template($exportSchema), + service: Handlebars.template($exportService), + settings: Handlebars.template($OpenAPI), }; - const partials = [ - 'exportEnum.js', - 'exportInterface.js', - 'exportType.js', - 'extends.js', - 'isNullable.js', - 'isReadOnly.js', - 'isRequired.js', - 'parameters.js', - 'result.js', - 'schema.js', - 'schemaArray.js', - 'schemaDictionary.js', - 'schemaEnum.js', - 'schemaGeneric.js', - 'schemaInterface.js', - 'type.js', - 'typeArray.js', - 'typeDictionary.js', - 'typeEnum.js', - 'typeGeneric.js', - 'typeInterface.js', - 'typeReference.js', - ]; - - partials.forEach(partial => { - const templatePath = resolveTemplate(`partials/${partial}`); - const templateName = path.basename(partial, '.js'); - const template = readHandlebarsTemplate(templatePath); - Handlebars.registerPartial(templateName, template); - }); + Handlebars.registerPartial('exportEnum', Handlebars.template($exportEnum)); + Handlebars.registerPartial('exportInterface', Handlebars.template($exportInterface)); + Handlebars.registerPartial('exportType', Handlebars.template($exportType)); + Handlebars.registerPartial('extends', Handlebars.template($extends)); + Handlebars.registerPartial('isNullable', Handlebars.template($isNullable)); + Handlebars.registerPartial('isReadOnly', Handlebars.template($isReadOnly)); + Handlebars.registerPartial('isRequired', Handlebars.template($isRequired)); + Handlebars.registerPartial('parameters', Handlebars.template($parameters)); + Handlebars.registerPartial('result', Handlebars.template($result)); + Handlebars.registerPartial('schema', Handlebars.template($schema)); + Handlebars.registerPartial('schemaArray', Handlebars.template($schemaArray)); + Handlebars.registerPartial('schemaDictionary', Handlebars.template($schemaDictionary)); + Handlebars.registerPartial('schemaEnum', Handlebars.template($schemaEnum)); + Handlebars.registerPartial('schemaGeneric', Handlebars.template($schemaGeneric)); + Handlebars.registerPartial('schemaInterface', Handlebars.template($schemaInterface)); + Handlebars.registerPartial('type', Handlebars.template($type)); + Handlebars.registerPartial('typeArray', Handlebars.template($typeArray)); + Handlebars.registerPartial('typeDictionary', Handlebars.template($typeDictionary)); + Handlebars.registerPartial('typeEnum', Handlebars.template($typeEnum)); + Handlebars.registerPartial('typeGeneric', Handlebars.template($typeGeneric)); + Handlebars.registerPartial('typeInterface', Handlebars.template($typeInterface)); + Handlebars.registerPartial('typeReference', Handlebars.template($typeReference)); return templates; } diff --git a/src/utils/writeClient.ts b/src/utils/writeClient.ts index e50c3672..77c36558 100644 --- a/src/utils/writeClient.ts +++ b/src/utils/writeClient.ts @@ -13,7 +13,7 @@ import { writeClientServices } from './writeClientServices'; import { writeClientSettings } from './writeClientSettings'; function copySupportFile(filePath: string, outputPath: string): void { - fs.copyFileSync(path.resolve(__dirname, `../../src/templates/${filePath}`), path.resolve(outputPath, filePath)); + fs.copyFileSync(path.resolve(__dirname, `../src/templates/${filePath}`), path.resolve(outputPath, filePath)); } /** diff --git a/test/__snapshots__/index.spec.js.snap b/test/__snapshots__/index.spec.js.snap index df299afc..366f2a05 100644 --- a/test/__snapshots__/index.spec.js.snap +++ b/test/__snapshots__/index.spec.js.snap @@ -2100,40 +2100,40 @@ export class DefaultsService { } /** + * @param parameterStringWithNoDefault This is a string with no default * @param parameterOptionalStringWithDefault This is a optional string with default * @param parameterOptionalStringWithEmptyDefault This is a optional string with empty default * @param parameterOptionalStringWithNoDefault This is a optional string with no default * @param parameterStringWithDefault This is a string with default * @param parameterStringWithEmptyDefault This is a string with empty default - * @param parameterStringWithNoDefault This is a string with no default * @throws ApiError */ public static async callToTestOrderOfParams({ + parameterStringWithNoDefault, parameterOptionalStringWithDefault = 'Hello World!', parameterOptionalStringWithEmptyDefault = '', parameterOptionalStringWithNoDefault, parameterStringWithDefault = 'hello', parameterStringWithEmptyDefault = '', - parameterStringWithNoDefault, }: { + parameterStringWithNoDefault: string, parameterOptionalStringWithDefault?: string, parameterOptionalStringWithEmptyDefault?: string, parameterOptionalStringWithNoDefault?: string, parameterStringWithDefault?: string, parameterStringWithEmptyDefault?: string, - parameterStringWithNoDefault: string, }): Promise { const result = await __request({ method: 'put', path: \`/api/v\${OpenAPI.VERSION}/defaults\`, query: { + 'parameterStringWithNoDefault': parameterStringWithNoDefault, 'parameterOptionalStringWithDefault': parameterOptionalStringWithDefault, 'parameterOptionalStringWithEmptyDefault': parameterOptionalStringWithEmptyDefault, 'parameterOptionalStringWithNoDefault': parameterOptionalStringWithNoDefault, 'parameterStringWithDefault': parameterStringWithDefault, 'parameterStringWithEmptyDefault': parameterStringWithEmptyDefault, - 'parameterStringWithNoDefault': parameterStringWithNoDefault, }, }); @@ -2311,31 +2311,31 @@ export class ParametersService { } /** - * @param parameterPath1 This is the parameter that goes into the path - * @param parameterPath2 This is the parameter that goes into the path - * @param parameterPath3 This is the parameter that goes into the path * @param parameterHeader This is the parameter that goes into the request header * @param parameterQuery This is the parameter that goes into the request query params * @param parameterForm This is the parameter that goes into the request form data * @param parameterBody This is the parameter that is send as request body + * @param parameterPath1 This is the parameter that goes into the path + * @param parameterPath2 This is the parameter that goes into the path + * @param parameterPath3 This is the parameter that goes into the path * @throws ApiError */ public static async callWithWeirdParameterNames({ - parameterPath1, - parameterPath2, - parameterPath3, parameterHeader, parameterQuery, parameterForm, parameterBody, + parameterPath1, + parameterPath2, + parameterPath3, }: { - parameterPath1?: string, - parameterPath2?: string, - parameterPath3?: string, parameterHeader: string, parameterQuery: string, parameterForm: string, parameterBody: string, + parameterPath1?: string, + parameterPath2?: string, + parameterPath3?: string, }): Promise { const result = await __request({ @@ -2579,13 +2579,13 @@ import { OpenAPI } from '../core/OpenAPI'; export class TypesService { /** + * @param parameterArray This is an array parameter + * @param parameterDictionary This is a dictionary parameter + * @param parameterEnum This is an enum parameter * @param parameterNumber This is a number parameter * @param parameterString This is a string parameter * @param parameterBoolean This is a boolean parameter * @param parameterObject This is an object parameter - * @param parameterArray This is an array parameter - * @param parameterDictionary This is a dictionary parameter - * @param parameterEnum This is an enum parameter * @param id This is a number parameter * @result number Response is a simple number * @result string Response is a simple string @@ -2594,22 +2594,22 @@ export class TypesService { * @throws ApiError */ public static async types({ + parameterArray, + parameterDictionary, + parameterEnum, parameterNumber = 123, parameterString = 'default', parameterBoolean = true, parameterObject = null, - parameterArray, - parameterDictionary, - parameterEnum, id, }: { + parameterArray: Array, + parameterDictionary: Dictionary, + parameterEnum: ('Success' | 'Warning' | 'Error'), parameterNumber?: number, parameterString?: string, parameterBoolean?: boolean, parameterObject?: any, - parameterArray: Array, - parameterDictionary: Dictionary, - parameterEnum: ('Success' | 'Warning' | 'Error'), id?: number, }): Promise { @@ -2617,13 +2617,13 @@ export class TypesService { method: 'get', path: \`/api/v\${OpenAPI.VERSION}/types\`, query: { + 'parameterArray': parameterArray, + 'parameterDictionary': parameterDictionary, + 'parameterEnum': parameterEnum, 'parameterNumber': parameterNumber, 'parameterString': parameterString, 'parameterBoolean': parameterBoolean, 'parameterObject': parameterObject, - 'parameterArray': parameterArray, - 'parameterDictionary': parameterDictionary, - 'parameterEnum': parameterEnum, }, }); @@ -4864,40 +4864,40 @@ export class DefaultsService { } /** + * @param parameterStringWithNoDefault This is a string with no default * @param parameterOptionalStringWithDefault This is a optional string with default * @param parameterOptionalStringWithEmptyDefault This is a optional string with empty default * @param parameterOptionalStringWithNoDefault This is a optional string with no default * @param parameterStringWithDefault This is a string with default * @param parameterStringWithEmptyDefault This is a string with empty default - * @param parameterStringWithNoDefault This is a string with no default * @throws ApiError */ public static async callToTestOrderOfParams({ + parameterStringWithNoDefault, parameterOptionalStringWithDefault = 'hello', parameterOptionalStringWithEmptyDefault = '', parameterOptionalStringWithNoDefault, parameterStringWithDefault = 'hello', parameterStringWithEmptyDefault = '', - parameterStringWithNoDefault, }: { + parameterStringWithNoDefault: string, parameterOptionalStringWithDefault?: string, parameterOptionalStringWithEmptyDefault?: string, parameterOptionalStringWithNoDefault?: string, parameterStringWithDefault?: string, parameterStringWithEmptyDefault?: string, - parameterStringWithNoDefault: string, }): Promise { const result = await __request({ method: 'put', path: \`/api/v\${OpenAPI.VERSION}/defaults\`, query: { + 'parameterStringWithNoDefault': parameterStringWithNoDefault, 'parameterOptionalStringWithDefault': parameterOptionalStringWithDefault, 'parameterOptionalStringWithEmptyDefault': parameterOptionalStringWithEmptyDefault, 'parameterOptionalStringWithNoDefault': parameterOptionalStringWithNoDefault, 'parameterStringWithDefault': parameterStringWithDefault, 'parameterStringWithEmptyDefault': parameterStringWithEmptyDefault, - 'parameterStringWithNoDefault': parameterStringWithNoDefault, }, }); @@ -5121,34 +5121,34 @@ export class ParametersService { } /** - * @param parameterPath1 This is the parameter that goes into the path - * @param parameterPath2 This is the parameter that goes into the path - * @param parameterPath3 This is the parameter that goes into the path * @param parameterHeader This is the parameter that goes into the request header * @param parameterQuery This is the parameter that goes into the request query params * @param parameterForm This is the parameter that goes into the request form data * @param parameterCookie This is the parameter that goes into the cookie * @param requestBody This is the parameter that goes into the body + * @param parameterPath1 This is the parameter that goes into the path + * @param parameterPath2 This is the parameter that goes into the path + * @param parameterPath3 This is the parameter that goes into the path * @throws ApiError */ public static async callWithWeirdParameterNames({ - parameterPath1, - parameterPath2, - parameterPath3, parameterHeader, parameterQuery, parameterForm, parameterCookie, requestBody, + parameterPath1, + parameterPath2, + parameterPath3, }: { - parameterPath1?: string, - parameterPath2?: string, - parameterPath3?: string, parameterHeader: string | null, parameterQuery: string | null, parameterForm: string | null, parameterCookie: string | null, requestBody: ModelThatExtends | ModelThatExtendsExtends | ModelWithString | null, + parameterPath1?: string, + parameterPath2?: string, + parameterPath3?: string, }): Promise { const result = await __request({ @@ -5175,16 +5175,16 @@ export class ParametersService { } /** - * @param parameter This is an optional parameter * @param requestBody This is a required parameter + * @param parameter This is an optional parameter * @throws ApiError */ public static async getCallWithOptionalParam({ - parameter, requestBody, + parameter, }: { - parameter?: string, requestBody: ModelThatExtends | ModelThatExtendsExtends | ModelWithString, + parameter?: string, }): Promise { const result = await __request({ @@ -5448,13 +5448,13 @@ import { OpenAPI } from '../core/OpenAPI'; export class TypesService { /** + * @param parameterArray This is an array parameter + * @param parameterDictionary This is a dictionary parameter + * @param parameterEnum This is an enum parameter * @param parameterNumber This is a number parameter * @param parameterString This is a string parameter * @param parameterBoolean This is a boolean parameter * @param parameterObject This is an object parameter - * @param parameterArray This is an array parameter - * @param parameterDictionary This is a dictionary parameter - * @param parameterEnum This is an enum parameter * @param id This is a number parameter * @result number Response is a simple number * @result string Response is a simple string @@ -5463,22 +5463,22 @@ export class TypesService { * @throws ApiError */ public static async types({ + parameterArray, + parameterDictionary, + parameterEnum, parameterNumber = 123, parameterString = 'default', parameterBoolean = true, parameterObject = null, - parameterArray, - parameterDictionary, - parameterEnum, id, }: { + parameterArray: Array | null, + parameterDictionary: any, + parameterEnum: ('Success' | 'Warning' | 'Error') | null, parameterNumber?: number, parameterString?: string | null, parameterBoolean?: boolean | null, parameterObject?: any, - parameterArray: Array | null, - parameterDictionary: any, - parameterEnum: ('Success' | 'Warning' | 'Error') | null, id?: number, }): Promise { @@ -5486,13 +5486,13 @@ export class TypesService { method: 'get', path: \`/api/v\${OpenAPI.VERSION}/types\`, query: { + 'parameterArray': parameterArray, + 'parameterDictionary': parameterDictionary, + 'parameterEnum': parameterEnum, 'parameterNumber': parameterNumber, 'parameterString': parameterString, 'parameterBoolean': parameterBoolean, 'parameterObject': parameterObject, - 'parameterArray': parameterArray, - 'parameterDictionary': parameterDictionary, - 'parameterEnum': parameterEnum, }, }); diff --git a/test/index.js b/test/index.js index aae2374d..9acc11ac 100644 --- a/test/index.js +++ b/test/index.js @@ -29,7 +29,7 @@ OpenAPI.generate({ useOptions: true, useUnionTypes: true, exportSchemas: true, - exportServices: true, + exportServices: true }); OpenAPI.generate({ @@ -39,7 +39,7 @@ OpenAPI.generate({ useOptions: true, useUnionTypes: true, exportSchemas: true, - exportServices: true, + exportServices: true }); console.timeEnd('generate'); diff --git a/tsconfig.json b/tsconfig.json index cf81c171..61c94a13 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,7 +4,7 @@ "compilerOptions": { "outDir": "./dist", "target": "es6", - "module": "commonjs", + "module": "es6", "moduleResolution": "node", "lib": ["es6", "dom"], "types": ["node", "jest"], @@ -24,6 +24,10 @@ "forceConsistentCasingInFileNames": true }, + "files": [ + "./src/typings/hbs.d.ts" + ], + "include": [ "./src/index.ts" ], diff --git a/yarn.lock b/yarn.lock index 44b5dbf4..548ccf30 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1005,6 +1005,41 @@ "@types/yargs" "^15.0.0" chalk "^4.0.0" +"@rollup/plugin-commonjs@12.0.0": + version "12.0.0" + resolved "https://registry.yarnpkg.com/@rollup/plugin-commonjs/-/plugin-commonjs-12.0.0.tgz#e2f308ae6057499e0f413f878fff7c3a0fdc02a1" + integrity sha512-8+mDQt1QUmN+4Y9D3yCG8AJNewuTSLYPJVzKKUZ+lGeQrI+bV12Tc5HCyt2WdlnG6ihIL/DPbKRJlB40DX40mw== + dependencies: + "@rollup/pluginutils" "^3.0.8" + commondir "^1.0.1" + estree-walker "^1.0.1" + glob "^7.1.2" + is-reference "^1.1.2" + magic-string "^0.25.2" + resolve "^1.11.0" + +"@rollup/plugin-node-resolve@8.0.0": + version "8.0.0" + resolved "https://registry.yarnpkg.com/@rollup/plugin-node-resolve/-/plugin-node-resolve-8.0.0.tgz#47cc0775e31b6a531c88a40270377fe899a271cb" + integrity sha512-5poJCChrkVggXXND/sQ7yNqwjUNT4fP31gpRWCnSNnlXuUXTCMHT33xZrTGxgjm5Rl18MHj7iEzlCT8rYWwQSA== + dependencies: + "@rollup/pluginutils" "^3.0.8" + "@types/resolve" "0.0.8" + builtin-modules "^3.1.0" + deep-freeze "^0.0.1" + deepmerge "^4.2.2" + is-module "^1.0.0" + resolve "^1.14.2" + +"@rollup/pluginutils@^3.0.8": + version "3.0.10" + resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-3.0.10.tgz#a659b9025920378494cd8f8c59fbf9b3a50d5f12" + integrity sha512-d44M7t+PjmMrASHbhgpSbVgtL6EFyX7J4mYxwQ/c5eoaE6N2VgCgEcWVzNnwycIloti+/MpwFr8qfw+nRw00sw== + dependencies: + "@types/estree" "0.0.39" + estree-walker "^1.0.1" + picomatch "^2.2.2" + "@sinonjs/commons@^1.7.0": version "1.8.0" resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-1.8.0.tgz#c8d68821a854c555bba172f3b06959a0039b236d" @@ -1067,6 +1102,11 @@ resolved "https://registry.yarnpkg.com/@types/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#1ee30d79544ca84d68d4b3cdb0af4f205663dd2d" integrity sha512-OCutwjDZ4aFS6PB1UZ988C4YgwlBHJd6wCeQqaLdmadZ/7e+w79+hbMUFC1QXDNCmdyoRfAFdm0RypzwR+Qpag== +"@types/estree@0.0.39": + version "0.0.39" + resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.39.tgz#e177e699ee1b8c22d23174caaa7422644389509f" + integrity sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw== + "@types/events@*": version "3.0.0" resolved "https://registry.yarnpkg.com/@types/events/-/events-3.0.0.tgz#2862f3f58a9a7f7c3e78d79f130dd4d71c25c2a7" @@ -1158,6 +1198,13 @@ resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-2.0.1.tgz#b6e98083f13faa1e5231bfa3bdb1b0feff536b6d" integrity sha512-boy4xPNEtiw6N3abRhBi/e7hNvy3Tt8E9ZRAQrwAGzoCGZS/1wjo9KY7JHhnfnEsG5wSjDbymCozUM9a3ea7OQ== +"@types/resolve@0.0.8": + version "0.0.8" + resolved "https://registry.yarnpkg.com/@types/resolve/-/resolve-0.0.8.tgz#f26074d238e02659e323ce1a13d041eee280e194" + integrity sha512-auApPaJf3NPfe18hSoJkp8EbZzer2ISk7o8mCC3M9he/a04+gbMF97NkpD2S8riMGvm4BMRI59/SZQSaLTKpsQ== + dependencies: + "@types/node" "*" + "@types/rimraf@3.0.0": version "3.0.0" resolved "https://registry.yarnpkg.com/@types/rimraf/-/rimraf-3.0.0.tgz#b9d03f090ece263671898d57bb7bb007023ac19f" @@ -1546,6 +1593,11 @@ buffer-from@^1.0.0: resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A== +builtin-modules@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-3.1.0.tgz#aad97c15131eb76b65b50ef208e7584cd76a7484" + integrity sha512-k0KL0aWZuBt2lrxrcASWDfwOLMnodeQjodT/1SxEQAXsHANgo6ZC/VEaSEHCXt7aSTZ4/4H5LKa+tBXmW7Vtvw== + cache-base@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/cache-base/-/cache-base-1.0.1.tgz#0a7f46416831c8b662ee36fe4e7c59d76f666ab2" @@ -1729,11 +1781,16 @@ commander@5.1.0: resolved "https://registry.yarnpkg.com/commander/-/commander-5.1.0.tgz#46abbd1652f8e059bddaef99bbdcb2ad9cf179ae" integrity sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg== -commander@~2.20.3: +commander@^2.20.0, commander@~2.20.3: version "2.20.3" resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== +commondir@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b" + integrity sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs= + component-emitter@^1.2.1: version "1.3.0" resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.3.0.tgz#16e4070fba8ae29b679f2215853ee181ab2eabc0" @@ -1851,6 +1908,11 @@ decode-uri-component@^0.2.0: resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545" integrity sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU= +deep-freeze@^0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/deep-freeze/-/deep-freeze-0.0.1.tgz#3a0b0005de18672819dfd38cd31f91179c893e84" + integrity sha1-OgsABd4YZygZ39OM0x+RF5yJPoQ= + deep-is@~0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" @@ -2110,6 +2172,11 @@ estraverse@^5.1.0: resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.1.0.tgz#374309d39fd935ae500e7b92e8a6b4c720e59642" integrity sha512-FyohXK+R0vE+y1nHLoBM7ZTyqRpqAlhdZHCWIWEviFLiGB8b04H6bQs8G+XTthacvT8VuwvteiP7RJSxMs8UEw== +estree-walker@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-1.0.1.tgz#31bc5d612c96b704106b477e6dd5d8aa138cb700" + integrity sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg== + esutils@^2.0.2: version "2.0.3" resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" @@ -2289,6 +2356,15 @@ fill-range@^7.0.1: dependencies: to-regex-range "^5.0.1" +find-cache-dir@^3.3.1: + version "3.3.1" + resolved "https://registry.yarnpkg.com/find-cache-dir/-/find-cache-dir-3.3.1.tgz#89b33fad4a4670daa94f855f7fbe31d6d84fe880" + integrity sha512-t2GDMt3oGC/v+BMwzmllWDuJF/xcDtE5j/fCGbqDD7OLuJkj0cfh1YSA5VKPvwMeLFLNDBkwOKZ2X85jGLVftQ== + dependencies: + commondir "^1.0.1" + make-dir "^3.0.2" + pkg-dir "^4.1.0" + find-up@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/find-up/-/find-up-2.1.0.tgz#45d1b7e506c717ddd482775a2b77920a3c0c57a7" @@ -2344,12 +2420,21 @@ fragment-cache@^0.2.1: dependencies: map-cache "^0.2.2" +fs-extra@8.1.0: + version "8.1.0" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-8.1.0.tgz#49d43c45a88cd9677668cb7be1b46efdb8d2e1c0" + integrity sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g== + dependencies: + graceful-fs "^4.2.0" + jsonfile "^4.0.0" + universalify "^0.1.0" + fs.realpath@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= -fsevents@^2.1.2: +fsevents@^2.1.2, fsevents@~2.1.2: version "2.1.3" resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.1.3.tgz#fb738703ae8d2f9fe900c33836ddebee8b97f23e" integrity sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ== @@ -2441,7 +2526,7 @@ globals@^12.1.0: dependencies: type-fest "^0.8.1" -graceful-fs@^4.2.4: +graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.4: version "4.2.4" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.4.tgz#2256bde14d3632958c465ebc96dc467ca07a29fb" integrity sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw== @@ -2766,6 +2851,11 @@ is-glob@^4.0.0, is-glob@^4.0.1: dependencies: is-extglob "^2.1.1" +is-module@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-module/-/is-module-1.0.0.tgz#3258fb69f78c14d5b815d664336b4cffb6441591" + integrity sha1-Mlj7afeMFNW4FdZkM2tM/7ZEFZE= + is-number@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/is-number/-/is-number-3.0.0.tgz#24fd6201a4782cf50561c810276afc7d12d71195" @@ -2790,6 +2880,13 @@ is-potential-custom-element-name@^1.0.0: resolved "https://registry.yarnpkg.com/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.0.tgz#0c52e54bcca391bb2c494b21e8626d7336c6e397" integrity sha1-DFLlS8yjkbssSUsh6GJtczbG45c= +is-reference@^1.1.2: + version "1.1.4" + resolved "https://registry.yarnpkg.com/is-reference/-/is-reference-1.1.4.tgz#3f95849886ddb70256a3e6d062b1a68c13c51427" + integrity sha512-uJA/CDPO3Tao3GTrxYn6AwkM4nUPJiGGYu5+cB8qbC7WGFlrKZbiRo7SFKxUAEpFUfiHofWCXBUNhvYJMh+6zw== + dependencies: + "@types/estree" "0.0.39" + is-stream@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" @@ -3360,6 +3457,13 @@ json5@^2.1.2: dependencies: minimist "^1.2.5" +jsonfile@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb" + integrity sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss= + optionalDependencies: + graceful-fs "^4.1.6" + jsprim@^1.2.2: version "1.4.1" resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.4.1.tgz#313e66bc1e5cc06e438bc1b7499c2e5c56acb6a2" @@ -3456,7 +3560,14 @@ loose-envify@^1.0.0: dependencies: js-tokens "^3.0.0 || ^4.0.0" -make-dir@^3.0.0: +magic-string@^0.25.2: + version "0.25.7" + resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.25.7.tgz#3f497d6fd34c669c6798dcb821f2ef31f5445051" + integrity sha512-4CrMT5DOHTDk4HYDlzmwu4FVCcIYI8gauveasrdCu2IKIFOJ3f0v/8MDGJCDL9oD2ppz/Av1b0Nj345H9M+XIA== + dependencies: + sourcemap-codec "^1.4.4" + +make-dir@^3.0.0, make-dir@^3.0.2: version "3.1.0" resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-3.1.0.tgz#415e967046b3a7f1d185277d84aa58203726a13f" integrity sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw== @@ -3875,7 +3986,7 @@ performance-now@^2.1.0: resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" integrity sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns= -picomatch@^2.0.4, picomatch@^2.0.5: +picomatch@^2.0.4, picomatch@^2.0.5, picomatch@^2.2.2: version "2.2.2" resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.2.2.tgz#21f333e9b6b8eaff02468f5146ea406d345f4dad" integrity sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg== @@ -3887,7 +3998,7 @@ pirates@^4.0.1: dependencies: node-modules-regexp "^1.0.0" -pkg-dir@^4.2.0: +pkg-dir@^4.1.0, pkg-dir@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-4.2.0.tgz#f099133df7ede422e81d1d8448270eeb3e4261f3" integrity sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ== @@ -4169,7 +4280,14 @@ resolve-url@^0.2.1: resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" integrity sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo= -resolve@^1.10.0, resolve@^1.17.0, resolve@^1.3.2: +resolve@1.15.1: + version "1.15.1" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.15.1.tgz#27bdcdeffeaf2d6244b95bb0f9f4b4653451f3e8" + integrity sha512-84oo6ZTtoTUpjgNEr5SJyzQhzL72gaRodsSfyxC/AXRvwu0Yse9H8eF9IpGo7b8YetZhlI6v7ZQ6bKBFV/6S7w== + dependencies: + path-parse "^1.0.6" + +resolve@^1.10.0, resolve@^1.11.0, resolve@^1.14.2, resolve@^1.17.0, resolve@^1.3.2: version "1.17.0" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.17.0.tgz#b25941b54968231cc2d1bb76a79cb7f2c0bf8444" integrity sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w== @@ -4203,6 +4321,34 @@ rimraf@3.0.2, rimraf@^3.0.0: dependencies: glob "^7.1.3" +rollup-plugin-terser@6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/rollup-plugin-terser/-/rollup-plugin-terser-6.0.1.tgz#aebdcc83a3b61e307944861ad2e8e2362b89b992" + integrity sha512-XUPB2wwtgQV0A1eq4HXavfkOYL8MqX2ghU3uxvjRQYbUo0QEE3Tjupk7d7hNd1Yfm91xrpQHlbnVI01sf2s3bA== + dependencies: + "@babel/code-frame" "^7.8.3" + jest-worker "^26.0.0" + serialize-javascript "^3.0.0" + terser "^4.7.0" + +rollup-plugin-typescript2@0.27.1: + version "0.27.1" + resolved "https://registry.yarnpkg.com/rollup-plugin-typescript2/-/rollup-plugin-typescript2-0.27.1.tgz#4f27193408a8f040139eed3e3db7b0c7f3668200" + integrity sha512-RJl77Bbj1EunAQDC3dK/O2HWuSUX3oJbRGzyLoS5o9W4Hs1Nix3Gavqj1Lzs5Y6Ff4H2xXfmZ1WWUQCYocSbzQ== + dependencies: + "@rollup/pluginutils" "^3.0.8" + find-cache-dir "^3.3.1" + fs-extra "8.1.0" + resolve "1.15.1" + tslib "1.11.2" + +rollup@2.10.9: + version "2.10.9" + resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.10.9.tgz#17dcc6753c619efcc1be2cf61d73a87827eebdf9" + integrity sha512-dY/EbjiWC17ZCUSyk14hkxATAMAShkMsD43XmZGWjLrgFj15M3Dw2kEkA9ns64BiLFm9PKN6vTQw8neHwK74eg== + optionalDependencies: + fsevents "~2.1.2" + rsvp@^4.8.4: version "4.8.5" resolved "https://registry.yarnpkg.com/rsvp/-/rsvp-4.8.5.tgz#c8f155311d167f68f21e168df71ec5b083113734" @@ -4284,6 +4430,11 @@ semver@^7.2.1, semver@^7.3.2: resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.2.tgz#604962b052b81ed0786aae84389ffba70ffd3938" integrity sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ== +serialize-javascript@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-3.0.0.tgz#492e489a2d77b7b804ad391a5f5d97870952548e" + integrity sha512-skZcHYw2vEX4bw90nAr2iTTsz6x2SrHEnfxgKYmZlvJYBEZrvbKtobJWlQ20zczKb3bsHHXXTYt48zBA7ni9cw== + set-blocking@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" @@ -4393,7 +4544,7 @@ source-map-resolve@^0.5.0: source-map-url "^0.4.0" urix "^0.1.0" -source-map-support@^0.5.6: +source-map-support@^0.5.6, source-map-support@~0.5.12: version "0.5.19" resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.19.tgz#a98b62f86dcaf4f67399648c085291ab9e8fed61" integrity sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw== @@ -4421,6 +4572,11 @@ source-map@^0.7.3: resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.3.tgz#5302f8169031735226544092e64981f751750383" integrity sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ== +sourcemap-codec@^1.4.4: + version "1.4.8" + resolved "https://registry.yarnpkg.com/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz#ea804bd94857402e6992d05a38ef1ae35a9ab4c4" + integrity sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA== + spdx-correct@^3.0.0: version "3.1.1" resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.1.1.tgz#dece81ac9c1e6713e5f7d1b6f17d468fa53d89a9" @@ -4622,6 +4778,15 @@ terminal-link@^2.0.0: ansi-escapes "^4.2.1" supports-hyperlinks "^2.0.0" +terser@^4.7.0: + version "4.7.0" + resolved "https://registry.yarnpkg.com/terser/-/terser-4.7.0.tgz#15852cf1a08e3256a80428e865a2fa893ffba006" + integrity sha512-Lfb0RiZcjRDXCC3OSHJpEkxJ9Qeqs6mp2v4jf2MHfy8vGERmVDuvjXdd/EnP5Deme5F2yBRBymKmKHCBg2echw== + dependencies: + commander "^2.20.0" + source-map "~0.6.1" + source-map-support "~0.5.12" + test-exclude@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-6.0.0.tgz#04a8698661d805ea6fa293b6cb9e63ac044ef15e" @@ -4719,6 +4884,11 @@ tr46@^2.0.2: dependencies: punycode "^2.1.1" +tslib@1.11.2: + version "1.11.2" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.11.2.tgz#9c79d83272c9a7aaf166f73915c9667ecdde3cc9" + integrity sha512-tTSkux6IGPnUGUd1XAZHcpu85MOkIl5zX49pO+jfsie3eP0B6pyhOlLXm3cAC6T7s+euSDDUUV+Acop5WmtkVg== + tslib@^1.8.1, tslib@^1.9.0: version "1.13.0" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.13.0.tgz#c881e13cc7015894ed914862d276436fa9a47043" @@ -4822,6 +4992,11 @@ union-value@^1.0.0: is-extendable "^0.1.1" set-value "^2.0.1" +universalify@^0.1.0: + version "0.1.2" + resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66" + integrity sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg== + unset-value@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/unset-value/-/unset-value-1.0.0.tgz#8376873f7d2335179ffb1e6fc3a8ed0dfc8ab559"