# @growing-web/dancf-provider

> Package Import Map Generation Tool

Latest version **0.4.5** (published 2023-06-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install @growing-web/dancf-provider
pnpm add @growing-web/dancf-provider
yarn add @growing-web/dancf-provider
bun add @growing-web/dancf-provider
```

## Health

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

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.4.5 |
| Published | 2023-06-29 |
| First published | 2022-03-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 9 |
| Unpacked size | 51.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Guy Bedford |
| Maintainers | vvben, aui |
| Keywords | jspm, import maps, es modules, cdn, package manager |

## Links

- npm: https://www.npmjs.com/package/@growing-web/dancf-provider
- Repository: https://github.com/growing-web/dancf-provider
- Homepage: https://github.com/growing-web/dancf-provider#readme
- Issues: https://github.com/growing-web/dancf-provider/issues
- npm.io page: https://npm.io/package/@growing-web/dancf-provider

## Dependencies (9)

- [sver](https://npm.io/package/sver.md) ^1.8.4
- [rimraf](https://npm.io/package/rimraf.md) ^5.0.1
- [@jspm/core](https://npm.io/package/@jspm/core.md) ^2.0.1
- [node-fetch](https://npm.io/package/node-fetch.md) ^3.3.1
- [ipfs-client](https://npm.io/package/ipfs-client.md) ^0.10.0
- [@jspm/generator](https://npm.io/package/@jspm/generator.md) 1.1.7
- [es-module-lexer](https://npm.io/package/es-module-lexer.md) ^1.2.1
- [@jspm/import-map](https://npm.io/package/@jspm/import-map.md) ^1.0.7
- [make-fetch-happen](https://npm.io/package/make-fetch-happen.md) ^11.1.1

## Recent versions

- 0.4.5 (latest) — 2023-06-29
- 0.4.4 — 2023-06-29
- 0.4.3 — 2023-06-27
- 0.4.2 — 2023-06-02
- 0.4.1 — 2023-05-22
- 0.4.0 — 2023-05-20
- 0.3.0 — 2023-05-19
- 0.2.1 — 2022-11-07
- 0.2.0 — 2022-10-31
- 0.1.0 — 2022-06-07
- 0.1.0-beta.1 — 2022-06-07
- 0.0.4 — 2022-04-12
- 0.0.3 — 2022-04-12
- 0.0.2 — 2022-04-12
- 0.0.1 — 2022-03-17

## README

# DANCF Provider

这是一个 Import Map 生成器的配置，CDN 的提供者将会设置为 dancf.com，它能够在全球加速访问 NPM 的包，包括中国。

## Getting Started

### 安装

Node.js:
```
npm install @jspm/generator
npm install @growing-web/dancf-provider
```

`@jspm/generator` only ships as an ES module, so to use it in Node.js add `"type": "module"` to your package.json file or write an `.mjs` to load it.

### 生成 Import Maps

By default the generator generates import maps against the JSPM CDN by treating the `defaultProvider: 'dancf'` option. This can be configured to other CDNs or sources including local `nodemodules`, see the next section on how to achieve this.

generate.mjs
```js
import { Generator } from '@jspm/generator';
import * as dancf from '@growing-web/dancf-provider';

const generator = new Generator({
  mapUrl: import.meta.url,
  env: ['production', 'browser', 'module'],
  defaultProvider: 'dancf',
  customProviders: {
    dancf
  }
});

// Install a new package into the import map
await generator.install('react-dom');

// Install a package version and subpath into the import map (installs lit/decorators.js)
await generator.install('lit@2/decorators.js');

// Install a package version to a custom alias
await generator.install({ alias: 'react16', target: 'react@16' });

// Install a specific subpath of a package
await generator.install({ target: 'lit@2', subpath: './html.js' });

// Install an export from a locally located package folder into the map
// The package.json is used to determine the exports and dependencies.
await generator.install({ alias: 'mypkg', target: './packages/local-pkg', subpath: './feature' });

console.log(JSON.stringify(generator.getMap(), null, 2));
/*
 * Outputs the import map:
 *
 * {
 *   "imports": {
 *     "lit/decorators.js": "https://es.dancf.com/npm:lit@2.0.0-rc.1/decorators.js",
 *     "lit/html.js": "https://es.dancf.com/npm:lit@2.0.0-rc.1/html.js",
 *     "mypkg/feature": "./packages/local-pkg/feature.js",
 *     "react": "./local/react.js",
 *     "react16": "https://es.dancf.com/npm:react@16.14.0/index.js",
 *     "react-dom": "https://es.dancf.com/npm:react-dom@17.0.2/index.js"
 *   },
 *   "scopes": { ... }
 * }
 */
```

更多使用说明：[jspm/generator](https://github.com/jspm/generator)

### License

MIT

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