Comparing version 0.1.2 to 0.1.3
{ | ||
"name": "snakepipe", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "A node implementation of the rust snakepipe crate", | ||
"main": "index.js", | ||
"main": "dist/src/lib.js", | ||
"types": "dist/src/lib.d.ts", | ||
"bin": { | ||
"snakepipe-node": "./bin.js" | ||
}, | ||
"files": ["dist"], | ||
"files": [ | ||
"dist" | ||
], | ||
"scripts": { | ||
@@ -11,0 +14,0 @@ "build": "rm -rf ./dist && tsc", |
@@ -6,3 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.makeWriteLine = exports.parseGameState = exports.formatVersionToDisplay = exports.version = void 0; | ||
exports.makeWriteLine = exports.parseGameState = exports.parseGameStateFromAsyncIterator = exports.makeLineIterator = exports.formatVersionToDisplay = exports.version = void 0; | ||
const node_readline_1 = __importDefault(require("node:readline")); | ||
@@ -27,11 +27,16 @@ const node_process_1 = require("node:process"); | ||
} | ||
async function parseGameState() { | ||
const readStdin = node_readline_1.default.createInterface({ input: node_process_1.stdin }); | ||
const stdinIterator = readStdin[Symbol.asyncIterator](); | ||
const options = schemas_1.initOptionsSchema.parse(JSON.parse((await stdinIterator.next()).value)); | ||
exports.makeLineIterator = makeLineIterator; | ||
async function parseGameStateFromAsyncIterator(stream) { | ||
const options = schemas_1.initOptionsSchema.parse(JSON.parse((await stream.next()).value)); | ||
return { | ||
options, | ||
lines: makeLineIterator(stdinIterator), | ||
lines: makeLineIterator(stream), | ||
}; | ||
} | ||
exports.parseGameStateFromAsyncIterator = parseGameStateFromAsyncIterator; | ||
async function parseGameState() { | ||
const readStdin = node_readline_1.default.createInterface({ input: node_process_1.stdin }); | ||
const stdinIterator = readStdin[Symbol.asyncIterator](); | ||
return parseGameStateFromAsyncIterator(stdinIterator); | ||
} | ||
exports.parseGameState = parseGameState; | ||
@@ -38,0 +43,0 @@ function makeWriteLine(stdout) { |
{ | ||
"name": "snakepipe", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "A node implementation of the rust snakepipe crate", | ||
"main": "index.js", | ||
"main": "dist/src/lib.js", | ||
"types": "dist/src/lib.d.ts", | ||
"bin": { | ||
"snakepipe-node": "./bin.js" | ||
}, | ||
"files": ["dist"], | ||
"files": [ | ||
"dist" | ||
], | ||
"scripts": { | ||
@@ -11,0 +14,0 @@ "build": "rm -rf ./dist && tsc", |
# snake-pipe-node | ||
[![npm](https://img.shields.io/npm/v/snakepipe?color=blue)](https://www.npmjs.com/package/snakepipe) | ||
A partial node implementation of my rust cli [topheman/snake-pipe-rust](https://github.com/topheman/snake-pipe-rust). | ||
@@ -35,4 +37,12 @@ | ||
## Usage as a library | ||
``` | ||
npm install snakepipe | ||
``` | ||
See example of usage on [topheman/snake-pipe-rust](https://github.com/topheman/snake-pipe-rust/tree/master/node-helpers/dev-server-sse/index.ts). | ||
## Known bugs | ||
- tty issue when piping from `snakepipe gamestate` [#1](https://github.com/topheman/snake-pipe-node/issues/1) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15798
16
405
48
1