+4
-0
@@ -0,1 +1,5 @@ | ||
| # 1.0.5 (2015-10-22) | ||
| * Preemptively parse diff. | ||
| # 1.0.4 (2015-10-20) | ||
@@ -2,0 +6,0 @@ |
+26
-24
| #!/usr/bin/env node | ||
| var spawn = require("child_process").spawn | ||
| var electron = require("electron-prebuilt") | ||
| var path = require("path") | ||
| var fs = require("fs") | ||
| var spawn = require("child_process").spawn; | ||
| var electron = require("electron-prebuilt"); | ||
| var path = require("path"); | ||
| var parse = require("parse-diff"); | ||
| var stdin = require("get-stdin")(); | ||
| var Readable = require("stream").Readable; | ||
@@ -10,23 +12,23 @@ var serverPath = path.join(__dirname, "./server.js") | ||
| var hasRead = false; | ||
| process.stdin.on('readable', function () { | ||
| var partial = process.stdin.read(1); | ||
| if (!partial) { | ||
| console.error("Your branch has no changes to view."); | ||
| process.exit(0); | ||
| if (process.stdin.isTTY) { | ||
| console.error("No stdin provided."); | ||
| process.exit(1); | ||
| } | ||
| stdin.then(function (raw) { | ||
| var diff = parse(raw); | ||
| if (!(diff instanceof Array) || diff.length === 0) { | ||
| console.error("Could not parse diff."); | ||
| process.exit(1); | ||
| } | ||
| if (partial && !hasRead) { | ||
| partial = partial.toString().trim(); | ||
| hasRead = true; | ||
| if (!process.stdin.isTTY && partial !== "") { | ||
| var proc = spawn(electron, args) | ||
| process.stdin.pipe(proc.stdin) | ||
| } else if (partial === "") { | ||
| console.error("Your branch has no changes to view."); | ||
| process.exit(0); | ||
| } else { | ||
| console.error("No stdin provided"); | ||
| process.exit(1); | ||
| } | ||
| } | ||
| var proc = spawn(electron, args) | ||
| var stream = new Readable(); | ||
| stream.push(JSON.stringify(diff)); | ||
| stream.push(null); | ||
| stream.pipe(proc.stdin); | ||
| }); |
+1
-7
| const ipc = require("ipc"); | ||
| const parse = require("parse-diff"); | ||
| const React = require("react"); | ||
@@ -83,10 +82,5 @@ const ReactDOM = require("react-dom"); | ||
| ipc.on("diff", function (raw) { | ||
| var diff = parse(raw); | ||
| var diff = JSON.parse(raw); | ||
| if (!(diff instanceof Array) || diff.length === 0) { | ||
| alert("Could not parse diff."); | ||
| return; | ||
| } | ||
| ReactDOM.render(<Main diff={diff} />, document.getElementById("content")); | ||
| }); |
+1
-7
| "use strict"; | ||
| var ipc = require("ipc"); | ||
| var parse = require("parse-diff"); | ||
| var React = require("react"); | ||
@@ -143,11 +142,6 @@ var ReactDOM = require("react-dom"); | ||
| ipc.on("diff", function (raw) { | ||
| var diff = parse(raw); | ||
| var diff = JSON.parse(raw); | ||
| if (!(diff instanceof Array) || diff.length === 0) { | ||
| alert("Could not parse diff."); | ||
| return; | ||
| } | ||
| ReactDOM.render(React.createElement(Main, { diff: diff }), document.getElementById("content")); | ||
| }); | ||
+1
-1
| { | ||
| "name": "viewdiff", | ||
| "version": "1.0.4", | ||
| "version": "1.0.5", | ||
| "description": "View your diffs a separate window.", | ||
@@ -5,0 +5,0 @@ "main": "server.js", |
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
1
-50%244730
-0.14%241
-5.49%