app-root-path
Advanced tools
Comparing version 3.0.0 to 3.1.0
@@ -110,4 +110,11 @@ 'use strict'; | ||
// resort to require.main.filename (See http://nodejs.org/api/modules.html) | ||
if (alternateMethod || null == appRootPath) { | ||
appRootPath = path.dirname(requireFunction.main.filename); | ||
if ((alternateMethod || null == appRootPath)) { | ||
if (requireFunction.main) { | ||
appRootPath = path.dirname(requireFunction.main.filename); | ||
} else { | ||
// This is the case when app-root-path is bundle'd to a commonjs2 format and is being called from an esm file. | ||
// In those cases require.main is undefined (See https://nodejs.org/api/modules.html#accessing-the-main-module) | ||
// At that point we can only get the root from looking at the callee | ||
appRootPath = path.dirname(process.argv[1]); | ||
} | ||
} | ||
@@ -114,0 +121,0 @@ |
{ | ||
"name": "app-root-path", | ||
"version": "3.0.0", | ||
"version": "3.1.0", | ||
"description": "Determine an app's root path from anywhere inside the app", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -93,2 +93,6 @@ # App Root Path Module | ||
### 3.1.0 | ||
- Added TypeScript types | ||
- Added fallback for when `require.main` is missing (ESM imports) | ||
### 3.0.0 | ||
@@ -95,0 +99,0 @@ - Improved Yarn Plug'n'Play support |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
154
160
0
14962