detect-templating-language 4.1.0 → 4.2.0

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
@@ -3,11 +3,23 @@
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
- ## 4.1.0 (2025-10-15)
6
+ ## 4.2.0 (2026-08-19)
7
+
8
+ ### Bug Fixes
9
+
10
+ - make validation diagnostics safe ([7b01074](https://github.com/codsen/codsen/commit/7b0107476f12734aeb8e82852ba980b187280110))
11
+ - resolve review findings REV-004 through REV-007 ([b60e9ee](https://github.com/codsen/codsen/commit/b60e9eeb499af94685cfb87b4970fe025be1fc10))
12
+ - retire direct publish aliases ([f98e31e](https://github.com/codsen/codsen/commit/f98e31eb89bc185471225664e610b55f34fbf648))
7
13
 
8
14
  ### Features
9
15
 
10
- - if value to be added is a number, keep it as is, don't stringify ([ce3e1a5](https://github.com/codsen/codsen/commit/ce3e1a525998ca3c0abf0142affef95b14cd1990))
16
+ - add codsen-glob and migrate glob consumers ([5595a2b](https://github.com/codsen/codsen/commit/5595a2b267eaa6cb60072d037aef00b7a28edd42))
17
+ - refresh the tooling and generate with the latest dependencies ([781f802](https://github.com/codsen/codsen/commit/781f802911066a82a4533b0e5a3fcbd742d0dd83))
18
+
19
+ ### Reverts
20
+
21
+ - Revert "Merge pull request #128 from codsen/release/npm-32198404552-1" ([5baeeaa](https://github.com/codsen/codsen/commit/5baeeaaa677b86f1eaa6396cadf3aea32b06416e)), closes [#128](https://github.com/codsen/codsen/issues/128)
22
+ - Revert "Merge pull request #127 from codsen/release/npm-32194020886-1" ([5f1e94d](https://github.com/codsen/codsen/commit/5f1e94deef910ce735266b16aeee08a76de7a862)), closes [#127](https://github.com/codsen/codsen/issues/127)
11
23
 
12
24
  ## 4.0.0 (2022-12-01)
13
25
 
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright © 2010-2025 Roy Revelt and other contributors
3
+ Copyright © 2010-2026 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
@@ -32,7 +32,7 @@ npm i detect-templating-language
32
32
  ## Quick Take
33
33
 
34
34
  ```js
35
- import { strict as assert } from "assert";
35
+ import { strict as assert } from "node:assert";
36
36
 
37
37
  import { detectLang } from "detect-templating-language";
38
38
 
@@ -41,14 +41,9 @@ assert.deepEqual(
41
41
  detectLang("<div>{% if something %}x{% else %}y{% endif %}</div>"),
42
42
  { name: "Nunjucks" },
43
43
  );
44
-
45
- // detects JSP (Java Server Pages)
46
- assert.deepEqual(
47
- detectLang('<div><c:set var="someList" value="${jspProp.someList}" /></div>'),
48
- { name: "JSP" },
49
- );
50
44
  ```
51
45
 
46
+
52
47
  ## Documentation
53
48
 
54
49
  Please [visit codsen.com](https://codsen.com/os/detect-templating-language/) for a full description of the API. If you’re looking for the **Changelog**, it’s [here](https://github.com/codsen/codsen/blob/main/packages/detect-templating-language/CHANGELOG.md).
@@ -61,6 +56,6 @@ To report bugs or request features or assistance, [raise an issue](https://githu
61
56
 
62
57
  MIT License
63
58
 
64
- Copyright © 2010-2025 Roy Revelt and other contributors
59
+ Copyright © 2010-2026 Roy Revelt and other contributors
65
60
 
66
61
  <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 4.1.0
4
+ * @version 4.2.0
5
5
  * @author Roy Revelt
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 p}from"regex-jinja-specific";var n="4.1.0";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?(i().test(e)?(t="Nunjucks",p().test(e)&&(t="Jinja")):r().test(e)&&(t="JSP"),{name:t}):{name:t}}export{g as detectLang,d as version};
10
+ import{formatDiagnosticValue as i}from"codsen-utils";import{isJinjaNunjucksRegex as r}from"regex-is-jinja-nunjucks";import{isJSP as o}from"regex-is-jsp";import{isJinjaSpecific as c}from"regex-jinja-specific";var n="4.2.0";var g=n;function f(e){let t=null;if(typeof e!="string")throw new TypeError(`detect-templating-language/detectLang(): [THROW_ID_01] Input must be string! It was given as ${i(e,4)} (type ${typeof e}).`);return e?(r().test(e)?(t="Nunjucks",c().test(e)&&(t="Jinja")):o().test(e)&&(t="JSP"),{name:t}):{name:t}}export{f as detectLang,g as version};
@@ -1,17 +1,25 @@
1
1
  /**
2
2
  * @name detect-templating-language
3
3
  * @fileoverview Detects various templating languages present in string
4
- * @version 4.1.0
4
+ * @version 4.2.0
5
5
  * @author Roy Revelt
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/detect-templating-language/}
8
8
  */
9
9
 
10
- "use strict";var detectTemplatingLanguage=(()=>{var i=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var m=(e,t)=>{for(var s in t)i(e,s,{get:t[s],enumerable:!0})},d=(e,t,s,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of l(t))!g.call(e,n)&&n!==s&&i(e,n,{get:()=>t[n],enumerable:!(r=a(t,n))||r.enumerable});return e};var f=e=>d(i({},"__esModule",{value:!0}),e);var y={};m(y,{detectLang:()=>x,version:()=>v});function p(){return/{%|{{|%}|}}/gi}function o(){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 u="4.1.0";var v=u;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 ".concat(JSON.stringify(e,null,4)," (type ").concat(typeof e,")."));return e?(p().test(e)?(t="Nunjucks",c().test(e)&&(t="Jinja")):o().test(e)&&(t="JSP"),{name:t}):{name:t}}return f(y);})();
10
+ "use strict";var detectTemplatingLanguage=(()=>{var h=Object.defineProperty;var W=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyNames;var R=Object.prototype.hasOwnProperty;var I=(t,n)=>{for(var e in n)h(t,e,{get:n[e],enumerable:!0})},B=(t,n,e,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let a of M(n))!R.call(t,a)&&a!==e&&h(t,a,{get:()=>n[a],enumerable:!(i=W(n,a))||i.enumerable});return t};var L=t=>B(h({},"__esModule",{value:!0}),t);var J={};I(J,{detectLang:()=>F,version:()=>E});function P(){let t=[],n=0,e=!1;return{append(i){return e?!1:n+i.length>1999?(t.push("\u2026"),n+=1,e=!0,!1):(t.push(i),n+=i.length,!0)},result(){return t.join("")},stopped(){return e}}}function N(t){return"\\u".concat(t.toString(16).padStart(4,"0"))}function d(t,n){if(t.append('"')){for(let e=0;e<n.length&&!t.stopped();e+=1){let i=n.charCodeAt(e);i===34?t.append('\\"'):i===92?t.append("\\\\"):i===8?t.append("\\b"):i===9?t.append("\\t"):i===10?t.append("\\n"):i===12?t.append("\\f"):i===13?t.append("\\r"):i<32||i===8232||i===8233||i>=55296&&i<=57343?t.append(N(i)):t.append(n[e])}t.append('"')}}function T(t){return t.get&&t.set?"[Getter/Setter]":t.get?"[Getter]":t.set?"[Setter]":"[Accessor]"}function w(t,n){t.append("Symbol(");let e=String(n);e.length>8&&d(t,e.slice(7,-1)),t.append(")")}function A(t,n){typeof n=="symbol"?w(t,n):d(t,String(n))}function x(t,n=0){let e=P(),i=n===4?4:0,a=new WeakSet,p=0;function m(r){i&&e.append(" ".repeat(r*i))}function g(r,s){r&&e.append(","),i&&(e.append("\n"),m(s+1))}function y(r,s,l){i&&s&&(e.append("\n"),m(l)),e.append(r)}function b(r,s){Object.prototype.hasOwnProperty.call(r,"value")?v(r.value,s):e.append(T(r))}function O(r,s){let l;try{l=Reflect.getOwnPropertyDescriptor(r,"length")}catch(u){e.append("[Uninspectable]");return}let o=l==null?void 0:l.value;if(!Number.isSafeInteger(o)||o<0){e.append("[Uninspectable]");return}e.append("[");let f=!1;for(let u=0;u<o&&!e.stopped();u+=1){if(g(f,s),f=!0,p>=50){e.append("[MaxEntries]");break}p+=1;let c;try{c=Reflect.getOwnPropertyDescriptor(r,String(u))}catch(V){e.append("[Uninspectable]");continue}c!=null&&c.enumerable?b(c,s+1):e.append("[Empty]")}y("]",f,s)}function D(r,s){let l;try{l=Reflect.ownKeys(r)}catch(f){e.append("[Uninspectable]");return}e.append("{");let o=!1;for(let f of l){if(e.stopped())break;if(p>=50){g(o,s),o=!0,d(e,"\u2026"),e.append(i?": ":":"),e.append("[MaxEntries]");break}p+=1;let u;try{u=Reflect.getOwnPropertyDescriptor(r,f)}catch(c){g(o,s),o=!0,A(e,f),e.append(i?": ":":"),e.append("[Uninspectable]");continue}u!=null&&u.enumerable&&(g(o,s),o=!0,A(e,f),e.append(i?": ":":"),b(u,s+1))}y("}",o,s)}function $(r,s){if(a.has(r)){e.append("[Circular]");return}if(s>=5){e.append("[MaxDepth]");return}let l;try{l=Array.isArray(r)}catch(o){e.append("[Uninspectable]");return}a.add(r);try{l?O(r,s):D(r,s)}finally{a.delete(r)}}function v(r,s){r===null?e.append("null"):typeof r=="string"?d(e,r):typeof r=="number"?e.append(Object.is(r,-0)?"-0":String(r)):typeof r=="boolean"?e.append(r?"true":"false"):typeof r>"u"?e.append("undefined"):typeof r=="bigint"?e.append("".concat(r,"n")):typeof r=="symbol"?w(e,r):typeof r=="function"?e.append("[Function]"):$(r,s)}try{return v(t,0),e.result()}catch(r){return"[Uninspectable]"}}var Q=new Set([..."\u060B$\u20BC\u17DB\xA5\u20A1\u20B1\xA3\u20AC\xA2\u20B9\uFDFC\u20AA\u20A9\u20AD\u20A8\u20AE\u20A6\u20BD\u20AB\u0E3F\u20A9\u20BA\u20B4","$U","$b","B/.","BZ$","Br","Bs","C$","CHF","Ft","Gs","J$","KM","K\u010D","L","MT","NT$","P","Q","R","R$","RD$","RM","Rp","S","S/.","TT$","Z$","kn","kr","lei","z\u0142","\u0192","\u0414\u0438\u043D.","\u0434\u0435\u043D","\u043B\u0432","\u062F.\u0625","Lek"]);function j(){return/{%|{{|%}|}}/gi}function k(){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 S="4.2.0";var E=S;function F(t){let n=null;if(typeof t!="string")throw new TypeError("detect-templating-language/detectLang(): [THROW_ID_01] Input must be string! It was given as ".concat(x(t,4)," (type ").concat(typeof t,")."));return t?(j().test(t)?(n="Nunjucks",C().test(t)&&(n="Jinja")):k().test(t)&&(n="JSP"),{name:n}):{name:n}}return L(J);})();
11
+ /**
12
+ * @name codsen-utils
13
+ * @fileoverview Various utility functions
14
+ * @version 1.8.0
15
+ * @author Roy Revelt
16
+ * @license MIT
17
+ * {@link https://codsen.com/os/codsen-utils/}
18
+ */
11
19
  /**
12
20
  * @name regex-is-jinja-nunjucks
13
21
  * @fileoverview Regular expression for detecting Jinja or Nunjucks code
14
- * @version 4.1.0
22
+ * @version 4.2.0
15
23
  * @author Roy Revelt
16
24
  * @license MIT
17
25
  * {@link https://codsen.com/os/regex-is-jinja-nunjucks/}
@@ -19,7 +27,7 @@
19
27
  /**
20
28
  * @name regex-is-jsp
21
29
  * @fileoverview Regular expression for detecting JSP (Java Server Pages) code
22
- * @version 4.1.0
30
+ * @version 4.2.0
23
31
  * @author Roy Revelt
24
32
  * @license MIT
25
33
  * {@link https://codsen.com/os/regex-is-jsp/}
@@ -27,7 +35,7 @@
27
35
  /**
28
36
  * @name regex-jinja-specific
29
37
  * @fileoverview Regular expression for detecting Python-specific Jinja code
30
- * @version 4.1.0
38
+ * @version 4.2.0
31
39
  * @author Roy Revelt
32
40
  * @license MIT
33
41
  * {@link https://codsen.com/os/regex-jinja-specific/}
package/package.json CHANGED
@@ -1,15 +1,8 @@
1
1
  {
2
2
  "name": "detect-templating-language",
3
- "version": "4.1.0",
3
+ "version": "4.2.0",
4
4
  "description": "Detects various templating languages present in string",
5
- "keywords": [
6
- "check",
7
- "code",
8
- "detect",
9
- "language",
10
- "template",
11
- "templating"
12
- ],
5
+ "keywords": ["check", "code", "detect", "language", "template", "templating"],
13
6
  "homepage": "https://codsen.com/os/detect-templating-language",
14
7
  "repository": {
15
8
  "type": "git",
@@ -30,45 +23,45 @@
30
23
  },
31
24
  "types": "types/index.d.ts",
32
25
  "scripts": {
33
- "build": "node '../../ops/scripts/esbuild.js' && npm run dts",
34
- "cjs-off": "exit 0",
35
- "cjs-on": "exit 0",
36
- "dev": "DEV=true node '../../ops/scripts/esbuild.js' && npm run dts",
26
+ "build": "node ../../ops/scripts/esbuild.js && npm run dts",
27
+ "coverage": "c8 uvu test",
28
+ "dev": "node ../../ops/scripts/esbuild.js --dev && npm run dts",
37
29
  "devtest": "c8 npm run unit && npm run examples && npm run lint",
38
- "dts": "rollup -c && npm run prettier -- 'types/index.d.ts' --write --log-level 'silent'",
30
+ "dts": "rollup -c && biome format --write --config-path=../../biome.json --vcs-enabled=false --use-editorconfig=false types/index.d.ts",
39
31
  "examples": "node '../../ops/scripts/run-examples.js'",
40
- "lect": "node '../../ops/lect/lect.js' && npm run prettier -- 'README.md' '.all-contributorsrc' 'rollup.config.js' --write",
41
- "letspublish": "npm publish --provenance || :",
42
- "lint": "eslint . --fix --concurrency=auto --cache",
32
+ "lect": "node '../../ops/lect/lect.js'",
33
+ "lect:check": "node '../../ops/lect/lect.js' --check",
34
+ "lint": "biome lint --error-on-warnings . && npm run typecheck",
35
+ "lint:fix": "biome lint --write --error-on-warnings . && npm run typecheck",
43
36
  "perf": "node perf/check.js",
44
37
  "prep": "echo 'ready'",
45
- "prettier": "prettier",
46
- "prettier:format": "npm run prettier -- --write '**/*.{ts,tsx,md}' --no-error-on-unmatched-pattern --log-level 'silent'",
47
- "pretest": "npm run lect && npm run build",
38
+ "prettier": "biome format",
39
+ "prettier:format": "biome format --write .",
40
+ "pretest": "npm run lect:check && npm run build",
48
41
  "test": "npm run devtest",
42
+ "typecheck": "tsc --noEmit --pretty false --project tsconfig.json",
49
43
  "unit": "uvu test"
50
44
  },
51
- "engines": {
52
- "node": ">=14.18.0"
53
- },
54
45
  "c8": {
46
+ "all": true,
55
47
  "check-coverage": true,
56
- "exclude": [
57
- "**/test/**/*.*"
58
- ],
48
+ "exclude": ["**/test/**/*.*"],
49
+ "include": ["dist/*.esm.js"],
59
50
  "lines": 100
60
51
  },
61
52
  "lect": {
62
53
  "licence": {
63
- "extras": [
64
- ""
65
- ]
54
+ "extras": [""]
66
55
  }
67
56
  },
68
57
  "dependencies": {
69
- "regex-is-jinja-nunjucks": "^4.1.0",
70
- "regex-is-jsp": "^4.1.0",
71
- "regex-jinja-specific": "^4.1.0"
58
+ "codsen-utils": "^1.8.0",
59
+ "regex-is-jinja-nunjucks": "^4.2.0",
60
+ "regex-is-jsp": "^4.2.0",
61
+ "regex-jinja-specific": "^4.2.0"
62
+ },
63
+ "engines": {
64
+ "node": ">=18.20.8"
72
65
  },
73
66
  "publishConfig": {
74
67
  "registry": "https://registry.npmjs.org/"
package/.eslintcache DELETED
@@ -1 +0,0 @@
1
- [{"/home/runner/work/codsen/codsen/packages/detect-templating-language/examples/_quickTake.js":"1","/home/runner/work/codsen/codsen/packages/detect-templating-language/perf/check.js":"2","/home/runner/work/codsen/codsen/packages/detect-templating-language/rollup.config.js":"3","/home/runner/work/codsen/codsen/packages/detect-templating-language/src/main.ts":"4","/home/runner/work/codsen/codsen/packages/detect-templating-language/test/test.js":"5"},{"size":424,"mtime":1760566739084,"results":"6","hashOfConfig":"7"},{"size":581,"mtime":1760566739084,"results":"8","hashOfConfig":"9"},{"size":373,"mtime":1760566739084,"results":"10","hashOfConfig":"7"},{"size":1065,"mtime":1760566739084,"results":"11","hashOfConfig":"9"},{"size":1790,"mtime":1760566739084,"results":"12","hashOfConfig":"13"},{"filePath":"14","messages":"15","suppressedMessages":"16","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"1nlhngw",{"filePath":"17","messages":"18","suppressedMessages":"19","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"1xjytlu",{"filePath":"20","messages":"21","suppressedMessages":"22","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"23","messages":"24","suppressedMessages":"25","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"26","messages":"27","suppressedMessages":"28","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"nrihsz","/home/runner/work/codsen/codsen/packages/detect-templating-language/examples/_quickTake.js",[],[],"/home/runner/work/codsen/codsen/packages/detect-templating-language/perf/check.js",[],[],"/home/runner/work/codsen/codsen/packages/detect-templating-language/rollup.config.js",[],[],"/home/runner/work/codsen/codsen/packages/detect-templating-language/src/main.ts",[],[],"/home/runner/work/codsen/codsen/packages/detect-templating-language/test/test.js",[],["29","30","31","32","33"],{"ruleId":"34","severity":2,"message":"35","line":3,"column":17,"nodeType":null,"messageId":"36","endLine":3,"endColumn":19,"suppressions":"37"},{"ruleId":"34","severity":2,"message":"38","line":3,"column":21,"nodeType":null,"messageId":"36","endLine":3,"endColumn":23,"suppressions":"39"},{"ruleId":"34","severity":2,"message":"40","line":3,"column":33,"nodeType":null,"messageId":"36","endLine":3,"endColumn":37,"suppressions":"41"},{"ruleId":"34","severity":2,"message":"42","line":3,"column":39,"nodeType":null,"messageId":"36","endLine":3,"endColumn":42,"suppressions":"43"},{"ruleId":"34","severity":2,"message":"44","line":3,"column":44,"nodeType":null,"messageId":"36","endLine":3,"endColumn":49,"suppressions":"45"},"@typescript-eslint/no-unused-vars","'is' is defined but never used.","unusedVar",["46"],"'ok' is defined but never used.",["47"],"'type' is defined but never used.",["48"],"'not' is defined but never used.",["49"],"'match' is defined but never used.",["50"],{"kind":"51","justification":"52"},{"kind":"51","justification":"52"},{"kind":"51","justification":"52"},{"kind":"51","justification":"52"},{"kind":"51","justification":"52"},"directive",""]