Skip to content

Commit 524e660

Browse files
committed
chore: Merge branch 'main' into minor
2 parents 1224caf + e5ca13a commit 524e660

File tree

10 files changed

+81
-32
lines changed

10 files changed

+81
-32
lines changed

CHANGELOG.md

+14
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
## [3.4.29](https://github.com/vuejs/core/compare/v3.4.28...v3.4.29) (2024-06-14)
2+
3+
4+
### Bug Fixes
5+
6+
* **build:** fix accidental inclusion of runtime-core in server-renderer cjs build ([11cc12b](https://github.com/vuejs/core/commit/11cc12b915edfe0e4d3175e57464f73bc2c1cb04)), closes [#11137](https://github.com/vuejs/core/issues/11137)
7+
* **compiler-sfc:** fix missing scope for extends error message ([4ec387b](https://github.com/vuejs/core/commit/4ec387b100985b008cdcc4cd883a5b6328c05766))
8+
* **compiler-sfc:** fix parsing of mts, d.mts, and mtsx files ([a476692](https://github.com/vuejs/core/commit/a476692ed2d7308f2742d8ff3554cf97a392b0b7))
9+
* **compiler-sfc:** support [@vue-ignore](https://github.com/vue-ignore) comment on more type sources ([a23e99b](https://github.com/vuejs/core/commit/a23e99bedf1d65841d162951f10ce35b907a5680))
10+
* **custom-element:** support same direct setup function signature in defineCustomElement ([7c8b126](https://github.com/vuejs/core/commit/7c8b12620aad4969b8dc4944d4fc486d16c3033c)), closes [#11116](https://github.com/vuejs/core/issues/11116)
11+
* **reactivity:** avoid infinite loop when render access a side effect computed ([#11135](https://github.com/vuejs/core/issues/11135)) ([8296e19](https://github.com/vuejs/core/commit/8296e19855e369a7826f5ea26540a6da01dc7093)), closes [#11121](https://github.com/vuejs/core/issues/11121)
12+
13+
14+
115
## [3.4.28](https://github.com/vuejs/core/compare/v3.4.27...v3.4.28) (2024-06-14)
216

317

packages/compiler-sfc/__tests__/compileScript/resolveType.spec.ts

+12
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,18 @@ describe('resolveType', () => {
137137
})
138138
})
139139

140+
test('intersection type with ignore', () => {
141+
expect(
142+
resolve(`
143+
type Foo = { foo: number }
144+
type Bar = { bar: string }
145+
defineProps<Foo & /* @vue-ignore */ Bar>()
146+
`).props,
147+
).toStrictEqual({
148+
foo: ['Number'],
149+
})
150+
})
151+
140152
// #7553
141153
test('union type', () => {
142154
expect(

packages/compiler-sfc/src/script/context.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -175,14 +175,14 @@ export function resolveParserPlugins(
175175
) {
176176
plugins.push('importAttributes')
177177
}
178-
if (lang === 'jsx' || lang === 'tsx') {
178+
if (lang === 'jsx' || lang === 'tsx' || lang === 'mtsx') {
179179
plugins.push('jsx')
180180
} else if (userPlugins) {
181181
// If don't match the case of adding jsx
182182
// should remove the jsx from user options
183183
userPlugins = userPlugins.filter(p => p !== 'jsx')
184184
}
185-
if (lang === 'ts' || lang === 'tsx') {
185+
if (lang === 'ts' || lang === 'mts' || lang === 'tsx' || lang === 'mtsx') {
186186
plugins.push(['typescript', { dts }], 'explicitResourceManagement')
187187
if (!userPlugins || !userPlugins.includes('decorators')) {
188188
plugins.push('decorators-legacy')

packages/compiler-sfc/src/script/resolveType.ts

+9-8
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,12 @@ function innerResolveTypeElements(
165165
scope: TypeScope,
166166
typeParameters?: Record<string, Node>,
167167
): ResolvedElements {
168+
if (
169+
node.leadingComments &&
170+
node.leadingComments.some(c => c.value.includes('@vue-ignore'))
171+
) {
172+
return { props: {} }
173+
}
168174
switch (node.type) {
169175
case 'TSTypeLiteral':
170176
return typeElementsToMap(ctx, node.members, scope, typeParameters)
@@ -414,12 +420,6 @@ function resolveInterfaceMembers(
414420
)
415421
if (node.extends) {
416422
for (const ext of node.extends) {
417-
if (
418-
ext.leadingComments &&
419-
ext.leadingComments.some(c => c.value.includes('@vue-ignore'))
420-
) {
421-
continue
422-
}
423423
try {
424424
const { props, calls } = resolveTypeElements(ctx, ext, scope)
425425
for (const key in props) {
@@ -439,6 +439,7 @@ function resolveInterfaceMembers(
439439
`Note: both in 3.2 or with the ignore, the properties in the base ` +
440440
`type are treated as fallthrough attrs at runtime.`,
441441
ext,
442+
scope,
442443
)
443444
}
444445
}
@@ -1138,12 +1139,12 @@ function parseFile(
11381139
parserPlugins?: SFCScriptCompileOptions['babelParserPlugins'],
11391140
): Statement[] {
11401141
const ext = extname(filename)
1141-
if (ext === '.ts' || ext === '.tsx') {
1142+
if (ext === '.ts' || ext === '.mts' || ext === '.tsx' || ext === '.mtsx') {
11421143
return babelParse(content, {
11431144
plugins: resolveParserPlugins(
11441145
ext.slice(1),
11451146
parserPlugins,
1146-
filename.endsWith('.d.ts'),
1147+
/\.d\.m?ts$/.test(filename),
11471148
),
11481149
sourceType: 'module',
11491150
}).program.body

packages/reactivity/src/constants.ts

-8
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,3 @@ export enum ReactiveFlags {
2222
RAW = '__v_raw',
2323
IS_REF = '__v_isRef',
2424
}
25-
26-
export enum DirtyLevels {
27-
NotDirty = 0,
28-
QueryingDirty = 1,
29-
MaybeDirty_ComputedSideEffect = 2,
30-
MaybeDirty = 3,
31-
Dirty = 4,
32-
}

packages/runtime-dom/__tests__/customElement.spec.ts

+17
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,23 @@ describe('defineCustomElement', () => {
342342
expect(el.maxAge).toBe(50)
343343
expect(el.shadowRoot.innerHTML).toBe('max age: 50/type: number')
344344
})
345+
346+
test('support direct setup function syntax with extra options', () => {
347+
const E = defineCustomElement(
348+
props => {
349+
return () => props.text
350+
},
351+
{
352+
props: {
353+
text: String,
354+
},
355+
},
356+
)
357+
customElements.define('my-el-setup-with-props', E)
358+
container.innerHTML = `<my-el-setup-with-props text="hello"></my-el-setup-with-props>`
359+
const e = container.childNodes[0] as VueElement
360+
expect(e.shadowRoot!.innerHTML).toBe('hello')
361+
})
345362
})
346363

347364
describe('attrs', () => {

packages/runtime-dom/src/apiCustomElement.ts

+20-7
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,16 @@ export type VueElementConstructor<P = {}> = {
3838

3939
// overload 1: direct setup function
4040
export function defineCustomElement<Props, RawBindings = object>(
41-
setup: (
42-
props: Readonly<Props>,
43-
ctx: SetupContext,
44-
) => RawBindings | RenderFunction,
41+
setup: (props: Props, ctx: SetupContext) => RawBindings | RenderFunction,
42+
options?: Pick<ComponentOptions, 'name' | 'inheritAttrs' | 'emits'> & {
43+
props?: (keyof Props)[]
44+
},
45+
): VueElementConstructor<Props>
46+
export function defineCustomElement<Props, RawBindings = object>(
47+
setup: (props: Props, ctx: SetupContext) => RawBindings | RenderFunction,
48+
options?: Pick<ComponentOptions, 'name' | 'inheritAttrs' | 'emits'> & {
49+
props?: ComponentObjectPropsOptions<Props>
50+
},
4551
): VueElementConstructor<Props>
4652

4753
// overload 2: defineCustomElement with options object, infer props from options
@@ -127,9 +133,13 @@ export function defineCustomElement<P>(
127133
/*! #__NO_SIDE_EFFECTS__ */
128134
export function defineCustomElement(
129135
options: any,
136+
extraOptions?: ComponentOptions,
137+
/**
138+
* @internal
139+
*/
130140
hydrate?: RootHydrateFunction,
131141
): VueElementConstructor {
132-
const Comp = defineComponent(options) as any
142+
const Comp = defineComponent(options, extraOptions) as any
133143
class VueCustomElement extends VueElement {
134144
static def = Comp
135145
constructor(initialProps?: Record<string, any>) {
@@ -141,9 +151,12 @@ export function defineCustomElement(
141151
}
142152

143153
/*! #__NO_SIDE_EFFECTS__ */
144-
export const defineSSRCustomElement = ((options: any) => {
154+
export const defineSSRCustomElement = ((
155+
options: any,
156+
extraOptions?: ComponentOptions,
157+
) => {
145158
// @ts-expect-error
146-
return defineCustomElement(options, hydrate)
159+
return defineCustomElement(options, extraOptions, hydrate)
147160
}) as typeof defineCustomElement
148161

149162
const BaseClass = (

packages/server-renderer/src/helpers/ssrGetDirectiveProps.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
import {
2-
type ComponentPublicInstance,
3-
type Directive,
4-
ssrUtils,
5-
} from '@vue/runtime-core'
1+
import { type ComponentPublicInstance, type Directive, ssrUtils } from 'vue'
62

73
export function ssrGetDirectiveProps(
84
instance: ComponentPublicInstance,

scripts/release.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -352,8 +352,11 @@ async function getCIResult() {
352352
`https://api.github.com/repos/vuejs/core/actions/runs?head_sha=${sha}` +
353353
`&status=success&exclude_pull_requests=true`,
354354
)
355+
/** @type {{ workflow_runs: ({ name: string, conclusion: string })[] }} */
355356
const data = await res.json()
356-
return data.workflow_runs.length > 0
357+
return data.workflow_runs.some(({ name, conclusion }) => {
358+
return name === 'ci' && conclusion === 'success'
359+
})
357360
} catch {
358361
console.error('Failed to get CI status for current commit.')
359362
return false

tsconfig.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,6 @@
3636
"packages/vue/jsx-runtime",
3737
"scripts/*",
3838
"rollup.*.js"
39-
]
39+
],
40+
"exclude": ["packages/sfc-playground/src/vue-dev-proxy*"]
4041
}

0 commit comments

Comments
 (0)