diff --git a/.changeset/config.json b/.changeset/config.json index d86fcec82..2396f0ca7 100644 --- a/.changeset/config.json +++ b/.changeset/config.json @@ -6,7 +6,6 @@ "linked": [], "access": "public", "baseBranch": "master", - "ignore": ["@asyncapi/nunjucks-filters"], "updateInternalDependencies": "patch", "privatePackages": { "version": true, diff --git a/.changeset/proud-brooms-accept.md b/.changeset/proud-brooms-accept.md deleted file mode 100644 index 8a8feff94..000000000 --- a/.changeset/proud-brooms-accept.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@asyncapi/generator": patch ---- - -Updated the method for importing the Nunjucks filter dependency \ No newline at end of file diff --git a/.github/workflows/release-docker.yml b/.github/workflows/release-docker.yml index 93f6615eb..82366d8a8 100644 --- a/.github/workflows/release-docker.yml +++ b/.github/workflows/release-docker.yml @@ -47,11 +47,15 @@ jobs: platforms: linux/amd64,linux/arm64 cache-from: type=gha cache-to: type=gha - + + - name: Check out the repository + uses: actions/checkout@v4 + - name: Update Docker Hub Readme uses: meeDamian/sync-readme@v1.0.6 with: user: ${{ secrets.DOCKER_USERNAME }} pass: ${{ secrets.DOCKER_PASSWORD }} slug: asyncapi/generator + readme: ./apps/generator/README.md description: Use your AsyncAPI definition to generate literally anything. Markdown documentation, Node.js code, HTML documentation, anything! diff --git a/.github/workflows/update-docs-in-website.yml b/.github/workflows/update-docs-in-website.yml index 6394cefae..b39628970 100644 --- a/.github/workflows/update-docs-in-website.yml +++ b/.github/workflows/update-docs-in-website.yml @@ -5,7 +5,7 @@ on: branches: - 'master' paths: - - 'docs/*.md' + - 'apps/generator/docs/*.md' jobs: Make-PR: @@ -37,10 +37,10 @@ jobs: run: | rm -r ./markdown/docs/tools/generator mkdir -p ./markdown/docs/tools/generator - rm ../generator/docs/README.md - rm -r ../generator/docs/jsdoc2md-handlebars + rm ../generator/apps/generator/docs/README.md + rm -r ../generator/apps/generator/docs/jsdoc2md-handlebars printf "%s\ntitle: Generator\nweight: 3\n%s" "---" "---"> ../generator/docs/_section.md - mv ../generator/docs/*.md ./markdown/docs/tools/generator + mv ../generator/apps/generator/docs/*.md ./markdown/docs/tools/generator - name: Commit and push working-directory: ./website run: | diff --git a/.gitignore b/.gitignore index ecb69486e..a53c05bd1 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,4 @@ coverage # Turbo .turbo +/.idea diff --git a/apps/generator/.gitignore b/apps/generator/.gitignore index 670435e61..4c5f72e17 100644 --- a/apps/generator/.gitignore +++ b/apps/generator/.gitignore @@ -15,6 +15,7 @@ output out/ coverage test/temp/integrationTestResult +test/temp/reactTemplate test/test-project/package-lock.json test/test-project/verdaccio/storage/ test/test-project/storage/ diff --git a/apps/generator/CHANGELOG.md b/apps/generator/CHANGELOG.md index ea79756ba..2ead8e4ea 100644 --- a/apps/generator/CHANGELOG.md +++ b/apps/generator/CHANGELOG.md @@ -1,5 +1,35 @@ # @asyncapi/generator +## 2.4.1 + +### Patch Changes + +- 3a372c4: Removed the source-map-support package from the AsyncAPI Generator, as it is no longer required for version 2, which now supports Node.js version 18.12.0 and above. + +## 2.4.0 + +### Minor Changes + +- 46114d8: Add `compile` option to enable rerun of transpilation of templates build with react engine. It is set to `true` by default. In future major releases it will be set to `false` and we will explain how to publish template to include transpilation files by default. Transpiled files are already included in [`html-template`](https://github.com/asyncapi/html-template/pull/575). It means that you can run generator for `html-template` (it's latest version) with `compile=false` and this will improve the speed of HTML generation for you. + +## 2.3.0 + +### Minor Changes + +- 44fcc33: ts-node is registered only when it's actually needed + +## 2.2.0 + +### Minor Changes + +- 81dfd0c: Enable `noOverwriteGlobs` option for templates based on react rendering engine. + +## 2.1.3 + +### Patch Changes + +- 93fb8e8: Updated the method for importing the Nunjucks filter dependency + ## 2.1.2 ### Patch Changes diff --git a/apps/generator/README.md b/apps/generator/README.md new file mode 100644 index 000000000..13f9ba7b3 --- /dev/null +++ b/apps/generator/README.md @@ -0,0 +1,28 @@ +Generator is a tool that you can use to generate whatever you want basing on the AsyncAPI specification file as an input. For more information [read the docs](https://www.asyncapi.com/docs/tools/generator). + +There is a large number of templates that are ready to use and are officially supported by the AsyncAPI Initiative. + +## List of official generator templates + + + + +| Template Name | Description | Source code | +| --------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------------------- | +| `@asyncapi/nodejs-template` | Generates Nodejs service that uses Hermes package | [click here](https://github.com/asyncapi/nodejs-template) | +| `@asyncapi/nodejs-ws-template` | Generates Nodejs service that supports WebSockets protocol only | [click here](https://github.com/asyncapi/nodejs-ws-template) | +| `@asyncapi/java-template` | Generates Java JMS application | [click here](https://github.com/asyncapi/java-template) | +| `@asyncapi/java-spring-template` | Generates Java Spring service | [click here](https://github.com/asyncapi/java-spring-template) | +| `@asyncapi/java-spring-cloud-stream-template` | Generates Java Spring Cloud Stream service | [click here](https://github.com/asyncapi/java-spring-cloud-stream-template) | +| `@asyncapi/python-paho-template` | Generates Python service that uses Paho library | [click here](https://github.com/asyncapi/python-paho-template) | +| `@asyncapi/html-template` | Generates HTML documentation site | [click here](https://github.com/asyncapi/html-template) | +| `@asyncapi/markdown-template` | Generates documentation in Markdown file | [click here](https://github.com/asyncapi/markdown-template) | +| `@asyncapi/ts-nats-template` | Generates TypeScript NATS client | [click here](https://github.com/asyncapi/ts-nats-template/) | +| `@asyncapi/go-watermill-template` | Generates Go client using Watermill | [click here](https://github.com/asyncapi/go-watermill-template) | +| `@asyncapi/dotnet-nats-template` | Generates .NET C# client using NATS | [click here](https://github.com/asyncapi/dotnet-nats-template) | +| `@asyncapi/php-template` | Generates PHP client using RabbitMQ | [click here](https://github.com/asyncapi/php-template) | +| `@asyncapi/dotnet-rabbitmq-template` | Generates .NET C# client using RabbitMQ | [click here](https://github.com/asyncapi/dotnet-rabbitmq-template) | + + + +You can find above templates and the ones provided by the community in **[this list](https://github.com/search?q=topic%3Aasyncapi+topic%3Agenerator+topic%3Atemplate)** diff --git a/apps/generator/docs/file-templates.md b/apps/generator/docs/file-templates.md index 5ba4a9687..7a7a8ce77 100644 --- a/apps/generator/docs/file-templates.md +++ b/apps/generator/docs/file-templates.md @@ -3,7 +3,11 @@ title: "File templates" weight: 140 --- -It is possible to generate files for each specific object in your AsyncAPI documentation. For example, you can specify a filename like `$$channel$$.js` to generate a file for each channel defined in your AsyncAPI. The following file-template names and extra variables in them are available: +## Generating files with the Nunjucks render engine + +> **Note**: This section applies only to the Nunjucks render engine. For information on using the React render engine, refer to the [Generating files with the React render engine](#generating-files-with-the-react-render-engine) section below. + +It is possible to generate files for each specific object in your AsyncAPI documentation using the Nunjucks render engine. For example, you can specify a filename like `$$channel$$.js` to generate a file for each channel defined in your AsyncAPI. The following file-template names and extra variables are available: - `$$channel$$`, within the template-file you have access to two variables [`channel`](https://github.com/asyncapi/parser-api/blob/master/docs/api.md#channel) and [`channelName`](https://github.com/asyncapi/parser-api/blob/master/docs/api.md#channels). Where the `channel` contains the current channel being rendered. - `$$message$$`, within the template-file you have access to two variables [`message`](https://github.com/asyncapi/parser-api/blob/master/docs/api.md#message) and [`messageName`](https://github.com/asyncapi/parser-api/blob/master/docs/api.md#message). Where `message` contains the current message being rendered. @@ -25,7 +29,7 @@ Schema name is '{{schemaName}}' and properties are: {% endfor %} ``` -With following AsyncAPI: +With the following AsyncAPI: ``` components: schemas: @@ -53,15 +57,82 @@ Schema name is 'people' and properties are: - id ``` -### React +> You can see an example of a file template that uses the Nunjucks render engine [here](https://github.com/asyncapi/template-for-generator-templates/tree/nunjucks/template/schemas). + +## Generating files with the React render engine -The above way of rendering **file templates** works for both `nunjucks` and `react` render engines, but `react` also has another, more generic way to render multiple files. It is enough to return an array of `File` components in the rendering component. See the following example: +The above method of rendering **file templates** only works for the Nunjucks render engine. To use the React render engine, you need to follow a different approach. The React render engine allows for a more generic way to render multiple files by returning an array of `File` components in the rendering component. This can be particularly useful for complex templates or when you need to generate a large number of files with varying content. + +### Example 1: Rendering hardcoded files + +The following is a simple hardcoded example of how to render multiple files using the React render engine: ```tsx +import { File} from "@asyncapi/generator-react-sdk"; + export default function({ asyncapi }) { return [ Content, Content ] } -``` \ No newline at end of file +``` + +### Example 2: Rendering files based on the AsyncAPI Schema + +In practice, to render the multiple files, that are generated from the data defined in your AsyncAPI, you'll iterate over the array of schemas and generate a file for each schema as shown in the example below: + +```js +import { File} from "@asyncapi/generator-react-sdk"; + +/* + * To render multiple files, it is enough to return an array of `File` components in the rendering component, like in following example. + */ +export default function({ asyncapi }) { + const schemas = asyncapi.allSchemas(); + const files = []; + // schemas is an instance of the Map + schemas.forEach((schema) => { + + files.push( + // We return a react file component and each time we do it, the name of the generated file will be a schema name + // Content of the file will be a variable representing schema + + const { schema.id() } = { JSON.stringify(schema._json, null, 2) } + + ); + }); + return files; +} +``` + +### Example 3: Rendering files for each channel + +Additionally, you can generate multiple files for each channel defined in your AsyncAPI specification using the React render engine as shown in the example below: + +```js +import { File, Text } from "@asyncapi/generator-react-sdk"; + + +export default function ({ asyncapi }) { + const files = []; + + // Generate files for channels + asyncapi.channels().forEach((channel) => { + const channelName = channel.id(); + + files.push( + + # Channel: {channelName} + + {channel.hasDescription() && `${channel.description()}`} + + + ); + }); + return files; +} +``` +The code snippet above uses the `Text` component to write file content to the `.md` markdown file. The `newline` property is used to ensure that the content isn't all rendered in one line in the markdown file. In summary, the code snippet above is a practical guide on generating properly formatted multiline Markdown files for each channel in an AsyncAPI document. + +> You can see an example of a file template that uses the React render engine [here](https://github.com/asyncapi/template-for-generator-templates/blob/master/template/schemas/schema.js). diff --git a/apps/generator/lib/filtersRegistry.js b/apps/generator/lib/filtersRegistry.js index 4c90aed31..6659960ed 100644 --- a/apps/generator/lib/filtersRegistry.js +++ b/apps/generator/lib/filtersRegistry.js @@ -1,7 +1,7 @@ const path = require('path'); const fs = require('fs'); const xfs = require('fs.extra'); -const { isAsyncFunction } = require('./utils'); +const { isAsyncFunction, registerTypeScript } = require('./utils'); const nunjucksFilters = require('@asyncapi/nunjucks-filters'); /** @@ -38,7 +38,12 @@ function registerLocalFilters(nunjucks, templateDir, filtersDir) { walker.on('file', async (root, stats, next) => { try { - const filePath = path.resolve(templateDir, path.resolve(root, stats.name)); + const filePath = path.resolve( + templateDir, + path.resolve(root, stats.name) + ); + + registerTypeScript(filePath); // If it's a module constructor, inject dependencies to ensure consistent usage in remote templates in other projects or plain directories. delete require.cache[require.resolve(filePath)]; const mod = require(filePath); diff --git a/apps/generator/lib/generator.js b/apps/generator/lib/generator.js index 0e66e6f8f..8a07a5670 100644 --- a/apps/generator/lib/generator.js +++ b/apps/generator/lib/generator.js @@ -27,8 +27,6 @@ const { fetchSpec, isReactTemplate, isJsFile, - registerSourceMap, - registerTypeScript, getTemplateDetails, convertCollectionToObject, } = require('./utils'); @@ -48,7 +46,7 @@ const DEFAULT_TEMPLATES_DIR = path.resolve(ROOT_DIR, 'node_modules'); const TRANSPILED_TEMPLATE_LOCATION = '__transpiled'; const TEMPLATE_CONTENT_DIRNAME = 'template'; -const GENERATOR_OPTIONS = ['debug', 'disabledHooks', 'entrypoint', 'forceWrite', 'install', 'noOverwriteGlobs', 'output', 'templateParams', 'mapBaseUrlToFolder', 'url', 'auth', 'token', 'registry']; +const GENERATOR_OPTIONS = ['debug', 'disabledHooks', 'entrypoint', 'forceWrite', 'install', 'noOverwriteGlobs', 'output', 'templateParams', 'mapBaseUrlToFolder', 'url', 'auth', 'token', 'registry', 'compile']; const logMessage = require('./logMessages'); const shouldIgnoreFile = filePath => @@ -58,9 +56,6 @@ const shouldIgnoreDir = dirPath => dirPath === '.git' || dirPath.startsWith(`.git${path.sep}`); -registerSourceMap(); -registerTypeScript(); - class Generator { /** * Instantiates a new Generator object. @@ -88,6 +83,7 @@ class Generator { * @param {Boolean} [options.forceWrite=false] Force writing of the generated files to given directory even if it is a git repo with unstaged files or not empty dir. Default is set to false. * @param {Boolean} [options.install=false] Install the template and its dependencies, even when the template has already been installed. * @param {Boolean} [options.debug=false] Enable more specific errors in the console. At the moment it only shows specific errors about filters. Keep in mind that as a result errors about template are less descriptive. + * @param {Boolean} [options.compile=true] Whether to compile the template or use the cached transpiled version provided by template in '__transpiled' folder * @param {Object} [options.mapBaseUrlToFolder] Optional parameter to map schema references from a base url to a local base folder e.g. url=https://schema.example.com/crm/ folder=./test/docs/ . * @param {Object} [options.registry] Optional parameter with private registry configuration * @param {String} [options.registry.url] Parameter to pass npm registry url @@ -95,13 +91,14 @@ class Generator { * @param {String} [options.registry.token] Optional parameter to pass npm registry auth token that you can grab from .npmrc file */ - constructor(templateName, targetDir, { templateParams = {}, entrypoint, noOverwriteGlobs, disabledHooks, output = 'fs', forceWrite = false, install = false, debug = false, mapBaseUrlToFolder = {}, registry = {}} = {}) { + constructor(templateName, targetDir, { templateParams = {}, entrypoint, noOverwriteGlobs, disabledHooks, output = 'fs', forceWrite = false, install = false, debug = false, mapBaseUrlToFolder = {}, registry = {}, compile = true } = {}) { const options = arguments[arguments.length - 1]; this.verifyoptions(options); if (!templateName) throw new Error('No template name has been specified.'); if (!entrypoint && !targetDir) throw new Error('No target directory has been specified.'); if (!['fs', 'string'].includes(output)) throw new Error(`Invalid output type ${output}. Valid values are 'fs' and 'string'.`); - + /** @type {Boolean} Whether to compile the template or use the cached transpiled version provided by template in '__transpiled' folder. */ + this.compile = compile; /** @type {Object} Npm registry information. */ this.registry = registry; /** @type {String} Name of the template to generate. */ @@ -395,7 +392,7 @@ class Generator { * Configure the templates based the desired renderer. */ async configureTemplate() { - if (isReactTemplate(this.templateConfig)) { + if (isReactTemplate(this.templateConfig) && this.compile) { await configureReact(this.templateDir, this.templateContentDir, TRANSPILED_TEMPLATE_LOCATION); } else { this.nunjucks = configureNunjucks(this.debug, this.templateDir); @@ -852,7 +849,7 @@ class Generator { if (renderContent === undefined) { return; } else if (isReactTemplate(this.templateConfig)) { - await saveRenderedReactContent(renderContent, outputpath); + await saveRenderedReactContent(renderContent, outputpath, this.noOverwriteGlobs); } else { await writeFile(outputpath, renderContent); } diff --git a/apps/generator/lib/hooksRegistry.js b/apps/generator/lib/hooksRegistry.js index bde5c919c..2c21389fb 100644 --- a/apps/generator/lib/hooksRegistry.js +++ b/apps/generator/lib/hooksRegistry.js @@ -1,6 +1,6 @@ const path = require('path'); const xfs = require('fs.extra'); -const { exists } = require('./utils'); +const { exists, registerTypeScript } = require('./utils'); /** * Registers all template hooks. @@ -37,6 +37,9 @@ async function registerLocalHooks(hooks, templateDir, hooksDir) { walker.on('file', async (root, stats, next) => { try { const filePath = path.resolve(templateDir, path.resolve(root, stats.name)); + + registerTypeScript(filePath); + delete require.cache[require.resolve(filePath)]; const mod = require(filePath); diff --git a/apps/generator/lib/logMessages.js b/apps/generator/lib/logMessages.js index 40a0e77ce..0ea167d6b 100644 --- a/apps/generator/lib/logMessages.js +++ b/apps/generator/lib/logMessages.js @@ -6,22 +6,22 @@ const NODE_MODULES_INSTALL ='Remember that your local template must have its own const NPM_INSTALL_TRIGGER = 'Installation of template located on disk technically means symlink creation betweed node_modules of the generator and template sources. Your local template must have its own node_modules, "npm install" is not triggered.'; -function templateVersion(ver) { +function templateVersion(ver) { return `Version of used template is ${ver}.`; -} +} function templateSource(localHtmlTemplate) { return `Template sources taken from ${localHtmlTemplate}.`; -} +} function templateNotFound(templateName) { return `${templateName} not found in local dependencies but found it installed as a global package.`; -} +} function packageNotAvailable(packageDetails) { if (packageDetails && packageDetails.pkgPath) { return `Unable to resolve template location at ${packageDetails.pkgPath}. Package is not available locally.`; - } + } return `Template is not available locally and expected location is undefined. Known details are: ${JSON.stringify(packageDetails, null, 2)}`; } @@ -38,10 +38,18 @@ function relativeSourceFileNotGenerated(relativeSourceFile , subject) { return `${relativeSourceFile} was not generated because ${subject} specified in template configuration in conditionalFiles was not found in provided AsyncAPI specification file.`; } +function skipOverwrite(testFilePath) { + return `Skipping overwrite for: ${testFilePath}`; +} + function conditionalFilesMatched(relativeSourceFile) { return `${relativeSourceFile} was not generated because condition specified for this file in template configuration in conditionalFiles matched.`; } +function compileEnabled(dir, output_dir) { + return `Transpilation of files ${dir} into ${output_dir} started.`; +} + module.exports = { TEMPLATE_INSTALL_FLAG_MSG, TEMPLATE_INSTALL_DISK_MSG, @@ -54,6 +62,7 @@ module.exports = { installationDebugMessage, templateSuccessfullyInstalled, relativeSourceFileNotGenerated, - conditionalFilesMatched - -}; \ No newline at end of file + conditionalFilesMatched, + compileEnabled, + skipOverwrite +}; diff --git a/apps/generator/lib/parser.js b/apps/generator/lib/parser.js index 329d1244a..ac1d327a8 100644 --- a/apps/generator/lib/parser.js +++ b/apps/generator/lib/parser.js @@ -1,6 +1,6 @@ const fs = require('fs'); const { convertToOldAPI } = require('@asyncapi/parser'); -const { ConvertDocumentParserAPIVersion, NewParser } = require('@smoya/multi-parser'); +const { ConvertDocumentParserAPIVersion, NewParser } = require('@asyncapi/multi-parser'); const parser = module.exports; diff --git a/apps/generator/lib/renderer/react.js b/apps/generator/lib/renderer/react.js index ab139254a..5a8171b8b 100644 --- a/apps/generator/lib/renderer/react.js +++ b/apps/generator/lib/renderer/react.js @@ -1,5 +1,8 @@ const path = require('path'); const AsyncReactSDK = require('@asyncapi/generator-react-sdk'); +const minimatch = require('minimatch'); +const logMessage = require('../logMessages.js'); +const log = require('loglevel'); const { writeFile } = require('../utils'); @@ -8,14 +11,16 @@ const reactExport = module.exports; /** * Configures React templating system, this handles all the transpilation work. - * + * * @private * @param {string} templateLocation located for thetemplate * @param {string} templateContentDir where the template content are located * @param {string} transpiledTemplateLocation folder for the transpiled code + * @param {Boolean} compile Whether to compile the template files or used the cached transpiled version provided by the template in the '__transpiled' folder */ reactExport.configureReact = async (templateLocation, templateContentDir, transpiledTemplateLocation) => { const outputDir = path.resolve(templateLocation, `./${transpiledTemplateLocation}`); + log.debug(logMessage.compileEnabled(templateContentDir, outputDir)); await AsyncReactSDK.transpileFiles(templateContentDir, outputDir, { recursive: true }); @@ -23,9 +28,9 @@ reactExport.configureReact = async (templateLocation, templateContentDir, transp /** * Renders the template with react and returns the content and meta data for the file. - * + * * @private - * @param {AsyncAPIDocument} asyncapiDocument + * @param {AsyncAPIDocument} asyncapiDocument * @param {string} filePath path to the template file * @param {Object} extraTemplateData Extra data to pass to the template. * @param {string} templateLocation located for thetemplate @@ -33,34 +38,34 @@ reactExport.configureReact = async (templateLocation, templateContentDir, transp * @param {string} transpiledTemplateLocation folder for the transpiled code * @param {Object} templateParams provided template parameters * @param {boolean} debug flag - * @param {string} originalAsyncAPI + * @param {string} originalAsyncAPI * @return {Promise} */ reactExport.renderReact = async (asyncapiDocument, filePath, extraTemplateData, templateLocation, templateContentDir, transpiledTemplateLocation, templateParams, debug, originalAsyncAPI) => { extraTemplateData = extraTemplateData || {}; filePath = filePath.replace(templateContentDir, path.resolve(templateLocation, transpiledTemplateLocation)); return await AsyncReactSDK.renderTemplate( - filePath, + filePath, { asyncapi: asyncapiDocument, params: templateParams, originalAsyncAPI, ...extraTemplateData - }, + }, debug ); }; /** * Save the single rendered react content based on the meta data available. - * + * * @private * @param {TemplateRenderResult} renderedContent the react content rendered * @param {String} outputPath Path to the file being rendered. */ -const saveContentToFile = async (renderedContent, outputPath) => { +const saveContentToFile = async (renderedContent, outputPath, noOverwriteGlobs = []) => { let filePath = outputPath; - // Might be the same as in the `fs` package, but is an active choice for our default file permission for any rendered files. + // Might be the same as in the `fs` package, but is an active choice for our default file permission for any rendered files. let permissions = 0o666; const content = renderedContent.content; @@ -78,21 +83,32 @@ const saveContentToFile = async (renderedContent, outputPath) => { } } - await writeFile(filePath, content, { - mode: permissions - }); + // get the final file name of the file + const finalFileName = path.basename(filePath); + // check whether the filename should be ignored based on user's inputs + const shouldOverwrite = !noOverwriteGlobs.some(globExp => minimatch(finalFileName, globExp)); + + // Write the file only if it should not be skipped + if (shouldOverwrite) { + await writeFile(filePath, content, { + mode: permissions + }); + } else { + await log.debug(logMessage.skipOverwrite(filePath)); + } }; /** * Save the rendered react content based on the meta data available. - * + * * @private * @param {TemplateRenderResult[] | TemplateRenderResult} renderedContent the react content rendered * @param {String} outputPath Path to the file being rendered. + * @param noOverwriteGlobs Array of globs to skip overwriting files. */ -reactExport.saveRenderedReactContent = async (renderedContent, outputPath) => { +reactExport.saveRenderedReactContent = async (renderedContent, outputPath, noOverwriteGlobs = []) => { if (Array.isArray(renderedContent)) { - return Promise.all(renderedContent.map(content => saveContentToFile(content, outputPath))); + return Promise.all(renderedContent.map(content => saveContentToFile(content, outputPath, noOverwriteGlobs))); } - return saveContentToFile(renderedContent, outputPath); + return await saveContentToFile(renderedContent, outputPath, noOverwriteGlobs); }; diff --git a/apps/generator/lib/utils.js b/apps/generator/lib/utils.js index f7026b166..6403eb2fd 100644 --- a/apps/generator/lib/utils.js +++ b/apps/generator/lib/utils.js @@ -134,22 +134,18 @@ utils.isAsyncFunction = (fn) => { return fn && fn.constructor && fn.constructor.name === 'AsyncFunction'; }; -/** - * Register `source-map-support` package. - * This package provides source map support for stack traces in Node - also for transpiled code from TS. - * - * @private - */ -utils.registerSourceMap = () => { - require('source-map-support').install(); -}; - /** * Register TypeScript transpiler. It enables transpilation of TS filters and hooks on the fly. * * @private */ -utils.registerTypeScript = () => { +utils.registerTypeScript = (filePath) => { + const isTypescriptFile = filePath.endsWith('.ts'); + + if (!isTypescriptFile) { + return; + } + const { REGISTER_INSTANCE, register } = require('ts-node'); // if the ts-node has already been registered before, do not register it again. // Check the env. TS_NODE_ENV if ts-node started via ts-node-dev package diff --git a/apps/generator/package.json b/apps/generator/package.json index 19aacaa8b..3dbc021b1 100644 --- a/apps/generator/package.json +++ b/apps/generator/package.json @@ -1,6 +1,6 @@ { "name": "@asyncapi/generator", - "version": "2.1.2", + "version": "2.4.1", "description": "The AsyncAPI generator. It can generate documentation, code, anything!", "main": "./lib/generator.js", "bin": { @@ -15,8 +15,8 @@ "test": "npm run test:unit && npm run test:integration && npm run test:cli", "test:unit": "jest --coverage --testPathIgnorePatterns=integration --testPathIgnorePatterns=test-project", "test:dev": "npm run test:unit -- --watchAll", - "test:integration": "npm run test:cleanup && jest --testPathPattern=integration --modulePathIgnorePatterns='./__mocks__'", - "test:integration:update": "jest --updateSnapshot --testPathPattern=integration --modulePathIgnorePatterns='./__mocks__'", + "test:integration": "npm run test:cleanup && jest --testPathPattern=integration --modulePathIgnorePatterns='./__mocks__(?!\\/loglevel\\.js$)'", + "test:integration:update": "jest --updateSnapshot --testPathPattern=integration --modulePathIgnorePatterns='./__mocks__(?!\\/loglevel\\.js$)'", "test:cli": "node cli.js ./test/docs/dummy.yml ./test/test-templates/react-template -o test/output --force-write --debug && test -e test/output/test-file.md", "test:cleanup": "rimraf \"test/temp\"", "docs": "jsdoc2md --partial docs/jsdoc2md-handlebars/custom-sig-name.hbs docs/jsdoc2md-handlebars/main.hbs docs/jsdoc2md-handlebars/docs.hbs docs/jsdoc2md-handlebars/header.hbs docs/jsdoc2md-handlebars/defaultvalue.hbs docs/jsdoc2md-handlebars/link.hbs docs/jsdoc2md-handlebars/params-table.hbs --files lib/generator.js > docs/api.md", @@ -49,11 +49,12 @@ "license": "Apache-2.0", "homepage": "https://github.com/asyncapi/generator", "dependencies": { + "@asyncapi/generator-react-sdk": "^1.1.1", + "@asyncapi/multi-parser": "^2.1.1", + "@asyncapi/nunjucks-filters": "*", + "@asyncapi/parser": "^3.0.14", "@npmcli/arborist": "5.6.3", "@npmcli/config": "^8.0.2", - "@asyncapi/generator-react-sdk": "^1.0.18", - "@asyncapi/parser": "^3.0.14", - "@smoya/multi-parser": "^5.0.0", "ajv": "^8.12.0", "chokidar": "^3.4.0", "commander": "^6.1.0", @@ -72,20 +73,19 @@ "resolve-pkg": "^2.0.0", "semver": "^7.3.2", "simple-git": "^3.3.0", - "source-map-support": "^0.5.19", "ts-node": "^10.9.1", - "typescript": "^4.9.3", - "@asyncapi/nunjucks-filters": "*" + "typescript": "^4.9.3" }, "devDependencies": { "eslint": "^6.8.0", "eslint-plugin-jest": "^23.8.2", - "eslint-plugin-sonarjs": "^0.5.0", "eslint-plugin-react": "^7.34.1", + "eslint-plugin-sonarjs": "^0.5.0", "jest": "^27.3.1", "jsdoc-to-markdown": "^7.1.1", "markdown-toc": "^1.2.0", "rimraf": "^3.0.2", - "unixify": "^1.0.0" + "unixify": "^1.0.0", + "fs-extra": "9.1.0" } } diff --git a/apps/generator/test/generator.test.js b/apps/generator/test/generator.test.js index 0cf90129d..22c67aaaf 100644 --- a/apps/generator/test/generator.test.js +++ b/apps/generator/test/generator.test.js @@ -26,6 +26,7 @@ describe('Generator', () => { expect(gen.forceWrite).toStrictEqual(false); expect(gen.install).toStrictEqual(false); expect(gen.templateParams).toStrictEqual({}); + expect(gen.compile).toStrictEqual(true); }); it('works with all the params', () => { @@ -39,6 +40,7 @@ describe('Generator', () => { templateParams: { test: true, }, + compile: false, }); expect(gen.templateName).toStrictEqual('testTemplate'); expect(gen.targetDir).toStrictEqual(__dirname); @@ -48,6 +50,7 @@ describe('Generator', () => { expect(gen.output).toStrictEqual('string'); expect(gen.forceWrite).toStrictEqual(true); expect(gen.install).toStrictEqual(true); + expect(gen.compile).toStrictEqual(false); expect(() => gen.templateParams.test).toThrow('Template parameter "test" has not been defined in the package.json file under generator property. Please make sure it\'s listed there before you use it in your template.'); // Mock params on templateConfig so it doesn't fail. diff --git a/apps/generator/test/integration.test.js b/apps/generator/test/integration.test.js index 81c9f4a67..c77c03924 100644 --- a/apps/generator/test/integration.test.js +++ b/apps/generator/test/integration.test.js @@ -2,8 +2,9 @@ * @jest-environment node */ -const { readFile } = require('fs').promises; const path = require('path'); +const { readFile, writeFile, access, mkdir } = require('fs').promises; +const { copy } = require('fs-extra'); const Generator = require('../lib/generator'); const dummySpecPath = path.resolve(__dirname, './docs/dummy.yml'); const refSpecPath = path.resolve(__dirname, './docs/apiwithref.json'); @@ -12,6 +13,8 @@ const crypto = require('crypto'); const mainTestResultPath = 'test/temp/integrationTestResult'; const reactTemplate = 'test/test-templates/react-template'; const nunjucksTemplate = 'test/test-templates/nunjucks-template'; +//temp location where react template is copied for each test that does some mutation on template files +const copyOfReactTemplate = 'test/temp/reactTemplate'; describe('Integration testing generateFromFile() to make sure the result of the generation is not changend comparing to snapshot', () => { const generateFolderName = () => { @@ -19,12 +22,31 @@ describe('Integration testing generateFromFile() to make sure the result of the return path.resolve(mainTestResultPath, crypto.randomBytes(4).toString('hex')); }; - jest.setTimeout(60000); + const getCleanReactTemplate = async () => { + //for each test new react template is needed in unique location + const newReactTemplateLocation = path.resolve(copyOfReactTemplate, crypto.randomBytes(4).toString('hex')); + await copy(reactTemplate, newReactTemplateLocation); + return newReactTemplateLocation; + }; + + jest.setTimeout(100000); const testOutputFile = 'test-file.md'; + const tempJsContent = ` + import { File, Text } from '@asyncapi/generator-react-sdk'; + + export default function() { + return ( + + Test + + ); + } + `; + it('generated using Nunjucks template', async () => { const outputDir = generateFolderName(); - const generator = new Generator(nunjucksTemplate, outputDir, { + const generator = new Generator(nunjucksTemplate, outputDir, { forceWrite: true, templateParams: { version: 'v1', mode: 'production' } }); @@ -35,7 +57,7 @@ describe('Integration testing generateFromFile() to make sure the result of the it('generate using React template', async () => { const outputDir = generateFolderName(); - const generator = new Generator(reactTemplate, outputDir, { + const generator = new Generator(reactTemplate, outputDir, { forceWrite: true , templateParams: { version: 'v1', mode: 'production' } }); @@ -55,4 +77,77 @@ describe('Integration testing generateFromFile() to make sure the result of the const file = await readFile(path.join(outputDir, testOutputFile), 'utf8'); expect(file).toMatchSnapshot(); }); + + it('check if the temp.md file is created with compile option true', async () => { + const outputDir = generateFolderName(); + const cleanReactTemplate = await getCleanReactTemplate(); + // Create temp.md.js file dynamically + + const tempJsPath = path.join(cleanReactTemplate, 'template/temp.md.js'); + // Create temp.md.js file dynamically + await writeFile(tempJsPath, tempJsContent); + + const generator = new Generator(cleanReactTemplate, outputDir, { + forceWrite: true, + compile: true, + debug: true, + }); + await generator.generateFromFile(dummySpecPath); + + const tempMdPath = path.join(outputDir, 'temp.md'); + + // Check the content of temp.md + const tempMdContent = await readFile(tempMdPath, 'utf8'); + expect(tempMdContent.trim()).toBe('Test'); + }); + + it('check if the temp.md file is not created when compile option is false', async () => { + const outputDir = generateFolderName(); + const cleanReactTemplate = await getCleanReactTemplate(); + // Create temp.md.js file dynamically + const tempJsPath = path.join(cleanReactTemplate, 'template/temp.md.js'); + await writeFile(tempJsPath, tempJsContent); + + const generator = new Generator(cleanReactTemplate, outputDir, { + forceWrite: true, + compile: false, + debug: true + }); + await generator.generateFromFile(dummySpecPath); + + // Check if temp.md is not created in the output directory + const tempMdPath = path.join(outputDir, 'temp.md'); + const tempMdExists = await access(tempMdPath).then(() => true).catch(() => false); + expect(tempMdExists).toBe(false); + }); + + it('should ignore specified files with noOverwriteGlobs', async () => { + const outputDir = generateFolderName(); + const cleanReactTemplate = await getCleanReactTemplate(); + // Manually create a file to test if it's not overwritten + await mkdir(outputDir, { recursive: true }); + // Create a variable to store the file content + const testContent = ''; + // eslint-disable-next-line sonarjs/no-duplicate-string + const testFilePath = path.normalize(path.resolve(outputDir, testOutputFile)); + await writeFile(testFilePath, testContent); + + // Manually create an output first, before generation, with additional custom file to validate if later it is still there, not overwritten + const generator = new Generator(cleanReactTemplate, outputDir, { + forceWrite: true, + noOverwriteGlobs: [`**/${testOutputFile}`], + debug: true, + }); + + await generator.generateFromFile(dummySpecPath); + + // Read the file to confirm it was not overwritten + const fileContent = await readFile(testFilePath, 'utf8'); + // Check if the files have been overwritten + expect(fileContent).toBe(testContent); + // Check if the log debug message was printed + /*TODO: + Include log message test in the future to ensure that the log.debug for skipping overwrite is called + */ + }); }); diff --git a/apps/generator/test/test-project/test-project.test.js b/apps/generator/test/test-project/test-project.test.js index e740df46a..ded760bd7 100644 --- a/apps/generator/test/test-project/test-project.test.js +++ b/apps/generator/test/test-project/test-project.test.js @@ -41,7 +41,7 @@ describe('Testing if markdown was generated with proper version of the template' it('Test B - generated markdown should contain new content because of explicit fresh installation of different template version (install: true)', async () => { const templateVersion = '0.0.2'; - const generator = new Generator(`${templateName}@${templateVersion}`, tempOutputResults, { forceWrite: true, install: true, debug: true, templateParams: { version: 'v1', mode: 'production' } }); + const generator = new Generator(`${templateName}@${templateVersion}`, tempOutputResults, { compile: true, forceWrite: true, install: true, debug: true, templateParams: { version: 'v1', mode: 'production' } }); await generator.generateFromFile(dummySpecPath); const file = await readFile(path.join(tempOutputResults, fileToCheck), 'utf8'); @@ -95,4 +95,4 @@ describe('Testing if markdown was generated with proper version of the template' expect(console.log).toHaveBeenCalledWith(logMessage.templateVersion(version)); expect(console.log).toHaveBeenCalledWith(logMessage.NPM_INSTALL_TRIGGER); }); -}); \ No newline at end of file +}); diff --git a/apps/generator/test/test-project/test-registry.test.js b/apps/generator/test/test-project/test-registry.test.js index 6ef8d4b5e..d4ab648a3 100644 --- a/apps/generator/test/test-project/test-registry.test.js +++ b/apps/generator/test/test-project/test-registry.test.js @@ -16,6 +16,7 @@ describe('Integration testing generateFromFile() to make sure the template can b it('generated using private registory', async () => { const generator = new Generator('react-template', tempOutputResults, { + compile: true, debug: true, install: true, forceWrite: true, @@ -41,6 +42,7 @@ describe('Integration testing generateFromFile() to make sure the template can b it('generated using private registory from npm config', async () => { const generator = new Generator('react-template', tempOutputResults, { + compile: true, debug: true, install: true, forceWrite: true, diff --git a/apps/generator/test/test-templates/nunjucks-template/package-lock.json b/apps/generator/test/test-templates/nunjucks-template/package-lock.json index 056bdc9c7..d1f6ed151 100644 --- a/apps/generator/test/test-templates/nunjucks-template/package-lock.json +++ b/apps/generator/test/test-templates/nunjucks-template/package-lock.json @@ -8,7 +8,7 @@ "name": "nunjucks-template", "version": "0.0.1", "dependencies": { - "@asyncapi/generator-react-sdk": "^1.0.19" + "@asyncapi/generator-react-sdk": "^1.1.1" } }, "node_modules/@ampproject/remapping": { @@ -25,11 +25,11 @@ } }, "node_modules/@asyncapi/generator-react-sdk": { - "version": "1.0.19", - "resolved": "https://registry.npmjs.org/@asyncapi/generator-react-sdk/-/generator-react-sdk-1.0.19.tgz", - "integrity": "sha512-J+uj7pptc8IUg4RLNWwoTB0AizYGKSbTjcN87BU3Ck8TwGxIuSRuk7Dz/SX0I/6bX0PWgZN8snsahBQ3j4HXYA==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@asyncapi/generator-react-sdk/-/generator-react-sdk-1.1.1.tgz", + "integrity": "sha512-R86Xa20wLtzI4fVf9HECR+UCSYvNE1B4WZs3eI5jAvGtONBTFOvkixd4SUL+uLP4DP96pU2DuKhih/PQbmMneQ==", "dependencies": { - "@asyncapi/parser": "^3.0.15", + "@asyncapi/parser": "^3.1.0", "@babel/core": "7.12.9", "@babel/preset-env": "^7.12.7", "@babel/preset-react": "^7.12.7", @@ -93,23 +93,23 @@ } }, "node_modules/@asyncapi/parser": { - "version": "3.0.15", - "resolved": "https://registry.npmjs.org/@asyncapi/parser/-/parser-3.0.15.tgz", - "integrity": "sha512-tP4O6c9jM8pKimg8kw3+/SdPAKJQWPmYozO6ZFJB5ziVtsr3Z8Qe06V13QcBOg4LzIWAwontyG5lZ5jnyvuDPQ==", + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/@asyncapi/parser/-/parser-3.2.2.tgz", + "integrity": "sha512-ved4ja3ANs6BcRhWLbK/A7JIhJyMQBYdV1GZwo6Ptf+qBkGIdvV3dt8M4T6TZqtIbUI2NOvmO2YUqtaPWTudgA==", "dependencies": { "@asyncapi/specs": "^6.6.0", "@openapi-contrib/openapi-schema-to-json-schema": "~3.2.0", - "@stoplight/json": "^3.20.2", + "@stoplight/json": "3.21.0", "@stoplight/json-ref-readers": "^1.2.2", "@stoplight/json-ref-resolver": "^3.1.5", - "@stoplight/spectral-core": "^1.16.1", + "@stoplight/spectral-core": "^1.18.3", "@stoplight/spectral-functions": "^1.7.2", "@stoplight/spectral-parsers": "^1.0.2", "@stoplight/spectral-ref-resolver": "^1.0.3", "@stoplight/types": "^13.12.0", "@types/json-schema": "^7.0.11", "@types/urijs": "^1.19.19", - "ajv": "^8.11.0", + "ajv": "^8.17.1", "ajv-errors": "^3.0.0", "ajv-formats": "^2.1.1", "avsc": "^5.7.5", @@ -2055,9 +2055,9 @@ "integrity": "sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==" }, "node_modules/@stoplight/spectral-functions": { - "version": "1.7.2", - "resolved": "https://registry.npmjs.org/@stoplight/spectral-functions/-/spectral-functions-1.7.2.tgz", - "integrity": "sha512-f+61/FtIkQeIo+a269CeaeqjpyRsgDyIk6DGr7iS4hyuk1PPk7Uf6MNRDs9FEIBh7CpdEJ+HSHbMLwgpymWTIw==", + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@stoplight/spectral-functions/-/spectral-functions-1.8.0.tgz", + "integrity": "sha512-ZrAkYA/ZGbuQ6EyG1gisF4yQ5nWP/+glcqVoGmS6kH6ekaynz2Yp6FL0oIamWj3rWedFUN7ppwTRUdo+9f/uCw==", "dependencies": { "@stoplight/better-ajv-errors": "1.0.3", "@stoplight/json": "^3.17.1", @@ -2232,11 +2232,11 @@ "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==" }, "node_modules/@types/node": { - "version": "20.14.2", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.14.2.tgz", - "integrity": "sha512-xyu6WAMVwv6AKFLB+e/7ySZVr/0zLCzOa7rSpq6jNwpqOrUbcACDWC+53d4n2QHOnDou0fbIsg8wZu/sxrnI4Q==", + "version": "22.2.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.2.0.tgz", + "integrity": "sha512-bm6EG6/pCpkxDf/0gDNDdtDILMOHgaQBVOJGdwsqClnxA3xL6jtMv76rLBc006RVMWbmaf0xbmom4Z/5o2nRkQ==", "dependencies": { - "undici-types": "~5.26.4" + "undici-types": "~6.13.0" } }, "node_modules/@types/urijs": { @@ -2256,14 +2256,14 @@ } }, "node_modules/ajv": { - "version": "8.16.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.16.0.tgz", - "integrity": "sha512-F0twR8U1ZU67JIEtekUcLkXkoO5mMMmgGD8sK/xUFzJ805jxHQl92hImFAqqXMyMYjSPOyUPAwHYhB72g5sTXw==", + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", + "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", "dependencies": { "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2", - "uri-js": "^4.4.1" + "require-from-string": "^2.0.2" }, "funding": { "type": "github", @@ -2864,6 +2864,11 @@ "resolved": "https://registry.npmjs.org/fast-memoize/-/fast-memoize-2.5.2.tgz", "integrity": "sha512-Ue0LwpDYErFbmNnZSF0UH6eImUwDmogUO1jyE+JbN2gsQz/jICm1Ve7t9QT0rNSsfJt+Hs4/S3GnsDVjL4HVrw==" }, + "node_modules/fast-uri": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.0.1.tgz", + "integrity": "sha512-MWipKbbYiYI0UC7cl8m/i/IWTqfC8YXsqjzybjddLsFjStroQzsHXkc73JutMvBiXmOvapk+axIl79ig5t55Bw==" + }, "node_modules/for-each": { "version": "0.3.3", "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", @@ -3310,9 +3315,9 @@ } }, "node_modules/jsep": { - "version": "1.3.8", - "resolved": "https://registry.npmjs.org/jsep/-/jsep-1.3.8.tgz", - "integrity": "sha512-qofGylTGgYj9gZFsHuyWAN4jr35eJ66qJCK4eKDnldohuUoQFbU3iZn2zjvEbd9wOAhP9Wx5DsAAduTyE1PSWQ==", + "version": "1.3.9", + "resolved": "https://registry.npmjs.org/jsep/-/jsep-1.3.9.tgz", + "integrity": "sha512-i1rBX5N7VPl0eYb6+mHNp52sEuaS2Wi8CDYx1X5sn9naevL78+265XJqy1qENEk7mRKwS06NHpUqiBwR7qeodw==", "engines": { "node": ">= 10.16.0" } @@ -3483,9 +3488,12 @@ } }, "node_modules/object-inspect": { - "version": "1.13.1", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz", - "integrity": "sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==", + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.2.tgz", + "integrity": "sha512-IRZSRuzJiynemAXPYtPe5BoI/RESNYR7TYm50MC5Mqbd3Jmw5y790sErYw3V6SryFJD64b74qQQs9wn5Bg/k3g==", + "engines": { + "node": ">= 0.4" + }, "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -3562,14 +3570,6 @@ "react-is": "^16.13.1" } }, - "node_modules/punycode": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", - "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", - "engines": { - "node": ">=6" - } - }, "node_modules/react": { "version": "17.0.2", "resolved": "https://registry.npmjs.org/react/-/react-17.0.2.tgz", @@ -3997,9 +3997,9 @@ } }, "node_modules/undici-types": { - "version": "5.26.5", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", - "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==" + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.13.0.tgz", + "integrity": "sha512-xtFJHudx8S2DSoujjMd1WeWvn7KKWFRESZTMeL1RptAYERu29D6jphMjjY+vn96jvN3kVPDNxU/E13VTaXj6jg==" }, "node_modules/unicode-canonical-property-names-ecmascript": { "version": "2.0.0", @@ -4066,14 +4066,6 @@ "browserslist": ">= 4.21.0" } }, - "node_modules/uri-js": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", - "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", - "dependencies": { - "punycode": "^2.1.0" - } - }, "node_modules/urijs": { "version": "1.19.11", "resolved": "https://registry.npmjs.org/urijs/-/urijs-1.19.11.tgz", diff --git a/apps/generator/test/test-templates/nunjucks-template/package.json b/apps/generator/test/test-templates/nunjucks-template/package.json index 278ae11b2..e6c43bf61 100644 --- a/apps/generator/test/test-templates/nunjucks-template/package.json +++ b/apps/generator/test/test-templates/nunjucks-template/package.json @@ -16,6 +16,6 @@ } }, "dependencies": { - "@asyncapi/generator-react-sdk": "^1.0.19" + "@asyncapi/generator-react-sdk": "^1.1.1" } } diff --git a/apps/generator/test/test-templates/react-template/package-lock.json b/apps/generator/test/test-templates/react-template/package-lock.json index c4e9c7921..c42587539 100644 --- a/apps/generator/test/test-templates/react-template/package-lock.json +++ b/apps/generator/test/test-templates/react-template/package-lock.json @@ -8,7 +8,7 @@ "name": "react-template", "version": "0.0.1", "dependencies": { - "@asyncapi/generator-react-sdk": "^1.0.19" + "@asyncapi/generator-react-sdk": "^1.1.1" } }, "node_modules/@ampproject/remapping": { @@ -25,11 +25,11 @@ } }, "node_modules/@asyncapi/generator-react-sdk": { - "version": "1.0.19", - "resolved": "https://registry.npmjs.org/@asyncapi/generator-react-sdk/-/generator-react-sdk-1.0.19.tgz", - "integrity": "sha512-J+uj7pptc8IUg4RLNWwoTB0AizYGKSbTjcN87BU3Ck8TwGxIuSRuk7Dz/SX0I/6bX0PWgZN8snsahBQ3j4HXYA==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@asyncapi/generator-react-sdk/-/generator-react-sdk-1.1.1.tgz", + "integrity": "sha512-R86Xa20wLtzI4fVf9HECR+UCSYvNE1B4WZs3eI5jAvGtONBTFOvkixd4SUL+uLP4DP96pU2DuKhih/PQbmMneQ==", "dependencies": { - "@asyncapi/parser": "^3.0.15", + "@asyncapi/parser": "^3.1.0", "@babel/core": "7.12.9", "@babel/preset-env": "^7.12.7", "@babel/preset-react": "^7.12.7", @@ -93,23 +93,23 @@ } }, "node_modules/@asyncapi/parser": { - "version": "3.0.15", - "resolved": "https://registry.npmjs.org/@asyncapi/parser/-/parser-3.0.15.tgz", - "integrity": "sha512-tP4O6c9jM8pKimg8kw3+/SdPAKJQWPmYozO6ZFJB5ziVtsr3Z8Qe06V13QcBOg4LzIWAwontyG5lZ5jnyvuDPQ==", + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/@asyncapi/parser/-/parser-3.2.2.tgz", + "integrity": "sha512-ved4ja3ANs6BcRhWLbK/A7JIhJyMQBYdV1GZwo6Ptf+qBkGIdvV3dt8M4T6TZqtIbUI2NOvmO2YUqtaPWTudgA==", "dependencies": { "@asyncapi/specs": "^6.6.0", "@openapi-contrib/openapi-schema-to-json-schema": "~3.2.0", - "@stoplight/json": "^3.20.2", + "@stoplight/json": "3.21.0", "@stoplight/json-ref-readers": "^1.2.2", "@stoplight/json-ref-resolver": "^3.1.5", - "@stoplight/spectral-core": "^1.16.1", + "@stoplight/spectral-core": "^1.18.3", "@stoplight/spectral-functions": "^1.7.2", "@stoplight/spectral-parsers": "^1.0.2", "@stoplight/spectral-ref-resolver": "^1.0.3", "@stoplight/types": "^13.12.0", "@types/json-schema": "^7.0.11", "@types/urijs": "^1.19.19", - "ajv": "^8.11.0", + "ajv": "^8.17.1", "ajv-errors": "^3.0.0", "ajv-formats": "^2.1.1", "avsc": "^5.7.5", @@ -2055,9 +2055,9 @@ "integrity": "sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==" }, "node_modules/@stoplight/spectral-functions": { - "version": "1.7.2", - "resolved": "https://registry.npmjs.org/@stoplight/spectral-functions/-/spectral-functions-1.7.2.tgz", - "integrity": "sha512-f+61/FtIkQeIo+a269CeaeqjpyRsgDyIk6DGr7iS4hyuk1PPk7Uf6MNRDs9FEIBh7CpdEJ+HSHbMLwgpymWTIw==", + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@stoplight/spectral-functions/-/spectral-functions-1.8.0.tgz", + "integrity": "sha512-ZrAkYA/ZGbuQ6EyG1gisF4yQ5nWP/+glcqVoGmS6kH6ekaynz2Yp6FL0oIamWj3rWedFUN7ppwTRUdo+9f/uCw==", "dependencies": { "@stoplight/better-ajv-errors": "1.0.3", "@stoplight/json": "^3.17.1", @@ -2232,11 +2232,11 @@ "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==" }, "node_modules/@types/node": { - "version": "20.14.2", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.14.2.tgz", - "integrity": "sha512-xyu6WAMVwv6AKFLB+e/7ySZVr/0zLCzOa7rSpq6jNwpqOrUbcACDWC+53d4n2QHOnDou0fbIsg8wZu/sxrnI4Q==", + "version": "22.2.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.2.0.tgz", + "integrity": "sha512-bm6EG6/pCpkxDf/0gDNDdtDILMOHgaQBVOJGdwsqClnxA3xL6jtMv76rLBc006RVMWbmaf0xbmom4Z/5o2nRkQ==", "dependencies": { - "undici-types": "~5.26.4" + "undici-types": "~6.13.0" } }, "node_modules/@types/urijs": { @@ -2256,14 +2256,14 @@ } }, "node_modules/ajv": { - "version": "8.16.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.16.0.tgz", - "integrity": "sha512-F0twR8U1ZU67JIEtekUcLkXkoO5mMMmgGD8sK/xUFzJ805jxHQl92hImFAqqXMyMYjSPOyUPAwHYhB72g5sTXw==", + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", + "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", "dependencies": { "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2", - "uri-js": "^4.4.1" + "require-from-string": "^2.0.2" }, "funding": { "type": "github", @@ -2864,6 +2864,11 @@ "resolved": "https://registry.npmjs.org/fast-memoize/-/fast-memoize-2.5.2.tgz", "integrity": "sha512-Ue0LwpDYErFbmNnZSF0UH6eImUwDmogUO1jyE+JbN2gsQz/jICm1Ve7t9QT0rNSsfJt+Hs4/S3GnsDVjL4HVrw==" }, + "node_modules/fast-uri": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.0.1.tgz", + "integrity": "sha512-MWipKbbYiYI0UC7cl8m/i/IWTqfC8YXsqjzybjddLsFjStroQzsHXkc73JutMvBiXmOvapk+axIl79ig5t55Bw==" + }, "node_modules/for-each": { "version": "0.3.3", "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", @@ -3310,9 +3315,9 @@ } }, "node_modules/jsep": { - "version": "1.3.8", - "resolved": "https://registry.npmjs.org/jsep/-/jsep-1.3.8.tgz", - "integrity": "sha512-qofGylTGgYj9gZFsHuyWAN4jr35eJ66qJCK4eKDnldohuUoQFbU3iZn2zjvEbd9wOAhP9Wx5DsAAduTyE1PSWQ==", + "version": "1.3.9", + "resolved": "https://registry.npmjs.org/jsep/-/jsep-1.3.9.tgz", + "integrity": "sha512-i1rBX5N7VPl0eYb6+mHNp52sEuaS2Wi8CDYx1X5sn9naevL78+265XJqy1qENEk7mRKwS06NHpUqiBwR7qeodw==", "engines": { "node": ">= 10.16.0" } @@ -3483,9 +3488,12 @@ } }, "node_modules/object-inspect": { - "version": "1.13.1", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz", - "integrity": "sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==", + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.2.tgz", + "integrity": "sha512-IRZSRuzJiynemAXPYtPe5BoI/RESNYR7TYm50MC5Mqbd3Jmw5y790sErYw3V6SryFJD64b74qQQs9wn5Bg/k3g==", + "engines": { + "node": ">= 0.4" + }, "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -3562,14 +3570,6 @@ "react-is": "^16.13.1" } }, - "node_modules/punycode": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", - "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", - "engines": { - "node": ">=6" - } - }, "node_modules/react": { "version": "17.0.2", "resolved": "https://registry.npmjs.org/react/-/react-17.0.2.tgz", @@ -3997,9 +3997,9 @@ } }, "node_modules/undici-types": { - "version": "5.26.5", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", - "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==" + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.13.0.tgz", + "integrity": "sha512-xtFJHudx8S2DSoujjMd1WeWvn7KKWFRESZTMeL1RptAYERu29D6jphMjjY+vn96jvN3kVPDNxU/E13VTaXj6jg==" }, "node_modules/unicode-canonical-property-names-ecmascript": { "version": "2.0.0", @@ -4066,14 +4066,6 @@ "browserslist": ">= 4.21.0" } }, - "node_modules/uri-js": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", - "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", - "dependencies": { - "punycode": "^2.1.0" - } - }, "node_modules/urijs": { "version": "1.19.11", "resolved": "https://registry.npmjs.org/urijs/-/urijs-1.19.11.tgz", diff --git a/apps/generator/test/test-templates/react-template/package.json b/apps/generator/test/test-templates/react-template/package.json index e4d843360..610fcf223 100644 --- a/apps/generator/test/test-templates/react-template/package.json +++ b/apps/generator/test/test-templates/react-template/package.json @@ -18,6 +18,6 @@ } }, "dependencies": { - "@asyncapi/generator-react-sdk": "^1.0.19" + "@asyncapi/generator-react-sdk": "^1.1.1" } } diff --git a/package-lock.json b/package-lock.json index 5f3b1b082..45663cb5b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,15 +20,15 @@ }, "apps/generator": { "name": "@asyncapi/generator", - "version": "2.1.2", + "version": "2.3.0", "license": "Apache-2.0", "dependencies": { - "@asyncapi/generator-react-sdk": "^1.0.18", + "@asyncapi/generator-react-sdk": "^1.1.1", + "@asyncapi/multi-parser": "^2.1.1", "@asyncapi/nunjucks-filters": "*", "@asyncapi/parser": "^3.0.14", "@npmcli/arborist": "5.6.3", "@npmcli/config": "^8.0.2", - "@smoya/multi-parser": "^5.0.0", "ajv": "^8.12.0", "chokidar": "^3.4.0", "commander": "^6.1.0", @@ -47,7 +47,6 @@ "resolve-pkg": "^2.0.0", "semver": "^7.3.2", "simple-git": "^3.3.0", - "source-map-support": "^0.5.19", "ts-node": "^10.9.1", "typescript": "^4.9.3" }, @@ -60,6 +59,7 @@ "eslint-plugin-jest": "^23.8.2", "eslint-plugin-react": "^7.34.1", "eslint-plugin-sonarjs": "^0.5.0", + "fs-extra": "9.1.0", "jest": "^27.3.1", "jsdoc-to-markdown": "^7.1.1", "markdown-toc": "^1.2.0", @@ -71,6 +71,42 @@ "npm": ">=8.19.0" } }, + "apps/generator/node_modules/fs-extra": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", + "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", + "dev": true, + "dependencies": { + "at-least-node": "^1.0.0", + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "apps/generator/node_modules/jsonfile": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "dev": true, + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "apps/generator/node_modules/universalify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", + "dev": true, + "engines": { + "node": ">= 10.0.0" + } + }, "apps/nunjucks-filters": { "name": "@asyncapi/nunjucks-filters", "version": "2.1.0", @@ -159,7 +195,8 @@ }, "node_modules/@asyncapi/avro-schema-parser": { "version": "3.0.24", - "license": "Apache-2.0", + "resolved": "https://registry.npmjs.org/@asyncapi/avro-schema-parser/-/avro-schema-parser-3.0.24.tgz", + "integrity": "sha512-YMyr2S2heMrWHRyECknjHeejlZl5exUSv9nD1gTejAT13fSf0PqIRydZ9ZuoglCLBg55AeehypR2zLIBu/9kHQ==", "dependencies": { "@asyncapi/parser": "^3.1.0", "@types/json-schema": "^7.0.11", @@ -171,8 +208,9 @@ "link": true }, "node_modules/@asyncapi/generator-react-sdk": { - "version": "1.0.20", - "license": "Apache-2.0", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@asyncapi/generator-react-sdk/-/generator-react-sdk-1.1.1.tgz", + "integrity": "sha512-R86Xa20wLtzI4fVf9HECR+UCSYvNE1B4WZs3eI5jAvGtONBTFOvkixd4SUL+uLP4DP96pU2DuKhih/PQbmMneQ==", "dependencies": { "@asyncapi/parser": "^3.1.0", "@babel/core": "7.12.9", @@ -233,13 +271,28 @@ "node": ">=0.10.0" } }, + "node_modules/@asyncapi/multi-parser": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@asyncapi/multi-parser/-/multi-parser-2.1.1.tgz", + "integrity": "sha512-nGf9ete+KHKQ/VdaLQ/AoqIAm6/L5oehyx5Cam/hUpybPNRyBkOCqiikDreoc2PiduaAcYkLbZdQceoKpEbSdg==", + "dependencies": { + "@asyncapi/avro-schema-parser": "^3.0.3", + "@asyncapi/openapi-schema-parser": "^3.0.4", + "@asyncapi/parser": "*", + "@asyncapi/protobuf-schema-parser": "^3.0.0", + "@asyncapi/raml-dt-schema-parser": "^4.0.4", + "parserapiv1": "npm:@asyncapi/parser@^2.1.0", + "parserapiv2": "npm:@asyncapi/parser@3.0.0-next-major-spec.8" + } + }, "node_modules/@asyncapi/nunjucks-filters": { "resolved": "apps/nunjucks-filters", "link": true }, "node_modules/@asyncapi/openapi-schema-parser": { "version": "3.0.24", - "license": "Apache-2.0", + "resolved": "https://registry.npmjs.org/@asyncapi/openapi-schema-parser/-/openapi-schema-parser-3.0.24.tgz", + "integrity": "sha512-7wz2yVDedJMS+TzOuqCvRWJMc6pNHICKZcOhnW6ZvyVLAh7hYIqQE1WA4OoXT4cKVbwSU3V2Q4bZagSsAIQd6Q==", "dependencies": { "@asyncapi/parser": "^3.1.0", "@openapi-contrib/openapi-schema-to-json-schema": "~3.2.0", @@ -330,7 +383,8 @@ }, "node_modules/@asyncapi/protobuf-schema-parser": { "version": "3.2.14", - "license": "Apache-2.0", + "resolved": "https://registry.npmjs.org/@asyncapi/protobuf-schema-parser/-/protobuf-schema-parser-3.2.14.tgz", + "integrity": "sha512-7v64Jxhz2IBfaQECUhfwuLRMFQTysvmqtvT+Esgd9NooIPRnkEzgCbBnC25oGjzSB6Sju28G406lQpO15HHaEw==", "dependencies": { "@asyncapi/parser": "^3.1.0", "@types/protocol-buffers-schema": "^3.4.1", @@ -339,7 +393,8 @@ }, "node_modules/@asyncapi/raml-dt-schema-parser": { "version": "4.0.24", - "license": "Apache-2.0", + "resolved": "https://registry.npmjs.org/@asyncapi/raml-dt-schema-parser/-/raml-dt-schema-parser-4.0.24.tgz", + "integrity": "sha512-Fy9IwCXPpXoG4Mkm7sXgWucSwYg8POwdx16xuHAmV6AerpcM8nk5mT/tARLtR3wrMst3OBwReEVYzwT3esSb8g==", "dependencies": { "@asyncapi/parser": "^3.1.0", "js-yaml": "^4.1.0", @@ -349,11 +404,13 @@ }, "node_modules/@asyncapi/raml-dt-schema-parser/node_modules/argparse": { "version": "2.0.1", - "license": "Python-2.0" + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" }, "node_modules/@asyncapi/raml-dt-schema-parser/node_modules/js-yaml": { "version": "4.1.0", - "license": "MIT", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", "dependencies": { "argparse": "^2.0.1" }, @@ -3238,23 +3295,28 @@ }, "node_modules/@protobufjs/aspromise": { "version": "1.1.2", - "license": "BSD-3-Clause" + "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", + "integrity": "sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ==" }, "node_modules/@protobufjs/base64": { "version": "1.1.2", - "license": "BSD-3-Clause" + "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz", + "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==" }, "node_modules/@protobufjs/codegen": { "version": "2.0.4", - "license": "BSD-3-Clause" + "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz", + "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==" }, "node_modules/@protobufjs/eventemitter": { "version": "1.1.0", - "license": "BSD-3-Clause" + "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz", + "integrity": "sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q==" }, "node_modules/@protobufjs/fetch": { "version": "1.1.0", - "license": "BSD-3-Clause", + "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz", + "integrity": "sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ==", "dependencies": { "@protobufjs/aspromise": "^1.1.1", "@protobufjs/inquire": "^1.1.0" @@ -3262,23 +3324,28 @@ }, "node_modules/@protobufjs/float": { "version": "1.0.2", - "license": "BSD-3-Clause" + "resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz", + "integrity": "sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ==" }, "node_modules/@protobufjs/inquire": { "version": "1.1.0", - "license": "BSD-3-Clause" + "resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz", + "integrity": "sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q==" }, "node_modules/@protobufjs/path": { "version": "1.1.2", - "license": "BSD-3-Clause" + "resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz", + "integrity": "sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA==" }, "node_modules/@protobufjs/pool": { "version": "1.1.0", - "license": "BSD-3-Clause" + "resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz", + "integrity": "sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw==" }, "node_modules/@protobufjs/utf8": { "version": "1.1.0", - "license": "BSD-3-Clause" + "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz", + "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==" }, "node_modules/@rollup/plugin-babel": { "version": "5.3.1", @@ -3332,19 +3399,6 @@ "@sinonjs/commons": "^1.7.0" } }, - "node_modules/@smoya/multi-parser": { - "version": "5.0.9", - "license": "Apache-2.0", - "dependencies": { - "@asyncapi/avro-schema-parser": "^3.0.3", - "@asyncapi/openapi-schema-parser": "^3.0.4", - "@asyncapi/protobuf-schema-parser": "^3.0.0", - "@asyncapi/raml-dt-schema-parser": "^4.0.4", - "parserapiv1": "npm:@asyncapi/parser@^2.1.0", - "parserapiv2": "npm:@asyncapi/parser@3.0.0-next-major-spec.8", - "parserapiv3": "npm:@asyncapi/parser@^3.1.0" - } - }, "node_modules/@stoplight/better-ajv-errors": { "version": "1.0.3", "license": "Apache-2.0", @@ -3773,7 +3827,8 @@ }, "node_modules/@types/protocol-buffers-schema": { "version": "3.4.3", - "license": "MIT", + "resolved": "https://registry.npmjs.org/@types/protocol-buffers-schema/-/protocol-buffers-schema-3.4.3.tgz", + "integrity": "sha512-8cCg6BiIj4jS0LXUFq3sndmd46yyPLYqMzvXLcTM1MRubh3sfZlQiehoCjGDxSHTqGSjjx8EtVNryIAl0njQWg==", "dependencies": { "@types/node": "*" } @@ -4363,6 +4418,15 @@ "dev": true, "license": "MIT" }, + "node_modules/at-least-node": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", + "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==", + "dev": true, + "engines": { + "node": ">= 4.0.0" + } + }, "node_modules/autolinker": { "version": "0.28.1", "dev": true, @@ -10118,14 +10182,16 @@ }, "node_modules/json-schema-migrate": { "version": "0.2.0", - "license": "MIT", + "resolved": "https://registry.npmjs.org/json-schema-migrate/-/json-schema-migrate-0.2.0.tgz", + "integrity": "sha512-dq4/oHWmtw/+0ytnXsDqVn+VsVweTEmzm5jLgguPn9BjSzn6/q58ZiZx3BHiQyJs612f0T5Z+MrUEUUY5DHsRg==", "dependencies": { "ajv": "^5.0.0" } }, "node_modules/json-schema-migrate/node_modules/ajv": { "version": "5.5.2", - "license": "MIT", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", + "integrity": "sha512-Ajr4IcMXq/2QmMkEmSvxqfLN5zGmJ92gHXAeOXq1OekoH2rfDNsgdDoL2f7QaRCy7G/E6TpxBVdRuNraMztGHw==", "dependencies": { "co": "^4.6.0", "fast-deep-equal": "^1.0.0", @@ -10135,11 +10201,13 @@ }, "node_modules/json-schema-migrate/node_modules/fast-deep-equal": { "version": "1.1.0", - "license": "MIT" + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", + "integrity": "sha512-fueX787WZKCV0Is4/T2cyAdM4+x1S3MXXOAhavE1ys/W42SHAPacLTQhucja22QBYrfGw50M2sRiXPtTGv9Ymw==" }, "node_modules/json-schema-migrate/node_modules/json-schema-traverse": { "version": "0.3.1", - "license": "MIT" + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", + "integrity": "sha512-4JD/Ivzg7PoW8NzdrBSr3UFwC9mHgvI7Z6z3QGBsSHgKaRTUDmyZAAKJo2UbG1kUVfS9WS8bi36N49U1xw43DA==" }, "node_modules/json-schema-traverse": { "version": "0.4.1", @@ -10412,7 +10480,8 @@ }, "node_modules/long": { "version": "5.2.3", - "license": "Apache-2.0" + "resolved": "https://registry.npmjs.org/long/-/long-5.2.3.tgz", + "integrity": "sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==" }, "node_modules/loose-envify": { "version": "1.4.0", @@ -11588,7 +11657,8 @@ "node_modules/parserapiv1": { "name": "@asyncapi/parser", "version": "2.1.2", - "license": "Apache-2.0", + "resolved": "https://registry.npmjs.org/@asyncapi/parser/-/parser-2.1.2.tgz", + "integrity": "sha512-2pHKnr2P8EujcrvZo4x4zNwsEIAg5vb1ZEhl2+OH0YBg8EYH/Xx73XZ+bbwLaYIg1gvFjm29jNB9UL3CMeDU5w==", "dependencies": { "@asyncapi/specs": "^5.1.0", "@openapi-contrib/openapi-schema-to-json-schema": "~3.2.0", @@ -11613,18 +11683,21 @@ }, "node_modules/parserapiv1/node_modules/@asyncapi/specs": { "version": "5.1.0", - "license": "Apache-2.0", + "resolved": "https://registry.npmjs.org/@asyncapi/specs/-/specs-5.1.0.tgz", + "integrity": "sha512-yffhETqehkim43luMnPKOwzY0D0YtU4bKpORIXIaid6p5Y5kDLrMGJaEPkNieQp03HMjhjFrnUPtT8kvqe0+aQ==", "dependencies": { "@types/json-schema": "^7.0.11" } }, "node_modules/parserapiv1/node_modules/argparse": { "version": "2.0.1", - "license": "Python-2.0" + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" }, "node_modules/parserapiv1/node_modules/js-yaml": { "version": "4.1.0", - "license": "MIT", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", "dependencies": { "argparse": "^2.0.1" }, @@ -11634,7 +11707,8 @@ }, "node_modules/parserapiv1/node_modules/node-fetch": { "version": "2.6.7", - "license": "MIT", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", + "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", "dependencies": { "whatwg-url": "^5.0.0" }, @@ -11652,15 +11726,18 @@ }, "node_modules/parserapiv1/node_modules/tr46": { "version": "0.0.3", - "license": "MIT" + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" }, "node_modules/parserapiv1/node_modules/webidl-conversions": { "version": "3.0.1", - "license": "BSD-2-Clause" + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" }, "node_modules/parserapiv1/node_modules/whatwg-url": { "version": "5.0.0", - "license": "MIT", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", "dependencies": { "tr46": "~0.0.3", "webidl-conversions": "^3.0.0" @@ -11669,7 +11746,8 @@ "node_modules/parserapiv2": { "name": "@asyncapi/parser", "version": "3.0.0-next-major-spec.8", - "license": "Apache-2.0", + "resolved": "https://registry.npmjs.org/@asyncapi/parser/-/parser-3.0.0-next-major-spec.8.tgz", + "integrity": "sha512-d8ebYM08BCsx3Q4AeLke6naU/NrcAXFEVpS6b3EWcKRdUDce+v0X5k9aDH+YXWCaQApEF28UzcxhlSOJvhIFgQ==", "dependencies": { "@asyncapi/specs": "^6.0.0-next-major-spec.9", "@openapi-contrib/openapi-schema-to-json-schema": "~3.2.0", @@ -11692,18 +11770,21 @@ }, "node_modules/parserapiv2/node_modules/@asyncapi/specs": { "version": "6.7.1", - "license": "Apache-2.0", + "resolved": "https://registry.npmjs.org/@asyncapi/specs/-/specs-6.7.1.tgz", + "integrity": "sha512-jEaW2vgAwD9GboCdO/TI1zN2k+iowL8YFYwiZwTIr4U4KDmsgo3BLypScl6Jl4+IvY9RdsWE67nuzVX7jooiqQ==", "dependencies": { "@types/json-schema": "^7.0.11" } }, "node_modules/parserapiv2/node_modules/argparse": { "version": "2.0.1", - "license": "Python-2.0" + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" }, "node_modules/parserapiv2/node_modules/js-yaml": { "version": "4.1.0", - "license": "MIT", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", "dependencies": { "argparse": "^2.0.1" }, @@ -11713,7 +11794,8 @@ }, "node_modules/parserapiv2/node_modules/node-fetch": { "version": "2.6.7", - "license": "MIT", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", + "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", "dependencies": { "whatwg-url": "^5.0.0" }, @@ -11731,96 +11813,18 @@ }, "node_modules/parserapiv2/node_modules/tr46": { "version": "0.0.3", - "license": "MIT" + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" }, "node_modules/parserapiv2/node_modules/webidl-conversions": { "version": "3.0.1", - "license": "BSD-2-Clause" + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" }, "node_modules/parserapiv2/node_modules/whatwg-url": { "version": "5.0.0", - "license": "MIT", - "dependencies": { - "tr46": "~0.0.3", - "webidl-conversions": "^3.0.0" - } - }, - "node_modules/parserapiv3": { - "name": "@asyncapi/parser", - "version": "3.1.0", - "license": "Apache-2.0", - "dependencies": { - "@asyncapi/specs": "^6.7.1", - "@openapi-contrib/openapi-schema-to-json-schema": "~3.2.0", - "@stoplight/json": "^3.20.2", - "@stoplight/json-ref-readers": "^1.2.2", - "@stoplight/json-ref-resolver": "^3.1.5", - "@stoplight/spectral-core": "^1.16.1", - "@stoplight/spectral-functions": "^1.7.2", - "@stoplight/spectral-parsers": "^1.0.2", - "@stoplight/spectral-ref-resolver": "^1.0.3", - "@stoplight/types": "^13.12.0", - "@types/json-schema": "^7.0.11", - "@types/urijs": "^1.19.19", - "ajv": "^8.11.0", - "ajv-errors": "^3.0.0", - "ajv-formats": "^2.1.1", - "avsc": "^5.7.5", - "js-yaml": "^4.1.0", - "jsonpath-plus": "^7.2.0", - "node-fetch": "2.6.7" - } - }, - "node_modules/parserapiv3/node_modules/@asyncapi/specs": { - "version": "6.7.1", - "license": "Apache-2.0", - "dependencies": { - "@types/json-schema": "^7.0.11" - } - }, - "node_modules/parserapiv3/node_modules/argparse": { - "version": "2.0.1", - "license": "Python-2.0" - }, - "node_modules/parserapiv3/node_modules/js-yaml": { - "version": "4.1.0", - "license": "MIT", - "dependencies": { - "argparse": "^2.0.1" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" - } - }, - "node_modules/parserapiv3/node_modules/node-fetch": { - "version": "2.6.7", - "license": "MIT", - "dependencies": { - "whatwg-url": "^5.0.0" - }, - "engines": { - "node": "4.x || >=6.0.0" - }, - "peerDependencies": { - "encoding": "^0.1.0" - }, - "peerDependenciesMeta": { - "encoding": { - "optional": true - } - } - }, - "node_modules/parserapiv3/node_modules/tr46": { - "version": "0.0.3", - "license": "MIT" - }, - "node_modules/parserapiv3/node_modules/webidl-conversions": { - "version": "3.0.1", - "license": "BSD-2-Clause" - }, - "node_modules/parserapiv3/node_modules/whatwg-url": { - "version": "5.0.0", - "license": "MIT", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", "dependencies": { "tr46": "~0.0.3", "webidl-conversions": "^3.0.0" @@ -12159,8 +12163,9 @@ }, "node_modules/protobufjs": { "version": "7.3.2", + "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.3.2.tgz", + "integrity": "sha512-RXyHaACeqXeqAKGLDl68rQKbmObRsTIn4TYVUUug1KfS47YWCo5MacGITEryugIgZqORCvJWEk4l449POg5Txg==", "hasInstallScript": true, - "license": "BSD-3-Clause", "dependencies": { "@protobufjs/aspromise": "^1.1.2", "@protobufjs/base64": "^1.1.2", @@ -12225,7 +12230,8 @@ }, "node_modules/ramldt2jsonschema": { "version": "1.2.3", - "license": "Apache-2.0", + "resolved": "https://registry.npmjs.org/ramldt2jsonschema/-/ramldt2jsonschema-1.2.3.tgz", + "integrity": "sha512-+wLDAV2NNv9NkfEUOYStaDu/6RYgYXeC1zLtXE+dMU/jDfjpN4iJnBGycDwFTFaIQGosOQhxph7fEX6Mpwxdug==", "dependencies": { "commander": "^5.0.0", "js-yaml": "^3.14.0", @@ -12239,7 +12245,8 @@ }, "node_modules/ramldt2jsonschema/node_modules/commander": { "version": "5.1.0", - "license": "MIT", + "resolved": "https://registry.npmjs.org/commander/-/commander-5.1.0.tgz", + "integrity": "sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg==", "engines": { "node": ">= 6" } @@ -14381,14 +14388,16 @@ }, "node_modules/webapi-parser": { "version": "0.5.0", - "license": "Apache-2.0", + "resolved": "https://registry.npmjs.org/webapi-parser/-/webapi-parser-0.5.0.tgz", + "integrity": "sha512-fPt6XuMqLSvBz8exwX4QE1UT+pROLHa00EMDCdO0ybICduwQ1V4f7AWX4pNOpCp+x+0FjczEsOxtQU0d8L3QKw==", "dependencies": { "ajv": "6.5.2" } }, "node_modules/webapi-parser/node_modules/ajv": { "version": "6.5.2", - "license": "MIT", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.5.2.tgz", + "integrity": "sha512-hOs7GfvI6tUI1LfZddH82ky6mOMyTuY0mk7kE2pWpmhhUSkumzaTO5vbVwij39MdwPQWCV4Zv57Eo06NtL/GVA==", "dependencies": { "fast-deep-equal": "^2.0.1", "fast-json-stable-stringify": "^2.0.0", @@ -14398,7 +14407,8 @@ }, "node_modules/webapi-parser/node_modules/fast-deep-equal": { "version": "2.0.1", - "license": "MIT" + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", + "integrity": "sha512-bCK/2Z4zLidyB4ReuIsvALH6w31YfAQDmXMqMx6FyfHqvBxtjC0eRumeSu4Bs3XtXwpyIywtSTrVT99BxY1f9w==" }, "node_modules/webidl-conversions": { "version": "6.1.0",