@detergent-software/atk 8.9.0 → 8.9.1-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +312 -0
- package/README.md +22 -12
- package/build/cli.js +18 -6
- package/build/cli.js.map +1 -1
- package/build/command-manifest.json +1507 -0
- package/build/commands/_app.d.ts.map +1 -1
- package/build/commands/_app.js +8 -4
- package/build/commands/_app.js.map +1 -1
- package/build/commands/audit.d.ts.map +1 -1
- package/build/commands/audit.js +1 -1
- package/build/commands/audit.js.map +1 -1
- package/build/commands/browse.js +2 -2
- package/build/commands/browse.js.map +1 -1
- package/build/commands/cache.d.ts +1 -1
- package/build/commands/cache.d.ts.map +1 -1
- package/build/commands/cache.js +1 -16
- package/build/commands/cache.js.map +1 -1
- package/build/commands/config.d.ts.map +1 -1
- package/build/commands/config.js +1 -1
- package/build/commands/config.js.map +1 -1
- package/build/commands/diff.d.ts.map +1 -1
- package/build/commands/diff.js +4 -0
- package/build/commands/diff.js.map +1 -1
- package/build/commands/drift.d.ts.map +1 -1
- package/build/commands/drift.js +4 -0
- package/build/commands/drift.js.map +1 -1
- package/build/commands/index.d.ts.map +1 -1
- package/build/commands/index.js +5 -40
- package/build/commands/index.js.map +1 -1
- package/build/commands/info.d.ts.map +1 -1
- package/build/commands/info.js +50 -33
- package/build/commands/info.js.map +1 -1
- package/build/commands/init.d.ts.map +1 -1
- package/build/commands/init.js +4 -2
- package/build/commands/init.js.map +1 -1
- package/build/commands/install.d.ts.map +1 -1
- package/build/commands/install.js +28 -7
- package/build/commands/install.js.map +1 -1
- package/build/commands/list.js +2 -2
- package/build/commands/list.js.map +1 -1
- package/build/commands/login.d.ts.map +1 -1
- package/build/commands/login.js +12 -2
- package/build/commands/login.js.map +1 -1
- package/build/commands/logout.d.ts.map +1 -1
- package/build/commands/logout.js +9 -1
- package/build/commands/logout.js.map +1 -1
- package/build/commands/outdated.js +1 -1
- package/build/commands/outdated.js.map +1 -1
- package/build/commands/prune.d.ts.map +1 -1
- package/build/commands/prune.js +4 -2
- package/build/commands/prune.js.map +1 -1
- package/build/commands/publish.d.ts +1 -1
- package/build/commands/publish.d.ts.map +1 -1
- package/build/commands/publish.js +33 -37
- package/build/commands/publish.js.map +1 -1
- package/build/commands/release-notes.d.ts.map +1 -1
- package/build/commands/release-notes.js +4 -0
- package/build/commands/release-notes.js.map +1 -1
- package/build/commands/schema.d.ts +3 -3
- package/build/commands/search.js +1 -1
- package/build/commands/search.js.map +1 -1
- package/build/commands/sync.d.ts +1 -1
- package/build/commands/sync.d.ts.map +1 -1
- package/build/commands/sync.js +27 -12
- package/build/commands/sync.js.map +1 -1
- package/build/commands/update.d.ts.map +1 -1
- package/build/commands/update.js +58 -9
- package/build/commands/update.js.map +1 -1
- package/build/commands/whoami.d.ts.map +1 -1
- package/build/commands/whoami.js +16 -4
- package/build/commands/whoami.js.map +1 -1
- package/build/commands/why.js +3 -4
- package/build/commands/why.js.map +1 -1
- package/build/components/Header.d.ts +2 -3
- package/build/components/Header.d.ts.map +1 -1
- package/build/components/Header.js +2 -9
- package/build/components/Header.js.map +1 -1
- package/build/components/LocalEditsHint.d.ts +16 -0
- package/build/components/LocalEditsHint.d.ts.map +1 -0
- package/build/components/LocalEditsHint.js +18 -0
- package/build/components/LocalEditsHint.js.map +1 -0
- package/build/components/SyncAllInSync.d.ts +5 -1
- package/build/components/SyncAllInSync.d.ts.map +1 -1
- package/build/components/SyncAllInSync.js +2 -2
- package/build/components/SyncAllInSync.js.map +1 -1
- package/build/components/header-art.d.ts +7 -0
- package/build/components/header-art.d.ts.map +1 -0
- package/build/components/header-art.js +14 -0
- package/build/components/header-art.js.map +1 -0
- package/build/components/index.d.ts +1 -0
- package/build/components/index.d.ts.map +1 -1
- package/build/components/index.js +1 -0
- package/build/components/index.js.map +1 -1
- package/build/hooks/useListActions.d.ts.map +1 -1
- package/build/hooks/useListActions.js +4 -0
- package/build/hooks/useListActions.js.map +1 -1
- package/build/hooks/usePruneState.d.ts +1 -7
- package/build/hooks/usePruneState.d.ts.map +1 -1
- package/build/hooks/usePruneState.js +18 -62
- package/build/hooks/usePruneState.js.map +1 -1
- package/build/hooks/usePublishState.d.ts +38 -207
- package/build/hooks/usePublishState.d.ts.map +1 -1
- package/build/hooks/usePublishState.js +83 -1501
- package/build/hooks/usePublishState.js.map +1 -1
- package/build/lib/adapter.d.ts +10 -1
- package/build/lib/adapter.d.ts.map +1 -1
- package/build/lib/adapter.js +46 -3
- package/build/lib/adapter.js.map +1 -1
- package/build/lib/api-client.d.ts +9 -5
- package/build/lib/api-client.d.ts.map +1 -1
- package/build/lib/api-client.js +35 -8
- package/build/lib/api-client.js.map +1 -1
- package/build/lib/atk-api/errors.d.ts +5 -2
- package/build/lib/atk-api/errors.d.ts.map +1 -1
- package/build/lib/atk-api/errors.js +1 -0
- package/build/lib/atk-api/errors.js.map +1 -1
- package/build/lib/atk-api/generated/types.gen.d.ts +12 -12
- package/build/lib/atk-api/index.d.ts +2 -2
- package/build/lib/atk-api/index.d.ts.map +1 -1
- package/build/lib/atk-api/index.js +1 -1
- package/build/lib/atk-api/index.js.map +1 -1
- package/build/lib/atk-api/web-routes.d.ts +25 -6
- package/build/lib/atk-api/web-routes.d.ts.map +1 -1
- package/build/lib/atk-api/web-routes.js +27 -8
- package/build/lib/atk-api/web-routes.js.map +1 -1
- package/build/lib/auth.d.ts +12 -2
- package/build/lib/auth.d.ts.map +1 -1
- package/build/lib/auth.js +38 -3
- package/build/lib/auth.js.map +1 -1
- package/build/lib/checksum.d.ts +40 -14
- package/build/lib/checksum.d.ts.map +1 -1
- package/build/lib/checksum.js +110 -57
- package/build/lib/checksum.js.map +1 -1
- package/build/lib/config.d.ts +4 -4
- package/build/lib/config.d.ts.map +1 -1
- package/build/lib/config.js +31 -8
- package/build/lib/config.js.map +1 -1
- package/build/lib/diagnostics.d.ts.map +1 -1
- package/build/lib/diagnostics.js +10 -7
- package/build/lib/diagnostics.js.map +1 -1
- package/build/lib/diff-command.js +1 -1
- package/build/lib/diff-command.js.map +1 -1
- package/build/lib/errors.d.ts +4 -1
- package/build/lib/errors.d.ts.map +1 -1
- package/build/lib/errors.js.map +1 -1
- package/build/lib/format-age.d.ts +3 -0
- package/build/lib/format-age.d.ts.map +1 -0
- package/build/lib/format-age.js +18 -0
- package/build/lib/format-age.js.map +1 -0
- package/build/lib/installer.d.ts +8 -11
- package/build/lib/installer.d.ts.map +1 -1
- package/build/lib/installer.js +83 -28
- package/build/lib/installer.js.map +1 -1
- package/build/lib/local-edits.d.ts +72 -0
- package/build/lib/local-edits.d.ts.map +1 -0
- package/build/lib/local-edits.js +145 -0
- package/build/lib/local-edits.js.map +1 -0
- package/build/lib/lockfile.d.ts +12 -8
- package/build/lib/lockfile.d.ts.map +1 -1
- package/build/lib/lockfile.js +209 -59
- package/build/lib/lockfile.js.map +1 -1
- package/build/lib/mover.d.ts.map +1 -1
- package/build/lib/mover.js +11 -12
- package/build/lib/mover.js.map +1 -1
- package/build/lib/multi-tool-install.d.ts +4 -2
- package/build/lib/multi-tool-install.d.ts.map +1 -1
- package/build/lib/multi-tool-install.js +12 -2
- package/build/lib/multi-tool-install.js.map +1 -1
- package/build/lib/offline.d.ts +19 -0
- package/build/lib/offline.d.ts.map +1 -0
- package/build/lib/offline.js +26 -0
- package/build/lib/offline.js.map +1 -0
- package/build/lib/owned-paths.d.ts +7 -4
- package/build/lib/owned-paths.d.ts.map +1 -1
- package/build/lib/owned-paths.js +23 -8
- package/build/lib/owned-paths.js.map +1 -1
- package/build/lib/parse-json.d.ts +12 -0
- package/build/lib/parse-json.d.ts.map +1 -1
- package/build/lib/parse-json.js +15 -2
- package/build/lib/parse-json.js.map +1 -1
- package/build/lib/pastel/commander-specs.d.ts +7 -0
- package/build/lib/pastel/commander-specs.d.ts.map +1 -0
- package/build/lib/pastel/commander-specs.js +50 -0
- package/build/lib/pastel/commander-specs.js.map +1 -0
- package/build/lib/pastel/generate-arguments.d.ts +3 -3
- package/build/lib/pastel/generate-arguments.d.ts.map +1 -1
- package/build/lib/pastel/generate-arguments.js +25 -22
- package/build/lib/pastel/generate-arguments.js.map +1 -1
- package/build/lib/pastel/generate-command.d.ts +7 -5
- package/build/lib/pastel/generate-command.d.ts.map +1 -1
- package/build/lib/pastel/generate-command.js +32 -67
- package/build/lib/pastel/generate-command.js.map +1 -1
- package/build/lib/pastel/generate-commands.d.ts +3 -5
- package/build/lib/pastel/generate-commands.d.ts.map +1 -1
- package/build/lib/pastel/generate-commands.js +6 -10
- package/build/lib/pastel/generate-commands.js.map +1 -1
- package/build/lib/pastel/generate-options.d.ts +3 -3
- package/build/lib/pastel/generate-options.d.ts.map +1 -1
- package/build/lib/pastel/generate-options.js +16 -13
- package/build/lib/pastel/generate-options.js.map +1 -1
- package/build/lib/pastel/index.d.ts +26 -4
- package/build/lib/pastel/index.d.ts.map +1 -1
- package/build/lib/pastel/index.js +104 -18
- package/build/lib/pastel/index.js.map +1 -1
- package/build/lib/pastel/internal-types.d.ts +39 -8
- package/build/lib/pastel/internal-types.d.ts.map +1 -1
- package/build/lib/pastel/manifest.d.ts +8 -0
- package/build/lib/pastel/manifest.d.ts.map +1 -0
- package/build/lib/pastel/manifest.js +7 -0
- package/build/lib/pastel/manifest.js.map +1 -0
- package/build/lib/pastel/read-commands.d.ts +7 -2
- package/build/lib/pastel/read-commands.d.ts.map +1 -1
- package/build/lib/pastel/read-commands.js +51 -30
- package/build/lib/pastel/read-commands.js.map +1 -1
- package/build/lib/pastel/render-command.d.ts +13 -0
- package/build/lib/pastel/render-command.d.ts.map +1 -0
- package/build/lib/pastel/render-command.js +56 -0
- package/build/lib/pastel/render-command.js.map +1 -0
- package/build/lib/process-alive.d.ts +11 -0
- package/build/lib/process-alive.d.ts.map +1 -0
- package/build/lib/process-alive.js +22 -0
- package/build/lib/process-alive.js.map +1 -0
- package/build/lib/pruner.d.ts +26 -0
- package/build/lib/pruner.d.ts.map +1 -0
- package/build/lib/pruner.js +42 -0
- package/build/lib/pruner.js.map +1 -0
- package/build/lib/publish-flow.d.ts +224 -0
- package/build/lib/publish-flow.d.ts.map +1 -0
- package/build/lib/publish-flow.js +1258 -0
- package/build/lib/publish-flow.js.map +1 -0
- package/build/lib/publish-run.d.ts +55 -0
- package/build/lib/publish-run.d.ts.map +1 -0
- package/build/lib/publish-run.js +169 -0
- package/build/lib/publish-run.js.map +1 -0
- package/build/lib/publisher.d.ts +25 -17
- package/build/lib/publisher.d.ts.map +1 -1
- package/build/lib/publisher.js +54 -53
- package/build/lib/publisher.js.map +1 -1
- package/build/lib/registrar.d.ts.map +1 -1
- package/build/lib/registrar.js +2 -2
- package/build/lib/registrar.js.map +1 -1
- package/build/lib/registry.d.ts +18 -7
- package/build/lib/registry.d.ts.map +1 -1
- package/build/lib/registry.js +113 -32
- package/build/lib/registry.js.map +1 -1
- package/build/lib/root-path.d.ts +11 -0
- package/build/lib/root-path.d.ts.map +1 -1
- package/build/lib/root-path.js +15 -1
- package/build/lib/root-path.js.map +1 -1
- package/build/lib/schemas/config.d.ts +3 -1
- package/build/lib/schemas/config.d.ts.map +1 -1
- package/build/lib/schemas/config.js +1 -1
- package/build/lib/schemas/config.js.map +1 -1
- package/build/lib/schemas/lockfile.d.ts +156 -23
- package/build/lib/schemas/lockfile.d.ts.map +1 -1
- package/build/lib/schemas/lockfile.js +100 -79
- package/build/lib/schemas/lockfile.js.map +1 -1
- package/build/lib/setup.d.ts.map +1 -1
- package/build/lib/setup.js +53 -48
- package/build/lib/setup.js.map +1 -1
- package/build/lib/staging.d.ts +15 -0
- package/build/lib/staging.d.ts.map +1 -0
- package/build/lib/staging.js +33 -0
- package/build/lib/staging.js.map +1 -0
- package/build/lib/sync.d.ts +22 -6
- package/build/lib/sync.d.ts.map +1 -1
- package/build/lib/sync.js +59 -7
- package/build/lib/sync.js.map +1 -1
- package/build/lib/uninstaller.d.ts.map +1 -1
- package/build/lib/uninstaller.js +8 -5
- package/build/lib/uninstaller.js.map +1 -1
- package/build/lib/update-check.d.ts +4 -0
- package/build/lib/update-check.d.ts.map +1 -1
- package/build/lib/update-check.js +55 -56
- package/build/lib/update-check.js.map +1 -1
- package/build/lib/updater.d.ts +31 -1
- package/build/lib/updater.d.ts.map +1 -1
- package/build/lib/updater.js +143 -4
- package/build/lib/updater.js.map +1 -1
- package/build/lib/usage-error.d.ts +20 -0
- package/build/lib/usage-error.d.ts.map +1 -0
- package/build/lib/usage-error.js +41 -0
- package/build/lib/usage-error.js.map +1 -0
- package/build/lib/user-setup.d.ts.map +1 -1
- package/build/lib/user-setup.js +62 -59
- package/build/lib/user-setup.js.map +1 -1
- package/build/lib/write-file.d.ts +5 -0
- package/build/lib/write-file.d.ts.map +1 -1
- package/build/lib/write-file.js +68 -13
- package/build/lib/write-file.js.map +1 -1
- package/package.json +81 -81
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { Adapter } from './schemas/adapter.js';
|
|
2
|
+
import type { AssetType, Registry } from './schemas/index.js';
|
|
3
|
+
import type { InstalledAsset, Lockfile } from './schemas/lockfile.js';
|
|
4
|
+
/** An installed asset with files the user edited since ATK placed them. */
|
|
5
|
+
export interface LocalEdits {
|
|
6
|
+
/**
|
|
7
|
+
* Set when the edits are not the asset's own but those of these installed dependencies, which
|
|
8
|
+
* updating the asset would replace or remove (see `withDependencyEdits` in the updater).
|
|
9
|
+
*/
|
|
10
|
+
dependencies?: Array<{
|
|
11
|
+
name: string;
|
|
12
|
+
org?: string;
|
|
13
|
+
type: AssetType;
|
|
14
|
+
}>;
|
|
15
|
+
/** The edited files, as the lockfile records their paths. */
|
|
16
|
+
files: string[];
|
|
17
|
+
name: string;
|
|
18
|
+
org?: string;
|
|
19
|
+
type: AssetType;
|
|
20
|
+
/**
|
|
21
|
+
* A registry version's file listing couldn't be read (or there was no registry), so a file may
|
|
22
|
+
* hold that version's content rather than an edit. It is kept, to be safe.
|
|
23
|
+
*/
|
|
24
|
+
unchecked?: true;
|
|
25
|
+
}
|
|
26
|
+
/** A placed file: where it is, and its path in the registry's version directory. */
|
|
27
|
+
type PlacedFile = {
|
|
28
|
+
installedPath: string;
|
|
29
|
+
sourcePath: string;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* The placed files among `placed` whose check failed on content rather than a missing file: the
|
|
33
|
+
* candidates for a local edit. `failures` are {@link verifyOwnFiles}'s, with absolute paths.
|
|
34
|
+
*/
|
|
35
|
+
export declare function changedAmong<T extends PlacedFile>(placed: T[], failures: Array<{
|
|
36
|
+
actual: string;
|
|
37
|
+
path: string;
|
|
38
|
+
}>, root: string): T[];
|
|
39
|
+
/** Forget the file listings {@link localEditsAmong} read (for tests). */
|
|
40
|
+
export declare function clearPublishedListings(): void;
|
|
41
|
+
/**
|
|
42
|
+
* The files of `asset` the adapter's tool has on disk with content that no published version of it
|
|
43
|
+
* had (see {@link localEditsAmong}): edits a reinstall would overwrite, and placed asset
|
|
44
|
+
* directories are gitignored, so they can't be recovered. Paths are read where ATK placed the copy,
|
|
45
|
+
* also when the tool's user config directory moved since. Undefined when there are none.
|
|
46
|
+
*/
|
|
47
|
+
export declare function editedFiles(asset: InstalledAsset, adapter: Adapter, root: string, lockfile: Pick<Lockfile, 'assets'>, registry: Registry | undefined): Promise<LocalEdits | undefined>;
|
|
48
|
+
/**
|
|
49
|
+
* The installed assets with local edits for any of `adapters`, keyed by {@link identityKey}: those
|
|
50
|
+
* `only` picks, when given (the assets a command can overwrite). A tool the asset was uninstalled
|
|
51
|
+
* for, or one with no placement for its type, has no copy to edit.
|
|
52
|
+
*/
|
|
53
|
+
export declare function findLocalEdits(lockfile: Pick<Lockfile, 'assets'>, adapters: Adapter[], root: string, registry: Registry | undefined, only?: (asset: InstalledAsset) => boolean): Promise<Map<string, LocalEdits>>;
|
|
54
|
+
/**
|
|
55
|
+
* Whether an installed asset in `lockfile` declares `asset` as a dependency, so updating that one
|
|
56
|
+
* can replace or remove it. Dependency refs carry no org, so name and type decide.
|
|
57
|
+
*/
|
|
58
|
+
export declare function isDependedOn(lockfile: Pick<Lockfile, 'assets'>, asset: Pick<InstalledAsset, 'name' | 'type'>): boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Which of `changed`, placed files of `asset` whose content differs from the lockfile, are local
|
|
61
|
+
* edits: those holding content that no published version of the asset had. A file that matches a
|
|
62
|
+
* file of one (with either line ending, as checksums allow) is stale, not edited: the lockfile moved
|
|
63
|
+
* past it (a lockfile bump pulled from git, a copy of another version, a tool a multi-tool update
|
|
64
|
+
* left behind), so reinstalling loses nothing. Any file of the version counts, so an entrypoint
|
|
65
|
+
* renamed between versions still matches. The versions are read newest first, a few file listings
|
|
66
|
+
* at a time, until every file is matched. A listing that can't be read, or no registry, leaves its
|
|
67
|
+
* files as edits (`unchecked`). A failure no other request would get past (an expired sign-in, an
|
|
68
|
+
* outdated CLI) is thrown. Undefined when none is an edit.
|
|
69
|
+
*/
|
|
70
|
+
export declare function localEditsAmong(asset: InstalledAsset, changed: PlacedFile[], root: string, registry: Registry | undefined): Promise<LocalEdits | undefined>;
|
|
71
|
+
export {};
|
|
72
|
+
//# sourceMappingURL=local-edits.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-edits.d.ts","sourceRoot":"","sources":["../../src/lib/local-edits.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAWtE,2EAA2E;AAC3E,MAAM,WAAW,UAAU;IACzB;;;OAGG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,SAAS,CAAA;KAAE,CAAC,CAAC;IACtE,6DAA6D;IAC7D,KAAK,EAAE,MAAM,EAA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AK,EAAE,IAAI,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,CAAC,GAC3C,OAAO,CAIT;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,eAAe,CACnC,KAAK,EAAE,cAAc,EACrB,OAAO,EAAE,UAAU,EAAE,EACrB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,QAAQ,GAAG,SAAS,GAC7B,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAgCjC"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
2
|
+
import { rcompare, valid } from 'semver';
|
|
3
|
+
import { adapterAsPlaced, resolveInstalledPaths } from './adapter.js';
|
|
4
|
+
import { isExcludedForTool, supportsType } from './asset-tools.js';
|
|
5
|
+
import { gitBlobShas } from './checksum.js';
|
|
6
|
+
import { errorGuidance, isRunWideFailure } from './errors.js';
|
|
7
|
+
import { identityKey } from './lockfile.js';
|
|
8
|
+
import { verifyOwnFiles } from './owned-paths.js';
|
|
9
|
+
import { findAsset, listAssetFiles } from './registry.js';
|
|
10
|
+
import { fromRoot } from './root-path.js';
|
|
11
|
+
/** The file listings {@link localEditsAmong} reads at once, newest version first. */
|
|
12
|
+
const LISTINGS_AT_ONCE = 4;
|
|
13
|
+
/** Each registry version's files, as git blob shas, read once per run. */
|
|
14
|
+
const publishedListings = new Map();
|
|
15
|
+
/**
|
|
16
|
+
* The placed files among `placed` whose check failed on content rather than a missing file: the
|
|
17
|
+
* candidates for a local edit. `failures` are {@link verifyOwnFiles}'s, with absolute paths.
|
|
18
|
+
*/
|
|
19
|
+
export function changedAmong(placed, failures, root) {
|
|
20
|
+
const changed = new Set(failures.filter((f) => !f.actual.startsWith('FILE_NOT_FOUND')).map((f) => f.path));
|
|
21
|
+
return placed.filter((f) => changed.has(fromRoot(root, f.installedPath)));
|
|
22
|
+
}
|
|
23
|
+
/** Forget the file listings {@link localEditsAmong} read (for tests). */
|
|
24
|
+
export function clearPublishedListings() {
|
|
25
|
+
publishedListings.clear();
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The files of `asset` the adapter's tool has on disk with content that no published version of it
|
|
29
|
+
* had (see {@link localEditsAmong}): edits a reinstall would overwrite, and placed asset
|
|
30
|
+
* directories are gitignored, so they can't be recovered. Paths are read where ATK placed the copy,
|
|
31
|
+
* also when the tool's user config directory moved since. Undefined when there are none.
|
|
32
|
+
*/
|
|
33
|
+
export async function editedFiles(asset, adapter, root, lockfile, registry) {
|
|
34
|
+
const placed = resolveInstalledPaths(asset, adapterAsPlaced(adapter, asset), root).files;
|
|
35
|
+
const files = placed.map((f) => ({ checksum: f.checksum, path: fromRoot(root, f.installedPath) }));
|
|
36
|
+
const changed = changedAmong(placed, await verifyOwnFiles(files, asset, lockfile, adapter, root), root);
|
|
37
|
+
return localEditsAmong(asset, changed, root, registry);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* The installed assets with local edits for any of `adapters`, keyed by {@link identityKey}: those
|
|
41
|
+
* `only` picks, when given (the assets a command can overwrite). A tool the asset was uninstalled
|
|
42
|
+
* for, or one with no placement for its type, has no copy to edit.
|
|
43
|
+
*/
|
|
44
|
+
export async function findLocalEdits(lockfile, adapters, root, registry, only) {
|
|
45
|
+
const found = new Map();
|
|
46
|
+
for (const asset of (lockfile.assets ?? []).filter((a) => !only || only(a))) {
|
|
47
|
+
for (const adapter of adapters) {
|
|
48
|
+
if (!supportsType(adapter, asset.type) || isExcludedForTool(asset, adapter.tool))
|
|
49
|
+
continue;
|
|
50
|
+
const edits = await editedFiles(asset, adapter, root, lockfile, registry);
|
|
51
|
+
if (!edits)
|
|
52
|
+
continue;
|
|
53
|
+
const known = found.get(identityKey(asset));
|
|
54
|
+
found.set(identityKey(asset), known
|
|
55
|
+
? {
|
|
56
|
+
...known,
|
|
57
|
+
files: [...new Set([...known.files, ...edits.files])],
|
|
58
|
+
...(edits.unchecked ? { unchecked: true } : {}),
|
|
59
|
+
}
|
|
60
|
+
: edits);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return found;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Whether an installed asset in `lockfile` declares `asset` as a dependency, so updating that one
|
|
67
|
+
* can replace or remove it. Dependency refs carry no org, so name and type decide.
|
|
68
|
+
*/
|
|
69
|
+
export function isDependedOn(lockfile, asset) {
|
|
70
|
+
return (lockfile.assets ?? []).some((a) => (a.dependencies ?? []).some((d) => d.name === asset.name && d.type === asset.type));
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Which of `changed`, placed files of `asset` whose content differs from the lockfile, are local
|
|
74
|
+
* edits: those holding content that no published version of the asset had. A file that matches a
|
|
75
|
+
* file of one (with either line ending, as checksums allow) is stale, not edited: the lockfile moved
|
|
76
|
+
* past it (a lockfile bump pulled from git, a copy of another version, a tool a multi-tool update
|
|
77
|
+
* left behind), so reinstalling loses nothing. Any file of the version counts, so an entrypoint
|
|
78
|
+
* renamed between versions still matches. The versions are read newest first, a few file listings
|
|
79
|
+
* at a time, until every file is matched. A listing that can't be read, or no registry, leaves its
|
|
80
|
+
* files as edits (`unchecked`). A failure no other request would get past (an expired sign-in, an
|
|
81
|
+
* outdated CLI) is thrown. Undefined when none is an edit.
|
|
82
|
+
*/
|
|
83
|
+
export async function localEditsAmong(asset, changed, root, registry) {
|
|
84
|
+
if (changed.length === 0)
|
|
85
|
+
return undefined;
|
|
86
|
+
let remaining = await Promise.all(changed.map(async (file) => ({
|
|
87
|
+
file,
|
|
88
|
+
shas: await readFile(fromRoot(root, file.installedPath)).then(gitBlobShas, () => undefined),
|
|
89
|
+
})));
|
|
90
|
+
let unchecked = !registry;
|
|
91
|
+
const versions = registry ? otherVersionsNewestFirst(registry, asset) : [];
|
|
92
|
+
for (let i = 0; i < versions.length && remaining.length > 0; i += LISTINGS_AT_ONCE) {
|
|
93
|
+
const listings = await Promise.allSettled(versions.slice(i, i + LISTINGS_AT_ONCE).map((version) => publishedListing(asset, version)));
|
|
94
|
+
for (const listing of listings) {
|
|
95
|
+
if (listing.status === 'rejected') {
|
|
96
|
+
if (isRunWide(listing.reason))
|
|
97
|
+
throw listing.reason;
|
|
98
|
+
unchecked = true;
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
remaining = remaining.filter(({ shas }) => !shas?.some((sha) => listing.value.has(sha)));
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
if (remaining.length === 0)
|
|
105
|
+
return undefined;
|
|
106
|
+
const { name, org, type } = asset;
|
|
107
|
+
return {
|
|
108
|
+
files: remaining.map(({ file }) => file.installedPath),
|
|
109
|
+
name,
|
|
110
|
+
...(org ? { org } : {}),
|
|
111
|
+
type,
|
|
112
|
+
...(unchecked ? { unchecked: true } : {}),
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
/** A failure every other request of the run would hit too: an expired sign-in, an outdated CLI. */
|
|
116
|
+
function isRunWide(error) {
|
|
117
|
+
// The sign-in's AuthError, by name: checking files doesn't depend on auth.js.
|
|
118
|
+
return (error instanceof Error && error.name === 'AuthError') || isRunWideFailure(errorGuidance(error));
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* The registry's versions of `asset`, in its own scope, other than the locked one (whose content
|
|
122
|
+
* the lockfile's checksums are), newest first.
|
|
123
|
+
*/
|
|
124
|
+
function otherVersionsNewestFirst(registry, asset) {
|
|
125
|
+
const found = findAsset(registry, asset.name, asset.type, undefined, asset.org);
|
|
126
|
+
if (!found || found.asset.org !== asset.org)
|
|
127
|
+
return [];
|
|
128
|
+
const versions = Object.keys(found.asset.versions).filter((v) => v !== asset.version);
|
|
129
|
+
return [...versions.filter((v) => valid(v)).sort(rcompare), ...versions.filter((v) => !valid(v))];
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* The git blob shas of the files in one version of `asset`. A listing that fails is not kept, so a
|
|
133
|
+
* later check (the list view's next update) asks again.
|
|
134
|
+
*/
|
|
135
|
+
function publishedListing(asset, version) {
|
|
136
|
+
const key = `${identityKey(asset)}@${version}`;
|
|
137
|
+
let listing = publishedListings.get(key);
|
|
138
|
+
if (!listing) {
|
|
139
|
+
listing = listAssetFiles(asset, version).then((files) => new Set(files.map((f) => f.sha)));
|
|
140
|
+
listing.catch(() => publishedListings.delete(key));
|
|
141
|
+
publishedListings.set(key, listing);
|
|
142
|
+
}
|
|
143
|
+
return listing;
|
|
144
|
+
}
|
|
145
|
+
//# sourceMappingURL=local-edits.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-edits.js","sourceRoot":"","sources":["../../src/lib/local-edits.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAMzC,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAwB1C,qFAAqF;AACrF,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAE3B,0EAA0E;AAC1E,MAAM,iBAAiB,GAAG,IAAI,GAAG,EAAgC,CAAC;AAElE;;;GAGG;AACH,MAAM,UAAU,YAAY,CAC1B,MAAW,EACX,QAAiD,EACjD,IAAY;IAEZ,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,M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AAC,CAAC;QAC3F,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,iBAAiB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;QACnD,iBAAiB,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IACtC,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/build/lib/lockfile.d.ts
CHANGED
|
@@ -4,9 +4,11 @@ import { type InstalledAsset, type Lockfile } from './schemas/lockfile.js';
|
|
|
4
4
|
export interface AcquireLockOptions {
|
|
5
5
|
/** Maximum time (ms) to wait to acquire the lock. Default: 30 000. */
|
|
6
6
|
acquireTimeout?: number;
|
|
7
|
+
/** Interval (ms) at which the holder refreshes the lock. Default: 10 000. */
|
|
8
|
+
refreshInterval?: number;
|
|
7
9
|
/** Interval (ms) between retry attempts. Default: 200. */
|
|
8
10
|
retryInterval?: number;
|
|
9
|
-
/** Time (ms) after which a held lock is considered stale. Default: 60 000. */
|
|
11
|
+
/** Time (ms) without a refresh after which a held lock is considered stale. Default: 60 000. */
|
|
10
12
|
staleTimeout?: number;
|
|
11
13
|
}
|
|
12
14
|
/** What identifies an installed asset in the lockfile. */
|
|
@@ -47,14 +49,14 @@ export type DependencyChainResult = {
|
|
|
47
49
|
} | {
|
|
48
50
|
name: string;
|
|
49
51
|
org?: string;
|
|
50
|
-
status: '
|
|
52
|
+
status: 'not-installed';
|
|
51
53
|
};
|
|
52
54
|
export declare class LockfileError extends GuidedError {
|
|
53
55
|
name: string;
|
|
54
56
|
}
|
|
55
57
|
export declare class LockfileLockedError extends GuidedError {
|
|
56
58
|
name: string;
|
|
57
|
-
constructor(pid: number, sentinelPath: string, options?: GuidedErrorOptions);
|
|
59
|
+
constructor(pid: number | undefined, sentinelPath: string, options?: GuidedErrorOptions);
|
|
58
60
|
}
|
|
59
61
|
/** What the user sees in place of a {@link LockfileLockedError}'s PID and sentinel path. */
|
|
60
62
|
export declare const LOCKFILE_LOCKED_MESSAGE = "Another ATK process is currently modifying this project. Please wait and try again.";
|
|
@@ -62,10 +64,12 @@ export declare const LOCKFILE_LOCKED_MESSAGE = "Another ATK process is currently
|
|
|
62
64
|
* Acquire an advisory lock on the lockfile.
|
|
63
65
|
*
|
|
64
66
|
* Creates a sentinel file (`.atk-lock.json.lock`) atomically using the `'wx'`
|
|
65
|
-
* flag
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
67
|
+
* flag, then refreshes its mtime every `refreshInterval` ms until
|
|
68
|
+
* {@link releaseLockfileLock}. If the sentinel already exists the function will:
|
|
69
|
+
* 1. Read the sentinel's holding PID and its mtime (the holder's last refresh).
|
|
70
|
+
* 2. If the holding PID is dead **or** the holder hasn't refreshed it for `staleTimeout`
|
|
71
|
+
* (the only test when nobody can read it), remove the stale sentinel under a guard
|
|
72
|
+
* file and retry immediately.
|
|
69
73
|
* 3. Otherwise wait `retryInterval` ms and retry, up to `acquireTimeout` ms total.
|
|
70
74
|
*
|
|
71
75
|
* @throws {LockfileLockedError} if the lock cannot be acquired within the timeout.
|
|
@@ -209,7 +213,7 @@ export declare function setOrgReviewers(lockfile: Lockfile, usernames: string[])
|
|
|
209
213
|
* Returns a discriminated union indicating whether the asset is:
|
|
210
214
|
* - `direct`: explicitly installed by the user
|
|
211
215
|
* - `dependency`: pulled in as a dependency, with chain(s) to direct root(s)
|
|
212
|
-
* - `
|
|
216
|
+
* - `not-installed`: not found in the lockfile
|
|
213
217
|
* - `orphaned`: installed as a dependency but no path to a direct root exists
|
|
214
218
|
*/
|
|
215
219
|
export declare function traceDependencyChain(lockfile: Lockfile, assetName: string, assetType?: AssetType, assetOrg?: string): DependencyChainResult;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lockfile.d.ts","sourceRoot":"","sources":["../../src/lib/lockfile.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAGpD,OAAO,EAAE,WAAW,EAAE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