Skip to content

refactor: extract shared compiler options resolution logic#14731

Open
Zakir176 wants to merge 2 commits intovuejs:mainfrom
Zakir176:refactor/extract-compiler-options
Open

refactor: extract shared compiler options resolution logic#14731
Zakir176 wants to merge 2 commits intovuejs:mainfrom
Zakir176:refactor/extract-compiler-options

Conversation

@Zakir176
Copy link
Copy Markdown
Contributor

@Zakir176 Zakir176 commented Apr 16, 2026

Removes code duplication between runtime-core and server-renderer by introducing a shared getResolvedCompilerOptions helper. This addresses a TODO in ssrCompile.ts and improves maintainability.

Summary by CodeRabbit

  • Refactor
    • Consolidated and reused internal compiler-options resolution logic across runtime and server rendering. This improves internal consistency and maintainability of template compilation paths (including SSR) while preserving existing behavior. No user-visible changes or behavioral impacts.

Removes code duplication between runtime-core and server-renderer by introducing a shared getResolvedCompilerOptions helper. This addresses a TODO in ssrCompile.ts and improves maintainability.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 16, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 76fb8ac6-a2f6-4f70-8b54-f66c5ce08b9d

📥 Commits

Reviewing files that changed from the base of the PR and between 62bac64 and 5df2d8b.

📒 Files selected for processing (2)
  • packages/runtime-core/src/component.ts
  • packages/runtime-core/src/index.ts
✅ Files skipped from review due to trivial changes (1)
  • packages/runtime-core/src/index.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/runtime-core/src/component.ts

📝 Walkthrough

Walkthrough

Centralized compiler option resolution into a new helper getResolvedCompilerOptions(instance) and exported it via SSR utilities; server-side compilation (ssrCompile) now uses this helper instead of inlined option merging.

Changes

Cohort / File(s) Summary
Compiler Options Helper
packages/runtime-core/src/component.ts, packages/runtime-core/src/index.ts
Added getResolvedCompilerOptions(instance) to compute/merge compiler options from appContext.config and component-level options; exported through _ssrUtils/ssrUtils.
SSR Compilation
packages/server-renderer/src/helpers/ssrCompile.ts
Replaced manual extraction/merging of compiler options with a call to ssrUtils.getResolvedCompilerOptions(instance) when deriving finalCompilerOptions; existing mutation and compile flow unchanged.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐇 I hopped through options, bits all astray,
Gathered them neatly, in one tidy way,
From app and component I stitched every part,
Now ssr compiles with a happier heart,
A carrot for progress, and code that's smart.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title clearly and concisely summarizes the main change: extracting shared compiler options resolution logic to eliminate code duplication between runtime-core and server-renderer.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@github-actions
Copy link
Copy Markdown

Size Report

Bundles

File Size Gzip Brotli
runtime-dom.global.prod.js 105 kB (+37 B) 39.9 kB (+4 B) 35.8 kB (+7 B)
vue.global.prod.js 164 kB (+37 B) 59.9 kB (+2 B) 53.2 kB (-24 B)

Usages

Name Size Gzip Brotli
createApp (CAPI only) 48.3 kB 18.8 kB 17.2 kB
createApp 56.5 kB 21.8 kB 20 kB
createSSRApp 60.7 kB 23.6 kB 21.5 kB
defineCustomElement 62.6 kB 23.8 kB 21.7 kB
overall 71 kB (+31 B) 27.2 kB (+4 B) 24.8 kB (+70 B)

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 16, 2026

Open in StackBlitz

@vue/compiler-core

pnpm add https://pkg.pr.new/@vue/compiler-core@14731
npm i https://pkg.pr.new/@vue/compiler-core@14731
yarn add https://pkg.pr.new/@vue/compiler-core@14731.tgz

@vue/compiler-dom

pnpm add https://pkg.pr.new/@vue/compiler-dom@14731
npm i https://pkg.pr.new/@vue/compiler-dom@14731
yarn add https://pkg.pr.new/@vue/compiler-dom@14731.tgz

@vue/compiler-sfc

pnpm add https://pkg.pr.new/@vue/compiler-sfc@14731
npm i https://pkg.pr.new/@vue/compiler-sfc@14731
yarn add https://pkg.pr.new/@vue/compiler-sfc@14731.tgz

@vue/compiler-ssr

pnpm add https://pkg.pr.new/@vue/compiler-ssr@14731
npm i https://pkg.pr.new/@vue/compiler-ssr@14731
yarn add https://pkg.pr.new/@vue/compiler-ssr@14731.tgz

@vue/reactivity

pnpm add https://pkg.pr.new/@vue/reactivity@14731
npm i https://pkg.pr.new/@vue/reactivity@14731
yarn add https://pkg.pr.new/@vue/reactivity@14731.tgz

@vue/runtime-core

pnpm add https://pkg.pr.new/@vue/runtime-core@14731
npm i https://pkg.pr.new/@vue/runtime-core@14731
yarn add https://pkg.pr.new/@vue/runtime-core@14731.tgz

@vue/runtime-dom

pnpm add https://pkg.pr.new/@vue/runtime-dom@14731
npm i https://pkg.pr.new/@vue/runtime-dom@14731
yarn add https://pkg.pr.new/@vue/runtime-dom@14731.tgz

@vue/server-renderer

pnpm add https://pkg.pr.new/@vue/server-renderer@14731
npm i https://pkg.pr.new/@vue/server-renderer@14731
yarn add https://pkg.pr.new/@vue/server-renderer@14731.tgz

@vue/shared

pnpm add https://pkg.pr.new/@vue/shared@14731
npm i https://pkg.pr.new/@vue/shared@14731
yarn add https://pkg.pr.new/@vue/shared@14731.tgz

vue

pnpm add https://pkg.pr.new/vue@14731
npm i https://pkg.pr.new/vue@14731
yarn add https://pkg.pr.new/vue@14731.tgz

@vue/compat

pnpm add https://pkg.pr.new/@vue/compat@14731
npm i https://pkg.pr.new/@vue/compat@14731
yarn add https://pkg.pr.new/@vue/compat@14731.tgz

commit: 5df2d8b

@edison1105
Copy link
Copy Markdown
Member

Thanks for the PR. Could you please fix the failing tests?

@edison1105 edison1105 added 🧹 p1-chore Priority 1: this doesn't change code behavior. wait changes labels Apr 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🧹 p1-chore Priority 1: this doesn't change code behavior. wait changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants