@reqvire-org/ads 0.3.28 → 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.
- package/dist/atomic-composition.mjs +2 -1
- package/dist/behaviors.mjs +2 -2
- package/dist/boundaries.mjs +6 -3
- package/dist/check.mjs +3 -0
- package/dist/cli.mjs +13 -0
- package/dist/config.mjs +5 -3
- package/dist/mcp/build-status.mjs +17 -4
- package/dist/mcp/context.mjs +2 -1
- package/dist/mcp/execution-results.mjs +4 -3
- package/dist/mcp/mutations.mjs +5 -43
- package/dist/mcp/preview-watch.mjs +23 -3
- package/dist/mcp/preview-widget.bundle.js +16 -15
- package/dist/mcp/resource-loader.js +40 -12
- package/dist/mcp/server.mjs +74 -36
- package/dist/oxlint.mjs +6 -1
- package/dist/preview-builder.mjs +10 -4
- package/dist/preview-resources.mjs +11 -4
- package/dist/preview-scope.mjs +6 -0
- package/dist/preview-workers.mjs +184 -0
- package/dist/scenario-inspector.mjs +34 -0
- package/dist/scenario-trace.mjs +3 -2
- package/dist/scenarios-compiler.mjs +200 -25
- package/dist/showcase/client.bundle.js +22 -21
- package/dist/showcase/index.html +2 -2
- package/dist/showcase/style.css +2 -1
- package/dist/skills/ads-break-ui/SKILL.md +3 -0
- package/dist/skills/ads-break-ui/references/runtimes.md +31 -0
- package/dist/skills/ads-break-ui/references/validation.md +53 -0
- package/dist/skills/ads-designer/SKILL.md +3 -0
- package/dist/skills/ads-designer/references/runtimes.md +31 -0
- package/dist/skills/ads-designer/references/validation.md +53 -0
- package/dist/skills/ads-import/SKILL.md +3 -0
- package/dist/skills/ads-import/references/runtimes.md +31 -0
- package/dist/skills/ads-import/references/validation.md +53 -0
- package/dist/skills/ads-motion/SKILL.md +3 -0
- package/dist/skills/ads-motion/references/runtimes.md +31 -0
- package/dist/skills/ads-motion/references/validation.md +53 -0
- package/dist/skills/ads-port/SKILL.md +3 -0
- package/dist/skills/ads-port/references/runtimes.md +31 -0
- package/dist/skills/ads-port/references/validation.md +53 -0
- package/dist/source-symbols.mjs +11 -0
- package/dist/source-values.mjs +10 -3
- package/dist/test-boundaries.mjs +95 -0
- package/dist/ui-framework.mjs +2 -1
- package/dist/units.mjs +12 -1
- package/dist/validation-checks.mjs +50 -0
- package/dist/validation.mjs +172 -0
- package/dist/verification/browser.mjs +3 -1
- package/dist/verification.mjs +1 -0
- package/docs/ARCHITECTURE.md +72 -17
- package/docs/CHANGELOG.md +37 -0
- package/docs/MCP.md +68 -9
- package/package.json +1 -1
package/dist/showcase/index.html
CHANGED
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
<button data-section="patterns"><svg viewBox="0 0 16 16"><rect x="2" y="2" width="5" height="5"/><rect x="10" y="2" width="4" height="5"/><rect x="2" y="10" width="5" height="4"/><rect x="10" y="10" width="4" height="4"/></svg>Patterns</button>
|
|
11
11
|
<button data-section="composition"><svg viewBox="0 0 16 16"><path d="M2 2h4v4H2zM10 2h4v4h-4zM2 10h4v4H2zM10 10h4v4h-4z"/></svg>Composition</button>
|
|
12
12
|
</nav>
|
|
13
|
-
<div class="actions"><button id="theme" aria-label="Use dark theme" title="Use dark theme"><svg viewBox="0 0 16 16"><path d="M13.5 9a5.5 5.5 0 0 1-6.5-6.5A5.5 5.5 0 1 0 13.5 9Z"/></svg></button><button id="minimize" aria-label="Minimize showcase menu" title="Minimize showcase menu (refresh to restore)"><svg viewBox="0 0 16 16"><path d="m4 10 4-4 4 4"/></svg></button></div>
|
|
13
|
+
<div class="actions"><button id="preview-status" data-phase="opening" aria-label="Preview status: Connecting to ADS MCP…" title="Connecting to ADS MCP…" popovertarget="status-details"><span class="status-dot" aria-hidden="true"></span></button><div id="status-details" popover><p id="status" role="status">Connecting to ADS MCP…</p></div><button id="theme" aria-label="Use dark theme" title="Use dark theme"><svg viewBox="0 0 16 16"><path d="M13.5 9a5.5 5.5 0 0 1-6.5-6.5A5.5 5.5 0 1 0 13.5 9Z"/></svg></button><button id="minimize" aria-label="Minimize showcase menu" title="Minimize showcase menu (refresh to restore)"><svg viewBox="0 0 16 16"><path d="m4 10 4-4 4 4"/></svg></button></div>
|
|
14
14
|
</header>
|
|
15
|
-
<main><aside id="sidebar"><nav id="entries" aria-label="Tokens"></nav></aside><section id="preview" aria-label="Preview"><
|
|
15
|
+
<main><aside id="sidebar"><nav id="entries" aria-label="Tokens"></nav></aside><section id="preview" aria-label="Preview"><div id="frame-slot"></div></section></main>
|
|
16
16
|
<script type="module" src="/client.js"></script>
|
|
17
17
|
</body></html>
|
package/dist/showcase/style.css
CHANGED
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
header{height:52px;display:flex;flex:none;border-bottom:1px solid var(--frame-line);align-items:stretch;background:var(--frame-bg)}#brand{width:var(--pane-width);display:flex;flex:none;gap:8px;align-items:center;padding:0 12px;border-right:1px solid var(--frame-line);font-weight:600;white-space:nowrap}#brand .mark{font-weight:700}#title{min-width:0;overflow:hidden;text-overflow:ellipsis}#pane-toggle{width:28px;height:28px;margin-inline-start:auto;display:grid;place-items:center;flex:none}.collapsed #brand{width:44px;padding:0 8px;border-right:0}.collapsed #brand .mark,.collapsed #title{display:none}
|
|
5
5
|
#sections{display:flex;gap:4px;align-items:center;min-width:0;overflow-x:auto;padding:8px}#sections button{display:flex;align-items:center;gap:8px;flex:none;border-color:transparent;padding:6px 10px}#sections button[aria-current="page"]{border-color:var(--frame-line)}#sections svg{opacity:.7}.actions{display:flex;align-items:center;gap:4px;margin-inline-start:auto;padding:8px;flex:none}.actions button{width:28px;height:28px;display:grid;place-items:center}
|
|
6
6
|
main{flex:1;min-height:0;display:flex}#sidebar{width:var(--pane-width);flex:none;border-right:1px solid var(--frame-line);overflow-y:auto;background:var(--frame-bg)}#entries{display:flex;flex-direction:column;gap:4px;padding:8px}#entries a{flex:none;padding:8px;border:1px solid transparent;border-radius:4px;text-decoration:none;overflow-wrap:anywhere}#entries a:hover,#entries a[aria-current="page"]{border-color:var(--frame-line)}#entries a[aria-current="page"]{font-weight:600}
|
|
7
|
-
#preview{position:relative;flex:1;min-width:0;min-height:0;display:flex;flex-direction:column;overflow:hidden}#frame-slot{flex:1;min-height:0;min-width:0}iframe{display:block;width:100%;height:100%;border:0}
|
|
7
|
+
#preview{position:relative;flex:1;min-width:0;min-height:0;display:flex;flex-direction:column;overflow:hidden}#frame-slot{flex:1;min-height:0;min-width:0}iframe{display:block;width:100%;height:100%;border:0}
|
|
8
|
+
#preview-status{border-color:transparent}.status-dot{width:8px;height:8px;border-radius:50%;background:currentColor;opacity:.45}#preview-status:not([data-phase="ready"]):not([data-phase="error"]) .status-dot{background:transparent;border:1.5px solid currentColor;animation:status-pulse 1.6s ease-in-out infinite}#preview-status[data-phase="error"] .status-dot{width:12px;height:12px;background:transparent;border:1px solid currentColor;opacity:1;display:grid;place-items:center}#preview-status[data-phase="error"] .status-dot:after{content:"!";font:600 9px/1 system-ui}#preview-status:hover,#preview-status:focus-visible{border-color:var(--frame-line)}#status-details{position:fixed;inset:58px 8px auto auto;margin:0;width:max-content;max-width:min(480px,calc(100vw - 16px));max-height:40vh;overflow:auto;padding:12px 16px;border:1px solid var(--frame-line);border-radius:6px;background:var(--frame-bg);color:var(--frame-ink)}#status{margin:0;white-space:pre-wrap;overflow-wrap:anywhere}@keyframes status-pulse{50%{opacity:.9}}@media(prefers-reduced-motion:reduce){.status-dot{animation:none!important}}[hidden],.collapsed #sidebar{display:none!important}@media(max-width:760px){#title{display:none}}
|
|
8
9
|
/* The capture host keeps the same MCP client/bridge and gives the App the exact requested viewport. */
|
|
9
10
|
.entry-group{min-width:0}.entry-group summary{cursor:pointer;padding:8px;font-weight:600;overflow-wrap:anywhere}.entry-group summary:focus-visible{outline:2px solid var(--frame-ink);outline-offset:-2px}.entry-group>div{display:flex;flex-direction:column;gap:4px;padding-inline-start:8px}
|
|
10
11
|
:root[data-capture="true"] #header,:root[data-capture="true"] #sidebar{display:none!important}
|
|
@@ -3,6 +3,9 @@ name: ads-break-ui
|
|
|
3
3
|
description: Stress-test a project's local design-system components or patterns with extreme realistic content, empty and failure states, narrow containers, and accessibility settings. Build development fixtures, report layout failures, and fix them when requested.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
+
For validation scope, full audits, and CLI/MCP parity, read
|
|
7
|
+
[validation.md](references/validation.md).
|
|
8
|
+
|
|
6
9
|
For Node/Bun setup, MCP launch and compiler workers, read
|
|
7
10
|
[runtimes.md](references/runtimes.md).
|
|
8
11
|
|
|
@@ -103,6 +103,37 @@ compiler. Existing custom adapters still work; they must adopt the helper to gai
|
|
|
103
103
|
incremental transforms. Upgrade the project dependency and restart the builder.
|
|
104
104
|
Keep the full validation callback and production build behavior.
|
|
105
105
|
|
|
106
|
+
The shared watched builder reuses completed self-contained IIFE worker bundles
|
|
107
|
+
for constructor URLs and standard `?worker`/`?worker&url` imports. It uses Vite's
|
|
108
|
+
configured worker plugins, deduplicates pending requests, tracks real worker and
|
|
109
|
+
configuration dependencies and checks resolution-directory changes. Assets are
|
|
110
|
+
included on every refresh. Changing a transitive worker import rebuilds its
|
|
111
|
+
bundle; failed or superseded work cannot populate the cache. Nested, inline and
|
|
112
|
+
split workers keep the normal Vite path. Keep worker lifetimes/cancellation in
|
|
113
|
+
their owning component/controller; compiler reuse does not keep runtime workers
|
|
114
|
+
alive. Do not add project-specific worker names or lists to ADS.
|
|
115
|
+
|
|
116
|
+
Watched resource builds publish explicitly unverified live feedback while full
|
|
117
|
+
checks and semantic registry inspection run in the background. Rapid edits
|
|
118
|
+
coalesce behind one verification run. The showcase can browse that feedback
|
|
119
|
+
without a blocking loading overlay; a quiet header indicator exposes checking,
|
|
120
|
+
reload, failure and fallback details. A failed edit restores the last verified
|
|
121
|
+
view. Preview minification is disabled only for watched builds.
|
|
122
|
+
|
|
123
|
+
`ads_show_scenario` and `ads_show_tokens` default to `waitFor: "verified"`.
|
|
124
|
+
Interactive browsing can request `waitFor: "compiled"`, which may return live or
|
|
125
|
+
retained output with `build.current: false`. `build.live.validated: false` and
|
|
126
|
+
`ads://preview/live` are never proof of passing checks. Captures, behavior checks
|
|
127
|
+
and guarded publication still require accepted, current output. Do not replace
|
|
128
|
+
the validation callback with a faster incomplete check to speed up the viewer.
|
|
129
|
+
|
|
130
|
+
Accepted MCP edits prepare previews without requiring a viewer request. Matching
|
|
131
|
+
checked candidate graphs and registry metadata reuse the existing project cache;
|
|
132
|
+
incompatible output falls back to background compilation. The connected showcase
|
|
133
|
+
can prefetch changed peers' static bytes without evaluating or mounting them.
|
|
134
|
+
Reuse depends on content and dependencies, with no time-based expiry. Preparation
|
|
135
|
+
does not establish additional behavior or visual evidence.
|
|
136
|
+
|
|
106
137
|
The App preserves selected form/scroll state across accepted unrelated graph
|
|
107
138
|
updates, reruns audits and remounts when its own module/style/asset closure changes.
|
|
108
139
|
Do not promise component-level HMR. Guarded edits select affected behavior owners
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Validation scope
|
|
2
|
+
|
|
3
|
+
Use `ads_validate({})` for the complete project audit, equivalent to `ads validate`.
|
|
4
|
+
Use `ads_validate({scope:"changed"})`, equivalent to `ads validate --changed`, during
|
|
5
|
+
editing when a successful full baseline exists. Both interfaces call the same
|
|
6
|
+
engine. Full is the default.
|
|
7
|
+
|
|
8
|
+
- During local editing, use existing guarded edits and affected behavior checks.
|
|
9
|
+
Reuse completed guards for unchanged source rather than repeatedly auditing all
|
|
10
|
+
owners. Direct edits need `ads_check` and appropriate project/behavior checks.
|
|
11
|
+
- After test migrations, ownership changes or validation/runner configuration
|
|
12
|
+
changes, run full validation. Also run it before a release or an explicit request
|
|
13
|
+
to validate everything. It validates the current source, not a prepared draft.
|
|
14
|
+
- Inspect failures through `ads_results` using the returned resultId and sections
|
|
15
|
+
diagnostics, checks or outcomes. For browser failures, use the outcome's exact
|
|
16
|
+
unit/check/runId with `ads_investigate`. Fix the owner and rerun the appropriate scope.
|
|
17
|
+
- Report the actual scope and revision. Scoped, stale, cancelled or incomplete
|
|
18
|
+
runs cannot establish successful full validation. Passing covers registered
|
|
19
|
+
checks and configured scripts, not arbitrary assertions, visual parity or every
|
|
20
|
+
application state.
|
|
21
|
+
|
|
22
|
+
Full validation runs core architecture/test-boundary guards, registered Oxlint,
|
|
23
|
+
project scripts and every registered behavior contract. Defaults use the existing
|
|
24
|
+
mutation-check scripts plus a project's `test` and build scripts when present.
|
|
25
|
+
Build selection prefers `build:lib`, then `build:app`, then `build`.
|
|
26
|
+
Projects can declare `validation.checks` as a list of package
|
|
27
|
+
script names for the complete audit; core/Oxlint and registered behaviors remain
|
|
28
|
+
mandatory. Commands are trusted project configuration, never MCP arguments.
|
|
29
|
+
Use scripts that check/build without changing source. Avoid calling `ads validate`
|
|
30
|
+
from a script selected by validation.
|
|
31
|
+
|
|
32
|
+
Changed mode compares current content, including added/deleted files, with the
|
|
33
|
+
last successful full baseline in `.ds/validation-baseline.json`. No Git history is
|
|
34
|
+
required. A missing/incompatible baseline or a change to configuration, foundation,
|
|
35
|
+
ownership that no longer resolves, or unclassified input expands to full and
|
|
36
|
+
reports the reason. Scoped runs leave the full baseline unchanged. Core architecture
|
|
37
|
+
checks and opaque project commands still run in full; behavior selection narrows
|
|
38
|
+
to affected owner contracts. This is not a per-test-result cache.
|
|
39
|
+
|
|
40
|
+
ADS tests live with their component, pattern, controller, composition or review
|
|
41
|
+
owner. Private imports must resolve to that owner, including through helpers;
|
|
42
|
+
peer implementations use the public API. Marked behavior specs must be registered
|
|
43
|
+
in an owner contract. Pure ADS tests outside those owners fail the boundary guard.
|
|
44
|
+
Application integration tests may exercise public UI alongside their real application
|
|
45
|
+
runtime subject. Ordinary local unit tests retain their project's runner; full
|
|
46
|
+
validation includes the configured test script. Registration is enforced for ADS
|
|
47
|
+
behavior specs, not inferred for every case in an arbitrary runner.
|
|
48
|
+
|
|
49
|
+
During execution `ads_status.validation` reports progress. MCP summaries retain a
|
|
50
|
+
separate latest validation result, alongside verification and mutation results.
|
|
51
|
+
Source changes during execution reject success and leave the previous full
|
|
52
|
+
baseline intact. Skipped registered behavior cases never pass; a project with no
|
|
53
|
+
registered behavior contracts reports that stage as skipped with a reason.
|
|
@@ -3,6 +3,9 @@ name: ads-designer
|
|
|
3
3
|
description: Bootstrap an empty local React design system from bundled scaffolding, or build UI using a project's existing design system. Covers shared token contracts, local ownership, public APIs, external source integration, showcase inspection, and validation.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
+
For validation scope, full audits, and CLI/MCP parity, read
|
|
7
|
+
[validation.md](references/validation.md).
|
|
8
|
+
|
|
6
9
|
For Node/Bun setup, MCP launch and compiler workers, read
|
|
7
10
|
[runtimes.md](references/runtimes.md).
|
|
8
11
|
|
|
@@ -103,6 +103,37 @@ compiler. Existing custom adapters still work; they must adopt the helper to gai
|
|
|
103
103
|
incremental transforms. Upgrade the project dependency and restart the builder.
|
|
104
104
|
Keep the full validation callback and production build behavior.
|
|
105
105
|
|
|
106
|
+
The shared watched builder reuses completed self-contained IIFE worker bundles
|
|
107
|
+
for constructor URLs and standard `?worker`/`?worker&url` imports. It uses Vite's
|
|
108
|
+
configured worker plugins, deduplicates pending requests, tracks real worker and
|
|
109
|
+
configuration dependencies and checks resolution-directory changes. Assets are
|
|
110
|
+
included on every refresh. Changing a transitive worker import rebuilds its
|
|
111
|
+
bundle; failed or superseded work cannot populate the cache. Nested, inline and
|
|
112
|
+
split workers keep the normal Vite path. Keep worker lifetimes/cancellation in
|
|
113
|
+
their owning component/controller; compiler reuse does not keep runtime workers
|
|
114
|
+
alive. Do not add project-specific worker names or lists to ADS.
|
|
115
|
+
|
|
116
|
+
Watched resource builds publish explicitly unverified live feedback while full
|
|
117
|
+
checks and semantic registry inspection run in the background. Rapid edits
|
|
118
|
+
coalesce behind one verification run. The showcase can browse that feedback
|
|
119
|
+
without a blocking loading overlay; a quiet header indicator exposes checking,
|
|
120
|
+
reload, failure and fallback details. A failed edit restores the last verified
|
|
121
|
+
view. Preview minification is disabled only for watched builds.
|
|
122
|
+
|
|
123
|
+
`ads_show_scenario` and `ads_show_tokens` default to `waitFor: "verified"`.
|
|
124
|
+
Interactive browsing can request `waitFor: "compiled"`, which may return live or
|
|
125
|
+
retained output with `build.current: false`. `build.live.validated: false` and
|
|
126
|
+
`ads://preview/live` are never proof of passing checks. Captures, behavior checks
|
|
127
|
+
and guarded publication still require accepted, current output. Do not replace
|
|
128
|
+
the validation callback with a faster incomplete check to speed up the viewer.
|
|
129
|
+
|
|
130
|
+
Accepted MCP edits prepare previews without requiring a viewer request. Matching
|
|
131
|
+
checked candidate graphs and registry metadata reuse the existing project cache;
|
|
132
|
+
incompatible output falls back to background compilation. The connected showcase
|
|
133
|
+
can prefetch changed peers' static bytes without evaluating or mounting them.
|
|
134
|
+
Reuse depends on content and dependencies, with no time-based expiry. Preparation
|
|
135
|
+
does not establish additional behavior or visual evidence.
|
|
136
|
+
|
|
106
137
|
The App preserves selected form/scroll state across accepted unrelated graph
|
|
107
138
|
updates, reruns audits and remounts when its own module/style/asset closure changes.
|
|
108
139
|
Do not promise component-level HMR. Guarded edits select affected behavior owners
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Validation scope
|
|
2
|
+
|
|
3
|
+
Use `ads_validate({})` for the complete project audit, equivalent to `ads validate`.
|
|
4
|
+
Use `ads_validate({scope:"changed"})`, equivalent to `ads validate --changed`, during
|
|
5
|
+
editing when a successful full baseline exists. Both interfaces call the same
|
|
6
|
+
engine. Full is the default.
|
|
7
|
+
|
|
8
|
+
- During local editing, use existing guarded edits and affected behavior checks.
|
|
9
|
+
Reuse completed guards for unchanged source rather than repeatedly auditing all
|
|
10
|
+
owners. Direct edits need `ads_check` and appropriate project/behavior checks.
|
|
11
|
+
- After test migrations, ownership changes or validation/runner configuration
|
|
12
|
+
changes, run full validation. Also run it before a release or an explicit request
|
|
13
|
+
to validate everything. It validates the current source, not a prepared draft.
|
|
14
|
+
- Inspect failures through `ads_results` using the returned resultId and sections
|
|
15
|
+
diagnostics, checks or outcomes. For browser failures, use the outcome's exact
|
|
16
|
+
unit/check/runId with `ads_investigate`. Fix the owner and rerun the appropriate scope.
|
|
17
|
+
- Report the actual scope and revision. Scoped, stale, cancelled or incomplete
|
|
18
|
+
runs cannot establish successful full validation. Passing covers registered
|
|
19
|
+
checks and configured scripts, not arbitrary assertions, visual parity or every
|
|
20
|
+
application state.
|
|
21
|
+
|
|
22
|
+
Full validation runs core architecture/test-boundary guards, registered Oxlint,
|
|
23
|
+
project scripts and every registered behavior contract. Defaults use the existing
|
|
24
|
+
mutation-check scripts plus a project's `test` and build scripts when present.
|
|
25
|
+
Build selection prefers `build:lib`, then `build:app`, then `build`.
|
|
26
|
+
Projects can declare `validation.checks` as a list of package
|
|
27
|
+
script names for the complete audit; core/Oxlint and registered behaviors remain
|
|
28
|
+
mandatory. Commands are trusted project configuration, never MCP arguments.
|
|
29
|
+
Use scripts that check/build without changing source. Avoid calling `ads validate`
|
|
30
|
+
from a script selected by validation.
|
|
31
|
+
|
|
32
|
+
Changed mode compares current content, including added/deleted files, with the
|
|
33
|
+
last successful full baseline in `.ds/validation-baseline.json`. No Git history is
|
|
34
|
+
required. A missing/incompatible baseline or a change to configuration, foundation,
|
|
35
|
+
ownership that no longer resolves, or unclassified input expands to full and
|
|
36
|
+
reports the reason. Scoped runs leave the full baseline unchanged. Core architecture
|
|
37
|
+
checks and opaque project commands still run in full; behavior selection narrows
|
|
38
|
+
to affected owner contracts. This is not a per-test-result cache.
|
|
39
|
+
|
|
40
|
+
ADS tests live with their component, pattern, controller, composition or review
|
|
41
|
+
owner. Private imports must resolve to that owner, including through helpers;
|
|
42
|
+
peer implementations use the public API. Marked behavior specs must be registered
|
|
43
|
+
in an owner contract. Pure ADS tests outside those owners fail the boundary guard.
|
|
44
|
+
Application integration tests may exercise public UI alongside their real application
|
|
45
|
+
runtime subject. Ordinary local unit tests retain their project's runner; full
|
|
46
|
+
validation includes the configured test script. Registration is enforced for ADS
|
|
47
|
+
behavior specs, not inferred for every case in an arbitrary runner.
|
|
48
|
+
|
|
49
|
+
During execution `ads_status.validation` reports progress. MCP summaries retain a
|
|
50
|
+
separate latest validation result, alongside verification and mutation results.
|
|
51
|
+
Source changes during execution reject success and leave the previous full
|
|
52
|
+
baseline intact. Skipped registered behavior cases never pass; a project with no
|
|
53
|
+
registered behavior contracts reports that stage as skipped with a reason.
|
|
@@ -3,6 +3,9 @@ name: ads-import
|
|
|
3
3
|
description: "Import selected source ADS components, patterns, styles, brand artwork or theme values into a project's design system. Check compatibility with the destination's framework, dependencies, APIs and token policy before applying. Preserve behavior, credits and license notices."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
+
For validation scope, full audits, and CLI/MCP parity, read
|
|
7
|
+
[validation.md](references/validation.md).
|
|
8
|
+
|
|
6
9
|
For Node/Bun setup, MCP launch and compiler workers, read
|
|
7
10
|
[runtimes.md](references/runtimes.md).
|
|
8
11
|
|
|
@@ -103,6 +103,37 @@ compiler. Existing custom adapters still work; they must adopt the helper to gai
|
|
|
103
103
|
incremental transforms. Upgrade the project dependency and restart the builder.
|
|
104
104
|
Keep the full validation callback and production build behavior.
|
|
105
105
|
|
|
106
|
+
The shared watched builder reuses completed self-contained IIFE worker bundles
|
|
107
|
+
for constructor URLs and standard `?worker`/`?worker&url` imports. It uses Vite's
|
|
108
|
+
configured worker plugins, deduplicates pending requests, tracks real worker and
|
|
109
|
+
configuration dependencies and checks resolution-directory changes. Assets are
|
|
110
|
+
included on every refresh. Changing a transitive worker import rebuilds its
|
|
111
|
+
bundle; failed or superseded work cannot populate the cache. Nested, inline and
|
|
112
|
+
split workers keep the normal Vite path. Keep worker lifetimes/cancellation in
|
|
113
|
+
their owning component/controller; compiler reuse does not keep runtime workers
|
|
114
|
+
alive. Do not add project-specific worker names or lists to ADS.
|
|
115
|
+
|
|
116
|
+
Watched resource builds publish explicitly unverified live feedback while full
|
|
117
|
+
checks and semantic registry inspection run in the background. Rapid edits
|
|
118
|
+
coalesce behind one verification run. The showcase can browse that feedback
|
|
119
|
+
without a blocking loading overlay; a quiet header indicator exposes checking,
|
|
120
|
+
reload, failure and fallback details. A failed edit restores the last verified
|
|
121
|
+
view. Preview minification is disabled only for watched builds.
|
|
122
|
+
|
|
123
|
+
`ads_show_scenario` and `ads_show_tokens` default to `waitFor: "verified"`.
|
|
124
|
+
Interactive browsing can request `waitFor: "compiled"`, which may return live or
|
|
125
|
+
retained output with `build.current: false`. `build.live.validated: false` and
|
|
126
|
+
`ads://preview/live` are never proof of passing checks. Captures, behavior checks
|
|
127
|
+
and guarded publication still require accepted, current output. Do not replace
|
|
128
|
+
the validation callback with a faster incomplete check to speed up the viewer.
|
|
129
|
+
|
|
130
|
+
Accepted MCP edits prepare previews without requiring a viewer request. Matching
|
|
131
|
+
checked candidate graphs and registry metadata reuse the existing project cache;
|
|
132
|
+
incompatible output falls back to background compilation. The connected showcase
|
|
133
|
+
can prefetch changed peers' static bytes without evaluating or mounting them.
|
|
134
|
+
Reuse depends on content and dependencies, with no time-based expiry. Preparation
|
|
135
|
+
does not establish additional behavior or visual evidence.
|
|
136
|
+
|
|
106
137
|
The App preserves selected form/scroll state across accepted unrelated graph
|
|
107
138
|
updates, reruns audits and remounts when its own module/style/asset closure changes.
|
|
108
139
|
Do not promise component-level HMR. Guarded edits select affected behavior owners
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Validation scope
|
|
2
|
+
|
|
3
|
+
Use `ads_validate({})` for the complete project audit, equivalent to `ads validate`.
|
|
4
|
+
Use `ads_validate({scope:"changed"})`, equivalent to `ads validate --changed`, during
|
|
5
|
+
editing when a successful full baseline exists. Both interfaces call the same
|
|
6
|
+
engine. Full is the default.
|
|
7
|
+
|
|
8
|
+
- During local editing, use existing guarded edits and affected behavior checks.
|
|
9
|
+
Reuse completed guards for unchanged source rather than repeatedly auditing all
|
|
10
|
+
owners. Direct edits need `ads_check` and appropriate project/behavior checks.
|
|
11
|
+
- After test migrations, ownership changes or validation/runner configuration
|
|
12
|
+
changes, run full validation. Also run it before a release or an explicit request
|
|
13
|
+
to validate everything. It validates the current source, not a prepared draft.
|
|
14
|
+
- Inspect failures through `ads_results` using the returned resultId and sections
|
|
15
|
+
diagnostics, checks or outcomes. For browser failures, use the outcome's exact
|
|
16
|
+
unit/check/runId with `ads_investigate`. Fix the owner and rerun the appropriate scope.
|
|
17
|
+
- Report the actual scope and revision. Scoped, stale, cancelled or incomplete
|
|
18
|
+
runs cannot establish successful full validation. Passing covers registered
|
|
19
|
+
checks and configured scripts, not arbitrary assertions, visual parity or every
|
|
20
|
+
application state.
|
|
21
|
+
|
|
22
|
+
Full validation runs core architecture/test-boundary guards, registered Oxlint,
|
|
23
|
+
project scripts and every registered behavior contract. Defaults use the existing
|
|
24
|
+
mutation-check scripts plus a project's `test` and build scripts when present.
|
|
25
|
+
Build selection prefers `build:lib`, then `build:app`, then `build`.
|
|
26
|
+
Projects can declare `validation.checks` as a list of package
|
|
27
|
+
script names for the complete audit; core/Oxlint and registered behaviors remain
|
|
28
|
+
mandatory. Commands are trusted project configuration, never MCP arguments.
|
|
29
|
+
Use scripts that check/build without changing source. Avoid calling `ads validate`
|
|
30
|
+
from a script selected by validation.
|
|
31
|
+
|
|
32
|
+
Changed mode compares current content, including added/deleted files, with the
|
|
33
|
+
last successful full baseline in `.ds/validation-baseline.json`. No Git history is
|
|
34
|
+
required. A missing/incompatible baseline or a change to configuration, foundation,
|
|
35
|
+
ownership that no longer resolves, or unclassified input expands to full and
|
|
36
|
+
reports the reason. Scoped runs leave the full baseline unchanged. Core architecture
|
|
37
|
+
checks and opaque project commands still run in full; behavior selection narrows
|
|
38
|
+
to affected owner contracts. This is not a per-test-result cache.
|
|
39
|
+
|
|
40
|
+
ADS tests live with their component, pattern, controller, composition or review
|
|
41
|
+
owner. Private imports must resolve to that owner, including through helpers;
|
|
42
|
+
peer implementations use the public API. Marked behavior specs must be registered
|
|
43
|
+
in an owner contract. Pure ADS tests outside those owners fail the boundary guard.
|
|
44
|
+
Application integration tests may exercise public UI alongside their real application
|
|
45
|
+
runtime subject. Ordinary local unit tests retain their project's runner; full
|
|
46
|
+
validation includes the configured test script. Registration is enforced for ADS
|
|
47
|
+
behavior specs, not inferred for every case in an arbitrary runner.
|
|
48
|
+
|
|
49
|
+
During execution `ads_status.validation` reports progress. MCP summaries retain a
|
|
50
|
+
separate latest validation result, alongside verification and mutation results.
|
|
51
|
+
Source changes during execution reject success and leave the previous full
|
|
52
|
+
baseline intact. Skipped registered behavior cases never pass; a project with no
|
|
53
|
+
registered behavior contracts reports that stage as skipped with a reason.
|
|
@@ -3,6 +3,9 @@ name: ads-motion
|
|
|
3
3
|
description: Implement, review, audit, or profile web animation in a project's local design system. Use for motion purpose, easing, timing, origins, interruptibility, reduced motion, and rendering performance while preserving token and component ownership.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
+
For validation scope, full audits, and CLI/MCP parity, read
|
|
7
|
+
[validation.md](references/validation.md).
|
|
8
|
+
|
|
6
9
|
For Node/Bun setup, MCP launch and compiler workers, read
|
|
7
10
|
[runtimes.md](references/runtimes.md).
|
|
8
11
|
|
|
@@ -103,6 +103,37 @@ compiler. Existing custom adapters still work; they must adopt the helper to gai
|
|
|
103
103
|
incremental transforms. Upgrade the project dependency and restart the builder.
|
|
104
104
|
Keep the full validation callback and production build behavior.
|
|
105
105
|
|
|
106
|
+
The shared watched builder reuses completed self-contained IIFE worker bundles
|
|
107
|
+
for constructor URLs and standard `?worker`/`?worker&url` imports. It uses Vite's
|
|
108
|
+
configured worker plugins, deduplicates pending requests, tracks real worker and
|
|
109
|
+
configuration dependencies and checks resolution-directory changes. Assets are
|
|
110
|
+
included on every refresh. Changing a transitive worker import rebuilds its
|
|
111
|
+
bundle; failed or superseded work cannot populate the cache. Nested, inline and
|
|
112
|
+
split workers keep the normal Vite path. Keep worker lifetimes/cancellation in
|
|
113
|
+
their owning component/controller; compiler reuse does not keep runtime workers
|
|
114
|
+
alive. Do not add project-specific worker names or lists to ADS.
|
|
115
|
+
|
|
116
|
+
Watched resource builds publish explicitly unverified live feedback while full
|
|
117
|
+
checks and semantic registry inspection run in the background. Rapid edits
|
|
118
|
+
coalesce behind one verification run. The showcase can browse that feedback
|
|
119
|
+
without a blocking loading overlay; a quiet header indicator exposes checking,
|
|
120
|
+
reload, failure and fallback details. A failed edit restores the last verified
|
|
121
|
+
view. Preview minification is disabled only for watched builds.
|
|
122
|
+
|
|
123
|
+
`ads_show_scenario` and `ads_show_tokens` default to `waitFor: "verified"`.
|
|
124
|
+
Interactive browsing can request `waitFor: "compiled"`, which may return live or
|
|
125
|
+
retained output with `build.current: false`. `build.live.validated: false` and
|
|
126
|
+
`ads://preview/live` are never proof of passing checks. Captures, behavior checks
|
|
127
|
+
and guarded publication still require accepted, current output. Do not replace
|
|
128
|
+
the validation callback with a faster incomplete check to speed up the viewer.
|
|
129
|
+
|
|
130
|
+
Accepted MCP edits prepare previews without requiring a viewer request. Matching
|
|
131
|
+
checked candidate graphs and registry metadata reuse the existing project cache;
|
|
132
|
+
incompatible output falls back to background compilation. The connected showcase
|
|
133
|
+
can prefetch changed peers' static bytes without evaluating or mounting them.
|
|
134
|
+
Reuse depends on content and dependencies, with no time-based expiry. Preparation
|
|
135
|
+
does not establish additional behavior or visual evidence.
|
|
136
|
+
|
|
106
137
|
The App preserves selected form/scroll state across accepted unrelated graph
|
|
107
138
|
updates, reruns audits and remounts when its own module/style/asset closure changes.
|
|
108
139
|
Do not promise component-level HMR. Guarded edits select affected behavior owners
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Validation scope
|
|
2
|
+
|
|
3
|
+
Use `ads_validate({})` for the complete project audit, equivalent to `ads validate`.
|
|
4
|
+
Use `ads_validate({scope:"changed"})`, equivalent to `ads validate --changed`, during
|
|
5
|
+
editing when a successful full baseline exists. Both interfaces call the same
|
|
6
|
+
engine. Full is the default.
|
|
7
|
+
|
|
8
|
+
- During local editing, use existing guarded edits and affected behavior checks.
|
|
9
|
+
Reuse completed guards for unchanged source rather than repeatedly auditing all
|
|
10
|
+
owners. Direct edits need `ads_check` and appropriate project/behavior checks.
|
|
11
|
+
- After test migrations, ownership changes or validation/runner configuration
|
|
12
|
+
changes, run full validation. Also run it before a release or an explicit request
|
|
13
|
+
to validate everything. It validates the current source, not a prepared draft.
|
|
14
|
+
- Inspect failures through `ads_results` using the returned resultId and sections
|
|
15
|
+
diagnostics, checks or outcomes. For browser failures, use the outcome's exact
|
|
16
|
+
unit/check/runId with `ads_investigate`. Fix the owner and rerun the appropriate scope.
|
|
17
|
+
- Report the actual scope and revision. Scoped, stale, cancelled or incomplete
|
|
18
|
+
runs cannot establish successful full validation. Passing covers registered
|
|
19
|
+
checks and configured scripts, not arbitrary assertions, visual parity or every
|
|
20
|
+
application state.
|
|
21
|
+
|
|
22
|
+
Full validation runs core architecture/test-boundary guards, registered Oxlint,
|
|
23
|
+
project scripts and every registered behavior contract. Defaults use the existing
|
|
24
|
+
mutation-check scripts plus a project's `test` and build scripts when present.
|
|
25
|
+
Build selection prefers `build:lib`, then `build:app`, then `build`.
|
|
26
|
+
Projects can declare `validation.checks` as a list of package
|
|
27
|
+
script names for the complete audit; core/Oxlint and registered behaviors remain
|
|
28
|
+
mandatory. Commands are trusted project configuration, never MCP arguments.
|
|
29
|
+
Use scripts that check/build without changing source. Avoid calling `ads validate`
|
|
30
|
+
from a script selected by validation.
|
|
31
|
+
|
|
32
|
+
Changed mode compares current content, including added/deleted files, with the
|
|
33
|
+
last successful full baseline in `.ds/validation-baseline.json`. No Git history is
|
|
34
|
+
required. A missing/incompatible baseline or a change to configuration, foundation,
|
|
35
|
+
ownership that no longer resolves, or unclassified input expands to full and
|
|
36
|
+
reports the reason. Scoped runs leave the full baseline unchanged. Core architecture
|
|
37
|
+
checks and opaque project commands still run in full; behavior selection narrows
|
|
38
|
+
to affected owner contracts. This is not a per-test-result cache.
|
|
39
|
+
|
|
40
|
+
ADS tests live with their component, pattern, controller, composition or review
|
|
41
|
+
owner. Private imports must resolve to that owner, including through helpers;
|
|
42
|
+
peer implementations use the public API. Marked behavior specs must be registered
|
|
43
|
+
in an owner contract. Pure ADS tests outside those owners fail the boundary guard.
|
|
44
|
+
Application integration tests may exercise public UI alongside their real application
|
|
45
|
+
runtime subject. Ordinary local unit tests retain their project's runner; full
|
|
46
|
+
validation includes the configured test script. Registration is enforced for ADS
|
|
47
|
+
behavior specs, not inferred for every case in an arbitrary runner.
|
|
48
|
+
|
|
49
|
+
During execution `ads_status.validation` reports progress. MCP summaries retain a
|
|
50
|
+
separate latest validation result, alongside verification and mutation results.
|
|
51
|
+
Source changes during execution reject success and leave the previous full
|
|
52
|
+
baseline intact. Skipped registered behavior cases never pass; a project with no
|
|
53
|
+
registered behavior contracts reports that stage as skipped with a reason.
|
|
@@ -3,6 +3,9 @@ name: ads-port
|
|
|
3
3
|
description: "Port existing library components into a coherent project-owned ADS, reusing shared tokens and primitives while preserving required behavior. Use for native adaptation from a library URL, with reference comparison and provenance; not dependency installation or wrapping."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
+
For validation scope, full audits, and CLI/MCP parity, read
|
|
7
|
+
[validation.md](references/validation.md).
|
|
8
|
+
|
|
6
9
|
For Node/Bun setup, MCP launch and compiler workers, read
|
|
7
10
|
[runtimes.md](references/runtimes.md).
|
|
8
11
|
|
|
@@ -103,6 +103,37 @@ compiler. Existing custom adapters still work; they must adopt the helper to gai
|
|
|
103
103
|
incremental transforms. Upgrade the project dependency and restart the builder.
|
|
104
104
|
Keep the full validation callback and production build behavior.
|
|
105
105
|
|
|
106
|
+
The shared watched builder reuses completed self-contained IIFE worker bundles
|
|
107
|
+
for constructor URLs and standard `?worker`/`?worker&url` imports. It uses Vite's
|
|
108
|
+
configured worker plugins, deduplicates pending requests, tracks real worker and
|
|
109
|
+
configuration dependencies and checks resolution-directory changes. Assets are
|
|
110
|
+
included on every refresh. Changing a transitive worker import rebuilds its
|
|
111
|
+
bundle; failed or superseded work cannot populate the cache. Nested, inline and
|
|
112
|
+
split workers keep the normal Vite path. Keep worker lifetimes/cancellation in
|
|
113
|
+
their owning component/controller; compiler reuse does not keep runtime workers
|
|
114
|
+
alive. Do not add project-specific worker names or lists to ADS.
|
|
115
|
+
|
|
116
|
+
Watched resource builds publish explicitly unverified live feedback while full
|
|
117
|
+
checks and semantic registry inspection run in the background. Rapid edits
|
|
118
|
+
coalesce behind one verification run. The showcase can browse that feedback
|
|
119
|
+
without a blocking loading overlay; a quiet header indicator exposes checking,
|
|
120
|
+
reload, failure and fallback details. A failed edit restores the last verified
|
|
121
|
+
view. Preview minification is disabled only for watched builds.
|
|
122
|
+
|
|
123
|
+
`ads_show_scenario` and `ads_show_tokens` default to `waitFor: "verified"`.
|
|
124
|
+
Interactive browsing can request `waitFor: "compiled"`, which may return live or
|
|
125
|
+
retained output with `build.current: false`. `build.live.validated: false` and
|
|
126
|
+
`ads://preview/live` are never proof of passing checks. Captures, behavior checks
|
|
127
|
+
and guarded publication still require accepted, current output. Do not replace
|
|
128
|
+
the validation callback with a faster incomplete check to speed up the viewer.
|
|
129
|
+
|
|
130
|
+
Accepted MCP edits prepare previews without requiring a viewer request. Matching
|
|
131
|
+
checked candidate graphs and registry metadata reuse the existing project cache;
|
|
132
|
+
incompatible output falls back to background compilation. The connected showcase
|
|
133
|
+
can prefetch changed peers' static bytes without evaluating or mounting them.
|
|
134
|
+
Reuse depends on content and dependencies, with no time-based expiry. Preparation
|
|
135
|
+
does not establish additional behavior or visual evidence.
|
|
136
|
+
|
|
106
137
|
The App preserves selected form/scroll state across accepted unrelated graph
|
|
107
138
|
updates, reruns audits and remounts when its own module/style/asset closure changes.
|
|
108
139
|
Do not promise component-level HMR. Guarded edits select affected behavior owners
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Validation scope
|
|
2
|
+
|
|
3
|
+
Use `ads_validate({})` for the complete project audit, equivalent to `ads validate`.
|
|
4
|
+
Use `ads_validate({scope:"changed"})`, equivalent to `ads validate --changed`, during
|
|
5
|
+
editing when a successful full baseline exists. Both interfaces call the same
|
|
6
|
+
engine. Full is the default.
|
|
7
|
+
|
|
8
|
+
- During local editing, use existing guarded edits and affected behavior checks.
|
|
9
|
+
Reuse completed guards for unchanged source rather than repeatedly auditing all
|
|
10
|
+
owners. Direct edits need `ads_check` and appropriate project/behavior checks.
|
|
11
|
+
- After test migrations, ownership changes or validation/runner configuration
|
|
12
|
+
changes, run full validation. Also run it before a release or an explicit request
|
|
13
|
+
to validate everything. It validates the current source, not a prepared draft.
|
|
14
|
+
- Inspect failures through `ads_results` using the returned resultId and sections
|
|
15
|
+
diagnostics, checks or outcomes. For browser failures, use the outcome's exact
|
|
16
|
+
unit/check/runId with `ads_investigate`. Fix the owner and rerun the appropriate scope.
|
|
17
|
+
- Report the actual scope and revision. Scoped, stale, cancelled or incomplete
|
|
18
|
+
runs cannot establish successful full validation. Passing covers registered
|
|
19
|
+
checks and configured scripts, not arbitrary assertions, visual parity or every
|
|
20
|
+
application state.
|
|
21
|
+
|
|
22
|
+
Full validation runs core architecture/test-boundary guards, registered Oxlint,
|
|
23
|
+
project scripts and every registered behavior contract. Defaults use the existing
|
|
24
|
+
mutation-check scripts plus a project's `test` and build scripts when present.
|
|
25
|
+
Build selection prefers `build:lib`, then `build:app`, then `build`.
|
|
26
|
+
Projects can declare `validation.checks` as a list of package
|
|
27
|
+
script names for the complete audit; core/Oxlint and registered behaviors remain
|
|
28
|
+
mandatory. Commands are trusted project configuration, never MCP arguments.
|
|
29
|
+
Use scripts that check/build without changing source. Avoid calling `ads validate`
|
|
30
|
+
from a script selected by validation.
|
|
31
|
+
|
|
32
|
+
Changed mode compares current content, including added/deleted files, with the
|
|
33
|
+
last successful full baseline in `.ds/validation-baseline.json`. No Git history is
|
|
34
|
+
required. A missing/incompatible baseline or a change to configuration, foundation,
|
|
35
|
+
ownership that no longer resolves, or unclassified input expands to full and
|
|
36
|
+
reports the reason. Scoped runs leave the full baseline unchanged. Core architecture
|
|
37
|
+
checks and opaque project commands still run in full; behavior selection narrows
|
|
38
|
+
to affected owner contracts. This is not a per-test-result cache.
|
|
39
|
+
|
|
40
|
+
ADS tests live with their component, pattern, controller, composition or review
|
|
41
|
+
owner. Private imports must resolve to that owner, including through helpers;
|
|
42
|
+
peer implementations use the public API. Marked behavior specs must be registered
|
|
43
|
+
in an owner contract. Pure ADS tests outside those owners fail the boundary guard.
|
|
44
|
+
Application integration tests may exercise public UI alongside their real application
|
|
45
|
+
runtime subject. Ordinary local unit tests retain their project's runner; full
|
|
46
|
+
validation includes the configured test script. Registration is enforced for ADS
|
|
47
|
+
behavior specs, not inferred for every case in an arbitrary runner.
|
|
48
|
+
|
|
49
|
+
During execution `ads_status.validation` reports progress. MCP summaries retain a
|
|
50
|
+
separate latest validation result, alongside verification and mutation results.
|
|
51
|
+
Source changes during execution reject success and leave the previous full
|
|
52
|
+
baseline intact. Skipped registered behavior cases never pass; a project with no
|
|
53
|
+
registered behavior contracts reports that stage as skipped with a reason.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// TypeScript programs/checkers are immutable inspection snapshots. Share only
|
|
2
|
+
// context-free symbol lookups, including misses, within that checker. A new
|
|
3
|
+
// inspection gets a new checker; no filesystem result or diagnostic is retained.
|
|
4
|
+
const snapshots = new WeakMap();
|
|
5
|
+
|
|
6
|
+
export function sourceSymbol(checker, node) {
|
|
7
|
+
let symbols = snapshots.get(checker);
|
|
8
|
+
if (!symbols) snapshots.set(checker, symbols = new WeakMap());
|
|
9
|
+
if (!symbols.has(node)) symbols.set(node, checker.getSymbolAtLocation(node));
|
|
10
|
+
return symbols.get(node);
|
|
11
|
+
}
|
package/dist/source-values.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import ts from "typescript";
|
|
2
2
|
import { isInside } from "./config.mjs";
|
|
3
3
|
import { uiOperation } from "./ui-framework.mjs";
|
|
4
|
+
import { sourceSymbol } from "./source-symbols.mjs";
|
|
4
5
|
|
|
5
6
|
export const unknown = reason => ({ kind: "unknown", reason });
|
|
6
7
|
export const literal = value => ({ kind: "literal", value });
|
|
@@ -16,8 +17,14 @@ export function unwrap(node) {
|
|
|
16
17
|
/** Bounded symbolic source traversal. No project code is imported or executed. */
|
|
17
18
|
export function createSourceValues(program, options, { preserveCall = () => false, strict = false } = {}) {
|
|
18
19
|
const checker = program.getTypeChecker();
|
|
20
|
+
const ownedFiles = new Map();
|
|
21
|
+
function owned(node) {
|
|
22
|
+
const file = node.getSourceFile().fileName;
|
|
23
|
+
if (!ownedFiles.has(file)) ownedFiles.set(file, isInside(options.dsRoot, file));
|
|
24
|
+
return ownedFiles.get(file);
|
|
25
|
+
}
|
|
19
26
|
const symbol = node => {
|
|
20
|
-
const value = checker
|
|
27
|
+
const value = sourceSymbol(checker, ts.isPropertyAccessExpression(node) ? node.name : node);
|
|
21
28
|
return value?.valueDeclaration && ts.isShorthandPropertyAssignment(value.valueDeclaration) ? checker.getShorthandAssignmentValueSymbol(value.valueDeclaration) ?? value : value;
|
|
22
29
|
};
|
|
23
30
|
function declaration(node) {
|
|
@@ -180,7 +187,7 @@ export function createSourceValues(program, options, { preserveCall = () => fals
|
|
|
180
187
|
return strict && escapes.has(symbol(node)) && (result.kind === "object" || result.kind === "array" || result.kind === "node" && (ts.isObjectLiteralExpression(result.node) || ts.isArrayLiteralExpression(result.node))) ? unknown("An object passed to another call may have been mutated.") : result;
|
|
181
188
|
}
|
|
182
189
|
const owner = declaration(node);
|
|
183
|
-
if (owner &&
|
|
190
|
+
if (owner && owned(owner)) {
|
|
184
191
|
if (isFunction(owner)) return reference(owner, env, via);
|
|
185
192
|
if (ts.isVariableDeclaration(owner) && owner.initializer && owner.parent.flags & ts.NodeFlags.Const) {
|
|
186
193
|
const result = resolve(reference(owner.initializer, env, via), next(context));
|
|
@@ -196,7 +203,7 @@ export function createSourceValues(program, options, { preserveCall = () => fals
|
|
|
196
203
|
if (key.kind === "literal") {
|
|
197
204
|
const selected = get(object, String(key.value), next(context));
|
|
198
205
|
const owner = declaration(node);
|
|
199
|
-
if (selected.kind === "unknown" && owner &&
|
|
206
|
+
if (selected.kind === "unknown" && owner && owned(owner)) {
|
|
200
207
|
if (isFunction(owner)) return reference(owner, env, via);
|
|
201
208
|
if (ts.isVariableDeclaration(owner) && owner.initializer && owner.parent.flags & ts.NodeFlags.Const) return resolve(reference(owner.initializer, env, via), next(context));
|
|
202
209
|
}
|