Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

Use native node fetch (#1875)

Bogdan Chadkin06a311c87712
diff --git a/packages/css-data/bin/property-value-descriptions.ts b/packages/css-data/bin/property-value-descriptions.ts
index e3b7dfa927..51177f27a0 100755
--- a/packages/css-data/bin/property-value-descriptions.ts
+++ b/packages/css-data/bin/property-value-descriptions.ts
@@ -2,7 +2,6 @@
import * as fs from "node:fs";
import * as path from "node:path";
import type { CreateChatCompletionResponse } from "openai";
-import { fetch } from "undici";
import { keywordValues } from "../src/__generated__/keyword-values";
const propertiesPrompt = fs.readFileSync(
diff --git a/packages/css-data/package.json b/packages/css-data/package.json
index 1242c1f2ee..782e5f54c2 100644
--- a/packages/css-data/package.json
+++ b/packages/css-data/package.json
@@ -51,7 +51,6 @@
"css-tree": "^2.3.1",
"hyphenate-style-name": "^1.0.4",
"openai": "^3.2.1",
- "undici": "^5.22.1",
"warn-once": "^0.1.1"
}
}
diff --git a/packages/http-client/package.json b/packages/http-client/package.json
index e39236e10b..9bbe5ed564 100644
--- a/packages/http-client/package.json
+++ b/packages/http-client/package.json
@@ -15,7 +15,6 @@
},
"devDependencies": {
"@jest/globals": "^29.3.1",
- "@types/isomorphic-fetch": "^0.0.36",
"@webstudio-is/jest-config": "workspace:^",
"@webstudio-is/prisma-client": "workspace:^",
"@webstudio-is/react-sdk": "workspace:^",
@@ -24,9 +23,6 @@
"jest": "^29.3.1",
"typescript": "5.1.3"
},
- "dependencies": {
- "isomorphic-fetch": "^3.0.0"
- },
"exports": {
"source": "./src/index.ts",
"types": "./lib/types/index.d.ts",
diff --git a/packages/http-client/src/index.ts b/packages/http-client/src/index.ts
index 6d31008f03..6785d50959 100644
--- a/packages/http-client/src/index.ts
+++ b/packages/http-client/src/index.ts
@@ -1,4 +1,3 @@
-import fetch from "isomorphic-fetch";
import type { Data } from "@webstudio-is/react-sdk";
export const loadProject = async ({
diff --git a/packages/trpc-interface/package.json b/packages/trpc-interface/package.json
index 6eea5574b4..8adbe70558 100644
--- a/packages/trpc-interface/package.json
+++ b/packages/trpc-interface/package.json
@@ -17,7 +17,6 @@
"@trpc/client": "^10.9.0",
"@trpc/server": "^10.9.0",
"@webstudio-is/prisma-client": "workspace:^",
- "node-fetch": "2",
"ts-custom-error": "^3.3.1",
"uuid": "^9.0.0",
"zod": "^3.21.4"
diff --git a/packages/trpc-interface/src/shared/client.ts b/packages/trpc-interface/src/shared/client.ts
index 108ffd155c..e5cca3b0dd 100644
--- a/packages/trpc-interface/src/shared/client.ts
+++ b/packages/trpc-interface/src/shared/client.ts
@@ -1,4 +1,3 @@
-import fetch from "node-fetch";
import { createTRPCProxyClient, httpBatchLink } from "@trpc/client";
import {
sharedRouter,
@@ -20,9 +19,6 @@ export const createTrpcProxyServiceClient = (
const remoteClient = createTRPCProxyClient<SharedRouter>({
links: [
httpBatchLink({
- // httpBatchLink uses lib.dom.d.ts's fetch type
- // which is incompatible with node fetch type.
- fetch: fetch as never,
url: options.url,
headers: () => ({
Authorization: options.token,
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 09891bba28..762e91cdc8 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -462,9 +462,6 @@ importers:
openai:
specifier: ^3.2.1
version: 3.2.1
- undici:
- specifier: ^5.22.1
- version: 5.22.1
warn-once:
specifier: ^0.1.1
version: 0.1.1
@@ -947,17 +944,10 @@ importers:
version: 5.1.3
packages/http-client:
- dependencies:
- isomorphic-fetch:
- specifier: ^3.0.0
- version: 3.0.0
devDependencies:
'@jest/globals':
specifier: ^29.3.1
version: 29.3.1
- '@types/isomorphic-fetch':
- specifier: ^0.0.36
- version: 0.0.36
'@webstudio-is/jest-config':
specifier: workspace:^
version: link:../jest-config
@@ -1490,9 +1480,6 @@ importers:
'@webstudio-is/prisma-client':
specifier: workspace:^
version: link:../prisma-client
- node-fetch:
- specifier: '2'
- version: 2.6.9
ts-custom-error:
specifier: ^3.3.1
version: 3.3.1
@@ -8367,10 +8354,6 @@ packages:
resolution: {integrity: sha512-sjO5w5XZTF2zKepC9ZOv8e0K6n5JVuCjhD/9WRxsDTJTX7Oz3APlN5Arsio8cFj/zrHBqv8jIKBuUOVIr9ckUQ==}
dev: true
- resolution: {integrity: sha512-ulw4d+vW1HKn4oErSmNN2HYEcHGq0N1C5exlrMM0CRqX1UUpFhGb5lwiom5j9KN3LBJJDLRmYIZz1ghm7FIzZw==}
- dev: true
-
resolution: {integrity: sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==}
@@ -9470,6 +9453,7 @@ packages:
engines: {node: '>=10.16.0'}
dependencies:
streamsearch: 1.1.0
+ dev: true
resolution: {integrity: sha512-fey6+4jDK7TFtFg/klGSvNKJctyU7n2aQdnM+CO0ruLPbqqMOM8Tio0Pc+deqUeVKX1tL5DQep1zQ7+37aTAsA==}
@@ -12495,15 +12479,6 @@ packages:
resolution: {integrity: sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==}
engines: {node: '>=0.10.0'}
- resolution: {integrity: sha512-qvUtwJ3j6qwsF3jLxkZ72qCgjMysPzDfeV240JHiGZsANBYd+EEuu35v7dfrJ9Up0Ak07D7GGSkGhCHTqg/5wA==}
- dependencies:
- node-fetch: 2.6.9
- whatwg-fetch: 3.6.2
- transitivePeerDependencies:
- - encoding
- dev: false
-
resolution: {integrity: sha512-geDJjpoZ8N0kWexiwkX8F9NkTsXhetLPVbZFQ+JTW239QNOwvB0gniuR1Wc6f0AMTn7/mFGyXvHTifrCp/GH8Q==}
dependencies:
@@ -16430,6 +16405,7 @@ packages:
resolution: {integrity: sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==}
engines: {node: '>=10.0.0'}
+ dev: true
resolution: {integrity: sha512-a1uQGz7IyVy9YwhqjZIZu1c8JO8dNIe20xBmSS6qu9kv++k3JGzCVmprbNN5Kn+BgzD5E7YYwg1CcjuJMRNsvg==}
@@ -17020,13 +16996,6 @@ packages:
busboy: 1.6.0
dev: true
- resolution: {integrity: sha512-Ji2IJhFXZY0x/0tVBXeQwgPlLWw13GVzpsWPQ3rV50IFMMof2I55PZZxtm4P6iNq+L5znYN9nSTAq0ZyE6lSJw==}
- engines: {node: '>=14.0'}
- dependencies:
- busboy: 1.6.0
- dev: false
-
resolution: {integrity: sha512-F9p7yYCn6cIW9El1zi0HI6vqpeIvBsr3dSuRO6Xuppb1u5rXpCPmMvLSyECLhybr9isec8Ohl0hPekMVrEinDA==}
@@ -17483,10 +17452,6 @@ packages:
resolution: {integrity: sha512-5tyDlKLqPfMqjT3Q9TAqf2YqjwmnUleZwzJi1A5qXnlBCdj2AtOJ6wAWdglTIDOPgOiOrXeBeFcsQ8+aGQ6QbA==}
- resolution: {integrity: sha512-bJlen0FcuU/0EMLrdbJ7zOnW6ITZLrZMIarMUVmdKtsGvZna8vxKYaexICWPfZ8qwf9fzNq+UEIZrnSaApt6RA==}
- dev: false
-
resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==}
dependencies: