Remove undici dep (#7980)

This commit is contained in:
Bjorn Lu 2023-08-08 15:04:14 +08:00 committed by Emanuele Stoppa
parent 3c31008519
commit b675acb2aa
10 changed files with 9 additions and 14 deletions

View file

@ -0,0 +1,5 @@
---
'@astrojs/telemetry': patch
---
Remove undici dependency

View file

@ -211,7 +211,6 @@
"rollup": "^3.25.1",
"sass": "^1.63.4",
"srcset-parse": "^1.1.0",
"undici": "^5.22.1",
"unified": "^10.1.2"
},
"engines": {

View file

@ -1,6 +1,5 @@
import { expect } from 'chai';
import net from 'node:net';
import { File, FormData } from 'undici';
import testAdapter from './test-adapter.js';
import { loadFixture } from './test-utils.js';

View file

@ -20,7 +20,6 @@ import { sync } from '../dist/core/sync/index.js';
process.env.ASTRO_TELEMETRY_DISABLED = true;
/**
* @typedef {import('undici').Response} Response
* @typedef {import('../src/core/dev/dev').DedvServer} DevServer
* @typedef {import('../src/@types/astro').AstroInlineConfig & { root?: string | URL }} AstroInlineConfig
* @typedef {import('../src/core/preview/index').PreviewServer} PreviewServer

View file

@ -48,7 +48,6 @@
"chai": "^4.3.7",
"cheerio": "1.0.0-rc.12",
"mocha": "^9.2.2",
"node-mocks-http": "^1.12.2",
"undici": "^5.22.1"
"node-mocks-http": "^1.12.2"
}
}

View file

@ -6,7 +6,6 @@
import type { ReadableStreamDefaultReadResult } from 'node:stream/web';
import { Readable as NodeReadableStream } from 'stream';
import type { Response as NodeResponse } from 'undici';
interface NodeStreamIterator<T> {
next(): Promise<IteratorResult<T, boolean | undefined>>;
@ -35,8 +34,8 @@ function isBuffer(value: any): value is Buffer {
);
}
function isNodeResponse(value: any): value is NodeResponse {
return !!(value as NodeResponse).body;
function isNodeResponse(value: any): value is Response {
return !!(value as Response).body;
}
function isReadableStream(value: any): value is ReadableStream<any> {
@ -202,7 +201,7 @@ function asyncIterator<T>(source: AsyncIterableIterator<T>): AsyncIterableIterat
}
export function responseIterator<T>(
response: Response | NodeResponse | Buffer
response: Response | Buffer
): AsyncIterableIterator<T> {
let body: unknown = response;

View file

@ -2,7 +2,6 @@ import nodejs from '../dist/index.js';
import { loadFixture } from './test-utils.js';
import { expect } from 'chai';
import * as cheerio from 'cheerio';
import { fetch } from 'undici';
/**
* @typedef {import('../../../astro/test/test-utils').Fixture} Fixture

View file

@ -2,7 +2,6 @@ import nodejs from '../dist/index.js';
import { loadFixture } from './test-utils.js';
import { expect } from 'chai';
import * as cheerio from 'cheerio';
import { fetch } from 'undici';
/**
* @typedef {import('../../../astro/test/test-utils').Fixture} Fixture

View file

@ -35,7 +35,6 @@
"dset": "^3.1.2",
"is-docker": "^3.0.0",
"is-wsl": "^2.2.0",
"undici": "^5.22.1",
"which-pm-runs": "^1.1.0"
},
"devDependencies": {

View file

@ -1,5 +1,3 @@
import { fetch } from 'undici';
const ASTRO_TELEMETRY_ENDPOINT = `https://telemetry.astro.build/api/v1/record`;
export function post(body: Record<string, any>): Promise<any> {