@vue/compiler-dom 3.5.16 → 3.6.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/compiler-dom.cjs.js +10 -5
- package/dist/compiler-dom.cjs.prod.js +175 -5
- package/dist/compiler-dom.d.ts +20 -3
- package/dist/compiler-dom.esm-browser.js +114 -44
- package/dist/compiler-dom.esm-browser.prod.js +11 -11
- package/dist/compiler-dom.esm-bundler.js +10 -7
- package/dist/compiler-dom.global.js +122 -43
- package/dist/compiler-dom.global.prod.js +10 -10
- package/package.json +3 -3
package/dist/compiler-dom.cjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-dom v3.
|
|
2
|
+
* @vue/compiler-dom v3.6.0-alpha.1
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -162,7 +162,9 @@ const DOMErrorMessages = {
|
|
|
162
162
|
[60]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
|
|
163
163
|
[61]: `v-show is missing expression.`,
|
|
164
164
|
[62]: `<Transition> expects exactly one child element or component.`,
|
|
165
|
-
[63]: `Tags with side effect (<script> and <style>) are ignored in client component templates
|
|
165
|
+
[63]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`,
|
|
166
|
+
// just to fulfill types
|
|
167
|
+
[64]: ``
|
|
166
168
|
};
|
|
167
169
|
|
|
168
170
|
const transformVHtml = (dir, node, context) => {
|
|
@@ -311,7 +313,7 @@ const resolveModifiers = (key, modifiers, context, loc) => {
|
|
|
311
313
|
const eventOptionModifiers = [];
|
|
312
314
|
for (let i = 0; i < modifiers.length; i++) {
|
|
313
315
|
const modifier = modifiers[i].content;
|
|
314
|
-
if (modifier === "native" && compilerCore.checkCompatEnabled(
|
|
316
|
+
if (modifier === "native" && context && compilerCore.checkCompatEnabled(
|
|
315
317
|
"COMPILER_V_ON_NATIVE",
|
|
316
318
|
context,
|
|
317
319
|
loc
|
|
@@ -320,9 +322,10 @@ const resolveModifiers = (key, modifiers, context, loc) => {
|
|
|
320
322
|
} else if (isEventOptionModifier(modifier)) {
|
|
321
323
|
eventOptionModifiers.push(modifier);
|
|
322
324
|
} else {
|
|
325
|
+
const keyString = shared.isString(key) ? key : compilerCore.isStaticExp(key) ? key.content : null;
|
|
323
326
|
if (maybeKeyModifier(modifier)) {
|
|
324
|
-
if (
|
|
325
|
-
if (isKeyboardEvent(
|
|
327
|
+
if (keyString) {
|
|
328
|
+
if (isKeyboardEvent(keyString.toLowerCase())) {
|
|
326
329
|
keyModifiers.push(modifier);
|
|
327
330
|
} else {
|
|
328
331
|
nonKeyModifiers.push(modifier);
|
|
@@ -923,8 +926,10 @@ exports.V_ON_WITH_MODIFIERS = V_ON_WITH_MODIFIERS;
|
|
|
923
926
|
exports.V_SHOW = V_SHOW;
|
|
924
927
|
exports.compile = compile;
|
|
925
928
|
exports.createDOMCompilerError = createDOMCompilerError;
|
|
929
|
+
exports.isValidHTMLNesting = isValidHTMLNesting;
|
|
926
930
|
exports.parse = parse;
|
|
927
931
|
exports.parserOptions = parserOptions;
|
|
932
|
+
exports.resolveModifiers = resolveModifiers;
|
|
928
933
|
exports.transformStyle = transformStyle;
|
|
929
934
|
Object.keys(compilerCore).forEach(function (k) {
|
|
930
935
|
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) exports[k] = compilerCore[k];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-dom v3.
|
|
2
|
+
* @vue/compiler-dom v3.6.0-alpha.1
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -162,7 +162,9 @@ const DOMErrorMessages = {
|
|
|
162
162
|
[60]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
|
|
163
163
|
[61]: `v-show is missing expression.`,
|
|
164
164
|
[62]: `<Transition> expects exactly one child element or component.`,
|
|
165
|
-
[63]: `Tags with side effect (<script> and <style>) are ignored in client component templates
|
|
165
|
+
[63]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`,
|
|
166
|
+
// just to fulfill types
|
|
167
|
+
[64]: ``
|
|
166
168
|
};
|
|
167
169
|
|
|
168
170
|
const transformVHtml = (dir, node, context) => {
|
|
@@ -293,7 +295,7 @@ const resolveModifiers = (key, modifiers, context, loc) => {
|
|
|
293
295
|
const eventOptionModifiers = [];
|
|
294
296
|
for (let i = 0; i < modifiers.length; i++) {
|
|
295
297
|
const modifier = modifiers[i].content;
|
|
296
|
-
if (modifier === "native" && compilerCore.checkCompatEnabled(
|
|
298
|
+
if (modifier === "native" && context && compilerCore.checkCompatEnabled(
|
|
297
299
|
"COMPILER_V_ON_NATIVE",
|
|
298
300
|
context,
|
|
299
301
|
loc
|
|
@@ -302,9 +304,10 @@ const resolveModifiers = (key, modifiers, context, loc) => {
|
|
|
302
304
|
} else if (isEventOptionModifier(modifier)) {
|
|
303
305
|
eventOptionModifiers.push(modifier);
|
|
304
306
|
} else {
|
|
307
|
+
const keyString = shared.isString(key) ? key : compilerCore.isStaticExp(key) ? key.content : null;
|
|
305
308
|
if (maybeKeyModifier(modifier)) {
|
|
306
|
-
if (
|
|
307
|
-
if (isKeyboardEvent(
|
|
309
|
+
if (keyString) {
|
|
310
|
+
if (isKeyboardEvent(keyString.toLowerCase())) {
|
|
308
311
|
keyModifiers.push(modifier);
|
|
309
312
|
} else {
|
|
310
313
|
nonKeyModifiers.push(modifier);
|
|
@@ -623,6 +626,171 @@ const ignoreSideEffectTags = (node, context) => {
|
|
|
623
626
|
}
|
|
624
627
|
};
|
|
625
628
|
|
|
629
|
+
function isValidHTMLNesting(parent, child) {
|
|
630
|
+
if (parent === "template") {
|
|
631
|
+
return true;
|
|
632
|
+
}
|
|
633
|
+
if (parent in onlyValidChildren) {
|
|
634
|
+
return onlyValidChildren[parent].has(child);
|
|
635
|
+
}
|
|
636
|
+
if (child in onlyValidParents) {
|
|
637
|
+
return onlyValidParents[child].has(parent);
|
|
638
|
+
}
|
|
639
|
+
if (parent in knownInvalidChildren) {
|
|
640
|
+
if (knownInvalidChildren[parent].has(child)) return false;
|
|
641
|
+
}
|
|
642
|
+
if (child in knownInvalidParents) {
|
|
643
|
+
if (knownInvalidParents[child].has(parent)) return false;
|
|
644
|
+
}
|
|
645
|
+
return true;
|
|
646
|
+
}
|
|
647
|
+
const headings = /* @__PURE__ */ new Set(["h1", "h2", "h3", "h4", "h5", "h6"]);
|
|
648
|
+
const emptySet = /* @__PURE__ */ new Set([]);
|
|
649
|
+
const onlyValidChildren = {
|
|
650
|
+
head: /* @__PURE__ */ new Set([
|
|
651
|
+
"base",
|
|
652
|
+
"basefront",
|
|
653
|
+
"bgsound",
|
|
654
|
+
"link",
|
|
655
|
+
"meta",
|
|
656
|
+
"title",
|
|
657
|
+
"noscript",
|
|
658
|
+
"noframes",
|
|
659
|
+
"style",
|
|
660
|
+
"script",
|
|
661
|
+
"template"
|
|
662
|
+
]),
|
|
663
|
+
optgroup: /* @__PURE__ */ new Set(["option"]),
|
|
664
|
+
select: /* @__PURE__ */ new Set(["optgroup", "option", "hr"]),
|
|
665
|
+
// table
|
|
666
|
+
table: /* @__PURE__ */ new Set(["caption", "colgroup", "tbody", "tfoot", "thead"]),
|
|
667
|
+
tr: /* @__PURE__ */ new Set(["td", "th"]),
|
|
668
|
+
colgroup: /* @__PURE__ */ new Set(["col"]),
|
|
669
|
+
tbody: /* @__PURE__ */ new Set(["tr"]),
|
|
670
|
+
thead: /* @__PURE__ */ new Set(["tr"]),
|
|
671
|
+
tfoot: /* @__PURE__ */ new Set(["tr"]),
|
|
672
|
+
// these elements can not have any children elements
|
|
673
|
+
script: emptySet,
|
|
674
|
+
iframe: emptySet,
|
|
675
|
+
option: emptySet,
|
|
676
|
+
textarea: emptySet,
|
|
677
|
+
style: emptySet,
|
|
678
|
+
title: emptySet
|
|
679
|
+
};
|
|
680
|
+
const onlyValidParents = {
|
|
681
|
+
// sections
|
|
682
|
+
html: emptySet,
|
|
683
|
+
body: /* @__PURE__ */ new Set(["html"]),
|
|
684
|
+
head: /* @__PURE__ */ new Set(["html"]),
|
|
685
|
+
// table
|
|
686
|
+
td: /* @__PURE__ */ new Set(["tr"]),
|
|
687
|
+
colgroup: /* @__PURE__ */ new Set(["table"]),
|
|
688
|
+
caption: /* @__PURE__ */ new Set(["table"]),
|
|
689
|
+
tbody: /* @__PURE__ */ new Set(["table"]),
|
|
690
|
+
tfoot: /* @__PURE__ */ new Set(["table"]),
|
|
691
|
+
col: /* @__PURE__ */ new Set(["colgroup"]),
|
|
692
|
+
th: /* @__PURE__ */ new Set(["tr"]),
|
|
693
|
+
thead: /* @__PURE__ */ new Set(["table"]),
|
|
694
|
+
tr: /* @__PURE__ */ new Set(["tbody", "thead", "tfoot"]),
|
|
695
|
+
// data list
|
|
696
|
+
dd: /* @__PURE__ */ new Set(["dl", "div"]),
|
|
697
|
+
dt: /* @__PURE__ */ new Set(["dl", "div"]),
|
|
698
|
+
// other
|
|
699
|
+
figcaption: /* @__PURE__ */ new Set(["figure"]),
|
|
700
|
+
// li: new Set(["ul", "ol"]),
|
|
701
|
+
summary: /* @__PURE__ */ new Set(["details"]),
|
|
702
|
+
area: /* @__PURE__ */ new Set(["map"])
|
|
703
|
+
};
|
|
704
|
+
const knownInvalidChildren = {
|
|
705
|
+
p: /* @__PURE__ */ new Set([
|
|
706
|
+
"address",
|
|
707
|
+
"article",
|
|
708
|
+
"aside",
|
|
709
|
+
"blockquote",
|
|
710
|
+
"center",
|
|
711
|
+
"details",
|
|
712
|
+
"dialog",
|
|
713
|
+
"dir",
|
|
714
|
+
"div",
|
|
715
|
+
"dl",
|
|
716
|
+
"fieldset",
|
|
717
|
+
"figure",
|
|
718
|
+
"footer",
|
|
719
|
+
"form",
|
|
720
|
+
"h1",
|
|
721
|
+
"h2",
|
|
722
|
+
"h3",
|
|
723
|
+
"h4",
|
|
724
|
+
"h5",
|
|
725
|
+
"h6",
|
|
726
|
+
"header",
|
|
727
|
+
"hgroup",
|
|
728
|
+
"hr",
|
|
729
|
+
"li",
|
|
730
|
+
"main",
|
|
731
|
+
"nav",
|
|
732
|
+
"menu",
|
|
733
|
+
"ol",
|
|
734
|
+
"p",
|
|
735
|
+
"pre",
|
|
736
|
+
"section",
|
|
737
|
+
"table",
|
|
738
|
+
"ul"
|
|
739
|
+
]),
|
|
740
|
+
svg: /* @__PURE__ */ new Set([
|
|
741
|
+
"b",
|
|
742
|
+
"blockquote",
|
|
743
|
+
"br",
|
|
744
|
+
"code",
|
|
745
|
+
"dd",
|
|
746
|
+
"div",
|
|
747
|
+
"dl",
|
|
748
|
+
"dt",
|
|
749
|
+
"em",
|
|
750
|
+
"embed",
|
|
751
|
+
"h1",
|
|
752
|
+
"h2",
|
|
753
|
+
"h3",
|
|
754
|
+
"h4",
|
|
755
|
+
"h5",
|
|
756
|
+
"h6",
|
|
757
|
+
"hr",
|
|
758
|
+
"i",
|
|
759
|
+
"img",
|
|
760
|
+
"li",
|
|
761
|
+
"menu",
|
|
762
|
+
"meta",
|
|
763
|
+
"ol",
|
|
764
|
+
"p",
|
|
765
|
+
"pre",
|
|
766
|
+
"ruby",
|
|
767
|
+
"s",
|
|
768
|
+
"small",
|
|
769
|
+
"span",
|
|
770
|
+
"strong",
|
|
771
|
+
"sub",
|
|
772
|
+
"sup",
|
|
773
|
+
"table",
|
|
774
|
+
"u",
|
|
775
|
+
"ul",
|
|
776
|
+
"var"
|
|
777
|
+
])
|
|
778
|
+
};
|
|
779
|
+
const knownInvalidParents = {
|
|
780
|
+
a: /* @__PURE__ */ new Set(["a"]),
|
|
781
|
+
button: /* @__PURE__ */ new Set(["button"]),
|
|
782
|
+
dd: /* @__PURE__ */ new Set(["dd", "dt"]),
|
|
783
|
+
dt: /* @__PURE__ */ new Set(["dd", "dt"]),
|
|
784
|
+
form: /* @__PURE__ */ new Set(["form"]),
|
|
785
|
+
li: /* @__PURE__ */ new Set(["li"]),
|
|
786
|
+
h1: headings,
|
|
787
|
+
h2: headings,
|
|
788
|
+
h3: headings,
|
|
789
|
+
h4: headings,
|
|
790
|
+
h5: headings,
|
|
791
|
+
h6: headings
|
|
792
|
+
};
|
|
793
|
+
|
|
626
794
|
const DOMNodeTransforms = [
|
|
627
795
|
transformStyle,
|
|
628
796
|
...[]
|
|
@@ -678,8 +846,10 @@ exports.V_ON_WITH_MODIFIERS = V_ON_WITH_MODIFIERS;
|
|
|
678
846
|
exports.V_SHOW = V_SHOW;
|
|
679
847
|
exports.compile = compile;
|
|
680
848
|
exports.createDOMCompilerError = createDOMCompilerError;
|
|
849
|
+
exports.isValidHTMLNesting = isValidHTMLNesting;
|
|
681
850
|
exports.parse = parse;
|
|
682
851
|
exports.parserOptions = parserOptions;
|
|
852
|
+
exports.resolveModifiers = resolveModifiers;
|
|
683
853
|
exports.transformStyle = transformStyle;
|
|
684
854
|
Object.keys(compilerCore).forEach(function (k) {
|
|
685
855
|
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) exports[k] = compilerCore[k];
|
package/dist/compiler-dom.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ParserOptions, NodeTransform, SourceLocation, CompilerError, DirectiveTransform, RootNode, CompilerOptions, CodegenResult } from '@vue/compiler-core';
|
|
1
|
+
import { ParserOptions, NodeTransform, SourceLocation, CompilerError, ExpressionNode, SimpleExpressionNode, TransformContext, DirectiveTransform, RootNode, CompilerOptions, CodegenResult } from '@vue/compiler-core';
|
|
2
2
|
export * from '@vue/compiler-core';
|
|
3
3
|
|
|
4
4
|
export declare const parserOptions: ParserOptions;
|
|
@@ -34,10 +34,27 @@ export declare enum DOMErrorCodes {
|
|
|
34
34
|
X_IGNORED_SIDE_EFFECT_TAG = 63,
|
|
35
35
|
__EXTEND_POINT__ = 64
|
|
36
36
|
}
|
|
37
|
-
export declare const DOMErrorMessages:
|
|
38
|
-
|
|
37
|
+
export declare const DOMErrorMessages: Record<DOMErrorCodes, string>;
|
|
38
|
+
|
|
39
|
+
export declare const resolveModifiers: (key: ExpressionNode | string, modifiers: SimpleExpressionNode[], context: TransformContext | null, loc: SourceLocation) => {
|
|
40
|
+
keyModifiers: string[];
|
|
41
|
+
nonKeyModifiers: string[];
|
|
42
|
+
eventOptionModifiers: string[];
|
|
39
43
|
};
|
|
40
44
|
|
|
45
|
+
/**
|
|
46
|
+
* Copied from https://github.com/MananTank/validate-html-nesting
|
|
47
|
+
* with ISC license
|
|
48
|
+
*
|
|
49
|
+
* To avoid runtime dependency on validate-html-nesting
|
|
50
|
+
* This file should not change very often in the original repo
|
|
51
|
+
* but we may need to keep it up-to-date from time to time.
|
|
52
|
+
*/
|
|
53
|
+
/**
|
|
54
|
+
* returns true if given parent-child nesting is valid HTML
|
|
55
|
+
*/
|
|
56
|
+
export declare function isValidHTMLNesting(parent: string, child: string): boolean;
|
|
57
|
+
|
|
41
58
|
export declare const DOMNodeTransforms: NodeTransform[];
|
|
42
59
|
export declare const DOMDirectiveTransforms: Record<string, DirectiveTransform>;
|
|
43
60
|
export declare function compile(src: string | RootNode, options?: CompilerOptions): CodegenResult;
|