# skypin

> Convert NPM imports into Skypack Pinned URL's

Latest version **2.0.11** (published 2021-09-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install skypin
pnpm add skypin
yarn add skypin
bun add skypin
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.11 |
| Published | 2021-09-09 |
| First published | 2020-11-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >= 10 |
| Dependencies | 4 |
| Unpacked size | 17.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 9 |
| Author | Marshall Brandt |
| Maintainers | marshallcb |
| Keywords | skypack, cdn, pinned, performance, npm |

## Links

- npm: https://www.npmjs.com/package/skypin
- Repository: https://github.com/MarshallCB/skypin
- Homepage: https://github.com/MarshallCB/skypin#readme
- Issues: https://github.com/MarshallCB/skypin/issues
- npm.io page: https://npm.io/package/skypin

## Dependencies (4)

- [umap](https://npm.io/package/umap.md) ^1.0.2
- [escalade](https://npm.io/package/escalade.md) ^3.1.1
- [node-fetch](https://npm.io/package/node-fetch.md) ^2.6.1
- [resolve-cwd](https://npm.io/package/resolve-cwd.md) ^3.0.0

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 2.0.11 (latest) — 2021-09-09
- 2.0.10 — 2021-02-18
- 2.0.9 — 2021-01-17
- 2.0.8 — 2021-01-17
- 2.0.7 — 2020-12-15
- 2.0.6 — 2020-12-10
- 2.0.5 — 2020-12-10
- 2.0.4 — 2020-12-10
- 2.0.3 — 2020-12-10
- 2.0.2 — 2020-12-09
- 2.0.1 — 2020-12-09
- 2.0.0 — 2020-12-09
- 1.1.1 — 2020-11-30
- 1.1.0 — 2020-11-30
- 1.0.2 — 2020-11-26
- … 2 more at https://npm.io/package/skypin/versions

## README

<div align="center">
  <img src="https://github.com/marshallcb/skypin/raw/main/meta/skypin.png" alt="Skypin Logo" width="300" />
</div>

<h1 align="center">skypin</h1>

<h3 align="center">Convert NPM imports into Skypack Pinned URL's</h3>

<div align="center">
  <a href="https://npmjs.org/package/skypin">
    <img src="https://badgen.now.sh/npm/v/skypin" alt="version" />
  </a>
  <a href="https://packagephobia.com/result?p=skypin">
    <img src="https://badgen.net/packagephobia/install/skypin" alt="install size" />
  </a>
  <a href="https://bundlephobia.com/result?p=skypin">
    <img src="https://img.badgesize.io/MarshallCB/skypin/main/es.js?compression=brotli" alt="browser size" />
  </a>
</div>


## About

Skypack is a CDN built for browser modules. This module converts npm module id's into the optimized Skypack URL for optimal performance. Read more [here](https://docs.skypack.dev/skypack-cdn/api-reference/pinned-urls-optimized). This could be used in build tools (like [rollup](https://github.com/MarshallCB/rollup-plugin-skypin)) to convert source code into browser-optimized modules.

## Usage

**NodeJS**
```js
import { skypin } from 'skypin';

// Uses version of package found in node_modules (if it exists - otherwise 'latest')
await skypin('hueman')
// ~> https://cdn.skypack.dev/pin/hueman@v2.1.1-ElNqhC8YFxLlgRtjjL9o/min/hueman.js

await skypin('hueman', { pin: false })
// ~> https://cdn.skypack.dev/hueman@2.1.1

await skypin('hueman', { min: false })
// ~> https://cdn.skypack.dev/hueman@2.1.1

// Specify version directly
await skypin('hueman@2.0.0')
// ~> https://cdn.skypack.dev/pin/hueman@v2.0.0-Eh8v1x3dV0iEyJ9rG915/min/hueman.js

```

**Browser** [Codepen](https://codepen.io/marshallcb/pen/qBaaJRY?editors=0011)
```js
import { skypin } from 'https://cdn.skypack.dev/skypin'

await skypin('hueman')
```

## API

#### `skypin(module_id, options)` -> `URL`
- `module_id`: String that identifies the package in npm (`hueman`, `uhtml@latest`, `themepark@1.0.0`, etc.) (version number optional)
- `options`:
  - `pin`: Boolean (default `true`). Read more [here](https://docs.skypack.dev/skypack-cdn/api-reference/pinned-urls-optimized)
  - `min`: Boolean (default `true`). Based on normal vs. minified in skypack lookup page
- **Returns**: Promise that resolves to URL that can be used as an import statement in the browser

Uses the version of the package found in `node_modules`. Requires that the module has been installed to the current working directory. May take a few seconds if the package has not been "pinned" on skypack before.

## References

- [Skypack](https://skypack.dev/)

## License

MIT © [Marshall Brandt](https://m4r.sh)

---
_Source: https://npm.io/package/skypin · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
