@pnpm/pnpmfile
Advanced tools
Comparing version 6.0.0 to 6.0.1
import type { CookedHooks } from './requireHooks'; | ||
export { requireHooks } from './requireHooks'; | ||
export { requirePnpmfile, BadReadPackageHookError } from './requirePnpmfile'; | ||
export type { HookContext } from './Hooks'; | ||
export type Hooks = CookedHooks; |
@@ -1,17 +0,4 @@ | ||
import type { PreResolutionHook } from '@pnpm/hooks.types'; | ||
import type { Lockfile } from '@pnpm/lockfile-types'; | ||
import type { Log } from '@pnpm/core-loggers'; | ||
import type { CustomFetchers } from '@pnpm/fetcher-base'; | ||
import { type ImportIndexedPackageAsync } from '@pnpm/store-controller-types'; | ||
interface HookContext { | ||
log: (message: string) => void; | ||
} | ||
interface Hooks { | ||
readPackage?: (pkg: any, context: HookContext) => any; | ||
preResolution?: PreResolutionHook; | ||
afterAllResolved?: (lockfile: Lockfile, context: HookContext) => Lockfile | Promise<Lockfile>; | ||
filterLog?: (log: Log) => boolean; | ||
importPackage?: ImportIndexedPackageAsync; | ||
fetchers?: CustomFetchers; | ||
} | ||
import { type Hooks } from './Hooks'; | ||
type Cook<T extends (...args: any[]) => any> = (arg: Parameters<T>[0], ...otherArgs: any[]) => ReturnType<T>; | ||
@@ -18,0 +5,0 @@ export interface CookedHooks { |
@@ -13,3 +13,3 @@ "use strict"; | ||
function requireHooks(prefix, opts) { | ||
const globalPnpmfile = opts.globalPnpmfile && (0, requirePnpmfile_1.requirePnpmfile)((0, path_absolute_1.default)(opts.globalPnpmfile, prefix), prefix); | ||
const globalPnpmfile = opts.globalPnpmfile ? (0, requirePnpmfile_1.requirePnpmfile)((0, path_absolute_1.default)(opts.globalPnpmfile, prefix), prefix) : undefined; | ||
let globalHooks = globalPnpmfile?.hooks; | ||
@@ -22,4 +22,4 @@ const pnpmfilePath = (0, getPnpmfilePath_1.getPnpmfilePath)(prefix, opts.pnpmfile); | ||
const calculatePnpmfileChecksum = hooks ? () => (0, crypto_base32_hash_1.createBase32HashFromFile)(pnpmfilePath) : undefined; | ||
globalHooks = globalHooks || {}; | ||
hooks = hooks || {}; | ||
globalHooks = globalHooks ?? {}; | ||
hooks = hooks ?? {}; | ||
const cookedHooks = { | ||
@@ -26,0 +26,0 @@ afterAllResolved: [], |
import { PnpmError } from '@pnpm/error'; | ||
import { type Hooks } from './Hooks'; | ||
export declare class BadReadPackageHookError extends PnpmError { | ||
@@ -6,2 +7,6 @@ readonly pnpmfile: string; | ||
} | ||
export declare function requirePnpmfile(pnpmFilePath: string, prefix: string): any; | ||
export interface Pnpmfile { | ||
hooks?: Hooks; | ||
filename: string; | ||
} | ||
export declare function requirePnpmfile(pnpmFilePath: string, prefix: string): Pnpmfile | undefined; |
@@ -41,3 +41,3 @@ "use strict"; | ||
if (pnpmfile?.hooks?.readPackage) { | ||
const readPackage = pnpmfile.hooks.readPackage; | ||
const readPackage = pnpmfile.hooks.readPackage; // eslint-disable-line | ||
pnpmfile.hooks.readPackage = async function (pkg, ...args) { | ||
@@ -44,0 +44,0 @@ pkg.dependencies = pkg.dependencies ?? {}; |
{ | ||
"name": "@pnpm/pnpmfile", | ||
"version": "6.0.0", | ||
"version": "6.0.1", | ||
"description": "Reading a .pnpmfile.cjs", | ||
@@ -25,4 +25,4 @@ "main": "lib/index.js", | ||
"devDependencies": { | ||
"@pnpm/fetcher-base": "16.0.0", | ||
"@pnpm/pnpmfile": "6.0.0" | ||
"@pnpm/pnpmfile": "6.0.1", | ||
"@pnpm/fetcher-base": "16.0.0" | ||
}, | ||
@@ -34,3 +34,3 @@ "dependencies": { | ||
"@pnpm/crypto.base32-hash": "3.0.0", | ||
"@pnpm/error": "6.0.0", | ||
"@pnpm/error": "6.0.1", | ||
"@pnpm/lockfile-types": "6.0.0", | ||
@@ -37,0 +37,0 @@ "@pnpm/hooks.types": "2.0.0", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
21566
21
253
+ Added@pnpm/error@6.0.1(transitive)
- Removed@pnpm/error@6.0.0(transitive)
Updated@pnpm/error@6.0.1