diff --git a/packages/apidom-parser-adapter-openapi-json-3-1/config/api-extractor/api-extractor.json b/packages/apidom-parser-adapter-openapi-json-3-1/config/api-extractor/api-extractor.json new file mode 100644 index 0000000000..40bee5b261 --- /dev/null +++ b/packages/apidom-parser-adapter-openapi-json-3-1/config/api-extractor/api-extractor.json @@ -0,0 +1,5 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + "extends": "../../../../api-extractor.json", + "mainEntryPointFilePath": "../../types/adapter.d.ts" +} diff --git a/packages/apidom-parser-adapter-openapi-json-3-1/config/rollup/types.dist.js b/packages/apidom-parser-adapter-openapi-json-3-1/config/rollup/types.dist.js deleted file mode 100644 index 6ecc45f65c..0000000000 --- a/packages/apidom-parser-adapter-openapi-json-3-1/config/rollup/types.dist.js +++ /dev/null @@ -1,11 +0,0 @@ -import dts from 'rollup-plugin-dts'; - -const config = [ - { - input: './types/adapter.d.ts', - output: [{ file: 'types/dist.d.ts', format: 'es' }], - plugins: [dts()], - }, -]; - -export default config; diff --git a/packages/apidom-parser-adapter-openapi-json-3-1/package.json b/packages/apidom-parser-adapter-openapi-json-3-1/package.json index f66920dc07..82664b3fd0 100644 --- a/packages/apidom-parser-adapter-openapi-json-3-1/package.json +++ b/packages/apidom-parser-adapter-openapi-json-3-1/package.json @@ -11,11 +11,11 @@ "unpkg": "./dist/apidom-parser-apdater-openapi-json-3-1.browser.min.js", "main": "./src/adapter.cjs", "exports": { - "types": "./types/dist.d.ts", + "types": "./types/apidom-parser-adapter-openapi-json-3-1.d.ts", "import": "./src/adapter.mjs", "require": "./src/adapter.cjs" }, - "types": "./types/dist.d.ts", + "types": "./types/apidom-parser-adapter-openapi-json-3-1.d.ts", "scripts": { "build": "npm run clean && run-p --max-parallel ${CPU_CORES:-2} typescript:declaration build:es build:cjs build:umd:browser", "build:es": "cross-env BABEL_ENV=es babel src --out-dir src --extensions '.ts' --out-file-extension '.mjs' --root-mode 'upward'", @@ -25,7 +25,7 @@ "lint:fix": "eslint ./ --fix", "clean": "rimraf --glob 'src/**/*.mjs' 'src/**/*.cjs' 'test/**/*.mjs' ./dist ./types", "typescript:check-types": "tsc --noEmit && tsc -p ./test/tsconfig.json --noEmit", - "typescript:declaration": "tsc -p tsconfig.declaration.json && rollup -c config/rollup/types.dist.js", + "typescript:declaration": "tsc -p tsconfig.declaration.json && api-extractor run -l -c ./config/api-extractor/api-extractor.json", "test": "npm run build:es && cross-env BABEL_ENV=es babel test --out-dir test --extensions '.ts' --out-file-extension '.mjs' --root-mode 'upward' && cross-env NODE_ENV=test mocha", "perf": "cross-env BABEL_ENV=es babel ./test/perf/index.ts --out-file ./test/perf/index.mjs --root-mode 'upward' && cross-env NODE_ENV=test node ./test/perf/index.mjs", "perf:lexical-analysis": "cross-env BABEL_ENV=es babel ./test/perf/lexical-analysis.ts --out-file ./test/perf/lexical-analysis.mjs --root-mode 'upward' && cross-env NODE_ENV=test node ./test/perf/lexical-analysis.mjs", @@ -54,7 +54,7 @@ "src/**/*.mjs", "src/**/*.cjs", "dist/", - "types/dist.d.ts", + "types/apidom-parser-adapter-openapi-json-3-1.d.ts", "LICENSES", "NOTICE", "README.md", diff --git a/packages/apidom-parser-adapter-openapi-json-3-1/src/adapter.ts b/packages/apidom-parser-adapter-openapi-json-3-1/src/adapter.ts index 9569cb4b0f..a6f017898f 100644 --- a/packages/apidom-parser-adapter-openapi-json-3-1/src/adapter.ts +++ b/packages/apidom-parser-adapter-openapi-json-3-1/src/adapter.ts @@ -6,11 +6,20 @@ import openApiNamespace, { OpenApi3_1Element } from '@swagger-api/apidom-ns-open export { default as mediaTypes } from './media-types.ts'; +/** + * @public + */ export const detectionRegExp = /"openapi"\s*:\s*"(?3\.1\.(?:[1-9]\d*|0))"/; +/** + * @public + */ export const detect = async (source: string): Promise => detectionRegExp.test(source) && (await detectJSON(source)); +/** + * @public + */ export const parse = async ( source: string, options: Record = {}, @@ -29,4 +38,7 @@ export const parse = async ( return parseResultElement; }; +/** + * @public + */ export const namespace = createNamespace(openApiNamespace); diff --git a/packages/apidom-parser-adapter-openapi-json-3-1/src/media-types.ts b/packages/apidom-parser-adapter-openapi-json-3-1/src/media-types.ts index 72b0081b11..7bf4bfe3ce 100644 --- a/packages/apidom-parser-adapter-openapi-json-3-1/src/media-types.ts +++ b/packages/apidom-parser-adapter-openapi-json-3-1/src/media-types.ts @@ -1,5 +1,8 @@ import { mediaTypes, OpenAPIMediaTypes } from '@swagger-api/apidom-ns-openapi-3-1'; +/** + * @public + */ const jsonMediaTypes = new OpenAPIMediaTypes( ...mediaTypes.filterByFormat('generic'), ...mediaTypes.filterByFormat('json'),