Skip to content

Commit de07dc2

Browse files
authored
feat: persistent builders for all (#716)
1 parent f216361 commit de07dc2

File tree

6 files changed

+13
-19
lines changed

6 files changed

+13
-19
lines changed

package-lock.json

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

package.json

-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@
5656
"@netlify/ipx": "^0.0.7",
5757
"@vercel/node": "^1.11.2-canary.4",
5858
"chalk": "^4.1.2",
59-
"destr": "^1.1.0",
6059
"fs-extra": "^10.0.0",
6160
"moize": "^6.1.0",
6261
"outdent": "^0.8.0",

src/constants.js

-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1-
const destr = require('destr')
2-
31
const HANDLER_FUNCTION_NAME = '___netlify-handler'
42
const ODB_FUNCTION_NAME = '___netlify-odb-handler'
53
const IMAGE_FUNCTION_NAME = '_ipx'
6-
const ODB_PATH = destr(process.env.EXPERIMENTAL_PERSISTENT_BUILDERS) ? 'builders' : 'functions'
74

85
// These are paths in .next that shouldn't be publicly accessible
96
const HIDDEN_PATHS = [
@@ -23,5 +20,4 @@ module.exports = {
2320
IMAGE_FUNCTION_NAME,
2421
HANDLER_FUNCTION_NAME,
2522
ODB_FUNCTION_NAME,
26-
ODB_PATH,
2723
}

src/helpers/config.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ const defaultFailBuild = (message, { error }) => {
77
throw new Error(`${message}\n${error && error.stack}`)
88
}
99

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

12-
const ODB_FUNCTION_PATH = `/.netlify/${ODB_PATH}/${ODB_FUNCTION_NAME}`
12+
const ODB_FUNCTION_PATH = `/.netlify/builders/${ODB_FUNCTION_NAME}`
1313
const HANDLER_FUNCTION_PATH = `/.netlify/functions/${HANDLER_FUNCTION_NAME}`
1414

1515
const CATCH_ALL_REGEX = /\/\[\.{3}(.*)](.json)?$/

src/helpers/functions.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const { join, relative } = require('path')
22

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

5-
const { HANDLER_FUNCTION_NAME, ODB_FUNCTION_NAME, IMAGE_FUNCTION_NAME, ODB_PATH } = require('../constants')
5+
const { HANDLER_FUNCTION_NAME, ODB_FUNCTION_NAME, IMAGE_FUNCTION_NAME } = require('../constants')
66
const getHandler = require('../templates/getHandler')
77
const { getPageResolver } = require('../templates/getPageResolver')
88

@@ -78,7 +78,7 @@ exports.setupImageFunction = async ({
7878
},
7979
{
8080
from: `${basePath}/${IMAGE_FUNCTION_NAME}/*`,
81-
to: `/.netlify/${ODB_PATH}/${IMAGE_FUNCTION_NAME}`,
81+
to: `/.netlify/builders/${IMAGE_FUNCTION_NAME}`,
8282
status: 200,
8383
},
8484
)

test/__snapshots__/index.js.snap

+9-9
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ Array [
8181
Object {
8282
"from": "/_ipx/*",
8383
"status": 200,
84-
"to": "/.netlify/functions/_ipx",
84+
"to": "/.netlify/builders/_ipx",
8585
},
8686
Object {
8787
"force": true,
@@ -162,42 +162,42 @@ Array [
162162
Object {
163163
"from": "/getStaticProps/withFallback/:slug/*",
164164
"status": 200,
165-
"to": "/.netlify/functions/___netlify-odb-handler",
165+
"to": "/.netlify/builders/___netlify-odb-handler",
166166
},
167167
Object {
168168
"from": "/_next/data/build-id/getStaticProps/withFallback/:slug/*",
169169
"status": 200,
170-
"to": "/.netlify/functions/___netlify-odb-handler",
170+
"to": "/.netlify/builders/___netlify-odb-handler",
171171
},
172172
Object {
173173
"from": "/getStaticProps/withFallback/:id",
174174
"status": 200,
175-
"to": "/.netlify/functions/___netlify-odb-handler",
175+
"to": "/.netlify/builders/___netlify-odb-handler",
176176
},
177177
Object {
178178
"from": "/_next/data/build-id/getStaticProps/withFallback/:id.json",
179179
"status": 200,
180-
"to": "/.netlify/functions/___netlify-odb-handler",
180+
"to": "/.netlify/builders/___netlify-odb-handler",
181181
},
182182
Object {
183183
"from": "/getStaticProps/withFallbackBlocking/:id",
184184
"status": 200,
185-
"to": "/.netlify/functions/___netlify-odb-handler",
185+
"to": "/.netlify/builders/___netlify-odb-handler",
186186
},
187187
Object {
188188
"from": "/_next/data/build-id/getStaticProps/withFallbackBlocking/:id.json",
189189
"status": 200,
190-
"to": "/.netlify/functions/___netlify-odb-handler",
190+
"to": "/.netlify/builders/___netlify-odb-handler",
191191
},
192192
Object {
193193
"from": "/getStaticProps/withRevalidate/withFallback/:id",
194194
"status": 200,
195-
"to": "/.netlify/functions/___netlify-odb-handler",
195+
"to": "/.netlify/builders/___netlify-odb-handler",
196196
},
197197
Object {
198198
"from": "/_next/data/build-id/getStaticProps/withRevalidate/withFallback/:id.json",
199199
"status": 200,
200-
"to": "/.netlify/functions/___netlify-odb-handler",
200+
"to": "/.netlify/builders/___netlify-odb-handler",
201201
},
202202
Object {
203203
"from": "/*",

0 commit comments

Comments
 (0)