Skip to content

feat: persistent builders for all #716

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

Merged
merged 1 commit into from
Oct 17, 2021
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
1 change: 0 additions & 1 deletion package-lock.json

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

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
"@netlify/ipx": "^0.0.7",
"@vercel/node": "^1.11.2-canary.4",
"chalk": "^4.1.2",
"destr": "^1.1.0",
"fs-extra": "^10.0.0",
"moize": "^6.1.0",
"outdent": "^0.8.0",
Expand Down
4 changes: 0 additions & 4 deletions src/constants.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
const destr = require('destr')

const HANDLER_FUNCTION_NAME = '___netlify-handler'
const ODB_FUNCTION_NAME = '___netlify-odb-handler'
const IMAGE_FUNCTION_NAME = '_ipx'
const ODB_PATH = destr(process.env.EXPERIMENTAL_PERSISTENT_BUILDERS) ? 'builders' : 'functions'

// These are paths in .next that shouldn't be publicly accessible
const HIDDEN_PATHS = [
Expand All @@ -23,5 +20,4 @@ module.exports = {
IMAGE_FUNCTION_NAME,
HANDLER_FUNCTION_NAME,
ODB_FUNCTION_NAME,
ODB_PATH,
}
4 changes: 2 additions & 2 deletions src/helpers/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ const defaultFailBuild = (message, { error }) => {
throw new Error(`${message}\n${error && error.stack}`)
}

const { HANDLER_FUNCTION_NAME, ODB_FUNCTION_NAME, HIDDEN_PATHS, ODB_PATH } = require('../constants')
const { HANDLER_FUNCTION_NAME, ODB_FUNCTION_NAME, HIDDEN_PATHS } = require('../constants')

const ODB_FUNCTION_PATH = `/.netlify/${ODB_PATH}/${ODB_FUNCTION_NAME}`
const ODB_FUNCTION_PATH = `/.netlify/builders/${ODB_FUNCTION_NAME}`
const HANDLER_FUNCTION_PATH = `/.netlify/functions/${HANDLER_FUNCTION_NAME}`

const CATCH_ALL_REGEX = /\/\[\.{3}(.*)](.json)?$/
Expand Down
4 changes: 2 additions & 2 deletions src/helpers/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const { join, relative } = require('path')

const { copyFile, ensureDir, writeFile, writeJSON } = require('fs-extra')

const { HANDLER_FUNCTION_NAME, ODB_FUNCTION_NAME, IMAGE_FUNCTION_NAME, ODB_PATH } = require('../constants')
const { HANDLER_FUNCTION_NAME, ODB_FUNCTION_NAME, IMAGE_FUNCTION_NAME } = require('../constants')
const getHandler = require('../templates/getHandler')
const { getPageResolver } = require('../templates/getPageResolver')

Expand Down Expand Up @@ -78,7 +78,7 @@ exports.setupImageFunction = async ({
},
{
from: `${basePath}/${IMAGE_FUNCTION_NAME}/*`,
to: `/.netlify/${ODB_PATH}/${IMAGE_FUNCTION_NAME}`,
to: `/.netlify/builders/${IMAGE_FUNCTION_NAME}`,
status: 200,
},
)
Expand Down
18 changes: 9 additions & 9 deletions test/__snapshots__/index.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Array [
Object {
"from": "/_ipx/*",
"status": 200,
"to": "/.netlify/functions/_ipx",
"to": "/.netlify/builders/_ipx",
},
Object {
"force": true,
Expand Down Expand Up @@ -162,42 +162,42 @@ Array [
Object {
"from": "/getStaticProps/withFallback/:slug/*",
"status": 200,
"to": "/.netlify/functions/___netlify-odb-handler",
"to": "/.netlify/builders/___netlify-odb-handler",
},
Object {
"from": "/_next/data/build-id/getStaticProps/withFallback/:slug/*",
"status": 200,
"to": "/.netlify/functions/___netlify-odb-handler",
"to": "/.netlify/builders/___netlify-odb-handler",
},
Object {
"from": "/getStaticProps/withFallback/:id",
"status": 200,
"to": "/.netlify/functions/___netlify-odb-handler",
"to": "/.netlify/builders/___netlify-odb-handler",
},
Object {
"from": "/_next/data/build-id/getStaticProps/withFallback/:id.json",
"status": 200,
"to": "/.netlify/functions/___netlify-odb-handler",
"to": "/.netlify/builders/___netlify-odb-handler",
},
Object {
"from": "/getStaticProps/withFallbackBlocking/:id",
"status": 200,
"to": "/.netlify/functions/___netlify-odb-handler",
"to": "/.netlify/builders/___netlify-odb-handler",
},
Object {
"from": "/_next/data/build-id/getStaticProps/withFallbackBlocking/:id.json",
"status": 200,
"to": "/.netlify/functions/___netlify-odb-handler",
"to": "/.netlify/builders/___netlify-odb-handler",
},
Object {
"from": "/getStaticProps/withRevalidate/withFallback/:id",
"status": 200,
"to": "/.netlify/functions/___netlify-odb-handler",
"to": "/.netlify/builders/___netlify-odb-handler",
},
Object {
"from": "/_next/data/build-id/getStaticProps/withRevalidate/withFallback/:id.json",
"status": 200,
"to": "/.netlify/functions/___netlify-odb-handler",
"to": "/.netlify/builders/___netlify-odb-handler",
},
Object {
"from": "/*",
Expand Down