Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(runtime-core): #7203 - adds support for custom element hydration #7300

Closed
wants to merge 183 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
183 commits
Select commit Hold shift + click to select a range
d445b31
fix(runtime-core): #7203 - adds support for custom element hydration
steveworkman Dec 8, 2022
3ccd929
chore(runtime-core): removed console.log from unit test
steveworkman Dec 8, 2022
510abf9
Merge remote-tracking branch 'origin/main' into feat/7203-custom-elem…
steveworkman Jan 12, 2023
81587b3
fix(runtime-core): registered custom elements should have all properi…
steveworkman Jan 12, 2023
6584906
test: removed changes to unrelated test
steveworkman Jan 12, 2023
95d92b3
fix: added isCustomElement check for patching in production
steveworkman Jan 13, 2023
277f198
chore: run format
antfu Jan 12, 2023
0e314ee
chore: apply format
antfu Jan 12, 2023
2070d17
fix(shared): `feDistanceLight` changed to `feDistantLight` (#7540)
baiwusanyu-c Jan 16, 2023
6a27b80
fix(build): ensure cjs re-exports can be properly detected when impor…
yyx990803 Jan 20, 2023
1431554
fix(build): fix cjs re-exports check for compat build
yyx990803 Jan 21, 2023
f3bcf00
chore: bump vite and esbuild
yyx990803 Jan 26, 2023
591088f
build: update build scripts to esm
yyx990803 Jan 26, 2023
88b6c92
wip(vitest-migration): reactivity tests passing
yyx990803 Jan 26, 2023
ba02d6e
wip(vitest-migration): shared tests passing
yyx990803 Jan 26, 2023
906d0eb
build: fix build script
yyx990803 Jan 26, 2023
8a795e5
wip(vitest-migration): ssr tests passing
yyx990803 Jan 26, 2023
834b1bb
wip(vitest-migration): compiler-core tests passing
yyx990803 Jan 26, 2023
959aa9f
wip(vitest-migration): compiler-dom tests passing
yyx990803 Jan 26, 2023
53ac665
wip(vitest-migration): compiler-sfc tests passing
yyx990803 Jan 26, 2023
6689aef
wip(vitest-migration): compiler-ssr tests passing
yyx990803 Jan 26, 2023
1bcb239
wip(vitest-migration): compat tests passing
yyx990803 Jan 26, 2023
3480d4b
wip(vitest-migration): runtime-core tests passing
yyx990803 Jan 26, 2023
ec015f1
chore: only wrap during tests
yyx990803 Jan 26, 2023
a628079
wip(vitest-migration): runtime-dom tests passing + use environmentMat…
yyx990803 Jan 26, 2023
3a24538
wip(vitest-migration): all tests passing
yyx990803 Jan 26, 2023
8dce248
workflow: complete migration from jest to vitest
yyx990803 Jan 26, 2023
657b5a3
chore: replace test global types with vitest types
yyx990803 Jan 26, 2023
5542380
chore: explicitly install jsdom
yyx990803 Jan 26, 2023
afd9a00
ci: fix dts tests
yyx990803 Jan 26, 2023
7687d82
test: configure test hooks sequence order, remove workaround
yyx990803 Jan 27, 2023
df1cfd1
chore: fix broken link (#7589)
vaakian Jan 27, 2023
1f393c4
build: do not throw when running `build --release` for the 1st time (…
haoqunjiang Jan 27, 2023
0b2fe2e
chore: remove debugging log
sxzz Jan 29, 2023
f485765
chore: remove unused import
yyx990803 Jan 30, 2023
16684ec
fix(build): ensure type exports is first
yyx990803 Feb 1, 2023
f8ffe58
test: fix await patch prop case (#7600)
sxzz Feb 1, 2023
a6b4821
chore: update caniuse
yyx990803 Feb 1, 2023
427e1b6
ci: bump netlify node version
yyx990803 Feb 1, 2023
94c0ba7
fix(types): accept sync `serverPrefetch()` (#7000)
antfu Feb 1, 2023
a582afe
fix(reactivity): `triggerRef` working with `toRef` from reactive (#7507)
antfu Feb 1, 2023
2ea880c
fix(compat): fix custom transition classes in compat mode (#7435)
SxDx Feb 1, 2023
b13c051
chore: fix jest reference in merged test case
yyx990803 Feb 1, 2023
b449ea0
fix(runtime-core): fix keep-alive cache prune logic on vnodes with sa…
GRPdream Feb 1, 2023
1765323
fix(compiler-sfc): support resolving type declaration from normal scr…
edison1105 Feb 1, 2023
2a61107
fix(types): optional boolean props should have boolean type in return…
sxzz Feb 2, 2023
6d1a482
workflow: check ci status during release
yyx990803 Feb 2, 2023
45dc8f7
release: v3.2.46
yyx990803 Feb 2, 2023
73e426a
fix(build): enforce __esModule interop for cjs builds
yyx990803 Feb 2, 2023
d47a1b2
release: v3.2.47
yyx990803 Feb 2, 2023
a75d185
chore: fix types
yyx990803 Feb 2, 2023
0f62bdb
chore: fix size reporting for brotli
yyx990803 Feb 2, 2023
53c83c1
fix(build): ensure BaseTransition functions can be tree-shaken
yyx990803 Feb 2, 2023
040ede5
chore: define compile time flags during size check
yyx990803 Feb 2, 2023
2836dcc
workflow: disable threads during tests
yyx990803 Feb 2, 2023
92f2cf0
build: only enable esModule compat for cjs builds
yyx990803 Feb 2, 2023
65dd0c5
wip: isolatedModules + use rollup-plugin-esbuild
yyx990803 Feb 2, 2023
7bd9e7b
chore: remove rpts2
yyx990803 Feb 2, 2023
ceb5f37
workflow: type check on commit
yyx990803 Feb 2, 2023
929407d
chore: remove hanging slash from import
yyx990803 Feb 2, 2023
ed672eb
build: refactor rollup config
yyx990803 Feb 2, 2023
710ae60
chore: bump deps
yyx990803 Feb 2, 2023
9c3c09b
build: custom const enum processing
yyx990803 Feb 3, 2023
0ef6bfd
build: use rollup-plugin-dts for dts build
yyx990803 Feb 3, 2023
73e3a2b
build: remove api-extractor
yyx990803 Feb 3, 2023
458f790
build: fix handling of const enum that rely on previous values
yyx990803 Feb 3, 2023
3271d73
ci: try puppeteer fix
yyx990803 Feb 3, 2023
943c336
build: adjust dts test setup
yyx990803 Feb 3, 2023
7197852
build: fix size check
yyx990803 Feb 3, 2023
970af3d
docs: update contributing guide
yyx990803 Feb 3, 2023
27c67e3
ci: avoid netlify oom
yyx990803 Feb 3, 2023
3b261e6
docs: document git hooks [ci skip]
yyx990803 Feb 3, 2023
bcc60e4
chore: use type: "module"
yyx990803 Feb 3, 2023
9be9909
chore: update packageManager field
yyx990803 Feb 3, 2023
feefb95
chore: use consistent ts-check comments in scripts
yyx990803 Feb 3, 2023
f103666
build: stricter conditions for UnaryExpression in const enum plugin
yyx990803 Feb 3, 2023
c2922ef
test: more strict linking in dts tests
yyx990803 Feb 3, 2023
da2c8d6
chore: use workspace vue dep for sfc-playground
yyx990803 Feb 3, 2023
a8a60a8
build: improve dts rollup output
yyx990803 Feb 4, 2023
0251d3e
release: v3.3.0-alpha.1
yyx990803 Feb 5, 2023
3ed730f
fix(build): fix dev flag replacement in esm-bundler builds
yyx990803 Feb 5, 2023
883dad2
chore: avoid double-building types on release
yyx990803 Feb 5, 2023
91d6f25
release: v3.3.0-alpha.2
yyx990803 Feb 5, 2023
59942f3
chore: catch unhandled export as just in case
yyx990803 Feb 6, 2023
d61f9c3
build: reuse const enum data between concurrent rollup builds
yyx990803 Feb 6, 2023
3dc6ca1
fix(build): avoid const enum conflicts
yyx990803 Feb 6, 2023
0e1351d
build: fix const enum when cache dir does not exist
yyx990803 Feb 6, 2023
06b4f19
release: v3.3.0-alpha.3
yyx990803 Feb 6, 2023
973465b
fix(build): fix const enum w/ number values
yyx990803 Feb 6, 2023
31fe690
release: v3.3.0-alpha.4
yyx990803 Feb 6, 2023
e2febe2
ci: add a ecosystem-ci-trigger workflow (#7618)
haoqunjiang Feb 10, 2023
074affa
chore: fix typo (#7680)
Alfred-Skyblue Feb 11, 2023
1644387
refactor(runtime-core): use Symbol.for for runtime Symbols
yyx990803 Feb 21, 2023
9b02e7b
chore: bump vitest + use threads
yyx990803 Feb 21, 2023
35d0ea8
fix(runtime-core): support `getCurrentInstance` across mutiple builds…
yyx990803 Feb 21, 2023
1bdbf2e
chore: remove warnings due to potential false-positives
yyx990803 Feb 21, 2023
6e0e5ec
ci: only disable threads for gh
yyx990803 Feb 21, 2023
88c0b04
ci: release canary versions every week (#7860)
haoqunjiang Mar 17, 2023
572c26b
build: fix canary bundling issues (#7907)
haoqunjiang Mar 17, 2023
427c286
refactor: remove circular dependencies in compiler
yyx990803 Mar 23, 2023
c636f81
build: bump rollup, remove cjs re-exports hack
yyx990803 Mar 23, 2023
318c2e8
chore: bump vite & vitest
yyx990803 Mar 23, 2023
622a794
build: upgrade to TypeScript 5.x
yyx990803 Mar 23, 2023
f173fc3
feat(dx): improve readability of displayed types for props
yyx990803 Mar 24, 2023
e911941
test: improve test case on `$el` (#7922)
himself65 Mar 25, 2023
7bca739
chore: add redirect for template explorer
yyx990803 Mar 26, 2023
71e31e3
fix(types): ensure defineProps with generics return correct types
yyx990803 Mar 26, 2023
83bf6af
chore: allow editing changelog before committing release
yyx990803 Mar 26, 2023
ce3f597
feat(types/jsx): support jsxImportSource, avoid global JSX conflict (…
yyx990803 Mar 26, 2023
9ca94fe
release: v3.3.0-alpha.5
yyx990803 Mar 26, 2023
dbe324a
fix(types/jsx): remove $slots children override
yyx990803 Mar 26, 2023
967afb3
chore: fix type
yyx990803 Mar 27, 2023
5154061
feat(types): `defineComponent()` with generics support (#7963)
yyx990803 Mar 27, 2023
3db4079
ci: avoid duplicated ci runs on self-repo pull requests
yyx990803 Mar 27, 2023
b5ff9a6
feat(sfc): deprecate reactivity transform
yyx990803 Mar 27, 2023
724a8e1
test: add test for defineComponent function syntax with object emits
yyx990803 Mar 28, 2023
4ff561f
build: don't wait for changelog edits when `--skip-prompts` or `--can…
haoqunjiang Mar 28, 2023
5ed39ab
build: exit with code 1 on release failure (#7962)
haoqunjiang Mar 28, 2023
92d7cb2
chore(deps): upgrade rollup & magic-string (#7326)
sxzz Mar 28, 2023
977232f
chore: remove unused deps
yyx990803 Mar 28, 2023
54b7f1b
chore: eslint node env should apply to root ts config files (#7687)
sxzz Mar 28, 2023
e793517
feat(compiler-sfc): add defineOptions macro (#5738)
sxzz Mar 28, 2023
bd84df4
fix(jsx-runtime): fix automatic runtime implementation (#7959)
remcohaszing Mar 28, 2023
d3fa878
fix(types): revert jsx global removal (to be removed in 3.4)
yyx990803 Mar 28, 2023
a502d7a
feat(complier-sfc): hoist literal constants for script (#5752)
sxzz Mar 28, 2023
199e313
fix(compiler-sfc): rewrite default export with AST analysis instead o…
sxzz Mar 28, 2023
2df2243
fix(compiler-sfc): infer function prop type from type literal w/ call…
sxzz Mar 28, 2023
3f8e1c3
fix(compiler-sfc): infer TS Extract&Exclude runtime type (#7339)
sxzz Mar 28, 2023
aa17992
fix(compiler-sfc): unwrap TS node for defineProps (#7340)
sxzz Mar 28, 2023
7ae4f2a
fix(compiler-sfc): infer TSIntersectionType in defineProps (#7394)
sxzz Mar 28, 2023
690a437
fix(compiler-sfc): handle more TS built-in utilities in defineProps i…
yyx990803 Mar 28, 2023
6b75125
fix(compiler-sfc): allow `<script>` with lang='js' (#7398)
sxzz Mar 28, 2023
0b9f820
fix(compiler-sfc): properly remove comma of multiple macros in the sa…
sxzz Mar 28, 2023
087dac0
fix(compiler-sfc): fix edge case of default export call with no args …
sxzz Mar 28, 2023
af06907
feat(compiler-sfc): support module string names syntax (#7428)
sxzz Mar 28, 2023
81e7cdb
fix(compiler-sfc): infer correct type for enums
yyx990803 Mar 28, 2023
f883df4
Revert "fix(compiler-sfc): infer correct type for enums"
yyx990803 Mar 28, 2023
dd09b4a
fix(compiler-sfc): properly handle unknown types in runtime prop infe…
yyx990803 Mar 28, 2023
830936a
feat(compiler-sfc): improve runtime props inference for enum
yyx990803 Mar 28, 2023
384ad47
feat(compiler-core): support parsing `const` modifier in type paramet…
sxzz Mar 28, 2023
5356663
fix(compiler-sfc): disallow `expose` property in `defineOptions` (#7967)
sxzz Mar 28, 2023
36da03b
fix(compiler-sfc): avoid codegen conflict with user variable named `e…
sxzz Mar 28, 2023
532be19
chore: update snapshots
yyx990803 Mar 28, 2023
bb2c98f
fix(compiler-sfc): use prependLeft to handle CSSVars (#7760)
baiwusanyu-c Mar 28, 2023
5502738
chore: update snapshots by #7766 (#7970)
baiwusanyu-c Mar 28, 2023
376ce19
chore: fix accidentally replaced comments [ci skip]
yyx990803 Mar 28, 2023
935609a
feat(runtime-core): add skipCheck for prop (#7548)
sxzz Mar 28, 2023
a166f25
fix(compiler-core): check if expression is constant (#7974)
sxzz Mar 29, 2023
c653a2d
fix(types/jsx): jsx-runtime types for global JSX namespace registrati…
haoqunjiang Mar 29, 2023
e843f99
fix(jsx-runtime): handle keys (#7976)
leopiccionia Mar 29, 2023
8525f8c
fix(types/jsx): move JSX DOM types back to `@vue/runtime-dom` (#7979)
haoqunjiang Mar 29, 2023
30f48fb
fix(compiler-sfc): fix defineExpose() codegen regression from #7949
yyx990803 Mar 29, 2023
45cb38f
fix(compiler-sfc): infer object type for empty type literal
yyx990803 Mar 29, 2023
72a5cef
fix(compiler-sfc): fix function default value handling w/ props destr…
yyx990803 Mar 29, 2023
38b15c0
feat(compiler-sfc): enable reactive props destructure by default and …
yyx990803 Mar 30, 2023
ae6c6b1
fix(compiler-sfc): infer runtime type in defineProps (#7972)
sxzz Mar 30, 2023
0d3ca0a
fix(compiler-core): fix codegen for literal const in non-inline mode
yyx990803 Mar 30, 2023
8143d84
feat(compiler-sfc): support generating variable instead of default ex…
yyx990803 Mar 30, 2023
63f3b12
build: improve dts generation
yyx990803 Mar 30, 2023
60c449b
chore: bump csstype version
yyx990803 Mar 30, 2023
b70f327
release: v3.3.0-alpha.6
yyx990803 Mar 30, 2023
0d3c75e
feat(sfc): support more ergnomic defineEmits type syntax (#7992)
yyx990803 Mar 30, 2023
d07d59f
feat(compiler-sfc): codegen support for defineEmits() short syntax (f…
yyx990803 Mar 30, 2023
f009170
refactor(compiler-sfc): remove unnecessary emits type codegen
yyx990803 Mar 30, 2023
fafa759
feat(sfc): revert withDefaults() deprecation
yyx990803 Mar 31, 2023
d9f7928
chore: remove unused param
yyx990803 Mar 31, 2023
6d665e3
feat(compiler-sfc): support arbitrary expression as withDefaults argu…
yyx990803 Mar 31, 2023
ea62511
fix(compiler-sfc): use dynamic defaults merging for methods with comp…
yyx990803 Mar 31, 2023
a22ff97
fix(compiler-dom): handle newlines when evaluating constants during s…
baiwusanyu-c Mar 31, 2023
4425409
docs: comments on reactivity functions (fixes #4832) (#4836)
defaude Mar 31, 2023
6cfd7b1
chore: add docs links for sfc macros
yyx990803 Apr 2, 2023
62a2b31
feat(reactivity): improve support of getter usage in reactivity APIs …
yyx990803 Apr 2, 2023
dc866cb
feat(types/slots): support slot presence / props type checks via `def…
sxzz Apr 3, 2023
cd5886d
release: v3.3.0-alpha.7
yyx990803 Apr 3, 2023
9aa7e55
fix(compiler-sfc): check binding is prop before erroring
yyx990803 Apr 4, 2023
00ef259
chore: add setupVitest to tsconfig (#8009)
JayFate Apr 4, 2023
4313480
chore: remove duplicate test (#8003)
wsypower Apr 4, 2023
cfeee77
release: v3.3.0-alpha.8
yyx990803 Apr 4, 2023
bf8282f
fix(compiler-ssr): disable v-once transform in ssr vdom fallback branch
yyx990803 Apr 5, 2023
c89fdf6
chore: remove unused args passed to ssrRender
yyx990803 Apr 5, 2023
b547ff3
feat(app): app.runWithContext() (#7451)
posva Apr 5, 2023
2ae405e
refactor(compiler-sfc): move related files into separate directories
yyx990803 Apr 5, 2023
5feb3dd
fix(types): improve defineProps return type with generic arguments
yyx990803 Apr 5, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
21 changes: 14 additions & 7 deletions .eslintrc.js → .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = {
parserOptions: {
sourceType: 'module'
},
plugins: ["jest"],
plugins: ['jest'],
rules: {
'no-debugger': 'error',
'no-unused-vars': [
Expand All @@ -17,20 +17,22 @@ module.exports = {
],
// most of the codebase are expected to be env agnostic
'no-restricted-globals': ['error', ...DOMGlobals, ...NodeGlobals],
// since we target ES2015 for baseline support, we need to forbid object
// rest spread usage in destructure as it compiles into a verbose helper.
// TS now compiles assignment spread into Object.assign() calls so that
// is allowed.

'no-restricted-syntax': [
'error',
// since we target ES2015 for baseline support, we need to forbid object
// rest spread usage in destructure as it compiles into a verbose helper.
'ObjectPattern > RestElement',
// tsc compiles assignment spread into Object.assign() calls, but esbuild
// still generates verbose helpers, so spread assignment is also prohiboted
'ObjectExpression > SpreadElement',
'AwaitExpression'
]
},
overrides: [
// tests, no restrictions (runs in Node / jest with jsdom)
{
files: ['**/__tests__/**', 'test-dts/**'],
files: ['**/__tests__/**', 'packages/dts-test/**'],
rules: {
'no-restricted-globals': 'off',
'no-restricted-syntax': 'off',
Expand Down Expand Up @@ -72,7 +74,12 @@ module.exports = {
},
// Node scripts
{
files: ['scripts/**', './*.js', 'packages/**/index.js', 'packages/size-check/**'],
files: [
'scripts/**',
'*.{js,ts}',
'packages/**/index.js',
'packages/size-check/**'
],
rules: {
'no-restricted-globals': 'off',
'no-restricted-syntax': 'off'
Expand Down
81 changes: 57 additions & 24 deletions .github/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Hi! I'm really excited that you are interested in contributing to Vue.js. Before

- If you are resolving a special issue, add `(fix #xxxx[,#xxxx])` (#xxxx is the issue id) in your PR title for a better release log, e.g. `update entities encoding/decoding (fix #3899)`.
- Provide a detailed description of the bug in the PR. Live demo preferred.
- Add appropriate test coverage if applicable. You can check the coverage of your code addition by running `npm test -- --coverage`.
- Add appropriate test coverage if applicable. You can check the coverage of your code addition by running `nr test-coverage`.

- It's OK to have multiple small commits as you work on the PR - GitHub can automatically squash them before merging.

Expand Down Expand Up @@ -70,16 +70,36 @@ $ pnpm i # install the dependencies of the project
A high level overview of tools used:

- [TypeScript](https://www.typescriptlang.org/) as the development language
- [Rollup](https://rollupjs.org) for bundling
- [Jest](https://jestjs.io/) for unit testing
- [Vite](https://vitejs.dev/) and [ESBuild](https://esbuild.github.io/) for development bundling
- [Rollup](https://rollupjs.org) for production bundling
- [Vitest](https://vitest.dev/) for unit testing
- [Prettier](https://prettier.io/) for code formatting
- [ESLint](https://eslint.org/) for static error prevention (outside of types)

## Git Hooks

The project uses [simple-git-hooks](https://github.com/toplenboren/simple-git-hooks) to enforce the following on each commit:

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

## Scripts

**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`.

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".

- [`nr build`](#nr-build)
- [`nr build-dts`](#nr-build-dts)
- [`nr check`](#nr-check)
- [`nr dev`](#nr-dev)
- [`nr dev-sfc`](#nr-dev-sfc)
- [`nr dev-esm`](#nr-dev-esm)
- [`nr dev-compiler`](#nr-dev-compiler)
- [`nr test`](#nr-test)
- [`nr test-dts`](#nr-test-dts)

### `nr build`

The `build` script builds all public packages (packages without `private: true` in their `package.json`).
Expand All @@ -94,6 +114,8 @@ nr build runtime-core
nr build runtime --all
```

Note that `nr build` uses `rollup-plugin-esbuild` for transpiling typescript and **does not perform type checking**. To run type check on the entire codebase, run `nr check`. Type checks are also automatically run on each commit.

#### Build Formats

By default, each package will be built in multiple distribution formats as specified in the `buildOptions.formats` field in its `package.json`. These can be overwritten via the `-f` flag. The following formats are supported:
Expand Down Expand Up @@ -127,13 +149,11 @@ nr build runtime-core -f esm-browser,cjs

Use the `--sourcemap` or `-s` flag to build with source maps. Note this will make the build much slower.

#### Build with Type Declarations
### `nr build-dts`

The `--types` or `-t` flag will generate type declarations during the build and in addition:
This command builds the type declarations for all packages. It first generates the raw `.d.ts` files in the `temp` directory, then uses [rollup-plugin-dts](https://github.com/Swatinem/rollup-plugin-dts) to roll the types into a single `.d.ts` file for each package.

- Roll the declarations into a single `.d.ts` file for each package;
- Generate an API report in `<projectRoot>/temp/<packageName>.api.md`. This report contains potential warnings emitted by [api-extractor](https://api-extractor.com/).
- Generate an API model json in `<projectRoot>/temp/<packageName>.api.json`. This file can be used to generate a Markdown version of the exported APIs.
### `nr check`

### `nr dev`

Expand All @@ -142,7 +162,7 @@ The `dev` script bundles a target package (default: `vue`) in a specified format
```bash
$ nr dev

> watching: packages/vue/dist/vue.global.js
> built: packages/vue/dist/vue.global.js
```

- **Important:** output of the `dev` script is for development and debugging only. While it has the same runtime behavior, the generated code should never be published to npm.
Expand All @@ -169,23 +189,30 @@ The `dev-compiler` script builds, watches and serves the [Template Explorer](htt

### `nr test`

The `test` script simply calls the `jest` binary, so all [Jest CLI Options](https://jestjs.io/docs/en/cli) can be used. Some examples:
The `test` script simply calls the `vitest` binary, so all [Vitest CLI Options](https://vitest.dev/guide/cli.html#options) can be used. Some examples:

```bash
# run all tests
# run all tests in watch mode
$ nr test

# run once and exit (equivalent to `vitest run`)
$ nr test run

# run all tests under the runtime-core package
$ nr test runtime-core

# run tests in a specific file
$ nr test fileName
# run tests in files matching the pattern
$ nr test <fileNamePattern>

# run a specific test in a specific file
$ nr test fileName -t 'test name'
# run a specific test in specific files
$ nr test <fileNamePattern> -t 'test name'
```

The default `test` script includes the `--runInBand` jest flag to improve test stability, especially for the CSS transition related tests. When you are testing specific test specs, you can also run `npx jest` with flags directly to speed up tests (jest runs them in parallel by default).
Tests that test against source code are grouped under `nr test-unit`, while tests that test against built files that run in real browsers are grouped under `nr test-e2e`.

### `nr test-dts`

Runs `nr build-dts` first, then verify the type tests in `packages/dts-test` are working correctly against the actual built type declarations.

## Project Structure

Expand All @@ -209,14 +236,20 @@ This repository employs a [monorepo](https://en.wikipedia.org/wiki/Monorepo) set

- `compiler-ssr`: Compiler that produces render functions optimized for server-side rendering.

- `template-explorer`: A development tool for debugging compiler output. You can run `nr dev template-explorer` and open its `index.html` to get a repl of template compilation based on current source code.

A [live version](https://vue-next-template-explorer.netlify.com) of the template explorer is also available, which can be used for providing reproductions for compiler bugs. You can also pick the deployment for a specific commit from the [deploy logs](https://app.netlify.com/sites/vue-next-template-explorer/deploys).

- `shared`: Internal utilities shared across multiple packages (especially environment-agnostic utils used by both runtime and compiler packages).

- `vue`: The public facing "full build" which includes both the runtime AND the compiler.

- Private utility packages:

- `dts-test`: Contains type-only tests against generated dts files.

- `sfc-playground`: The playground continuously deployed at https://sfc.vuejs.org. To run the playground locally, use [`nr dev-sfc`](#nr-dev-sfc).

- `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).

- `size-check`: Used for checking built bundle sizes on CI.

### Importing Packages

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:
Expand All @@ -228,7 +261,7 @@ import { h } from '@vue/runtime-core'
This is made possible via several configurations:

- For TypeScript, `compilerOptions.paths` in `tsconfig.json`
- For Jest, `moduleNameMapper` in `jest.config.js`
- Vitest and Rollup share the sae set of aliases from `scripts/aliases.js`
- For plain Node.js, they are linked using [PNPM Workspaces](https://pnpm.io/workspaces).

### Package Dependencies
Expand Down Expand Up @@ -268,19 +301,19 @@ There are some rules to follow when importing across package boundaries:

## Contributing Tests

Unit tests are collocated with the code being tested in each package, inside directories named `__tests__`. Consult the [Jest docs](https://jestjs.io/docs/en/using-matchers) and existing test cases for how to write new test specs. Here are some additional guidelines:
Unit tests are collocated with the code being tested in each package, inside directories named `__tests__`. Consult the [Vitest docs](https://vitest.dev/api/) and existing test cases for how to write new test specs. Here are some additional guidelines:

- Use the minimal API needed for a test case. For example, if a test can be written without involving the reactivity system or a component, it should be written so. This limits the test's exposure to changes in unrelated parts and makes it more stable.

- If testing platform agnostic behavior or asserting low-level virtual DOM operations, use `@vue/runtime-test`.

- Only use platform-specific runtimes if the test is asserting platform-specific behavior.

Test coverage is continuously deployed at https://vue-next-coverage.netlify.app/. PRs that improve test coverage are welcome, but in general the test coverage should be used as a guidance for finding API use cases that are not covered by tests. We don't recommend adding tests that only improve coverage but not actually test a meaning use case.
Test coverage is continuously deployed at https://coverage.vuejs.org. PRs that improve test coverage are welcome, but in general the test coverage should be used as a guidance for finding API use cases that are not covered by tests. We don't recommend adding tests that only improve coverage but not actually test a meaning use case.

### Testing Type Definition Correctness

Type tests are located in the `test-dts` directory. To run the dts tests, run `nr test-dts`. Note that the type test requires all relevant `*.d.ts` files to be built first (and the script does it for you). Once the `d.ts` files are built and up-to-date, the tests can be re-run by simply running `nr test-dts`.
Type tests are located in the `packages/dts-test` directory. To run the dts tests, run `nr test-dts`. Note that the type test requires all relevant `*.d.ts` files to be built first (and the script does it for you). Once the `d.ts` files are built and up-to-date, the tests can be re-run by running `nr test-dts-only`.

## Financial Contribution

Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/canary.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: canary release
on:
# Runs every Monday at 1 AM UTC (9:00 AM in Singapore)
schedule:
- cron: 0 1 * * MON
workflow_dispatch:

jobs:
canary:
# prevents this action from running on forks
if: github.repository == 'vuejs/core'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Install pnpm
uses: pnpm/action-setup@v2

- name: Set node version to 18
uses: actions/setup-node@v3
with:
node-version: 18
registry-url: 'https://registry.npmjs.org'
cache: 'pnpm'

- run: pnpm install

- run: pnpm release --canary
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
11 changes: 4 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ permissions:
jobs:
unit-test:
runs-on: ubuntu-latest
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
steps:
- uses: actions/checkout@v3

Expand All @@ -32,6 +33,7 @@ jobs:

e2e-test:
runs-on: ubuntu-latest
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
steps:
- uses: actions/checkout@v3

Expand All @@ -57,6 +59,7 @@ jobs:

lint-and-test-dts:
runs-on: ubuntu-latest
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
steps:
- uses: actions/checkout@v3

Expand All @@ -82,6 +85,7 @@ jobs:

size:
runs-on: ubuntu-latest
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
env:
CI_JOB_NUMBER: 1
steps:
Expand All @@ -98,10 +102,3 @@ jobs:

- run: PUPPETEER_SKIP_DOWNLOAD=1 pnpm install
- run: pnpm run size

# - name: Check build size
# uses: posva/size-check-action@v1.1.2
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# build_script: size
# files: packages/vue/dist/vue.global.prod.js packages/runtime-dom/dist/runtime-dom.global.prod.js packages/size-check/dist/index.js
85 changes: 85 additions & 0 deletions .github/workflows/ecosystem-ci-trigger.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: ecosystem-ci trigger

on:
issue_comment:
types: [created]

jobs:
trigger:
runs-on: ubuntu-latest
if: github.repository == 'vuejs/core' && github.event.issue.pull_request && startsWith(github.event.comment.body, '/ecosystem-ci run')
steps:
- uses: actions/github-script@v6
with:
script: |
const user = context.payload.sender.login
console.log(`Validate user: ${user}`)

let isVuejsMember = false
try {
const { status } = await github.rest.orgs.checkMembershipForUser({
org: 'vuejs',
username: user
});

isVuejsMember = (status === 204)
} catch (e) {}

if (isVuejsMember) {
console.log('Allowed')
await github.rest.reactions.createForIssueComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: context.payload.comment.id,
content: '+1',
})
} else {
console.log('Not allowed')
await github.rest.reactions.createForIssueComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: context.payload.comment.id,
content: '-1',
})
throw new Error('not allowed')
}
- uses: actions/github-script@v6
id: get-pr-data
with:
script: |
console.log(`Get PR info: ${context.repo.owner}/${context.repo.repo}#${context.issue.number}`)
const { data: pr } = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number
})
return {
num: context.issue.number,
branchName: pr.head.ref,
repo: pr.head.repo.full_name
}
- uses: actions/github-script@v6
id: trigger
env:
COMMENT: ${{ github.event.comment.body }}
with:
github-token: ${{ secrets.ECOSYSTEM_CI_ACCESS_TOKEN }}
result-encoding: string
script: |
const comment = process.env.COMMENT.trim()
const prData = ${{ steps.get-pr-data.outputs.result }}

const suite = comment.replace(/^\/ecosystem-ci run/, '').trim()

await github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: 'ecosystem-ci',
workflow_id: 'ecosystem-ci-from-pr.yml',
ref: 'main',
inputs: {
prNumber: '' + prData.num,
branchName: prData.branchName,
repo: prData.repo,
suite: suite === '' ? '-' : suite
}
})
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ TODOs.md
*.log
.idea
.eslintcache
dts-build/packages
*.tsbuildinfo
Loading