@reqvire-org/ads 0.4.0 → 0.4.3
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/README.md +115 -87
- package/dist/a11y.mjs +133 -48
- package/dist/analysis/compiler-options.mjs +13 -0
- package/dist/analysis/context.mjs +46 -0
- package/dist/analysis/file-tree.mjs +52 -0
- package/dist/analysis/helpers.mjs +142 -0
- package/dist/analysis/impact.mjs +20 -0
- package/dist/analysis/inputs.mjs +22 -0
- package/dist/analysis/module-resolvers.mjs +46 -0
- package/dist/analysis/native-adapter.mjs +180 -0
- package/dist/analysis/native-project.mjs +323 -0
- package/dist/analysis/queries.mjs +133 -0
- package/dist/analysis/service.mjs +153 -0
- package/dist/analysis/standalone.mjs +57 -0
- package/dist/analysis/syntax.mjs +179 -0
- package/dist/analysis/worker.mjs +182 -0
- package/dist/assets.mjs +6 -6
- package/dist/atomic-composition.mjs +191 -70
- package/dist/atomic-trace.mjs +120 -50
- package/dist/behavior-libraries.mjs +106 -37
- package/dist/behaviors.mjs +219 -77
- package/dist/boundaries.mjs +140 -41
- package/dist/brand-assets.mjs +219 -47
- package/dist/brands.mjs +86 -27
- package/dist/bun-compiler.mjs +28 -14
- package/dist/bun-worker.mjs +7 -5
- package/dist/capture/worker.mjs +15 -4
- package/dist/capture-store.mjs +4 -2
- package/dist/capture.mjs +17 -14
- package/dist/check-service.mjs +44 -58
- package/dist/check.mjs +754 -188
- package/dist/cli.mjs +200 -99
- package/dist/color-values.mjs +21 -21
- package/dist/component-contrast.mjs +127 -9
- package/dist/config.mjs +303 -135
- package/dist/construction-styles.cjs +10 -0
- package/dist/contrast-composition.mjs +134 -0
- package/dist/control-padding.mjs +45 -25
- package/dist/css-values.mjs +3 -2
- package/dist/declarative-flow.mjs +209 -109
- package/dist/design-values.mjs +136 -51
- package/dist/development-runtime.mjs +4 -6
- package/dist/draft-boundary.mjs +11 -6
- package/dist/evidence.mjs +1 -1
- package/dist/finding-rules.mjs +9 -5
- package/dist/font-rules.mjs +22 -17
- package/dist/fonts-generated.mjs +23 -16
- package/dist/foundation-views.mjs +242 -0
- package/dist/foundation.mjs +63 -39
- package/dist/generated-entries.mjs +101 -34
- package/dist/icons.mjs +79 -32
- package/dist/image-attributes.mjs +143 -66
- package/dist/image-size.mjs +1 -1
- package/dist/index.mjs +0 -2
- package/dist/init.mjs +122 -41
- package/dist/investigations.mjs +2 -2
- package/dist/layers.mjs +298 -129
- package/dist/layout-widths.mjs +180 -85
- package/dist/linaria/preserve-values.cjs +7 -0
- package/dist/linaria/spatial-inputs.cjs +56 -0
- package/dist/lockup-composition.mjs +44 -0
- package/dist/lockup-model.cjs +64 -0
- package/dist/mcp/THIRD_PARTY_NOTICES.md +51 -1
- package/dist/mcp/apps.mjs +4 -30
- package/dist/mcp/behavior-pages.mjs +72 -24
- package/dist/mcp/build-status.mjs +257 -64
- package/dist/mcp/catalog.mjs +90 -26
- package/dist/mcp/context.mjs +17 -18
- package/dist/mcp/draft-discovery.mjs +44 -21
- package/dist/mcp/drafts.mjs +903 -281
- package/dist/mcp/execution-coordinator.mjs +417 -167
- package/dist/mcp/execution-results.mjs +7 -7
- package/dist/mcp/mutations.mjs +673 -234
- package/dist/mcp/preview-watch.mjs +448 -170
- package/dist/mcp/preview-widget.bundle.js +44 -50
- package/dist/mcp/prompts.mjs +5 -5
- package/dist/mcp/result-pages.mjs +1 -1
- package/dist/mcp/sandbox-host.mjs +1 -1
- package/dist/mcp/server.mjs +2409 -577
- package/dist/mcp/showcase-host.mjs +165 -41
- package/dist/mcp/skills.mjs +1 -1
- package/dist/mcp/text-diff.mjs +29 -10
- package/dist/paint-contracts.mjs +174 -81
- package/dist/palette-generated.mjs +2 -2
- package/dist/pictogram-model.mjs +59 -0
- package/dist/pictograms.mjs +52 -0
- package/dist/preview-bun.mjs +494 -187
- package/dist/preview-failure.mjs +1 -1
- package/dist/preview-files.mjs +13 -13
- package/dist/preview-imports.mjs +104 -55
- package/dist/preview-inputs.mjs +2 -2
- package/dist/preview-requests.mjs +24 -0
- package/dist/preview-resources.mjs +288 -147
- package/dist/preview-scope.mjs +5 -4
- package/dist/program-cache.mjs +8 -34
- package/dist/project-documents.mjs +1 -1
- package/dist/public-api.mjs +69 -31
- package/dist/public-props.mjs +39 -22
- package/dist/{browser-audit → render-audit}/axe-run.mjs +3 -3
- package/dist/{browser-audit → render-audit}/image-shape.mjs +15 -5
- package/dist/{browser-audit → render-audit}/layout-overflow.mjs +86 -23
- package/dist/{browser-audit → render-audit}/non-text-contrast.mjs +86 -27
- package/dist/render-audit/pictograms.mjs +88 -0
- package/dist/{browser-audit → render-audit}/render-states.mjs +208 -52
- package/dist/{browser-audit → render-audit}/worker.mjs +98 -30
- package/dist/render-audit.mjs +838 -0
- package/dist/render-color-probe.mjs +96 -42
- package/dist/render-composition.mjs +164 -0
- package/dist/resource-limits.mjs +229 -97
- package/dist/runtime-contracts.mjs +467 -185
- package/dist/scenario-groups.mjs +22 -10
- package/dist/scenario-inspector.mjs +6 -43
- package/dist/scenario-program.mjs +8 -25
- package/dist/scenario-registry.mjs +72 -30
- package/dist/scenario-selectors.mjs +161 -64
- package/dist/scenario-slots.mjs +149 -56
- package/dist/scenario-trace.mjs +215 -109
- package/dist/scenarios-compiler.mjs +719 -378
- package/dist/scenarios-vite.d.mts +1 -3
- package/dist/scenarios-vite.mjs +2 -81
- package/dist/scenarios.mjs +421 -157
- package/dist/selector-match.mjs +2 -2
- package/dist/showcase/client.bundle.js +57 -56
- package/dist/showcase/draft-navigation.js +21 -3
- package/dist/showcase/favicon.ico +0 -0
- package/dist/showcase/favicon.svg +1 -0
- package/dist/showcase/foundation-view.css +58 -0
- package/dist/showcase/foundation-view.mjs +255 -0
- package/dist/showcase/guide-controls.ads.review.mjs +32 -0
- package/dist/showcase/icons.js +1 -145
- package/dist/showcase/index.html +3 -31
- package/dist/showcase/pictogram-view.mjs +53 -0
- package/dist/showcase/preview-frame.ads.review.css +46 -0
- package/dist/showcase/preview-frame.ads.review.d.mts +11 -0
- package/dist/showcase/preview-frame.ads.review.mjs +22 -0
- package/dist/showcase/preview-state.js +0 -9
- package/dist/showcase/refresh-scheduler.js +23 -0
- package/dist/showcase/style.css +5 -47
- package/dist/showcase/ui/ui.css +1353 -0
- package/dist/showcase/ui/ui.js +1064 -0
- package/dist/showcase-coverage.mjs +58 -37
- package/dist/skills/README.md +24 -23
- package/dist/skills/ads-designer/README.md +8 -2
- package/dist/skills/ads-designer/SKILL.md +143 -120
- package/dist/skills/ads-designer/references/accessibility.md +78 -15
- package/dist/skills/ads-designer/references/atomic-styles.md +4 -4
- package/dist/skills/ads-designer/references/behaviors.md +30 -27
- package/dist/skills/ads-designer/references/branding.md +101 -24
- package/dist/skills/ads-designer/references/captures.md +25 -0
- package/dist/skills/ads-designer/references/cli.md +21 -24
- package/dist/skills/ads-designer/references/contracts.md +7 -6
- package/dist/skills/ads-designer/references/design-data.md +49 -52
- package/dist/skills/ads-designer/references/drafts.md +20 -17
- package/dist/skills/ads-designer/references/evidence.md +1 -5
- package/dist/skills/ads-designer/references/guarded-editing.md +14 -18
- package/dist/skills/ads-designer/references/layers.md +1 -1
- package/dist/skills/ads-designer/references/layout.md +347 -0
- package/dist/skills/ads-designer/references/mobile.md +2 -1
- package/dist/skills/{ads-motion/references/performance.md → ads-designer/references/motion-performance.md} +5 -1
- package/dist/skills/{ads-motion/references/build.md → ads-designer/references/motion.md} +73 -5
- package/dist/skills/ads-designer/references/performance.md +3 -2
- package/dist/skills/ads-designer/references/pictograms.md +131 -0
- package/dist/skills/ads-designer/references/review.md +37 -34
- package/dist/skills/ads-designer/references/runtimes.md +33 -30
- package/dist/skills/ads-designer/references/scenarios.md +16 -18
- package/dist/skills/{ads-break-ui/references/catalog.md → ads-designer/references/stress-catalog.md} +3 -1
- package/dist/skills/ads-designer/references/stress-test.md +68 -0
- package/dist/skills/ads-designer/references/validation.md +83 -75
- package/dist/skills/ads-designer/references/workflows.md +8 -33
- package/dist/skills/ads-import/SKILL.md +43 -325
- package/dist/skills/ads-import/references/atomic-styles.md +4 -4
- package/dist/skills/ads-import/references/behaviors.md +30 -27
- package/dist/skills/ads-import/references/branding.md +5 -5
- package/dist/skills/ads-import/references/captures.md +25 -0
- package/dist/skills/ads-import/references/cli.md +21 -24
- package/dist/skills/ads-import/references/compatibility.md +1 -1
- package/dist/skills/ads-import/references/contracts.md +7 -6
- package/dist/skills/ads-import/references/design-data.md +49 -52
- package/dist/skills/ads-import/references/drafts.md +20 -17
- package/dist/skills/ads-import/references/evidence.md +1 -5
- package/dist/skills/ads-import/references/guarded-editing.md +14 -18
- package/dist/skills/ads-import/references/implementation.md +2 -1
- package/dist/skills/ads-import/references/layers.md +1 -1
- package/dist/skills/ads-import/references/layout.md +347 -0
- package/dist/skills/ads-import/references/review.md +37 -34
- package/dist/skills/ads-import/references/runtimes.md +33 -30
- package/dist/skills/ads-import/references/scenarios.md +16 -18
- package/dist/skills/ads-import/references/tokens.md +3 -3
- package/dist/skills/ads-import/references/validation.md +83 -75
- package/dist/skills/ads-import/references/workflows.md +8 -33
- package/dist/skills/ads-migrate/SKILL.md +56 -0
- package/dist/skills/ads-migrate/references/0.4.1-to-0.4.2.md +602 -0
- package/dist/skills/ads-port/SKILL.md +58 -344
- package/dist/skills/ads-port/references/atomic-styles.md +4 -4
- package/dist/skills/ads-port/references/behaviors.md +30 -27
- package/dist/skills/ads-port/references/captures.md +25 -0
- package/dist/skills/ads-port/references/cli.md +21 -24
- package/dist/skills/ads-port/references/contracts.md +7 -6
- package/dist/skills/ads-port/references/design-data.md +49 -52
- package/dist/skills/ads-port/references/drafts.md +20 -17
- package/dist/skills/ads-port/references/evidence.md +1 -5
- package/dist/skills/ads-port/references/guarded-editing.md +14 -18
- package/dist/skills/ads-port/references/layers.md +1 -1
- package/dist/skills/ads-port/references/layout.md +347 -0
- package/dist/skills/ads-port/references/lint-and-docs.md +8 -11
- package/dist/skills/ads-port/references/native-implementation.md +2 -1
- package/dist/skills/ads-port/references/review.md +37 -34
- package/dist/skills/ads-port/references/runtimes.md +33 -30
- package/dist/skills/ads-port/references/scenarios.md +16 -18
- package/dist/skills/ads-port/references/validation.md +83 -75
- package/dist/skills/ads-port/references/workflows.md +8 -33
- package/dist/source-symbols.mjs +1 -8
- package/dist/source-values.mjs +270 -129
- package/dist/spatial-composition.mjs +322 -0
- package/dist/spatial-contexts.cjs +56 -0
- package/dist/spatial-css.cjs +351 -0
- package/dist/spatial-inputs.cjs +80 -0
- package/dist/spatial-metadata.mjs +18 -0
- package/dist/spatial-model.cjs +322 -0
- package/dist/spatial.mjs +21 -0
- package/dist/stage-timing.cjs +20 -0
- package/dist/starters/preact/design-system/patterns/Conversation/Conversation.tsx +105 -0
- package/dist/starters/preact/design-system/patterns/Shell/Shell.tsx +275 -0
- package/dist/starters/preact/design-system/review/demo-frame/DemoFrame.ads.review.tsx +7 -0
- package/dist/starters/preact/design-system/review/screen-frame/ScreenFrame.ads.review.tsx +10 -0
- package/dist/starters/preact/design-system/showcase/mcp/main.ads.mount.tsx +8 -0
- package/dist/starters/preact/ds.config.json +25 -6
- package/dist/starters/preact/package.json +4 -8
- package/dist/starters/preact/tsconfig.json +4 -5
- package/dist/starters/preact/vite.config.ts +3 -3
- package/dist/starters/react/ADS.md +42 -47
- package/dist/starters/react/README.md +47 -49
- package/dist/starters/react/design-system/assets/pictograms/catalog.ads.json +13 -0
- package/dist/starters/react/design-system/assets/pictograms/journey.dark.svg +7 -0
- package/dist/starters/react/design-system/assets/pictograms/journey.svg +7 -0
- package/dist/starters/react/design-system/components/Actions/IconButton/IconButton.tsx +18 -2
- package/dist/starters/react/design-system/components/Actions/IconButton/README.md +3 -0
- package/dist/starters/react/design-system/components/Content/Pictogram/Pictogram.ads.exports.ts +1 -0
- package/dist/starters/react/design-system/components/Content/Pictogram/Pictogram.ads.fixture.ts +1 -0
- package/dist/starters/react/design-system/components/Content/Pictogram/Pictogram.ads.scenario.tsx +7 -0
- package/dist/starters/react/design-system/components/Content/Pictogram/Pictogram.tsx +26 -0
- package/dist/starters/react/design-system/composition/Workspace/WorkspacePage/README.md +5 -0
- package/dist/starters/react/design-system/composition/Workspace/WorkspacePage/WorkspacePage.ads.fixture.ts +13 -0
- package/dist/starters/react/design-system/composition/Workspace/WorkspacePage/WorkspacePage.ads.scenario.tsx +22 -0
- package/dist/starters/react/design-system/index.ts +2 -1
- package/dist/starters/react/design-system/patterns/Conversation/Conversation.ads.exports.ts +1 -0
- package/dist/starters/react/design-system/patterns/Conversation/Conversation.ads.fixture.ts +7 -0
- package/dist/starters/react/design-system/patterns/Conversation/Conversation.ads.scenario.tsx +15 -0
- package/dist/starters/react/design-system/patterns/Conversation/Conversation.tsx +105 -0
- package/dist/starters/react/design-system/patterns/Conversation/README.md +9 -0
- package/dist/starters/react/design-system/patterns/Shell/Floating.ads.fixture.ts +5 -0
- package/dist/starters/react/design-system/patterns/Shell/Floating.ads.scenario.tsx +21 -0
- package/dist/starters/react/design-system/patterns/Shell/README.md +43 -0
- package/dist/starters/react/design-system/patterns/Shell/Shell.ads.exports.ts +1 -0
- package/dist/starters/react/design-system/patterns/Shell/Shell.ads.fixture.ts +5 -0
- package/dist/starters/react/design-system/patterns/Shell/Shell.ads.scenario.tsx +21 -0
- package/dist/starters/react/design-system/patterns/Shell/Shell.tsx +274 -0
- package/dist/starters/react/design-system/review/demo-frame/DemoFrame.ads.exports.ts +1 -1
- package/dist/starters/react/design-system/review/demo-frame/DemoFrame.ads.review.tsx +7 -0
- package/dist/starters/react/design-system/review/index.ads.review.ts +4 -0
- package/dist/starters/react/design-system/review/region-block/RegionBlock.ads.exports.ts +1 -0
- package/dist/starters/react/design-system/review/region-block/RegionBlock.ads.review.tsx +6 -0
- package/dist/starters/react/design-system/review/screen-frame/ScreenFrame.ads.exports.ts +1 -1
- package/dist/starters/react/design-system/review/screen-frame/ScreenFrame.ads.review.tsx +10 -0
- package/dist/starters/react/design-system/showcase/mcp/{main.tsx → main.ads.mount.tsx} +4 -2
- package/dist/starters/react/design-system/tokens/catalog.ads.json +1221 -0
- package/dist/starters/react/design-system/tokens/colors.css +1 -1
- package/dist/starters/react/design-system/tokens/spacing.css +22 -32
- package/dist/starters/react/design-system/tokens/spatial.ads.json +70 -0
- package/dist/starters/react/design-system/tokens/themes.generated.ts +1 -1
- package/dist/starters/react/ds.config.json +25 -6
- package/dist/starters/react/package.json +2 -6
- package/dist/starters/react/tsconfig.json +2 -3
- package/dist/starters/react/vite.config.ts +3 -3
- package/dist/style-boundaries.mjs +70 -25
- package/dist/task-cache.mjs +173 -72
- package/dist/task-worker.mjs +22 -11
- package/dist/test-boundaries.mjs +132 -59
- package/dist/themes-generated.mjs +1 -1
- package/dist/themes-watch.mjs +57 -22
- package/dist/themes.mjs +176 -73
- package/dist/token-export.mjs +39 -14
- package/dist/token-policy.mjs +6 -3
- package/dist/token-quality.mjs +6 -6
- package/dist/token-samples.mjs +16 -5
- package/dist/tokens.mjs +71 -26
- package/dist/ui-framework.mjs +16 -14
- package/dist/unit-contracts.mjs +251 -104
- package/dist/units.mjs +209 -99
- package/dist/usage.mjs +138 -38
- package/dist/validation-checks.mjs +115 -38
- package/dist/validation-inputs.mjs +191 -78
- package/dist/validation.mjs +268 -102
- package/dist/verification/browser.mjs +27 -5
- package/dist/verification.mjs +711 -187
- package/docs/ADS.md +96 -80
- package/docs/ARCHITECTURE.md +368 -137
- package/docs/BEHAVIORS.md +29 -25
- package/docs/CACHING.md +77 -17
- package/docs/CHANGELOG.md +332 -17
- package/docs/CONTRACTS.md +12 -4
- package/docs/DESIGN-REFERENCES.md +40 -0
- package/docs/GUIDE.md +300 -263
- package/docs/MCP.md +187 -324
- package/docs/SPATIAL-CHECKS.md +69 -0
- package/docs/benchmarks/README.md +39 -0
- package/package.json +43 -34
- package/dist/browser-audit.mjs +0 -429
- package/dist/create.mjs +0 -48
- package/dist/lint-config.mjs +0 -50
- package/dist/mcp/project-widget.bundle.js +0 -114
- package/dist/mcp/reports.mjs +0 -101
- package/dist/mcp/widget.bundle.js +0 -147
- package/dist/oxlint.mjs +0 -89
- package/dist/preview-builder.mjs +0 -133
- package/dist/preview-workers.mjs +0 -184
- package/dist/showcase.mjs +0 -77
- package/dist/skills/ads-break-ui/LICENSE.upstream +0 -21
- package/dist/skills/ads-break-ui/README.md +0 -16
- package/dist/skills/ads-break-ui/SKILL.md +0 -412
- package/dist/skills/ads-break-ui/agents/openai.yaml +0 -4
- package/dist/skills/ads-break-ui/references/atomic-styles.md +0 -293
- package/dist/skills/ads-break-ui/references/behaviors.md +0 -412
- package/dist/skills/ads-break-ui/references/captures.md +0 -135
- package/dist/skills/ads-break-ui/references/contracts.md +0 -317
- package/dist/skills/ads-break-ui/references/design-data.md +0 -354
- package/dist/skills/ads-break-ui/references/drafts.md +0 -194
- package/dist/skills/ads-break-ui/references/evidence.md +0 -128
- package/dist/skills/ads-break-ui/references/guarded-editing.md +0 -165
- package/dist/skills/ads-break-ui/references/layers.md +0 -145
- package/dist/skills/ads-break-ui/references/reporting.md +0 -101
- package/dist/skills/ads-break-ui/references/review.md +0 -97
- package/dist/skills/ads-break-ui/references/runtimes.md +0 -203
- package/dist/skills/ads-break-ui/references/scenarios.md +0 -246
- package/dist/skills/ads-break-ui/references/validation.md +0 -166
- package/dist/skills/ads-break-ui/references/verification.md +0 -58
- package/dist/skills/ads-break-ui/references/workflows.md +0 -90
- package/dist/skills/ads-designer/references/reporting.md +0 -101
- package/dist/skills/ads-import/references/reporting.md +0 -101
- package/dist/skills/ads-motion/LICENSE.upstream +0 -21
- package/dist/skills/ads-motion/README.md +0 -22
- package/dist/skills/ads-motion/SKILL.md +0 -385
- package/dist/skills/ads-motion/agents/openai.yaml +0 -4
- package/dist/skills/ads-motion/references/atomic-styles.md +0 -293
- package/dist/skills/ads-motion/references/audit.md +0 -44
- package/dist/skills/ads-motion/references/behaviors.md +0 -412
- package/dist/skills/ads-motion/references/captures.md +0 -135
- package/dist/skills/ads-motion/references/contracts.md +0 -317
- package/dist/skills/ads-motion/references/design-data.md +0 -354
- package/dist/skills/ads-motion/references/drafts.md +0 -194
- package/dist/skills/ads-motion/references/evidence.md +0 -128
- package/dist/skills/ads-motion/references/guarded-editing.md +0 -165
- package/dist/skills/ads-motion/references/layers.md +0 -145
- package/dist/skills/ads-motion/references/motion-review.md +0 -35
- package/dist/skills/ads-motion/references/reporting.md +0 -101
- package/dist/skills/ads-motion/references/review.md +0 -97
- package/dist/skills/ads-motion/references/runtimes.md +0 -203
- package/dist/skills/ads-motion/references/scenarios.md +0 -246
- package/dist/skills/ads-motion/references/validation.md +0 -166
- package/dist/skills/ads-motion/references/verification.md +0 -39
- package/dist/skills/ads-motion/references/workflows.md +0 -90
- package/dist/skills/ads-port/references/reporting.md +0 -101
- package/dist/starters/preact/design-system/components/Layout/Grid/Grid.ads.contract.ts +0 -6
- package/dist/starters/preact/design-system/components/Layout/Grid/Grid.tsx +0 -76
- package/dist/starters/preact/design-system/review/demo-frame/DemoFrame.tsx +0 -29
- package/dist/starters/preact/design-system/review/screen-frame/ScreenFrame.tsx +0 -34
- package/dist/starters/preact/design-system/review/token-preview/TokenPreview.ads.contract.ts +0 -6
- package/dist/starters/preact/design-system/review/token-preview/TokenPreview.tsx +0 -137
- package/dist/starters/preact/design-system/showcase/mcp/main.tsx +0 -6
- package/dist/starters/react/design-system/brand/Icons/AppIcon/AppIcon.ads.fixture.ts +0 -7
- package/dist/starters/react/design-system/brand/Icons/AppIcon/AppIcon.ads.scenario.tsx +0 -4
- package/dist/starters/react/design-system/brand/Identity/Logo/Logo.ads.fixture.ts +0 -7
- package/dist/starters/react/design-system/brand/Identity/Logo/Logo.ads.scenario.tsx +0 -4
- package/dist/starters/react/design-system/components/Layout/Grid/Grid.ads.contract.ts +0 -6
- package/dist/starters/react/design-system/components/Layout/Grid/Grid.ads.exports.ts +0 -1
- package/dist/starters/react/design-system/components/Layout/Grid/Grid.ads.fixture.ts +0 -12
- package/dist/starters/react/design-system/components/Layout/Grid/Grid.ads.scenario.tsx +0 -17
- package/dist/starters/react/design-system/components/Layout/Grid/Grid.tsx +0 -75
- package/dist/starters/react/design-system/components/Layout/Grid/README.md +0 -21
- package/dist/starters/react/design-system/review/brand-preview/BrandPreview.ads.exports.ts +0 -1
- package/dist/starters/react/design-system/review/brand-preview/BrandPreview.tsx +0 -112
- package/dist/starters/react/design-system/review/demo-frame/DemoFrame.tsx +0 -29
- package/dist/starters/react/design-system/review/grid-cell/GridCell.ads.exports.ts +0 -1
- package/dist/starters/react/design-system/review/grid-cell/GridCell.tsx +0 -18
- package/dist/starters/react/design-system/review/index.ts +0 -6
- package/dist/starters/react/design-system/review/screen-frame/ScreenFrame.tsx +0 -34
- package/dist/starters/react/design-system/review/token-preview/TokenPreview.ads.contract.ts +0 -6
- package/dist/starters/react/design-system/review/token-preview/TokenPreview.ads.exports.ts +0 -1
- package/dist/starters/react/design-system/review/token-preview/TokenPreview.tsx +0 -137
- package/dist/starters/react/design-system/showcase/mcp/index.html +0 -1
- package/dist/starters/react/design-system/tokens/Color.ads.fixture.ts +0 -124
- package/dist/starters/react/design-system/tokens/Color.ads.scenario.tsx +0 -4
- package/dist/starters/react/design-system/tokens/Layout.ads.fixture.ts +0 -39
- package/dist/starters/react/design-system/tokens/Layout.ads.scenario.tsx +0 -4
- package/dist/starters/react/design-system/tokens/Motion.ads.fixture.ts +0 -18
- package/dist/starters/react/design-system/tokens/Motion.ads.scenario.tsx +0 -4
- package/dist/starters/react/design-system/tokens/Shape.ads.fixture.ts +0 -30
- package/dist/starters/react/design-system/tokens/Shape.ads.scenario.tsx +0 -4
- package/dist/starters/react/design-system/tokens/Space.ads.fixture.ts +0 -37
- package/dist/starters/react/design-system/tokens/Space.ads.scenario.tsx +0 -4
- package/dist/starters/react/design-system/tokens/Type.ads.fixture.ts +0 -29
- package/dist/starters/react/design-system/tokens/Type.ads.scenario.tsx +0 -4
- package/dist/starters/react/package-lock.json +0 -4707
- package/dist/token-fixtures.mjs +0 -30
- package/docs/benchmarks/bun-previews.md +0 -91
- package/docs/benchmarks/preview-memory.md +0 -147
- package/docs/benchmarks/turbo-poc.md +0 -284
- package/docs/plans/execution-coordination.md +0 -57
- /package/dist/{browser-audit → render-audit}/first-render.mjs +0 -0
- /package/dist/{browser-audit → render-audit}/layout-shift.mjs +0 -0
package/dist/source-values.mjs
CHANGED
|
@@ -1,21 +1,25 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { eachChild, flatMapAsync, forEachAsync, mapAsync } from "./analysis/queries.mjs";
|
|
2
|
+
import ts from "./analysis/syntax.mjs";
|
|
2
3
|
import { isInside } from "./config.mjs";
|
|
3
4
|
import { uiOperation } from "./ui-framework.mjs";
|
|
4
5
|
import { sourceSymbol } from "./source-symbols.mjs";
|
|
6
|
+
import { memoProgram } from "./analysis/helpers.mjs";
|
|
5
7
|
|
|
6
|
-
export const unknown = reason => ({ kind: "unknown", reason });
|
|
7
|
-
export const literal = value => ({ kind: "literal", value });
|
|
8
|
-
export const reference = (node, env = new Map(), via = []) => node ? { kind: "node", node, env, via } : literal(undefined);
|
|
9
|
-
export const union = values => values.length === 1 ? values[0] : { kind: "union", values };
|
|
10
|
-
export const isFunction =
|
|
11
|
-
|
|
8
|
+
export const unknown = (reason) => ({ kind: "unknown", reason });
|
|
9
|
+
export const literal = (value) => ({ kind: "literal", value });
|
|
10
|
+
export const reference = (node, env = new Map(), via = []) => (node ? { kind: "node", node, env, via } : literal(undefined));
|
|
11
|
+
export const union = (values) => (values.length === 1 ? values[0] : { kind: "union", values });
|
|
12
|
+
export const isFunction = (node) =>
|
|
13
|
+
node && (ts.isFunctionDeclaration(node) || ts.isFunctionExpression(node) || ts.isArrowFunction(node) || ts.isMethodDeclaration(node));
|
|
14
|
+
const nameOf = (node) => (node && (ts.isIdentifier(node) || ts.isStringLiteralLike(node) || ts.isNumericLiteral(node)) ? node.text : undefined);
|
|
12
15
|
export function unwrap(node) {
|
|
13
|
-
while (node && (ts.isParenthesizedExpression(node) || ts.isAsExpression(node) || ts.isSatisfiesExpression(node) || ts.isNonNullExpression(node)))
|
|
16
|
+
while (node && (ts.isParenthesizedExpression(node) || ts.isAsExpression(node) || ts.isSatisfiesExpression(node) || ts.isNonNullExpression(node)))
|
|
17
|
+
node = node.expression;
|
|
14
18
|
return node;
|
|
15
19
|
}
|
|
16
20
|
|
|
17
21
|
/** Bounded symbolic source traversal. No project code is imported or executed. */
|
|
18
|
-
export function createSourceValues(program, options, { preserveCall = () => false, strict = false } = {}) {
|
|
22
|
+
export function createSourceValues(program, options, { preserveCall = () => false, strict = false, completeReturns = strict } = {}) {
|
|
19
23
|
const checker = program.getTypeChecker();
|
|
20
24
|
const ownedFiles = new Map();
|
|
21
25
|
function owned(node) {
|
|
@@ -23,99 +27,158 @@ export function createSourceValues(program, options, { preserveCall = () => fals
|
|
|
23
27
|
if (!ownedFiles.has(file)) ownedFiles.set(file, isInside(options.dsRoot, file));
|
|
24
28
|
return ownedFiles.get(file);
|
|
25
29
|
}
|
|
26
|
-
const symbol = node => {
|
|
27
|
-
const value = sourceSymbol(checker, ts.isPropertyAccessExpression(node) ? node.name : node);
|
|
28
|
-
return value?.valueDeclaration && ts.isShorthandPropertyAssignment(value.valueDeclaration)
|
|
30
|
+
const symbol = async (node) => {
|
|
31
|
+
const value = await sourceSymbol(checker, ts.isPropertyAccessExpression(node) ? node.name : node);
|
|
32
|
+
return value?.valueDeclaration && ts.isShorthandPropertyAssignment(value.valueDeclaration)
|
|
33
|
+
? ((await checker.getShorthandAssignmentValueSymbol(value.valueDeclaration)) ?? value)
|
|
34
|
+
: value;
|
|
29
35
|
};
|
|
30
|
-
function declaration(node) {
|
|
31
|
-
let value = symbol(node);
|
|
32
|
-
if (value?.flags & ts.SymbolFlags.Alias) value = checker.getAliasedSymbol(value);
|
|
36
|
+
async function declaration(node) {
|
|
37
|
+
let value = await symbol(node);
|
|
38
|
+
if (value?.flags & ts.SymbolFlags.Alias) value = await checker.getAliasedSymbol(value);
|
|
33
39
|
return value?.valueDeclaration;
|
|
34
40
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
if (ts.isDeleteExpression(node)) writes.add(root(node.expression));
|
|
46
|
-
if (ts.isCallExpression(node) || ts.isNewExpression(node)) for (const argument of node.arguments ?? []) {
|
|
47
|
-
const value = unwrap(argument);
|
|
48
|
-
if (ts.isIdentifier(value)) escapes.add(symbol(value));
|
|
41
|
+
let effects;
|
|
42
|
+
const strictEffects = async () =>
|
|
43
|
+
(effects ??= await memoProgram(program, `strict-source-effects:${options.dsRoot}`, async () => {
|
|
44
|
+
const writes = new Set(),
|
|
45
|
+
escapes = new Set(),
|
|
46
|
+
aliases = [];
|
|
47
|
+
async function root(node) {
|
|
48
|
+
node = unwrap(node);
|
|
49
|
+
while (node && (ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node))) node = unwrap(node.expression);
|
|
50
|
+
return node && ts.isIdentifier(node) ? await symbol(node) : null;
|
|
49
51
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
52
|
+
async function scan(node) {
|
|
53
|
+
if (ts.isBinaryExpression(node) && node.operatorToken.kind >= ts.SyntaxKind.FirstAssignment && node.operatorToken.kind <= ts.SyntaxKind.LastAssignment)
|
|
54
|
+
writes.add(await root(node.left));
|
|
55
|
+
if (
|
|
56
|
+
(ts.isPrefixUnaryExpression(node) || ts.isPostfixUnaryExpression(node)) &&
|
|
57
|
+
[ts.SyntaxKind.PlusPlusToken, ts.SyntaxKind.MinusMinusToken].includes(node.operator)
|
|
58
|
+
)
|
|
59
|
+
writes.add(await root(node.operand));
|
|
60
|
+
if (ts.isDeleteExpression(node)) writes.add(await root(node.expression));
|
|
61
|
+
if (ts.isCallExpression(node) || ts.isNewExpression(node))
|
|
62
|
+
for (const argument of node.arguments ?? []) {
|
|
63
|
+
const value = unwrap(argument);
|
|
64
|
+
if (ts.isIdentifier(value)) escapes.add(await symbol(value));
|
|
65
|
+
}
|
|
66
|
+
if (ts.isVariableDeclaration(node) && ts.isIdentifier(node.name) && node.initializer && (await root(node.initializer)))
|
|
67
|
+
aliases.push([await symbol(node.name), await root(node.initializer)]);
|
|
68
|
+
await eachChild(node, scan);
|
|
69
|
+
}
|
|
70
|
+
for (const file of await program.getSourceFiles()) if (isInside(options.dsRoot, file.fileName)) await scan(file);
|
|
71
|
+
const targets = new Map();
|
|
72
|
+
for (const [alias, target] of aliases) {
|
|
73
|
+
if (!targets.has(alias)) targets.set(alias, []);
|
|
74
|
+
targets.get(alias).push(target);
|
|
75
|
+
}
|
|
76
|
+
for (const affected of [writes, escapes]) {
|
|
77
|
+
const queue = [...affected];
|
|
78
|
+
for (let index = 0; index < queue.length; ++index)
|
|
79
|
+
for (const target of targets.get(queue[index]) ?? [])
|
|
80
|
+
if (!affected.has(target)) {
|
|
81
|
+
affected.add(target);
|
|
82
|
+
queue.push(target);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return { writes, escapes };
|
|
86
|
+
}));
|
|
61
87
|
const state = () => ({ budget: { steps: 0 }, depth: 0, calls: new Set() });
|
|
62
|
-
function next(context) {
|
|
63
|
-
|
|
88
|
+
function next(context) {
|
|
89
|
+
return { ...context, depth: context.depth + 1 };
|
|
90
|
+
}
|
|
91
|
+
function exhausted(context) {
|
|
92
|
+
return ++context.budget.steps > (context.maxSteps ?? 4000) || context.depth > (context.maxDepth ?? 48);
|
|
93
|
+
}
|
|
64
94
|
function at(node, kind, name) {
|
|
65
|
-
const source = node.getSourceFile(),
|
|
95
|
+
const source = node.getSourceFile(),
|
|
96
|
+
position = source.getLineAndCharacterOfPosition(node.getStart(source));
|
|
66
97
|
return { file: source.fileName, line: position.line + 1, column: position.character + 1, kind, name: name.slice(0, 100) };
|
|
67
98
|
}
|
|
68
99
|
function withVia(value, via) {
|
|
69
|
-
if (value.kind === "union") return { ...value, values: value.values.map(item => withVia(item, via)) };
|
|
70
|
-
return value.kind === "node"
|
|
100
|
+
if (value.kind === "union") return { ...value, values: value.values.map((item) => withVia(item, via)) };
|
|
101
|
+
return value.kind === "node"
|
|
102
|
+
? { ...value, via: [...new Map([...via, ...value.via].map((item) => [JSON.stringify(item), item])).values()].slice(0, 16) }
|
|
103
|
+
: value;
|
|
71
104
|
}
|
|
72
|
-
function withDefault(value, fallback, context) {
|
|
105
|
+
async function withDefault(value, fallback, context) {
|
|
73
106
|
if (!fallback) return value;
|
|
74
|
-
value = resolve(value, next(context));
|
|
107
|
+
value = await resolve(value, next(context));
|
|
75
108
|
if (value.kind === "literal") return value.value === undefined ? fallback : value;
|
|
76
109
|
if (value.kind === "unknown") return union([value, fallback]);
|
|
77
|
-
if (value.kind === "union") return union(value.values
|
|
110
|
+
if (value.kind === "union") return union(await mapAsync(value.values, async (item) => withDefault(item, fallback, next(context))));
|
|
78
111
|
return value;
|
|
79
112
|
}
|
|
80
|
-
function bind(pattern, value, env, via, context) {
|
|
81
|
-
if (ts.isIdentifier(pattern)) {
|
|
113
|
+
async function bind(pattern, value, env, via, context) {
|
|
114
|
+
if (ts.isIdentifier(pattern)) {
|
|
115
|
+
env.set(await symbol(pattern), value);
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
82
118
|
if (ts.isObjectBindingPattern(pattern)) {
|
|
83
119
|
const excluded = new Set();
|
|
84
120
|
for (const part of pattern.elements) {
|
|
85
121
|
const key = nameOf(part.propertyName ?? part.name);
|
|
86
|
-
if (part.dotDotDotToken) bind(part.name, { kind: "rest", value, excluded: new Set(excluded) }, env, via, next(context));
|
|
122
|
+
if (part.dotDotDotToken) await bind(part.name, { kind: "rest", value, excluded: new Set(excluded) }, env, via, next(context));
|
|
87
123
|
else {
|
|
88
124
|
if (key === undefined) continue;
|
|
89
125
|
excluded.add(key);
|
|
90
|
-
bind(
|
|
126
|
+
await bind(
|
|
127
|
+
part.name,
|
|
128
|
+
await withDefault(await get(value, key, next(context)), part.initializer && reference(part.initializer, env, via), context),
|
|
129
|
+
env,
|
|
130
|
+
via,
|
|
131
|
+
next(context),
|
|
132
|
+
);
|
|
91
133
|
}
|
|
92
134
|
}
|
|
93
135
|
} else if (ts.isArrayBindingPattern(pattern)) {
|
|
94
|
-
pattern.elements
|
|
95
|
-
if (ts.isBindingElement(part) && !part.dotDotDotToken)
|
|
136
|
+
await forEachAsync(pattern.elements, async (part, index) => {
|
|
137
|
+
if (ts.isBindingElement(part) && !part.dotDotDotToken)
|
|
138
|
+
await bind(
|
|
139
|
+
part.name,
|
|
140
|
+
await withDefault(await get(value, String(index), next(context)), part.initializer && reference(part.initializer, env, via), context),
|
|
141
|
+
env,
|
|
142
|
+
via,
|
|
143
|
+
next(context),
|
|
144
|
+
);
|
|
96
145
|
});
|
|
97
146
|
}
|
|
98
147
|
}
|
|
99
|
-
function boundElement(node, env, via, context) {
|
|
148
|
+
async function boundElement(node, env, via, context) {
|
|
100
149
|
let owner = node;
|
|
101
150
|
while (ts.isBindingElement(owner) || ts.isObjectBindingPattern(owner) || ts.isArrayBindingPattern(owner)) owner = owner.parent;
|
|
102
151
|
if (!ts.isVariableDeclaration(owner) || !owner.initializer || !(owner.parent.flags & ts.NodeFlags.Const)) return unknown();
|
|
103
152
|
const local = new Map(env);
|
|
104
|
-
bind(owner.name, reference(owner.initializer, env, via), local, via, next(context));
|
|
105
|
-
return local.get(symbol(node.name)) ?? unknown();
|
|
153
|
+
await bind(owner.name, reference(owner.initializer, env, via), local, via, next(context));
|
|
154
|
+
return local.get(await symbol(node.name)) ?? unknown();
|
|
106
155
|
}
|
|
107
|
-
function get(value, key, context) {
|
|
108
|
-
value = resolve(value, next(context));
|
|
156
|
+
async function get(value, key, context) {
|
|
157
|
+
value = await resolve(value, next(context));
|
|
109
158
|
if (strict && value.kind === "context" && key === "Provider") return { kind: "provider" };
|
|
110
|
-
if (value.kind === "union") return union(value.values
|
|
111
|
-
if (value.kind === "rest") return value.excluded.has(key) ? literal(undefined) : get(value.value, key, next(context));
|
|
159
|
+
if (value.kind === "union") return union(await mapAsync(value.values, async (item) => get(item, key, next(context))));
|
|
160
|
+
if (value.kind === "rest") return value.excluded.has(key) ? literal(undefined) : await get(value.value, key, next(context));
|
|
112
161
|
const layers = value.kind === "object" ? value.layers : [];
|
|
113
162
|
if (value.kind === "node" && ts.isObjectLiteralExpression(value.node)) {
|
|
114
163
|
for (const property of value.node.properties) {
|
|
115
164
|
if (ts.isSpreadAssignment(property)) layers.push(reference(property.expression, value.env, value.via));
|
|
116
165
|
else {
|
|
117
166
|
const name = nameOf(property.name);
|
|
118
|
-
if (name !== undefined)
|
|
167
|
+
if (name !== undefined)
|
|
168
|
+
layers.push(
|
|
169
|
+
new Map([
|
|
170
|
+
[
|
|
171
|
+
name,
|
|
172
|
+
strict && (ts.isGetAccessorDeclaration(property) || ts.isSetAccessorDeclaration(property))
|
|
173
|
+
? unknown("An accessor is not a statically known property.")
|
|
174
|
+
: reference(
|
|
175
|
+
ts.isShorthandPropertyAssignment(property) ? property.name : ts.isMethodDeclaration(property) ? property : property.initializer,
|
|
176
|
+
value.env,
|
|
177
|
+
value.via,
|
|
178
|
+
),
|
|
179
|
+
],
|
|
180
|
+
]),
|
|
181
|
+
);
|
|
119
182
|
else if (strict) layers.push(unknown("A computed object key may replace the selected property."));
|
|
120
183
|
}
|
|
121
184
|
}
|
|
@@ -124,132 +187,210 @@ export function createSourceValues(program, options, { preserveCall = () => fals
|
|
|
124
187
|
} else if (value.kind !== "object") return unknown(value.reason);
|
|
125
188
|
for (let index = layers.length - 1; index >= 0; index--) {
|
|
126
189
|
const layer = layers[index];
|
|
127
|
-
if (layer instanceof Map) {
|
|
128
|
-
|
|
129
|
-
|
|
190
|
+
if (layer instanceof Map) {
|
|
191
|
+
if (layer.has(key)) return layer.get(key);
|
|
192
|
+
} else {
|
|
193
|
+
const selected = await get(layer, key, next(context));
|
|
130
194
|
if (selected.kind === "literal" && selected.value === undefined) continue;
|
|
131
195
|
// An opaque later spread may replace an earlier explicit property.
|
|
132
|
-
if (selected.kind === "unknown" || selected.kind === "union")
|
|
196
|
+
if (selected.kind === "unknown" || selected.kind === "union")
|
|
197
|
+
return union([selected, await get({ kind: "object", layers: layers.slice(0, index) }, key, next(context))]);
|
|
133
198
|
return selected;
|
|
134
199
|
}
|
|
135
200
|
}
|
|
136
201
|
return literal(undefined);
|
|
137
202
|
}
|
|
138
|
-
function keys(value, context) {
|
|
139
|
-
value = resolve(value, next(context));
|
|
140
|
-
if (value.kind === "union") return [...new Set(value.values
|
|
141
|
-
if (value.kind === "rest") return keys(value.value, next(context)).filter(key => !value.excluded.has(key));
|
|
142
|
-
if (value.kind === "node" && ts.isObjectLiteralExpression(value.node))
|
|
143
|
-
|
|
203
|
+
async function keys(value, context) {
|
|
204
|
+
value = await resolve(value, next(context));
|
|
205
|
+
if (value.kind === "union") return [...new Set(await flatMapAsync(value.values, async (item) => keys(item, next(context))))];
|
|
206
|
+
if (value.kind === "rest") return (await keys(value.value, next(context))).filter((key) => !value.excluded.has(key));
|
|
207
|
+
if (value.kind === "node" && ts.isObjectLiteralExpression(value.node))
|
|
208
|
+
return flatMapAsync(value.node.properties, async (property) =>
|
|
209
|
+
ts.isSpreadAssignment(property) ? await keys(reference(property.expression, value.env, value.via), next(context)) : (nameOf(property.name) ?? []),
|
|
210
|
+
);
|
|
211
|
+
if (value.kind === "object")
|
|
212
|
+
return [...new Set(await flatMapAsync(value.layers, async (layer) => (layer instanceof Map ? [...layer.keys()] : await keys(layer, next(context)))))];
|
|
144
213
|
return [];
|
|
145
214
|
}
|
|
146
|
-
function returns(fn, args, context, kind = "helper") {
|
|
147
|
-
if (kind!=="component"&&context.calls.has(fn.node)) return [unknown("Recursive local call could not be fully traced.")];
|
|
148
|
-
if (!fn.node.body || fn.node.asteriskToken || fn.node.modifiers?.some(item => item.kind === ts.SyntaxKind.AsyncKeyword))
|
|
149
|
-
|
|
150
|
-
const
|
|
215
|
+
async function returns(fn, args, context, kind = "helper") {
|
|
216
|
+
if (kind !== "component" && context.calls.has(fn.node)) return [unknown("Recursive local call could not be fully traced.")];
|
|
217
|
+
if (!fn.node.body || fn.node.asteriskToken || fn.node.modifiers?.some((item) => item.kind === ts.SyntaxKind.AsyncKeyword))
|
|
218
|
+
return [unknown("Async, generator or declaration-only calls are outside atomic source tracing.")];
|
|
219
|
+
const env = new Map(fn.env),
|
|
220
|
+
via = [...fn.via, at(fn.node, kind, fn.node.name?.getText() ?? "local function")];
|
|
221
|
+
const inner = { ...next(context), calls: new Set(kind === "component" ? [fn.node] : [...context.calls, fn.node]) };
|
|
151
222
|
for (const [index, parameter] of fn.node.parameters.entries()) {
|
|
152
|
-
if (parameter.dotDotDotToken) {
|
|
153
|
-
|
|
223
|
+
if (parameter.dotDotDotToken) {
|
|
224
|
+
await bind(parameter.name, { kind: "array", values: args.slice(index) }, env, via, inner);
|
|
225
|
+
break;
|
|
226
|
+
}
|
|
227
|
+
await bind(
|
|
228
|
+
parameter.name,
|
|
229
|
+
await withDefault(await resolve(args[index] ?? literal(undefined), inner), parameter.initializer && reference(parameter.initializer, env, via), inner),
|
|
230
|
+
env,
|
|
231
|
+
via,
|
|
232
|
+
inner,
|
|
233
|
+
);
|
|
154
234
|
}
|
|
155
235
|
const outputs = [];
|
|
156
|
-
function statement(node) {
|
|
157
|
-
if (ts.isReturnStatement(node)) {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
const
|
|
236
|
+
async function statement(node) {
|
|
237
|
+
if (ts.isReturnStatement(node)) {
|
|
238
|
+
outputs.push(reference(node.expression, env, via));
|
|
239
|
+
return true;
|
|
240
|
+
}
|
|
241
|
+
if (ts.isBlock(node)) {
|
|
242
|
+
for (const child of node.statements) if (await statement(child)) return true;
|
|
243
|
+
} else if (ts.isIfStatement(node)) {
|
|
244
|
+
const condition = await resolve(reference(node.expression, env, via), inner);
|
|
245
|
+
if (condition.kind === "literal")
|
|
246
|
+
return condition.value ? await statement(node.thenStatement) : node.elseStatement ? await statement(node.elseStatement) : false;
|
|
247
|
+
const left = await statement(node.thenStatement),
|
|
248
|
+
right = node.elseStatement ? await statement(node.elseStatement) : false;
|
|
163
249
|
return left && right;
|
|
164
|
-
} else if (ts.isThrowStatement(node)) {
|
|
165
|
-
|
|
250
|
+
} else if (ts.isThrowStatement(node)) {
|
|
251
|
+
if (completeReturns) outputs.push(unknown("A throwing branch does not establish a returned value."));
|
|
252
|
+
return true;
|
|
253
|
+
} else if (ts.isIterationStatement(node, false) || ts.isSwitchStatement(node) || ts.isTryStatement(node))
|
|
254
|
+
outputs.push(unknown("Loop, switch or try control flow could not be fully traced."));
|
|
166
255
|
return false;
|
|
167
256
|
}
|
|
168
|
-
if (ts.isBlock(fn.node.body)) {
|
|
169
|
-
|
|
257
|
+
if (ts.isBlock(fn.node.body)) {
|
|
258
|
+
if (!(await statement(fn.node.body)) && completeReturns) outputs.push(literal(undefined));
|
|
259
|
+
} else outputs.push(reference(fn.node.body, env, via));
|
|
170
260
|
// Keep call stacks with lazy return references, including nested helpers.
|
|
171
|
-
return outputs.length ? outputs.map(value => ({ ...value, context: inner })) : [literal(undefined)];
|
|
261
|
+
return outputs.length ? outputs.map((value) => ({ ...value, context: inner })) : [literal(undefined)];
|
|
172
262
|
}
|
|
173
|
-
function resolve(value, context) {
|
|
263
|
+
async function resolve(value, context) {
|
|
174
264
|
if (!value) return literal(undefined);
|
|
175
265
|
context = value.context ?? context;
|
|
176
266
|
if (exhausted(context)) return unknown("Atomic source tracing reached its depth or work limit.");
|
|
177
267
|
if (value.kind !== "node") return value;
|
|
178
|
-
const node = unwrap(value.node),
|
|
179
|
-
|
|
268
|
+
const node = unwrap(value.node),
|
|
269
|
+
{ env, via } = value;
|
|
270
|
+
if (ts.isStringLiteralLike(node) || ts.isNumericLiteral(node))
|
|
271
|
+
return { ...literal(ts.isNumericLiteral(node) ? Number(node.text) : node.text), ...(strict ? { origin: node, via } : {}) };
|
|
180
272
|
if (node.kind === ts.SyntaxKind.TrueKeyword || node.kind === ts.SyntaxKind.FalseKeyword) return literal(node.kind === ts.SyntaxKind.TrueKeyword);
|
|
181
273
|
if (node.kind === ts.SyntaxKind.NullKeyword) return literal(null);
|
|
182
274
|
if (ts.isIdentifier(node)) {
|
|
183
|
-
if (strict && writes.has(symbol(node))) return unknown("A written binding or object is not a statically known value.");
|
|
184
|
-
if (strict && ["Fragment", "StrictMode"].includes(uiOperation(node, checker))) return { kind: "provider" };
|
|
185
|
-
if (env.has(symbol(node))) {
|
|
186
|
-
const result = resolve(env.get(symbol(node)), next(context));
|
|
187
|
-
return strict &&
|
|
275
|
+
if (strict && (await strictEffects()).writes.has(await symbol(node))) return unknown("A written binding or object is not a statically known value.");
|
|
276
|
+
if (strict && ["Fragment", "StrictMode"].includes(await uiOperation(node, checker))) return { kind: "provider" };
|
|
277
|
+
if (env.has(await symbol(node))) {
|
|
278
|
+
const result = await resolve(env.get(await symbol(node)), next(context));
|
|
279
|
+
return strict &&
|
|
280
|
+
(await strictEffects()).escapes.has(await symbol(node)) &&
|
|
281
|
+
(result.kind === "object" ||
|
|
282
|
+
result.kind === "array" ||
|
|
283
|
+
(result.kind === "node" && (ts.isObjectLiteralExpression(result.node) || ts.isArrayLiteralExpression(result.node))))
|
|
284
|
+
? unknown("An object passed to another call may have been mutated.")
|
|
285
|
+
: result;
|
|
188
286
|
}
|
|
189
|
-
const owner = declaration(node);
|
|
287
|
+
const owner = await declaration(node);
|
|
190
288
|
if (owner && owned(owner)) {
|
|
191
289
|
if (isFunction(owner)) return reference(owner, env, via);
|
|
192
290
|
if (ts.isVariableDeclaration(owner) && owner.initializer && owner.parent.flags & ts.NodeFlags.Const) {
|
|
193
|
-
const result = resolve(reference(owner.initializer, env, via), next(context));
|
|
194
|
-
return strict &&
|
|
291
|
+
const result = await resolve(reference(owner.initializer, env, via), next(context));
|
|
292
|
+
return strict &&
|
|
293
|
+
(await strictEffects()).escapes.has(await symbol(node)) &&
|
|
294
|
+
(result.kind === "object" ||
|
|
295
|
+
result.kind === "array" ||
|
|
296
|
+
(result.kind === "node" && (ts.isObjectLiteralExpression(result.node) || ts.isArrayLiteralExpression(result.node))))
|
|
297
|
+
? unknown("An object passed to another call may have been mutated.")
|
|
298
|
+
: result;
|
|
195
299
|
}
|
|
196
|
-
if (ts.isBindingElement(owner)) return resolve(boundElement(owner, env, via, context), next(context));
|
|
300
|
+
if (ts.isBindingElement(owner)) return resolve(await boundElement(owner, env, via, context), next(context));
|
|
197
301
|
}
|
|
198
302
|
return node.text === "undefined" && !owner ? literal(undefined) : unknown();
|
|
199
303
|
}
|
|
200
304
|
if (ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node)) {
|
|
201
|
-
const key = ts.isPropertyAccessExpression(node) ? literal(node.name.text) : resolve(reference(node.argumentExpression, env, via), next(context));
|
|
305
|
+
const key = ts.isPropertyAccessExpression(node) ? literal(node.name.text) : await resolve(reference(node.argumentExpression, env, via), next(context));
|
|
202
306
|
const object = reference(node.expression, env, via);
|
|
203
307
|
if (key.kind === "literal") {
|
|
204
|
-
const selected = get(object, String(key.value), next(context));
|
|
205
|
-
const owner = declaration(node);
|
|
206
|
-
|
|
308
|
+
const selected = await get(object, String(key.value), next(context));
|
|
309
|
+
const owner = await declaration(node);
|
|
310
|
+
// A property symbol identifies its original declaration, not the value
|
|
311
|
+
// after mutation, an accessor or an opaque override. Preserve that lack
|
|
312
|
+
// of proof instead of recovering the declaration's stale initializer.
|
|
313
|
+
if (selected.kind === "unknown" && !(strict && selected.reason) && owner && owned(owner)) {
|
|
207
314
|
if (isFunction(owner)) return reference(owner, env, via);
|
|
208
|
-
if (ts.isVariableDeclaration(owner) && owner.initializer && owner.parent.flags & ts.NodeFlags.Const)
|
|
315
|
+
if (ts.isVariableDeclaration(owner) && owner.initializer && owner.parent.flags & ts.NodeFlags.Const)
|
|
316
|
+
return resolve(reference(owner.initializer, env, via), next(context));
|
|
209
317
|
}
|
|
210
318
|
return resolve(selected, next(context));
|
|
211
319
|
}
|
|
212
|
-
const names = keys(object, next(context));
|
|
320
|
+
const names = await keys(object, next(context));
|
|
213
321
|
if (strict) return unknown("A dynamic property selection is not a statically known value.");
|
|
214
|
-
return names.length ? union(names
|
|
322
|
+
return names.length ? resolve(union(await mapAsync(names, async (name) => get(object, name, next(context)))), next(context)) : unknown();
|
|
215
323
|
}
|
|
216
324
|
if (ts.isConditionalExpression(node)) {
|
|
217
|
-
const condition = resolve(reference(node.condition, env, via), next(context));
|
|
218
|
-
return condition.kind === "literal"
|
|
325
|
+
const condition = await resolve(reference(node.condition, env, via), next(context));
|
|
326
|
+
return condition.kind === "literal"
|
|
327
|
+
? await resolve(reference(condition.value ? node.whenTrue : node.whenFalse, env, via), next(context))
|
|
328
|
+
: union([reference(node.whenTrue, env, via), reference(node.whenFalse, env, via)]);
|
|
219
329
|
}
|
|
220
330
|
if (ts.isBinaryExpression(node)) {
|
|
221
|
-
const left = resolve(reference(node.left, env, via), next(context)),
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
if (operator === ts.SyntaxKind.
|
|
225
|
-
|
|
226
|
-
if (
|
|
331
|
+
const left = await resolve(reference(node.left, env, via), next(context)),
|
|
332
|
+
right = reference(node.right, env, via),
|
|
333
|
+
operator = node.operatorToken.kind;
|
|
334
|
+
if (operator === ts.SyntaxKind.AmpersandAmpersandToken)
|
|
335
|
+
return left.kind === "literal" ? (left.value ? right : literal(undefined)) : union([literal(undefined), right]);
|
|
336
|
+
if (operator === ts.SyntaxKind.BarBarToken) return left.kind === "literal" ? (left.value ? left : right) : union([left, right]);
|
|
337
|
+
if (operator === ts.SyntaxKind.QuestionQuestionToken) return left.kind === "literal" ? (left.value == null ? right : left) : union([left, right]);
|
|
338
|
+
const other = await resolve(right, next(context));
|
|
339
|
+
if (
|
|
340
|
+
left.kind === "literal" &&
|
|
341
|
+
other.kind === "literal" &&
|
|
342
|
+
[ts.SyntaxKind.EqualsEqualsEqualsToken, ts.SyntaxKind.ExclamationEqualsEqualsToken].includes(operator)
|
|
343
|
+
)
|
|
344
|
+
return literal(operator === ts.SyntaxKind.EqualsEqualsEqualsToken ? left.value === other.value : left.value !== other.value);
|
|
227
345
|
}
|
|
228
346
|
if (ts.isPrefixUnaryExpression(node) && node.operator === ts.SyntaxKind.ExclamationToken) {
|
|
229
|
-
const operand = resolve(reference(node.operand, env, via), next(context));
|
|
347
|
+
const operand = await resolve(reference(node.operand, env, via), next(context));
|
|
230
348
|
return operand.kind === "literal" ? literal(!operand.value) : unknown();
|
|
231
349
|
}
|
|
232
|
-
if (ts.isCallExpression(node) && !preserveCall(node.expression)) {
|
|
233
|
-
if (strict && uiOperation(node.expression, checker) === "createContext") return { kind: "context" };
|
|
234
|
-
if (["memo", "forwardRef"].includes(uiOperation(node.expression, checker))) return resolve(reference(node.arguments[0], env, via), next(context));
|
|
235
|
-
const fn = resolve(reference(node.expression, env, via), next(context));
|
|
350
|
+
if (ts.isCallExpression(node) && !(await preserveCall(node.expression))) {
|
|
351
|
+
if (strict && (await uiOperation(node.expression, checker)) === "createContext") return { kind: "context" };
|
|
352
|
+
if (["memo", "forwardRef"].includes(await uiOperation(node.expression, checker))) return resolve(reference(node.arguments[0], env, via), next(context));
|
|
353
|
+
const fn = await resolve(reference(node.expression, env, via), next(context));
|
|
236
354
|
if (fn.kind === "node" && isFunction(fn.node)) {
|
|
237
|
-
const outputs = returns(
|
|
238
|
-
|
|
355
|
+
const outputs = await returns(
|
|
356
|
+
fn,
|
|
357
|
+
node.arguments.map((argument) => reference(argument, env, via)),
|
|
358
|
+
next(context),
|
|
359
|
+
);
|
|
360
|
+
return withVia(
|
|
361
|
+
await resolve(union(outputs), next(context)),
|
|
362
|
+
outputs.flatMap((item) => item.via ?? []),
|
|
363
|
+
);
|
|
239
364
|
}
|
|
240
365
|
return unknown(`Call ${node.expression.getText().slice(0, 80)} could not be traced to a local function.`);
|
|
241
366
|
}
|
|
242
367
|
return { ...value, node };
|
|
243
368
|
}
|
|
244
|
-
function arrays(value, context) {
|
|
245
|
-
value = resolve(value, next(context));
|
|
369
|
+
async function arrays(value, context) {
|
|
370
|
+
value = await resolve(value, next(context));
|
|
246
371
|
if (value.kind === "array") return value.values;
|
|
247
|
-
if (value.kind === "node" && ts.isArrayLiteralExpression(value.node)) return value.node.elements.map(node => reference(node, value.env, value.via));
|
|
372
|
+
if (value.kind === "node" && ts.isArrayLiteralExpression(value.node)) return value.node.elements.map((node) => reference(node, value.env, value.via));
|
|
248
373
|
return null;
|
|
249
374
|
}
|
|
250
375
|
|
|
251
376
|
function props(node, env = new Map(), via = []) {
|
|
252
|
-
return {
|
|
377
|
+
return {
|
|
378
|
+
kind: "object",
|
|
379
|
+
layers: node.attributes.properties.map((attribute) =>
|
|
380
|
+
ts.isJsxSpreadAttribute(attribute)
|
|
381
|
+
? reference(attribute.expression, env, via)
|
|
382
|
+
: new Map([
|
|
383
|
+
[
|
|
384
|
+
attribute.name.text,
|
|
385
|
+
attribute.initializer
|
|
386
|
+
? ts.isJsxExpression(attribute.initializer)
|
|
387
|
+
? reference(attribute.initializer.expression, env, via)
|
|
388
|
+
: reference(attribute.initializer, env, via)
|
|
389
|
+
: literal(true),
|
|
390
|
+
],
|
|
391
|
+
]),
|
|
392
|
+
),
|
|
393
|
+
};
|
|
253
394
|
}
|
|
254
395
|
return { state, next, at, resolve, get, keys, arrays, returns, props, declaration };
|
|
255
396
|
}
|