Skip to content

Commit

Permalink
fix: trying a last resort
Browse files Browse the repository at this point in the history
  • Loading branch information
stipsan committed Jul 29, 2022
1 parent 8dd6a5d commit 1cfc8ff
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 16 deletions.
3 changes: 2 additions & 1 deletion package-lock.json

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

8 changes: 0 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,5 @@
"verifyPackage": {
"eslintImports": false
}
},
"targets": {
"main": {
"includeNodeModules": [
"jsonwebtoken-esm",
"media-chrome"
]
}
}
}
19 changes: 12 additions & 7 deletions src/util/generateJwt.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import {sign} from 'jsonwebtoken-esm'
import type {SanityClient} from '@sanity/client'
// import {suspend} from 'suspend-react'
import {suspend} from 'suspend-react'

import {readSecrets} from './readSecrets'
import type {ThumbnailOptions, AnimatedThumbnailOptions} from './types'
import type {AnimatedThumbnailOptions, ThumbnailOptions} from './types'

export type Audience = 'g' | 's' | 't' | 'v'

Expand Down Expand Up @@ -31,12 +30,18 @@ export function generateJwt<T extends Audience>(
throw new TypeError('Missing signingKeyPrivate')
}

/*
const {sign}: {sign: typeof import('jsonwebtoken-esm/sign')['default']} = suspend(async () => {
// /*
const {sign}: {sign: typeof import('jsonwebtoken-esm/sign')['default']} = suspend(() => {
// eslint-disable-next-line @typescript-eslint/no-shadow
const {default: sign} = await import('jsonwebtoken-esm/sign')
// const {default: sign} = await import('jsonwebtoken-esm/sign')
// eslint-disable-next-line @typescript-eslint/no-shadow
return {sign: (payload: any, secret: any, options: any) => sign(payload, secret, options)}
return import(
/* webpackIgnore: true */
// @ts-expect-error -- TS don't like HRL classes in dynamic imports even though it's valid
new URL(
'https://cdn.skypack.dev/pin/[email protected]/mode=imports,min/optimized/jsonwebtoken-esm/sign.js'
)
)
}, ['sanity-plugin-mux-input', 'jsonwebtoken-esm/sign'])
// */

Expand Down

0 comments on commit 1cfc8ff

Please sign in to comment.