Skip to content

Commit 3c28af0

Browse files
authored
fix: drop node-fetch from build package (#6377)
1 parent ed08b0d commit 3c28af0

File tree

6 files changed

+0
-48
lines changed

6 files changed

+0
-48
lines changed

package-lock.json

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/build/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@
9797
"map-obj": "^5.0.0",
9898
"memoize-one": "^6.0.0",
9999
"minimatch": "^9.0.4",
100-
"node-fetch": "^3.3.2",
101100
"os-name": "^6.0.0",
102101
"p-event": "^6.0.0",
103102
"p-every": "^2.0.0",

packages/build/src/plugins_core/blobs_upload/index.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
import { version as nodeVersion } from 'node:process'
2-
31
import { getDeployStore } from '@netlify/blobs'
42
import pMap from 'p-map'
5-
import semver from 'semver'
63

74
import { DEFAULT_API_HOST } from '../../core/normalize_flags.js'
85
import { logError } from '../../log/logger.js'
@@ -32,12 +29,6 @@ const coreStep: CoreStepFunction = async function ({
3229
apiURL: `https://${apiHost}`,
3330
}
3431

35-
// If we don't have native `fetch` in the global scope, add a polyfill.
36-
if (semver.lt(nodeVersion, '18.0.0')) {
37-
const nodeFetch = (await import('node-fetch')).default as unknown as typeof fetch
38-
storeOpts.fetch = nodeFetch
39-
}
40-
4132
const blobs = await scanForBlobs(buildDir, packagePath)
4233

4334
// We checked earlier, but let's be extra safe

packages/build/src/plugins_core/dev_blobs_upload/index.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
import { version as nodeVersion } from 'node:process'
2-
31
import { getDeployStore } from '@netlify/blobs'
42
import pMap from 'p-map'
5-
import semver from 'semver'
63

74
import { log, logError } from '../../log/logger.js'
85
import { getFileWithMetadata, getKeysToUpload, scanForBlobs } from '../../utils/blobs.js'
@@ -32,12 +29,6 @@ const coreStep: CoreStepFunction = async function ({
3229
apiURL: `https://${apiHost}`,
3330
}
3431

35-
// If we don't have native `fetch` in the global scope, add a polyfill.
36-
if (semver.lt(nodeVersion, '18.0.0')) {
37-
const nodeFetch = (await import('node-fetch')).default as unknown as typeof fetch
38-
storeOpts.fetch = nodeFetch
39-
}
40-
4132
const blobs = await scanForBlobs(buildDir, packagePath)
4233

4334
// We checked earlier, but let's be extra safe

packages/build/tests/blobs_upload/tests.js

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,6 @@ test.serial('Blobs upload step uploads files to deploy store (legacy API)', asyn
9696
t.is(defaultRegionRequests.length, 3)
9797

9898
const storeOpts = { deployID: 'abc123', siteID: 'test', token: TOKEN }
99-
if (semver.lt(nodeVersion, '18.0.0')) {
100-
const nodeFetch = await import('node-fetch')
101-
storeOpts.fetch = nodeFetch.default
102-
}
103-
10499
const store = getDeployStore(storeOpts)
105100

106101
const blob1 = await store.getWithMetadata('something.txt')
@@ -134,11 +129,6 @@ test.serial('Blobs upload step uploads files to deploy store (legacy deploy conf
134129
t.is(regionAutoRequests.length, 3)
135130

136131
const storeOpts = { deployID: 'abc123', siteID: 'test', token: TOKEN }
137-
if (semver.lt(nodeVersion, '18.0.0')) {
138-
const nodeFetch = await import('node-fetch')
139-
storeOpts.fetch = nodeFetch.default
140-
}
141-
142132
const store = getDeployStore(storeOpts)
143133

144134
const blob1 = await store.getWithMetadata('something.txt')
@@ -175,11 +165,6 @@ test.serial('Blobs upload step uploads files to deploy store', async (t) => {
175165
t.is(regionAutoRequests.length, 3)
176166

177167
const storeOpts = { deployID: 'abc123', siteID: 'test', token: TOKEN }
178-
if (semver.lt(nodeVersion, '18.0.0')) {
179-
const nodeFetch = await import('node-fetch')
180-
storeOpts.fetch = nodeFetch.default
181-
}
182-
183168
const store = getDeployStore(storeOpts)
184169

185170
const blob1 = await store.getWithMetadata('something.txt')
@@ -222,11 +207,6 @@ if (semver.gte(nodeVersion, '18.19.0')) {
222207
t.is(t.context.blobRequests.set.length, 6)
223208

224209
const storeOpts = { deployID: 'abc123', siteID: 'test', token: TOKEN }
225-
if (semver.lt(nodeVersion, '18.0.0')) {
226-
const nodeFetch = await import('node-fetch')
227-
storeOpts.fetch = nodeFetch.default
228-
}
229-
230210
const store = getDeployStore(storeOpts)
231211

232212
const blob1 = await store.getWithMetadata('something.txt')

packages/build/tests/plugins/fixtures/blobs_read/plugin.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
1-
import { version as nodeVersion } from "process"
2-
31
import { getDeployStore } from '@netlify/blobs'
4-
import semver from 'semver'
52

63
export const onPreBuild = async function ({netlifyConfig}) {
74
const storeOptions = {}
85

9-
if (semver.lt(nodeVersion, '18.0.0')) {
10-
const nodeFetch = await import('node-fetch')
11-
storeOptions.fetch = nodeFetch.default
12-
}
13-
146
const store = getDeployStore(storeOptions)
157
const value = await store.get("my-key")
168

0 commit comments

Comments
 (0)