@markuplint/vue-parser 3.5.0 → 3.6.0
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/lib/attr.js +5 -4
- package/lib/index.d.ts +1 -1
- package/lib/parse.js +1 -1
- package/lib/vue-parser/index.d.ts +4 -1
- package/package.json +4 -4
package/lib/attr.js
CHANGED
|
@@ -5,6 +5,7 @@ const duplicatableAttrs = ['class', 'style'];
|
|
|
5
5
|
function attr(
|
|
6
6
|
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
7
7
|
attr) {
|
|
8
|
+
var _a, _b, _c, _d;
|
|
8
9
|
if (attr.type !== 'html-attr') {
|
|
9
10
|
const name = attr.potentialName;
|
|
10
11
|
if (duplicatableAttrs.includes(name)) {
|
|
@@ -16,7 +17,7 @@ attr) {
|
|
|
16
17
|
/**
|
|
17
18
|
* `v-on`
|
|
18
19
|
*/
|
|
19
|
-
const [, directive, potentialName, modifier] = attr.name.raw.match(/^(v-on:|@)([^.]+)(?:\.([^.]))?$/i)
|
|
20
|
+
const [, directive, potentialName, modifier] = (_a = attr.name.raw.match(/^(v-on:|@)([^.]+)(?:\.([^.]+))?$/i)) !== null && _a !== void 0 ? _a : [];
|
|
20
21
|
if (directive && potentialName) {
|
|
21
22
|
return {
|
|
22
23
|
...attr,
|
|
@@ -31,7 +32,7 @@ attr) {
|
|
|
31
32
|
/**
|
|
32
33
|
* `v-bind`
|
|
33
34
|
*/
|
|
34
|
-
const [, directive, potentialName, modifier] = attr.name.raw.match(/^(v-bind:|:)([^.]+)(?:\.([^.]))?$/i)
|
|
35
|
+
const [, directive, potentialName, modifier] = (_b = attr.name.raw.match(/^(v-bind:|:)([^.]+)(?:\.([^.]+))?$/i)) !== null && _b !== void 0 ? _b : [];
|
|
35
36
|
if (directive && potentialName) {
|
|
36
37
|
if (duplicatableAttrs.includes(potentialName.toLowerCase())) {
|
|
37
38
|
attr.isDuplicatable = true;
|
|
@@ -73,7 +74,7 @@ attr) {
|
|
|
73
74
|
/**
|
|
74
75
|
* `v-model`
|
|
75
76
|
*/
|
|
76
|
-
const [, directive, modifier] = attr.name.raw.match(/^(v-model)(?:\.([^.]))?$/i)
|
|
77
|
+
const [, directive, modifier] = (_c = attr.name.raw.match(/^(v-model)(?:\.([^.]+))?$/i)) !== null && _c !== void 0 ? _c : [];
|
|
77
78
|
if (directive) {
|
|
78
79
|
// TODO: Supporting for `v-model` https://github.com/markuplint/markuplint/pull/681
|
|
79
80
|
return {
|
|
@@ -88,7 +89,7 @@ attr) {
|
|
|
88
89
|
/**
|
|
89
90
|
* `v-slot`
|
|
90
91
|
*/
|
|
91
|
-
const [, , slotName] = attr.name.raw.match(/^(v-slot:|#)(.+)$/i)
|
|
92
|
+
const [, , slotName] = (_d = attr.name.raw.match(/^(v-slot:|#)(.+)$/i)) !== null && _d !== void 0 ? _d : [];
|
|
92
93
|
const name = `v-slot:${slotName}`;
|
|
93
94
|
if (slotName) {
|
|
94
95
|
return {
|
package/lib/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { parse } from './parse';
|
|
2
|
-
export declare const endTag =
|
|
2
|
+
export declare const endTag = 'xml';
|
package/lib/parse.js
CHANGED
|
@@ -87,7 +87,7 @@ parentNode, rawHtml, options) {
|
|
|
87
87
|
const endLine = originNode.loc.end.line;
|
|
88
88
|
const startCol = originNode.loc.start.column + 1;
|
|
89
89
|
const endCol = originNode.loc.end.column + 1;
|
|
90
|
-
const raw = rawHtml.slice(startOffset, endOffset
|
|
90
|
+
const raw = rawHtml.slice(startOffset, endOffset !== null && endOffset !== void 0 ? endOffset : startOffset);
|
|
91
91
|
switch (originNode.type) {
|
|
92
92
|
case 'VText': {
|
|
93
93
|
const node = {
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import * as VueESLintParser from 'vue-eslint-parser';
|
|
2
2
|
export type VueTokens = VueESLintParser.AST.ESLintProgram;
|
|
3
3
|
export default function vueParse(vueTemplate: string): VueTokens;
|
|
4
|
-
export type ASTNode =
|
|
4
|
+
export type ASTNode =
|
|
5
|
+
| VueESLintParser.AST.VElement
|
|
6
|
+
| VueESLintParser.AST.VText
|
|
7
|
+
| VueESLintParser.AST.VExpressionContainer;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@markuplint/vue-parser",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.0",
|
|
4
4
|
"description": "Vue parser for markuplint",
|
|
5
5
|
"repository": "git@github.com:markuplint/markuplint.git",
|
|
6
6
|
"author": "Yusuke Hirao <yusukehirao@me.com>",
|
|
@@ -16,11 +16,11 @@
|
|
|
16
16
|
"clean": "tsc --build --clean"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@markuplint/html-parser": "3.
|
|
19
|
+
"@markuplint/html-parser": "3.6.0",
|
|
20
20
|
"@markuplint/ml-ast": "3.1.0",
|
|
21
|
-
"@markuplint/parser-utils": "3.
|
|
21
|
+
"@markuplint/parser-utils": "3.6.0",
|
|
22
22
|
"tslib": "^2.4.1",
|
|
23
23
|
"vue-eslint-parser": "^9.1.0"
|
|
24
24
|
},
|
|
25
|
-
"gitHead": "
|
|
25
|
+
"gitHead": "715dd53d3b1064a9bcf616c1533921cad9e3b187"
|
|
26
26
|
}
|