diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 4296d0f39..92b5b5342 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -3,6 +3,15 @@ const DOMGlobals = ['window', 'document'] const NodeGlobals = ['module', 'require'] +const banConstEnum = { + selector: 'TSEnumDeclaration[const=true]', + message: + 'Please use non-const enums. This project automatically inlines enums.' +} + +/** + * @type {import('eslint-define-config').ESLintConfig} + */ module.exports = { parser: '@typescript-eslint/parser', parserOptions: { @@ -16,6 +25,7 @@ module.exports = { 'no-restricted-syntax': [ 'error', + banConstEnum, // 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', @@ -52,12 +62,10 @@ module.exports = { }, // Packages targeting Node { - files: [ - 'packages/{compiler-sfc,compiler-ssr,server-renderer,reactivity-transform}/**' - ], + files: ['packages/{compiler-sfc,compiler-ssr,server-renderer}/**'], rules: { 'no-restricted-globals': ['error', ...DOMGlobals], - 'no-restricted-syntax': 'off' + 'no-restricted-syntax': ['error', banConstEnum] } }, // Private package, browser only + no syntax restrictions @@ -65,7 +73,7 @@ module.exports = { files: ['packages/template-explorer/**', 'packages/sfc-playground/**'], rules: { 'no-restricted-globals': ['error', ...NodeGlobals], - 'no-restricted-syntax': 'off' + 'no-restricted-syntax': ['error', banConstEnum] } }, // JavaScript files @@ -81,7 +89,7 @@ module.exports = { files: ['scripts/**', '*.{js,ts}', 'packages/**/index.js'], rules: { 'no-restricted-globals': 'off', - 'no-restricted-syntax': 'off' + 'no-restricted-syntax': ['error', banConstEnum] } } ] diff --git a/CHANGELOG.md b/CHANGELOG.md index 062c61032..ec08f2169 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,59 @@ +# [3.4.0-alpha.3](https://github.com/vuejs/core/compare/v3.4.0-alpha.2...v3.4.0-alpha.3) (2023-11-28) + + +### Bug Fixes + +* **deps:** update compiler to ^7.23.4 ([#9681](https://github.com/vuejs/core/issues/9681)) ([31f6ebc](https://github.com/vuejs/core/commit/31f6ebc4df84490ed29fb75e7bf4259200eb51f0)) +* **parser:** directive arg should be undefined on shorthands with no arg ([e49dffc](https://github.com/vuejs/core/commit/e49dffc9ece86bddf094b9ad4ad15eb4856d6277)) + + +### Features + +* **dx:** link errors to docs in prod build ([#9165](https://github.com/vuejs/core/issues/9165)) ([9f8ba98](https://github.com/vuejs/core/commit/9f8ba9821fe166f77e63fa940e9e7e13ec3344fa)) + + + +# [3.4.0-alpha.2](https://github.com/vuejs/core/compare/v3.3.9...v3.4.0-alpha.2) (2023-11-27) + + +### Bug Fixes + +* avoid confusing breakage in @vitejs/plugin-vue ([ceec69c](https://github.com/vuejs/core/commit/ceec69c8ccb96c433a4a506ad2e85e276998bade)) +* **compiler-core:** fix line/column tracking when fast forwarding ([2e65ea4](https://github.com/vuejs/core/commit/2e65ea481f74db8649df8110a031cbdc98f98c84)) +* **compiler-sfc:** fix ast reuse for ssr ([fb619cf](https://github.com/vuejs/core/commit/fb619cf9a440239f0ba88e327d10001a6a3c8171)) +* **compiler-sfc:** support `:is` and `:where` selector in scoped css rewrite ([#8929](https://github.com/vuejs/core/issues/8929)) ([c6083dc](https://github.com/vuejs/core/commit/c6083dcad31f3e9292c687fada9e32f287e2317f)) +* **compiler-sfc:** use correct compiler when re-parsing in ssr mode ([678378a](https://github.com/vuejs/core/commit/678378afd559481badb486b243722b6287862e09)) + + +* feat!: remove reactivity transform (#9321) ([79b8a09](https://github.com/vuejs/core/commit/79b8a0905bf363bf82edd2096fef10c3db6d9c3c)), closes [#9321](https://github.com/vuejs/core/issues/9321) + + +### Features + +* **compiler-core:** support specifying root namespace when parsing ([40f72d5](https://github.com/vuejs/core/commit/40f72d5e50b389cb11b7ca13461aa2a75ddacdb4)) +* **compiler-core:** support v-bind shorthand for key and value with the same name ([#9451](https://github.com/vuejs/core/issues/9451)) ([26399aa](https://github.com/vuejs/core/commit/26399aa6fac1596b294ffeba06bb498d86f5508c)) +* **compiler:** improve parsing tolerance for language-tools ([41ff68e](https://github.com/vuejs/core/commit/41ff68ea579d933333392146625560359acb728a)) +* **reactivity:** expose last result for computed getter ([#9497](https://github.com/vuejs/core/issues/9497)) ([48b47a1](https://github.com/vuejs/core/commit/48b47a1ab63577e2dbd91947eea544e3ef185b85)) + + +### Performance Improvements + +* avoid sfc source map unnecessary serialization and parsing ([f15d2f6](https://github.com/vuejs/core/commit/f15d2f6cf69c0c39f8dfb5c33122790c68bf92e2)) +* **codegen:** optimize line / column calculation during codegen ([3be53d9](https://github.com/vuejs/core/commit/3be53d9b974dae1a10eb795cade71ae765e17574)) +* **codegen:** optimize source map generation ([c11002f](https://github.com/vuejs/core/commit/c11002f16afd243a2b15b546816e73882eea9e4d)) +* **compiler-sfc:** remove magic-string trim on script ([e8e3ec6](https://github.com/vuejs/core/commit/e8e3ec6ca7392e43975c75b56eaaa711d5ea9410)) +* **compiler-sfc:** use faster source map addMapping ([50cde7c](https://github.com/vuejs/core/commit/50cde7cfbcc49022ba88f5f69fa9b930b483c282)) +* optimize away isBuiltInType ([66c0ed0](https://github.com/vuejs/core/commit/66c0ed0a3c1c6f37dafc6b1c52b75c6bf60e3136)) +* optimize makeMap ([ae6fba9](https://github.com/vuejs/core/commit/ae6fba94954bac6430902f77b0d1113a98a75b18)) +* optimize position cloning ([2073236](https://github.com/vuejs/core/commit/20732366b9b3530d33b842cf1fc985919afb9317)) + + +### BREAKING CHANGES + +* Reactivity Transform was marked deprecated in 3.3 and is now removed in 3.4. This change does not require a major due to the feature being experimental. Users who wish to continue using the feature can do so via the external plugin at https://vue-macros.dev/features/reactivity-transform.html + + + ## [3.3.9](https://github.com/vuejs/core/compare/v3.3.8...v3.3.9) (2023-11-25) @@ -47,6 +103,19 @@ +# [3.4.0-alpha.1](https://github.com/vuejs/core/compare/v3.3.7...v3.4.0-alpha.1) (2023-10-28) + + +### Features + +* **compiler-core:** export error message ([#8729](https://github.com/vuejs/core/issues/8729)) ([f7e80ee](https://github.com/vuejs/core/commit/f7e80ee4a065a9eaba98720abf415d9e87756cbd)) +* **compiler-sfc:** expose resolve type-based props and emits ([#8874](https://github.com/vuejs/core/issues/8874)) ([9e77580](https://github.com/vuejs/core/commit/9e77580c0c2f0d977bd0031a1d43cc334769d433)) +* export runtime error strings ([#9301](https://github.com/vuejs/core/issues/9301)) ([feb2f2e](https://github.com/vuejs/core/commit/feb2f2edce2d91218a5e9a52c81e322e4033296b)) +* **reactivity:** more efficient reactivity system ([#5912](https://github.com/vuejs/core/issues/5912)) ([16e06ca](https://github.com/vuejs/core/commit/16e06ca08f5a1e2af3fc7fb35de153dbe0c3087d)), closes [#311](https://github.com/vuejs/core/issues/311) [#1811](https://github.com/vuejs/core/issues/1811) [#6018](https://github.com/vuejs/core/issues/6018) [#7160](https://github.com/vuejs/core/issues/7160) [#8714](https://github.com/vuejs/core/issues/8714) [#9149](https://github.com/vuejs/core/issues/9149) [#9419](https://github.com/vuejs/core/issues/9419) [#9464](https://github.com/vuejs/core/issues/9464) +* **runtime-core:** add `once` option to watch ([#9034](https://github.com/vuejs/core/issues/9034)) ([a645e7a](https://github.com/vuejs/core/commit/a645e7aa51006516ba668b3a4365d296eb92ee7d)) + + + ## [3.3.7](https://github.com/vuejs/core/compare/v3.3.6...v3.3.7) (2023-10-24) diff --git a/package.json b/package.json index c3be99e2b..6675800e3 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "private": true, "version": "0.0.0-vapor", - "packageManager": "pnpm@8.10.5", + "packageManager": "pnpm@8.11.0", "type": "module", "scripts": { "dev": "node scripts/dev.js vue vue-vapor", @@ -35,7 +35,7 @@ "serve": "serve", "open": "open http://localhost:3000/packages/template-explorer/local.html", "build-sfc-playground": "run-s build-all-cjs build-runtime-esm build-ssr-esm build-sfc-playground-self", - "build-all-cjs": "node scripts/build.js vue runtime compiler reactivity reactivity-transform shared -af cjs", + "build-all-cjs": "node scripts/build.js vue runtime compiler reactivity shared -af cjs", "build-runtime-esm": "node scripts/build.js runtime reactivity shared -af esm-bundler && node scripts/build.js vue -f esm-bundler-runtime && node scripts/build.js vue -f esm-browser-runtime", "build-ssr-esm": "node scripts/build.js compiler-sfc server-renderer -f esm-browser", "build-sfc-playground-self": "cd packages/sfc-playground && npm run build", @@ -59,8 +59,8 @@ "node": ">=18.12.0" }, "devDependencies": { - "@babel/parser": "^7.23.3", - "@babel/types": "^7.23.3", + "@babel/parser": "^7.23.4", + "@babel/types": "^7.23.4", "@rollup/plugin-alias": "^5.0.1", "@rollup/plugin-commonjs": "^25.0.7", "@rollup/plugin-json": "^6.0.1", @@ -68,8 +68,10 @@ "@rollup/plugin-replace": "^5.0.4", "@rollup/plugin-terser": "^0.4.4", "@types/hash-sum": "^1.0.2", - "@types/node": "^20.9.2", - "@typescript-eslint/parser": "^6.11.0", + "@types/minimist": "^1.2.5", + "@types/node": "^20.10.0", + "@types/semver": "^7.5.5", + "@typescript-eslint/parser": "^6.13.0", "@vitest/coverage-istanbul": "^0.34.6", "@vue/consolidate": "0.17.3", "conventional-changelog-cli": "^4.1.0", @@ -77,6 +79,7 @@ "esbuild": "^0.19.5", "esbuild-plugin-polyfill-node": "^0.3.0", "eslint": "^8.54.0", + "eslint-define-config": "^1.24.1", "eslint-plugin-jest": "^27.6.0", "estree-walker": "^2.0.2", "execa": "^8.0.1", @@ -104,7 +107,7 @@ "terser": "^5.22.0", "todomvc-app-css": "^2.4.3", "tslib": "^2.6.2", - "tsx": "^4.1.4", + "tsx": "^4.5.0", "typescript": "^5.2.2", "vite": "^5.0.0", "vitest": "^0.34.6" diff --git a/packages/compiler-core/__tests__/__snapshots__/parse.spec.ts.snap b/packages/compiler-core/__tests__/__snapshots__/parse.spec.ts.snap index e4728a461..924038450 100644 --- a/packages/compiler-core/__tests__/__snapshots__/parse.spec.ts.snap +++ b/packages/compiler-core/__tests__/__snapshots__/parse.spec.ts.snap @@ -1,241 +1,12 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`compiler: parse > Errors > ABRUPT_CLOSING_OF_EMPTY_COMMENT > 1`] = ` -{ - "cached": 0, - "children": [ - { - "children": [ - { - "content": "", - "loc": { - "end": { - "column": 16, - "line": 1, - "offset": 15, - }, - "source": "", - "start": { - "column": 11, - "line": 1, - "offset": 10, - }, - }, - "type": 3, - }, - ], - "codegenNode": undefined, - "isSelfClosing": false, - "loc": { - "end": { - "column": 27, - "line": 1, - "offset": 26, - }, - "source": "", - "start": { - "column": 1, - "line": 1, - "offset": 0, - }, - }, - "ns": 0, - "props": [], - "tag": "template", - "tagType": 0, - "type": 1, - }, - ], - "codegenNode": undefined, - "components": [], - "directives": [], - "helpers": Set {}, - "hoists": [], - "imports": [], - "loc": { - "end": { - "column": 27, - "line": 1, - "offset": 26, - }, - "source": "", - "start": { - "column": 1, - "line": 1, - "offset": 0, - }, - }, - "temps": 0, - "type": 0, -} -`; - -exports[`compiler: parse > Errors > ABRUPT_CLOSING_OF_EMPTY_COMMENT > 1`] = ` -{ - "cached": 0, - "children": [ - { - "children": [ - { - "content": "", - "loc": { - "end": { - "column": 17, - "line": 1, - "offset": 16, - }, - "source": "", - "start": { - "column": 11, - "line": 1, - "offset": 10, - }, - }, - "type": 3, - }, - ], - "codegenNode": undefined, - "isSelfClosing": false, - "loc": { - "end": { - "column": 28, - "line": 1, - "offset": 27, - }, - "source": "", - "start": { - "column": 1, - "line": 1, - "offset": 0, - }, - }, - "ns": 0, - "props": [], - "tag": "template", - "tagType": 0, - "type": 1, - }, - ], - "codegenNode": undefined, - "components": [], - "directives": [], - "helpers": Set {}, - "hoists": [], - "imports": [], - "loc": { - "end": { - "column": 28, - "line": 1, - "offset": 27, - }, - "source": "", - "start": { - "column": 1, - "line": 1, - "offset": 0, - }, - }, - "temps": 0, - "type": 0, -} -`; - -exports[`compiler: parse > Errors > ABRUPT_CLOSING_OF_EMPTY_COMMENT > 1`] = ` -{ - "cached": 0, - "children": [ - { - "children": [ - { - "content": "", - "loc": { - "end": { - "column": 18, - "line": 1, - "offset": 17, - }, - "source": "", - "start": { - "column": 11, - "line": 1, - "offset": 10, - }, - }, - "type": 3, - }, - ], - "codegenNode": undefined, - "isSelfClosing": false, - "loc": { - "end": { - "column": 29, - "line": 1, - "offset": 28, - }, - "source": "", - "start": { - "column": 1, - "line": 1, - "offset": 0, - }, - }, - "ns": 0, - "props": [], - "tag": "template", - "tagType": 0, - "type": 1, - }, - ], - "codegenNode": undefined, - "components": [], - "directives": [], - "helpers": Set {}, - "hoists": [], - "imports": [], - "loc": { - "end": { - "column": 29, - "line": 1, - "offset": 28, - }, - "source": "", - "start": { - "column": 1, - "line": 1, - "offset": 0, - }, - }, - "temps": 0, - "type": 0, -} -`; - exports[`compiler: parse > Errors > CDATA_IN_HTML_CONTENT > 1`] = ` { "cached": 0, "children": [ { - "children": [ - { - "content": "[CDATA[cdata]]", - "loc": { - "end": { - "column": 28, - "line": 1, - "offset": 27, - }, - "source": "", - "start": { - "column": 11, - "line": 1, - "offset": 10, - }, - }, - "type": 3, - }, - ], + "children": [], "codegenNode": undefined, - "isSelfClosing": false, "loc": { "end": { "column": 39, @@ -275,6 +46,7 @@ exports[`compiler: parse > Errors > CDATA_IN_HTML_CONTENT > ", "temps": 0, "type": 0, } @@ -307,7 +79,6 @@ exports[`compiler: parse > Errors > CDATA_IN_HTML_CONTENT >