• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..20-Sep-2020-

LICENSEH A D26-Oct-1985756 1612

README.mdH A D26-Oct-19851.7 KiB4937

package.jsonH A D20-Sep-20201.7 KiB6362

README.md

1# npm-bundled
2
3Run this in a node package, and it'll tell you which things in
4node_modules are bundledDependencies, or transitive dependencies of
5bundled dependencies.
6
7[![Build Status](https://travis-ci.org/npm/npm-bundled.svg?branch=master)](https://travis-ci.org/npm/npm-bundled)
8
9## USAGE
10
11To get the list of deps at the top level that are bundled (or
12transitive deps of a bundled dep) run this:
13
14```js
15const bundled = require('npm-bundled')
16
17// async version
18bundled({ path: '/path/to/pkg/defaults/to/cwd'}, (er, list) => {
19  // er means it had an error, which is _hella_ weird
20  // list is a list of package names, like `fooblz` or `@corp/blerg`
21  // the might not all be deps of the top level, because transitives
22})
23
24// async promise version
25bundled({ path: '/path/to/pkg/defaults/to/cwd'}).then(list => {
26  // so promisey!
27  // actually the callback version returns a promise, too, it just
28  // attaches the supplied callback to the promise
29})
30
31// sync version, throws if there's an error
32const list = bundled({ path: '/path/to/pkg/defaults/to/cwd'})
33```
34
35That's basically all you need to know.  If you care to dig into it,
36you can also use the `bundled.Walker` and `bundled.WalkerSync`
37classes to get fancy.
38
39This library does not write anything to the filesystem, but it _may_
40have undefined behavior if the structure of `node_modules` changes
41while it's reading deps.
42
43All symlinks are followed.  This means that it can lead to surprising
44results if a symlinked bundled dependency has a missing dependency
45that is satisfied at the top level.  Since package creation resolves
46symlinks as well, this is an edge case where package creation and
47development environment are not going to be aligned, and is best
48avoided.
49