@markuplint/vue-parser 4.0.0 → 4.0.2

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/parser.d.ts CHANGED
@@ -16,7 +16,7 @@ declare class VueParser extends Parser<ASTNode, State> {
16
16
  parseError(error: any): ParserError;
17
17
  nodeize(originNode: ASTNode, parentNode: MLASTParentNode | null, depth: number): readonly MLASTNodeTreeItem[];
18
18
  flattenNodes(nodeTree: readonly MLASTNodeTreeItem[]): MLASTNodeTreeItem[];
19
- afterFlattenNodes(nodeList: readonly MLASTNodeTreeItem[]): MLASTNodeTreeItem[];
19
+ afterFlattenNodes(nodeList: readonly MLASTNodeTreeItem[]): readonly MLASTNodeTreeItem[];
20
20
  visitAttr(token: Token): (import("@markuplint/ml-ast").MLASTHTMLAttr & {
21
21
  __rightText?: string | undefined;
22
22
  }) | (import("@markuplint/ml-ast").MLASTSpreadAttr & {
package/lib/parser.js CHANGED
@@ -104,36 +104,11 @@ class VueParser extends Parser {
104
104
  return newNodeList;
105
105
  }
106
106
  afterFlattenNodes(nodeList) {
107
- const optimizedNodeList = super.afterFlattenNodes(nodeList);
108
- const newNodeList = [];
109
- let openTemplateTag = false;
110
- let closeTemplateTag = false;
111
- for (const node of optimizedNodeList) {
112
- if (!openTemplateTag && node.type === 'text') {
113
- continue;
114
- }
115
- if (node.type === 'starttag' && node.nodeName === 'template' && node.depth === 0) {
116
- openTemplateTag = true;
117
- continue;
118
- }
119
- if (/^<\/template>$/i.test(node.raw) && node.depth === 0) {
120
- closeTemplateTag = true;
121
- continue;
122
- }
123
- if (closeTemplateTag && node.type === 'text') {
124
- continue;
125
- }
126
- // ignore script and style
127
- if (node.nodeName === 'script' || node.nodeName === 'style') {
128
- continue;
129
- }
130
- // and ignore endtag of script and style
131
- if (node.raw === '</script>' || node.nodeName === '</style>') {
132
- continue;
133
- }
134
- newNodeList.push(node);
135
- }
136
- return newNodeList;
107
+ return super.afterFlattenNodes(nodeList, {
108
+ exposeInvalidNode: false,
109
+ exposeWhiteSpace: false,
110
+ concatText: false,
111
+ });
137
112
  }
138
113
  visitAttr(token) {
139
114
  const attr = super.visitAttr(token);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@markuplint/vue-parser",
3
- "version": "4.0.0",
3
+ "version": "4.0.2",
4
4
  "description": "Vue parser for markuplint",
5
5
  "repository": "git@github.com:markuplint/markuplint.git",
6
6
  "author": "Yusuke Hirao <yusukehirao@me.com>",
@@ -21,10 +21,10 @@
21
21
  "clean": "tsc --build --clean"
22
22
  },
23
23
  "dependencies": {
24
- "@markuplint/html-parser": "4.0.0",
25
- "@markuplint/ml-ast": "4.0.0",
26
- "@markuplint/parser-utils": "4.0.0",
24
+ "@markuplint/html-parser": "4.0.1",
25
+ "@markuplint/ml-ast": "4.0.1",
26
+ "@markuplint/parser-utils": "4.0.1",
27
27
  "vue-eslint-parser": "^9.4.2"
28
28
  },
29
- "gitHead": "be4aabe189dc53a717b2fbd58583a03017646251"
29
+ "gitHead": "bf84b391b580a8586fa7acaf56eb2e8114c8e33e"
30
30
  }