Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/npm-bundled/index.js')
-rw-r--r--node_modules/npm-bundled/index.js18
1 files changed, 13 insertions, 5 deletions
diff --git a/node_modules/npm-bundled/index.js b/node_modules/npm-bundled/index.js
index bde0acd16..197a1bcb9 100644
--- a/node_modules/npm-bundled/index.js
+++ b/node_modules/npm-bundled/index.js
@@ -10,6 +10,9 @@
const fs = require('fs')
const path = require('path')
const EE = require('events').EventEmitter
+// we don't care about the package bins, but we share a pj cache
+// with other modules that DO care about it, so keep it nice.
+const normalizePackageBin = require('npm-normalize-package-bin')
class BundleWalker extends EE {
constructor (opt) {
@@ -84,7 +87,7 @@ class BundleWalker extends EE {
onPackageJson (pj, data) {
try {
- this.package = JSON.parse(data + '')
+ this.package = normalizePackageBin(JSON.parse(data + ''))
} catch (er) {
return this.done()
}
@@ -92,17 +95,22 @@ class BundleWalker extends EE {
this.onPackage(this.package)
}
+ allDepsBundled (pkg) {
+ return Object.keys(pkg.dependencies || {}).concat(
+ Object.keys(pkg.optionalDependencies || {}))
+ }
+
onPackage (pkg) {
// all deps are bundled if we got here as a child.
// otherwise, only bundle bundledDeps
// Get a unique-ified array with a short-lived Set
- const bdRaw = this.parent
- ? Object.keys(pkg.dependencies || {}).concat(
- Object.keys(pkg.optionalDependencies || {}))
+ const bdRaw = this.parent ? this.allDepsBundled(pkg)
: pkg.bundleDependencies || pkg.bundledDependencies || []
const bd = Array.from(new Set(
- Array.isArray(bdRaw) ? bdRaw : Object.keys(bdRaw)))
+ Array.isArray(bdRaw) ? bdRaw
+ : bdRaw === true ? this.allDepsBundled(pkg)
+ : Object.keys(bdRaw)))
if (!bd.length)
return this.done()