1 | import { normalizeRawAbbreviatedPackument } from '../utils/normalize-raw-abbreviated-packument.esm.js';
|
2 | import { getRawAbbreviatedPackument } from './get-raw-abbreviated-packument.esm.js';
|
3 |
|
4 | /**
|
5 | * `getAbbreviatedPackument` returns the abbreviated packument (package document)
|
6 | * containing only the metadata necessary to install a package present on the registry.
|
7 | *
|
8 | * @remarks
|
9 | * To get all the metadata (full packument) about a package see {@link getPackument}.
|
10 | *
|
11 | * @param name - package name
|
12 | * @param registry - URL of the registry (default: npm registry)
|
13 | * @param mirrors - URLs of the registry mirrors (default: npm registry mirrors)
|
14 | * @param cached - accept cached responses (default: `true`)
|
15 | *
|
16 | * @example
|
17 | * Get the abbreviated packument for package `query-registry` from the npm registry:
|
18 | *
|
19 | * ```typescript
|
20 | * import { getAbbreviatedPackument } from 'query-registry';
|
21 | *
|
22 | * (async () => {
|
23 | * const packument = await getAbbreviatedPackument({ name: 'query-registry' });
|
24 | *
|
25 | * // Output: 'query-registry'
|
26 | * console.log(packument.name);
|
27 | * })();
|
28 | * ```
|
29 | *
|
30 | * @see {@link AbbreviatedPackument}
|
31 | * @see {@link RawAbbreviatedPackument}
|
32 | * @see {@link npmRegistry}
|
33 | * @see {@link npmRegistryMirrors}
|
34 | */
|
35 |
|
36 | async function getAbbreviatedPackument({
|
37 | name,
|
38 | registry,
|
39 | mirrors,
|
40 | cached
|
41 | }) {
|
42 | const rawAbbreviatedPackument = await getRawAbbreviatedPackument({
|
43 | name,
|
44 | registry,
|
45 | mirrors,
|
46 | cached
|
47 | });
|
48 | return normalizeRawAbbreviatedPackument({
|
49 | rawAbbreviatedPackument
|
50 | });
|
51 | }
|
52 |
|
53 | export { getAbbreviatedPackument };
|
54 | //# sourceMappingURL=get-abbreviated-packument.esm.js.map
|