@html-validate/plugin-utils 1.0.2 → 2.0.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/dist/index.cjs.js +11 -4
- package/dist/index.esm.js +11 -4
- package/dist/tsdoc-metadata.json +1 -1
- package/package.json +5 -5
package/dist/index.cjs.js
CHANGED
|
@@ -85,6 +85,7 @@ function joinTemplateLiteral(nodes) {
|
|
|
85
85
|
}
|
|
86
86
|
function extractLiteral(node, filename, data) {
|
|
87
87
|
switch (node.type) {
|
|
88
|
+
/* ignored nodes */
|
|
88
89
|
case "FunctionExpression":
|
|
89
90
|
case "Identifier":
|
|
90
91
|
return null;
|
|
@@ -123,9 +124,12 @@ function extractLiteral(node, filename, data) {
|
|
|
123
124
|
return null;
|
|
124
125
|
}
|
|
125
126
|
}
|
|
127
|
+
/* istanbul ignore next: this only provides a better error, all currently known nodes are tested */
|
|
126
128
|
default: {
|
|
127
129
|
const loc = node.loc.start;
|
|
128
|
-
const
|
|
130
|
+
const line = String(loc.line);
|
|
131
|
+
const column = String(loc.column);
|
|
132
|
+
const context = `${filename}:${line}:${column}`;
|
|
129
133
|
throw new Error(`Unhandled node type "${node.type}" at "${context}" in extractLiteral`);
|
|
130
134
|
}
|
|
131
135
|
}
|
|
@@ -136,14 +140,17 @@ function compareKey(node, key, filename) {
|
|
|
136
140
|
return node.name === key;
|
|
137
141
|
case "Literal":
|
|
138
142
|
return node.value === key;
|
|
143
|
+
/* istanbul ignore next: this only provides a better error, all currently known nodes are tested */
|
|
139
144
|
default: {
|
|
140
145
|
const loc = node.loc.start;
|
|
141
|
-
const
|
|
146
|
+
const line = String(loc.line);
|
|
147
|
+
const column = String(loc.column);
|
|
148
|
+
const context = `${filename}:${line}:${column}`;
|
|
142
149
|
throw new Error(`Unhandled node type "${node.type}" at "${context}" in compareKey`);
|
|
143
150
|
}
|
|
144
151
|
}
|
|
145
152
|
}
|
|
146
|
-
var TemplateExtractor = class {
|
|
153
|
+
var TemplateExtractor = class _TemplateExtractor {
|
|
147
154
|
constructor(ast, filename, data) {
|
|
148
155
|
this.ast = ast;
|
|
149
156
|
this.filename = filename;
|
|
@@ -166,7 +173,7 @@ var TemplateExtractor = class {
|
|
|
166
173
|
sourceType: "module",
|
|
167
174
|
loc: true
|
|
168
175
|
});
|
|
169
|
-
return new
|
|
176
|
+
return new _TemplateExtractor(ast, filename ?? "inline", source);
|
|
170
177
|
}
|
|
171
178
|
/**
|
|
172
179
|
* Extract object properties.
|
package/dist/index.esm.js
CHANGED
|
@@ -47,6 +47,7 @@ function joinTemplateLiteral(nodes) {
|
|
|
47
47
|
}
|
|
48
48
|
function extractLiteral(node, filename, data) {
|
|
49
49
|
switch (node.type) {
|
|
50
|
+
/* ignored nodes */
|
|
50
51
|
case "FunctionExpression":
|
|
51
52
|
case "Identifier":
|
|
52
53
|
return null;
|
|
@@ -85,9 +86,12 @@ function extractLiteral(node, filename, data) {
|
|
|
85
86
|
return null;
|
|
86
87
|
}
|
|
87
88
|
}
|
|
89
|
+
/* istanbul ignore next: this only provides a better error, all currently known nodes are tested */
|
|
88
90
|
default: {
|
|
89
91
|
const loc = node.loc.start;
|
|
90
|
-
const
|
|
92
|
+
const line = String(loc.line);
|
|
93
|
+
const column = String(loc.column);
|
|
94
|
+
const context = `${filename}:${line}:${column}`;
|
|
91
95
|
throw new Error(`Unhandled node type "${node.type}" at "${context}" in extractLiteral`);
|
|
92
96
|
}
|
|
93
97
|
}
|
|
@@ -98,14 +102,17 @@ function compareKey(node, key, filename) {
|
|
|
98
102
|
return node.name === key;
|
|
99
103
|
case "Literal":
|
|
100
104
|
return node.value === key;
|
|
105
|
+
/* istanbul ignore next: this only provides a better error, all currently known nodes are tested */
|
|
101
106
|
default: {
|
|
102
107
|
const loc = node.loc.start;
|
|
103
|
-
const
|
|
108
|
+
const line = String(loc.line);
|
|
109
|
+
const column = String(loc.column);
|
|
110
|
+
const context = `${filename}:${line}:${column}`;
|
|
104
111
|
throw new Error(`Unhandled node type "${node.type}" at "${context}" in compareKey`);
|
|
105
112
|
}
|
|
106
113
|
}
|
|
107
114
|
}
|
|
108
|
-
var TemplateExtractor = class {
|
|
115
|
+
var TemplateExtractor = class _TemplateExtractor {
|
|
109
116
|
constructor(ast, filename, data) {
|
|
110
117
|
this.ast = ast;
|
|
111
118
|
this.filename = filename;
|
|
@@ -128,7 +135,7 @@ var TemplateExtractor = class {
|
|
|
128
135
|
sourceType: "module",
|
|
129
136
|
loc: true
|
|
130
137
|
});
|
|
131
|
-
return new
|
|
138
|
+
return new _TemplateExtractor(ast, filename ?? "inline", source);
|
|
132
139
|
}
|
|
133
140
|
/**
|
|
134
141
|
* Extract object properties.
|
package/dist/tsdoc-metadata.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@html-validate/plugin-utils",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Plugin utilities and helpers for writing plugins to HTML-Validate",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"html-validate"
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
},
|
|
12
12
|
"repository": {
|
|
13
13
|
"type": "git",
|
|
14
|
-
"url": "https://gitlab.com/html-validate/plugin-utils.git"
|
|
14
|
+
"url": "git+https://gitlab.com/html-validate/plugin-utils.git"
|
|
15
15
|
},
|
|
16
16
|
"license": "MIT",
|
|
17
17
|
"author": "David Sveningsson <ext@sidvind.com>",
|
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
],
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"acorn-walk": "^8",
|
|
35
|
-
"espree": "^9",
|
|
36
|
-
"html-validate": "^
|
|
35
|
+
"espree": "^9 || ^10",
|
|
36
|
+
"html-validate": "^8.0.0 || ^9.0.0 || >= 9.0.0-rc.6 < 10.0.0"
|
|
37
37
|
},
|
|
38
38
|
"engines": {
|
|
39
|
-
"node": ">=
|
|
39
|
+
"node": ">= 18.0"
|
|
40
40
|
},
|
|
41
41
|
"publishConfig": {
|
|
42
42
|
"access": "public"
|