detect-is-it-html-or-xhtml 6.1.3 → 6.2.1

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,30 @@
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
- ## 6.1.0 (2025-10-15)
6
+ ## 6.2.1 (2026-08-22)
7
+
8
+ ### Performance Improvements
9
+
10
+ - optimise package hot paths and JSON editing ([f3112bd](https://github.com/codsen/codsen/commit/f3112bd7fc0d7c9bc09312d3744c950691d72ca5))
11
+
12
+ ## 6.2.0 (2026-08-19)
13
+
14
+ ### Bug Fixes
15
+
16
+ - make validation diagnostics safe ([7b01074](https://github.com/codsen/codsen/commit/7b0107476f12734aeb8e82852ba980b187280110))
17
+ - reject non-string falsy inputs ([f000de4](https://github.com/codsen/codsen/commit/f000de44f1a5637ca8d5a593b3a9d933f9c7dac0))
18
+ - resolve various review findings ([b60e9ee](https://github.com/codsen/codsen/commit/b60e9eeb499af94685cfb87b4970fe025be1fc10))
19
+ - retire direct publish aliases ([f98e31e](https://github.com/codsen/codsen/commit/f98e31eb89bc185471225664e610b55f34fbf648))
7
20
 
8
21
  ### Features
9
22
 
10
- - if value to be added is a number, keep it as is, don't stringify ([ce3e1a5](https://github.com/codsen/codsen/commit/ce3e1a525998ca3c0abf0142affef95b14cd1990))
23
+ - add codsen-glob and migrate glob consumers ([5595a2b](https://github.com/codsen/codsen/commit/5595a2b267eaa6cb60072d037aef00b7a28edd42))
24
+ - refresh the tooling and generate with the latest dependencies ([781f802](https://github.com/codsen/codsen/commit/781f802911066a82a4533b0e5a3fcbd742d0dd83))
25
+
26
+ ### Reverts
27
+
28
+ - 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)
29
+ - 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
30
 
12
31
  ## 6.0.0 (2022-12-01)
13
32
 
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-is-it-html-or-xhtml
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 { detectIsItHTMLOrXhtml } from "detect-is-it-html-or-xhtml";
38
38
 
@@ -44,6 +44,7 @@ assert.equal(
44
44
  );
45
45
  ```
46
46
 
47
+
47
48
  ## Documentation
48
49
 
49
50
  Please [visit codsen.com](https://codsen.com/os/detect-is-it-html-or-xhtml/) 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-is-it-html-or-xhtml/CHANGELOG.md).
@@ -56,6 +57,6 @@ To report bugs or request features or assistance, [raise an issue](https://githu
56
57
 
57
58
  MIT License
58
59
 
59
- Copyright © 2010-2025 Roy Revelt and other contributors
60
+ Copyright © 2010-2026 Roy Revelt and other contributors
60
61
 
61
62
  <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-is-it-html-or-xhtml
3
3
  * @fileoverview Does the string resemble an HTML or XHTML (or neither)?
4
- * @version 6.1.3
4
+ * @version 6.2.1
5
5
  * @author Roy Revelt
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/detect-is-it-html-or-xhtml/}
8
8
  */
9
9
 
10
- var i="6.1.3";var v=i;function T(t){function o(e){return e!=null}if(!t)return null;if(typeof t!="string")throw new TypeError(`detect-is-it-html-or-xhtml: [THROW_ID_01] Input must be a string! It was given as ${JSON.stringify(t,null,4)} (type ${typeof t})`);let c=/<\s*!\s*doctype[^>]*>/im,m=/<\s*img[^>]*>/gi,p=/<\s*br[^>]*>/gi,a=/<\s*hr[^>]*>/gi,h=/\/\s*>/g,s=t.match(c);if(s){let e=/xhtml/gi,l=/svg/gi;return s[0].match(e)||s[0].match(l)?"xhtml":"html"}let d=t.match(m)||[],g=t.match(p)||[],u=t.match(a)||[],r=d.concat(g).concat(u);if(r.length===0)return null;let n=0;for(let e=0,l=r.length;e<l;e++)o(r[e].match(h))&&(n+=1);return n>r.length/2?"xhtml":"html"}export{T as detectIsItHTMLOrXhtml,v as version};
10
+ import{formatDiagnosticValue as l}from"codsen-utils";var o="6.2.1";var x=o,m=/<\s*!\s*doctype[^>]*>/i,p=/<\s*(?:img|br|hr)[^>]*>/gi,d=/\/\s*>/,h=/xhtml/i,a=/svg/i;function y(e){if(e==null||e==="")return null;if(typeof e!="string")throw new TypeError(`detect-is-it-html-or-xhtml/detectIsItHTMLOrXhtml(): [THROW_ID_01] Input must be a string! It was given as ${l(e,4)} (type ${typeof e})`);let s=e.match(m);if(s)return h.test(s[0])||a.test(s[0])?"xhtml":"html";let t=e.match(p);if(!t)return null;let n=0;for(let r=0,i=t.length;r<i;r++)d.test(t[r])&&(n+=1);return n>t.length/2?"xhtml":"html"}export{y as detectIsItHTMLOrXhtml,x as version};
@@ -1,10 +1,18 @@
1
1
  /**
2
2
  * @name detect-is-it-html-or-xhtml
3
3
  * @fileoverview Does the string resemble an HTML or XHTML (or neither)?
4
- * @version 6.1.3
4
+ * @version 6.2.1
5
5
  * @author Roy Revelt
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/detect-is-it-html-or-xhtml/}
8
8
  */
9
9
 
10
- "use strict";var detectIsItHtmlOrXhtml=(()=>{var m=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var v=Object.prototype.hasOwnProperty;var T=(t,e)=>{for(var l in e)m(t,l,{get:e[l],enumerable:!0})},b=(t,e,l,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of f(e))!v.call(t,r)&&r!==l&&m(t,r,{get:()=>e[r],enumerable:!(n=y(e,r))||n.enumerable});return t};var j=t=>b(m({},"__esModule",{value:!0}),t);var M={};T(M,{detectIsItHTMLOrXhtml:()=>I,version:()=>w});var a="6.1.3";var w=a;function I(t){function e(s){return s!=null}if(!t)return null;if(typeof t!="string")throw new TypeError("detect-is-it-html-or-xhtml: [THROW_ID_01] Input must be a string! It was given as ".concat(JSON.stringify(t,null,4)," (type ").concat(typeof t,")"));let l=/<\s*!\s*doctype[^>]*>/im,n=/<\s*img[^>]*>/gi,r=/<\s*br[^>]*>/gi,h=/<\s*hr[^>]*>/gi,d=/\/\s*>/g,o=t.match(l);if(o){let s=/xhtml/gi,c=/svg/gi;return o[0].match(s)||o[0].match(c)?"xhtml":"html"}let g=t.match(n)||[],u=t.match(r)||[],x=t.match(h)||[],i=g.concat(u).concat(x);if(i.length===0)return null;let p=0;for(let s=0,c=i.length;s<c;s++)e(i[s].match(d))&&(p+=1);return p>i.length/2?"xhtml":"html"}return j(M);})();
10
+ "use strict";var detectIsItHtmlOrXhtml=(()=>{var g=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var I=Object.prototype.hasOwnProperty;var M=(t,i)=>{for(var e in i)g(t,e,{get:i[e],enumerable:!0})},$=(t,i,e,n)=>{if(i&&typeof i=="object"||typeof i=="function")for(let s of R(i))!I.call(t,s)&&s!==e&&g(t,s,{get:()=>i[s],enumerable:!(n=D(i,s))||n.enumerable});return t};var W=t=>$(g({},"__esModule",{value:!0}),t);var Q={};M(Q,{detectIsItHTMLOrXhtml:()=>_,version:()=>P});function T(){let t=[],i=0,e=!1;return{append(n){return e?!1:i+n.length>1999?(t.push("\u2026"),i+=1,e=!0,!1):(t.push(n),i+=n.length,!0)},result(){return t.join("")},stopped(){return e}}}function L(t){return"\\u".concat(t.toString(16).padStart(4,"0"))}function d(t,i){if(t.append('"')){for(let e=0;e<i.length&&!t.stopped();e+=1){let n=i.charCodeAt(e);n===34?t.append('\\"'):n===92?t.append("\\\\"):n===8?t.append("\\b"):n===9?t.append("\\t"):n===10?t.append("\\n"):n===12?t.append("\\f"):n===13?t.append("\\r"):n<32||n===8232||n===8233||n>=55296&&n<=57343?t.append(L(n)):t.append(i[e])}t.append('"')}}function B(t){return t.get&&t.set?"[Getter/Setter]":t.get?"[Getter]":t.set?"[Setter]":"[Accessor]"}function w(t,i){t.append("Symbol(");let e=String(i);e.length>8&&d(t,e.slice(7,-1)),t.append(")")}function A(t,i){typeof i=="symbol"?w(t,i):d(t,String(i))}function C(t,i=0){let e=T(),n=i===4?4:0,s=new WeakSet,c=0;function m(r){n&&e.append(" ".repeat(r*n))}function h(r,l){r&&e.append(","),n&&(e.append("\n"),m(l+1))}function y(r,l,o){n&&l&&(e.append("\n"),m(o)),e.append(r)}function b(r,l){Object.prototype.hasOwnProperty.call(r,"value")?v(r.value,l):e.append(B(r))}function k(r,l){let o;try{o=Reflect.getOwnPropertyDescriptor(r,"length")}catch(a){e.append("[Uninspectable]");return}let u=o==null?void 0:o.value;if(!Number.isSafeInteger(u)||u<0){e.append("[Uninspectable]");return}e.append("[");let f=!1;for(let a=0;a<u&&!e.stopped();a+=1){if(h(f,l),f=!0,c>=50){e.append("[MaxEntries]");break}c+=1;let p;try{p=Reflect.getOwnPropertyDescriptor(r,String(a))}catch(z){e.append("[Uninspectable]");continue}p!=null&&p.enumerable?b(p,l+1):e.append("[Empty]")}y("]",f,l)}function S(r,l){let o;try{o=Reflect.ownKeys(r)}catch(f){e.append("[Uninspectable]");return}e.append("{");let u=!1;for(let f of o){if(e.stopped())break;if(c>=50){h(u,l),u=!0,d(e,"\u2026"),e.append(n?": ":":"),e.append("[MaxEntries]");break}c+=1;let a;try{a=Reflect.getOwnPropertyDescriptor(r,f)}catch(p){h(u,l),u=!0,A(e,f),e.append(n?": ":":"),e.append("[Uninspectable]");continue}a!=null&&a.enumerable&&(h(u,l),u=!0,A(e,f),e.append(n?": ":":"),b(a,l+1))}y("}",u,l)}function j(r,l){if(s.has(r)){e.append("[Circular]");return}if(l>=5){e.append("[MaxDepth]");return}let o;try{o=Array.isArray(r)}catch(u){e.append("[Uninspectable]");return}s.add(r);try{o?k(r,l):S(r,l)}finally{s.delete(r)}}function v(r,l){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]"):j(r,l)}try{return v(t,0),e.result()}catch(r){return"[Uninspectable]"}}var X=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"]);var x,Z=(x=Object.getOwnPropertyDescriptor(RegExp.prototype,"source"))==null?void 0:x.get;var q=Date.prototype.getTime;var O="6.2.1";var P=O,U=/<\s*!\s*doctype[^>]*>/i,F=/<\s*(?:img|br|hr)[^>]*>/gi,N=/\/\s*>/,H=/xhtml/i,V=/svg/i;function _(t){if(t==null||t==="")return null;if(typeof t!="string")throw new TypeError("detect-is-it-html-or-xhtml/detectIsItHTMLOrXhtml(): [THROW_ID_01] Input must be a string! It was given as ".concat(C(t,4)," (type ").concat(typeof t,")"));let i=t.match(U);if(i)return H.test(i[0])||V.test(i[0])?"xhtml":"html";let e=t.match(F);if(!e)return null;let n=0;for(let s=0,c=e.length;s<c;s++)N.test(e[s])&&(n+=1);return n>e.length/2?"xhtml":"html"}return W(Q);})();
11
+ /**
12
+ * @name codsen-utils
13
+ * @fileoverview Various utility functions
14
+ * @version 1.9.0
15
+ * @author Roy Revelt
16
+ * @license MIT
17
+ * {@link https://codsen.com/os/codsen-utils/}
18
+ */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "detect-is-it-html-or-xhtml",
3
- "version": "6.1.3",
3
+ "version": "6.2.1",
4
4
  "description": "Does the string resemble an HTML or XHTML (or neither)?",
5
5
  "keywords": [
6
6
  "check",
@@ -38,41 +38,43 @@
38
38
  },
39
39
  "types": "types/index.d.ts",
40
40
  "scripts": {
41
- "build": "node '../../ops/scripts/esbuild.js' && npm run dts",
42
- "cjs-off": "exit 0",
43
- "cjs-on": "exit 0",
44
- "dev": "DEV=true node '../../ops/scripts/esbuild.js' && npm run dts",
41
+ "build": "node ../../ops/scripts/esbuild.js && npm run dts",
42
+ "coverage": "c8 uvu test",
43
+ "dev": "node ../../ops/scripts/esbuild.js --dev && npm run dts",
45
44
  "devtest": "c8 npm run unit && npm run examples && npm run lint",
46
- "dts": "rollup -c && npm run prettier -- 'types/index.d.ts' --write --log-level 'silent'",
45
+ "dts": "rollup -c && biome format --write --config-path=../../biome.json --vcs-enabled=false --use-editorconfig=false types/index.d.ts",
47
46
  "examples": "node '../../ops/scripts/run-examples.js'",
48
- "lect": "node '../../ops/lect/lect.js' && npm run prettier -- 'README.md' '.all-contributorsrc' 'rollup.config.js' --write",
49
- "letspublish": "npm publish --provenance || :",
50
- "lint": "eslint . --fix --concurrency=auto --cache",
47
+ "lect": "node '../../ops/lect/lect.js'",
48
+ "lect:check": "node '../../ops/lect/lect.js' --check",
49
+ "lint": "biome lint --error-on-warnings . && npm run typecheck",
50
+ "lint:fix": "biome lint --write --error-on-warnings . && npm run typecheck",
51
51
  "perf": "node perf/check.js",
52
52
  "prep": "echo 'ready'",
53
- "prettier": "prettier",
54
- "prettier:format": "npm run prettier -- --write '**/*.{ts,tsx,md}' --no-error-on-unmatched-pattern --log-level 'silent'",
55
- "pretest": "npm run lect && npm run build",
53
+ "prettier": "biome format",
54
+ "prettier:format": "biome format --write .",
55
+ "pretest": "npm run lect:check && npm run build",
56
56
  "test": "npm run devtest",
57
+ "typecheck": "tsc --noEmit --pretty false --project tsconfig.json",
57
58
  "unit": "uvu test"
58
59
  },
59
- "engines": {
60
- "node": ">=14.18.0"
61
- },
62
60
  "c8": {
61
+ "all": true,
63
62
  "check-coverage": true,
64
- "exclude": [
65
- "**/test/**/*.*"
66
- ],
63
+ "exclude": ["**/test/**/*.*"],
64
+ "include": ["dist/*.esm.js"],
67
65
  "lines": 100
68
66
  },
69
67
  "lect": {
70
68
  "licence": {
71
- "extras": [
72
- ""
73
- ]
69
+ "extras": [""]
74
70
  }
75
71
  },
72
+ "dependencies": {
73
+ "codsen-utils": "^1.9.0"
74
+ },
75
+ "engines": {
76
+ "node": ">=18.20.8"
77
+ },
76
78
  "publishConfig": {
77
79
  "registry": "https://registry.npmjs.org/"
78
80
  }