提交 e11a7c13 编写于 作者: G Guy Bedford 提交者: Joe Haddad

jsonwebtoken

上级 3b36a371
......@@ -302,7 +302,7 @@ export function tryGetPreviewData(
const tokenPreviewData = cookies[COOKIE_NAME_PRERENDER_DATA]
const jsonwebtoken = require('jsonwebtoken') as typeof import('jsonwebtoken')
const jsonwebtoken = require('next/dist/compiled/jsonwebtoken') as typeof import('jsonwebtoken')
let encryptedPreviewData: string
try {
encryptedPreviewData = jsonwebtoken.verify(
......@@ -360,7 +360,7 @@ function setPreviewData<T>(
throw new Error('invariant: invalid previewModeSigningKey')
}
const jsonwebtoken = require('jsonwebtoken') as typeof import('jsonwebtoken')
const jsonwebtoken = require('next/dist/compiled/jsonwebtoken') as typeof import('jsonwebtoken')
const payload = jsonwebtoken.sign(
encryptWithSecret(
......
......@@ -71,7 +71,6 @@
"fork-ts-checker-webpack-plugin": "3.1.1",
"ignore-loader": "0.1.2",
"jest-worker": "24.9.0",
"jsonwebtoken": "8.5.1",
"launch-editor": "2.2.1",
"loader-utils": "2.0.0",
"lodash.curry": "4.1.1",
......@@ -193,6 +192,7 @@
"is-docker": "2.0.0",
"is-wsl": "2.1.1",
"json5": "2.1.2",
"jsonwebtoken": "8.5.1",
"nanoid": "2.0.3",
"resolve": "1.11.0",
"taskr": "1.1.0",
......
......@@ -370,6 +370,13 @@ export async function ncc_json5(task, opts) {
.target('dist/compiled/json5')
}
// eslint-disable-next-line camelcase
export async function ncc_jsonwebtoken(task, opts) {
await task
.source(opts.src || relative(__dirname, require.resolve('jsonwebtoken')))
.ncc({ packageName: 'jsonwebtoken' })
.target('dist/compiled/jsonwebtoken')
}
// eslint-disable-next-line camelcase
export async function ncc_nanoid(task, opts) {
await task
.source(opts.src || relative(__dirname, require.resolve('nanoid')))
......@@ -441,6 +448,7 @@ export async function precompile(task) {
'ncc_is_docker',
'ncc_is_wsl',
'ncc_json5',
'ncc_jsonwebtoken',
'ncc_nanoid',
'ncc_resolve',
'ncc_text_table',
......
......@@ -120,6 +120,10 @@ declare module 'next/dist/compiled/json5' {
import m from 'json5'
export = m
}
declare module 'next/dist/compiled/jsonwebtoken' {
import m from 'jsonwebtoken'
export = m
}
declare module 'next/dist/compiled/nanoid/index.js' {
function nanoid(size?: number): string
export = nanoid
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册