Skip to content

Commit b68a79b

Browse files
authored
Merge branch 'main' into ep/add-detection
2 parents 65700ab + 9e0fadd commit b68a79b

File tree

6 files changed

+37
-17
lines changed

6 files changed

+37
-17
lines changed

.release-please-manifest.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"packages/runtime": "4.15.0",
2+
"packages/runtime": "4.16.0",
33
"packages/next": "0.0.1"
44
}

package-lock.json

+10-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/runtime/CHANGELOG.md

+13
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
# Changelog
22

3+
## [4.16.0](https://github.com/netlify/next-runtime/compare/plugin-nextjs-v4.15.0...plugin-nextjs-v4.16.0) (2022-08-15)
4+
5+
6+
### Features
7+
8+
* **graph:** populate graph token for ISR ([#1525](https://github.com/netlify/next-runtime/issues/1525)) ([573b913](https://github.com/netlify/next-runtime/commit/573b9137241882359411f448acd044a32c2c8169))
9+
10+
11+
### Bug Fixes
12+
13+
* **deps:** update dependency @netlify/functions to ^1.1.0 ([#1526](https://github.com/netlify/next-runtime/issues/1526)) ([8a98d72](https://github.com/netlify/next-runtime/commit/8a98d7237f9168342e3bfeb9dbcc9240d694dcdd))
14+
* **deps:** update dependency @netlify/ipx to ^1.2.1 ([#1534](https://github.com/netlify/next-runtime/issues/1534)) ([086a703](https://github.com/netlify/next-runtime/commit/086a703c87fb196d3b84c698dfb1621be6a0713b))
15+
316
## [4.15.0](https://github.com/netlify/netlify-plugin-nextjs/compare/plugin-nextjs-v4.14.2...plugin-nextjs-v4.15.0) (2022-08-12)
417

518

packages/runtime/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@netlify/plugin-nextjs",
3-
"version": "4.15.0",
3+
"version": "4.16.0",
44
"description": "Run Next.js seamlessly on Netlify",
55
"main": "lib/index.js",
66
"files": [
@@ -10,7 +10,7 @@
1010
],
1111
"dependencies": {
1212
"@netlify/functions": "^1.1.0",
13-
"@netlify/ipx": "^1.2.0",
13+
"@netlify/ipx": "^1.2.1",
1414
"@vercel/node-bridge": "^2.1.0",
1515
"chalk": "^4.1.2",
1616
"fs-extra": "^10.0.0",

packages/runtime/src/helpers/files.ts

+10-2
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,8 @@ export const moveStaticPages = async ({
280280
}
281281
}
282282

283+
const PATCH_WARNING = `/* File patched by Netlify */`
284+
283285
/**
284286
* Attempt to patch a source file, preserving a backup
285287
*/
@@ -294,7 +296,13 @@ const patchFile = async ({
294296
console.warn('File was not found')
295297
return false
296298
}
297-
const content = await readFile(file, 'utf8')
299+
let content = await readFile(file, 'utf8')
300+
301+
// If the file has already been patched, patch the backed-up original instead
302+
if (content.includes(PATCH_WARNING) && existsSync(`${file}.orig`)) {
303+
content = await readFile(`${file}.orig`, 'utf8')
304+
}
305+
298306
const newContent = replacements.reduce((acc, [from, to]) => {
299307
if (acc.includes(to)) {
300308
console.log('Already patched. Skipping.')
@@ -307,7 +315,7 @@ const patchFile = async ({
307315
return false
308316
}
309317
await writeFile(`${file}.orig`, content)
310-
await writeFile(file, newContent)
318+
await writeFile(file, `${newContent}\n${PATCH_WARNING}`)
311319
console.log('Done')
312320
return true
313321
}

packages/runtime/src/index.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
generateCustomHeaders,
1717
} from './helpers/config'
1818
import { updateConfig, writeEdgeFunctions, loadMiddlewareManifest } from './helpers/edge'
19-
import { moveStaticPages, movePublicFiles, patchNextFiles, unpatchNextFiles } from './helpers/files'
19+
import { moveStaticPages, movePublicFiles, patchNextFiles } from './helpers/files'
2020
import { generateFunctions, setupImageFunction, generatePagesResolver } from './helpers/functions'
2121
import { generateRedirects, generateStaticRedirects } from './helpers/redirects'
2222
import { shouldSkip, isNextAuthInstalled, isOldPluginInstalled, getCustomImageResponseHeaders } from './helpers/utils'
@@ -212,7 +212,6 @@ const plugin: NetlifyPlugin = {
212212

213213
warnForProblematicUserRewrites({ basePath, redirects })
214214
warnForRootRedirects({ appDir })
215-
await unpatchNextFiles(basePath)
216215
},
217216
}
218217
module.exports = plugin

0 commit comments

Comments
 (0)