@gjsify/dom-exception 0.3.13 → 0.3.15
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/lib/esm/index.js +41 -35
- package/lib/esm/register.js +5 -1
- package/package.json +3 -3
package/lib/esm/index.js
CHANGED
|
@@ -1,38 +1,44 @@
|
|
|
1
|
+
//#region src/index.ts
|
|
2
|
+
/** Standard DOMException error code mapping per WebIDL spec */
|
|
1
3
|
const DOMExceptionCodes = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
4
|
+
IndexSizeError: 1,
|
|
5
|
+
HierarchyRequestError: 3,
|
|
6
|
+
WrongDocumentError: 4,
|
|
7
|
+
InvalidCharacterError: 5,
|
|
8
|
+
NoModificationAllowedError: 7,
|
|
9
|
+
NotFoundError: 8,
|
|
10
|
+
NotSupportedError: 9,
|
|
11
|
+
InUseAttributeError: 10,
|
|
12
|
+
InvalidStateError: 11,
|
|
13
|
+
SyntaxError: 12,
|
|
14
|
+
InvalidModificationError: 13,
|
|
15
|
+
NamespaceError: 14,
|
|
16
|
+
InvalidAccessError: 15,
|
|
17
|
+
TypeMismatchError: 17,
|
|
18
|
+
SecurityError: 18,
|
|
19
|
+
NetworkError: 19,
|
|
20
|
+
AbortError: 20,
|
|
21
|
+
URLMismatchError: 21,
|
|
22
|
+
QuotaExceededError: 22,
|
|
23
|
+
TimeoutError: 23,
|
|
24
|
+
InvalidNodeTypeError: 24,
|
|
25
|
+
DataCloneError: 25
|
|
24
26
|
};
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
const DOMException = typeof globalThis.DOMException !== "undefined" ? globalThis.DOMException : _DOMExceptionPolyfill;
|
|
34
|
-
var index_default = DOMException;
|
|
35
|
-
export {
|
|
36
|
-
DOMException,
|
|
37
|
-
index_default as default
|
|
27
|
+
/** DOMException polyfill — extends Error with standard error codes */
|
|
28
|
+
var _DOMExceptionPolyfill = class extends Error {
|
|
29
|
+
code;
|
|
30
|
+
constructor(message, name) {
|
|
31
|
+
super(message);
|
|
32
|
+
this.name = name || "Error";
|
|
33
|
+
this.code = Object.hasOwn(DOMExceptionCodes, this.name) ? DOMExceptionCodes[this.name] : 0;
|
|
34
|
+
}
|
|
38
35
|
};
|
|
36
|
+
/**
|
|
37
|
+
* DOMException — uses native implementation if available, polyfill otherwise.
|
|
38
|
+
* Native is available in Node.js 17+ and modern browsers.
|
|
39
|
+
* On GJS, the polyfill is used.
|
|
40
|
+
*/
|
|
41
|
+
const DOMException = typeof globalThis.DOMException !== "undefined" ? globalThis.DOMException : _DOMExceptionPolyfill;
|
|
42
|
+
|
|
43
|
+
//#endregion
|
|
44
|
+
export { DOMException, DOMException as default };
|
package/lib/esm/register.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/dom-exception",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.15",
|
|
4
4
|
"description": "DOMException polyfill for GJS (WebIDL standard)",
|
|
5
5
|
"module": "lib/esm/index.js",
|
|
6
6
|
"types": "lib/types/index.d.ts",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"polyfill"
|
|
41
41
|
],
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@gjsify/cli": "^0.3.
|
|
44
|
-
"@gjsify/unit": "^0.3.
|
|
43
|
+
"@gjsify/cli": "^0.3.15",
|
|
44
|
+
"@gjsify/unit": "^0.3.15",
|
|
45
45
|
"@types/node": "^25.6.0",
|
|
46
46
|
"typescript": "^6.0.3"
|
|
47
47
|
}
|