This repository was archived by the owner on Mar 7, 2025. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 8787 "pinst" : " ^3.0.0" ,
8888 "prettier" : " ^3.0.3" ,
8989 "ts-node" : " ^10.9.1" ,
90- "tsup" : " ^7.2.0 " ,
90+ "tsup" : " ^8.0.2 " ,
9191 "typescript" : " ^5.3.3" ,
9292 "vitest" : " ^0.34.6"
9393 },
Original file line number Diff line number Diff line change 1- import PQueue , { QueueAddOptions } from 'p-queue' ;
1+ import type { default as PQueueType , QueueAddOptions } from 'p-queue' ;
22
33import { HttpError } from '../errors.js' ;
44
@@ -11,8 +11,13 @@ function isConcurrencyLimitError(err: unknown): err is HttpError {
1111 ) ;
1212}
1313
14+ const PQueue = ( async ( ) => {
15+ const lib = await import ( 'p-queue' ) ;
16+ return lib . default ;
17+ } ) ( ) ;
18+
1419export class ConcurrencyLimiter {
15- private _queue ?: PQueue ;
20+ private _queue ?: PQueueType ;
1621 private _limiterPromise ?: ReturnType < Limiter > ;
1722
1823 constructor ( private readonly limiter : Limiter ) { }
@@ -42,6 +47,6 @@ export class ConcurrencyLimiter {
4247
4348 this . _limiterPromise = this . limiter ( ) ;
4449 const { limit } = await this . _limiterPromise ;
45- this . _queue = new PQueue ( { concurrency : limit } ) ;
50+ this . _queue = new ( await PQueue ) ( { concurrency : limit } ) ;
4651 }
4752}
Original file line number Diff line number Diff line change 2929 "ts-node" : {
3030 "esm" : true
3131 }
32- }
32+ }
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ export default defineConfig({
1616 format : [ 'esm' , 'cjs' ] ,
1717 platform : 'node' ,
1818 shims : true ,
19+ splitting : true ,
1920 env : {
2021 NODE_ENV : 'production' ,
2122 GENAI_DEFAULT_ENDPOINT : GENAI_DEFAULT_ENDPOINT ,
You can’t perform that action at this time.
0 commit comments