prettier-plugin-ejs 0.0.12 → 0.0.14
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/README.md +6 -2
- package/index.js +22 -10
- package/package.json +10 -16
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ npm install --save-dev prettier-plugin-ejs
|
|
|
21
21
|
|
|
22
22
|
<!-- prettier-ignore -->
|
|
23
23
|
<div>
|
|
24
|
-
<%
|
|
24
|
+
<%
|
|
25
25
|
const a = 0;
|
|
26
26
|
%>
|
|
27
27
|
</div>
|
|
@@ -43,7 +43,11 @@ npm install --save-dev prettier-plugin-ejs
|
|
|
43
43
|
<% } %>
|
|
44
44
|
</div>
|
|
45
45
|
|
|
46
|
-
<div
|
|
46
|
+
<div>
|
|
47
|
+
<%
|
|
48
|
+
const a = 0;
|
|
49
|
+
%>
|
|
50
|
+
</div>
|
|
47
51
|
|
|
48
52
|
<div class="<%= red %>"><%= 1 > 0 %></div>
|
|
49
53
|
<textarea><%= text %></textarea>
|
package/index.js
CHANGED
|
@@ -1,15 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var parserHtml = require('prettier/parser-html');
|
|
1
|
+
const { parsers } = require("prettier/parser-html");
|
|
4
2
|
|
|
5
3
|
const regex = /"[^"]*"|<textarea.*?<\/textarea|(<%([^>]*?)%>)/gs;
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
|
|
5
|
+
function parse(text, parsersOrOptions, optionsOrUndefined) {
|
|
6
|
+
return parsers.html.parse(
|
|
7
|
+
text.replace(regex, (m, t, c) => (!t ? m : `<!${c}!>`)),
|
|
8
|
+
parsersOrOptions,
|
|
9
|
+
optionsOrUndefined
|
|
10
|
+
);
|
|
8
11
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
+
|
|
13
|
+
module.exports = {
|
|
14
|
+
languages: [
|
|
15
|
+
{
|
|
16
|
+
name: "EJS",
|
|
17
|
+
parsers: ["html"],
|
|
18
|
+
extensions: [".ejs"],
|
|
12
19
|
},
|
|
20
|
+
],
|
|
21
|
+
parsers: {
|
|
22
|
+
html: {
|
|
23
|
+
...parsers.html,
|
|
24
|
+
parse,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
13
27
|
};
|
|
14
|
-
|
|
15
|
-
module.exports = index;
|
package/package.json
CHANGED
|
@@ -1,42 +1,36 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "prettier-plugin-ejs",
|
|
3
3
|
"displayName": "Prettier EJS Plugin",
|
|
4
|
-
"version": "0.0.
|
|
5
|
-
"description": "A
|
|
4
|
+
"version": "0.0.14",
|
|
5
|
+
"description": "A Prettier plugin for Embedded JavaScript Templating (EJS).",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"prettier",
|
|
8
8
|
"plugin",
|
|
9
9
|
"ejs",
|
|
10
10
|
"html"
|
|
11
11
|
],
|
|
12
|
-
"repository": {
|
|
13
|
-
"type": "git",
|
|
14
|
-
"url": "https://github.com/ecmel/prettier-plugin-ejs.git"
|
|
15
|
-
},
|
|
16
12
|
"author": {
|
|
17
13
|
"name": "Ecmel Ercan",
|
|
18
14
|
"url": "https://github.com/ecmel"
|
|
19
15
|
},
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "https://github.com/ecmel/prettier-plugin-ejs.git"
|
|
19
|
+
},
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"files": [
|
|
22
22
|
"index.js"
|
|
23
23
|
],
|
|
24
24
|
"main": "index.js",
|
|
25
|
+
"type": "commonjs",
|
|
25
26
|
"scripts": {
|
|
26
27
|
"clean": "git clean -Xdf",
|
|
27
|
-
"format": "prettier --ignore-path .gitignore --write ."
|
|
28
|
-
"build": "rollup -c",
|
|
29
|
-
"prepack": "npm run clean && npm install && npm run build"
|
|
28
|
+
"format": "prettier --ignore-path .gitignore --plugin ./index.js --write ."
|
|
30
29
|
},
|
|
31
30
|
"devDependencies": {
|
|
32
|
-
"
|
|
33
|
-
"@types/prettier": "^2.7.3",
|
|
34
|
-
"prettier": "^2.8.8",
|
|
35
|
-
"prettier-plugin-ejs": "file:../prettier-plugin-ejs",
|
|
36
|
-
"rollup": "^3.26.2",
|
|
37
|
-
"tslib": "^2.6.0"
|
|
31
|
+
"prettier": "^2.8.8"
|
|
38
32
|
},
|
|
39
33
|
"peerDependencies": {
|
|
40
|
-
"prettier": "2.x"
|
|
34
|
+
"prettier": "2.x - 3.x"
|
|
41
35
|
}
|
|
42
36
|
}
|