@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/dist/package-json.d.ts
CHANGED
|
@@ -1,138 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
resolveCatalogs?: boolean;
|
|
9
|
-
strict?: boolean;
|
|
10
|
-
yaml?: boolean;
|
|
11
|
-
};
|
|
12
|
-
export type FindPackageJsonCache = Cache<NormalizedReadResult>;
|
|
13
|
-
export type NormalizedReadResult = {
|
|
14
|
-
packageJson: NormalizedPackageJson;
|
|
15
|
-
path: string;
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* An asynchronous function to find the package.json, package.yaml, or package.json5 file in the specified directory or its parent directories.
|
|
19
|
-
* @param cwd The current working directory.
|
|
20
|
-
* @param options Configuration options including yaml, json5, and resolveCatalogs flags.
|
|
21
|
-
* @returns A `Promise` that resolves to an object containing the parsed package data and the file path.
|
|
22
|
-
* The type of the returned promise is `Promise<NormalizedReadResult>`.
|
|
23
|
-
* @throws {Error} If no package file can be found or if strict mode is enabled and normalize warnings are thrown.
|
|
24
|
-
*/
|
|
25
|
-
export declare const findPackageJson: (cwd?: URL | string, options?: ReadOptions) => Promise<NormalizedReadResult>;
|
|
26
|
-
/**
|
|
27
|
-
* A synchronous function to find the package.json, package.yaml, or package.json5 file in the specified directory or its parent directories.
|
|
28
|
-
* @param cwd The current working directory.
|
|
29
|
-
* @param options Configuration options including yaml, json5, and resolveCatalogs flags.
|
|
30
|
-
* @returns An object containing the parsed package data and the file path.
|
|
31
|
-
* @throws {Error} If no package file can be found or if strict mode is enabled and normalize warnings are thrown.
|
|
32
|
-
*/
|
|
33
|
-
export declare const findPackageJsonSync: (cwd?: URL | string, options?: ReadOptions) => NormalizedReadResult;
|
|
34
|
-
/**
|
|
35
|
-
* An asynchronous function to write the package.json file with the given data.
|
|
36
|
-
* @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.
|
|
37
|
-
* @param options Optional. The options for writing the package.json. If not provided, an empty object will be used `{}`.
|
|
38
|
-
* This is an intersection type of `WriteJsonOptions` and a record with an optional `cwd` key which type is `Options["cwd"]`.
|
|
39
|
-
* `cwd` represents the current working directory. If not specified, the default working directory will be used.
|
|
40
|
-
* @returns A `Promise` that resolves once the package.json file has been written. The type of the returned promise is `Promise<void>`.
|
|
41
|
-
*/
|
|
42
|
-
export declare const writePackageJson: (data: PackageJson, options?: WriteJsonOptions & {
|
|
43
|
-
cwd?: URL | string;
|
|
44
|
-
}) => Promise<void>;
|
|
45
|
-
export declare const writePackageJsonSync: (data: PackageJson, options?: WriteJsonOptions & {
|
|
46
|
-
cwd?: URL | string;
|
|
47
|
-
}) => void;
|
|
48
|
-
/**
|
|
49
|
-
* A synchronous function to parse the package.json, package.yaml, or package.json5 file/object/string and return normalize the data.
|
|
50
|
-
* @param packageFile
|
|
51
|
-
* @param options
|
|
52
|
-
* @param options.cache Cache for parsed results (only applies to file paths)
|
|
53
|
-
* @param options.ignoreWarnings List of warning messages or patterns to skip in strict mode
|
|
54
|
-
* @param options.resolveCatalogs Whether to resolve pnpm catalog references
|
|
55
|
-
* @param options.strict Whether to throw errors on normalization warnings
|
|
56
|
-
* @param options.yaml Whether to enable package.yaml parsing (default: true)
|
|
57
|
-
* @param options.json5 Whether to enable package.json5 parsing (default: true)
|
|
58
|
-
* @returns
|
|
59
|
-
* @throws {Error} If the packageFile parameter is not an object or a string or if strict mode is enabled and normalize warnings are thrown.
|
|
60
|
-
*/
|
|
61
|
-
export declare const parsePackageJsonSync: (packageFile: JsonObject | string, options?: {
|
|
62
|
-
cache?: Cache<NormalizedPackageJson> | boolean;
|
|
63
|
-
ignoreWarnings?: (RegExp | string)[];
|
|
64
|
-
json5?: boolean;
|
|
65
|
-
resolveCatalogs?: boolean;
|
|
66
|
-
strict?: boolean;
|
|
67
|
-
yaml?: boolean;
|
|
68
|
-
}) => NormalizedPackageJson;
|
|
69
|
-
/**
|
|
70
|
-
* An asynchronous function to parse the package.json, package.yaml, or package.json5 file/object/string and return normalize the data.
|
|
71
|
-
* @param packageFile
|
|
72
|
-
* @param options
|
|
73
|
-
* @param options.cache Cache for parsed results (only applies to file paths)
|
|
74
|
-
* @param options.ignoreWarnings List of warning messages or patterns to skip in strict mode
|
|
75
|
-
* @param options.strict Whether to throw errors on normalization warnings
|
|
76
|
-
* @param options.resolveCatalogs Whether to resolve pnpm catalog references
|
|
77
|
-
* @param options.yaml Whether to enable package.yaml parsing (default: true)
|
|
78
|
-
* @param options.json5 Whether to enable package.json5 parsing (default: true)
|
|
79
|
-
* @returns
|
|
80
|
-
* @throws {Error} If the packageFile parameter is not an object or a string or if strict mode is enabled and normalize warnings are thrown.
|
|
81
|
-
*/
|
|
82
|
-
export declare const parsePackageJson: (packageFile: JsonObject | string, options?: {
|
|
83
|
-
cache?: Cache<NormalizedPackageJson> | boolean;
|
|
84
|
-
ignoreWarnings?: (RegExp | string)[];
|
|
85
|
-
json5?: boolean;
|
|
86
|
-
resolveCatalogs?: boolean;
|
|
87
|
-
strict?: boolean;
|
|
88
|
-
yaml?: boolean;
|
|
89
|
-
}) => Promise<NormalizedPackageJson>;
|
|
90
|
-
/**
|
|
91
|
-
* An asynchronous function to get the value of a property from the package.json file.
|
|
92
|
-
* @param packageJson
|
|
93
|
-
* @param property
|
|
94
|
-
* @param defaultValue
|
|
95
|
-
* @returns
|
|
96
|
-
*/
|
|
97
|
-
export declare const getPackageJsonProperty: <T = unknown>(packageJson: NormalizedPackageJson, property: Paths<NormalizedPackageJson>, defaultValue?: T) => T;
|
|
98
|
-
/**
|
|
99
|
-
* An asynchronous function to check if a property exists in the package.json file.
|
|
100
|
-
* @param packageJson
|
|
101
|
-
* @param property
|
|
102
|
-
* @returns
|
|
103
|
-
*/
|
|
104
|
-
export declare const hasPackageJsonProperty: (packageJson: NormalizedPackageJson, property: Paths<NormalizedPackageJson>) => boolean;
|
|
105
|
-
/**
|
|
106
|
-
* An asynchronous function to check if any of the specified dependencies exist in the package.json file.
|
|
107
|
-
* @param packageJson
|
|
108
|
-
* @param arguments_
|
|
109
|
-
* @param options
|
|
110
|
-
* @param options.peerDeps Whether to include peer dependencies
|
|
111
|
-
* @returns
|
|
112
|
-
*/
|
|
113
|
-
export declare const hasPackageJsonAnyDependency: (packageJson: NormalizedPackageJson, arguments_: string[], options?: {
|
|
114
|
-
peerDeps?: boolean;
|
|
115
|
-
}) => boolean;
|
|
116
|
-
/**
|
|
117
|
-
* An asynchronous function to ensure that the specified packages are installed in the package.json file.
|
|
118
|
-
* If the packages are not installed, the user will be prompted to install them.
|
|
119
|
-
* If the user agrees, the packages will be installed.
|
|
120
|
-
* If the user declines, the function will return without installing the packages.
|
|
121
|
-
* If the user does not respond, the function will return without installing the packages.
|
|
122
|
-
* @param packageJson
|
|
123
|
-
* @param packages
|
|
124
|
-
* @param installKey
|
|
125
|
-
* @param options
|
|
126
|
-
* @param options.deps Whether to include regular dependencies
|
|
127
|
-
* @param options.devDeps Whether to include development dependencies
|
|
128
|
-
* @param options.peerDeps Whether to include peer dependencies
|
|
129
|
-
* @param options.throwOnWarn Whether to throw an error when warnings are logged instead of just logging them
|
|
130
|
-
* @param options.logger Whether to use a custom logger
|
|
131
|
-
* @param options.confirm Whether to use a custom confirmation prompt
|
|
132
|
-
* @param options.installPackage Whether to use a custom installation package
|
|
133
|
-
* @param options.cwd Whether to use a custom current working directory
|
|
134
|
-
* @param options.dev Whether to use a custom installation key
|
|
135
|
-
* @returns
|
|
136
|
-
*/
|
|
137
|
-
export declare const ensurePackages: (packageJson: NormalizedPackageJson, packages: string[], installKey?: "dependencies" | "devDependencies", options?: EnsurePackagesOptions) => Promise<void>;
|
|
138
|
-
export {};
|
|
1
|
+
import '@visulima/fs';
|
|
2
|
+
import 'type-fest';
|
|
3
|
+
export { F as FindPackageJsonCache, a as NormalizedReadResult, 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";
|
|
4
|
+
import '@antfu/install-pkg';
|
|
5
|
+
import '@inquirer/core';
|
|
6
|
+
import '@inquirer/type';
|
|
7
|
+
import 'normalize-package-data';
|