Skip to content

Commit f95a94f

Browse files
authored
remove axios dependency (#288)
1 parent 0d2e0ec commit f95a94f

File tree

4 files changed

+8
-44
lines changed

4 files changed

+8
-44
lines changed

packages/docusaurus-plugin-openapi/package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
"devDependencies": {
2424
"@docusaurus/module-type-aliases": "^3.2.0",
2525
"@docusaurus/types": "^3.2.0",
26-
"@types/axios": "^0.14.0",
2726
"@types/js-yaml": "^4.0.5",
2827
"@types/json-schema": "^7.0.9",
2928
"@types/lodash": "^4.14.176",
@@ -36,7 +35,6 @@
3635
"@docusaurus/utils": "^3.2.0",
3736
"@docusaurus/utils-validation": "^3.2.0",
3837
"@docusaurus/utils-common": "^3.2.0",
39-
"axios": "^0.26.1",
4038
"chalk": "^4.1.2",
4139
"clsx": "^1.2.1",
4240
"js-yaml": "^4.1.0",

packages/docusaurus-plugin-openapi/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import {
2424
Globby,
2525
} from "@docusaurus/utils";
2626
import chalk from "chalk";
27-
import { Configuration } from "webpack";
27+
import type { Configuration } from "webpack";
2828

2929
import { DocEnv, processDocMetadata } from "./docs/docs";
3030
import { createApiPageMD, createInfoPageMD } from "./markdown";

packages/docusaurus-plugin-openapi/src/openapi/openapi.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import { lstat, readFile } from "node:fs/promises";
99
import { dirname, join } from "node:path";
1010

1111
import { aliasedSitePath, Globby, normalizeUrl } from "@docusaurus/utils";
12-
import axios from "axios";
1312
import chalk from "chalk";
1413
import yaml from "js-yaml";
1514
import JsonRefs from "json-refs";
@@ -209,8 +208,11 @@ export async function readOpenapiFiles(
209208
_options: {}
210209
): Promise<OpenApiFiles[]> {
211210
if (isURL(openapiPath)) {
212-
const { data } = await axios.get(openapiPath);
213-
if (!data) {
211+
let data;
212+
try {
213+
const response = await fetch(openapiPath);
214+
data = await response.json();
215+
} catch (err) {
214216
throw Error(
215217
`Did not find an OpenAPI specification at URL ${openapiPath}`
216218
);

yarn.lock

Lines changed: 2 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1590,7 +1590,7 @@
15901590
"@docusaurus/theme-search-algolia" "3.2.0"
15911591
"@docusaurus/types" "3.2.0"
15921592

1593-
"@docusaurus/[email protected]":
1593+
"@docusaurus/[email protected]", "react-loadable@npm:@docusaurus/[email protected]":
15941594
version "5.5.2"
15951595
resolved "https://registry.yarnpkg.com/@docusaurus/react-loadable/-/react-loadable-5.5.2.tgz#81aae0db81ecafbdaee3651f12804580868fa6ce"
15961596
integrity sha512-A3dYjdBGuy0IGT+wyLIGIKLRE+sAk1iNk0f1HjNDysO7u8lhL4N3VEm+FAubmJbAztn94F7MxBTPmnixbiyFdQ==
@@ -3390,13 +3390,6 @@
33903390
resolved "https://registry.yarnpkg.com/@types/aria-query/-/aria-query-5.0.4.tgz#1a31c3d378850d2778dabb6374d036dcba4ba708"
33913391
integrity sha512-rfT93uj5s0PRL7EzccGMs3brplhcrghnDoV26NqKhCAS1hVo+WdNsPvE/yb6ilfr5hi2MEk6d5EWJTKdxg8jVw==
33923392

3393-
"@types/axios@^0.14.0":
3394-
version "0.14.0"
3395-
resolved "https://registry.yarnpkg.com/@types/axios/-/axios-0.14.0.tgz#ec2300fbe7d7dddd7eb9d3abf87999964cafce46"
3396-
integrity sha512-KqQnQbdYE54D7oa/UmYVMZKq7CO4l8DEENzOKc4aBRwxCXSlJXGz83flFx5L7AWrOQnmuN3kVsRdt+GZPPjiVQ==
3397-
dependencies:
3398-
axios "*"
3399-
34003393
"@types/babel__core@^7.0.0", "@types/babel__core@^7.1.14":
34013394
version "7.20.5"
34023395
resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.20.5.tgz#3df15f27ba85319caa07ba08d0721889bb39c017"
@@ -4838,22 +4831,6 @@ axe-core@=4.7.0:
48384831
resolved "https://registry.yarnpkg.com/axe-core/-/axe-core-4.7.0.tgz#34ba5a48a8b564f67e103f0aa5768d76e15bbbbf"
48394832
integrity sha512-M0JtH+hlOL5pLQwHOLNYZaXuhqmvS8oExsqB1SBYgA4Dk7u/xx+YdGHXaK5pyUfed5mYXdlYiphWq3G8cRi5JQ==
48404833

4841-
axios@*:
4842-
version "1.6.5"
4843-
resolved "https://registry.yarnpkg.com/axios/-/axios-1.6.5.tgz#2c090da14aeeab3770ad30c3a1461bc970fb0cd8"
4844-
integrity sha512-Ii012v05KEVuUoFWmMW/UQv9aRIc3ZwkWDcM+h5Il8izZCtRVpDUfwpoFf7eOtajT3QiGR4yDUx7lPqHJULgbg==
4845-
dependencies:
4846-
follow-redirects "^1.15.4"
4847-
form-data "^4.0.0"
4848-
proxy-from-env "^1.1.0"
4849-
4850-
axios@^0.26.1:
4851-
version "0.26.1"
4852-
resolved "https://registry.yarnpkg.com/axios/-/axios-0.26.1.tgz#1ede41c51fcf51bbbd6fd43669caaa4f0495aaa9"
4853-
integrity sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==
4854-
dependencies:
4855-
follow-redirects "^1.14.8"
4856-
48574834
axios@^0.27.2:
48584835
version "0.27.2"
48594836
resolved "https://registry.yarnpkg.com/axios/-/axios-0.27.2.tgz#207658cc8621606e586c85db4b41a750e756d972"
@@ -7707,7 +7684,7 @@ flatted@^3.2.9:
77077684
resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.9.tgz#7eb4c67ca1ba34232ca9d2d93e9886e611ad7daf"
77087685
integrity sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ==
77097686

7710-
follow-redirects@^1.0.0, follow-redirects@^1.14.8, follow-redirects@^1.14.9, follow-redirects@^1.15.4:
7687+
follow-redirects@^1.0.0, follow-redirects@^1.14.9:
77117688
version "1.15.4"
77127689
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.4.tgz#cdc7d308bf6493126b17ea2191ea0ccf3e535adf"
77137690
integrity sha512-Cr4D/5wlrb0z9dgERpUL3LrmPKVDsETIJhaCMeDfuFYcqa5bldGV6wBsAN6X/vxlXQtFBMrXdXxdL8CbDTGniw==
@@ -13042,11 +13019,6 @@ [email protected]:
1304213019
resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.0.0.tgz#33c50398f70ea7eb96d21f7b817630a55791c7ee"
1304313020
integrity sha512-F2JHgJQ1iqwnHDcQjVBsq3n/uoaFL+iPW/eAeL7kVxy/2RrWaN4WroKjjvbsoRtv0ftelNyC01bjRhn/bhcf4A==
1304413021

13045-
proxy-from-env@^1.1.0:
13046-
version "1.1.0"
13047-
resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz#e102f16ca355424865755d2c9e8ea4f24d58c3e2"
13048-
integrity sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==
13049-
1305013022
1305113023
version "1.2.0"
1305213024
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:
1328913261
dependencies:
1329013262
"@babel/runtime" "^7.10.3"
1329113263

13292-
"react-loadable@npm:@docusaurus/[email protected]":
13293-
version "5.5.2"
13294-
resolved "https://registry.yarnpkg.com/@docusaurus/react-loadable/-/react-loadable-5.5.2.tgz#81aae0db81ecafbdaee3651f12804580868fa6ce"
13295-
integrity sha512-A3dYjdBGuy0IGT+wyLIGIKLRE+sAk1iNk0f1HjNDysO7u8lhL4N3VEm+FAubmJbAztn94F7MxBTPmnixbiyFdQ==
13296-
dependencies:
13297-
"@types/react" "*"
13298-
prop-types "^15.6.2"
13299-
1330013264
react-magic-dropzone@^1.0.1:
1330113265
version "1.0.1"
1330213266
resolved "https://registry.yarnpkg.com/react-magic-dropzone/-/react-magic-dropzone-1.0.1.tgz#bfd25b77b57e7a04aaef0a28910563b707ee54df"

0 commit comments

Comments
 (0)