Remove undici dep (#7980)
This commit is contained in:
parent
3c31008519
commit
b675acb2aa
10 changed files with 9 additions and 14 deletions
5
.changeset/violet-peaches-invent.md
Normal file
5
.changeset/violet-peaches-invent.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'@astrojs/telemetry': patch
|
||||
---
|
||||
|
||||
Remove undici dependency
|
|
@ -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": {
|
||||
|
|
|
@ -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';
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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": {
|
||||
|
|
|
@ -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> {
|
||||
|
|
Loading…
Reference in a new issue