]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
refactor: further tweak compiler layers
authorEvan You <yyx990803@gmail.com>
Tue, 17 Sep 2019 15:57:25 +0000 (11:57 -0400)
committerEvan You <yyx990803@gmail.com>
Tue, 17 Sep 2019 15:57:37 +0000 (11:57 -0400)
31 files changed:
jest.config.js
packages/compiler-core/__tests__/__snapshots__/parse.spec.ts.snap
packages/compiler-core/__tests__/parse.spec.ts
packages/compiler-core/src/assert.ts [deleted file]
packages/compiler-core/src/codegen.ts
packages/compiler-core/src/directives/vBind.ts
packages/compiler-core/src/directives/vFor.ts
packages/compiler-core/src/directives/vIf.ts
packages/compiler-core/src/directives/vModel.ts
packages/compiler-core/src/directives/vOn.ts
packages/compiler-core/src/directives/vPre.ts
packages/compiler-core/src/directives/vSlot.ts
packages/compiler-core/src/directives/vText.ts
packages/compiler-core/src/index.ts
packages/compiler-core/src/optimizations/blocks.ts
packages/compiler-core/src/optimizations/class.ts
packages/compiler-core/src/optimizations/patchFlag.ts
packages/compiler-core/src/optimizations/style.ts
packages/compiler-core/src/parser.ts
packages/compiler-core/src/transform.ts
packages/compiler-dom/__tests__/parse.spec.ts
packages/compiler-dom/src/directives/vCloak.ts
packages/compiler-dom/src/directives/vHtml.ts
packages/compiler-dom/src/directives/vModel.ts
packages/compiler-dom/src/directives/vOn.ts
packages/compiler-dom/src/directives/vShow.ts
packages/compiler-dom/src/index.ts
packages/compiler-dom/src/parserOptionsMinimal.ts
packages/global.d.ts
packages/vue/src/index.ts
rollup.config.js

index 956e0f7a42983b2670184d562f662fe19b6d5106..6c322c834215eca4c48e0e6e9c55a9e009d4179b 100644 (file)
@@ -2,9 +2,9 @@ module.exports = {
   preset: 'ts-jest',
   globals: {
     __DEV__: true,
+    __BROWSER__: false,
     __JSDOM__: true,
     __FEATURE_OPTIONS__: true,
-    __FEATURE_PRODUCTION_TIP__: false,
     __FEATURE_SUSPENSE__: true
   },
   coverageDirectory: 'coverage',
index f488bac6adb1ec6b52707deb100996808aafe7bb..14e2e9d9bc0b0d2ec49ec2612ecea5a4fc8f63c0 100644 (file)
@@ -1,78 +1,6 @@
 // Jest Snapshot v1, https://goo.gl/fbAQLP
 
-exports[`base parser invalid html 1`] = `
-Object {
-  "children": Array [
-    Object {
-      "children": Array [
-        Object {
-          "children": Array [],
-          "isSelfClosing": false,
-          "loc": Object {
-            "end": Object {
-              "column": 1,
-              "line": 3,
-              "offset": 13,
-            },
-            "source": "<span>
-",
-            "start": Object {
-              "column": 1,
-              "line": 2,
-              "offset": 6,
-            },
-          },
-          "ns": 0,
-          "props": Array [],
-          "tag": "span",
-          "tagType": 0,
-          "type": 2,
-        },
-      ],
-      "isSelfClosing": false,
-      "loc": Object {
-        "end": Object {
-          "column": 7,
-          "line": 3,
-          "offset": 19,
-        },
-        "source": "<div>
-<span>
-</div>",
-        "start": Object {
-          "column": 1,
-          "line": 1,
-          "offset": 0,
-        },
-      },
-      "ns": 0,
-      "props": Array [],
-      "tag": "div",
-      "tagType": 0,
-      "type": 2,
-    },
-  ],
-  "loc": Object {
-    "end": Object {
-      "column": 8,
-      "line": 4,
-      "offset": 27,
-    },
-    "source": "<div>
-<span>
-</div>
-</span>",
-    "start": Object {
-      "column": 1,
-      "line": 1,
-      "offset": 0,
-    },
-  },
-  "type": 6,
-}
-`;
-
-exports[`base parser onError option ABRUPT_CLOSING_OF_EMPTY_COMMENT <template><!--></template> 1`] = `
+exports[`base parser Errors ABRUPT_CLOSING_OF_EMPTY_COMMENT <template><!--></template> 1`] = `
 Object {
   "children": Array [
     Object {
@@ -133,7 +61,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option ABRUPT_CLOSING_OF_EMPTY_COMMENT <template><!---></template> 1`] = `
+exports[`base parser Errors ABRUPT_CLOSING_OF_EMPTY_COMMENT <template><!---></template> 1`] = `
 Object {
   "children": Array [
     Object {
@@ -194,7 +122,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option ABRUPT_CLOSING_OF_EMPTY_COMMENT <template><!----></template> 1`] = `
+exports[`base parser Errors ABRUPT_CLOSING_OF_EMPTY_COMMENT <template><!----></template> 1`] = `
 Object {
   "children": Array [
     Object {
@@ -255,7 +183,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option ABSENCE_OF_DIGITS_IN_NUMERIC_CHARACTER_REFERENCE <template attr="&#99;"></template> 1`] = `
+exports[`base parser Errors ABSENCE_OF_DIGITS_IN_NUMERIC_CHARACTER_REFERENCE <template attr="&#99;"></template> 1`] = `
 Object {
   "children": Array [
     Object {
@@ -334,7 +262,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option ABSENCE_OF_DIGITS_IN_NUMERIC_CHARACTER_REFERENCE <template attr="&#a;"></template> 1`] = `
+exports[`base parser Errors ABSENCE_OF_DIGITS_IN_NUMERIC_CHARACTER_REFERENCE <template attr="&#a;"></template> 1`] = `
 Object {
   "children": Array [
     Object {
@@ -413,7 +341,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option ABSENCE_OF_DIGITS_IN_NUMERIC_CHARACTER_REFERENCE <template attr="&#xff;"></template> 1`] = `
+exports[`base parser Errors ABSENCE_OF_DIGITS_IN_NUMERIC_CHARACTER_REFERENCE <template attr="&#xff;"></template> 1`] = `
 Object {
   "children": Array [
     Object {
@@ -492,7 +420,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option ABSENCE_OF_DIGITS_IN_NUMERIC_CHARACTER_REFERENCE <template attr="&#xg;"></template> 1`] = `
+exports[`base parser Errors ABSENCE_OF_DIGITS_IN_NUMERIC_CHARACTER_REFERENCE <template attr="&#xg;"></template> 1`] = `
 Object {
   "children": Array [
     Object {
@@ -571,7 +499,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option ABSENCE_OF_DIGITS_IN_NUMERIC_CHARACTER_REFERENCE <template>&#99;</template> 1`] = `
+exports[`base parser Errors ABSENCE_OF_DIGITS_IN_NUMERIC_CHARACTER_REFERENCE <template>&#99;</template> 1`] = `
 Object {
   "children": Array [
     Object {
@@ -633,7 +561,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option ABSENCE_OF_DIGITS_IN_NUMERIC_CHARACTER_REFERENCE <template>&#a;</template> 1`] = `
+exports[`base parser Errors ABSENCE_OF_DIGITS_IN_NUMERIC_CHARACTER_REFERENCE <template>&#a;</template> 1`] = `
 Object {
   "children": Array [
     Object {
@@ -695,7 +623,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option ABSENCE_OF_DIGITS_IN_NUMERIC_CHARACTER_REFERENCE <template>&#xff;</template> 1`] = `
+exports[`base parser Errors ABSENCE_OF_DIGITS_IN_NUMERIC_CHARACTER_REFERENCE <template>&#xff;</template> 1`] = `
 Object {
   "children": Array [
     Object {
@@ -757,7 +685,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option ABSENCE_OF_DIGITS_IN_NUMERIC_CHARACTER_REFERENCE <template>&#xg;</template> 1`] = `
+exports[`base parser Errors ABSENCE_OF_DIGITS_IN_NUMERIC_CHARACTER_REFERENCE <template>&#xg;</template> 1`] = `
 Object {
   "children": Array [
     Object {
@@ -819,7 +747,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option CDATA_IN_HTML_CONTENT <template><![CDATA[cdata]]></template> 1`] = `
+exports[`base parser Errors CDATA_IN_HTML_CONTENT <template><![CDATA[cdata]]></template> 1`] = `
 Object {
   "children": Array [
     Object {
@@ -880,7 +808,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option CDATA_IN_HTML_CONTENT <template><svg><![CDATA[cdata]]></svg></template> 1`] = `
+exports[`base parser Errors CDATA_IN_HTML_CONTENT <template><svg><![CDATA[cdata]]></svg></template> 1`] = `
 Object {
   "children": Array [
     Object {
@@ -965,7 +893,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option CHARACTER_REFERENCE_OUTSIDE_UNICODE_RANGE <template>&#1234567;</template> 1`] = `
+exports[`base parser Errors CHARACTER_REFERENCE_OUTSIDE_UNICODE_RANGE <template>&#1234567;</template> 1`] = `
 Object {
   "children": Array [
     Object {
@@ -1027,7 +955,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option CONTROL_CHARACTER_REFERENCE <template>&#0003;</template> 1`] = `
+exports[`base parser Errors CONTROL_CHARACTER_REFERENCE <template>&#0003;</template> 1`] = `
 Object {
   "children": Array [
     Object {
@@ -1089,7 +1017,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option CONTROL_CHARACTER_REFERENCE <template>&#x7F;</template> 1`] = `
+exports[`base parser Errors CONTROL_CHARACTER_REFERENCE <template>&#x7F;</template> 1`] = `
 Object {
   "children": Array [
     Object {
@@ -1151,7 +1079,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option DUPLICATE_ATTRIBUTE <template><div id="" id=""></div></template> 1`] = `
+exports[`base parser Errors DUPLICATE_ATTRIBUTE <template><div id="" id=""></div></template> 1`] = `
 Object {
   "children": Array [
     Object {
@@ -1288,7 +1216,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option END_TAG_WITH_ATTRIBUTES <template><div></div id=""></template> 1`] = `
+exports[`base parser Errors END_TAG_WITH_ATTRIBUTES <template><div></div id=""></template> 1`] = `
 Object {
   "children": Array [
     Object {
@@ -1354,7 +1282,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option END_TAG_WITH_TRAILING_SOLIDUS <template><div></div/></template> 1`] = `
+exports[`base parser Errors END_TAG_WITH_TRAILING_SOLIDUS <template><div></div/></template> 1`] = `
 Object {
   "children": Array [
     Object {
@@ -1420,7 +1348,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option EOF_BEFORE_TAG_NAME <template>< 1`] = `
+exports[`base parser Errors EOF_BEFORE_TAG_NAME <template>< 1`] = `
 Object {
   "children": Array [
     Object {
@@ -1482,7 +1410,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option EOF_BEFORE_TAG_NAME <template></ 1`] = `
+exports[`base parser Errors EOF_BEFORE_TAG_NAME <template></ 1`] = `
 Object {
   "children": Array [
     Object {
@@ -1544,7 +1472,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option EOF_IN_CDATA <template><svg><![CDATA[ 1`] = `
+exports[`base parser Errors EOF_IN_CDATA <template><svg><![CDATA[ 1`] = `
 Object {
   "children": Array [
     Object {
@@ -1610,7 +1538,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option EOF_IN_CDATA <template><svg><![CDATA[cdata 1`] = `
+exports[`base parser Errors EOF_IN_CDATA <template><svg><![CDATA[cdata 1`] = `
 Object {
   "children": Array [
     Object {
@@ -1695,7 +1623,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option EOF_IN_COMMENT <template><! 1`] = `
+exports[`base parser Errors EOF_IN_COMMENT <template><! 1`] = `
 Object {
   "children": Array [
     Object {
@@ -1756,7 +1684,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option EOF_IN_COMMENT <template><!- 1`] = `
+exports[`base parser Errors EOF_IN_COMMENT <template><!- 1`] = `
 Object {
   "children": Array [
     Object {
@@ -1817,7 +1745,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option EOF_IN_COMMENT <template><!-- 1`] = `
+exports[`base parser Errors EOF_IN_COMMENT <template><!-- 1`] = `
 Object {
   "children": Array [
     Object {
@@ -1878,7 +1806,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option EOF_IN_COMMENT <template><!--comment 1`] = `
+exports[`base parser Errors EOF_IN_COMMENT <template><!--comment 1`] = `
 Object {
   "children": Array [
     Object {
@@ -1939,7 +1867,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option EOF_IN_COMMENT <template><!abc 1`] = `
+exports[`base parser Errors EOF_IN_COMMENT <template><!abc 1`] = `
 Object {
   "children": Array [
     Object {
@@ -2000,7 +1928,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option EOF_IN_SCRIPT_HTML_COMMENT_LIKE_TEXT <script><!--console.log('hello') 1`] = `
+exports[`base parser Errors EOF_IN_SCRIPT_HTML_COMMENT_LIKE_TEXT <script><!--console.log('hello') 1`] = `
 Object {
   "children": Array [
     Object {
@@ -2062,7 +1990,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option EOF_IN_SCRIPT_HTML_COMMENT_LIKE_TEXT <script>console.log('hello') 1`] = `
+exports[`base parser Errors EOF_IN_SCRIPT_HTML_COMMENT_LIKE_TEXT <script>console.log('hello') 1`] = `
 Object {
   "children": Array [
     Object {
@@ -2124,7 +2052,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option EOF_IN_TAG <template><div  1`] = `
+exports[`base parser Errors EOF_IN_TAG <template><div  1`] = `
 Object {
   "children": Array [
     Object {
@@ -2190,7 +2118,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option EOF_IN_TAG <template><div 1`] = `
+exports[`base parser Errors EOF_IN_TAG <template><div 1`] = `
 Object {
   "children": Array [
     Object {
@@ -2256,7 +2184,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option EOF_IN_TAG <template><div id  1`] = `
+exports[`base parser Errors EOF_IN_TAG <template><div id  1`] = `
 Object {
   "children": Array [
     Object {
@@ -2341,7 +2269,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option EOF_IN_TAG <template><div id = 1`] = `
+exports[`base parser Errors EOF_IN_TAG <template><div id = 1`] = `
 Object {
   "children": Array [
     Object {
@@ -2426,7 +2354,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option EOF_IN_TAG <template><div id 1`] = `
+exports[`base parser Errors EOF_IN_TAG <template><div id 1`] = `
 Object {
   "children": Array [
     Object {
@@ -2511,7 +2439,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option EOF_IN_TAG <template><div id="abc 1`] = `
+exports[`base parser Errors EOF_IN_TAG <template><div id="abc 1`] = `
 Object {
   "children": Array [
     Object {
@@ -2613,7 +2541,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option EOF_IN_TAG <template><div id="abc" 1`] = `
+exports[`base parser Errors EOF_IN_TAG <template><div id="abc" 1`] = `
 Object {
   "children": Array [
     Object {
@@ -2715,7 +2643,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option EOF_IN_TAG <template><div id="abc"/ 1`] = `
+exports[`base parser Errors EOF_IN_TAG <template><div id="abc"/ 1`] = `
 Object {
   "children": Array [
     Object {
@@ -2817,7 +2745,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option EOF_IN_TAG <template><div id='abc 1`] = `
+exports[`base parser Errors EOF_IN_TAG <template><div id='abc 1`] = `
 Object {
   "children": Array [
     Object {
@@ -2919,7 +2847,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option EOF_IN_TAG <template><div id='abc' 1`] = `
+exports[`base parser Errors EOF_IN_TAG <template><div id='abc' 1`] = `
 Object {
   "children": Array [
     Object {
@@ -3021,7 +2949,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option EOF_IN_TAG <template><div id='abc'/ 1`] = `
+exports[`base parser Errors EOF_IN_TAG <template><div id='abc'/ 1`] = `
 Object {
   "children": Array [
     Object {
@@ -3123,7 +3051,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option EOF_IN_TAG <template><div id=abc / 1`] = `
+exports[`base parser Errors EOF_IN_TAG <template><div id=abc / 1`] = `
 Object {
   "children": Array [
     Object {
@@ -3225,7 +3153,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option EOF_IN_TAG <template><div id=abc 1`] = `
+exports[`base parser Errors EOF_IN_TAG <template><div id=abc 1`] = `
 Object {
   "children": Array [
     Object {
@@ -3327,7 +3255,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option INCORRECTLY_CLOSED_COMMENT <template><!--comment--!></template> 1`] = `
+exports[`base parser Errors INCORRECTLY_CLOSED_COMMENT <template><!--comment--!></template> 1`] = `
 Object {
   "children": Array [
     Object {
@@ -3388,7 +3316,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option INCORRECTLY_OPENED_COMMENT <!DOCTYPE html> 1`] = `
+exports[`base parser Errors INCORRECTLY_OPENED_COMMENT <!DOCTYPE html> 1`] = `
 Object {
   "children": Array [
     Object {
@@ -3426,7 +3354,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option INCORRECTLY_OPENED_COMMENT <template><!></template> 1`] = `
+exports[`base parser Errors INCORRECTLY_OPENED_COMMENT <template><!></template> 1`] = `
 Object {
   "children": Array [
     Object {
@@ -3487,7 +3415,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option INCORRECTLY_OPENED_COMMENT <template><!-></template> 1`] = `
+exports[`base parser Errors INCORRECTLY_OPENED_COMMENT <template><!-></template> 1`] = `
 Object {
   "children": Array [
     Object {
@@ -3548,7 +3476,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option INCORRECTLY_OPENED_COMMENT <template><!ELEMENT br EMPTY></template> 1`] = `
+exports[`base parser Errors INCORRECTLY_OPENED_COMMENT <template><!ELEMENT br EMPTY></template> 1`] = `
 Object {
   "children": Array [
     Object {
@@ -3609,7 +3537,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option INVALID_FIRST_CHARACTER_OF_TAG_NAME <template></�></template> 1`] = `
+exports[`base parser Errors INVALID_FIRST_CHARACTER_OF_TAG_NAME <template></�></template> 1`] = `
 Object {
   "children": Array [
     Object {
@@ -3670,7 +3598,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option INVALID_FIRST_CHARACTER_OF_TAG_NAME <template><�></template> 1`] = `
+exports[`base parser Errors INVALID_FIRST_CHARACTER_OF_TAG_NAME <template><�></template> 1`] = `
 Object {
   "children": Array [
     Object {
@@ -3732,7 +3660,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option INVALID_FIRST_CHARACTER_OF_TAG_NAME <template>{{a < b}}</template> 1`] = `
+exports[`base parser Errors INVALID_FIRST_CHARACTER_OF_TAG_NAME <template>{{a < b}}</template> 1`] = `
 Object {
   "children": Array [
     Object {
@@ -3794,7 +3722,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option INVALID_FIRST_CHARACTER_OF_TAG_NAME <template>a < b</template> 1`] = `
+exports[`base parser Errors INVALID_FIRST_CHARACTER_OF_TAG_NAME <template>a < b</template> 1`] = `
 Object {
   "children": Array [
     Object {
@@ -3856,7 +3784,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option INVALID_FIRST_CHARACTER_OF_TAG_NAME <template>a </ b</template> 1`] = `
+exports[`base parser Errors INVALID_FIRST_CHARACTER_OF_TAG_NAME <template>a </ b</template> 1`] = `
 Object {
   "children": Array [
     Object {
@@ -3935,7 +3863,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option MISSING_ATTRIBUTE_VALUE <template><div id= /></div></template> 1`] = `
+exports[`base parser Errors MISSING_ATTRIBUTE_VALUE <template><div id= /></div></template> 1`] = `
 Object {
   "children": Array [
     Object {
@@ -4037,7 +3965,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option MISSING_ATTRIBUTE_VALUE <template><div id= ></div></template> 1`] = `
+exports[`base parser Errors MISSING_ATTRIBUTE_VALUE <template><div id= ></div></template> 1`] = `
 Object {
   "children": Array [
     Object {
@@ -4122,7 +4050,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option MISSING_ATTRIBUTE_VALUE <template><div id=></div></template> 1`] = `
+exports[`base parser Errors MISSING_ATTRIBUTE_VALUE <template><div id=></div></template> 1`] = `
 Object {
   "children": Array [
     Object {
@@ -4207,7 +4135,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option MISSING_END_TAG_NAME <template></></template> 1`] = `
+exports[`base parser Errors MISSING_END_TAG_NAME <template></></template> 1`] = `
 Object {
   "children": Array [
     Object {
@@ -4250,7 +4178,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option MISSING_SEMICOLON_AFTER_CHARACTER_REFERENCE <template>&#40</template> 1`] = `
+exports[`base parser Errors MISSING_SEMICOLON_AFTER_CHARACTER_REFERENCE <template>&#40</template> 1`] = `
 Object {
   "children": Array [
     Object {
@@ -4312,7 +4240,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option MISSING_SEMICOLON_AFTER_CHARACTER_REFERENCE <template>&#x40</template> 1`] = `
+exports[`base parser Errors MISSING_SEMICOLON_AFTER_CHARACTER_REFERENCE <template>&#x40</template> 1`] = `
 Object {
   "children": Array [
     Object {
@@ -4374,7 +4302,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option MISSING_SEMICOLON_AFTER_CHARACTER_REFERENCE <template>&amp</template> 1`] = `
+exports[`base parser Errors MISSING_SEMICOLON_AFTER_CHARACTER_REFERENCE <template>&amp</template> 1`] = `
 Object {
   "children": Array [
     Object {
@@ -4436,7 +4364,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option MISSING_WHITESPACE_BETWEEN_ATTRIBUTES <template><div id="foo"\\x0d;\\x0a;class="bar"></div></template> 1`] = `
+exports[`base parser Errors MISSING_WHITESPACE_BETWEEN_ATTRIBUTES <template><div id="foo"\\x0d;\\x0a;class="bar"></div></template> 1`] = `
 Object {
   "children": Array [
     Object {
@@ -4576,7 +4504,7 @@ class=\\"bar\\"></div></template>",
 }
 `;
 
-exports[`base parser onError option MISSING_WHITESPACE_BETWEEN_ATTRIBUTES <template><div id="foo"class="bar"></div></template> 1`] = `
+exports[`base parser Errors MISSING_WHITESPACE_BETWEEN_ATTRIBUTES <template><div id="foo"class="bar"></div></template> 1`] = `
 Object {
   "children": Array [
     Object {
@@ -4713,7 +4641,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option NESTED_COMMENT <template><!--a<!-- 1`] = `
+exports[`base parser Errors NESTED_COMMENT <template><!--a<!-- 1`] = `
 Object {
   "children": Array [
     Object {
@@ -4774,7 +4702,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option NESTED_COMMENT <template><!--a<!--></template> 1`] = `
+exports[`base parser Errors NESTED_COMMENT <template><!--a<!--></template> 1`] = `
 Object {
   "children": Array [
     Object {
@@ -4835,7 +4763,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option NESTED_COMMENT <template><!--a<!--b<!--c--></template> 1`] = `
+exports[`base parser Errors NESTED_COMMENT <template><!--a<!--b<!--c--></template> 1`] = `
 Object {
   "children": Array [
     Object {
@@ -4896,7 +4824,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option NESTED_COMMENT <template><!--a<!--b--></template> 1`] = `
+exports[`base parser Errors NESTED_COMMENT <template><!--a<!--b--></template> 1`] = `
 Object {
   "children": Array [
     Object {
@@ -4957,7 +4885,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option NONCHARACTER_CHARACTER_REFERENCE <template>&#x1FFFF;</template> 1`] = `
+exports[`base parser Errors NONCHARACTER_CHARACTER_REFERENCE <template>&#x1FFFF;</template> 1`] = `
 Object {
   "children": Array [
     Object {
@@ -5019,7 +4947,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option NONCHARACTER_CHARACTER_REFERENCE <template>&#xFFFE;</template> 1`] = `
+exports[`base parser Errors NONCHARACTER_CHARACTER_REFERENCE <template>&#xFFFE;</template> 1`] = `
 Object {
   "children": Array [
     Object {
@@ -5081,7 +5009,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option NULL_CHARACTER_REFERENCE <template>&#0000;</template> 1`] = `
+exports[`base parser Errors NULL_CHARACTER_REFERENCE <template>&#0000;</template> 1`] = `
 Object {
   "children": Array [
     Object {
@@ -5143,7 +5071,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option SURROGATE_CHARACTER_REFERENCE <template>&#xD800;</template> 1`] = `
+exports[`base parser Errors SURROGATE_CHARACTER_REFERENCE <template>&#xD800;</template> 1`] = `
 Object {
   "children": Array [
     Object {
@@ -5205,7 +5133,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME <template><div a"bc=''></div></template> 1`] = `
+exports[`base parser Errors UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME <template><div a"bc=''></div></template> 1`] = `
 Object {
   "children": Array [
     Object {
@@ -5307,7 +5235,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME <template><div a'bc=''></div></template> 1`] = `
+exports[`base parser Errors UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME <template><div a'bc=''></div></template> 1`] = `
 Object {
   "children": Array [
     Object {
@@ -5409,7 +5337,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME <template><div a<bc=''></div></template> 1`] = `
+exports[`base parser Errors UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME <template><div a<bc=''></div></template> 1`] = `
 Object {
   "children": Array [
     Object {
@@ -5511,7 +5439,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_VALUE <template><div foo=bar"></div></template> 1`] = `
+exports[`base parser Errors UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_VALUE <template><div foo=bar"></div></template> 1`] = `
 Object {
   "children": Array [
     Object {
@@ -5613,7 +5541,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_VALUE <template><div foo=bar'></div></template> 1`] = `
+exports[`base parser Errors UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_VALUE <template><div foo=bar'></div></template> 1`] = `
 Object {
   "children": Array [
     Object {
@@ -5715,7 +5643,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_VALUE <template><div foo=bar<div></div></template> 1`] = `
+exports[`base parser Errors UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_VALUE <template><div foo=bar<div></div></template> 1`] = `
 Object {
   "children": Array [
     Object {
@@ -5817,7 +5745,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_VALUE <template><div foo=bar=baz></div></template> 1`] = `
+exports[`base parser Errors UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_VALUE <template><div foo=bar=baz></div></template> 1`] = `
 Object {
   "children": Array [
     Object {
@@ -5919,7 +5847,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_VALUE <template><div foo=bar\`></div></template> 1`] = `
+exports[`base parser Errors UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_VALUE <template><div foo=bar\`></div></template> 1`] = `
 Object {
   "children": Array [
     Object {
@@ -6021,7 +5949,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME <template><div =></div></template> 1`] = `
+exports[`base parser Errors UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME <template><div =></div></template> 1`] = `
 Object {
   "children": Array [
     Object {
@@ -6106,7 +6034,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME <template><div =foo=bar></div></template> 1`] = `
+exports[`base parser Errors UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME <template><div =foo=bar></div></template> 1`] = `
 Object {
   "children": Array [
     Object {
@@ -6208,7 +6136,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option UNEXPECTED_QUESTION_MARK_INSTEAD_OF_TAG_NAME <template><?xml?></template> 1`] = `
+exports[`base parser Errors UNEXPECTED_QUESTION_MARK_INSTEAD_OF_TAG_NAME <template><?xml?></template> 1`] = `
 Object {
   "children": Array [
     Object {
@@ -6269,7 +6197,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option UNEXPECTED_SOLIDUS_IN_TAG <template><div a/b></div></template> 1`] = `
+exports[`base parser Errors UNEXPECTED_SOLIDUS_IN_TAG <template><div a/b></div></template> 1`] = `
 Object {
   "children": Array [
     Object {
@@ -6372,7 +6300,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option UNKNOWN_NAMED_CHARACTER_REFERENCE <template>&unknown;</template> 1`] = `
+exports[`base parser Errors UNKNOWN_NAMED_CHARACTER_REFERENCE <template>&unknown;</template> 1`] = `
 Object {
   "children": Array [
     Object {
@@ -6434,7 +6362,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option X_INVALID_END_TAG <svg><![CDATA[</div>]]></svg> 1`] = `
+exports[`base parser Errors X_INVALID_END_TAG <svg><![CDATA[</div>]]></svg> 1`] = `
 Object {
   "children": Array [
     Object {
@@ -6496,7 +6424,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option X_INVALID_END_TAG <svg><!--</div>--></svg> 1`] = `
+exports[`base parser Errors X_INVALID_END_TAG <svg><!--</div>--></svg> 1`] = `
 Object {
   "children": Array [
     Object {
@@ -6557,7 +6485,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option X_INVALID_END_TAG <template></div></div></template> 1`] = `
+exports[`base parser Errors X_INVALID_END_TAG <template></div></div></template> 1`] = `
 Object {
   "children": Array [
     Object {
@@ -6600,7 +6528,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option X_INVALID_END_TAG <template></div></template> 1`] = `
+exports[`base parser Errors X_INVALID_END_TAG <template></div></template> 1`] = `
 Object {
   "children": Array [
     Object {
@@ -6643,7 +6571,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option X_INVALID_END_TAG <template>{{'</div>'}}</template> 1`] = `
+exports[`base parser Errors X_INVALID_END_TAG <template>{{'</div>'}}</template> 1`] = `
 Object {
   "children": Array [
     Object {
@@ -6705,7 +6633,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option X_INVALID_END_TAG <textarea></div></textarea> 1`] = `
+exports[`base parser Errors X_INVALID_END_TAG <textarea></div></textarea> 1`] = `
 Object {
   "children": Array [
     Object {
@@ -6767,7 +6695,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option X_MISSING_END_TAG <template><div> 1`] = `
+exports[`base parser Errors X_MISSING_END_TAG <template><div> 1`] = `
 Object {
   "children": Array [
     Object {
@@ -6833,7 +6761,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option X_MISSING_END_TAG <template><div></template> 1`] = `
+exports[`base parser Errors X_MISSING_END_TAG <template><div></template> 1`] = `
 Object {
   "children": Array [
     Object {
@@ -6899,7 +6827,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option X_MISSING_INTERPOLATION_END {{ 1`] = `
+exports[`base parser Errors X_MISSING_INTERPOLATION_END {{ 1`] = `
 Object {
   "children": Array [
     Object {
@@ -6938,7 +6866,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option X_MISSING_INTERPOLATION_END {{ foo 1`] = `
+exports[`base parser Errors X_MISSING_INTERPOLATION_END {{ foo 1`] = `
 Object {
   "children": Array [
     Object {
@@ -6977,7 +6905,7 @@ Object {
 }
 `;
 
-exports[`base parser onError option X_MISSING_INTERPOLATION_END {{}} 1`] = `
+exports[`base parser Errors X_MISSING_INTERPOLATION_END {{}} 1`] = `
 Object {
   "children": Array [
     Object {
@@ -7016,6 +6944,78 @@ Object {
 }
 `;
 
+exports[`base parser invalid html 1`] = `
+Object {
+  "children": Array [
+    Object {
+      "children": Array [
+        Object {
+          "children": Array [],
+          "isSelfClosing": false,
+          "loc": Object {
+            "end": Object {
+              "column": 1,
+              "line": 3,
+              "offset": 13,
+            },
+            "source": "<span>
+",
+            "start": Object {
+              "column": 1,
+              "line": 2,
+              "offset": 6,
+            },
+          },
+          "ns": 0,
+          "props": Array [],
+          "tag": "span",
+          "tagType": 0,
+          "type": 2,
+        },
+      ],
+      "isSelfClosing": false,
+      "loc": Object {
+        "end": Object {
+          "column": 7,
+          "line": 3,
+          "offset": 19,
+        },
+        "source": "<div>
+<span>
+</div>",
+        "start": Object {
+          "column": 1,
+          "line": 1,
+          "offset": 0,
+        },
+      },
+      "ns": 0,
+      "props": Array [],
+      "tag": "div",
+      "tagType": 0,
+      "type": 2,
+    },
+  ],
+  "loc": Object {
+    "end": Object {
+      "column": 8,
+      "line": 4,
+      "offset": 27,
+    },
+    "source": "<div>
+<span>
+</div>
+</span>",
+    "start": Object {
+      "column": 1,
+      "line": 1,
+      "offset": 0,
+    },
+  },
+  "type": 6,
+}
+`;
+
 exports[`base parser self closing multiple tag 1`] = `
 Object {
   "children": Array [
index 20d3c1af5d9b1d1446155be2d13332b0c4df8c1a..dbe2e334d67000330c12cdd4daaa8709255d176e 100644 (file)
@@ -9,7 +9,8 @@ import {
   Namespaces,
   NodeTypes,
   Position,
-  TextNode
+  TextNode,
+  AttributeNode
 } from '../src/ast'
 
 describe('base parser', () => {
@@ -175,6 +176,84 @@ describe('base parser', () => {
       })
     })
 
+    test('HTML entities compatibility in text (https://html.spec.whatwg.org/multipage/parsing.html#named-character-reference-state).', () => {
+      const spy = jest.fn()
+      const ast = parse('&ampersand;', {
+        namedCharacterReferences: { amp: '&' },
+        onError: spy
+      })
+      const text = ast.children[0] as TextNode
+
+      expect(text).toStrictEqual({
+        type: NodeTypes.TEXT,
+        content: '&ersand;',
+        isEmpty: false,
+        loc: {
+          start: { offset: 0, line: 1, column: 1 },
+          end: { offset: 11, line: 1, column: 12 },
+          source: '&ampersand;'
+        }
+      })
+      expect(spy.mock.calls).toEqual([
+        [
+          ParserErrorTypes.MISSING_SEMICOLON_AFTER_CHARACTER_REFERENCE,
+          { 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 = parse(
+        '<div a="&ampersand;" b="&amp;ersand;" c="&amp!"></div>',
+        {
+          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: '&ampersand;',
+        isEmpty: false,
+        loc: {
+          start: { offset: 7, line: 1, column: 8 },
+          end: { offset: 20, line: 1, column: 21 },
+          source: '"&ampersand;"'
+        }
+      })
+      expect(text2).toStrictEqual({
+        type: NodeTypes.TEXT,
+        content: '&ersand;',
+        isEmpty: false,
+        loc: {
+          start: { offset: 23, line: 1, column: 24 },
+          end: { offset: 37, line: 1, column: 38 },
+          source: '"&amp;ersand;"'
+        }
+      })
+      expect(text3).toStrictEqual({
+        type: NodeTypes.TEXT,
+        content: '&!',
+        isEmpty: false,
+        loc: {
+          start: { offset: 40, line: 1, column: 41 },
+          end: { offset: 47, line: 1, column: 48 },
+          source: '"&amp!"'
+        }
+      })
+      expect(spy.mock.calls).toEqual([
+        [
+          ParserErrorTypes.MISSING_SEMICOLON_AFTER_CHARACTER_REFERENCE,
+          { offset: 45, line: 1, column: 46 }
+        ]
+      ])
+    })
+
     test('Some control character reference should be replaced.', () => {
       const spy = jest.fn()
       const ast = parse('&#x86;', { onError: spy })
diff --git a/packages/compiler-core/src/assert.ts b/packages/compiler-core/src/assert.ts
deleted file mode 100644 (file)
index e69de29..0000000
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..70b786d12ed055a08b57f5cf47f717bf6a266301 100644 (file)
@@ -0,0 +1 @@
+// TODO
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..70b786d12ed055a08b57f5cf47f717bf6a266301 100644 (file)
@@ -0,0 +1 @@
+// TODO
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..70b786d12ed055a08b57f5cf47f717bf6a266301 100644 (file)
@@ -0,0 +1 @@
+// TODO
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..70b786d12ed055a08b57f5cf47f717bf6a266301 100644 (file)
@@ -0,0 +1 @@
+// TODO
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..70b786d12ed055a08b57f5cf47f717bf6a266301 100644 (file)
@@ -0,0 +1 @@
+// TODO
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..70b786d12ed055a08b57f5cf47f717bf6a266301 100644 (file)
@@ -0,0 +1 @@
+// TODO
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..70b786d12ed055a08b57f5cf47f717bf6a266301 100644 (file)
@@ -0,0 +1 @@
+// TODO
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..70b786d12ed055a08b57f5cf47f717bf6a266301 100644 (file)
@@ -0,0 +1 @@
+// TODO
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..70b786d12ed055a08b57f5cf47f717bf6a266301 100644 (file)
@@ -0,0 +1 @@
+// TODO
index d6bb179e9cd41f0d289302cfb13d4f8e33bd506b..6cd157a49c74f08f368747b08a8b17bd797a5704 100644 (file)
@@ -1,3 +1,3 @@
 export { parse, ParserOptions, TextModes } from './parser'
+export { ParserErrorTypes } from './errorTypes'
 export * from './ast'
-export * from './errorTypes'
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..70b786d12ed055a08b57f5cf47f717bf6a266301 100644 (file)
@@ -0,0 +1 @@
+// TODO
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..70b786d12ed055a08b57f5cf47f717bf6a266301 100644 (file)
@@ -0,0 +1 @@
+// TODO
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..70b786d12ed055a08b57f5cf47f717bf6a266301 100644 (file)
@@ -0,0 +1 @@
+// TODO
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..70b786d12ed055a08b57f5cf47f717bf6a266301 100644 (file)
@@ -0,0 +1 @@
+// TODO
index 7c3edc85a451f0b6a2719ee22b59adf704724a4d..0b45b5c609cfae0d69a0e3481f975c22fcce6f72 100644 (file)
@@ -35,10 +35,18 @@ export const defaultParserOptions: Required<ParserOptions> = {
   getNamespace: () => Namespaces.HTML,
   getTextMode: () => TextModes.DATA,
   isVoidTag: () => false,
-  namedCharacterReferences: {},
+  namedCharacterReferences: {
+    'gt;': '>',
+    'lt;': '<',
+    'amp;': '&',
+    'apos;': "'",
+    'quot;': '"'
+  },
   onError(code: ParserErrorTypes, loc: Position): void {
     const error: any = new SyntaxError(
-      `${errorMessages[code]} (${loc.line}:${loc.column})`
+      `${__DEV__ || !__BROWSER__ ? errorMessages[code] : code} (${loc.line}:${
+        loc.column
+      })`
     )
     error.code = code
     error.loc = loc
@@ -658,7 +666,7 @@ function parseTextData(
     return text
   }
 
-  // DATA or RCDATA.
+  // DATA or RCDATA. Entity decoding required.
   const end = context.offset + length
   let text: string = ''
 
@@ -767,7 +775,6 @@ function parseTextData(
       }
     }
   }
-
   return text
 }
 
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..70b786d12ed055a08b57f5cf47f717bf6a266301 100644 (file)
@@ -0,0 +1 @@
+// TODO
index 86f62c8ae0b8c1ad5fce9572e49945253637091c..7d43a6d049bb8786f9c80aa2bb09c5eb51adb829 100644 (file)
@@ -3,7 +3,6 @@ import {
   NodeTypes,
   ElementNode,
   TextNode,
-  AttributeNode,
   ParserErrorTypes,
   ExpressionNode,
   ElementTypes
@@ -104,86 +103,6 @@ describe('DOM parser', () => {
         }
       })
     })
-
-    test('HTML entities compatibility in text (https://html.spec.whatwg.org/multipage/parsing.html#named-character-reference-state).', () => {
-      const spy = jest.fn()
-      const ast = parse('&ampersand;', {
-        ...parserOptions,
-        namedCharacterReferences: { amp: '&' },
-        onError: spy
-      })
-      const text = ast.children[0] as TextNode
-
-      expect(text).toStrictEqual({
-        type: NodeTypes.TEXT,
-        content: '&ersand;',
-        isEmpty: false,
-        loc: {
-          start: { offset: 0, line: 1, column: 1 },
-          end: { offset: 11, line: 1, column: 12 },
-          source: '&ampersand;'
-        }
-      })
-      expect(spy.mock.calls).toEqual([
-        [
-          ParserErrorTypes.MISSING_SEMICOLON_AFTER_CHARACTER_REFERENCE,
-          { 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 = parse(
-        '<div a="&ampersand;" b="&amp;ersand;" c="&amp!"></div>',
-        {
-          ...parserOptions,
-          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: '&ampersand;',
-        isEmpty: false,
-        loc: {
-          start: { offset: 7, line: 1, column: 8 },
-          end: { offset: 20, line: 1, column: 21 },
-          source: '"&ampersand;"'
-        }
-      })
-      expect(text2).toStrictEqual({
-        type: NodeTypes.TEXT,
-        content: '&ersand;',
-        isEmpty: false,
-        loc: {
-          start: { offset: 23, line: 1, column: 24 },
-          end: { offset: 37, line: 1, column: 38 },
-          source: '"&amp;ersand;"'
-        }
-      })
-      expect(text3).toStrictEqual({
-        type: NodeTypes.TEXT,
-        content: '&!',
-        isEmpty: false,
-        loc: {
-          start: { offset: 40, line: 1, column: 41 },
-          end: { offset: 47, line: 1, column: 48 },
-          source: '"&amp!"'
-        }
-      })
-      expect(spy.mock.calls).toEqual([
-        [
-          ParserErrorTypes.MISSING_SEMICOLON_AFTER_CHARACTER_REFERENCE,
-          { offset: 45, line: 1, column: 46 }
-        ]
-      ])
-    })
   })
 
   describe('Interpolation', () => {
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..70b786d12ed055a08b57f5cf47f717bf6a266301 100644 (file)
@@ -0,0 +1 @@
+// TODO
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..70b786d12ed055a08b57f5cf47f717bf6a266301 100644 (file)
@@ -0,0 +1 @@
+// TODO
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..70b786d12ed055a08b57f5cf47f717bf6a266301 100644 (file)
@@ -0,0 +1 @@
+// TODO
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..70b786d12ed055a08b57f5cf47f717bf6a266301 100644 (file)
@@ -0,0 +1 @@
+// TODO
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..70b786d12ed055a08b57f5cf47f717bf6a266301 100644 (file)
@@ -0,0 +1 @@
+// TODO
index a1a106456dce9ab55edb5f2ae7521a5c942f9f00..5c052d2f67de808f7e6f3ca1765c1d6132d7e920 100644 (file)
@@ -1,4 +1,8 @@
 // TODO
 export * from '@vue/compiler-core'
-export { parserOptionsMinimal } from './parserOptionsMinimal'
-export { parserOptionsStandard } from './parserOptionsStandard'
+import { parserOptionsMinimal } from './parserOptionsMinimal'
+import { parserOptionsStandard } from './parserOptionsStandard'
+
+export const parserOptions = __BROWSER__
+  ? parserOptionsMinimal
+  : parserOptionsStandard
index a652f17fdba402ca796d8e65dd98838ad3781b4d..a22614a8ae9b26cb16d77ab6325b0e490b83e0f6 100644 (file)
@@ -81,13 +81,5 @@ export const parserOptionsMinimal: ParserOptions = {
 
   isVoidTag(tag: string): boolean {
     return VOID_TAG_RE.test(tag)
-  },
-
-  namedCharacterReferences: {
-    'gt;': '>',
-    'lt;': '<',
-    'amp;': '&',
-    'apos;': "'",
-    'quot;': '"'
   }
 }
index 6e0808fe0ff34c2956e016f6faf866f49bdbba17..0d81152785759c1863274b90044e2d9188b65ec5 100644 (file)
@@ -1,8 +1,8 @@
 // Global compile-time constants
 declare var __DEV__: boolean
 declare var __JSDOM__: boolean
+declare var __BROWSER__: boolean
 
 // Feature flags
 declare var __FEATURE_OPTIONS__: boolean
-declare var __FEATURE_PRODUCTION_TIP__: boolean
 declare var __FEATURE_SUSPENSE__: boolean
index b70c9fe2c8d4a0adb25b47ba05f9527baa67e518..11fdece3f4bf1f8a52426831f3f70a681a3e0597 100644 (file)
@@ -7,7 +7,7 @@
 export * from '@vue/compiler-dom'
 export * from '@vue/runtime-dom'
 
-if (__FEATURE_PRODUCTION_TIP__) {
+if (__BROWSER__ && __DEV__) {
   console[console.info ? 'info' : 'log'](
     `You are running a development build of Vue.\n` +
       `Make sure to use the production build (*.prod.js) when deploying for production.`
index e94a5ce17ad4e397f78d7985e23dc14a64f5f0a9..360bdf9b2ca2d7f61fc4ebd4231dc2090d4d5106 100644 (file)
@@ -134,9 +134,8 @@ function createReplacePlugin(isProduction, isBunlderESMBuild, isBrowserBuild) {
         `process.env.NODE_ENV !== 'production'`
       : // hard coded dev/prod builds
         !isProduction,
-    // show production tip?
-    // should only do this for dev AND browser-targeting builds.
-    __FEATURE_PRODUCTION_TIP__: !isProduction && isBrowserBuild,
+    // If the build is expected to run directly in the browser (global / esm-browser builds)
+    __BROWSER__: isBrowserBuild,
     // support options?
     // the lean build drops options related code with buildOptions.lean: true
     __FEATURE_OPTIONS__: !packageOptions.lean,