Skip to content

Commit f1a3c1b

Browse files
committed
Merge remote-tracking branch 'origin/main' into bwsy/feat/compilerSearchElm
# Conflicts: # packages/compiler-core/src/ast.ts # packages/compiler-core/src/codegen.ts # packages/compiler-core/src/transforms/transformElement.ts # packages/runtime-core/src/helpers/resolveAssets.ts # packages/runtime-core/src/index.ts
2 parents 2975dcd + d94d8d4 commit f1a3c1b

File tree

494 files changed

+18014
-14461
lines changed

Some content is hidden

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

494 files changed

+18014
-14461
lines changed

.eslintignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules
2+
dist
3+
temp
4+
coverage

.eslintrc.cjs

Lines changed: 55 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
/* eslint-disable no-restricted-globals */
2-
1+
const { builtinModules } = require('node:module')
32
const DOMGlobals = ['window', 'document']
43
const NodeGlobals = ['module', 'require']
54

65
const banConstEnum = {
76
selector: 'TSEnumDeclaration[const=true]',
87
message:
9-
'Please use non-const enums. This project automatically inlines enums.'
8+
'Please use non-const enums. This project automatically inlines enums.',
109
}
1110

1211
/**
@@ -15,9 +14,9 @@ const banConstEnum = {
1514
module.exports = {
1615
parser: '@typescript-eslint/parser',
1716
parserOptions: {
18-
sourceType: 'module'
17+
sourceType: 'module',
1918
},
20-
plugins: ['jest'],
19+
plugins: ['jest', 'import', '@typescript-eslint'],
2120
rules: {
2221
'no-debugger': 'error',
2322
// most of the codebase are expected to be env agnostic
@@ -32,8 +31,27 @@ module.exports = {
3231
// tsc compiles assignment spread into Object.assign() calls, but esbuild
3332
// still generates verbose helpers, so spread assignment is also prohiboted
3433
'ObjectExpression > SpreadElement',
35-
'AwaitExpression'
36-
]
34+
'AwaitExpression',
35+
],
36+
'sort-imports': ['error', { ignoreDeclarationSort: true }],
37+
38+
'import/no-nodejs-modules': [
39+
'error',
40+
{ allow: builtinModules.map(mod => `node:${mod}`) },
41+
],
42+
// This rule enforces the preference for using '@ts-expect-error' comments in TypeScript
43+
// code to indicate intentional type errors, improving code clarity and maintainability.
44+
'@typescript-eslint/prefer-ts-expect-error': 'error',
45+
// Enforce the use of 'import type' for importing types
46+
'@typescript-eslint/consistent-type-imports': [
47+
'error',
48+
{
49+
fixStyle: 'inline-type-imports',
50+
disallowTypeAnnotations: false,
51+
},
52+
],
53+
// Enforce the use of top-level import type qualifier when an import only has specifiers with inline type qualifiers
54+
'@typescript-eslint/no-import-type-side-effects': 'error',
3755
},
3856
overrides: [
3957
// tests, no restrictions (runs in Node / jest with jsdom)
@@ -43,54 +61,66 @@ module.exports = {
4361
'no-restricted-globals': 'off',
4462
'no-restricted-syntax': 'off',
4563
'jest/no-disabled-tests': 'error',
46-
'jest/no-focused-tests': 'error'
47-
}
64+
'jest/no-focused-tests': 'error',
65+
},
4866
},
4967
// shared, may be used in any env
5068
{
51-
files: ['packages/shared/**'],
69+
files: ['packages/shared/**', '.eslintrc.cjs'],
5270
rules: {
53-
'no-restricted-globals': 'off'
54-
}
71+
'no-restricted-globals': 'off',
72+
},
5573
},
5674
// Packages targeting DOM
5775
{
5876
files: ['packages/{vue,vue-compat,runtime-dom}/**'],
5977
rules: {
60-
'no-restricted-globals': ['error', ...NodeGlobals]
61-
}
78+
'no-restricted-globals': ['error', ...NodeGlobals],
79+
},
6280
},
6381
// Packages targeting Node
6482
{
6583
files: ['packages/{compiler-sfc,compiler-ssr,server-renderer}/**'],
6684
rules: {
6785
'no-restricted-globals': ['error', ...DOMGlobals],
68-
'no-restricted-syntax': ['error', banConstEnum]
69-
}
86+
'no-restricted-syntax': ['error', banConstEnum],
87+
},
7088
},
7189
// Private package, browser only + no syntax restrictions
7290
{
7391
files: ['packages/template-explorer/**', 'packages/sfc-playground/**'],
7492
rules: {
7593
'no-restricted-globals': ['error', ...NodeGlobals],
76-
'no-restricted-syntax': ['error', banConstEnum]
77-
}
94+
'no-restricted-syntax': ['error', banConstEnum],
95+
},
7896
},
7997
// JavaScript files
8098
{
8199
files: ['*.js', '*.cjs'],
82100
rules: {
83101
// We only do `no-unused-vars` checks for js files, TS files are checked by TypeScript itself.
84-
'no-unused-vars': ['error', { vars: 'all', args: 'none' }]
85-
}
102+
'no-unused-vars': ['error', { vars: 'all', args: 'none' }],
103+
},
86104
},
87105
// Node scripts
88106
{
89-
files: ['scripts/**', '*.{js,ts}', 'packages/**/index.js'],
107+
files: [
108+
'scripts/**',
109+
'./*.{js,ts}',
110+
'packages/*/*.js',
111+
'packages/vue/*/*.js',
112+
],
90113
rules: {
91114
'no-restricted-globals': 'off',
92-
'no-restricted-syntax': ['error', banConstEnum]
93-
}
94-
}
95-
]
115+
'no-restricted-syntax': ['error', banConstEnum],
116+
},
117+
},
118+
// Import nodejs modules in compiler-sfc
119+
{
120+
files: ['packages/compiler-sfc/src/**'],
121+
rules: {
122+
'import/no-nodejs-modules': ['error', { allow: builtinModules }],
123+
},
124+
},
125+
],
96126
}

.git-blame-ignore-revs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# update prettier & eslint config (#9162)
2+
bfe6b459d3a0ce6168611ee1ac7e6e789709df9d

.github/contributing.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ Hi! I'm really excited that you are interested in contributing to Vue.js. Before
6363

6464
You will need [Node.js](https://nodejs.org) **version 18.12+**, and [PNPM](https://pnpm.io) **version 8+**.
6565

66-
We also recommend installing [ni](https://github.com/antfu/ni) to help switching between repos using different package managers. `ni` also provides the handy `nr` command which running npm scripts easier.
66+
We also recommend installing [@antfu/ni](https://github.com/antfu/ni) to help switching between repos using different package managers. `ni` also provides the handy `nr` command which running npm scripts easier.
6767

6868
After cloning the repo, run:
6969

@@ -86,11 +86,11 @@ The project uses [simple-git-hooks](https://github.com/toplenboren/simple-git-ho
8686

8787
- Type check the entire project
8888
- Automatically format changed files using Prettier
89-
- Verify commit message format (logic in `scripts/verifyCommit.js`)
89+
- Verify commit message format (logic in `scripts/verify-commit.js`)
9090

9191
## Scripts
9292

93-
**The examples below will be using the `nr` command from the [ni](https://github.com/antfu/ni) package.** You can also use plain `npm run`, but you will need to pass all additional arguments after the command after an extra `--`. For example, `nr build runtime --all` is equivalent to `npm run build -- runtime --all`.
93+
**The examples below will be using the `nr` command from the [@antfu/ni](https://github.com/antfu/ni) package.** You can also use plain `npm run`, but you will need to pass all additional arguments after the command after an extra `--`. For example, `nr build runtime --all` is equivalent to `npm run build -- runtime --all`.
9494

9595
The `run-s` and `run-p` commands found in some scripts are from [npm-run-all](https://github.com/mysticatea/npm-run-all) for orchestrating multiple scripts. `run-s` means "run in sequence" while `run-p` means "run in parallel".
9696

.github/renovate.json5

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,35 +7,35 @@
77
packageRules: [
88
{
99
depTypeList: ['peerDependencies'],
10-
enabled: false
10+
enabled: false,
1111
},
1212
{
1313
groupName: 'test',
1414
matchPackageNames: ['vitest', 'jsdom', 'puppeteer'],
15-
matchPackagePrefixes: ['@vitest']
15+
matchPackagePrefixes: ['@vitest'],
1616
},
1717
{
1818
groupName: 'playground',
1919
matchFileNames: [
2020
'packages/sfc-playground/package.json',
21-
'packages/template-explorer/package.json'
22-
]
21+
'packages/template-explorer/package.json',
22+
],
2323
},
2424
{
2525
groupName: 'compiler',
2626
matchPackageNames: ['magic-string'],
27-
matchPackagePrefixes: ['@babel', 'postcss']
27+
matchPackagePrefixes: ['@babel', 'postcss'],
2828
},
2929
{
3030
groupName: 'build',
3131
matchPackageNames: ['vite', 'terser'],
32-
matchPackagePrefixes: ['rollup', 'esbuild', '@rollup', '@vitejs']
32+
matchPackagePrefixes: ['rollup', 'esbuild', '@rollup', '@vitejs'],
3333
},
3434
{
3535
groupName: 'lint',
3636
matchPackageNames: ['simple-git-hooks', 'lint-staged'],
37-
matchPackagePrefixes: ['@typescript-eslint', 'eslint', 'prettier']
38-
}
37+
matchPackagePrefixes: ['@typescript-eslint', 'eslint', 'prettier'],
38+
},
3939
],
4040
ignoreDeps: [
4141
'vue',
@@ -45,6 +45,6 @@
4545
'typescript',
4646

4747
// ESM only
48-
'estree-walker'
49-
]
48+
'estree-walker',
49+
],
5050
}

.github/workflows/autofix.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ jobs:
3030
- name: Run prettier
3131
run: pnpm run format
3232

33-
- uses: autofix-ci/action@bee19d72e71787c12ca0f29de72f2833e437e4c9
33+
- uses: autofix-ci/action@ea32e3a12414e6d3183163c3424a7d7a8631ad84

.github/workflows/ci.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ jobs:
8585
- name: Run e2e tests
8686
run: pnpm run test-e2e
8787

88+
- name: verify treeshaking
89+
run: node scripts/verify-treeshaking.js
90+
8891
lint-and-test-dts:
8992
runs-on: ubuntu-latest
9093
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
@@ -112,3 +115,28 @@ jobs:
112115

113116
- name: Run type declaration tests
114117
run: pnpm run test-dts
118+
119+
# benchmarks:
120+
# runs-on: ubuntu-latest
121+
# if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
122+
# env:
123+
# PUPPETEER_SKIP_DOWNLOAD: 'true'
124+
# steps:
125+
# - uses: actions/checkout@v4
126+
127+
# - name: Install pnpm
128+
# uses: pnpm/action-setup@v2
129+
130+
# - name: Install Node.js
131+
# uses: actions/setup-node@v4
132+
# with:
133+
# node-version-file: '.node-version'
134+
# cache: 'pnpm'
135+
136+
# - run: pnpm install
137+
138+
# - name: Run benchmarks
139+
# uses: CodSpeedHQ/action@v2
140+
# with:
141+
# run: pnpm vitest bench --run
142+
# token: ${{ secrets.CODSPEED_TOKEN }}

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
dist
2+
*.md
3+
*.html
4+
pnpm-lock.yaml

.prettierrc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
semi: false
2-
singleQuote: true
3-
printWidth: 80
4-
trailingComma: 'none'
5-
arrowParens: 'avoid'
1+
{
2+
"semi": false,
3+
"singleQuote": true,
4+
"arrowParens": "avoid"
5+
}

.vscode/launch.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"console": "integratedTerminal",
2222
"sourceMaps": true,
2323
"windows": {
24-
"program": "${workspaceFolder}/node_modules/jest/bin/jest",
24+
"program": "${workspaceFolder}/node_modules/jest/bin/jest"
2525
}
2626
}
2727
]

0 commit comments

Comments
 (0)