v8-compile-cache
Advanced tools
Comparing version 2.2.0 to 2.3.0
# `v8-module-cache` Changelog | ||
## 2021-03-05, Version 2.3.0 | ||
* Fix use require.main instead of module.parent [#34](https://github.com/zertosh/v8-compile-cache/pull/34). | ||
## 2020-10-28, Version 2.2.0 | ||
@@ -4,0 +8,0 @@ |
{ | ||
"name": "v8-compile-cache", | ||
"version": "2.2.0", | ||
"version": "2.3.0", | ||
"description": "Require hook for automatic V8 compile cache persistence", | ||
@@ -30,3 +30,3 @@ "main": "v8-compile-cache.js", | ||
"semver": "^5.3.0", | ||
"tap": "^10.1.1", | ||
"tap": "^9.0.0", | ||
"temp": "^0.8.3", | ||
@@ -33,0 +33,0 @@ "yarn": "1.22.10" |
@@ -331,11 +331,11 @@ 'use strict'; | ||
function getParentName() { | ||
// `module.parent.filename` is undefined or null when: | ||
function getMainName() { | ||
// `require.main.filename` is undefined or null when: | ||
// * node -e 'require("v8-compile-cache")' | ||
// * node -r 'v8-compile-cache' | ||
// * Or, requiring from the REPL. | ||
const parentName = module.parent && typeof module.parent.filename === 'string' | ||
? module.parent.filename | ||
const mainName = require.main && typeof require.main.filename === 'string' | ||
? require.main.filename | ||
: process.cwd(); | ||
return parentName; | ||
return mainName; | ||
} | ||
@@ -349,3 +349,3 @@ | ||
const cacheDir = getCacheDir(); | ||
const prefix = getParentName(); | ||
const prefix = getMainName(); | ||
const blobStore = new FileSystemBlobStore(cacheDir, prefix); | ||
@@ -372,3 +372,3 @@ | ||
getCacheDir, | ||
getParentName, | ||
getMainName, | ||
}; |
16807