Comparing version 1.0.1 to 1.0.2
@@ -16,4 +16,10 @@ import {fileURLToPath} from 'url'; | ||
const modulePath = fileURLToPath(meta.url); | ||
const scriptPath = process.argv[1]; | ||
return stripExt(modulePath) === stripExt(scriptPath); | ||
const extension = path.extname(scriptPath); | ||
if (extension) { | ||
return modulePath === scriptPath; | ||
} | ||
return stripExt(modulePath) === scriptPath; | ||
} |
{ | ||
"name": "es-main", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Test if an ES module is run directly (require.main replacement)", | ||
@@ -16,6 +16,6 @@ "main": "main.js", | ||
"pretest": "eslint .", | ||
"test:with-extension": "node --no-warnings test.js", | ||
"test:without-extension": "node --no-warnings test", | ||
"test:without-node": "NODE_NO_WARNINGS=1 ./test.js", | ||
"test": "npm-run-all test:*" | ||
"test:with-extension": "node test.js", | ||
"test:without-extension": "node test", | ||
"test:without-node": "./test.js", | ||
"test": "NODE_NO_WARNINGS=1 npm-run-all test:*" | ||
}, | ||
@@ -22,0 +22,0 @@ "keywords": [ |
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
2237
19