# npm-amd

> Scans installed npm modules, browserifies them if they are not AMD, and produce a path object to be consumed by RequireJS and the like.

Latest version **1.0.1** (published 2013-06-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install npm-amd
pnpm add npm-amd
yarn add npm-amd
bun add npm-amd
```

Provides the command `npm-amd`.

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2013-06-03 |
| First published | 2013-05-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.8.0 |
| Dependencies | 8 |
| Known vulnerabilities | 0 (+5 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Juan Pablo Kaniefsky |
| Maintainers | jpka |
| Keywords | browserify, amd, npm, package |

## Links

- npm: https://www.npmjs.com/package/npm-amd
- Repository: https://github.com/jpka/npm-amd
- npm.io page: https://npm.io/package/npm-amd

## Dependencies (8)

- [async](https://npm.io/package/async.md) ~0.2.9
- [sigmund](https://npm.io/package/sigmund.md) ~1.0.0
- [fs-extra](https://npm.io/package/fs-extra.md) ~0.6.1
- [minimatch](https://npm.io/package/minimatch.md) ~0.2.12
- [browserify](https://npm.io/package/browserify.md) ~2.13.2
- [browser-resolve](https://npm.io/package/browser-resolve.md) ~1.0.1
- [readable-stream](https://npm.io/package/readable-stream.md) ~1.0.2
- [module-investigator](https://npm.io/package/module-investigator.md) ~0.1.3

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2013-06-03
- 1.0.0 — 2013-05-31
- 0.4.6 — 2013-05-29
- 0.3.5 — 2013-05-29
- 0.2.5 — 2013-05-28
- 0.0.2 — 2013-05-27
- 0.0.1 — 2013-05-25

## README

Node utility intended to bridge npm modules and browser AMD consumers, it browserifies every installed browserifiable npm module and generates a paths hash to be used in a [RequireJS](http://requirejs.org/) configuration or the like.

# What it does

It resolves the entry files of the npm modules with [browser-resolve](https://github.com/shtylman/node-browser-resolve) to make use of the [browser](https://gist.github.com/shtylman/4339901) field if present. If the resolved file doesn't have AMD support it bundles it with [browserify](https://github.com/substack/node-browserify).
Finally it returns a paths object pointing the npm module's id's to the browserified bundle (wrapped in an AMD define), or to the original entry file if it already has AMD support.

It does caching via the bundle filename. The same module version with the same browserify options won't be processed twice unless the force option is used or the files deleted.

# Usage

```javascript
var stream = require("npm-amd")(options);
```

which returns a readable stream which will emit `[id, path]` for each processed module
([streams2](http://blog.nodejs.org/2012/12/20/streams2/) supported).

or

```javascript
require("npm-amd")(options, function(err, paths){});
```

which will return a buffered paths object like so:
```javascript
{
  "a": "path/to/a",
  "b": "path/to/b"
}
```

or just

```
node_modules/.bin/npm-amd
```

from the command line

options can be:

- `browserifyOptions: {/* browserify options */}`

- `force: true`, that disables the caching and rebrowserifies everything

- `map: function(filePath) {}`, a transform function that will be applied to each returned file path (useful in case you are using the callback)

- `match: [/* minimatch patterns */]`, that makes use of [minimatch](https://github.com/isaacs/minimatch) to filter the installed node modules before processing them. This can be used to exclude certain modules (with the use of the negative operator, i.e: `"!grunt-*"`) or to only process a few select ones or both. Take into consideration the patterns will be applied in the order in which they are given.

- `storagePath: some/path`, that specifies a destination for bundled modules, defaults to `npm_amd_bundles`

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