detect-templating-language 3.1.2 → 3.1.4
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/CHANGELOG.md
CHANGED
|
@@ -17,7 +17,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
17
17
|
|
|
18
18
|
### BREAKING CHANGES
|
|
19
19
|
|
|
20
|
-
- programs now are in ES Modules and won't work with Common JS require()
|
|
20
|
+
- programs now are in ES Modules and won't work with Common JS `require()`
|
|
21
21
|
|
|
22
22
|
## 2.1.0 (2021-05-24)
|
|
23
23
|
|
|
@@ -35,7 +35,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
35
35
|
|
|
36
36
|
### Fixed
|
|
37
37
|
|
|
38
|
-
- add testStats to npmignore ([f3c84e9](https://github.com/codsen/codsen/commit/f3c84e95afc5514214312f913692d85b2e12eb29))
|
|
38
|
+
- add `testStats` to npmignore ([f3c84e9](https://github.com/codsen/codsen/commit/f3c84e95afc5514214312f913692d85b2e12eb29))
|
|
39
39
|
|
|
40
40
|
## 2.0.0 (2021-01-23)
|
|
41
41
|
|
package/README.md
CHANGED
|
@@ -1,28 +1,25 @@
|
|
|
1
|
-
|
|
1
|
+
<h1 align="center">detect-templating-language</h1>
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
<p align="center">Detects various templating languages present in string</p>
|
|
4
4
|
|
|
5
|
-
<
|
|
6
|
-
<a href="https://www.npmjs.com/package/detect-templating-language" rel="nofollow noreferrer noopener">
|
|
7
|
-
<img src="https://img.shields.io/badge/-npm-blue?style=flat-square" alt="page on npm">
|
|
8
|
-
</a>
|
|
5
|
+
<p align="center">
|
|
9
6
|
<a href="https://codsen.com/os/detect-templating-language" rel="nofollow noreferrer noopener">
|
|
10
7
|
<img src="https://img.shields.io/badge/-codsen-blue?style=flat-square" alt="page on codsen.com">
|
|
11
8
|
</a>
|
|
9
|
+
<a href="https://www.npmjs.com/package/detect-templating-language" rel="nofollow noreferrer noopener">
|
|
10
|
+
<img src="https://img.shields.io/badge/-npm-blue?style=flat-square" alt="page on npm">
|
|
11
|
+
</a>
|
|
12
12
|
<a href="https://github.com/codsen/codsen/tree/main/packages/detect-templating-language" rel="nofollow noreferrer noopener">
|
|
13
13
|
<img src="https://img.shields.io/badge/-github-blue?style=flat-square" alt="page on github">
|
|
14
14
|
</a>
|
|
15
15
|
<a href="https://npmcharts.com/compare/detect-templating-language?interval=30" rel="nofollow noreferrer noopener" target="_blank">
|
|
16
16
|
<img src="https://img.shields.io/npm/dm/detect-templating-language.svg?style=flat-square" alt="Downloads per month">
|
|
17
17
|
</a>
|
|
18
|
-
<a href="https://
|
|
19
|
-
<img src="https://img.shields.io/badge/
|
|
20
|
-
</a>
|
|
21
|
-
<img src="https://img.shields.io/badge/licence-MIT-brightgreen.svg?style=flat-square" alt="MIT License">
|
|
22
|
-
<a href="https://liberamanifesto.com" rel="nofollow noreferrer noopener" target="_blank">
|
|
23
|
-
<img src="https://img.shields.io/badge/libera-manifesto-lightgrey.svg?style=flat-square" alt="libera manifesto">
|
|
18
|
+
<a href="https://codsen.com/os/detect-templating-language/changelog" rel="nofollow noreferrer noopener">
|
|
19
|
+
<img src="https://img.shields.io/badge/changelog-here-brightgreen?style=flat-square" alt="changelog">
|
|
24
20
|
</a>
|
|
25
|
-
|
|
21
|
+
<img src="https://img.shields.io/badge/licence-MIT-brightgreen.svg?style=flat-square" alt="MIT Licence">
|
|
22
|
+
</p>
|
|
26
23
|
|
|
27
24
|
## Install
|
|
28
25
|
|
|
@@ -64,8 +61,8 @@ To report bugs or request features or assistance, [raise an issue](https://githu
|
|
|
64
61
|
|
|
65
62
|
## Licence
|
|
66
63
|
|
|
67
|
-
MIT License
|
|
64
|
+
MIT License.
|
|
68
65
|
|
|
69
|
-
Copyright
|
|
66
|
+
Copyright © 2010-2022 Roy Revelt and other contributors.
|
|
70
67
|
|
|
71
|
-
<img src="https://codsen.com/images/png-codsen-ok.png" width="98" alt="ok" align="center"> <img src="https://codsen.com/images/png-codsen-1.png" width="148" alt="codsen" align="center"> <img src="https://codsen.com/images/png-codsen-star-small.png" width="32" alt="star" align="center">
|
|
68
|
+
<p align="center"><img src="https://codsen.com/images/png-codsen-ok.png" width="98" alt="ok" align="center"> <img src="https://codsen.com/images/png-codsen-1.png" width="148" alt="codsen" align="center"> <img src="https://codsen.com/images/png-codsen-star-small.png" width="32" alt="star" align="center"></p>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @name detect-templating-language
|
|
3
3
|
* @fileoverview Detects various templating languages present in string
|
|
4
|
-
* @version 3.1.
|
|
4
|
+
* @version 3.1.4
|
|
5
5
|
* @author Roy Revelt, Codsen Ltd
|
|
6
6
|
* @license MIT
|
|
7
7
|
* {@link https://codsen.com/os/detect-templating-language/}
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import{isJinjaNunjucksRegex as
|
|
10
|
+
import{isJinjaNunjucksRegex as r}from"regex-is-jinja-nunjucks";import{isJSP as i}from"regex-is-jsp";import{isJinjaSpecific as p}from"regex-jinja-specific";var n="3.1.4";var d=n;function g(e){let t=null;if(typeof e!="string")throw new TypeError(`detect-templating-language: [THROW_ID_01] Input must be string! It was given as ${JSON.stringify(e,null,4)} (type ${typeof e}).`);return e?(r().test(e)?(t="Nunjucks",p().test(e)&&(t="Jinja")):i().test(e)&&(t="JSP"),{name:t}):{name:t}}export{g as detectLang,d as version};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @name detect-templating-language
|
|
3
3
|
* @fileoverview Detects various templating languages present in string
|
|
4
|
-
* @version 3.1.
|
|
4
|
+
* @version 3.1.4
|
|
5
5
|
* @author Roy Revelt, Codsen Ltd
|
|
6
6
|
* @license MIT
|
|
7
7
|
* {@link https://codsen.com/os/detect-templating-language/}
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
"use strict";var detectTemplatingLanguage=(()=>{var r=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var g=(e,t)=>{for(var s in t)r(e,s,{get:t[s],enumerable:!0})},m=(e,t,s,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of l(t))!d.call(e,n)&&n!==s&&r(e,n,{get:()=>t[n],enumerable:!(i=c(t,n))||i.enumerable});return e};var y=e=>m(r({},"__esModule",{value:!0}),e);var v={};g(v,{detectLang:()=>x,version:()=>j});function a(){return/{%|{{|%}|}}/gi}function p(){return/<%|%>|<\s*jsp:|<\s*cms:|<\s*c:|\${\s*jsp/gi}function u(){return/(set\s*[\w]+\s*=\s*namespace\()|({{['"][\w]+['"]\s+if)|(['"]%x?[+0]?[.>^<]?\d+[\w%]['"]\|format\()/gi}var o="3.1.
|
|
10
|
+
"use strict";var detectTemplatingLanguage=(()=>{var r=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var g=(e,t)=>{for(var s in t)r(e,s,{get:t[s],enumerable:!0})},m=(e,t,s,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of l(t))!d.call(e,n)&&n!==s&&r(e,n,{get:()=>t[n],enumerable:!(i=c(t,n))||i.enumerable});return e};var y=e=>m(r({},"__esModule",{value:!0}),e);var v={};g(v,{detectLang:()=>x,version:()=>j});function a(){return/{%|{{|%}|}}/gi}function p(){return/<%|%>|<\s*jsp:|<\s*cms:|<\s*c:|\${\s*jsp/gi}function u(){return/(set\s*[\w]+\s*=\s*namespace\()|({{['"][\w]+['"]\s+if)|(['"]%x?[+0]?[.>^<]?\d+[\w%]['"]\|format\()/gi}var o="3.1.4";var j=o;function x(e){let t=null;if(typeof e!="string")throw new TypeError(`detect-templating-language: [THROW_ID_01] Input must be string! It was given as ${JSON.stringify(e,null,4)} (type ${typeof e}).`);return e?(a().test(e)?(t="Nunjucks",u().test(e)&&(t="Jinja")):p().test(e)&&(t="JSP"),{name:t}):{name:t}}return y(v);})();
|
|
11
11
|
/**
|
|
12
12
|
* @name regex-is-jinja-nunjucks
|
|
13
13
|
* @fileoverview Regular expression for detecting Jinja or Nunjucks code
|
|
14
|
-
* @version 3.1.
|
|
14
|
+
* @version 3.1.4
|
|
15
15
|
* @author Roy Revelt, Codsen Ltd
|
|
16
16
|
* @license MIT
|
|
17
17
|
* {@link https://codsen.com/os/regex-is-jinja-nunjucks/}
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
/**
|
|
20
20
|
* @name regex-is-jsp
|
|
21
21
|
* @fileoverview Regular expression for detecting JSP (Java Server Pages) code
|
|
22
|
-
* @version 3.1.
|
|
22
|
+
* @version 3.1.4
|
|
23
23
|
* @author Roy Revelt, Codsen Ltd
|
|
24
24
|
* @license MIT
|
|
25
25
|
* {@link https://codsen.com/os/regex-is-jsp/}
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
/**
|
|
28
28
|
* @name regex-jinja-specific
|
|
29
29
|
* @fileoverview Regular expression for detecting Python-specific Jinja code
|
|
30
|
-
* @version 3.1.
|
|
30
|
+
* @version 3.1.4
|
|
31
31
|
* @author Roy Revelt, Codsen Ltd
|
|
32
32
|
* @license MIT
|
|
33
33
|
* {@link https://codsen.com/os/regex-jinja-specific/}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "detect-templating-language",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.4",
|
|
4
4
|
"description": "Detects various templating languages present in string",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"check",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"examples": "node '../../ops/scripts/run-examples.js'",
|
|
38
38
|
"lect": "node '../../ops/lect/lect.js' && yarn run prettier 'README.md' '.all-contributorsrc' 'rollup.config.js' --write",
|
|
39
39
|
"letspublish": "yarn publish || :",
|
|
40
|
-
"lint": "eslint . --fix",
|
|
40
|
+
"lint": "eslint . --ext .js --ext .ts --fix",
|
|
41
41
|
"perf": "node perf/check.js",
|
|
42
42
|
"prepare": "echo 'ready'",
|
|
43
43
|
"prettier": "prettier",
|
|
@@ -64,8 +64,8 @@
|
|
|
64
64
|
}
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"regex-is-jinja-nunjucks": "^3.1.
|
|
68
|
-
"regex-is-jsp": "^3.1.
|
|
69
|
-
"regex-jinja-specific": "^3.1.
|
|
67
|
+
"regex-is-jinja-nunjucks": "^3.1.4",
|
|
68
|
+
"regex-is-jsp": "^3.1.4",
|
|
69
|
+
"regex-jinja-specific": "^3.1.4"
|
|
70
70
|
}
|
|
71
71
|
}
|
package/examples/_quickTake.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
// Quick Take
|
|
2
|
-
|
|
3
|
-
import { strict as assert } from "assert";
|
|
4
|
-
|
|
5
|
-
import { detectLang } from "../dist/detect-templating-language.esm.js";
|
|
6
|
-
|
|
7
|
-
// detects Nunjucks
|
|
8
|
-
assert.deepEqual(
|
|
9
|
-
detectLang(`<div>{% if something %}x{% else %}y{% endif %}</div>`),
|
|
10
|
-
{ name: "Nunjucks" }
|
|
11
|
-
);
|
|
12
|
-
|
|
13
|
-
// detects JSP (Java Server Pages)
|
|
14
|
-
assert.deepEqual(
|
|
15
|
-
detectLang(
|
|
16
|
-
`<div><c:set var="someList" value="\${jspProp.someList}" /></div>`
|
|
17
|
-
),
|
|
18
|
-
{ name: "JSP" }
|
|
19
|
-
);
|