diff --git a/packages/docusaurus-plugin-openapi/package.json b/packages/docusaurus-plugin-openapi/package.json index 7b9a12be..6b6aa0ac 100644 --- a/packages/docusaurus-plugin-openapi/package.json +++ b/packages/docusaurus-plugin-openapi/package.json @@ -23,7 +23,6 @@ "devDependencies": { "@docusaurus/module-type-aliases": "^3.2.0", "@docusaurus/types": "^3.2.0", - "@types/axios": "^0.14.0", "@types/js-yaml": "^4.0.5", "@types/json-schema": "^7.0.9", "@types/lodash": "^4.14.176", @@ -36,7 +35,6 @@ "@docusaurus/utils": "^3.2.0", "@docusaurus/utils-validation": "^3.2.0", "@docusaurus/utils-common": "^3.2.0", - "axios": "^0.26.1", "chalk": "^4.1.2", "clsx": "^1.2.1", "js-yaml": "^4.1.0", diff --git a/packages/docusaurus-plugin-openapi/src/index.ts b/packages/docusaurus-plugin-openapi/src/index.ts index 7c8cb81b..aeefebe4 100644 --- a/packages/docusaurus-plugin-openapi/src/index.ts +++ b/packages/docusaurus-plugin-openapi/src/index.ts @@ -24,7 +24,7 @@ import { Globby, } from "@docusaurus/utils"; import chalk from "chalk"; -import { Configuration } from "webpack"; +import type { Configuration } from "webpack"; import { DocEnv, processDocMetadata } from "./docs/docs"; import { createApiPageMD, createInfoPageMD } from "./markdown"; diff --git a/packages/docusaurus-plugin-openapi/src/openapi/openapi.ts b/packages/docusaurus-plugin-openapi/src/openapi/openapi.ts index a0d2ced4..e5d4c478 100644 --- a/packages/docusaurus-plugin-openapi/src/openapi/openapi.ts +++ b/packages/docusaurus-plugin-openapi/src/openapi/openapi.ts @@ -9,7 +9,6 @@ import { lstat, readFile } from "node:fs/promises"; import { dirname, join } from "node:path"; import { aliasedSitePath, Globby, normalizeUrl } from "@docusaurus/utils"; -import axios from "axios"; import chalk from "chalk"; import yaml from "js-yaml"; import JsonRefs from "json-refs"; @@ -209,8 +208,10 @@ export async function readOpenapiFiles( _options: {} ): Promise { if (isURL(openapiPath)) { - const { data } = await axios.get(openapiPath); - if (!data) { + let data; + try { + data = await (await fetch(openapiPath)).json(); + } catch (err) { throw Error( `Did not find an OpenAPI specification at URL ${openapiPath}` ); diff --git a/yarn.lock b/yarn.lock index 32eea39b..99191cf1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1590,7 +1590,7 @@ "@docusaurus/theme-search-algolia" "3.2.0" "@docusaurus/types" "3.2.0" -"@docusaurus/react-loadable@5.5.2": +"@docusaurus/react-loadable@5.5.2", "react-loadable@npm:@docusaurus/react-loadable@5.5.2": version "5.5.2" resolved "https://registry.yarnpkg.com/@docusaurus/react-loadable/-/react-loadable-5.5.2.tgz#81aae0db81ecafbdaee3651f12804580868fa6ce" integrity sha512-A3dYjdBGuy0IGT+wyLIGIKLRE+sAk1iNk0f1HjNDysO7u8lhL4N3VEm+FAubmJbAztn94F7MxBTPmnixbiyFdQ== @@ -3390,13 +3390,6 @@ resolved "https://registry.yarnpkg.com/@types/aria-query/-/aria-query-5.0.4.tgz#1a31c3d378850d2778dabb6374d036dcba4ba708" integrity sha512-rfT93uj5s0PRL7EzccGMs3brplhcrghnDoV26NqKhCAS1hVo+WdNsPvE/yb6ilfr5hi2MEk6d5EWJTKdxg8jVw== -"@types/axios@^0.14.0": - version "0.14.0" - resolved "https://registry.yarnpkg.com/@types/axios/-/axios-0.14.0.tgz#ec2300fbe7d7dddd7eb9d3abf87999964cafce46" - integrity sha512-KqQnQbdYE54D7oa/UmYVMZKq7CO4l8DEENzOKc4aBRwxCXSlJXGz83flFx5L7AWrOQnmuN3kVsRdt+GZPPjiVQ== - dependencies: - axios "*" - "@types/babel__core@^7.0.0", "@types/babel__core@^7.1.14": version "7.20.5" resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.20.5.tgz#3df15f27ba85319caa07ba08d0721889bb39c017" @@ -4838,22 +4831,6 @@ axe-core@=4.7.0: resolved "https://registry.yarnpkg.com/axe-core/-/axe-core-4.7.0.tgz#34ba5a48a8b564f67e103f0aa5768d76e15bbbbf" integrity sha512-M0JtH+hlOL5pLQwHOLNYZaXuhqmvS8oExsqB1SBYgA4Dk7u/xx+YdGHXaK5pyUfed5mYXdlYiphWq3G8cRi5JQ== -axios@*: - version "1.6.5" - resolved "https://registry.yarnpkg.com/axios/-/axios-1.6.5.tgz#2c090da14aeeab3770ad30c3a1461bc970fb0cd8" - integrity sha512-Ii012v05KEVuUoFWmMW/UQv9aRIc3ZwkWDcM+h5Il8izZCtRVpDUfwpoFf7eOtajT3QiGR4yDUx7lPqHJULgbg== - dependencies: - follow-redirects "^1.15.4" - form-data "^4.0.0" - proxy-from-env "^1.1.0" - -axios@^0.26.1: - version "0.26.1" - resolved "https://registry.yarnpkg.com/axios/-/axios-0.26.1.tgz#1ede41c51fcf51bbbd6fd43669caaa4f0495aaa9" - integrity sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA== - dependencies: - follow-redirects "^1.14.8" - axios@^0.27.2: version "0.27.2" resolved "https://registry.yarnpkg.com/axios/-/axios-0.27.2.tgz#207658cc8621606e586c85db4b41a750e756d972" @@ -7707,7 +7684,7 @@ flatted@^3.2.9: resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.9.tgz#7eb4c67ca1ba34232ca9d2d93e9886e611ad7daf" integrity sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ== -follow-redirects@^1.0.0, follow-redirects@^1.14.8, follow-redirects@^1.14.9, follow-redirects@^1.15.4: +follow-redirects@^1.0.0, follow-redirects@^1.14.9: version "1.15.4" resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.4.tgz#cdc7d308bf6493126b17ea2191ea0ccf3e535adf" integrity sha512-Cr4D/5wlrb0z9dgERpUL3LrmPKVDsETIJhaCMeDfuFYcqa5bldGV6wBsAN6X/vxlXQtFBMrXdXxdL8CbDTGniw== @@ -13042,11 +13019,6 @@ proxy-from-env@1.0.0: resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.0.0.tgz#33c50398f70ea7eb96d21f7b817630a55791c7ee" integrity sha512-F2JHgJQ1iqwnHDcQjVBsq3n/uoaFL+iPW/eAeL7kVxy/2RrWaN4WroKjjvbsoRtv0ftelNyC01bjRhn/bhcf4A== -proxy-from-env@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz#e102f16ca355424865755d2c9e8ea4f24d58c3e2" - integrity sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg== - ps-tree@1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/ps-tree/-/ps-tree-1.2.0.tgz#5e7425b89508736cdd4f2224d028f7bb3f722ebd" @@ -13289,14 +13261,6 @@ react-loadable-ssr-addon-v5-slorber@^1.0.1: dependencies: "@babel/runtime" "^7.10.3" -"react-loadable@npm:@docusaurus/react-loadable@5.5.2": - version "5.5.2" - resolved "https://registry.yarnpkg.com/@docusaurus/react-loadable/-/react-loadable-5.5.2.tgz#81aae0db81ecafbdaee3651f12804580868fa6ce" - integrity sha512-A3dYjdBGuy0IGT+wyLIGIKLRE+sAk1iNk0f1HjNDysO7u8lhL4N3VEm+FAubmJbAztn94F7MxBTPmnixbiyFdQ== - dependencies: - "@types/react" "*" - prop-types "^15.6.2" - react-magic-dropzone@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/react-magic-dropzone/-/react-magic-dropzone-1.0.1.tgz#bfd25b77b57e7a04aaef0a28910563b707ee54df"