detect-templating-language 3.0.5 → 3.0.6
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @name detect-templating-language
|
|
3
3
|
* @fileoverview Detects various templating languages present in string
|
|
4
|
-
* @version 3.0.
|
|
4
|
+
* @version 3.0.6
|
|
5
5
|
* @author Roy Revelt, Codsen Ltd
|
|
6
6
|
* @license MIT
|
|
7
7
|
* {@link https://codsen.com/os/detect-templating-language/}
|
|
@@ -11,30 +11,31 @@ import { isJinjaNunjucksRegex } from 'regex-is-jinja-nunjucks';
|
|
|
11
11
|
import { isJSP } from 'regex-is-jsp';
|
|
12
12
|
import { isJinjaSpecific } from 'regex-jinja-specific';
|
|
13
13
|
|
|
14
|
-
var version$1 = "3.0.
|
|
14
|
+
var version$1 = "3.0.6";
|
|
15
15
|
|
|
16
16
|
const version = version$1;
|
|
17
17
|
function detectLang(str) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
let name = null;
|
|
19
|
+
if (typeof str !== "string") {
|
|
20
|
+
throw new TypeError(`detect-templating-language: [THROW_ID_01] Input must be string! It was given as ${JSON.stringify(str, null, 4)} (type ${typeof str}).`);
|
|
21
|
+
}
|
|
22
|
+
if (!str) {
|
|
23
|
+
return {
|
|
24
|
+
name,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
if (isJinjaNunjucksRegex().test(str)) {
|
|
28
|
+
name = "Nunjucks";
|
|
29
|
+
if (isJinjaSpecific().test(str)) {
|
|
30
|
+
name = "Jinja";
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
else if (isJSP().test(str)) {
|
|
34
|
+
name = "JSP";
|
|
35
|
+
}
|
|
23
36
|
return {
|
|
24
|
-
|
|
37
|
+
name,
|
|
25
38
|
};
|
|
26
|
-
}
|
|
27
|
-
if (isJinjaNunjucksRegex().test(str)) {
|
|
28
|
-
name = "Nunjucks";
|
|
29
|
-
if (isJinjaSpecific().test(str)) {
|
|
30
|
-
name = "Jinja";
|
|
31
|
-
}
|
|
32
|
-
} else if (isJSP().test(str)) {
|
|
33
|
-
name = "JSP";
|
|
34
|
-
}
|
|
35
|
-
return {
|
|
36
|
-
name
|
|
37
|
-
};
|
|
38
39
|
}
|
|
39
40
|
|
|
40
41
|
export { detectLang, version };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @name detect-templating-language
|
|
3
3
|
* @fileoverview Detects various templating languages present in string
|
|
4
|
-
* @version 3.0.
|
|
4
|
+
* @version 3.0.6
|
|
5
5
|
* @author Roy Revelt, Codsen Ltd
|
|
6
6
|
* @license MIT
|
|
7
7
|
* {@link https://codsen.com/os/detect-templating-language/}
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
/**
|
|
12
12
|
* @name regex-is-jinja-nunjucks
|
|
13
13
|
* @fileoverview Regular expression for detecting Jinja or Nunjucks code
|
|
14
|
-
* @version 3.0.
|
|
14
|
+
* @version 3.0.6
|
|
15
15
|
* @author Roy Revelt, Codsen Ltd
|
|
16
16
|
* @license MIT
|
|
17
17
|
* {@link https://codsen.com/os/regex-is-jinja-nunjucks/}
|
|
18
|
-
*/e.detectLang=function(e){let t=null;if("string"!=typeof e)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?(/{%|{{|%}|}}/gi.test(e)?(t="Nunjucks",/(set\s*[\w]+\s*=\s*namespace\()|({{['"][\w]+['"]\s+if)|(['"]%x?[+0]?[.>^<]?\d+[\w%]['"]\|format\()/gi.test(e)&&(t="Jinja")):/<%|%>|<\s*jsp:|<\s*cms:|<\s*c:|\${\s*jsp/gi.test(e)&&(t="JSP"),{name:t}):{name:t}},e.version="3.0.
|
|
18
|
+
*/e.detectLang=function(e){let t=null;if("string"!=typeof e)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?(/{%|{{|%}|}}/gi.test(e)?(t="Nunjucks",/(set\s*[\w]+\s*=\s*namespace\()|({{['"][\w]+['"]\s+if)|(['"]%x?[+0]?[.>^<]?\d+[\w%]['"]\|format\()/gi.test(e)&&(t="Jinja")):/<%|%>|<\s*jsp:|<\s*cms:|<\s*c:|\${\s*jsp/gi.test(e)&&(t="JSP"),{name:t}):{name:t}},e.version="3.0.6",Object.defineProperty(e,"__esModule",{value:!0})}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "detect-templating-language",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.6",
|
|
4
4
|
"description": "Detects various templating languages present in string",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"check",
|
|
@@ -30,13 +30,12 @@
|
|
|
30
30
|
"types": "types/index.d.ts",
|
|
31
31
|
"scripts": {
|
|
32
32
|
"build": "rollup -c",
|
|
33
|
-
"
|
|
34
|
-
"
|
|
33
|
+
"build:esbuild": "node '../../scripts/esbuild.js'",
|
|
34
|
+
"build:esbuild:dev": "cross-env MODE=dev node '../../scripts/esbuild.js'",
|
|
35
|
+
"ci_test": "npm run build && npm run format && tap --no-only --reporter=silent",
|
|
35
36
|
"clean_types": "../../scripts/cleanTypes.js",
|
|
36
37
|
"dev": "rollup -c --dev",
|
|
37
38
|
"devunittest": "npm run dev && tap --only -R 'base'",
|
|
38
|
-
"esbuild": "node '../../scripts/esbuild.js'",
|
|
39
|
-
"esbuild_dev": "cross-env MODE=dev node '../../scripts/esbuild.js'",
|
|
40
39
|
"format": "npm run lect && npm run prettier && npm run lint",
|
|
41
40
|
"lect": "lect",
|
|
42
41
|
"lint": "../../node_modules/eslint/bin/eslint.js . --ext .js --ext .ts --fix --config \"../../.eslintrc.json\" --quiet",
|
|
@@ -45,17 +44,14 @@
|
|
|
45
44
|
"republish": "npm publish || :",
|
|
46
45
|
"tap": "tap",
|
|
47
46
|
"pretest": "npm run build",
|
|
48
|
-
"test": "npm run
|
|
47
|
+
"test": "npm run test:ci && npm run perf",
|
|
48
|
+
"test:ci": "npm run unittest && npm run test:examples && npm run format",
|
|
49
49
|
"test:examples": "../../scripts/test-examples.js && npm run lect && npm run prettier",
|
|
50
50
|
"tsc": "tsc",
|
|
51
|
-
"unittest": "tap --no-only --
|
|
51
|
+
"unittest": "tap --no-only --reporter=terse && tsc -p tsconfig.json --noEmit"
|
|
52
52
|
},
|
|
53
53
|
"tap": {
|
|
54
54
|
"check-coverage": false,
|
|
55
|
-
"coverage-report": [
|
|
56
|
-
"json-summary",
|
|
57
|
-
"text"
|
|
58
|
-
],
|
|
59
55
|
"node-arg": [
|
|
60
56
|
"--no-warnings",
|
|
61
57
|
"--experimental-loader",
|
|
@@ -75,10 +71,10 @@
|
|
|
75
71
|
}
|
|
76
72
|
},
|
|
77
73
|
"dependencies": {
|
|
78
|
-
"@babel/runtime": "^7.16.
|
|
79
|
-
"regex-is-jinja-nunjucks": "^3.0.
|
|
80
|
-
"regex-is-jsp": "^3.0.
|
|
81
|
-
"regex-jinja-specific": "^3.0.
|
|
74
|
+
"@babel/runtime": "^7.16.3",
|
|
75
|
+
"regex-is-jinja-nunjucks": "^3.0.6",
|
|
76
|
+
"regex-is-jsp": "^3.0.6",
|
|
77
|
+
"regex-jinja-specific": "^3.0.6"
|
|
82
78
|
},
|
|
83
79
|
"devDependencies": {
|
|
84
80
|
"@babel/cli": "^7.16.0",
|
|
@@ -89,8 +85,8 @@
|
|
|
89
85
|
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.0",
|
|
90
86
|
"@babel/plugin-proposal-object-rest-spread": "^7.16.0",
|
|
91
87
|
"@babel/plugin-proposal-optional-chaining": "^7.16.0",
|
|
92
|
-
"@babel/plugin-transform-runtime": "^7.16.
|
|
93
|
-
"@babel/preset-env": "^7.16.
|
|
88
|
+
"@babel/plugin-transform-runtime": "^7.16.4",
|
|
89
|
+
"@babel/preset-env": "^7.16.4",
|
|
94
90
|
"@babel/preset-typescript": "^7.16.0",
|
|
95
91
|
"@babel/register": "^7.16.0",
|
|
96
92
|
"@istanbuljs/esm-loader-hook": "^0.1.2",
|
|
@@ -100,25 +96,25 @@
|
|
|
100
96
|
"@rollup/plugin-node-resolve": "^13.0.6",
|
|
101
97
|
"@rollup/plugin-strip": "^2.1.0",
|
|
102
98
|
"@rollup/plugin-typescript": "^8.3.0",
|
|
103
|
-
"@types/node": "^16.11.
|
|
99
|
+
"@types/node": "^16.11.9",
|
|
104
100
|
"@types/tap": "^15.0.5",
|
|
105
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
106
|
-
"@typescript-eslint/parser": "^5.
|
|
101
|
+
"@typescript-eslint/eslint-plugin": "^5.4.0",
|
|
102
|
+
"@typescript-eslint/parser": "^5.4.0",
|
|
107
103
|
"core-js": "^3.19.1",
|
|
108
104
|
"cross-env": "^7.0.3",
|
|
109
|
-
"eslint": "^8.
|
|
110
|
-
"lect": "^0.18.
|
|
111
|
-
"rollup": "^2.
|
|
105
|
+
"eslint": "^8.3.0",
|
|
106
|
+
"lect": "^0.18.6",
|
|
107
|
+
"rollup": "^2.60.0",
|
|
112
108
|
"rollup-plugin-ascii": "^0.0.3",
|
|
113
109
|
"rollup-plugin-banner": "^0.2.1",
|
|
114
110
|
"rollup-plugin-cleanup": "^3.2.1",
|
|
115
111
|
"rollup-plugin-dts": "^4.0.1",
|
|
116
112
|
"rollup-plugin-terser": "^7.0.2",
|
|
117
|
-
"tap": "^15.
|
|
113
|
+
"tap": "^15.1.2",
|
|
118
114
|
"tslib": "^2.3.1",
|
|
119
|
-
"typescript": "^4.
|
|
115
|
+
"typescript": "^4.5.2"
|
|
120
116
|
},
|
|
121
117
|
"engines": {
|
|
122
|
-
"node": ">=
|
|
118
|
+
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
|
123
119
|
}
|
|
124
120
|
}
|