mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 12:10:49 +00:00
Improve types and remove async
This commit is contained in:
parent
49d31049ac
commit
ad9551ca6d
6 changed files with 14 additions and 7 deletions
|
|
@ -12,7 +12,7 @@ export function createBunPackageManager() {
|
||||||
// For bun, we use the proxy-only approach to block package downloads,
|
// For bun, we use the proxy-only approach to block package downloads,
|
||||||
// so we don't need to analyze commands.
|
// so we don't need to analyze commands.
|
||||||
isSupportedCommand: () => false,
|
isSupportedCommand: () => false,
|
||||||
getDependencyUpdatesForCommand: async () => [],
|
getDependencyUpdatesForCommand: () => [],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -26,7 +26,7 @@ export function createBunxPackageManager() {
|
||||||
// For bunx, we use the proxy-only approach to block package downloads,
|
// For bunx, we use the proxy-only approach to block package downloads,
|
||||||
// so we don't need to analyze commands.
|
// so we don't need to analyze commands.
|
||||||
isSupportedCommand: () => false,
|
isSupportedCommand: () => false,
|
||||||
getDependencyUpdatesForCommand: async () => [],
|
getDependencyUpdatesForCommand: () => [],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,11 +17,18 @@ const state = {
|
||||||
packageManagerName: null,
|
packageManagerName: null,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {Object} GetDependencyUpdatesResult
|
||||||
|
* @property {string} name
|
||||||
|
* @property {string} version
|
||||||
|
* @property {string} type
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {Object} PackageManager
|
* @typedef {Object} PackageManager
|
||||||
* @property {(args: string[]) => Promise<{ status: number }>} runCommand
|
* @property {(args: string[]) => Promise<{ status: number }>} runCommand
|
||||||
* @property {(args: string[]) => boolean} isSupportedCommand
|
* @property {(args: string[]) => boolean} isSupportedCommand
|
||||||
* @property {(args: string[]) => Promise<{name: string, version: string, type: string}[]>} getDependencyUpdatesForCommand
|
* @property {(args: string[]) => Promise<GetDependencyUpdatesResult[]> | GetDependencyUpdatesResult[]} getDependencyUpdatesForCommand
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ export function createNpmPackageManager() {
|
||||||
/**
|
/**
|
||||||
* @param {string[]} args
|
* @param {string[]} args
|
||||||
*
|
*
|
||||||
* @returns {Promise<{name: string, version: string, type: string}[]>}
|
* @returns {ReturnType<import("../currentPackageManager.js").PackageManager["getDependencyUpdatesForCommand"]>}
|
||||||
*/
|
*/
|
||||||
function getDependencyUpdatesForCommand(args) {
|
function getDependencyUpdatesForCommand(args) {
|
||||||
const scanner = findDependencyScannerForCommand(
|
const scanner = findDependencyScannerForCommand(
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ import { hasDryRunArg } from "../utils/npmCommands.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {Object} CommandArgumentScanner
|
* @typedef {Object} CommandArgumentScanner
|
||||||
* @property {(args: string[]) => Promise<ScanResult[]>} scan
|
* @property {(args: string[]) => Promise<ScanResult[]> | ScanResult[]} scan
|
||||||
* @property {(args: string[]) => boolean} shouldScan
|
* @property {(args: string[]) => boolean} shouldScan
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
*/
|
*/
|
||||||
export function nullScanner() {
|
export function nullScanner() {
|
||||||
return {
|
return {
|
||||||
scan: async () => [],
|
scan: () => [],
|
||||||
shouldScan: () => false,
|
shouldScan: () => false,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ export function createPnpxPackageManager() {
|
||||||
/**
|
/**
|
||||||
* @param {string[]} args
|
* @param {string[]} args
|
||||||
* @param {boolean} isPnpx
|
* @param {boolean} isPnpx
|
||||||
* @returns {Promise<import("../npm/dependencyScanner/commandArgumentScanner.js").ScanResult[]>}
|
* @returns {ReturnType<import("../currentPackageManager.js").PackageManager["getDependencyUpdatesForCommand"]>}
|
||||||
*/
|
*/
|
||||||
function getDependencyUpdatesForCommand(args, isPnpx) {
|
function getDependencyUpdatesForCommand(args, isPnpx) {
|
||||||
if (isPnpx) {
|
if (isPnpx) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue