Socket
Socket
Sign inDemoInstall

v8-compile-cache

Package Overview
Dependencies
0
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.2 to 2.0.3

LICENSE

6

CHANGELOG.md
# `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 @@

9

package.json
{
"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 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc