Skip to content

Commit

Permalink
fix: update deps, security fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ruicsh committed Jan 8, 2023
1 parent fd6497a commit acfa9ee
Show file tree
Hide file tree
Showing 10 changed files with 584 additions and 388 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v1
with:
node-version: 18
Expand All @@ -56,7 +56,7 @@ jobs:
yarn --frozen-lockfile
yarn build
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v2
uses: cycjimmy/semantic-release-action@main
with:
branch: main
env:
Expand Down
4 changes: 2 additions & 2 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const config = {
setupFilesAfterEnv: ['./jest.setup.ts'],
setupFilesAfterEnv: ["./jest.setup.ts"],
transform: {
'^.+\\.(t|j)sx?$': 'ts-jest',
"^.+\\.(t|j)sx?$": "ts-jest",
},
};

Expand Down
2 changes: 1 addition & 1 deletion jest.setup.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { server } from './src/mocks/server';
import { server } from "./src/mocks/server";

beforeAll(() => server.listen());

Expand Down
22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,25 +41,25 @@
},
"devDependencies": {
"@types/debug": "4.1.7",
"@types/jest": "29.2.3",
"@types/node": "18.11.9",
"@typescript-eslint/eslint-plugin": "5.45.0",
"@typescript-eslint/parser": "5.45.0",
"esbuild": "0.15.16",
"eslint": "8.28.0",
"@types/jest": "29.2.5",
"@types/node": "18.11.18",
"@typescript-eslint/eslint-plugin": "5.48.0",
"@typescript-eslint/parser": "5.48.0",
"esbuild": "0.16.15",
"eslint": "8.31.0",
"eslint-config-airbnb-base": "15.0.0",
"eslint-config-airbnb-typescript": "17.0.0",
"eslint-config-prettier": "8.5.0",
"eslint-config-prettier": "8.6.0",
"eslint-plugin-import": "2.26.0",
"eslint-plugin-jest": "27.1.6",
"eslint-plugin-jest": "27.2.1",
"jest": "29.3.1",
"msw": "0.49.1",
"msw": "0.49.2",
"nyc": "15.1.0",
"prettier": "2.8.0",
"prettier": "2.8.2",
"ts-jest": "29.0.3",
"ts-node": "10.9.1",
"tsx": "3.12.1",
"typescript": "4.9.3",
"typescript": "4.9.4",
"zx": "7.1.1"
},
"publishConfig": {
Expand Down
4 changes: 2 additions & 2 deletions src/fetch.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { RequestOptions } from "http";
import type { URLSearchParams } from "url";
import type { RequestOptions } from "node:http";
import type { URLSearchParams } from "node:url";

export type Headers = URLSearchParams;

Expand Down
6 changes: 4 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { Response, FetchOptions, HttpMethod } from "./fetch.d";
import type { FetchOptions, HttpMethod, Response } from "./fetch.d";
import { request } from "./request";
import { timeout } from "./timeout";

export type { Response, FetchOptions, HttpMethod };

export default async function fetch<T = unknown>(
async function fetch<T = unknown>(
url: string,
options?: Partial<FetchOptions>
): Promise<Response<T>> {
Expand Down Expand Up @@ -32,3 +32,5 @@ export default async function fetch<T = unknown>(

return result as Response<T>;
}

export default fetch;
11 changes: 4 additions & 7 deletions src/mocks/handlers.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import { rest } from "msw";
import type {
RestRequest,
DefaultBodyType,
ResponseComposition,
RestContext,
MockedResponse,
DefaultBodyType, MockedResponse, ResponseComposition,
RestContext, RestRequest
} from "msw";
import { rest } from "msw";

import { cancelDelay, delay } from "./helpers/delay";
import { getHeaders, getQuery } from "./helpers/request";
import { delay, cancelDelay } from "./helpers/delay";

export function handler(
req: RestRequest<DefaultBodyType>,
Expand Down
1 change: 0 additions & 1 deletion src/mocks/helpers/request.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { RestRequest, DefaultBodyType } from "msw";
import { URL } from "url";

type Request = RestRequest<DefaultBodyType>;

Expand Down
10 changes: 5 additions & 5 deletions src/request.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import http from "http";
import https from "https";
import type { RequestOptions } from "https";
import type { OutgoingHttpHeaders } from "http";
import type { OutgoingHttpHeaders } from "node:http";
import http from "node:http";
import type { RequestOptions } from "node:https";
import https from "node:https";

import type { FetchOptions, Response } from "./fetch.d";
import { fromRawHeaders } from "./headers";
import type { Response, FetchOptions } from "./fetch.d";

export async function request<T = unknown>(
url: string,
Expand Down
Loading

0 comments on commit acfa9ee

Please sign in to comment.