UNPKG

layaair2-cmd

Version:

layaair version 2 toolkit

148 lines (147 loc) 10.1 kB
{ "_args": [ [ { "raw": "flagged-respawn@^1.0.0", "scope": null, "escapedName": "flagged-respawn", "name": "flagged-respawn", "rawSpec": "^1.0.0", "spec": ">=1.0.0 <2.0.0", "type": "range" }, "E:\\Mine\\Project\\git\\laya\\dawawa\\layaairdoc_cmd\\node_modules\\liftoff" ] ], "_from": "flagged-respawn@^1.0.0", "_hasShrinkwrap": false, "_id": "flagged-respawn@1.0.1", "_location": "/flagged-respawn", "_nodeVersion": "8.11.1", "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/flagged-respawn_1.0.1_1544555649674_0.741443184349275" }, "_npmUser": { "name": "phated", "email": "blaine.bublitz@gmail.com" }, "_npmVersion": "5.6.0", "_phantomChildren": {}, "_requested": { "raw": "flagged-respawn@^1.0.0", "scope": null, "escapedName": "flagged-respawn", "name": "flagged-respawn", "rawSpec": "^1.0.0", "spec": ">=1.0.0 <2.0.0", "type": "range" }, "_requiredBy": [ "/liftoff" ], "_resolved": "https://registry.npmjs.org/flagged-respawn/-/flagged-respawn-1.0.1.tgz", "_shasum": "e7de6f1279ddd9ca9aac8a5971d618606b3aab41", "_shrinkwrap": null, "_spec": "flagged-respawn@^1.0.0", "_where": "E:\\Mine\\Project\\git\\laya\\dawawa\\layaairdoc_cmd\\node_modules\\liftoff", "author": { "name": "Gulp Team", "email": "team@gulpjs.com", "url": "http://gulpjs.com/" }, "bugs": { "url": "https://github.com/gulpjs/flagged-respawn/issues" }, "contributors": [ { "name": "Takayuki Sato", "email": "sttk.xslet@gmail.com" }, { "name": "Bertrand Marron", "email": "bertrand.marron@ionisx.com" }, { "name": "Tyler Kellen", "email": "tyler@sleekcode.net" }, { "name": "Blaine Bublitz", "email": "blaine.bublitz@gmail.com" } ], "dependencies": {}, "description": "A tool for respawning node binaries when special flags are present.", "devDependencies": { "eslint": "^2.13.0", "eslint-config-gulp": "^3.0.1", "expect": "^1.20.2", "istanbul": "^0.4.3", "istanbul-coveralls": "^1.0.3", "mocha": "^3.5.3", "nyc": "^11.3.0", "v8flags": "^3.0.1" }, "directories": {}, "dist": { "integrity": "sha512-lNaHNVymajmk0OJMBn8fVUAU1BtDeKIqKoVhk4xAALB57aALg6b4W0MfJ/cUE0g9YBXy5XhSlPIpYIJ7HaY/3Q==", "shasum": "e7de6f1279ddd9ca9aac8a5971d618606b3aab41", "tarball": "https://registry.npmjs.org/flagged-respawn/-/flagged-respawn-1.0.1.tgz", "fileCount": 8, "unpackedSize": 10361, "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcEAyCCRA9TVsSAnZWagAAhsYP/2AY4Pl0bYf+9yQcpER9\nNCMnLhkopAYRi5jJwsXm5V6BsAQRO4dWgmUwN4cxHx9BbaKaA0kcnrCyohiW\nrcPODIT2oEip6FAJPfgsp0JFuDDTN8YW0ieKDP3f5IkL70RqHZjaCLRLVPCI\n3vpYIqQcvkCupqCNyB0aaYIZRFVqAK/oB5Vps3w2Bt0L67EnD63mV5I5e3HS\n5BOGROpxJms9KK6r4QPoCquGhe9UuwzCA2sbNcgdkz2LIykyixgO5tGpY6hQ\nq27t0GNw8zmZv+NNo0/3BFtb1MdDFj2PaUEVkFQjeLSGpoxEt4AYwzixx8jk\nNTh6hDVV9JKOeMeXhqpTYftnMfUDrVsKs28OEGr38e9CjAyTEMDEPyTmPLyO\nkT4cV8OktbGu9me3cbSLOrofTeE1YjLGFP9arAkdQX076JFM8bU49YRoH7f0\ngySuqY526bBdtwasGwGlKHvvXP61IE1La6Q187pyDi6RjFH8sBwfQuhP1AwG\nKZc43eoRplWu8G0KJQ1KmHiVbf4nU20fb9enTyeRM0WEUvp4YJHmJYxB/VxH\nkrvz7xZaaKRcI9r2qzxBxDC4jGdT0nbjc82e409UC7SP9IvvgmQbPnYi75Gu\nXZ+EgPFg4XEKl/yLvdWCLB2lUzv5iIC/z45RYMqp6ovbR7L9QrnBHezEwKM4\nWnvN\r\n=pTd5\r\n-----END PGP SIGNATURE-----\r\n" }, "engines": { "node": ">= 0.10" }, "files": [ "index.js", "lib/", "LICENSE" ], "gitHead": "2640711d748a1bea801b502d4861277425706721", "homepage": "https://github.com/gulpjs/flagged-respawn#readme", "keywords": [ "respawn", "flags" ], "license": "MIT", "main": "index.js", "maintainers": [ { "name": "contra", "email": "yo@contra.io" }, { "name": "phated", "email": "blaine.bublitz@gmail.com" }, { "name": "sttk", "email": "sttk.xslet@gmail.com" }, { "name": "tkellen", "email": "tyler@sleekcode.net" } ], "name": "flagged-respawn", "optionalDependencies": {}, "readme": "<p align=\"center\">\n <a href=\"http://gulpjs.com\">\n <img height=\"257\" width=\"114\" src=\"https://raw.githubusercontent.com/gulpjs/artwork/master/gulp-2x.png\">\n </a>\n</p>\n\n# flagged-respawn\n\n[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Travis Build Status][travis-image]][travis-url] [![AppVeyor Build Status][appveyor-image]][appveyor-url] [![Coveralls Status][coveralls-image]][coveralls-url] [![Gitter chat][gitter-image]][gitter-url]\n\nA tool for respawning node binaries when special flags are present.\n\n## What is it?\n\nSay you wrote a command line tool that runs arbitrary javascript (e.g. task runner, test framework, etc). For the sake of discussion, let's pretend it's a testing harness you've named `testify`.\n\nEverything is going splendidly until one day you decide to test some code that relies on a feature behind a v8 flag in node (`--harmony`, for example). Without much thought, you run `testify --harmony spec tests.js`.\n\nIt doesn't work. After digging around for a bit, you realize this produces a [`process.argv`](http://nodejs.org/docs/latest/api/process.html#process_process_argv) of:\n\n`['node', '/usr/local/bin/test', '--harmony', 'spec', 'tests.js']`\n\nCrap. The `--harmony` flag is in the wrong place! It should be applied to the **node** command, not our binary. What we actually wanted was this:\n\n`['node', '--harmony', '/usr/local/bin/test', 'spec', 'tests.js']`\n\nFlagged-respawn fixes this problem and handles all the edge cases respawning creates, such as:\n- Providing a method to determine if a respawn is needed.\n- Piping stderr/stdout from the child into the parent.\n- Making the parent process exit with the same code as the child.\n- If the child is killed, making the parent exit with the same signal.\n\nTo see it in action, clone this repository and run `npm install` / `npm run respawn` / `npm run nospawn`.\n\n## Sample Usage\n\n```js\n#!/usr/bin/env node\n\nconst flaggedRespawn = require('flagged-respawn');\n\n// get a list of all possible v8 flags for the running version of node\nconst v8flags = require('v8flags').fetch();\n\nflaggedRespawn(v8flags, process.argv, function (ready, child) {\n if (ready) {\n console.log('Running!');\n // your cli code here\n } else {\n console.log('Special flags found, respawning.');\n }\n if (process.pid !== child.pid) {\n console.log('Respawned to PID:', child.pid);\n }\n});\n\n```\n\n\n## API\n\n### <u>flaggedRespawn(flags, argv, [ forcedFlags, ] callback) : Void</u>\n\nRespawns the script itself when *argv* has special flag contained in *flags* and/or *forcedFlags* is not empty. Because members of *flags* and *forcedFlags* are passed to `node` command, each of them needs to be a node flag or a V8 flag.\n\n#### Forbid respawning\n\nIf `--no-respawning` flag is given in *argv*, this function does not respawned even if *argv* contains members of flags or *forcedFlags* is not empty. (This flag is also used internally to prevent from respawning more than once).\n\n#### Parameter:\n\n| Parameter | Type | Description |\n|:--------------|:------:|:----------------------------------------------------|\n| *flags* | Array | An array of node flags and V8 flags which are available when present in *argv*. |\n| *argv* | Array | Command line arguments to respawn. |\n| *forcedFlags* | Array or String | An array of node flags or a string of a single flag and V8 flags for respawning forcely. |\n| *callback* | function | A called function when not respawning or after respawned. |\n\n* **<u><i>callback</i>(ready, proc, argv) : Void</u>**\n\n *callback* function is called both when respawned or not, and it can be distinguished by callback's argument: *ready*. (*ready* indicates whether a process spawned its child process (false) or not (true), but it does not indicate whether a process is a spawned child process or not. *ready* for a spawned child process is true.)\n\n *argv* is an array of command line arguments which is respawned (when *ready* is false) or is passed current process except flags within *flags* and `--no-respawning` (when *ready* is true).\n\n **Parameter:**\n\n | Parameter | Type | Description |\n |:----------|:-------:|:--------------------------|\n | *ready* | boolean | True, if not respawning and is ready to execute main function. |\n | *proc* | object | Child process object if respawned, otherwise current process object. |\n | *argv* | Array | An array of command line arguments. |\n\n## License\n\nMIT\n\n[downloads-image]: http://img.shields.io/npm/dm/flagged-respawn.svg\n[npm-url]: https://www.npmjs.com/package/flagged-respawn\n[npm-image]: http://img.shields.io/npm/v/flagged-respawn.svg\n\n[travis-url]: https://travis-ci.org/gulpjs/flagged-respawn\n[travis-image]: http://img.shields.io/travis/gulpjs/flagged-respawn.svg?label=travis-ci\n\n[appveyor-url]: https://ci.appveyor.com/project/gulpjs/flagged-respawn\n[appveyor-image]: https://img.shields.io/appveyor/ci/gulpjs/flagged-respawn.svg?label=appveyor\n\n[coveralls-url]: https://coveralls.io/r/gulpjs/flagged-respawn\n[coveralls-image]: http://img.shields.io/coveralls/gulpjs/flagged-respawn/master.svg\n\n[gitter-url]: https://gitter.im/gulpjs/gulp\n[gitter-image]: https://badges.gitter.im/gulpjs/gulp.svg\n", "readmeFilename": "README.md", "repository": { "type": "git", "url": "git+https://github.com/gulpjs/flagged-respawn.git" }, "scripts": { "cover": "nyc --reporter=lcov --reporter=text-summary npm test", "coveralls": "npm run cover && istanbul-coveralls", "lint": "eslint .", "nospawn": "node test/bin/respawner test", "pretest": "npm run lint", "respawn": "node test/bin/respawner --harmony test", "test": "mocha --async-only" }, "version": "1.0.1" }