prettier-plugin-ejs 0.0.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.
Files changed (3) hide show
  1. package/README.md +3 -0
  2. package/index.js +19 -0
  3. package/package.json +40 -0
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # Prettier Plugin for EJS
2
+
3
+ This plugin formats EJS marrkup as comments in html files.
package/index.js ADDED
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ var parserHtml = require("prettier/parser-html");
4
+
5
+ const regex = /<%(.*?)%>/gs;
6
+ function parse(text, parsers, options) {
7
+ return parserHtml.parsers.html.parse(
8
+ text.replace(regex, "<?$1?>"),
9
+ parsers,
10
+ options
11
+ );
12
+ }
13
+ var index = {
14
+ parsers: {
15
+ html: Object.assign(Object.assign({}, parserHtml.parsers.html), { parse }),
16
+ },
17
+ };
18
+
19
+ module.exports = index;
package/package.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "prettier-plugin-ejs",
3
+ "displayName": "Prettier EJS Plugin",
4
+ "version": "0.0.1",
5
+ "description": "A prettier plugin for Embedded JavaScript Templating.",
6
+ "keywords": [
7
+ "pretiier",
8
+ "plugin",
9
+ "ejs",
10
+ "html"
11
+ ],
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "https://github.com/ecmel/prettier-plugin-ejs.git"
15
+ },
16
+ "author": {
17
+ "name": "Ecmel Ercan",
18
+ "url": "https://github.com/ecmel"
19
+ },
20
+ "license": "MIT",
21
+ "files": [
22
+ "index.js"
23
+ ],
24
+ "main": "index.js",
25
+ "scripts": {
26
+ "clean": "git clean -Xdf",
27
+ "format": "prettier --ignore-path .gitignore --write .",
28
+ "build": "rollup -c"
29
+ },
30
+ "devDependencies": {
31
+ "@rollup/plugin-typescript": "^11.0.0",
32
+ "@types/prettier": "^2.7.2",
33
+ "prettier": "^2.8.6",
34
+ "rollup": "^3.19.1",
35
+ "tslib": "^2.5.0"
36
+ },
37
+ "peerDependencies": {
38
+ "prettier": "^2.8.6"
39
+ }
40
+ }