feat: use starlight-typedoc - #3986
Conversation
✅ Deploy Preview for tauri-v2 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
bdcedc4 to
0ff6f12
Compare
✅ Deploy Preview for tauri-releases ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
All alerts resolved. Learn more about Socket for GitHub. This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored. |
Prototype A of the "build both, then decide" evaluation for the JS API reference direction. Replaces the hand-rolled packages/js-api-generator (which copied starlight-typedoc's internals) with the upstream starlight-typedoc plugin, generating Markdown that Starlight renders natively. - add starlight-typedoc@0.23, typedoc@0.28, typedoc-plugin-markdown@4.12, typedoc-plugin-mdn-links@5.1 (compatible with Starlight 0.41.3) - config/typedoc-plugins.ts: one createStarlightTypeDocPlugin() instance per package (core + fs + autostart slice; flip PROTOTYPE_FULL for all 26). Each package gets its own output dir -- TypeDoc cleans its output dir per run, so a shared dir clobbers. Output URLs kept compatible with today's site. - config/typedoc-tauri-plugin.mjs: non-destructive, reflection-level fix for the '#### Platform-specific' headings that leak into member tables (replaces the old theme's string surgery; no submodule source mutation). - disable packages/js-api-generator in the workspace so its old typedoc@0.26 / typedoc-plugin-markdown@4.2 don't shadow the modern stack. Validated (dev): core / fs / autostart render 200 natively; namespace links resolve (the #3424 blocker is absent in this config); type cross-linking + MDN links work; the Uint8Array<ArrayBuffer> canary renders cleanly with NO submodule patch (git -C packages/plugins-workspace status stays clean). Known gaps (see comparison writeup): full-site links validation + the ~130 existing /reference/javascript links are URL-compatible but member anchors move from a single flat page to per-namespace pages; source links show node_modules .d.ts paths for re-exported types (needs sourceLinkTemplate). Prototype only -- not for merge. Slice = core + fs + autostart.
…green Takes the starlight-typedoc reference from a 3-package slice to production-ready: - config/typedoc-plugins.ts: auto-discover every plugin exposing guest-js/index.ts (drop the hardcoded 26-plugin list + the PROTOTYPE_FULL slice gate). New plugins in the submodule are picked up automatically. - add skipErrorChecking so doc generation isn't coupled to a plugin's own TS errors (e.g. shell's guest-js/init.ts, a webview-injected script with DOM typing gaps). - delete packages/js-api-generator entirely (replaced by the plugin); drop build:references from the build pipeline (starlight-typedoc generates during astro build). Validated: full `astro build` GREEN with starlightLinksValidator ON -- core + 27 auto-discovered plugins generated, 1959 pages, "All internal links are valid" (the ~130 existing /reference/javascript links resolve unchanged -- no rewiring needed, the output is URL-compatible with the old generator). Submodule stays clean. Remaining polish (not blocking): "Defined in" shows node_modules .d.ts paths for types re-exported from @tauri-apps/api (needs per-package sourceLinkTemplate + re-export handling); platform-specific inside member tables is inline bold, not a rich aside.
Some JSDoc comments in the Tauri sources write platform notes as markdown headings, which TypeDoc faithfully renders as real <h4> elements. On /reference/javascript/deep-link/ this turned a support note into a section heading with the anchor #--macos--android--ios-unsupported. The normalizer only matched the exact string "#### Platform-specific", so two variants leaked through: #### Platform-specific: (19 occurrences) #### - **macOS / Android / iOS**: ... (5 occurrences, the reported bug) Widen it to accept an optional trailing colon, and to demote a heading whose body is a list item back to the list item it was meant to be. The latter is unambiguously malformed markdown upstream (a heading cannot contain a bullet), so the rule stays narrow: genuine section headings such as "## Security", "# Examples" and "#### Warning" are left untouched. The underlying typo belongs in tauri-apps/plugins-workspace; this keeps the docs build resilient to it either way. Verified by regenerating deep-link, api and opener: no heading-form platform notes remain in the generated reference, and the bogus anchor is gone from the rendered page.
…Script 7 typescript >= 7 (native compiler) drops the JS compiler API typedoc requires, and pnpm always links a package's typescript peer from its importer's context — no override or packageExtension can redirect it (all three were tried and rejected). Moving the typedoc stack into its own workspace package (the same isolation the old js-api-generator had) lets it keep typescript 5.9 while the repo root uses typescript 7. - resolvePeersFromWorkspaceRoot: the package's @astrojs/starlight -> astro peers link the root instances instead of resolving fresh copies - minimumReleaseAgeExclude for astro: pnpm re-checks release maturity when an already-locked version gains a new importer, and rejects it otherwise
…nerator references
0ff6f12 to
0125da5
Compare
| * Every transform here is a workaround for a known upstream bug or rough edge, kept in one | ||
| * place so each can be deleted once fixed at the source. Current inventory: | ||
| * | ||
| * - typedoc-plugin-markdown `escapeChars` (dist/libs/utils/escape-chars.js) escapes | ||
| * backticks unconditionally, so inline code in headings and mixed link labels renders | ||
| * as literal backticks -> ESCAPED_CODE_SPAN_RE undoes it. (Reported-upstream candidate.) | ||
| * - starlight-typedoc appends `:::` aside directives to member comments (libs/theme.ts | ||
| * #addDeprecatedAside); with table formats the comment lands in a table cell where a | ||
| * block directive cannot parse and leaks as literal text -> TABLE_ASIDE_RE flattens it | ||
| * to bold. (Reported-upstream candidate.) | ||
| * - typedoc-plugin-markdown emits type expressions as code-span fragments joined by | ||
| * escaped angle brackets, which renders as broken-looking chips with literal `<` `>` | ||
| * -> mergeGenerics() collapses the safe cases. (Cosmetic; likely by design upstream.) | ||
| * - typedoc-plugin-markdown v4 titles every constructor section "Constructor", which is | ||
| * ambiguous in the ToC and broke the previous generator's #new-classname anchors | ||
| * -> renameConstructorHeading() restores `new ClassName()`. (v4 design change, no | ||
| * opt-out found.) | ||
| * - TS 5.7+ generic Uint8Array noise, stripped via UINT8_GENERIC_RE (not an upstream | ||
| * bug, just a docs-build preference). |
There was a problem hiding this comment.
I'll review these later. I have annotated here and left for reference
There was a problem hiding this comment.
these are from a few issues I noticed visually when navigating and comparing with ours
| * into bold inline text so it reads cleanly in both tables and prose. | ||
| * | ||
| * Two variants exist in the sources, both handled here: | ||
| * `#### Platform-specific` / `#### Platform-specific:` -> bold label | ||
| * `#### - **macOS / iOS**: Unsupported.` -> plain list item | ||
| * | ||
| * The second form (e.g. deep-link's `isRegistered`) is malformed markdown upstream: a | ||
| * heading can't contain a list bullet. Left alone it becomes a real `<h4>` with an anchor | ||
| * like `#--macos--android--ios-unsupported`, so a platform note shows up as a section | ||
| * heading. We demote it back to the list item it was meant to be. Headings that are | ||
| * genuine section titles (`## Security`, `#### Warning`, ...) are deliberately untouched. |
There was a problem hiding this comment.
fixed at tauri-apps/plugins-workspace#3504
There was a problem hiding this comment.
well... I would merge this as is but the workaround would display the incorrect behaviour
There was a problem hiding this comment.
awaitng plugin-workspace next release to match the code

superseeds #3410 #3424 #3910
there are a few workarounds that I'll see about fixing upstream
depends on #3985
there are slight differences for the better
https://deploy-preview-3986--tauri-v2.netlify.app/reference/javascript/autostart/
https://tauri.app/reference/javascript/autostart/
https://deploy-preview-3986--tauri-v2.netlify.app/reference/javascript/dialog/
https://tauri.app/reference/javascript/dialog/
<T>from Channel being removed is not a regression, was a fix in typedochttps://deploy-preview-3986--tauri-v2.netlify.app/reference/javascript/api/namespacecore/
https://tauri.app/reference/javascript/api/namespacecore/
todo:
bug on code blockhttps://deploy-preview-3986--tauri-v2.netlify.app/reference/javascript/opener/
https://tauri.app/reference/javascript/opener/
new page
https://deploy-preview-3986--tauri-v2.netlify.app/reference/javascript/shell/