Launch Week Day 4: Introducing Data Exports.Learn More
Socket
Book a DemoSign in
Socket

app-root-path

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

app-root-path - npm Package Compare versions

Comparing version
3.0.0
to
3.1.0
+8
index.d.ts
declare namespace appRootPath {
export function resolve(pathToModule: string): string
export function require(pathToModule: string): ReturnType<NodeRequire>
export function toString(): string
export function setPath(explicitlySetPath: string): void
export const path: string
}
export = appRootPath
+9
-2

@@ -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 @@

+1
-1
{
"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

Sorry, the diff of this file is not supported yet