@reqvire-org/ads 0.5.1 → 0.5.2
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/ads-errors.mjs +110 -25
- package/dist/analysis/composition-axes.mjs +48 -0
- package/dist/analysis/construction-memo.mjs +38 -0
- package/dist/analysis/context.mjs +19 -0
- package/dist/analysis/design-reads.mjs +177 -0
- package/dist/analysis/factored-classes.mjs +90 -0
- package/dist/analysis/helpers.mjs +5 -7
- package/dist/analysis/native-project.mjs +12 -0
- package/dist/analysis/owner-analysis-cache.mjs +86 -23
- package/dist/analysis/owner-analysis-key.mjs +42 -10
- package/dist/analysis/owner-choices.mjs +23 -4
- package/dist/analysis/owner-composition.mjs +118 -33
- package/dist/analysis/owner-reuse.mjs +8 -6
- package/dist/analysis/owner-source.mjs +253 -76
- package/dist/analysis/scenario-keys.mjs +10 -7
- package/dist/analysis/service.mjs +50 -3
- package/dist/analysis/standalone.mjs +7 -4
- package/dist/analysis/syntax.mjs +59 -1
- package/dist/analysis/worker-protocol.mjs +14 -2
- package/dist/analysis/worker.mjs +32 -10
- package/dist/architecture-report.mjs +26 -0
- package/dist/asset-view-facts.mjs +16 -2
- package/dist/boundaries.mjs +26 -10
- package/dist/bun-compiler.mjs +2 -2
- package/dist/check-service.mjs +29 -17
- package/dist/check.mjs +13 -6
- package/dist/cli.mjs +1 -1
- package/dist/composed-keyline.mjs +2 -2
- package/dist/config.mjs +2 -1
- package/dist/construction-output.mjs +3 -2
- package/dist/construction-spec.d.mts +111 -6
- package/dist/construction-spec.mjs +172 -30
- package/dist/corner-overpaint.mjs +16 -4
- package/dist/derived-states.mjs +182 -0
- package/dist/design-inputs.mjs +18 -3
- package/dist/design-system-closure.mjs +12 -7
- package/dist/emit/contract.mjs +24 -5
- package/dist/emit/emission.mjs +6 -4
- package/dist/emit/integrity.mjs +8 -2
- package/dist/emit/output-watch.mjs +120 -0
- package/dist/emit/owner-emission-cache.mjs +4 -4
- package/dist/emit/preview-emitter.mjs +4 -2
- package/dist/emit/preview-tree.mjs +1 -1
- package/dist/emit/service.mjs +8 -2
- package/dist/finding-rules.mjs +3 -0
- package/dist/form-states.mjs +8 -0
- package/dist/frame-regions.mjs +29 -9
- package/dist/hover-geometry.mjs +15 -0
- package/dist/input-digests.mjs +17 -10
- package/dist/linaria/delivery.mjs +2 -0
- package/dist/lowering-properties.mjs +5 -0
- package/dist/lowering-region-layout.mjs +7 -2
- package/dist/mcp/build-status.mjs +9 -1
- package/dist/mcp/compiler-channel.mjs +11 -4
- package/dist/mcp/mutations.mjs +1 -0
- package/dist/mcp/preview-http.bundle.js +1 -1
- package/dist/mcp/preview-watch.mjs +2 -1
- package/dist/mcp/preview-widget.bundle.js +1 -1
- package/dist/motion-model.mjs +1 -1
- package/dist/owner-analysis-check.mjs +19 -5
- package/dist/owner-errors.mjs +4 -2
- package/dist/owner-lowering.mjs +71 -12
- package/dist/owner-scenarios.mjs +4 -1
- package/dist/ownership-model.mjs +18 -4
- package/dist/placeholder-contrast.mjs +17 -1
- package/dist/platform-features.mjs +10 -1
- package/dist/profile-view-facts.mjs +1 -1
- package/dist/recipe-macro.d.mts +72 -13
- package/dist/recipe-model.mjs +9 -5
- package/dist/region-lowering.mjs +238 -40
- package/dist/render-audit/layout-shift.page.mjs +24 -0
- package/dist/render-audit/render-states.mjs +122 -1
- package/dist/render-audit/render-states.page.mjs +140 -0
- package/dist/render-audit/worker.mjs +18 -3
- package/dist/render-audit.mjs +114 -1
- package/dist/role-vocabulary.d.mts +5 -0
- package/dist/role-vocabulary.mjs +12 -1
- package/dist/scenarios-compiler.mjs +20 -6
- package/dist/showcase/assets-view.mjs +29 -13
- package/dist/showcase/client.bundle.js +32 -32
- package/dist/showcase/http-client.bundle.js +15 -15
- package/dist/showcase/ui/ui.css +1 -1
- package/dist/showcase/ui/ui.js +4 -4
- package/dist/skills/ads-designer/references/accessibility.md +7 -0
- package/dist/skills/ads-designer/references/branding.md +13 -3
- package/dist/skills/ads-designer/references/contracts.md +5 -2
- package/dist/skills/ads-designer/references/design-data.md +1 -1
- package/dist/skills/ads-designer/references/layout.md +5 -1
- package/dist/skills/ads-designer/references/motion.md +9 -1
- package/dist/skills/ads-designer/references/recipes.md +27 -3
- package/dist/skills/ads-import/references/contracts.md +5 -2
- package/dist/skills/ads-import/references/design-data.md +1 -1
- package/dist/skills/ads-import/references/layout.md +5 -1
- package/dist/skills/ads-import/references/recipes.md +27 -3
- package/dist/skills/ads-migrate/SKILL.md +1 -0
- package/dist/skills/ads-migrate/references/0.5.1-to-0.5.2.md +185 -0
- package/dist/skills/ads-port/references/contracts.md +5 -2
- package/dist/skills/ads-port/references/design-data.md +1 -1
- package/dist/skills/ads-port/references/layout.md +5 -1
- package/dist/skills/ads-port/references/recipes.md +27 -3
- package/dist/surface-contrast.mjs +1 -0
- package/dist/surface-effects.mjs +5 -3
- package/dist/task-cache.mjs +8 -18
- package/dist/validation-checks.mjs +1 -1
- package/docs/ARCHITECTURE.md +63 -7
- package/docs/CACHING.md +152 -24
- package/docs/CHANGELOG.md +200 -23
- package/docs/GUIDE.md +45 -1
- package/docs/LANGUAGE.md +146 -8
- package/docs/MOTION.md +10 -2
- package/docs/PROFILE-KINDS.md +9 -1
- package/docs/RULES.md +22 -14
- package/docs/TOKEN-ROLES.md +7 -1
- package/package.json +1 -1
|
@@ -45,6 +45,7 @@ function failure(error, current = worker) {
|
|
|
45
45
|
worker = void 0;
|
|
46
46
|
registered.clear();
|
|
47
47
|
baselines.clear();
|
|
48
|
+
inventories.clear();
|
|
48
49
|
for (const task of pending.values())
|
|
49
50
|
task.reject(error);
|
|
50
51
|
pending.clear();
|
|
@@ -103,6 +104,13 @@ function request(message, signal) {
|
|
|
103
104
|
const task = pending.get(id);
|
|
104
105
|
pending.delete(id);
|
|
105
106
|
task?.reject(cancelled());
|
|
107
|
+
if (task !== void 0 && worker === current && current.connected) {
|
|
108
|
+
const cancel = { action: "cancel", target: id, id: ++sequence, runtime: developmentRuntime() };
|
|
109
|
+
current.send(cancel, (error) => {
|
|
110
|
+
if (error)
|
|
111
|
+
failure(error, current);
|
|
112
|
+
});
|
|
113
|
+
}
|
|
106
114
|
}, timer = setTimeout(() => {
|
|
107
115
|
failure(Object.assign(Error("Analysis request exceeded 60 seconds."), { code: "ADS_ANALYSIS_TIMEOUT" }), current);
|
|
108
116
|
current.kill();
|
|
@@ -157,9 +165,48 @@ export function analyzeCaptured(root, inputs, kind = "registry", args = [], sign
|
|
|
157
165
|
inputs = void 0;
|
|
158
166
|
else if (!inputs)
|
|
159
167
|
throw Error("Unregistered analysis requires captured inputs.");
|
|
160
|
-
if (inputs)
|
|
161
|
-
|
|
162
|
-
|
|
168
|
+
if (!inputs)
|
|
169
|
+
return request({ action: "analyze", root, kind, args }, signal);
|
|
170
|
+
baselines.delete(root);
|
|
171
|
+
const captured = inputs, send = (delta) => {
|
|
172
|
+
const sent = inventories.get(root), inventory = `${++inventorySequence}`, changes = !delta || sent === void 0 ? null : captured.revision !== "" && sent.revision === captured.revision && sent.dependencyRevision === captured.dependencyRevision ? [] : inventoryChanges(sent.files, captured.files);
|
|
173
|
+
inventories.delete(root);
|
|
174
|
+
inventories.set(root, { name: inventory, files: captured.files, revision: captured.revision, dependencyRevision: captured.dependencyRevision });
|
|
175
|
+
for (const oldest of inventories.keys()) {
|
|
176
|
+
if (inventories.size <= INVENTORY_ROOTS)
|
|
177
|
+
break;
|
|
178
|
+
inventories.delete(oldest);
|
|
179
|
+
}
|
|
180
|
+
return request({
|
|
181
|
+
action: "analyze",
|
|
182
|
+
root,
|
|
183
|
+
kind,
|
|
184
|
+
args,
|
|
185
|
+
files: changes ?? [...captured.files],
|
|
186
|
+
...changes !== null && sent !== void 0 ? { base: sent.name } : {},
|
|
187
|
+
inventory,
|
|
188
|
+
dependencyRevision: captured.dependencyRevision,
|
|
189
|
+
inputRevision: captured.revision
|
|
190
|
+
}, signal);
|
|
191
|
+
};
|
|
192
|
+
return send(!0).catch((error) => {
|
|
193
|
+
if (!isRecord(error) || error.code !== "ADS_INVENTORY_BASE")
|
|
194
|
+
throw error;
|
|
195
|
+
return send(!1);
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
const inventories = new Map;
|
|
199
|
+
let inventorySequence = 0;
|
|
200
|
+
const INVENTORY_ROOTS = 8;
|
|
201
|
+
function inventoryChanges(before, after) {
|
|
202
|
+
const changes = [];
|
|
203
|
+
for (const [file, content] of after)
|
|
204
|
+
if (before.get(file) !== content)
|
|
205
|
+
changes.push([file, content]);
|
|
206
|
+
for (const file of before.keys())
|
|
207
|
+
if (!after.has(file))
|
|
208
|
+
changes.push([file, null]);
|
|
209
|
+
return changes;
|
|
163
210
|
}
|
|
164
211
|
export async function releaseAnalysisRevision(root) {
|
|
165
212
|
root = path.resolve(root);
|
|
@@ -3,7 +3,7 @@ import { currentAnalysis, runAnalysis } from "./context.mjs";
|
|
|
3
3
|
import { readAnalysisInputs } from "./inputs.mjs";
|
|
4
4
|
import { NativeProject } from "./native-project.mjs";
|
|
5
5
|
import { revisionProviders } from "./native-session.mjs";
|
|
6
|
-
const MAX_PROJECTS = 8, IDLE_MILLISECONDS =
|
|
6
|
+
const MAX_PROJECTS = 8, IDLE_MILLISECONDS = 60000, projects = new Map;
|
|
7
7
|
let idle, closing = Promise.resolve();
|
|
8
8
|
export function closeStandaloneAnalysis() {
|
|
9
9
|
clearTimeout(idle);
|
|
@@ -33,14 +33,17 @@ export async function withProjectAnalysis(directory, run) {
|
|
|
33
33
|
state = projects.get(root) ?? { project: new NativeProject(root), queue: Promise.resolve() };
|
|
34
34
|
projects.set(root, state);
|
|
35
35
|
}
|
|
36
|
-
const { project } = state
|
|
36
|
+
const { project } = state;
|
|
37
|
+
project.holdsProcess(!0);
|
|
38
|
+
const work = state.queue.then(async () => {
|
|
37
39
|
const inputs = await readAnalysisInputs(root), view = await project.synchronize(inputs.files, inputs.dependencyRevision);
|
|
38
40
|
return runAnalysis(root, run, { ...revisionProviders(project, view), inputRevision: inputs.revision });
|
|
39
|
-
});
|
|
40
|
-
state.queue = work.then(() => {}, () => {});
|
|
41
|
+
}), settled = state.queue = work.then(() => {}, () => {});
|
|
41
42
|
try {
|
|
42
43
|
return await work;
|
|
43
44
|
} finally {
|
|
45
|
+
if (state.queue === settled)
|
|
46
|
+
project.holdsProcess(!1);
|
|
44
47
|
idle = setTimeout(() => {
|
|
45
48
|
closeStandaloneAnalysis();
|
|
46
49
|
}, IDLE_MILLISECONDS);
|
package/dist/analysis/syntax.mjs
CHANGED
|
@@ -15,7 +15,7 @@ import path from "node:path";
|
|
|
15
15
|
import { nativeCompilerOptions } from "./compiler-options.mjs";
|
|
16
16
|
import { currentAnalysis } from "./context.mjs";
|
|
17
17
|
import { createModuleResolvers } from "./module-resolvers.mjs";
|
|
18
|
-
const resolutionScope = new AsyncLocalStorage, MAX_RETAINED_SOURCES = 64, IDLE_MILLISECONDS = 1000;
|
|
18
|
+
const resolutionScope = new AsyncLocalStorage, MAX_RETAINED_SOURCES = 64, MAX_EXTENDS_DEPTH = 64, IDLE_MILLISECONDS = 1000;
|
|
19
19
|
let api, sequence = 0, pending = 0, idle;
|
|
20
20
|
const overlays = new Map, sources = new Map;
|
|
21
21
|
function client() {
|
|
@@ -108,6 +108,64 @@ export function parseConfigText(file, text) {
|
|
|
108
108
|
}
|
|
109
109
|
});
|
|
110
110
|
}
|
|
111
|
+
export async function parseCompilerOptionsFrom(file, read) {
|
|
112
|
+
const served = [], problems = [], virtualBeside = (target) => path.join(path.dirname(target), `.ads-config-${++sequence}.json`), reference = (from, virtual) => {
|
|
113
|
+
const relative = path.relative(path.dirname(from), virtual).split(path.sep).join("/");
|
|
114
|
+
return relative.startsWith("./") || relative.startsWith("../") ? relative : `./${relative}`;
|
|
115
|
+
}, stands = new Map, serve = (virtual, text, real) => {
|
|
116
|
+
overlays.set(virtual, text);
|
|
117
|
+
served.push(virtual);
|
|
118
|
+
stands.set(virtual, real);
|
|
119
|
+
}, realNames = (message) => {
|
|
120
|
+
let named = message;
|
|
121
|
+
for (const [virtual, real] of stands)
|
|
122
|
+
named = named.split(virtual).join(real).split(path.basename(virtual)).join(path.basename(real));
|
|
123
|
+
return named;
|
|
124
|
+
}, localized = async (target, text, chain) => {
|
|
125
|
+
const parsed = await parseConfigText(target, text);
|
|
126
|
+
if (parsed.error !== void 0 || parsed.config === null || typeof parsed.config !== "object" || Array.isArray(parsed.config)) {
|
|
127
|
+
problems.push({ file: target, message: parsed.error === void 0 ? "The configuration is not an object." : realNames(parsed.error.text) });
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
const config = parsed.config, moved = async (entry) => {
|
|
131
|
+
if (typeof entry !== "string" || !(entry.startsWith(".") || path.isAbsolute(entry)))
|
|
132
|
+
return entry;
|
|
133
|
+
const base = path.resolve(path.dirname(target), entry);
|
|
134
|
+
for (const candidate of base.endsWith(".json") ? [base] : [base, `${base}.json`]) {
|
|
135
|
+
const nested = read(candidate);
|
|
136
|
+
if (nested === null)
|
|
137
|
+
continue;
|
|
138
|
+
const stop = chain.includes(candidate) ? `The configuration extends ${entry}, which is already in this extends chain (a circular chain).` : chain.length >= MAX_EXTENDS_DEPTH ? `The configuration extends ${entry} beyond ${MAX_EXTENDS_DEPTH} levels of extends; ADS does not follow a longer chain.` : null;
|
|
139
|
+
if (stop !== null) {
|
|
140
|
+
problems.push({ file: target, message: stop });
|
|
141
|
+
return reference(target, path.join(path.dirname(base), `.ads-missing-${++sequence}.json`));
|
|
142
|
+
}
|
|
143
|
+
const virtual = virtualBeside(candidate), localizedNested = await localized(candidate, nested, [...chain, candidate]);
|
|
144
|
+
serve(virtual, JSON.stringify(localizedNested ?? {}), candidate);
|
|
145
|
+
return reference(target, virtual);
|
|
146
|
+
}
|
|
147
|
+
problems.push({ file: target, message: `The configuration extends ${entry}, which is not in this revision.` });
|
|
148
|
+
return reference(target, path.join(path.dirname(base), `.ads-missing-${++sequence}.json`));
|
|
149
|
+
}, extended = config.extends;
|
|
150
|
+
return extended === void 0 ? config : { ...config, extends: Array.isArray(extended) ? await Promise.all(extended.map(moved)) : await moved(extended) };
|
|
151
|
+
};
|
|
152
|
+
try {
|
|
153
|
+
const resolved = path.resolve(file), text = read(resolved);
|
|
154
|
+
if (text === null)
|
|
155
|
+
return { options: {}, problems: [] };
|
|
156
|
+
const config = await localized(resolved, text, [resolved]);
|
|
157
|
+
if (config === null)
|
|
158
|
+
return { options: {}, problems };
|
|
159
|
+
const parsed = await parseCompilerOptions(config, path.dirname(resolved));
|
|
160
|
+
for (const error of parsed.errors)
|
|
161
|
+
if (error.code !== 18002 && error.code !== 18003 && !error.text.includes(".ads-missing-"))
|
|
162
|
+
problems.push({ file: resolved, message: realNames(error.text) });
|
|
163
|
+
return { options: parsed.options, problems };
|
|
164
|
+
} finally {
|
|
165
|
+
for (const virtual of served)
|
|
166
|
+
overlays.delete(virtual);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
111
169
|
export const readConfig = (file) => use((current) => current.readConfigFile(path.resolve(file))), parseConfig = (config, directory) => use((current) => current.parseJsonConfigFileContent(config, { configDirectory: path.resolve(directory) })), parseCompilerOptions = (config, directory) => parseConfig({ ...config, files: [], include: [] }, directory), parseConfigFile = (file) => use((current) => current.parseConfigFile(path.resolve(file))), transpileSource = (input, options) => use(async (current) => {
|
|
112
170
|
const result = await current.transpileModule(input, options);
|
|
113
171
|
return { ...result, diagnostics: result.diagnostics?.map((diagnostic) => ({ ...diagnostic, messageText: diagnostic.text })) };
|
|
@@ -40,6 +40,10 @@ function parseRequest(message) {
|
|
|
40
40
|
const action = message.action;
|
|
41
41
|
if (action === "close")
|
|
42
42
|
return ok({ action });
|
|
43
|
+
if (action === "cancel") {
|
|
44
|
+
const target = message.target;
|
|
45
|
+
return typeof target === "number" && Number.isInteger(target) ? ok({ action, target }) : err("target must be a request id");
|
|
46
|
+
}
|
|
43
47
|
if (action !== "release" && action !== "promote" && action !== "register" && action !== "analyze")
|
|
44
48
|
return err(`unknown action ${String(action)}`);
|
|
45
49
|
const root = message.root;
|
|
@@ -64,7 +68,13 @@ function parseRequest(message) {
|
|
|
64
68
|
return ok({ action, projectRoot, root, baselineToken: baselineToken.value, baselineReset, baselineChanges, changes, dependencyRevision });
|
|
65
69
|
}
|
|
66
70
|
case "analyze": {
|
|
67
|
-
const { kind, args, files } = message, dependencyRevision = optionalString(message, "dependencyRevision"), inputRevision = optionalString(message, "inputRevision");
|
|
71
|
+
const { kind, args, files } = message, dependencyRevision = optionalString(message, "dependencyRevision"), inputRevision = optionalString(message, "inputRevision"), base = optionalString(message, "base"), inventory = optionalString(message, "inventory");
|
|
72
|
+
if (base.kind === "err")
|
|
73
|
+
return base;
|
|
74
|
+
if (inventory.kind === "err")
|
|
75
|
+
return inventory;
|
|
76
|
+
if ((base.value !== void 0 || inventory.value !== void 0) && files === void 0)
|
|
77
|
+
return err("an inventory name comes with files");
|
|
68
78
|
if (!isAnalysisKind(kind))
|
|
69
79
|
return err(`unknown analysis operation ${String(kind)}`);
|
|
70
80
|
if (!Array.isArray(args))
|
|
@@ -84,7 +94,9 @@ function parseRequest(message) {
|
|
|
84
94
|
args,
|
|
85
95
|
...files === void 0 ? {} : { files },
|
|
86
96
|
...dependencyRevision.value === void 0 ? {} : { dependencyRevision: dependencyRevision.value },
|
|
87
|
-
...inputRevision.value === void 0 ? {} : { inputRevision: inputRevision.value }
|
|
97
|
+
...inputRevision.value === void 0 ? {} : { inputRevision: inputRevision.value },
|
|
98
|
+
...base.value === void 0 ? {} : { base: base.value },
|
|
99
|
+
...inventory.value === void 0 ? {} : { inventory: inventory.value }
|
|
88
100
|
});
|
|
89
101
|
}
|
|
90
102
|
default:
|
package/dist/analysis/worker.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import * as timing from "../stage-timing.mjs";
|
|
|
4
4
|
import { loadConfig } from "../config.mjs";
|
|
5
5
|
import { assertNever } from "../result.mjs";
|
|
6
6
|
import { pruneDueExtractionStores } from "../linaria/persisted-extraction-cache.mjs";
|
|
7
|
-
import { runAnalysis } from "./context.mjs";
|
|
7
|
+
import { runAnalysis, throwIfCancelled } from "./context.mjs";
|
|
8
8
|
import { NativeProject } from "./native-project.mjs";
|
|
9
9
|
import { releaseOwnerAnalyses } from "./owner-analysis-cache.mjs";
|
|
10
10
|
import { releaseClosureFacts } from "../design-system-closure.mjs";
|
|
@@ -51,6 +51,7 @@ async function register(request) {
|
|
|
51
51
|
if (request.baselineReset)
|
|
52
52
|
state.files = new Map;
|
|
53
53
|
applyChanges(state.files, request.baselineChanges);
|
|
54
|
+
state.inventory = void 0;
|
|
54
55
|
const baseline = await state.project.synchronize(state.files, request.dependencyRevision), candidate = new Map(state.files);
|
|
55
56
|
applyChanges(candidate, request.changes);
|
|
56
57
|
const previous = revisions.get(root);
|
|
@@ -74,6 +75,7 @@ async function promote(root) {
|
|
|
74
75
|
if (!state)
|
|
75
76
|
throw Error("Analysis project was closed before promotion.");
|
|
76
77
|
state.files = new Map([...entry.view.files].map(([file, text]) => [path.relative(entry.project.root, file), text]));
|
|
78
|
+
state.inventory = void 0;
|
|
77
79
|
state.version++;
|
|
78
80
|
revisions.delete(root);
|
|
79
81
|
return { stats: entry.project.stats };
|
|
@@ -91,8 +93,15 @@ async function analysisRevision(request) {
|
|
|
91
93
|
const state = await projectFor(request.root);
|
|
92
94
|
if (!request.files)
|
|
93
95
|
throw Error("Unregistered analysis request requires a fenced inventory.");
|
|
94
|
-
|
|
96
|
+
if (request.base === void 0)
|
|
97
|
+
state.files = new Map;
|
|
98
|
+
else if (state.inventory !== request.base) {
|
|
99
|
+
state.inventory = void 0;
|
|
100
|
+
throw Object.assign(Error("The analysis worker does not hold the inventory these changes are based on."), { code: "ADS_INVENTORY_BASE" });
|
|
101
|
+
}
|
|
102
|
+
timing.recordStage("analysis-inventory", 0, { files: request.files.length, changes: request.base !== void 0 });
|
|
95
103
|
applyChanges(state.files, request.files);
|
|
104
|
+
state.inventory = request.inventory;
|
|
96
105
|
state.version++;
|
|
97
106
|
return { project: state.project, view: await state.project.synchronize(state.files, request.dependencyRevision), inputRevision: request.inputRevision };
|
|
98
107
|
}
|
|
@@ -170,12 +179,13 @@ async function runOperation(operation, root, options) {
|
|
|
170
179
|
return assertNever(operation, "analysis operation");
|
|
171
180
|
}
|
|
172
181
|
}
|
|
173
|
-
async function analyzeRevision(request) {
|
|
182
|
+
async function analyzeRevision(request, signal) {
|
|
174
183
|
const operation = analysisOperation(request.kind, request.args);
|
|
175
184
|
if (operation.kind === "err")
|
|
176
185
|
throw Error(`Malformed ${request.kind} analysis request: ${operation.error}.`);
|
|
177
186
|
const { root } = request, { project, view, inputRevision } = await analysisRevision(request);
|
|
178
187
|
return runAnalysis(root, () => runOperation(operation.value, root, loadConfig(root)), {
|
|
188
|
+
signal,
|
|
179
189
|
revision: view,
|
|
180
190
|
environment: () => project.environment(view),
|
|
181
191
|
...inputRevision === void 0 ? {} : { inputRevision },
|
|
@@ -189,7 +199,7 @@ async function analyzeRevision(request) {
|
|
|
189
199
|
resolveModuleDetails: (specifier, file, compilerOptions) => project.resolveDetails(view, specifier, file, compilerOptions)
|
|
190
200
|
});
|
|
191
201
|
}
|
|
192
|
-
async function execute(request) {
|
|
202
|
+
async function execute(request, signal) {
|
|
193
203
|
switch (request.action) {
|
|
194
204
|
case "register":
|
|
195
205
|
return register(request);
|
|
@@ -201,16 +211,17 @@ async function execute(request) {
|
|
|
201
211
|
pruneDueExtractionStores();
|
|
202
212
|
return closeProjects();
|
|
203
213
|
case "analyze":
|
|
204
|
-
return analyzeRevision(request);
|
|
214
|
+
return analyzeRevision(request, signal);
|
|
215
|
+
case "cancel":
|
|
216
|
+
return;
|
|
205
217
|
default:
|
|
206
218
|
return assertNever(request, "analysis request");
|
|
207
219
|
}
|
|
208
220
|
}
|
|
209
221
|
const disconnect = () => {
|
|
210
222
|
process.disconnect?.();
|
|
211
|
-
};
|
|
212
|
-
async function serve(
|
|
213
|
-
const incoming = parseIncomingMessage(message);
|
|
223
|
+
}, controllers = new Map;
|
|
224
|
+
async function serve(incoming, signal) {
|
|
214
225
|
switch (incoming.kind) {
|
|
215
226
|
case "unaddressed":
|
|
216
227
|
return;
|
|
@@ -220,12 +231,15 @@ async function serve(message) {
|
|
|
220
231
|
case "request": {
|
|
221
232
|
const { request } = incoming;
|
|
222
233
|
try {
|
|
223
|
-
|
|
234
|
+
if (request.action === "analyze")
|
|
235
|
+
throwIfCancelled(signal);
|
|
236
|
+
process.send?.(resultReply(request.id, await execute(request, signal)));
|
|
224
237
|
} catch (error) {
|
|
225
238
|
process.send?.(errorReply(request.id, error));
|
|
226
239
|
if (isFatalFailure(error))
|
|
227
240
|
disconnect();
|
|
228
241
|
}
|
|
242
|
+
controllers.delete(request.id);
|
|
229
243
|
if (request.action === "close")
|
|
230
244
|
disconnect();
|
|
231
245
|
return;
|
|
@@ -236,7 +250,15 @@ async function serve(message) {
|
|
|
236
250
|
}
|
|
237
251
|
timing.recordStage("analysis-worker-boot", performance.now());
|
|
238
252
|
process.on("message", (message) => {
|
|
239
|
-
|
|
253
|
+
const incoming = parseIncomingMessage(message);
|
|
254
|
+
if (incoming.kind === "request" && incoming.request.action === "cancel") {
|
|
255
|
+
controllers.get(incoming.request.target)?.abort();
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
const controller = new AbortController;
|
|
259
|
+
if (incoming.kind === "request")
|
|
260
|
+
controllers.set(incoming.request.id, controller);
|
|
261
|
+
queue = queue.then(() => serve(incoming, controller.signal));
|
|
240
262
|
});
|
|
241
263
|
process.on("disconnect", () => {
|
|
242
264
|
(async () => {
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { isRecord } from "./unknown.mjs";
|
|
2
|
+
const isStringArray = (value) => Array.isArray(value) && value.every((item) => typeof item === "string"), isDiagnostic = (value) => isRecord(value) && typeof value.rule === "string", isDiagnostics = (value) => Array.isArray(value) && value.every(isDiagnostic), isAcceptance = (value) => isRecord(value) && typeof value.scope === "string" && (value.status === "passed" || value.status === "not_established") && isStringArray(value.established) && isStringArray(value.unverified);
|
|
3
|
+
export function parseArchitectureReport(value, source) {
|
|
4
|
+
if (isRecord(value)) {
|
|
5
|
+
const { ok, diagnostics, advisories, acceptance } = value;
|
|
6
|
+
if (typeof ok === "boolean" && isDiagnostics(diagnostics) && isAcceptance(acceptance)) {
|
|
7
|
+
if (advisories === void 0)
|
|
8
|
+
return { ...value, ok, diagnostics, acceptance };
|
|
9
|
+
if (isDiagnostics(advisories))
|
|
10
|
+
return { ...value, ok, diagnostics, advisories, acceptance };
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
throw TypeError(`${source} is not an ADS architecture report.`);
|
|
14
|
+
}
|
|
15
|
+
export function parseCheckedArchitectureReport(value) {
|
|
16
|
+
if (!isRecord(value) || typeof value.key !== "string" || !/^[a-f0-9]{64}$/.test(value.key) || typeof value.revision !== "string")
|
|
17
|
+
return;
|
|
18
|
+
try {
|
|
19
|
+
const report = parseArchitectureReport(value.report, "The emitter's checked report");
|
|
20
|
+
if (!report.ok || report.diagnostics.length !== 0 || report.acceptance.status !== "passed")
|
|
21
|
+
return;
|
|
22
|
+
return { key: value.key, revision: value.revision, report };
|
|
23
|
+
} catch {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { references } from "./design-foundation.mjs";
|
|
3
3
|
const byName = (a, b) => a < b ? -1 : a > b ? 1 : 0, byGroup = (a, b) => a === b ? 0 : a === null ? 1 : b === null ? -1 : byName(a, b);
|
|
4
|
-
export function assetViewFacts(catalog, dsRoot, foundation = null) {
|
|
4
|
+
export function assetViewFacts(catalog, dsRoot, foundation = null, owners = new Map) {
|
|
5
|
+
const usedBy = new Map, use = (asset, item) => {
|
|
6
|
+
const known = usedBy.get(asset) ?? [];
|
|
7
|
+
if (!known.some((other) => other.owner === item.owner && other.size === item.size))
|
|
8
|
+
known.push(item);
|
|
9
|
+
usedBy.set(asset, known);
|
|
10
|
+
};
|
|
11
|
+
for (const [owner, { artwork }] of owners) {
|
|
12
|
+
for (const item of artwork.uses)
|
|
13
|
+
use(item.asset, { owner, size: item.size === null ? null : references(item.size)[0] ?? item.size });
|
|
14
|
+
for (const glyph of artwork.glyphs)
|
|
15
|
+
if (!artwork.uses.some((item) => item.asset === glyph))
|
|
16
|
+
use(glyph, { owner, size: null });
|
|
17
|
+
}
|
|
5
18
|
const sizes = new Set;
|
|
6
19
|
for (const profile of foundation?.profiles.values() ?? []) {
|
|
7
20
|
if (profile.kind !== "visual")
|
|
@@ -28,7 +41,8 @@ export function assetViewFacts(catalog, dsRoot, foundation = null) {
|
|
|
28
41
|
center: [record.center[0], record.center[1]],
|
|
29
42
|
sets: (membership.get(record.name) ?? []).sort(byName),
|
|
30
43
|
file: relative(record.file),
|
|
31
|
-
drawings: record.drawings.map((drawing) => ({ state: drawing.state, size: drawing.size ?? null, theme: drawing.theme ?? null, scheme: drawing.scheme ?? null, svg: drawing.text, box: drawing.box }))
|
|
44
|
+
drawings: record.drawings.map((drawing) => ({ state: drawing.state, size: drawing.size ?? null, theme: drawing.theme ?? null, scheme: drawing.scheme ?? null, svg: drawing.text, box: drawing.box })),
|
|
45
|
+
usedBy: (usedBy.get(record.name) ?? []).sort((a, b) => byName(a.owner, b.owner) || byName(a.size ?? "", b.size ?? ""))
|
|
32
46
|
})).sort((a, b) => byGroup(a.group, b.group) || byName(a.name, b.name)), counts = new Map;
|
|
33
47
|
for (const asset of assets)
|
|
34
48
|
counts.set(asset.group, (counts.get(asset.group) ?? 0) + 1);
|
package/dist/boundaries.mjs
CHANGED
|
@@ -1,27 +1,43 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
1
2
|
import path from "node:path";
|
|
2
|
-
import ts, { resolveModule,
|
|
3
|
+
import ts, { resolveModule, parseCompilerOptionsFrom } from "./analysis/syntax.mjs";
|
|
3
4
|
import { isInside } from "./config.mjs";
|
|
4
5
|
import { memoFact } from "./analysis/helpers.mjs";
|
|
5
|
-
import { currentAnalysis } from "./analysis/context.mjs";
|
|
6
|
-
import { isRecord } from "./unknown.mjs";
|
|
6
|
+
import { currentAnalysis, revisionText } from "./analysis/context.mjs";
|
|
7
7
|
export async function projectCompilerOptions(options) {
|
|
8
|
+
return (await projectConfiguration(options)).options;
|
|
9
|
+
}
|
|
10
|
+
export async function compilerConfigurationProblems(options) {
|
|
11
|
+
return (await projectConfiguration(options)).problems;
|
|
12
|
+
}
|
|
13
|
+
function projectConfiguration(options) {
|
|
8
14
|
return memoFact(options, "compiler-options", async () => discoverCompilerOptions(options));
|
|
9
15
|
}
|
|
16
|
+
function configurationText(file) {
|
|
17
|
+
const captured = revisionText(file);
|
|
18
|
+
if (captured !== void 0)
|
|
19
|
+
return captured.text;
|
|
20
|
+
try {
|
|
21
|
+
return readFileSync(file, "utf8");
|
|
22
|
+
} catch {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
10
26
|
async function discoverCompilerOptions({ root, config, dsRoot }) {
|
|
11
|
-
const file = ts.findConfigFile(root,
|
|
12
|
-
let compiler = {};
|
|
27
|
+
const file = ts.findConfigFile(root, (candidate) => configurationText(candidate) !== null, "tsconfig.json");
|
|
28
|
+
let compiler = {}, problems = [];
|
|
13
29
|
if (file && isInside(root, file)) {
|
|
14
|
-
const parsed = await
|
|
15
|
-
|
|
16
|
-
|
|
30
|
+
const parsed = await parseCompilerOptionsFrom(file, configurationText);
|
|
31
|
+
compiler = parsed.options;
|
|
32
|
+
problems = parsed.problems;
|
|
17
33
|
}
|
|
18
|
-
return config && dsRoot ? {
|
|
34
|
+
return { options: config && dsRoot ? {
|
|
19
35
|
...compiler,
|
|
20
36
|
paths: {
|
|
21
37
|
...compiler.paths,
|
|
22
38
|
[config.publicAlias]: [path.join(dsRoot, config.publicEntry)]
|
|
23
39
|
}
|
|
24
|
-
} : compiler;
|
|
40
|
+
} : compiler, problems };
|
|
25
41
|
}
|
|
26
42
|
export async function importResolver(options) {
|
|
27
43
|
return memoFact(options, "import-resolver", async () => createImportResolver(options));
|
package/dist/bun-compiler.mjs
CHANGED
|
@@ -23,8 +23,8 @@ export const compilerFiles = [
|
|
|
23
23
|
].map((file) => fileURLToPath(new URL(file, import.meta.url)))
|
|
24
24
|
];
|
|
25
25
|
function validator(root) {
|
|
26
|
-
return async function validate() {
|
|
27
|
-
const result = await checkCandidate(root);
|
|
26
|
+
return async function validate(checked, environment) {
|
|
27
|
+
const result = await checkCandidate(root, void 0, root, { checked, environment });
|
|
28
28
|
if (result.ok)
|
|
29
29
|
return !0;
|
|
30
30
|
throw Object.assign(Error("ADS project validation failed."), { diagnostics: result.diagnostics });
|
package/dist/check-service.mjs
CHANGED
|
@@ -1,9 +1,23 @@
|
|
|
1
|
-
import { createHash } from "node:crypto";
|
|
2
1
|
import path from "node:path";
|
|
2
|
+
import { digest as hash } from "./digest.mjs";
|
|
3
3
|
import { architectureTaskInputs, parseArchitectureReport } from "./task-cache.mjs";
|
|
4
4
|
import { analyzeCaptured } from "./analysis/service.mjs";
|
|
5
|
-
import { createAnalysisInputCapture } from "./analysis/inputs.mjs";
|
|
6
|
-
|
|
5
|
+
import { createAnalysisInputCapture, inputRevision } from "./analysis/inputs.mjs";
|
|
6
|
+
import { loadConfig } from "./config.mjs";
|
|
7
|
+
import { withCurrentOutput } from "./emit/integrity.mjs";
|
|
8
|
+
import { releaseOutputWatch, watchedOutputFindings } from "./emit/output-watch.mjs";
|
|
9
|
+
const remembered = new Map, limit = 16;
|
|
10
|
+
export function rememberCheckedReport({ key, report }) {
|
|
11
|
+
if (!report.ok || report.diagnostics.length !== 0 || report.acceptance.status !== "passed")
|
|
12
|
+
return;
|
|
13
|
+
remembered.delete(key);
|
|
14
|
+
remembered.set(key, report);
|
|
15
|
+
for (const oldest of remembered.keys()) {
|
|
16
|
+
if (remembered.size <= limit)
|
|
17
|
+
break;
|
|
18
|
+
remembered.delete(oldest);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
7
21
|
let queue = Promise.resolve(), active;
|
|
8
22
|
function cancelled() {
|
|
9
23
|
return Object.assign(Error("Mutation cancelled during validation."), {
|
|
@@ -23,27 +37,24 @@ async function run(root, trackingRoot, signal, inputs) {
|
|
|
23
37
|
export async function stopWarmChecks() {
|
|
24
38
|
active?.abort();
|
|
25
39
|
}
|
|
26
|
-
export function warmCheck(root, trackingRoot = root, signal, { fresh = !1 } = {}) {
|
|
40
|
+
export function warmCheck(root, trackingRoot = root, signal, { fresh = !1, checked, environment } = {}) {
|
|
27
41
|
const job = queue.then(async () => {
|
|
28
42
|
if (signal?.aborted)
|
|
29
43
|
throw cancelled();
|
|
30
|
-
const started = Date.now(), capture = createAnalysisInputCapture(), inputs = await architectureTaskInputs(root, trackingRoot, capture), key = hash(inputs)
|
|
31
|
-
if (
|
|
32
|
-
|
|
44
|
+
const started = Date.now(), capture = createAnalysisInputCapture(), inputs = await architectureTaskInputs(root, trackingRoot, { onFile: capture.onFile, environment }), key = hash(inputs);
|
|
45
|
+
if (!fresh && checked?.key === key && checked.revision === inputRevision(inputs.files))
|
|
46
|
+
rememberCheckedReport(checked);
|
|
47
|
+
const known = fresh ? void 0 : remembered.get(key);
|
|
48
|
+
if (known) {
|
|
49
|
+
const watchedFindings = warmRoots.has(path.resolve(root)) ? await watchedOutputFindings(root) : void 0;
|
|
50
|
+
return { ...withCurrentOutput(known, loadConfig(root), watchedFindings), cache: { backend: "warm", task: "architecture", key, status: "hit", elapsedMs: Date.now() - started } };
|
|
51
|
+
}
|
|
33
52
|
const result = await run(root, trackingRoot, signal, capture.complete(inputs.files));
|
|
34
|
-
if (hash(await architectureTaskInputs(root, trackingRoot)) !== key)
|
|
53
|
+
if (hash(await architectureTaskInputs(root, trackingRoot, { environment })) !== key)
|
|
35
54
|
throw Object.assign(Error("Source, dependencies or Git tracking changed during the ADS task; retry against the current inputs."), {
|
|
36
55
|
code: "ADS_SOURCE_CHANGED"
|
|
37
56
|
});
|
|
38
|
-
|
|
39
|
-
remembered.delete(key);
|
|
40
|
-
remembered.set(key, result);
|
|
41
|
-
for (const oldest of remembered.keys()) {
|
|
42
|
-
if (remembered.size <= limit)
|
|
43
|
-
break;
|
|
44
|
-
remembered.delete(oldest);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
57
|
+
rememberCheckedReport({ key, revision: inputRevision(inputs.files), report: result });
|
|
47
58
|
return { ...result, cache: { backend: "warm", task: "architecture", key, status: fresh ? "fresh" : "miss", elapsedMs: Date.now() - started } };
|
|
48
59
|
});
|
|
49
60
|
queue = job.catch(() => {});
|
|
@@ -55,6 +66,7 @@ export function useWarmChecks(root) {
|
|
|
55
66
|
}
|
|
56
67
|
export async function releaseWarmChecks(root) {
|
|
57
68
|
warmRoots.delete(path.resolve(root));
|
|
69
|
+
releaseOutputWatch(root);
|
|
58
70
|
if (!warmRoots.size)
|
|
59
71
|
await stopWarmChecks();
|
|
60
72
|
}
|
package/dist/check.mjs
CHANGED
|
@@ -4,10 +4,10 @@ import { currentAnalysis } from "./analysis/context.mjs";
|
|
|
4
4
|
import { existsSync, statSync } from "node:fs";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import { isTestFile, loadConfig, sourceFiles } from "./config.mjs";
|
|
7
|
-
import { projectCompilerOptions } from "./boundaries.mjs";
|
|
7
|
+
import { compilerConfigurationProblems, projectCompilerOptions } from "./boundaries.mjs";
|
|
8
8
|
import { architectureEvidence } from "./evidence.mjs";
|
|
9
9
|
import { isRecord } from "./unknown.mjs";
|
|
10
|
-
import { designSystemClosure } from "./design-system-closure.mjs";
|
|
10
|
+
import { closureStats, designSystemClosure } from "./design-system-closure.mjs";
|
|
11
11
|
import { outputDirectory, outputInsidePackage } from "./emit/output-location.mjs";
|
|
12
12
|
import * as timing from "./stage-timing.mjs";
|
|
13
13
|
const errorField = (error, name) => isRecord(error) ? error[name] : void 0;
|
|
@@ -78,13 +78,13 @@ async function structureFindings(options) {
|
|
|
78
78
|
return findings;
|
|
79
79
|
}
|
|
80
80
|
async function closureFindings(options, compiler) {
|
|
81
|
-
const { root, config, dsRoot } = options, projectPath = (file) => path.relative(root, file).replaceAll("\\", "/");
|
|
82
|
-
return (await designSystemClosure({
|
|
81
|
+
const { root, config, dsRoot } = options, projectPath = (file) => path.relative(root, file).replaceAll("\\", "/"), { computed, reused } = closureStats;
|
|
82
|
+
return (await timing.timeStage("design-system-closure", () => designSystemClosure({
|
|
83
83
|
dsRoot,
|
|
84
84
|
files: sourceFiles(dsRoot, options).filter((file) => isScript(file) && !isTestFile(file)),
|
|
85
85
|
compilerOptions: { ...compiler, paths: { ...compiler.paths, [config.publicAlias]: [path.join(dsRoot, config.publicEntry)] } },
|
|
86
86
|
excluded: [...config.assets.generatedPaths.map((entry) => path.resolve(root, entry)), outputDirectory(root, config)]
|
|
87
|
-
})).map((violation) => violation.kind === "unavailable" ? { ...sourceUnavailable(root, config, violation.target, violation.file), line: violation.line, column: violation.column } : {
|
|
87
|
+
}), void 0, () => ({ computed: closureStats.computed - computed, reused: closureStats.reused - reused }))).map((violation) => violation.kind === "unavailable" ? { ...sourceUnavailable(root, config, violation.target, violation.file), line: violation.line, column: violation.column } : {
|
|
88
88
|
file: projectPath(violation.file),
|
|
89
89
|
rule: "import-leaves-design-system",
|
|
90
90
|
message: `${violation.specifier} resolves to ${projectPath(violation.target)}, a project file outside ${config.dsDir}. ADS previews, drafts and emitted packages read only the design-system folder, so changes there would never reach them. Move the module into ${config.dsDir}, or pass the value in through a public prop.`,
|
|
@@ -95,6 +95,7 @@ async function closureFindings(options, compiler) {
|
|
|
95
95
|
}
|
|
96
96
|
export const checkRules = [
|
|
97
97
|
"project-structure",
|
|
98
|
+
"typescript-config-invalid",
|
|
98
99
|
"source-unavailable",
|
|
99
100
|
"import-leaves-design-system",
|
|
100
101
|
"owner-analysis",
|
|
@@ -187,7 +188,13 @@ async function mockOwnershipFindings(options) {
|
|
|
187
188
|
});
|
|
188
189
|
}
|
|
189
190
|
async function checkDesignSystem(options) {
|
|
190
|
-
const { root, config, dsRoot } = options, compilerOptions = await projectCompilerOptions(options), closure =
|
|
191
|
+
const { root, config, dsRoot } = options, compilerOptions = await projectCompilerOptions(options), closure = [...(await compilerConfigurationProblems(options)).map((problem) => ({
|
|
192
|
+
rule: "typescript-config-invalid",
|
|
193
|
+
file: path.relative(root, problem.file).replaceAll("\\", "/"),
|
|
194
|
+
line: 1,
|
|
195
|
+
column: 1,
|
|
196
|
+
message: `${problem.message} ADS analyses the design system with this TypeScript configuration's compiler options; fix the configuration so the analysis uses the same options as the project's compiler.`
|
|
197
|
+
})), ...await closureFindings(options, compilerOptions)], mocks = await mockOwnershipFindings(options), { ownerRevision } = await ownerCheck(), cacheOwner = options.trackingRoot ?? root, revision = await ownerRevision({
|
|
191
198
|
root,
|
|
192
199
|
dsRoot,
|
|
193
200
|
publicAlias: config.publicAlias,
|
package/dist/cli.mjs
CHANGED
|
@@ -127,7 +127,7 @@ async function printText(report, target) {
|
|
|
127
127
|
console.log(`ADS accessibility audit (${result.engine}): ${findingCounts(result.diagnostics.length, result.findings.filter((finding) => finding.severity === "review").length, info)}, ${result.incomplete ?? 0} that axe could not decide across ${result.scenarios} scenarios \xD7 ${result.themes.length} themes (${result.themes.join(", ")})${result.brands ? ` \xD7 ${result.brands.length} brands (${result.brands.join(", ")})` : ""}.`);
|
|
128
128
|
if (result.coverage) {
|
|
129
129
|
const skipped = Object.entries(result.coverage.skipped);
|
|
130
|
-
console.log(`Covered: ${result.coverage.renders} renders, ${result.coverage.overlaysOpened} overlays opened, ${result.coverage.controlsMeasured} controls hovered and focused; ${skipped.length ? `skipped ${skipped.map(([reason, entry]) => `${reason} ${entry.count}`).join(", ")}` : "nothing skipped"}.`);
|
|
130
|
+
console.log(`Covered: ${result.coverage.renders} renders, ${result.coverage.overlaysOpened} overlays opened, ${result.coverage.controlsMeasured} controls hovered and focused, ${result.coverage.derivedMeasured ?? 0} owner states derived from the recipes; ${skipped.length ? `skipped ${skipped.map(([reason, entry]) => `${reason} ${entry.count}`).join(", ")}` : "nothing skipped"}.`);
|
|
131
131
|
}
|
|
132
132
|
if (result.retries)
|
|
133
133
|
console.log(`Retried ${result.retries.length} render${result.retries.length === 1 ? "" : "s"} that then passed: ${result.retries.map((retry) => `${retry.scenario} [${[retry.theme, retry.brand].filter(Boolean).join(", ")}] in ${retry.attempts} attempts`).join("; ")}.`);
|
|
@@ -53,8 +53,8 @@ function rootsOf(owners, ref, known, hops) {
|
|
|
53
53
|
}
|
|
54
54
|
const outer = last.elements.at(-1);
|
|
55
55
|
if (outer !== void 0) {
|
|
56
|
-
|
|
57
|
-
frames.set(JSON.stringify([outer.at,
|
|
56
|
+
for (const frame of outer.frame === void 0 ? [] : [outer.frame, ...outer.frame.states ?? []])
|
|
57
|
+
frames.set(JSON.stringify([outer.at, frame.name, frame.padding]), { name: frame.name, padding: frame.padding, at: outer.at });
|
|
58
58
|
continue;
|
|
59
59
|
}
|
|
60
60
|
if (leaf.segments.length !== 1 || position.content.kind !== "placement")
|
package/dist/config.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { isDraftFile } from "./draft-boundary.mjs";
|
|
4
|
+
import { revisionText } from "./analysis/context.mjs";
|
|
4
5
|
import { defaultCompileSettings, outputDirectory, outputDirectoryProblem } from "./emit/output-location.mjs";
|
|
5
6
|
export const supportedFrameworks = ["react", "preact"];
|
|
6
7
|
const isFramework = (value) => value === "react" || value === "preact";
|
|
@@ -92,7 +93,7 @@ const scriptList = (value, name) => {
|
|
|
92
93
|
return value;
|
|
93
94
|
};
|
|
94
95
|
export function loadConfig(directory = process.cwd()) {
|
|
95
|
-
const root = path.resolve(directory), configFile = path.join(root, "ds.config.json"), configText = existsSync(configFile) ? readFileSync(configFile, "utf8") : "{}", user = JSON.parse(configText);
|
|
96
|
+
const root = path.resolve(directory), configFile = path.join(root, "ds.config.json"), captured = revisionText(configFile), configText = (captured === void 0 ? existsSync(configFile) ? readFileSync(configFile, "utf8") : null : captured.text) ?? "{}", user = JSON.parse(configText);
|
|
96
97
|
if (!isFields(user))
|
|
97
98
|
throw Error("ds.config.json must be an object.");
|
|
98
99
|
for (const field of Object.keys(user))
|