Licence
MIT
Version
2.1.0
Deps
6
Size
22 kB
Vulns
0
Weekly
0
fly-import
Install and import packages on-the-fly
Usage
Supports many different specifications.
import { flyImport } from 'fly-import';
const { flyImport: flyImport2 } = await flyImport('fly-import@0.1.2');
const { flyInstall } = await 'fly-import2@npm:fly-import@0.1.2';
console.log(await flyInstall('camelcase-git@github:sindresorhus/camelcase#v7.0.1'));
Import a subpath of a package, resolved through its exports when it declares them:
import { flyImport } from 'fly-import';
const { customAlphabet } = await flyImport('nanoid@5', { subpath: 'non-secure' });
Abort an install with a signal, which cancels its registry requests:
import { flyImport } from 'fly-import';
const { default: camelcase } = await flyImport('camelcase@8', { signal: AbortSignal.timeout(60_000) });
Bins of installed packages are not linked, pass arboristConfig: { binLinks: true } to link them at <repositoryPath>/../bin (<repositoryPath> on Windows).
License
MIT