{"_id":"file-eval","_rev":"11-c060b6cb40013548e843b7e6dd9237aa","name":"file-eval","description":"Read file and eval it","dist-tags":{"latest":"2.0.0"},"versions":{"1.0.0":{"name":"file-eval","version":"1.0.0","description":"Read file and eval it","license":"MIT","repository":{"type":"git","url":"git+https://github.com/nodules/file-eval.git"},"author":{"name":"Andrew Abramov","email":"mail@blond.im","url":"github.com/blond"},"keywords":["file","read","eval","require"],"main":"index.js","files":["index.js"],"engines":{"node":">= 4.0"},"dependencies":{"es6-promisify":"5.0.0","isobject":"2.1.0","node-eval":"1.0.3"},"devDependencies":{"eslint":"^3.6.0","eslint-config-pedant":"^0.8.0"},"scripts":{"test":"eslint ."},"gitHead":"0e251b3eb4b41ea1cba6e6ffa3ba06729e93fed3","bugs":{"url":"https://github.com/nodules/file-eval/issues"},"homepage":"https://github.com/nodules/file-eval#readme","_id":"file-eval@1.0.0","_shasum":"ac4091ba2a42a4e9ad095f13795c9ab1e963557a","_from":".","_npmVersion":"2.15.9","_nodeVersion":"4.6.0","_npmUser":{"name":"blond","email":"mail@blond.im"},"dist":{"shasum":"ac4091ba2a42a4e9ad095f13795c9ab1e963557a","tarball":"https://registry.npmjs.org/file-eval/-/file-eval-1.0.0.tgz","integrity":"sha512-ZX6XYg5SsBKyqnac+BH4dCfFQo/2ucXcZDT27tDBD3Yl+lBNUeBn0eeLwRpkr+dyKPKvxj8ZsA2ocIbZ/GBoLA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHvpb2gYIwXnfQhyu6JK5HW58P6k3nJQvvtSGgiROmHJAiEAv1UicJz6GTNubbb5AbrvQPRhXYd4kRbMg8KviYK7gMw="}]},"maintainers":[{"name":"blond","email":"mail@blond.im"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/file-eval-1.0.0.tgz_1476216059199_0.22455475013703108"}},"1.0.1":{"name":"file-eval","version":"1.0.1","description":"Read file and eval it","license":"MIT","repository":{"type":"git","url":"git+https://github.com/nodules/file-eval.git"},"author":{"name":"Andrew Abramov","email":"mail@blond.im","url":"github.com/blond"},"keywords":["file","read","eval","require"],"main":"index.js","files":["index.js"],"engines":{"node":">= 4.0"},"dependencies":{"es6-promisify":"5.0.0","node-eval":"1.0.3"},"devDependencies":{"eslint":"^3.6.0","eslint-config-pedant":"^0.8.0"},"scripts":{"test":"eslint ."},"gitHead":"dc1f4224a39ff6700888ece5e26b9fa4af66f64b","bugs":{"url":"https://github.com/nodules/file-eval/issues"},"homepage":"https://github.com/nodules/file-eval#readme","_id":"file-eval@1.0.1","_shasum":"13b9451632e367fcbec3f861e5052447a4ae5038","_from":".","_npmVersion":"2.15.9","_nodeVersion":"4.6.0","_npmUser":{"name":"blond","email":"mail@blond.im"},"dist":{"shasum":"13b9451632e367fcbec3f861e5052447a4ae5038","tarball":"https://registry.npmjs.org/file-eval/-/file-eval-1.0.1.tgz","integrity":"sha512-pa431dzkV/s4ldWW3GyPRZ6BoHU1hZJK1181NiPe9A45+f+7i9QePO+AGWnqF9NIu0j7quqnEVc29hSSVbi3Sw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCc7rOu8kR5qSpsmBGyrtLTPhyjqCrXX3784yzXNoh6PwIhAOH1TqtfKPA1xzVzWHb7Il8hd0xGz7TtOyrb+MGVx4hI"}]},"maintainers":[{"name":"blond","email":"mail@blond.im"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/file-eval-1.0.1.tgz_1476222343329_0.30922968685626984"}},"1.1.0":{"name":"file-eval","version":"1.1.0","description":"Read file and eval it","license":"MIT","repository":{"type":"git","url":"https://github.com/nodules/file-eval"},"author":{"name":"Andrew Abramov","email":"mail@blond.im","url":"github.com/blond"},"keywords":["file","read","eval","require"],"main":"index.js","files":["index.js"],"engines":{"node":">= 0.10"},"dependencies":{"es6-promisify":"5.0.0","node-eval":"1.1.0"},"devDependencies":{"chai":"^3.5.0","eslint":"^3.6.0","eslint-config-pedant":"^0.8.0","mocha":"^3.1.2","nyc":"^8.3.2","proxyquire":"^1.7.10","sinon":"^1.17.6","sinon-as-promised":"^4.0.2","sinon-chai":"^2.8.0"},"scripts":{"pretest":"npm run lint","test":"nyc mocha","test:unit":"mocha","lint":"eslint ."},"gitHead":"63fd6396b2c29e2abf8ffd66351547cee1e911c7","bugs":{"url":"https://github.com/nodules/file-eval/issues"},"homepage":"https://github.com/nodules/file-eval","_id":"file-eval@1.1.0","_shasum":"d86e405b47dbcaa1475d99529d3de700a19ade29","_from":".","_npmVersion":"2.7.3","_nodeVersion":"0.10.40","_npmUser":{"name":"blond","email":"mail@blond.im"},"dist":{"shasum":"d86e405b47dbcaa1475d99529d3de700a19ade29","tarball":"https://registry.npmjs.org/file-eval/-/file-eval-1.1.0.tgz","integrity":"sha512-d0UgVqL3gX0382BuTmgv7myEmin6KqVSwvcze96xH4vFi2B5VivIt7Knfis+yBD9AQan1kMq8wVZepyDeuVGUg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCQk0PjTkm/1TBO+SAQ++8J6aFrDCHDCUuxzylXQs9H2gIgCQLRLh2cilAcKJU1M0W61mvz+0xfqm3RDITz5vD7nAU="}]},"maintainers":[{"name":"blond","email":"mail@blond.im"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/file-eval-1.1.0.tgz_1477039401381_0.44555990234948695"}},"1.2.0":{"name":"file-eval","version":"1.2.0","description":"Read file and eval it","license":"MIT","repository":{"type":"git","url":"git+https://github.com/nodules/file-eval.git"},"author":{"name":"Andrew Abramov","email":"mail@blond.im","url":"github.com/blond"},"keywords":["file","read","eval","require","CommonJS","JSON","JSON5"],"main":"index.js","files":["lib/","index.js"],"engines":{"node":">= 0.10"},"dependencies":{"es6-promisify":"5.0.0","json5":"0.5.1","node-eval":"1.1.0","stripbom":"3.0.0"},"devDependencies":{"chai":"^3.5.0","eslint":"^3.6.0","eslint-config-pedant":"^0.8.0","mocha":"^3.1.2","nyc":"^10.0.0","proxyquire":"^1.7.10","sinon":"^1.17.6","sinon-as-promised":"^4.0.2","sinon-chai":"^2.8.0"},"scripts":{"pretest":"npm run lint","test":"npm run cover && npm run examples","test:unit":"mocha test/**/*.test.js","cover":"nyc mocha test/**/*.test.js","lint":"eslint .","examples":"node examples/index.js"},"gitHead":"97f33a88e3c821b17ee264b676c91ef1ae8f1fc0","bugs":{"url":"https://github.com/nodules/file-eval/issues"},"homepage":"https://github.com/nodules/file-eval#readme","_id":"file-eval@1.2.0","_shasum":"da74e97a93274b528dbbed4f7bfbf7fc298014a3","_from":".","_npmVersion":"2.15.11","_nodeVersion":"4.7.3","_npmUser":{"name":"blond","email":"mail@blond.im"},"dist":{"shasum":"da74e97a93274b528dbbed4f7bfbf7fc298014a3","tarball":"https://registry.npmjs.org/file-eval/-/file-eval-1.2.0.tgz","integrity":"sha512-/srt91HZJF6tW/uiehluz2cqhJNpzhublMB5CjwdjG+vfW8Hnc9KwZ91zh9xHPqJxPA8bgvMCypy0IUaACes3w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD912Fi8X5mncnN9Dvy0hEoEQegVRO8j3DTYj/PYH7/mgIgFGByFmPJw5Kses9MyBm//r7vtDTjUJUbBt40Byc6+ig="}]},"maintainers":[{"name":"blond","email":"mail@blond.im"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/file-eval-1.2.0.tgz_1490526422957_0.9083880777470767"}},"1.3.0":{"name":"file-eval","version":"1.3.0","description":"Read file and eval it","license":"MIT","repository":{"type":"git","url":"git+https://github.com/node-eval/file-eval.git"},"author":{"name":"Andrew Abramov","email":"mail@blond.im","url":"github.com/blond"},"keywords":["file","read","eval","require","CommonJS","JSON","JSON5"],"main":"index.js","files":["lib/","index.js"],"engines":{"node":">= 0.12"},"dependencies":{"es6-promisify":"5.0.0","json5":"0.5.1","node-eval":"1.1.1"},"devDependencies":{"chai":"^4.1.1","eslint":"^4.4.1","eslint-config-pedant":"^1.0.0","mocha":"^3.5.0","nyc":"11.3.0","proxyquire":"^1.8.0","sinon":"4.0.1","sinon-chai":"^2.14.0"},"scripts":{"pretest":"npm run lint","test":"npm run cover && npm run examples","test:unit":"mocha test/**{,/*}.test.js","cover":"nyc mocha test/**{,/*}.test.js","lint":"eslint .","examples":"node examples/index.js"},"gitHead":"5905efff6f7c32bfd9a343f080e2e96c7dace765","bugs":{"url":"https://github.com/node-eval/file-eval/issues"},"homepage":"https://github.com/node-eval/file-eval#readme","_id":"file-eval@1.3.0","_npmVersion":"5.5.1","_nodeVersion":"8.9.1","_npmUser":{"name":"blond","email":"mail@blond.im"},"dist":{"integrity":"sha512-1OvAJoazFzzg2YSY0pSvdqWfsNkFDDeo3mkRf/DcIp/cpBzaudjZryNI3l85kxAsF/3NeNUf7BFu4fh4Svv6Bw==","shasum":"936f2a3213e15c242181d0d97a1edbc8ba6fc38b","tarball":"https://registry.npmjs.org/file-eval/-/file-eval-1.3.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDQI0kWqy1gcTDy93bOZOJrR+QLwL4mk4UNAMvn5ipqnwIhAKogHZ+huXYKGEEM1saPNm6zqCT580/0DbIMLPQvZ3Zm"}]},"maintainers":[{"name":"blond","email":"mail@blond.im"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/file-eval-1.3.0.tgz_1510424360861_0.7970035371836275"}},"2.0.0":{"name":"file-eval","version":"2.0.0","description":"Read file and eval it","license":"MIT","repository":{"type":"git","url":"git+https://github.com/node-eval/file-eval.git"},"author":{"name":"Andrew Abramov","email":"mail@blond.im","url":"github.com/blond"},"keywords":["file","read","eval","require","CommonJS","JSON","JSON5"],"main":"index.js","files":["index.js"],"engines":{"node":">= 4"},"dependencies":{"any-eval":"1.0.0","es6-promisify":"5.0.0"},"devDependencies":{"chai":"^4.1.2","eslint":"^4.11.0","eslint-config-pedant":"^1.0.0","mocha":"^4.0.1","nyc":"^11.3.0","proxyquire":"^1.8.0","sinon":"^4.1.2","sinon-chai":"^2.14.0"},"scripts":{"pretest":"npm run lint","test":"npm run cover && npm run examples","test:unit":"mocha test/**{,/*}.test.js","cover":"nyc npm run test:unit","lint":"eslint .","examples":"node examples/index.js"},"gitHead":"61f0e0d675cc00b2334345d89ee5f6e68e078fcf","bugs":{"url":"https://github.com/node-eval/file-eval/issues"},"homepage":"https://github.com/node-eval/file-eval#readme","_id":"file-eval@2.0.0","_npmVersion":"5.5.1","_nodeVersion":"8.9.1","_npmUser":{"name":"blond","email":"mail@blond.im"},"dist":{"integrity":"sha512-87oEj/m8PjkmXJ7Mc8bRHmyZF9fOT8hT5ix8jRWsPVBki1GPL1kdrgzu7fYXP3ShiVGFrA+B1N7Bk7FG0hZg/g==","shasum":"77cf5eab9f3afdfb5e115d2cb921a9f534ae78c0","tarball":"https://registry.npmjs.org/file-eval/-/file-eval-2.0.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIE8WyCIkA+NonABK9na1pEoVnoBMwLJkbbLdaeRjxmooAiEAkOhWvvji2eYj1thl4cY7Nq2b2XnCG8UPlxI+91UofIc="}]},"maintainers":[{"name":"blond","email":"mail@blond.im"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/file-eval-2.0.0.tgz_1510520951107_0.3625996387563646"}}},"readme":"file-eval\n=========\n\n[![NPM Status][npm-img]][npm]\n[![Travis Status][test-img]][travis]\n[![Coverage Status][coverage-img]][coveralls]\n[![Dependency Status][david-img]][david]\n\n[npm]:          https://www.npmjs.org/package/file-eval\n[npm-img]:      https://img.shields.io/npm/v/file-eval.svg\n\n[travis]:       https://travis-ci.org/node-eval/file-eval\n[test-img]:     https://img.shields.io/travis/node-eval/file-eval/master.svg?label=tests\n\n[coveralls]:    https://coveralls.io/r/node-eval/file-eval\n[coverage-img]: https://img.shields.io/coveralls/node-eval/file-eval/master.svg\n\n[david]:        https://david-dm.org/node-eval/file-eval\n[david-img]:    http://img.shields.io/david/node-eval/file-eval/master.svg\n\nRead file and eval it. Uses [any-eval](https://github.com/node-eval/any-eval).\n\nLike `require`, but asynchronous and doesn't use the module cache.\n\n**Important:** internally `file-eval` will resolve passed relative paths with `path.resolve()`, not `require.resolve()`.\n\nIn addition to `JSON` and `CommonJS` supports [JSON5](http://json5.org) data format.\n\nInstall\n-------\n\n```\n$ npm install --save file-eval\n```\n\nUsage\n-----\n\n```js\nconst fileEval = require('file-eval');\n\nfileEval('./path/to/file.js')\n    .then(console.log)\n    .catch(console.error);\n```\n\nAPI\n---\n\n### fileEval(file[, options])\n\n### file\n\nType: `String`.\n\nThe filename or file descriptor.\n\nThe `file-eval` determinate format by extension. If filename ends with `.js`, its contents will be evaluating with [vm](https://nodejs.org/dist/latest/docs/api/vm.html).\n\nIf filename ends with `.json` extention, its contents will be parsing with `JSON.parse`. If filename ends with `.json5` extention, its contents will be parsing with [json5](https://github.com/json5/json5).\n\nBy default expected JS-expression or CommonJS module contents.\n\n#### options\n\nType: `Object`, `string`.\n\nOptions or encoding.\n\n#### options.encoding\n\nType: `string`.\n\nDefault: `utf-8`.\n\nThe file encoding.\n\n#### options.flag\n\nType: `string`.\n\nDefault: `r`.\n\nThe flag mode.\n\n#### options.context\n\nType: `Object`.\n\nThe object to provide into execute method.\n\nIf `context` is specified, then module contents will be evaluating with `vm.runInNewContext`.\n\nIf `context` is not specified, then module contents will be evaluating with `vm.runInThisContext`.\n\nWith context you can provide some like-a-global variables into `file-eval`.\n\n```js\nconst fileEval = require('file-eval');\nconst secretKey = '^___^';\n\n// The file has the contents \"module.exports = secretKey;\"\nfileEval('./path/to/file.js', {\n    context: { secretKey }\n});\n\n// ➜ '^___^'\n```\n\n### fileEval.sync(file[, options])\n\nSynchronous version of [fileEval](#fileevalfile-options).\n\nMethod signature is same.\n\nFormats\n-------\n\nSupports [CommonJS](#commonjs), [JSON](#json) and [JSON5](#json5) formats.\n\n> See [examples](./examples) with evaluating files with different formats.\n\n### CommonJS\n\nEvaluates `CommonJS` files with `.js` extention.\n\n```js\nconst fileEval = require('file-eval');\n\n// export data with `module.exports` or `exports`\nfileEval('./path/to/file.js');\n```\n\n### JSON\n\nEvaluates `JSON` files with `.json` extention.\n\n```js\nconst fileEval = require('file-eval');\n\nfileEval('./path/to/file.json');\n```\n\n### JSON5\n\nEvaluates `JSON5` files with `.json5` extention.\n\n> JSON5 is not an official successor to JSON, and JSON5 content may not work with existing JSON parsers. For this reason, JSON5 files use a new `.json5` extension.\n\n```js\nconst fileEval = require('file-eval');\n\nfileEval('./path/to/file.json5');\n```\n\nRelated\n-------\n\n* [node-eval](https://github.com/node-eval/node-eval) — eval Node.js contents only (JS-expression, CommonJS modules and JSON).\n* [any-eval](https://github.com/node-eval/any-eval) — eval any contents (JS-expression, CommonJS modules and JSON/JSON5).\n* [node-file-eval](https://github.com/node-eval/node-file-eval) — read node.js file and eval it with [node-eval](https://github.com/node-eval/node-eval).\n\nLicense\n-------\n\nMIT © [Andrew Abramov](https://github.com/blond)\n","maintainers":[{"email":"yeti.or@gmail.com","name":"yeti-or"},{"email":"zxqfox@gmail.com","name":"qfox"},{"email":"mail@blond.im","name":"blond"}],"time":{"modified":"2022-06-18T00:35:31.989Z","created":"2016-10-11T20:00:59.802Z","1.0.0":"2016-10-11T20:00:59.802Z","1.0.1":"2016-10-11T21:45:44.994Z","1.1.0":"2016-10-21T08:43:23.032Z","1.2.0":"2017-03-26T11:07:04.831Z","1.3.0":"2017-11-11T18:19:22.479Z","2.0.0":"2017-11-12T21:09:12.022Z"},"homepage":"https://github.com/node-eval/file-eval#readme","keywords":["file","read","eval","require","CommonJS","JSON","JSON5"],"repository":{"type":"git","url":"git+https://github.com/node-eval/file-eval.git"},"author":{"name":"Andrew Abramov","email":"mail@blond.im","url":"github.com/blond"},"bugs":{"url":"https://github.com/node-eval/file-eval/issues"},"license":"MIT","readmeFilename":"README.md"}