@reqvire-org/ads 0.3.23 → 0.3.25
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/behaviors.mjs +6 -4
- package/dist/config.mjs +2 -1
- package/dist/contract-migration.mjs +1 -1
- package/dist/contracts.d.mts +2 -2
- package/dist/declarative-flow.mjs +144 -0
- package/dist/mcp/catalog.mjs +4 -2
- package/dist/mcp/mutations.mjs +4 -4
- package/dist/mcp/preview-widget.bundle.js +5 -5
- package/dist/runtime-contracts.mjs +26 -37
- package/dist/scenario-trace.mjs +47 -18
- package/dist/scenarios.mjs +1 -1
- package/dist/showcase/client.bundle.js +15 -15
- package/dist/skills/ads-break-ui/SKILL.md +2 -1
- package/dist/skills/ads-break-ui/references/contracts.md +50 -3
- package/dist/skills/ads-break-ui/references/guarded-editing.md +10 -0
- package/dist/skills/ads-designer/SKILL.md +2 -1
- package/dist/skills/ads-designer/references/contracts.md +50 -3
- package/dist/skills/ads-designer/references/guarded-editing.md +10 -0
- package/dist/skills/ads-import/SKILL.md +2 -1
- package/dist/skills/ads-import/references/contracts.md +50 -3
- package/dist/skills/ads-import/references/guarded-editing.md +10 -0
- package/dist/skills/ads-migrate/SKILL.md +2 -1
- package/dist/skills/ads-migrate/references/contracts.md +50 -3
- package/dist/skills/ads-migrate/references/guarded-editing.md +10 -0
- package/dist/skills/ads-motion/SKILL.md +2 -1
- package/dist/skills/ads-motion/references/contracts.md +50 -3
- package/dist/skills/ads-motion/references/guarded-editing.md +10 -0
- package/dist/source-values.mjs +3 -3
- package/dist/unit-contracts.mjs +23 -4
- package/dist/verification/browser.mjs +2 -0
- package/docs/ARCHITECTURE.md +5 -0
- package/docs/BEHAVIORS.md +8 -0
- package/docs/CHANGELOG.md +21 -0
- package/docs/CONTRACTS.md +50 -3
- package/docs/GUIDE.md +3 -1
- package/docs/MCP.md +23 -4
- package/package.json +1 -1
|
@@ -5,15 +5,21 @@ import { isDevelopmentFile, isReviewFile } from "./config.mjs";
|
|
|
5
5
|
import { inspectUnitContracts, implementationIdentity, implementationNode } from "./unit-contracts.mjs";
|
|
6
6
|
import { tokenContract } from "./token-policy.mjs";
|
|
7
7
|
import { uiOperation } from "./ui-framework.mjs";
|
|
8
|
+
import { createChildFlow } from "./declarative-flow.mjs";
|
|
8
9
|
import { unwrap, createSourceValues, reference } from "./source-values.mjs";
|
|
9
10
|
|
|
10
11
|
function fn(node) { return node && ts.isVariableDeclaration(node) ? unwrap(node.initializer) : node; }
|
|
11
12
|
function all(node, predicate) { const result=[];function visit(item){if(predicate(item))result.push(item);ts.forEachChild(item,visit);}if(node)visit(node);return result; }
|
|
12
13
|
|
|
13
14
|
export function inspectRuntimeContracts(options, program) {
|
|
15
|
+
// Contract discovery already owns a fully resolved program. Reuse it for
|
|
16
|
+
// typed array selections; the lightweight source guard program has no libs.
|
|
17
|
+
const declarations=inspectUnitContracts(options);
|
|
18
|
+
program=declarations.program??program;
|
|
14
19
|
if(options.runtimeContracts?.program===program)return options.runtimeContracts;
|
|
15
|
-
const checker=program.getTypeChecker()
|
|
20
|
+
const checker=program.getTypeChecker();
|
|
16
21
|
const result={program,diagnostics:[],bindings:[],parts:[],allowedStyles:new Set(),allowedStyleTypes:new Set()};
|
|
22
|
+
const partProofs=new Map();
|
|
17
23
|
options.runtimeContracts=result;
|
|
18
24
|
const key=node=>`${node.getSourceFile().fileName}:${node.pos}`;
|
|
19
25
|
const values=createSourceValues(program,options,{strict:true});
|
|
@@ -36,39 +42,14 @@ export function inspectRuntimeContracts(options, program) {
|
|
|
36
42
|
}
|
|
37
43
|
for(const contract of declarations.contracts) {
|
|
38
44
|
for(const part of contract.declarativeParts??[]) {
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
seen=new Set([...seen,expression]);
|
|
44
|
-
const merge=sets=>new Set(sets.flatMap(set=>[...set]));
|
|
45
|
-
if(ts.isPropertyAccessExpression(expression)&&expression.name.text==="children") {
|
|
46
|
-
if(canonical(expression.expression)===consumer?.parameters?.[0])return new Set(["children-input"]);
|
|
47
|
-
if(ts.isPropertyAccessExpression(expression.expression)&&expression.expression.name.text==="props"&&childOrigins(expression.expression.expression,seen).size)return new Set([key(expression)]);
|
|
48
|
-
}
|
|
49
|
-
const declaration=canonical(expression);
|
|
50
|
-
if(declaration&&ts.isBindingElement(declaration)&&ts.isObjectBindingPattern(declaration.parent)&&declaration.parent.parent===consumer?.parameters?.[0]&&(declaration.propertyName??declaration.name).getText()==="children")return new Set(["children-input"]);
|
|
51
|
-
if(declaration&&ts.isVariableDeclaration(declaration)) {
|
|
52
|
-
if(declaration.initializer)return childOrigins(declaration.initializer,seen);
|
|
53
|
-
if(ts.isVariableDeclarationList(declaration.parent)&&ts.isForOfStatement(declaration.parent.parent)&&childOrigins(declaration.parent.parent.expression,seen).size)return new Set([key(declaration)]);
|
|
54
|
-
}
|
|
55
|
-
if(declaration&&ts.isParameter(declaration)) {
|
|
56
|
-
const callback=declaration.parent,index=callback.parameters.indexOf(declaration),origins=[];
|
|
57
|
-
for(const call of calls) {
|
|
58
|
-
if(fn(canonical(call.expression))===callback&&call.arguments[index])origins.push(childOrigins(call.arguments[index],seen));
|
|
59
|
-
const operation=uiOperation(call.expression,checker);
|
|
60
|
-
const childrenCall=["Children.map","Children.forEach"].includes(operation)&&call.arguments[1]&&(call.arguments[1]===callback||fn(canonical(call.arguments[1]))===callback);
|
|
61
|
-
const arrayCall=ts.isPropertyAccessExpression(call.expression)&&["map","forEach","flatMap"].includes(call.expression.name.text)&&call.arguments[0]&&(call.arguments[0]===callback||fn(canonical(call.arguments[0]))===callback);
|
|
62
|
-
if(index===0&&(childrenCall&&childOrigins(call.arguments[0],seen).size||arrayCall&&childOrigins(call.expression.expression,seen).size))origins.push(new Set([key(declaration)]));
|
|
63
|
-
}
|
|
64
|
-
return merge(origins);
|
|
65
|
-
}
|
|
66
|
-
if(ts.isCallExpression(expression)) {
|
|
67
|
-
if(["Children.toArray","toChildArray"].includes(uiOperation(expression.expression,checker)))return childOrigins(expression.arguments[0],seen);
|
|
68
|
-
if(ts.isPropertyAccessExpression(expression.expression)&&["filter","slice"].includes(expression.expression.name.text))return childOrigins(expression.expression.expression,seen);
|
|
69
|
-
}
|
|
70
|
-
return new Set();
|
|
45
|
+
const proofId=`${part.api.identity}@${part.consumer.identity}`;
|
|
46
|
+
if(partProofs.has(proofId)) {
|
|
47
|
+
if(partProofs.get(proofId))result.parts.push({...part,unit:contract.unit,file:contract.file});
|
|
48
|
+
continue;
|
|
71
49
|
}
|
|
50
|
+
const consumer=fn(implementationNode(program,part.consumer,options.root));
|
|
51
|
+
const bodies=[...new Set(localCalls(consumer))],calls=[...new Set(bodies.flatMap(body=>all(body,ts.isCallExpression)))];
|
|
52
|
+
const childOrigins=createChildFlow({consumer,calls,bodies,canonical,key,checker});
|
|
72
53
|
const propOrigins=new Set(bodies.flatMap(body=>all(body,ts.isPropertyAccessExpression).filter(node=>node.name.text==="props").flatMap(node=>[...childOrigins(node.expression)])));
|
|
73
54
|
const readsProps=expression=>[...childOrigins(expression)].some(origin=>propOrigins.has(origin));
|
|
74
55
|
let consumed=false;
|
|
@@ -88,13 +69,15 @@ export function inspectRuntimeContracts(options, program) {
|
|
|
88
69
|
}
|
|
89
70
|
}
|
|
90
71
|
}
|
|
72
|
+
partProofs.set(proofId,!!consumer&&consumed);
|
|
91
73
|
if(!consumer||!consumed)report(contract,`${part.apiName}: cannot establish that ${part.consumer.symbol} identifies this declarative child from its children input by resolved symbol and reads that same child's props. A registration, decoy object, import or unused reference is not consumption.`,"declarative-consumer");
|
|
92
74
|
else result.parts.push({...part,unit:contract.unit,file:contract.file});
|
|
93
75
|
}
|
|
94
76
|
for(const [name,binding]of Object.entries(contract.bindings??{})) {
|
|
95
77
|
const producer=fn(implementationNode(program,binding.producer,options.root));
|
|
96
78
|
const [prefix,suffix]=binding.variable.split("${key}");
|
|
97
|
-
|
|
79
|
+
const valuePaths=typeof binding.valueFrom==="string"?[binding.valueFrom]:binding.valueFrom;
|
|
80
|
+
if(valuePaths.some(field=>!(contract.paintInputs??[]).some(input=>input.api.identity===binding.input.api.identity&&input.property===`${binding.input.property}.*.${field}`))) {report(contract,`${name}: register every valueFrom config-entry path as a constrained paint input. A producer does not authorize untyped config colours.`,"binding-input");continue;}
|
|
98
81
|
if([...tokenContract.naming.prefixes,"--ds-","--ux-","--showcase-"].some(value=>value.startsWith(prefix)||prefix.startsWith(value))||[...tokenContract.naming.names,...Object.keys(tokenContract.tokens)].some(value=>value.startsWith(prefix)&&value.endsWith(suffix))) {
|
|
99
82
|
report(contract,`${name}: runtime family ${binding.variable} overlaps the shared token vocabulary. Use a nonconflicting private runtime family; registration cannot grant shared-token overrides.`,"binding-collision");continue;
|
|
100
83
|
}
|
|
@@ -122,8 +105,14 @@ export function inspectRuntimeContracts(options, program) {
|
|
|
122
105
|
function pairMatches(template,value,keySymbol,valueSymbol) {
|
|
123
106
|
template=unwrap(template);value=unwrap(value);
|
|
124
107
|
if(!template||!ts.isTemplateExpression(template)||template.templateSpans.length!==1||template.head.text!==prefix||template.templateSpans[0].literal.text!==suffix||checker.getSymbolAtLocation(template.templateSpans[0].expression)!==keySymbol)return false;
|
|
125
|
-
|
|
126
|
-
|
|
108
|
+
function entryValue(expression) {
|
|
109
|
+
expression=unwrap(expression);const fields=[];while(expression&&ts.isPropertyAccessExpression(expression)){fields.unshift(expression.name.text);expression=unwrap(expression.expression);}
|
|
110
|
+
return expression&&checker.getSymbolAtLocation(expression)===valueSymbol&&valuePaths.includes(fields.join("."));
|
|
111
|
+
}
|
|
112
|
+
if(entryValue(value))return true;
|
|
113
|
+
return ts.isTemplateExpression(value)&&value.head.text==="light-dark("&&value.templateSpans.length===2
|
|
114
|
+
&&/^\s*,\s*$/.test(value.templateSpans[0].literal.text)&&value.templateSpans[1].literal.text===")"
|
|
115
|
+
&&value.templateSpans.every(span=>entryValue(span.expression));
|
|
127
116
|
}
|
|
128
117
|
function proveMap(body,seen=new Set()) {
|
|
129
118
|
if(!body?.parameters?.[0]||!ts.isIdentifier(body.parameters[0].name)||seen.has(body)||seen.size>8)return null;
|
|
@@ -163,7 +152,7 @@ export function inspectRuntimeContracts(options, program) {
|
|
|
163
152
|
return mapSymbol&&!escapes&&checker.getSymbolAtLocation(returned)===mapSymbol?[body]:null;
|
|
164
153
|
}
|
|
165
154
|
const proof=proveMap(producer);
|
|
166
|
-
if(!proof){report(contract,`${name}: producer must return only the declared config-entry paint map. Use Object.entries with a loop or Object.fromEntries/map, guard keys with /^[A-Za-z0-9_-]+$/ before writing (throw or continue), and the exact computed family. Owner-local helper returns are supported; escaped maps, extra writes and unknown returns grant no permission.`,"binding-producer");continue;}
|
|
155
|
+
if(!proof){report(contract,`${name}: producer must return only the declared config-entry paint map. Declare every source path in valueFrom (one path or an array), with matching paintInputs; theme pairs may use an exact light-dark() template over two declared paths. Use Object.entries with a loop or Object.fromEntries/map, guard keys with /^[A-Za-z0-9_-]+$/ before writing (throw or continue), and the exact computed family. Owner-local helper returns are supported; escaped maps, extra writes and unknown returns grant no permission.`,"binding-producer");continue;}
|
|
167
156
|
const scope=fn(implementationNode(program,binding.scope.api,options.root));
|
|
168
157
|
let attached=false;
|
|
169
158
|
const returnedElements=new Set();
|
package/dist/scenario-trace.mjs
CHANGED
|
@@ -27,10 +27,12 @@ export function createScenarioTrace(program, options) {
|
|
|
27
27
|
return false;
|
|
28
28
|
}
|
|
29
29
|
const isCx = expression => linaria(expression, "cx");
|
|
30
|
-
const { state, next, at, resolve, get, arrays, returns, props } = createSourceValues(program, options, { preserveCall: expression => isCx(expression) || uiOperation(expression, checker) === "createElement", strict: true });
|
|
30
|
+
const { state, next, at, resolve, get, arrays, returns, props } = createSourceValues(program, options, { preserveCall: expression => isCx(expression) || uiOperation(expression, checker) === "createElement" || ts.isPropertyAccessExpression(expression)&&["map","flatMap"].includes(expression.name.text), strict: true });
|
|
31
31
|
const publicNodes = new Map(), helpers = new Map(), inventory = inspectUnits(options);
|
|
32
32
|
const parts = inspectRuntimeContracts(options, program).parts.map(part => ({ ...part,
|
|
33
|
+
edge: `${part.api.identity}>${part.parent.identity}@${part.consumer.identity}`,
|
|
33
34
|
apiNode: resolve(reference(implementationNode(program, part.api, options.root)?.name), state()).node,
|
|
35
|
+
parentNode: resolve(reference(implementationNode(program, part.parent, options.root)?.name), state()).node,
|
|
34
36
|
consumerNode: resolve(reference(implementationNode(program, part.consumer, options.root)?.name), state()).node,
|
|
35
37
|
}));
|
|
36
38
|
const locationKey = value => JSON.stringify([value.file, value.line, value.column]);
|
|
@@ -66,19 +68,35 @@ export function createScenarioTrace(program, options) {
|
|
|
66
68
|
return null;
|
|
67
69
|
}
|
|
68
70
|
|
|
69
|
-
function traceRenders(site, { entry = false } = {}) {
|
|
71
|
+
function traceRenders(site, { entry = false, exercise = false } = {}) {
|
|
70
72
|
const limits = new Set();
|
|
71
|
-
|
|
73
|
+
const alternatives=exercise?combine:common;
|
|
74
|
+
const initial={...state(),...(exercise?{maxDepth:128,maxSteps:16000}:{})};
|
|
75
|
+
function mapped(value,context,visit) {
|
|
76
|
+
const call=value.node;
|
|
77
|
+
if(!call||!ts.isCallExpression(call)||!ts.isPropertyAccessExpression(call.expression)||!["map","flatMap"].includes(call.expression.name.text))return null;
|
|
78
|
+
const items=arrays(reference(call.expression.expression,value.env,value.via),next(context));
|
|
79
|
+
if(!items?.length)return new Set();
|
|
80
|
+
const callback=resolve(reference(call.arguments[0],value.env,value.via),next(context));
|
|
81
|
+
if(callback.kind!=="node"||!isFunction(callback.node))return new Set();
|
|
82
|
+
return combine(items.slice(0,maxBranches).map((item,index)=>combine(returns(callback,[item,{kind:"literal",value:index}],next(context)).map(output=>visit(output,next(context))))));
|
|
83
|
+
}
|
|
84
|
+
function childParts(input, context, parent = null) {
|
|
72
85
|
const value = resolve(input, next(context));
|
|
73
|
-
if (value.kind === "union") return
|
|
74
|
-
if (value.kind === "array") return combine(value.values.map(item => childParts(item, next(context))));
|
|
86
|
+
if (value.kind === "union") return alternatives(value.values.slice(0, maxBranches).map(item => childParts(item, next(context),parent)));
|
|
87
|
+
if (value.kind === "array") return combine(value.values.map(item => childParts(item, next(context),parent)));
|
|
75
88
|
if (value.kind !== "node") return new Set();
|
|
76
|
-
|
|
77
|
-
if
|
|
89
|
+
const mappedChildren=mapped(value,context,(output,context)=>childParts(output,context,parent));
|
|
90
|
+
if(mappedChildren)return mappedChildren;
|
|
91
|
+
if (ts.isJsxExpression(value.node)) return childParts(reference(value.node.expression, value.env, value.via), next(context),parent);
|
|
92
|
+
if (ts.isJsxFragment(value.node)) return combine(value.node.children.map(item => childParts(reference(item, value.env, value.via), next(context),parent)));
|
|
78
93
|
const view = element(value.node, value.env, value.via);
|
|
79
94
|
if (!view) return new Set();
|
|
80
95
|
const target = resolve(view.tag, next(context));
|
|
81
|
-
|
|
96
|
+
if(["provider","context"].includes(target.kind))return childParts(get(view.attributes,"children",next(context)),next(context),parent);
|
|
97
|
+
const matched=parts.filter(part=>part.apiNode&&part.apiNode===target.node);
|
|
98
|
+
const edges=matched.filter(part=>parent?part.parentNode===parent:!parts.some(other=>other.apiNode===part.parentNode)).map(part=>part.edge);
|
|
99
|
+
return new Set([...edges,...(matched.length?childParts(get(view.attributes,"children",next(context)),next(context),target.node):[])]);
|
|
82
100
|
}
|
|
83
101
|
function render(input, context) {
|
|
84
102
|
const value = resolve(input, next(context));
|
|
@@ -86,10 +104,11 @@ export function createScenarioTrace(program, options) {
|
|
|
86
104
|
if (value.kind === "unknown") { if (value.reason) limits.add(value.reason); return new Set(); }
|
|
87
105
|
if (value.kind === "union") {
|
|
88
106
|
if (value.values.length > maxBranches) { limits.add("Scenario render tracing reached its alternative limit."); return new Set(); }
|
|
89
|
-
return
|
|
107
|
+
return alternatives(value.values.map(item => render(item, next(context))));
|
|
90
108
|
}
|
|
91
109
|
if (value.kind === "array") return combine(value.values.map(item => render(item, next(context))));
|
|
92
110
|
if (value.kind !== "node") return new Set();
|
|
111
|
+
if(exercise){const mappedChildren=mapped(value,context,render);if(mappedChildren)return mappedChildren;}
|
|
93
112
|
const { node, env, via } = value;
|
|
94
113
|
if (ts.isJsxExpression(node)) return render(reference(node.expression, env, via), next(context));
|
|
95
114
|
if (ts.isJsxFragment(node)) return combine(node.children.map(child => render(reference(child, env, via), next(context))));
|
|
@@ -100,21 +119,31 @@ export function createScenarioTrace(program, options) {
|
|
|
100
119
|
function component(input) {
|
|
101
120
|
const target = resolve(input, next(context));
|
|
102
121
|
if (["provider", "context"].includes(target.kind)) return render(get(view.attributes, "children", next(context)), next(context));
|
|
103
|
-
if (target.kind === "union") return target.values.length <= maxBranches ?
|
|
122
|
+
if (target.kind === "union") return target.values.length <= maxBranches ? alternatives(target.values.map(component)) : new Set();
|
|
104
123
|
if (target.kind !== "node") return new Set();
|
|
105
124
|
const names = new Set(publicNodes.get(target.node) ?? []);
|
|
106
|
-
|
|
125
|
+
const children=parts.some(part=>target.node===part.consumerNode)?childParts(get(view.attributes,"children",next(context)),next(context)):new Set();
|
|
126
|
+
for (const part of parts) if (target.node === part.consumerNode && children.has(part.edge)) names.add(`@consumed:${part.edge}`);
|
|
107
127
|
if (isFunction(target.node) && (entry || !isDevelopmentFile(target.node.getSourceFile().fileName, options) || isReviewFile(target.node.getSourceFile().fileName, options))) {
|
|
108
|
-
const
|
|
109
|
-
|
|
128
|
+
const sites=context.componentSites??new Set();
|
|
129
|
+
if(sites.has(node))limits.add("Recursive component source site could not be fully traced.");
|
|
130
|
+
else {
|
|
131
|
+
const nested={...next(context),componentSites:new Set([...sites,node])};
|
|
132
|
+
const outputs = returns(target, [view.attributes], nested, "component");
|
|
133
|
+
for (const name of render(union(outputs), nested)) names.add(name);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
for(let pass=0;pass<parts.length;pass++) {
|
|
137
|
+
const count=names.size;
|
|
138
|
+
for (const part of parts) if ((names.has(part.parentName)||names.has(`@exercised:${part.parentName}`)) && names.has(`@consumed:${part.edge}`)) names.add(`@exercised:${part.apiName}`);
|
|
139
|
+
if(names.size===count)break;
|
|
110
140
|
}
|
|
111
|
-
for (const part of parts) if (names.has(part.parentName) && names.has(`@consumed:${part.apiName}`)) names.add(`@exercised:${part.apiName}`);
|
|
112
141
|
return names;
|
|
113
142
|
}
|
|
114
143
|
return component(view.tag);
|
|
115
144
|
}
|
|
116
|
-
const target=entry&&resolve(reference(site),
|
|
117
|
-
const evidence = target?.kind==="node"&&isFunction(target.node) ? render(union(returns(target,[{kind:"object",layers:[]}],
|
|
145
|
+
const target=entry&&resolve(reference(site),initial);
|
|
146
|
+
const evidence = target?.kind==="node"&&isFunction(target.node) ? render(union(returns(target,[{kind:"object",layers:[]}],initial,"component")),initial) : render(reference(site), initial);
|
|
118
147
|
return { rendered: new Set([...evidence].filter(name => !name.startsWith("@"))), declarative: new Set([...evidence].filter(name => name.startsWith("@exercised:")).map(name => name.slice(11))), limits: [...limits].slice(0, 3) };
|
|
119
148
|
}
|
|
120
149
|
|
|
@@ -167,11 +196,11 @@ export function createScenarioTrace(program, options) {
|
|
|
167
196
|
if (!ok && !reasons.size) reasons.add("Each nonempty return path needs owned Linaria styles; stable hooks alone are not styling evidence.");
|
|
168
197
|
return { present: !property || value.kind !== "unknown", ok, reasons: [...reasons].slice(0, 3) };
|
|
169
198
|
}
|
|
170
|
-
function traceEntry(source) {
|
|
199
|
+
function traceEntry(source, {exercise=false}={}) {
|
|
171
200
|
const module=checker.getSymbolAtLocation(source),symbol=module&&checker.getExportsOfModule(module).find(symbol=>symbol.name==="default");
|
|
172
201
|
const resolved=symbol?.flags&ts.SymbolFlags.Alias?checker.getAliasedSymbol(symbol):symbol;
|
|
173
202
|
const declaration=resolved?.valueDeclaration;
|
|
174
|
-
return traceRenders(declaration&&(ts.isExportAssignment(declaration)?declaration.expression:declaration.name??declaration),{entry:true});
|
|
203
|
+
return traceRenders(declaration&&(ts.isExportAssignment(declaration)?declaration.expression:declaration.name??declaration),{entry:true,exercise});
|
|
175
204
|
}
|
|
176
205
|
return { traceRenders, traceEntry, classValue };
|
|
177
206
|
}
|
package/dist/scenarios.mjs
CHANGED
|
@@ -282,7 +282,7 @@ export function inspectScenarioCoverage(options, program, report, advise = () =>
|
|
|
282
282
|
ts.forEachChild(node, child => visit(child, reached && (ts.isExportAssignment(node) || ts.isVariableDeclaration(node))));
|
|
283
283
|
}
|
|
284
284
|
for (const node of source.statements) if (ts.isExportAssignment(node) || node.modifiers?.some(item => item.kind === ts.SyntaxKind.DefaultKeyword)) visit(node, true);
|
|
285
|
-
if(parts.some(part=>scenario.exercises?.includes(part.apiName)))for(const name of trace.traceEntry(source).declarative)declarative.add(name);
|
|
285
|
+
if(parts.some(part=>scenario.exercises?.includes(part.apiName)))for(const name of trace.traceEntry(source,{exercise:true}).declarative)declarative.add(name);
|
|
286
286
|
for (const name of scenario.covers) {
|
|
287
287
|
if (!rendered.has(name)) report(source.fileName, "scenario-render", `${name} is declared in covers but has no reachable public render reference. Render it directly or through a traced parent with fixture props/defaults selecting that child. Imports, unused JSX and unknown conditional paths do not establish coverage.${renderLimits.size ? ` Source tracing could not establish: ${[...renderLimits].slice(0, 2).join(" ")}` : ""} Review the real scenario in a browser; do not hide a valid public part just to avoid coverage. See ads://guides/scenarios.`);
|
|
288
288
|
else covered.add(name);
|