File tree Expand file tree Collapse file tree 3 files changed +18
-6
lines changed Expand file tree Collapse file tree 3 files changed +18
-6
lines changed Original file line number Diff line number Diff line change 11import createDebug from 'debug' ;
2- import memoizer from 'lru-memoizer' ;
32import { promisify , callbackify } from 'util' ;
43
4+ // CJS import workaround for lru-memoizer
5+ import { createRequire } from 'module' ;
6+ const require = createRequire ( import . meta. url ) ;
7+ const memoizer = require ( 'lru-memoizer' ) ;
8+
59const logger = createDebug ( 'jwks' ) ;
10+
611function cacheWrapper ( client , { cacheMaxEntries = 5 , cacheMaxAge = 600000 } ) {
712 logger ( `Configured caching of signing keys. Max: ${ cacheMaxEntries } / Age: ${ cacheMaxAge } ` ) ;
813 return promisify ( memoizer ( {
Original file line number Diff line number Diff line change 11import createDebug from 'debug' ;
2- import limiterPkg from 'limiter' ;
2+
3+ // CJS → named export for limiter
4+ import { createRequire } from 'module' ;
5+ const require = createRequire ( import . meta. url ) ;
6+ const { RateLimiter } = require ( 'limiter' ) ;
7+
38import JwksRateLimitError from '../errors/JwksRateLimitError.js' ;
49
5- const { RateLimiter } = limiterPkg ;
610const logger = createDebug ( 'jwks' ) ;
711function rateLimitWrapper ( client , { jwksRequestsPerMinute = 10 } ) {
812 const getSigningKey = client . getSigningKey . bind ( client ) ;
Original file line number Diff line number Diff line change 1- import http from 'http' ;
2- import https from 'https' ;
3- import urlUtil from 'url' ;
1+ // CommonJS imports
2+ import { createRequire } from 'module' ;
3+ const require = createRequire ( import . meta. url ) ;
4+ const http = require ( 'http' ) ;
5+ const https = require ( 'https' ) ;
6+ const urlUtil = require ( 'url' ) ;
47
58const request = ( options ) => {
69 if ( options . fetcher ) {
You can’t perform that action at this time.
0 commit comments