Skip to content

Commit

Permalink
fix(deps): update dependency jwt-decode to v4 (#6617)
Browse files Browse the repository at this point in the history
* fix(deps): update dependency jwt-decode to v4

* chore: fix import syntax

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Mateusz Bocian <mateusz.bocian@netlify.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
3 people committed May 16, 2024
1 parent 14ec696 commit 0aa0544
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 16 deletions.
17 changes: 10 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
"isexe": "2.0.0",
"js-yaml": "4.1.0",
"jsonwebtoken": "9.0.2",
"jwt-decode": "3.1.2",
"jwt-decode": "4.0.0",
"lambda-local": "2.2.0",
"listr2": "7.0.2",
"locate-path": "7.2.0",
Expand Down
5 changes: 2 additions & 3 deletions src/lib/functions/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import path from 'path'
import express, { type RequestHandler } from 'express'
// @ts-expect-error TS(7016) FIXME: Could not find a declaration file for module 'expr... Remove this comment to see the full error message
import expressLogging from 'express-logging'
import jwtDecode from 'jwt-decode'
import { jwtDecode } from 'jwt-decode'

import type BaseCommand from '../../commands/base-command.js'
import type { $TSFixMe } from '../../commands/types.js'
Expand All @@ -22,13 +22,13 @@ import type { BlobsContext } from '../blobs/blobs.js'
import { headers as efHeaders } from '../edge-functions/headers.js'
import { getGeoLocation } from '../geo-location.js'

import { UNLINKED_SITE_MOCK_ID } from '../../utils/dev.js'
import { handleBackgroundFunction, handleBackgroundFunctionResult } from './background.js'
import { createFormSubmissionHandler } from './form-submissions-handler.js'
import { FunctionsRegistry } from './registry.js'
import { handleScheduledFunction } from './scheduled.js'
import { handleSynchronousFunction } from './synchronous.js'
import { shouldBase64Encode } from './utils.js'
import { UNLINKED_SITE_MOCK_ID } from '../../utils/dev.js'

// @ts-expect-error TS(7006) FIXME: Parameter 'headers' implicitly has an 'any' type.
const buildClientContext = function (headers) {
Expand All @@ -53,7 +53,6 @@ const buildClientContext = function (headers) {
try {
// This data is available on both the context root and under custom.netlify for retro-compatibility.
// In the future it will only be available in custom.netlify.
// @ts-expect-error
const user = jwtDecode(parts[1])

const netlifyContext = JSON.stringify({
Expand Down
9 changes: 4 additions & 5 deletions src/utils/proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import generateETag from 'etag'
import getAvailablePort from 'get-port'
import httpProxy from 'http-proxy'
import { createProxyMiddleware } from 'http-proxy-middleware'
import jwtDecode from 'jwt-decode'
import { jwtDecode } from 'jwt-decode'
import { locatePath } from 'locate-path'
import { Match } from 'netlify-redirector'
import pFilter from 'p-filter'
Expand All @@ -38,13 +38,13 @@ import { DEFAULT_FUNCTION_URL_EXPRESSION } from '../lib/functions/registry.js'
import { initializeProxy as initializeImageProxy, isImageRequest } from '../lib/images/proxy.js'
import renderErrorTemplate from '../lib/render-error-template.js'

import { NETLIFYDEVLOG, NETLIFYDEVWARN, log, chalk } from './command-helpers.js'
import { NETLIFYDEVLOG, NETLIFYDEVWARN, chalk, log } from './command-helpers.js'
import createStreamPromise from './create-stream-promise.js'
import { headersForPath, parseHeaders, NFFunctionName, NFRequestID, NFFunctionRoute } from './headers.js'
import { NFFunctionName, NFFunctionRoute, NFRequestID, headersForPath, parseHeaders } from './headers.js'
import { generateRequestID } from './request-id.js'
import { createRewriter, onChanges } from './rules-proxy.js'
import { signRedirect } from './sign-redirect.js'
import { Rewriter, Request, ServerSettings } from './types.js'
import { Request, Rewriter, ServerSettings } from './types.js'

const gunzip = util.promisify(zlib.gunzip)
const brotliDecompress = util.promisify(zlib.brotliDecompress)
Expand Down Expand Up @@ -264,7 +264,6 @@ const serveRedirect = async function ({
if (token) {
let jwtValue = {}
try {
// @ts-expect-error TS(2349) This expression is not callable
jwtValue = jwtDecode(token) || {}
} catch (error) {
// @ts-expect-error TS(2571) FIXME: Object is of type 'unknown'.
Expand Down

1 comment on commit 0aa0544

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📊 Benchmark results

  • Dependency count: 1,343
  • Package size: 313 MB
  • Number of ts-expect-error directives: 983

Please sign in to comment.