@visulima/package 5.0.0-alpha.11 → 5.0.0-alpha.13
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/CHANGELOG.md +25 -0
- package/dist/error.d.ts +15 -1
- package/dist/error.js +1 -1
- package/dist/index.d.ts +13 -13
- package/dist/index.js +1 -7
- package/dist/lockfile.d.ts +98 -97
- package/dist/lockfile.js +1 -425
- package/dist/monorepo.d.ts +23 -22
- package/dist/monorepo.js +1 -121
- package/dist/package-json.d.ts +7 -138
- package/dist/package-json.js +4 -621
- package/dist/package-manager.d.ts +62 -61
- package/dist/package-manager.js +9 -186
- package/dist/package.d.ts +11 -10
- package/dist/package.js +1 -81
- package/dist/packem_shared/PackageNotFoundError--qHnCLzN.js +1 -0
- package/dist/packem_shared/package-json.d-R9WIRfmM.d.ts +173 -0
- package/dist/pnpm.d.ts +12 -11
- package/dist/pnpm.js +1 -105
- package/package.json +32 -33
- package/dist/error/package-not-found-error.d.ts +0 -15
- package/dist/packem_shared/PackageNotFoundError-C0ltLzw7.js +0 -44
- package/dist/types.d.ts +0 -37
- package/dist/utils/confirm.d.ts +0 -11
- package/dist/utils/is-node.d.ts +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,28 @@
|
|
|
1
|
+
## @visulima/package [5.0.0-alpha.13](https://github.com/visulima/visulima/compare/@visulima/package@5.0.0-alpha.12...@visulima/package@5.0.0-alpha.13) (2026-05-06)
|
|
2
|
+
|
|
3
|
+
### Miscellaneous Chores
|
|
4
|
+
|
|
5
|
+
* **package:** apply prettier and eslint quote-style auto-fix ([0316bca](https://github.com/visulima/visulima/commit/0316bca0deca444ff12675bc760c7091ce243d31))
|
|
6
|
+
* **package:** housekeeping cleanup ([113978b](https://github.com/visulima/visulima/commit/113978b0babcfc7879514aec076f6e2d5e7afab0))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Dependencies
|
|
10
|
+
|
|
11
|
+
* **@visulima/fs:** upgraded to 5.0.0-alpha.14
|
|
12
|
+
|
|
13
|
+
## @visulima/package [5.0.0-alpha.12](https://github.com/visulima/visulima/compare/@visulima/package@5.0.0-alpha.11...@visulima/package@5.0.0-alpha.12) (2026-05-04)
|
|
14
|
+
|
|
15
|
+
### Miscellaneous Chores
|
|
16
|
+
|
|
17
|
+
* **package:** upgrade packem to 2.0.0-alpha.76 ([b2ef62b](https://github.com/visulima/visulima/commit/b2ef62b72a84545cb025a250cbe7e3e36b34330d))
|
|
18
|
+
* re-sort workspace package.json files via vis sort-package-json ([f625696](https://github.com/visulima/visulima/commit/f625696cfac974325774b3243e1a83c3d23acbd7))
|
|
19
|
+
* simplify pnpm-workspace packages list ([7cab221](https://github.com/visulima/visulima/commit/7cab221163632d9b7aa044a6f88c49083103a869))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Dependencies
|
|
23
|
+
|
|
24
|
+
* **@visulima/fs:** upgraded to 5.0.0-alpha.13
|
|
25
|
+
|
|
1
26
|
## @visulima/package [5.0.0-alpha.11](https://github.com/visulima/visulima/compare/@visulima/package@5.0.0-alpha.10...@visulima/package@5.0.0-alpha.11) (2026-04-22)
|
|
2
27
|
|
|
3
28
|
### Bug Fixes
|
package/dist/error.d.ts
CHANGED
|
@@ -1 +1,15 @@
|
|
|
1
|
-
|
|
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
|
+
override get name(): string;
|
|
13
|
+
override set name(_name: string);
|
|
14
|
+
}
|
|
15
|
+
export { PackageNotFoundError };
|
package/dist/error.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{default as a}from"./packem_shared/PackageNotFoundError--qHnCLzN.js";export{a as PackageNotFoundError};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export type
|
|
3
|
-
export {
|
|
4
|
-
export
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export type
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
export { PackageNotFoundError } from "./error.js";
|
|
2
|
+
export { type LockFileEntry, type LockFileIntegrity, type LockFileIntegrityAlgorithm, type LockFileParseResult, type LockFileType, decodeSriIntegrity, parseBunLockFile, parseLockFile, parseLockFileContent, parseLockFileSync, parseNpmLockFile, parsePnpmLockFile, parseYarnLockFile } from "./lockfile.js";
|
|
3
|
+
export { type RootMonorepo, type Strategy, findMonorepoRoot, findMonorepoRootSync } from "./monorepo.js";
|
|
4
|
+
export { findPackageRoot, findPackageRootSync } from "./package.js";
|
|
5
|
+
export { type E as EnsurePackagesOptions, type F as FindPackageJsonCache, type N as NormalizedPackageJson, type a as NormalizedReadResult, type P as PackageJson, e as ensurePackages, f as findPackageJson, b as findPackageJsonSync, g as getPackageJsonProperty, h as hasPackageJsonAnyDependency, c as hasPackageJsonProperty, p as parsePackageJson, d as parsePackageJsonSync, w as writePackageJson, i as writePackageJsonSync } from "./packem_shared/package-json.d-R9WIRfmM.js";
|
|
6
|
+
export { type PackageManager, type PackageManagerResult, findLockFile, findLockFileSync, findPackageManager, findPackageManagerSync, generateMissingPackagesInstallMessage, getPackageManagerVersion, identifyInitiatingPackageManager } from "./package-manager.js";
|
|
7
|
+
export { type PnpmCatalog, type PnpmCatalogs, isPackageInWorkspace, readPnpmCatalogs, readPnpmCatalogsSync, resolveCatalogReference, resolveCatalogReferences, resolveDependenciesCatalogReferences } from "./pnpm.js";
|
|
8
|
+
import '@visulima/fs';
|
|
9
|
+
import 'type-fest';
|
|
10
|
+
import '@antfu/install-pkg';
|
|
11
|
+
import '@inquirer/core';
|
|
12
|
+
import '@inquirer/type';
|
|
13
|
+
import 'normalize-package-data';
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { decodeSriIntegrity, parseBunLockFile, parseLockFile, parseLockFileContent, parseLockFileSync, parseNpmLockFile, parsePnpmLockFile, parseYarnLockFile } from './lockfile.js';
|
|
3
|
-
export { findMonorepoRoot, findMonorepoRootSync } from './monorepo.js';
|
|
4
|
-
export { findPackageRoot, findPackageRootSync } from './package.js';
|
|
5
|
-
export { ensurePackages, findPackageJson, findPackageJsonSync, getPackageJsonProperty, hasPackageJsonAnyDependency, hasPackageJsonProperty, parsePackageJson, parsePackageJsonSync, writePackageJson, writePackageJsonSync } from './package-json.js';
|
|
6
|
-
export { findLockFile, findLockFileSync, findPackageManager, findPackageManagerSync, generateMissingPackagesInstallMessage, getPackageManagerVersion, identifyInitiatingPackageManager } from './package-manager.js';
|
|
7
|
-
export { isPackageInWorkspace, readPnpmCatalogs, readPnpmCatalogsSync, resolveCatalogReference, resolveCatalogReferences, resolveDependenciesCatalogReferences } from './pnpm.js';
|
|
1
|
+
import{default as o}from"./packem_shared/PackageNotFoundError--qHnCLzN.js";import{decodeSriIntegrity as r,parseBunLockFile as c,parseLockFile as s,parseLockFileContent as g,parseLockFileSync as i,parseNpmLockFile as t,parsePnpmLockFile as k,parseYarnLockFile as p}from"./lockfile.js";import{findMonorepoRoot as f,findMonorepoRootSync as l}from"./monorepo.js";import{findPackageRoot as y,findPackageRootSync as m}from"./package.js";import{ensurePackages as S,findPackageJson as J,findPackageJsonSync as L,getPackageJsonProperty as M,hasPackageJsonAnyDependency as x,hasPackageJsonProperty as R,parsePackageJson as C,parsePackageJsonSync as u,writePackageJson as I,writePackageJsonSync as v}from"./package-json.js";import{findLockFile as w,findLockFileSync as D,findPackageManager as N,findPackageManagerSync as A,generateMissingPackagesInstallMessage as B,getPackageManagerVersion as E,identifyInitiatingPackageManager as V}from"./package-manager.js";import{isPackageInWorkspace as Y,readPnpmCatalogs as b,readPnpmCatalogsSync as j,resolveCatalogReference as q,resolveCatalogReferences as z,resolveDependenciesCatalogReferences as G}from"./pnpm.js";export{o as PackageNotFoundError,r as decodeSriIntegrity,S as ensurePackages,w as findLockFile,D as findLockFileSync,f as findMonorepoRoot,l as findMonorepoRootSync,J as findPackageJson,L as findPackageJsonSync,N as findPackageManager,A as findPackageManagerSync,y as findPackageRoot,m as findPackageRootSync,B as generateMissingPackagesInstallMessage,M as getPackageJsonProperty,E as getPackageManagerVersion,x as hasPackageJsonAnyDependency,R as hasPackageJsonProperty,V as identifyInitiatingPackageManager,Y as isPackageInWorkspace,c as parseBunLockFile,s as parseLockFile,g as parseLockFileContent,i as parseLockFileSync,t as parseNpmLockFile,C as parsePackageJson,u as parsePackageJsonSync,k as parsePnpmLockFile,p as parseYarnLockFile,b as readPnpmCatalogs,j as readPnpmCatalogsSync,q as resolveCatalogReference,z as resolveCatalogReferences,G as resolveDependenciesCatalogReferences,I as writePackageJson,v as writePackageJsonSync};
|
package/dist/lockfile.d.ts
CHANGED
|
@@ -1,113 +1,114 @@
|
|
|
1
1
|
/** Lockfiles the parser recognises. Legacy binary `bun.lockb` is unsupported. */
|
|
2
|
-
|
|
2
|
+
type LockFileType = "bun" | "npm" | "pnpm" | "yarn";
|
|
3
3
|
/** SRI algorithms the parser can decode into hex. */
|
|
4
|
-
|
|
4
|
+
type LockFileIntegrityAlgorithm = "sha256" | "sha384" | "sha512";
|
|
5
5
|
/** Decoded integrity digest: algorithm + lowercase hex string. */
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
interface LockFileIntegrity {
|
|
7
|
+
algorithm: LockFileIntegrityAlgorithm;
|
|
8
|
+
hex: string;
|
|
9
9
|
}
|
|
10
10
|
/** A single resolved package extracted from a lockfile. */
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
11
|
+
interface LockFileEntry {
|
|
12
|
+
/**
|
|
13
|
+
* Declared runtime dependencies — `name → specifier[]` map. Values
|
|
14
|
+
* are arrays so pnpm v9+ peer-context variants (the same dep name
|
|
15
|
+
* resolved to different versions under different peer contexts)
|
|
16
|
+
* can all be preserved. npm, yarn v1, bun, and pnpm v6-v8 always
|
|
17
|
+
* produce single-element arrays; pnpm v9+ may produce multi-element
|
|
18
|
+
* arrays for peer-context-sensitive deps.
|
|
19
|
+
*
|
|
20
|
+
* Specifiers are whatever the lockfile recorded — a range
|
|
21
|
+
* (`^1.0.0`) for npm / yarn / bun, or an already-resolved exact
|
|
22
|
+
* version for pnpm. Callers resolve each specifier against
|
|
23
|
+
* {@link LockFileEntry.version} values elsewhere in the lockfile
|
|
24
|
+
* when they need a concrete edge.
|
|
25
|
+
*/
|
|
26
|
+
dependencies?: Record<string, string[]>;
|
|
27
|
+
/** Decoded SRI digest, if the lockfile recorded one. */
|
|
28
|
+
integrity?: LockFileIntegrity;
|
|
29
|
+
/** Package name — `lodash` or `@scope/name`. */
|
|
30
|
+
name: string;
|
|
31
|
+
/** Declared optional dependencies, same shape as `dependencies`. */
|
|
32
|
+
optionalDependencies?: Record<string, string[]>;
|
|
33
|
+
/** Declared peer dependencies, same shape as `dependencies`. */
|
|
34
|
+
peerDependencies?: Record<string, string[]>;
|
|
35
|
+
/** Resolved exact version — e.g. `4.17.21`. */
|
|
36
|
+
version: string;
|
|
37
37
|
}
|
|
38
38
|
/** Result of locating + parsing a lockfile on disk. */
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
interface LockFileParseResult {
|
|
40
|
+
entries: LockFileEntry[];
|
|
41
|
+
/** Absolute path of the lockfile that was parsed. */
|
|
42
|
+
path: string;
|
|
43
|
+
type: LockFileType;
|
|
44
44
|
}
|
|
45
45
|
/**
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
46
|
+
* Decodes a Subresource Integrity string (`sha512-<base64>`) into a
|
|
47
|
+
* `{ algorithm, hex }` pair. Returns `undefined` if the string is
|
|
48
|
+
* malformed, oversized, or uses an unsupported algorithm.
|
|
49
|
+
* @param sri Full SRI string, e.g. `sha512-<base64>`.
|
|
50
|
+
* @returns Decoded algorithm + hex digest, or `undefined` when the
|
|
51
|
+
* input can't be parsed.
|
|
52
|
+
*/
|
|
53
|
+
declare const decodeSriIntegrity: (sri: string) => LockFileIntegrity | undefined;
|
|
54
54
|
/**
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
55
|
+
* Parses `package-lock.json` (npm v2 / v3 format).
|
|
56
|
+
* @param content Raw JSON text of the lockfile.
|
|
57
|
+
* @returns One {@link LockFileEntry} per distinct `name@version`.
|
|
58
|
+
*/
|
|
59
|
+
declare const parseNpmLockFile: (content: string) => LockFileEntry[];
|
|
60
60
|
/**
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
61
|
+
* Parses `pnpm-lock.yaml`. Regex-based; works for lockfile v6 through
|
|
62
|
+
* v9. v9 moves concrete resolved dependency versions out of `packages:`
|
|
63
|
+
* and into `snapshots:`; this parser reads both sections and unions
|
|
64
|
+
* their dep-maps onto the final entry.
|
|
65
|
+
* @param content Raw YAML text of the lockfile.
|
|
66
|
+
* @returns One {@link LockFileEntry} per distinct `name@version`.
|
|
67
|
+
*/
|
|
68
|
+
declare const parsePnpmLockFile: (content: string) => LockFileEntry[];
|
|
69
69
|
/**
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
70
|
+
* Parses `yarn.lock` for Yarn Classic (v1) and Berry (v2+). Berry's
|
|
71
|
+
* XXH64 `checksum:` is not a cryptographic hash and is intentionally
|
|
72
|
+
* dropped; only v1's SRI `integrity:` flows through to
|
|
73
|
+
* {@link LockFileEntry.integrity}.
|
|
74
|
+
* @param content Raw text of the lockfile.
|
|
75
|
+
* @returns One {@link LockFileEntry} per distinct `name@version`.
|
|
76
|
+
*/
|
|
77
|
+
declare const parseYarnLockFile: (content: string) => LockFileEntry[];
|
|
78
78
|
/**
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
79
|
+
* Parses `bun.lock` (Bun v1.1+, JSON-ish with trailing commas). The
|
|
80
|
+
* binary `bun.lockb` format is not supported.
|
|
81
|
+
*
|
|
82
|
+
* Attribution: format + tuple layout verified against lockparse
|
|
83
|
+
* (https://github.com/43081j/lockparse, MIT).
|
|
84
|
+
* @param content Raw text of the lockfile.
|
|
85
|
+
* @returns One {@link LockFileEntry} per distinct `name@version`.
|
|
86
|
+
*/
|
|
87
|
+
declare const parseBunLockFile: (content: string) => LockFileEntry[];
|
|
88
88
|
/**
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
89
|
+
* Parses raw lockfile content of the given type. Returns an empty
|
|
90
|
+
* array if the content is malformed or doesn't contain any package
|
|
91
|
+
* entries.
|
|
92
|
+
* @param content Raw text of the lockfile.
|
|
93
|
+
* @param type Which parser to dispatch to.
|
|
94
|
+
* @returns One {@link LockFileEntry} per distinct `name@version`.
|
|
95
|
+
*/
|
|
96
|
+
declare const parseLockFileContent: (content: string, type: LockFileType) => LockFileEntry[];
|
|
97
97
|
/**
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
98
|
+
* Walks up from `cwd`, locates the nearest supported lockfile, reads
|
|
99
|
+
* it, and returns the parsed entries alongside the lockfile type and
|
|
100
|
+
* absolute path.
|
|
101
|
+
* @param cwd Directory to start the search from. Defaults to
|
|
102
|
+
* `process.cwd()` (delegated to `findUp`).
|
|
103
|
+
* @returns The parsed result, keyed by the discovered lockfile path.
|
|
104
|
+
* @throws If no supported lockfile can be found above `cwd`.
|
|
105
|
+
*/
|
|
106
|
+
declare const parseLockFile: (cwd?: URL | string) => Promise<LockFileParseResult>;
|
|
107
107
|
/**
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
108
|
+
* Synchronous counterpart to {@link parseLockFile}.
|
|
109
|
+
* @param cwd Directory to start the search from.
|
|
110
|
+
* @returns The parsed result, keyed by the discovered lockfile path.
|
|
111
|
+
* @throws If no supported lockfile can be found above `cwd`.
|
|
112
|
+
*/
|
|
113
|
+
declare const parseLockFileSync: (cwd?: URL | string) => LockFileParseResult;
|
|
114
|
+
export { LockFileEntry, LockFileIntegrity, LockFileIntegrityAlgorithm, LockFileParseResult, LockFileType, decodeSriIntegrity, parseBunLockFile, parseLockFile, parseLockFileContent, parseLockFileSync, parseNpmLockFile, parsePnpmLockFile, parseYarnLockFile };
|