Skip to content

Commit d86ac57

Browse files
authored
Merge branch 'main' into fix/8969
2 parents 9008c77 + 1b56405 commit d86ac57

File tree

22 files changed

+469
-142
lines changed

22 files changed

+469
-142
lines changed

.eslintrc.cjs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,7 @@ module.exports = {
7474
},
7575
// Node scripts
7676
{
77-
files: [
78-
'scripts/**',
79-
'*.{js,ts}',
80-
'packages/**/index.js',
81-
'packages/size-check/**'
82-
],
77+
files: ['scripts/**', '*.{js,ts}', 'packages/**/index.js'],
8378
rules: {
8479
'no-restricted-globals': 'off',
8580
'no-restricted-syntax': 'off'

.github/contributing.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,6 @@ This repository employs a [monorepo](https://en.wikipedia.org/wiki/Monorepo) set
248248

249249
- `template-explorer`: A development tool for debugging compiler output, continuously deployed at https://template-explorer.vuejs.org/. To run it locally, run [`nr dev-compiler`](#nr-dev-compiler).
250250

251-
- `size-check`: Used for checking built bundle sizes on CI.
252-
253251
### Importing Packages
254252

255253
The packages can import each other directly using their package names. Note that when importing a package, the name listed in its `package.json` should be used. Most of the time the `@vue/` prefix is needed:

.github/workflows/ci.yml

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -109,28 +109,8 @@ jobs:
109109
- name: Run eslint
110110
run: pnpm run lint
111111

112-
# - name: Run prettier
113-
# run: pnpm run format-check
112+
- name: Run prettier
113+
run: pnpm run format-check
114114

115115
- name: Run type declaration tests
116116
run: pnpm run test-dts
117-
118-
size:
119-
runs-on: ubuntu-latest
120-
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
121-
env:
122-
CI_JOB_NUMBER: 1
123-
steps:
124-
- uses: actions/checkout@v3
125-
126-
- name: Install pnpm
127-
uses: pnpm/action-setup@v2
128-
129-
- name: Set node version to 18
130-
uses: actions/setup-node@v3
131-
with:
132-
node-version: 18
133-
cache: 'pnpm'
134-
135-
- run: PUPPETEER_SKIP_DOWNLOAD=1 pnpm install
136-
- run: pnpm run size

.github/workflows/size-report.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: size report
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: read
10+
pull-requests: write
11+
12+
jobs:
13+
size:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v3
18+
19+
- name: Install pnpm
20+
uses: pnpm/action-setup@v2
21+
22+
- name: Set node version to LTS
23+
uses: actions/setup-node@v3
24+
with:
25+
node-version: lts/*
26+
cache: pnpm
27+
28+
- run: PUPPETEER_SKIP_DOWNLOAD=1 pnpm install
29+
- run: pnpm run size
30+
31+
- name: Download Previous Size Report
32+
id: download-artifact
33+
uses: dawidd6/action-download-artifact@v2
34+
with:
35+
branch: main
36+
name: size-report
37+
path: temp/size-prev
38+
if_no_artifact_found: warn
39+
40+
- name: Upload Size Report
41+
uses: actions/upload-artifact@v3
42+
with:
43+
name: size-report
44+
path: temp/size
45+
46+
- name: Compare size
47+
run: pnpm tsx scripts/size-report.ts > size.md
48+
49+
- name: Read Size Markdown
50+
id: size-markdown
51+
uses: juliangruber/read-file-action@v1
52+
with:
53+
path: ./size.md
54+
55+
- name: Create Comment
56+
uses: actions-cool/maintain-one-comment@v3
57+
with:
58+
body: |
59+
${{steps.size-markdown.outputs.content}}
60+
<!-- VUE_CORE_SIZE -->
61+
body-include: '<!-- VUE_CORE_SIZE -->'

package.json

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@
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-
"size": "run-s size-global size-baseline",
11-
"size-global": "node scripts/build.js vue runtime-dom -f global -p",
12-
"size-baseline": "node scripts/build.js vue -f esm-bundler-runtime && node scripts/build.js runtime-dom runtime-core reactivity shared -f esm-bundler && cd packages/size-check && vite build && node brotli",
10+
"size": "run-s \"size-*\" && tsx scripts/usage-size.ts",
11+
"size-global": "node scripts/build.js vue runtime-dom -f global -p --size",
12+
"size-esm-runtime": "node scripts/build.js vue -f esm-bundler-runtime",
13+
"size-esm": "node scripts/build.js runtime-dom runtime-core reactivity shared -f esm-bundler",
1314
"check": "tsc --incremental --noEmit",
1415
"lint": "eslint --cache --ext .ts packages/*/{src,__tests__}/**.ts",
15-
"format": "prettier --write --cache --parser typescript \"**/*.[tj]s?(x)\"",
16-
"format-check": "prettier --check --cache --parser typescript \"**/*.[tj]s?(x)\"",
16+
"format": "prettier --write --cache \"**/*.[tj]s?(x)\"",
17+
"format-check": "prettier --check --cache \"**/*.[tj]s?(x)\"",
1718
"test": "vitest",
1819
"test-unit": "vitest -c vitest.unit.config.ts",
1920
"test-e2e": "node scripts/build.js vue -f global -d && vitest -c vitest.e2e.config.ts",
@@ -81,10 +82,12 @@
8182
"lint-staged": "^10.2.10",
8283
"lodash": "^4.17.15",
8384
"magic-string": "^0.30.0",
85+
"markdown-table": "^3.0.3",
8486
"marked": "^4.0.10",
8587
"minimist": "^1.2.0",
8688
"npm-run-all": "^4.1.5",
87-
"prettier": "^2.7.1",
89+
"prettier": "^3.0.1",
90+
"pretty-bytes": "^6.1.1",
8891
"pug": "^3.0.1",
8992
"puppeteer": "~19.6.0",
9093
"rollup": "^3.26.0",
@@ -94,9 +97,10 @@
9497
"semver": "^7.3.2",
9598
"serve": "^12.0.0",
9699
"simple-git-hooks": "^2.8.1",
97-
"terser": "^5.15.1",
100+
"terser": "^5.19.2",
98101
"todomvc-app-css": "^2.3.0",
99102
"tslib": "^2.5.0",
103+
"tsx": "^3.12.7",
100104
"typescript": "^5.1.6",
101105
"vite": "^4.3.0",
102106
"vitest": "^0.30.1"

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,11 @@ function resolveTemplateUsageCheckString(sfc: SFCDescriptor) {
6363
)}`
6464
}
6565
}
66-
if (prop.type === NodeTypes.ATTRIBUTE && prop.name === 'ref' && prop.value?.content) {
66+
if (
67+
prop.type === NodeTypes.ATTRIBUTE &&
68+
prop.name === 'ref' &&
69+
prop.value?.content
70+
) {
6771
code += `,${prop.value.content}`
6872
}
6973
}

packages/dts-test/setupHelpers.test-d.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ describe('defineProps w/ union type declaration + withDefaults', () => {
100100
)
101101
})
102102

103-
describe('defineProps w/ generic type declaration + withDefaults', <T extends number, TA extends {
103+
describe('defineProps w/ generic type declaration + withDefaults', <T extends
104+
number, TA extends {
104105
a: string
105106
}, TString extends string>() => {
106107
const res = withDefaults(
@@ -117,10 +118,10 @@ describe('defineProps w/ generic type declaration + withDefaults', <T extends nu
117118
n: 123,
118119

119120
generic1: () => [123, 33] as T[],
120-
generic2: () => ({ x: 123 } as { x: T }),
121+
generic2: () => ({ x: 123 }) as { x: T },
121122

122123
generic3: () => 'test' as TString,
123-
generic4: () => ({ a: 'test' } as TA)
124+
generic4: () => ({ a: 'test' }) as TA
124125
}
125126
)
126127

packages/reactivity/src/ref.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,10 @@ class RefImpl<T> {
138138
public dep?: Dep = undefined
139139
public readonly __v_isRef = true
140140

141-
constructor(value: T, public readonly __v_isShallow: boolean) {
141+
constructor(
142+
value: T,
143+
public readonly __v_isShallow: boolean
144+
) {
142145
this._rawValue = __v_isShallow ? value : toRaw(value)
143146
this._value = __v_isShallow ? value : toReactive(value)
144147
}

packages/runtime-core/__tests__/apiOptions.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ describe('api: options', () => {
382382
render() {
383383
return this[injectedKey]
384384
}
385-
} as any)
385+
}) as any
386386

387387
const ChildA = defineChild(['a'], 'a')
388388
const ChildB = defineChild({ b: 'a' })

packages/runtime-core/__tests__/rendererTemplateRef.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ describe('api: template refs', () => {
116116
const toggle = ref(true)
117117

118118
const Comp = defineComponent(
119-
() => () => toggle.value ? h('div', { ref: fn }) : null
119+
() => () => (toggle.value ? h('div', { ref: fn }) : null)
120120
)
121121
render(h(Comp), root)
122122
expect(fn.mock.calls[0][0]).toBe(root.children[0])

packages/runtime-core/src/components/Teleport.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ function hydrateTeleport(
400400
// Force-casted public typing for h and TSX props inference
401401
export const Teleport = TeleportImpl as unknown as {
402402
__isTeleport: true
403-
new(): {
403+
new (): {
404404
$props: VNodeProps & TeleportProps
405405
$slots: {
406406
default(): VNode[]

packages/size-check/README.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

packages/size-check/brotli.js

Lines changed: 0 additions & 6 deletions
This file was deleted.

packages/size-check/package.json

Lines changed: 0 additions & 11 deletions
This file was deleted.

packages/size-check/src/index.ts

Lines changed: 0 additions & 6 deletions
This file was deleted.

packages/size-check/vite.config.js

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)