@reqvire-org/ads 0.4.5 → 0.4.7
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/dist/behavior-libraries.mjs +13 -1
- package/dist/capture.mjs +1 -1
- package/dist/config.mjs +22 -8
- package/dist/init.mjs +3 -1
- package/dist/input-digests.mjs +270 -0
- package/dist/input-scope.mjs +57 -0
- package/dist/mcp/build-status.mjs +36 -5
- package/dist/mcp/compiler-channel.mjs +145 -0
- package/dist/mcp/drafts.mjs +49 -94
- package/dist/mcp/mutations.mjs +1 -1
- package/dist/mcp/preview-watch.mjs +140 -53
- package/dist/mcp/server.mjs +78 -43
- package/dist/mcp/showcase-host.mjs +2 -1
- package/dist/preview-bun.mjs +2 -2
- package/dist/preview-inputs.mjs +18 -4
- package/dist/resource-limits.mjs +25 -3
- package/dist/scenario-registry.mjs +2 -2
- package/dist/scenarios-compiler.mjs +119 -73
- package/dist/skills/ads-designer/references/behaviors.md +4 -2
- package/dist/skills/ads-import/references/behaviors.md +4 -2
- package/dist/skills/ads-migrate/SKILL.md +1 -0
- package/dist/skills/ads-migrate/references/0.4.6-to-0.4.7.md +46 -0
- package/dist/skills/ads-port/references/behaviors.md +4 -2
- package/dist/stage-timing.cjs +3 -2
- package/dist/validation-inputs.mjs +217 -26
- package/docs/ARCHITECTURE.md +50 -4
- package/docs/CHANGELOG.md +65 -76
- package/docs/GUIDE.md +8 -2
- package/package.json +1 -1
|
@@ -10,13 +10,14 @@ import { prepareScenarioRegistryTransfer, releaseScenarioRegistry } from "./scen
|
|
|
10
10
|
import { artifactDigest, createBuildReporter } from "./mcp/build-status.mjs";
|
|
11
11
|
import { cachedPreviewPublication, previewArtifactHtml, readPreviewManifest } from "./preview-resources.mjs";
|
|
12
12
|
import { previewArtifactPath, withPreviewSession } from "./preview-scope.mjs";
|
|
13
|
-
import { previewSourceRevision } from "./preview-inputs.mjs";
|
|
13
|
+
import { previewBuildRevision, previewSourceRevision } from "./preview-inputs.mjs";
|
|
14
14
|
import { queuePreviewRequests } from "./preview-requests.mjs";
|
|
15
|
-
import { previewFileIgnored
|
|
15
|
+
import { previewFileIgnored } from "./preview-files.mjs";
|
|
16
16
|
import { createScenarioInspector } from "./scenario-inspector.mjs";
|
|
17
17
|
import { analyze } from "./analysis/service.mjs";
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
18
|
+
import { ownedInputSet, registerInputDigests } from "./validation-inputs.mjs";
|
|
19
|
+
import { createInputDigests } from "./input-digests.mjs";
|
|
20
|
+
import { compilerChannel } from "./mcp/compiler-channel.mjs";
|
|
20
21
|
import { previewRuntimeFingerprint } from "./runtime-requirements.mjs";
|
|
21
22
|
import { architectureExternalInputs } from "./task-cache.mjs";
|
|
22
23
|
|
|
@@ -89,7 +90,7 @@ export function createPreviewCache(options, compilerFiles = []) {
|
|
|
89
90
|
reload();
|
|
90
91
|
async function inputs() {
|
|
91
92
|
const rows = [
|
|
92
|
-
["project-inputs", await
|
|
93
|
+
["project-inputs", await previewBuildRevision(options)],
|
|
93
94
|
["runtime", previewRuntimeFingerprint()],
|
|
94
95
|
["architecture-environment", { ...architectureExternalInputs(root), environment: launchEnvironment }],
|
|
95
96
|
];
|
|
@@ -122,34 +123,11 @@ export function createPreviewCache(options, compilerFiles = []) {
|
|
|
122
123
|
rmSync(temporary, { force: true });
|
|
123
124
|
}
|
|
124
125
|
}
|
|
125
|
-
async function compilerInputs() {
|
|
126
|
-
const configured = new Set([...(await configurationFiles(options))].filter((file) => !/^(?:biome|oxlint|\.oxlint)/.test(file)));
|
|
127
|
-
const packages = new Set([
|
|
128
|
-
"package-lock.json",
|
|
129
|
-
"npm-shrinkwrap.json",
|
|
130
|
-
"yarn.lock",
|
|
131
|
-
"pnpm-lock.yaml",
|
|
132
|
-
"bun.lock",
|
|
133
|
-
"bun.lockb",
|
|
134
|
-
"bunfig.toml",
|
|
135
|
-
".npmrc",
|
|
136
|
-
".yarnrc.yml",
|
|
137
|
-
"installed-dependencies",
|
|
138
|
-
]);
|
|
139
|
-
const opaque = (options.config.validation?.inputs ?? []).map((file) => path.resolve(root, file));
|
|
140
|
-
// Use the same declared configuration/input boundary as guarded copies.
|
|
141
|
-
// Unrelated local launcher JSON must not make a candidate unportable.
|
|
142
|
-
return Object.entries(await validationInputFiles(options))
|
|
143
|
-
.filter(([file]) => configured.has(file) || packages.has(file) || opaque.some((directory) => isInside(directory, path.resolve(root, file))))
|
|
144
|
-
.sort(([a], [b]) => a.localeCompare(b));
|
|
145
|
-
}
|
|
146
126
|
const compilerDigest = async () =>
|
|
147
127
|
digest(
|
|
148
128
|
JSON.stringify([
|
|
149
129
|
["adapter", adapterDigest()],
|
|
150
130
|
...compilerFiles.map((file) => [key(file), fileDigest(file)]),
|
|
151
|
-
...(await compilerInputs()),
|
|
152
|
-
["installed-packages", fileDigest(path.join(root, "node_modules/.package-lock.json"))],
|
|
153
131
|
["scheduler", fileDigest(import.meta.filename)],
|
|
154
132
|
["runtime", previewRuntimeFingerprint()],
|
|
155
133
|
]),
|
|
@@ -407,15 +385,11 @@ function createScheduler() {
|
|
|
407
385
|
* with the options setup(root) gives for its own root and a builder of its own. Compiler options
|
|
408
386
|
* fixed to one root cannot build a draft; each draft then reports that instead of waiting.
|
|
409
387
|
*/
|
|
410
|
-
async function hostDrafts(
|
|
388
|
+
async function hostDrafts(channel, setup, schedule) {
|
|
411
389
|
const instances = new Map();
|
|
390
|
+
let wanted = [],
|
|
391
|
+
reconciling = Promise.resolve();
|
|
412
392
|
async function reconcile() {
|
|
413
|
-
let wanted = [];
|
|
414
|
-
try {
|
|
415
|
-
wanted = JSON.parse(readFileSync(file, "utf8")).drafts ?? [];
|
|
416
|
-
} catch {
|
|
417
|
-
/* No drafts yet. */
|
|
418
|
-
}
|
|
419
393
|
const sessions = new Set(wanted.map((entry) => entry.session));
|
|
420
394
|
for (const [session, instance] of instances)
|
|
421
395
|
if (!sessions.has(session)) {
|
|
@@ -424,10 +398,10 @@ async function hostDrafts(file, setup, schedule) {
|
|
|
424
398
|
}
|
|
425
399
|
for (const entry of wanted) {
|
|
426
400
|
if (instances.has(entry.session) || !isDraftPreviewWorkspace(entry.root)) continue;
|
|
427
|
-
const context = { session: entry.session,
|
|
401
|
+
const context = { session: entry.session, prewarm: false, schedule: schedule("draft") };
|
|
428
402
|
if (!setup) {
|
|
429
403
|
instances.set(entry.session, Promise.resolve(null));
|
|
430
|
-
createBuildReporter(entry.root, { apps: [], session: entry.session
|
|
404
|
+
createBuildReporter(entry.root, { apps: [], session: entry.session }).failure(
|
|
431
405
|
scopedPreviewFailure(
|
|
432
406
|
new Error(
|
|
433
407
|
"This project's preview compiler passes runScenarioCompiler options for one root, so it cannot build drafts. Pass a function of the root that returns the options instead.",
|
|
@@ -447,18 +421,15 @@ async function hostDrafts(file, setup, schedule) {
|
|
|
447
421
|
);
|
|
448
422
|
}
|
|
449
423
|
}
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
clearTimeout(timer);
|
|
455
|
-
timer = setTimeout(async () => void (await reconcile()), 16);
|
|
456
|
-
}
|
|
424
|
+
// The MCP watcher sends the current draft list (and replays it after a reconnect).
|
|
425
|
+
const off = channel.on("drafts", (message) => {
|
|
426
|
+
wanted = (Array.isArray(message.drafts) ? message.drafts : []).filter((entry) => typeof entry?.root === "string" && typeof entry?.session === "string");
|
|
427
|
+
reconciling = reconciling.then(reconcile, reconcile);
|
|
457
428
|
});
|
|
458
429
|
return {
|
|
459
430
|
async stop() {
|
|
460
|
-
|
|
461
|
-
|
|
431
|
+
off();
|
|
432
|
+
await reconciling.catch(() => {});
|
|
462
433
|
for (const instance of instances.values()) (await instance)?.stop();
|
|
463
434
|
instances.clear();
|
|
464
435
|
},
|
|
@@ -482,13 +453,13 @@ export async function runScenarioCompiler(directory, setup) {
|
|
|
482
453
|
await buildGraph.close?.();
|
|
483
454
|
return { async stop() {} };
|
|
484
455
|
}
|
|
485
|
-
|
|
486
|
-
|
|
456
|
+
// An MCP-managed compiler talks to its watcher over one channel; the project
|
|
457
|
+
// instance also hosts that watcher's draft instances in this process.
|
|
458
|
+
const channel = watched ? compilerChannel() : null;
|
|
459
|
+
const hosting = !!channel && !context.session;
|
|
487
460
|
const scheduler = hosting ? createScheduler() : null;
|
|
488
461
|
const {
|
|
489
462
|
session: buildSession = process.env.ADS_MCP_BUILD_SESSION,
|
|
490
|
-
requestFile = process.env.ADS_MCP_REQUEST_FILE,
|
|
491
|
-
statusFile = process.env.ADS_MCP_BUILD_STATUS,
|
|
492
463
|
prewarm: prewarmViews = process.env.ADS_MCP_PREWARM_VIEWS === "1",
|
|
493
464
|
schedule = scheduler ? scheduler("project") : (run) => run(),
|
|
494
465
|
} = context;
|
|
@@ -522,7 +493,6 @@ export async function runScenarioCompiler(directory, setup) {
|
|
|
522
493
|
const reporter = createBuildReporter(root, {
|
|
523
494
|
apps: buildApps(),
|
|
524
495
|
...(buildSession ? { session: buildSession } : {}),
|
|
525
|
-
...(statusFile ? { file: statusFile } : {}),
|
|
526
496
|
});
|
|
527
497
|
const requested = new Set();
|
|
528
498
|
const pending = new Set();
|
|
@@ -671,7 +641,7 @@ export async function runScenarioCompiler(directory, setup) {
|
|
|
671
641
|
reusable = false;
|
|
672
642
|
}
|
|
673
643
|
}
|
|
674
|
-
const outcomes = await checkedBuild(stamp, async () => (reusable ? null : await buildGraph(entries, options, track, { watched: false, sourceRevision })));
|
|
644
|
+
const outcomes = await checkedBuild(stamp, async () => (reusable ? null : await buildGraph(entries, options, track, { watched: false, sourceRevision: await previewBuildRevision(options) })));
|
|
675
645
|
const failure = outcomes.find((outcome) => outcome.status === "rejected");
|
|
676
646
|
if (failure) throw failure.reason;
|
|
677
647
|
cache.assertCompiler();
|
|
@@ -778,7 +748,7 @@ export async function runScenarioCompiler(directory, setup) {
|
|
|
778
748
|
candidate.reused = true;
|
|
779
749
|
return cached;
|
|
780
750
|
}
|
|
781
|
-
return buildGraph(candidate.entries, options, track, { watched: true, sourceRevision });
|
|
751
|
+
return buildGraph(candidate.entries, options, track, { watched: true, sourceRevision: await previewBuildRevision(options) });
|
|
782
752
|
});
|
|
783
753
|
liveCandidate = candidate;
|
|
784
754
|
try {
|
|
@@ -924,10 +894,7 @@ export async function runScenarioCompiler(directory, setup) {
|
|
|
924
894
|
releaseScenarioRegistry(root);
|
|
925
895
|
}
|
|
926
896
|
completedFull = token;
|
|
927
|
-
|
|
928
|
-
temporary = `${file}.tmp`;
|
|
929
|
-
writeFileSync(temporary, JSON.stringify({ token, ok: !!ok, sourceRevision }));
|
|
930
|
-
renameSync(temporary, file);
|
|
897
|
+
channel?.send({ type: "full-build", session: reporter.session, token, ok: !!ok, sourceRevision });
|
|
931
898
|
continue;
|
|
932
899
|
}
|
|
933
900
|
if (registryFailure) break;
|
|
@@ -1002,12 +969,13 @@ export async function runScenarioCompiler(directory, setup) {
|
|
|
1002
969
|
discovering = undefined;
|
|
1003
970
|
});
|
|
1004
971
|
}
|
|
972
|
+
// The watcher's latest preview request for this session (replayed on reconnect).
|
|
973
|
+
let latestRequest;
|
|
1005
974
|
async function request(startBuild = true) {
|
|
1006
|
-
const
|
|
1007
|
-
if (!
|
|
975
|
+
const value = latestRequest;
|
|
976
|
+
if (!value) return;
|
|
1008
977
|
try {
|
|
1009
|
-
|
|
1010
|
-
if (value.session !== buildSession) return;
|
|
978
|
+
if (value.session !== buildSession || !Array.isArray(value.files)) return;
|
|
1011
979
|
if (typeof value.full === "string" && /^[\w-]{1,100}$/.test(value.full)) fullRequest = value.full;
|
|
1012
980
|
if (value.invalidation !== invalidation) {
|
|
1013
981
|
invalidation = value.invalidation;
|
|
@@ -1034,7 +1002,39 @@ export async function runScenarioCompiler(directory, setup) {
|
|
|
1034
1002
|
}
|
|
1035
1003
|
let timer;
|
|
1036
1004
|
const changed = new Set();
|
|
1037
|
-
|
|
1005
|
+
// This process's watchers feed one digest map; every revision read here
|
|
1006
|
+
// (including the reconcile check) answers from it instead of walking again.
|
|
1007
|
+
// Build reports and compile cache keys both derive from the ADS-owned inputs,
|
|
1008
|
+
// exactly as the MCP server checks them.
|
|
1009
|
+
// This compiler owns the digest map of ADS-owned inputs. It sends each changed map
|
|
1010
|
+
// to its MCP watcher (same session), so reports and status checks share one view.
|
|
1011
|
+
const publishDigests = (digests) => {
|
|
1012
|
+
if (!stopped) channel?.send({ type: "digests", session: reporter.session, key: ownedInputSet(root).key(loadConfig(root)), digests });
|
|
1013
|
+
};
|
|
1014
|
+
// An event makes the map provisional at once; the watcher then reports no build as
|
|
1015
|
+
// current until this process has re-read the files and published the new map.
|
|
1016
|
+
let settleTimer;
|
|
1017
|
+
const pendingDigests = () => {
|
|
1018
|
+
if (stopped) return;
|
|
1019
|
+
channel?.send({ type: "digests-pending", session: reporter.session });
|
|
1020
|
+
clearTimeout(settleTimer);
|
|
1021
|
+
settleTimer = setTimeout(() => void digestMaps[0][0].current().catch((error) => failure(error)), 16);
|
|
1022
|
+
settleTimer.unref?.();
|
|
1023
|
+
};
|
|
1024
|
+
const digestMaps = [
|
|
1025
|
+
[
|
|
1026
|
+
createInputDigests(root, ownedInputSet(root), { watchFiles: false, onError: (error) => console.error(error), onUpdate: publishDigests, onPending: pendingDigests }),
|
|
1027
|
+
"owned",
|
|
1028
|
+
],
|
|
1029
|
+
];
|
|
1030
|
+
const unregisterDigests = digestMaps.map(([map, set]) => registerInputDigests(map, { set, unscoped: true }));
|
|
1031
|
+
const inputDigests = {
|
|
1032
|
+
notify: (...args) => digestMaps.forEach(([map]) => map.notify(...args)),
|
|
1033
|
+
invalidate: () => digestMaps.forEach(([map]) => map.invalidate()),
|
|
1034
|
+
close: () => digestMaps.forEach(([map]) => map.close()),
|
|
1035
|
+
};
|
|
1036
|
+
function sourceChanged(event, file, topology = false) {
|
|
1037
|
+
inputDigests.notify(file ?? null, event === "rename" || topology ? "rename" : "change");
|
|
1038
1038
|
if (!file || (!topology && !/\.(?:[cm]?[jt]sx?|css|html|json|md|svg|png|jpe?g|webp|gif|woff2?|ttf|otf|lock|lockb)$/.test(file))) return;
|
|
1039
1039
|
const absolute = path.join(root, file);
|
|
1040
1040
|
if (previewFileIgnored(options, absolute)) return;
|
|
@@ -1093,6 +1093,7 @@ export async function runScenarioCompiler(directory, setup) {
|
|
|
1093
1093
|
watcher.on("error", async (error) => {
|
|
1094
1094
|
watcher.close();
|
|
1095
1095
|
if (watchers.get(directory)?.watcher === watcher) watchers.delete(directory);
|
|
1096
|
+
inputDigests.invalidate(); // Events may have been missed: walk again.
|
|
1096
1097
|
await failure(error);
|
|
1097
1098
|
});
|
|
1098
1099
|
return true;
|
|
@@ -1101,32 +1102,73 @@ export async function runScenarioCompiler(directory, setup) {
|
|
|
1101
1102
|
}
|
|
1102
1103
|
}
|
|
1103
1104
|
async function reconcileWatches(initial = false) {
|
|
1104
|
-
|
|
1105
|
+
// Draft workspaces change only through MCP, which sends their changed files
|
|
1106
|
+
// over the channel; they need no watchers.
|
|
1107
|
+
if (stopped || draftWorkspace) return;
|
|
1105
1108
|
try {
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1109
|
+
// Only ADS-owned inputs: ds.config.json and the folders it declares (plus
|
|
1110
|
+
// ADS's own .ds). A replaced config file gets a new identity and a new watch.
|
|
1111
|
+
const configFile = path.join(root, "ds.config.json");
|
|
1112
|
+
const wanted = new Set();
|
|
1113
|
+
if (existsSync(configFile)) {
|
|
1114
|
+
wanted.add(configFile);
|
|
1115
|
+
await addWatch(configFile, (event) => sourceChanged(event, "ds.config.json", event === "rename"));
|
|
1116
|
+
}
|
|
1117
|
+
// The compiler's own declared files (its command and adapters) restart it when they change.
|
|
1118
|
+
for (const file of compilerFiles.map((file) => path.resolve(file)))
|
|
1119
|
+
if (isInside(root, file) && existsSync(file) && !previewFileIgnored(options, file)) {
|
|
1120
|
+
wanted.add(file);
|
|
1121
|
+
await addWatch(file, (event) => sourceChanged(event, path.relative(root, file), true));
|
|
1122
|
+
}
|
|
1123
|
+
for (const directory of ownedInputSet(root).directories(options)) {
|
|
1124
|
+
if (directory === configFile) continue;
|
|
1110
1125
|
wanted.add(directory);
|
|
1111
1126
|
const relative = path.relative(root, directory);
|
|
1112
1127
|
if ((await addWatch(directory, (event, file, topology) => sourceChanged(event, file && path.join(relative, file), topology))) && !initial)
|
|
1113
1128
|
sourceChanged("rename", relative, true);
|
|
1114
1129
|
}
|
|
1115
|
-
mkdirSync(path.join(root, ".ds"), { recursive: true });
|
|
1116
|
-
await addWatch(path.join(root, ".ds"), async (_event, file) => {
|
|
1117
|
-
if (file === path.basename(requestFile ?? "")) await request();
|
|
1118
|
-
});
|
|
1119
1130
|
for (const [directory, { watcher }] of watchers)
|
|
1120
1131
|
if (!wanted.has(directory) || !existsSync(directory)) {
|
|
1121
1132
|
watcher.close();
|
|
1122
1133
|
watchers.delete(directory);
|
|
1123
|
-
if (!initial && directory !==
|
|
1134
|
+
if (!initial && directory !== configFile && !compilerFiles.some((file) => path.resolve(file) === directory))
|
|
1135
|
+
sourceChanged("rename", path.relative(root, directory), true);
|
|
1124
1136
|
}
|
|
1125
1137
|
} catch (error) {
|
|
1126
1138
|
await failure(error);
|
|
1127
1139
|
}
|
|
1128
1140
|
}
|
|
1141
|
+
// Requests and (for drafts) MCP's change notices arrive over the channel.
|
|
1142
|
+
const channelHandlers = channel
|
|
1143
|
+
? [
|
|
1144
|
+
channel.on("request", (message) => {
|
|
1145
|
+
if (message.session !== buildSession || !message.value || typeof message.value !== "object") return;
|
|
1146
|
+
latestRequest = message.value;
|
|
1147
|
+
void request();
|
|
1148
|
+
}),
|
|
1149
|
+
// A reader asks for the map as of now: process every event already delivered
|
|
1150
|
+
// (re-reading those files), then answer, even if nothing changed.
|
|
1151
|
+
channel.on("digests-flush", async (message) => {
|
|
1152
|
+
if (message.session !== buildSession || typeof message.id !== "string") return;
|
|
1153
|
+
try {
|
|
1154
|
+
await new Promise((resolve) => setImmediate(resolve));
|
|
1155
|
+
await new Promise((resolve) => setImmediate(resolve));
|
|
1156
|
+
const digests = await digestMaps[0][0].current();
|
|
1157
|
+
channel.send({ type: "digests", session: buildSession, key: ownedInputSet(root).key(loadConfig(root)), digests, flush: message.id });
|
|
1158
|
+
} catch (error) {
|
|
1159
|
+
channel.send({ type: "digests-flush-failed", session: buildSession, id: message.id, message: error.message });
|
|
1160
|
+
}
|
|
1161
|
+
}),
|
|
1162
|
+
channel.on("draft-changes", (message) => {
|
|
1163
|
+
if (message.session !== buildSession || !Array.isArray(message.files)) return;
|
|
1164
|
+
for (const change of message.files)
|
|
1165
|
+
if (typeof change?.path === "string") sourceChanged(change.kind === "rename" ? "rename" : "change", change.path, change.kind === "rename");
|
|
1166
|
+
}),
|
|
1167
|
+
]
|
|
1168
|
+
: [];
|
|
1129
1169
|
await reconcileWatches(true);
|
|
1170
|
+
// Publish the first map before any request reads it.
|
|
1171
|
+
await digestMaps[0][0].current().catch((error) => failure(error));
|
|
1130
1172
|
const reconcileTimer = setInterval(async () => {
|
|
1131
1173
|
// A retired draft workspace disappears before its host stops this instance.
|
|
1132
1174
|
if (!existsSync(root)) {
|
|
@@ -1148,13 +1190,17 @@ export async function runScenarioCompiler(directory, setup) {
|
|
|
1148
1190
|
await request();
|
|
1149
1191
|
if (prewarm) void drain();
|
|
1150
1192
|
console.log(`Scenario compiler ready: ${entries.length} entries; ${prewarm ? "sequential background warming enabled" : "builds are requested on demand"}.`);
|
|
1151
|
-
const drafts = hosting ? await hostDrafts(
|
|
1193
|
+
const drafts = hosting ? await hostDrafts(channel, typeof setup === "function" ? setup : null, scheduler) : null;
|
|
1152
1194
|
handle = {
|
|
1153
1195
|
async stop() {
|
|
1154
1196
|
if (stopped) return;
|
|
1155
1197
|
stopped = true;
|
|
1156
1198
|
clearTimeout(timer);
|
|
1157
1199
|
clearInterval(reconcileTimer);
|
|
1200
|
+
for (const unregister of unregisterDigests) unregister();
|
|
1201
|
+
clearTimeout(settleTimer);
|
|
1202
|
+
inputDigests.close();
|
|
1203
|
+
for (const off of channelHandlers) off();
|
|
1158
1204
|
for (const { watcher } of watchers.values()) watcher.close();
|
|
1159
1205
|
void (await drafts?.stop());
|
|
1160
1206
|
void (await inspector?.close());
|
|
@@ -23,8 +23,10 @@ style writes retain the exact properties declared in the owner contract's
|
|
|
23
23
|
`styles.writes`; they do not allow
|
|
24
24
|
shared-token overrides or an extra styling layer.
|
|
25
25
|
Projects explicitly approve installed runtime packages through
|
|
26
|
-
`behaviorLibraries` in `ds.config.json
|
|
27
|
-
|
|
26
|
+
`behaviorLibraries` in `ds.config.json`, pinned to the exact installed version
|
|
27
|
+
(`"tabbable@6.2.0"`); each must also be a `package.json` dependency. Pin the
|
|
28
|
+
`framework` the same way (`"preact@10.27.2"`) and update a pin together with the
|
|
29
|
+
upgrade; `ads check` reports a pin that differs from the installed version. Components, patterns and controllers may use them directly, including
|
|
28
30
|
package subpaths. Extract a shared controller when behavior is shared. Type-only
|
|
29
31
|
and development-role imports retain their existing rules. An empty/missing list
|
|
30
32
|
allows no additional runtime packages beyond the configured framework and Linaria.
|
|
@@ -23,8 +23,10 @@ style writes retain the exact properties declared in the owner contract's
|
|
|
23
23
|
`styles.writes`; they do not allow
|
|
24
24
|
shared-token overrides or an extra styling layer.
|
|
25
25
|
Projects explicitly approve installed runtime packages through
|
|
26
|
-
`behaviorLibraries` in `ds.config.json
|
|
27
|
-
|
|
26
|
+
`behaviorLibraries` in `ds.config.json`, pinned to the exact installed version
|
|
27
|
+
(`"tabbable@6.2.0"`); each must also be a `package.json` dependency. Pin the
|
|
28
|
+
`framework` the same way (`"preact@10.27.2"`) and update a pin together with the
|
|
29
|
+
upgrade; `ads check` reports a pin that differs from the installed version. Components, patterns and controllers may use them directly, including
|
|
28
30
|
package subpaths. Extract a shared controller when behavior is shared. Type-only
|
|
29
31
|
and development-role imports retain their existing rules. An empty/missing list
|
|
30
32
|
allows no additional runtime packages beyond the configured framework and Linaria.
|
|
@@ -56,3 +56,4 @@ Load only the guide(s) for the requested transition.
|
|
|
56
56
|
| 0.4.1 | 0.4.2 | [Showcase, review boundaries and preview migration](references/0.4.1-to-0.4.2.md) |
|
|
57
57
|
| 0.4.3 | 0.4.4 | [Incremental previews and manifest reuse](references/0.4.3-to-0.4.4.md) |
|
|
58
58
|
| 0.4.4 | 0.4.5 | [HTTP showcase delivery and reconnect behavior](references/0.4.4-to-0.4.5.md) |
|
|
59
|
+
| 0.4.5 or 0.4.6 | 0.4.7 | [Pinned package versions and ADS-owned preview inputs](references/0.4.6-to-0.4.7.md) |
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# ADS 0.4.6 → 0.4.7
|
|
2
|
+
|
|
3
|
+
Confirm the target version in the installed package or registry. This guide also
|
|
4
|
+
accompanies a local release candidate and does not establish publication.
|
|
5
|
+
0.4.5 → 0.4.6 needs no project change; apply this guide from either version.
|
|
6
|
+
|
|
7
|
+
## Pin package versions in `ds.config.json`
|
|
8
|
+
|
|
9
|
+
ADS now decides preview freshness and compiled-preview reuse from the files it owns:
|
|
10
|
+
`ds.config.json`, the design-system folder and the public folders it declares. It no
|
|
11
|
+
longer reads the project's lockfiles, `tsconfig.json`, `src/` or `node_modules` to
|
|
12
|
+
notice a dependency upgrade. The configuration pins are how an upgrade reaches previews.
|
|
13
|
+
|
|
14
|
+
1. Read the installed version of the framework package (`react` or `preact`) and of
|
|
15
|
+
every `behaviorLibraries` entry from the project's own dependency manifest or
|
|
16
|
+
lockfile.
|
|
17
|
+
2. Write each as `name@version` with the exact version:
|
|
18
|
+
|
|
19
|
+
```json
|
|
20
|
+
{
|
|
21
|
+
"framework": "preact@10.27.2",
|
|
22
|
+
"behaviorLibraries": ["elkjs@0.9.3", "minisearch@7.1.2"]
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Only exact versions are accepted (no ranges, tags or wildcards). Unpinned names
|
|
27
|
+
keep working, but then an upgrade of that package does not invalidate previews.
|
|
28
|
+
3. Run `ads check`. `behavior-library-version` reports a pin that differs from the
|
|
29
|
+
installed version. When the project later upgrades a pinned package, update its
|
|
30
|
+
pin in the same change.
|
|
31
|
+
|
|
32
|
+
## Keep preview inputs inside the design system
|
|
33
|
+
|
|
34
|
+
A change outside the owned folders no longer marks previews stale. If a scenario,
|
|
35
|
+
fixture or owner imports a file from `src/` or another project folder, move that
|
|
36
|
+
code into the design system (or a declared public folder). Otherwise edits there
|
|
37
|
+
reach previews only when the compiler rebuilds for another reason.
|
|
38
|
+
|
|
39
|
+
## What else changes
|
|
40
|
+
|
|
41
|
+
- Repeated preview, explorer and build reads, and an idle showcase, read no project
|
|
42
|
+
files: watched sessions keep an in-memory digest of the owned inputs and re-read only
|
|
43
|
+
files that an event names. A periodic full walk remains the safety net.
|
|
44
|
+
- On macOS the automatic memory limit counts memory the system can reclaim, and the
|
|
45
|
+
automatic limit is never below min(3 GiB, half of RAM). An explicit
|
|
46
|
+
`resources.memoryLimitMb` still replaces it.
|
|
@@ -23,8 +23,10 @@ style writes retain the exact properties declared in the owner contract's
|
|
|
23
23
|
`styles.writes`; they do not allow
|
|
24
24
|
shared-token overrides or an extra styling layer.
|
|
25
25
|
Projects explicitly approve installed runtime packages through
|
|
26
|
-
`behaviorLibraries` in `ds.config.json
|
|
27
|
-
|
|
26
|
+
`behaviorLibraries` in `ds.config.json`, pinned to the exact installed version
|
|
27
|
+
(`"tabbable@6.2.0"`); each must also be a `package.json` dependency. Pin the
|
|
28
|
+
`framework` the same way (`"preact@10.27.2"`) and update a pin together with the
|
|
29
|
+
upgrade; `ads check` reports a pin that differs from the installed version. Components, patterns and controllers may use them directly, including
|
|
28
30
|
package subpaths. Extract a shared controller when behavior is shared. Type-only
|
|
29
31
|
and development-role imports retain their existing rules. An empty/missing list
|
|
30
32
|
allows no additional runtime packages beyond the configured framework and Linaria.
|
package/dist/stage-timing.cjs
CHANGED
|
@@ -2,11 +2,12 @@ const { appendFileSync } = require("node:fs");
|
|
|
2
2
|
const { performance } = require("node:perf_hooks");
|
|
3
3
|
|
|
4
4
|
/** Opt-in development tracing, inherited by compiler children. No output normally. */
|
|
5
|
-
function timeStage(stage, run) {
|
|
5
|
+
function timeStage(stage, run, detail) {
|
|
6
6
|
const output = process.env.ADS_PROFILE_STAGES;
|
|
7
7
|
if (!output) return run();
|
|
8
8
|
const started = performance.now();
|
|
9
|
-
const
|
|
9
|
+
const extra = typeof detail === "function" ? detail() : detail;
|
|
10
|
+
const record = () => appendFileSync(output, JSON.stringify({ stage, pid: process.pid, ms: performance.now() - started, ...extra }) + "\n");
|
|
10
11
|
let pending = false;
|
|
11
12
|
try {
|
|
12
13
|
const result = run();
|