Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

npx-import

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

npx-import - npm Package Compare versions

Comparing version 0.0.2 to 1.0.0

6

package.json
{
"name": "npx-import",
"version": "0.0.2",
"description": "NPX import: dynamically install & import packages at runtime, using NPX.",
"version": "1.0.0",
"description": "Runtime dependencies, installed as if by magic ✨",
"main": "lib/index.js",

@@ -17,3 +17,3 @@ "type": "module",

"license": "ISC",
"homepage": "https://github.com/geelen/import-on-demand",
"homepage": "https://github.com/geelen/npx-import",
"devDependencies": {

@@ -20,0 +20,0 @@ "@types/node": "^18.6.3",

@@ -5,3 +5,3 @@ # 🧙‍♂️ `npx-import` 🧙‍♀️

[![](https://img.shields.io/badge/author-@glenmaddern-blue.svg?style=flat)](https://twitter.com/glenmaddern) ![npm](https://img.shields.io/npm/v/npx-import) ![GitHub last commit](https://img.shields.io/github/last-commit/geelen/npx-import)
[![twitter](https://img.shields.io/badge/author-@glenmaddern-blue.svg?style=flat)](https://twitter.com/glenmaddern) [![npm](https://img.shields.io/npm/v/npx-import)](https://www.npmjs.com/package/npx-import) [![GitHub last commit](https://img.shields.io/github/last-commit/geelen/npx-import)](https://github.com/geelen/npx-import)

@@ -34,2 +34,3 @@ `npx-import` can be used as a drop-in replacement for [dynamic `import()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import):

export async function writeToFile(report: Report, filename: string) {
if (filename.endsWith('.png')) {

@@ -39,2 +40,3 @@ console.log(`This is a PNG! We'll have to compile imagemagick!`)

await magick.renderToPNG(report, filename)
} else if (filename.endsWith('.pdf')) {

@@ -44,2 +46,3 @@ console.log(`Argh, a PDF!? Go make a cuppa, this'll take a while...`)

await pdfBoi.generate(report, filename)
} else {

@@ -77,3 +80,3 @@ console.log(`Writing to ${filename}...`)

Most importantly, though **it's compatible with `npx`!** For example, `npx some-cli --help` can be super fast but `npx some-cli export --type=pdf` can transparently download the required dependencies during execution. It's super neat!
Most importantly, though, **it's compatible with `npx`!** For example, `npx some-cli --help` can be super fast but `npx some-cli export --type=pdf` can transparently download the required dependencies during execution. It's super neat!

@@ -100,3 +103,3 @@ ## Installation

const { default: bigDep } = await npxImport<{ default: BigDep }>('big-dep')
const bigDep = await npxImport<BigDep>('big-dep')
```

@@ -106,3 +109,3 @@

Since package versions are no longer tracked in your `package.json`, we recommend being explicit:
* Since package versions are no longer tracked in your `package.json`, we recommend being explicit:

@@ -115,3 +118,3 @@ ```ts

You can also install multiple packages at once:
* You can also install multiple packages at once:

@@ -129,3 +132,3 @@ ```ts

If you ever need the equivalent for `require.resolve` for a package, use `npxResolve`:
* Use `npxResolve` instead of `require.resolve` to get the path (local or temporary)

@@ -280,3 +283,3 @@ ```ts

- CLI packages that want to make `npx my-cli --help` or `npx my-cli init` really fast and dependency-free, but also allow `npx my-cli <cmd>` to pull in arbitrary deps on-demand, without forcing the user to stop, create a local directory, and install dev dependencies.
- Anything already making heavy use of `npx`. You're in the jungle already, baby.
- Anything already making heavy use of `npx`. You're in the jungle, baby.

@@ -283,0 +286,0 @@ ---

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc