Skip to content

Conversation

@KazariEX
Copy link
Member

@KazariEXKazariEX commented Nov 18, 2025

resolve vuejs/rfcs#777

Summary by CodeRabbit

  • New Features
    • Added support for the false shorthand syntax in v-bind directives. Developers can now use the ! notation to concisely set binding values to false, improving code readability for boolean attribute bindings (e.g., <div !id />).

@coderabbitai
Copy link

coderabbitaibot commented Nov 18, 2025

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Title check✅ PassedThe title 'feat(compiler-core): support false prop shorthand' clearly and concisely describes the main feature being added, matching the changes across tokenizer, parser, and tests.
Docstring Coverage✅ PassedNo 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

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

Size Report

Bundles

FileSizeGzipBrotli
runtime-dom.global.prod.js103 kB38.9 kB35.1 kB
vue.global.prod.js161 kB (+37 B)58.8 kB (+13 B)52.4 kB (+56 B)

Usages

NameSizeGzipBrotli
createApp (CAPI only)46.9 kB18.3 kB16.8 kB
createApp55 kB21.4 kB19.6 kB
createSSRApp59.3 kB23.1 kB21.1 kB
defineCustomElement60.6 kB23.1 kB21.1 kB
overall69.3 kB26.6 kB24.3 kB

@pkg-pr-new
Copy link

Open in StackBlitz

@vue/compiler-core

npm i https://pkg.pr.new/@vue/compiler-core@14110 

@vue/compiler-dom

npm i https://pkg.pr.new/@vue/compiler-dom@14110 

@vue/compiler-sfc

npm i https://pkg.pr.new/@vue/compiler-sfc@14110 

@vue/compiler-ssr

npm i https://pkg.pr.new/@vue/compiler-ssr@14110 

@vue/reactivity

npm i https://pkg.pr.new/@vue/reactivity@14110 

@vue/runtime-core

npm i https://pkg.pr.new/@vue/runtime-core@14110 

@vue/runtime-dom

npm i https://pkg.pr.new/@vue/runtime-dom@14110 

@vue/server-renderer

npm i https://pkg.pr.new/@vue/server-renderer@14110 

@vue/shared

npm i https://pkg.pr.new/@vue/shared@14110 

vue

npm i https://pkg.pr.new/vue@14110 

@vue/compat

npm i https://pkg.pr.new/@vue/compat@14110 

commit: 555e626

Copy link

@coderabbitaicoderabbitaibot 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 (2)
packages/compiler-core/src/parser.ts (1)

200-233: !bind mapping and default false exp look correct; consider the <div !> edge case

Mapping raw === '!' to the bind directive and seeding exp with a false SimpleExpression gives <div !id /> the same internal shape as v-bind:id="false", and stays consistent with how ., :, @, and # are treated here. Using a synthetic expression (no real source span) also makes sense since false is implicit in the shorthand.

One behavioral edge case to be aware of: <div ! /> will now parse as a bind directive with no arg and exp = false (effectively v-bind="false"), rather than producing a missing-arg error. If RFC 777 expects that to be invalid, you might want to special‑case raw === '!' with an empty arg to emit an error instead; otherwise this behavior is consistent with the rest of the parser.

packages/compiler-core/__tests__/transforms/vBind.spec.ts (1)

136-149: New false‑shorthand test is aligned with the intended semantics

This test cleanly validates that <div !id /> compiles to a prop id: false with a static key and non‑static value, matching the new parser behavior. For future hardening (not blocking here), you might also add variants with prefixIdentifiers: true and/or dynamic args (e.g. ![foo]) to lock in those combinations.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3942dbe and 555e626.

📒 Files selected for processing (3)
  • packages/compiler-core/__tests__/transforms/vBind.spec.ts (1 hunks)
  • packages/compiler-core/src/parser.ts (2 hunks)
  • packages/compiler-core/src/tokenizer.ts (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
packages/compiler-core/__tests__/transforms/vBind.spec.ts (1)
packages/compiler-core/src/ast.ts (2)
  • VNodeCall (323-341)
  • ObjectExpression (374-377)
packages/compiler-core/src/parser.ts (1)
packages/compiler-core/src/ast.ts (1)
  • createSimpleExpression (685-698)
⏰ 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). (1)
  • GitHub Check: test / e2e-test
🔇 Additional comments (1)
packages/compiler-core/src/tokenizer.ts (1)

664-681: Extending directive prefix detection to ! is consistent and localized

Routing ! through the directive path here (same bucket as ., :, @, #) correctly feeds ondirname a raw '!' and then parses the rest as the arg. This aligns tokenizer behavior with the parser’s new handling and keeps all existing attr/dir state transitions intact. The only functional change is that attrs starting with ! are no longer plain attributes but directives, which seems acceptable given HTML’s constraints and the RFC intent.

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

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

2 participants

@KazariEX@edison1105