Skip to content

Commit 1148901

Browse files
authored
Merge branch 'minor' into bwsy/feat/compilerSearchElm
2 parents f515ba7 + 5d93a55 commit 1148901

File tree

29 files changed

+1374
-1295
lines changed

29 files changed

+1374
-1295
lines changed

.github/workflows/canary-minor.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: canary minor release
2+
on:
3+
# Runs every Monday at 1 AM UTC (9:00 AM in Singapore)
4+
schedule:
5+
- cron: 0 1 * * MON
6+
workflow_dispatch:
7+
8+
jobs:
9+
canary:
10+
# prevents this action from running on forks
11+
if: github.repository == 'vuejs/core'
12+
runs-on: ubuntu-latest
13+
environment: Release
14+
steps:
15+
- uses: actions/checkout@v4
16+
with:
17+
ref: minor
18+
19+
- name: Install pnpm
20+
uses: pnpm/action-setup@v2
21+
22+
- name: Set node version to 18
23+
uses: actions/setup-node@v3
24+
with:
25+
node-version: 18
26+
registry-url: 'https://registry.npmjs.org'
27+
cache: 'pnpm'
28+
29+
- run: pnpm install
30+
31+
- run: pnpm release --canary --tag minor
32+
env:
33+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

package.json

Lines changed: 34 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
{
22
"private": true,
33
"version": "3.3.4",
4-
"packageManager": "pnpm@8.6.2",
4+
"packageManager": "pnpm@8.7.6",
55
"type": "module",
66
"scripts": {
77
"dev": "node scripts/dev.js",
88
"build": "node scripts/build.js",
99
"build-dts": "tsc -p tsconfig.build.json && rollup -c rollup.dts.config.js",
10+
"clean": "rimraf packages/*/dist temp .eslintcache",
1011
"size": "run-s \"size-*\" && tsx scripts/usage-size.ts",
1112
"size-global": "node scripts/build.js vue runtime-dom -f global -p --size",
1213
"size-esm-runtime": "node scripts/build.js vue -f esm-bundler-runtime",
@@ -56,53 +57,54 @@
5657
"node": ">=16.14.0"
5758
},
5859
"devDependencies": {
59-
"@babel/parser": "^7.21.3",
60-
"@babel/types": "^7.21.3",
61-
"@rollup/plugin-alias": "^4.0.3",
62-
"@rollup/plugin-commonjs": "^24.0.1",
60+
"@babel/parser": "^7.22.16",
61+
"@babel/types": "^7.22.19",
62+
"@rollup/plugin-alias": "^5.0.0",
63+
"@rollup/plugin-commonjs": "^25.0.4",
6364
"@rollup/plugin-json": "^6.0.0",
64-
"@rollup/plugin-node-resolve": "^15.0.1",
65+
"@rollup/plugin-node-resolve": "^15.2.1",
6566
"@rollup/plugin-replace": "^5.0.2",
66-
"@rollup/plugin-terser": "^0.4.0",
67+
"@rollup/plugin-terser": "^0.4.3",
6768
"@types/hash-sum": "^1.0.0",
68-
"@types/node": "^16.4.7",
69-
"@typescript-eslint/parser": "^6.6.0",
70-
"@vitest/coverage-istanbul": "^0.34.3",
69+
"@types/node": "^18.18.5",
70+
"@typescript-eslint/parser": "^6.7.2",
71+
"@vitest/coverage-istanbul": "^0.34.4",
7172
"@vue/consolidate": "0.17.3",
7273
"chalk": "^4.1.0",
73-
"conventional-changelog-cli": "^2.0.31",
74-
"enquirer": "^2.3.2",
75-
"esbuild": "^0.17.4",
76-
"esbuild-plugin-polyfill-node": "^0.2.0",
77-
"eslint": "^8.48.0",
78-
"eslint-plugin-jest": "^27.2.3",
74+
"conventional-changelog-cli": "^4.1.0",
75+
"enquirer": "^2.4.1",
76+
"esbuild": "^0.19.3",
77+
"esbuild-plugin-polyfill-node": "^0.3.0",
78+
"eslint": "^8.49.0",
79+
"eslint-plugin-jest": "^27.4.0",
7980
"estree-walker": "^2.0.2",
80-
"execa": "^4.0.2",
81+
"execa": "^8.0.1",
8182
"jsdom": "^22.1.0",
8283
"lint-staged": "^14.0.1",
83-
"lodash": "^4.17.15",
84-
"magic-string": "^0.30.0",
84+
"lodash": "^4.17.21",
85+
"magic-string": "^0.30.3",
8586
"markdown-table": "^3.0.3",
86-
"marked": "^4.0.10",
87-
"minimist": "^1.2.0",
87+
"marked": "^9.1.1",
88+
"minimist": "^1.2.8",
8889
"npm-run-all": "^4.1.5",
8990
"prettier": "^3.0.3",
9091
"pretty-bytes": "^6.1.1",
91-
"pug": "^3.0.1",
92-
"puppeteer": "~21.1.1",
93-
"rollup": "^3.26.0",
94-
"rollup-plugin-dts": "^5.3.0",
95-
"rollup-plugin-esbuild": "^5.0.0",
92+
"pug": "^3.0.2",
93+
"puppeteer": "~21.2.1",
94+
"rimraf": "^5.0.1",
95+
"rollup": "^3.29.2",
96+
"rollup-plugin-dts": "^6.0.2",
97+
"rollup-plugin-esbuild": "^6.0.0",
9698
"rollup-plugin-polyfill-node": "^0.12.0",
97-
"semver": "^7.3.2",
99+
"semver": "^7.5.4",
98100
"serve": "^14.2.1",
99101
"simple-git-hooks": "^2.9.0",
100-
"terser": "^5.19.2",
101-
"todomvc-app-css": "^2.3.0",
102-
"tslib": "^2.5.0",
103-
"tsx": "^3.12.7",
102+
"terser": "^5.19.4",
103+
"todomvc-app-css": "^2.4.2",
104+
"tslib": "^2.6.2",
105+
"tsx": "^3.12.10",
104106
"typescript": "^5.1.6",
105107
"vite": "^4.3.0",
106-
"vitest": "^0.34.3"
108+
"vitest": "^0.34.4"
107109
}
108110
}

packages/compiler-core/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@
3232
},
3333
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-core#readme",
3434
"dependencies": {
35-
"@babel/parser": "^7.21.3",
35+
"@babel/parser": "^7.22.16",
3636
"@vue/shared": "3.3.4",
3737
"estree-walker": "^2.0.2",
3838
"source-map-js": "^1.0.2"
3939
},
4040
"devDependencies": {
41-
"@babel/types": "^7.21.3"
41+
"@babel/types": "^7.22.19"
4242
}
4343
}

packages/compiler-core/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export {
2424
export { generate, type CodegenContext, type CodegenResult } from './codegen'
2525
export {
2626
ErrorCodes,
27+
errorMessages,
2728
createCompilerError,
2829
type CoreCompilerError,
2930
type CompilerError

packages/compiler-dom/src/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,5 +68,9 @@ export function parse(template: string, options: ParserOptions = {}): RootNode {
6868

6969
export * from './runtimeHelpers'
7070
export { transformStyle } from './transforms/transformStyle'
71-
export { createDOMCompilerError, DOMErrorCodes } from './errors'
71+
export {
72+
createDOMCompilerError,
73+
DOMErrorCodes,
74+
DOMErrorMessages
75+
} from './errors'
7276
export * from '@vue/compiler-core'

packages/compiler-sfc/package.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,29 +32,29 @@
3232
},
3333
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-sfc#readme",
3434
"dependencies": {
35-
"@babel/parser": "^7.20.15",
35+
"@babel/parser": "^7.22.16",
3636
"@vue/compiler-core": "3.3.4",
3737
"@vue/compiler-dom": "3.3.4",
3838
"@vue/compiler-ssr": "3.3.4",
3939
"@vue/reactivity-transform": "3.3.4",
4040
"@vue/shared": "3.3.4",
4141
"estree-walker": "^2.0.2",
42-
"magic-string": "^0.30.0",
43-
"postcss": "^8.1.10",
42+
"magic-string": "^0.30.3",
43+
"postcss": "^8.4.30",
4444
"source-map-js": "^1.0.2"
4545
},
4646
"devDependencies": {
47-
"@babel/types": "^7.21.3",
48-
"@types/estree": "^0.0.48",
49-
"@types/lru-cache": "^5.1.0",
47+
"@babel/types": "^7.22.19",
48+
"@types/estree": "^0.0.52",
49+
"@types/lru-cache": "^5.1.1",
5050
"@vue/consolidate": "^0.17.3",
5151
"hash-sum": "^2.0.0",
5252
"lru-cache": "^5.1.1",
5353
"merge-source-map": "^1.1.0",
54-
"minimatch": "^9.0.0",
55-
"postcss-modules": "^4.0.0",
56-
"postcss-selector-parser": "^6.0.4",
57-
"pug": "^3.0.1",
58-
"sass": "^1.26.9"
54+
"minimatch": "^9.0.3",
55+
"postcss-modules": "^4.3.1",
56+
"postcss-selector-parser": "^6.0.13",
57+
"pug": "^3.0.2",
58+
"sass": "^1.67.0"
5959
}
6060
}

packages/compiler-sfc/src/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ export {
3333

3434
// Internals for type resolution
3535
export { invalidateTypeCache, registerTS } from './script/resolveType'
36+
export { extractRuntimeProps } from './script/defineProps'
37+
export { extractRuntimeEmits } from './script/defineEmits'
3638

3739
// Types
3840
export type {
@@ -58,6 +60,7 @@ export type { SFCScriptCompileOptions } from './compileScript'
5860
export type { ScriptCompileContext } from './script/context'
5961
export type {
6062
TypeResolveContext,
63+
SimpleTypeResolveOptions,
6164
SimpleTypeResolveContext
6265
} from './script/resolveType'
6366
export type {

packages/compiler-sfc/src/rewriteDefault.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export function rewriteDefaultAST(
3737
// multi-line comments or template strings. fallback to a full parse.
3838
ast.forEach(node => {
3939
if (node.type === 'ExportDefaultDeclaration') {
40-
if (node.declaration.type === 'ClassDeclaration') {
40+
if (node.declaration.type === 'ClassDeclaration' && node.declaration.id) {
4141
let start: number =
4242
node.declaration.decorators && node.declaration.decorators.length > 0
4343
? node.declaration.decorators[

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

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
1-
import { Identifier, LVal, Node, RestElement } from '@babel/types'
1+
import {
2+
ArrayPattern,
3+
Identifier,
4+
LVal,
5+
Node,
6+
ObjectPattern,
7+
RestElement
8+
} from '@babel/types'
29
import { isCallOf } from './utils'
310
import { ScriptCompileContext } from './context'
4-
import { resolveTypeElements, resolveUnionType } from './resolveType'
11+
import {
12+
TypeResolveContext,
13+
resolveTypeElements,
14+
resolveUnionType
15+
} from './resolveType'
516

617
export const DEFINE_EMITS = 'defineEmits'
718

@@ -57,7 +68,7 @@ export function genRuntimeEmits(ctx: ScriptCompileContext): string | undefined {
5768
return emitsDecl
5869
}
5970

60-
function extractRuntimeEmits(ctx: ScriptCompileContext): Set<string> {
71+
export function extractRuntimeEmits(ctx: TypeResolveContext): Set<string> {
6172
const emits = new Set<string>()
6273
const node = ctx.emitsTypeDecl!
6374

@@ -90,8 +101,8 @@ function extractRuntimeEmits(ctx: ScriptCompileContext): Set<string> {
90101
}
91102

92103
function extractEventNames(
93-
ctx: ScriptCompileContext,
94-
eventName: Identifier | RestElement,
104+
ctx: TypeResolveContext,
105+
eventName: ArrayPattern | Identifier | ObjectPattern | RestElement,
95106
emits: Set<string>
96107
) {
97108
if (

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

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ import {
88
} from '@babel/types'
99
import { BindingTypes, isFunctionType } from '@vue/compiler-dom'
1010
import { ScriptCompileContext } from './context'
11-
import { inferRuntimeType, resolveTypeElements } from './resolveType'
11+
import {
12+
TypeResolveContext,
13+
inferRuntimeType,
14+
resolveTypeElements
15+
} from './resolveType'
1216
import {
1317
resolveObjectKey,
1418
UNKNOWN_TYPE,
@@ -150,7 +154,7 @@ export function genRuntimeProps(ctx: ScriptCompileContext): string | undefined {
150154
}
151155
}
152156
} else if (ctx.propsTypeDecl) {
153-
propsDecls = genRuntimePropsFromTypes(ctx)
157+
propsDecls = extractRuntimeProps(ctx)
154158
}
155159

156160
const modelsDecls = genModelProps(ctx)
@@ -162,7 +166,9 @@ export function genRuntimeProps(ctx: ScriptCompileContext): string | undefined {
162166
}
163167
}
164168

165-
function genRuntimePropsFromTypes(ctx: ScriptCompileContext) {
169+
export function extractRuntimeProps(
170+
ctx: TypeResolveContext
171+
): string | undefined {
166172
// this is only called if propsTypeDecl exists
167173
const props = resolveRuntimePropsFromType(ctx, ctx.propsTypeDecl!)
168174
if (!props.length) {
@@ -175,7 +181,7 @@ function genRuntimePropsFromTypes(ctx: ScriptCompileContext) {
175181
for (const prop of props) {
176182
propStrings.push(genRuntimePropFromType(ctx, prop, hasStaticDefaults))
177183
// register bindings
178-
if (!(prop.key in ctx.bindingMetadata)) {
184+
if ('bindingMetadata' in ctx && !(prop.key in ctx.bindingMetadata)) {
179185
ctx.bindingMetadata[prop.key] = BindingTypes.PROPS
180186
}
181187
}
@@ -193,7 +199,7 @@ function genRuntimePropsFromTypes(ctx: ScriptCompileContext) {
193199
}
194200

195201
function resolveRuntimePropsFromType(
196-
ctx: ScriptCompileContext,
202+
ctx: TypeResolveContext,
197203
node: Node
198204
): PropTypeData[] {
199205
const props: PropTypeData[] = []
@@ -222,7 +228,7 @@ function resolveRuntimePropsFromType(
222228
}
223229

224230
function genRuntimePropFromType(
225-
ctx: ScriptCompileContext,
231+
ctx: TypeResolveContext,
226232
{ key, required, type, skipCheck }: PropTypeData,
227233
hasStaticDefaults: boolean
228234
): string {
@@ -284,7 +290,7 @@ function genRuntimePropFromType(
284290
* static properties, we can directly generate more optimized default
285291
* declarations. Otherwise we will have to fallback to runtime merging.
286292
*/
287-
function hasStaticWithDefaults(ctx: ScriptCompileContext) {
293+
function hasStaticWithDefaults(ctx: TypeResolveContext) {
288294
return !!(
289295
ctx.propsRuntimeDefaults &&
290296
ctx.propsRuntimeDefaults.type === 'ObjectExpression' &&
@@ -297,7 +303,7 @@ function hasStaticWithDefaults(ctx: ScriptCompileContext) {
297303
}
298304

299305
function genDestructuredDefaultValue(
300-
ctx: ScriptCompileContext,
306+
ctx: TypeResolveContext,
301307
key: string,
302308
inferredType?: string[]
303309
):

0 commit comments

Comments
 (0)