detect-templating-language 3.0.10 → 3.0.13

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2010-2021 Roy Revelt and other contributors
3
+ Copyright (c) 2010-2022 Roy Revelt and other contributors
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining
6
6
  a copy of this software and associated documentation files (the
package/README.md CHANGED
@@ -26,14 +26,12 @@
26
26
 
27
27
  ## Install
28
28
 
29
- This package is ESM only: Node 12+ is needed to use it and it must be imported instead of required:
29
+ This package is [pure ESM](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c). If you're not ready yet, install an older version of this program, 2.1.0 (`npm i detect-templating-language@2.1.0`).
30
30
 
31
31
  ```bash
32
32
  npm i detect-templating-language
33
33
  ```
34
34
 
35
- If you need a legacy version which works with `require`, use version 2.1.0
36
-
37
35
  ## Quick Take
38
36
 
39
37
  ```js
@@ -68,8 +66,6 @@ To report bugs or request features or assistance, [raise an issue](https://githu
68
66
 
69
67
  MIT License
70
68
 
71
- Copyright (c) 2010-2021 Roy Revelt and other contributors
72
-
69
+ Copyright (c) 2010-2022 Roy Revelt and other contributors
73
70
 
74
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">
75
-
@@ -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.0.10
4
+ * @version 3.0.13
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 i}from"regex-is-jinja-nunjucks";import{isJSP as r}from"regex-is-jsp";import{isJinjaSpecific as a}from"regex-jinja-specific";var n="3.0.10";var g=n;function d(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?(i().test(e)?(t="Nunjucks",a().test(e)&&(t="Jinja")):r().test(e)&&(t="JSP"),{name:t}):{name:t}}export{d as detectLang,g as version};
10
+ import{isJinjaNunjucksRegex as s}from"regex-is-jinja-nunjucks";import{isJSP as i}from"regex-is-jsp";import{isJinjaSpecific as p}from"regex-jinja-specific";var n="3.0.13";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?(s().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.0.10
4
+ * @version 3.0.13
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
- var detectTemplatingLanguage=(()=>{var i=Object.defineProperty;var o=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var d=e=>i(e,"__esModule",{value:!0});var m=(e,t)=>{for(var s in t)i(e,s,{get:t[s],enumerable:!0})},f=(e,t,s,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of l(t))!g.call(e,n)&&(s||n!=="default")&&i(e,n,{get:()=>t[n],enumerable:!(r=o(t,n))||r.enumerable});return e};var j=(e=>(t,s)=>e&&e.get(t)||(s=f(d({}),t,1),e&&e.set(t,s),s))(typeof WeakMap!="undefined"?new WeakMap:0);var h={};m(h,{detectLang:()=>x,version:()=>v});function a(){return/{%|{{|%}|}}/gi}function u(){return/<%|%>|<\s*jsp:|<\s*cms:|<\s*c:|\${\s*jsp/gi}function c(){return/(set\s*[\w]+\s*=\s*namespace\()|({{['"][\w]+['"]\s+if)|(['"]%x?[+0]?[.>^<]?\d+[\w%]['"]\|format\()/gi}var p="3.0.10";var v=p;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",c().test(e)&&(t="Jinja")):u().test(e)&&(t="JSP"),{name:t}):{name:t}}return j(h);})();
10
+ 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 x={};g(x,{detectLang:()=>v,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.0.13";var j=o;function v(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(x);})();
11
11
  /**
12
12
  * @name regex-is-jinja-nunjucks
13
13
  * @fileoverview Regular expression for detecting Jinja or Nunjucks code
14
- * @version 3.0.10
14
+ * @version 3.0.13
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 @@ var detectTemplatingLanguage=(()=>{var i=Object.defineProperty;var o=Object.getO
19
19
  /**
20
20
  * @name regex-is-jsp
21
21
  * @fileoverview Regular expression for detecting JSP (Java Server Pages) code
22
- * @version 3.0.10
22
+ * @version 3.0.13
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 @@ var detectTemplatingLanguage=(()=>{var i=Object.defineProperty;var o=Object.getO
27
27
  /**
28
28
  * @name regex-jinja-specific
29
29
  * @fileoverview Regular expression for detecting Python-specific Jinja code
30
- * @version 3.0.10
30
+ * @version 3.0.13
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.0.10",
3
+ "version": "3.0.13",
4
4
  "description": "Detects various templating languages present in string",
5
5
  "keywords": [
6
6
  "check",
@@ -31,15 +31,18 @@
31
31
  "scripts": {
32
32
  "build": "node '../../ops/scripts/esbuild.js' && yarn run dts",
33
33
  "dev": "DEV=true node '../../ops/scripts/esbuild.js' && yarn run dts",
34
- "dts": "rollup -c",
34
+ "devtest": "c8 yarn run unit && yarn run examples && yarn run lint",
35
+ "dts": "rollup -c && yarn run prettier 'types/index.d.ts' --write",
35
36
  "examples": "node '../../ops/scripts/run-examples.js'",
36
- "lect": "node '../../ops/lect/lect.js'",
37
+ "lect": "node '../../ops/lect/lect.js' && yarn run prettier 'README.md' '.all-contributorsrc' 'rollup.config.js' --write",
37
38
  "letspublish": "yarn publish || :",
38
39
  "lint": "eslint . --fix",
39
40
  "perf": "node perf/check.js",
40
41
  "prepare": "echo 'ready'",
42
+ "prettier": "prettier",
43
+ "prettier:format": "prettier --write '**/*.{ts,tsx,md}' --no-error-on-unmatched-pattern",
41
44
  "pretest": "yarn run lect && yarn run build",
42
- "test": "c8 yarn run unit && yarn run examples && yarn run lint",
45
+ "test": "yarn run devtest",
43
46
  "unit": "uvu test"
44
47
  },
45
48
  "engines": {
@@ -60,8 +63,8 @@
60
63
  }
61
64
  },
62
65
  "dependencies": {
63
- "regex-is-jinja-nunjucks": "^3.0.10",
64
- "regex-is-jsp": "^3.0.10",
65
- "regex-jinja-specific": "^3.0.10"
66
+ "regex-is-jinja-nunjucks": "^3.0.13",
67
+ "regex-is-jsp": "^3.0.13",
68
+ "regex-jinja-specific": "^3.0.13"
66
69
  }
67
70
  }
package/types/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  declare const version: string;
2
2
  declare type Output = "Nunjucks" | "Jinja" | "JSP" | null;
3
3
  declare function detectLang(str: string): {
4
- name: Output;
4
+ name: Output;
5
5
  };
6
6
 
7
7
  export { detectLang, version };