Skip to content

Commit

Permalink
remove axios dependency (#288)
Browse files Browse the repository at this point in the history
  • Loading branch information
benmccann authored Apr 29, 2024
1 parent 0d2e0ec commit f95a94f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 44 deletions.
2 changes: 0 additions & 2 deletions packages/docusaurus-plugin-openapi/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/docusaurus-plugin-openapi/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
8 changes: 5 additions & 3 deletions packages/docusaurus-plugin-openapi/src/openapi/openapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -209,8 +208,11 @@ export async function readOpenapiFiles(
_options: {}
): Promise<OpenApiFiles[]> {
if (isURL(openapiPath)) {
const { data } = await axios.get(openapiPath);
if (!data) {
let data;
try {
const response = await fetch(openapiPath);
data = await response.json();
} catch (err) {
throw Error(
`Did not find an OpenAPI specification at URL ${openapiPath}`
);
Expand Down
40 changes: 2 additions & 38 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1590,7 +1590,7 @@
"@docusaurus/theme-search-algolia" "3.2.0"
"@docusaurus/types" "3.2.0"

"@docusaurus/[email protected]":
"@docusaurus/[email protected]", "react-loadable@npm:@docusaurus/[email protected]":
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==
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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==
Expand Down Expand Up @@ -13042,11 +13019,6 @@ [email protected]:
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==

[email protected]:
version "1.2.0"
resolved "https://registry.yarnpkg.com/ps-tree/-/ps-tree-1.2.0.tgz#5e7425b89508736cdd4f2224d028f7bb3f722ebd"
Expand Down Expand Up @@ -13289,14 +13261,6 @@ react-loadable-ssr-addon-v5-slorber@^1.0.1:
dependencies:
"@babel/runtime" "^7.10.3"

"react-loadable@npm:@docusaurus/[email protected]":
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"
Expand Down

0 comments on commit f95a94f

Please sign in to comment.