@server/next 0.20.33 → 0.20.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@server/next",
3
- "version": "0.20.33",
3
+ "version": "0.20.35",
4
4
  "description": "A fully-fledged web server with routing, file uploads, sessions, static files, schema validation, websockets, testing, etc.",
5
5
  "homepage": "https://server-js.com/",
6
6
  "repository": "https://github.com/franciscop/server-next.git",
@@ -3,6 +3,7 @@ import { define, parseHeaders } from "../helpers/index.js";
3
3
  import parseBody from "./parseBody.js";
4
4
  import parseCookies from "./parseCookies.js";
5
5
 
6
+ // Headers come like [title1, value1, title2, value2, ...]
6
7
  // https://stackoverflow.com/a/54029307/938236
7
8
  const chunkArray = (arr, size) =>
8
9
  arr.length > size
@@ -48,6 +49,7 @@ export default async (request, options = {}, app) => {
48
49
 
49
50
  ctx.app = app;
50
51
  ctx.platform = app.platform;
52
+ ctx.machine = app.platform;
51
53
 
52
54
  return ctx;
53
55
  };
@@ -26,6 +26,7 @@ export default async (request, options = {}, app) => {
26
26
 
27
27
  ctx.app = app;
28
28
  ctx.platform = app.platform;
29
+ ctx.machine = app.platform;
29
30
 
30
31
  return ctx;
31
32
  };
@@ -15,10 +15,15 @@ function getRuntime() {
15
15
  }
16
16
 
17
17
  export default function getMachine() {
18
+ const provider = getProvider();
18
19
  return {
19
- provider: getProvider(),
20
+ provider,
20
21
  service: getService(),
21
22
  runtime: getRuntime(),
22
- production: process.env.NODE_ENV === "production",
23
+ // Can I cry now?
24
+ production:
25
+ provider === "netlify"
26
+ ? Netlify.env.get("NETLIFY_DEV") === "true"
27
+ : process.env.NODE_ENV === "production",
23
28
  };
24
29
  }
@@ -39,7 +39,7 @@ export default async function handleRequest(handlers, ctx) {
39
39
 
40
40
  // In Netlify, a non-response is perfectly valid, which would indicate
41
41
  // the edge function to just go ahead and consume the original resource
42
- if (ctx.machine.provider === "netlify") return;
42
+ if (ctx.platform.provider === "netlify") return;
43
43
 
44
44
  // In other environments, a non-response is wrong and we should 404 then
45
45
  return new Response("Not Found", { status: 404 });