You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

create-require

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.1 to 1.0.2

7

CHANGELOG.md

@@ -5,2 +5,9 @@ # Changelog

### [1.0.2](https://github.com/nuxt-contrib/create-require/compare/v1.0.1...v1.0.2) (2020-06-12)
### Bug Fixes
* use fake path if filename is directory ([c8e0983](https://github.com/nuxt-contrib/create-require/commit/c8e09834e322d8a106ac8018011f799e2fed03f2))
### [1.0.1](https://github.com/nuxt-contrib/create-require/compare/v1.0.0...v1.0.1) (2020-06-06)

@@ -7,0 +14,0 @@

const nativeModule = require('module')
const path = require('path')
const fs = require('fs')
function createRequire (filename) {
// If filename is dir, createRequire goes with parent directory, so we need fakepath
if (isDir(filename)) {
filename = path.join(filename, 'index.js')
}
// Added in Node v12.2.0

@@ -28,2 +34,12 @@ if (nativeModule.createRequire) {

function isDir (path) {
try {
const stat = fs.lstatSync(path)
return stat.isDirectory()
} catch (e) {
// lstatSync throws an error if path doesn't exist
return false
}
}
module.exports = createRequire

2

package.json
{
"name": "create-require",
"version": "1.0.1",
"version": "1.0.2",
"description": "Polyfill for Node.js module.createRequire (<= v12.2.0)",

@@ -5,0 +5,0 @@ "repository": "nuxt-contrib/create-require",

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc