@deepseek-ai/dsh-plugin-manager 0.2.1-rc.3 → 0.2.2-alpha.2

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.
@@ -6,7 +6,7 @@
6
6
  */
7
7
  /** Patterns in the order they decide: a specific code before the generic network family. */
8
8
  const LOG_KINDS = [
9
- ['build-blocked', /ERR_PNPM_IGNORED_BUILDS|Ignored build scripts/],
9
+ ['build-blocked', /ERR_PNPM_IGNORED_BUILDS|Ignored build scripts|ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED/],
10
10
  ['not-found', /ERR_PNPM_FETCH_404|\bE404\b|404 Not Found|Not Found - GET/],
11
11
  ['no-matching-version', /ERR_PNPM_NO_MATCHING_VERSION|\bETARGET\b|No matching version/],
12
12
  ['disk-full', /\bENOSPC\b|no space left on device/i],
@@ -62,6 +62,8 @@ export declare function saveManifest(dir: string, manifest: ProfileManifest): Pr
62
62
  * @param options Output, activation and cancellation policy.
63
63
  * @returns Exit status, whether the silence bound stopped the run, and the diagnostic path.
64
64
  * A compatibility denial returns exit code 1. Service output is bounded; CLI output uses inherited descriptors.
65
+ * Unsupported Host activation returns exit code 1 with named diagnostics; installed dependencies remain,
66
+ * and no bundle selection changes are saved. Other reconciliation or filesystem errors reject.
65
67
  * The diagnostic file is closed on return or rejection, including preparation and spawn failures.
66
68
  */
67
69
  export declare function runProfilePnpm(context: PackageOperationContext, args: readonly string[], options: PackageOperationOptions): Promise<PackageResult>;
@@ -97,6 +99,8 @@ export interface PackageViewOptions {
97
99
  timeoutMs: number;
98
100
  /** The registry asked; null asks the one pnpm's own configuration names. */
99
101
  registry?: Registry;
102
+ /** The manifest fields printed, as `pnpm view` names them; registry-only fields such as `versions`, `time`, and `dist-tags` included. */
103
+ fields: readonly string[];
100
104
  }
101
105
  /**
102
106
  * Read the registry pnpm's own configuration names in the profile: its `.npmrc` chain and workspace settings,
@@ -125,7 +129,7 @@ export declare function registryArguments(registry: Registry): string[];
125
129
  * configured after it are the retry.
126
130
  * @param dir Profile directory.
127
131
  * @param spec One registry spec: a package name with an optional range.
128
- * @param options The registry, cancellation, and the time bound.
132
+ * @param options The fields printed, the registry, cancellation, and the time bound.
129
133
  * @returns pnpm's exit, output, and how the lookup ended.
130
134
  */
131
135
  export declare function viewProfilePackage(dir: string, spec: string, options: PackageViewOptions): Promise<PackageViewResult>;
@@ -57,7 +57,8 @@ import { mkdir, mkdtemp, open, rm } from 'node:fs/promises';
57
57
  import { join, resolve } from 'node:path';
58
58
  import { execa } from 'execa';
59
59
  import { withFileLock, writeFileAtomic } from '@deepseek-ai/dsh-atomic-write';
60
- import { DEFAULT_PROFILE_BUNDLES, bundlePatchPaths, initProfile, PROFILE_TEMPLATES, readProfileManifest, resolveBundleDir, resolveProfileDir, loadOverlayPatches, composeEntries, readProfileVersionExemptions, evaluatePluginCompatibility, pluginCompatibilityWarning, } from '@deepseek-ai/dsh-app-boot';
60
+ import { assertBundlePlatform, UnsupportedBundlePlatformError, bundlePatchPaths, initProfile, readProfileManifest, resolveBundleDir, resolveProfileDir, loadOverlayPatches, composeEntries, readProfileVersionExemptions, evaluatePluginCompatibility, pluginCompatibilityWarning, } from '@deepseek-ai/dsh-app-boot';
61
+ import { PROFILE_TEMPLATES, DEFAULT_PROFILE_BUNDLES } from '@deepseek-ai/dsh-official-bundles';
61
62
  import { scrubbedParentEnv } from '@deepseek-ai/dsh-subprocess';
62
63
  import { parseInstallSpec } from "./install-spec.js";
63
64
  import { awaitTreeGone, leadsOwnGroup, treeAlive } from "./run-tree.js";
@@ -92,12 +93,13 @@ export function bundleManifest(name, dir, anchor) {
92
93
  export async function saveManifest(dir, manifest) {
93
94
  await writeFileAtomic(join(dir, 'package.json'), JSON.stringify(manifest, undefined, 2) + '\n', { mode: 0o600 });
94
95
  }
95
- /** Reconcile package removals and newly installed bundles without re-enabling retained dependencies. */
96
+ /** Reconcile bundle selection, returning platform denials without saving any selection changes. */
96
97
  async function reconcile(before, dir, anchor, options) {
97
98
  const after = readProfileManifest('dsh', dir);
98
99
  const dependencies = Object.keys(after.dependencies ?? {});
99
100
  const beforeDeps = new Set(Object.keys(before.dependencies ?? {}));
100
101
  const previous = after.dsh?.profile?.bundles ?? [];
102
+ const unsupported = [];
101
103
  const bundles = previous.filter((name) => {
102
104
  if (!beforeDeps.has(name) && !dependencies.includes(name))
103
105
  return true;
@@ -111,16 +113,28 @@ async function reconcile(before, dir, anchor, options) {
111
113
  options.onOutput?.(`dsh: warning: ${name} declares no dsh.bundle — installed as a plain dependency, not a profile layer\n`, 'stderr');
112
114
  continue;
113
115
  }
116
+ try {
117
+ assertBundlePlatform(metadata.dsh.bundle.platforms, process.platform);
118
+ }
119
+ catch (error) {
120
+ if (!(error instanceof UnsupportedBundlePlatformError))
121
+ throw error;
122
+ unsupported.push(`${name}: ${error.message}`);
123
+ continue;
124
+ }
114
125
  for (const file of bundlePatchPaths(resolveBundleDir('dsh', name, anchor, dir), metadata.dsh.bundle))
115
126
  loadOverlayPatches('dsh', file);
116
127
  if (!bundles.includes(name)) {
117
128
  bundles.push(name);
118
129
  }
119
130
  }
131
+ if (unsupported.length > 0)
132
+ return unsupported;
120
133
  if (JSON.stringify(previous) === JSON.stringify(bundles))
121
- return;
134
+ return [];
122
135
  after.dsh = { ...after.dsh, profile: { ...after.dsh?.profile, bundles } };
123
136
  await saveManifest(dir, after);
137
+ return [];
124
138
  }
125
139
  /**
126
140
  * How long the pipes keep draining after their process exited, as a fixed part of
@@ -294,6 +308,8 @@ function bundleComponentManifests(manifest, dir, anchor) {
294
308
  * @param options Output, activation and cancellation policy.
295
309
  * @returns Exit status, whether the silence bound stopped the run, and the diagnostic path.
296
310
  * A compatibility denial returns exit code 1. Service output is bounded; CLI output uses inherited descriptors.
311
+ * Unsupported Host activation returns exit code 1 with named diagnostics; installed dependencies remain,
312
+ * and no bundle selection changes are saved. Other reconciliation or filesystem errors reject.
297
313
  * The diagnostic file is closed on return or rejection, including preparation and spawn failures.
298
314
  */
299
315
  export async function runProfilePnpm(context, args, options) {
@@ -556,7 +572,14 @@ export async function runProfilePnpm(context, args, options) {
556
572
  append(Buffer.from(diagnostic));
557
573
  }
558
574
  else if (options.activateNewBundles !== false) {
559
- await reconcile(before, dir, context.installAnchor, options);
575
+ const unsupported = await reconcile(before, dir, context.installAnchor, options);
576
+ if (unsupported.length > 0) {
577
+ exitCode = 1;
578
+ const diagnostic = `\ndsh: bundle activation rejected: ${unsupported.join('\n')}\ndsh: installed dependencies remain; bundle selection is unchanged. Use a supported Host or remove the unwanted dependencies with 'dsh plugin remove <package>'.\n`;
579
+ await log.write(diagnostic);
580
+ options.onOutput?.(diagnostic, 'stderr');
581
+ append(Buffer.from(diagnostic));
582
+ }
560
583
  }
561
584
  }
562
585
  }
@@ -631,12 +654,12 @@ export function registryArguments(registry) {
631
654
  * configured after it are the retry.
632
655
  * @param dir Profile directory.
633
656
  * @param spec One registry spec: a package name with an optional range.
634
- * @param options The registry, cancellation, and the time bound.
657
+ * @param options The fields printed, the registry, cancellation, and the time bound.
635
658
  * @returns pnpm's exit, output, and how the lookup ended.
636
659
  */
637
660
  export async function viewProfilePackage(dir, spec, options) {
638
661
  const result = await execa(options.command ?? 'pnpm', [
639
- ...options.args ?? [], 'view', spec, 'name', 'version', 'description', 'dsh', '--json',
662
+ ...options.args ?? [], 'view', spec, ...options.fields, '--json',
640
663
  ...registryArguments(options.registry ?? null), '--config.fetch-retries=0',
641
664
  ], {
642
665
  cwd: dir, env: { ...scrubbedParentEnv(), ...options.env }, extendEnv: false, reject: false, stdin: 'ignore',
@@ -17,6 +17,7 @@ const ERROR_STEPS = {
17
17
  'bundle-in-use': 'Call list_plugins, disable the entries from other layers that still use this bundle, then retry.',
18
18
  'stale-approval': 'Call install_bundle again without approvedBuilds to read the current pendingBuilds.',
19
19
  'incompatible-version': 'Install a version compatible with the running DSH. A version exemption needs the user\'s explicit acceptance of crash and data-loss risk.',
20
+ 'unsupported-platform': 'This bundle cannot run on the current Host platform; ask the user to use a supported Host.',
20
21
  'operation-error': 'Report the diagnostic to the user; retry only after its cause is addressed.',
21
22
  };
22
23
  /** What the model does next for each package-manager failure. */
@@ -115,7 +116,10 @@ export function apply(ctx) {
115
116
  }
116
117
  const rows = args.action === 'list_plugins' ? await manager.listPlugins() : await manager.listBundles();
117
118
  const entries = rows.slice(offset, offset + limit).map(({ meta: _meta, ...row }) => 'rows' in row
118
- ? { ...row, rows: row.rows.map(({ meta: _rowMeta, ...declared }) => declared) }
119
+ // GUI listing and update eligibility do not change the tool's management operations.
120
+ ? (({ updatable: _updatable, listedByDefault: _listedByDefault, ...bundle }) => ({
121
+ ...bundle, rows: bundle.rows.map(({ meta: _rowMeta, ...declared }) => declared),
122
+ }))(row)
119
123
  : row);
120
124
  return JSON.stringify({ entries, total: rows.length,
121
125
  nextOffset: offset + entries.length < rows.length ? offset + entries.length : null });
@@ -4,6 +4,27 @@ import type { PluginLocalizedMeta } from '@deepseek-ai/dsh-package-manifest';
4
4
  import type { PluginInventoryEntry } from '@deepseek-ai/dsh-host-plugin-inventory/types';
5
5
  export type { PluginEntryId } from '@deepseek-ai/dsh-host-plugin-inventory/types';
6
6
  import type { PluginEntryId } from '@deepseek-ai/dsh-host-plugin-inventory/types';
7
+ import type { DetailFailureReason } from '@deepseek-ai/dsh-plugin-detail/types';
8
+ declare module '@deepseek-ai/dsh-typert-protocol' {
9
+ interface RemoteErrorDetailsMap {
10
+ /** The profile lists no such bundle, or its directory cannot be resolved. */
11
+ 'plugin-manager/unknown-bundle': {
12
+ readonly name: string;
13
+ };
14
+ /** The display language is not a BCP 47 language id. */
15
+ 'plugin-manager/invalid-language': {
16
+ readonly language: string;
17
+ };
18
+ /**
19
+ * A bundle's detail document or image exists but cannot be read: `too-large` beyond a size limit, `network` when the
20
+ * npm file CDNs cannot be reached, `invalid` for a malformed locale file or `meta.detail`, or a named file that does
21
+ * not exist. Bundle files come from local directories and public CDNs, which never answer `denied`.
22
+ */
23
+ 'plugin-manager/detail-unavailable': {
24
+ readonly reason: DetailFailureReason;
25
+ };
26
+ }
27
+ }
7
28
  /** Reasons a profile control cannot modify its target. */
8
29
  export type ReadOnlyReason = 'management-required' | 'unaddressable';
9
30
  /** A package whose declared DSH requirements reject the running DSH version, without an exemption for the exact pair. */
@@ -16,7 +37,7 @@ export interface IncompatiblePlugin {
16
37
  }
17
38
  /** Localizable management failure and optional external diagnostic. */
18
39
  export interface ManagementError {
19
- code: ReadOnlyReason | 'unknown-plugin' | 'invalid-spec' | 'already-installed' | 'ambiguous-install' | 'not-bundle' | 'not-removable' | 'stop-profile' | 'bundle-in-use' | 'stale-approval' | 'incompatible-version' | 'operation-error';
40
+ code: ReadOnlyReason | 'unknown-plugin' | 'invalid-spec' | 'already-installed' | 'ambiguous-install' | 'not-bundle' | 'not-removable' | 'stop-profile' | 'bundle-in-use' | 'stale-approval' | 'incompatible-version' | 'unsupported-platform' | 'operation-error';
20
41
  diagnostic?: string;
21
42
  /** Present with `incompatible-version`: the packages the running DSH version rejects. */
22
43
  incompatible?: IncompatiblePlugin[];
@@ -65,6 +86,8 @@ export interface BundleInfo {
65
86
  meta?: PluginLocalizedMeta;
66
87
  /** Untranslated `description` of this bundle's package manifest. */
67
88
  description?: string;
89
+ /** Default GUI visibility after package and Host checks; selected or profile-installed bundles remain manageable. */
90
+ listedByDefault?: boolean;
68
91
  /** Selected in the profile manifest; a load error means its layer was skipped. */
69
92
  enabled: boolean;
70
93
  /** Whether the profile declares this dependency; availability separately reports whether its files can be read. */
@@ -80,6 +103,11 @@ export interface BundleInfo {
80
103
  */
81
104
  optional: boolean;
82
105
  removable: boolean;
106
+ /**
107
+ * Whether `listVersions` and `updateBundle` accept the bundle: a third-party profile dependency saved as a registry
108
+ * spec under its own name, whose installed manifest declares a semver version, and that carries no plugin management.
109
+ */
110
+ updatable: boolean;
83
111
  readOnlyReason?: ReadOnlyReason;
84
112
  error?: ManagementError;
85
113
  /** The rows the bundle's patch inserts, in declaration order; empty when the patch cannot be read. */
@@ -130,7 +158,7 @@ export interface ChangeResult {
130
158
  bundle?: string;
131
159
  /** The installed bundle's manifest version, when declared; pnpm's `minimumReleaseAge` can make it older than the newest release. */
132
160
  version?: string;
133
- /** Exact package names awaiting explicit script approval in the profile's pnpm settings, read after a failed run. */
161
+ /** Exact `allowBuilds` keys awaiting explicit script approval in the profile's pnpm settings, read after a failed run. */
134
162
  pendingBuilds?: string[];
135
163
  /** Package script permissions saved before this installation attempt. */
136
164
  approvedBuilds?: string[];
@@ -190,6 +218,81 @@ export type PluginSpecInspection = {
190
218
  /** The registries asked, in order, when the refusal came from asking them; `reason` is the last one's. */
191
219
  readonly registries?: Registry[];
192
220
  };
221
+ /** One registry a lookup asked, in order; the registry that answered carries no problem. */
222
+ export interface RegistryAttempt {
223
+ readonly registry: Registry;
224
+ /** Why this registry gave no usable answer; absent for the registry that answered. */
225
+ readonly problem?: 'not-found' | 'network' | 'unknown';
226
+ /** What pnpm or the registry said, verbatim. */
227
+ readonly reason?: string;
228
+ }
229
+ /** One published version newer than the installed one. */
230
+ export interface PluginVersion {
231
+ readonly version: string;
232
+ /** The registry's publication time, as an ISO 8601 string. */
233
+ readonly publishedAt?: string;
234
+ /** The dist-tags pointing at this version, such as `latest`. */
235
+ readonly tags: readonly string[];
236
+ /** Whether the version carries a semver prerelease suffix. */
237
+ readonly prerelease: boolean;
238
+ /** The registry's deprecation message, when the version is deprecated. */
239
+ readonly deprecated?: string;
240
+ /** Whether the version declares a `dsh.bundle`; a version that does not cannot replace a bundle. */
241
+ readonly bundle: boolean;
242
+ /** Present when the version's `engines.dsh` or DSH peers reject the running DSH version without an exemption for the exact pair. */
243
+ readonly incompatible?: IncompatiblePlugin;
244
+ }
245
+ /** The versions a registry offers for an installed registry package, read without changing the profile. */
246
+ export type PluginVersionList = {
247
+ readonly status: 'listed';
248
+ /** The installed version the list is newer than. */
249
+ readonly installed: string;
250
+ /** The registry that answered; an update installs from it. */
251
+ readonly registry: Registry;
252
+ readonly attempts: readonly RegistryAttempt[];
253
+ /** Published versions newer than `installed`, newest first, at most `versionListLimit` of them. */
254
+ readonly versions: readonly PluginVersion[];
255
+ /** Newer versions beyond `versionListLimit` that the list leaves out. */
256
+ readonly omitted: number;
257
+ } | {
258
+ readonly status: 'refused';
259
+ /** `not-updatable`: the package is not an installed profile dependency resolved from a registry. */
260
+ readonly problem: 'not-updatable' | 'not-found' | 'network' | 'unknown';
261
+ readonly reason: string;
262
+ /** The registries asked, in order; empty for `not-updatable`. */
263
+ readonly attempts: readonly RegistryAttempt[];
264
+ };
265
+ /** Where a version listing asks. */
266
+ export interface ListVersionsOptions {
267
+ /** The registry asked first; absent, the one this process last installed the package from, else the configured one. */
268
+ readonly registry?: Registry;
269
+ }
270
+ /** Where an update asks for its target, and the request id its progress names. */
271
+ export interface UpdateBundleOptions {
272
+ /** The registry asked first, normally the one that answered `listVersions`; absent, as for `listVersions`. */
273
+ readonly registry?: Registry;
274
+ /** Names the update's progress and the target installation's logs; `cancelInstall` stops only that installation. */
275
+ readonly requestId?: PluginInstallRequestId;
276
+ }
277
+ /** The step of an update its Host progress names. */
278
+ export type PluginUpdateStep = 'checking' | 'removing' | 'installing' | 'restoring';
279
+ /** Progress of one update request. */
280
+ export interface PluginUpdateProgress {
281
+ readonly requestId: PluginInstallRequestId;
282
+ readonly step: PluginUpdateStep;
283
+ }
284
+ /**
285
+ * How an update ended. `result` belongs to the last step that ran: the target check, the removal of the installed
286
+ * version, or the target's installation. `restore` is present when the target's installation failed or was cancelled
287
+ * after the installed version was removed, and reports the reinstallation of that version.
288
+ */
289
+ export interface PluginUpdateResult {
290
+ readonly from: string;
291
+ readonly to: string;
292
+ readonly step: 'check' | 'remove' | 'install';
293
+ readonly result: ChangeResult;
294
+ readonly restore?: ChangeResult;
295
+ }
193
296
  /** The Host phase of one installation, before its install call settles; `installing` is announced once per registry asked. */
194
297
  export interface PluginInstallProgress {
195
298
  readonly requestId: PluginInstallRequestId;
@@ -220,13 +323,60 @@ export interface PluginInstallLogChunk {
220
323
  /** Present on the run's last chunk: pnpm's exit code, null when it ended without one. */
221
324
  readonly exitCode?: number | null;
222
325
  }
326
+ /**
327
+ * A bundle's long description, or `none` when it has neither a `meta.detail` file nor a README. Images resolve beside
328
+ * `path` through `GET /api/plugin-manager/detail-file?bundle=<name>&document=<path>&path=<destination>`.
329
+ */
330
+ export type BundleDetail = {
331
+ readonly status: 'found';
332
+ /** `locale` for the file locale `meta.detail` names, `readme` for the package's README. */
333
+ readonly origin: 'locale' | 'readme';
334
+ /** `/`-separated path of the document inside the package. */
335
+ readonly path: string;
336
+ /** Markdown text without a byte order mark or a leading YAML front matter block. */
337
+ readonly markdown: string;
338
+ } | {
339
+ readonly status: 'none';
340
+ };
223
341
  /** What changed in the profile, for consumers that show it. */
224
342
  export interface PluginChange {
225
343
  /** The operation that changed it. */
226
344
  readonly reason: 'plugin' | 'bundle' | 'install' | 'remove';
227
345
  }
346
+ /** Identifies one manager invocation, including time spent waiting for its profile lock. */
347
+ export type PluginOperationId = Branded<'PluginOperationId'>;
348
+ /** Management facts for diagnostic consumers; recent operations do not establish a crash's cause. */
349
+ export type PluginOperation = {
350
+ readonly id: PluginOperationId;
351
+ readonly time: string;
352
+ readonly reason: PluginChange['reason'];
353
+ /** Known entry id or parsed registry package name; unrecognized targets and raw specs are omitted. */
354
+ readonly target: string | null;
355
+ readonly stage: ChangeResult['stage'];
356
+ readonly enabled?: boolean | undefined;
357
+ /** Request-time or resolved package version; absence means unusable or unavailable, never the latest registry version. */
358
+ readonly version?: string | undefined;
359
+ } & ({
360
+ readonly phase: 'started';
361
+ } | {
362
+ readonly phase: 'settled';
363
+ readonly application: ChangeResult['application'];
364
+ readonly changed: boolean;
365
+ readonly errorCode?: ManagementError['code'] | undefined;
366
+ readonly restartReason?: RestartReason | undefined;
367
+ }
368
+ /** An exception escaped the operation result; persisted or applied changes cannot be inferred. */
369
+ | {
370
+ readonly phase: 'unknown';
371
+ });
228
372
  declare module '@deepseek-ai/cordis' {
229
373
  interface Events {
374
+ /**
375
+ * One manager invocation started or ended; subscribers run independently without delaying management.
376
+ * @mode parallel
377
+ * @param operation - Correlated operation facts; a start without an end has an unknown outcome.
378
+ */
379
+ 'plugin-manager/operation'(operation: PluginOperation): void | Promise<void>;
230
380
  /**
231
381
  * The profile's plugins, bundles, or composition changed: a manager
232
382
  * operation completed. A patch generation applied outside the manager,
@@ -248,6 +398,13 @@ declare module '@deepseek-ai/cordis' {
248
398
  * @param progress - the installation's request id and phase, with the attempt while installing.
249
399
  */
250
400
  'plugin-manager/install-state'(progress: PluginInstallProgress): void;
401
+ /**
402
+ * An update moved to its next step: checking the target, removing the installed version, installing the target,
403
+ * or reinstalling the removed version after the target failed. Announced once per step.
404
+ * @mode emit
405
+ * @param progress - the update's request id and step.
406
+ */
407
+ 'plugin-manager/update-state'(progress: PluginUpdateProgress): void;
251
408
  }
252
409
  }
253
410
  //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,40 @@
1
+ /** The fields a version listing prints for the package: every version, its publication times, and its dist-tags. */
2
+ export declare const VERSION_LIST_FIELDS: readonly ["versions", "time", "dist-tags"];
3
+ /** The fields read for one version: what decides whether it can replace an installed bundle. */
4
+ export declare const VERSION_FIELDS: readonly ["name", "version", "engines", "peerDependencies", "deprecated", "dsh"];
5
+ /** One published version newer than the installed one, before its own manifest is read. */
6
+ export interface PublishedVersion {
7
+ readonly version: string;
8
+ readonly publishedAt?: string;
9
+ readonly tags: readonly string[];
10
+ readonly prerelease: boolean;
11
+ }
12
+ /** What one version's manifest says about replacing an installed bundle. */
13
+ export interface VersionFacts {
14
+ /** The fields `evaluatePluginCompatibility` reads. */
15
+ readonly manifest: {
16
+ name: string;
17
+ version: string;
18
+ engines?: unknown;
19
+ peerDependencies?: unknown;
20
+ };
21
+ readonly bundle: boolean;
22
+ readonly deprecated?: string;
23
+ }
24
+ /**
25
+ * The published versions newer than the installed one, newest first.
26
+ * @param answer - parsed `pnpm view <name> versions time dist-tags --json` output.
27
+ * @param installed - the installed version.
28
+ * @returns the newer versions with their publication times and dist-tags.
29
+ * @throws when the answer names no versions.
30
+ */
31
+ export declare function newerVersions(answer: unknown, installed: string): PublishedVersion[];
32
+ /**
33
+ * What one exact version's manifest says, from `pnpm view <name>@<version> name version engines peerDependencies deprecated dsh --json`.
34
+ * @param answer - the parsed output.
35
+ * @param name - the package name, used when the answer omits it.
36
+ * @param version - the version asked for, used when the answer omits it.
37
+ * @returns the manifest fields compatibility reads, whether the version declares a bundle, and its deprecation message.
38
+ */
39
+ export declare function versionFacts(answer: unknown, name: string, version: string): VersionFacts;
40
+ //# sourceMappingURL=versions.d.ts.map
@@ -0,0 +1,61 @@
1
+ /** Read `pnpm view` answers about a package's published versions. */
2
+ import semver from 'semver';
3
+ /** The fields a version listing prints for the package: every version, its publication times, and its dist-tags. */
4
+ export const VERSION_LIST_FIELDS = ['versions', 'time', 'dist-tags'];
5
+ /** The fields read for one version: what decides whether it can replace an installed bundle. */
6
+ export const VERSION_FIELDS = ['name', 'version', 'engines', 'peerDependencies', 'deprecated', 'dsh'];
7
+ /** A JSON object, or undefined for anything else. */
8
+ function recordOf(value) {
9
+ return typeof value === 'object' && value !== null && !Array.isArray(value) ? value : undefined;
10
+ }
11
+ /**
12
+ * The published versions newer than the installed one, newest first.
13
+ * @param answer - parsed `pnpm view <name> versions time dist-tags --json` output.
14
+ * @param installed - the installed version.
15
+ * @returns the newer versions with their publication times and dist-tags.
16
+ * @throws when the answer names no versions.
17
+ */
18
+ export function newerVersions(answer, installed) {
19
+ const fields = recordOf(answer);
20
+ // pnpm prints a package with one version as a string rather than a one-element array.
21
+ const listed = typeof fields?.versions === 'string' ? [fields.versions] : fields?.versions;
22
+ if (!Array.isArray(listed))
23
+ throw new Error('pnpm view answered no versions');
24
+ const time = recordOf(fields?.time) ?? {};
25
+ const tags = Object.entries(recordOf(fields?.['dist-tags']) ?? {});
26
+ return listed
27
+ .filter((version) => typeof version === 'string' && semver.valid(version) !== null && semver.gt(version, installed))
28
+ .sort(semver.rcompare)
29
+ .map((version) => {
30
+ const published = time[version];
31
+ return {
32
+ version,
33
+ ...typeof published === 'string' ? { publishedAt: published } : {},
34
+ tags: tags.filter(([, tagged]) => tagged === version).map(([tag]) => tag),
35
+ prerelease: semver.prerelease(version) !== null,
36
+ };
37
+ });
38
+ }
39
+ /**
40
+ * What one exact version's manifest says, from `pnpm view <name>@<version> name version engines peerDependencies deprecated dsh --json`.
41
+ * @param answer - the parsed output.
42
+ * @param name - the package name, used when the answer omits it.
43
+ * @param version - the version asked for, used when the answer omits it.
44
+ * @returns the manifest fields compatibility reads, whether the version declares a bundle, and its deprecation message.
45
+ */
46
+ export function versionFacts(answer, name, version) {
47
+ const fields = recordOf(answer) ?? {};
48
+ const dsh = recordOf(fields.dsh);
49
+ const deprecated = fields.deprecated;
50
+ return {
51
+ manifest: {
52
+ name: typeof fields.name === 'string' ? fields.name : name,
53
+ version: typeof fields.version === 'string' ? fields.version : version,
54
+ ...Object.hasOwn(fields, 'engines') ? { engines: fields.engines } : {},
55
+ ...Object.hasOwn(fields, 'peerDependencies') ? { peerDependencies: fields.peerDependencies } : {},
56
+ },
57
+ bundle: recordOf(dsh?.bundle) !== undefined,
58
+ ...typeof deprecated === 'string' && deprecated !== '' ? { deprecated } : {},
59
+ };
60
+ }
61
+ //# sourceMappingURL=versions.js.map
package/locale/de.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "Plug-in-Verwaltungsdienst",
4
+ "description": "Verwalten Sie Plug-Ins und Plug-In-Pakete in der aktuell ausgeführten Konfiguration und unterstützen Sie Installation, Entfernung, Starten und Stoppen."
5
+ }
6
+ }
package/locale/es.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "Servicio de gestión de complementos",
4
+ "description": "Administre complementos y paquetes de complementos en la configuración en ejecución actual, admitiendo la instalación, eliminación, inicio y detención."
5
+ }
6
+ }
package/locale/fr.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "Service de gestion des plug-ins",
4
+ "description": "Gérez les plug-ins et les packages de plug-ins dans la configuration en cours d'exécution, prenant en charge l'installation, la suppression, le démarrage et l'arrêt."
5
+ }
6
+ }
package/locale/ja.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "プラグイン管理サービス",
4
+ "description": "現在の実行設定にあるプラグインとパッケージを管理し、インストール、削除、有効化、無効化を行います。"
5
+ }
6
+ }
package/locale/pt.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "Serviço de gerenciamento de plug-ins",
4
+ "description": "Gerencie plug-ins e pacotes de plug-ins na configuração atual em execução, oferecendo suporte à instalação, remoção, início e parada."
5
+ }
6
+ }
package/locale/ru.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "Служба управления плагинами",
4
+ "description": "Управляйте плагинами и пакетами плагинов в текущей работающей конфигурации, поддерживая установку, удаление, запуск и остановку."
5
+ }
6
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "meta": {
3
+ "title": "Werkzeuge zur Plugin-Verwaltung"
4
+ }
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "meta": {
3
+ "title": "Herramientas de gestión de plugins"
4
+ }
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "meta": {
3
+ "title": "Outils de gestion des plugins"
4
+ }
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "meta": {
3
+ "title": "プラグイン管理ツール"
4
+ }
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "meta": {
3
+ "title": "Ferramentas de gerenciamento de plug-ins"
4
+ }
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "meta": {
3
+ "title": "Инструменты управления плагинами"
4
+ }
5
+ }