Skip to content

Commit ee2b881

Browse files
committed
fix: test updates + remove preRender update
1 parent a8d4a32 commit ee2b881

File tree

5 files changed

+6
-13
lines changed

5 files changed

+6
-13
lines changed

packages/runtime/src/helpers/edge.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,6 @@ export const writeEdgeFunctions = async ({
462462
function: functionName,
463463
name: edgeFunctionDefinition.name,
464464
pattern,
465-
// cache: "manual" is currently experimental, so we restrict it to sites that use experimental appDir
466465
cache: 'manual',
467466
generator,
468467
})

packages/runtime/src/helpers/functions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import { getResolverForPages, getResolverForSourceFiles } from '../templates/get
2828
import { ApiConfig, extractConfigFromFile, isEdgeConfig } from './analysis'
2929
import { getRequiredServerFiles } from './config'
3030
import { getDependenciesOfFile, getServerFile, getSourceFileForPage } from './files'
31-
import { writeFunctionConfiguration, nextVersionNum } from './functionsMetaData'
31+
import { writeFunctionConfiguration, useRequireHooks } from './functionsMetaData'
3232
import { pack } from './pack'
3333
import { ApiRouteType } from './types'
3434
import { getFunctionNameForPage } from './utils'
@@ -132,7 +132,7 @@ export const generateFunctions = async (
132132
}
133133

134134
const writeHandler = async (functionName: string, functionTitle: string, isODB: boolean) => {
135-
const useHooks = await nextVersionNum()
135+
const useHooks = await useRequireHooks()
136136
const handlerSource = getHandler({
137137
isODB,
138138
publishDir,

packages/runtime/src/helpers/functionsMetaData.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const nextPluginVersion = async (module?: string) => {
3232

3333
export const getPluginVersion = async () => `${NEXT_PLUGIN_NAME}@${await nextPluginVersion()}`
3434

35-
export const nextVersionNum = async () => satisfies(await nextPluginVersion('next'), '13.3.3 - 13.4.9')
35+
export const useRequireHooks = async () => satisfies(await nextPluginVersion('next'), '13.3.3 - 13.4.9')
3636

3737
// The information needed to create a function configuration file
3838
export interface FunctionInfo {

packages/runtime/src/templates/server.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { join } from 'path'
21
// eslint-disable-next-line n/no-deprecated-api -- this is what Next.js uses as well
32
import { parse } from 'url'
43

@@ -36,16 +35,11 @@ const getNetlifyNextServer = (NextServer: NextServerType) => {
3635
return this.nextConfig.experimental?.serverActions ? 'experimental' : 'next'
3736
}
3837

39-
protected getManifest(manifest: string) {
40-
// eslint-disable-next-line import/no-dynamic-require
41-
return require(join(this.distDir, manifest))
42-
}
43-
4438
public constructor(options: Options, netlifyConfig: NetlifyConfig) {
4539
super(options)
4640
this.netlifyConfig = netlifyConfig
4741
// copy the prerender manifest so it doesn't get mutated by Next.js
48-
const manifest = this.getPrerenderManifest() || this.getManifest('prerender-manifest.json')
42+
const manifest = this.getPrerenderManifest()
4943
this.netlifyPrerenderManifest = {
5044
...manifest,
5145
routes: { ...manifest.routes },
@@ -96,7 +90,7 @@ const getNetlifyNextServer = (NextServer: NextServerType) => {
9690

9791
// doing what they do in https://github.com/vercel/vercel/blob/1663db7ca34d3dd99b57994f801fb30b72fbd2f3/packages/next/src/server-build.ts#L576-L580
9892
private async netlifyPrebundleReact(path: string, { basePath, trailingSlash }: NextConfig, parsedUrl) {
99-
const routesManifest = this.getRoutesManifest?.() || this.getManifest('routes-manifest.json')
93+
const routesManifest = this.getRoutesManifest?.()
10094
const appPathsRoutes = this.getAppPathRoutes?.()
10195
const routes = routesManifest && [...routesManifest.staticRoutes, ...routesManifest.dynamicRoutes]
10296
const matchedRoute = await getMatchedRoute(path, routes, parsedUrl, basePath, trailingSlash)

test/templates/server.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ describe('the netlify next server', () => {
296296
await requestHandler(new NodeNextRequest(mockReq), new NodeNextResponse(mockRes))
297297

298298
// eslint-disable-next-line no-underscore-dangle
299-
expect(process.env.__NEXT_PRIVATE_PREBUNDLED_REACT).toBe('')
299+
expect(process.env.__NEXT_PRIVATE_PREBUNDLED_REACT).toBeFalsy()
300300
})
301301

302302
it('resolves the prebundled react version for app routes', async () => {

0 commit comments

Comments
 (0)