diff --git a/CHANGELOG.md b/CHANGELOG.md index 900a96005..792f1400e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,42 @@ +# [3.0.0-alpha.12](https://github.com/vuejs/vue-next/compare/v3.0.0-alpha.11...v3.0.0-alpha.12) (2020-04-08) + + +### Bug Fixes + +* **compiler:** should not condense ` ` ([8c17535](https://github.com/vuejs/vue-next/commit/8c17535a470501f7f4ec3747cd3de25d9169c505)), closes [#945](https://github.com/vuejs/vue-next/issues/945) +* **compiler:** should only strip leading newline directly in pre tag ([be666eb](https://github.com/vuejs/vue-next/commit/be666ebd59027eb2fc96595c1a6054ecf62832e8)) +* **compiler:** support full range of entity decoding in browser builds ([1f6e72b](https://github.com/vuejs/vue-next/commit/1f6e72b11051561abe270fa233cf52d5aba01d6b)) +* **compiler-core:** elements with dynamic keys should be forced into blocks ([d531686](https://github.com/vuejs/vue-next/commit/d531686f9154c2ef7f1d877c275df62a8d8da2a5)), closes [#916](https://github.com/vuejs/vue-next/issues/916) +* **reactivity:** track reactive keys in raw collection types ([5dcc645](https://github.com/vuejs/vue-next/commit/5dcc645fc068f9a467fa31ba2d3c2a59e68a9fd7)), closes [#919](https://github.com/vuejs/vue-next/issues/919) +* **runtime-core:** fix globalProperties in check on instance render proxy ([c28a919](https://github.com/vuejs/vue-next/commit/c28a9196b2165e8ce274b2708d6d772024c2933a)) +* **runtime-core:** set fragment root children should also update dynamicChildren ([#944](https://github.com/vuejs/vue-next/issues/944)) ([a27e9ee](https://github.com/vuejs/vue-next/commit/a27e9ee9aea3487ef3ef0c8a5df53227fc172886)), closes [#943](https://github.com/vuejs/vue-next/issues/943) +* **runtime-dom:** fix getModelAssigner order in vModelCheckbox ([#926](https://github.com/vuejs/vue-next/issues/926)) ([da1fb7a](https://github.com/vuejs/vue-next/commit/da1fb7afef75470826501fe6e9d81e5af296fea7)) +* **runtime-dom:** support native onxxx handlers ([2302dea](https://github.com/vuejs/vue-next/commit/2302dea1624d4b964fed71e30089426212091c11)), closes [#927](https://github.com/vuejs/vue-next/issues/927) +* **slots:** should update compiled dynamic slots ([8444078](https://github.com/vuejs/vue-next/commit/84440780f9e45aa5b060180078b769f27757c7bd)) +* **transition:** fix dynamic transition update on nested HOCs ([b8da8b2](https://github.com/vuejs/vue-next/commit/b8da8b2dfac96558df1d038aac3bbe63bd42a8ce)) +* **transition:** should ship props declarations in production ([4227831](https://github.com/vuejs/vue-next/commit/42278317e15a202e4e1c8f7084eafa7bb13f1ade)) +* **types:** accept generic Component type in h() ([c1d5928](https://github.com/vuejs/vue-next/commit/c1d5928f3b240a4a69bcd8d88494e4fe8d2e625b)), closes [#922](https://github.com/vuejs/vue-next/issues/922) +* **v-model:** handle dynamic assigners and array assigners ([f42d11e](https://github.com/vuejs/vue-next/commit/f42d11e8e19f7356f4e1629cd07c774c9af39288)), closes [#923](https://github.com/vuejs/vue-next/issues/923) + + +### Features + +* **asyncComponent:** add `onError` option for defineAsyncComponent ([e804463](https://github.com/vuejs/vue-next/commit/e80446349215159c002223a41baeb5a8bc0f444c)) +* **runtime-core:** improve component public instance proxy inspection ([899287a](https://github.com/vuejs/vue-next/commit/899287ad35d8b74e76a71f39772a92f261dfa4f8)) + + +### BREAKING CHANGES + +* **compiler:** compiler options have been adjusted. + - new option `decodeEntities` is added. + - `namedCharacterReferences` option has been removed. + - `maxCRNameLength` option has been rmeoved. +* **asyncComponent:** `retryWhen` and `maxRetries` options for +`defineAsyncComponent` has been replaced by the more flexible `onError` +option, per https://github.com/vuejs/rfcs/pull/148 + + + # [3.0.0-alpha.11](https://github.com/vuejs/vue-next/compare/v3.0.0-alpha.10...v3.0.0-alpha.11) (2020-04-04) @@ -11,7 +50,7 @@ * **reactivity:** scheduled effect should not execute if stopped ([0764c33](https://github.com/vuejs/vue-next/commit/0764c33d3da8c06d472893a4e451e33394726a42)), closes [#910](https://github.com/vuejs/vue-next/issues/910) * **runtime-core:** support attr merging on child with root level comments ([e42cb54](https://github.com/vuejs/vue-next/commit/e42cb543947d4286115b6adae6e8a5741d909f14)), closes [#904](https://github.com/vuejs/vue-next/issues/904) * **runtime-dom:** v-cloak should be removed after compile on the root element ([#893](https://github.com/vuejs/vue-next/issues/893)) ([0ed147d](https://github.com/vuejs/vue-next/commit/0ed147d33610b86af72cbadcc4b32e6069bcaf08)), closes [#890](https://github.com/vuejs/vue-next/issues/890) -* **runtome-dom:** properly support creating customized built-in element ([b1d0b04](https://github.com/vuejs/vue-next/commit/b1d0b046afb1e8f4640d8d80b6eeaf9f89e892f7)) +* **runtime-dom:** properly support creating customized built-in element ([b1d0b04](https://github.com/vuejs/vue-next/commit/b1d0b046afb1e8f4640d8d80b6eeaf9f89e892f7)) * **transition:** warn only when there is more than one rendered child ([#903](https://github.com/vuejs/vue-next/issues/903)) ([37b1dc8](https://github.com/vuejs/vue-next/commit/37b1dc8242608b072d14fd2a5e52f5d40829ea52)) * **types:** allow use PropType with Function ([#915](https://github.com/vuejs/vue-next/issues/915)) ([026eb72](https://github.com/vuejs/vue-next/commit/026eb729f3d1566e95f2f4253d76c20e86d1ec9b)), closes [#748](https://github.com/vuejs/vue-next/issues/748) * **types:** export missing types from runtime-core ([#889](https://github.com/vuejs/vue-next/issues/889)) ([412ec86](https://github.com/vuejs/vue-next/commit/412ec86128fa33fa41ce435c493fd8275a785fea)) diff --git a/package.json b/package.json index 20c7129ad..24e522244 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "private": true, - "version": "3.0.0-alpha.11", + "version": "3.0.0-alpha.12", "workspaces": [ "packages/*" ], diff --git a/packages/compiler-core/__tests__/__snapshots__/parse.spec.ts.snap b/packages/compiler-core/__tests__/__snapshots__/parse.spec.ts.snap index c7af84fff..998b00ab7 100644 --- a/packages/compiler-core/__tests__/__snapshots__/parse.spec.ts.snap +++ b/packages/compiler-core/__tests__/__snapshots__/parse.spec.ts.snap @@ -210,634 +210,6 @@ Object { } `; -exports[`compiler: parse Errors ABSENCE_OF_DIGITS_IN_NUMERIC_CHARACTER_REFERENCE 1`] = ` -Object { - "cached": 0, - "children": Array [ - Object { - "children": Array [], - "codegenNode": undefined, - "isSelfClosing": false, - "loc": Object { - "end": Object { - "column": 35, - "line": 1, - "offset": 34, - }, - "source": "", - "start": Object { - "column": 1, - "line": 1, - "offset": 0, - }, - }, - "ns": 0, - "props": Array [ - Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - "offset": 22, - }, - "source": "attr=\\"c\\"", - "start": Object { - "column": 11, - "line": 1, - "offset": 10, - }, - }, - "name": "attr", - "type": 6, - "value": Object { - "content": "c", - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - "offset": 22, - }, - "source": "\\"c\\"", - "start": Object { - "column": 16, - "line": 1, - "offset": 15, - }, - }, - "type": 2, - }, - }, - ], - "tag": "template", - "tagType": 0, - "type": 1, - }, - ], - "codegenNode": undefined, - "components": Array [], - "directives": Array [], - "helpers": Array [], - "hoists": Array [], - "imports": Array [], - "loc": Object { - "end": Object { - "column": 35, - "line": 1, - "offset": 34, - }, - "source": "", - "start": Object { - "column": 1, - "line": 1, - "offset": 0, - }, - }, - "temps": 0, - "type": 0, -} -`; - -exports[`compiler: parse Errors ABSENCE_OF_DIGITS_IN_NUMERIC_CHARACTER_REFERENCE 1`] = ` -Object { - "cached": 0, - "children": Array [ - Object { - "children": Array [], - "codegenNode": undefined, - "isSelfClosing": false, - "loc": Object { - "end": Object { - "column": 34, - "line": 1, - "offset": 33, - }, - "source": "", - "start": Object { - "column": 1, - "line": 1, - "offset": 0, - }, - }, - "ns": 0, - "props": Array [ - Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - "offset": 21, - }, - "source": "attr=\\"a;\\"", - "start": Object { - "column": 11, - "line": 1, - "offset": 10, - }, - }, - "name": "attr", - "type": 6, - "value": Object { - "content": "a;", - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - "offset": 21, - }, - "source": "\\"a;\\"", - "start": Object { - "column": 16, - "line": 1, - "offset": 15, - }, - }, - "type": 2, - }, - }, - ], - "tag": "template", - "tagType": 0, - "type": 1, - }, - ], - "codegenNode": undefined, - "components": Array [], - "directives": Array [], - "helpers": Array [], - "hoists": Array [], - "imports": Array [], - "loc": Object { - "end": Object { - "column": 34, - "line": 1, - "offset": 33, - }, - "source": "", - "start": Object { - "column": 1, - "line": 1, - "offset": 0, - }, - }, - "temps": 0, - "type": 0, -} -`; - -exports[`compiler: parse Errors ABSENCE_OF_DIGITS_IN_NUMERIC_CHARACTER_REFERENCE 1`] = ` -Object { - "cached": 0, - "children": Array [ - Object { - "children": Array [], - "codegenNode": undefined, - "isSelfClosing": false, - "loc": Object { - "end": Object { - "column": 36, - "line": 1, - "offset": 35, - }, - "source": "", - "start": Object { - "column": 1, - "line": 1, - "offset": 0, - }, - }, - "ns": 0, - "props": Array [ - Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - "offset": 23, - }, - "source": "attr=\\"ÿ\\"", - "start": Object { - "column": 11, - "line": 1, - "offset": 10, - }, - }, - "name": "attr", - "type": 6, - "value": Object { - "content": "ÿ", - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - "offset": 23, - }, - "source": "\\"ÿ\\"", - "start": Object { - "column": 16, - "line": 1, - "offset": 15, - }, - }, - "type": 2, - }, - }, - ], - "tag": "template", - "tagType": 0, - "type": 1, - }, - ], - "codegenNode": undefined, - "components": Array [], - "directives": Array [], - "helpers": Array [], - "hoists": Array [], - "imports": Array [], - "loc": Object { - "end": Object { - "column": 36, - "line": 1, - "offset": 35, - }, - "source": "", - "start": Object { - "column": 1, - "line": 1, - "offset": 0, - }, - }, - "temps": 0, - "type": 0, -} -`; - -exports[`compiler: parse Errors ABSENCE_OF_DIGITS_IN_NUMERIC_CHARACTER_REFERENCE 1`] = ` -Object { - "cached": 0, - "children": Array [ - Object { - "children": Array [], - "codegenNode": undefined, - "isSelfClosing": false, - "loc": Object { - "end": Object { - "column": 35, - "line": 1, - "offset": 34, - }, - "source": "", - "start": Object { - "column": 1, - "line": 1, - "offset": 0, - }, - }, - "ns": 0, - "props": Array [ - Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - "offset": 22, - }, - "source": "attr=\\"g;\\"", - "start": Object { - "column": 11, - "line": 1, - "offset": 10, - }, - }, - "name": "attr", - "type": 6, - "value": Object { - "content": "g;", - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - "offset": 22, - }, - "source": "\\"g;\\"", - "start": Object { - "column": 16, - "line": 1, - "offset": 15, - }, - }, - "type": 2, - }, - }, - ], - "tag": "template", - "tagType": 0, - "type": 1, - }, - ], - "codegenNode": undefined, - "components": Array [], - "directives": Array [], - "helpers": Array [], - "hoists": Array [], - "imports": Array [], - "loc": Object { - "end": Object { - "column": 35, - "line": 1, - "offset": 34, - }, - "source": "", - "start": Object { - "column": 1, - "line": 1, - "offset": 0, - }, - }, - "temps": 0, - "type": 0, -} -`; - -exports[`compiler: parse Errors ABSENCE_OF_DIGITS_IN_NUMERIC_CHARACTER_REFERENCE c 1`] = ` -Object { - "cached": 0, - "children": Array [ - Object { - "children": Array [ - Object { - "content": "c", - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - "offset": 15, - }, - "source": "c", - "start": Object { - "column": 11, - "line": 1, - "offset": 10, - }, - }, - "type": 2, - }, - ], - "codegenNode": undefined, - "isSelfClosing": false, - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - "offset": 26, - }, - "source": "c", - "start": Object { - "column": 1, - "line": 1, - "offset": 0, - }, - }, - "ns": 0, - "props": Array [], - "tag": "template", - "tagType": 0, - "type": 1, - }, - ], - "codegenNode": undefined, - "components": Array [], - "directives": Array [], - "helpers": Array [], - "hoists": Array [], - "imports": Array [], - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - "offset": 26, - }, - "source": "c", - "start": Object { - "column": 1, - "line": 1, - "offset": 0, - }, - }, - "temps": 0, - "type": 0, -} -`; - -exports[`compiler: parse Errors ABSENCE_OF_DIGITS_IN_NUMERIC_CHARACTER_REFERENCE a; 1`] = ` -Object { - "cached": 0, - "children": Array [ - Object { - "children": Array [ - Object { - "content": "a;", - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - "offset": 14, - }, - "source": "a;", - "start": Object { - "column": 11, - "line": 1, - "offset": 10, - }, - }, - "type": 2, - }, - ], - "codegenNode": undefined, - "isSelfClosing": false, - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - "offset": 25, - }, - "source": "a;", - "start": Object { - "column": 1, - "line": 1, - "offset": 0, - }, - }, - "ns": 0, - "props": Array [], - "tag": "template", - "tagType": 0, - "type": 1, - }, - ], - "codegenNode": undefined, - "components": Array [], - "directives": Array [], - "helpers": Array [], - "hoists": Array [], - "imports": Array [], - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - "offset": 25, - }, - "source": "a;", - "start": Object { - "column": 1, - "line": 1, - "offset": 0, - }, - }, - "temps": 0, - "type": 0, -} -`; - -exports[`compiler: parse Errors ABSENCE_OF_DIGITS_IN_NUMERIC_CHARACTER_REFERENCE ÿ 1`] = ` -Object { - "cached": 0, - "children": Array [ - Object { - "children": Array [ - Object { - "content": "ÿ", - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - "offset": 16, - }, - "source": "ÿ", - "start": Object { - "column": 11, - "line": 1, - "offset": 10, - }, - }, - "type": 2, - }, - ], - "codegenNode": undefined, - "isSelfClosing": false, - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - "offset": 27, - }, - "source": "ÿ", - "start": Object { - "column": 1, - "line": 1, - "offset": 0, - }, - }, - "ns": 0, - "props": Array [], - "tag": "template", - "tagType": 0, - "type": 1, - }, - ], - "codegenNode": undefined, - "components": Array [], - "directives": Array [], - "helpers": Array [], - "hoists": Array [], - "imports": Array [], - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - "offset": 27, - }, - "source": "ÿ", - "start": Object { - "column": 1, - "line": 1, - "offset": 0, - }, - }, - "temps": 0, - "type": 0, -} -`; - -exports[`compiler: parse Errors ABSENCE_OF_DIGITS_IN_NUMERIC_CHARACTER_REFERENCE g; 1`] = ` -Object { - "cached": 0, - "children": Array [ - Object { - "children": Array [ - Object { - "content": "g;", - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - "offset": 15, - }, - "source": "g;", - "start": Object { - "column": 11, - "line": 1, - "offset": 10, - }, - }, - "type": 2, - }, - ], - "codegenNode": undefined, - "isSelfClosing": false, - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - "offset": 26, - }, - "source": "g;", - "start": Object { - "column": 1, - "line": 1, - "offset": 0, - }, - }, - "ns": 0, - "props": Array [], - "tag": "template", - "tagType": 0, - "type": 1, - }, - ], - "codegenNode": undefined, - "components": Array [], - "directives": Array [], - "helpers": Array [], - "hoists": Array [], - "imports": Array [], - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - "offset": 26, - }, - "source": "g;", - "start": Object { - "column": 1, - "line": 1, - "offset": 0, - }, - }, - "temps": 0, - "type": 0, -} -`; - exports[`compiler: parse Errors CDATA_IN_HTML_CONTENT 1`] = ` Object { "cached": 0, @@ -1002,216 +374,6 @@ Object { } `; -exports[`compiler: parse Errors CHARACTER_REFERENCE_OUTSIDE_UNICODE_RANGE 1`] = ` -Object { - "cached": 0, - "children": Array [ - Object { - "children": Array [ - Object { - "content": "�", - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - "offset": 20, - }, - "source": "", - "start": Object { - "column": 11, - "line": 1, - "offset": 10, - }, - }, - "type": 2, - }, - ], - "codegenNode": undefined, - "isSelfClosing": false, - "loc": Object { - "end": Object { - "column": 32, - "line": 1, - "offset": 31, - }, - "source": "", - "start": Object { - "column": 1, - "line": 1, - "offset": 0, - }, - }, - "ns": 0, - "props": Array [], - "tag": "template", - "tagType": 0, - "type": 1, - }, - ], - "codegenNode": undefined, - "components": Array [], - "directives": Array [], - "helpers": Array [], - "hoists": Array [], - "imports": Array [], - "loc": Object { - "end": Object { - "column": 32, - "line": 1, - "offset": 31, - }, - "source": "", - "start": Object { - "column": 1, - "line": 1, - "offset": 0, - }, - }, - "temps": 0, - "type": 0, -} -`; - -exports[`compiler: parse Errors CONTROL_CHARACTER_REFERENCE 1`] = ` -Object { - "cached": 0, - "children": Array [ - Object { - "children": Array [ - Object { - "content": "", - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - "offset": 17, - }, - "source": "", - "start": Object { - "column": 11, - "line": 1, - "offset": 10, - }, - }, - "type": 2, - }, - ], - "codegenNode": undefined, - "isSelfClosing": false, - "loc": Object { - "end": Object { - "column": 29, - "line": 1, - "offset": 28, - }, - "source": "", - "start": Object { - "column": 1, - "line": 1, - "offset": 0, - }, - }, - "ns": 0, - "props": Array [], - "tag": "template", - "tagType": 0, - "type": 1, - }, - ], - "codegenNode": undefined, - "components": Array [], - "directives": Array [], - "helpers": Array [], - "hoists": Array [], - "imports": Array [], - "loc": Object { - "end": Object { - "column": 29, - "line": 1, - "offset": 28, - }, - "source": "", - "start": Object { - "column": 1, - "line": 1, - "offset": 0, - }, - }, - "temps": 0, - "type": 0, -} -`; - -exports[`compiler: parse Errors CONTROL_CHARACTER_REFERENCE 1`] = ` -Object { - "cached": 0, - "children": Array [ - Object { - "children": Array [ - Object { - "content": "", - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - "offset": 16, - }, - "source": "", - "start": Object { - "column": 11, - "line": 1, - "offset": 10, - }, - }, - "type": 2, - }, - ], - "codegenNode": undefined, - "isSelfClosing": false, - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - "offset": 27, - }, - "source": "", - "start": Object { - "column": 1, - "line": 1, - "offset": 0, - }, - }, - "ns": 0, - "props": Array [], - "tag": "template", - "tagType": 0, - "type": 1, - }, - ], - "codegenNode": undefined, - "components": Array [], - "directives": Array [], - "helpers": Array [], - "hoists": Array [], - "imports": Array [], - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - "offset": 27, - }, - "source": "", - "start": Object { - "column": 1, - "line": 1, - "offset": 0, - }, - }, - "temps": 0, - "type": 0, -} -`; - exports[`compiler: parse Errors DUPLICATE_ATTRIBUTE 1`] = ` Object { "cached": 0, @@ -4698,216 +3860,6 @@ Object { } `; -exports[`compiler: parse Errors MISSING_SEMICOLON_AFTER_CHARACTER_REFERENCE ( 1`] = ` -Object { - "cached": 0, - "children": Array [ - Object { - "children": Array [ - Object { - "content": "(", - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - "offset": 14, - }, - "source": "(", - "start": Object { - "column": 11, - "line": 1, - "offset": 10, - }, - }, - "type": 2, - }, - ], - "codegenNode": undefined, - "isSelfClosing": false, - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - "offset": 25, - }, - "source": "(", - "start": Object { - "column": 1, - "line": 1, - "offset": 0, - }, - }, - "ns": 0, - "props": Array [], - "tag": "template", - "tagType": 0, - "type": 1, - }, - ], - "codegenNode": undefined, - "components": Array [], - "directives": Array [], - "helpers": Array [], - "hoists": Array [], - "imports": Array [], - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - "offset": 25, - }, - "source": "(", - "start": Object { - "column": 1, - "line": 1, - "offset": 0, - }, - }, - "temps": 0, - "type": 0, -} -`; - -exports[`compiler: parse Errors MISSING_SEMICOLON_AFTER_CHARACTER_REFERENCE @ 1`] = ` -Object { - "cached": 0, - "children": Array [ - Object { - "children": Array [ - Object { - "content": "@", - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - "offset": 15, - }, - "source": "@", - "start": Object { - "column": 11, - "line": 1, - "offset": 10, - }, - }, - "type": 2, - }, - ], - "codegenNode": undefined, - "isSelfClosing": false, - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - "offset": 26, - }, - "source": "@", - "start": Object { - "column": 1, - "line": 1, - "offset": 0, - }, - }, - "ns": 0, - "props": Array [], - "tag": "template", - "tagType": 0, - "type": 1, - }, - ], - "codegenNode": undefined, - "components": Array [], - "directives": Array [], - "helpers": Array [], - "hoists": Array [], - "imports": Array [], - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - "offset": 26, - }, - "source": "@", - "start": Object { - "column": 1, - "line": 1, - "offset": 0, - }, - }, - "temps": 0, - "type": 0, -} -`; - -exports[`compiler: parse Errors MISSING_SEMICOLON_AFTER_CHARACTER_REFERENCE & 1`] = ` -Object { - "cached": 0, - "children": Array [ - Object { - "children": Array [ - Object { - "content": "&", - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - "offset": 14, - }, - "source": "&", - "start": Object { - "column": 11, - "line": 1, - "offset": 10, - }, - }, - "type": 2, - }, - ], - "codegenNode": undefined, - "isSelfClosing": false, - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - "offset": 25, - }, - "source": "&", - "start": Object { - "column": 1, - "line": 1, - "offset": 0, - }, - }, - "ns": 0, - "props": Array [], - "tag": "template", - "tagType": 0, - "type": 1, - }, - ], - "codegenNode": undefined, - "components": Array [], - "directives": Array [], - "helpers": Array [], - "hoists": Array [], - "imports": Array [], - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - "offset": 25, - }, - "source": "&", - "start": Object { - "column": 1, - "line": 1, - "offset": 0, - }, - }, - "temps": 0, - "type": 0, -} -`; - exports[`compiler: parse Errors MISSING_WHITESPACE_BETWEEN_ATTRIBUTES 1`] = ` Object { "cached": 0, @@ -5481,286 +4433,6 @@ Object { } `; -exports[`compiler: parse Errors NONCHARACTER_CHARACTER_REFERENCE 1`] = ` -Object { - "cached": 0, - "children": Array [ - Object { - "children": Array [ - Object { - "content": "", - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - "offset": 19, - }, - "source": "", - "start": Object { - "column": 11, - "line": 1, - "offset": 10, - }, - }, - "type": 2, - }, - ], - "codegenNode": undefined, - "isSelfClosing": false, - "loc": Object { - "end": Object { - "column": 31, - "line": 1, - "offset": 30, - }, - "source": "", - "start": Object { - "column": 1, - "line": 1, - "offset": 0, - }, - }, - "ns": 0, - "props": Array [], - "tag": "template", - "tagType": 0, - "type": 1, - }, - ], - "codegenNode": undefined, - "components": Array [], - "directives": Array [], - "helpers": Array [], - "hoists": Array [], - "imports": Array [], - "loc": Object { - "end": Object { - "column": 31, - "line": 1, - "offset": 30, - }, - "source": "", - "start": Object { - "column": 1, - "line": 1, - "offset": 0, - }, - }, - "temps": 0, - "type": 0, -} -`; - -exports[`compiler: parse Errors NONCHARACTER_CHARACTER_REFERENCE 1`] = ` -Object { - "cached": 0, - "children": Array [ - Object { - "children": Array [ - Object { - "content": "", - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - "offset": 18, - }, - "source": "", - "start": Object { - "column": 11, - "line": 1, - "offset": 10, - }, - }, - "type": 2, - }, - ], - "codegenNode": undefined, - "isSelfClosing": false, - "loc": Object { - "end": Object { - "column": 30, - "line": 1, - "offset": 29, - }, - "source": "", - "start": Object { - "column": 1, - "line": 1, - "offset": 0, - }, - }, - "ns": 0, - "props": Array [], - "tag": "template", - "tagType": 0, - "type": 1, - }, - ], - "codegenNode": undefined, - "components": Array [], - "directives": Array [], - "helpers": Array [], - "hoists": Array [], - "imports": Array [], - "loc": Object { - "end": Object { - "column": 30, - "line": 1, - "offset": 29, - }, - "source": "", - "start": Object { - "column": 1, - "line": 1, - "offset": 0, - }, - }, - "temps": 0, - "type": 0, -} -`; - -exports[`compiler: parse Errors NULL_CHARACTER_REFERENCE 1`] = ` -Object { - "cached": 0, - "children": Array [ - Object { - "children": Array [ - Object { - "content": "�", - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - "offset": 17, - }, - "source": "", - "start": Object { - "column": 11, - "line": 1, - "offset": 10, - }, - }, - "type": 2, - }, - ], - "codegenNode": undefined, - "isSelfClosing": false, - "loc": Object { - "end": Object { - "column": 29, - "line": 1, - "offset": 28, - }, - "source": "", - "start": Object { - "column": 1, - "line": 1, - "offset": 0, - }, - }, - "ns": 0, - "props": Array [], - "tag": "template", - "tagType": 0, - "type": 1, - }, - ], - "codegenNode": undefined, - "components": Array [], - "directives": Array [], - "helpers": Array [], - "hoists": Array [], - "imports": Array [], - "loc": Object { - "end": Object { - "column": 29, - "line": 1, - "offset": 28, - }, - "source": "", - "start": Object { - "column": 1, - "line": 1, - "offset": 0, - }, - }, - "temps": 0, - "type": 0, -} -`; - -exports[`compiler: parse Errors SURROGATE_CHARACTER_REFERENCE 1`] = ` -Object { - "cached": 0, - "children": Array [ - Object { - "children": Array [ - Object { - "content": "�", - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - "offset": 18, - }, - "source": "", - "start": Object { - "column": 11, - "line": 1, - "offset": 10, - }, - }, - "type": 2, - }, - ], - "codegenNode": undefined, - "isSelfClosing": false, - "loc": Object { - "end": Object { - "column": 30, - "line": 1, - "offset": 29, - }, - "source": "", - "start": Object { - "column": 1, - "line": 1, - "offset": 0, - }, - }, - "ns": 0, - "props": Array [], - "tag": "template", - "tagType": 0, - "type": 1, - }, - ], - "codegenNode": undefined, - "components": Array [], - "directives": Array [], - "helpers": Array [], - "hoists": Array [], - "imports": Array [], - "loc": Object { - "end": Object { - "column": 30, - "line": 1, - "offset": 29, - }, - "source": "", - "start": Object { - "column": 1, - "line": 1, - "offset": 0, - }, - }, - "temps": 0, - "type": 0, -} -`; - exports[`compiler: parse Errors UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME 1`] = ` Object { "cached": 0, diff --git a/packages/compiler-core/__tests__/parse.spec.ts b/packages/compiler-core/__tests__/parse.spec.ts index 4b0992a5f..d556a1070 100644 --- a/packages/compiler-core/__tests__/parse.spec.ts +++ b/packages/compiler-core/__tests__/parse.spec.ts @@ -9,7 +9,6 @@ import { NodeTypes, Position, TextNode, - AttributeNode, InterpolationNode } from '../src/ast' @@ -163,114 +162,6 @@ describe('compiler: parse', () => { } }) }) - - test('HTML entities compatibility in text (https://html.spec.whatwg.org/multipage/parsing.html#named-character-reference-state).', () => { - const spy = jest.fn() - const ast = baseParse('&ersand;', { - namedCharacterReferences: { amp: '&' }, - onError: spy - }) - const text = ast.children[0] as TextNode - - expect(text).toStrictEqual({ - type: NodeTypes.TEXT, - content: '&ersand;', - loc: { - start: { offset: 0, line: 1, column: 1 }, - end: { offset: 11, line: 1, column: 12 }, - source: '&ersand;' - } - }) - expect(spy.mock.calls).toMatchObject([ - [ - { - code: ErrorCodes.MISSING_SEMICOLON_AFTER_CHARACTER_REFERENCE, - loc: { - start: { offset: 4, line: 1, column: 5 } - } - } - ] - ]) - }) - - test('HTML entities compatibility in attribute (https://html.spec.whatwg.org/multipage/parsing.html#named-character-reference-state).', () => { - const spy = jest.fn() - const ast = baseParse( - '
', - { - namedCharacterReferences: { amp: '&', 'amp;': '&' }, - onError: spy - } - ) - const element = ast.children[0] as ElementNode - const text1 = (element.props[0] as AttributeNode).value - const text2 = (element.props[1] as AttributeNode).value - const text3 = (element.props[2] as AttributeNode).value - - expect(text1).toStrictEqual({ - type: NodeTypes.TEXT, - content: '&ersand;', - loc: { - start: { offset: 7, line: 1, column: 8 }, - end: { offset: 20, line: 1, column: 21 }, - source: '"&ersand;"' - } - }) - expect(text2).toStrictEqual({ - type: NodeTypes.TEXT, - content: '&ersand;', - loc: { - start: { offset: 23, line: 1, column: 24 }, - end: { offset: 37, line: 1, column: 38 }, - source: '"&ersand;"' - } - }) - expect(text3).toStrictEqual({ - type: NodeTypes.TEXT, - content: '&!', - loc: { - start: { offset: 40, line: 1, column: 41 }, - end: { offset: 47, line: 1, column: 48 }, - source: '"&!"' - } - }) - expect(spy.mock.calls).toMatchObject([ - [ - { - code: ErrorCodes.MISSING_SEMICOLON_AFTER_CHARACTER_REFERENCE, - loc: { - start: { offset: 45, line: 1, column: 46 } - } - } - ] - ]) - }) - - test('Some control character reference should be replaced.', () => { - const spy = jest.fn() - const ast = baseParse('', { onError: spy }) - const text = ast.children[0] as TextNode - - expect(text).toStrictEqual({ - type: NodeTypes.TEXT, - content: '†', - loc: { - start: { offset: 0, line: 1, column: 1 }, - end: { offset: 6, line: 1, column: 7 }, - source: '' - } - }) - expect(spy.mock.calls).toMatchObject([ - [ - { - code: ErrorCodes.CONTROL_CHARACTER_REFERENCE, - loc: { - start: { offset: 0, line: 1, column: 1 } - } - } - ] - ]) - }) }) describe('Interpolation', () => { @@ -1652,12 +1543,10 @@ foo expect(baz.loc.end).toEqual({ line: 2, column: 28, offset }) }) - describe('namedCharacterReferences option', () => { + describe('decodeEntities option', () => { test('use the given map', () => { const ast: any = baseParse('&∪︀', { - namedCharacterReferences: { - 'cups;': '\u222A\uFE00' // UNION with serifs - }, + decodeEntities: text => text.replace('∪︀', '\u222A\uFE00'), onError: () => {} // Ignore errors }) @@ -1756,60 +1645,6 @@ foo errors: [] } ], - ABSENCE_OF_DIGITS_IN_NUMERIC_CHARACTER_REFERENCE: [ - { - code: 'a;', - errors: [ - { - type: ErrorCodes.ABSENCE_OF_DIGITS_IN_NUMERIC_CHARACTER_REFERENCE, - loc: { offset: 10, line: 1, column: 11 } - } - ] - }, - { - code: 'g;', - errors: [ - { - type: ErrorCodes.ABSENCE_OF_DIGITS_IN_NUMERIC_CHARACTER_REFERENCE, - loc: { offset: 10, line: 1, column: 11 } - } - ] - }, - { - code: 'c', - errors: [] - }, - { - code: 'ÿ', - errors: [] - }, - { - code: '', - errors: [ - { - type: ErrorCodes.ABSENCE_OF_DIGITS_IN_NUMERIC_CHARACTER_REFERENCE, - loc: { offset: 16, line: 1, column: 17 } - } - ] - }, - { - code: '', - errors: [ - { - type: ErrorCodes.ABSENCE_OF_DIGITS_IN_NUMERIC_CHARACTER_REFERENCE, - loc: { offset: 16, line: 1, column: 17 } - } - ] - }, - { - code: '', - errors: [] - }, - { - code: '', - errors: [] - } - ], CDATA_IN_HTML_CONTENT: [ { code: '', @@ -1825,37 +1660,6 @@ foo errors: [] } ], - CHARACTER_REFERENCE_OUTSIDE_UNICODE_RANGE: [ - { - code: '', - errors: [ - { - type: ErrorCodes.CHARACTER_REFERENCE_OUTSIDE_UNICODE_RANGE, - loc: { offset: 10, line: 1, column: 11 } - } - ] - } - ], - CONTROL_CHARACTER_REFERENCE: [ - { - code: '', - errors: [ - { - type: ErrorCodes.CONTROL_CHARACTER_REFERENCE, - loc: { offset: 10, line: 1, column: 11 } - } - ] - }, - { - code: '', - errors: [ - { - type: ErrorCodes.CONTROL_CHARACTER_REFERENCE, - loc: { offset: 10, line: 1, column: 11 } - } - ] - } - ], DUPLICATE_ATTRIBUTE: [ { code: '', @@ -2412,36 +2216,6 @@ foo ] } ], - MISSING_SEMICOLON_AFTER_CHARACTER_REFERENCE: [ - { - code: '&', - options: { namedCharacterReferences: { amp: '&' } }, - errors: [ - { - type: ErrorCodes.MISSING_SEMICOLON_AFTER_CHARACTER_REFERENCE, - loc: { offset: 14, line: 1, column: 15 } - } - ] - }, - { - code: '(', - errors: [ - { - type: ErrorCodes.MISSING_SEMICOLON_AFTER_CHARACTER_REFERENCE, - loc: { offset: 14, line: 1, column: 15 } - } - ] - }, - { - code: '@', - errors: [ - { - type: ErrorCodes.MISSING_SEMICOLON_AFTER_CHARACTER_REFERENCE, - loc: { offset: 15, line: 1, column: 16 } - } - ] - } - ], MISSING_WHITESPACE_BETWEEN_ATTRIBUTES: [ { code: '', @@ -2500,48 +2274,6 @@ foo ] } ], - NONCHARACTER_CHARACTER_REFERENCE: [ - { - code: '', - errors: [ - { - type: ErrorCodes.NONCHARACTER_CHARACTER_REFERENCE, - loc: { offset: 10, line: 1, column: 11 } - } - ] - }, - { - code: '', - errors: [ - { - type: ErrorCodes.NONCHARACTER_CHARACTER_REFERENCE, - loc: { offset: 10, line: 1, column: 11 } - } - ] - } - ], - NULL_CHARACTER_REFERENCE: [ - { - code: '', - errors: [ - { - type: ErrorCodes.NULL_CHARACTER_REFERENCE, - loc: { offset: 10, line: 1, column: 11 } - } - ] - } - ], - SURROGATE_CHARACTER_REFERENCE: [ - { - code: '', - errors: [ - { - type: ErrorCodes.SURROGATE_CHARACTER_REFERENCE, - loc: { offset: 10, line: 1, column: 11 } - } - ] - } - ], UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME: [ { code: "", diff --git a/packages/compiler-core/__tests__/transforms/transformElement.spec.ts b/packages/compiler-core/__tests__/transforms/transformElement.spec.ts index 6bdef0db0..a25756d6b 100644 --- a/packages/compiler-core/__tests__/transforms/transformElement.spec.ts +++ b/packages/compiler-core/__tests__/transforms/transformElement.spec.ts @@ -739,6 +739,15 @@ describe('compiler: element transform', () => { expect(node.dynamicProps).toBe(`["foo", "baz"]`) }) + // should treat `class` and `style` as PROPS + test('PROPS on component', () => { + const { node } = parseWithBind( + `