Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix(deps): remove node-fetch and abortcontroller-polyfill, upgrade uuid #825

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

Closed
talentlessguy wants to merge 1 commit into netlify:main from talentlessguy:remove-fetch-ac
Closed
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
82 changes: 13 additions & 69 deletions plugin/package-lock.json
View file Open in desktop

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

4 changes: 1 addition & 3 deletions plugin/package.json
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,19 @@
"dependencies": {
"@netlify/functions": "^1.6.0",
"@netlify/ipx": "^1.4.6",
"abortcontroller-polyfill": "^1.7.3",
"chalk": "^4.1.2",
"co-body": "^6.1.0",
"cookie": "^0.7.0",
"etag": "^1.8.1",
"fs-extra": "^10.0.0",
"linkfs": "^2.1.0",
"multer": "^2.0.0",
"node-fetch": "^2.6.1",
"node-stream-zip": "^1.15.0",
"pathe": "^0.3.0",
"pretty-bytes": "^5.6.0",
"semver": "^7.3.5",
"statuses": "^2.0.1",
"uuid": "^9.0.0"
"uuid": "^11.1.0"
},
"devDependencies": {
"@gatsbyjs/reach-router": "^2.0.0",
Expand Down
2 changes: 0 additions & 2 deletions plugin/src/index.ts
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import path from 'path'
import process from 'process'
import 'abortcontroller-polyfill/dist/abortcontroller-polyfill-only'

import { NetlifyPluginOptions } from '@netlify/build'
import { stripIndent } from 'common-tags'
import { existsSync } from 'fs-extra'
import fetch from 'node-fetch'

import { normalizedCacheDir, restoreCache, saveCache } from './helpers/cache'
import {
Expand Down
3 changes: 1 addition & 2 deletions plugin/src/templates/api/utils.ts
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
import cookie from 'cookie'
import type { GatsbyFunctionResponse } from 'gatsby'
import { GatsbyFunctionRequest } from 'gatsby'
import fetch, { Headers } from 'node-fetch'
import statuses from 'statuses'

interface NetlifyFunctionParams {
Expand Down Expand Up @@ -311,6 +310,6 @@ export const proxyRequest = async (event: HandlerEvent, res) => {
}
}

res.write(await response.buffer())
res.write(Buffer.from(await response.arrayBuffer()))
res.send()
}
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
/* eslint-disable no-unused-vars */
const fetch = require(`node-fetch`)
const { readFileSync } = require('fs')
const path = require('path')

const FormData = require('form-data')
// Based on Gatsby Functions integration tests
// Source: https://github.com/gatsbyjs/gatsby/blob/master/integration-tests/functions/test-helpers.js

Expand Down
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
/* eslint-disable no-unused-vars */
const fetch = require(`node-fetch`)
const { readFileSync } = require('fs')
const path = require('path')

const FormData = require('form-data')
// Based on Gatsby Functions integration tests
// Source: https://github.com/gatsbyjs/gatsby/blob/master/integration-tests/functions/test-helpers.js

Expand Down
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
/* eslint-disable no-unused-vars */
const fetch = require(`node-fetch`)
const { readFileSync } = require('fs')
const path = require('path')

const FormData = require('form-data')
// Based on Gatsby Functions integration tests
// Source: https://github.com/gatsbyjs/gatsby/blob/master/integration-tests/functions/test-helpers.js

Expand Down
13 changes: 6 additions & 7 deletions plugin/test/unit/index.spec.ts
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@ import Chance from 'chance'
import { onBuild, onSuccess } from '../../src/index'
import { enableGatsbyExcludeDatastoreFromBundle } from '../helpers'

jest.mock('node-fetch', () => ({
__esModule: true,
default: jest.fn(),
}))

jest.mock('../../src/helpers/config', () => {
const configObj = jest.requireActual('../../src/helpers/config')

Expand Down Expand Up @@ -209,14 +204,18 @@ describe('plugin', () => {
})

describe('onSuccess', () => {
const fetch = require('node-fetch').default
const mockFetch = jest.fn()
const originalFetch = globalThis.fetch

beforeEach(() => {
fetch.mockImplementation(mockFetchMethod)
globalThis.fetch = mockFetch
mockFetch.mockImplementation(mockFetchMethod)
enableGatsbyExcludeDatastoreFromBundle()
})

afterEach(() => {
globalThis.fetch = originalFetch
jest.clearAllMocks()
delete process.env.GATSBY_EXCLUDE_DATASTORE_FROM_BUNDLE
delete process.env.DEPLOY_PRIME_URL
})
Expand Down

AltStyle によって変換されたページ (->オリジナル) /