@memberjunction/cli 6.1.0-edge.1 → 6.1.0-edge.3
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 +180 -4
- package/README.md +1 -1
- package/dist/commands/artifacts/reclassify.d.ts.map +1 -1
- package/dist/commands/artifacts/reclassify.js +2 -1
- package/dist/commands/artifacts/reclassify.js.map +1 -1
- package/dist/commands/codegen/manifest.d.ts +14 -0
- package/dist/commands/codegen/manifest.d.ts.map +1 -1
- package/dist/commands/codegen/manifest.js +26 -7
- package/dist/commands/codegen/manifest.js.map +1 -1
- package/dist/commands/dev/index.d.ts +7 -0
- package/dist/commands/dev/index.d.ts.map +1 -0
- package/dist/commands/dev/index.js +11 -0
- package/dist/commands/dev/index.js.map +1 -0
- package/dist/commands/dev/usage.d.ts +7 -0
- package/dist/commands/dev/usage.d.ts.map +1 -0
- package/dist/commands/dev/usage.js +10 -0
- package/dist/commands/dev/usage.js.map +1 -0
- package/dist/commands/dev/workspace/clean.d.ts +27 -0
- package/dist/commands/dev/workspace/clean.d.ts.map +1 -0
- package/dist/commands/dev/workspace/clean.js +87 -0
- package/dist/commands/dev/workspace/clean.js.map +1 -0
- package/dist/commands/dev/workspace/doctor.d.ts +28 -0
- package/dist/commands/dev/workspace/doctor.d.ts.map +1 -0
- package/dist/commands/dev/workspace/doctor.js +62 -0
- package/dist/commands/dev/workspace/doctor.js.map +1 -0
- package/dist/commands/dev/workspace/index.d.ts +60 -0
- package/dist/commands/dev/workspace/index.d.ts.map +1 -0
- package/dist/commands/dev/workspace/index.js +279 -0
- package/dist/commands/dev/workspace/index.js.map +1 -0
- package/dist/commands/dev/workspace/status.d.ts +19 -0
- package/dist/commands/dev/workspace/status.d.ts.map +1 -0
- package/dist/commands/dev/workspace/status.js +46 -0
- package/dist/commands/dev/workspace/status.js.map +1 -0
- package/dist/lib/cli-plugins.d.ts.map +1 -1
- package/dist/lib/cli-plugins.js +5 -0
- package/dist/lib/cli-plugins.js.map +1 -1
- package/dist/lib/dev-workspace/build.d.ts +180 -0
- package/dist/lib/dev-workspace/build.d.ts.map +1 -0
- package/dist/lib/dev-workspace/build.js +570 -0
- package/dist/lib/dev-workspace/build.js.map +1 -0
- package/dist/lib/dev-workspace/clean.d.ts +40 -0
- package/dist/lib/dev-workspace/clean.d.ts.map +1 -0
- package/dist/lib/dev-workspace/clean.js +193 -0
- package/dist/lib/dev-workspace/clean.js.map +1 -0
- package/dist/lib/dev-workspace/detect.d.ts +56 -0
- package/dist/lib/dev-workspace/detect.d.ts.map +1 -0
- package/dist/lib/dev-workspace/detect.js +343 -0
- package/dist/lib/dev-workspace/detect.js.map +1 -0
- package/dist/lib/dev-workspace/dir-flag.d.ts +23 -0
- package/dist/lib/dev-workspace/dir-flag.d.ts.map +1 -0
- package/dist/lib/dev-workspace/dir-flag.js +24 -0
- package/dist/lib/dev-workspace/dir-flag.js.map +1 -0
- package/dist/lib/dev-workspace/doctor.d.ts +96 -0
- package/dist/lib/dev-workspace/doctor.d.ts.map +1 -0
- package/dist/lib/dev-workspace/doctor.js +400 -0
- package/dist/lib/dev-workspace/doctor.js.map +1 -0
- package/dist/lib/dev-workspace/lockfile.d.ts +62 -0
- package/dist/lib/dev-workspace/lockfile.d.ts.map +1 -0
- package/dist/lib/dev-workspace/lockfile.js +456 -0
- package/dist/lib/dev-workspace/lockfile.js.map +1 -0
- package/dist/lib/dev-workspace/member-installs.d.ts +35 -0
- package/dist/lib/dev-workspace/member-installs.d.ts.map +1 -0
- package/dist/lib/dev-workspace/member-installs.js +139 -0
- package/dist/lib/dev-workspace/member-installs.js.map +1 -0
- package/dist/lib/dev-workspace/pnpm.d.ts +29 -0
- package/dist/lib/dev-workspace/pnpm.d.ts.map +1 -0
- package/dist/lib/dev-workspace/pnpm.js +59 -0
- package/dist/lib/dev-workspace/pnpm.js.map +1 -0
- package/dist/lib/dev-workspace/status.d.ts +16 -0
- package/dist/lib/dev-workspace/status.d.ts.map +1 -0
- package/dist/lib/dev-workspace/status.js +185 -0
- package/dist/lib/dev-workspace/status.js.map +1 -0
- package/dist/lib/dev-workspace/types.d.ts +312 -0
- package/dist/lib/dev-workspace/types.d.ts.map +1 -0
- package/dist/lib/dev-workspace/types.js +14 -0
- package/dist/lib/dev-workspace/types.js.map +1 -0
- package/dist/lib/dev-workspace/usage.d.ts +30 -0
- package/dist/lib/dev-workspace/usage.d.ts.map +1 -0
- package/dist/lib/dev-workspace/usage.js +177 -0
- package/dist/lib/dev-workspace/usage.js.map +1 -0
- package/dist/lib/dev-workspace/write.d.ts +25 -0
- package/dist/lib/dev-workspace/write.d.ts.map +1 -0
- package/dist/lib/dev-workspace/write.js +75 -0
- package/dist/lib/dev-workspace/write.js.map +1 -0
- package/dist/light-commands.d.ts.map +1 -1
- package/dist/light-commands.js +7 -0
- package/dist/light-commands.js.map +1 -1
- package/dist/utils/open-app-context.js +1 -1
- package/dist/utils/open-app-context.js.map +1 -1
- package/oclif.manifest.json +3432 -3173
- package/package.json +22 -22
|
@@ -0,0 +1,570 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure content builders for the four generated workspace files.
|
|
3
|
+
*
|
|
4
|
+
* NO SIDE EFFECTS in this module: every function maps member metadata (already
|
|
5
|
+
* loaded by `detect.ts`) to file content strings. Writing is `write.ts`'s job.
|
|
6
|
+
*
|
|
7
|
+
* Content rules reproduce the manual setup this command replaces — each one was
|
|
8
|
+
* proven by joining these repos by hand before any of it was automated:
|
|
9
|
+
* - pnpm-workspace.yaml: `linkWorkspacePackages: true`, the 16-name build-scripts
|
|
10
|
+
* allowlist, and per member the repo root plus the member's OWN packages-rooted
|
|
11
|
+
* workspace globs re-prefixed with its directory name (producer packages only —
|
|
12
|
+
* `apps/*` globs collide because every repo names its apps `mj_api`/`mj_explorer`,
|
|
13
|
+
* so detection filters them out before they reach this module). A member with no
|
|
14
|
+
* workspace file of its own contributes the proven `packages/*` default; the MJ
|
|
15
|
+
* monorepo contributes its 42 nested globs (#3795).
|
|
16
|
+
* - .npmrc: exactly three settings lines. There is deliberately no
|
|
17
|
+
* `public-hoist-pattern[]` block — see "Why no hoist block" below.
|
|
18
|
+
* - package.json: private root manifest, pnpm `packageManager` pin, the
|
|
19
|
+
* devDependency union of member roots (highest version wins, every conflict
|
|
20
|
+
* reported), and the proven peerDependencyRules bridge block.
|
|
21
|
+
* - turbo.json: copied verbatim from a member, with a minimal fallback.
|
|
22
|
+
*
|
|
23
|
+
* Why no hoist block: the 78-entry `public-hoist-pattern[]` set the manual setup
|
|
24
|
+
* carried was written for the npm-hoisted era, when a library could import a
|
|
25
|
+
* package it never declared and hoisting silently covered for it. An attribution
|
|
26
|
+
* audit of all 78 entries against the MJ monorepo (2026-08-13) found no entry that
|
|
27
|
+
* still needs hoisting: every package an MJ library imports is declared by it, and
|
|
28
|
+
* every third-party peer relationship in the set (`@foblex/flow`'s siblings,
|
|
29
|
+
* `rete-*-plugin` -> `rete`, `marked-*` -> `marked`, `date-fns-tz` -> `date-fns`,
|
|
30
|
+
* `ajv-formats` -> `ajv`, radix/expo -> `react`) is satisfied by a real
|
|
31
|
+
* declaration. pnpm's strict layout is what forced that: a package that imports
|
|
32
|
+
* what it does not declare fails to resolve rather than falling through to a
|
|
33
|
+
* hoisted copy, so the pnpm conversion had to fix them all.
|
|
34
|
+
*
|
|
35
|
+
* The one residual class is genuinely the shell's own choice rather than a layout
|
|
36
|
+
* problem — see {@link SHELL_PROVIDED_PEERS}.
|
|
37
|
+
*
|
|
38
|
+
* @module lib/dev-workspace/build
|
|
39
|
+
*/
|
|
40
|
+
import { DeriveLockfilePins } from './lockfile.js';
|
|
41
|
+
/** Build-scripts allowlist proven on the core-monorepo spike. */
|
|
42
|
+
export const ONLY_BUILT_DEPENDENCIES = [
|
|
43
|
+
'@apollo/protobufjs',
|
|
44
|
+
'@google/genai',
|
|
45
|
+
'@parcel/watcher',
|
|
46
|
+
'@zoom/rtms',
|
|
47
|
+
'browser-tabs-lock',
|
|
48
|
+
'core-js',
|
|
49
|
+
'core-js-pure',
|
|
50
|
+
'esbuild',
|
|
51
|
+
'isolated-vm',
|
|
52
|
+
'lmdb',
|
|
53
|
+
'msgpackr-extract',
|
|
54
|
+
'oracledb',
|
|
55
|
+
'protobufjs',
|
|
56
|
+
'rete',
|
|
57
|
+
'sharp',
|
|
58
|
+
'tesseract.js',
|
|
59
|
+
];
|
|
60
|
+
/** The three .npmrc settings lines — strict peers has been the standard since 2026-08-07. */
|
|
61
|
+
export const NPMRC_BASE_LINES = [
|
|
62
|
+
'package-manager-strict=false',
|
|
63
|
+
'strict-peer-dependencies=true',
|
|
64
|
+
'auto-install-peers=true',
|
|
65
|
+
];
|
|
66
|
+
/**
|
|
67
|
+
* Packages an MJ library declares as a `peerDependency` because the choice belongs
|
|
68
|
+
* to the app shell, not the library — the auth SDK family especially, where a shell
|
|
69
|
+
* picks exactly one provider out of five. These are NOT a layout problem and no
|
|
70
|
+
* pnpm setting fixes them: a shell that serves one of these features declares the
|
|
71
|
+
* package in its own `package.json`, the same as any other direct dependency.
|
|
72
|
+
*
|
|
73
|
+
* Kept here (rather than as prose) so the command's guidance text has one source of
|
|
74
|
+
* truth. Grouped by the MJ package whose peer declaration creates the requirement.
|
|
75
|
+
*/
|
|
76
|
+
export const SHELL_PROVIDED_PEERS = [
|
|
77
|
+
{
|
|
78
|
+
Library: '@memberjunction/ng-auth-services',
|
|
79
|
+
Peers: [
|
|
80
|
+
'@auth0/auth0-angular',
|
|
81
|
+
'@azure/msal-angular',
|
|
82
|
+
'@azure/msal-browser',
|
|
83
|
+
'@azure/msal-common',
|
|
84
|
+
'@okta/okta-auth-js',
|
|
85
|
+
'@workos-inc/authkit-js',
|
|
86
|
+
'aws-amplify',
|
|
87
|
+
],
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
Library: '@memberjunction/ng-explorer-service-worker',
|
|
91
|
+
Peers: ['@angular/service-worker'],
|
|
92
|
+
},
|
|
93
|
+
];
|
|
94
|
+
/**
|
|
95
|
+
* Peer bridge baseline for older published MJ copies still in the tree.
|
|
96
|
+
*
|
|
97
|
+
* Verified 2026-08-13 against the MJ monorepo root: the five `allowedVersions`
|
|
98
|
+
* rules match MJ's own `pnpm.peerDependencyRules` exactly; `ignoreMissing:
|
|
99
|
+
* ['axios']` is generator-only, for older published MJ copies a parent may still
|
|
100
|
+
* resolve. The baseline stays hardcoded (rather than read from MJ) because a
|
|
101
|
+
* parent whose members declare no rules still needs the proven bridge — and any
|
|
102
|
+
* member-declared `peerDependencyRules` are UNIONED ON TOP of it by
|
|
103
|
+
* {@link ResolveMemberPnpmBlocks}, so MJ's rules can evolve without a generator
|
|
104
|
+
* release as long as MJ is a member.
|
|
105
|
+
*/
|
|
106
|
+
export const PEER_DEPENDENCY_RULES = {
|
|
107
|
+
allowedVersions: {
|
|
108
|
+
'nunjucks>chokidar': '5',
|
|
109
|
+
'@modelcontextprotocol/sdk>zod': '^3.24',
|
|
110
|
+
'zod-to-json-schema>zod': '^3.24',
|
|
111
|
+
'openai>zod': '^3.24',
|
|
112
|
+
'@anthropic-ai/sdk>zod': '^3.24',
|
|
113
|
+
},
|
|
114
|
+
ignoreMissing: ['axios'],
|
|
115
|
+
};
|
|
116
|
+
/** Used only when no member pins pnpm — the proven pin (== the MJ monorepo's pin today). */
|
|
117
|
+
export const FALLBACK_PNPM_PIN = 'pnpm@10.33.0';
|
|
118
|
+
/** The proven root-manifest devDependency baseline; fills gaps the union leaves. */
|
|
119
|
+
export const BASELINE_DEV_DEPENDENCIES = {
|
|
120
|
+
turbo: '^2.5.0',
|
|
121
|
+
'tsc-alias': '^1.8.16',
|
|
122
|
+
};
|
|
123
|
+
/** Minimal parent turbo.json used only when no member carries one. */
|
|
124
|
+
const FALLBACK_TURBO_JSON = `${JSON.stringify({
|
|
125
|
+
$schema: 'https://turbo.build/schema.json',
|
|
126
|
+
tasks: { build: { dependsOn: ['^build'], outputs: ['dist/**', 'build/**'] } },
|
|
127
|
+
}, null, 2)}\n`;
|
|
128
|
+
const GENERATED_HEADER = 'Generated by `mj dev workspace` — never commit to any repo; teardown = delete.';
|
|
129
|
+
/** Quotes a YAML list entry the proven way: scoped names quoted, bare names not. */
|
|
130
|
+
function yamlListEntry(name) {
|
|
131
|
+
return name.startsWith('@') ? ` - '${name}'` : ` - ${name}`;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* One member's glob lines: the repo root plus each of its workspace globs
|
|
135
|
+
* re-prefixed with its directory name (negations keep the `!` outside the prefix,
|
|
136
|
+
* as pnpm requires). Preconditions — enforced, since violating them silently
|
|
137
|
+
* drops packages from the workspace or admits colliding app shells (#3795): the
|
|
138
|
+
* member has at least one glob, and every POSITIVE glob is packages-rooted.
|
|
139
|
+
* Negations are exempt (a `!**\/dist\/**` guard survives verbatim): they only
|
|
140
|
+
* subtract, so re-prefixing one can never admit anything.
|
|
141
|
+
*/
|
|
142
|
+
function memberGlobLines(member) {
|
|
143
|
+
if (member.WorkspaceGlobs.length === 0) {
|
|
144
|
+
throw new Error(`Member ${member.Name} has no workspace globs — detection must supply at least the packages/* default`);
|
|
145
|
+
}
|
|
146
|
+
const lines = [` - '${member.Name}'`];
|
|
147
|
+
for (const glob of member.WorkspaceGlobs) {
|
|
148
|
+
const negated = glob.startsWith('!');
|
|
149
|
+
const body = negated ? glob.slice(1) : glob;
|
|
150
|
+
if (!negated && !body.startsWith('packages/')) {
|
|
151
|
+
throw new Error(`Member ${member.Name} glob '${glob}' is not rooted under packages/ — detection must filter app-shell globs out`);
|
|
152
|
+
}
|
|
153
|
+
lines.push(negated ? ` - '!${member.Name}/${body}'` : ` - '${member.Name}/${glob}'`);
|
|
154
|
+
}
|
|
155
|
+
return lines;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Builds `pnpm-workspace.yaml`: per member (sorted by name) the repo root plus the
|
|
159
|
+
* member's own packages-rooted workspace globs re-prefixed with its directory name.
|
|
160
|
+
* Producer packages only — never `apps/*` (app-shell names collide across repos).
|
|
161
|
+
*/
|
|
162
|
+
export function BuildWorkspaceYaml(members) {
|
|
163
|
+
if (members.length === 0) {
|
|
164
|
+
throw new Error('BuildWorkspaceYaml requires at least one member repo');
|
|
165
|
+
}
|
|
166
|
+
const lines = [`# ${GENERATED_HEADER}`, 'linkWorkspacePackages: true', ''];
|
|
167
|
+
lines.push('onlyBuiltDependencies:');
|
|
168
|
+
for (const dep of ONLY_BUILT_DEPENDENCIES) {
|
|
169
|
+
lines.push(yamlListEntry(dep));
|
|
170
|
+
}
|
|
171
|
+
lines.push('', 'packages:');
|
|
172
|
+
// Plain codepoint order (what Array.prototype.sort did on the old name list) —
|
|
173
|
+
// keeps regenerated output byte-identical for pre-existing workspaces.
|
|
174
|
+
for (const member of [...members].sort((a, b) => (a.Name < b.Name ? -1 : a.Name > b.Name ? 1 : 0))) {
|
|
175
|
+
lines.push(...memberGlobLines(member));
|
|
176
|
+
}
|
|
177
|
+
return `${lines.join('\n')}\n`;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Renders the shell-dependency guidance the command prints — the replacement for
|
|
181
|
+
* the deleted hoist block. Derived from {@link SHELL_PROVIDED_PEERS} so the advice
|
|
182
|
+
* and the data cannot drift apart.
|
|
183
|
+
*/
|
|
184
|
+
export function BuildShellPeerGuidance() {
|
|
185
|
+
const lines = ['Serving an app shell from inside the workspace? Declare its own runtime picks in the shell\'s package.json:'];
|
|
186
|
+
for (const { Library, Peers } of SHELL_PROVIDED_PEERS) {
|
|
187
|
+
lines.push(` ${Library} peers -> ${Peers.join(', ')}`);
|
|
188
|
+
}
|
|
189
|
+
lines.push(' (only the ones your shell actually uses — these are choices, not a layout fix)');
|
|
190
|
+
return lines;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Builds `.npmrc`: exactly the three proven settings lines.
|
|
194
|
+
*
|
|
195
|
+
* No `public-hoist-pattern[]` block by design — see the "Why no hoist block" note
|
|
196
|
+
* at the top of this module.
|
|
197
|
+
*/
|
|
198
|
+
export function BuildNpmrc() {
|
|
199
|
+
return `${[`# ${GENERATED_HEADER}`, ...NPMRC_BASE_LINES].join('\n')}\n`;
|
|
200
|
+
}
|
|
201
|
+
/** Parses the leading numeric triple out of a version/range string, or null. */
|
|
202
|
+
function parseVersionTriple(version) {
|
|
203
|
+
const match = /^[\^~>=<\s v]*(\d+)\.(\d+)\.(\d+)/.exec(version.trim());
|
|
204
|
+
if (!match)
|
|
205
|
+
return null;
|
|
206
|
+
return [Number(match[1]), Number(match[2]), Number(match[3])];
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Compares two version/range strings by their base numeric triple.
|
|
210
|
+
* Returns >0 when `a` is higher, <0 when `b` is higher, 0 on a tie or when
|
|
211
|
+
* either side has no parseable triple (caller keeps the incumbent and reports).
|
|
212
|
+
*/
|
|
213
|
+
export function CompareVersionStrings(a, b) {
|
|
214
|
+
const ta = parseVersionTriple(a);
|
|
215
|
+
const tb = parseVersionTriple(b);
|
|
216
|
+
if (ta === null || tb === null)
|
|
217
|
+
return 0;
|
|
218
|
+
for (let i = 0; i < 3; i++) {
|
|
219
|
+
if (ta[i] !== tb[i])
|
|
220
|
+
return ta[i] - tb[i];
|
|
221
|
+
}
|
|
222
|
+
return 0;
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Classifies one member devDep for the union: kept as-is, rewritten to
|
|
226
|
+
* `workspace:*` (member-provided names — local source beats registry pins), or
|
|
227
|
+
* dropped (`@types/*`; `workspace:` on a package no member provides).
|
|
228
|
+
*/
|
|
229
|
+
function classifyDevDep(name, version, repo, familyNames, result) {
|
|
230
|
+
if (name.startsWith('@types/')) {
|
|
231
|
+
if (!result.SkippedTypes.includes(name))
|
|
232
|
+
result.SkippedTypes.push(name);
|
|
233
|
+
return null; // the field's @types/mssql 9.1.8+9.1.11 nominal-type break — never union @types
|
|
234
|
+
}
|
|
235
|
+
if (familyNames.has(name)) {
|
|
236
|
+
return { Repo: `workspace member (declared by ${repo})`, Version: 'workspace:*' };
|
|
237
|
+
}
|
|
238
|
+
if (version.startsWith('workspace:')) {
|
|
239
|
+
result.DroppedWorkspace.push({ Package: name, Repo: repo });
|
|
240
|
+
return null; // meaningless at the parent when nothing provides the package
|
|
241
|
+
}
|
|
242
|
+
return { Repo: repo, Version: version };
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Unions every member repo's root devDependencies. Conflict rule: highest base
|
|
246
|
+
* version wins; ties keep the first seen. EVERY conflict, skip, and drop is
|
|
247
|
+
* returned so the command can log it — the resolver never decides silently.
|
|
248
|
+
* `familyNames` = package names provided by workspace members; those become
|
|
249
|
+
* `workspace:*` (local ALWAYS beats a registry pin — field finding on #3795).
|
|
250
|
+
*/
|
|
251
|
+
export function ResolveDevDependencyUnion(members, familyNames = new Set()) {
|
|
252
|
+
const chosen = new Map();
|
|
253
|
+
const conflicts = new Map();
|
|
254
|
+
const result = { SkippedTypes: [], DroppedWorkspace: [] };
|
|
255
|
+
for (const member of [...members].sort((a, b) => a.Name.localeCompare(b.Name))) {
|
|
256
|
+
for (const [name, version] of Object.entries(member.RootPackageJson.devDependencies ?? {})) {
|
|
257
|
+
const candidate = classifyDevDep(name, version, member.Name, familyNames, result);
|
|
258
|
+
if (candidate !== null)
|
|
259
|
+
recordDevDep(chosen, conflicts, name, candidate);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
for (const [name, version] of Object.entries(BASELINE_DEV_DEPENDENCIES)) {
|
|
263
|
+
if (!chosen.has(name))
|
|
264
|
+
chosen.set(name, { Repo: 'generator baseline', Version: version });
|
|
265
|
+
}
|
|
266
|
+
const union = {};
|
|
267
|
+
for (const name of [...chosen.keys()].sort()) {
|
|
268
|
+
union[name] = chosen.get(name).Version;
|
|
269
|
+
}
|
|
270
|
+
return { DevDependencies: union, Conflicts: [...conflicts.values()], ...result };
|
|
271
|
+
}
|
|
272
|
+
/** Applies one member's devDep declaration to the union, recording any conflict. */
|
|
273
|
+
function recordDevDep(chosen, conflicts, name, candidate) {
|
|
274
|
+
const incumbent = chosen.get(name);
|
|
275
|
+
if (!incumbent) {
|
|
276
|
+
chosen.set(name, candidate);
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
if (incumbent.Version === candidate.Version)
|
|
280
|
+
return;
|
|
281
|
+
const winner = CompareVersionStrings(candidate.Version, incumbent.Version) > 0 ? candidate : incumbent;
|
|
282
|
+
const loser = winner === candidate ? incumbent : candidate;
|
|
283
|
+
chosen.set(name, winner);
|
|
284
|
+
const existing = conflicts.get(name);
|
|
285
|
+
if (existing) {
|
|
286
|
+
existing.Winner = winner;
|
|
287
|
+
existing.Losers.push(loser);
|
|
288
|
+
}
|
|
289
|
+
else {
|
|
290
|
+
conflicts.set(name, { Package: name, Winner: winner, Losers: [loser] });
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Resolves the pnpm `packageManager` pin for the parent manifest: the highest
|
|
295
|
+
* pnpm pin any member carries (the MJ monorepo pins pnpm, so with MJ as a member
|
|
296
|
+
* this matches the MJ repo's pin); otherwise the proven fallback pin.
|
|
297
|
+
*/
|
|
298
|
+
export function ResolvePnpmPin(members) {
|
|
299
|
+
let best = null;
|
|
300
|
+
for (const member of [...members].sort((a, b) => a.Name.localeCompare(b.Name))) {
|
|
301
|
+
const pin = member.RootPackageJson.packageManager;
|
|
302
|
+
if (!pin || !pin.startsWith('pnpm@'))
|
|
303
|
+
continue;
|
|
304
|
+
if (best === null || CompareVersionStrings(pin.slice('pnpm@'.length), best.Pin.slice('pnpm@'.length)) > 0) {
|
|
305
|
+
best = { Pin: pin, Source: member.Name };
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
return best ?? { Pin: FALLBACK_PNPM_PIN, Source: 'generator fallback (proven pin)' };
|
|
309
|
+
}
|
|
310
|
+
/** npm-safe workspace name derived from the parent directory basename. */
|
|
311
|
+
function workspaceName(parentDirName) {
|
|
312
|
+
const cleaned = parentDirName.toLowerCase().replace(/[^a-z0-9-]+/g, '-').replace(/^-+|-+$/g, '');
|
|
313
|
+
return `${cleaned.length > 0 ? cleaned : 'mj'}-dev-workspace`;
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* Collects every package name the workspace members provide, from the members'
|
|
317
|
+
* OWN package enumerations. These names get `workspace:*` overrides in the
|
|
318
|
+
* parent manifest so local source ALWAYS beats registry copies — the field
|
|
319
|
+
* measured 1,898 registry shadow copies of family packages before forcing local
|
|
320
|
+
* with 367 `workspace:*` overrides (#3795 addendum). Duplicate providers are
|
|
321
|
+
* returned for loud reporting: the link target for a duplicated name is decided
|
|
322
|
+
* by sort order, silently.
|
|
323
|
+
*/
|
|
324
|
+
export function CollectFamilyPackages(members) {
|
|
325
|
+
const providers = new Map();
|
|
326
|
+
for (const member of [...members].sort((a, b) => (a.Name < b.Name ? -1 : a.Name > b.Name ? 1 : 0))) {
|
|
327
|
+
for (const pkg of member.Packages) {
|
|
328
|
+
const name = pkg.PackageJson.name;
|
|
329
|
+
if (name === undefined || name.length === 0)
|
|
330
|
+
continue;
|
|
331
|
+
const repos = providers.get(name) ?? new Set();
|
|
332
|
+
repos.add(member.Name);
|
|
333
|
+
providers.set(name, repos);
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
const duplicates = [];
|
|
337
|
+
for (const [name, repos] of providers) {
|
|
338
|
+
if (repos.size > 1)
|
|
339
|
+
duplicates.push({ Package: name, Repos: [...repos].sort() });
|
|
340
|
+
}
|
|
341
|
+
return { Names: [...providers.keys()].sort(), Duplicates: duplicates.sort((a, b) => (a.Package < b.Package ? -1 : 1)) };
|
|
342
|
+
}
|
|
343
|
+
/** Records a first-member-wins value, reporting any differing later declaration as a conflict. */
|
|
344
|
+
function recordFirstWins(chosen, conflicts, key, candidate) {
|
|
345
|
+
const incumbent = chosen.get(key);
|
|
346
|
+
if (!incumbent) {
|
|
347
|
+
chosen.set(key, candidate);
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
if (incumbent.Version === candidate.Version)
|
|
351
|
+
return;
|
|
352
|
+
const existing = conflicts.get(key);
|
|
353
|
+
if (existing) {
|
|
354
|
+
existing.Losers.push(candidate);
|
|
355
|
+
}
|
|
356
|
+
else {
|
|
357
|
+
conflicts.set(key, { Package: key, Winner: incumbent, Losers: [candidate] });
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
/** Sorted shallow copy of a record by key (codepoint order — deterministic across locales). */
|
|
361
|
+
function sortedRecord(record) {
|
|
362
|
+
const sorted = {};
|
|
363
|
+
for (const key of Object.keys(record).sort())
|
|
364
|
+
sorted[key] = record[key];
|
|
365
|
+
return sorted;
|
|
366
|
+
}
|
|
367
|
+
/**
|
|
368
|
+
* Hoists every member's `pnpm` block into one parent-manifest block. pnpm honors
|
|
369
|
+
* NONE of these at a member (finding 2 on #3795: the field workspace ran
|
|
370
|
+
* unpatched type-graphql and lost MJ's 26 pins until this was done by hand).
|
|
371
|
+
* Rules, all deterministic over codepoint-sorted member names:
|
|
372
|
+
* - overrides: higher base version wins where comparable, first member wins
|
|
373
|
+
* otherwise (npm-alias values never parse) — every conflict reported;
|
|
374
|
+
* - patchedDependencies: paths re-rooted to `<member>/<path>`; first member
|
|
375
|
+
* wins a same-key conflict (two patches cannot merge) — reported;
|
|
376
|
+
* - packageExtensions: first member wins a differing same-key block — reported;
|
|
377
|
+
* - peerDependencyRules: allowedVersions first-wins with conflicts reported,
|
|
378
|
+
* ignoreMissing set-unioned.
|
|
379
|
+
*/
|
|
380
|
+
export function ResolveMemberPnpmBlocks(members) {
|
|
381
|
+
const overrides = new Map();
|
|
382
|
+
const patches = new Map();
|
|
383
|
+
const extensionMeta = new Map();
|
|
384
|
+
const extensionValues = new Map();
|
|
385
|
+
const peerAllowed = new Map();
|
|
386
|
+
const conflicts = new Map();
|
|
387
|
+
const ignoreMissing = new Set();
|
|
388
|
+
for (const member of [...members].sort((a, b) => (a.Name < b.Name ? -1 : a.Name > b.Name ? 1 : 0))) {
|
|
389
|
+
const block = member.RootPackageJson.pnpm ?? {};
|
|
390
|
+
for (const [name, version] of Object.entries(block.overrides ?? {})) {
|
|
391
|
+
recordDevDep(overrides, conflicts, name, { Repo: member.Name, Version: version });
|
|
392
|
+
}
|
|
393
|
+
for (const [pkg, patchPath] of Object.entries(block.patchedDependencies ?? {})) {
|
|
394
|
+
recordFirstWins(patches, conflicts, pkg, { Repo: member.Name, Version: `${member.Name}/${patchPath}` });
|
|
395
|
+
}
|
|
396
|
+
for (const [pkg, extension] of Object.entries(block.packageExtensions ?? {})) {
|
|
397
|
+
recordFirstWins(extensionMeta, conflicts, pkg, { Repo: member.Name, Version: JSON.stringify(extension) });
|
|
398
|
+
if (!extensionValues.has(pkg))
|
|
399
|
+
extensionValues.set(pkg, extension); // mirrors first-wins
|
|
400
|
+
}
|
|
401
|
+
for (const [rule, range] of Object.entries(block.peerDependencyRules?.allowedVersions ?? {})) {
|
|
402
|
+
recordFirstWins(peerAllowed, conflicts, rule, { Repo: member.Name, Version: range });
|
|
403
|
+
}
|
|
404
|
+
for (const name of block.peerDependencyRules?.ignoreMissing ?? []) {
|
|
405
|
+
ignoreMissing.add(name);
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
return {
|
|
409
|
+
Overrides: sortedRecord(Object.fromEntries([...overrides].map(([k, v]) => [k, v.Version]))),
|
|
410
|
+
PatchedDependencies: sortedRecord(Object.fromEntries([...patches].map(([k, v]) => [k, v.Version]))),
|
|
411
|
+
PackageExtensions: sortedRecord(Object.fromEntries(extensionValues)),
|
|
412
|
+
PeerAllowedVersions: sortedRecord(Object.fromEntries([...peerAllowed].map(([k, v]) => [k, v.Version]))),
|
|
413
|
+
PeerIgnoreMissing: [...ignoreMissing].sort(),
|
|
414
|
+
Conflicts: [...conflicts.values()],
|
|
415
|
+
Patches: [...patches].map(([pkg, v]) => ({ Package: pkg, Path: v.Version, Repo: v.Repo })).sort((a, b) => (a.Package < b.Package ? -1 : 1)),
|
|
416
|
+
};
|
|
417
|
+
}
|
|
418
|
+
/** The bare package name of an override key: `chalk@^5` -> `chalk`, `@types/node@^4` -> `@types/node`. */
|
|
419
|
+
function overrideKeyName(key) {
|
|
420
|
+
const at = key.lastIndexOf('@');
|
|
421
|
+
return at <= 0 ? key : key.slice(0, at);
|
|
422
|
+
}
|
|
423
|
+
/** Removes every pin entry (plain or per-major selector) for a name; records what was displaced. */
|
|
424
|
+
function displacePinsForName(overrides, name, newValue, superseded) {
|
|
425
|
+
for (const key of Object.keys(overrides)) {
|
|
426
|
+
if (overrideKeyName(key) !== name && key !== name)
|
|
427
|
+
continue;
|
|
428
|
+
if (overrides[key] !== newValue)
|
|
429
|
+
superseded.add(key);
|
|
430
|
+
delete overrides[key];
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
/**
|
|
434
|
+
* Layers the three override sources into the parent `pnpm.overrides`, weakest
|
|
435
|
+
* first: lockfile-derived pins < explicit member overrides < family
|
|
436
|
+
* `workspace:*` (local source always wins). A member's or family's whole-name
|
|
437
|
+
* entry displaces every per-major pin selector for that name (a plain key and
|
|
438
|
+
* a `name@^N` selector must not fight). Displacements are returned so the
|
|
439
|
+
* command reports them — nothing is overwritten silently.
|
|
440
|
+
*/
|
|
441
|
+
export function AssembleParentOverrides(lockfilePins, memberOverrides, familyNames) {
|
|
442
|
+
const overrides = { ...lockfilePins };
|
|
443
|
+
const superseded = new Set();
|
|
444
|
+
for (const [key, version] of Object.entries(memberOverrides)) {
|
|
445
|
+
if (overrideKeyName(key) === key) {
|
|
446
|
+
// whole-name member override displaces every per-major pin selector for the name
|
|
447
|
+
displacePinsForName(overrides, key, version, superseded);
|
|
448
|
+
}
|
|
449
|
+
else if (key in overrides && overrides[key] !== version) {
|
|
450
|
+
superseded.add(key); // range-scoped member override displaces only its own selector
|
|
451
|
+
}
|
|
452
|
+
overrides[key] = version;
|
|
453
|
+
}
|
|
454
|
+
for (const name of familyNames) {
|
|
455
|
+
displacePinsForName(overrides, name, 'workspace:*', superseded);
|
|
456
|
+
overrides[name] = 'workspace:*';
|
|
457
|
+
}
|
|
458
|
+
return { Overrides: sortedRecord(overrides), SupersededPins: [...superseded].sort() };
|
|
459
|
+
}
|
|
460
|
+
/** Builds the manifest's `pnpm` block from the assembled parts, omitting empty sections. */
|
|
461
|
+
function buildPnpmBlock(overrides, blocks) {
|
|
462
|
+
const peerDependencyRules = {
|
|
463
|
+
allowedVersions: sortedRecord({ ...PEER_DEPENDENCY_RULES.allowedVersions, ...blocks.PeerAllowedVersions }),
|
|
464
|
+
ignoreMissing: [...new Set([...PEER_DEPENDENCY_RULES.ignoreMissing, ...blocks.PeerIgnoreMissing])].sort(),
|
|
465
|
+
};
|
|
466
|
+
const block = { peerDependencyRules };
|
|
467
|
+
if (Object.keys(overrides).length > 0)
|
|
468
|
+
block.overrides = overrides;
|
|
469
|
+
if (Object.keys(blocks.PatchedDependencies).length > 0) {
|
|
470
|
+
block.patchedDependencies = blocks.PatchedDependencies;
|
|
471
|
+
// A member patch is keyed to pkg@version; when the parent graph never resolves
|
|
472
|
+
// that exact version, pnpm hard-fails the WHOLE install with ERR_PNPM_UNUSED_PATCH.
|
|
473
|
+
// One member's stale patch must not brick every member's workspace — allow it,
|
|
474
|
+
// and rely on the assembly report, which names every hoisted patch.
|
|
475
|
+
block.allowUnusedPatches = true;
|
|
476
|
+
}
|
|
477
|
+
if (Object.keys(blocks.PackageExtensions).length > 0)
|
|
478
|
+
block.packageExtensions = blocks.PackageExtensions;
|
|
479
|
+
return block;
|
|
480
|
+
}
|
|
481
|
+
/**
|
|
482
|
+
* Builds the private parent `package.json`: pnpm pin, the cleaned member
|
|
483
|
+
* devDependency union, and the full absorbed `pnpm` block — member overrides and
|
|
484
|
+
* patches hoisted, lockfile-derived pins, and `workspace:*` overrides for every
|
|
485
|
+
* member-provided package. Every decision lands in the returned Report.
|
|
486
|
+
*/
|
|
487
|
+
export function BuildRootPackageJson(parentDirName, members) {
|
|
488
|
+
if (members.length === 0) {
|
|
489
|
+
throw new Error('BuildRootPackageJson requires at least one member repo');
|
|
490
|
+
}
|
|
491
|
+
const family = CollectFamilyPackages(members);
|
|
492
|
+
const union = ResolveDevDependencyUnion(members, new Set(family.Names));
|
|
493
|
+
const pins = DeriveLockfilePins(members.flatMap((m) => (m.Lockfile !== null && m.Lockfile.Kind !== 'unsupported' ? [{ Repo: m.Name, Lockfile: m.Lockfile }] : [])), new Set(family.Names));
|
|
494
|
+
const blocks = ResolveMemberPnpmBlocks(members);
|
|
495
|
+
const assembled = AssembleParentOverrides(pins.Pins, blocks.Overrides, family.Names);
|
|
496
|
+
const { Pin, Source } = ResolvePnpmPin(members);
|
|
497
|
+
const manifest = {
|
|
498
|
+
name: workspaceName(parentDirName),
|
|
499
|
+
private: true,
|
|
500
|
+
packageManager: Pin,
|
|
501
|
+
devDependencies: union.DevDependencies,
|
|
502
|
+
pnpm: buildPnpmBlock(assembled.Overrides, blocks),
|
|
503
|
+
};
|
|
504
|
+
return {
|
|
505
|
+
Content: `${JSON.stringify(manifest, null, 2)}\n`,
|
|
506
|
+
Conflicts: union.Conflicts,
|
|
507
|
+
PinSource: Source,
|
|
508
|
+
Pin,
|
|
509
|
+
Report: buildManifestReport(members, family, union, pins, blocks, assembled.SupersededPins),
|
|
510
|
+
};
|
|
511
|
+
}
|
|
512
|
+
/** Assembles the absorption report — one place, so nothing the build decided goes unreported. */
|
|
513
|
+
function buildManifestReport(members, family, union, pins, blocks, supersededPins) {
|
|
514
|
+
const lockfileSkips = members.flatMap((m) => m.Lockfile !== null && m.Lockfile.Kind !== 'unsupported' ? m.Lockfile.Skipped.map((skip) => ({ Repo: m.Name, Skip: skip })) : []);
|
|
515
|
+
const unsupportedLockfiles = members.flatMap((m) => m.Lockfile !== null && m.Lockfile.Kind === 'unsupported' ? [{ Repo: m.Name, File: m.Lockfile.File, Version: m.Lockfile.Version }] : []);
|
|
516
|
+
return {
|
|
517
|
+
LockfilePinCount: Object.keys(pins.Pins).length,
|
|
518
|
+
PinConflicts: pins.Conflicts,
|
|
519
|
+
LockfileSkips: lockfileSkips,
|
|
520
|
+
UnsupportedLockfiles: unsupportedLockfiles,
|
|
521
|
+
HoistedOverrideCount: Object.keys(blocks.Overrides).length,
|
|
522
|
+
BlockConflicts: blocks.Conflicts,
|
|
523
|
+
Patches: blocks.Patches,
|
|
524
|
+
FamilyOverrideCount: family.Names.length,
|
|
525
|
+
DuplicateFamilyPackages: family.Duplicates,
|
|
526
|
+
SkippedTypesDevDeps: [...union.SkippedTypes].sort(),
|
|
527
|
+
DroppedWorkspaceDevDeps: union.DroppedWorkspace,
|
|
528
|
+
SupersededPins: supersededPins,
|
|
529
|
+
};
|
|
530
|
+
}
|
|
531
|
+
/**
|
|
532
|
+
* Marker value the sentinel carries. `mj dev workspace clean` refuses to delete a
|
|
533
|
+
* workspace whose sentinel does not carry exactly this string, so it is the proof
|
|
534
|
+
* that the residue at a parent directory is this tool's own output.
|
|
535
|
+
*/
|
|
536
|
+
export const SENTINEL_MARKER = 'mj dev workspace';
|
|
537
|
+
/**
|
|
538
|
+
* Builds the `.mj-dev-workspace.json` sentinel manifest: the marker `clean`
|
|
539
|
+
* checks, the files the generator wrote, and the members it wrote them for.
|
|
540
|
+
*
|
|
541
|
+
* Both lists are sorted and no timestamp is recorded — regenerating an unchanged
|
|
542
|
+
* workspace must produce a byte-identical sentinel.
|
|
543
|
+
*/
|
|
544
|
+
export function BuildSentinel(fileNames, memberNames) {
|
|
545
|
+
if (fileNames.length === 0) {
|
|
546
|
+
throw new Error('BuildSentinel requires at least one generated file name');
|
|
547
|
+
}
|
|
548
|
+
if (memberNames.length === 0) {
|
|
549
|
+
throw new Error('BuildSentinel requires at least one member repo');
|
|
550
|
+
}
|
|
551
|
+
const sentinel = {
|
|
552
|
+
generatedBy: SENTINEL_MARKER,
|
|
553
|
+
files: [...fileNames].sort(),
|
|
554
|
+
members: [...memberNames].sort(),
|
|
555
|
+
};
|
|
556
|
+
return `${JSON.stringify(sentinel, null, 2)}\n`;
|
|
557
|
+
}
|
|
558
|
+
/**
|
|
559
|
+
* Picks the parent `turbo.json`: copied verbatim from the first member (sorted by
|
|
560
|
+
* name) that carries one; a minimal proven config otherwise.
|
|
561
|
+
*/
|
|
562
|
+
export function PickTurboJson(members) {
|
|
563
|
+
for (const member of [...members].sort((a, b) => a.Name.localeCompare(b.Name))) {
|
|
564
|
+
if (member.TurboJson !== null) {
|
|
565
|
+
return { Content: member.TurboJson, Source: member.Name };
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
return { Content: FALLBACK_TURBO_JSON, Source: 'generator fallback' };
|
|
569
|
+
}
|
|
570
|
+
//# sourceMappingURL=build.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../../src/lib/dev-workspace/build.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,OAAO,EAAE,kBAAkB,EAA2B,MAAM,eAAe,CAAC;AAY5E,iEAAiE;AACjE,MAAM,CAAC,MAAM,uBAAuB,GAAsB;IACxD,oBAAoB;IACpB,eAAe;IACf,iBAAiB;IACjB,YAAY;IACZ,mBAAmB;IACnB,SAAS;IACT,cAAc;IACd,SAAS;IACT,aAAa;IACb,MAAM;IACN,kBAAkB;IAClB,UAAU;IACV,YAAY;IACZ,MAAM;IACN,OAAO;IACP,cAAc;CACf,CAAC;AAEF,6FAA6F;AAC7F,MAAM,CAAC,MAAM,gBAAgB,GAAsB;IACjD,8BAA8B;IAC9B,+BAA+B;IAC/B,yBAAyB;CAC1B,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAiE;IAChG;QACE,OAAO,EAAE,kCAAkC;QAC3C,KAAK,EAAE;YACL,sBAAsB;YACtB,qBAAqB;YACrB,qBAAqB;YACrB,oBAAoB;YACpB,oBAAoB;YACpB,wBAAwB;YACxB,aAAa;SACd;KACF;IACD;QACE,OAAO,EAAE,4CAA4C;QACrD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E,CAAC,GAAG,WAAW,CAAC,CAAC,IAAI,EAAE;KACjC,CAAC;IACF,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC;AAClD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,OAAiC;IAC7D,KAAK,MAAM,MAAM,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;QAC/E,IAAI,MAAM,CAAC,SAAS,KAAK,IAAI,EAAE,CAAC;YAC9B,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;QAC5D,CAAC;IACH,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,oBAAoB,EAAE,CAAC;AACxE,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { CleanPlan, CleanResult, SentinelReadResult } from './types.js';
|
|
2
|
+
/** Lockfile `pnpm install` produces at the parent. */
|
|
3
|
+
export declare const LOCKFILE_NAME = "pnpm-lock.yaml";
|
|
4
|
+
/** Dependency tree `pnpm install` produces at the parent. */
|
|
5
|
+
export declare const NODE_MODULES_NAME = "node_modules";
|
|
6
|
+
/**
|
|
7
|
+
* Number of paths clean owns: the four workspace files, the lockfile, the
|
|
8
|
+
* node_modules tree, and the sentinel. Asserted in {@link PlanClean} so editing a
|
|
9
|
+
* file-name constant can never silently widen or narrow what clean deletes.
|
|
10
|
+
*/
|
|
11
|
+
export declare const CLEAN_TARGET_COUNT: number;
|
|
12
|
+
/**
|
|
13
|
+
* Reads the sentinel at a parent directory. Read-only, and never throws for a
|
|
14
|
+
* malformed file: a sentinel that is absent or not ours is a decision the caller
|
|
15
|
+
* makes (refuse, or proceed under `--force`), not a crash.
|
|
16
|
+
*/
|
|
17
|
+
export declare function ReadSentinel(parentDir: string): SentinelReadResult;
|
|
18
|
+
/**
|
|
19
|
+
* Applies the pre-deletion safety ladder and returns what the sentinel said.
|
|
20
|
+
* Throws when the parent is not a safe workspace parent, or when no valid
|
|
21
|
+
* sentinel is present and `force` was not given.
|
|
22
|
+
*/
|
|
23
|
+
export declare function AssertCleanAllowed(parentDir: string, force: boolean): SentinelReadResult;
|
|
24
|
+
/**
|
|
25
|
+
* Builds the removal plan for a parent directory: every owned path with whether it
|
|
26
|
+
* exists right now, plus the `.bak` files that will be left alone. Read-only.
|
|
27
|
+
*/
|
|
28
|
+
export declare function PlanClean(parentDir: string): CleanPlan;
|
|
29
|
+
/**
|
|
30
|
+
* Deletes every existing target in plan order. Targets that are already absent
|
|
31
|
+
* are reported, not treated as failures. A failed removal aborts and names what
|
|
32
|
+
* had already gone — the sentinel is removed last, so a re-run resumes.
|
|
33
|
+
*/
|
|
34
|
+
export declare function ExecuteClean(plan: CleanPlan): CleanResult;
|
|
35
|
+
/**
|
|
36
|
+
* Renders the `--dry-run` report: only the paths that actually exist (so the list
|
|
37
|
+
* is what a real clean would delete), plus the `.bak` files it would leave. Pure.
|
|
38
|
+
*/
|
|
39
|
+
export declare function RenderCleanPlan(plan: CleanPlan): string[];
|
|
40
|
+
//# sourceMappingURL=clean.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clean.d.ts","sourceRoot":"","sources":["../../../src/lib/dev-workspace/clean.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAe,kBAAkB,EAAqB,MAAM,YAAY,CAAC;AAE7G,sDAAsD;AACtD,eAAO,MAAM,aAAa,mBAAmB,CAAC;AAE9C,6DAA6D;AAC7D,eAAO,MAAM,iBAAiB,iBAAiB,CAAC;AAQhD;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,QAAkC,CAAC;AA6BlE;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,kBAAkB,CAQlE;AAiBD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,kBAAkB,CAKxF;AAqBD;;;GAGG;AACH,wBAAgB,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,CAYtD;AAeD;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,GAAG,WAAW,CAoBzD;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,EAAE,CAazD"}
|