Skip to content

Commit 9e6dff6

Browse files
hbbrawer-twitchfaisalman
authored andcommitted
replace node fetch types with undici
1 parent bf5155e commit 9e6dff6

File tree

4 files changed

+15
-86
lines changed

4 files changed

+15
-86
lines changed

package-lock.json

Lines changed: 10 additions & 80 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,15 +227,14 @@
227227
"detect-europe-js": "^0.1.2",
228228
"is-standalone-pwa": "^0.1.1",
229229
"ua-is-frozen": "^0.1.2",
230-
"@types/node-fetch": "^2.6.12"
230+
"undici": "^7.12.0"
231231
},
232232
"devDependencies": {
233233
"@babel/parser": "7.15.8",
234234
"@babel/traverse": "7.23.2",
235235
"@playwright/test": "^1.49.0",
236236
"jshint": "~2.13.6",
237237
"mocha": "~8.2.0",
238-
"node-fetch": "^2.7.0",
239238
"requirejs": "2.3.2",
240239
"safe-regex": "^2.1.1",
241240
"tsd": "^0.29.0",

src/main/ua-parser.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// Project: https://github.com/faisalman/ua-parser-js
33
// Definitions by: Faisal Salman <https://github.com/faisalman>
44

5-
import type { IncomingHttpHeaders } from 'http';
6-
import type { Headers as FetchAPIHeaders } from 'node-fetch';
5+
import type { Headers } from "undici";
6+
import type { IncomingHttpHeaders } from "undici/types/header";
77

88
declare namespace UAParser {
99

@@ -53,7 +53,7 @@ declare namespace UAParser {
5353
type RegexMap = ((RegExp | string | (string | RegExp | Function)[])[])[];
5454
type UAParserProps = 'browser' | 'cpu' | 'device' | 'engine' | 'os';
5555
type UAParserExt = Partial<Record<UAParserProps, RegexMap>> | Partial<Record<UAParserProps, RegexMap>>[];
56-
type UAParserHeaders = Record<string, string> | IncomingHttpHeaders | FetchAPIHeaders;
56+
type UAParserHeaders = Record<string, string> | IncomingHttpHeaders | Headers;
5757

5858
export function UAParser(uastring?: string, extensions?: UAParserExt, headers?: UAParserHeaders): IResult;
5959
export function UAParser(uastring?: string, headers?: UAParserHeaders): IResult;

test/unit/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ var cpus = require('../data/ua/cpu/cpu-all.json');
1010
var devices = readJsonFiles('test/data/ua/device');
1111
var engines = require('../data/ua/engine/engine-all.json');
1212
var os = readJsonFiles('test/data/ua/os');
13-
var { Headers } = require('node-fetch');
13+
var { Headers } = require('undici');
1414

1515
function readJsonFiles(dir) {
1616
var list = [];

0 commit comments

Comments
 (0)