pax_global_header00006660000000000000000000000064130004615150014505gustar00rootroot0000000000000052 comment=151a22349cec4efeddea1041e9ab3ad768949ff0 roadrunner-1.1.0/000077500000000000000000000000001300046151500136635ustar00rootroot00000000000000roadrunner-1.1.0/.jshintrc000066400000000000000000000000231300046151500155030ustar00rootroot00000000000000{ "node": true } roadrunner-1.1.0/LICENSE000066400000000000000000000020631300046151500146710ustar00rootroot00000000000000Copyright (c) 2014 Sebastian McKenzie MIT License Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. roadrunner-1.1.0/README.md000066400000000000000000000004421300046151500151420ustar00rootroot00000000000000# roadrunner Roadrunner will cache require resolutions to heavily improve startup speed of your node application. ## Installation $ npm install roadrunner ## Usage ```javascript var roadrunner = require("roadrunner"); roadrunner.load(); // your code here roadrunner.save(); ``` roadrunner-1.1.0/index.js000066400000000000000000000024421300046151500153320ustar00rootroot00000000000000"use strict"; var Module = require("module"); var fs = require("fs"); var FILENAME = ".roadrunner.json"; var data = {}; var wrap = function (fn) { return function (filename) { filename = filename || FILENAME; return fn(filename); }; }; var init = function () { Module._pathCache = exports.get("path"); Module._realpathCache = exports.get("realpath"); }; exports.save = wrap(function (filename) { exports.set("realpath", Module._realpathCache); exports.set("path", Module._pathCache); fs.writeFileSync(filename, JSON.stringify(data, null, " ")); }); exports.load = wrap(function (filename) { if (!fs.existsSync(filename)) return; try { data = JSON.parse(fs.readFileSync(filename)); } catch (err) { return; } init(); }); exports.setup = wrap(function (filename) { var save = exports.save.bind(null, filename); process.on("exit", save); process.on("SIGINT", function sigint() { process.removeListener("SIGINT", sigint); save(); process.kill(process.pid, "SIGINT"); }); }); exports.reset = wrap(function (filename) { if (fs.existsSync(filename)) fs.unlinkSync(filename); data = {}; init(); }); exports.get = function (key) { return data[key] = data[key] || {}; }; exports.set = function (key, val) { return data[key] = val; }; roadrunner-1.1.0/package.json000066400000000000000000000003641300046151500161540ustar00rootroot00000000000000{ "name": "roadrunner", "version": "1.1.0", "description": "Cache require resolutions to heavily improve startup speed on subsequent loads", "repository": { "type": "git", "url": "https://github.com/sebmck/roadrunner.git" } }