{"_id":"haxec","_rev":"4-39ba48aaafb7f9f787da378aff839872","name":"haxec","dist-tags":{"latest":"2.0.1"},"versions":{"1.1.0":{"name":"haxec","version":"1.1.0","description":"Wrap a Node.js spawn() or exec() with before/after handlers","author":{"name":"Gustaf Räntilä"},"license":"MIT","bugs":{"url":"https://github.com/grantila/haxec/issues"},"homepage":"https://github.com/grantila/haxec#readme","main":"./dist/index.js","types":"./dist/index.d.ts","engines":{"node":">=8"},"scripts":{"build":"rimraf dist && node_modules/.bin/tsc","test":"node node_modules/.bin/jest","buildtest":"yarn build && yarn test","travis-deploy-once":"travis-deploy-once","semantic-release":"semantic-release","cz":"git-cz"},"repository":{"type":"git","url":"git+https://github.com/grantila/haxec.git"},"keywords":["wrap","command","program","before","after"],"devDependencies":{"@types/jest":"^24","@types/node":"^12","already":"^1.8.0","commitizen":"^3","cz-conventional-changelog":"^2","jest":"^24","rimraf":"^2.6.3","semantic-release":"^15.13.18","travis-deploy-once":"^5","ts-jest":"^24.0.2","typescript":"^3.5.2"},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"dependencies":{"foreground-child":"^1.5.6","spawn-wrap":"^1.4.2"},"gitHead":"29084858738aa30454caeb8c5cc365c5aa753c81","_id":"haxec@1.1.0","_nodeVersion":"12.5.0","_npmVersion":"6.9.2","dist":{"integrity":"sha512-2nzK1PoW8iUS56yj/52pulGEa24YnjVSQ3mrYTagQ1xoWl/2kKgoJ/SaZ6UclgZqlvsXy6QzJWjVU/m1wd2r+Q==","shasum":"077c6e067d0f8cf1bd5c68327c84f336e878d298","tarball":"https://registry.npmjs.org/haxec/-/haxec-1.1.0.tgz","fileCount":24,"unpackedSize":17564,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdGOAHCRA9TVsSAnZWagAAAFIP/0MgQ9SVM109Ada2HtfC\naTS035c9EUqiCvKi+SkcOQp1DX2QnK2WW93cV9nSugjYb5Gy67KdNChr8MPJ\nU8Z0sUW/YPWKW0m8ifROQHjruR0VPGiqXOdWFpVNqWB/mp1l58FEsypClt9l\nWpZPoGFChohVyYFENUUShqV8Rrcunsx0nKsS8Eb+9bjiX2EDke0rGonnescn\nKObHa4N78g+h/SuXIdBq2LUz8yIkYxxpZ7A2AGNL4Ts7vDRjsvd3+LAgIOw4\n25XwuNd97HZHAR/GizefDdP4/F6Zb4IaTy6+20b9A6wrq7nui9ndxHrRWKn6\n8P/7hNIVzfViWxQXA9lBYAmQRFAX/bjYPUg5NPxJU6CWnARI7TzWP86k3HHT\n6NoOpAK8AVk6CENSwBNcB7kqDpr6U5i9qZTPQ1fWR74P0/AJ5ImP2/TmwlQp\nulMmSxrON7uQlEj7+oEDhCg2/R5Q8d2cyRRzeohaP/CCX/7LKk8DjrzVF+6f\n2mxF7mOsNf27JnMBkIiHgxXCw983EAl3U2JMKj5eQkq8F1JIDEOpzZioE96A\nN5oHQf39eKwW6xGiD7wtB83jQbndVN/A/sq8WiIVBh8UIIP5GAohMj76iZzk\nidMzZ7TMM+0PQ9SZt7M374MC3xdjMzXbgMKR1OLYNZK07CBCEUW3C52p2rqy\n3ddx\r\n=K5Co\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCVK9geBhEbZN6ZVg7MQkQzIyihCN0Ilt+OidjMijLQXgIhANoDhPHaQXGGsfFY0hAOT7RdJ6PS4gVaumDDSW7cKcKW"}]},"maintainers":[{"name":"grantila","email":"g.rantila@gmail.com"}],"_npmUser":{"name":"grantila","email":"g.rantila@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/haxec_1.1.0_1561911302972_0.5327955628798933"},"_hasShrinkwrap":false},"1.1.1":{"name":"haxec","version":"1.1.1","description":"Wrap a Node.js spawn() or exec() with before/after handlers","author":{"name":"Gustaf Räntilä"},"license":"MIT","bugs":{"url":"https://github.com/grantila/haxec/issues"},"homepage":"https://github.com/grantila/haxec#readme","main":"./dist/index.js","types":"./dist/index.d.ts","engines":{"node":">=8"},"scripts":{"build:dist":"rimraf dist && node_modules/.bin/tsc -p tsconfig.prod.json","build:test":"rimraf dist-test && node_modules/.bin/tsc -p tsconfig.test.json","build":"yarn build:dist && yarn build:test","test":"node node_modules/.bin/jest","buildtest":"yarn build && yarn test","travis-deploy-once":"travis-deploy-once","semantic-release":"semantic-release","cz":"git-cz"},"repository":{"type":"git","url":"git+https://github.com/grantila/haxec.git"},"keywords":["wrap","command","program","before","after"],"devDependencies":{"@types/jest":"^24.9.1","@types/node":"^13.5.0","already":"^1.10.0","commitizen":"^4.0.3","cz-conventional-changelog":"^3.0.2","jest":"^25.1.0","rimraf":"^3.0.0","ts-jest":"^25.0.0","typescript":"^3.7.5"},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"dependencies":{"foreground-child":"^2.0.0","spawn-wrap":"^2.0.0"},"gitHead":"c22b2553632db1fe785a90cb6066aeae0b929d37","_id":"haxec@1.1.1","_nodeVersion":"12.14.1","_npmVersion":"6.13.4","dist":{"integrity":"sha512-O4zS37uEvIvVCl/GyHo5E9eSIdFTPlV1KckWy8whJrBG2MLzDJkE5Z5j16OY2mSq9KEseBkhYbT7VSudOurigw==","shasum":"3b1bd180b17ae6bb6bb77d4ea4cf5b2bc7569c25","tarball":"https://registry.npmjs.org/haxec/-/haxec-1.1.1.tgz","fileCount":9,"unpackedSize":8954,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeLZX/CRA9TVsSAnZWagAAvgoP/jSdmg5YtKmtzjSYH7jb\nlGZOAK9wmcvbslowiXuDvlRjIlZjUGouFfLIpqYMIpzmAhTxILYaVYPDL9/H\ngNI0Xw+aYJ8ozNrSmqhFE478BA1XBEXM2UWof1WN3MOklFfNOpbLX4TLMlD8\nd5pPBCq0diRnjKgdH/84peatNRoeOdyE2VHgCehdip91/Dag5T7AoGDg1Rvc\nYkGnB9dWY9+uH4F9pAb7WO67n0vmz/mL6W1V2sudQmRtSShuO1idaWramgLD\npovFCPtJU71CZ/aWdcVIaTdIyES686V+3A7s6l3zr4SGk/2NomBpgSmzW4PH\nl4jLBOI1u4l9IMCJCQ/hWSkyfqjw4NIGJBR1Bxc63x11zgxiOVteATe+45Re\nqium64+gOOk6EgaxcPjsZ97yocQf4CadizxPFR0nqYCMKZn1sd2ypliutxnQ\n5ACbSL97f376LE0ZRNcH1obkFjsKOAV3huU9ghqr7tnq3HgGX0kZI+yVVu2v\nz8CwVuLFYTkOlm9LFX5h55oxzmJI6hyJ6YWuuLabTLH0SgpmjbHCS9002Dqj\nkwR0Mpejn2gX5Et0mk/WmbfB2d7ZUvVHXRA78ckXQS6H0wdLXN/p60SZE0q4\nzplyijz/mEa1qGgtuIdx5+vxpVlOeFdKUhyNcoftbDaJUQe3izfeUVB19V6P\nZQo8\r\n=2C3L\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGXMzi0ryOSTGnZeXrREDsy+yI8IFovW6dIGX+kYddSyAiEAhWyu9lNd9fOCmzFezFOkbea+WLJXP6OjyYmGcmRg8zM="}]},"maintainers":[{"name":"grantila","email":"g.rantila@gmail.com"}],"_npmUser":{"name":"grantila","email":"g.rantila@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/haxec_1.1.1_1580045823361_0.8651393068643101"},"_hasShrinkwrap":false},"2.0.0":{"name":"haxec","version":"2.0.0","description":"Wrap a Node.js spawn() or exec() with before/after handlers","author":{"name":"Gustaf Räntilä"},"license":"MIT","bugs":{"url":"https://github.com/grantila/haxec/issues"},"homepage":"https://github.com/grantila/haxec#readme","main":"./dist/index.js","types":"./dist/index.d.ts","engines":{"node":">=10"},"scripts":{"build:dist":"rimraf dist && tsc -p tsconfig.prod.json","build:test":"rimraf dist-test && tsc -p tsconfig.test.json","build":"yarn build:dist && yarn build:test","test":"jest","buildtest":"yarn build && yarn test","cz":"git-cz"},"repository":{"type":"git","url":"git+https://github.com/grantila/haxec.git"},"keywords":["wrap","command","program","before","after"],"devDependencies":{"@types/jest":"^26.0.20","@types/node":"^14.14.31","already":"^1.13.2","cz-conventional-changelog":"^3.3.0","jest":"^26.6.3","rimraf":"^3.0.2","ts-jest":"^26.5.2","typescript":"^4.2.2"},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"dependencies":{"foreground-child":"^2.0.0","spawn-wrap":"^2.0.0"},"gitHead":"b85e98f98a477201e3fa75e5450a29e51fd48f4f","_id":"haxec@2.0.0","_nodeVersion":"14.16.0","_npmVersion":"6.14.11","dist":{"integrity":"sha512-dSio6wlqVmRd2C/myzkKnMma71voQh2pe+rundPI4qtrabJ8AVAyC/t/LQMmnMx4lPacJz8Emvhuq6XOVqkVfg==","shasum":"1553fdd173072f19221948feabe103fa6a55d185","tarball":"https://registry.npmjs.org/haxec/-/haxec-2.0.0.tgz","fileCount":9,"unpackedSize":9193,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgP835CRA9TVsSAnZWagAAt3sP/jfUW+Kl+GbuFfRbBonW\nXEcJXGLTJXbXTf5SN9yAZTiv3j1h8KHLKvCx7fOtX0fgVNhPY6dK8MoWKVhl\nNmSs8e0E18Rz7wFGQMr/mRAV6/kd/Wx5C4fk/ikbkDtLn/PNmj0px/ouUYsU\n/CBWWN3zvmamIMHwZDLWJXix2uotQ/SuvFVywtwD4Gjmtcds1TGV7L88pYp0\nupeqn4NSDXb4qbub6r5yctM4lJ/ATj+BECx4pf6vPq2p+LerPkmWg8SswKXa\nl8HPyZfxlGDSNRYUHHUIxTAmSwFkxWmeLmbhxRjaePjvdcPvNCK7U7x1wQtG\ndsVqMzwvMfWKbtZZmriUm/EGASVz/y7ixW/F7gWaVMNAW6oHn7ZmC3x1LFS8\nAbYY4O8cdBNYSSgf9aC+Xz1FEyJ0/YooyVLPTQGqwJ/dovALvYTTxPiLvvNt\n0z14PepnTCk/6hGj2m3A6mV0XpCcABwHRr1a+kZQdADLZlfDCbBbAOl184dx\nJ94+kqp4xMFQzoFBN4fJJFMBCydduSsyioi/vTsBIkshYSleXn4kXw/zW/ek\nl/wDpvm1kUBQCKA3s3ERywrhZg9HTTmHR3cfruk3/SqaorziN6/4PxT1XTMj\njOHXocASdxcMihfhxdm7sLfm/VSev4CSgi22qUBHKkmE8jabHj23DWt/ECyC\nutXK\r\n=abCe\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDsT43lVzKPRuH86io974f4a7vD8lcNazDPSpet+xSLAAiEAqt4EuKYEaMB5zlkbjpoyntH3nsbw47kLsUefF+0fxD8="}]},"_npmUser":{"name":"grantila","email":"g.rantila@gmail.com"},"directories":{},"maintainers":[{"name":"grantila","email":"g.rantila@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/haxec_2.0.0_1614794232542_0.8012481636636621"},"_hasShrinkwrap":false},"2.0.1":{"name":"haxec","version":"2.0.1","description":"Wrap a Node.js spawn() or exec() with before/after handlers","author":{"name":"Gustaf Räntilä"},"license":"MIT","bugs":{"url":"https://github.com/grantila/haxec/issues"},"homepage":"https://github.com/grantila/haxec#readme","main":"./dist/index.js","types":"./dist/index.d.ts","engines":{"node":">=10"},"scripts":{"build:dist":"rimraf dist && tsc -p tsconfig.prod.json","build:test":"rimraf dist-test && tsc -p tsconfig.test.json","build":"yarn build:dist && yarn build:test","test":"jest","buildtest":"yarn build && yarn test","cz":"git-cz"},"repository":{"type":"git","url":"git+https://github.com/grantila/haxec.git"},"keywords":["wrap","command","program","before","after"],"devDependencies":{"@types/jest":"^26.0.20","@types/node":"^14.14.31","already":"^1.13.2","cz-conventional-changelog":"^3.3.0","jest":"^26.6.3","rimraf":"^3.0.2","ts-jest":"^26.5.2","typescript":"^4.2.2"},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"dependencies":{"foreground-child":"^2.0.0","spawn-wrap":"^2.0.0"},"gitHead":"0559dc6038fb3d234e5116cb18e34b646fdd91fd","_id":"haxec@2.0.1","_nodeVersion":"14.16.0","_npmVersion":"6.14.11","dist":{"integrity":"sha512-2DaSqGZIzgVkZ4YFHbk9Su0Q6gm7YbzNX9njOHK/D/XklOdvgTemsPmjcyExlLdkl7lRlNIW0Wxo6niVfpWedw==","shasum":"cfc4d6d0da396132bbbc708c60d6b1deb051323f","tarball":"https://registry.npmjs.org/haxec/-/haxec-2.0.1.tgz","fileCount":9,"unpackedSize":9234,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgQAkiCRA9TVsSAnZWagAAX2oQAJe62O5s6/wdu6M+gYzW\n06o05qwcLMsGbG2jCoIh3aMRp9RwPmP/ahanW4rTLmWIZ1r6T/taIM4dy8n8\n4T7d+118vwpc1UPqj9o9pxH2uZAJR6CDfaOonoz6ALJKSwqIhBDzSryGttX2\nRuP3t+C4ZeQ/2+B3MvmkUHt/2uMrJibf1qlgwKM55ArWQk830fTDdqxuKUJK\nhwx+qyFHQge60AB0OVMNm852aPhhU/kQkT7pd4jC5zq5Jl3+ephYS5s6Rdrn\n2/RJtYfVI8rl69QoZi192k+GF9eXnkVcaApN7DfMAkbck6TiFe61HC8LTmvN\nJwv1YAjeZuIhc+KazGygGyEY3sNbxIx+nb66HDQUQth5OW89RcFyC1GoPtIi\nTGDduxJW8X2pn+oS21KAwAFnp1i1uHrWEYH8/hrB7XDqTIowdDki7rhzJz+F\nh5hF8tRyivT3cEEizkkrBGqEd3A+9P/E0dzpTI2fCQdIr0LbU0awLdYmT/9O\nLImUdyXYpYrGG0/ynx0+hmSX+QLAzjpfT+HleyXmLYMOf/nibQD81kjyZV08\nfp6md5Jj+YC46IxBhRVS7c/RkCu3mZT0FvcC3Y0gfJK+64oIJSheuGzGJbD6\nEpLpbT1IxLjqiVlb0I7QmeTirR/rLKszlJk/vwvb45UaXxCX5fICAOQ2hiWw\nhMlD\r\n=ZBkk\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDFEMVCZFAMTcZMxSLSDtDn/n6G/0Tf796Adb1zRi3K1AIhANaOcRXHHpOYK/5cSD/e5noeIWDm3BKAZDISzkLwitSh"}]},"_npmUser":{"name":"grantila","email":"g.rantila@gmail.com"},"directories":{},"maintainers":[{"name":"grantila","email":"g.rantila@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/haxec_2.0.1_1614809378111_0.6135396049797088"},"_hasShrinkwrap":false}},"time":{"created":"2019-06-30T16:15:02.971Z","1.1.0":"2019-06-30T16:15:03.125Z","modified":"2022-05-04T18:45:54.504Z","1.1.1":"2020-01-26T13:37:03.485Z","2.0.0":"2021-03-03T17:57:12.668Z","2.0.1":"2021-03-03T22:09:38.273Z"},"maintainers":[{"name":"grantila","email":"g.rantila@gmail.com"}],"description":"Wrap a Node.js spawn() or exec() with before/after handlers","homepage":"https://github.com/grantila/haxec#readme","keywords":["wrap","command","program","before","after"],"repository":{"type":"git","url":"git+https://github.com/grantila/haxec.git"},"author":{"name":"Gustaf Räntilä"},"bugs":{"url":"https://github.com/grantila/haxec/issues"},"license":"MIT","readme":"[![npm version][npm-image]][npm-url]\n[![downloads][downloads-image]][npm-url]\n[![build status][build-image]][build-url]\n[![greenkeeper badge][greenkeeper-image]][greenkeeper-url]\n[![Language grade: JavaScript][lgtm-image]][lgtm-url]\n\n\n# haxec\n\nRun a (JavaScript) program with *before* and *after* handlers inside the child process. The command can be either a `.js` file or a `node file.js [...]` command line, or a Node shebang script.\n\nIf the wrapped script spawns further sub processes, the wrapping will occur to these as well!\n\nThe invoked program will take over standard I/O and become foreground. When the invoked program exits, the parent exits too.\n\n\n# API\n\n## Interface\n\nThe interface for `haxec` is a module exporting a function `run`:\n\n```ts\nconst { run } = require( 'haxec' );\n\n// run is defined as:\nfunction run(\n  wrapModule: string,\n  cmdWithArgs: Array< string >,\n  options?: Options\n): void;\n\n// where options can contain environment variables in the \"env\" property:\ninterface Options\n{\n  env?: { [ key: string ]: string; };\n  beforeExit?: ( ) => void | Promise< void >;\n}\n```\n\nThe `wrapModule` is *your* module (it will make sense to provide an absolut path to it) which `haxec` will `require()`. This module is supposed to export a `before` function and/or a `after` function. The module will be injected into the command that is being run, so these functions will be called in that process.\n\n`run` returns nothing. At this time, the program shouldn't do much else, as the child will take over terminal I/O and exit the parent when the child exits.\n\nEnvironment variables can be added to the child, using the `env` property in the options object.\n\nTo perform any final/cleanup work right before the child has exited, provide a `beforeExit` callback. If this returns a promise, it will be awaited before exiting the child (and thereby the parent).\n\n\n## Usage\n\n```ts\nconst path = require( \"path\" );\nconst { run } = require( 'haxec' );\n\nconst wrapModule = path.join( __dirname, \"child.js\" );\n\nrun( wrapModule, [ \"node\", \"file.js\", \"arg1\" ] );\n// which is same as\nrun( wrapModule, [ \"file.js\", \"arg1\" ] );\n// or as a shebang script\nrun( wrapModule, [ \"./script-name.sh\", \"arg1\" ] );\n```\n\n\n## Example\n\n```ts\n// main.js\nconst { run } = require( 'haxec' );\n\nrun(\n  path.join( __dirname, \"child.js\" ),\n  [ \"node\", \"some-app.js\", \"arg1\" ],\n  {\n    env: { foo: \"bar\" }\n  }\n);\n```\n\nThis will run `some-app.js` with `arg1` as argument. It will inject this file into it and call its hooks before and after `some-app.js` is invoked, inside its process:\n\n```ts\n// child.js\nmodule.exports = {\n  before( ) {\n    console.log( \"Child has pid\", process.pid );\n    // Inject an environment into this process\n    process.env.injected = \"yes\";\n\n    // When this function returns, the main \"some-app.js\" will run, and it\n    // will have { foo: \"bar\", injected: \"yes\" } as environment variables.\n  },\n  after( code ) {\n    console.log( \"Child exited with code\", code );\n  },\n};\n```\n\n\n[npm-image]: https://img.shields.io/npm/v/haxec.svg\n[npm-url]: https://npmjs.org/package/haxec\n[downloads-image]: https://img.shields.io/npm/dm/haxec.svg\n[build-image]: https://img.shields.io/github/workflow/status/grantila/haxec/Master.svg\n[build-url]: https://github.com/grantila/haxec/actions?query=workflow%3AMaster\n[greenkeeper-image]: https://badges.greenkeeper.io/grantila/haxec.svg\n[greenkeeper-url]: https://greenkeeper.io/\n[lgtm-image]: https://img.shields.io/lgtm/grade/javascript/g/grantila/haxec.svg?logo=lgtm&logoWidth=18\n[lgtm-url]: https://lgtm.com/projects/g/grantila/haxec/context:javascript\n","readmeFilename":"README.md"}