detect-is-it-html-or-xhtml 6.1.3 → 6.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 +15 -2
- package/LICENSE +1 -1
- package/README.md +3 -2
- package/dist/detect-is-it-html-or-xhtml.esm.js +2 -2
- package/dist/detect-is-it-html-or-xhtml.umd.js +10 -2
- package/package.json +23 -21
package/CHANGELOG.md
CHANGED
|
@@ -3,11 +3,24 @@
|
|
|
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.
|
|
6
|
+
## 6.2.0 (2026-08-19)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- make validation diagnostics safe ([7b01074](https://github.com/codsen/codsen/commit/7b0107476f12734aeb8e82852ba980b187280110))
|
|
11
|
+
- reject non-string falsy inputs ([f000de4](https://github.com/codsen/codsen/commit/f000de44f1a5637ca8d5a593b3a9d933f9c7dac0))
|
|
12
|
+
- resolve review findings REV-004 through REV-007 ([b60e9ee](https://github.com/codsen/codsen/commit/b60e9eeb499af94685cfb87b4970fe025be1fc10))
|
|
13
|
+
- retire direct publish aliases ([f98e31e](https://github.com/codsen/codsen/commit/f98e31eb89bc185471225664e610b55f34fbf648))
|
|
7
14
|
|
|
8
15
|
### Features
|
|
9
16
|
|
|
10
|
-
-
|
|
17
|
+
- add codsen-glob and migrate glob consumers ([5595a2b](https://github.com/codsen/codsen/commit/5595a2b267eaa6cb60072d037aef00b7a28edd42))
|
|
18
|
+
- refresh the tooling and generate with the latest dependencies ([781f802](https://github.com/codsen/codsen/commit/781f802911066a82a4533b0e5a3fcbd742d0dd83))
|
|
19
|
+
|
|
20
|
+
### Reverts
|
|
21
|
+
|
|
22
|
+
- 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)
|
|
23
|
+
- 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
24
|
|
|
12
25
|
## 6.0.0 (2022-12-01)
|
|
13
26
|
|
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright © 2010-
|
|
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-
|
|
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.
|
|
4
|
+
* @version 6.2.0
|
|
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
|
|
10
|
+
import{formatDiagnosticValue as l}from"codsen-utils";var o="6.2.0";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.
|
|
4
|
+
* @version 6.2.0
|
|
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
|
|
10
|
+
"use strict";var detectIsItHtmlOrXhtml=(()=>{var g=Object.defineProperty;var j=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyNames;var D=Object.prototype.hasOwnProperty;var R=(t,i)=>{for(var e in i)g(t,e,{get:i[e],enumerable:!0})},W=(t,i,e,n)=>{if(i&&typeof i=="object"||typeof i=="function")for(let l of M(i))!D.call(t,l)&&l!==e&&g(t,l,{get:()=>i[l],enumerable:!(n=j(i,l))||n.enumerable});return t};var $=t=>W(g({},"__esModule",{value:!0}),t);var _={};R(_,{detectIsItHTMLOrXhtml:()=>V,version:()=>P});function I(){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 T(t){return t.get&&t.set?"[Getter/Setter]":t.get?"[Getter]":t.set?"[Setter]":"[Accessor]"}function A(t,i){t.append("Symbol(");let e=String(i);e.length>8&&d(t,e.slice(7,-1)),t.append(")")}function x(t,i){typeof i=="symbol"?A(t,i):d(t,String(i))}function w(t,i=0){let e=I(),n=i===4?4:0,l=new WeakSet,c=0;function m(r){n&&e.append(" ".repeat(r*n))}function h(r,s){r&&e.append(","),n&&(e.append("\n"),m(s+1))}function y(r,s,o){n&&s&&(e.append("\n"),m(o)),e.append(r)}function b(r,s){Object.prototype.hasOwnProperty.call(r,"value")?v(r.value,s):e.append(T(r))}function k(r,s){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,s),f=!0,c>=50){e.append("[MaxEntries]");break}c+=1;let p;try{p=Reflect.getOwnPropertyDescriptor(r,String(a))}catch(Q){e.append("[Uninspectable]");continue}p!=null&&p.enumerable?b(p,s+1):e.append("[Empty]")}y("]",f,s)}function O(r,s){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,s),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,s),u=!0,x(e,f),e.append(n?": ":":"),e.append("[Uninspectable]");continue}a!=null&&a.enumerable&&(h(u,s),u=!0,x(e,f),e.append(n?": ":":"),b(a,s+1))}y("}",u,s)}function S(r,s){if(l.has(r)){e.append("[Circular]");return}if(s>=5){e.append("[MaxDepth]");return}let o;try{o=Array.isArray(r)}catch(u){e.append("[Uninspectable]");return}l.add(r);try{o?k(r,s):O(r,s)}finally{l.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"?A(e,r):typeof r=="function"?e.append("[Function]"):S(r,s)}try{return v(t,0),e.result()}catch(r){return"[Uninspectable]"}}var K=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 C="6.2.0";var P=C,U=/<\s*!\s*doctype[^>]*>/i,E=/<\s*(?:img|br|hr)[^>]*>/gi,F=/\/\s*>/,N=/xhtml/i,H=/svg/i;function V(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(w(t,4)," (type ").concat(typeof t,")"));let i=t.match(U);if(i)return N.test(i[0])||H.test(i[0])?"xhtml":"html";let e=t.match(E);if(!e)return null;let n=0;for(let l=0,c=e.length;l<c;l++)F.test(e[l])&&(n+=1);return n>e.length/2?"xhtml":"html"}return $(_);})();
|
|
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
|
+
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "detect-is-it-html-or-xhtml",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.2.0",
|
|
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
|
|
42
|
-
"
|
|
43
|
-
"
|
|
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 &&
|
|
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'
|
|
49
|
-
"
|
|
50
|
-
"lint": "
|
|
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": "
|
|
54
|
-
"prettier:format": "
|
|
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
|
-
|
|
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.8.0"
|
|
74
|
+
},
|
|
75
|
+
"engines": {
|
|
76
|
+
"node": ">=18.20.8"
|
|
77
|
+
},
|
|
76
78
|
"publishConfig": {
|
|
77
79
|
"registry": "https://registry.npmjs.org/"
|
|
78
80
|
}
|