Skip to content

Commit 7e794b1

Browse files
revert last change
1 parent ad88088 commit 7e794b1

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

patches/@greenwood+plugin-adapter-netlify+0.34.0-alpha.1.patch

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,28 @@
11
diff --git a/node_modules/@greenwood/plugin-adapter-netlify/src/index.js b/node_modules/@greenwood/plugin-adapter-netlify/src/index.js
2-
index 549448a..03fe986 100644
2+
index 549448a..6c407f8 100644
33
--- a/node_modules/@greenwood/plugin-adapter-netlify/src/index.js
44
+++ b/node_modules/@greenwood/plugin-adapter-netlify/src/index.js
5-
@@ -7,8 +7,14 @@ import {
5+
@@ -7,15 +7,26 @@ import {
66
import { zip } from "zip-a-folder";
77

88
// https://docs.netlify.com/functions/create/?fn-language=js
99
-function generateOutputFormat(id) {
1010
+function generateOutputFormat(id, type, segmentKey) {
1111
const handlerAlias = "$handler";
12+
-
1213
+ // TODO: use `URLPattern` for extracting props after we upgrade to Node24
1314
+ const extractProps = segmentKey
1415
+ ? type === 'page'
1516
+ ? `const props = { ${segmentKey}: rawUrl.split('/')[url.split('/').length - 2] }`
1617
+ : `const props = { ${segmentKey}: rawUrl.split('?')[0].split('/').pop() }`
1718
+ : 'const props = {}';
18-
19+
+ // const path = segment ? segment.pathname : route;
20+
+ // export const config = {
21+
+ // path: ['${path}']
22+
+ // };
1923
return `
2024
import { handler as ${handlerAlias} } from './${id}.js';
21-
@@ -16,6 +22,8 @@ function generateOutputFormat(id) {
25+
2226
export async function handler (event, context = {}) {
2327
const { rawUrl, body, headers = {}, httpMethod } = event;
2428
const contentType = headers['content-type'] || '';
@@ -27,7 +31,7 @@ index 549448a..03fe986 100644
2731
let format = body;
2832

2933
if (['GET', 'HEAD'].includes(httpMethod.toUpperCase())) {
30-
@@ -41,7 +49,11 @@ function generateOutputFormat(id) {
34+
@@ -41,7 +52,11 @@ function generateOutputFormat(id) {
3135
method: httpMethod,
3236
headers: new Headers(headers)
3337
});
@@ -40,7 +44,7 @@ index 549448a..03fe986 100644
4044

4145
return {
4246
statusCode: response.status,
43-
@@ -52,10 +64,10 @@ function generateOutputFormat(id) {
47+
@@ -52,10 +67,10 @@ function generateOutputFormat(id) {
4448
`;
4549
}
4650

@@ -53,7 +57,7 @@ index 549448a..03fe986 100644
5357

5458
await fs.mkdir(outputRoot, { recursive: true });
5559
await fs.writeFile(new URL(`./${filename}.js`, outputRoot), outputFormat);
56-
@@ -101,14 +113,14 @@ async function netlifyAdapter(compilation) {
60+
@@ -101,14 +116,14 @@ async function netlifyAdapter(compilation) {
5761
await fs.mkdir(adapterOutputUrl, { recursive: true });
5862

5963
for (const page of ssrPages) {
@@ -70,7 +74,7 @@ index 549448a..03fe986 100644
7074

7175
// handle user's actual route entry file
7276
await fs.cp(
73-
@@ -131,17 +143,21 @@ async function netlifyAdapter(compilation) {
77+
@@ -131,17 +146,21 @@ async function netlifyAdapter(compilation) {
7478
projectDirectory,
7579
);
7680

@@ -95,7 +99,7 @@ index 549448a..03fe986 100644
9599

96100
await fs.cp(new URL(outputHref), new URL(`./${id}.js`, outputRoot), { recursive: true });
97101

98-
@@ -155,11 +171,18 @@ async function netlifyAdapter(compilation) {
102+
@@ -155,11 +174,18 @@ async function netlifyAdapter(compilation) {
99103
// https://github.com/netlify/netlify-lambda/issues/90#issuecomment-486047201
100104
await createOutputZip(id, outputType, outputRoot, projectDirectory);
101105

0 commit comments

Comments
 (0)