v8-compile-cache
Advanced tools
Comparing version 2.0.2 to 2.0.3
# `v8-module-cache` Changelog | ||
## 2019-05-10, Version 2.0.3 | ||
* Add `LICENSE` file [#19](https://github.com/zertosh/v8-compile-cache/pull/19). | ||
* Add "repository" to `package.json` (see [eea336e](https://github.com/zertosh/v8-compile-cache/commit/eea336eaa8360f9ded9342b8aa928e56ac6a7529)). | ||
* Support `require.resolve.paths` (added in Node v8.9.0) [#20](https://github.com/zertosh/v8-compile-cache/pull/20)/[#22](https://github.com/zertosh/v8-compile-cache/pull/22). | ||
## 2018-08-06, Version 2.0.2 | ||
@@ -4,0 +10,0 @@ |
{ | ||
"name": "v8-compile-cache", | ||
"version": "2.0.2", | ||
"version": "2.0.3", | ||
"description": "Require hook for automatic V8 compile cache persistence", | ||
@@ -9,5 +9,10 @@ "main": "v8-compile-cache.js", | ||
"lint": "eslint --max-warnings=0 .", | ||
"test": "tap test/*-test.js" | ||
"test": "tap test/*-test.js", | ||
"posttest": "npm run lint" | ||
}, | ||
"author": "Andres Suarez <zertosh@gmail.com>", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/zertosh/v8-compile-cache.git" | ||
}, | ||
"files": [ | ||
@@ -14,0 +19,0 @@ "v8-compile-cache.js" |
@@ -155,11 +155,25 @@ 'use strict'; | ||
const self = this; | ||
const hasRequireResolvePaths = typeof require.resolve.paths === 'function'; | ||
this._previousModuleCompile = Module.prototype._compile; | ||
Module.prototype._compile = function(content, filename) { | ||
const mod = this; | ||
function require(id) { | ||
return mod.require(id); | ||
} | ||
require.resolve = function(request, options) { | ||
// https://github.com/nodejs/node/blob/v10.15.3/lib/internal/modules/cjs/helpers.js#L28 | ||
function resolve(request, options) { | ||
return Module._resolveFilename(request, mod, false, options); | ||
}; | ||
} | ||
require.resolve = resolve; | ||
// https://github.com/nodejs/node/blob/v10.15.3/lib/internal/modules/cjs/helpers.js#L37 | ||
// resolve.resolve.paths was added in v8.9.0 | ||
if (hasRequireResolvePaths) { | ||
resolve.paths = function paths(request) { | ||
return Module._resolveLookupPaths(request, mod, true); | ||
}; | ||
} | ||
require.main = process.mainModule; | ||
@@ -166,0 +180,0 @@ |
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
15866
5
311
0
0
5