Socket
Socket
Sign inDemoInstall

read-pkg-up

Package Overview
Dependencies
39
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 8.0.0 to 9.0.0

16

index.d.ts
import {Except} from 'type-fest';
import {readPackageAsync, readPackageSync, Options as ReadPackageOptions, NormalizeOptions as ReadPackageNormalizeOptions, PackageJson, NormalizedPackageJson} from 'read-pkg';
import {readPackage, readPackageSync, Options as ReadPackageOptions, NormalizeOptions as ReadPackageNormalizeOptions, PackageJson, NormalizedPackageJson} from 'read-pkg';
export type Options = {
/**
Directory to start looking for a package.json file.
The directory to start looking for a package.json file.

@@ -15,3 +15,3 @@ @default process.cwd()

/**
Directory to start looking for a package.json file.
The directory to start looking for a package.json file.

@@ -35,3 +35,3 @@ @default process.cwd()

PackageJson,
NormalizedPackageJson
NormalizedPackageJson,
};

@@ -44,5 +44,5 @@

```
import {readPackageUpAsync} from 'read-pkg-up';
import {readPackageUp} from 'read-pkg-up';
console.log(await readPackageUpAsync());
console.log(await readPackageUp());
// {

@@ -58,4 +58,4 @@ // packageJson: {

*/
export function readPackageUpAsync(options?: NormalizeOptions): Promise<NormalizedReadResult | undefined>;
export function readPackageUpAsync(options: Options): Promise<ReadResult | undefined>;
export function readPackageUp(options?: NormalizeOptions): Promise<NormalizedReadResult | undefined>;
export function readPackageUp(options: Options): Promise<ReadResult | undefined>;

@@ -62,0 +62,0 @@ /**

@@ -1,6 +0,6 @@

import path from 'path';
import findUp from 'find-up';
import {readPackageAsync, readPackageSync} from 'read-pkg';
import path from 'node:path';
import {findUp, findUpSync} from 'find-up';
import {readPackage, readPackageSync} from 'read-pkg';
export async function readPackageUpAsync(options) {
export async function readPackageUp(options) {
const filePath = await findUp('package.json', options);

@@ -12,4 +12,4 @@ if (!filePath) {

return {
packageJson: await readPackageAsync({...options, cwd: path.dirname(filePath)}),
path: filePath
packageJson: await readPackage({...options, cwd: path.dirname(filePath)}),
path: filePath,
};

@@ -19,3 +19,3 @@ }

export function readPackageUpSync(options) {
const filePath = findUp.sync('package.json', options);
const filePath = findUpSync('package.json', options);
if (!filePath) {

@@ -27,4 +27,4 @@ return;

packageJson: readPackageSync({...options, cwd: path.dirname(filePath)}),
path: filePath
path: filePath,
};
}
{
"name": "read-pkg-up",
"version": "8.0.0",
"version": "9.0.0",
"description": "Read the closest package.json file",

@@ -16,3 +16,3 @@ "license": "MIT",

"engines": {
"node": ">=12"
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
},

@@ -53,11 +53,11 @@ "scripts": {

"dependencies": {
"find-up": "^5.0.0",
"read-pkg": "^6.0.0",
"type-fest": "^1.0.1"
"find-up": "^6.2.0",
"read-pkg": "^7.0.0",
"type-fest": "^2.5.0"
},
"devDependencies": {
"ava": "^3.15.0",
"tsd": "^0.14.0",
"xo": "^0.38.2"
"tsd": "^0.18.0",
"xo": "^0.45.0"
}
}

@@ -13,5 +13,5 @@ # read-pkg-up

```sh
npm install read-pkg-up
```
$ npm install read-pkg-up
```

@@ -21,5 +21,5 @@ ## Usage

```js
import {readPackageUpAsync} from 'read-pkg-up';
import {readPackageUp} from 'read-pkg-up';
console.log(await readPackageUpAsync());
console.log(await readPackageUp());
/*

@@ -39,3 +39,3 @@ {

### readPackageUpAsync(options?)
### readPackageUp(options?)

@@ -57,3 +57,3 @@ Returns a `Promise<object>` or `Promise<undefined>` if no `package.json` was found.

Directory to start looking for a package.json file.
The directory to start looking for a package.json file.

@@ -60,0 +60,0 @@ ##### normalize

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