Skip to content

Commit 3e2efe0

Browse files
authored
Merge branch 'main' into feat/v-model-details-dialog
2 parents 43839c3 + a95e612 commit 3e2efe0

File tree

213 files changed

+12609
-8986
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

213 files changed

+12609
-8986
lines changed

.github/workflows/ci.yml

+34-2
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,40 @@ jobs:
2626
node-version: 18
2727
cache: 'pnpm'
2828

29-
- run: PUPPETEER_SKIP_DOWNLOAD=1 pnpm install
29+
- name: Skip Puppeteer download
30+
run: echo "PUPPETEER_SKIP_DOWNLOAD=1" >> $GITHUB_ENV
31+
32+
- run: pnpm install
3033

3134
- name: Run unit tests
3235
run: pnpm run test-unit
3336

37+
unit-test-windows:
38+
runs-on: windows-latest
39+
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
40+
steps:
41+
- uses: actions/checkout@v3
42+
43+
- name: Install pnpm
44+
uses: pnpm/action-setup@v2
45+
46+
- name: Set node version to 18
47+
uses: actions/setup-node@v3
48+
with:
49+
node-version: 18
50+
cache: 'pnpm'
51+
52+
- name: Skip Puppeteer download
53+
run: echo "PUPPETEER_SKIP_DOWNLOAD=1" >> $env:GITHUB_ENV
54+
55+
- run: pnpm install
56+
57+
- name: Run compiler unit tests
58+
run: pnpm run test-unit compiler
59+
60+
- name: Run ssr unit tests
61+
run: pnpm run test-unit server-renderer
62+
3463
e2e-test:
3564
runs-on: ubuntu-latest
3665
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
@@ -72,7 +101,10 @@ jobs:
72101
node-version: 18
73102
cache: 'pnpm'
74103

75-
- run: PUPPETEER_SKIP_DOWNLOAD=1 pnpm install
104+
- name: Skip Puppeteer download
105+
run: echo "PUPPETEER_SKIP_DOWNLOAD=1" >> $GITHUB_ENV
106+
107+
- run: pnpm install
76108

77109
- name: Run eslint
78110
run: pnpm run lint

CHANGELOG.md

+200-2,960
Large diffs are not rendered by default.

changelogs/CHANGELOG-3.0.md

+1,617
Large diffs are not rendered by default.

changelogs/CHANGELOG-3.1.md

+320
Large diffs are not rendered by default.

changelogs/CHANGELOG-3.2.md

+1,067
Large diffs are not rendered by default.

package.json

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"private": true,
3-
"version": "3.3.0-alpha.9",
4-
"packageManager": "pnpm@7.26.0",
3+
"version": "3.3.4",
4+
"packageManager": "pnpm@8.4.0",
55
"type": "module",
66
"scripts": {
77
"dev": "node scripts/dev.js",
@@ -57,7 +57,6 @@
5757
"devDependencies": {
5858
"@babel/parser": "^7.21.3",
5959
"@babel/types": "^7.21.3",
60-
"@esbuild-plugins/node-modules-polyfill": "^0.2.2",
6160
"@rollup/plugin-alias": "^4.0.3",
6261
"@rollup/plugin-commonjs": "^24.0.1",
6362
"@rollup/plugin-json": "^6.0.0",
@@ -69,11 +68,11 @@
6968
"@typescript-eslint/parser": "^5.56.0",
7069
"@vitest/coverage-istanbul": "^0.29.7",
7170
"@vue/consolidate": "0.17.3",
72-
"brotli": "^1.3.2",
7371
"chalk": "^4.1.0",
7472
"conventional-changelog-cli": "^2.0.31",
7573
"enquirer": "^2.3.2",
7674
"esbuild": "^0.17.4",
75+
"esbuild-plugin-polyfill-node": "^0.2.0",
7776
"eslint": "^8.33.0",
7877
"eslint-plugin-jest": "^27.2.1",
7978
"estree-walker": "^2.0.2",
@@ -99,7 +98,7 @@
9998
"todomvc-app-css": "^2.3.0",
10099
"tslib": "^2.5.0",
101100
"typescript": "^5.0.0",
102-
"vite": "^4.2.0",
103-
"vitest": "^0.29.7"
101+
"vite": "^4.3.0",
102+
"vitest": "^0.30.1"
104103
}
105104
}

packages/compiler-core/__tests__/compile.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { baseCompile as compile } from '../src'
2-
import { SourceMapConsumer, RawSourceMap } from 'source-map'
2+
import { SourceMapConsumer, RawSourceMap } from 'source-map-js'
33

44
describe('compiler: integration tests', () => {
55
const source = `

packages/compiler-core/__tests__/parse.spec.ts

+30-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { vi } from 'vitest'
21
import { ParserOptions } from '../src/options'
32
import { baseParse, TextModes } from '../src/parse'
43
import { ErrorCodes } from '../src/errors'
@@ -11,7 +10,8 @@ import {
1110
Position,
1211
TextNode,
1312
InterpolationNode,
14-
ConstantTypes
13+
ConstantTypes,
14+
DirectiveNode
1515
} from '../src/ast'
1616

1717
describe('compiler: parse', () => {
@@ -1164,6 +1164,34 @@ describe('compiler: parse', () => {
11641164
})
11651165
})
11661166

1167+
// #3494
1168+
test('directive argument edge case', () => {
1169+
const ast = baseParse('<div v-slot:slot />')
1170+
const directive = (ast.children[0] as ElementNode)
1171+
.props[0] as DirectiveNode
1172+
expect(directive.arg).toMatchObject({
1173+
loc: {
1174+
start: { offset: 12, line: 1, column: 13 },
1175+
end: { offset: 16, line: 1, column: 17 },
1176+
source: 'slot'
1177+
}
1178+
})
1179+
})
1180+
1181+
// https://github.com/vuejs/language-tools/issues/2710
1182+
test('directive argument edge case (2)', () => {
1183+
const ast = baseParse('<div #item.item />')
1184+
const directive = (ast.children[0] as ElementNode)
1185+
.props[0] as DirectiveNode
1186+
expect(directive.arg).toMatchObject({
1187+
loc: {
1188+
start: { offset: 6, line: 1, column: 7 },
1189+
end: { offset: 15, line: 1, column: 16 },
1190+
source: 'item.item'
1191+
}
1192+
})
1193+
})
1194+
11671195
test('directive with dynamic argument', () => {
11681196
const ast = baseParse('<div v-on:[event]/>')
11691197
const directive = (ast.children[0] as ElementNode).props[0]

packages/compiler-core/__tests__/transform.spec.ts

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { vi } from 'vitest'
21
import { baseParse } from '../src/parse'
32
import { transform, NodeTransform } from '../src/transform'
43
import {

packages/compiler-core/__tests__/transforms/transformElement.spec.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { vi } from 'vitest'
21
import {
32
CompilerOptions,
43
baseParse as parse,
@@ -998,7 +997,7 @@ describe('compiler: element transform', () => {
998997
})
999998

1000999
test('NEED_PATCH (vnode hooks)', () => {
1001-
const root = baseCompile(`<div @vnodeUpdated="foo" />`, {
1000+
const root = baseCompile(`<div @vue:updated="foo" />`, {
10021001
prefixIdentifiers: true,
10031002
cacheHandlers: true
10041003
}).ast
@@ -1184,6 +1183,7 @@ describe('compiler: element transform', () => {
11841183
})
11851184
})
11861185

1186+
// TODO remove in 3.4
11871187
test('v-is', () => {
11881188
const { node, root } = parseWithBind(`<div v-is="'foo'" />`)
11891189
expect(root.helpers).toContain(RESOLVE_DYNAMIC_COMPONENT)
@@ -1201,6 +1201,7 @@ describe('compiler: element transform', () => {
12011201
// should skip v-is runtime check
12021202
directives: undefined
12031203
})
1204+
expect('v-is="component-name" has been deprecated').toHaveBeenWarned()
12041205
})
12051206

12061207
// #3934

packages/compiler-core/__tests__/transforms/transformExpressions.spec.ts

+11-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { vi } from 'vitest'
21
import {
32
baseParse as parse,
43
transform,
@@ -431,6 +430,16 @@ describe('compiler: expression transform', () => {
431430
})
432431
})
433432

433+
// #8295
434+
test('should treat floating point number literals as constant', () => {
435+
const node = parseWithExpressionTransform(
436+
`{{ [1, 2.1] }}`
437+
) as InterpolationNode
438+
expect(node.content).toMatchObject({
439+
constType: ConstantTypes.CAN_STRINGIFY
440+
})
441+
})
442+
434443
describe('ES Proposals support', () => {
435444
test('bigInt', () => {
436445
const node = parseWithExpressionTransform(
@@ -549,7 +558,7 @@ describe('compiler: expression transform', () => {
549558

550559
test('literal const handling, non-inline mode', () => {
551560
const { code } = compileWithBindingMetadata(`<div>{{ literal }}</div>`)
552-
expect(code).toMatch(`toDisplayString(literal)`)
561+
expect(code).toMatch(`toDisplayString($setup.literal)`)
553562
// #7973 should skip patch for literal const
554563
expect(code).not.toMatch(
555564
`${PatchFlags.TEXT} /* ${PatchFlagNames[PatchFlags.TEXT]} */`

packages/compiler-core/__tests__/transforms/transformSlotOutlet.spec.ts

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { vi } from 'vitest'
21
import {
32
CompilerOptions,
43
baseParse as parse,

packages/compiler-core/__tests__/transforms/vBind.spec.ts

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { vi } from 'vitest'
21
import {
32
baseParse as parse,
43
transform,

packages/compiler-core/__tests__/transforms/vFor.spec.ts

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { vi } from 'vitest'
21
import { baseParse as parse } from '../../src/parse'
32
import { transform } from '../../src/transform'
43
import { transformIf } from '../../src/transforms/vIf'

packages/compiler-core/__tests__/transforms/vIf.spec.ts

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { vi } from 'vitest'
21
import { baseParse as parse } from '../../src/parse'
32
import { transform } from '../../src/transform'
43
import { transformIf } from '../../src/transforms/vIf'

packages/compiler-core/__tests__/transforms/vModel.spec.ts

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { vi } from 'vitest'
21
import {
32
baseParse as parse,
43
transform,

packages/compiler-core/__tests__/transforms/vOn.spec.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { vi } from 'vitest'
21
import {
32
baseParse as parse,
43
CompilerOptions,
@@ -438,6 +437,7 @@ describe('compiler: transform v-on', () => {
438437
})
439438
})
440439

440+
// TODO remove in 3.4
441441
test('case conversion for vnode hooks', () => {
442442
const { node } = parseWithVOn(`<div v-on:vnode-mounted="onMount"/>`)
443443
expect((node.codegenNode as VNodeCall).props).toMatchObject({
@@ -452,6 +452,7 @@ describe('compiler: transform v-on', () => {
452452
}
453453
]
454454
})
455+
expect('@vnode-* hooks in templates are deprecated').toHaveBeenWarned()
455456
})
456457

457458
test('vue: prefixed events', () => {

packages/compiler-core/__tests__/transforms/vSlot.spec.ts

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { vi } from 'vitest'
21
import {
32
CompilerOptions,
43
baseParse as parse,

packages/compiler-core/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vue/compiler-core",
3-
"version": "3.3.0-alpha.9",
3+
"version": "3.3.4",
44
"description": "@vue/compiler-core",
55
"main": "index.js",
66
"module": "dist/compiler-core.esm-bundler.js",
@@ -33,9 +33,9 @@
3333
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-core#readme",
3434
"dependencies": {
3535
"@babel/parser": "^7.21.3",
36-
"@vue/shared": "3.3.0-alpha.9",
36+
"@vue/shared": "3.3.4",
3737
"estree-walker": "^2.0.2",
38-
"source-map": "^0.6.1"
38+
"source-map-js": "^1.0.2"
3939
},
4040
"devDependencies": {
4141
"@babel/types": "^7.21.3"

packages/compiler-core/src/babelUtils.ts

+1-38
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,7 @@ import type {
66
Function,
77
ObjectProperty,
88
BlockStatement,
9-
Program,
10-
ImportDefaultSpecifier,
11-
ImportNamespaceSpecifier,
12-
ImportSpecifier,
13-
CallExpression
9+
Program
1410
} from '@babel/types'
1511
import { walk } from 'estree-walker'
1612

@@ -247,17 +243,6 @@ export const isStaticProperty = (node: Node): node is ObjectProperty =>
247243
export const isStaticPropertyKey = (node: Node, parent: Node) =>
248244
isStaticProperty(parent) && parent.key === node
249245

250-
export function getImportedName(
251-
specifier: ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier
252-
) {
253-
if (specifier.type === 'ImportSpecifier')
254-
return specifier.imported.type === 'Identifier'
255-
? specifier.imported.name
256-
: specifier.imported.value
257-
else if (specifier.type === 'ImportNamespaceSpecifier') return '*'
258-
return 'default'
259-
}
260-
261246
/**
262247
* Copied from https://github.com/babel/babel/blob/main/packages/babel-types/src/validators/isReferenced.ts
263248
* To avoid runtime dependency on @babel/types (which includes process references)
@@ -443,25 +428,3 @@ export const TS_NODE_TYPES = [
443428
'TSInstantiationExpression', // foo<string>
444429
'TSSatisfiesExpression' // foo satisfies T
445430
]
446-
export function unwrapTSNode(node: Node): Node {
447-
if (TS_NODE_TYPES.includes(node.type)) {
448-
return unwrapTSNode((node as any).expression)
449-
} else {
450-
return node
451-
}
452-
}
453-
454-
export function isCallOf(
455-
node: Node | null | undefined,
456-
test: string | ((id: string) => boolean) | null | undefined
457-
): node is CallExpression {
458-
return !!(
459-
node &&
460-
test &&
461-
node.type === 'CallExpression' &&
462-
node.callee.type === 'Identifier' &&
463-
(typeof test === 'string'
464-
? node.callee.name === test
465-
: test(node.callee.name))
466-
)
467-
}

packages/compiler-core/src/codegen.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import {
2828
getVNodeBlockHelper,
2929
getVNodeHelper
3030
} from './ast'
31-
import { SourceMapGenerator, RawSourceMap } from 'source-map'
31+
import { SourceMapGenerator, RawSourceMap } from 'source-map-js'
3232
import {
3333
advancePositionWithMutation,
3434
assert,

packages/compiler-core/src/errors.ts

+8
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ export const enum ErrorCodes {
9797
X_CACHE_HANDLER_NOT_SUPPORTED,
9898
X_SCOPE_ID_NOT_SUPPORTED,
9999

100+
// deprecations
101+
DEPRECATION_VNODE_HOOKS,
102+
DEPRECATION_V_IS,
103+
100104
// Special value for higher-order compilers to pick up the last code
101105
// to avoid collision of error codes. This should always be kept as the last
102106
// item.
@@ -179,6 +183,10 @@ export const errorMessages: Record<ErrorCodes, string> = {
179183
[ErrorCodes.X_CACHE_HANDLER_NOT_SUPPORTED]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
180184
[ErrorCodes.X_SCOPE_ID_NOT_SUPPORTED]: `"scopeId" option is only supported in module mode.`,
181185

186+
// deprecations
187+
[ErrorCodes.DEPRECATION_VNODE_HOOKS]: `@vnode-* hooks in templates are deprecated. Use the vue: prefix instead. For example, @vnode-mounted should be changed to @vue:mounted. @vnode-* hooks support will be removed in 3.4.`,
188+
[ErrorCodes.DEPRECATION_V_IS]: `v-is="component-name" has been deprecated. Use is="vue:component-name" instead. v-is support will be removed in 3.4.`,
189+
182190
// just to fulfill types
183191
[ErrorCodes.__EXTEND_POINT__]: ``
184192
}

packages/compiler-core/src/parse.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,7 @@ function isComponent(
687687
}
688688
} else {
689689
// directive
690-
// v-is (TODO Deprecate)
690+
// v-is (TODO: remove in 3.4)
691691
if (p.name === 'is') {
692692
return true
693693
} else if (
@@ -817,7 +817,10 @@ function parseAttribute(
817817

818818
if (match[2]) {
819819
const isSlot = dirName === 'slot'
820-
const startOffset = name.lastIndexOf(match[2])
820+
const startOffset = name.lastIndexOf(
821+
match[2],
822+
name.length - (match[3]?.length || 0)
823+
)
821824
const loc = getSelection(
822825
context,
823826
getNewPosition(context, start, startOffset),

0 commit comments

Comments
 (0)