Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@antfu/ni

Package Overview
Dependencies
Maintainers
1
Versions
75
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@antfu/ni - npm Package Compare versions

Comparing version 0.22.4 to 0.23.0

dist/shared/ni.7b6d0b44.mjs

148

dist/index.d.ts
import { Buffer } from 'node:buffer';
declare const AGENTS: {
npm: {
agent: string;
run: (args: string[]) => string;
install: string;
frozen: string;
global: string;
add: string;
upgrade: string;
'upgrade-interactive': null;
execute: string;
uninstall: string;
global_uninstall: string;
};
yarn: {
agent: string;
run: string;
install: string;
frozen: string;
global: string;
add: string;
upgrade: string;
'upgrade-interactive': string;
execute: string;
uninstall: string;
global_uninstall: string;
};
'yarn@berry': {
frozen: string;
upgrade: string;
'upgrade-interactive': string;
execute: string;
global: string;
global_uninstall: string;
agent: string;
run: string;
install: string;
add: string;
uninstall: string;
};
pnpm: {
agent: string;
run: string;
install: string;
frozen: string;
global: string;
add: string;
upgrade: string;
'upgrade-interactive': string;
execute: string;
uninstall: string;
global_uninstall: string;
};
'pnpm@6': {
run: (args: string[]) => string;
agent: string;
install: string;
frozen: string;
global: string;
add: string;
upgrade: string;
'upgrade-interactive': string;
execute: string;
uninstall: string;
global_uninstall: string;
};
bun: {
agent: string;
run: string;
install: string;
frozen: string;
global: string;
add: string;
upgrade: string;
'upgrade-interactive': string;
execute: string;
uninstall: string;
global_uninstall: string;
};
};
type Agent = keyof typeof AGENTS;
type Command = keyof typeof AGENTS.npm;
declare const agents: Agent[];
declare const LOCKS: Record<string, Agent>;
type Agent = 'npm' | 'yarn' | 'yarn@berry' | 'pnpm' | 'pnpm@6' | 'bun';
type AgentName = 'npm' | 'yarn' | 'pnpm' | 'bun';
type AgentCommandValue = (string | number)[] | ((args?: string[]) => string[]) | null;
interface AgentCommands {
'agent': AgentCommandValue;
'run': AgentCommandValue;
'install': AgentCommandValue;
'frozen': AgentCommandValue;
'global': AgentCommandValue;
'add': AgentCommandValue;
'upgrade': AgentCommandValue;
'upgrade-interactive': AgentCommandValue;
'execute': AgentCommandValue;
'uninstall': AgentCommandValue;
'global_uninstall': AgentCommandValue;
}
type Command = keyof AgentCommands;
interface ResolvedCommand {
/**
* CLI command.
*/
command: string;
/**
* Arguments for the CLI command, merged with user arguments.
*/
args: string[];
}
declare const AGENTS: Agent[];
declare const LOCKS: Record<string, AgentName>;
declare const INSTALL_PAGE: Record<Agent, string>;
declare const COMMANDS: {
npm: AgentCommands;
yarn: AgentCommands;
'yarn@berry': AgentCommands;
pnpm: AgentCommands;
'pnpm@6': AgentCommands;
bun: AgentCommands;
};
declare function resolveCommand(agent: Agent, command: Command, args: string[]): ResolvedCommand | null;
declare function constructCommand(value: AgentCommandValue, args: string[]): ResolvedCommand | null;
interface Config {

@@ -94,4 +51,4 @@ defaultAgent: Agent | 'prompt';

declare function getConfig(): Promise<Config>;
declare function getDefaultAgent(programmatic?: boolean): Promise<"npm" | "pnpm" | "yarn" | "yarn@berry" | "pnpm@6" | "bun" | "prompt">;
declare function getGlobalAgent(): Promise<"npm" | "pnpm" | "yarn" | "yarn@berry" | "pnpm@6" | "bun">;
declare function getDefaultAgent(programmatic?: boolean): Promise<Agent | "prompt">;
declare function getGlobalAgent(): Promise<Agent>;

@@ -102,4 +59,11 @@ interface DetectOptions {

cwd?: string;
/**
* Should use Volta when present
*
* @see https://volta.sh/
* @default true
*/
detectVolta?: boolean;
}
declare function detect({ autoInstall, programmatic, cwd }?: DetectOptions): Promise<"npm" | "pnpm" | "yarn" | "yarn@berry" | "pnpm@6" | "bun" | null>;
declare function detect({ autoInstall, programmatic, cwd }?: DetectOptions): Promise<Agent | undefined>;

@@ -111,7 +75,7 @@ interface RunnerContext {

}
type Runner = (agent: Agent, args: string[], ctx?: RunnerContext) => Promise<string | undefined> | string | undefined;
type Runner = (agent: Agent, args: string[], ctx?: RunnerContext) => Promise<ResolvedCommand | undefined> | ResolvedCommand | undefined;
declare function runCli(fn: Runner, options?: DetectOptions & {
args?: string[];
}): Promise<void>;
declare function getCliCommand(fn: Runner, args: string[], options?: DetectOptions, cwd?: string): Promise<string | undefined>;
declare function getCliCommand(fn: Runner, args: string[], options?: DetectOptions, cwd?: string): Promise<ResolvedCommand | undefined>;
declare function run(fn: Runner, args: string[], options?: DetectOptions): Promise<void>;

@@ -125,3 +89,3 @@

}
declare function getCommand(agent: Agent, command: Command, args?: string[]): string;
declare function getCommand(agent: Agent, command: Command, args?: string[]): ResolvedCommand;
declare const parseNi: Runner;

@@ -133,2 +97,3 @@ declare const parseNr: Runner;

declare const parseNa: Runner;
declare function serializeCommand(command?: ResolvedCommand): string | undefined;

@@ -139,3 +104,2 @@ declare const CLI_TEMP_DIR: string;

declare function cmdExists(cmd: string): boolean;
declare function getVoltaPrefix(): string;
/**

@@ -148,2 +112,2 @@ * Write file safely avoiding conflicts

export { AGENTS, type Agent, CLI_TEMP_DIR, type Command, type DetectOptions, INSTALL_PAGE, LOCKS, type Runner, type RunnerContext, UnsupportedCommand, agents, cmdExists, detect, exclude, formatPackageWithUrl, getCliCommand, getCommand, getConfig, getDefaultAgent, getGlobalAgent, getVoltaPrefix, limitText, parseNa, parseNi, parseNlx, parseNr, parseNu, parseNun, remove, run, runCli, writeFileSafe };
export { AGENTS, CLI_TEMP_DIR, COMMANDS, type DetectOptions, INSTALL_PAGE, LOCKS, type Runner, type RunnerContext, UnsupportedCommand, cmdExists, constructCommand, detect, exclude, formatPackageWithUrl, getCliCommand, getCommand, getConfig, getDefaultAgent, getGlobalAgent, limitText, parseNa, parseNi, parseNlx, parseNr, parseNu, parseNun, remove, resolveCommand, run, runCli, serializeCommand, writeFileSafe };
{
"name": "@antfu/ni",
"type": "module",
"version": "0.22.4",
"packageManager": "pnpm@9.7.0",
"version": "0.23.0",
"packageManager": "pnpm@9.9.0",
"description": "Use the right package manager",
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
"license": "MIT",
"homepage": "https://github.com/antfu/ni#readme",
"homepage": "https://github.com/antfu-collective/ni#readme",
"repository": {
"type": "git",
"url": "git+https://github.com/antfu/ni.git"
"url": "git+https://github.com/antfu-collective/ni.git"
},
"bugs": {
"url": "https://github.com/antfu/ni/issues"
"url": "https://github.com/antfu-collective/ni/issues"
},
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",

@@ -47,2 +46,4 @@ "require": "./dist/index.cjs"

"release": "bumpp && npm publish",
"typecheck": "tsc",
"prepare": "npx simple-git-hooks",
"lint": "eslint .",

@@ -52,20 +53,22 @@ "test": "vitest"

"devDependencies": {
"@antfu/eslint-config": "^2.25.0",
"@jsdevtools/ez-spawn": "^3.0.4",
"@antfu/eslint-config": "^2.27.3",
"@posva/prompts": "^2.4.4",
"@types/fs-extra": "^11.0.4",
"@types/ini": "^4.1.1",
"@types/node": "^22.1.0",
"@types/node": "^22.5.0",
"@types/which": "^3.0.4",
"bumpp": "^9.4.2",
"eslint": "^9.8.0",
"fast-glob": "^3.3.2",
"find-up": "^6.3.0",
"bumpp": "^9.5.2",
"eslint": "^9.9.1",
"fs-extra": "^11.2.0",
"fzf": "^0.5.2",
"ini": "^4.1.3",
"kleur": "^4.1.5",
"taze": "^0.16.3",
"lint-staged": "^15.2.9",
"package-manager-detector": "^0.2.0",
"picocolors": "^1.0.1",
"simple-git-hooks": "^2.11.1",
"taze": "^0.16.6",
"terminal-link": "^3.0.0",
"tsx": "^4.17.0",
"tinyexec": "^0.3.0",
"tinyglobby": "^0.2.5",
"tsx": "^4.18.0",
"typescript": "^5.5.4",

@@ -75,3 +78,9 @@ "unbuild": "^2.0.0",

"which": "^4.0.0"
},
"simple-git-hooks": {
"pre-commit": "pnpm lint-staged"
},
"lint-staged": {
"*": "eslint --fix"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc