@visulima/package 5.0.0-alpha.3 → 5.0.0-alpha.30
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 +345 -0
- package/LICENSE.md +1 -1
- package/dist/error.d.ts +15 -1
- package/dist/error.js +1 -1
- package/dist/index.d.ts +13 -11
- package/dist/index.js +1 -1
- package/dist/lockfile.d.ts +114 -0
- package/dist/lockfile.js +1 -0
- package/dist/monorepo.d.ts +23 -22
- package/dist/monorepo.js +1 -1
- package/dist/package-json.d.ts +7 -138
- package/dist/package-json.js +3 -3
- package/dist/package-manager.d.ts +63 -63
- package/dist/package-manager.js +6 -6
- package/dist/package.d.ts +11 -10
- package/dist/package.js +1 -1
- 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 -1
- package/package.json +20 -19
- package/dist/error/package-not-found-error.d.ts +0 -15
- package/dist/packem_shared/PackageNotFoundError-BictYTIA.js +0 -1
- package/dist/types.d.ts +0 -37
- package/dist/utils/confirm.d.ts +0 -11
- package/dist/utils/is-node.d.ts +0 -2
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { WriteJsonOptions } from '@visulima/fs';
|
|
2
|
+
import { PackageJson as PackageJson$1, Paths, JsonObject } from 'type-fest';
|
|
3
|
+
import { InstallPackageOptions } from '@antfu/install-pkg';
|
|
4
|
+
import { Theme } from '@inquirer/core';
|
|
5
|
+
import { PartialDeep } from '@inquirer/type';
|
|
6
|
+
import { Package } from 'normalize-package-data';
|
|
7
|
+
type NormalizedPackageJson = Package & PackageJson;
|
|
8
|
+
type PackageJson = PackageJson$1;
|
|
9
|
+
type Cache<T = unknown> = Map<string, T>;
|
|
10
|
+
type EnsurePackagesOptions = {
|
|
11
|
+
/** Configuration for user confirmation prompts when installing packages */
|
|
12
|
+
confirm?: {
|
|
13
|
+
/** Default value for the confirmation prompt */
|
|
14
|
+
default?: boolean;
|
|
15
|
+
/** Message to display in the confirmation prompt, or a function that receives packages array */
|
|
16
|
+
message: string | ((packages: string[]) => string);
|
|
17
|
+
/** Theme configuration for the prompt interface */
|
|
18
|
+
theme?: PartialDeep<Theme>;
|
|
19
|
+
/** Function to transform the boolean value for display */
|
|
20
|
+
transformer?: (value: boolean) => string;
|
|
21
|
+
};
|
|
22
|
+
/** Current working directory for package operations */
|
|
23
|
+
cwd?: URL | string;
|
|
24
|
+
/** Whether to include regular dependencies in the operation */
|
|
25
|
+
deps?: boolean;
|
|
26
|
+
/** Whether to include development dependencies in the operation */
|
|
27
|
+
devDeps?: boolean;
|
|
28
|
+
/** Additional options for package installation (excluding cwd and dev which are handled separately) */
|
|
29
|
+
installPackage?: Omit<InstallPackageOptions, "cwd" | "dev">;
|
|
30
|
+
/** Custom logger interface for warning messages */
|
|
31
|
+
logger?: {
|
|
32
|
+
warn: (message: string) => void;
|
|
33
|
+
};
|
|
34
|
+
/** Whether to include peer dependencies in the operation */
|
|
35
|
+
peerDeps?: boolean;
|
|
36
|
+
/** Whether to throw an error when warnings are logged instead of just logging them */
|
|
37
|
+
throwOnWarn?: boolean;
|
|
38
|
+
};
|
|
39
|
+
type ReadOptions = {
|
|
40
|
+
cache?: FindPackageJsonCache | boolean;
|
|
41
|
+
ignoreWarnings?: (RegExp | string)[];
|
|
42
|
+
json5?: boolean;
|
|
43
|
+
resolveCatalogs?: boolean;
|
|
44
|
+
strict?: boolean;
|
|
45
|
+
yaml?: boolean;
|
|
46
|
+
};
|
|
47
|
+
type FindPackageJsonCache = Cache<NormalizedReadResult>;
|
|
48
|
+
type NormalizedReadResult = {
|
|
49
|
+
packageJson: NormalizedPackageJson;
|
|
50
|
+
path: string;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* An asynchronous function to find the package.json, package.yaml, or package.json5 file in the specified directory or its parent directories.
|
|
54
|
+
* @param cwd The current working directory.
|
|
55
|
+
* @param options Configuration options including yaml, json5, and resolveCatalogs flags.
|
|
56
|
+
* @returns A `Promise` that resolves to an object containing the parsed package data and the file path.
|
|
57
|
+
* The type of the returned promise is `Promise<NormalizedReadResult>`.
|
|
58
|
+
* @throws {Error} If no package file can be found or if strict mode is enabled and normalize warnings are thrown.
|
|
59
|
+
*/
|
|
60
|
+
declare const findPackageJson: (cwd?: URL | string, options?: ReadOptions) => Promise<NormalizedReadResult>;
|
|
61
|
+
/**
|
|
62
|
+
* A synchronous function to find the package.json, package.yaml, or package.json5 file in the specified directory or its parent directories.
|
|
63
|
+
* @param cwd The current working directory.
|
|
64
|
+
* @param options Configuration options including yaml, json5, and resolveCatalogs flags.
|
|
65
|
+
* @returns An object containing the parsed package data and the file path.
|
|
66
|
+
* @throws {Error} If no package file can be found or if strict mode is enabled and normalize warnings are thrown.
|
|
67
|
+
*/
|
|
68
|
+
declare const findPackageJsonSync: (cwd?: URL | string, options?: ReadOptions) => NormalizedReadResult;
|
|
69
|
+
/**
|
|
70
|
+
* An asynchronous function to write the package.json file with the given data.
|
|
71
|
+
* @param data The package.json data to write. The data is an intersection type of `PackageJson` and a record where keys are `string` and values can be any type.
|
|
72
|
+
* @param options Optional. The options for writing the package.json. If not provided, an empty object will be used `{}`.
|
|
73
|
+
* This is an intersection type of `WriteJsonOptions` and a record with an optional `cwd` key which type is `Options["cwd"]`.
|
|
74
|
+
* `cwd` represents the current working directory. If not specified, the default working directory will be used.
|
|
75
|
+
* @returns A `Promise` that resolves once the package.json file has been written. The type of the returned promise is `Promise<void>`.
|
|
76
|
+
*/
|
|
77
|
+
declare const writePackageJson: (data: PackageJson, options?: WriteJsonOptions & {
|
|
78
|
+
cwd?: URL | string;
|
|
79
|
+
}) => Promise<void>;
|
|
80
|
+
declare const writePackageJsonSync: (data: PackageJson, options?: WriteJsonOptions & {
|
|
81
|
+
cwd?: URL | string;
|
|
82
|
+
}) => void;
|
|
83
|
+
/**
|
|
84
|
+
* A synchronous function to parse the package.json, package.yaml, or package.json5 file/object/string and return normalize the data.
|
|
85
|
+
* @param packageFile
|
|
86
|
+
* @param options
|
|
87
|
+
* @param options.cache Cache for parsed results (only applies to file paths)
|
|
88
|
+
* @param options.ignoreWarnings List of warning messages or patterns to skip in strict mode
|
|
89
|
+
* @param options.resolveCatalogs Whether to resolve pnpm catalog references
|
|
90
|
+
* @param options.strict Whether to throw errors on normalization warnings
|
|
91
|
+
* @param options.yaml Whether to enable package.yaml parsing (default: true)
|
|
92
|
+
* @param options.json5 Whether to enable package.json5 parsing (default: true)
|
|
93
|
+
* @returns
|
|
94
|
+
* @throws {Error} If the packageFile parameter is not an object or a string or if strict mode is enabled and normalize warnings are thrown.
|
|
95
|
+
*/
|
|
96
|
+
declare const parsePackageJsonSync: (packageFile: JsonObject | string, options?: {
|
|
97
|
+
cache?: Cache<NormalizedPackageJson> | boolean;
|
|
98
|
+
ignoreWarnings?: (RegExp | string)[];
|
|
99
|
+
json5?: boolean;
|
|
100
|
+
resolveCatalogs?: boolean;
|
|
101
|
+
strict?: boolean;
|
|
102
|
+
yaml?: boolean;
|
|
103
|
+
}) => NormalizedPackageJson;
|
|
104
|
+
/**
|
|
105
|
+
* An asynchronous function to parse the package.json, package.yaml, or package.json5 file/object/string and return normalize the data.
|
|
106
|
+
* @param packageFile
|
|
107
|
+
* @param options
|
|
108
|
+
* @param options.cache Cache for parsed results (only applies to file paths)
|
|
109
|
+
* @param options.ignoreWarnings List of warning messages or patterns to skip in strict mode
|
|
110
|
+
* @param options.strict Whether to throw errors on normalization warnings
|
|
111
|
+
* @param options.resolveCatalogs Whether to resolve pnpm catalog references
|
|
112
|
+
* @param options.yaml Whether to enable package.yaml parsing (default: true)
|
|
113
|
+
* @param options.json5 Whether to enable package.json5 parsing (default: true)
|
|
114
|
+
* @returns
|
|
115
|
+
* @throws {Error} If the packageFile parameter is not an object or a string or if strict mode is enabled and normalize warnings are thrown.
|
|
116
|
+
*/
|
|
117
|
+
declare const parsePackageJson: (packageFile: JsonObject | string, options?: {
|
|
118
|
+
cache?: Cache<NormalizedPackageJson> | boolean;
|
|
119
|
+
ignoreWarnings?: (RegExp | string)[];
|
|
120
|
+
json5?: boolean;
|
|
121
|
+
resolveCatalogs?: boolean;
|
|
122
|
+
strict?: boolean;
|
|
123
|
+
yaml?: boolean;
|
|
124
|
+
}) => Promise<NormalizedPackageJson>;
|
|
125
|
+
/**
|
|
126
|
+
* An asynchronous function to get the value of a property from the package.json file.
|
|
127
|
+
* @param packageJson
|
|
128
|
+
* @param property
|
|
129
|
+
* @param defaultValue
|
|
130
|
+
* @returns
|
|
131
|
+
*/
|
|
132
|
+
declare const getPackageJsonProperty: <T = unknown>(packageJson: NormalizedPackageJson, property: Paths<NormalizedPackageJson>, defaultValue?: T) => T;
|
|
133
|
+
/**
|
|
134
|
+
* An asynchronous function to check if a property exists in the package.json file.
|
|
135
|
+
* @param packageJson
|
|
136
|
+
* @param property
|
|
137
|
+
* @returns
|
|
138
|
+
*/
|
|
139
|
+
declare const hasPackageJsonProperty: (packageJson: NormalizedPackageJson, property: Paths<NormalizedPackageJson>) => boolean;
|
|
140
|
+
/**
|
|
141
|
+
* An asynchronous function to check if any of the specified dependencies exist in the package.json file.
|
|
142
|
+
* @param packageJson
|
|
143
|
+
* @param arguments_
|
|
144
|
+
* @param options
|
|
145
|
+
* @param options.peerDeps Whether to include peer dependencies
|
|
146
|
+
* @returns
|
|
147
|
+
*/
|
|
148
|
+
declare const hasPackageJsonAnyDependency: (packageJson: NormalizedPackageJson, arguments_: string[], options?: {
|
|
149
|
+
peerDeps?: boolean;
|
|
150
|
+
}) => boolean;
|
|
151
|
+
/**
|
|
152
|
+
* An asynchronous function to ensure that the specified packages are installed in the package.json file.
|
|
153
|
+
* If the packages are not installed, the user will be prompted to install them.
|
|
154
|
+
* If the user agrees, the packages will be installed.
|
|
155
|
+
* If the user declines, the function will return without installing the packages.
|
|
156
|
+
* If the user does not respond, the function will return without installing the packages.
|
|
157
|
+
* @param packageJson
|
|
158
|
+
* @param packages
|
|
159
|
+
* @param installKey
|
|
160
|
+
* @param options
|
|
161
|
+
* @param options.deps Whether to include regular dependencies
|
|
162
|
+
* @param options.devDeps Whether to include development dependencies
|
|
163
|
+
* @param options.peerDeps Whether to include peer dependencies
|
|
164
|
+
* @param options.throwOnWarn Whether to throw an error when warnings are logged instead of just logging them
|
|
165
|
+
* @param options.logger Whether to use a custom logger
|
|
166
|
+
* @param options.confirm Whether to use a custom confirmation prompt
|
|
167
|
+
* @param options.installPackage Whether to use a custom installation package
|
|
168
|
+
* @param options.cwd Whether to use a custom current working directory
|
|
169
|
+
* @param options.dev Whether to use a custom installation key
|
|
170
|
+
* @returns
|
|
171
|
+
*/
|
|
172
|
+
declare const ensurePackages: (packageJson: NormalizedPackageJson, packages: string[], installKey?: "dependencies" | "devDependencies", options?: EnsurePackagesOptions) => Promise<void>;
|
|
173
|
+
export { EnsurePackagesOptions as E, FindPackageJsonCache as F, NormalizedPackageJson as N, PackageJson as P, NormalizedReadResult as a, findPackageJsonSync as b, hasPackageJsonProperty as c, parsePackageJsonSync as d, ensurePackages as e, findPackageJson as f, getPackageJsonProperty as g, hasPackageJsonAnyDependency as h, writePackageJsonSync as i, parsePackageJson as p, writePackageJson as w };
|
package/dist/pnpm.d.ts
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
12
|
+
declare const readPnpmCatalogsSync: (packagePath: string) => PnpmCatalogs | undefined;
|
|
13
13
|
/** Resolves a single catalog reference to its actual version. */
|
|
14
|
-
|
|
14
|
+
declare const resolveCatalogReference: (packageName: string, versionSpec: string, catalogs: PnpmCatalogs) => string | undefined;
|
|
15
15
|
/** Resolves catalog references in a single dependency object. */
|
|
16
|
-
|
|
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
|
-
|
|
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
|
|
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,39 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visulima/package",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.30",
|
|
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
|
-
"
|
|
28
|
-
"bun",
|
|
29
|
-
"npm",
|
|
30
|
-
"yarn",
|
|
31
|
+
"visulima",
|
|
31
32
|
"yaml",
|
|
32
|
-
"
|
|
33
|
-
"visulima"
|
|
33
|
+
"yarn"
|
|
34
34
|
],
|
|
35
|
-
"homepage": "https://
|
|
36
|
-
"bugs":
|
|
37
|
-
"url": "https://github.com/visulima/visulima/issues"
|
|
38
|
-
},
|
|
35
|
+
"homepage": "https://visulima.com/packages/package/",
|
|
36
|
+
"bugs": "https://github.com/visulima/visulima/issues",
|
|
39
37
|
"repository": {
|
|
40
38
|
"type": "git",
|
|
41
39
|
"url": "git+https://github.com/visulima/visulima.git",
|
|
@@ -79,6 +77,10 @@
|
|
|
79
77
|
"types": "./dist/package-manager.d.ts",
|
|
80
78
|
"default": "./dist/package-manager.js"
|
|
81
79
|
},
|
|
80
|
+
"./lockfile": {
|
|
81
|
+
"types": "./dist/lockfile.d.ts",
|
|
82
|
+
"default": "./dist/lockfile.js"
|
|
83
|
+
},
|
|
82
84
|
"./pnpm": {
|
|
83
85
|
"types": "./dist/pnpm.d.ts",
|
|
84
86
|
"default": "./dist/pnpm.js"
|
|
@@ -97,15 +99,14 @@
|
|
|
97
99
|
],
|
|
98
100
|
"dependencies": {
|
|
99
101
|
"@antfu/install-pkg": "^1.1.0",
|
|
100
|
-
"@visulima/fs": "5.0.0-alpha.
|
|
101
|
-
"@visulima/path": "3.0.0-alpha.
|
|
102
|
+
"@visulima/fs": "5.0.0-alpha.31",
|
|
103
|
+
"@visulima/path": "3.0.0-alpha.12",
|
|
102
104
|
"json5": "^2.2.3",
|
|
103
|
-
"normalize-package-data": "^
|
|
104
|
-
"
|
|
105
|
-
"yaml": "^2.8.2"
|
|
105
|
+
"normalize-package-data": "^9.0.0",
|
|
106
|
+
"yaml": "2.9.0"
|
|
106
107
|
},
|
|
107
108
|
"engines": {
|
|
108
|
-
"node": "
|
|
109
|
+
"node": "^22.14.0 || >=24.10.0"
|
|
109
110
|
},
|
|
110
111
|
"os": [
|
|
111
112
|
"darwin",
|
|
@@ -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
|
-
};
|
package/dist/utils/confirm.d.ts
DELETED
|
@@ -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;
|
package/dist/utils/is-node.d.ts
DELETED