Prechádzať zdrojové kódy

chore: Merge branch 'main' into minor

daiwei 5 mesiacov pred
rodič
commit
5bfda8c9c2

+ 1 - 1
package.json

@@ -1,7 +1,7 @@
 {
   "private": true,
   "version": "3.6.0-alpha.3",
-  "packageManager": "pnpm@10.12.4",
+  "packageManager": "pnpm@10.20.0",
   "type": "module",
   "scripts": {
     "dev": "node scripts/dev.js",

+ 0 - 10
packages/compiler-core/__tests__/transforms/__snapshots__/transformExpressions.spec.ts.snap

@@ -14,16 +14,6 @@ return function render(_ctx, _cache, $props, $setup, $data, $options) {
 }"
 `;
 
-exports[`compiler: expression transform > expression with type 1`] = `
-"const { openBlock: _openBlock, createElementBlock: _createElementBlock } = Vue
-
-return function render(_ctx, _cache) {
-  return (_openBlock(), _createElementBlock("div", {
-    onClick: _ctx.handleClick
-  }, null, 8 /* PROPS */, ["onClick"]))
-}"
-`;
-
 exports[`compiler: expression transform > should allow leak of var declarations in for loop 1`] = `
 "const { openBlock: _openBlock, createElementBlock: _createElementBlock } = Vue
 

+ 0 - 8
packages/compiler-core/__tests__/transforms/transformExpressions.spec.ts

@@ -754,12 +754,4 @@ describe('compiler: expression transform', () => {
       expect(code).toMatch(`_ctx.bar`)
     })
   })
-
-  test('expression with type', () => {
-    const { code } = compile(
-      `<div @click="(<number>handleClick as any)"></div>`,
-    )
-    expect(code).toMatch(`onClick: _ctx.handleClick`)
-    expect(code).toMatchSnapshot()
-  })
 })

+ 4 - 8
packages/compiler-core/src/transforms/transformExpression.ts

@@ -18,7 +18,6 @@ import {
   createSimpleExpression,
 } from '../ast'
 import {
-  TS_NODE_TYPES,
   isInDestructureAssignment,
   isInNewExpression,
   isStaticProperty,
@@ -349,18 +348,15 @@ export function processExpression(
   // an ExpressionNode has the `.children` property, it will be used instead of
   // `.content`.
   const children: CompoundExpressionNode['children'] = []
-  const isTSNode = TS_NODE_TYPES.includes(ast.type)
   ids.sort((a, b) => a.start - b.start)
   ids.forEach((id, i) => {
     // range is offset by -1 due to the wrapping parens when parsed
     const start = id.start - 1
     const end = id.end - 1
     const last = ids[i - 1]
-    if (!(isTSNode && i === 0)) {
-      const leadingText = rawExp.slice(last ? last.end - 1 : 0, start)
-      if (leadingText.length || id.prefix) {
-        children.push(leadingText + (id.prefix || ``))
-      }
+    const leadingText = rawExp.slice(last ? last.end - 1 : 0, start)
+    if (leadingText.length || id.prefix) {
+      children.push(leadingText + (id.prefix || ``))
     }
     const source = rawExp.slice(start, end)
     children.push(
@@ -377,7 +373,7 @@ export function processExpression(
           : ConstantTypes.NOT_CONSTANT,
       ),
     )
-    if (i === ids.length - 1 && end < rawExp.length && !isTSNode) {
+    if (i === ids.length - 1 && end < rawExp.length) {
       children.push(rawExp.slice(end))
     }
   })

+ 0 - 5
packages/reactivity/src/effect.ts

@@ -169,11 +169,6 @@ if (__DEV__) {
   setupOnTrigger(ReactiveEffect)
 }
 
-export interface ReactiveEffectRunner<T = any> {
-  (): T
-  effect: ReactiveEffect
-}
-
 export function effect<T = any>(
   fn: () => T,
   options?: ReactiveEffectOptions,

+ 1 - 0
packages/runtime-dom/src/index.ts

@@ -19,6 +19,7 @@ import {
 } from '@vue/runtime-core'
 import { nodeOps } from './nodeOps'
 import { patchProp } from './patchProp'
+export { nodeOps, patchProp }
 // Importing from the compiler, will be tree-shaken in prod
 import {
   NOOP,