114 lines
11 KiB
JSON
114 lines
11 KiB
JSON
|
|
{
|
|||
|
|
"_args": [
|
|||
|
|
[
|
|||
|
|
{
|
|||
|
|
"raw": "stealthy-require@^1.1.0",
|
|||
|
|
"scope": null,
|
|||
|
|
"escapedName": "stealthy-require",
|
|||
|
|
"name": "stealthy-require",
|
|||
|
|
"rawSpec": "^1.1.0",
|
|||
|
|
"spec": ">=1.1.0 <2.0.0",
|
|||
|
|
"type": "range"
|
|||
|
|
},
|
|||
|
|
"/home/jdaugherty/work/GT2/GT2-Android/node_modules/request-promise-native"
|
|||
|
|
]
|
|||
|
|
],
|
|||
|
|
"_from": "stealthy-require@>=1.1.0 <2.0.0",
|
|||
|
|
"_id": "stealthy-require@1.1.1",
|
|||
|
|
"_inCache": true,
|
|||
|
|
"_location": "/stealthy-require",
|
|||
|
|
"_nodeVersion": "4.8.0",
|
|||
|
|
"_npmOperationalInternal": {
|
|||
|
|
"host": "packages-18-east.internal.npmjs.com",
|
|||
|
|
"tmp": "tmp/stealthy-require-1.1.1.tgz_1494301911395_0.9998155683279037"
|
|||
|
|
},
|
|||
|
|
"_npmUser": {
|
|||
|
|
"name": "analog-nico",
|
|||
|
|
"email": "nicolai.kamenzky@testrails.org"
|
|||
|
|
},
|
|||
|
|
"_npmVersion": "2.15.11",
|
|||
|
|
"_phantomChildren": {},
|
|||
|
|
"_requested": {
|
|||
|
|
"raw": "stealthy-require@^1.1.0",
|
|||
|
|
"scope": null,
|
|||
|
|
"escapedName": "stealthy-require",
|
|||
|
|
"name": "stealthy-require",
|
|||
|
|
"rawSpec": "^1.1.0",
|
|||
|
|
"spec": ">=1.1.0 <2.0.0",
|
|||
|
|
"type": "range"
|
|||
|
|
},
|
|||
|
|
"_requiredBy": [
|
|||
|
|
"/request-promise-native"
|
|||
|
|
],
|
|||
|
|
"_resolved": "https://registry.npmjs.org/stealthy-require/-/stealthy-require-1.1.1.tgz",
|
|||
|
|
"_shasum": "35b09875b4ff49f26a777e509b3090a3226bf24b",
|
|||
|
|
"_shrinkwrap": null,
|
|||
|
|
"_spec": "stealthy-require@^1.1.0",
|
|||
|
|
"_where": "/home/jdaugherty/work/GT2/GT2-Android/node_modules/request-promise-native",
|
|||
|
|
"author": {
|
|||
|
|
"name": "Nicolai Kamenzky",
|
|||
|
|
"url": "https://github.com/analog-nico"
|
|||
|
|
},
|
|||
|
|
"bugs": {
|
|||
|
|
"url": "https://github.com/analog-nico/stealthy-require/issues"
|
|||
|
|
},
|
|||
|
|
"dependencies": {},
|
|||
|
|
"description": "The closest you can get to require something with bypassing the require cache",
|
|||
|
|
"devDependencies": {
|
|||
|
|
"bcrypt": "~1.0.2",
|
|||
|
|
"browserify": "~14.3.0",
|
|||
|
|
"chai": "~3.5.0",
|
|||
|
|
"chalk": "~1.1.3",
|
|||
|
|
"gulp": "~3.9.1",
|
|||
|
|
"gulp-coveralls": "~0.1.4",
|
|||
|
|
"gulp-eslint": "~2.1.0",
|
|||
|
|
"gulp-istanbul": "~1.1.1",
|
|||
|
|
"gulp-mocha": "~3.0.1",
|
|||
|
|
"mkdirp": "~0.5.1",
|
|||
|
|
"publish-please": "~2.3.1",
|
|||
|
|
"rimraf": "~2.6.1",
|
|||
|
|
"run-sequence": "~1.2.2",
|
|||
|
|
"webpack": "~1.15.0"
|
|||
|
|
},
|
|||
|
|
"directories": {},
|
|||
|
|
"dist": {
|
|||
|
|
"shasum": "35b09875b4ff49f26a777e509b3090a3226bf24b",
|
|||
|
|
"tarball": "https://registry.npmjs.org/stealthy-require/-/stealthy-require-1.1.1.tgz"
|
|||
|
|
},
|
|||
|
|
"engines": {
|
|||
|
|
"node": ">=0.10.0"
|
|||
|
|
},
|
|||
|
|
"gitHead": "80489389e74c6877c49a916bf87826bf2b4ba1c8",
|
|||
|
|
"homepage": "https://github.com/analog-nico/stealthy-require#readme",
|
|||
|
|
"keywords": [
|
|||
|
|
"require",
|
|||
|
|
"bypass",
|
|||
|
|
"no",
|
|||
|
|
"cache",
|
|||
|
|
"fresh"
|
|||
|
|
],
|
|||
|
|
"license": "ISC",
|
|||
|
|
"main": "./lib/index.js",
|
|||
|
|
"maintainers": [
|
|||
|
|
{
|
|||
|
|
"name": "analog-nico",
|
|||
|
|
"email": "nicolai.kamenzky@testrails.org"
|
|||
|
|
}
|
|||
|
|
],
|
|||
|
|
"name": "stealthy-require",
|
|||
|
|
"optionalDependencies": {},
|
|||
|
|
"readme": "# Stealthy-Require\n\n[](https://travis-ci.org/analog-nico/stealthy-require)\n[](https://coveralls.io/r/analog-nico/stealthy-require)\n[](https://david-dm.org/analog-nico/stealthy-require)\n\nThis is probably the closest you can currently get to require something in node.js with completely bypassing the require cache.\n\n`stealthy-require` works like this:\n\n1. It clears the require cache.\n2. It calls a callback in which you require your module(s) without the cache kicking in.\n3. It clears the cache again and restores its old state.\n\nThe restrictions are:\n\n- [Native modules cannot be required twice.](https://github.com/nodejs/node/issues/5016) Thus this module bypasses the require cache only for non-native (e.g. JS) modules.\n- The require cache is only bypassed for all operations that happen synchronously when a module is required. If a module lazy loads another module at a later time that require call will not bypass the cache anymore.\n\nThis means you should have a close look at all internal require calls before you decide to use this library.\n\n## Installation\n\n[](https://npmjs.org/package/stealthy-require)\n\nThis is a module for node.js and is installed via npm:\n\n``` bash\nnpm install stealthy-require --save\n```\n\n## Usage\n\nLet's say you want to bypass the require cache for this require call:\n\n``` js\nvar request = require('request');\n```\n\nWith `stealthy-require` you can do that like this:\n\n``` js\nvar stealthyRequire = require('stealthy-require');\n\nvar requestFresh = stealthyRequire(require.cache, function () {\n return require('request');\n});\n```\n\nThe require cache is bypassed for the module you require (i.e. `request`) as well as all modules the module requires (i.e. `http` and many more).\n\nSometimes the require cache shall not be bypassed for specific modules. E.g. `request` is required but `tough-cookie` – on which `request` depends on – shall be required using the regular cache. For that you can pass two extra arguments to `stealthyRequire(...)`:\n\n- A callback that requires the modules that shall be required without bypassing the cache\n- The `module` variable\n\n``` js\nvar stealthyRequire = require('stealthy-require');\n\nvar requestFresh = stealthyRequire(require.cache, function () {\n return require('request');\n},\nfunction () {\n require('tough-cookie'); // No return needed\n // You can require multiple modules here\n}, module);\n```\n\n## Usage with Module Bundlers\n\n- [Webpack](https://webpack.github.io) works out-of-the-box like described in the [Usage section](#usage) above.\n- [Browserify](http://browserify.org) does not expose `require.cache`. However, as of `browserify@13.0.1` the cache is passed as the 6th argument to CommonJS modules. Thus you can pass this argument instead:\n\n``` js\n// Tweak for Browserify - using arguments[5] instead of require.cache\nvar requestFresh = stealthyRequire(arguments[5], function () {\n return require('request');\n});\n```\n\n## Preventing a Memory Leak When Repeatedly Requiring Fresh Module Instances in Node.js\n\nIf you are using `stealthy-require` in node.js and repeatedly require fresh module instances the `module.children` array will hold all module instances which prevents unneeded instances to be garbage collected.\n\nAssume your code calls `doSomething()` repeatedly.\n\n``` js\nvar stealthyRequire = require('stealthy-require');\n\nfunction doSomething() {\n\n var freshInstance = stealthyRequire(require.cache, function () {\n return require('some-module');\n });\n \n return freshInstance.calc();\n\n}\n```\n\nAfter `doSomething()` returns `freshInstance` is not used anymore but won’t be garbage col
|
|||
|
|
"readmeFilename": "README.md",
|
|||
|
|
"repository": {
|
|||
|
|
"type": "git",
|
|||
|
|
"url": "git+https://github.com/analog-nico/stealthy-require.git"
|
|||
|
|
},
|
|||
|
|
"scripts": {
|
|||
|
|
"prepublish": "publish-please guard",
|
|||
|
|
"publish-please": "publish-please",
|
|||
|
|
"test": "gulp ci",
|
|||
|
|
"test-publish": "gulp ci-no-cov"
|
|||
|
|
},
|
|||
|
|
"version": "1.1.1"
|
|||
|
|
}
|