detect-templating-language 3.0.2 → 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.
- package/CHANGELOG.md +0 -6
- package/LICENSE +1 -1
- package/dist/detect-templating-language.esm.js +21 -20
- package/dist/detect-templating-language.umd.js +3 -3
- package/package.json +39 -43
package/CHANGELOG.md
CHANGED
|
@@ -3,12 +3,6 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## 3.0.1 (2021-09-13)
|
|
7
|
-
|
|
8
|
-
### Bug Fixes
|
|
9
|
-
|
|
10
|
-
- bump TS and separate ESLint plugins away from this monorepo ([2e07d42](https://github.com/codsen/codsen/commit/2e07d424222b6ffedf5fb45c83ad453627ec2904))
|
|
11
|
-
|
|
12
6
|
## 3.0.0 (2021-09-09)
|
|
13
7
|
|
|
14
8
|
### Features
|
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2010
|
|
3
|
+
Copyright (c) 2010-2021 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
|
|
@@ -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,9 +30,10 @@
|
|
|
30
30
|
"types": "types/index.d.ts",
|
|
31
31
|
"scripts": {
|
|
32
32
|
"build": "rollup -c",
|
|
33
|
-
"esbuild": "node '../../scripts/esbuild.js'",
|
|
34
|
-
"
|
|
35
|
-
"ci_test": "npm run build && npm run format && tap --no-only --reporter=silent
|
|
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",
|
|
36
|
+
"clean_types": "../../scripts/cleanTypes.js",
|
|
36
37
|
"dev": "rollup -c --dev",
|
|
37
38
|
"devunittest": "npm run dev && tap --only -R 'base'",
|
|
38
39
|
"format": "npm run lect && npm run prettier && npm run lint",
|
|
@@ -42,20 +43,15 @@
|
|
|
42
43
|
"prettier": "../../node_modules/prettier/bin-prettier.js '*.{js,css,scss,vue,md,ts}' --write --loglevel silent",
|
|
43
44
|
"republish": "npm publish || :",
|
|
44
45
|
"tap": "tap",
|
|
45
|
-
"tsc": "tsc",
|
|
46
46
|
"pretest": "npm run build",
|
|
47
|
-
"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",
|
|
48
49
|
"test:examples": "../../scripts/test-examples.js && npm run lect && npm run prettier",
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"clean_types": "../../scripts/cleanTypes.js"
|
|
50
|
+
"tsc": "tsc",
|
|
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,50 +71,50 @@
|
|
|
75
71
|
}
|
|
76
72
|
},
|
|
77
73
|
"dependencies": {
|
|
78
|
-
"@babel/runtime": "^7.
|
|
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
|
-
"@babel/cli": "^7.
|
|
85
|
-
"@babel/core": "^7.
|
|
86
|
-
"@babel/node": "^7.
|
|
87
|
-
"@babel/plugin-external-helpers": "^7.
|
|
88
|
-
"@babel/plugin-proposal-class-properties": "^7.
|
|
89
|
-
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.
|
|
90
|
-
"@babel/plugin-proposal-object-rest-spread": "^7.
|
|
91
|
-
"@babel/plugin-proposal-optional-chaining": "^7.
|
|
92
|
-
"@babel/plugin-transform-runtime": "^7.
|
|
93
|
-
"@babel/preset-env": "^7.
|
|
94
|
-
"@babel/preset-typescript": "^7.
|
|
95
|
-
"@babel/register": "^7.
|
|
80
|
+
"@babel/cli": "^7.16.0",
|
|
81
|
+
"@babel/core": "^7.16.0",
|
|
82
|
+
"@babel/node": "^7.16.0",
|
|
83
|
+
"@babel/plugin-external-helpers": "^7.16.0",
|
|
84
|
+
"@babel/plugin-proposal-class-properties": "^7.16.0",
|
|
85
|
+
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.0",
|
|
86
|
+
"@babel/plugin-proposal-object-rest-spread": "^7.16.0",
|
|
87
|
+
"@babel/plugin-proposal-optional-chaining": "^7.16.0",
|
|
88
|
+
"@babel/plugin-transform-runtime": "^7.16.4",
|
|
89
|
+
"@babel/preset-env": "^7.16.4",
|
|
90
|
+
"@babel/preset-typescript": "^7.16.0",
|
|
91
|
+
"@babel/register": "^7.16.0",
|
|
96
92
|
"@istanbuljs/esm-loader-hook": "^0.1.2",
|
|
97
93
|
"@rollup/plugin-babel": "^5.3.0",
|
|
98
|
-
"@rollup/plugin-commonjs": "^
|
|
94
|
+
"@rollup/plugin-commonjs": "^21.0.1",
|
|
99
95
|
"@rollup/plugin-json": "^4.1.0",
|
|
100
|
-
"@rollup/plugin-node-resolve": "^13.0.
|
|
96
|
+
"@rollup/plugin-node-resolve": "^13.0.6",
|
|
101
97
|
"@rollup/plugin-strip": "^2.1.0",
|
|
102
|
-
"@rollup/plugin-typescript": "^8.
|
|
103
|
-
"@types/node": "^16.9
|
|
98
|
+
"@rollup/plugin-typescript": "^8.3.0",
|
|
99
|
+
"@types/node": "^16.11.9",
|
|
104
100
|
"@types/tap": "^15.0.5",
|
|
105
|
-
"@typescript-eslint/eslint-plugin": "^4.
|
|
106
|
-
"@typescript-eslint/parser": "^4.
|
|
107
|
-
"core-js": "^3.
|
|
101
|
+
"@typescript-eslint/eslint-plugin": "^5.4.0",
|
|
102
|
+
"@typescript-eslint/parser": "^5.4.0",
|
|
103
|
+
"core-js": "^3.19.1",
|
|
108
104
|
"cross-env": "^7.0.3",
|
|
109
|
-
"eslint": "^
|
|
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
|
-
"rollup-plugin-dts": "^4.0.
|
|
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
|
}
|