@reqvire-org/ads 0.3.27 → 0.3.29

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.
Files changed (69) hide show
  1. package/dist/atomic-composition.mjs +2 -1
  2. package/dist/behaviors.mjs +2 -2
  3. package/dist/bootstrap-ds/scripts/build-mcp-previews.mjs +6 -7
  4. package/dist/boundaries.mjs +6 -3
  5. package/dist/check.mjs +3 -0
  6. package/dist/cli.mjs +13 -0
  7. package/dist/config.mjs +5 -3
  8. package/dist/mcp/build-status.mjs +17 -4
  9. package/dist/mcp/context.mjs +2 -1
  10. package/dist/mcp/execution-results.mjs +4 -3
  11. package/dist/mcp/mutations.mjs +5 -43
  12. package/dist/mcp/preview-watch.mjs +23 -3
  13. package/dist/mcp/preview-widget.bundle.js +16 -15
  14. package/dist/mcp/project-widget.bundle.js +13 -13
  15. package/dist/mcp/resource-loader.js +50 -13
  16. package/dist/mcp/server.mjs +81 -39
  17. package/dist/oxlint.mjs +6 -1
  18. package/dist/preview-builder.mjs +114 -0
  19. package/dist/preview-inputs.mjs +8 -1
  20. package/dist/preview-resources.mjs +11 -4
  21. package/dist/preview-scope.mjs +6 -0
  22. package/dist/preview-workers.mjs +184 -0
  23. package/dist/scenario-groups.mjs +47 -0
  24. package/dist/scenario-inspector.mjs +34 -0
  25. package/dist/scenario-trace.mjs +3 -2
  26. package/dist/scenarios-compiler.mjs +203 -27
  27. package/dist/scenarios-vite.mjs +13 -5
  28. package/dist/scenarios.mjs +4 -1
  29. package/dist/showcase/client.bundle.js +23 -22
  30. package/dist/showcase/index.html +2 -2
  31. package/dist/showcase/navigation.js +13 -0
  32. package/dist/showcase/style.css +3 -1
  33. package/dist/skills/ads-break-ui/SKILL.md +4 -1
  34. package/dist/skills/ads-break-ui/references/runtimes.md +48 -0
  35. package/dist/skills/ads-break-ui/references/scenarios.md +19 -0
  36. package/dist/skills/ads-break-ui/references/validation.md +53 -0
  37. package/dist/skills/ads-designer/SKILL.md +4 -1
  38. package/dist/skills/ads-designer/assets/bootstrap-ds/scripts/build-mcp-previews.mjs +6 -7
  39. package/dist/skills/ads-designer/references/runtimes.md +48 -0
  40. package/dist/skills/ads-designer/references/scenarios.md +19 -0
  41. package/dist/skills/ads-designer/references/validation.md +53 -0
  42. package/dist/skills/ads-import/SKILL.md +4 -1
  43. package/dist/skills/ads-import/references/runtimes.md +48 -0
  44. package/dist/skills/ads-import/references/scenarios.md +19 -0
  45. package/dist/skills/ads-import/references/validation.md +53 -0
  46. package/dist/skills/ads-motion/SKILL.md +4 -1
  47. package/dist/skills/ads-motion/references/runtimes.md +48 -0
  48. package/dist/skills/ads-motion/references/scenarios.md +19 -0
  49. package/dist/skills/ads-motion/references/validation.md +53 -0
  50. package/dist/skills/ads-port/SKILL.md +4 -1
  51. package/dist/skills/ads-port/references/runtimes.md +48 -0
  52. package/dist/skills/ads-port/references/scenarios.md +19 -0
  53. package/dist/skills/ads-port/references/validation.md +53 -0
  54. package/dist/source-symbols.mjs +11 -0
  55. package/dist/source-values.mjs +10 -3
  56. package/dist/test-boundaries.mjs +95 -0
  57. package/dist/ui-framework.mjs +2 -1
  58. package/dist/units.mjs +12 -1
  59. package/dist/validation-checks.mjs +50 -0
  60. package/dist/validation.mjs +172 -0
  61. package/dist/verification/browser.mjs +3 -1
  62. package/dist/verification.mjs +1 -0
  63. package/docs/ADS.md +12 -2
  64. package/docs/ARCHITECTURE.md +125 -7
  65. package/docs/BEHAVIORS.md +7 -0
  66. package/docs/CHANGELOG.md +54 -0
  67. package/docs/GUIDE.md +31 -0
  68. package/docs/MCP.md +127 -16
  69. package/package.json +1 -1
@@ -4,10 +4,11 @@ import path from "node:path";
4
4
  import ts from "typescript";
5
5
  import valueParser from "postcss-value-parser";
6
6
  import { isInside, loadConfig } from "./config.mjs";
7
- import { previewArtifactPath, previewManifestPath } from "./preview-scope.mjs";
7
+ import { livePreviewOptions, previewArtifactPath, previewManifestPath } from "./preview-scope.mjs";
8
8
 
9
9
  export const PREVIEW_APP_URI = "ui://ads/preview";
10
10
  export const PREVIEW_MANIFEST_URI = "ads://preview/manifest";
11
+ export const LIVE_PREVIEW_MANIFEST_URI = "ads://preview/live";
11
12
  export const assetUriPattern = /^ads:\/\/assets\/[a-f0-9]{64}\.[a-z0-9]+$/;
12
13
  const hash = value => createHash("sha256").update(value).digest("hex");
13
14
  const unknownResource = message => Object.assign(new Error(message), { code: "ADS_PREVIEW_NOT_FOUND" });
@@ -142,7 +143,7 @@ function cacheOptions(options, revision) {
142
143
  }
143
144
 
144
145
  /** A cache hit still verifies every compiled byte before republishing it. */
145
- export function cachedPreviewPublication(options, entries, revision) {
146
+ export function cachedPreviewPublication(options, entries, revision, target = options) {
146
147
  if (!/^[a-f0-9]{64}$/.test(revision ?? "")) return null;
147
148
  try {
148
149
  const cached = cacheOptions(options, revision), manifest = readPreviewManifest(cached, { verify: true });
@@ -152,8 +153,12 @@ export function cachedPreviewPublication(options, entries, revision) {
152
153
  const value = readPreviewAsset(cached, uri, manifest);
153
154
  return [uri, "text" in value ? Buffer.from(value.text) : Buffer.from(value.blob, "base64")];
154
155
  }));
156
+ // A compiler may intentionally embed its working directory. Such output
157
+ // cannot be reused from a temporary candidate in the real project.
158
+ const roots=[options.root,options.root.replaceAll("\\","/"),JSON.stringify(options.root).slice(1,-1),encodeURI(options.root)];
159
+ if (target.root !== options.root && [...contents.values()].some(bytes => roots.some(root=>bytes.includes(root)))) return null;
155
160
  const { session: _session, ...graph } = manifest;
156
- return publication(options, entries, graph, contents);
161
+ return publication(target, entries, graph, contents);
157
162
  } catch { return null; } // Missing, pruned or corrupt cache means a real build.
158
163
  }
159
164
 
@@ -162,7 +167,9 @@ function publication(options, entries, manifest, contents, saveCache = true) {
162
167
  const target = previewManifestPath(options);
163
168
  const assetsRoot = path.join(path.dirname(target), "assets");
164
169
  const assetFiles = [...contents.keys()].map(uri => path.join(assetsRoot, uri.slice("ads://assets/".length)));
165
- return { assetFiles, revision, publish(session) {
170
+ return { assetFiles, revision,
171
+ publishLive(session) { publication(livePreviewOptions(options), [], manifest, contents, false).publish(session); },
172
+ publish(session) {
166
173
  const encoded = JSON.stringify({ ...manifest, session });
167
174
  if (Buffer.byteLength(encoded) > 2 * 1024 * 1024) throw new Error("Preview manifest exceeds the 2 MiB resource limit.");
168
175
  const history = path.join(path.dirname(target), "history");
@@ -14,6 +14,12 @@ export function previewManifestPath(options) {
14
14
  return options.previewSession ? path.join(path.dirname(configured), "sessions", options.previewSession, "manifest.json") : configured;
15
15
  }
16
16
 
17
+ /** Unverified live feedback has its own graph/assets; never accepted artifacts. */
18
+ export function livePreviewOptions(options) {
19
+ const file = path.join(path.dirname(previewManifestPath(options)), "live", "manifest.json");
20
+ return { ...options, previewSession: undefined, config: { ...options.config, mcp: { ...options.config.mcp, previewManifest: path.relative(options.root, file) } } };
21
+ }
22
+
17
23
  export function previewArtifactPath(options, file) {
18
24
  if (!options.previewSession || !file.replaceAll("\\", "/").startsWith(".ds/scenarios/")) return file;
19
25
  return path.join(".ds/preview-sessions", options.previewSession, path.relative(".ds", file)).replaceAll("\\", "/");
@@ -0,0 +1,184 @@
1
+ import { createHash } from "node:crypto";
2
+ import { existsSync, readFileSync, readdirSync } from "node:fs";
3
+ import path from "node:path";
4
+ import ts from "typescript";
5
+ import { isInside } from "./config.mjs";
6
+
7
+ const metadata = "ads:preview-workers";
8
+ const virtual = "\0ads-preview-worker:";
9
+ const digest = value => createHash("sha256").update(value).digest("hex");
10
+ function fileHash(file) { try { return digest(readFileSync(file)); } catch { return null; } }
11
+ function directoryHash(directory) {
12
+ try { return digest(JSON.stringify(readdirSync(directory, { withFileTypes: true }).map(entry => [entry.name, entry.isDirectory(), entry.isSymbolicLink()]).sort())); }
13
+ catch { return null; }
14
+ }
15
+ const filePath = id => typeof id === "string" && path.isAbsolute(id.split("?")[0]) ? id.split("?")[0] : null;
16
+
17
+ /** Cache Vite's own completed IIFE workers through public plugin hooks. No
18
+ * project-specific worker compiler, dependency list or Vite internals involved.
19
+ * Cached constructors refer to emitted assets; resource conversion still owns
20
+ * immutable URIs, byte verification and opaque-origin worker adaptation. */
21
+ export function createPreviewWorkerCache(options, isCurrent) {
22
+ const bundles = new Map(), staged = new Map(), pending = new Map();
23
+ let memo = new Map(), configuration = [], format, cycle = 0;
24
+ function valid(entry, fresh = false) {
25
+ if (!entry) return false;
26
+ if (fresh) memo.delete(entry);
27
+ if (!memo.has(entry)) memo.set(entry, [...entry.files].every(([file, hash]) => fileHash(file) === hash)
28
+ && [...entry.directories].every(([directory, hash]) => directoryHash(directory) === hash));
29
+ return memo.get(entry);
30
+ }
31
+ function directories(files) {
32
+ const result = new Map();
33
+ for (const file of files.keys()) {
34
+ let directory = path.dirname(file);
35
+ while (!result.has(directory)) {
36
+ result.set(directory, directoryHash(directory));
37
+ if (directory === options.root || path.basename(directory) === "node_modules"
38
+ || !isInside(options.root, directory) && existsSync(path.join(directory, "package.json"))) break;
39
+ const parent = path.dirname(directory);
40
+ if (parent === directory) break;
41
+ directory = parent;
42
+ }
43
+ }
44
+ return result;
45
+ }
46
+ function tracker() {
47
+ const observed = new Map();
48
+ const generation = cycle;
49
+ let nested = false;
50
+ return { name: "ads-preview-worker-inputs", enforce: "post",
51
+ buildStart() { for (const file of configuration) observed.set(file, fileHash(file)); },
52
+ load: { order: "pre", handler(id) { const file = filePath(id); if (file && !observed.has(file)) observed.set(file, fileHash(file)); } },
53
+ moduleParsed(info) {
54
+ if (/\bnew\s+(?:Worker|SharedWorker)\s*\(\s*new\s+URL\s*\(/.test(info.code ?? "")
55
+ || info.importedIds.some(id => /[?&](?:shared)?worker(?:[&=]|$)/.test(id))) nested = true;
56
+ },
57
+ generateBundle: { order: "post", handler(output, bundle) {
58
+ // Inline, nested and split ES workers retain Vite's normal path. Their
59
+ // extra parent-owned assets cannot be inferred from one worker bundle.
60
+ const chunks = Object.values(bundle).filter(item => item.type === "chunk");
61
+ if (generation !== cycle || format !== "iife" || nested || chunks.length !== 1 || chunks[0].imports.length || chunks[0].dynamicImports.length) return;
62
+ const entry = chunks[0].facadeModuleId;
63
+ if (!entry || !path.isAbsolute(entry)) return;
64
+ const files = new Map();
65
+ for (const id of [...this.getWatchFiles(), ...this.getModuleIds(), ...configuration]) {
66
+ const file = filePath(id);
67
+ if (!file) continue;
68
+ // Unobserved plugin inputs cannot establish a reusable snapshot.
69
+ const hash = observed.get(file);
70
+ if (!hash || fileHash(file) !== hash) return;
71
+ files.set(file, hash);
72
+ }
73
+ if (!files.has(entry)) return;
74
+ staged.set(entry, { entry, files, directories: directories(files), fileName: chunks[0].fileName,
75
+ assets: Object.values(bundle).map(item => ({ type: "asset", fileName: item.fileName,
76
+ source: item.type === "chunk" ? item.code : typeof item.source === "string" ? item.source : Buffer.from(item.source) })) });
77
+ } },
78
+ };
79
+ }
80
+ async function worker(context, file, query = "worker&url") {
81
+ let entry = staged.get(file) ?? bundles.get(file);
82
+ if (!valid(entry)) {
83
+ // Vite remains the compiler, including its configured worker plugins.
84
+ if (!pending.has(file)) pending.set(file, context.load({ id: file + "?" + query }));
85
+ await pending.get(file);
86
+ entry = staged.get(file);
87
+ }
88
+ if (!valid(entry)) return null;
89
+ for (const dependency of entry.files.keys()) context.addWatchFile(dependency);
90
+ return entry;
91
+ }
92
+ const plugin = { name: "ads-preview-worker-cache", enforce: "pre",
93
+ config(config) {
94
+ const original = config.worker?.plugins;
95
+ // Mutate this option: Vite merges returned worker plugin factories by
96
+ // concatenation, which would execute the project's plugins twice.
97
+ config.worker ??= {};
98
+ config.worker.plugins = (...args) => [typeof original === "function" ? original(...args) : original ?? [], tracker()];
99
+ },
100
+ configResolved(config) {
101
+ configuration = [...new Set([...(config.configFileDependencies ?? []), path.join(options.root, "package.json"), path.join(options.root, "tsconfig.json")])].filter(existsSync);
102
+ format = config.worker.format;
103
+ },
104
+ buildStart() { ++cycle; staged.clear(); pending.clear(); memo = new Map(); },
105
+ shouldTransformCachedModule({ meta }) {
106
+ // Preserve Vite's worker-importer transform lifecycle. Other plugins can
107
+ // have evaluated dependencies which no longer appear in emitted JS (for
108
+ // example extracted CSS); only the expensive worker sub-build is cached.
109
+ if (meta[metadata]?.length) return true;
110
+ return null;
111
+ },
112
+ async resolveId(source, importer) {
113
+ if (format !== "iife" || importer?.startsWith(virtual)) return null;
114
+ const index = source.indexOf("?");
115
+ if (index < 0) return null;
116
+ const query = new URLSearchParams(source.slice(index + 1));
117
+ if (!query.has("worker") || [...query].some(([key, value]) => !["worker", "url"].includes(key) || value)) return null;
118
+ const resolved = await this.resolve(source.slice(0, index), importer, { skipSelf: true });
119
+ const file = filePath(resolved?.id);
120
+ if (!file) return null;
121
+ const suffix = query.has("url") ? "worker&url" : "worker";
122
+ if (!await worker(this, file, suffix)) return { id: file + "?" + suffix };
123
+ return virtual + JSON.stringify([file, suffix]);
124
+ },
125
+ load(id) { if (id.startsWith(virtual)) return "export {};"; },
126
+ async transform(code, id) {
127
+ if (id.startsWith(virtual)) {
128
+ const [file, query] = JSON.parse(id.slice(virtual.length));
129
+ const entry = await worker(this, file, query);
130
+ if (!entry) return { code: `export {default} from ${JSON.stringify(file + "?" + query)};`, meta: { [metadata]: [] } };
131
+ const url = JSON.stringify("/" + entry.fileName);
132
+ return { code: query === "worker&url" ? `export default ${url};`
133
+ : `export default function WorkerWrapper(options){return new Worker(${url},{name:options?.name});}`,
134
+ meta: { [metadata]: [file] } };
135
+ }
136
+ const previous = this.getModuleInfo(id)?.meta[metadata];
137
+ if (format !== "iife" || !code.includes("Worker") || !code.includes("new URL")) return previous?.length ? { meta: { [metadata]: [] } } : null;
138
+ const source = ts.createSourceFile(id, code, ts.ScriptTarget.Latest, true, /\.[jt]sx(?:\?|$)/.test(id) ? ts.ScriptKind.TSX : ts.ScriptKind.TS);
139
+ const calls = [];
140
+ function visit(node) {
141
+ if (ts.isNewExpression(node) && ts.isIdentifier(node.expression) && node.expression.text === "Worker") {
142
+ const url = node.arguments?.[0];
143
+ if (url && ts.isNewExpression(url) && ts.isIdentifier(url.expression) && url.expression.text === "URL"
144
+ && url.arguments?.length === 2 && ts.isStringLiteralLike(url.arguments[0]) && url.arguments[1].getText(source) === "import.meta.url") calls.push(url);
145
+ }
146
+ ts.forEachChild(node, visit);
147
+ }
148
+ visit(source);
149
+ const replacements = [], used = new Set();
150
+ for (const url of calls) {
151
+ const value = url.arguments[0].text;
152
+ if (!value.startsWith(".") || /[?#]/.test(value)) continue;
153
+ const resolved = await this.resolve(value, id, { skipSelf: true });
154
+ const file = filePath(resolved?.id);
155
+ const entry = file && await worker(this, file);
156
+ if (!entry) continue;
157
+ used.add(entry.entry);
158
+ replacements.push([url.getStart(source), url.end, JSON.stringify("/" + entry.fileName)]);
159
+ }
160
+ for (const [start, end, value] of replacements.sort((a, b) => b[0] - a[0])) code = code.slice(0, start) + value + code.slice(end);
161
+ return replacements.length || previous?.length ? { code, map: null, meta: { [metadata]: [...used] } } : null;
162
+ },
163
+ generateBundle: { order: "post", handler(_output, bundle) {
164
+ const used = new Set();
165
+ for (const id of this.getModuleIds()) for (const file of this.getModuleInfo(id)?.meta[metadata] ?? []) used.add(file);
166
+ for (const file of used) {
167
+ const entry = staged.get(file) ?? bundles.get(file);
168
+ if (!valid(entry, true)) this.error("Worker inputs changed during preview compilation. Rebuild the current source.");
169
+ for (const asset of entry.assets) {
170
+ const existing = bundle[asset.fileName];
171
+ if (existing) {
172
+ if (existing.type !== "asset" || !Buffer.from(existing.source).equals(Buffer.from(asset.source))) this.error(`Worker asset path collision: ${asset.fileName}`);
173
+ continue;
174
+ }
175
+ this.emitFile(asset);
176
+ }
177
+ }
178
+ for (const file of bundles.keys()) if (!used.has(file) && !staged.has(file)) bundles.delete(file);
179
+ } },
180
+ writeBundle: { order: "post", handler() { if (isCurrent()) for (const [file, entry] of staged) if (valid(entry, true)) bundles.set(file, entry); staged.clear(); } },
181
+ closeWatcher() { ++cycle; bundles.clear(); staged.clear(); pending.clear(); memo.clear(); },
182
+ };
183
+ return plugin;
184
+ }
@@ -0,0 +1,47 @@
1
+ import { readdirSync, statSync } from "node:fs";
2
+ import path from "node:path";
3
+ import { isInside, isScenarioFile, sourceFiles } from "./config.mjs";
4
+
5
+ const children = directory => readdirSync(directory, { withFileTypes: true }).filter(entry => !entry.name.startsWith("."));
6
+
7
+ /** Grouping depends on directory entries, including files outside source globs. */
8
+ export function scenarioGroupFingerprint(options, files) {
9
+ const dsRoot = options.dsRoot ?? path.resolve(options.root, options.config.dsDir);
10
+ const directories = new Set();
11
+ for (const file of (files ?? sourceFiles(dsRoot)).filter(isScenarioFile)) {
12
+ const layer = path.relative(dsRoot, file).split(path.sep)[0];
13
+ if (!["components", "patterns", "composition"].includes(layer)) continue;
14
+ const boundary = path.join(dsRoot, layer);
15
+ for (let directory = path.dirname(file); directory !== boundary && isInside(boundary, directory); directory = path.dirname(directory)) directories.add(directory);
16
+ }
17
+ return JSON.stringify([...directories].sort().map(directory => [path.relative(dsRoot, directory), children(directory)
18
+ .map(entry => [entry.name, entry.isDirectory() ? "directory" : entry.isSymbolicLink() ? "symlink" : "file"])
19
+ .sort(([left], [right]) => left.localeCompare(right))]));
20
+ }
21
+
22
+ /** Group containers organize owners; an owner's own directory is never a group. */
23
+ export function createScenarioGroups({ dsRoot }) {
24
+ const containers = new Map();
25
+ function container(directory) {
26
+ if (!containers.has(directory)) {
27
+ try {
28
+ const entries = children(directory);
29
+ containers.set(directory, entries.length > 0 && entries.every(entry => entry.isDirectory() && !entry.isSymbolicLink()));
30
+ } catch { containers.set(directory, false); }
31
+ }
32
+ return containers.get(directory);
33
+ }
34
+ return (file, owner) => {
35
+ const relative = path.relative(dsRoot, file), layer = relative.split(path.sep)[0];
36
+ if (!["components", "patterns", "composition"].includes(layer)) return undefined;
37
+ const boundary = path.join(dsRoot, layer);
38
+ let directory = owner ? path.join(dsRoot, owner) : path.dirname(file);
39
+ try { if (!statSync(directory).isDirectory()) directory = path.dirname(directory); }
40
+ catch { directory = path.dirname(directory); }
41
+ const groups = [];
42
+ for (directory = path.dirname(directory); directory !== boundary && isInside(boundary, directory); directory = path.dirname(directory)) {
43
+ if (container(directory)) groups.unshift(path.basename(directory));
44
+ }
45
+ return groups.length ? groups.join(" / ") : undefined;
46
+ };
47
+ }
@@ -0,0 +1,34 @@
1
+ import { Worker, isMainThread, parentPort, workerData } from "node:worker_threads";
2
+ import { loadConfig } from "./config.mjs";
3
+ import { inspectScenarios } from "./scenarios.mjs";
4
+
5
+ // Discovery is semantic source analysis. Keep it off the live compiler's event
6
+ // loop; the caller fences each result against the exact project input digest.
7
+ if (!isMainThread && workerData?.adsScenarioInspector) {
8
+ parentPort.on("message", ({ id }) => {
9
+ try { parentPort.postMessage({ id, result: inspectScenarios(loadConfig(workerData.root)) }); }
10
+ catch (error) { parentPort.postMessage({ id, error: error.message }); }
11
+ });
12
+ }
13
+
14
+ export function createScenarioInspector(root) {
15
+ let worker, sequence = 0;
16
+ const pending = new Map();
17
+ function fail(error) { for (const task of pending.values()) task.reject(error); pending.clear(); }
18
+ return {
19
+ inspect() {
20
+ if (!worker) {
21
+ worker = new Worker(new URL(import.meta.url), { workerData: { adsScenarioInspector: true, root } });
22
+ worker.on("message", ({ id, result, error }) => {
23
+ const task = pending.get(id); pending.delete(id);
24
+ if (task) { if (error) task.reject(new Error(error)); else task.resolve(result); }
25
+ });
26
+ worker.on("error", fail);
27
+ worker.on("exit", () => { fail(new Error("Scenario inspector closed.")); worker = undefined; });
28
+ }
29
+ const id = ++sequence;
30
+ return new Promise((resolve, reject) => { pending.set(id, { resolve, reject }); worker.postMessage({ id }); });
31
+ },
32
+ async close() { const previous = worker; worker = undefined; fail(new Error("Scenario inspector closed.")); await previous?.terminate(); },
33
+ };
34
+ }
@@ -5,6 +5,7 @@ import { isDevelopmentFile, isInside, isReviewFile } from "./config.mjs";
5
5
  import { scenarioApi } from "./public-api.mjs";
6
6
  import { uiOperation } from "./ui-framework.mjs";
7
7
  import { inspectUnits } from "./units.mjs";
8
+ import { sourceSymbol } from "./source-symbols.mjs";
8
9
  import { createSourceValues, reference, union, isFunction } from "./source-values.mjs";
9
10
  import { inspectRuntimeContracts } from "./runtime-contracts.mjs";
10
11
  import { implementationNode } from "./unit-contracts.mjs";
@@ -18,7 +19,7 @@ export function createScenarioTrace(program, options) {
18
19
  if (!expression || seen.has(expression)) return false;
19
20
  seen.add(expression);
20
21
  const base = ts.isPropertyAccessExpression(expression) ? expression.expression : expression;
21
- const symbol = checker.getSymbolAtLocation(base);
22
+ const symbol = sourceSymbol(checker, base);
22
23
  for (const declaration of symbol?.declarations ?? []) {
23
24
  if (ts.isImportSpecifier(declaration) && (declaration.propertyName ?? declaration.name).text === name && ["@linaria/atomic", "@linaria/core"].includes(declaration.parent.parent.parent.moduleSpecifier.text)) return true;
24
25
  if (ts.isNamespaceImport(declaration) && ts.isPropertyAccessExpression(expression) && expression.name.text === name && ["@linaria/atomic", "@linaria/core"].includes(declaration.parent.parent.moduleSpecifier.text)) return true;
@@ -197,7 +198,7 @@ export function createScenarioTrace(program, options) {
197
198
  return { present: !property || value.kind !== "unknown", ok, reasons: [...reasons].slice(0, 3) };
198
199
  }
199
200
  function traceEntry(source, {exercise=false}={}) {
200
- const module=checker.getSymbolAtLocation(source),symbol=module&&checker.getExportsOfModule(module).find(symbol=>symbol.name==="default");
201
+ const module=sourceSymbol(checker, source),symbol=module&&checker.getExportsOfModule(module).find(symbol=>symbol.name==="default");
201
202
  const resolved=symbol?.flags&ts.SymbolFlags.Alias?checker.getAliasedSymbol(symbol):symbol;
202
203
  const declaration=resolved?.valueDeclaration;
203
204
  return traceRenders(declaration&&(ts.isExportAssignment(declaration)?declaration.expression:declaration.name??declaration),{entry:true,exercise});