nextjs-server-modules
Advanced tools
Comparing version 1.2.3 to 1.3.0
#!/usr/bin/env node | ||
require("./lib/cli.js").default() | ||
require("./dist/lib/cli.js").default() |
import routes from "./generated_routes" | ||
import micro from "micro" | ||
import getPort from "get-port" | ||
import { apiResolver } from "./nextjs-middleware/api-utils" | ||
@@ -61,2 +60,3 @@ import { IncomingMessage } from "http" | ||
if (!module.parent) { | ||
console.log("starting server at http://localhost:3000") | ||
runServer({ port: 3000 }) | ||
@@ -63,0 +63,0 @@ } |
@@ -7,2 +7,3 @@ // Modified version of: https://github.com/vercel/next.js/blob/e8408c70863b6bcd05437ff92a19194788716722/packages/next/server/api-utils.ts | ||
import { NextApiRequest, NextApiResponse } from "../types/nextjs" | ||
import { serialize } from "cookie" | ||
@@ -394,4 +395,4 @@ export type NextApiRequestCookies = { [key: string]: string } | ||
const jsonwebtoken = | ||
require("next/dist/compiled/jsonwebtoken") as typeof import("jsonwebtoken") | ||
// const jsonwebtoken = | ||
// require("next/dist/compiled/jsonwebtoken") as typeof import("jsonwebtoken") | ||
let encryptedPreviewData: { | ||
@@ -401,6 +402,6 @@ data: string | ||
try { | ||
encryptedPreviewData = jsonwebtoken.verify( | ||
tokenPreviewData, | ||
options.previewModeSigningKey | ||
) as typeof encryptedPreviewData | ||
// encryptedPreviewData = jsonwebtoken.verify( | ||
// tokenPreviewData, | ||
// options.previewModeSigningKey | ||
// ) as typeof encryptedPreviewData | ||
} catch { | ||
@@ -412,16 +413,17 @@ // TODO: warn | ||
const decryptedPreviewData = decryptWithSecret( | ||
Buffer.from(options.previewModeEncryptionKey), | ||
encryptedPreviewData.data | ||
) | ||
// const decryptedPreviewData = decryptWithSecret( | ||
// Buffer.from(options.previewModeEncryptionKey), | ||
// encryptedPreviewData.data | ||
// ) | ||
try { | ||
// TODO: strict runtime type checking | ||
const data = JSON.parse(decryptedPreviewData) | ||
// const data = JSON.parse(decryptedPreviewData) | ||
// Cache lookup | ||
Object.defineProperty(req, SYMBOL_PREVIEW_DATA, { | ||
value: data, | ||
enumerable: false, | ||
}) | ||
return data | ||
// Object.defineProperty(req, SYMBOL_PREVIEW_DATA, { | ||
// value: data, | ||
// enumerable: false, | ||
// }) | ||
// return data | ||
return null | ||
} catch { | ||
@@ -480,4 +482,2 @@ return false | ||
const { serialize } = | ||
require("next/dist/compiled/cookie") as typeof import("cookie") | ||
const previous = res.getHeader("Set-Cookie") | ||
@@ -517,4 +517,2 @@ res.setHeader(`Set-Cookie`, [ | ||
const { serialize } = | ||
require("next/dist/compiled/cookie") as typeof import("cookie") | ||
const previous = res.getHeader("Set-Cookie") | ||
@@ -521,0 +519,0 @@ res.setHeader(`Set-Cookie`, [ |
{ | ||
"name": "nextjs-server-modules", | ||
"version": "1.2.3", | ||
"main": "index.js", | ||
"version": "1.3.0", | ||
"main": "bin.js", | ||
"repository": "git@github.com:hello-seam/nextjs-server-modules.git", | ||
"author": "seveibar <seveibar@gmail.com>", | ||
"scripts": { | ||
"build": "tsup --dts --sourcemap ./nsm ./lib" | ||
}, | ||
"bin": { | ||
@@ -26,2 +29,3 @@ "nsm": "./bin.js" | ||
"tempy": "1", | ||
"tsup": "^5.11.10", | ||
"typescript": "^4.5.4" | ||
@@ -31,2 +35,3 @@ }, | ||
"@seamapi/wrappers": "^1.0.1", | ||
"cookie": "^0.4.1", | ||
"debug": "^4.3.3", | ||
@@ -33,0 +38,0 @@ "execa": "^6.0.0", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
43221
23
1078
14
16
14
+ Addedcookie@^0.4.1
+ Addedcookie@0.4.2(transitive)