Commit df64bc5
Add TypeScript twoslash support to docs code blocks (#729)
* Add TypeScript twoslash support to docs code blocks
Wires up expressive-code-twoslash with a generated Aspire SDK .d.ts
so TS samples get hover types. Adds the `twoslash` meta to TS code
blocks across docs and the homepage AppHostBuilder component. Also
fixes nav bar / mobile TOC stacking at ≥72rem where expressive-code's
`:root .main-pane { z-index: 1 }` was trapping the TOC below content.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* Remove @Noerrors from docs twoslash blocks
Inherit class baseType from src/data/pkgs/*.json so subclasses like
ViteAppResource/NodeAppResource/PythonAppResource pick up methods defined
on their parent class (publishAsDockerFile, publishAsHostedAgent). Fix
misaligned samples (withVolume args, withHostPort, publishAsExisting,
userNameParameter/passwordParameter, executionContext.isRunMode, redis
host/port accessors). Drop twoslash marker from the hypothetical
user-integration example where types don't resolve by design.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* Let twoslash tooltips escape the AppHostBuilder container
Remove overflow:hidden from the outer .container so the popup
(positioned by floating-ui into the expressive-code wrapper) can extend
past the bottom edge. Top-corner rounding moves to .header to preserve
the visual against the container's rounded border.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* Address PR review comments
- Add fallback value to --sl-z-index-toc var in site.css so the
right-sidebar z-index still resolves when the CSS variable is absent
- Guard the twoslash popup-fix IIFE with window.__aspireTwoslashFixInitialized
so document-level listeners only register once across Astro view transitions
- Downgrade typescript to ^5.9.3 to stay within the peer range declared by
expressive-code-twoslash (^5.5.0)
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* Address additional PR review comments
- postgres-host.mdx: pass port directly to withHostPort(5050); the TS SDK
signature takes a number, not an object
- ec.config.mjs: use canonical lib name 'es2022' instead of the filename
'lib.es2022.d.ts' so TypeScript loads the standard library correctly
during twoslash compilation
- ec.config.mjs: point the missing-types warning at the 'pnpm twoslash-types'
script rather than the raw tsx invocation
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* Update src/frontend/src/content/docs/extensibility/multi-language-integration-authoring.mdx
Co-authored-by: David Pine <david.pine@microsoft.com>
* Update src/frontend/src/content/docs/app-host/migrate-from-docker-compose.mdx
Co-authored-by: David Pine <david.pine@microsoft.com>
* Update src/frontend/src/content/docs/app-host/migrate-from-docker-compose.mdx
Co-authored-by: David Pine <david.pine@microsoft.com>
* Address review round 2 on twoslash docs PR
- generate-twoslash-types.ts: type the JSON.parse results so the
@typescript-eslint/no-unsafe-* rules pass (previously failed CI)
- Add tests/unit/twoslash-types-generator.vitest.test.ts covering the
key shape of aspire.d.ts (createBuilder, IDistributedApplicationBuilder,
class inheritance from pkgs/, camelCasing, options-object overloads)
and wire test:unit:twoslash-types into the test:unit pipeline
- ec.config.mjs: drop the explicit `lib` array — twoslash's VFS only
loads the lib files literally named in `lib`, so triple-slash
references inside lib.es2022.d.ts (es5 → Date, dom → URL, etc.) were
silently dropped. Letting `target: ESNext` pick lib.esnext.full.d.ts
restores the full standard library. Also remove the now-redundant
console.d.ts shim
- multi-language-integration-authoring.mdx: drop `twoslash` flag from
the apphost.ts sample — the article shows authoring custom exported
APIs that aren't part of the generated .d.ts, so the sample correctly
uses hypothetical types
- executable-resources.mdx: publishAsDockerFile() takes no args
- migrate-from-docker-compose.mdx: switch withVolume() calls to the
options-object overload as suggested
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* Regenerate TS module JSON with AtsTransformer fixes
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Make twoslash-types generator test cross-platform
execFileSync('pnpm', ...) fails on Windows with ENOENT because spawn doesn't resolve .cmd shims. Invoke tsx directly via node instead, which also sidesteps the DEP0190 warning from shell:true.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Stabilize frontend e2e CI by using astro preview + 60s timeout
Tests were flaking in CI (4-5 flaky + 1 failed each run) because playwright's webServer was running astro dev, and this PR's twoslash processing makes first-request page loads expensive. Under 2 parallel workers, concurrent requests for twoslash pages pegged the dev server, causing unrelated page.goto calls (e.g. on / and /get-started/install-cli/) to exceed the 30s test timeout.
Switch CI to astro preview (dist/ already exists from the Build frontend step) so pages are served as static files. Kept astro dev for local dev so interactive work doesn't require a rebuild. Also bumped per-test timeout to 60s as a safety net against any residual slow pages.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Set E2E_TESTS=1 at CI build time so cookie consent loads under preview
After switching CI's playwright webServer to astro preview, the 6 cookie-consent e2e tests began failing because hideFromBots in config/cookie.config.ts is evaluated at build time (read by astro.config.mjs at static build). Previously astro dev was started by playwright with E2E_TESTS=1 set, so the flag flipped correctly; under preview, the env has to be set during the preceding build step.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
Co-authored-by: David Pine <david.pine@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 4d96323 commit df64bc5
78 files changed
Lines changed: 1732 additions & 570 deletions
File tree
- .github/workflows
- src
- frontend
- scripts
- src
- components
- starlight
- content/docs
- app-host
- community
- deployment
- azure
- extensibility
- get-started
- integrations
- cloud/azure
- databases/postgres
- ja/get-started
- whats-new
- data/ts-modules
- styles
- tests/unit
- tools/AtsJsonGenerator/Helpers
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
78 | 84 | | |
79 | 85 | | |
80 | 86 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
1 | 5 | | |
2 | 6 | | |
| 7 | + | |
3 | 8 | | |
4 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
5 | 22 | | |
6 | 23 | | |
7 | | - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
8 | 64 | | |
9 | 65 | | |
10 | 66 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
31 | | - | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
| 35 | + | |
34 | 36 | | |
35 | 37 | | |
36 | 38 | | |
| |||
88 | 90 | | |
89 | 91 | | |
90 | 92 | | |
| 93 | + | |
91 | 94 | | |
92 | 95 | | |
93 | 96 | | |
94 | 97 | | |
95 | 98 | | |
96 | 99 | | |
97 | 100 | | |
| 101 | + | |
98 | 102 | | |
99 | 103 | | |
100 | 104 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
13 | 17 | | |
14 | 18 | | |
15 | 19 | | |
| |||
50 | 54 | | |
51 | 55 | | |
52 | 56 | | |
53 | | - | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
54 | 66 | | |
55 | 67 | | |
56 | 68 | | |
| |||
0 commit comments