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:
authorKenan Yildirim <kenan@kenany.me>2015-03-19 19:19:58 +0300
committerForrest L Norvell <forrest@npmjs.com>2015-03-20 10:33:33 +0300
commit3ce3cc242fc345bca6820185a4f5a013c5bc1944 (patch)
treef72483ca1dea709cb9f7c0a1b112264fbb17311f /node_modules/fstream-npm
parentbd72c47ce8c58e287d496902c11845c8fea420d6 (diff)
fstream-npm@1.0.2
Error out with a more descriptive message when `bundledDependencies` isn't an array. Includes a test for npm. Also converted to `standard` style.
Diffstat (limited to 'node_modules/fstream-npm')
-rw-r--r--node_modules/fstream-npm/.npmignore1
-rw-r--r--node_modules/fstream-npm/example/dir-tar.js18
-rw-r--r--node_modules/fstream-npm/example/dir.js26
-rw-r--r--node_modules/fstream-npm/example/example.js14
-rw-r--r--node_modules/fstream-npm/example/ig-tar.js18
-rw-r--r--node_modules/fstream-npm/example/tar.js20
-rw-r--r--node_modules/fstream-npm/fstream-npm.js140
-rw-r--r--node_modules/fstream-npm/node_modules/fstream-ignore/package.json3
-rw-r--r--node_modules/fstream-npm/package.json37
9 files changed, 136 insertions, 141 deletions
diff --git a/node_modules/fstream-npm/.npmignore b/node_modules/fstream-npm/.npmignore
index 06aea6917..c02f40cee 100644
--- a/node_modules/fstream-npm/.npmignore
+++ b/node_modules/fstream-npm/.npmignore
@@ -1,2 +1,3 @@
# ignore the output junk from the example scripts
example/output
+node_modules/
diff --git a/node_modules/fstream-npm/example/dir-tar.js b/node_modules/fstream-npm/example/dir-tar.js
index f2bad92e0..393c796b2 100644
--- a/node_modules/fstream-npm/example/dir-tar.js
+++ b/node_modules/fstream-npm/example/dir-tar.js
@@ -1,18 +1,18 @@
// this will show what ends up in the fstream-npm package
-var P = require("fstream").DirReader
-var tar = require("tar")
+var P = require('fstream').DirReader
+var tar = require('tar')
function f (entry) {
- return entry.basename !== ".git"
+ return entry.basename !== '.git'
}
-new P({ path: "./", type: "Directory", Directory: true, filter: f })
- .on("package", function (p) {
- console.error("package", p)
+new P({ path: './', type: 'Directory', Directory: true, filter: f })
+ .on('package', function (p) {
+ console.error('package', p)
})
- .on("ignoreFile", function (e) {
- console.error("ignoreFile", e)
+ .on('ignoreFile', function (e) {
+ console.error('ignoreFile', e)
})
- .on("entry", function (e) {
+ .on('entry', function (e) {
console.error(e.constructor.name, e.path.substr(e.root.path.length + 1))
})
.pipe(tar.Pack())
diff --git a/node_modules/fstream-npm/example/dir.js b/node_modules/fstream-npm/example/dir.js
index 75e2eed0f..e524a3bfd 100644
--- a/node_modules/fstream-npm/example/dir.js
+++ b/node_modules/fstream-npm/example/dir.js
@@ -1,25 +1,25 @@
// this will show what ends up in the fstream-npm package
-var P = require("../")
-var DW = require("fstream").DirWriter
+var P = require('../')
+var DW = require('fstream').DirWriter
-var target = new DW({ Directory: true, type: "Directory",
- path: __dirname + "/output"})
+var target = new DW({ Directory: true, type: 'Directory',
+ path: __dirname + '/output'})
function f (entry) {
- return entry.basename !== ".git"
+ return entry.basename !== '.git'
}
-P({ path: "./", type: "Directory", isDirectory: true, filter: f })
- .on("package", function (p) {
- console.error("package", p)
+P({ path: './', type: 'Directory', isDirectory: true, filter: f })
+ .on('package', function (p) {
+ console.error('package', p)
})
- .on("ignoreFile", function (e) {
- console.error("ignoreFile", e)
+ .on('ignoreFile', function (e) {
+ console.error('ignoreFile', e)
})
- .on("entry", function (e) {
+ .on('entry', function (e) {
console.error(e.constructor.name, e.path)
})
.pipe(target)
- .on("end", function () {
- console.error("ended")
+ .on('end', function () {
+ console.error('ended')
})
diff --git a/node_modules/fstream-npm/example/example.js b/node_modules/fstream-npm/example/example.js
index 0b53931ca..2c933c440 100644
--- a/node_modules/fstream-npm/example/example.js
+++ b/node_modules/fstream-npm/example/example.js
@@ -1,12 +1,12 @@
// this will show what ends up in the fstream-npm package
-var P = require("../")
-P({ path: "./" })
- .on("package", function (p) {
- console.error("package", p)
+var P = require('../')
+P({ path: './' })
+ .on('package', function (p) {
+ console.error('package', p)
})
- .on("ignoreFile", function (e) {
- console.error("ignoreFile", e)
+ .on('ignoreFile', function (e) {
+ console.error('ignoreFile', e)
})
- .on("entry", function (e) {
+ .on('entry', function (e) {
console.error(e.constructor.name, e.path.substr(e.root.dirname.length + 1))
})
diff --git a/node_modules/fstream-npm/example/ig-tar.js b/node_modules/fstream-npm/example/ig-tar.js
index c1db81050..7a5b61fba 100644
--- a/node_modules/fstream-npm/example/ig-tar.js
+++ b/node_modules/fstream-npm/example/ig-tar.js
@@ -1,18 +1,18 @@
// this will show what ends up in the fstream-npm package
-var P = require("fstream-ignore")
-var tar = require("tar")
+var P = require('fstream-ignore')
+var tar = require('tar')
function f (entry) {
- return entry.basename !== ".git"
+ return entry.basename !== '.git'
}
-new P({ path: "./", type: "Directory", Directory: true, filter: f })
- .on("package", function (p) {
- console.error("package", p)
+new P({ path: './', type: 'Directory', Directory: true, filter: f })
+ .on('package', function (p) {
+ console.error('package', p)
})
- .on("ignoreFile", function (e) {
- console.error("ignoreFile", e)
+ .on('ignoreFile', function (e) {
+ console.error('ignoreFile', e)
})
- .on("entry", function (e) {
+ .on('entry', function (e) {
console.error(e.constructor.name, e.path.substr(e.root.path.length + 1))
})
.pipe(tar.Pack())
diff --git a/node_modules/fstream-npm/example/tar.js b/node_modules/fstream-npm/example/tar.js
index f9bcaea81..b7f7e5f04 100644
--- a/node_modules/fstream-npm/example/tar.js
+++ b/node_modules/fstream-npm/example/tar.js
@@ -1,6 +1,6 @@
// this will show what ends up in the fstream-npm package
-var P = require("../")
-var tar = require("tar")
+var P = require('../')
+var tar = require('tar')
function f () {
return true
}
@@ -8,18 +8,18 @@ function f () {
// return entry.basename !== ".git"
// }
-new P({ path: "./", type: "Directory", isDirectory: true, filter: f })
- .on("package", function (p) {
- console.error("package", p)
+new P({ path: './', type: 'Directory', isDirectory: true, filter: f })
+ .on('package', function (p) {
+ console.error('package', p)
})
- .on("ignoreFile", function (e) {
- console.error("ignoreFile", e)
+ .on('ignoreFile', function (e) {
+ console.error('ignoreFile', e)
})
- .on("entry", function (e) {
+ .on('entry', function (e) {
console.error(e.constructor.name, e.path)
})
- .on("end", function () {
- console.error("ended")
+ .on('end', function () {
+ console.error('ended')
})
.pipe(tar.Pack())
.pipe(process.stdout)
diff --git a/node_modules/fstream-npm/fstream-npm.js b/node_modules/fstream-npm/fstream-npm.js
index 863f58845..7e44072bc 100644
--- a/node_modules/fstream-npm/fstream-npm.js
+++ b/node_modules/fstream-npm/fstream-npm.js
@@ -1,7 +1,7 @@
-var Ignore = require("fstream-ignore")
-, inherits = require("inherits")
-, path = require("path")
-, fs = require("fs")
+var Ignore = require('fstream-ignore')
+var inherits = require('inherits')
+var path = require('path')
+var fs = require('fs')
module.exports = Packer
@@ -12,13 +12,13 @@ function Packer (props) {
return new Packer(props)
}
- if (typeof props === "string") {
+ if (typeof props === 'string') {
props = { path: props }
}
- props.ignoreFiles = props.ignoreFiles || [ ".npmignore",
- ".gitignore",
- "package.json" ]
+ props.ignoreFiles = props.ignoreFiles || [ '.npmignore',
+ '.gitignore',
+ 'package.json' ]
Ignore.call(this, props)
@@ -30,7 +30,7 @@ function Packer (props) {
// lives right next to a package.json file.
this.bundleMagic = this.parent &&
this.parent.packageRoot &&
- this.basename === "node_modules"
+ this.basename === 'node_modules'
// in a node_modules folder, resolve symbolic links to
// bundled dependencies when creating the package.
@@ -40,42 +40,44 @@ function Packer (props) {
if (this === this.root ||
this.parent &&
this.parent.bundleMagic &&
- this.basename.charAt(0) !== ".") {
+ this.basename.charAt(0) !== '.') {
this.readBundledLinks()
}
-
- this.on("entryStat", function (entry, props) {
+ this.on('entryStat', function (entry, props) {
// files should *always* get into tarballs
// in a user-writable state, even if they're
// being installed from some wackey vm-mounted
// read-only filesystem.
- entry.mode = props.mode = props.mode | 0200
+ entry.mode = props.mode = props.mode | parseInt('0200', 8)
})
}
Packer.prototype.readBundledLinks = function () {
if (this._paused) {
- this.once("resume", this.addIgnoreFiles)
+ this.once('resume', this.addIgnoreFiles)
return
}
this.pause()
- fs.readdir(this.path + "/node_modules", function (er, list) {
+ fs.readdir(this.path + '/node_modules', function (er, list) {
// no harm if there's no bundle
var l = list && list.length
if (er || l === 0) return this.resume()
var errState = null
- , then = function then (er) {
+ var then = function then (er) {
if (errState) return
- if (er) return errState = er, this.resume()
- if (-- l === 0) return this.resume()
+ if (er) {
+ errState = er
+ return this.resume()
+ }
+ if (--l === 0) return this.resume()
}.bind(this)
list.forEach(function (pkg) {
- if (pkg.charAt(0) === ".") return then()
- var pd = this.path + "/node_modules/" + pkg
+ if (pkg.charAt(0) === '.') return then()
+ var pd = this.path + '/node_modules/' + pkg
fs.realpath(pd, function (er, rp) {
if (er) return then()
this.bundleLinks = this.bundleLinks || {}
@@ -88,7 +90,7 @@ Packer.prototype.readBundledLinks = function () {
Packer.prototype.applyIgnores = function (entry, partial, entryObj) {
// package.json files can never be ignored.
- if (entry === "package.json") return true
+ if (entry === 'package.json') return true
// readme files should never be ignored.
if (entry.match(/^readme(\.[^\.]*)$/i)) return true
@@ -100,19 +102,19 @@ Packer.prototype.applyIgnores = function (entry, partial, entryObj) {
if (entry.match(/^(changes|changelog|history)(\.[^\.]*)?$/i)) return true
// special rules. see below.
- if (entry === "node_modules" && this.packageRoot) return true
+ if (entry === 'node_modules' && this.packageRoot) return true
// some files are *never* allowed under any circumstances
- if (entry === ".git" ||
- entry === ".lock-wscript" ||
+ if (entry === '.git' ||
+ entry === '.lock-wscript' ||
entry.match(/^\.wafpickle-[0-9]+$/) ||
- entry === "CVS" ||
- entry === ".svn" ||
- entry === ".hg" ||
+ entry === 'CVS' ||
+ entry === '.svn' ||
+ entry === '.hg' ||
entry.match(/^\..*\.swp$/) ||
- entry === ".DS_Store" ||
+ entry === '.DS_Store' ||
entry.match(/^\._/) ||
- entry === "npm-debug.log"
+ entry === 'npm-debug.log'
) {
return false
}
@@ -127,13 +129,12 @@ Packer.prototype.applyIgnores = function (entry, partial, entryObj) {
// if they're not already present at a higher level.
if (this.bundleMagic) {
// bubbling up. stop here and allow anything the bundled pkg allows
- if (entry.indexOf("/") !== -1) return true
+ if (entry.indexOf('/') !== -1) return true
// never include the .bin. It's typically full of platform-specific
// stuff like symlinks and .cmd files anyway.
- if (entry === ".bin") return false
+ if (entry === '.bin') return false
- var shouldBundle = false
// the package root.
var p = this.parent
// the package before this one.
@@ -149,12 +150,18 @@ Packer.prototype.applyIgnores = function (entry, partial, entryObj) {
// since it's *not* a symbolic link, if we're *already* in a bundle,
// then we should include everything.
- if (pp && pp.package && pp.basename === "node_modules") {
+ if (pp && pp.package && pp.basename === 'node_modules') {
return true
}
// only include it at this point if it's a bundleDependency
var bd = this.package && this.package.bundleDependencies
+
+ if (bd && !Array.isArray(bd)) {
+ throw new Error(this.package.name + '\'s `bundledDependencies` should ' +
+ 'be an array')
+ }
+
var shouldBundle = bd && bd.indexOf(entry) !== -1
// if we're not going to bundle it, then it doesn't count as a bundleLink
// if (this.bundleLinks && !shouldBundle) delete this.bundleLinks[entry]
@@ -169,8 +176,8 @@ Packer.prototype.addIgnoreFiles = function () {
var entries = this.entries
// if there's a .npmignore, then we do *not* want to
// read the .gitignore.
- if (-1 !== entries.indexOf(".npmignore")) {
- var i = entries.indexOf(".gitignore")
+ if (entries.indexOf('.npmignore') !== -1) {
+ var i = entries.indexOf('.gitignore')
if (i !== -1) {
entries.splice(i, 1)
}
@@ -181,9 +188,8 @@ Packer.prototype.addIgnoreFiles = function () {
Ignore.prototype.addIgnoreFiles.call(this)
}
-
Packer.prototype.readRules = function (buf, e) {
- if (e !== "package.json") {
+ if (e !== 'package.json') {
return Ignore.prototype.readRules.call(this, buf, e)
}
@@ -204,7 +210,7 @@ Packer.prototype.readRules = function (buf, e) {
}
this.packageRoot = true
- this.emit("package", p)
+ this.emit('package', p)
// make bundle deps predictable
if (p.bundledDependencies && !p.bundleDependencies) {
@@ -215,10 +221,10 @@ Packer.prototype.readRules = function (buf, e) {
if (!p.files || !Array.isArray(p.files)) return []
// ignore everything except what's in the files array.
- return ["*"].concat(p.files.map(function (f) {
- return "!" + f
+ return ['*'].concat(p.files.map(function (f) {
+ return '!' + f
})).concat(p.files.map(function (f) {
- return "!" + f.replace(/\/+$/, "") + "/**"
+ return '!' + f.replace(/\/+$/, '') + '/**'
}))
}
@@ -242,20 +248,20 @@ Packer.prototype.getChildProps = function (stat) {
return props
}
-
-var order =
- [ "package.json"
- , ".npmignore"
- , ".gitignore"
- , /^README(\.md)?$/
- , "LICENCE"
- , "LICENSE"
- , /\.js$/ ]
+var order = [
+ 'package.json',
+ '.npmignore',
+ '.gitignore',
+ /^README(\.md)?$/,
+ 'LICENCE',
+ 'LICENSE',
+ /\.js$/
+]
Packer.prototype.sort = function (a, b) {
- for (var i = 0, l = order.length; i < l; i ++) {
+ for (var i = 0, l = order.length; i < l; i++) {
var o = order[i]
- if (typeof o === "string") {
+ if (typeof o === 'string') {
if (a === o) return -1
if (b === o) return 1
} else {
@@ -265,46 +271,44 @@ Packer.prototype.sort = function (a, b) {
}
// deps go in the back
- if (a === "node_modules") return 1
- if (b === "node_modules") return -1
+ if (a === 'node_modules') return 1
+ if (b === 'node_modules') return -1
return Ignore.prototype.sort.call(this, a, b)
}
-
-
Packer.prototype.emitEntry = function (entry) {
if (this._paused) {
- this.once("resume", this.emitEntry.bind(this, entry))
+ this.once('resume', this.emitEntry.bind(this, entry))
return
}
// if there is a .gitignore, then we're going to
// rename it to .npmignore in the output.
- if (entry.basename === ".gitignore") {
- entry.basename = ".npmignore"
+ if (entry.basename === '.gitignore') {
+ entry.basename = '.npmignore'
entry.path = path.resolve(entry.dirname, entry.basename)
}
// all *.gyp files are renamed to binding.gyp for node-gyp
// but only when they are in the same folder as a package.json file.
if (entry.basename.match(/\.gyp$/) &&
- this.entries.indexOf("package.json") !== -1) {
- entry.basename = "binding.gyp"
+ this.entries.indexOf('package.json') !== -1) {
+ entry.basename = 'binding.gyp'
entry.path = path.resolve(entry.dirname, entry.basename)
}
// skip over symbolic links
- if (entry.type === "SymbolicLink") {
+ if (entry.type === 'SymbolicLink') {
entry.abort()
return
}
- if (entry.type !== "Directory") {
+ if (entry.type !== 'Directory') {
// make it so that the folder in the tarball is named "package"
var h = path.dirname((entry.root || entry).path)
- , t = entry.path.substr(h.length + 1).replace(/^[^\/\\]+/, "package")
- , p = h + "/" + t
+ var t = entry.path.substr(h.length + 1).replace(/^[^\/\\]+/, 'package')
+ var p = h + '/' + t
entry.path = p
entry.dirname = path.dirname(p)
@@ -319,11 +323,11 @@ Packer.prototype.emitEntry = function (entry) {
// .pipe() doesn't do anythign special with "child" events, on
// with "entry" events.
var me = this
- entry.on("entry", function (e) {
+ entry.on('entry', function (e) {
if (e.parent === entry) {
e.parent = me
- me.emit("entry", e)
+ me.emit('entry', e)
}
})
- entry.on("package", this.emit.bind(this, "package"))
+ entry.on('package', this.emit.bind(this, 'package'))
}
diff --git a/node_modules/fstream-npm/node_modules/fstream-ignore/package.json b/node_modules/fstream-npm/node_modules/fstream-ignore/package.json
index 161b82564..1a505bd4a 100644
--- a/node_modules/fstream-npm/node_modules/fstream-ignore/package.json
+++ b/node_modules/fstream-npm/node_modules/fstream-ignore/package.json
@@ -51,5 +51,6 @@
"tarball": "http://registry.npmjs.org/fstream-ignore/-/fstream-ignore-1.0.2.tgz"
},
"directories": {},
- "_resolved": "https://registry.npmjs.org/fstream-ignore/-/fstream-ignore-1.0.2.tgz"
+ "_resolved": "https://registry.npmjs.org/fstream-ignore/-/fstream-ignore-1.0.2.tgz",
+ "readme": "ERROR: No README data found!"
}
diff --git a/node_modules/fstream-npm/package.json b/node_modules/fstream-npm/package.json
index 6b2ccc99d..f3c5d3cfc 100644
--- a/node_modules/fstream-npm/package.json
+++ b/node_modules/fstream-npm/package.json
@@ -6,42 +6,31 @@
},
"name": "fstream-npm",
"description": "fstream class for creating npm packages",
- "version": "1.0.1",
+ "version": "1.0.2",
"repository": {
"type": "git",
"url": "git://github.com/isaacs/fstream-npm.git"
},
+ "scripts": {
+ "test": "standard"
+ },
"main": "./fstream-npm.js",
"dependencies": {
"fstream-ignore": "^1.0.0",
"inherits": "2"
},
+ "devDependencies": {
+ "standard": "^2.7.3"
+ },
"license": "ISC",
- "gitHead": "4a95e1903f93dc122320349bb55e367ddd08ad6b",
+ "readme": "# fstream-npm\n\nThis is an fstream DirReader class that will read a directory and filter\nthings according to the semantics of what goes in an npm package.\n\nFor example:\n\n```javascript\n// This will print out all the files that would be included\n// by 'npm publish' or 'npm install' of this directory.\n\nvar FN = require(\"fstream-npm\")\nFN({ path: \"./\" })\n .on(\"child\", function (e) {\n console.error(e.path.substr(e.root.path.length + 1))\n })\n```\n\n",
+ "readmeFilename": "README.md",
+ "gitHead": "d5e26643135522925effa2c112258f1feeec2ba5",
"bugs": {
"url": "https://github.com/isaacs/fstream-npm/issues"
},
"homepage": "https://github.com/isaacs/fstream-npm",
- "_id": "fstream-npm@1.0.1",
- "scripts": {},
- "_shasum": "1e35c77f0fa24f5d6367e6d447ae7d6ddb482db2",
- "_from": "fstream-npm@1.0.1",
- "_npmVersion": "2.1.3",
- "_nodeVersion": "0.10.31",
- "_npmUser": {
- "name": "isaacs",
- "email": "i@izs.me"
- },
- "maintainers": [
- {
- "name": "isaacs",
- "email": "i@izs.me"
- }
- ],
- "dist": {
- "shasum": "1e35c77f0fa24f5d6367e6d447ae7d6ddb482db2",
- "tarball": "http://registry.npmjs.org/fstream-npm/-/fstream-npm-1.0.1.tgz"
- },
- "directories": {},
- "_resolved": "https://registry.npmjs.org/fstream-npm/-/fstream-npm-1.0.1.tgz"
+ "_id": "fstream-npm@1.0.2",
+ "_shasum": "a1d2a4ce6ac2db731f0f66a85b4dddfea9565d77",
+ "_from": "fstream-npm@>=1.0.2 <1.1.0"
}