Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove undici dep #7980

Merged
merged 1 commit into from
Aug 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}
Comment on lines +37 to 39
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we even need this util anymore?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's used to check the types below, and could probably be instanceof Response too. But I think I'll leave it for now to simplify the change.


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
17 changes: 2 additions & 15 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading