Skip to content

Commit

Permalink
Remove undici dep (#7980)
Browse files Browse the repository at this point in the history
  • Loading branch information
bluwy authored and ematipico committed Aug 8, 2023
1 parent 3c31008 commit b675acb
Show file tree
Hide file tree
Showing 10 changed files with 9 additions and 14 deletions.
5 changes: 5 additions & 0 deletions .changeset/violet-peaches-invent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@astrojs/telemetry': patch
---

Remove undici dependency
1 change: 0 additions & 1 deletion packages/astro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
1 change: 0 additions & 1 deletion packages/astro/test/ssr-api-route.test.js
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
1 change: 0 additions & 1 deletion packages/astro/test/test-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions packages/integrations/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
7 changes: 3 additions & 4 deletions packages/integrations/node/src/response-iterator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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>>;
Expand Down Expand Up @@ -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> {
Expand Down Expand Up @@ -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;

Expand Down
1 change: 0 additions & 1 deletion packages/integrations/node/test/prerender-404.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion packages/integrations/node/test/prerender.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion packages/telemetry/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
2 changes: 0 additions & 2 deletions packages/telemetry/src/post.ts
Original file line number Diff line number Diff line change
@@ -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> {
Expand Down

0 comments on commit b675acb

Please sign in to comment.