@pnpm/pnpmfile
Advanced tools
Comparing version 1.1.1 to 1.2.0
@@ -8,3 +8,3 @@ import type { Lockfile } from '@pnpm/lockfile-types'; | ||
readPackage?: (pkg: any, context: HookContext) => any; | ||
afterAllResolved?: (lockfile: Lockfile, context: HookContext) => Lockfile; | ||
afterAllResolved?: (lockfile: Lockfile, context: HookContext) => Lockfile | Promise<Lockfile>; | ||
filterLog?: (log: Log) => boolean; | ||
@@ -11,0 +11,0 @@ } |
@@ -28,3 +28,3 @@ "use strict"; | ||
} | ||
for (const hookName of ['readPackage', 'afterAllResolved', 'filterLog']) { | ||
for (const hookName of ['readPackage', 'afterAllResolved']) { | ||
if (globalHooks[hookName] && hooks[hookName]) { | ||
@@ -34,4 +34,4 @@ const globalHookContext = createReadPackageHookContext(globalPnpmfile.filename, prefix, hookName); | ||
// the `arg` is a package manifest in case of readPackage() and a lockfile object in case of afterAllResolved() | ||
cookedHooks[hookName] = (arg) => { | ||
return hooks[hookName](globalHooks[hookName](arg, globalHookContext), localHookContext); | ||
cookedHooks[hookName] = async (arg) => { | ||
return hooks[hookName](await globalHooks[hookName](arg, globalHookContext), localHookContext); | ||
}; | ||
@@ -50,2 +50,10 @@ } | ||
} | ||
const globalFilterLog = globalHooks.filterLog; | ||
const filterLog = hooks.filterLog; | ||
if (globalFilterLog != null && filterLog != null) { | ||
cookedHooks.filterLog = (log) => globalFilterLog(log) && filterLog(log); | ||
} | ||
else { | ||
cookedHooks.filterLog = globalFilterLog !== null && globalFilterLog !== void 0 ? globalFilterLog : filterLog; | ||
} | ||
return cookedHooks; | ||
@@ -52,0 +60,0 @@ } |
@@ -45,3 +45,3 @@ "use strict"; | ||
const readPackage = pnpmfile.hooks.readPackage; | ||
pnpmfile.hooks.readPackage = function (pkg, ...args) { | ||
pnpmfile.hooks.readPackage = async function (pkg, ...args) { | ||
var _a, _b, _c, _d; | ||
@@ -52,3 +52,3 @@ pkg.dependencies = (_a = pkg.dependencies) !== null && _a !== void 0 ? _a : {}; | ||
pkg.peerDependencies = (_d = pkg.peerDependencies) !== null && _d !== void 0 ? _d : {}; | ||
const newPkg = readPackage(pkg, ...args); | ||
const newPkg = await readPackage(pkg, ...args); | ||
if (!newPkg) { | ||
@@ -55,0 +55,0 @@ throw new BadReadPackageHookError(pnpmFilePath, 'readPackage hook did not return a package manifest object.'); |
{ | ||
"name": "@pnpm/pnpmfile", | ||
"version": "1.1.1", | ||
"version": "1.2.0", | ||
"description": "Reading a .pnpmfile.cjs", | ||
"main": "lib/index.js", | ||
"typings": "lib/index.d.ts", | ||
"types": "lib/index.d.ts", | ||
"files": [ | ||
@@ -28,6 +28,6 @@ "lib", | ||
"dependencies": { | ||
"@pnpm/core-loggers": "6.0.5", | ||
"@pnpm/core-loggers": "6.0.6", | ||
"@pnpm/error": "2.0.0", | ||
"@pnpm/lockfile-types": "3.1.0", | ||
"@pnpm/types": "7.5.0", | ||
"@pnpm/lockfile-types": "3.1.1", | ||
"@pnpm/types": "7.6.0", | ||
"chalk": "^4.1.0", | ||
@@ -34,0 +34,0 @@ "path-absolute": "^1.0.1" |
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
18437
215
+ Added@pnpm/core-loggers@6.0.6(transitive)
+ Added@pnpm/lockfile-types@3.1.1(transitive)
+ Added@pnpm/types@7.6.0(transitive)
- Removed@pnpm/core-loggers@6.0.5(transitive)
- Removed@pnpm/lockfile-types@3.1.0(transitive)
- Removed@pnpm/types@7.5.0(transitive)
Updated@pnpm/core-loggers@6.0.6
Updated@pnpm/lockfile-types@3.1.1
Updated@pnpm/types@7.6.0