dsh-crate 0.0.0-stage → 0.5.0
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/LICENSE +27 -0
- package/README.md +288 -2
- package/README.zh.md +263 -0
- package/UPDATE-API-V1.md +207 -0
- package/assets/logo.svg +37 -0
- package/client/client.js +18964 -0
- package/cordis.patch.yml +4 -0
- package/lib/accelerate.js +194 -0
- package/lib/agents.js +67 -0
- package/lib/backup.js +688 -0
- package/lib/body-progress.js +173 -0
- package/lib/catalog-local-match.js +160 -0
- package/lib/catalog-npm.js +180 -0
- package/lib/changelog.js +462 -0
- package/lib/channels.js +64 -0
- package/lib/check.js +1557 -0
- package/lib/compatibility.js +243 -0
- package/lib/crate-catalog.js +179 -0
- package/lib/diagnostics.js +49 -0
- package/lib/discovery-compatibility.js +447 -0
- package/lib/drain-journal.js +164 -0
- package/lib/drain.js +1043 -0
- package/lib/dsh-cli.js +1373 -0
- package/lib/dsh-install.js +259 -0
- package/lib/entry-identity.js +85 -0
- package/lib/gist.js +369 -0
- package/lib/groups.js +108 -0
- package/lib/home-paths.js +29 -0
- package/lib/host-recovery.js +187 -0
- package/lib/hot.js +871 -0
- package/lib/http.js +252 -0
- package/lib/index.js +394 -0
- package/lib/install.js +1147 -0
- package/lib/lifecycle.js +37 -0
- package/lib/log-redaction.js +24 -0
- package/lib/log.js +204 -0
- package/lib/ndjson.js +154 -0
- package/lib/net.js +174 -0
- package/lib/official-desktop.js +619 -0
- package/lib/order.js +284 -0
- package/lib/patch.js +943 -0
- package/lib/pending-rows.js +142 -0
- package/lib/pending-updates.js +346 -0
- package/lib/pnpm-compat.js +972 -0
- package/lib/presets.js +282 -0
- package/lib/probe-context.js +20 -0
- package/lib/proc-text.js +69 -0
- package/lib/profile.js +1978 -0
- package/lib/recovery.js +1059 -0
- package/lib/region-probe.js +93 -0
- package/lib/regions.js +283 -0
- package/lib/registry.js +308 -0
- package/lib/release-candidates.js +115 -0
- package/lib/release-updates.js +70 -0
- package/lib/restart.js +688 -0
- package/lib/routes.js +7960 -0
- package/lib/settings.js +164 -0
- package/lib/shelfry-catalog.js +179 -0
- package/lib/snapshot.js +506 -0
- package/lib/source-migration.js +164 -0
- package/lib/sources.js +1005 -0
- package/lib/state.js +38 -0
- package/lib/store.js +163 -0
- package/lib/themes.js +350 -0
- package/lib/trial.js +125 -0
- package/lib/types/accelerate.d.ts +85 -0
- package/lib/types/agents.d.ts +52 -0
- package/lib/types/backup.d.ts +171 -0
- package/lib/types/body-progress.d.ts +94 -0
- package/lib/types/catalog-local-match.d.ts +39 -0
- package/lib/types/catalog-npm.d.ts +77 -0
- package/lib/types/changelog.d.ts +131 -0
- package/lib/types/channels.d.ts +56 -0
- package/lib/types/check.d.ts +353 -0
- package/lib/types/compatibility.d.ts +83 -0
- package/lib/types/crate-catalog.d.ts +48 -0
- package/lib/types/diagnostics.d.ts +29 -0
- package/lib/types/discovery-compatibility.d.ts +145 -0
- package/lib/types/drain-journal.d.ts +25 -0
- package/lib/types/drain.d.ts +306 -0
- package/lib/types/dsh-cli.d.ts +481 -0
- package/lib/types/dsh-install.d.ts +106 -0
- package/lib/types/entry-identity.d.ts +68 -0
- package/lib/types/gist.d.ts +79 -0
- package/lib/types/groups.d.ts +34 -0
- package/lib/types/home-paths.d.ts +13 -0
- package/lib/types/host-recovery.d.ts +95 -0
- package/lib/types/hot.d.ts +405 -0
- package/lib/types/http.d.ts +114 -0
- package/lib/types/index.d.ts +52 -0
- package/lib/types/install.d.ts +463 -0
- package/lib/types/lifecycle.d.ts +14 -0
- package/lib/types/log-redaction.d.ts +2 -0
- package/lib/types/log.d.ts +43 -0
- package/lib/types/ndjson.d.ts +52 -0
- package/lib/types/net.d.ts +94 -0
- package/lib/types/official-desktop.d.ts +59 -0
- package/lib/types/order.d.ts +100 -0
- package/lib/types/patch.d.ts +218 -0
- package/lib/types/pending-rows.d.ts +81 -0
- package/lib/types/pending-updates.d.ts +161 -0
- package/lib/types/pnpm-compat.d.ts +102 -0
- package/lib/types/presets.d.ts +94 -0
- package/lib/types/probe-context.d.ts +14 -0
- package/lib/types/proc-text.d.ts +29 -0
- package/lib/types/profile.d.ts +551 -0
- package/lib/types/recovery.d.ts +342 -0
- package/lib/types/region-probe.d.ts +50 -0
- package/lib/types/regions.d.ts +134 -0
- package/lib/types/registry.d.ts +160 -0
- package/lib/types/release-candidates.d.ts +42 -0
- package/lib/types/release-updates.d.ts +15 -0
- package/lib/types/restart.d.ts +279 -0
- package/lib/types/routes.d.ts +130 -0
- package/lib/types/settings.d.ts +112 -0
- package/lib/types/shelfry-catalog.d.ts +48 -0
- package/lib/types/snapshot.d.ts +93 -0
- package/lib/types/source-migration.d.ts +100 -0
- package/lib/types/sources.d.ts +391 -0
- package/lib/types/state.d.ts +20 -0
- package/lib/types/store.d.ts +47 -0
- package/lib/types/themes.d.ts +46 -0
- package/lib/types/trial.d.ts +61 -0
- package/lib/types/update-api-v1.d.ts +83 -0
- package/lib/types/updates.d.ts +273 -0
- package/lib/types/verify.d.ts +277 -0
- package/lib/update-api-v1.js +273 -0
- package/lib/updates.js +981 -0
- package/lib/verify.js +904 -0
- package/locale/en.json +5 -0
- package/locale/zh.json +6 -0
- package/package.json +113 -4
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The market's own settings namespace: the half that makes `allowRestart`
|
|
3
|
+
* a switch on the plugin configuration page instead of a line the user has
|
|
4
|
+
* to hand-write into cordis.yml.
|
|
5
|
+
*
|
|
6
|
+
* `allowRestart: false` is the documented answer for a host owned by
|
|
7
|
+
* systemd, launchd or pm2 — a supervisor restarts it, so the market's
|
|
8
|
+
* one-click restart must not launch a second one. Until now the only way to
|
|
9
|
+
* say that was editing YAML in the right place with the right indentation,
|
|
10
|
+
* where a stray space stops the profile booting.
|
|
11
|
+
*
|
|
12
|
+
* Only `allowRestart` is exposed. `profile` names which profile this
|
|
13
|
+
* instance manages: it is decided at mount from the composition or the
|
|
14
|
+
* command line, and a running instance cannot switch to another one, so
|
|
15
|
+
* offering it as a field would promise something the write cannot deliver.
|
|
16
|
+
*
|
|
17
|
+
* `buildEnv` (issue #336) is deliberately NOT here. It is a map, so it
|
|
18
|
+
* wants a form, and the market's own settings card is the form that renders
|
|
19
|
+
* one — editing it there persists through the market's state.json and
|
|
20
|
+
* reaches children through spawnEnv. Registering it here as well would make
|
|
21
|
+
* this namespace a SECOND writer for a value that already has an editor:
|
|
22
|
+
* the settings layer and the card would overwrite each other on their next
|
|
23
|
+
* events, the exact shape of the channel bug documented below.
|
|
24
|
+
*
|
|
25
|
+
* The release channel is NOT here either, and that is a correction rather
|
|
26
|
+
* than an omission. It was, briefly, and it made this namespace a second
|
|
27
|
+
* writer for a value the market already stores in its own state.json: the
|
|
28
|
+
* mount read the user's saved channel off disk, then `onChange` assigned
|
|
29
|
+
* `source().channel` — which knows nothing about that file — straight back
|
|
30
|
+
* over it. The choice survived exactly until the next settings event.
|
|
31
|
+
*
|
|
32
|
+
* Only a real host could show that; the unit lane mounts the routes without
|
|
33
|
+
* this layer at all. `allowRestart` needs this door because its only other
|
|
34
|
+
* one is hand-edited YAML. The channel has a control of its own on the
|
|
35
|
+
* plugin configuration page, so a second door bought nothing and cost the
|
|
36
|
+
* setting its memory.
|
|
37
|
+
*
|
|
38
|
+
* The wiring rides the scoped fiber, so a host with no settings service —
|
|
39
|
+
* every dsh before 0.1.0-rc.7 — simply never runs any of this and the entry
|
|
40
|
+
* configuration stands as composed. That is why this needs no version check
|
|
41
|
+
* of its own.
|
|
42
|
+
*
|
|
43
|
+
* It depends on the SERVICE and nothing else, which is the whole point of
|
|
44
|
+
* the shape below. This module used to import two convenience helpers,
|
|
45
|
+
* `installSettingsSection` and `settingsNamespace`, from
|
|
46
|
+
* `@deepseek-ai/dsh-settings`. dsh 0.1.2-alpha.1 deleted both — and a
|
|
47
|
+
* missing NAMED EXPORT is not a missing service. `ctx.inject` degrades
|
|
48
|
+
* quietly; an ESM named import that resolves to nothing is a SyntaxError at
|
|
49
|
+
* module evaluation, which cordis's loader reports as a failed entry and the
|
|
50
|
+
* host exits 1. Installing the market stopped the host from booting at all:
|
|
51
|
+
*
|
|
52
|
+
* SyntaxError: The requested module '@deepseek-ai/dsh-settings' does not
|
|
53
|
+
* provide an export named 'installSettingsSection'
|
|
54
|
+
*
|
|
55
|
+
* The service itself did not change then — `sctx.settings.register(ns,
|
|
56
|
+
* schema, { base })` is identical in 0.1.0-rc.7 and 0.1.2-alpha.2. Only the
|
|
57
|
+
* two wrappers went away. So this inlines what the wrapper did (verified
|
|
58
|
+
* against its source: an inject, a register, a watch, and an unload effect)
|
|
59
|
+
* and validates the namespace here.
|
|
60
|
+
*
|
|
61
|
+
* It DID change in 0.1.7 (#677): `SettingsService` there has `describe` and
|
|
62
|
+
* `update` and no `register` — namespaces are derived from a plugin's Config
|
|
63
|
+
* schema instead. The `settings` service still exists, so the inject callback
|
|
64
|
+
* runs and `register` threw a TypeError that cordis swallowed. Both entry
|
|
65
|
+
* points now check for the method and, without it, leave the composed entry
|
|
66
|
+
* standing and say so once in the host log. That is a stop-gap, not the
|
|
67
|
+
* migration: on 0.1.7 the allowRestart switch is absent until the market
|
|
68
|
+
* moves to the new model.
|
|
69
|
+
*/
|
|
70
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
71
|
+
import z from '@deepseek-ai/schemastery';
|
|
72
|
+
/** Namespace the card on the browser side keys itself to. */
|
|
73
|
+
export declare const MARKET_SETTINGS_NS = "dsh-crate";
|
|
74
|
+
/**
|
|
75
|
+
* What happened when the market offered its namespace to the host (#677).
|
|
76
|
+
*
|
|
77
|
+
* Reported rather than kept private because it is the difference between two
|
|
78
|
+
* host generations, and nothing else in the system can state it: 0.1.7
|
|
79
|
+
* derives settings from a plugin's Config schema and serves no third-party
|
|
80
|
+
* namespace at all, so the market's plugin-configuration card cannot be
|
|
81
|
+
* dispatched there. That is the host's model, not a profile defect — and a
|
|
82
|
+
* test that cannot tell the two apart either demands a namespace a host
|
|
83
|
+
* cannot serve, or passes while proving nothing.
|
|
84
|
+
*
|
|
85
|
+
* `pending` is the honest third answer: the market boots before the settings
|
|
86
|
+
* service settles, so a reader can be asked too early to have an answer.
|
|
87
|
+
*/
|
|
88
|
+
export type SettingsNamespaceState = 'pending' | 'registered' | 'unsupported-by-host';
|
|
89
|
+
/** The state as of the last attempt to register the namespace. */
|
|
90
|
+
export declare function settingsNamespaceState(): SettingsNamespaceState;
|
|
91
|
+
/** The market settings a user may edit at runtime. */
|
|
92
|
+
export interface MarketSettings {
|
|
93
|
+
allowRestart: boolean;
|
|
94
|
+
}
|
|
95
|
+
export declare const MarketSettings: z<MarketSettings>;
|
|
96
|
+
/** Serve the Desktop card without claiming settings-controlled restart. */
|
|
97
|
+
export declare function installDesktopMarketSettings(ctx: Context): void;
|
|
98
|
+
/**
|
|
99
|
+
* Wire the namespace so a saved change reaches the routes immediately.
|
|
100
|
+
*
|
|
101
|
+
* The routes read `allowRestart` off this object on every request (the
|
|
102
|
+
* status route reports the capability, the restart route enforces it), so
|
|
103
|
+
* updating it in place is what makes a toggle take effect without a
|
|
104
|
+
* restart — which would be a poor thing to require of a setting whose whole
|
|
105
|
+
* subject is restarting.
|
|
106
|
+
*
|
|
107
|
+
* @param ctx - the plugin context owning the wiring.
|
|
108
|
+
* @param resolved - the live config object the routes read.
|
|
109
|
+
*/
|
|
110
|
+
export declare function installMarketSettings(ctx: Context, resolved: {
|
|
111
|
+
allowRestart?: boolean;
|
|
112
|
+
}): void;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { Registry, RegistryPlugin } from './registry.ts';
|
|
2
|
+
/**
|
|
3
|
+
* 判断一份 JSON 是否为 shelfry 目录。
|
|
4
|
+
*
|
|
5
|
+
* 只用结构特征,不依赖某个版本号:带 `entries` 数组且没有 `plugins` 数组的
|
|
6
|
+
* 就是 shelfry 形态,旧目录照常走 `asRegistry`,两套夹具互不干扰。
|
|
7
|
+
*/
|
|
8
|
+
export declare function isShelfryCatalog(value: unknown): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* 把 shelfry 目录映射成市场内部的 Registry。
|
|
11
|
+
*
|
|
12
|
+
* @param value - 已经 `JSON.parse` 过的载荷。
|
|
13
|
+
* @returns 条目已校验、分类已归一化的目录。
|
|
14
|
+
* @throws 载荷不是对象、缺少 entries、或没有一条可用条目时抛出。
|
|
15
|
+
*/
|
|
16
|
+
export declare function asShelfryRegistry(value: unknown): Registry;
|
|
17
|
+
/**
|
|
18
|
+
* 单条 shelfry 条目转成 RegistryPlugin。
|
|
19
|
+
*
|
|
20
|
+
* @param entry - entries 数组里的一项,来源不可信,逐字段校验。
|
|
21
|
+
* @returns 映射结果;缺少仓库路径或展示名时返回 null,由调用方跳过。
|
|
22
|
+
*/
|
|
23
|
+
export declare function asShelfryPlugin(entry: unknown): RegistryPlugin | null;
|
|
24
|
+
/**
|
|
25
|
+
* 条目类型转分类 id。
|
|
26
|
+
*
|
|
27
|
+
* @param type - shelfry 的 `t` 字段,可能是任何类型。
|
|
28
|
+
*/
|
|
29
|
+
export declare function categoryOf(type: unknown): string;
|
|
30
|
+
/**
|
|
31
|
+
* 从安装命令里取出 npm 包名。
|
|
32
|
+
*
|
|
33
|
+
* 命令形如 `dsh plugin --profile web add @scope/name@1.2.3`;版本号与 tag 都要
|
|
34
|
+
* 去掉,带变量的地址(`github:...#${DSH_PLUGIN_REF}`)和本地绝对路径都不是
|
|
35
|
+
* npm 包名,返回 null 让安装回落到 GitHub 源。
|
|
36
|
+
*
|
|
37
|
+
* @param command - shelfry 的 `cmd` 字段,可能是任何类型。
|
|
38
|
+
* @returns 合法 npm 包名,或 null。
|
|
39
|
+
*/
|
|
40
|
+
export declare function npmFromCommand(command: unknown): string | null;
|
|
41
|
+
/**
|
|
42
|
+
* 去掉安装源末尾的 `@版本` 或 `@tag`。
|
|
43
|
+
*
|
|
44
|
+
* 从下标 1 开始查找,避免把作用域包名开头的 `@` 当成版本分隔符。
|
|
45
|
+
*
|
|
46
|
+
* @param spec - 安装源,例如 `@scope/name@1.2.3`。
|
|
47
|
+
*/
|
|
48
|
+
export declare function stripSpecVersion(spec: string): string;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Profile snapshots — issue #98 (phase 3), implementing the snapshot half of
|
|
3
|
+
* #19: before any ordering / preset change is applied, the profile's
|
|
4
|
+
* composition-critical files are captured as a timestamped snapshot; a failed
|
|
5
|
+
* or unwanted change can be rolled back in one step.
|
|
6
|
+
*
|
|
7
|
+
* A snapshot is a single JSON document under `<profile>/.dsh-crate/
|
|
8
|
+
* snapshots/<timestamp>-<seq>.json` describing the files that define the
|
|
9
|
+
* profile's composition: package.json (dependency + bundle list),
|
|
10
|
+
* cordis.patch.yml (the user patch layer) and state.json (market disable
|
|
11
|
+
* list + groups). Version 2 records optional-file absence explicitly;
|
|
12
|
+
* restoring validates every path, reconciles writes and deletions, and rolls
|
|
13
|
+
* completed actions back if a later action fails.
|
|
14
|
+
*
|
|
15
|
+
* Retention: after every create, snapshots are pruned to the most recent
|
|
16
|
+
* `maxSnapshots` (default 20); the cap is configurable through the market
|
|
17
|
+
* plugin config (`maxSnapshots`) and each snapshot can also be deleted
|
|
18
|
+
* individually from the UI.
|
|
19
|
+
*/
|
|
20
|
+
declare const SNAPSHOT_FORMAT = "dsh-crate/profile-snapshot";
|
|
21
|
+
declare const SNAPSHOT_VERSION = 2;
|
|
22
|
+
interface SnapshotFile {
|
|
23
|
+
path: string;
|
|
24
|
+
/** JSON documents keep their parsed form (re-serialized on restore). */
|
|
25
|
+
json?: unknown;
|
|
26
|
+
/** Line-oriented text files (cordis.patch.yml) keep their lines. */
|
|
27
|
+
lines?: string[];
|
|
28
|
+
/** V2 records absence explicitly so restore can remove a later file. */
|
|
29
|
+
absent?: true;
|
|
30
|
+
}
|
|
31
|
+
export interface ProfileSnapshot {
|
|
32
|
+
/** Present on exact snapshots; omitted by legacy snapshots. */
|
|
33
|
+
format?: typeof SNAPSHOT_FORMAT;
|
|
34
|
+
/** Version 2 records all tracked paths, including explicit absence. */
|
|
35
|
+
version?: typeof SNAPSHOT_VERSION;
|
|
36
|
+
/** Snapshot id: the file basename without the .json suffix. */
|
|
37
|
+
id: string;
|
|
38
|
+
createdAt: number;
|
|
39
|
+
files: SnapshotFile[];
|
|
40
|
+
}
|
|
41
|
+
export type SnapshotCaptureResult = {
|
|
42
|
+
ok: true;
|
|
43
|
+
snapshot: ProfileSnapshot;
|
|
44
|
+
} | {
|
|
45
|
+
ok: false;
|
|
46
|
+
error: string;
|
|
47
|
+
};
|
|
48
|
+
/** Default number of snapshots retained; configurable via `maxSnapshots`. */
|
|
49
|
+
export declare const DEFAULT_MAX_SNAPSHOTS = 20;
|
|
50
|
+
/**
|
|
51
|
+
* Prune the snapshot directory to the `max` most recent snapshots (newest
|
|
52
|
+
* first). Extra ones are deleted oldest-first. A non-positive cap is clamped
|
|
53
|
+
* to 1 — a 0/negative max must never drop the snapshot that was just created
|
|
54
|
+
* nor invert to keeping the OLDEST set (issue #98 review hardening).
|
|
55
|
+
* @returns the ids that were deleted.
|
|
56
|
+
*/
|
|
57
|
+
export declare function pruneSnapshots(profileDir: string, max: number): string[];
|
|
58
|
+
/** @internal Deterministic newest-first order for equal-createdAt documents. */
|
|
59
|
+
export declare function compareSnapshotIdsNewest(a: string, b: string): number;
|
|
60
|
+
/**
|
|
61
|
+
* Capture the profile's composition into a version 2 snapshot. Missing
|
|
62
|
+
* optional files are represented explicitly. An existing optional file that
|
|
63
|
+
* cannot be read makes capture fail. Invalid market state is represented as
|
|
64
|
+
* absent because every state reader already observes it as empty and the next
|
|
65
|
+
* state write replaces it. A missing, unreadable, or invalid package.json is
|
|
66
|
+
* not snapshot-able. After creating, the directory is pruned to the most
|
|
67
|
+
* recent `maxSnapshots`.
|
|
68
|
+
*/
|
|
69
|
+
export declare function createProfileSnapshot(profileDir: string, maxSnapshots?: number): SnapshotCaptureResult;
|
|
70
|
+
/**
|
|
71
|
+
* All snapshots for a profile, newest first. Files that are unparseable,
|
|
72
|
+
* shape-invalid (bad id/createdAt/files), or whose internal id does not match
|
|
73
|
+
* the file name are skipped — a snapshot that could never be restored is not
|
|
74
|
+
* listed (issue #98 analysis: snapshot JSON validation).
|
|
75
|
+
*/
|
|
76
|
+
export declare function listSnapshots(profileDir: string): ProfileSnapshot[];
|
|
77
|
+
/**
|
|
78
|
+
* Restore a snapshot's files into the profile. Version 2 absence markers
|
|
79
|
+
* remove files created after capture; omitted optional files in unversioned
|
|
80
|
+
* legacy snapshots remain untouched. Every path is validated before mutation,
|
|
81
|
+
* each write uses a same-directory temp + rename, and a failure mid-restore
|
|
82
|
+
* rolls completed writes/deletions back to their pre-restore contents.
|
|
83
|
+
* @returns the paths restored; an error result when the snapshot is unsafe,
|
|
84
|
+
* unknown, or a write failed (with any partial writes rolled back).
|
|
85
|
+
*/
|
|
86
|
+
export declare function restoreSnapshot(profileDir: string, id: string): {
|
|
87
|
+
ok: boolean;
|
|
88
|
+
restored: string[];
|
|
89
|
+
error?: string;
|
|
90
|
+
};
|
|
91
|
+
/** Delete one snapshot; true only when it existed and was removed. */
|
|
92
|
+
export declare function deleteSnapshot(profileDir: string, id: string): boolean;
|
|
93
|
+
export {};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
export interface GitToNpmMigration {
|
|
2
|
+
kind: 'git-to-npm';
|
|
3
|
+
/** Normalized owner/repo or owner/repo#path:/subdir identity. */
|
|
4
|
+
repo: string;
|
|
5
|
+
/** Verified npm package declared by the same catalog entry. */
|
|
6
|
+
target: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The other direction: an npm install whose package was renamed (#1012).
|
|
10
|
+
*
|
|
11
|
+
* Unlike the Git case there is no local evidence to discover the target from —
|
|
12
|
+
* the old spec names only the old package, and the registry answers 404 for
|
|
13
|
+
* it. The fact has to come from the update failure that noticed it, and the
|
|
14
|
+
* transaction below is shared instead of duplicated.
|
|
15
|
+
*/
|
|
16
|
+
export interface NpmRenameMigration {
|
|
17
|
+
kind: 'npm-rename';
|
|
18
|
+
/** npm package name the profile currently depends on. */
|
|
19
|
+
from: string;
|
|
20
|
+
/** Catalog npm package name the install is offered as a target. */
|
|
21
|
+
target: string;
|
|
22
|
+
}
|
|
23
|
+
export declare function findGitToNpmMigration<T extends {
|
|
24
|
+
url: string;
|
|
25
|
+
npm?: unknown;
|
|
26
|
+
}>(plugins: readonly T[], spec: string): GitToNpmMigration | null;
|
|
27
|
+
/**
|
|
28
|
+
* The catalog entry that publishes `to` on npm, or null when no single entry
|
|
29
|
+
* does.
|
|
30
|
+
*
|
|
31
|
+
* The rename target arrives from an update failure's own artifact, but the
|
|
32
|
+
* `migrate-source` body is user-reachable all the same: this keeps the route
|
|
33
|
+
* from pointing a profile at a package name the catalog does not publish on
|
|
34
|
+
* npm. Two entries claiming one npm name is ambiguous and fails closed, the
|
|
35
|
+
* same rule {@link findGitToNpmMigration} follows.
|
|
36
|
+
*/
|
|
37
|
+
export declare function findNpmTargetEntry<T extends {
|
|
38
|
+
name: string;
|
|
39
|
+
npm?: unknown;
|
|
40
|
+
}>(plugins: readonly T[], to: string): T | null;
|
|
41
|
+
/**
|
|
42
|
+
* The catalog entry that declares `from` as a package it used to be (#1012).
|
|
43
|
+
*
|
|
44
|
+
* This is the discovery the update failure cannot provide: a user whose old
|
|
45
|
+
* version range no longer resolves never installs anything, so no
|
|
46
|
+
* "came back under another name" evidence is produced. The catalog states the
|
|
47
|
+
* rename up front instead — but it is external input, so two entries claiming
|
|
48
|
+
* one former name is ambiguity, and ambiguity fails closed exactly like
|
|
49
|
+
* {@link findGitToNpmMigration}.
|
|
50
|
+
*
|
|
51
|
+
* Only entries that can actually be installed from npm qualify: an entry whose
|
|
52
|
+
* own target is not a valid npm name has no successor this transaction could
|
|
53
|
+
* install.
|
|
54
|
+
*/
|
|
55
|
+
export declare function findCatalogRename<T extends {
|
|
56
|
+
name: string;
|
|
57
|
+
npm?: unknown;
|
|
58
|
+
previousNpm?: unknown;
|
|
59
|
+
}>(plugins: readonly T[], from: string): {
|
|
60
|
+
entry: T;
|
|
61
|
+
target: string;
|
|
62
|
+
} | null;
|
|
63
|
+
/**
|
|
64
|
+
* Installed packages that answer to one of this entry's former names (#1012).
|
|
65
|
+
*
|
|
66
|
+
* A renamed package usually re-registers the very same bundle ids, so two
|
|
67
|
+
* package names that were one plugin cannot coexist in a profile: the trial
|
|
68
|
+
* boot rejects duplicate loader ids while the two sit side by side. That makes
|
|
69
|
+
* "install the new name as well" the one obvious move that bricks the next
|
|
70
|
+
* start, which is why the install route refuses it before pnpm runs.
|
|
71
|
+
*
|
|
72
|
+
* A name on this list is a claim, not proof: the caller still compares the
|
|
73
|
+
* rows both sides declare before it refuses anything, so a stale catalog
|
|
74
|
+
* field can cost a click at worst and never a wrong refusal.
|
|
75
|
+
*/
|
|
76
|
+
export declare function declaredPredecessors<T extends {
|
|
77
|
+
name: string;
|
|
78
|
+
previousNpm?: unknown;
|
|
79
|
+
}>(plugin: T, installed: Record<string, unknown>): string[];
|
|
80
|
+
/**
|
|
81
|
+
* True when the two sides still register at least one of the same loader rows.
|
|
82
|
+
*
|
|
83
|
+
* This is the check that keeps a stale catalog from refusing an install it has
|
|
84
|
+
* no business refusing: two packages that insert different rows can coexist in
|
|
85
|
+
* a profile, so a `previousNpm` that points at one of them is a guess, not the
|
|
86
|
+
* plugin coming back. Only readable, non-empty row sets can prove sameness —
|
|
87
|
+
* a missing side proves nothing and the caller falls back to the declaration.
|
|
88
|
+
*/
|
|
89
|
+
export declare function sameLoaderRows(installed: readonly string[], incoming: readonly string[]): boolean;
|
|
90
|
+
/**
|
|
91
|
+
* True when a dependency spec is a plain registry version range — the only
|
|
92
|
+
* shape the rename transaction can replace.
|
|
93
|
+
*
|
|
94
|
+
* The route refuses anything carrying a protocol, a path prefix or an alias
|
|
95
|
+
* (`github:`, `file:`, `workspace:`, `npm:` …), because those describe a
|
|
96
|
+
* source this transaction cannot reproduce for the new name. Discovery is
|
|
97
|
+
* kept to the exact same test so the market never offers a migration the
|
|
98
|
+
* route would answer with 400.
|
|
99
|
+
*/
|
|
100
|
+
export declare function isRegistryRangeSpec(spec: string): boolean;
|