@reqvire-org/ads 0.3.52 → 0.4.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/README.md +10 -9
- package/dist/assets.mjs +16 -2
- package/dist/behaviors.mjs +6 -5
- package/dist/boundaries.mjs +5 -5
- package/dist/browser-audit/first-render.mjs +22 -0
- package/dist/browser-audit/image-shape.mjs +36 -0
- package/dist/browser-audit/render-states.mjs +61 -35
- package/dist/browser-audit/worker.mjs +47 -12
- package/dist/browser-audit.mjs +75 -12
- package/dist/bun-compiler.mjs +14 -7
- package/dist/check-service.mjs +83 -0
- package/dist/check.mjs +20 -18
- package/dist/cli.mjs +5 -3
- package/dist/config.mjs +20 -41
- package/dist/contracts.d.mts +9 -0
- package/dist/finding-rules.mjs +8 -1
- package/dist/font-rules.mjs +103 -0
- package/dist/fonts-generated.mjs +32 -12
- package/dist/generated-entries.mjs +131 -0
- package/dist/icons.mjs +1 -1
- package/dist/init.mjs +11 -32
- package/dist/layers.mjs +7 -3
- package/dist/lint-config.mjs +4 -2
- package/dist/mcp/catalog.mjs +2 -1
- package/dist/mcp/context.mjs +3 -3
- package/dist/mcp/drafts.mjs +136 -121
- package/dist/mcp/mutations.mjs +65 -19
- package/dist/mcp/preview-watch.mjs +31 -5
- package/dist/mcp/preview-widget.bundle.js +50 -47
- package/dist/mcp/project-widget.bundle.js +45 -42
- package/dist/mcp/prompts.mjs +1 -1
- package/dist/mcp/server.mjs +81 -40
- package/dist/mcp/showcase-host.mjs +20 -7
- package/dist/mcp/widget.bundle.js +49 -46
- package/dist/oxlint.mjs +3 -2
- package/dist/program-cache.mjs +36 -0
- package/dist/public-api.mjs +2 -1
- package/dist/scenarios-compiler.mjs +82 -14
- package/dist/scenarios-vite.mjs +1 -1
- package/dist/scenarios.mjs +4 -3
- package/dist/showcase/client.bundle.js +27 -27
- package/dist/showcase/index.html +2 -2
- package/dist/skills/ads-break-ui/SKILL.md +25 -28
- package/dist/skills/ads-break-ui/references/behaviors.md +7 -6
- package/dist/skills/ads-break-ui/references/captures.md +7 -32
- package/dist/skills/ads-break-ui/references/contracts.md +58 -25
- package/dist/skills/ads-break-ui/references/drafts.md +59 -43
- package/dist/skills/ads-break-ui/references/evidence.md +1 -1
- package/dist/skills/ads-break-ui/references/guarded-editing.md +58 -47
- package/dist/skills/ads-break-ui/references/review.md +9 -8
- package/dist/skills/ads-break-ui/references/scenarios.md +1 -1
- package/dist/skills/ads-break-ui/references/validation.md +8 -4
- package/dist/skills/ads-break-ui/references/workflows.md +15 -8
- package/dist/skills/ads-designer/SKILL.md +30 -31
- package/dist/skills/ads-designer/references/accessibility.md +9 -5
- package/dist/skills/ads-designer/references/behaviors.md +7 -6
- package/dist/skills/ads-designer/references/branding.md +2 -2
- package/dist/skills/ads-designer/references/captures.md +7 -32
- package/dist/skills/ads-designer/references/cli.md +5 -1
- package/dist/skills/ads-designer/references/contracts.md +58 -25
- package/dist/skills/ads-designer/references/drafts.md +59 -43
- package/dist/skills/ads-designer/references/evidence.md +1 -1
- package/dist/skills/ads-designer/references/guarded-editing.md +58 -47
- package/dist/skills/ads-designer/references/performance.md +57 -6
- package/dist/skills/ads-designer/references/review.md +9 -8
- package/dist/skills/ads-designer/references/scenarios.md +1 -1
- package/dist/skills/ads-designer/references/validation.md +8 -4
- package/dist/skills/ads-designer/references/workflows.md +15 -8
- package/dist/skills/ads-import/SKILL.md +25 -28
- package/dist/skills/ads-import/references/behaviors.md +7 -6
- package/dist/skills/ads-import/references/captures.md +7 -32
- package/dist/skills/ads-import/references/cli.md +5 -1
- package/dist/skills/ads-import/references/contracts.md +58 -25
- package/dist/skills/ads-import/references/drafts.md +59 -43
- package/dist/skills/ads-import/references/evidence.md +1 -1
- package/dist/skills/ads-import/references/guarded-editing.md +58 -47
- package/dist/skills/ads-import/references/review.md +9 -8
- package/dist/skills/ads-import/references/scenarios.md +1 -1
- package/dist/skills/ads-import/references/validation.md +8 -4
- package/dist/skills/ads-import/references/workflows.md +15 -8
- package/dist/skills/ads-motion/SKILL.md +25 -28
- package/dist/skills/ads-motion/references/behaviors.md +7 -6
- package/dist/skills/ads-motion/references/captures.md +7 -32
- package/dist/skills/ads-motion/references/contracts.md +58 -25
- package/dist/skills/ads-motion/references/drafts.md +59 -43
- package/dist/skills/ads-motion/references/evidence.md +1 -1
- package/dist/skills/ads-motion/references/guarded-editing.md +58 -47
- package/dist/skills/ads-motion/references/review.md +9 -8
- package/dist/skills/ads-motion/references/scenarios.md +1 -1
- package/dist/skills/ads-motion/references/validation.md +8 -4
- package/dist/skills/ads-motion/references/workflows.md +15 -8
- package/dist/skills/ads-port/SKILL.md +25 -28
- package/dist/skills/ads-port/references/behaviors.md +7 -6
- package/dist/skills/ads-port/references/captures.md +7 -32
- package/dist/skills/ads-port/references/cli.md +5 -1
- package/dist/skills/ads-port/references/contracts.md +58 -25
- package/dist/skills/ads-port/references/drafts.md +59 -43
- package/dist/skills/ads-port/references/evidence.md +1 -1
- package/dist/skills/ads-port/references/guarded-editing.md +58 -47
- package/dist/skills/ads-port/references/native-implementation.md +6 -6
- package/dist/skills/ads-port/references/review.md +9 -8
- package/dist/skills/ads-port/references/scenarios.md +1 -1
- package/dist/skills/ads-port/references/validation.md +8 -4
- package/dist/skills/ads-port/references/workflows.md +15 -8
- package/dist/starters/preact/design-system/components/Layout/Grid/Grid.ads.contract.ts +6 -0
- package/dist/starters/preact/design-system/review/token-preview/TokenPreview.ads.contract.ts +6 -0
- package/dist/starters/preact/ds.config.json +0 -14
- package/dist/starters/react/README.md +9 -5
- package/dist/starters/react/design-system/brand/Icons/AppIcon/AppIcon.ads.fixture.ts +1 -1
- package/dist/starters/react/design-system/brand/Identity/Logo/Logo.ads.fixture.ts +2 -2
- package/dist/starters/react/design-system/components/Actions/Button/Button.ads.exports.ts +1 -0
- package/dist/starters/react/design-system/components/Actions/IconButton/IconButton.ads.exports.ts +1 -0
- package/dist/starters/react/design-system/components/Content/Icon/Icon.ads.exports.ts +1 -0
- package/dist/starters/react/design-system/components/Content/Image/Image.ads.exports.ts +1 -0
- package/dist/starters/react/design-system/components/Content/Logo/Logo.ads.exports.ts +1 -0
- package/dist/starters/react/design-system/components/Content/Logo/Logo.tsx +2 -2
- package/dist/starters/react/design-system/components/Forms/TextField/TextField.ads.exports.ts +1 -0
- package/dist/starters/react/design-system/components/Layout/Grid/Grid.ads.contract.ts +6 -0
- package/dist/starters/react/design-system/components/Layout/Grid/Grid.ads.exports.ts +1 -0
- package/dist/starters/react/design-system/controllers/Palette/Palette.ads.exports.ts +1 -0
- package/dist/starters/react/design-system/index.ts +3 -7
- package/dist/starters/react/design-system/patterns/Search/SearchBar/SearchBar.ads.exports.ts +1 -0
- package/dist/starters/react/design-system/review/brand-preview/BrandPreview.ads.exports.ts +1 -0
- package/dist/starters/react/design-system/review/demo-frame/DemoFrame.ads.exports.ts +1 -0
- package/dist/starters/react/design-system/review/grid-cell/GridCell.ads.exports.ts +1 -0
- package/dist/starters/react/design-system/review/index.ts +4 -3
- package/dist/starters/react/design-system/review/screen-frame/ScreenFrame.ads.exports.ts +1 -0
- package/dist/starters/react/design-system/review/token-preview/TokenPreview.ads.contract.ts +6 -0
- package/dist/starters/react/design-system/review/token-preview/TokenPreview.ads.exports.ts +1 -0
- package/dist/starters/react/design-system/styles.css +1 -0
- package/dist/starters/react/ds.config.json +0 -14
- package/dist/style-boundaries.mjs +7 -6
- package/dist/test-boundaries.mjs +2 -2
- package/dist/themes-watch.mjs +9 -3
- package/dist/token-fixtures.mjs +1 -1
- package/dist/unit-contracts.mjs +38 -4
- package/dist/units.mjs +16 -91
- package/dist/validation-checks.mjs +7 -1
- package/docs/ADS.md +10 -10
- package/docs/ARCHITECTURE.md +104 -44
- package/docs/BEHAVIORS.md +8 -7
- package/docs/CACHING.md +15 -6
- package/docs/CHANGELOG.md +107 -12
- package/docs/COMPARISON.md +1 -1
- package/docs/CONTRACTS.md +10 -25
- package/docs/GUIDE.md +98 -57
- package/docs/MCP.md +116 -151
- package/package.json +7 -7
- package/dist/contract-migration.mjs +0 -110
- package/dist/mcp/draft-exports.mjs +0 -40
- package/dist/mcp/edit-preparation.mjs +0 -115
package/dist/mcp/drafts.mjs
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import { spawnSync } from "node:child_process";
|
|
2
1
|
import { writeThemesCss } from "../themes-generated.mjs";
|
|
3
|
-
import { mkdtempSync } from "node:fs";
|
|
4
|
-
import { tmpdir } from "node:os";
|
|
5
2
|
import { createHash, randomUUID } from "node:crypto";
|
|
6
3
|
import { cpSync, existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, symlinkSync, watch, writeFileSync } from "node:fs";
|
|
7
4
|
import path from "node:path";
|
|
@@ -10,19 +7,19 @@ import { loadConfig, isInside } from "../config.mjs";
|
|
|
10
7
|
import { DRAFT_DIRECTORY } from "../draft-boundary.mjs";
|
|
11
8
|
import { inspectUnits, validateUnitId } from "../units.mjs";
|
|
12
9
|
import { validationInputFiles } from "../validation-inputs.mjs";
|
|
13
|
-
import {
|
|
14
|
-
import { storePreparedPatch, preparedFileDiff } from "./edit-preparation.mjs";
|
|
15
|
-
import { mergeDraftExports, isDraftExportEntry } from "./draft-exports.mjs";
|
|
10
|
+
import { writeGeneratedEntries } from "../generated-entries.mjs";
|
|
16
11
|
import { inspectTokens } from "../tokens.mjs";
|
|
17
12
|
import { previewFileIgnored, previewWatchDirectories } from "../preview-files.mjs";
|
|
18
13
|
import { createDraftDiscovery } from "./draft-discovery.mjs";
|
|
19
14
|
import { mutationLimits } from "./mutation-limits.mjs";
|
|
15
|
+
import { applyFilePatch, parseUnifiedPatch } from "./patch.mjs";
|
|
16
|
+
import { readPatchFile } from "./mutations.mjs";
|
|
20
17
|
|
|
21
18
|
export const DRAFTS_URI = "ads://project/drafts";
|
|
22
19
|
const hash = bytes => createHash("sha256").update(bytes).digest("hex");
|
|
23
20
|
const idSchema = z.string().regex(/^[a-z0-9][a-z0-9-]{0,79}$/);
|
|
24
21
|
const relative = z.string().min(1).max(500).refine(value => !path.isAbsolute(value) && !value.includes("\\") && !value.includes("\0") && !value.split("/").some(part => !part || part === "." || part === ".."), "Use a canonical project-relative path.");
|
|
25
|
-
const fileSchema = z.object({ target: relative, source: relative.nullable(), baseline: z.string().regex(/^[a-f0-9]{64}$/).nullable(),
|
|
22
|
+
const fileSchema = z.object({ target: relative, source: relative.nullable(), baseline: z.string().regex(/^[a-f0-9]{64}$/).nullable(), unit: z.string().max(256) }).strict();
|
|
26
23
|
const draftUnits = z.array(z.string().min(1).max(256)).min(1).max(mutationLimits.units).refine(values=>new Set(values).size===values.length,"Draft owners must be unique.");
|
|
27
24
|
const manifestSchema = z.object({ schemaVersion: z.literal(1), id: idSchema, title: z.string().min(1).max(160), units: draftUnits, dependencies: z.array(idSchema).max(8).refine(values=>new Set(values).size===values.length,"Draft dependencies must be unique.").default([]), tokenGroups:z.array(z.string().min(1).max(160)).max(32).default([]), files: z.array(fileSchema).max(mutationLimits.files) }).strict();
|
|
28
25
|
export const draftIdSchema = idSchema;
|
|
@@ -55,32 +52,6 @@ function atomic(file, content) {
|
|
|
55
52
|
finally { rmSync(staging, { force: true }); }
|
|
56
53
|
}
|
|
57
54
|
const storedName = target => `files/${target}.ads`;
|
|
58
|
-
const baseName = target => `bases/${target}.ads`;
|
|
59
|
-
function mergeJson(current,baseline,proposed) {
|
|
60
|
-
const equal=(a,b)=>JSON.stringify(a)===JSON.stringify(b);
|
|
61
|
-
if(equal(current,baseline)||equal(current,proposed))return proposed;
|
|
62
|
-
if(equal(proposed,baseline))return current;
|
|
63
|
-
const object=value=>value!==null&&typeof value==="object"&&!Array.isArray(value);
|
|
64
|
-
if(![current,baseline,proposed].every(object))throw new Error("Overlapping JSON value edits.");
|
|
65
|
-
return Object.fromEntries([...new Set([...Object.keys(current),...Object.keys(baseline),...Object.keys(proposed)])]
|
|
66
|
-
.map(key=>[key,mergeJson(current[key],baseline[key],proposed[key])]).filter(([,value])=>value!==undefined));
|
|
67
|
-
}
|
|
68
|
-
function mergeSource(current, baseline, proposed, target) {
|
|
69
|
-
if (current === baseline || current === proposed) return proposed;
|
|
70
|
-
if (proposed === baseline) return current;
|
|
71
|
-
if ([current, baseline, proposed].some(value => value === null || value.includes("\0"))) throw new Error("Overlapping deletion, addition or binary edit.");
|
|
72
|
-
if(target.endsWith(".json")) {
|
|
73
|
-
const content=mergeJson(JSON.parse(current),JSON.parse(baseline),JSON.parse(proposed));
|
|
74
|
-
return JSON.stringify(content,null,current.match(/\n([ \t]+)"/)?.[1]??2)+(current.endsWith("\n")?"\n":"");
|
|
75
|
-
}
|
|
76
|
-
const folder = mkdtempSync(path.join(tmpdir(), "ads-draft-merge-"));
|
|
77
|
-
try {
|
|
78
|
-
const files = [current, baseline, proposed].map((content, index) => { const file=path.join(folder,String(index)); writeFileSync(file,content); return file; });
|
|
79
|
-
const result=spawnSync("git",["merge-file","-p","--",...files],{encoding:"utf8",timeout:5000,maxBuffer:32*1024**2});
|
|
80
|
-
if (result.error || result.status !== 0) throw new Error("Overlapping edits; resolve the draft source against the current project and retry.");
|
|
81
|
-
return result.stdout;
|
|
82
|
-
} finally { rmSync(folder,{recursive:true,force:true}); }
|
|
83
|
-
}
|
|
84
55
|
|
|
85
56
|
/** Tracked proposal source is separate from disposable compiler state. No Git checkout is required. */
|
|
86
57
|
export function createDraftController(directory, { edits, startPreview, prewarm = false, onChange, scenarioInspector } = {}) {
|
|
@@ -94,7 +65,7 @@ export function createDraftController(directory, { edits, startPreview, prewarm
|
|
|
94
65
|
}
|
|
95
66
|
return folder;
|
|
96
67
|
}
|
|
97
|
-
let active, closed = false;
|
|
68
|
+
let active, closed = false, lastShown;
|
|
98
69
|
let changeTimer, prewarmTimer, prewarming, pendingPrewarm;
|
|
99
70
|
const watchers = new Map();
|
|
100
71
|
let discoveryVersion = 0;
|
|
@@ -112,8 +83,6 @@ export function createDraftController(directory, { edits, startPreview, prewarm
|
|
|
112
83
|
if (!manifest.units.includes(file.unit) || file.target.split("/").some(part => [DRAFT_DIRECTORY, ".ds", "node_modules", ".git"].includes(part))) throw new Error("Draft targets must be normal source owned by a declared unit.");
|
|
113
84
|
if (file.source && (!file.source.startsWith("files/") || !file.source.endsWith(".ads"))) throw new Error("Draft sources must use the non-importable .ads extension under files/.");
|
|
114
85
|
if (file.source) safe(path.dirname(manifestFile(id)), file.source);
|
|
115
|
-
if (file.base && (file.base !== baseName(file.target) || !file.baseline)) throw new Error("Invalid draft baseline source.");
|
|
116
|
-
if (file.base) safe(path.dirname(manifestFile(id)),file.base);
|
|
117
86
|
}
|
|
118
87
|
return manifest;
|
|
119
88
|
}
|
|
@@ -199,6 +168,19 @@ export function createDraftController(directory, { edits, startPreview, prewarm
|
|
|
199
168
|
units = draftUnits.parse(units);
|
|
200
169
|
idSchema.parse(id);
|
|
201
170
|
if (existsSync(manifestFile(id))) throw new Error("Draft already exists.");
|
|
171
|
+
// One open draft per owner: concurrent clients edit different owners, so drafts never overlap.
|
|
172
|
+
// A token-group draft holds only its groups' sheets; a whole-tokens draft holds every group.
|
|
173
|
+
const holds = (manifest, unit) => {
|
|
174
|
+
if (!manifest.units.includes(unit)) return false;
|
|
175
|
+
if (unit !== "tokens") return true;
|
|
176
|
+
const mine = manifest.tokenGroups ?? [];
|
|
177
|
+
return !mine.length || !selectedGroups.length || mine.some(group => selectedGroups.includes(group));
|
|
178
|
+
};
|
|
179
|
+
for (const other of ids()) {
|
|
180
|
+
let held;
|
|
181
|
+
try { const manifest = read(other); held = units.filter(unit => holds(manifest, unit)); } catch { continue; }
|
|
182
|
+
if (held.length) throw new Error(`${held.join(", ")} ${held.length === 1 ? "is" : "are"} already in open draft ${other}. Accept or drop that draft first, or depend on it from a draft of other owners.`);
|
|
183
|
+
}
|
|
202
184
|
const options = loadConfig(root), inventory = inspectUnits(options), files = new Map();
|
|
203
185
|
const groups=selectedGroups.length?tokenGroups():[];
|
|
204
186
|
if(selectedGroups.length&&(!units.includes("tokens")||selectedGroups.some(id=>!groups.some(group=>group.id===id))))throw new Error("Choose discovered tokenGroups from ads_tokens and include the tokens owner.");
|
|
@@ -206,80 +188,79 @@ export function createDraftController(directory, { edits, startPreview, prewarm
|
|
|
206
188
|
validateUnitId(unit);
|
|
207
189
|
const owner = inventory.units.find(item => item.id === unit);
|
|
208
190
|
if (!owner && !/^(?:components|patterns|controllers|composition|review)\/.+/.test(unit)) throw new Error("Choose a discovered owner or a new component/pattern/controller/composition/review owner.");
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
191
|
+
// Only the owner's own files: a shared companion (ds.config.json, the foundation styles entry)
|
|
192
|
+
// joins a draft when the draft changes it, so drafts of different owners do not share copies.
|
|
193
|
+
const paths = owner?.files ?? [];
|
|
212
194
|
for (const target of paths) if (!files.has(target)) {
|
|
213
195
|
if(unit==="tokens"&&selectedGroups.length&&target.endsWith(".css")&&isInside(path.join(options.dsRoot,options.config.tokenDir),path.join(root,target))&&!groups.some(group=>selectedGroups.includes(group.id)&&group.file===target))continue;
|
|
214
196
|
const content = bytes(safe(root, target));
|
|
215
197
|
if (content === null) continue;
|
|
216
198
|
const source = storedName(target);
|
|
217
|
-
files.set(target, { target, source, baseline: hash(content),
|
|
199
|
+
files.set(target, { target, source, baseline: hash(content), unit });
|
|
218
200
|
}
|
|
219
201
|
}
|
|
220
202
|
const manifest = manifestSchema.parse({ schemaVersion: 1, id, title: title ?? units.join(", ").slice(0,160), units, dependencies, tokenGroups:selectedGroups, files: [...files.values()] });
|
|
221
203
|
for (const dependency of dependencies) {const value=inspect(dependency,[id]);if(value.dependencyErrors.length)throw new Error(value.dependencyErrors[0].message);}
|
|
222
204
|
for (const file of manifest.files) {
|
|
223
205
|
const content=bytes(safe(root,file.target)),folder=path.dirname(manifestFile(id));
|
|
224
|
-
atomic(safe(folder,file.source),content);
|
|
206
|
+
atomic(safe(folder,file.source),content);
|
|
225
207
|
}
|
|
226
208
|
save(manifest);
|
|
227
209
|
const value = inspect(id); event(id, value.revision, "created");
|
|
228
210
|
reconcileWatches(); queuePrewarm(id);
|
|
229
|
-
return { ...summary(value), directory: `${DRAFT_DIRECTORY}/${id}`, next: "Edit the marked source files, or register
|
|
211
|
+
return { ...summary(value), directory: `${DRAFT_DIRECTORY}/${id}`, next: "Edit the marked source files, or patch/register files with ads_update_draft. Use ads_show_draft, review the rendered result, then ads_accept with its exact revision (dryRun:true checks without writing). Do not finish a design change with unaccepted drafts." };
|
|
212
|
+
}
|
|
213
|
+
/** Write one proposed file into a draft: content null proposes deletion. Accepted source never changes. */
|
|
214
|
+
function stage(manifest, {unit, path: target, content}) {
|
|
215
|
+
if (!manifest.units.includes(unit)) throw new Error("Changes must belong to a declared draft unit.");
|
|
216
|
+
const folder = path.dirname(manifestFile(manifest.id));
|
|
217
|
+
let file = manifest.files.find(file => file.target === target);
|
|
218
|
+
if (!file) { file = { target, source: null, baseline: fileHash(bytes(safe(root,target))), unit }; manifest.files.push(file); }
|
|
219
|
+
file.unit = unit;
|
|
220
|
+
if (content === null) file.source = null;
|
|
221
|
+
else { file.source ??= storedName(target); atomic(safe(folder, file.source), content); }
|
|
222
|
+
}
|
|
223
|
+
/** The draft's current proposal for a canonical path: its source, null when deleted or absent. */
|
|
224
|
+
function proposed(manifest, target) {
|
|
225
|
+
const file = manifest.files.find(file => file.target === target);
|
|
226
|
+
if (!file) return bytes(safe(root, target));
|
|
227
|
+
return file.source ? bytes(safe(path.dirname(manifestFile(manifest.id)), file.source)) : null;
|
|
228
|
+
}
|
|
229
|
+
function ownerOf(manifest, target) {
|
|
230
|
+
const known = manifest.files.find(file => file.target === target)?.unit;
|
|
231
|
+
if (known) return known;
|
|
232
|
+
const units = inspectUnits(loadConfig(root)), owner = units.owner(units.relative(target));
|
|
233
|
+
if (manifest.units.includes(owner)) return owner;
|
|
234
|
+
if (manifest.units.length === 1) return manifest.units[0];
|
|
235
|
+
throw new Error(`${target} is not owned by a declared draft unit. Add its owner to a draft, or use changes with an explicit unit.`);
|
|
230
236
|
}
|
|
231
|
-
|
|
237
|
+
/** Apply a Git unified diff, written against canonical paths, to the draft's proposed files. */
|
|
238
|
+
function patchDraft(manifest, text) {
|
|
239
|
+
const entries = parseUnifiedPatch(text, mutationLimits.files), staged = [];
|
|
240
|
+
for (const entry of entries) {
|
|
241
|
+
if (entry.binary) throw new Error(`${entry.path}: binary patches cannot edit a draft. Send the file through changes with encoding:base64.`);
|
|
242
|
+
safe(root, entry.path);
|
|
243
|
+
const before = proposed(manifest, entry.path);
|
|
244
|
+
if (before !== null && !Buffer.from(before.toString("utf8")).equals(before)) throw new Error(`${entry.path} is binary; replace it through changes with encoding:base64.`);
|
|
245
|
+
const after = applyFilePatch(entry, before === null ? null : before.toString("utf8"));
|
|
246
|
+
staged.push({ unit: ownerOf(manifest, entry.path), path: entry.path, content: after === null ? null : Buffer.from(after) });
|
|
247
|
+
}
|
|
248
|
+
for (const change of staged) stage(manifest, change);
|
|
249
|
+
return staged.map(change => change.path);
|
|
250
|
+
}
|
|
251
|
+
function update({ id, revision, changes = [], dependencies, patch, patchFile }) {
|
|
232
252
|
const value = inspect(id);
|
|
233
253
|
if (value.revision !== revision) throw new Error("Draft revision changed. Read ads_drafts again before editing.");
|
|
234
254
|
const manifest = value.manifest;
|
|
235
|
-
if (
|
|
236
|
-
if (
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
const current=bytes(safe(root,file.target)),digest=fileHash(current);
|
|
242
|
-
if (digest===file.baseline && !resolved.has(file.target)) continue;
|
|
243
|
-
const original=file.base?bytes(safe(path.dirname(manifestFile(id)),file.base)):null;
|
|
244
|
-
try {
|
|
245
|
-
let content;
|
|
246
|
-
if(resolved.has(file.target))content=resolved.get(file.target);
|
|
247
|
-
else if (fileHash(file.content)===file.baseline || fileHash(file.content)===digest) content=current;
|
|
248
|
-
else {
|
|
249
|
-
if (fileHash(original)!==file.baseline) throw new Error("Original baseline unavailable for this older draft; resolve this file explicitly.");
|
|
250
|
-
if(current&&original&&file.content&&isDraftExportEntry(file.target,loadConfig(root))&&mergeDraftExports(original.toString(),current.toString(),current.toString(),file.target,loadConfig(root),manifest.units).content===original.toString())
|
|
251
|
-
content=Buffer.from(mergeDraftExports(current.toString(),file.content.toString(),original.toString(),file.target,loadConfig(root),manifest.units).content);
|
|
252
|
-
else {
|
|
253
|
-
if([current,original,file.content].some(content=>content!==null&&!Buffer.from(content.toString()).equals(content)))throw new Error("Overlapping binary edits require explicit resolution.");
|
|
254
|
-
content=Buffer.from(mergeSource(current?.toString()??null,original?.toString()??null,file.content?.toString()??null,file.target));
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
merged.push({file,current,content});
|
|
258
|
-
} catch(error) { conflicts.push({path:file.target,message:error.message}); }
|
|
259
|
-
}
|
|
260
|
-
if (conflicts.length) return {...summary(value),refreshed:false,diagnostics:conflicts};
|
|
261
|
-
for (const {file,current,content} of merged) {
|
|
262
|
-
const record=manifest.files.find(item=>item.target===file.target),folder=path.dirname(manifestFile(id));
|
|
263
|
-
record.baseline=fileHash(current);record.base=current===null?undefined:baseName(file.target);
|
|
264
|
-
if(current!==null)atomic(safe(folder,record.base),current);
|
|
265
|
-
record.source=content===null?null:storedName(file.target);
|
|
266
|
-
if(content!==null)atomic(safe(folder,record.source),content);
|
|
267
|
-
}
|
|
268
|
-
save(manifest);changed();return {...summary(inspect(id)),refreshed:true};
|
|
255
|
+
if (patch !== undefined || patchFile !== undefined) {
|
|
256
|
+
if (patch !== undefined && patchFile !== undefined) throw new Error("Provide exactly one of patch or patchFile.");
|
|
257
|
+
if (changes.length || dependencies) throw new Error("Patch a draft separately from changes and dependency edits.");
|
|
258
|
+
const patched = patchDraft(manifest, patch ?? readPatchFile(loadConfig(root), patchFile));
|
|
259
|
+
save(manifest); changed();
|
|
260
|
+
return { ...summary(inspect(id)), patched };
|
|
269
261
|
}
|
|
270
262
|
if (dependencies) { for (const dependency of dependencies) {const value=inspect(dependency,[id]);if(value.dependencyErrors.length)throw new Error(value.dependencyErrors[0].message);} manifest.dependencies = dependencies; }
|
|
271
|
-
for (const change of changes) {
|
|
272
|
-
if (!manifest.units.includes(change.unit)) throw new Error("Changes must belong to a declared draft unit.");
|
|
273
|
-
let file = manifest.files.find(file => file.target === change.path);
|
|
274
|
-
if (!file) { const original=bytes(safe(root,change.path)); file = { target: change.path, source: null, baseline: fileHash(original), ...(original===null?{}:{base:baseName(change.path)}), unit: change.unit }; if(original!==null)atomic(safe(path.dirname(manifestFile(id)),file.base),original); manifest.files.push(file); }
|
|
275
|
-
file.unit = change.unit;
|
|
276
|
-
if (change.content === null) file.source = null;
|
|
277
|
-
else {
|
|
278
|
-
file.source ??= storedName(change.path);
|
|
279
|
-
const content = Buffer.from(change.content, change.encoding === "base64" ? "base64" : "utf8");
|
|
280
|
-
atomic(safe(path.dirname(manifestFile(id)), file.source), content);
|
|
281
|
-
}
|
|
282
|
-
}
|
|
263
|
+
for (const change of changes) stage(manifest, { unit: change.unit, path: change.path, content: change.content === null ? null : Buffer.from(change.content, change.encoding === "base64" ? "base64" : "utf8") });
|
|
283
264
|
save(manifest);
|
|
284
265
|
changed();
|
|
285
266
|
return summary(inspect(id));
|
|
@@ -314,11 +295,6 @@ export function createDraftController(directory, { edits, startPreview, prewarm
|
|
|
314
295
|
for (const dependency of proposal.dependencies) overlay(dependency);
|
|
315
296
|
for (const file of proposal.changes) {
|
|
316
297
|
const digest = fileHash(file.content);
|
|
317
|
-
if (isDraftExportEntry(file.target, loadConfig(root)) && file.content !== null) {
|
|
318
|
-
const merged = mergeDraftExports(desired.get(file.target)?.toString() ?? "", file.content.toString(), bytes(safe(root,file.target))?.toString() ?? "", file.target, loadConfig(root), proposal.manifest.units);
|
|
319
|
-
desired.set(file.target,Buffer.from(merged.content));
|
|
320
|
-
continue;
|
|
321
|
-
}
|
|
322
298
|
if (applied.has(file.target) && applied.get(file.target) !== digest) throw new Error(`Drafts both change ${file.target}; use one coupled draft for overlapping edits.`);
|
|
323
299
|
applied.set(file.target, digest);
|
|
324
300
|
if (file.content === null) desired.delete(file.target); else desired.set(file.target, file.content);
|
|
@@ -328,8 +304,9 @@ export function createDraftController(directory, { edits, startPreview, prewarm
|
|
|
328
304
|
for (const target of session.inputs.keys()) if (!desired.has(target)) rmSync(safe(session.workspace, target), { force: true });
|
|
329
305
|
for (const [target, content] of desired) if (session.inputs.get(target) !== hash(content) || !existsSync(safe(session.workspace,target))) atomic(safe(session.workspace, target), content);
|
|
330
306
|
session.inputs = new Map([...desired].map(([target, content]) => [target, hash(content)]));
|
|
331
|
-
// A draft's token edits preview with their own generated theme sheet.
|
|
307
|
+
// A draft's token edits preview with their own generated theme sheet, and its exports files and token sheets with their own generated entries.
|
|
332
308
|
try { const draftOptions = loadConfig(session.workspace); writeThemesCss(draftOptions, inspectTokens(session.workspace, draftOptions)); } catch { /* Acceptance checks report broken token sheets. */ }
|
|
309
|
+
try { writeGeneratedEntries(loadConfig(session.workspace)); } catch { /* Acceptance checks report broken exports files. */ }
|
|
333
310
|
const modules = path.join(session.workspace, "node_modules");
|
|
334
311
|
if (!existsSync(modules) && existsSync(path.join(root, "node_modules"))) symlinkSync(realpathSync(path.join(root, "node_modules")), modules, process.platform === "win32" ? "junction" : "dir");
|
|
335
312
|
if (!existsSync(path.join(session.workspace, "dist")) && existsSync(path.join(root, "dist/cli.mjs"))) {
|
|
@@ -350,17 +327,21 @@ export function createDraftController(directory, { edits, startPreview, prewarm
|
|
|
350
327
|
let file=target==="installed-dependencies"?path.join(root,"node_modules/.package-lock.json"):path.join(root,target);
|
|
351
328
|
while(isInside(root,file)){watched.add(file);if(file===root)break;file=path.dirname(file);}
|
|
352
329
|
}
|
|
353
|
-
session.watchFiles=[...watched];session.
|
|
330
|
+
session.watchFiles=[...watched];session.ownObserved=ownStamp(id);session.acceptedObserved=watchStamp(session);
|
|
354
331
|
return { ...value, session };
|
|
355
332
|
}
|
|
356
|
-
async function show(
|
|
333
|
+
async function show(args, signal) {
|
|
334
|
+
++showing;
|
|
335
|
+
try { return await showDraft(args, signal); } finally { --showing; }
|
|
336
|
+
}
|
|
337
|
+
async function showDraft({ id, scenario }, signal) {
|
|
357
338
|
if (signal?.aborted) throw new Error("Draft preview request cancelled.");
|
|
358
339
|
if (closed) throw new Error("Draft controller is closed.");
|
|
359
340
|
const existing=previews.get(id);
|
|
360
341
|
if(existing&&(existing.recovering||!existsSync(path.join(existing.workspace,".ds/draft-preview.json"))))await retire(id);
|
|
361
342
|
if(!previews.has(id)&&[...previews.values()].filter(session=>session.starting).length>=4){const oldest=[...previews].find(([,session])=>session.starting);if(oldest)await retire(oldest[0]);}
|
|
362
343
|
const value = prepare(id), { session } = value;
|
|
363
|
-
session.opened = true;
|
|
344
|
+
session.opened = true; lastShown = id;
|
|
364
345
|
const options = loadConfig(session.workspace), units = inspectUnits(options);
|
|
365
346
|
const metadata = discovery.refresh(session.workspace, value.revision);
|
|
366
347
|
let registry = metadata.registry;
|
|
@@ -402,7 +383,7 @@ export function createDraftController(directory, { edits, startPreview, prewarm
|
|
|
402
383
|
if (oldest) await retire(oldest[0]);
|
|
403
384
|
}
|
|
404
385
|
if (closed || previews.get(id) !== session) throw new Error("Draft preview was closed before startup.");
|
|
405
|
-
const runtime = await startPreview(session.workspace);
|
|
386
|
+
const runtime = await startPreview(session.workspace, id);
|
|
406
387
|
if (closed || previews.get(id) !== session) { await runtime.close(); throw new Error("Draft preview startup was cancelled."); }
|
|
407
388
|
session.unsubscribeBuild = runtime.onBuildChange?.(report => recordBuild(id, session, report));
|
|
408
389
|
return session.runtime = runtime;
|
|
@@ -413,7 +394,11 @@ export function createDraftController(directory, { edits, startPreview, prewarm
|
|
|
413
394
|
const session=previews.get(id),workspace=path.join(previewDirectory(id),"project");
|
|
414
395
|
previews.delete(id);discovery.remove(workspace);
|
|
415
396
|
if(session){try{await session.starting;}catch{/* Failed startup remains disposable. */}session.unsubscribeBuild?.();await session.runtime?.close();}
|
|
416
|
-
if(
|
|
397
|
+
if(previews.has(id))return;
|
|
398
|
+
// Move the workspace aside in one step: a compiler instance still stopping sees its root gone, not half-deleted.
|
|
399
|
+
const directory=path.dirname(workspace),retired=`${directory}.retired-${randomUUID()}`;
|
|
400
|
+
try{renameSync(directory,retired);}catch{rmSync(directory,{recursive:true,force:true});return;}
|
|
401
|
+
rmSync(retired,{recursive:true,force:true});
|
|
417
402
|
}
|
|
418
403
|
function queuePrewarm(id) {
|
|
419
404
|
if (!prewarm || !startPreview || !loadConfig(root).config.mcp.previewWatch) return;
|
|
@@ -444,30 +429,36 @@ export function createDraftController(directory, { edits, startPreview, prewarm
|
|
|
444
429
|
rmSync(path.dirname(manifestFile(id)), { recursive: true });
|
|
445
430
|
return { dropped: true, event: event(id, revision, "dropped") };
|
|
446
431
|
}
|
|
447
|
-
async function accept({ id, revision }, signal, progress) {
|
|
432
|
+
async function accept({ id, revision, dryRun = false }, signal, progress) {
|
|
448
433
|
if (closed || active) throw new Error("Wait for the active acceptance, or reopen ADS.");
|
|
449
434
|
const value = inspect(id);
|
|
450
435
|
if(value.dependencyErrors.length)throw new Error(`Draft dependency error: ${value.dependencyErrors[0].message}`);
|
|
451
436
|
if (value.revision !== revision) throw new Error("Draft revision changed. Review the current draft before accepting.");
|
|
452
437
|
if (value.dependencies.length) throw new Error("Accept dependency drafts first. Dependent previews will automatically use their accepted implementations.");
|
|
453
|
-
if (value.conflicts.length) throw new Error(`Draft baseline conflict: ${value.conflicts.join(", ")}
|
|
438
|
+
if (value.conflicts.length) throw new Error(`Draft baseline conflict: accepted source changed outside this draft (${value.conflicts.join(", ")}). Drop the draft and create a new one from current source.`);
|
|
454
439
|
if (!value.changes.length) throw new Error("The draft has no changes to accept. Drop it instead.");
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
440
|
+
// The engine receives each owner's proposed files as they are: text as strings, binary as bytes.
|
|
441
|
+
const groups = new Map(), add = (unit, file) => groups.set(unit, [...(groups.get(unit) ?? []), file]);
|
|
442
|
+
const proposal = content => content === null || content.includes(0) || !Buffer.from(content.toString("utf8")).equals(content) ? content : content.toString("utf8");
|
|
443
|
+
for (const file of value.changes) add(file.unit, {path:file.target,content:proposal(file.content)});
|
|
444
|
+
const plans = value.manifest.units.filter(unit=>groups.has(unit)).map(unit => ({ unit, files: groups.get(unit) }));
|
|
445
|
+
// Check and render in the draft's preview workspace, served by the project's own host and
|
|
446
|
+
// compiler; a controller without previews lets the engine check its own copy.
|
|
447
|
+
let checkRoot, previewHost;
|
|
448
|
+
if (startPreview) {
|
|
449
|
+
try {
|
|
450
|
+
const { session } = prepare(id);
|
|
451
|
+
if (session.revision === revision) { previewHost = await startSession(id, session); checkRoot = session.workspace; }
|
|
452
|
+
} catch { checkRoot = previewHost = undefined; }
|
|
462
453
|
}
|
|
463
|
-
const plans = value.manifest.units.filter(unit=>groups.has(unit)).map(unit => ({ unit, ...storePreparedPatch(loadConfig(root), groups.get(unit)) })).map(({unit, patchFile}) => ({unit, patchFile}));
|
|
464
454
|
const originals = new Map(value.changes.map(file => [file.target,bytes(safe(root,file.target))]));
|
|
465
455
|
const abort = new AbortController();
|
|
466
|
-
active = { id, abort }; event(id, revision, "checking");
|
|
456
|
+
active = { id, abort }; if (!dryRun) event(id, revision, "checking");
|
|
467
457
|
try {
|
|
468
|
-
const result = await edits.apply(plans.length === 1 ? plans[0] : {patches: plans}, signal ? AbortSignal.any([signal, abort.signal]) : abort.signal, progress, { beforeApply() {
|
|
458
|
+
const result = await edits.apply({...(plans.length === 1 ? plans[0] : {patches: plans}), dryRun, ...(checkRoot ? { checkRoot, previewHost } : {})}, signal ? AbortSignal.any([signal, abort.signal]) : abort.signal, progress, { beforeApply() {
|
|
469
459
|
if (inspect(id).revision !== revision) throw new Error("Draft changed during acceptance; no changes were applied. Review and accept the new revision.");
|
|
470
460
|
} });
|
|
461
|
+
if (dryRun) return { ...result, draft: id, revision, dryRun: true, next: result.ok ? "Every acceptance check passed on this revision; nothing was written. Accept it with ads_accept and the same revision." : "Acceptance would fail. Fix the draft, then check again." };
|
|
471
462
|
let outcome;
|
|
472
463
|
try{outcome=event(id, revision, result.applied ? "applied" : "failed", { diagnostics: result.diagnostics?.slice(0,3) });}
|
|
473
464
|
catch(error){if(!result.applied)throw error;result.warnings=[...(result.warnings??[]),{rule:"draft-event",message:`Source applied; event storage needs recovery: ${error.message}`}];}
|
|
@@ -480,11 +471,7 @@ export function createDraftController(directory, { edits, startPreview, prewarm
|
|
|
480
471
|
for(const file of manifest.files)if(originals.has(file.target)&&file.baseline===fileHash(originals.get(file.target))){
|
|
481
472
|
const accepted=bytes(safe(root,file.target)),source=file.source?bytes(safe(path.dirname(manifestFile(dependent)),file.source)):null;
|
|
482
473
|
if(fileHash(source)===file.baseline){file.baseline=fileHash(accepted);if(file.source&&accepted)atomic(safe(path.dirname(manifestFile(dependent)),file.source),accepted);}
|
|
483
|
-
else if(source&&accepted&&isDraftExportEntry(file.target,loadConfig(root))){
|
|
484
|
-
try{const merged=mergeDraftExports(accepted.toString(),source.toString(),originals.get(file.target)?.toString()??"",file.target,loadConfig(root),manifest.units);atomic(safe(path.dirname(manifestFile(dependent)),file.source),merged.content);file.baseline=fileHash(accepted);}catch{/* An overlapping edit remains an explicit baseline conflict. */}
|
|
485
|
-
}
|
|
486
474
|
}
|
|
487
|
-
for(const file of manifest.files)if(file.base){const accepted=bytes(safe(root,file.target));if(accepted!==null&&fileHash(accepted)===file.baseline)atomic(safe(path.dirname(manifestFile(dependent)),file.base),accepted);}
|
|
488
475
|
manifest.dependencies = manifest.dependencies.filter(dependency => dependency !== id); save(manifest); updated.push(dependent);
|
|
489
476
|
}
|
|
490
477
|
}catch(error){result.warnings=[...(result.warnings??[]),{rule:"draft-dependency",message:`Source applied; dependent ${dependent} needs recovery: ${error.message}`}];}
|
|
@@ -502,12 +489,39 @@ export function createDraftController(directory, { edits, startPreview, prewarm
|
|
|
502
489
|
walk(storage);if(existsSync(eventFile))rows.push(bytes(eventFile)?.toString());return hash(JSON.stringify(rows));
|
|
503
490
|
}
|
|
504
491
|
function watchStamp(session){return hash(JSON.stringify((session.watchFiles??[]).map(file=>{try{const stat=lstatSync(file);return[file,stat.mtimeMs,stat.ctimeMs,stat.ino,stat.size];}catch{return[file,null];}})));}
|
|
492
|
+
// A draft's own edits and the viewed draft resync at once. Other drafts behind an accepted-source
|
|
493
|
+
// change catch up in the background, one at a time, paused while a draft is being shown; their
|
|
494
|
+
// rebuilds run last in the compiler's queue.
|
|
495
|
+
function ownStamp(id){const rows=[];(function walk(folder){if(!existsSync(folder))return;for(const entry of readdirSync(folder,{withFileTypes:true})){const file=path.join(folder,entry.name);if(entry.isSymbolicLink())continue;if(entry.isDirectory())walk(file);else{const stat=lstatSync(file);rows.push([file,stat.mtimeMs,stat.size]);}}})(path.dirname(manifestFile(id)));return hash(JSON.stringify(rows));}
|
|
496
|
+
const backlog = new Set();
|
|
497
|
+
let backlogTimer, showing = 0;
|
|
498
|
+
function stale(id, session) {
|
|
499
|
+
let own; try { own = ownStamp(id); } catch { return null; }
|
|
500
|
+
return session.ownObserved !== own ? "own" : session.acceptedObserved !== watchStamp(session) ? "accepted" : null;
|
|
501
|
+
}
|
|
502
|
+
function resync(id) { try { prepare(id); } catch (error) { const session = previews.get(id); if (session) session.error = error.message; } }
|
|
505
503
|
function syncPreviews() {
|
|
506
|
-
|
|
507
|
-
for (const
|
|
508
|
-
|
|
509
|
-
|
|
504
|
+
const order = [...previews.keys()].sort((a, b) => (b === lastShown) - (a === lastShown));
|
|
505
|
+
for (const id of order) {
|
|
506
|
+
const reason = stale(id, previews.get(id));
|
|
507
|
+
if (!reason) continue;
|
|
508
|
+
if (reason === "own" || id === lastShown) { backlog.delete(id); resync(id); }
|
|
509
|
+
else backlog.add(id);
|
|
510
510
|
}
|
|
511
|
+
drainBacklog();
|
|
512
|
+
}
|
|
513
|
+
function drainBacklog() {
|
|
514
|
+
if (closed || backlogTimer || !backlog.size) return;
|
|
515
|
+
backlogTimer = setTimeout(() => {
|
|
516
|
+
backlogTimer = undefined;
|
|
517
|
+
if (closed) return;
|
|
518
|
+
if (showing) { drainBacklog(); return; }
|
|
519
|
+
const [id] = backlog; backlog.delete(id);
|
|
520
|
+
const session = previews.get(id);
|
|
521
|
+
if (session && stale(id, session)) resync(id);
|
|
522
|
+
drainBacklog();
|
|
523
|
+
}, 50);
|
|
524
|
+
backlogTimer.unref();
|
|
511
525
|
}
|
|
512
526
|
function changed() {
|
|
513
527
|
if (closed) return;
|
|
@@ -550,6 +564,7 @@ export function createDraftController(directory, { edits, startPreview, prewarm
|
|
|
550
564
|
timer.unref();
|
|
551
565
|
const generated=path.join(root,".ds/draft-previews");
|
|
552
566
|
if(existsSync(generated)&&realpathSync(generated)===generated)for(const entry of readdirSync(generated,{withFileTypes:true})){
|
|
567
|
+
if(entry.isDirectory()&&!entry.isSymbolicLink()&&/\.retired-[a-f0-9-]{36}$/.test(entry.name)){rmSync(path.join(generated,entry.name),{recursive:true,force:true});continue;}
|
|
553
568
|
if(entry.isDirectory()&&!entry.isSymbolicLink()&&idSchema.safeParse(entry.name).success&&!existsSync(manifestFile(entry.name)))rmSync(previewDirectory(entry.name),{recursive:true,force:true});
|
|
554
569
|
}
|
|
555
570
|
reconcileWatches();
|
|
@@ -579,6 +594,6 @@ export function createDraftController(directory, { edits, startPreview, prewarm
|
|
|
579
594
|
await session.starting;return session.runtime.readResource(uri,signal);
|
|
580
595
|
},
|
|
581
596
|
fingerprint:()=>`${draftStamp()}:${discoveryVersion}`,
|
|
582
|
-
async close() { closed = true; clearInterval(timer); clearTimeout(changeTimer); clearTimeout(prewarmTimer); pendingPrewarm = undefined; for (const { watcher } of watchers.values()) watcher.close(); watchers.clear(); active?.abort.abort(); await Promise.allSettled([discovery.close(), ...[...previews.keys()].map(retire)]); await prewarming; },
|
|
597
|
+
async close() { closed = true; clearInterval(timer); clearTimeout(backlogTimer); backlog.clear(); clearTimeout(changeTimer); clearTimeout(prewarmTimer); pendingPrewarm = undefined; for (const { watcher } of watchers.values()) watcher.close(); watchers.clear(); active?.abort.abort(); await Promise.allSettled([discovery.close(), ...[...previews.keys()].map(retire)]); await prewarming; },
|
|
583
598
|
};
|
|
584
599
|
}
|