package-management 0.0.8 → 0.0.10
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/package.json +45 -38
- package/dist/index.cjs +0 -1006
- package/dist/index.d.cts +0 -722
- package/dist/index.d.mts +0 -722
- package/dist/index.d.ts +0 -722
- package/dist/index.mjs +0 -952
package/dist/index.d.cts
DELETED
|
@@ -1,722 +0,0 @@
|
|
|
1
|
-
import { AsyncCacheFn as AsyncCacheFn$1 } from 'async-cache-fn';
|
|
2
|
-
import { Options } from 'execa';
|
|
3
|
-
import * as async_cache_fn_index from 'async-cache-fn/index';
|
|
4
|
-
import { InstallPackageOptions as InstallPackageOptions$1 } from '@antfu/install-pkg';
|
|
5
|
-
import { ResolveOptions } from 'mlly';
|
|
6
|
-
import * as parse_gitignore from 'parse-gitignore';
|
|
7
|
-
import * as WST from 'workspace-tools';
|
|
8
|
-
|
|
9
|
-
type __<T> = {
|
|
10
|
-
[K in keyof T]: T[K];
|
|
11
|
-
} & {};
|
|
12
|
-
type ValueOf<T> = T[keyof T];
|
|
13
|
-
type EnumToLiteral<T extends string | number> = T extends string ? `${T}` : `${T}` extends `${infer N extends number}` ? N : never;
|
|
14
|
-
type Func = (...args: any[]) => any;
|
|
15
|
-
type StringLiteral<T extends string> = T | (string & {});
|
|
16
|
-
type Awaitable<T> = T | Promise<T>;
|
|
17
|
-
type ResolvedPromise<T> = T extends Promise<infer U> ? U : never;
|
|
18
|
-
type KeyOf<T, K> = K extends keyof T ? K : never;
|
|
19
|
-
type KeyOfValue<T, K> = T[KeyOf<T, K>];
|
|
20
|
-
type PickKeyOf<T, K extends keyof T> = K extends keyof T ? K : never;
|
|
21
|
-
type SelectionMap<T> = __<{
|
|
22
|
-
[K in keyof T]?: boolean;
|
|
23
|
-
}>;
|
|
24
|
-
type PickByValue<T, V> = {
|
|
25
|
-
[K in keyof T as T[K] extends V ? K : never]: T[K];
|
|
26
|
-
};
|
|
27
|
-
type Entry<key extends PropertyKey = PropertyKey, value = unknown> = readonly [key: key, value: value];
|
|
28
|
-
type EntryOf<O> = {
|
|
29
|
-
[k in keyof O]-?: [k, O[k] & ({} | null)];
|
|
30
|
-
}[O extends readonly unknown[] ? keyof O & number : keyof O] & unknown;
|
|
31
|
-
type FromEntries<entries extends readonly Entry[]> = {
|
|
32
|
-
[entry in entries[number] as entry[0]]: entry[1];
|
|
33
|
-
};
|
|
34
|
-
type UnionizedSelectionMap<T, TSelection extends SelectionMap<T>, V> = __<V & {
|
|
35
|
-
[K in keyof T as IsExactBoolean<TSelection[K]> extends true ? K : never]?: T[K];
|
|
36
|
-
}>;
|
|
37
|
-
type Select<T, TSelection extends SelectionMap<T>, TMode extends "pick" | "omit"> = __<UnionizedSelectionMap<T, TSelection, TMode extends "pick" ? Pick<T, KeyOf<T, keyof PickByValue<TSelection, true>>> : Omit<T, KeyOf<T, keyof PickByValue<TSelection, true>>>>>;
|
|
38
|
-
type IsExactBoolean<T> = true extends T ? false extends T ? true : false : false;
|
|
39
|
-
type IsUnion<T, U = T> = T extends U ? [U] extends [T] ? false : true : never;
|
|
40
|
-
type MergeObject<T extends object, O extends object | unknown = unknown> = __<T & (O extends object ? O : Record<never, never>)>;
|
|
41
|
-
type OmitIndexSignature<ObjectType> = {
|
|
42
|
-
[KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? never : KeyType]: ObjectType[KeyType];
|
|
43
|
-
};
|
|
44
|
-
type RequireExactlyOne<ObjectType, KeysType extends keyof ObjectType = keyof ObjectType> = {
|
|
45
|
-
[Key in KeysType]: Required<Pick<ObjectType, Key>> & Partial<Record<Exclude<KeysType, Key>, never>>;
|
|
46
|
-
}[KeysType] & Omit<ObjectType, KeysType>;
|
|
47
|
-
type OmitNever<T> = Omit<T, {
|
|
48
|
-
[K in keyof T]: T[K] extends never ? K : never;
|
|
49
|
-
}[keyof T]> & {};
|
|
50
|
-
type OmitByValue<T, V> = OmitNever<{
|
|
51
|
-
[K in keyof T]: T[K] extends V ? never : T[K];
|
|
52
|
-
}>;
|
|
53
|
-
type NoInfer<T> = [T][T extends any ? 0 : never];
|
|
54
|
-
|
|
55
|
-
interface PathOptions {
|
|
56
|
-
cwd?: string;
|
|
57
|
-
}
|
|
58
|
-
type AsyncCacheFn<TReturn = unknown, TOption extends object | undefined = undefined, C extends "required" | "optional" = "optional"> = AsyncCacheFn$1<TReturn, C extends "optional" ? [TOption | undefined] | [] : [TOption]>;
|
|
59
|
-
|
|
60
|
-
interface StackFrameOptions {
|
|
61
|
-
rootFunctionName?: string;
|
|
62
|
-
}
|
|
63
|
-
declare const _filename: (options?: StackFrameOptions) => string | undefined;
|
|
64
|
-
declare const _dirname: (options?: StackFrameOptions) => string | undefined;
|
|
65
|
-
|
|
66
|
-
interface PackageManagerConfig<ID extends string = string> {
|
|
67
|
-
id: ID;
|
|
68
|
-
command: string;
|
|
69
|
-
name: string;
|
|
70
|
-
meta: {
|
|
71
|
-
lockfile: string | string[];
|
|
72
|
-
};
|
|
73
|
-
runner: string;
|
|
74
|
-
args: {
|
|
75
|
-
install: {
|
|
76
|
-
command: string;
|
|
77
|
-
options: {
|
|
78
|
-
preferOffline: string;
|
|
79
|
-
dev: string;
|
|
80
|
-
};
|
|
81
|
-
};
|
|
82
|
-
uninstall: {
|
|
83
|
-
command: string;
|
|
84
|
-
};
|
|
85
|
-
};
|
|
86
|
-
options: {
|
|
87
|
-
version: string;
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
type InstallPackageOptions = PackageManagerScriptOptions<"install">;
|
|
91
|
-
type UninstallPackageOptions = PackageManagerScriptOptions<"uninstall">;
|
|
92
|
-
type PackageManagerCommands = PackageManagerConfig["args"];
|
|
93
|
-
type PackageManagerCommandName = keyof PackageManagerCommands;
|
|
94
|
-
type PackageManagerCommandSpec<K> = KeyOfValue<PackageManagerCommands, K> extends {
|
|
95
|
-
options: infer O;
|
|
96
|
-
} ? SelectionMap<O> : Record<never, never>;
|
|
97
|
-
type PackageManagerScriptOptions<K extends PackageManagerCommandName | undefined = undefined> = __<{
|
|
98
|
-
cwd?: string;
|
|
99
|
-
silent?: boolean;
|
|
100
|
-
shellOptions?: Options;
|
|
101
|
-
} & PackageManagerCommandSpec<K>>;
|
|
102
|
-
|
|
103
|
-
interface ImportModuleData<T = any> {
|
|
104
|
-
/**
|
|
105
|
-
* The name of the package to import. This should match the name used in the import statement.
|
|
106
|
-
*/
|
|
107
|
-
name: string;
|
|
108
|
-
/**
|
|
109
|
-
* A callback which returns a module import statement
|
|
110
|
-
*/
|
|
111
|
-
import: ImportCallback<T>;
|
|
112
|
-
}
|
|
113
|
-
interface ImportPackageData<T = any> extends ImportModuleData<T> {
|
|
114
|
-
/**
|
|
115
|
-
* When enabled, the package will be installed if it is not found
|
|
116
|
-
* @default true
|
|
117
|
-
*/
|
|
118
|
-
install?: boolean;
|
|
119
|
-
/**
|
|
120
|
-
* When enabled, the package will be installed as a dev dependency
|
|
121
|
-
*/
|
|
122
|
-
dev?: boolean;
|
|
123
|
-
/**
|
|
124
|
-
* Additional installation options
|
|
125
|
-
*/
|
|
126
|
-
installOptions?: Omit<InstallPackageOptions$1, "dev">;
|
|
127
|
-
}
|
|
128
|
-
type ImportOption<T = any> = Module | ImportCallback<T> | ImportModuleData<T> | ImportPackageData<T>;
|
|
129
|
-
type Module<T = any> = Promise<T>;
|
|
130
|
-
type ImportCallback<T = any> = () => Module<T>;
|
|
131
|
-
type ImportMap = Record<string, ImportOption>;
|
|
132
|
-
type ImportList = ImportOption[];
|
|
133
|
-
type ImportModuleFn = <T = any>(name: string) => ImportModuleData<T>;
|
|
134
|
-
type ImportOptionData<T extends ImportOption> = ResolvedPromise<ExtractImportOptionModule<T>>;
|
|
135
|
-
type ResolvedImportMap<$Imports extends ImportMap> = {
|
|
136
|
-
[P in keyof $Imports]: ImportOptionData<$Imports[P]>;
|
|
137
|
-
};
|
|
138
|
-
type ResolvedImportMapPromise<T extends ImportMap> = Promise<ResolvedImportMap<T>>;
|
|
139
|
-
type ResolvedImportList<$Imports extends ImportList> = {
|
|
140
|
-
[P in keyof $Imports]: ImportOptionData<$Imports[P]>;
|
|
141
|
-
};
|
|
142
|
-
type ResolvedImportListPromise<T extends ImportList> = Promise<ResolvedImportList<T>>;
|
|
143
|
-
type ResolvedImportOption<TOption extends ImportOption> = __<{
|
|
144
|
-
name?: string;
|
|
145
|
-
import: () => ExtractImportOptionModule<TOption>;
|
|
146
|
-
} & Partial<ImportPackageData>>;
|
|
147
|
-
type ExtractImportOptionModule<TOption> = Extract<TOption extends {
|
|
148
|
-
import: () => infer I;
|
|
149
|
-
} ? I : TOption extends () => infer I ? I : TOption extends Module ? TOption : never, Module>;
|
|
150
|
-
|
|
151
|
-
interface ImporterOptions {
|
|
152
|
-
/**
|
|
153
|
-
* When enabled, the default behavior is to install packages that are not found if the name is provided.
|
|
154
|
-
* @default true
|
|
155
|
-
*/
|
|
156
|
-
install?: boolean;
|
|
157
|
-
installer?: InstallerFn;
|
|
158
|
-
}
|
|
159
|
-
/**
|
|
160
|
-
* Dynamically imports modules and returns their exports in a tuple.
|
|
161
|
-
* This function ensures type safety and maintains the order of imports.
|
|
162
|
-
*
|
|
163
|
-
* @param imports An array of dynamic import promises.
|
|
164
|
-
* @returns A promise that resolves to a tuple containing the default exports of the imported modules.
|
|
165
|
-
*
|
|
166
|
-
* @example
|
|
167
|
-
* ```typescript
|
|
168
|
-
* // Usage example with dynamic imports
|
|
169
|
-
* const [package1, package2] = await importer([
|
|
170
|
-
* import('@antfu/eslint-config'),
|
|
171
|
-
* import('@antfu/install-pkg')
|
|
172
|
-
* ]);
|
|
173
|
-
*
|
|
174
|
-
* // package1 and package2 will be the default exports of the respective modules
|
|
175
|
-
* ```
|
|
176
|
-
*
|
|
177
|
-
* @typeparam Imports An array type representing the dynamic imports.
|
|
178
|
-
*/
|
|
179
|
-
declare function importer<T extends ImportList>(imports: [...T], options?: ImporterOptions): Promise<ResolvedImportList<T>>;
|
|
180
|
-
type DefinePackageFn = <T = any>(options: __<string | Pick<ImportPackageData, "name" | "dev">>) => ImportPackageData<T>;
|
|
181
|
-
declare const definePackage: DefinePackageFn;
|
|
182
|
-
type InstallerFn = (packageName: string | string[], options?: {
|
|
183
|
-
dev?: boolean;
|
|
184
|
-
checkExists?: boolean;
|
|
185
|
-
}) => Promise<void>;
|
|
186
|
-
|
|
187
|
-
interface ImportMapOptions extends ImporterOptions {
|
|
188
|
-
}
|
|
189
|
-
type ImportMapFn = <T extends ImportMap>(importMap: T, options?: ImportMapOptions) => ResolvedImportMapPromise<T>;
|
|
190
|
-
/**
|
|
191
|
-
* Asynchronously imports modules from a record of dynamic import promises.
|
|
192
|
-
* Returns a promise that resolves to a record with the same keys, each mapped to the resolved import.
|
|
193
|
-
* This function maintains the key-value mapping and ensures type safety.
|
|
194
|
-
*
|
|
195
|
-
* @param importMap A record where each key is associated with a dynamic import promise.
|
|
196
|
-
* @returns A promise that resolves to a record containing the default exports of the imported modules,
|
|
197
|
-
* maintaining the original key structure.
|
|
198
|
-
*
|
|
199
|
-
* @example
|
|
200
|
-
* ```typescript
|
|
201
|
-
* // Usage example with a record of dynamic imports
|
|
202
|
-
*
|
|
203
|
-
* const { package1, package2 } = await importMap({
|
|
204
|
-
* package1: import('package-1'),
|
|
205
|
-
* package2: import('package-2')
|
|
206
|
-
* });
|
|
207
|
-
*
|
|
208
|
-
* // importedModules.config and importedModules.pkg will be the default exports of the respective modules
|
|
209
|
-
* ```
|
|
210
|
-
*
|
|
211
|
-
*/
|
|
212
|
-
declare const importMap: ImportMapFn;
|
|
213
|
-
|
|
214
|
-
declare function resolveModule<T>(module: Awaitable<T>): Promise<T extends {
|
|
215
|
-
default: infer U;
|
|
216
|
-
} ? U : T>;
|
|
217
|
-
interface ResolveModulePathOptions extends Omit<ResolveOptions, "url"> {
|
|
218
|
-
paths?: string | URL | (string | URL)[];
|
|
219
|
-
normalize?: ((path: string) => string) | boolean;
|
|
220
|
-
}
|
|
221
|
-
declare function isPackageModuleFound(name: string, options?: ResolveModulePathOptions): boolean;
|
|
222
|
-
declare function resolvePackageModulePath(name: string, options?: ResolveModulePathOptions): string | undefined;
|
|
223
|
-
declare function findResolvedModulePath(paths: string[], options?: ResolveModulePathOptions): string | undefined;
|
|
224
|
-
declare function resolveModulePath(modulePath: string, options?: ResolveModulePathOptions): string | undefined;
|
|
225
|
-
|
|
226
|
-
type PackageManagers = PackageManager<PackageManagerId>[];
|
|
227
|
-
interface PackageManager<ID extends string = PackageManagerId> {
|
|
228
|
-
id: ID;
|
|
229
|
-
config: PackageManagerConfig;
|
|
230
|
-
findLockfilePath: AsyncCacheFn<string | undefined, {
|
|
231
|
-
cwd?: string;
|
|
232
|
-
}>;
|
|
233
|
-
hasLockfile: AsyncCacheFn<boolean, {
|
|
234
|
-
cwd?: string;
|
|
235
|
-
}>;
|
|
236
|
-
readLockfile: AsyncCacheFn<string | undefined, {
|
|
237
|
-
cwd?: string;
|
|
238
|
-
}>;
|
|
239
|
-
globalVersion: AsyncCacheFn<string | undefined, PackageManagerScriptOptions>;
|
|
240
|
-
definePackage: DefinePackageFn;
|
|
241
|
-
defineImportMap: <T extends ImportMap>(importMap: T, options?: {
|
|
242
|
-
/**
|
|
243
|
-
* When enabled, the default behavior is to install packages that are not found.
|
|
244
|
-
* @default true
|
|
245
|
-
*/
|
|
246
|
-
install?: boolean;
|
|
247
|
-
}) => ResolvedImportMapPromise<T>;
|
|
248
|
-
uninstallPackage: (packageNames: string | string[], options?: UninstallPackageOptions) => Promise<void>;
|
|
249
|
-
installPackage: (packageNames: string | string[], options?: PackageManagerScriptOptions<"install">) => Promise<void>;
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
interface DetectPackageManagerOptions {
|
|
253
|
-
allowed?: SelectionMap<Record<PackageManagerId, unknown>>;
|
|
254
|
-
cwd?: string;
|
|
255
|
-
}
|
|
256
|
-
declare function findPackageManager(packageManagers: PackageManagers, options?: DetectPackageManagerOptions): Promise<PackageManager<"yarn" | "pnpm" | "npm" | "bun">>;
|
|
257
|
-
declare function findPackageManagerSafely<TAssert extends boolean = true>(packageManagers: PackageManagers, options?: DetectPackageManagerOptions & {
|
|
258
|
-
assert?: TAssert;
|
|
259
|
-
}): Promise<PackageManager<"yarn" | "pnpm" | "npm" | "bun"> | undefined>;
|
|
260
|
-
declare function detectPackageManagers(packageManagers: PackageManagers, options?: DetectPackageManagerOptions): Promise<PackageManager<"yarn" | "pnpm" | "npm" | "bun">[]>;
|
|
261
|
-
declare function detectLockfilePackageManagers(packageManagers: PackageManagers, options?: DetectPackageManagerOptions): Promise<PackageManager<"yarn" | "pnpm" | "npm" | "bun">[]>;
|
|
262
|
-
declare function detectGlobalPackageManagers(packageManagers: PackageManagers, options?: DetectPackageManagerOptions): Promise<PackageManager<"yarn" | "pnpm" | "npm" | "bun">[]>;
|
|
263
|
-
declare function filterPackageManagers(packageManagers: PackageManagers, filterFn: (packageManager: PackageManager) => Promise<boolean> | boolean, options?: DetectPackageManagerOptions): Promise<PackageManager<"yarn" | "pnpm" | "npm" | "bun">[]>;
|
|
264
|
-
|
|
265
|
-
type PackageManagerId = (typeof packageManagerConfigs)[number]["id"];
|
|
266
|
-
declare const packageManagerConfigs: (PackageManagerConfig<"pnpm"> | PackageManagerConfig<"yarn"> | PackageManagerConfig<"bun"> | PackageManagerConfig<"npm">)[];
|
|
267
|
-
declare function definePackageManagerClient(options: DetectPackageManagerOptions): {
|
|
268
|
-
configs: PackageManager<"yarn" | "pnpm" | "npm" | "bun">[];
|
|
269
|
-
findPackageManager: async_cache_fn_index.AsyncCacheFn<PackageManager<"yarn" | "pnpm" | "npm" | "bun">, [options?: DetectPackageManagerOptions | undefined]>;
|
|
270
|
-
findPackageManagerSafely: async_cache_fn_index.AsyncCacheFn<PackageManager<"yarn" | "pnpm" | "npm" | "bun"> | undefined, [options?: DetectPackageManagerOptions | undefined]>;
|
|
271
|
-
detectPackageManagers: async_cache_fn_index.AsyncCacheFn<PackageManager<"yarn" | "pnpm" | "npm" | "bun">[], [options?: DetectPackageManagerOptions | undefined]>;
|
|
272
|
-
detectLockfilePackageManagers: async_cache_fn_index.AsyncCacheFn<PackageManager<"yarn" | "pnpm" | "npm" | "bun">[], [options?: DetectPackageManagerOptions | undefined]>;
|
|
273
|
-
detectGlobalPackageManagers: async_cache_fn_index.AsyncCacheFn<PackageManager<"yarn" | "pnpm" | "npm" | "bun">[], [options?: DetectPackageManagerOptions | undefined]>;
|
|
274
|
-
filterPackageManagers: (filterFn: (packageManager: PackageManager) => Promise<boolean> | boolean, options?: DetectPackageManagerOptions) => Promise<PackageManager<"yarn" | "pnpm" | "npm" | "bun">[]>;
|
|
275
|
-
};
|
|
276
|
-
|
|
277
|
-
declare function isPackageDependency(packageName: string | string[]): boolean;
|
|
278
|
-
|
|
279
|
-
interface AliasDefinition {
|
|
280
|
-
resolve: ResolvePathAliasFn;
|
|
281
|
-
subpaths?: Subpath[] | Readonly<Subpath[]>;
|
|
282
|
-
}
|
|
283
|
-
interface Subpath {
|
|
284
|
-
to: string;
|
|
285
|
-
description?: string;
|
|
286
|
-
}
|
|
287
|
-
type AliasDefinitionMap<TAlias extends string = string> = Record<TAlias, AliasDefinition>;
|
|
288
|
-
type AliasMap<TAliases extends AliasDefinitionMap = AliasDefinitionMap> = {
|
|
289
|
-
[K in keyof TAliases]: TAliases[K]["resolve"];
|
|
290
|
-
} & {
|
|
291
|
-
[K in keyof TAliases as `${Extract<K, string>}/${NonNullable<TAliases[K]["subpaths"]>[number]["to"]}`]: TAliases[K]["resolve"];
|
|
292
|
-
};
|
|
293
|
-
type ResolvePathAliasFn = (opts?: {
|
|
294
|
-
cwd?: string;
|
|
295
|
-
}) => string;
|
|
296
|
-
declare function definePathAliases<const T extends AliasDefinitionMap>(aliasDefinitions: T): {
|
|
297
|
-
aliasDefinitions: T;
|
|
298
|
-
aliasMap: AliasMap<T>;
|
|
299
|
-
getFilePath: <TValidate extends boolean = false, TGlob extends boolean = false>(options: PathTo<Extract<keyof T, string> | Extract<keyof { [K in keyof T as `${Extract<K, string>}/${NonNullable<T[K]["subpaths"]>[number]["to"]}`]: T[K]["resolve"]; }, string>> | GetPathOptions<Extract<keyof T, string> | Extract<keyof { [K in keyof T as `${Extract<K, string>}/${NonNullable<T[K]["subpaths"]>[number]["to"]}`]: T[K]["resolve"]; }, string>, TValidate, TGlob>, aliases?: Record<string, string>) => TValidate extends true ? string | undefined : TGlob extends true ? string | undefined : string;
|
|
300
|
-
};
|
|
301
|
-
type PathTo<TBaseDirAlias extends string = string> = string | [baseDir: TBaseDirAlias, subpath?: string];
|
|
302
|
-
interface GetPathOptions<TAlias extends string, TValidate extends boolean = false, TGlob extends boolean = false> {
|
|
303
|
-
to: PathTo<TAlias>;
|
|
304
|
-
startingFrom?: PathTo<TAlias>;
|
|
305
|
-
cwd?: string;
|
|
306
|
-
checkExistence?: TValidate;
|
|
307
|
-
glob?: TGlob;
|
|
308
|
-
}
|
|
309
|
-
declare function getAliasMap<const T extends AliasDefinitionMap>(aliasDefs: T): AliasMap<T>;
|
|
310
|
-
|
|
311
|
-
/**
|
|
312
|
-
* ### Path Aliases:
|
|
313
|
-
*
|
|
314
|
-
*
|
|
315
|
-
```jsx
|
|
316
|
-
Notation: <user_home>/Projects/<workspace_folder>/apps/<package_folder>/src/
|
|
317
|
-
```
|
|
318
|
-
|
|
319
|
-
* - **`<workspace_folder>`**:
|
|
320
|
-
* > Starting from `cwd`, searches up the directory hierarchy for the workspace root, falling back to the git root if no workspace is detected.
|
|
321
|
-
*
|
|
322
|
-
* - **`<workspace_folder?>`**:
|
|
323
|
-
* > Starting from `cwd`, searches up the directory hierarchy for the workspace root, unlike `<workspace_folder>` it will not fallback to the git root if no workspace is detected.
|
|
324
|
-
* > - *Note that the `?` seen in `<workspace_folder?>` indicates that it has no fallback.*
|
|
325
|
-
*
|
|
326
|
-
* - **`<workspace_folder>/node_modules`**:
|
|
327
|
-
* > Subpath for node modules in the workspace folder.
|
|
328
|
-
* > - Example: `<workspace_folder>/node_modules`
|
|
329
|
-
*
|
|
330
|
-
* - **`<package_folder>`**:
|
|
331
|
-
* > Starting from `cwd`, searches up the directory hierarchy for package.json.
|
|
332
|
-
* > - Example: `<workspace_folder>/apps/package-folder`
|
|
333
|
-
*
|
|
334
|
-
* - **`<package_folder>/node_modules`**:
|
|
335
|
-
* > Subpath for node modules in the package folder.
|
|
336
|
-
*
|
|
337
|
-
* - **`<package_folder>/node_modules/.bin`**:
|
|
338
|
-
* > Subpath for executable scripts in the package folder.
|
|
339
|
-
*
|
|
340
|
-
* - **`<user_home>`**:
|
|
341
|
-
* > Path to the current user's home directory.
|
|
342
|
-
* > - Example: `/Users/username`
|
|
343
|
-
*
|
|
344
|
-
* - **`<user_tmpdir>`**:
|
|
345
|
-
* > Path to the OS tmpdir folder.
|
|
346
|
-
* > - Example: `/var/folders/vb/62qmb9fj2qsxcwhr8tb16krrw0000gn/T`
|
|
347
|
-
*
|
|
348
|
-
* - **`<cwd>`**:
|
|
349
|
-
* > Path to the current working directory.
|
|
350
|
-
*
|
|
351
|
-
* - **`<current_file>`**:
|
|
352
|
-
* > Path to the current file.
|
|
353
|
-
* > - Example: `/Users/username/Projects/monorepo/package-folder/src/utils/getPath.ts`
|
|
354
|
-
*
|
|
355
|
-
* - **`<current-folder>`**:
|
|
356
|
-
* > Path to the current folder.
|
|
357
|
-
* > - Example: `/Users/username/Projects/monorepo/package-folder/src/utils`
|
|
358
|
-
*/
|
|
359
|
-
declare const getPath: <TValidate extends boolean = false, TGlob extends boolean = false>(options: PathTo<"<workspace_folder>" | "<workspace_folder?>" | "<package_folder>" | "<gitroot_folder>" | "<user_home>" | "<user_tmpdir>" | "<cwd>" | "<current_file>" | "<current_folder>" | `<user_home>/${any}` | `<user_tmpdir>/${any}` | `<cwd>/${any}` | `<current_file>/${any}` | `<current_folder>/${any}` | "<workspace_folder>/node_modules" | "<workspace_folder>/node_modules/.bin" | "<workspace_folder?>/node_modules" | "<workspace_folder?>/node_modules/.bin" | "<package_folder>/node_modules" | "<package_folder>/node_modules/.bin" | "<package_folder>/src" | "<gitroot_folder>/node_modules" | "<gitroot_folder>/node_modules/.bin" | "<gitroot_folder>/.vscode"> | GetPathOptions<"<workspace_folder>" | "<workspace_folder?>" | "<package_folder>" | "<gitroot_folder>" | "<user_home>" | "<user_tmpdir>" | "<cwd>" | "<current_file>" | "<current_folder>" | `<user_home>/${any}` | `<user_tmpdir>/${any}` | `<cwd>/${any}` | `<current_file>/${any}` | `<current_folder>/${any}` | "<workspace_folder>/node_modules" | "<workspace_folder>/node_modules/.bin" | "<workspace_folder?>/node_modules" | "<workspace_folder?>/node_modules/.bin" | "<package_folder>/node_modules" | "<package_folder>/node_modules/.bin" | "<package_folder>/src" | "<gitroot_folder>/node_modules" | "<gitroot_folder>/node_modules/.bin" | "<gitroot_folder>/.vscode", TValidate, TGlob>, aliases?: Record<string, string> | undefined) => TValidate extends true ? string | undefined : TGlob extends true ? string | undefined : string;
|
|
360
|
-
|
|
361
|
-
type PathAlias = keyof PredefinedPathAliases;
|
|
362
|
-
type PickPathAlias<K extends PathAlias> = K;
|
|
363
|
-
type PredefinedPathAliases = typeof predefinedPathAliases;
|
|
364
|
-
declare const predefinedPathAliases: {
|
|
365
|
-
readonly "<workspace_folder>": {
|
|
366
|
-
readonly resolve: (opts: {
|
|
367
|
-
cwd?: string | undefined;
|
|
368
|
-
} | undefined) => string;
|
|
369
|
-
readonly subpaths: [{
|
|
370
|
-
readonly to: "node_modules";
|
|
371
|
-
}, {
|
|
372
|
-
readonly to: "node_modules/.bin";
|
|
373
|
-
}];
|
|
374
|
-
};
|
|
375
|
-
readonly "<workspace_folder?>": {
|
|
376
|
-
readonly resolve: (opts: {
|
|
377
|
-
cwd?: string | undefined;
|
|
378
|
-
} | undefined) => string;
|
|
379
|
-
readonly subpaths: [{
|
|
380
|
-
readonly to: "node_modules";
|
|
381
|
-
}, {
|
|
382
|
-
readonly to: "node_modules/.bin";
|
|
383
|
-
}];
|
|
384
|
-
};
|
|
385
|
-
readonly "<package_folder>": {
|
|
386
|
-
readonly resolve: (opts: {
|
|
387
|
-
cwd?: string | undefined;
|
|
388
|
-
} | undefined) => string;
|
|
389
|
-
readonly subpaths: [{
|
|
390
|
-
readonly to: "node_modules";
|
|
391
|
-
}, {
|
|
392
|
-
readonly to: "node_modules/.bin";
|
|
393
|
-
}, {
|
|
394
|
-
readonly to: "src";
|
|
395
|
-
}];
|
|
396
|
-
};
|
|
397
|
-
readonly "<gitroot_folder>": {
|
|
398
|
-
readonly resolve: (opts: {
|
|
399
|
-
cwd?: string | undefined;
|
|
400
|
-
} | undefined) => string;
|
|
401
|
-
readonly subpaths: [{
|
|
402
|
-
readonly to: "node_modules";
|
|
403
|
-
}, {
|
|
404
|
-
readonly to: "node_modules/.bin";
|
|
405
|
-
}, {
|
|
406
|
-
readonly to: ".vscode";
|
|
407
|
-
}];
|
|
408
|
-
};
|
|
409
|
-
readonly "<user_home>": {
|
|
410
|
-
readonly resolve: () => string;
|
|
411
|
-
readonly subpaths: any[];
|
|
412
|
-
};
|
|
413
|
-
readonly "<user_tmpdir>": {
|
|
414
|
-
readonly resolve: () => string;
|
|
415
|
-
readonly subpaths: any[];
|
|
416
|
-
};
|
|
417
|
-
readonly "<cwd>": {
|
|
418
|
-
readonly resolve: () => string;
|
|
419
|
-
readonly subpaths: any[];
|
|
420
|
-
};
|
|
421
|
-
readonly "<current_file>": {
|
|
422
|
-
readonly resolve: () => string;
|
|
423
|
-
readonly subpaths: any[];
|
|
424
|
-
};
|
|
425
|
-
readonly "<current_folder>": {
|
|
426
|
-
readonly resolve: () => string;
|
|
427
|
-
readonly subpaths: any[];
|
|
428
|
-
};
|
|
429
|
-
};
|
|
430
|
-
|
|
431
|
-
type PackageName = string;
|
|
432
|
-
interface PackageInfo {
|
|
433
|
-
name: PackageName;
|
|
434
|
-
dirpath: string;
|
|
435
|
-
path: string;
|
|
436
|
-
packageJson: PackageJson;
|
|
437
|
-
}
|
|
438
|
-
type PackageInfoList = PackageInfo[];
|
|
439
|
-
type PackageInfoMap = Record<PackageName, PackageInfo>;
|
|
440
|
-
interface PackageDependencyItem {
|
|
441
|
-
name: string;
|
|
442
|
-
type: PackageDependencyType;
|
|
443
|
-
version: string;
|
|
444
|
-
}
|
|
445
|
-
type PackageDependencyType = "dependency" | "devDependency" | "peerDependency" | "optionalDependency";
|
|
446
|
-
declare const dependencyTypeMap: {
|
|
447
|
-
dependency: "dependencies";
|
|
448
|
-
devDependency: "devDependencies";
|
|
449
|
-
peerDependency: "peerDependencies";
|
|
450
|
-
optionalDependency: "optionalDependencies";
|
|
451
|
-
};
|
|
452
|
-
type KnownPackageJson = OmitIndexSignature<PackageJson>;
|
|
453
|
-
interface PackageJson {
|
|
454
|
-
/**
|
|
455
|
-
* The name is what your thing is called.
|
|
456
|
-
* Some rules:
|
|
457
|
-
|
|
458
|
-
- The name must be less than or equal to 214 characters. This includes the scope for scoped packages.
|
|
459
|
-
- The name can’t start with a dot or an underscore.
|
|
460
|
-
- New packages must not have uppercase letters in the name.
|
|
461
|
-
- The name ends up being part of a URL, an argument on the command line, and a folder name. Therefore, the name can’t contain any non-URL-safe characters.
|
|
462
|
-
|
|
463
|
-
*/
|
|
464
|
-
name: PackageName;
|
|
465
|
-
/**
|
|
466
|
-
* Version must be parseable by `node-semver`, which is bundled with npm as a dependency. (`npm install semver` to use it yourself.)
|
|
467
|
-
*/
|
|
468
|
-
version?: string;
|
|
469
|
-
/**
|
|
470
|
-
* Put a description in it. It’s a string. This helps people discover your package, as it’s listed in `npm search`.
|
|
471
|
-
*/
|
|
472
|
-
description?: string;
|
|
473
|
-
/**
|
|
474
|
-
* Put keywords in it. It’s an array of strings. This helps people discover your package as it’s listed in `npm search`.
|
|
475
|
-
*/
|
|
476
|
-
keywords?: string[];
|
|
477
|
-
/**
|
|
478
|
-
* The url to the project homepage.
|
|
479
|
-
*/
|
|
480
|
-
homepage?: string;
|
|
481
|
-
/**
|
|
482
|
-
* The url to your project’s issue tracker and / or the email address to which issues should be reported. These are helpful for people who encounter issues with your package.
|
|
483
|
-
*/
|
|
484
|
-
bugs?: string | {
|
|
485
|
-
url?: string;
|
|
486
|
-
email?: string;
|
|
487
|
-
};
|
|
488
|
-
/**
|
|
489
|
-
* You should specify a license for your package so that people know how they are permitted to use it, and any restrictions you’re placing on it.
|
|
490
|
-
*/
|
|
491
|
-
license?: string;
|
|
492
|
-
/**
|
|
493
|
-
* Specify the place where your code lives. This is helpful for people who want to contribute. If the git repo is on GitHub, then the `npm docs` command will be able to find you.
|
|
494
|
-
* For GitHub, GitHub gist, Bitbucket, or GitLab repositories you can use the same shortcut syntax you use for npm install:
|
|
495
|
-
*/
|
|
496
|
-
repository?: string | {
|
|
497
|
-
type: string;
|
|
498
|
-
url: string;
|
|
499
|
-
/**
|
|
500
|
-
* If the `package.json` for your package is not in the root directory (for example if it is part of a monorepo), you can specify the directory in which it lives:
|
|
501
|
-
*/
|
|
502
|
-
directory?: string;
|
|
503
|
-
};
|
|
504
|
-
scripts?: Record<string, string>;
|
|
505
|
-
/**
|
|
506
|
-
* If you set `"private": true` in your package.json, then npm will refuse to publish it.
|
|
507
|
-
*/
|
|
508
|
-
private?: boolean;
|
|
509
|
-
/**
|
|
510
|
-
* The “author” is one person.
|
|
511
|
-
*/
|
|
512
|
-
author?: PackageJsonPerson;
|
|
513
|
-
/**
|
|
514
|
-
* “contributors” is an array of people.
|
|
515
|
-
*/
|
|
516
|
-
contributors?: PackageJsonPerson[];
|
|
517
|
-
/**
|
|
518
|
-
* The optional `files` field is an array of file patterns that describes the entries to be included when your package is installed as a dependency. File patterns follow a similar syntax to `.gitignore`, but reversed: including a file, directory, or glob pattern (`*`, `**\/*`, and such) will make it so that file is included in the tarball when it’s packed. Omitting the field will make it default to `["*"]`, which means it will include all files.
|
|
519
|
-
*/
|
|
520
|
-
files?: string[];
|
|
521
|
-
/**
|
|
522
|
-
* The main field is a module ID that is the primary entry point to your program. That is, if your package is named `foo`, and a user installs it, and then does `require("foo")`, then your main module’s exports object will be returned.
|
|
523
|
-
* This should be a module ID relative to the root of your package folder.
|
|
524
|
-
* For most modules, it makes the most sense to have a main script and often not much else.
|
|
525
|
-
*/
|
|
526
|
-
main?: string;
|
|
527
|
-
/**
|
|
528
|
-
* If your module is meant to be used client-side the browser field should be used instead of the main field. This is helpful to hint users that it might rely on primitives that aren’t available in Node.js modules. (e.g. window)
|
|
529
|
-
*/
|
|
530
|
-
browser?: string;
|
|
531
|
-
/**
|
|
532
|
-
* A map of command name to local file name. On install, npm will symlink that file into `prefix/bin` for global installs, or `./node_modules/.bin/` for local installs.
|
|
533
|
-
*/
|
|
534
|
-
bin?: string | Record<string, string>;
|
|
535
|
-
/**
|
|
536
|
-
* Specify either a single file or an array of filenames to put in place for the `man` program to find.
|
|
537
|
-
*/
|
|
538
|
-
man?: string | string[];
|
|
539
|
-
/**
|
|
540
|
-
* Dependencies are specified in a simple object that maps a package name to a version range. The version range is a string which has one or more space-separated descriptors. Dependencies can also be identified with a tarball or git URL.
|
|
541
|
-
*/
|
|
542
|
-
dependencies?: Record<string, string>;
|
|
543
|
-
/**
|
|
544
|
-
* If someone is planning on downloading and using your module in their program, then they probably don’t want or need to download and build the external test or documentation framework that you use.
|
|
545
|
-
* In this case, it’s best to map these additional items in a `devDependencies` object.
|
|
546
|
-
*/
|
|
547
|
-
devDependencies?: Record<string, string>;
|
|
548
|
-
/**
|
|
549
|
-
* If a dependency can be used, but you would like npm to proceed if it cannot be found or fails to install, then you may put it in the `optionalDependencies` object. This is a map of package name to version or url, just like the `dependencies` object. The difference is that build failures do not cause installation to fail.
|
|
550
|
-
*/
|
|
551
|
-
optionalDependencies?: Record<string, string>;
|
|
552
|
-
/**
|
|
553
|
-
* In some cases, you want to express the compatibility of your package with a host tool or library, while not necessarily doing a `require` of this host. This is usually referred to as a plugin. Notably, your module may be exposing a specific interface, expected and specified by the host documentation.
|
|
554
|
-
*/
|
|
555
|
-
peerDependencies?: Record<string, string>;
|
|
556
|
-
/**
|
|
557
|
-
* TypeScript typings, typically ending by .d.ts
|
|
558
|
-
*/
|
|
559
|
-
types?: string;
|
|
560
|
-
typings?: string;
|
|
561
|
-
/**
|
|
562
|
-
* Non-Standard Node.js alternate entry-point to main.
|
|
563
|
-
* An initial implementation for supporting CJS packages (from main), and use module for ESM modules.
|
|
564
|
-
*/
|
|
565
|
-
module?: string;
|
|
566
|
-
/**
|
|
567
|
-
* Make main entry-point be loaded as an ESM module, support "export" syntax instead of "require"
|
|
568
|
-
*
|
|
569
|
-
* Docs:
|
|
570
|
-
* - https://nodejs.org/docs/latest-v14.x/api/esm.html#esm_package_json_type_field
|
|
571
|
-
*
|
|
572
|
-
* @default 'commonjs'
|
|
573
|
-
* @since Node.js v14
|
|
574
|
-
*/
|
|
575
|
-
type?: "module" | "commonjs";
|
|
576
|
-
/**
|
|
577
|
-
* Alternate and extensible alternative to "main" entry point.
|
|
578
|
-
*
|
|
579
|
-
* When using `{type: "module"}`, any ESM module file MUST end with `.mjs` extension.
|
|
580
|
-
*
|
|
581
|
-
* Docs:
|
|
582
|
-
* - https://nodejs.org/docs/latest-v14.x/api/esm.html#esm_exports_sugar
|
|
583
|
-
*
|
|
584
|
-
* @default 'commonjs'
|
|
585
|
-
* @since Node.js v14
|
|
586
|
-
*/
|
|
587
|
-
exports?: string | Record<"import" | "require" | "." | "node" | "browser" | string, string | Record<"import" | "require" | string, string>>;
|
|
588
|
-
workspaces?: string[];
|
|
589
|
-
[key: string]: any;
|
|
590
|
-
}
|
|
591
|
-
/**
|
|
592
|
-
* A “person” is an object with a “name” field and optionally “url” and “email”. Or you can shorten that all into a single string, and npm will parse it for you.
|
|
593
|
-
*/
|
|
594
|
-
type PackageJsonPerson = string | {
|
|
595
|
-
name: string;
|
|
596
|
-
email?: string;
|
|
597
|
-
url?: string;
|
|
598
|
-
};
|
|
599
|
-
|
|
600
|
-
interface FindDependencyInPackageJsonOptions {
|
|
601
|
-
name: string;
|
|
602
|
-
type?: PackageDependencyType | AllowedDependencyTypesOption;
|
|
603
|
-
}
|
|
604
|
-
type AllowedDependencyTypesOption = SelectionMap<Record<PackageDependencyType, any>>;
|
|
605
|
-
declare function isDependencyInPackageJson(options: string | FindDependencyInPackageJsonOptions, packageJson?: PackageJson): boolean;
|
|
606
|
-
declare function findDependencyInPackageJson(option: string | FindDependencyInPackageJsonOptions, packageJson: PackageJson | undefined): {
|
|
607
|
-
firstMatch: PackageDependencyItem | undefined;
|
|
608
|
-
matches: PackageDependencyItem[];
|
|
609
|
-
} | undefined;
|
|
610
|
-
|
|
611
|
-
type ProjectFolderTypeOption = WorkspaceFolderTypeOption | PackageFolderTypeOption | GitRootFolderTypeOption | PackageNameFolderTypeOption;
|
|
612
|
-
type PackageFolderTypeOption = PickPathAlias<"<package_folder>">;
|
|
613
|
-
type GitRootFolderTypeOption = PickPathAlias<"<gitroot_folder>">;
|
|
614
|
-
type PackageNameFolderTypeOption = RequireExactlyOne<{
|
|
615
|
-
packageName: PackageName;
|
|
616
|
-
}>;
|
|
617
|
-
type WorkspaceFolderTypeOption = PickPathAlias<"<workspace_folder>"> | RequireExactlyOne<{
|
|
618
|
-
"<workspace_folder>": Pick<GetWorkspaceFolderOptions, "fallbackToGitRoot" | "throwIfNotFound">;
|
|
619
|
-
}>;
|
|
620
|
-
|
|
621
|
-
type ProjectParams = [
|
|
622
|
-
source: ProjectFolderTypeOption,
|
|
623
|
-
options?: PathOptions
|
|
624
|
-
];
|
|
625
|
-
declare const project: (source: ProjectFolderTypeOption, options?: PathOptions | undefined) => {
|
|
626
|
-
packageJson: PackageJson | undefined;
|
|
627
|
-
packageJsonPath: string | undefined;
|
|
628
|
-
packageName: string | undefined;
|
|
629
|
-
projectDir: string | undefined;
|
|
630
|
-
findPackageManager: async_cache_fn_index.AsyncCacheFn<PackageManager<"yarn" | "pnpm" | "npm" | "bun">, [options?: DetectPackageManagerOptions | undefined]>;
|
|
631
|
-
detectPackageManagers: async_cache_fn_index.AsyncCacheFn<PackageManager<"yarn" | "pnpm" | "npm" | "bun">[], [options?: DetectPackageManagerOptions | undefined]>;
|
|
632
|
-
detectGlobalPackageManagers: async_cache_fn_index.AsyncCacheFn<PackageManager<"yarn" | "pnpm" | "npm" | "bun">[], [options?: DetectPackageManagerOptions | undefined]>;
|
|
633
|
-
detectLockfilePackageManagers: async_cache_fn_index.AsyncCacheFn<PackageManager<"yarn" | "pnpm" | "npm" | "bun">[], [options?: DetectPackageManagerOptions | undefined]>;
|
|
634
|
-
tsconfig: {
|
|
635
|
-
readonly paths: string[];
|
|
636
|
-
};
|
|
637
|
-
gitignore: {
|
|
638
|
-
readonly data: parse_gitignore.ParsedGitignoreObject;
|
|
639
|
-
readonly patterns: string[];
|
|
640
|
-
};
|
|
641
|
-
filterPackageManagers: (filterFn: (packageManager: PackageManager<"yarn" | "pnpm" | "npm" | "bun">) => boolean | Promise<boolean>, options?: DetectPackageManagerOptions | undefined) => Promise<PackageManager<"yarn" | "pnpm" | "npm" | "bun">[]>;
|
|
642
|
-
getPackageJson: () => PackageJson;
|
|
643
|
-
findDependencyInPackageJson: (options: string | FindDependencyInPackageJsonOptions) => {
|
|
644
|
-
firstMatch: PackageDependencyItem | undefined;
|
|
645
|
-
matches: PackageDependencyItem[];
|
|
646
|
-
} | undefined;
|
|
647
|
-
isDependencyInPackageJson: (options: string | FindDependencyInPackageJsonOptions) => boolean;
|
|
648
|
-
};
|
|
649
|
-
|
|
650
|
-
declare function getFolderByPackageName(name: PackageName, options?: PathOptions): string | undefined;
|
|
651
|
-
|
|
652
|
-
declare function getGitRootFolder(options?: PathOptions): string | undefined;
|
|
653
|
-
|
|
654
|
-
/**
|
|
655
|
-
*
|
|
656
|
-
* Finds the nearest `package.json` directory, starting from `cwd`
|
|
657
|
-
*
|
|
658
|
-
*/
|
|
659
|
-
declare function getPackageFolder(options?: {
|
|
660
|
-
cwd?: string;
|
|
661
|
-
}): string;
|
|
662
|
-
|
|
663
|
-
interface GetWorkspaceFolderOptions<$Validate extends boolean = true> extends PathOptions {
|
|
664
|
-
/** @default true */
|
|
665
|
-
fallbackToGitRoot?: boolean;
|
|
666
|
-
/** @default true */
|
|
667
|
-
throwIfNotFound?: $Validate;
|
|
668
|
-
}
|
|
669
|
-
/**
|
|
670
|
-
* Starting from cwd, searches up the directory hierarchy for the workspace root,
|
|
671
|
-
* falling back to the git root if no workspace is detected.
|
|
672
|
-
*/
|
|
673
|
-
declare function getWorkspaceFolder<$ThrowIfNotFound extends boolean = true>(options?: GetWorkspaceFolderOptions<$ThrowIfNotFound>): $ThrowIfNotFound extends true ? string : string | undefined;
|
|
674
|
-
|
|
675
|
-
declare function getWorkspacePackageInfoMap(options?: PathOptions & {
|
|
676
|
-
includeRoot?: boolean;
|
|
677
|
-
}): PackageInfoMap;
|
|
678
|
-
|
|
679
|
-
interface GetPackageInfoListOptions {
|
|
680
|
-
cwd?: string;
|
|
681
|
-
includeRoot?: boolean;
|
|
682
|
-
}
|
|
683
|
-
declare function getWorkspacePackageInfoList(options?: GetPackageInfoListOptions): (PackageInfo | {
|
|
684
|
-
name: string;
|
|
685
|
-
path: string;
|
|
686
|
-
packageJson: WST.PackageInfo;
|
|
687
|
-
})[];
|
|
688
|
-
|
|
689
|
-
declare function getWorkspacePackageNames(options?: GetPackageInfoListOptions): string[];
|
|
690
|
-
|
|
691
|
-
declare const workspace: {
|
|
692
|
-
packageNames: typeof getWorkspacePackageNames;
|
|
693
|
-
packageGraph: typeof getWorkspacePackageInfoMap;
|
|
694
|
-
packageList: typeof getWorkspacePackageInfoList;
|
|
695
|
-
workspaceRootDir: typeof getWorkspaceFolder;
|
|
696
|
-
getProject: (source: ProjectFolderTypeOption, options?: PathOptions | undefined) => {
|
|
697
|
-
packageJson: PackageJson | undefined;
|
|
698
|
-
packageJsonPath: string | undefined;
|
|
699
|
-
packageName: string | undefined;
|
|
700
|
-
projectDir: string | undefined;
|
|
701
|
-
findPackageManager: async_cache_fn_index.AsyncCacheFn<PackageManager<"yarn" | "pnpm" | "npm" | "bun">, [options?: DetectPackageManagerOptions | undefined]>;
|
|
702
|
-
detectPackageManagers: async_cache_fn_index.AsyncCacheFn<PackageManager<"yarn" | "pnpm" | "npm" | "bun">[], [options?: DetectPackageManagerOptions | undefined]>;
|
|
703
|
-
detectGlobalPackageManagers: async_cache_fn_index.AsyncCacheFn<PackageManager<"yarn" | "pnpm" | "npm" | "bun">[], [options?: DetectPackageManagerOptions | undefined]>;
|
|
704
|
-
detectLockfilePackageManagers: async_cache_fn_index.AsyncCacheFn<PackageManager<"yarn" | "pnpm" | "npm" | "bun">[], [options?: DetectPackageManagerOptions | undefined]>;
|
|
705
|
-
tsconfig: {
|
|
706
|
-
readonly paths: string[];
|
|
707
|
-
};
|
|
708
|
-
gitignore: {
|
|
709
|
-
readonly data: parse_gitignore.ParsedGitignoreObject;
|
|
710
|
-
readonly patterns: string[];
|
|
711
|
-
};
|
|
712
|
-
filterPackageManagers: (filterFn: (packageManager: PackageManager<"yarn" | "pnpm" | "npm" | "bun">) => boolean | Promise<boolean>, options?: DetectPackageManagerOptions | undefined) => Promise<PackageManager<"yarn" | "pnpm" | "npm" | "bun">[]>;
|
|
713
|
-
getPackageJson: () => PackageJson;
|
|
714
|
-
findDependencyInPackageJson: (options: string | FindDependencyInPackageJsonOptions) => {
|
|
715
|
-
firstMatch: PackageDependencyItem | undefined;
|
|
716
|
-
matches: PackageDependencyItem[];
|
|
717
|
-
} | undefined;
|
|
718
|
-
isDependencyInPackageJson: (options: string | FindDependencyInPackageJsonOptions) => boolean;
|
|
719
|
-
};
|
|
720
|
-
};
|
|
721
|
-
|
|
722
|
-
export { type AliasDefinition, type AliasDefinitionMap, type AliasMap, type AsyncCacheFn, type Awaitable, type DefinePackageFn, type DetectPackageManagerOptions, type Entry, type EntryOf, type EnumToLiteral, type ExtractImportOptionModule, type FindDependencyInPackageJsonOptions, type FromEntries, type Func, type GetPathOptions, type GetWorkspaceFolderOptions, type ImportCallback, type ImportList, type ImportMap, type ImportMapFn, type ImportMapOptions, type ImportModuleData, type ImportModuleFn, type ImportOption, type ImportOptionData, type ImportPackageData, type ImporterOptions, type InstallPackageOptions, type InstallerFn, type IsExactBoolean, type IsUnion, type KeyOf, type KeyOfValue, type KnownPackageJson, type MergeObject, type Module, type NoInfer, type OmitByValue, type OmitIndexSignature, type OmitNever, type PackageDependencyItem, type PackageDependencyType, type PackageInfo, type PackageInfoList, type PackageInfoMap, type PackageJson, type PackageJsonPerson, type PackageManagerCommandName, type PackageManagerCommandSpec, type PackageManagerCommands, type PackageManagerConfig, type PackageManagerId, type PackageManagerScriptOptions, type PackageName, type PathAlias, type PathOptions, type PathTo, type PickByValue, type PickKeyOf, type PickPathAlias, type PredefinedPathAliases, type ProjectParams, type RequireExactlyOne, type ResolveModulePathOptions, type ResolvedImportList, type ResolvedImportListPromise, type ResolvedImportMap, type ResolvedImportMapPromise, type ResolvedImportOption, type ResolvedPromise, type Select, type SelectionMap, type StringLiteral, type UninstallPackageOptions, type ValueOf, type __, _dirname, _filename, definePackage, definePackageManagerClient, definePathAliases, dependencyTypeMap, detectGlobalPackageManagers, detectLockfilePackageManagers, detectPackageManagers, filterPackageManagers, findDependencyInPackageJson, findPackageManager, findPackageManagerSafely, findResolvedModulePath, getAliasMap, getFolderByPackageName, getGitRootFolder, getPackageFolder, getPath, getWorkspaceFolder, importMap, importer, isDependencyInPackageJson, isPackageDependency, isPackageModuleFound, packageManagerConfigs, predefinedPathAliases, project, resolveModule, resolveModulePath, resolvePackageModulePath, workspace };
|