feat: init

This commit is contained in:
2026-02-13 22:02:30 +01:00
commit 8f9ff830fb
16711 changed files with 3307340 additions and 0 deletions

21
node_modules/nypm/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) Pooya Parsa <pooya@pi0.io>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

152
node_modules/nypm/README.md generated vendored Normal file
View File

@@ -0,0 +1,152 @@
# 🌈 nypm
<!-- automd:badges color="yellow" codecov -->
[![npm version](https://img.shields.io/npm/v/nypm?color=yellow)](https://npmjs.com/package/nypm)
[![npm downloads](https://img.shields.io/npm/dm/nypm?color=yellow)](https://npm.chart.dev/nypm)
[![codecov](https://img.shields.io/codecov/c/gh/unjs/nypm?color=yellow)](https://codecov.io/gh/unjs/nypm)
<!-- /automd -->
🌈 Unified Package Manager for Node.js (npm, pnpm, yarn), Bun and Deno.
✅ Supports [npm](https://docs.npmjs.com/cli/v10/commands/npm), [yarn](https://yarnpkg.com/), [pnpm](https://pnpm.io/), [bun](https://bun.sh/package-manager) and [deno](https://deno.com/) out of the box with a unified API.
✅ Provides an **API interface** to interact with package managers.
**Autodetects** project's package manager using `package.json` and known lockfiles.
**[corepack](https://github.com/nodejs/corepack)** integration for **pnpm** and **yarn**.
## `nypm` command
**Install dependencies:**
```sh
npx nypm i
```
**Add a dependency:**
```sh
npx nypm add defu
```
**Remove a dependency:**
```sh
npx nypm remove defu
```
## API Usage
Install package:
```sh
# ✨ Auto-detect
npx nypm install nypm
```
Import:
```js
// ESM import
import { addDependency } from "nypm";
// or dynamic import
const { addDependency } = await import("nypm");
```
### `addDependency(name, options)`
Adds dependency to the project.
### `addDevDependency(name, options)`
Adds dev dependency to the project.
### `detectPackageManager(cwd, options)`
Detect the package manager used in a directory (and up) by checking various sources:
1. Use `packageManager` field from package.json
2. Known lock files and other files
### `ensureDependencyInstalled(name, options)`
Ensures dependency is installed.
### `installDependencies(options)`
Installs project dependencies.
### `removeDependency(name, options)`
Removes dependency from the project.
### `dedupeDependencies(options)`
Dedupe project dependencies.
> [!NOTE]
> For `bun` and `deno` it will remove the lockfile and reinstall all dependencies.
### `runScript(name, options)`
Runs a script defined in the `package.json` file.
### `dlx(package, options)`
Download and execute a package with the package manager.
### `installDependenciesCommand(<pm>, { short?, frozenLockFile? })`
Get the command to install dependencies with the package manager.
### `addDependencyCommand(<pm>, <name>, { dev?, global?, workspace?, yarnBerry?, short? })`
Get the command to add a dependency with the package manager.
### `runScriptCommand(<pm>, <name>, { args? })`
Get the command to run a script with the package manager.
### `dlxCommand(<pm>, <name>, { args?, short?, packages? })`
Get the command to download and execute a package with the package manager.
## 💻 Development
- Clone this repository
- Play [Nyan Cat](https://www.nyan.cat/) in the background (really important!)
- Enable [Corepack](https://github.com/nodejs/corepack) using `corepack enable`
- Install dependencies using `pnpm install`
- Run interactive tests using `pnpm dev`
## Related Projects
NYPM is inspired from previous attempts and projects for unifying package manager experience.
- [pi0/yarnpm](https://github.com/pi0/yarnpm)
- [unjs/lmify](https://github.com/unjs/lmify)
- [antfu/ni](https://github.com/antfu/ni)
- [antfu/install-pkg](https://github.com/antfu/install-pkg)
- [egoist/dum](https://github.com/egoist/dum)
- [nodejs/corepack](https://github.com/nodejs/corepack)
## License
Made with 💛
Published under [MIT License](./LICENSE).
<!-- Badges -->
[npm-version-src]: https://img.shields.io/npm/v/nypm?style=flat-square
[npm-version-href]: https://npmjs.com/package/nypm
[npm-downloads-src]: https://img.shields.io/npm/dm/nypm?style=flat-square
[npm-downloads-href]: https://npmjs.com/package/nypm
[github-actions-src]: https://img.shields.io/github/actions/workflow/status/unjs/nypm/ci.yml?branch=main&style=flat-square
[github-actions-href]: https://github.com/unjs/nypm/actions?query=workflow%3Aci
[codecov-src]: https://img.shields.io/codecov/c/gh/unjs/nypm/main?style=flat-square
[codecov-href]: https://codecov.io/gh/unjs/nypm

1
node_modules/nypm/dist/cli.d.mts generated vendored Normal file
View File

@@ -0,0 +1 @@
export { };

460
node_modules/nypm/dist/cli.mjs generated vendored Executable file
View File

@@ -0,0 +1,460 @@
#!/usr/bin/env node
import { createRequire } from "node:module";
import { defineCommand, runMain } from "citty";
import { join, normalize, resolve } from "pathe";
import { x } from "tinyexec";
import * as fs from "node:fs";
import { existsSync } from "node:fs";
import { readFile } from "node:fs/promises";
import { join as join$1 } from "node:path";
var name = "nypm";
var version = "0.6.4";
var description = "Unified Package Manager for Node.js";
const packageManagers = [
{
name: "npm",
command: "npm",
lockFile: "package-lock.json"
},
{
name: "pnpm",
command: "pnpm",
lockFile: "pnpm-lock.yaml",
files: ["pnpm-workspace.yaml"]
},
{
name: "bun",
command: "bun",
lockFile: ["bun.lockb", "bun.lock"]
},
{
name: "yarn",
command: "yarn",
lockFile: "yarn.lock",
files: [".yarnrc.yml"]
},
{
name: "deno",
command: "deno",
lockFile: "deno.lock",
files: ["deno.json"]
}
];
async function detectPackageManager(cwd, options = {}) {
const detected = await findup(resolve(cwd || "."), async (path) => {
if (!options.ignorePackageJSON) {
const packageJSONPath = join(path, "package.json");
if (existsSync(packageJSONPath)) {
const packageJSON = JSON.parse(await readFile(packageJSONPath, "utf8"));
if (packageJSON?.packageManager) {
const { name, version = "0.0.0", buildMeta, warnings } = parsePackageManagerField(packageJSON.packageManager);
if (name) {
const majorVersion = version.split(".")[0];
const packageManager = packageManagers.find((pm) => pm.name === name && pm.majorVersion === majorVersion) || packageManagers.find((pm) => pm.name === name);
return {
name,
command: name,
version,
majorVersion,
buildMeta,
warnings,
files: packageManager?.files,
lockFile: packageManager?.lockFile
};
}
}
}
if (existsSync(join(path, "deno.json"))) return packageManagers.find((pm) => pm.name === "deno");
}
if (!options.ignoreLockFile) {
for (const packageManager of packageManagers) if ([packageManager.lockFile, packageManager.files].flat().filter(Boolean).some((file) => existsSync(resolve(path, file)))) return { ...packageManager };
}
}, { includeParentDirs: options.includeParentDirs ?? true });
if (!detected && !options.ignoreArgv) {
const scriptArg = process.argv[1];
if (scriptArg) {
for (const packageManager of packageManagers) if (new RegExp(`[/\\\\]\\.?${packageManager.command}`).test(scriptArg)) return packageManager;
}
}
return detected;
}
async function findup(cwd, match, options = {}) {
const segments = normalize(cwd).split("/");
while (segments.length > 0) {
const result = await match(segments.join("/") || "/");
if (result || !options.includeParentDirs) return result;
segments.pop();
}
}
async function readPackageJSON(cwd) {
return findup(cwd, (p) => {
const pkgPath = join$1(p, "package.json");
if (existsSync(pkgPath)) return readFile(pkgPath, "utf8").then((data) => JSON.parse(data));
});
}
function cached(fn) {
let v;
return () => {
if (v === void 0) v = fn().then((r) => {
v = r;
return v;
});
return v;
};
}
const hasCorepack = cached(async () => {
if (globalThis.process?.versions?.webcontainer) return false;
try {
const { exitCode } = await x("corepack", ["--version"]);
return exitCode === 0;
} catch {
return false;
}
});
async function executeCommand(command, args, options = {}) {
const xArgs = command !== "npm" && command !== "bun" && command !== "deno" && options.corepack !== false && await hasCorepack() ? ["corepack", [command, ...args]] : [command, args];
const { exitCode, stdout, stderr } = await x(xArgs[0], xArgs[1], { nodeOptions: {
cwd: resolve(options.cwd || process.cwd()),
env: options.env,
stdio: options.silent ? "pipe" : "inherit"
} });
if (exitCode !== 0) throw new Error(`\`${xArgs.flat().join(" ")}\` failed.${options.silent ? [
"",
stdout,
stderr
].join("\n") : ""}`);
}
const NO_PACKAGE_MANAGER_DETECTED_ERROR_MSG = "No package manager auto-detected.";
async function resolveOperationOptions(options = {}) {
const cwd = options.cwd || process.cwd();
const env = {
...process.env,
...options.env
};
const packageManager = (typeof options.packageManager === "string" ? packageManagers.find((pm) => pm.name === options.packageManager) : options.packageManager) || await detectPackageManager(options.cwd || process.cwd());
if (!packageManager) throw new Error(NO_PACKAGE_MANAGER_DETECTED_ERROR_MSG);
return {
cwd,
env,
silent: options.silent ?? false,
packageManager,
dev: options.dev ?? false,
workspace: options.workspace,
global: options.global ?? false,
dry: options.dry ?? false,
corepack: options.corepack ?? true
};
}
function getWorkspaceArgs(options) {
if (!options.workspace) return [];
const workspacePkg = typeof options.workspace === "string" && options.workspace !== "" ? options.workspace : void 0;
if (options.packageManager.name === "pnpm") return workspacePkg ? ["--filter", workspacePkg] : ["--workspace-root"];
if (options.packageManager.name === "npm") return workspacePkg ? ["-w", workspacePkg] : ["--workspaces"];
if (options.packageManager.name === "yarn") if (!options.packageManager.majorVersion || options.packageManager.majorVersion === "1") return workspacePkg ? ["--cwd", workspacePkg] : ["-W"];
else return workspacePkg ? ["workspace", workspacePkg] : [];
return [];
}
function parsePackageManagerField(packageManager) {
const [name, _version] = (packageManager || "").split("@");
const [version, buildMeta] = _version?.split("+") || [];
if (name && name !== "-" && /^(@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/.test(name)) return {
name,
version,
buildMeta
};
const sanitized = (name || "").replace(/\W+/g, "");
return {
name: sanitized,
version,
buildMeta,
warnings: [`Abnormal characters found in \`packageManager\` field, sanitizing from \`${name}\` to \`${sanitized}\``]
};
}
async function installDependencies(options = {}) {
const resolvedOptions = await resolveOperationOptions(options);
const commandArgs = options.frozenLockFile ? {
npm: ["ci"],
yarn: ["install", "--immutable"],
bun: ["install", "--frozen-lockfile"],
pnpm: ["install", "--frozen-lockfile"],
deno: ["install", "--frozen"]
}[resolvedOptions.packageManager.name] : ["install"];
if (options.ignoreWorkspace && resolvedOptions.packageManager.name === "pnpm") commandArgs.push("--ignore-workspace");
if (!resolvedOptions.dry) await executeCommand(resolvedOptions.packageManager.command, commandArgs, {
cwd: resolvedOptions.cwd,
silent: resolvedOptions.silent,
corepack: resolvedOptions.corepack
});
return { exec: {
command: resolvedOptions.packageManager.command,
args: commandArgs
} };
}
async function addDependency(name, options = {}) {
const resolvedOptions = await resolveOperationOptions(options);
const names = Array.isArray(name) ? name : [name];
if (resolvedOptions.packageManager.name === "deno") {
for (let i = 0; i < names.length; i++) if (!/^(npm|jsr|file):.+$/.test(names[i] || "")) names[i] = `npm:${names[i]}`;
}
if (names.length === 0) return {};
const args = (resolvedOptions.packageManager.name === "yarn" ? [
...getWorkspaceArgs(resolvedOptions),
resolvedOptions.global && resolvedOptions.packageManager.majorVersion === "1" ? "global" : "",
"add",
resolvedOptions.dev ? "-D" : "",
...names
] : [
resolvedOptions.packageManager.name === "npm" ? "install" : "add",
...getWorkspaceArgs(resolvedOptions),
resolvedOptions.dev ? "-D" : "",
resolvedOptions.global ? "-g" : "",
...names
]).filter(Boolean);
if (!resolvedOptions.dry) await executeCommand(resolvedOptions.packageManager.command, args, {
cwd: resolvedOptions.cwd,
silent: resolvedOptions.silent,
corepack: resolvedOptions.corepack
});
if (!resolvedOptions.dry && options.installPeerDependencies) {
const existingPkg = await readPackageJSON(resolvedOptions.cwd);
const peerDeps = [];
const peerDevDeps = [];
const _require = createRequire(join$1(resolvedOptions.cwd, "/_.js"));
for (const _name of names) {
const pkgName = _name.match(/^(.[^@]+)/)?.[0];
const pkg = await readPackageJSON(_require.resolve(pkgName));
if (!pkg?.peerDependencies || pkg?.name !== pkgName) continue;
for (const [peerDependency, version] of Object.entries(pkg.peerDependencies)) {
if (pkg.peerDependenciesMeta?.[peerDependency]?.optional) continue;
if (existingPkg?.dependencies?.[peerDependency] || existingPkg?.devDependencies?.[peerDependency]) continue;
(pkg.peerDependenciesMeta?.[peerDependency]?.dev ? peerDevDeps : peerDeps).push(`${peerDependency}@${version}`);
}
}
if (peerDeps.length > 0) await addDependency(peerDeps, { ...resolvedOptions });
if (peerDevDeps.length > 0) await addDevDependency(peerDevDeps, { ...resolvedOptions });
}
return { exec: {
command: resolvedOptions.packageManager.command,
args
} };
}
async function addDevDependency(name, options = {}) {
return await addDependency(name, {
...options,
dev: true
});
}
async function removeDependency(name, options = {}) {
const resolvedOptions = await resolveOperationOptions(options);
const names = Array.isArray(name) ? name : [name];
if (names.length === 0) return {};
const args = (resolvedOptions.packageManager.name === "yarn" ? [
resolvedOptions.global && resolvedOptions.packageManager.majorVersion === "1" ? "global" : "",
...getWorkspaceArgs(resolvedOptions),
"remove",
resolvedOptions.dev ? "-D" : "",
resolvedOptions.global ? "-g" : "",
...names
] : [
resolvedOptions.packageManager.name === "npm" ? "uninstall" : "remove",
...getWorkspaceArgs(resolvedOptions),
resolvedOptions.dev ? "-D" : "",
resolvedOptions.global ? "-g" : "",
...names
]).filter(Boolean);
if (!resolvedOptions.dry) await executeCommand(resolvedOptions.packageManager.command, args, {
cwd: resolvedOptions.cwd,
silent: resolvedOptions.silent,
corepack: resolvedOptions.corepack
});
return { exec: {
command: resolvedOptions.packageManager.command,
args
} };
}
async function dedupeDependencies(options = {}) {
const resolvedOptions = await resolveOperationOptions(options);
const isSupported = !["bun", "deno"].includes(resolvedOptions.packageManager.name);
if (options.recreateLockfile ?? !isSupported) {
const lockfiles = Array.isArray(resolvedOptions.packageManager.lockFile) ? resolvedOptions.packageManager.lockFile : [resolvedOptions.packageManager.lockFile];
for (const lockfile of lockfiles) if (lockfile) fs.rmSync(resolve(resolvedOptions.cwd, lockfile), { force: true });
return await installDependencies(resolvedOptions);
}
if (isSupported) {
const isyarnv1 = resolvedOptions.packageManager.name === "yarn" && resolvedOptions.packageManager.majorVersion === "1";
if (!resolvedOptions.dry) await executeCommand(resolvedOptions.packageManager.command, [isyarnv1 ? "install" : "dedupe"], {
cwd: resolvedOptions.cwd,
silent: resolvedOptions.silent,
corepack: resolvedOptions.corepack
});
return { exec: {
command: resolvedOptions.packageManager.command,
args: [isyarnv1 ? "install" : "dedupe"]
} };
}
throw new Error(`Deduplication is not supported for ${resolvedOptions.packageManager.name}`);
}
async function runScript(name, options = {}) {
const resolvedOptions = await resolveOperationOptions(options);
const args = [
resolvedOptions.packageManager.name === "deno" ? "task" : "run",
name,
...options.args || []
];
if (!resolvedOptions.dry) await executeCommand(resolvedOptions.packageManager.command, args, {
cwd: resolvedOptions.cwd,
env: resolvedOptions.env,
silent: resolvedOptions.silent,
corepack: resolvedOptions.corepack
});
return { exec: {
command: resolvedOptions.packageManager.command,
args
} };
}
const operationArgs = {
cwd: {
type: "string",
description: "Current working directory"
},
workspace: {
type: "boolean",
description: "Add to workspace"
},
silent: {
type: "boolean",
description: "Run in silent mode"
},
corepack: {
type: "boolean",
default: true,
description: "Use corepack"
},
dry: {
type: "boolean",
description: "Run in dry run mode (does not execute commands)"
}
};
const install = defineCommand({
meta: { description: "Install dependencies" },
args: {
...operationArgs,
name: {
type: "positional",
description: "Dependency name",
required: false
},
dev: {
type: "boolean",
alias: "D",
description: "Add as dev dependency"
},
global: {
type: "boolean",
alias: "g",
description: "Add globally"
},
"frozen-lockfile": {
type: "boolean",
description: "Install dependencies with frozen lock file"
},
"install-peer-dependencies": {
type: "boolean",
description: "Also install peer dependencies"
}
},
run: async ({ args }) => {
handleRes(await (args._.length > 0 ? addDependency(args._, args) : installDependencies(args)), args);
}
});
const remove = defineCommand({
meta: { description: "Remove dependencies" },
args: {
name: {
type: "positional",
description: "Dependency name",
required: true
},
...operationArgs
},
run: async ({ args }) => {
handleRes(await removeDependency(args._, args), args);
}
});
const detect = defineCommand({
meta: { description: "Detect the current package manager" },
args: { cwd: {
type: "string",
description: "Current working directory"
} },
run: async ({ args }) => {
const cwd = resolve(args.cwd || ".");
const packageManager = await detectPackageManager(cwd);
if (packageManager?.warnings) for (const warning of packageManager.warnings) console.warn(warning);
if (!packageManager) {
console.error(`Cannot detect package manager in "${cwd}"`);
return process.exit(1);
}
console.log(`Detected package manager in "${cwd}": "${packageManager.name}@${packageManager.version}"`);
}
});
const dedupe = defineCommand({
meta: { description: "Dedupe dependencies" },
args: {
cwd: {
type: "string",
description: "Current working directory"
},
silent: {
type: "boolean",
description: "Run in silent mode"
},
recreateLockFile: {
type: "boolean",
description: "Recreate lock file"
}
},
run: async ({ args }) => {
handleRes(await dedupeDependencies(args), args);
}
});
const run = defineCommand({
meta: { description: "Run script" },
args: {
name: {
type: "positional",
description: "Script name",
required: true
},
...operationArgs
},
run: async ({ args }) => {
handleRes(await runScript(args.name, {
...args,
args: args._.slice(1)
}), args);
}
});
runMain(defineCommand({
meta: {
name,
version,
description
},
subCommands: {
install,
i: install,
add: install,
remove,
rm: remove,
uninstall: remove,
un: remove,
detect,
dedupe,
run
}
}));
function handleRes(result, args) {
if (args.dry && !args.silent) console.log(`${result.exec?.command} ${result.exec?.args.join(" ")}`);
}
export {};

209
node_modules/nypm/dist/index.d.mts generated vendored Normal file
View File

@@ -0,0 +1,209 @@
//#region src/types.d.ts
type PackageManagerName = "npm" | "yarn" | "pnpm" | "bun" | "deno";
type PackageManager = {
name: PackageManagerName;
command: string;
version?: string;
buildMeta?: string;
majorVersion?: string;
lockFile?: string | string[];
files?: string[];
};
type OperationOptions = {
cwd?: string;
env?: Record<string, string>;
silent?: boolean;
packageManager?: PackageManager | PackageManagerName;
installPeerDependencies?: boolean;
dev?: boolean;
workspace?: boolean | string;
global?: boolean;
corepack?: boolean; /** Do not execute actual command */
dry?: boolean;
};
type OperationResult = {
exec?: {
command: string;
args: string[];
};
};
//#endregion
//#region src/package-manager.d.ts
type DetectPackageManagerOptions = {
/**
* Whether to ignore the lock file
*
* @default false
*/
ignoreLockFile?: boolean;
/**
* Whether to ignore the package.json file
*
* @default false
*/
ignorePackageJSON?: boolean;
/**
* Whether to include parent directories
*
* @default false
*/
includeParentDirs?: boolean;
/**
* Weather to ignore argv[1] to detect script
*/
ignoreArgv?: boolean;
};
declare const packageManagers: PackageManager[];
/**
* Detect the package manager used in a directory (and up) by checking various sources:
*
* 1. Use `packageManager` field from package.json
*
* 2. Known lock files and other files
*/
declare function detectPackageManager(cwd: string, options?: DetectPackageManagerOptions): Promise<(PackageManager & {
warnings?: string[];
}) | undefined>;
//#endregion
//#region src/api.d.ts
/**
* Installs project dependencies.
*
* @param options - Options to pass to the API call.
* @param options.cwd - The directory to run the command in.
* @param options.silent - Whether to run the command in silent mode.
* @param options.packageManager - The package manager info to use (auto-detected).
* @param options.frozenLockFile - Whether to install dependencies with frozen lock file.
*/
declare function installDependencies(options?: Pick<OperationOptions, "cwd" | "silent" | "packageManager" | "dry" | "corepack"> & {
frozenLockFile?: boolean;
ignoreWorkspace?: boolean;
}): Promise<OperationResult>;
/**
* Adds dependency to the project.
*
* @param name - Name of the dependency to add.
* @param options - Options to pass to the API call.
* @param options.cwd - The directory to run the command in.
* @param options.silent - Whether to run the command in silent mode.
* @param options.packageManager - The package manager info to use (auto-detected).
* @param options.dev - Whether to add the dependency as dev dependency.
* @param options.workspace - The name of the workspace to use.
* @param options.global - Whether to run the command in global mode.
*/
declare function addDependency(name: string | string[], options?: OperationOptions): Promise<OperationResult>;
/**
* Adds dev dependency to the project.
*
* @param name - Name of the dev dependency to add.
* @param options - Options to pass to the API call.
* @param options.cwd - The directory to run the command in.
* @param options.silent - Whether to run the command in silent mode.
* @param options.packageManager - The package manager info to use (auto-detected).
* @param options.workspace - The name of the workspace to use.
* @param options.global - Whether to run the command in global mode.
*
*/
declare function addDevDependency(name: string | string[], options?: Omit<OperationOptions, "dev">): Promise<OperationResult>;
/**
* Removes dependency from the project.
*
* @param name - Name of the dependency to remove.
* @param options - Options to pass to the API call.
* @param options.cwd - The directory to run the command in.
* @param options.silent - Whether to run the command in silent mode.
* @param options.packageManager - The package manager info to use (auto-detected).
* @param options.dev - Whether to remove dev dependency.
* @param options.workspace - The name of the workspace to use.
* @param options.global - Whether to run the command in global mode.
*/
declare function removeDependency(name: string | string[], options?: OperationOptions): Promise<OperationResult>;
/**
* Ensures dependency is installed.
*
* @param name - Name of the dependency.
* @param options - Options to pass to the API call.
* @param options.cwd - The directory to run the command in.
* @param options.dev - Whether to install as dev dependency (if not already installed).
* @param options.workspace - The name of the workspace to install dependency in (if not already installed).
*/
declare function ensureDependencyInstalled(name: string, options?: Pick<OperationOptions, "cwd" | "dev" | "workspace">): Promise<true | undefined>;
/**
* Dedupe dependencies in the project.
*
* @param options - Options to pass to the API call.
* @param options.cwd - The directory to run the command in.
* @param options.packageManager - The package manager info to use (auto-detected).
* @param options.silent - Whether to run the command in silent mode.
* @param options.recreateLockfile - Whether to recreate the lockfile instead of deduping.
*/
declare function dedupeDependencies(options?: Pick<OperationOptions, "cwd" | "silent" | "packageManager" | "dry" | "corepack"> & {
recreateLockfile?: boolean;
}): Promise<OperationResult>;
/**
* Runs a script defined in the package.json file.
*
* @param name - Name of the script to run.
* @param options - Options to pass to the API call.
* @param options.cwd - The directory to run the command in.
* @param options.env - Additional environment variables to set for the script execution.
* @param options.silent - Whether to run the command in silent mode.
* @param options.packageManager - The package manager info to use (auto-detected).
* @param options.args - Additional arguments to pass to the script.
*/
declare function runScript(name: string, options?: Pick<OperationOptions, "cwd" | "env" | "silent" | "packageManager" | "dry" | "corepack"> & {
args?: string[];
}): Promise<OperationResult>;
/**
* Download and execute a package with the package manager.
*
* @param name - Name of the package to download and execute.
* @param options - Options to pass to the API call.
* @param options.cwd - The directory to run the command in.
* @param options.env - Additional environment variables to set for the command execution.
* @param options.silent - Whether to run the command in silent mode.
* @param options.packageManager - The package manager info to use (auto-detected).
* @param options.args - The arguments to pass to the command.
* @param options.short - Whether to use the short version of the command (e.g. pnpx instead of pnpm dlx).
* @param options.packages - The packages to pass to the command (e.g. npx --package=<package1> --package=<package2> <command>).
*/
declare function dlx(name: string, options?: Pick<OperationOptions, "cwd" | "env" | "silent" | "packageManager" | "dry" | "corepack"> & {
args?: string[];
short?: boolean;
packages?: string[];
}): Promise<OperationResult>;
//#endregion
//#region src/cmd.d.ts
/**
* Get the command to install dependencies with the package manager.
*/
declare function installDependenciesCommand(packageManager: PackageManagerName, options?: {
short?: boolean;
frozenLockFile?: boolean;
}): string;
/**
* Get the command to add a dependency with the package manager.
*/
declare function addDependencyCommand(packageManager: PackageManagerName, name: string | string[], options?: {
dev?: boolean;
global?: boolean;
yarnBerry?: boolean;
workspace?: boolean | string;
short?: boolean;
}): string;
/**
* Get the command to run a script with the package manager.
*/
declare function runScriptCommand(packageManager: PackageManagerName, name: string, options?: {
args?: string[];
}): string;
/**
* Get the command to download and execute a package with the package manager.
*/
declare function dlxCommand(packageManager: PackageManagerName, name: string, options?: {
args?: string[];
short?: boolean;
packages?: string[];
}): string;
//#endregion
export { DetectPackageManagerOptions, OperationOptions, OperationResult, PackageManager, PackageManagerName, addDependency, addDependencyCommand, addDevDependency, dedupeDependencies, detectPackageManager, dlx, dlxCommand, ensureDependencyInstalled, installDependencies, installDependenciesCommand, packageManagers, removeDependency, runScript, runScriptCommand };

423
node_modules/nypm/dist/index.mjs generated vendored Normal file
View File

@@ -0,0 +1,423 @@
import { createRequire } from "node:module";
import * as fs from "node:fs";
import { existsSync } from "node:fs";
import { readFile } from "node:fs/promises";
import { join, normalize, resolve } from "pathe";
import { x } from "tinyexec";
import { join as join$1 } from "node:path";
async function findup(cwd, match, options = {}) {
const segments = normalize(cwd).split("/");
while (segments.length > 0) {
const result = await match(segments.join("/") || "/");
if (result || !options.includeParentDirs) return result;
segments.pop();
}
}
async function readPackageJSON(cwd) {
return findup(cwd, (p) => {
const pkgPath = join$1(p, "package.json");
if (existsSync(pkgPath)) return readFile(pkgPath, "utf8").then((data) => JSON.parse(data));
});
}
function cached(fn) {
let v;
return () => {
if (v === void 0) v = fn().then((r) => {
v = r;
return v;
});
return v;
};
}
const hasCorepack = cached(async () => {
if (globalThis.process?.versions?.webcontainer) return false;
try {
const { exitCode } = await x("corepack", ["--version"]);
return exitCode === 0;
} catch {
return false;
}
});
async function executeCommand(command, args, options = {}) {
const xArgs = command !== "npm" && command !== "bun" && command !== "deno" && options.corepack !== false && await hasCorepack() ? ["corepack", [command, ...args]] : [command, args];
const { exitCode, stdout, stderr } = await x(xArgs[0], xArgs[1], { nodeOptions: {
cwd: resolve(options.cwd || process.cwd()),
env: options.env,
stdio: options.silent ? "pipe" : "inherit"
} });
if (exitCode !== 0) throw new Error(`\`${xArgs.flat().join(" ")}\` failed.${options.silent ? [
"",
stdout,
stderr
].join("\n") : ""}`);
}
const NO_PACKAGE_MANAGER_DETECTED_ERROR_MSG = "No package manager auto-detected.";
async function resolveOperationOptions(options = {}) {
const cwd = options.cwd || process.cwd();
const env = {
...process.env,
...options.env
};
const packageManager = (typeof options.packageManager === "string" ? packageManagers.find((pm) => pm.name === options.packageManager) : options.packageManager) || await detectPackageManager(options.cwd || process.cwd());
if (!packageManager) throw new Error(NO_PACKAGE_MANAGER_DETECTED_ERROR_MSG);
return {
cwd,
env,
silent: options.silent ?? false,
packageManager,
dev: options.dev ?? false,
workspace: options.workspace,
global: options.global ?? false,
dry: options.dry ?? false,
corepack: options.corepack ?? true
};
}
function getWorkspaceArgs(options) {
if (!options.workspace) return [];
const workspacePkg = typeof options.workspace === "string" && options.workspace !== "" ? options.workspace : void 0;
if (options.packageManager.name === "pnpm") return workspacePkg ? ["--filter", workspacePkg] : ["--workspace-root"];
if (options.packageManager.name === "npm") return workspacePkg ? ["-w", workspacePkg] : ["--workspaces"];
if (options.packageManager.name === "yarn") if (!options.packageManager.majorVersion || options.packageManager.majorVersion === "1") return workspacePkg ? ["--cwd", workspacePkg] : ["-W"];
else return workspacePkg ? ["workspace", workspacePkg] : [];
return [];
}
function getWorkspaceArgs2(options) {
if (!options.workspace) return [];
const workspacePkg = typeof options.workspace === "string" && options.workspace !== "" ? options.workspace : void 0;
if (options.packageManager === "pnpm") return workspacePkg ? ["--filter", workspacePkg] : ["--workspace-root"];
if (options.packageManager === "npm") return workspacePkg ? ["-w", workspacePkg] : ["--workspaces"];
if (options.packageManager === "yarn") if (options.yarnBerry) return workspacePkg ? ["workspace", workspacePkg] : [];
else return workspacePkg ? ["--cwd", workspacePkg] : ["-W"];
return [];
}
function fmtCommand(args) {
return args.filter(Boolean).map((arg, i) => i > 0 && arg.includes(" ") ? `"${arg}"` : arg).join(" ");
}
function doesDependencyExist(name, options) {
const require = createRequire(options.cwd.endsWith("/") ? options.cwd : options.cwd + "/");
try {
return require.resolve(name).startsWith(options.cwd);
} catch {
return false;
}
}
function parsePackageManagerField(packageManager) {
const [name, _version] = (packageManager || "").split("@");
const [version, buildMeta] = _version?.split("+") || [];
if (name && name !== "-" && /^(@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/.test(name)) return {
name,
version,
buildMeta
};
const sanitized = (name || "").replace(/\W+/g, "");
return {
name: sanitized,
version,
buildMeta,
warnings: [`Abnormal characters found in \`packageManager\` field, sanitizing from \`${name}\` to \`${sanitized}\``]
};
}
const packageManagers = [
{
name: "npm",
command: "npm",
lockFile: "package-lock.json"
},
{
name: "pnpm",
command: "pnpm",
lockFile: "pnpm-lock.yaml",
files: ["pnpm-workspace.yaml"]
},
{
name: "bun",
command: "bun",
lockFile: ["bun.lockb", "bun.lock"]
},
{
name: "yarn",
command: "yarn",
lockFile: "yarn.lock",
files: [".yarnrc.yml"]
},
{
name: "deno",
command: "deno",
lockFile: "deno.lock",
files: ["deno.json"]
}
];
async function detectPackageManager(cwd, options = {}) {
const detected = await findup(resolve(cwd || "."), async (path) => {
if (!options.ignorePackageJSON) {
const packageJSONPath = join(path, "package.json");
if (existsSync(packageJSONPath)) {
const packageJSON = JSON.parse(await readFile(packageJSONPath, "utf8"));
if (packageJSON?.packageManager) {
const { name, version = "0.0.0", buildMeta, warnings } = parsePackageManagerField(packageJSON.packageManager);
if (name) {
const majorVersion = version.split(".")[0];
const packageManager = packageManagers.find((pm) => pm.name === name && pm.majorVersion === majorVersion) || packageManagers.find((pm) => pm.name === name);
return {
name,
command: name,
version,
majorVersion,
buildMeta,
warnings,
files: packageManager?.files,
lockFile: packageManager?.lockFile
};
}
}
}
if (existsSync(join(path, "deno.json"))) return packageManagers.find((pm) => pm.name === "deno");
}
if (!options.ignoreLockFile) {
for (const packageManager of packageManagers) if ([packageManager.lockFile, packageManager.files].flat().filter(Boolean).some((file) => existsSync(resolve(path, file)))) return { ...packageManager };
}
}, { includeParentDirs: options.includeParentDirs ?? true });
if (!detected && !options.ignoreArgv) {
const scriptArg = process.argv[1];
if (scriptArg) {
for (const packageManager of packageManagers) if (new RegExp(`[/\\\\]\\.?${packageManager.command}`).test(scriptArg)) return packageManager;
}
}
return detected;
}
function installDependenciesCommand(packageManager, options = {}) {
const installCmd = options.short ? "i" : "install";
const pmToFrozenLockfileInstallCommand = {
npm: ["ci"],
yarn: [installCmd, "--immutable"],
bun: [installCmd, "--frozen-lockfile"],
pnpm: [installCmd, "--frozen-lockfile"],
deno: [installCmd, "--frozen"]
};
return fmtCommand([packageManager, ...options.frozenLockFile ? pmToFrozenLockfileInstallCommand[packageManager] : [installCmd]]);
}
function addDependencyCommand(packageManager, name, options = {}) {
const names = Array.isArray(name) ? name : [name];
if (packageManager === "deno") {
for (let i = 0; i < names.length; i++) if (!/^(npm|jsr|file):.+$/.test(names[i])) names[i] = `npm:${names[i]}`;
}
return fmtCommand([packageManager, ...(packageManager === "yarn" ? [
...getWorkspaceArgs2({
packageManager,
...options
}),
options.global && !options.yarnBerry ? "global" : "",
"add",
options.dev ? options.short ? "-D" : "--dev" : "",
...names
] : [
packageManager === "npm" ? options.short ? "i" : "install" : "add",
...getWorkspaceArgs2({
packageManager,
...options
}),
options.dev ? options.short ? "-D" : "--dev" : "",
options.global ? "-g" : "",
...names
]).filter(Boolean)]);
}
function runScriptCommand(packageManager, name, options = {}) {
return fmtCommand([packageManager, ...[
packageManager === "deno" ? "task" : "run",
name,
...options.args || []
]]);
}
function dlxCommand(packageManager, name, options = {}) {
const command = {
npm: options.short ? "npx" : "npm exec",
yarn: "yarn dlx",
pnpm: options.short ? "pnpx" : "pnpm dlx",
bun: options.short ? "bunx" : "bun x",
deno: "deno run -A"
}[packageManager];
let packages = options.packages || [];
if (packageManager === "deno") {
if (!name.startsWith("npm:")) name = `npm:${name}`;
packages = packages.map((pkg) => pkg.startsWith("npm:") ? pkg : `npm:${pkg}`);
}
const packageArgs = [];
if (packages.length > 0 && packageManager !== "deno") {
const packageFlag = options.short && /^npm|yarn$/.test(packageManager) ? "-p" : "--package";
for (const pkg of packages) packageArgs.push(`${packageFlag}=${pkg}`);
}
const argSep = packageManager === "npm" && !options.short ? "--" : "";
return fmtCommand([
command,
...packageArgs,
name,
argSep,
...options.args || []
]);
}
async function installDependencies(options = {}) {
const resolvedOptions = await resolveOperationOptions(options);
const commandArgs = options.frozenLockFile ? {
npm: ["ci"],
yarn: ["install", "--immutable"],
bun: ["install", "--frozen-lockfile"],
pnpm: ["install", "--frozen-lockfile"],
deno: ["install", "--frozen"]
}[resolvedOptions.packageManager.name] : ["install"];
if (options.ignoreWorkspace && resolvedOptions.packageManager.name === "pnpm") commandArgs.push("--ignore-workspace");
if (!resolvedOptions.dry) await executeCommand(resolvedOptions.packageManager.command, commandArgs, {
cwd: resolvedOptions.cwd,
silent: resolvedOptions.silent,
corepack: resolvedOptions.corepack
});
return { exec: {
command: resolvedOptions.packageManager.command,
args: commandArgs
} };
}
async function addDependency(name, options = {}) {
const resolvedOptions = await resolveOperationOptions(options);
const names = Array.isArray(name) ? name : [name];
if (resolvedOptions.packageManager.name === "deno") {
for (let i = 0; i < names.length; i++) if (!/^(npm|jsr|file):.+$/.test(names[i] || "")) names[i] = `npm:${names[i]}`;
}
if (names.length === 0) return {};
const args = (resolvedOptions.packageManager.name === "yarn" ? [
...getWorkspaceArgs(resolvedOptions),
resolvedOptions.global && resolvedOptions.packageManager.majorVersion === "1" ? "global" : "",
"add",
resolvedOptions.dev ? "-D" : "",
...names
] : [
resolvedOptions.packageManager.name === "npm" ? "install" : "add",
...getWorkspaceArgs(resolvedOptions),
resolvedOptions.dev ? "-D" : "",
resolvedOptions.global ? "-g" : "",
...names
]).filter(Boolean);
if (!resolvedOptions.dry) await executeCommand(resolvedOptions.packageManager.command, args, {
cwd: resolvedOptions.cwd,
silent: resolvedOptions.silent,
corepack: resolvedOptions.corepack
});
if (!resolvedOptions.dry && options.installPeerDependencies) {
const existingPkg = await readPackageJSON(resolvedOptions.cwd);
const peerDeps = [];
const peerDevDeps = [];
const _require = createRequire(join$1(resolvedOptions.cwd, "/_.js"));
for (const _name of names) {
const pkgName = _name.match(/^(.[^@]+)/)?.[0];
const pkg = await readPackageJSON(_require.resolve(pkgName));
if (!pkg?.peerDependencies || pkg?.name !== pkgName) continue;
for (const [peerDependency, version] of Object.entries(pkg.peerDependencies)) {
if (pkg.peerDependenciesMeta?.[peerDependency]?.optional) continue;
if (existingPkg?.dependencies?.[peerDependency] || existingPkg?.devDependencies?.[peerDependency]) continue;
(pkg.peerDependenciesMeta?.[peerDependency]?.dev ? peerDevDeps : peerDeps).push(`${peerDependency}@${version}`);
}
}
if (peerDeps.length > 0) await addDependency(peerDeps, { ...resolvedOptions });
if (peerDevDeps.length > 0) await addDevDependency(peerDevDeps, { ...resolvedOptions });
}
return { exec: {
command: resolvedOptions.packageManager.command,
args
} };
}
async function addDevDependency(name, options = {}) {
return await addDependency(name, {
...options,
dev: true
});
}
async function removeDependency(name, options = {}) {
const resolvedOptions = await resolveOperationOptions(options);
const names = Array.isArray(name) ? name : [name];
if (names.length === 0) return {};
const args = (resolvedOptions.packageManager.name === "yarn" ? [
resolvedOptions.global && resolvedOptions.packageManager.majorVersion === "1" ? "global" : "",
...getWorkspaceArgs(resolvedOptions),
"remove",
resolvedOptions.dev ? "-D" : "",
resolvedOptions.global ? "-g" : "",
...names
] : [
resolvedOptions.packageManager.name === "npm" ? "uninstall" : "remove",
...getWorkspaceArgs(resolvedOptions),
resolvedOptions.dev ? "-D" : "",
resolvedOptions.global ? "-g" : "",
...names
]).filter(Boolean);
if (!resolvedOptions.dry) await executeCommand(resolvedOptions.packageManager.command, args, {
cwd: resolvedOptions.cwd,
silent: resolvedOptions.silent,
corepack: resolvedOptions.corepack
});
return { exec: {
command: resolvedOptions.packageManager.command,
args
} };
}
async function ensureDependencyInstalled(name, options = {}) {
const resolvedOptions = await resolveOperationOptions(options);
if (doesDependencyExist(name, resolvedOptions)) return true;
await addDependency(name, resolvedOptions);
}
async function dedupeDependencies(options = {}) {
const resolvedOptions = await resolveOperationOptions(options);
const isSupported = !["bun", "deno"].includes(resolvedOptions.packageManager.name);
if (options.recreateLockfile ?? !isSupported) {
const lockfiles = Array.isArray(resolvedOptions.packageManager.lockFile) ? resolvedOptions.packageManager.lockFile : [resolvedOptions.packageManager.lockFile];
for (const lockfile of lockfiles) if (lockfile) fs.rmSync(resolve(resolvedOptions.cwd, lockfile), { force: true });
return await installDependencies(resolvedOptions);
}
if (isSupported) {
const isyarnv1 = resolvedOptions.packageManager.name === "yarn" && resolvedOptions.packageManager.majorVersion === "1";
if (!resolvedOptions.dry) await executeCommand(resolvedOptions.packageManager.command, [isyarnv1 ? "install" : "dedupe"], {
cwd: resolvedOptions.cwd,
silent: resolvedOptions.silent,
corepack: resolvedOptions.corepack
});
return { exec: {
command: resolvedOptions.packageManager.command,
args: [isyarnv1 ? "install" : "dedupe"]
} };
}
throw new Error(`Deduplication is not supported for ${resolvedOptions.packageManager.name}`);
}
async function runScript(name, options = {}) {
const resolvedOptions = await resolveOperationOptions(options);
const args = [
resolvedOptions.packageManager.name === "deno" ? "task" : "run",
name,
...options.args || []
];
if (!resolvedOptions.dry) await executeCommand(resolvedOptions.packageManager.command, args, {
cwd: resolvedOptions.cwd,
env: resolvedOptions.env,
silent: resolvedOptions.silent,
corepack: resolvedOptions.corepack
});
return { exec: {
command: resolvedOptions.packageManager.command,
args
} };
}
async function dlx(name, options = {}) {
const resolvedOptions = await resolveOperationOptions(options);
const [command, ...args] = dlxCommand(resolvedOptions.packageManager.name, name, {
args: options.args,
short: options.short,
packages: options.packages
}).split(" ");
if (!resolvedOptions.dry) await executeCommand(command, args, {
cwd: resolvedOptions.cwd,
env: resolvedOptions.env,
silent: resolvedOptions.silent,
corepack: resolvedOptions.corepack
});
return { exec: {
command,
args
} };
}
export { addDependency, addDependencyCommand, addDevDependency, dedupeDependencies, detectPackageManager, dlx, dlxCommand, ensureDependencyInstalled, installDependencies, installDependenciesCommand, packageManagers, removeDependency, runScript, runScriptCommand };

21
node_modules/nypm/node_modules/citty/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) Pooya Parsa <pooya@pi0.io>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

105
node_modules/nypm/node_modules/citty/README.md generated vendored Normal file
View File

@@ -0,0 +1,105 @@
# 🌆 citty
<!-- automd:badges color=yellow bundlephobia -->
[![npm version](https://img.shields.io/npm/v/citty?color=yellow)](https://npmjs.com/package/citty)
[![npm downloads](https://img.shields.io/npm/dm/citty?color=yellow)](https://npmjs.com/package/citty)
[![bundle size](https://img.shields.io/bundlephobia/minzip/citty?color=yellow)](https://bundlephobia.com/package/citty)
<!-- /automd -->
Elegant CLI Builder
- Zero dependency
- Fast and lightweight argument parser (based on native [Node.js `util.parseArgs`](https://nodejs.org/api/util.html#utilparseargsconfig))
- Smart value parsing with typecast and boolean shortcuts
- Nested sub-commands
- Lazy and Async commands
- Pluggable and composable API
- Auto generated usage and help
## Usage
Install package:
```sh
npx nypm add -D citty
```
Import:
```js
import { defineCommand, runMain } from "citty";
```
Define main command to run:
```ts
import { defineCommand, runMain } from "citty";
const main = defineCommand({
meta: {
name: "hello",
version: "1.0.0",
description: "My Awesome CLI App",
},
args: {
name: {
type: "positional",
description: "Your name",
required: true,
},
friendly: {
type: "boolean",
description: "Use friendly greeting",
},
},
run({ args }) {
console.log(`${args.friendly ? "Hi" : "Greetings"} ${args.name}!`);
},
});
runMain(main);
```
## Utils
### `defineCommand`
`defineCommand` is a type helper for defining commands.
### `runMain`
Runs a command with usage support and graceful error handling.
### `createMain`
Create a wrapper around command that calls `runMain` when called.
### `runCommand`
Parses input args and runs command and sub-commands (unsupervised). You can access `result` key from returnd/awaited value to access command's result.
### `parseArgs`
Parses input arguments and applies defaults.
### `renderUsage`
Renders command usage to a string value.
### `showUsage`
Renders usage and prints to the console
## Development
- Clone this repository
- Install latest LTS version of [Node.js](https://nodejs.org/en/)
- Enable [Corepack](https://github.com/nodejs/corepack) using `corepack enable`
- Install dependencies using `pnpm install`
- Run interactive tests using `pnpm dev`
## License
Made with 💛 Published under [MIT License](./LICENSE).

View File

@@ -0,0 +1,33 @@
# Licenses of Bundled Dependencies
The published artifact additionally contains code with the following licenses:
MIT
# Bundled Dependencies
## scule
License: MIT
Repository: https://github.com/unjs/scule
> MIT License
>
> Copyright (c) Pooya Parsa <pooya@pi0.io>
>
> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal
> in the Software without restriction, including without limitation the rights
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> copies of the Software, and to permit persons to whom the Software is
> furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in all
> copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> SOFTWARE.

View File

@@ -0,0 +1,65 @@
const NUMBER_CHAR_RE = /\d/;
const STR_SPLITTERS = [
"-",
"_",
"/",
"."
];
function isUppercase(char = "") {
if (NUMBER_CHAR_RE.test(char)) return;
return char !== char.toLowerCase();
}
function splitByCase(str, separators) {
const splitters = separators ?? STR_SPLITTERS;
const parts = [];
if (!str || typeof str !== "string") return parts;
let buff = "";
let previousUpper;
let previousSplitter;
for (const char of str) {
const isSplitter = splitters.includes(char);
if (isSplitter === true) {
parts.push(buff);
buff = "";
previousUpper = void 0;
continue;
}
const isUpper = isUppercase(char);
if (previousSplitter === false) {
if (previousUpper === false && isUpper === true) {
parts.push(buff);
buff = char;
previousUpper = isUpper;
continue;
}
if (previousUpper === true && isUpper === false && buff.length > 1) {
const lastChar = buff.at(-1);
parts.push(buff.slice(0, Math.max(0, buff.length - 1)));
buff = lastChar + char;
previousUpper = isUpper;
continue;
}
}
buff += char;
previousUpper = isUpper;
previousSplitter = isSplitter;
}
parts.push(buff);
return parts;
}
function upperFirst(str) {
return str ? str[0].toUpperCase() + str.slice(1) : "";
}
function lowerFirst(str) {
return str ? str[0].toLowerCase() + str.slice(1) : "";
}
function pascalCase(str, opts) {
return str ? (Array.isArray(str) ? str : splitByCase(str)).map((p) => upperFirst(opts?.normalize ? p.toLowerCase() : p)).join("") : "";
}
function camelCase(str, opts) {
return lowerFirst(pascalCase(str || "", opts));
}
function kebabCase(str, joiner) {
return str ? (Array.isArray(str) ? str : splitByCase(str)).map((p) => p.toLowerCase()).join(joiner ?? "-") : "";
}
export { kebabCase as n, camelCase as t };

101
node_modules/nypm/node_modules/citty/dist/index.d.mts generated vendored Normal file
View File

@@ -0,0 +1,101 @@
//#region src/types.d.ts
type ArgType = "boolean" | "string" | "enum" | "positional" | undefined;
type _ArgDef<T extends ArgType, VT extends boolean | number | string> = {
type?: T;
description?: string;
valueHint?: string;
alias?: string | string[];
default?: VT;
required?: boolean;
options?: string[];
};
type BooleanArgDef = Omit<_ArgDef<"boolean", boolean>, "options"> & {
negativeDescription?: string;
};
type StringArgDef = Omit<_ArgDef<"string", string>, "options">;
type EnumArgDef = _ArgDef<"enum", string>;
type PositionalArgDef = Omit<_ArgDef<"positional", string>, "alias" | "options">;
type ArgDef = BooleanArgDef | StringArgDef | PositionalArgDef | EnumArgDef;
type ArgsDef = Record<string, ArgDef>;
type Arg = ArgDef & {
name: string;
alias: string[];
};
type ResolveParsedArgType<T extends ArgDef, VT> = T extends {
default?: any;
required?: boolean;
} ? T["default"] extends NonNullable<VT> ? VT : T["required"] extends true ? VT : VT | undefined : VT | undefined;
type ParsedPositionalArg<T extends ArgDef> = T extends {
type: "positional";
} ? ResolveParsedArgType<T, string> : never;
type ParsedStringArg<T extends ArgDef> = T extends {
type: "string";
} ? ResolveParsedArgType<T, string> : never;
type ParsedBooleanArg<T extends ArgDef> = T extends {
type: "boolean";
} ? ResolveParsedArgType<T, boolean> : never;
type ParsedEnumArg<T extends ArgDef> = T extends {
type: "enum";
options: infer U;
} ? U extends Array<any> ? ResolveParsedArgType<T, U[number]> : never : never;
type RawArgs = {
_: string[];
};
type ParsedArg<T extends ArgDef> = T["type"] extends "positional" ? ParsedPositionalArg<T> : T["type"] extends "boolean" ? ParsedBooleanArg<T> : T["type"] extends "string" ? ParsedStringArg<T> : T["type"] extends "enum" ? ParsedEnumArg<T> : never;
type ParsedArgs<T extends ArgsDef = ArgsDef> = RawArgs & { [K in keyof T]: ParsedArg<T[K]> } & { [K in keyof T as T[K] extends {
alias: string;
} ? T[K]["alias"] : never]: ParsedArg<T[K]> } & { [K in keyof T as T[K] extends {
alias: string[];
} ? T[K]["alias"][number] : never]: ParsedArg<T[K]> } & Record<string, string | number | boolean | string[]>;
interface CommandMeta {
name?: string;
version?: string;
description?: string;
hidden?: boolean;
}
type SubCommandsDef = Record<string, Resolvable<CommandDef<any>>>;
type CommandDef<T extends ArgsDef = ArgsDef> = {
meta?: Resolvable<CommandMeta>;
args?: Resolvable<T>;
subCommands?: Resolvable<SubCommandsDef>;
setup?: (context: CommandContext<T>) => any | Promise<any>;
cleanup?: (context: CommandContext<T>) => any | Promise<any>;
run?: (context: CommandContext<T>) => any | Promise<any>;
};
type CommandContext<T extends ArgsDef = ArgsDef> = {
rawArgs: string[];
args: ParsedArgs<T>;
cmd: CommandDef<T>;
subCommand?: CommandDef<T>;
data?: any;
};
type Awaitable<T> = () => T | Promise<T>;
type Resolvable<T> = T | Promise<T> | (() => T) | (() => Promise<T>);
//#endregion
//#region src/command.d.ts
declare function defineCommand<const T extends ArgsDef = ArgsDef>(def: CommandDef<T>): CommandDef<T>;
interface RunCommandOptions {
rawArgs: string[];
data?: any;
showUsage?: boolean;
}
declare function runCommand<T extends ArgsDef = ArgsDef>(cmd: CommandDef<T>, opts: RunCommandOptions): Promise<{
result: unknown;
}>;
//#endregion
//#region src/usage.d.ts
declare function showUsage<T extends ArgsDef = ArgsDef>(cmd: CommandDef<T>, parent?: CommandDef<T>): Promise<void>;
declare function renderUsage<T extends ArgsDef = ArgsDef>(cmd: CommandDef<T>, parent?: CommandDef<T>): Promise<string>;
//#endregion
//#region src/main.d.ts
interface RunMainOptions {
rawArgs?: string[];
showUsage?: typeof showUsage;
}
declare function runMain<T extends ArgsDef = ArgsDef>(cmd: CommandDef<T>, opts?: RunMainOptions): Promise<void>;
declare function createMain<T extends ArgsDef = ArgsDef>(cmd: CommandDef<T>): (opts?: RunMainOptions) => Promise<void>;
//#endregion
//#region src/args.d.ts
declare function parseArgs<T extends ArgsDef = ArgsDef>(rawArgs: string[], argsDef: ArgsDef): ParsedArgs<T>;
//#endregion
export { Arg, ArgDef, ArgType, ArgsDef, Awaitable, BooleanArgDef, CommandContext, CommandDef, CommandMeta, EnumArgDef, ParsedArgs, PositionalArgDef, Resolvable, type RunCommandOptions, type RunMainOptions, StringArgDef, SubCommandsDef, _ArgDef, createMain, defineCommand, parseArgs, renderUsage, runCommand, runMain, showUsage };

297
node_modules/nypm/node_modules/citty/dist/index.mjs generated vendored Normal file
View File

@@ -0,0 +1,297 @@
import { n as kebabCase, t as camelCase } from "./_chunks/libs/scule.mjs";
import { parseArgs as parseArgs$1 } from "node:util";
function toArray(val) {
if (Array.isArray(val)) return val;
return val === void 0 ? [] : [val];
}
function formatLineColumns(lines, linePrefix = "") {
const maxLength = [];
for (const line of lines) for (const [i, element] of line.entries()) maxLength[i] = Math.max(maxLength[i] || 0, element.length);
return lines.map((l) => l.map((c, i) => linePrefix + c[i === 0 ? "padStart" : "padEnd"](maxLength[i])).join(" ")).join("\n");
}
function resolveValue(input) {
return typeof input === "function" ? input() : input;
}
var CLIError = class extends Error {
code;
constructor(message, code) {
super(message);
this.name = "CLIError";
this.code = code;
}
};
function parseRawArgs(args = [], opts = {}) {
const booleans = new Set(opts.boolean || []);
const strings = new Set(opts.string || []);
const aliasMap = opts.alias || {};
const defaults = opts.default || {};
const aliasToMain = /* @__PURE__ */ new Map();
const mainToAliases = /* @__PURE__ */ new Map();
for (const [key, value] of Object.entries(aliasMap)) {
const targets = value;
for (const target of targets) {
aliasToMain.set(key, target);
if (!mainToAliases.has(target)) mainToAliases.set(target, []);
mainToAliases.get(target).push(key);
aliasToMain.set(target, key);
if (!mainToAliases.has(key)) mainToAliases.set(key, []);
mainToAliases.get(key).push(target);
}
}
const options = {};
function getType(name) {
if (booleans.has(name)) return "boolean";
const aliases = mainToAliases.get(name) || [];
for (const alias of aliases) if (booleans.has(alias)) return "boolean";
return "string";
}
const allOptions = new Set([
...booleans,
...strings,
...Object.keys(aliasMap),
...Object.values(aliasMap).flat(),
...Object.keys(defaults)
]);
for (const name of allOptions) if (!options[name]) options[name] = {
type: getType(name),
default: defaults[name]
};
for (const [alias, main] of aliasToMain.entries()) if (alias.length === 1 && options[main] && !options[main].short) options[main].short = alias;
const processedArgs = [];
const negatedFlags = {};
for (let i = 0; i < args.length; i++) {
const arg = args[i];
if (arg === "--") {
processedArgs.push(...args.slice(i));
break;
}
if (arg.startsWith("--no-")) {
const flagName = arg.slice(5);
negatedFlags[flagName] = true;
continue;
}
processedArgs.push(arg);
}
let parsed;
try {
parsed = parseArgs$1({
args: processedArgs,
options: Object.keys(options).length > 0 ? options : void 0,
allowPositionals: true,
strict: false
});
} catch {
parsed = {
values: {},
positionals: processedArgs
};
}
const out = { _: [] };
out._ = parsed.positionals;
for (const [key, value] of Object.entries(parsed.values)) out[key] = value;
for (const [name] of Object.entries(negatedFlags)) {
out[name] = false;
const mainName = aliasToMain.get(name);
if (mainName) out[mainName] = false;
const aliases = mainToAliases.get(name);
if (aliases) for (const alias of aliases) out[alias] = false;
}
for (const [alias, main] of aliasToMain.entries()) {
if (out[alias] !== void 0 && out[main] === void 0) out[main] = out[alias];
if (out[main] !== void 0 && out[alias] === void 0) out[alias] = out[main];
}
return out;
}
const noColor = /* @__PURE__ */ (() => {
const env = globalThis.process?.env ?? {};
return env.NO_COLOR === "1" || env.TERM === "dumb" || env.TEST || env.CI;
})();
const _c = (c, r = 39) => (t) => noColor ? t : `\u001B[${c}m${t}\u001B[${r}m`;
const bold = /* @__PURE__ */ _c(1, 22);
const cyan = /* @__PURE__ */ _c(36);
const gray = /* @__PURE__ */ _c(90);
const underline = /* @__PURE__ */ _c(4, 24);
function parseArgs(rawArgs, argsDef) {
const parseOptions = {
boolean: [],
string: [],
alias: {},
default: {}
};
const args = resolveArgs(argsDef);
for (const arg of args) {
if (arg.type === "positional") continue;
if (arg.type === "string" || arg.type === "enum") parseOptions.string.push(arg.name);
else if (arg.type === "boolean") parseOptions.boolean.push(arg.name);
if (arg.default !== void 0) parseOptions.default[arg.name] = arg.default;
if (arg.alias) parseOptions.alias[arg.name] = arg.alias;
const camelName = camelCase(arg.name);
const kebabName = kebabCase(arg.name);
if (camelName !== arg.name || kebabName !== arg.name) {
const existingAliases = toArray(parseOptions.alias[arg.name] || []);
if (camelName !== arg.name && !existingAliases.includes(camelName)) existingAliases.push(camelName);
if (kebabName !== arg.name && !existingAliases.includes(kebabName)) existingAliases.push(kebabName);
if (existingAliases.length > 0) parseOptions.alias[arg.name] = existingAliases;
}
}
const parsed = parseRawArgs(rawArgs, parseOptions);
const [ ...positionalArguments] = parsed._;
const parsedArgsProxy = new Proxy(parsed, { get(target, prop) {
return target[prop] ?? target[camelCase(prop)] ?? target[kebabCase(prop)];
} });
for (const [, arg] of args.entries()) if (arg.type === "positional") {
const nextPositionalArgument = positionalArguments.shift();
if (nextPositionalArgument !== void 0) parsedArgsProxy[arg.name] = nextPositionalArgument;
else if (arg.default === void 0 && arg.required !== false) throw new CLIError(`Missing required positional argument: ${arg.name.toUpperCase()}`, "EARG");
else parsedArgsProxy[arg.name] = arg.default;
} else if (arg.type === "enum") {
const argument = parsedArgsProxy[arg.name];
const options = arg.options || [];
if (argument !== void 0 && options.length > 0 && !options.includes(argument)) throw new CLIError(`Invalid value for argument: ${cyan(`--${arg.name}`)} (${cyan(argument)}). Expected one of: ${options.map((o) => cyan(o)).join(", ")}.`, "EARG");
} else if (arg.required && parsedArgsProxy[arg.name] === void 0) throw new CLIError(`Missing required argument: --${arg.name}`, "EARG");
return parsedArgsProxy;
}
function resolveArgs(argsDef) {
const args = [];
for (const [name, argDef] of Object.entries(argsDef || {})) args.push({
...argDef,
name,
alias: toArray(argDef.alias)
});
return args;
}
function defineCommand(def) {
return def;
}
async function runCommand(cmd, opts) {
const cmdArgs = await resolveValue(cmd.args || {});
const parsedArgs = parseArgs(opts.rawArgs, cmdArgs);
const context = {
rawArgs: opts.rawArgs,
args: parsedArgs,
data: opts.data,
cmd
};
if (typeof cmd.setup === "function") await cmd.setup(context);
let result;
try {
const subCommands = await resolveValue(cmd.subCommands);
if (subCommands && Object.keys(subCommands).length > 0) {
const subCommandArgIndex = opts.rawArgs.findIndex((arg) => !arg.startsWith("-"));
const subCommandName = opts.rawArgs[subCommandArgIndex];
if (subCommandName) {
if (!subCommands[subCommandName]) throw new CLIError(`Unknown command ${cyan(subCommandName)}`, "E_UNKNOWN_COMMAND");
const subCommand = await resolveValue(subCommands[subCommandName]);
if (subCommand) await runCommand(subCommand, { rawArgs: opts.rawArgs.slice(subCommandArgIndex + 1) });
} else if (!cmd.run) throw new CLIError(`No command specified.`, "E_NO_COMMAND");
}
if (typeof cmd.run === "function") result = await cmd.run(context);
} finally {
if (typeof cmd.cleanup === "function") await cmd.cleanup(context);
}
return { result };
}
async function resolveSubCommand(cmd, rawArgs, parent) {
const subCommands = await resolveValue(cmd.subCommands);
if (subCommands && Object.keys(subCommands).length > 0) {
const subCommandArgIndex = rawArgs.findIndex((arg) => !arg.startsWith("-"));
const subCommandName = rawArgs[subCommandArgIndex];
const subCommand = await resolveValue(subCommands[subCommandName]);
if (subCommand) return resolveSubCommand(subCommand, rawArgs.slice(subCommandArgIndex + 1), cmd);
}
return [cmd, parent];
}
async function showUsage(cmd, parent) {
try {
console.log(await renderUsage(cmd, parent) + "\n");
} catch (error) {
console.error(error);
}
}
const negativePrefixRe = /^no[-A-Z]/;
async function renderUsage(cmd, parent) {
const cmdMeta = await resolveValue(cmd.meta || {});
const cmdArgs = resolveArgs(await resolveValue(cmd.args || {}));
const parentMeta = await resolveValue(parent?.meta || {});
const commandName = `${parentMeta.name ? `${parentMeta.name} ` : ""}` + (cmdMeta.name || process.argv[1]);
const argLines = [];
const posLines = [];
const commandsLines = [];
const usageLine = [];
for (const arg of cmdArgs) if (arg.type === "positional") {
const name = arg.name.toUpperCase();
const isRequired = arg.required !== false && arg.default === void 0;
const defaultHint = arg.default ? `="${arg.default}"` : "";
posLines.push([
cyan(name + defaultHint),
arg.description || "",
arg.valueHint ? `<${arg.valueHint}>` : ""
]);
usageLine.push(isRequired ? `<${name}>` : `[${name}]`);
} else {
const isRequired = arg.required === true && arg.default === void 0;
const argStr = [...(arg.alias || []).map((a) => `-${a}`), `--${arg.name}`].join(", ") + (arg.type === "string" && (arg.valueHint || arg.default) ? `=${arg.valueHint ? `<${arg.valueHint}>` : `"${arg.default || ""}"`}` : "") + (arg.type === "enum" && arg.options ? `=<${arg.options.join("|")}>` : "");
argLines.push([cyan(argStr + (isRequired ? " (required)" : "")), arg.description || ""]);
if (arg.type === "boolean" && (arg.default === true || arg.negativeDescription) && !negativePrefixRe.test(arg.name)) {
const negativeArgStr = [...(arg.alias || []).map((a) => `--no-${a}`), `--no-${arg.name}`].join(", ");
argLines.push([cyan(negativeArgStr + (isRequired ? " (required)" : "")), arg.negativeDescription || ""]);
}
if (isRequired) usageLine.push(argStr);
}
if (cmd.subCommands) {
const commandNames = [];
const subCommands = await resolveValue(cmd.subCommands);
for (const [name, sub] of Object.entries(subCommands)) {
const meta = await resolveValue((await resolveValue(sub))?.meta);
if (meta?.hidden) continue;
commandsLines.push([cyan(name), meta?.description || ""]);
commandNames.push(name);
}
usageLine.push(commandNames.join("|"));
}
const usageLines = [];
const version = cmdMeta.version || parentMeta.version;
usageLines.push(gray(`${cmdMeta.description} (${commandName + (version ? ` v${version}` : "")})`), "");
const hasOptions = argLines.length > 0 || posLines.length > 0;
usageLines.push(`${underline(bold("USAGE"))} ${cyan(`${commandName}${hasOptions ? " [OPTIONS]" : ""} ${usageLine.join(" ")}`)}`, "");
if (posLines.length > 0) {
usageLines.push(underline(bold("ARGUMENTS")), "");
usageLines.push(formatLineColumns(posLines, " "));
usageLines.push("");
}
if (argLines.length > 0) {
usageLines.push(underline(bold("OPTIONS")), "");
usageLines.push(formatLineColumns(argLines, " "));
usageLines.push("");
}
if (commandsLines.length > 0) {
usageLines.push(underline(bold("COMMANDS")), "");
usageLines.push(formatLineColumns(commandsLines, " "));
usageLines.push("", `Use ${cyan(`${commandName} <command> --help`)} for more information about a command.`);
}
return usageLines.filter((l) => typeof l === "string").join("\n");
}
async function runMain(cmd, opts = {}) {
const rawArgs = opts.rawArgs || process.argv.slice(2);
const showUsage$1 = opts.showUsage || showUsage;
try {
if (rawArgs.includes("--help") || rawArgs.includes("-h")) {
await showUsage$1(...await resolveSubCommand(cmd, rawArgs));
process.exit(0);
} else if (rawArgs.length === 1 && rawArgs[0] === "--version") {
const meta = typeof cmd.meta === "function" ? await cmd.meta() : await cmd.meta;
if (!meta?.version) throw new CLIError("No version specified", "E_NO_VERSION");
console.log(meta.version);
} else await runCommand(cmd, { rawArgs });
} catch (error) {
if (error instanceof CLIError) {
await showUsage$1(...await resolveSubCommand(cmd, rawArgs));
console.error(error.message);
} else console.error(error, "\n");
process.exit(1);
}
}
function createMain(cmd) {
return (opts = {}) => runMain(cmd, opts);
}
export { createMain, defineCommand, parseArgs, renderUsage, runCommand, runMain, showUsage };

42
node_modules/nypm/node_modules/citty/package.json generated vendored Normal file
View File

@@ -0,0 +1,42 @@
{
"name": "citty",
"version": "0.2.1",
"description": "Elegant CLI Builder",
"license": "MIT",
"repository": "unjs/citty",
"files": [
"dist"
],
"type": "module",
"sideEffects": false,
"types": "./dist/index.d.mts",
"exports": {
".": "./dist/index.mjs"
},
"scripts": {
"build": "obuild",
"dev": "vitest dev",
"lint": "oxlint . && oxfmt --check",
"lint:fix": "oxlint . --fix && oxfmt",
"prepack": "pnpm run build",
"play": "node ./playground/cli.ts",
"release": "pnpm test && pnpm build && changelogen --release --push && npm publish",
"test": "pnpm lint && pnpm test:types && vitest run --coverage",
"test:types": "tsgo --noEmit"
},
"devDependencies": {
"@types/node": "^25.2.3",
"@typescript/native-preview": "7.0.0-dev.20260212.1",
"@vitest/coverage-v8": "^4.0.18",
"automd": "^0.4.3",
"changelogen": "^0.6.2",
"eslint-config-unjs": "^0.6.2",
"obuild": "^0.4.27",
"oxfmt": "^0.32.0",
"oxlint": "^1.47.0",
"scule": "^1.3.0",
"typescript": "^5.9.3",
"vitest": "^4.0.18"
},
"packageManager": "pnpm@10.29.3"
}

70
node_modules/nypm/node_modules/pathe/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,70 @@
MIT License
Copyright (c) Pooya Parsa <pooya@pi0.io> - Daniel Roe <daniel@roe.dev>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
---
Copyright Joyent, Inc. and other Node contributors.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the
following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE.
---
Bundled zeptomatch (https://github.com/fabiospampinato/zeptomatch)
The MIT License (MIT)
Copyright (c) 2023-present Fabio Spampinato
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

73
node_modules/nypm/node_modules/pathe/README.md generated vendored Normal file
View File

@@ -0,0 +1,73 @@
# 🛣️ pathe
> Universal filesystem path utils
[![version][npm-v-src]][npm-v-href]
[![downloads][npm-d-src]][npm-d-href]
[![size][size-src]][size-href]
## ❓ Why
For [historical reasons](https://docs.microsoft.com/en-us/archive/blogs/larryosterman/why-is-the-dos-path-character), windows followed MS-DOS and used backslash for separating paths rather than slash used for macOS, Linux, and other Posix operating systems. Nowadays, [Windows](https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file?redirectedfrom=MSDN) supports both Slash and Backslash for paths. [Node.js's built-in `path` module](https://nodejs.org/api/path.html) in the default operation of the path module varies based on the operating system on which a Node.js application is running. Specifically, when running on a Windows operating system, the path module will assume that Windows-style paths are being used. **This makes inconsistent code behavior between Windows and POSIX.**
Compared to popular [upath](https://github.com/anodynos/upath), pathe provides **identical exports** of Node.js with normalization on **all operations** and is written in modern **ESM/TypeScript** and has **no dependency on Node.js**!
This package is a drop-in replacement of the Node.js's [path module](https://nodejs.org/api/path.html) module and ensures paths are normalized with slash `/` and work in environments including Node.js.
## 💿 Usage
Install using npm or yarn:
```bash
# npm
npm i pathe
# yarn
yarn add pathe
# pnpm
pnpm i pathe
```
Import:
```js
// ESM / Typescript
import { resolve, matchesGlob } from "pathe";
// CommonJS
const { resolve, matchesGlob } = require("pathe");
```
Read more about path utils from [Node.js documentation](https://nodejs.org/api/path.html) and rest assured behavior is consistently like POSIX regardless of your input paths format and running platform (the only exception is `delimiter` constant export, it will be set to `;` on windows platform).
### Extra utilities
Pathe exports some extra utilities that do not exist in standard Node.js [path module](https://nodejs.org/api/path.html).
In order to use them, you can import from `pathe/utils` subpath:
```js
import {
filename,
normalizeAliases,
resolveAlias,
reverseResolveAlias,
} from "pathe/utils";
```
## License
Made with 💛 Published under the [MIT](./LICENSE) license.
Some code was used from the Node.js project. Glob supported is powered by [zeptomatch](https://github.com/fabiospampinato/zeptomatch).
<!-- Refs -->
[npm-v-src]: https://img.shields.io/npm/v/pathe?style=flat-square
[npm-v-href]: https://npmjs.com/package/pathe
[npm-d-src]: https://img.shields.io/npm/dm/pathe?style=flat-square
[npm-d-href]: https://npmjs.com/package/pathe
[github-actions-src]: https://img.shields.io/github/workflow/status/unjs/pathe/ci/main?style=flat-square
[github-actions-href]: https://github.com/unjs/pathe/actions?query=workflow%3Aci
[size-src]: https://packagephobia.now.sh/badge?p=pathe
[size-href]: https://packagephobia.now.sh/result?p=pathe

39
node_modules/nypm/node_modules/pathe/dist/index.cjs generated vendored Normal file
View File

@@ -0,0 +1,39 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
const _path = require('./shared/pathe.BSlhyZSM.cjs');
const delimiter = /* @__PURE__ */ (() => globalThis.process?.platform === "win32" ? ";" : ":")();
const _platforms = { posix: void 0, win32: void 0 };
const mix = (del = delimiter) => {
return new Proxy(_path._path, {
get(_, prop) {
if (prop === "delimiter") return del;
if (prop === "posix") return posix;
if (prop === "win32") return win32;
return _platforms[prop] || _path._path[prop];
}
});
};
const posix = /* @__PURE__ */ mix(":");
const win32 = /* @__PURE__ */ mix(";");
exports.basename = _path.basename;
exports.dirname = _path.dirname;
exports.extname = _path.extname;
exports.format = _path.format;
exports.isAbsolute = _path.isAbsolute;
exports.join = _path.join;
exports.matchesGlob = _path.matchesGlob;
exports.normalize = _path.normalize;
exports.normalizeString = _path.normalizeString;
exports.parse = _path.parse;
exports.relative = _path.relative;
exports.resolve = _path.resolve;
exports.sep = _path.sep;
exports.toNamespacedPath = _path.toNamespacedPath;
exports.default = posix;
exports.delimiter = delimiter;
exports.posix = posix;
exports.win32 = win32;

47
node_modules/nypm/node_modules/pathe/dist/index.d.cts generated vendored Normal file
View File

@@ -0,0 +1,47 @@
import * as path from 'node:path';
import path__default from 'node:path';
/**
* Constant for path separator.
*
* Always equals to `"/"`.
*/
declare const sep = "/";
declare const normalize: typeof path__default.normalize;
declare const join: typeof path__default.join;
declare const resolve: typeof path__default.resolve;
/**
* Resolves a string path, resolving '.' and '.' segments and allowing paths above the root.
*
* @param path - The path to normalise.
* @param allowAboveRoot - Whether to allow the resulting path to be above the root directory.
* @returns the normalised path string.
*/
declare function normalizeString(path: string, allowAboveRoot: boolean): string;
declare const isAbsolute: typeof path__default.isAbsolute;
declare const toNamespacedPath: typeof path__default.toNamespacedPath;
declare const extname: typeof path__default.extname;
declare const relative: typeof path__default.relative;
declare const dirname: typeof path__default.dirname;
declare const format: typeof path__default.format;
declare const basename: typeof path__default.basename;
declare const parse: typeof path__default.parse;
/**
* The `path.matchesGlob()` method determines if `path` matches the `pattern`.
* @param path The path to glob-match against.
* @param pattern The glob to check the path against.
*/
declare const matchesGlob: (path: string, pattern: string | string[]) => boolean;
type NodePath = typeof path;
/**
* The platform-specific file delimiter.
*
* Equals to `";"` in windows and `":"` in all other platforms.
*/
declare const delimiter: ";" | ":";
declare const posix: NodePath["posix"];
declare const win32: NodePath["win32"];
declare const _default: NodePath;
export { basename, _default as default, delimiter, dirname, extname, format, isAbsolute, join, matchesGlob, normalize, normalizeString, parse, posix, relative, resolve, sep, toNamespacedPath, win32 };

47
node_modules/nypm/node_modules/pathe/dist/index.d.mts generated vendored Normal file
View File

@@ -0,0 +1,47 @@
import * as path from 'node:path';
import path__default from 'node:path';
/**
* Constant for path separator.
*
* Always equals to `"/"`.
*/
declare const sep = "/";
declare const normalize: typeof path__default.normalize;
declare const join: typeof path__default.join;
declare const resolve: typeof path__default.resolve;
/**
* Resolves a string path, resolving '.' and '.' segments and allowing paths above the root.
*
* @param path - The path to normalise.
* @param allowAboveRoot - Whether to allow the resulting path to be above the root directory.
* @returns the normalised path string.
*/
declare function normalizeString(path: string, allowAboveRoot: boolean): string;
declare const isAbsolute: typeof path__default.isAbsolute;
declare const toNamespacedPath: typeof path__default.toNamespacedPath;
declare const extname: typeof path__default.extname;
declare const relative: typeof path__default.relative;
declare const dirname: typeof path__default.dirname;
declare const format: typeof path__default.format;
declare const basename: typeof path__default.basename;
declare const parse: typeof path__default.parse;
/**
* The `path.matchesGlob()` method determines if `path` matches the `pattern`.
* @param path The path to glob-match against.
* @param pattern The glob to check the path against.
*/
declare const matchesGlob: (path: string, pattern: string | string[]) => boolean;
type NodePath = typeof path;
/**
* The platform-specific file delimiter.
*
* Equals to `";"` in windows and `":"` in all other platforms.
*/
declare const delimiter: ";" | ":";
declare const posix: NodePath["posix"];
declare const win32: NodePath["win32"];
declare const _default: NodePath;
export { basename, _default as default, delimiter, dirname, extname, format, isAbsolute, join, matchesGlob, normalize, normalizeString, parse, posix, relative, resolve, sep, toNamespacedPath, win32 };

47
node_modules/nypm/node_modules/pathe/dist/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,47 @@
import * as path from 'node:path';
import path__default from 'node:path';
/**
* Constant for path separator.
*
* Always equals to `"/"`.
*/
declare const sep = "/";
declare const normalize: typeof path__default.normalize;
declare const join: typeof path__default.join;
declare const resolve: typeof path__default.resolve;
/**
* Resolves a string path, resolving '.' and '.' segments and allowing paths above the root.
*
* @param path - The path to normalise.
* @param allowAboveRoot - Whether to allow the resulting path to be above the root directory.
* @returns the normalised path string.
*/
declare function normalizeString(path: string, allowAboveRoot: boolean): string;
declare const isAbsolute: typeof path__default.isAbsolute;
declare const toNamespacedPath: typeof path__default.toNamespacedPath;
declare const extname: typeof path__default.extname;
declare const relative: typeof path__default.relative;
declare const dirname: typeof path__default.dirname;
declare const format: typeof path__default.format;
declare const basename: typeof path__default.basename;
declare const parse: typeof path__default.parse;
/**
* The `path.matchesGlob()` method determines if `path` matches the `pattern`.
* @param path The path to glob-match against.
* @param pattern The glob to check the path against.
*/
declare const matchesGlob: (path: string, pattern: string | string[]) => boolean;
type NodePath = typeof path;
/**
* The platform-specific file delimiter.
*
* Equals to `";"` in windows and `":"` in all other platforms.
*/
declare const delimiter: ";" | ":";
declare const posix: NodePath["posix"];
declare const win32: NodePath["win32"];
declare const _default: NodePath;
export { basename, _default as default, delimiter, dirname, extname, format, isAbsolute, join, matchesGlob, normalize, normalizeString, parse, posix, relative, resolve, sep, toNamespacedPath, win32 };

19
node_modules/nypm/node_modules/pathe/dist/index.mjs generated vendored Normal file
View File

@@ -0,0 +1,19 @@
import { _ as _path } from './shared/pathe.M-eThtNZ.mjs';
export { c as basename, d as dirname, e as extname, f as format, i as isAbsolute, j as join, m as matchesGlob, n as normalize, a as normalizeString, p as parse, b as relative, r as resolve, s as sep, t as toNamespacedPath } from './shared/pathe.M-eThtNZ.mjs';
const delimiter = /* @__PURE__ */ (() => globalThis.process?.platform === "win32" ? ";" : ":")();
const _platforms = { posix: void 0, win32: void 0 };
const mix = (del = delimiter) => {
return new Proxy(_path, {
get(_, prop) {
if (prop === "delimiter") return del;
if (prop === "posix") return posix;
if (prop === "win32") return win32;
return _platforms[prop] || _path[prop];
}
});
};
const posix = /* @__PURE__ */ mix(":");
const win32 = /* @__PURE__ */ mix(";");
export { posix as default, delimiter, posix, win32 };

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

82
node_modules/nypm/node_modules/pathe/dist/utils.cjs generated vendored Normal file
View File

@@ -0,0 +1,82 @@
'use strict';
const _path = require('./shared/pathe.BSlhyZSM.cjs');
const pathSeparators = /* @__PURE__ */ new Set(["/", "\\", void 0]);
const normalizedAliasSymbol = Symbol.for("pathe:normalizedAlias");
const SLASH_RE = /[/\\]/;
function normalizeAliases(_aliases) {
if (_aliases[normalizedAliasSymbol]) {
return _aliases;
}
const aliases = Object.fromEntries(
Object.entries(_aliases).sort(([a], [b]) => _compareAliases(a, b))
);
for (const key in aliases) {
for (const alias in aliases) {
if (alias === key || key.startsWith(alias)) {
continue;
}
if (aliases[key]?.startsWith(alias) && pathSeparators.has(aliases[key][alias.length])) {
aliases[key] = aliases[alias] + aliases[key].slice(alias.length);
}
}
}
Object.defineProperty(aliases, normalizedAliasSymbol, {
value: true,
enumerable: false
});
return aliases;
}
function resolveAlias(path, aliases) {
const _path$1 = _path.normalizeWindowsPath(path);
aliases = normalizeAliases(aliases);
for (const [alias, to] of Object.entries(aliases)) {
if (!_path$1.startsWith(alias)) {
continue;
}
const _alias = hasTrailingSlash(alias) ? alias.slice(0, -1) : alias;
if (hasTrailingSlash(_path$1[_alias.length])) {
return _path.join(to, _path$1.slice(alias.length));
}
}
return _path$1;
}
function reverseResolveAlias(path, aliases) {
const _path$1 = _path.normalizeWindowsPath(path);
aliases = normalizeAliases(aliases);
const matches = [];
for (const [to, alias] of Object.entries(aliases)) {
if (!_path$1.startsWith(alias)) {
continue;
}
const _alias = hasTrailingSlash(alias) ? alias.slice(0, -1) : alias;
if (hasTrailingSlash(_path$1[_alias.length])) {
matches.push(_path.join(to, _path$1.slice(alias.length)));
}
}
return matches.sort((a, b) => b.length - a.length);
}
function filename(path) {
const base = path.split(SLASH_RE).pop();
if (!base) {
return void 0;
}
const separatorIndex = base.lastIndexOf(".");
if (separatorIndex <= 0) {
return base;
}
return base.slice(0, separatorIndex);
}
function _compareAliases(a, b) {
return b.split("/").length - a.split("/").length;
}
function hasTrailingSlash(path = "/") {
const lastChar = path[path.length - 1];
return lastChar === "/" || lastChar === "\\";
}
exports.filename = filename;
exports.normalizeAliases = normalizeAliases;
exports.resolveAlias = resolveAlias;
exports.reverseResolveAlias = reverseResolveAlias;

32
node_modules/nypm/node_modules/pathe/dist/utils.d.cts generated vendored Normal file
View File

@@ -0,0 +1,32 @@
/**
* Normalises alias mappings, ensuring that more specific aliases are resolved before less specific ones.
* This function also ensures that aliases do not resolve to themselves cyclically.
*
* @param _aliases - A set of alias mappings where each key is an alias and its value is the actual path it points to.
* @returns a set of normalised alias mappings.
*/
declare function normalizeAliases(_aliases: Record<string, string>): Record<string, string>;
/**
* Resolves a path string to its alias if applicable, otherwise returns the original path.
* This function normalises the path, resolves the alias and then joins it to the alias target if necessary.
*
* @param path - The path string to resolve.
* @param aliases - A set of alias mappings to use for resolution.
* @returns the resolved path as a string.
*/
declare function resolveAlias(path: string, aliases: Record<string, string>): string;
/**
* Resolves a path string to its possible alias.
*
* Returns an array of possible alias resolutions (could be empty), sorted by specificity (longest first).
*/
declare function reverseResolveAlias(path: string, aliases: Record<string, string>): string[];
/**
* Extracts the filename from a given path, excluding any directory paths and the file extension.
*
* @param path - The full path of the file from which to extract the filename.
* @returns the filename without the extension, or `undefined` if the filename cannot be extracted.
*/
declare function filename(path: string): string | undefined;
export { filename, normalizeAliases, resolveAlias, reverseResolveAlias };

32
node_modules/nypm/node_modules/pathe/dist/utils.d.mts generated vendored Normal file
View File

@@ -0,0 +1,32 @@
/**
* Normalises alias mappings, ensuring that more specific aliases are resolved before less specific ones.
* This function also ensures that aliases do not resolve to themselves cyclically.
*
* @param _aliases - A set of alias mappings where each key is an alias and its value is the actual path it points to.
* @returns a set of normalised alias mappings.
*/
declare function normalizeAliases(_aliases: Record<string, string>): Record<string, string>;
/**
* Resolves a path string to its alias if applicable, otherwise returns the original path.
* This function normalises the path, resolves the alias and then joins it to the alias target if necessary.
*
* @param path - The path string to resolve.
* @param aliases - A set of alias mappings to use for resolution.
* @returns the resolved path as a string.
*/
declare function resolveAlias(path: string, aliases: Record<string, string>): string;
/**
* Resolves a path string to its possible alias.
*
* Returns an array of possible alias resolutions (could be empty), sorted by specificity (longest first).
*/
declare function reverseResolveAlias(path: string, aliases: Record<string, string>): string[];
/**
* Extracts the filename from a given path, excluding any directory paths and the file extension.
*
* @param path - The full path of the file from which to extract the filename.
* @returns the filename without the extension, or `undefined` if the filename cannot be extracted.
*/
declare function filename(path: string): string | undefined;
export { filename, normalizeAliases, resolveAlias, reverseResolveAlias };

32
node_modules/nypm/node_modules/pathe/dist/utils.d.ts generated vendored Normal file
View File

@@ -0,0 +1,32 @@
/**
* Normalises alias mappings, ensuring that more specific aliases are resolved before less specific ones.
* This function also ensures that aliases do not resolve to themselves cyclically.
*
* @param _aliases - A set of alias mappings where each key is an alias and its value is the actual path it points to.
* @returns a set of normalised alias mappings.
*/
declare function normalizeAliases(_aliases: Record<string, string>): Record<string, string>;
/**
* Resolves a path string to its alias if applicable, otherwise returns the original path.
* This function normalises the path, resolves the alias and then joins it to the alias target if necessary.
*
* @param path - The path string to resolve.
* @param aliases - A set of alias mappings to use for resolution.
* @returns the resolved path as a string.
*/
declare function resolveAlias(path: string, aliases: Record<string, string>): string;
/**
* Resolves a path string to its possible alias.
*
* Returns an array of possible alias resolutions (could be empty), sorted by specificity (longest first).
*/
declare function reverseResolveAlias(path: string, aliases: Record<string, string>): string[];
/**
* Extracts the filename from a given path, excluding any directory paths and the file extension.
*
* @param path - The full path of the file from which to extract the filename.
* @returns the filename without the extension, or `undefined` if the filename cannot be extracted.
*/
declare function filename(path: string): string | undefined;
export { filename, normalizeAliases, resolveAlias, reverseResolveAlias };

77
node_modules/nypm/node_modules/pathe/dist/utils.mjs generated vendored Normal file
View File

@@ -0,0 +1,77 @@
import { g as normalizeWindowsPath, j as join } from './shared/pathe.M-eThtNZ.mjs';
const pathSeparators = /* @__PURE__ */ new Set(["/", "\\", void 0]);
const normalizedAliasSymbol = Symbol.for("pathe:normalizedAlias");
const SLASH_RE = /[/\\]/;
function normalizeAliases(_aliases) {
if (_aliases[normalizedAliasSymbol]) {
return _aliases;
}
const aliases = Object.fromEntries(
Object.entries(_aliases).sort(([a], [b]) => _compareAliases(a, b))
);
for (const key in aliases) {
for (const alias in aliases) {
if (alias === key || key.startsWith(alias)) {
continue;
}
if (aliases[key]?.startsWith(alias) && pathSeparators.has(aliases[key][alias.length])) {
aliases[key] = aliases[alias] + aliases[key].slice(alias.length);
}
}
}
Object.defineProperty(aliases, normalizedAliasSymbol, {
value: true,
enumerable: false
});
return aliases;
}
function resolveAlias(path, aliases) {
const _path = normalizeWindowsPath(path);
aliases = normalizeAliases(aliases);
for (const [alias, to] of Object.entries(aliases)) {
if (!_path.startsWith(alias)) {
continue;
}
const _alias = hasTrailingSlash(alias) ? alias.slice(0, -1) : alias;
if (hasTrailingSlash(_path[_alias.length])) {
return join(to, _path.slice(alias.length));
}
}
return _path;
}
function reverseResolveAlias(path, aliases) {
const _path = normalizeWindowsPath(path);
aliases = normalizeAliases(aliases);
const matches = [];
for (const [to, alias] of Object.entries(aliases)) {
if (!_path.startsWith(alias)) {
continue;
}
const _alias = hasTrailingSlash(alias) ? alias.slice(0, -1) : alias;
if (hasTrailingSlash(_path[_alias.length])) {
matches.push(join(to, _path.slice(alias.length)));
}
}
return matches.sort((a, b) => b.length - a.length);
}
function filename(path) {
const base = path.split(SLASH_RE).pop();
if (!base) {
return void 0;
}
const separatorIndex = base.lastIndexOf(".");
if (separatorIndex <= 0) {
return base;
}
return base.slice(0, separatorIndex);
}
function _compareAliases(a, b) {
return b.split("/").length - a.split("/").length;
}
function hasTrailingSlash(path = "/") {
const lastChar = path[path.length - 1];
return lastChar === "/" || lastChar === "\\";
}
export { filename, normalizeAliases, resolveAlias, reverseResolveAlias };

61
node_modules/nypm/node_modules/pathe/package.json generated vendored Normal file
View File

@@ -0,0 +1,61 @@
{
"name": "pathe",
"version": "2.0.3",
"description": "Universal filesystem path utils",
"repository": "unjs/pathe",
"license": "MIT",
"sideEffects": false,
"type": "module",
"exports": {
".": {
"import": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
},
"require": {
"types": "./dist/index.d.cts",
"default": "./dist/index.cjs"
}
},
"./utils": {
"import": {
"types": "./dist/utils.d.mts",
"default": "./dist/utils.mjs"
},
"require": {
"types": "./dist/utils.d.cts",
"default": "./dist/utils.cjs"
}
}
},
"main": "./dist/index.cjs",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"files": [
"dist",
"utils.d.ts"
],
"devDependencies": {
"@types/node": "^22.13.1",
"@vitest/coverage-v8": "^3.0.5",
"changelogen": "^0.5.7",
"esbuild": "^0.25.0",
"eslint": "^9.20.1",
"eslint-config-unjs": "^0.4.2",
"jiti": "^2.4.2",
"prettier": "^3.5.0",
"typescript": "^5.7.3",
"unbuild": "^3.3.1",
"vitest": "^3.0.5",
"zeptomatch": "^2.0.0"
},
"scripts": {
"build": "unbuild",
"dev": "vitest",
"lint": "eslint . && prettier -c src test",
"lint:fix": "eslint . --fix && prettier -w src test",
"release": "pnpm test && pnpm build && changelogen --release && pnpm publish && git push --follow-tags",
"test": "pnpm lint && vitest run --coverage",
"test:types": "tsc --noEmit"
}
}

1
node_modules/nypm/node_modules/pathe/utils.d.ts generated vendored Normal file
View File

@@ -0,0 +1 @@
export * from "./dist/utils";

54
node_modules/nypm/package.json generated vendored Normal file
View File

@@ -0,0 +1,54 @@
{
"name": "nypm",
"version": "0.6.5",
"description": "Unified Package Manager for Node.js",
"license": "MIT",
"repository": "unjs/nypm",
"bin": {
"nypm": "./dist/cli.mjs"
},
"files": [
"dist"
],
"type": "module",
"sideEffects": false,
"module": "./dist/index.mjs",
"types": "./dist/index.d.mts",
"exports": {
".": "./dist/index.mjs"
},
"dependencies": {
"citty": "^0.2.0",
"pathe": "^2.0.3",
"tinyexec": "^1.0.2"
},
"devDependencies": {
"@types/node": "^25.2.1",
"@typescript/native-preview": "^7.0.0-dev.20260205.1",
"@vitest/coverage-v8": "^4.0.18",
"automd": "^0.4.3",
"changelogen": "^0.6.2",
"eslint-config-unjs": "^0.6.2",
"obuild": "^0.4.22",
"oxfmt": "^0.28.0",
"oxlint": "^1.43.0",
"pkg-types": "^2.3.0",
"std-env": "^3.10.0",
"typescript": "^5.9.3",
"ufo": "^1.6.3",
"vitest": "^4.0.18"
},
"engines": {
"node": ">=18"
},
"scripts": {
"build": "automd && obuild",
"dev": "vitest dev",
"lint": "oxlint . && oxfmt --check src test",
"lint:fix": "oxlint . --fix && oxfmt src test",
"nypm": "node ./src/cli.ts",
"release": "pnpm test && pnpm build && changelogen --release --push && pnpm publish",
"test": "pnpm lint && pnpm test:types && vitest run --coverage",
"test:types": "tsgo --noEmit"
}
}