Socket
Socket
Sign inDemoInstall

read-pkg

Package Overview
Dependencies
32
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 7.0.0 to 7.1.0

2

index.d.ts

@@ -10,3 +10,3 @@ import * as typeFest from 'type-fest';

*/
readonly cwd?: string;
readonly cwd?: URL | string;

@@ -13,0 +13,0 @@ /**

import process from 'node:process';
import fs, {promises as fsPromises} from 'node:fs';
import path from 'node:path';
import {fileURLToPath} from 'node:url';
import parseJson from 'parse-json';
import normalizePackageData from 'normalize-package-data';
export async function readPackage({cwd = process.cwd(), normalize = true} = {}) {
const toPath = urlOrPath => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;
export async function readPackage({cwd, normalize = true} = {}) {
cwd = toPath(cwd) || process.cwd();
const filePath = path.resolve(cwd, 'package.json');

@@ -18,3 +22,4 @@ const json = parseJson(await fsPromises.readFile(filePath, 'utf8'));

export function readPackageSync({cwd = process.cwd(), normalize = true} = {}) {
export function readPackageSync({cwd, normalize = true} = {}) {
cwd = toPath(cwd) || process.cwd();
const filePath = path.resolve(cwd, 'package.json');

@@ -21,0 +26,0 @@ const json = parseJson(fs.readFileSync(filePath, 'utf8'));

{
"name": "read-pkg",
"version": "7.0.0",
"version": "7.1.0",
"description": "Read a package.json file",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -44,3 +44,3 @@ # read-pkg

Type: `string`\
Type: `URL | string`\
Default: `process.cwd()`

@@ -47,0 +47,0 @@

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc