Skip to content

Commit 461b27a

Browse files
committed
add jsdocs
1 parent 23a5efc commit 461b27a

File tree

3 files changed

+30
-1
lines changed

3 files changed

+30
-1
lines changed

packages/@apphosting/adapter-nextjs/e2e/app.spec.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ describe("app", () => {
125125
);
126126
});
127127

128-
it("should have x-fah-adapter header on all routes", async () => {
128+
it("should have x-fah-adapter header and no x-fah-middleware header on all routes", async () => {
129129
const routes = [
130130
"/",
131131
"/ssg",
@@ -143,6 +143,11 @@ describe("app", () => {
143143
`nextjs-${adapterVersion}`,
144144
`Route ${route} missing x-fah-adapter header`,
145145
);
146+
assert.equal(
147+
response.headers.get("x-fah-middleware"),
148+
null,
149+
`Route ${route} should not have x-fah-middleware header`,
150+
);
146151
}
147152
});
148153
});

packages/@apphosting/adapter-nextjs/src/overrides.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
import { AdapterMetadata, MiddlewareManifest } from "./interfaces.js";
22
import { loadRouteManifest, writeRouteManifest, loadMiddlewareManifest } from "./utils.js";
33

4+
/**
5+
* Adds the route overrides to the route manifest.
6+
* @param appPath The path to the app directory.
7+
* @param distDir The path to the dist directory.
8+
* @param adapterMetadata The adapter metadata.
9+
*/
410
export async function addRouteOverrides(
511
appPath: string,
612
distDir: string,

packages/@apphosting/adapter-nextjs/src/utils.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,24 @@ export async function loadConfig(root: string, projectRoot: string): Promise<Nex
3535
return await loadConfig(PHASE_PRODUCTION_BUILD, root);
3636
}
3737

38+
/**
39+
* Loads the route manifest from the standalone directory.
40+
* @param standalonePath The path to the standalone directory.
41+
* @param distDir The path to the dist directory.
42+
* @returns The route manifest.
43+
*/
3844
export function loadRouteManifest(standalonePath: string, distDir: string): RoutesManifest {
3945
const manifestPath = join(standalonePath, distDir, ROUTES_MANIFEST);
4046
const json = readFileSync(manifestPath, "utf-8");
4147
return JSON.parse(json) as RoutesManifest;
4248
}
4349

50+
/**
51+
* Loads the middleware manifest from the standalone directory.
52+
* @param standalonePath The path to the standalone directory.
53+
* @param distDir The path to the dist directory.
54+
* @returns The middleware manifest.
55+
*/
4456
export function loadMiddlewareManifest(
4557
standalonePath: string,
4658
distDir: string,
@@ -50,6 +62,12 @@ export function loadMiddlewareManifest(
5062
return JSON.parse(json) as MiddlewareManifest;
5163
}
5264

65+
/**
66+
* Writes the route manifest to the standalone directory.
67+
* @param standalonePath The path to the standalone directory.
68+
* @param distDir The path to the dist directory.
69+
* @param customManifest The route manifest to write.
70+
*/
5371
export async function writeRouteManifest(
5472
standalonePath: string,
5573
distDir: string,

0 commit comments

Comments
 (0)