Skip to content

Conversation

@stefanonepanedap
Copy link

@stefanonepanedap stefanonepanedap commented Aug 12, 2025

This PR exposes nodeOps and patchProps in order to facilitate the extension of web base custom renderers.

eg. Implementing scopedRegistry for custom component support.

Summary by CodeRabbit

  • New Features
    • Exposed additional runtime DOM APIs as named exports from the main module, enabling direct imports without deep paths.
    • Improves developer ergonomics and tree-shaking by making low-level DOM operations and prop update helpers available through the public API.

@coderabbitai
Copy link

coderabbitai bot commented Aug 12, 2025

Walkthrough

Adds named re-exports for nodeOps and patchProp in packages/runtime-dom/src/index.ts, extending the module's public API. No runtime logic or control-flow changes.

Changes

Cohort / File(s) Summary
Public API re-exports
packages/runtime-dom/src/index.ts
Added named re-exports: export { nodeOps } from './nodeOps' and export { patchProp } from './patchProp'. No logic changes.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

  • Quick check: ensure exported identifiers match actual exports in ./nodeOps and ./patchProp.

Poem

I twitch my ears at exports new,
Two carrots—nodeOps, patchProp—debut!
No burrow re-dug, no flow askew,
Just clearer paths for hops to pursue.
Thump-thump! The API grew.

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: exporting nodeOps and patchProp from runtime-dom to facilitate custom renderer creation, which matches the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a3e9d85 and 6f680d2.

📒 Files selected for processing (1)
  • packages/runtime-dom/src/index.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/runtime-dom/src/index.ts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
packages/runtime-dom/src/index.ts (1)

20-20: Document and track the new public exports

This expands the public API. Please:

  • Add an API/docs note that nodeOps and patchProp are available from @vue/runtime-dom for custom renderers.
  • Add a changelog entry (semver: minor).
  • Double-check d.ts output to ensure consumers without "dom" lib in tsconfig don’t hit surprising type errors. Given this is runtime-dom, it should be fine.

I can draft the changelog and a short docs blurb if helpful.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c875019 and a3e9d85.

📒 Files selected for processing (1)
  • packages/runtime-dom/src/index.ts (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Redirect rules
  • GitHub Check: Header rules
  • GitHub Check: Pages changed
🔇 Additional comments (1)
packages/runtime-dom/src/index.ts (1)

20-20: Public API addition for custom renderers — LGTM

Re-exporting nodeOps and patchProp from the runtime-dom entry is a clean way to enable custom renderer composition without deep imports. No runtime behavior changes; size impact is negligible since both are already imported for rendererOptions.

@stefanonepanedap
Copy link
Author

@coderabbitai where can I add documentation?

@coderabbitai
Copy link

coderabbitai bot commented Aug 13, 2025

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# First, let's explore the repository structure to understand where documentation is typically placed
echo "=== Repository structure overview ==="
ls -la

echo -e "\n=== Looking for documentation directories ==="
fd -t d -I "doc" --max-depth 3
fd -t d -I "docs" --max-depth 3

echo -e "\n=== Looking for README files ==="
fd "README" --max-depth 2

echo -e "\n=== Checking packages structure ==="
ls -la packages/

echo -e "\n=== Looking at runtime-dom package structure ==="
ls -la packages/runtime-dom/

echo -e "\n=== Checking for existing documentation in runtime-dom ==="
fd -t f "README" packages/runtime-dom/
fd -t f "*.md" packages/runtime-dom/

Length of output: 4773


🏁 Script executed:

#!/bin/bash
# Let's check the existing runtime-dom README to see how it documents exports
echo "=== Current runtime-dom README content ==="
cat packages/runtime-dom/README.md

echo -e "\n=== Let's also check the main Vue README for documentation patterns ==="
head -50 README.md

echo -e "\n=== Check for any TypeScript declaration files that might contain documentation ==="
fd --glob "*.d.ts" packages/runtime-dom/

echo -e "\n=== Look at the actual index.ts file to see current exports and any existing documentation ==="
cat packages/runtime-dom/src/index.ts

echo -e "\n=== Check if there are JSDoc comments in nodeOps and patchProp files ==="
head -20 packages/runtime-dom/src/nodeOps.ts
echo "..."
head -20 packages/runtime-dom/src/patchProp.ts

Length of output: 13434


🏁 Script executed:

#!/bin/bash
# Let's check if there's a contributing guide that mentions documentation practices
echo "=== Looking for contributing guidelines ==="
fd "CONTRIBUTING" --max-depth 2

# Check the .github directory for any documentation guidelines
echo -e "\n=== Checking .github directory ==="
ls -la .github/

# Let's see if there are any existing JSDoc comments for similar exports in the codebase
echo -e "\n=== Looking for JSDoc patterns in similar exports ==="
rg -A 5 -B 2 "export.*{.*}" packages/runtime-dom/src/index.ts

# Check if there are any official Vue.js documentation repositories or links
echo -e "\n=== Looking for any documentation-related files ==="
rg -i "documentation|docs" README.md

# Let's also check what nodeOps and patchProp actually are
echo -e "\n=== Full nodeOps file to understand what it exports ==="
tail -50 packages/runtime-dom/src/nodeOps.ts

echo -e "\n=== Full patchProp file to understand what it exports ==="
tail -50 packages/runtime-dom/src/patchProp.ts

Length of output: 4871


🏁 Script executed:

#!/bin/bash
# Let's check the contributing guide to see if it mentions documentation practices
echo "=== Checking contributing guide for documentation practices ==="
cat .github/contributing.md

# Also check if there are any existing JSDoc comments in the codebase for reference
echo -e "\n=== Looking for JSDoc examples in runtime-dom ==="
rg -B 2 -A 2 "/\*\*" packages/runtime-dom/src/ --type ts

# Let's see the complete nodeOps and patchProp exports to understand their structure
echo -e "\n=== Complete nodeOps export structure ==="
rg -A 200 "export.*nodeOps" packages/runtime-dom/src/nodeOps.ts

echo -e "\n=== Complete patchProp export structure ==="
rg -A 50 "export.*patchProp" packages/runtime-dom/src/patchProp.ts

Length of output: 49742


@stefanonepanedap Based on my analysis of the Vue.js core repository, here are the recommended places where you can add documentation for the newly exported nodeOps and patchProp:

1. JSDoc Comments in index.ts (Recommended)

Add JSDoc comments directly above the export statement in packages/runtime-dom/src/index.ts:

/**
 * Platform-agnostic node operations for DOM manipulation.
 * Used internally by Vue's DOM renderer and can be used for creating custom renderers.
 * 
 * @example
 * ```js
 * import { nodeOps, patchProp, createRenderer } from '@vue/runtime-dom'
 * 
 * const customRenderer = createRenderer({ 
 *   ...nodeOps, 
 *   patchProp 
 * })
 * ```
 */
export { nodeOps } from './nodeOps'

/**
 * Platform-specific property patching function for DOM elements.
 * Handles class, style, events, and other DOM properties/attributes.
 * Used internally by Vue's DOM renderer and can be used for creating custom renderers.
 * 
 * @param el - The target DOM element
 * @param key - The property/attribute key
 * @param prevValue - Previous value
 * @param nextValue - New value
 * @param namespace - Element namespace (svg, mathml, etc.)
 * @param parentComponent - Parent component instance (for context)
 */
export { patchProp } from './patchProp'

2. Update the runtime-dom README.md

Enhance packages/runtime-dom/README.md with examples showing how to use the newly exported functions:

# @vue/runtime-dom

```js
import { h, createApp } from '@vue/runtime-dom'

const RootComponent = {
  render() {
    return h('div', 'hello world')
  },
}

createApp(RootComponent).mount('#app')

Custom Renderer Creation

The nodeOps and patchProp exports enable you to create custom renderers:

import { createRenderer, nodeOps, patchProp } from '@vue/runtime-dom'

// Create a custom renderer using DOM operations
const customRenderer = createRenderer({
  ...nodeOps,
  patchProp,
  // Add custom logic here
})

## 3. Inline Documentation in Source Files (Optional)

You could also add more detailed JSDoc comments in the source files themselves (`nodeOps.ts` and `patchProp.ts`), but since these are already well-structured, the export-level documentation would be sufficient.

## Best Practices

Based on the existing codebase patterns:
- Use standard JSDoc format with `/**` comments
- Include `@example` blocks showing practical usage
- Keep examples focused on the custom renderer use case (the main reason for exporting these)
- Follow the existing documentation style seen in other parts of the codebase

The JSDoc approach is most appropriate since it will appear in IDE intellisense and generated type documentation, making it immediately helpful to developers using these exports.

@edison1105 edison1105 added ready to merge The PR is ready to be merged. version: minor labels Aug 21, 2025
@edison1105 edison1105 moved this to Todo in Next Minor Aug 21, 2025
@stefanonepanedap
Copy link
Author

Hi @edison1105 ,

I see that the next minor is getting closer and closer. 🎉 I am excited to see this change being released 🤗

Thanks for you approval!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready to merge The PR is ready to be merged. version: minor

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

2 participants