@visulima/package 5.0.0-alpha.2 → 5.0.0-alpha.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/pnpm.d.ts CHANGED
@@ -1,18 +1,19 @@
1
- import type { JsonObject } from "type-fest";
2
- export type PnpmCatalog = Record<string, string>;
3
- export type PnpmCatalogs = {
4
- catalog?: PnpmCatalog;
5
- catalogs?: Record<string, PnpmCatalog>;
1
+ import { JsonObject } from 'type-fest';
2
+ type PnpmCatalog = Record<string, string>;
3
+ type PnpmCatalogs = {
4
+ catalog?: PnpmCatalog;
5
+ catalogs?: Record<string, PnpmCatalog>;
6
6
  };
7
7
  /** Checks if a package directory is included in the workspace packages configuration. */
8
- export declare const isPackageInWorkspace: (workspacePath: string, packagePath: string, workspacePackages: string[]) => boolean;
8
+ declare const isPackageInWorkspace: (workspacePath: string, packagePath: string, workspacePackages: string[]) => boolean;
9
9
  /** Reads, parses, and resolves catalogs from a pnpm-workspace file found by walking up the directory tree. */
10
- export declare const readPnpmCatalogs: (packagePath: string) => Promise<PnpmCatalogs | undefined>;
10
+ declare const readPnpmCatalogs: (packagePath: string) => Promise<PnpmCatalogs | undefined>;
11
11
  /** Reads, parses, and resolves catalogs from a pnpm-workspace file found by walking up the directory tree (synchronous). */
12
- export declare const readPnpmCatalogsSync: (packagePath: string) => PnpmCatalogs | undefined;
12
+ declare const readPnpmCatalogsSync: (packagePath: string) => PnpmCatalogs | undefined;
13
13
  /** Resolves a single catalog reference to its actual version. */
14
- export declare const resolveCatalogReference: (packageName: string, versionSpec: string, catalogs: PnpmCatalogs) => string | undefined;
14
+ declare const resolveCatalogReference: (packageName: string, versionSpec: string, catalogs: PnpmCatalogs) => string | undefined;
15
15
  /** Resolves catalog references in a single dependency object. */
16
- export declare const resolveDependenciesCatalogReferences: (dependencies: Record<string, string>, catalogs: PnpmCatalogs) => void;
16
+ declare const resolveDependenciesCatalogReferences: (dependencies: Record<string, string>, catalogs: PnpmCatalogs) => void;
17
17
  /** Resolves catalog references in package.json dependencies using the provided catalogs. */
18
- export declare const resolveCatalogReferences: (packageJson: JsonObject, catalogs: PnpmCatalogs) => void;
18
+ declare const resolveCatalogReferences: (packageJson: JsonObject, catalogs: PnpmCatalogs) => void;
19
+ export { PnpmCatalog, PnpmCatalogs, isPackageInWorkspace, readPnpmCatalogs, readPnpmCatalogsSync, resolveCatalogReference, resolveCatalogReferences, resolveDependenciesCatalogReferences };
package/dist/pnpm.js CHANGED
@@ -1 +1 @@
1
- var y=Object.defineProperty;var f=(t,a)=>y(t,"name",{value:a,configurable:!0});import{findUpSync as u,findUp as m}from"@visulima/fs";import{readYamlSync as v,readYaml as k}from"@visulima/fs/yaml";import{dirname as l,relative as b}from"@visulima/path";var h=Object.defineProperty,i=f((t,a)=>h(t,"name",{value:a,configurable:!0}),"c");const d=i((t,a,e)=>{const c=l(t),o=l(a),g=o===c?".":b(c,o);return e.some(p=>{const n=p.startsWith("./")?p.slice(2):p,s=g.startsWith("./")?g.slice(2):g;if(n==="."&&s===".")return!0;if(n.endsWith("/**")){const r=n.slice(0,-3);return s===r||s.startsWith(`${r}/`)}if(n.endsWith("/*")){const r=n.slice(0,-2);return r===""?s!=="."&&!s.includes("/"):s.startsWith(`${r}/`)||s===r}return s===n||s.startsWith(`${n}/`)})},"isPackageInWorkspace"),D=i(async t=>{const a=await m("pnpm-workspace.yaml",{cwd:l(t),type:"file"});if(!a)return;const e=await k(a),c=Array.isArray(e.packages)?e.packages:[];if(!d(a,t,c))return;const o={};return e.catalog&&typeof e.catalog=="object"&&(o.catalog=e.catalog),e.catalogs&&typeof e.catalogs=="object"&&(o.catalogs=e.catalogs),Object.keys(o).length>0?o:void 0},"readPnpmCatalogs"),A=i(t=>{const a=u("pnpm-workspace.yaml",{cwd:l(t),type:"file"});if(!a)return;const e=v(a),c=Array.isArray(e.packages)?e.packages:[];if(!d(a,t,c))return;const o={};return e.catalog&&typeof e.catalog=="object"&&(o.catalog=e.catalog),e.catalogs&&typeof e.catalogs=="object"&&(o.catalogs=e.catalogs),Object.keys(o).length>0?o:void 0},"readPnpmCatalogsSync"),C=i((t,a,e)=>{if(a==="catalog:")return e.catalog?.[t];if(a.startsWith("catalog:")){const c=a.slice(8);return e.catalogs?.[c]?.[t]}},"resolveCatalogReference"),W=i((t,a)=>{for(const[e,c]of Object.entries(t)){if(typeof c!="string")continue;const o=C(e,c,a);o&&(t[e]=o)}},"resolveDependenciesCatalogReferences"),O=i((t,a)=>{const e=["dependencies","devDependencies","peerDependencies","optionalDependencies"];for(const c of e){if(!t[c]||typeof t[c]!="object")continue;const o=t[c];W(o,a)}},"resolveCatalogReferences");export{d as isPackageInWorkspace,D as readPnpmCatalogs,A as readPnpmCatalogsSync,C as resolveCatalogReference,O as resolveCatalogReferences,W as resolveDependenciesCatalogReferences};
1
+ var y=Object.defineProperty;var f=(t,a)=>y(t,"name",{value:a,configurable:!0});import{findUpSync as u,findUp as m}from"@visulima/fs";import{readYamlSync as v,readYaml as k}from"@visulima/fs/yaml";import{dirname as l,relative as b}from"@visulima/path";var h=Object.defineProperty,i=f((t,a)=>h(t,"name",{value:a,configurable:!0}),"c");const d=i((t,a,e)=>{const o=l(t),s=l(a),g=s===o?".":b(o,s);return e.some(p=>{const n=p.startsWith("./")?p.slice(2):p,c=g.startsWith("./")?g.slice(2):g;if(n==="."&&c===".")return!0;if(n.endsWith("/**")){const r=n.slice(0,-3);return c===r||c.startsWith(`${r}/`)}if(n.endsWith("/*")){const r=n.slice(0,-2);return r===""?c!=="."&&!c.includes("/"):c.startsWith(`${r}/`)||c===r}return c===n||c.startsWith(`${n}/`)})},"isPackageInWorkspace"),D=i(async t=>{const a=await m("pnpm-workspace.yaml",{cwd:l(t),type:"file"});if(!a)return;const e=await k(a),o=Array.isArray(e.packages)?e.packages:[];if(!d(a,t,o))return;const s={};return e.catalog&&typeof e.catalog=="object"&&(s.catalog=e.catalog),e.catalogs&&typeof e.catalogs=="object"&&(s.catalogs=e.catalogs),Object.keys(s).length>0?s:void 0},"readPnpmCatalogs"),A=i(t=>{const a=u("pnpm-workspace.yaml",{cwd:l(t),type:"file"});if(!a)return;const e=v(a),o=Array.isArray(e.packages)?e.packages:[];if(!d(a,t,o))return;const s={};return e.catalog&&typeof e.catalog=="object"&&(s.catalog=e.catalog),e.catalogs&&typeof e.catalogs=="object"&&(s.catalogs=e.catalogs),Object.keys(s).length>0?s:void 0},"readPnpmCatalogsSync"),C=i((t,a,e)=>{if(a==="catalog:")return e.catalog?.[t];if(a.startsWith("catalog:")){const o=a.slice(8);return e.catalogs?.[o]?.[t]}},"resolveCatalogReference"),W=i((t,a)=>{for(const[e,o]of Object.entries(t)){if(typeof o!="string")continue;const s=C(e,o,a);s&&(t[e]=s)}},"resolveDependenciesCatalogReferences"),O=i((t,a)=>{const e=["dependencies","devDependencies","peerDependencies","optionalDependencies"];for(const o of e){if(!t[o]||typeof t[o]!="object")continue;const s=t[o];W(s,a)}},"resolveCatalogReferences");export{d as isPackageInWorkspace,D as readPnpmCatalogs,A as readPnpmCatalogsSync,C as resolveCatalogReference,O as resolveCatalogReferences,W as resolveDependenciesCatalogReferences};
package/package.json CHANGED
@@ -1,41 +1,46 @@
1
1
  {
2
2
  "name": "@visulima/package",
3
- "version": "5.0.0-alpha.2",
3
+ "version": "5.0.0-alpha.20",
4
4
  "description": "A comprehensive package management utility that helps you find root directories, monorepos, package managers, and parse package.json, package.yaml, and package.json5 files with advanced features like catalog resolution.",
5
5
  "keywords": [
6
6
  "anolilab",
7
+ "bun",
7
8
  "find",
8
9
  "find-monorepo-root",
9
- "find-up-pkg",
10
10
  "find-package-manager",
11
+ "find-up-pkg",
12
+ "json5",
11
13
  "mono-repo",
12
14
  "monorepo",
15
+ "npm",
13
16
  "package",
14
17
  "package-json",
15
18
  "package-manager",
16
19
  "package.json",
17
- "package.yaml",
18
20
  "package.json5",
21
+ "package.yaml",
19
22
  "packages",
20
23
  "pkg-dir",
21
24
  "pkg-manager",
22
25
  "pkg-types",
23
26
  "pkg-up",
27
+ "pnpm",
24
28
  "read-pkg",
25
29
  "read-pkg-up",
26
30
  "root",
27
- "pnpm",
28
- "bun",
29
- "npm",
30
- "yarn",
31
+ "visulima",
31
32
  "yaml",
32
- "json5",
33
- "visulima"
33
+ "yarn"
34
34
  ],
35
- "homepage": "https://www.visulima.com/docs/package/package",
35
+ "homepage": "https://visulima.com/packages/package/",
36
36
  "bugs": {
37
37
  "url": "https://github.com/visulima/visulima/issues"
38
38
  },
39
+ "license": "MIT",
40
+ "author": {
41
+ "name": "Daniel Bannert",
42
+ "email": "d.bannert@anolilab.de"
43
+ },
39
44
  "repository": {
40
45
  "type": "git",
41
46
  "url": "git+https://github.com/visulima/visulima.git",
@@ -51,13 +56,19 @@
51
56
  "url": "https://anolilab.com/support"
52
57
  }
53
58
  ],
54
- "license": "MIT",
55
- "author": {
56
- "name": "Daniel Bannert",
57
- "email": "d.bannert@anolilab.de"
58
- },
59
- "sideEffects": false,
59
+ "files": [
60
+ "dist/**",
61
+ "README.md",
62
+ "CHANGELOG.md",
63
+ "LICENSE.md"
64
+ ],
65
+ "os": [
66
+ "darwin",
67
+ "linux",
68
+ "win32"
69
+ ],
60
70
  "type": "module",
71
+ "sideEffects": false,
61
72
  "exports": {
62
73
  ".": {
63
74
  "types": "./dist/index.d.ts",
@@ -79,6 +90,10 @@
79
90
  "types": "./dist/package-manager.d.ts",
80
91
  "default": "./dist/package-manager.js"
81
92
  },
93
+ "./lockfile": {
94
+ "types": "./dist/lockfile.d.ts",
95
+ "default": "./dist/lockfile.js"
96
+ },
82
97
  "./pnpm": {
83
98
  "types": "./dist/pnpm.d.ts",
84
99
  "default": "./dist/pnpm.js"
@@ -89,31 +104,19 @@
89
104
  },
90
105
  "./package.json": "./package.json"
91
106
  },
92
- "files": [
93
- "dist/**",
94
- "README.md",
95
- "CHANGELOG.md",
96
- "LICENSE.md"
97
- ],
107
+ "publishConfig": {
108
+ "access": "public",
109
+ "provenance": true
110
+ },
98
111
  "dependencies": {
99
112
  "@antfu/install-pkg": "^1.1.0",
100
- "@visulima/fs": "5.0.0-alpha.2",
101
- "@visulima/path": "3.0.0-alpha.3",
113
+ "@visulima/fs": "5.0.0-alpha.21",
114
+ "@visulima/path": "3.0.0-alpha.10",
102
115
  "json5": "^2.2.3",
103
116
  "normalize-package-data": "^8.0.0",
104
- "type-fest": "^5.3.0",
105
- "yaml": "^2.8.2"
117
+ "yaml": "2.8.4"
106
118
  },
107
119
  "engines": {
108
- "node": ">=22.13 <=25.x"
109
- },
110
- "os": [
111
- "darwin",
112
- "linux",
113
- "win32"
114
- ],
115
- "publishConfig": {
116
- "access": "public",
117
- "provenance": true
120
+ "node": "^22.14.0 || >=24.10.0"
118
121
  }
119
122
  }
@@ -1,15 +0,0 @@
1
- /**
2
- * Error thrown when a package was not found.
3
- */
4
- declare class PackageNotFoundError extends Error {
5
- /**
6
- * @param packageName The name of the package that was not found.
7
- * @param packageManager The package manager used to install the package.
8
- */
9
- constructor(packageName: string[] | string, packageManager?: string);
10
- get code(): string;
11
- set code(_name: string);
12
- get name(): string;
13
- set name(_name: string);
14
- }
15
- export default PackageNotFoundError;
@@ -1 +0,0 @@
1
- var o=Object.defineProperty;var a=(t,e)=>o(t,"name",{value:e,configurable:!0});import{findPackageManagerSync as n}from"../package-manager.js";var c=Object.defineProperty,i=a((t,e)=>c(t,"name",{value:e,configurable:!0}),"t");class g extends Error{static{a(this,"u")}static{i(this,"PackageNotFoundError")}constructor(e,r){if(typeof e=="string"&&(e=[e]),e.length===0){super("Package was not found.");return}if(r===void 0)try{r=n().packageManager}catch{}r===void 0&&(r="npm"),super(`Package '${e.join(" ")}' was not found. Please install it using '${r} install ${e.join(" ")}'`)}get code(){return"PACKAGE_NOT_FOUND"}set code(e){throw new Error("Cannot overwrite code PACKAGE_NOT_FOUND")}get name(){return"PackageNotFoundError"}set name(e){throw new Error("Cannot overwrite name of PackageNotFoundError")}}export{g as default};
package/dist/types.d.ts DELETED
@@ -1,37 +0,0 @@
1
- import type { InstallPackageOptions } from "@antfu/install-pkg";
2
- import type { Theme } from "@inquirer/core";
3
- import type { PartialDeep } from "@inquirer/type";
4
- import type { Package as normalizePackage } from "normalize-package-data";
5
- import type { PackageJson as typeFestPackageJson } from "type-fest";
6
- export type NormalizedPackageJson = normalizePackage & PackageJson;
7
- export type PackageJson = typeFestPackageJson;
8
- export type Cache<T = any> = Map<string, T>;
9
- export type EnsurePackagesOptions = {
10
- /** Configuration for user confirmation prompts when installing packages */
11
- confirm?: {
12
- /** Default value for the confirmation prompt */
13
- default?: boolean;
14
- /** Message to display in the confirmation prompt, or a function that receives packages array */
15
- message: string | ((packages: string[]) => string);
16
- /** Theme configuration for the prompt interface */
17
- theme?: PartialDeep<Theme>;
18
- /** Function to transform the boolean value for display */
19
- transformer?: (value: boolean) => string;
20
- };
21
- /** Current working directory for package operations */
22
- cwd?: URL | string;
23
- /** Whether to include regular dependencies in the operation */
24
- deps?: boolean;
25
- /** Whether to include development dependencies in the operation */
26
- devDeps?: boolean;
27
- /** Additional options for package installation (excluding cwd and dev which are handled separately) */
28
- installPackage?: Omit<InstallPackageOptions, "cwd" | "dev">;
29
- /** Custom logger interface for warning messages */
30
- logger?: {
31
- warn: (message: string) => void;
32
- };
33
- /** Whether to include peer dependencies in the operation */
34
- peerDeps?: boolean;
35
- /** Whether to throw an error when warnings are logged instead of just logging them */
36
- throwOnWarn?: boolean;
37
- };
@@ -1,11 +0,0 @@
1
- import type { EnsurePackagesOptions } from "../types.d.ts";
2
- type ConfirmOptions = EnsurePackagesOptions["confirm"] & {
3
- message: string;
4
- };
5
- /**
6
- * Creates a styled confirmation prompt using readline.
7
- * @param options Configuration options for the confirmation prompt
8
- * @returns A promise that resolves to true if confirmed, false otherwise
9
- */
10
- declare const confirm: (options: ConfirmOptions) => Promise<boolean>;
11
- export default confirm;
@@ -1,2 +0,0 @@
1
- declare const isNode: boolean;
2
- export default isNode;