cross-spawn-cb 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright (c) 2013 Dominic Tarr
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge,
|
|
4
|
+
to any person obtaining a copy of this software and
|
|
5
|
+
associated documentation files (the "Software"), to
|
|
6
|
+
deal in the Software without restriction, including
|
|
7
|
+
without limitation the rights to use, copy, modify,
|
|
8
|
+
merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom
|
|
10
|
+
the Software is furnished to do so,
|
|
11
|
+
subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice
|
|
14
|
+
shall be included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
18
|
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
|
20
|
+
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
22
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Code based on https://github.com/dominictarr/json-buffer but adapted to be simpler to run in a purely node.js environment
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
//TODO: handle reviver/dehydrate function like normal
|
|
4
|
+
//and handle indentation, like normal.
|
|
5
|
+
//if anyone needs this... please send pull request.
|
|
6
|
+
|
|
7
|
+
exports.stringify = function stringify(o) {
|
|
8
|
+
if (o && Buffer.isBuffer(o)) return JSON.stringify(':base64:' + o.toString('base64'));
|
|
9
|
+
|
|
10
|
+
if (o && o.toJSON) o = o.toJSON();
|
|
11
|
+
|
|
12
|
+
if (o && 'object' === typeof o) {
|
|
13
|
+
var s = '';
|
|
14
|
+
var array = Array.isArray(o);
|
|
15
|
+
s = array ? '[' : '{';
|
|
16
|
+
var first = true;
|
|
17
|
+
|
|
18
|
+
for (var k in o) {
|
|
19
|
+
var ignore = 'function' == typeof o[k] || (!array && 'undefined' === typeof o[k]);
|
|
20
|
+
if (Object.hasOwnProperty.call(o, k) && !ignore) {
|
|
21
|
+
if (!first) s += ',';
|
|
22
|
+
first = false;
|
|
23
|
+
if (array) {
|
|
24
|
+
s += stringify(o[k]);
|
|
25
|
+
} else if (o[k] !== void 0) {
|
|
26
|
+
s += stringify(k) + ':' + stringify(o[k]);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
s += array ? ']' : '}';
|
|
32
|
+
|
|
33
|
+
return s;
|
|
34
|
+
} else if ('string' === typeof o) {
|
|
35
|
+
return JSON.stringify(/^:/.test(o) ? ':' + o : o);
|
|
36
|
+
} else if ('undefined' === typeof o) {
|
|
37
|
+
return 'null';
|
|
38
|
+
} else return JSON.stringify(o);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
exports.parse = function (s) {
|
|
42
|
+
return JSON.parse(s, function (key, value) {
|
|
43
|
+
if ('string' === typeof value) {
|
|
44
|
+
if (/^:base64:/.test(value)) return new Buffer(value.substring(8), 'base64');
|
|
45
|
+
else return /^:/.test(value) ? value.substring(1) : value;
|
|
46
|
+
}
|
|
47
|
+
return value;
|
|
48
|
+
});
|
|
49
|
+
};
|
package/lib/polyfills.js
CHANGED
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
if (!Object.assign) Object.assign = require('just-extend');
|
|
2
|
+
if (!Object.keys) Object.keys = require('object-keys');
|
|
2
3
|
|
|
3
4
|
var path = require('path');
|
|
4
5
|
if (typeof path.delimiter === 'undefined') path.delimiter = process.platform === 'win32' ? ';' : ':';
|
|
5
6
|
|
|
6
7
|
var cp = require('child_process');
|
|
7
8
|
if (!cp.spawnSync) cp.spawnSync = require('./spawn-sync/spawn-sync.js');
|
|
9
|
+
|
|
10
|
+
if (!Array.prototype.find) {
|
|
11
|
+
Array.prototype.find = function find(fn) {
|
|
12
|
+
for (var i = 0; i < this.length; i++) {
|
|
13
|
+
if (fn(this[i])) return this[i];
|
|
14
|
+
}
|
|
15
|
+
return null;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
@@ -6,7 +6,7 @@ var fs = require('fs');
|
|
|
6
6
|
var tmpdir = require('os').tmpdir || require('os-shim').tmpdir;
|
|
7
7
|
var cp = require('child_process');
|
|
8
8
|
var sleep = function () {};
|
|
9
|
-
var JSON = require('
|
|
9
|
+
var JSON = require('../json-buffer');
|
|
10
10
|
|
|
11
11
|
var temp = path.normalize(path.join(tmpdir(), 'spawn-sync'));
|
|
12
12
|
|
package/lib/spawn-sync/worker.js
CHANGED
|
@@ -6,7 +6,7 @@ require('../polyfills');
|
|
|
6
6
|
var spawn = require('../cross-spawn.js').spawn;
|
|
7
7
|
var fs = require('fs');
|
|
8
8
|
var concat = require('concat-stream');
|
|
9
|
-
var JSON = require('
|
|
9
|
+
var JSON = require('../json-buffer');
|
|
10
10
|
|
|
11
11
|
var inputFile = process.argv[2];
|
|
12
12
|
var outputFile = process.argv[3];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cross-spawn-cb",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "Cross spawn with a completion callback",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cross-spawn",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"cross-spawn": "^7.0.3",
|
|
29
29
|
"just-extend": "^6.0.1",
|
|
30
30
|
"next-tick": "^1.1.0",
|
|
31
|
-
"
|
|
32
|
-
"
|
|
31
|
+
"object-keys": "^1.1.1",
|
|
32
|
+
"once": "^1.4.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@babel/preset-env": "^7.18.6",
|