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:
authorisaacs <i@izs.me>2014-05-20 02:20:47 +0400
committerisaacs <i@izs.me>2014-05-20 02:21:35 +0400
commit015af8f0c42c1fd87e6521130e645b73f4559ddb (patch)
tree15b19402be0fdf3fc3f09969d238a3abe881dc36 /node_modules/ini
parent69bc6b5f01242b29527042bc5280087657fd6784 (diff)
Bump many minor dep versions
abbrev columnify fstream-npm glob ini minimatch npmconf
Diffstat (limited to 'node_modules/ini')
-rw-r--r--node_modules/ini/.npmignore1
-rw-r--r--node_modules/ini/ini.js30
-rw-r--r--node_modules/ini/package.json32
-rw-r--r--node_modules/ini/test/fixtures/foo.ini16
-rw-r--r--node_modules/ini/test/foo.js10
5 files changed, 71 insertions, 18 deletions
diff --git a/node_modules/ini/.npmignore b/node_modules/ini/.npmignore
new file mode 100644
index 000000000..3c3629e64
--- /dev/null
+++ b/node_modules/ini/.npmignore
@@ -0,0 +1 @@
+node_modules
diff --git a/node_modules/ini/ini.js b/node_modules/ini/ini.js
index eaf320933..1d1e6e934 100644
--- a/node_modules/ini/ini.js
+++ b/node_modules/ini/ini.js
@@ -42,12 +42,12 @@ function encode (obj, section) {
}
function dotSplit (str) {
- return str.replace(/\1/g, '\2LITERAL\\1LITERAL\2')
- .replace(/\\\./g, '\1')
+ return str.replace(/\1/g, '\u0002LITERAL\\1LITERAL\u0002')
+ .replace(/\\\./g, '\u0001')
.split(/\./).map(function (part) {
return part.replace(/\1/g, '\\.')
- .replace(/\2LITERAL\\1LITERAL\2/g, '\1')
- })
+ .replace(/\2LITERAL\\1LITERAL\2/g, '\u0001')
+ })
}
function decode (str) {
@@ -61,7 +61,7 @@ function decode (str) {
, section = null
lines.forEach(function (line, _, __) {
- if (!line || line.match(/^\s*;/)) return
+ if (!line || line.match(/^\s*[;#]/)) return
var match = line.match(re)
if (!match) return
if (match[1] !== undefined) {
@@ -122,21 +122,29 @@ function decode (str) {
return out
}
+function isQuoted (val) {
+ return (val.charAt(0) === "\"" && val.slice(-1) === "\"")
+ || (val.charAt(0) === "'" && val.slice(-1) === "'")
+}
+
function safe (val) {
return ( typeof val !== "string"
|| val.match(/[\r\n]/)
|| val.match(/^\[/)
|| (val.length > 1
- && val.charAt(0) === "\""
- && val.slice(-1) === "\"")
+ && isQuoted(val))
|| val !== val.trim() )
? JSON.stringify(val)
- : val.replace(/;/g, '\\;')
+ : val.replace(/;/g, '\\;').replace(/#/g, "\\#")
}
function unsafe (val, doUnesc) {
val = (val || "").trim()
- if (val.charAt(0) === "\"" && val.slice(-1) === "\"") {
+ if (isQuoted(val)) {
+ // remove the single quotes before calling JSON.parse
+ if (val.charAt(0) === "'") {
+ val = val.substr(1, val.length - 2);
+ }
try { val = JSON.parse(val) } catch (_) {}
} else {
// walk the val to find the first not-escaped ; character
@@ -145,12 +153,12 @@ function unsafe (val, doUnesc) {
for (var i = 0, l = val.length; i < l; i++) {
var c = val.charAt(i)
if (esc) {
- if (c === "\\" || c === ";")
+ if ("\\;#".indexOf(c) !== -1)
unesc += c
else
unesc += "\\" + c
esc = false
- } else if (c === ";") {
+ } else if (";#".indexOf(c) !== -1) {
break
} else if (c === "\\") {
esc = true
diff --git a/node_modules/ini/package.json b/node_modules/ini/package.json
index 41c63607a..6c3c8d18e 100644
--- a/node_modules/ini/package.json
+++ b/node_modules/ini/package.json
@@ -6,7 +6,7 @@
},
"name": "ini",
"description": "An ini encoder/decoder for node",
- "version": "1.1.0",
+ "version": "1.2.0",
"repository": {
"type": "git",
"url": "git://github.com/isaacs/ini.git"
@@ -20,10 +20,30 @@
},
"dependencies": {},
"devDependencies": {
- "tap": "~0.0.9"
+ "tap": "~0.4.0"
},
- "readme": "An ini format parser and serializer for node.\n\nSections are treated as nested objects. Items before the first heading\nare saved on the object directly.\n\n## Usage\n\nConsider an ini-file `config.ini` that looks like this:\n\n ; this comment is being ignored\n scope = global\n\n [database]\n user = dbuser\n password = dbpassword\n database = use_this_database\n\n [paths.default]\n datadir = /var/lib/data\n array[] = first value\n array[] = second value\n array[] = third value\n\nYou can read, manipulate and write the ini-file like so:\n\n var fs = require('fs')\n , ini = require('ini')\n\n var config = ini.parse(fs.readFileSync('./config.ini', 'utf-8'))\n\n config.scope = 'local'\n config.database.database = 'use_another_database'\n config.paths.default.tmpdir = '/tmp'\n delete config.paths.default.datadir\n config.paths.default.array.push('fourth value')\n\n fs.writeFileSync('./config_modified.ini', ini.stringify(config, 'section'))\n\nThis will result in a file called `config_modified.ini` being written to the filesystem with the following content:\n\n [section]\n scope = local\n [section.database]\n user = dbuser\n password = dbpassword\n database = use_another_database\n [section.paths.default]\n tmpdir = /tmp\n array[] = first value\n array[] = second value\n array[] = third value\n array[] = fourth value\n\n\n## API\n\n### decode(inistring)\nDecode the ini-style formatted `inistring` into a nested object.\n\n### parse(inistring)\nAlias for `decode(inistring)`\n\n### encode(object, [section])\nEncode the object `object` into an ini-style formatted string. If the optional parameter `section` is given, then all top-level properties of the object are put into this section and the `section`-string is prepended to all sub-sections, see the usage example above.\n\n### stringify(object, [section])\nAlias for `encode(object, [section])`\n\n### safe(val)\nEscapes the string `val` such that it is safe to be used as a key or value in an ini-file. Basically escapes quotes. For example\n\n ini.safe('\"unsafe string\"')\n\nwould result in\n\n \"\\\"unsafe string\\\"\"\n\n### unsafe(val)\nUnescapes the string `val`\n",
- "readmeFilename": "README.md",
- "_id": "ini@1.1.0",
- "_from": "ini@latest"
+ "bugs": {
+ "url": "https://github.com/isaacs/ini/issues"
+ },
+ "homepage": "https://github.com/isaacs/ini",
+ "_id": "ini@1.2.0",
+ "_shasum": "2cc36789605809930722e793ae13ac835e623ac6",
+ "_from": "ini@latest",
+ "_npmVersion": "1.4.10",
+ "_npmUser": {
+ "name": "isaacs",
+ "email": "i@izs.me"
+ },
+ "maintainers": [
+ {
+ "name": "isaacs",
+ "email": "i@izs.me"
+ }
+ ],
+ "dist": {
+ "shasum": "2cc36789605809930722e793ae13ac835e623ac6",
+ "tarball": "http://registry.npmjs.org/ini/-/ini-1.2.0.tgz"
+ },
+ "directories": {},
+ "_resolved": "https://registry.npmjs.org/ini/-/ini-1.2.0.tgz"
}
diff --git a/node_modules/ini/test/fixtures/foo.ini b/node_modules/ini/test/fixtures/foo.ini
index 1d81378fd..27555e9d8 100644
--- a/node_modules/ini/test/fixtures/foo.ini
+++ b/node_modules/ini/test/fixtures/foo.ini
@@ -8,6 +8,16 @@ o = p
; wrap in quotes to get a key with a bracket, not a section.
"[disturbing]" = hey you never know
+; Test single quotes
+s = 'something'
+
+; Test mixing quotes
+
+s1 = "something'
+
+; Test double quotes
+s2 = "something else"
+
; Test arrays
zr[] = deedee
ar[] = one
@@ -45,3 +55,9 @@ a.b.c = abc
; this next one is not a comment! it's escaped!
nocomment = this\; this is not a comment
+
+# Support the use of the number sign (#) as an alternative to the semicolon for indicating comments.
+# http://en.wikipedia.org/wiki/INI_file#Comments
+
+# this next one is not a comment! it's escaped!
+noHashComment = this\# this is not a comment
diff --git a/node_modules/ini/test/foo.js b/node_modules/ini/test/foo.js
index 3a05eaf32..e1499cbe3 100644
--- a/node_modules/ini/test/foo.js
+++ b/node_modules/ini/test/foo.js
@@ -10,6 +10,9 @@ var i = require("../")
+ 'a with spaces = b c\n'
+ '" xa n p " = "\\"\\r\\nyoyoyo\\r\\r\\n"\n'
+ '"[disturbing]" = hey you never know\n'
+ + 's = something\n'
+ + 's1 = \"something\'\n'
+ + 's2 = something else\n'
+ 'zr[] = deedee\n'
+ 'ar[] = one\n'
+ 'ar[] = three\n'
@@ -28,11 +31,15 @@ var i = require("../")
+ 'j = 2\n\n[x\\.y\\.z]\nx.y.z = xyz\n\n'
+ '[x\\.y\\.z.a\\.b\\.c]\na.b.c = abc\n'
+ 'nocomment = this\\; this is not a comment\n'
+ + 'noHashComment = this\\# this is not a comment\n'
, expectD =
{ o: 'p',
'a with spaces': 'b c',
" xa n p ":'"\r\nyoyoyo\r\r\n',
'[disturbing]': 'hey you never know',
+ 's': 'something',
+ 's1' : '\"something\'',
+ 's2': 'something else',
'zr': ['deedee'],
'ar': ['one', 'three', 'this is included'],
'br': 'warm',
@@ -47,7 +54,8 @@ var i = require("../")
'x.y.z': 'xyz',
'a.b.c': {
'a.b.c': 'abc',
- 'nocomment': 'this\; this is not a comment'
+ 'nocomment': 'this\; this is not a comment',
+ noHashComment: 'this\# this is not a comment'
}
}
}