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

jsonwebtoken

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