Skip to content

docs: v3 documentation overhaul + review fixes#494

Merged
Brooooooklyn merged 5 commits into
mainfrom
docs/v3-overhaul
Jul 10, 2026
Merged

docs: v3 documentation overhaul + review fixes#494
Brooooooklyn merged 5 commits into
mainfrom
docs/v3-overhaul

Conversation

@Brooooooklyn

Copy link
Copy Markdown
Member

What

A comprehensive v3 documentation overhaul, plus the review fixes surfaced while validating it against the real napi-rs source.

Overhaul

  • Rewrites getting-started, simple-package, release, and the concept/CLI reference around the napi-rs v3 napi new flow.
  • Adds new concept pages: cargo-features, napi-attributes, type-conversions, error-handling, iterators, manual-setup, async-concurrency, integrations, support-compatibility, testing-debugging, troubleshooting, v2-v3-migration-guide.
  • Brings cn / pt-BR translations to parity; regenerates the pages/ mirrors, nav, and route map.

Review fixes (applied on top)

Area Fix
Code samples Made compile-correct vs crates/napi + examples/napi: JsNumber::to_unknown(), create_obj(&Env)+Object::new, &Env params, unsafe { as_mut() }, Rc<RefCell> WeakReference field, get_options<'env>, @napi-rs/image .webp() + new Uint8Array(...)
Anchors Dead same-language links fixed by tagging target headings with explicit {#id}@void/md uses markdown-it-anchor's encodeURIComponent slugify, so commas and translated headings shift the id
Translations Translated the reference "JavaScript Value Reference" section and the typed-array safety/lifetime sections into cn/pt-BR
Prose Corrected the release npm version premise + publish step order, added the build --pipe flag row, fixed build --bin (pt-BR), and scoped the AsyncBlock feature note

Verification

  • pages/content.test.ts45/45
  • slug-aware anchor check — 0 dead same-language anchors
  • MDX <Callout> balance, heading ids, and imports — OK

Related (separate repos, same coordinated change)

  • napi-rs (cross-flags-dx): the @napi-rs/cli changes, including a new.ts fix so a programmatic newProject({ minNodeApiVersion: undefined }) can no longer overwrite the 4 default and emit an invalid napiundefined cargo feature.
  • package-template-pnpm: target rename wasm32-wasi-preview1-threadswasm32-wasip1-threads.

🤖 Generated with Claude Code

Rewrites the docs around the napi-rs v3 flow — getting-started, simple-package,
release, and the concept/CLI reference — and adds new concept pages
(cargo-features, napi-attributes, type-conversions, error-handling, iterators,
manual-setup, async-concurrency, integrations, support-compatibility,
testing-debugging, troubleshooting, v2-v3-migration-guide), bringing cn/pt-BR
to parity. Generated pages/ mirrors, nav, and route map regenerated.

Review fixes applied on top of the overhaul:

- Compile-correct the Rust/TS code samples (verified against crates/napi +
  examples/napi): JsNumber .to_unknown(); create_obj(&Env)+Object::new;
  get_tuple_array(&Env); unsafe { as_mut() }; Rc<RefCell> WeakReference field;
  get_options<'env>; @napi-rs/image .webp() and new Uint8Array(...).
- Fix dead same-language anchors by tagging target headings with explicit
  {#id} (@void/md uses markdown-it-anchor's encodeURIComponent slugify, so
  commas and translated headings shift the id).
- Translate the reference "JavaScript Value Reference" section and the
  typed-array safety/lifetime sections into cn/pt-BR.
- Correct release npm-version prose + publish step order, add the build
  --pipe flag row, fix build --bin (pt-BR), and scope the AsyncBlock feature note.

Verification: pages/content.test.ts 45/45; a slug-aware anchor check reports
zero dead same-language anchors.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9f7fcf54d2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread content/docs/cli/new.cn.mdx Outdated
Brooooooklyn and others added 3 commits July 10, 2026 17:50
The Chinese docs translated "target triple(s)" to 三元组/目标三元组; revert to
the English term across 8 pages (+mirrors) to match the en/pt-BR convention.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
content/ is authored in Nextra-flavored MDX; convert-content.mjs strips
top-level imports and converts <Callout> to ::: containers, so
nextra-theme-docs (no longer a dependency) never reaches the served
pages/ mirrors. Remove the 110 dead `import { Callout } from
'nextra-theme-docs'` lines. Mirrors are byte-identical (content test 45/45).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
In a cn/pt-BR page, a bare `[t](/docs/x#frag)` link renders verbatim, so the
browser requests `/docs/x`, which void.json rewrites `/docs/* -> /en/docs/:splat`
and serves the ENGLISH page — the reader silently leaves the locale, and any
translated `#fragment` is dead on the English page (8 such cases, e.g.
new.cn.mdx -> /docs/cross-build#向现有项目添加新目标).

Prefix every internal /docs, /blog, /changelog link in cn/pt-BR pages (content/
source + pages/ mirrors) with the file's locale. The i18n-fallback middleware
serves the en page under the unchanged /<locale>/... URL when a localized page is
missing, so prefixing never 404s and keeps the reader in-locale; translated
fragments now resolve against the translated headings on the localized page.

194 links across 52 pages (× mirrors). A routing-aware link checker reports 0
locale leaks and 0 dead fragments; content.test.ts 45/45, docs/i18n/seo units
126/126.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ee76d631fe

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread pages/cn/docs/concepts/webassembly.md
pages/{cn,pt-BR}/docs/concepts/webassembly.md share the identical byte-0
`<script>` island shape as the already-exempted en page, but were missing from
`fmt.ignorePatterns`. Current oxfmt (vp 0.2.2) skips byte-0 island pages so it
does not corrupt them today, but the exemption keeps the list consistent across
all three locales and guards against oxfmt version drift regressing to the
documented `---`-as-thematic-break corruption. A scan confirms these were the
only two unprotected island pages.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Brooooooklyn
Brooooooklyn merged commit fab3f49 into main Jul 10, 2026
2 checks passed
@Brooooooklyn
Brooooooklyn deleted the docs/v3-overhaul branch July 10, 2026 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant