How to use the @pnpm/package-requester function in @pnpm/package-requester

To help you get started, we’ve selected a few @pnpm/package-requester examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pnpm / pnpm / packages / package-store / src / storeController / index.ts View on Github external
networkConcurrency?: number,
    packageImportMethod?: 'auto' | 'hardlink' | 'copy' | 'clone',
    verifyStoreIntegrity: boolean,
  },
): Promise void, saveStateSync: () => void }> {
  const storeDir = initOpts.storeDir
  const unlock = initOpts.locks
    ? await lock(initOpts.storeDir, {
      locks: initOpts.locks,
      stale: initOpts.lockStaleDuration || 60 * 1000, // 1 minute,
      whenLocked: () => globalWarn(`waiting for the store at "${initOpts.storeDir}" to be unlocked...`),
    })
    : null

  const storeIndex = await readStore(initOpts.storeDir) || {}
  const packageRequester = createPackageRequester(resolve, fetchers, {
    networkConcurrency: initOpts.networkConcurrency,
    storeDir: initOpts.storeDir,
    storeIndex,
    verifyStoreIntegrity: initOpts.verifyStoreIntegrity,
  })

  return {
    close: unlock ? async () => { await unlock() } : () => Promise.resolve(undefined),
    closeSync: unlock ? () => unlock.sync() : () => undefined,
    fetchPackage: packageRequester.fetchPackageToStore,
    findPackageUsages,
    getPackageLocation,
    importPackage: createImportPackage(initOpts.packageImportMethod),
    prune,
    requestPackage: packageRequester.requestPackage,
    saveState: saveStore.bind(null, initOpts.storeDir, storeIndex),

@pnpm/package-requester

Concurrent downloader of npm-compatible packages

MIT
Latest version published 8 days ago

Package Health Score

63 / 100
Full package analysis

Popular @pnpm/package-requester functions