Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

esm-utils

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

esm-utils - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

8

lib/json.js

@@ -7,9 +7,9 @@ import fs, {promises as fsAsync} from 'node:fs'

const url = new URL(file, base)
const text = await fsAsync.readFile(url, 'utf8')
return JSON.parse(text)
const buffer = await fsAsync.readFile(url)
return JSON.parse(buffer)
},
loadSync(file) {
const url = new URL(file, base)
const text = fs.readFileSync(url, 'utf8')
return JSON.parse(text)
const buffer = fs.readFileSync(url)
return JSON.parse(buffer)
},

@@ -16,0 +16,0 @@ }

@@ -1,2 +0,2 @@

import url from 'node:url'
import {fileURLToPath} from 'node:url'
import path from 'node:path'

@@ -9,12 +9,9 @@ import {createRequire} from 'node:module'

get filename() {
return url.fileURLToPath(importMeta.url)
return fileURLToPath(importMeta.url)
},
get __filename() {
return this.filename
},
get dirname() {
return path.dirname(this.filename)
},
get __dirname() {
return this.dirname
get require() {
return createRequire(importMeta.url)
},

@@ -24,5 +21,9 @@ get json() {

},
get require() {
return createRequire(importMeta.url)
// Aliases
get __filename() {
return this.filename
},
get __dirname() {
return this.dirname
},
}

@@ -29,0 +30,0 @@ }

{
"name": "esm-utils",
"version": "1.0.0",
"version": "1.0.1",
"description": "Utilities you need when migrating to ESModule.",

@@ -60,3 +60,3 @@ "homepage": "https://github.com/fisker/esm-utils#readme",

"devDependencies": {
"@commitlint/cli": "12.1.1",
"@commitlint/cli": "12.1.3",
"@fisker/commitlint-config": "1.3.4",

@@ -63,0 +63,0 @@ "@fisker/eslint-config": "6.0.1",

@@ -16,3 +16,3 @@ # esm-utils

const {dirname, filename, json} = createEsmUtils(import.meta)
const {dirname, filename, require} = createEsmUtils(import.meta)
```

@@ -19,0 +19,0 @@

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc