@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
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { fork } from "node:child_process";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { readAnalysisInputs } from "./inputs.mjs";
|
|
4
|
+
import { developmentRuntime } from "../development-runtime.mjs";
|
|
5
|
+
|
|
6
|
+
let worker,
|
|
7
|
+
sequence = 0,
|
|
8
|
+
idle;
|
|
9
|
+
const pending = new Map(),
|
|
10
|
+
registered = new Set(),
|
|
11
|
+
baselines = new Map();
|
|
12
|
+
const cancelled = () =>
|
|
13
|
+
Object.assign(new Error("Analysis cancelled."), { code: "ADS_CANCELLED", diagnostic: { rule: "mutation-cancelled", message: "Analysis cancelled." } });
|
|
14
|
+
function failure(error, current = worker) {
|
|
15
|
+
if (current !== worker) return;
|
|
16
|
+
clearTimeout(idle);
|
|
17
|
+
worker = undefined;
|
|
18
|
+
registered.clear();
|
|
19
|
+
baselines.clear();
|
|
20
|
+
for (const task of pending.values()) task.reject(error);
|
|
21
|
+
pending.clear();
|
|
22
|
+
}
|
|
23
|
+
function start() {
|
|
24
|
+
if (worker) return worker;
|
|
25
|
+
worker = fork(new URL("./worker.mjs", import.meta.url), [], {
|
|
26
|
+
execPath: process.execPath,
|
|
27
|
+
execArgv: [],
|
|
28
|
+
serialization: "json",
|
|
29
|
+
stdio: ["ignore", "ignore", "inherit", "ipc"],
|
|
30
|
+
});
|
|
31
|
+
const current = worker;
|
|
32
|
+
current.on("message", ({ id, result, error }) => {
|
|
33
|
+
const task = pending.get(id);
|
|
34
|
+
pending.delete(id);
|
|
35
|
+
if (task) {
|
|
36
|
+
if (error) task.reject(Object.assign(new Error(error.message), error));
|
|
37
|
+
else task.resolve(result);
|
|
38
|
+
}
|
|
39
|
+
if (!pending.size && worker === current) {
|
|
40
|
+
current.unref();
|
|
41
|
+
current.channel?.unref?.();
|
|
42
|
+
idle = setTimeout(() => {
|
|
43
|
+
if (!registered.size) void closeAnalysis().catch(() => {});
|
|
44
|
+
}, 60000);
|
|
45
|
+
idle.unref();
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
current.on("error", (error) => failure(error, current));
|
|
49
|
+
current.on("exit", (code) => failure(new Error(`Analysis service exited (${code}).`), current));
|
|
50
|
+
return current;
|
|
51
|
+
}
|
|
52
|
+
function request(message, signal) {
|
|
53
|
+
if (signal?.aborted) return Promise.reject(cancelled());
|
|
54
|
+
clearTimeout(idle);
|
|
55
|
+
const current = start(),
|
|
56
|
+
id = ++sequence;
|
|
57
|
+
current.ref();
|
|
58
|
+
current.channel?.ref?.();
|
|
59
|
+
return new Promise((resolve, reject) => {
|
|
60
|
+
const abort = () => {
|
|
61
|
+
const task = pending.get(id);
|
|
62
|
+
pending.delete(id);
|
|
63
|
+
task?.reject(cancelled());
|
|
64
|
+
};
|
|
65
|
+
const timer = setTimeout(() => {
|
|
66
|
+
failure(Object.assign(new Error("Analysis request exceeded 60 seconds."), { code: "ADS_ANALYSIS_TIMEOUT" }), current);
|
|
67
|
+
current.kill();
|
|
68
|
+
}, 60000);
|
|
69
|
+
const done = (callback) => (value) => {
|
|
70
|
+
clearTimeout(timer);
|
|
71
|
+
signal?.removeEventListener("abort", abort);
|
|
72
|
+
callback(value);
|
|
73
|
+
};
|
|
74
|
+
pending.set(id, { resolve: done(resolve), reject: done(reject) });
|
|
75
|
+
signal?.addEventListener("abort", abort, { once: true });
|
|
76
|
+
current.send({ ...message, id, runtime: developmentRuntime() }, (error) => {
|
|
77
|
+
if (error) failure(error, current);
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
export function hasAnalysisRevision(root) {
|
|
82
|
+
return registered.has(path.resolve(root));
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export async function registerAnalysisRevision(projectRoot, root, files, changes, dependencyRevision = "", signal) {
|
|
86
|
+
projectRoot = path.resolve(projectRoot);
|
|
87
|
+
root = path.resolve(root);
|
|
88
|
+
// Start before consulting the sent-inventory cache: a restarted worker has no
|
|
89
|
+
// prior baseline. Only changed source bytes cross IPC after the initial read.
|
|
90
|
+
start();
|
|
91
|
+
const saved = baselines.get(projectRoot),
|
|
92
|
+
previous = saved?.files ?? new Map();
|
|
93
|
+
const baselineChanges = [...new Set([...previous.keys(), ...files.keys()])]
|
|
94
|
+
.filter((file) => (previous.get(file) ?? null) !== (files.get(file) ?? null))
|
|
95
|
+
.map((file) => [file, files.get(file) ?? null]);
|
|
96
|
+
let result;
|
|
97
|
+
try {
|
|
98
|
+
result = await request(
|
|
99
|
+
{ action: "register", projectRoot, root, baselineToken: saved?.token, baselineReset: !saved, baselineChanges, changes, dependencyRevision },
|
|
100
|
+
signal,
|
|
101
|
+
);
|
|
102
|
+
if (result.needsBaseline)
|
|
103
|
+
result = await request({ action: "register", projectRoot, root, baselineReset: true, baselineChanges: [...files], changes, dependencyRevision }, signal);
|
|
104
|
+
} catch (error) {
|
|
105
|
+
// Registration may finish after its caller cancels. Queue disposal behind
|
|
106
|
+
// that request so abandoned drafts cannot pin a compiler revision forever.
|
|
107
|
+
if (worker) await request({ action: "release", root }).catch(() => {});
|
|
108
|
+
baselines.delete(projectRoot);
|
|
109
|
+
throw error;
|
|
110
|
+
}
|
|
111
|
+
baselines.set(projectRoot, { files: new Map(files), token: result.baselineToken });
|
|
112
|
+
registered.add(root);
|
|
113
|
+
return result;
|
|
114
|
+
}
|
|
115
|
+
export async function analyze(root, kind = "registry", args = [], signal) {
|
|
116
|
+
root = path.resolve(root);
|
|
117
|
+
const inputs = registered.has(root) ? undefined : await readAnalysisInputs(root);
|
|
118
|
+
return analyzeCaptured(root, inputs, kind, args, signal);
|
|
119
|
+
}
|
|
120
|
+
/** Internal handoff of an operation's captured bytes; pinned drafts retain their branch. */
|
|
121
|
+
export function analyzeCaptured(root, inputs, kind = "registry", args = [], signal) {
|
|
122
|
+
root = path.resolve(root);
|
|
123
|
+
if (registered.has(root)) inputs = undefined;
|
|
124
|
+
else if (!inputs) throw new Error("Unregistered analysis requires captured inputs.");
|
|
125
|
+
if (inputs) baselines.delete(root);
|
|
126
|
+
return request(
|
|
127
|
+
{ action: "analyze", root, kind, args, ...(inputs ? { files: [...inputs.files], dependencyRevision: inputs.dependencyRevision } : {}) },
|
|
128
|
+
signal,
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
export async function releaseAnalysisRevision(root) {
|
|
132
|
+
root = path.resolve(root);
|
|
133
|
+
if (!registered.delete(root) || !worker) return;
|
|
134
|
+
await request({ action: "release", root });
|
|
135
|
+
}
|
|
136
|
+
export async function promoteAnalysisRevision(root, projectRoot) {
|
|
137
|
+
root = path.resolve(root);
|
|
138
|
+
const result = await request({ action: "promote", root });
|
|
139
|
+
registered.delete(root);
|
|
140
|
+
baselines.delete(path.resolve(projectRoot));
|
|
141
|
+
return result;
|
|
142
|
+
}
|
|
143
|
+
export async function closeAnalysis() {
|
|
144
|
+
clearTimeout(idle);
|
|
145
|
+
if (!worker) return;
|
|
146
|
+
const current = worker;
|
|
147
|
+
try {
|
|
148
|
+
await request({ action: "close" });
|
|
149
|
+
} finally {
|
|
150
|
+
failure(new Error("Analysis service closed."), current);
|
|
151
|
+
current.kill();
|
|
152
|
+
}
|
|
153
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// Library callers use the same native session as the service, without a second
|
|
2
|
+
// compiler implementation. A request context scopes discovery and memoization.
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { NativeProject } from "./native-project.mjs";
|
|
5
|
+
import { readAnalysisInputs } from "./inputs.mjs";
|
|
6
|
+
import { currentAnalysis, runAnalysis } from "./context.mjs";
|
|
7
|
+
|
|
8
|
+
const projects = new Map();
|
|
9
|
+
let idle;
|
|
10
|
+
export async function closeStandaloneAnalysis() {
|
|
11
|
+
clearTimeout(idle);
|
|
12
|
+
const closing = [...projects.values()];
|
|
13
|
+
projects.clear();
|
|
14
|
+
for (const state of closing) {
|
|
15
|
+
await state.queue;
|
|
16
|
+
await state.project.close();
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export async function withProjectAnalysis(root, run) {
|
|
20
|
+
root = path.resolve(root);
|
|
21
|
+
if (currentAnalysis()?.provideProgram && currentAnalysis().root === root) return run();
|
|
22
|
+
clearTimeout(idle);
|
|
23
|
+
let state = projects.get(root);
|
|
24
|
+
if (!state) {
|
|
25
|
+
if (projects.size >= 8) await closeStandaloneAnalysis();
|
|
26
|
+
projects.set(root, (state = { project: new NativeProject(root), queue: Promise.resolve() }));
|
|
27
|
+
}
|
|
28
|
+
const work = state.queue.then(async () => {
|
|
29
|
+
const inputs = await readAnalysisInputs(root);
|
|
30
|
+
const view = await state.project.synchronize(inputs.files, inputs.dependencyRevision);
|
|
31
|
+
return runAnalysis(root, run, {
|
|
32
|
+
revision: view,
|
|
33
|
+
provideProgram: (...args) => state.project.program(view, ...args),
|
|
34
|
+
provideSource: (file) => state.project.source(view, file),
|
|
35
|
+
readText: (file) => state.project.text(view, file),
|
|
36
|
+
listFiles: (directory) => state.project.files(view, directory),
|
|
37
|
+
resolveModule: (...args) => state.project.resolve(view, ...args),
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
state.queue = work.then(
|
|
41
|
+
() => {},
|
|
42
|
+
() => {},
|
|
43
|
+
);
|
|
44
|
+
try {
|
|
45
|
+
return await work;
|
|
46
|
+
} finally {
|
|
47
|
+
idle = setTimeout(() => {
|
|
48
|
+
void closeStandaloneAnalysis();
|
|
49
|
+
}, 1000);
|
|
50
|
+
idle.unref();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
export function standaloneProgram(purpose, roots, options) {
|
|
54
|
+
const root = purpose.slice(purpose.indexOf(":") + 1);
|
|
55
|
+
if (!path.isAbsolute(root)) throw new Error("A compiler request requires an absolute project root.");
|
|
56
|
+
return withProjectAnalysis(root, () => currentAnalysis().provideProgram(purpose, roots, options));
|
|
57
|
+
}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
// Native TypeScript syntax vocabulary. Source parsing and configuration reads
|
|
2
|
+
// are asynchronous; ordinary AST predicates and walks stay local and synchronous.
|
|
3
|
+
import * as ast from "typescript/ast";
|
|
4
|
+
import { API, ModuleKind, ModuleResolutionKind, JsxEmit, SymbolFlags, TypeFlags, TypeFormatFlags } from "typescript/async";
|
|
5
|
+
import { serverFS } from "typescript/fs";
|
|
6
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
7
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
8
|
+
import path from "node:path";
|
|
9
|
+
import { nativeCompilerOptions } from "./compiler-options.mjs";
|
|
10
|
+
import { currentAnalysis } from "./context.mjs";
|
|
11
|
+
import { createModuleResolvers } from "./module-resolvers.mjs";
|
|
12
|
+
|
|
13
|
+
const resolutionScope = new AsyncLocalStorage();
|
|
14
|
+
|
|
15
|
+
let api,
|
|
16
|
+
sequence = 0,
|
|
17
|
+
pending = 0,
|
|
18
|
+
idle;
|
|
19
|
+
const overlays = new Map(),
|
|
20
|
+
sources = new Map();
|
|
21
|
+
function client() {
|
|
22
|
+
clearTimeout(idle);
|
|
23
|
+
return (api ??= new API({
|
|
24
|
+
cwd: process.cwd(),
|
|
25
|
+
runExternalCode: false,
|
|
26
|
+
fs: {
|
|
27
|
+
readFile: (file) => (overlays.has(file) ? overlays.get(file) : serverFS.useOS),
|
|
28
|
+
fileExists: (file) => (overlays.has(file) ? true : serverFS.useOS),
|
|
29
|
+
directoryExists: serverFS.useOS,
|
|
30
|
+
getAccessibleEntries: serverFS.useOS,
|
|
31
|
+
realpath: serverFS.useOS,
|
|
32
|
+
stat: serverFS.useOS,
|
|
33
|
+
writeFile: serverFS.error,
|
|
34
|
+
removeFile: serverFS.error,
|
|
35
|
+
},
|
|
36
|
+
}));
|
|
37
|
+
}
|
|
38
|
+
async function use(run) {
|
|
39
|
+
const current = client();
|
|
40
|
+
pending++;
|
|
41
|
+
try {
|
|
42
|
+
return await run(current);
|
|
43
|
+
} finally {
|
|
44
|
+
if (--pending === 0) {
|
|
45
|
+
idle = setTimeout(() => {
|
|
46
|
+
void closeSyntax();
|
|
47
|
+
}, 1000);
|
|
48
|
+
idle.unref();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
export async function closeSyntax() {
|
|
53
|
+
clearTimeout(idle);
|
|
54
|
+
if (pending || !api) return;
|
|
55
|
+
const current = api;
|
|
56
|
+
api = undefined;
|
|
57
|
+
const leases = [...sources.values()];
|
|
58
|
+
sources.clear();
|
|
59
|
+
try {
|
|
60
|
+
for (const lease of leases) await (await lease).dispose();
|
|
61
|
+
} finally {
|
|
62
|
+
await current.close();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
export async function parseSource(file, text, scriptKind) {
|
|
66
|
+
file = path.resolve(file);
|
|
67
|
+
const context = currentAnalysis();
|
|
68
|
+
if (context?.provideSource && context.readText?.(file) === text) return context.provideSource(file);
|
|
69
|
+
return use(async (current) => {
|
|
70
|
+
const key = JSON.stringify([file, text, scriptKind]);
|
|
71
|
+
if (!sources.has(key)) {
|
|
72
|
+
const lease = current.createSourceFile(file, text, scriptKind === undefined ? {} : { scriptKind });
|
|
73
|
+
sources.set(key, lease);
|
|
74
|
+
lease.catch(() => {
|
|
75
|
+
if (sources.get(key) === lease) sources.delete(key);
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
const lease = sources.get(key);
|
|
79
|
+
sources.delete(key);
|
|
80
|
+
sources.set(key, lease);
|
|
81
|
+
while (sources.size > 64) {
|
|
82
|
+
const [oldest, previous] = sources.entries().next().value;
|
|
83
|
+
sources.delete(oldest);
|
|
84
|
+
await (await previous).dispose();
|
|
85
|
+
}
|
|
86
|
+
return (await lease).sourceFile;
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
export function parseConfigText(file, text) {
|
|
90
|
+
return use(async (current) => {
|
|
91
|
+
const virtual = path.resolve(path.dirname(file), `.ads-config-${++sequence}.json`);
|
|
92
|
+
overlays.set(virtual, text);
|
|
93
|
+
try {
|
|
94
|
+
return await current.readConfigFile(virtual);
|
|
95
|
+
} finally {
|
|
96
|
+
overlays.delete(virtual);
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
export const readConfig = (file) => use((current) => current.readConfigFile(path.resolve(file)));
|
|
101
|
+
export const parseConfig = (config, directory) => use((current) => current.parseJsonConfigFileContent(config, { configDirectory: path.resolve(directory) }));
|
|
102
|
+
export const parseCompilerOptions = (config, directory) => parseConfig({ ...config, files: [], include: [] }, directory);
|
|
103
|
+
export const transpileSource = (input, options) =>
|
|
104
|
+
use(async (current) => {
|
|
105
|
+
const result = await current.transpileModule(input, options);
|
|
106
|
+
return { ...result, diagnostics: result.diagnostics?.map((diagnostic) => ({ ...diagnostic, messageText: diagnostic.text })) };
|
|
107
|
+
});
|
|
108
|
+
export const parseConfigFile = (file) => use((current) => current.parseConfigFile(path.resolve(file)));
|
|
109
|
+
/** Keep the syntax client and resolver leases alive for exactly one capture. */
|
|
110
|
+
export function withModuleResolutionScope(run) {
|
|
111
|
+
return use(async (current) => {
|
|
112
|
+
const scope = createModuleResolvers(options => current.createModuleResolver(options));
|
|
113
|
+
let result;
|
|
114
|
+
try {
|
|
115
|
+
result = await resolutionScope.run(scope, run);
|
|
116
|
+
} catch (error) {
|
|
117
|
+
// Cleanup every lease, preserving the operation's original error.
|
|
118
|
+
await scope.close().catch(() => {});
|
|
119
|
+
throw error;
|
|
120
|
+
}
|
|
121
|
+
await scope.close();
|
|
122
|
+
return result;
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
export async function resolveModule(specifier, file, options) {
|
|
126
|
+
const scope = resolutionScope.getStore();
|
|
127
|
+
if (!scope) return withModuleResolutionScope(() => resolveModule(specifier, file, options));
|
|
128
|
+
return (await scope.resolve(specifier, path.dirname(file), nativeCompilerOptions(options, path.dirname(file)))).resolvedModule?.resolvedFileName;
|
|
129
|
+
}
|
|
130
|
+
function findConfigFile(directory, exists = existsSync, name = "tsconfig.json") {
|
|
131
|
+
for (directory = path.resolve(directory); ; ) {
|
|
132
|
+
const file = path.join(directory, name);
|
|
133
|
+
if (exists(file)) return file;
|
|
134
|
+
const parent = path.dirname(directory);
|
|
135
|
+
if (parent === directory) return undefined;
|
|
136
|
+
directory = parent;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
const flattenDiagnosticMessageText = (message, separator = "\n") =>
|
|
140
|
+
typeof message === "string"
|
|
141
|
+
? message
|
|
142
|
+
: [
|
|
143
|
+
message?.messageText ?? message?.text ?? "",
|
|
144
|
+
...(message?.next ?? message?.messageChain ?? []).map((item) => flattenDiagnosticMessageText(item, separator)),
|
|
145
|
+
].join(separator);
|
|
146
|
+
const sys = {
|
|
147
|
+
fileExists: existsSync,
|
|
148
|
+
readFile: (file) => {
|
|
149
|
+
try {
|
|
150
|
+
return readFileSync(file, "utf8");
|
|
151
|
+
} catch {
|
|
152
|
+
return undefined;
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
};
|
|
156
|
+
export default {
|
|
157
|
+
...ast,
|
|
158
|
+
ModuleKind,
|
|
159
|
+
ModuleResolutionKind,
|
|
160
|
+
JsxEmit,
|
|
161
|
+
SymbolFlags,
|
|
162
|
+
TypeFlags,
|
|
163
|
+
TypeFormatFlags,
|
|
164
|
+
isStringLiteralLike: ast.isStringLiteralLikeNode,
|
|
165
|
+
isFunctionLike: ast.isFunctionLikeDeclaration,
|
|
166
|
+
isPropertySignature: ast.isPropertySignatureDeclaration,
|
|
167
|
+
isParameter: ast.isParameterDeclaration,
|
|
168
|
+
isIterationStatement: (node) =>
|
|
169
|
+
ast.isForStatement(node) || ast.isForInStatement(node) || ast.isForOfStatement(node) || ast.isWhileStatement(node) || ast.isDoStatement(node),
|
|
170
|
+
forEachChild: (node, visit) => node.forEachChild(visit),
|
|
171
|
+
createSourceFile: (file, text, _target, _parents, scriptKind) => parseSource(file, text, scriptKind),
|
|
172
|
+
readConfigFile: readConfig,
|
|
173
|
+
parseJsonConfigFileContent: (config, _host, directory) => parseConfig(config, directory),
|
|
174
|
+
parseConfigFileTextToJson: parseConfigText,
|
|
175
|
+
resolveProjectReferencePath: (reference) => (reference.path.endsWith(".json") ? reference.path : path.join(reference.path, "tsconfig.json")),
|
|
176
|
+
flattenDiagnosticMessageText,
|
|
177
|
+
findConfigFile,
|
|
178
|
+
sys,
|
|
179
|
+
};
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
// Plain-data IPC boundary. A Bun host owns asynchronous native compiler sessions.
|
|
2
|
+
// Jobs are serial; native queries within a job share pending requests.
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { NativeProject } from "./native-project.mjs";
|
|
5
|
+
import { runAnalysis } from "./context.mjs";
|
|
6
|
+
import { loadConfig } from "../config.mjs";
|
|
7
|
+
|
|
8
|
+
const projects = new Map(),
|
|
9
|
+
revisions = new Map();
|
|
10
|
+
let queue = Promise.resolve(),
|
|
11
|
+
projectSequence = 0;
|
|
12
|
+
async function projectFor(root) {
|
|
13
|
+
root = path.resolve(root);
|
|
14
|
+
if (!projects.has(root)) {
|
|
15
|
+
if (projects.size >= 8) {
|
|
16
|
+
const idle = [...projects.keys()].find((key) => ![...revisions.values()].some((entry) => entry.project.root === key));
|
|
17
|
+
if (!idle) throw new Error("Too many projects with active analysis revisions.");
|
|
18
|
+
await projects.get(idle).project.close();
|
|
19
|
+
projects.delete(idle);
|
|
20
|
+
}
|
|
21
|
+
projects.set(root, { project: new NativeProject(root), files: new Map(), dependencyRevision: "", id: ++projectSequence, version: 0 });
|
|
22
|
+
}
|
|
23
|
+
return projects.get(root);
|
|
24
|
+
}
|
|
25
|
+
async function release(root) {
|
|
26
|
+
const entry = revisions.get(root);
|
|
27
|
+
if (entry) {
|
|
28
|
+
await entry.project.release(entry.view);
|
|
29
|
+
revisions.delete(root);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
async function execute(message) {
|
|
33
|
+
const { action, root, kind, args = [] } = message;
|
|
34
|
+
if (action === "register") {
|
|
35
|
+
const state = await projectFor(message.projectRoot);
|
|
36
|
+
if (!message.baselineReset && message.baselineToken !== `${state.id}:${state.version}`) return { needsBaseline: true };
|
|
37
|
+
if (message.baselineReset) state.files = new Map();
|
|
38
|
+
for (const [file, content] of message.baselineChanges) {
|
|
39
|
+
if (content === null) state.files.delete(file);
|
|
40
|
+
else state.files.set(file, content);
|
|
41
|
+
}
|
|
42
|
+
const baseline = await state.project.synchronize(state.files, message.dependencyRevision);
|
|
43
|
+
state.dependencyRevision = message.dependencyRevision;
|
|
44
|
+
const candidate = new Map(state.files);
|
|
45
|
+
for (const [file, content] of message.changes) {
|
|
46
|
+
if (content === null) candidate.delete(file);
|
|
47
|
+
else candidate.set(file, content);
|
|
48
|
+
}
|
|
49
|
+
const previous = revisions.get(root);
|
|
50
|
+
let view;
|
|
51
|
+
if (previous?.project === state.project && previous.view.generation === baseline.generation) view = await state.project.update(previous.view, candidate);
|
|
52
|
+
else {
|
|
53
|
+
await release(root);
|
|
54
|
+
view = await state.project.branch(root, candidate);
|
|
55
|
+
}
|
|
56
|
+
revisions.set(root, { project: state.project, view });
|
|
57
|
+
state.version++;
|
|
58
|
+
return { generation: view.generation, baselineToken: `${state.id}:${state.version}`, stats: state.project.stats };
|
|
59
|
+
}
|
|
60
|
+
if (action === "release") {
|
|
61
|
+
await release(root);
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
if (action === "promote") {
|
|
65
|
+
const entry = revisions.get(root);
|
|
66
|
+
if (!entry) throw new Error("Analysis revision was lost before promotion.");
|
|
67
|
+
await entry.project.promote(entry.view);
|
|
68
|
+
const state = projects.get(entry.project.root);
|
|
69
|
+
state.files = new Map([...entry.view.files].map(([file, text]) => [path.relative(entry.project.root, file), text]));
|
|
70
|
+
state.version++;
|
|
71
|
+
revisions.delete(root);
|
|
72
|
+
return { stats: entry.project.stats };
|
|
73
|
+
}
|
|
74
|
+
if (action === "close") {
|
|
75
|
+
for (const { project } of projects.values()) await project.close();
|
|
76
|
+
projects.clear();
|
|
77
|
+
revisions.clear();
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
let entry = revisions.get(root);
|
|
81
|
+
if (!entry) {
|
|
82
|
+
const state = await projectFor(root);
|
|
83
|
+
if (!message.files) throw new Error("Unregistered analysis request requires a fenced inventory.");
|
|
84
|
+
state.files = new Map(message.files);
|
|
85
|
+
state.version++;
|
|
86
|
+
state.dependencyRevision = message.dependencyRevision;
|
|
87
|
+
entry = { project: state.project, view: await state.project.synchronize(state.files, state.dependencyRevision) };
|
|
88
|
+
}
|
|
89
|
+
return runAnalysis(
|
|
90
|
+
root,
|
|
91
|
+
async () => {
|
|
92
|
+
const options = loadConfig(root);
|
|
93
|
+
if (kind === "check") {
|
|
94
|
+
const { checkProject } = await import("../check.mjs");
|
|
95
|
+
return checkProject(root, { trackingRoot: args[0] });
|
|
96
|
+
}
|
|
97
|
+
if (kind === "tokens") {
|
|
98
|
+
const { inspectTokens } = await import("../tokens.mjs");
|
|
99
|
+
return inspectTokens(root, options);
|
|
100
|
+
}
|
|
101
|
+
if (kind === "behavior") {
|
|
102
|
+
const { inspectBehaviors } = await import("../behaviors.mjs");
|
|
103
|
+
return inspectBehaviors(options);
|
|
104
|
+
}
|
|
105
|
+
if (kind === "behavior-page") {
|
|
106
|
+
const { behaviorPage } = await import("../mcp/behavior-pages.mjs");
|
|
107
|
+
return behaviorPage(options, ...args);
|
|
108
|
+
}
|
|
109
|
+
if (kind === "behavior-status") {
|
|
110
|
+
const { behaviorStatus } = await import("../verification.mjs");
|
|
111
|
+
return behaviorStatus(options);
|
|
112
|
+
}
|
|
113
|
+
if (kind === "verification-plan") {
|
|
114
|
+
const { verificationPlan } = await import("../verification.mjs");
|
|
115
|
+
return verificationPlan(options, ...args);
|
|
116
|
+
}
|
|
117
|
+
if (kind === "behavior-revisions") {
|
|
118
|
+
const { behaviorRevisions } = await import("../verification.mjs");
|
|
119
|
+
return behaviorRevisions(options, ...args);
|
|
120
|
+
}
|
|
121
|
+
if (kind === "needs-browser") {
|
|
122
|
+
const { needsBrowserPreviews } = await import("../verification.mjs");
|
|
123
|
+
return needsBrowserPreviews(options, ...args);
|
|
124
|
+
}
|
|
125
|
+
if (kind === "audit-selection") {
|
|
126
|
+
const { auditScenarioSelection } = await import("../render-audit.mjs");
|
|
127
|
+
return auditScenarioSelection(options, ...args);
|
|
128
|
+
}
|
|
129
|
+
if (kind === "affected-behavior") {
|
|
130
|
+
const { affectedBehaviorUnits } = await import("../verification.mjs");
|
|
131
|
+
return affectedBehaviorUnits(options, ...args);
|
|
132
|
+
}
|
|
133
|
+
if (kind === "selection-inputs") {
|
|
134
|
+
const { selectionInputs } = await import("../verification.mjs");
|
|
135
|
+
return selectionInputs(options);
|
|
136
|
+
}
|
|
137
|
+
const { discoverScenarioRegistry } = await import("../scenario-registry.mjs");
|
|
138
|
+
const registry = await discoverScenarioRegistry(options);
|
|
139
|
+
if (kind === "registry") return registry;
|
|
140
|
+
if (kind === "catalog") {
|
|
141
|
+
const { inspectCatalog } = await import("../mcp/catalog.mjs");
|
|
142
|
+
const { inspectBehaviorLibraries } = await import("../behavior-libraries.mjs");
|
|
143
|
+
const libraries = await inspectBehaviorLibraries(options);
|
|
144
|
+
return { catalog: await inspectCatalog(options, registry.scenarios, libraries), libraries: libraries.libraries };
|
|
145
|
+
}
|
|
146
|
+
throw new Error(`Unknown analysis operation ${kind}.`);
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
revision: entry.view,
|
|
150
|
+
runtime: message.runtime,
|
|
151
|
+
provideProgram: (...parameters) => entry.project.program(entry.view, ...parameters),
|
|
152
|
+
provideSource: (file) => entry.project.source(entry.view, file),
|
|
153
|
+
readText: (file) => entry.project.text(entry.view, file),
|
|
154
|
+
listFiles: (directory) => entry.project.files(entry.view, directory),
|
|
155
|
+
resolveModule: (...parameters) => entry.project.resolve(entry.view, ...parameters),
|
|
156
|
+
},
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
process.on("message", (message) => {
|
|
160
|
+
queue = queue.then(async () => {
|
|
161
|
+
try {
|
|
162
|
+
process.send?.({ id: message.id, result: await execute(message) });
|
|
163
|
+
} catch (error) {
|
|
164
|
+
// A beta transport/compiler failure must fail this request, then allow a
|
|
165
|
+
// fresh host next time; never keep serving a poisoned project session.
|
|
166
|
+
const fatal = ["EPIPE", "ECONNRESET"].includes(error.code) || /Unexpected EOF.*child process/.test(error.message);
|
|
167
|
+
process.send?.({ id: message.id, error: { message: error.message, stack: error.stack, code: error.code, diagnostic: error.diagnostic } });
|
|
168
|
+
if (fatal) process.disconnect?.();
|
|
169
|
+
}
|
|
170
|
+
if (message.action === "close") process.disconnect?.();
|
|
171
|
+
});
|
|
172
|
+
});
|
|
173
|
+
process.on("disconnect", async () => {
|
|
174
|
+
for (const { project } of projects.values()) {
|
|
175
|
+
try {
|
|
176
|
+
await project.close();
|
|
177
|
+
} catch {
|
|
178
|
+
/* Broken pipes are already reported to the caller. */
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
process.exit(0);
|
|
182
|
+
});
|
package/dist/assets.mjs
CHANGED
|
@@ -46,8 +46,8 @@ export function inspectGlyphs({ root, dsRoot, config }) {
|
|
|
46
46
|
if (!glyphs) return [];
|
|
47
47
|
const directory = path.join(dsRoot, glyphs.source);
|
|
48
48
|
const files = assetFiles(directory).filter(file => file.toLowerCase().endsWith(".svg"));
|
|
49
|
-
const read = files.map(file
|
|
50
|
-
const finding = (rule, file, message, line = 1, column = 1) =>
|
|
49
|
+
const read = files.map( (file )=>({file:path.join(directory,file),text:readFileSync(path.join(directory,file),"utf8")}));
|
|
50
|
+
const finding = (rule, file, message, line = 1, column = 1) =>( { rule, severity: findingSeverity(rule), file: path.relative(root, file).replaceAll("\\", "/"), line, column, guidanceUri: "ads://guides/branding", message });
|
|
51
51
|
const viewBox = glyphViewBox;
|
|
52
52
|
const counts = new Map();
|
|
53
53
|
for (const { text } of read) { const box = viewBox(text); if (box) counts.set(box, (counts.get(box) ?? 0) + 1); }
|
|
@@ -60,7 +60,7 @@ export function inspectGlyphs({ root, dsRoot, config }) {
|
|
|
60
60
|
else if (shared && box !== shared) findings.push(finding("glyph-viewbox", file, `${base} uses viewBox "${box}"; the set uses "${shared}", so it would draw at a different size.`));
|
|
61
61
|
// Any fill or stroke other than none or currentColor fixes the icon's color.
|
|
62
62
|
const colors = [...text.matchAll(/\b(fill|stroke)\s*[=:]\s*["']?\s*([^"';\s>]+)/g)].map(match => match[2]).filter(value => !/^(?:none|currentcolor|inherit)$/i.test(value) && !/^url\(/i.test(value));
|
|
63
|
-
if (colors.length) findings.push(finding("glyph-color", file, `${base} sets ${[...new Set(colors)].join(", ")}; draw glyphs in currentColor so they follow the text color and theme. Another product's logo that keeps its own colors belongs in assets/logos/, shown as an image;
|
|
63
|
+
if (colors.length) findings.push(finding("glyph-color", file, `${base} sets ${[...new Set(colors)].join(", ")}; draw glyphs in currentColor so they follow the text color and theme. Another product's logo that keeps its own colors belongs in assets/logos/, shown as an image; logos belong in assets/brand/; illustrative pictograms belong in assets/pictograms/ with catalog.ads.json.`));
|
|
64
64
|
}
|
|
65
65
|
return findings;
|
|
66
66
|
}
|
|
@@ -112,12 +112,12 @@ function inspectBrand({ root, dsRoot, config }) {
|
|
|
112
112
|
const generated = [...config.assets.generatedPaths.map(entry => path.resolve(root, entry)), path.join(root, ".ds")];
|
|
113
113
|
const sources = sourceTexts([dsRoot, path.join(root, config.sourceDir ?? "src")], [path.join(dsRoot, "assets"), ...generated]);
|
|
114
114
|
const configured = new Set([config.assets.iconSource, ...config.assets.targets.map(target => target.from)].filter(Boolean).map(file => path.join(dsRoot, file)));
|
|
115
|
-
const previews = path.join(dsRoot, "brand");
|
|
116
115
|
for (const name of artwork) {
|
|
117
116
|
const file = path.join(brand, name), base = path.basename(name);
|
|
118
117
|
if (readme !== null && !readme.includes(base)) finding("brand-readme", file, `Describe ${base} in assets/brand/README.md: its use, suitable backgrounds, credits and license.`);
|
|
119
118
|
const referencing = sources.filter(source => source.text.includes(base));
|
|
120
|
-
|
|
119
|
+
// Brand artwork is discovered directly by the tool-owned asset catalogue.
|
|
120
|
+
// Source scenarios remain for product Logo behavior, not gallery coverage.
|
|
121
121
|
if (!configured.has(file) && !referencing.some(source => !previewFile.test(source.file))) finding("brand-unused", file, `${base} is not used by any component, assets.iconSource or assets.targets. Use it or remove it.`);
|
|
122
122
|
}
|
|
123
123
|
return diagnostics;
|
|
@@ -150,7 +150,7 @@ export function inspectAssets({ root, dsRoot, config, trackingRoot = root }) {
|
|
|
150
150
|
report("asset-inspection", root, `Cannot inspect tracked build outputs: ${tracked.error?.message ?? tracked.stderr.trim()}`);
|
|
151
151
|
return diagnostics;
|
|
152
152
|
}
|
|
153
|
-
const generated = [...config.assets.generatedPaths.map((entry) => path.resolve(root, entry)), path.join(root, ".ds")
|
|
153
|
+
const generated = [...config.assets.generatedPaths.map((entry) => path.resolve(root, entry)), path.join(root, ".ds")];
|
|
154
154
|
for (const file of tracked.stdout.split("\0").filter(Boolean)) {
|
|
155
155
|
const absolute = path.resolve(root, file);
|
|
156
156
|
if ((existsSync(absolute) || trackingRoot !== root && existsSync(path.resolve(trackingRoot, file))) && generated.some((directory) => isInside(directory, absolute))) report("tracked-generated", absolute, "Generated build output is tracked as source. Ignore the configured generated path.");
|