From 74cd5caccb34655dbb40d7f7c53cd881ebd829fb Mon Sep 17 00:00:00 2001 From: Viacheslav Turovskyi Date: Mon, 11 Mar 2024 08:32:45 +0000 Subject: [PATCH] feat: add `x-origin` property --- src/index.ts | 2 +- src/util.ts | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/index.ts b/src/index.ts index f357e84..8b67b21 100644 --- a/src/index.ts +++ b/src/index.ts @@ -98,7 +98,7 @@ export default async function bundle(files: string[], options: any = {}) { resolvedJsons = await resolve(parsedJsons, options); } - return new Document(resolvedJsons as AsyncAPIObject[], options.base); + return new Document(resolvedJsons, options.base); } // 'module.exports' is added to maintain backward compatibility with Node.js diff --git a/src/util.ts b/src/util.ts index 637932c..016928f 100644 --- a/src/util.ts +++ b/src/util.ts @@ -1,7 +1,6 @@ import fs from 'fs'; -import $RefParser from '@apidevtools/json-schema-ref-parser'; import axios from 'axios'; -import { cloneDeep, merge } from 'lodash'; +import { merge } from 'lodash'; import yaml from 'js-yaml'; import { parse } from './parser'; import { ParserError } from './errors'; @@ -145,8 +144,8 @@ export function resolveBaseFileDir(file: object, baseFileDir: string) { ); } -// Moved 'addXOrigins' to the beginning of the scope to avoid an ESLint's error -// `'addXOrigins' was used before it was defined` +/* eslint-disable */ + export function addXOrigins(asyncapiDocument: AsyncAPIObject) { // VALUE from 'asyncapiDocument' becomes KEY for the // underlying and recursive functions @@ -192,3 +191,5 @@ export function addXOrigins(asyncapiDocument: AsyncAPIObject) { }); return asyncapiDocument; } + +/* eslint-enable */