@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 CHANGED
@@ -1,38 +1,44 @@
1
+ //#region src/index.ts
2
+ /** Standard DOMException error code mapping per WebIDL spec */
1
3
  const DOMExceptionCodes = {
2
- IndexSizeError: 1,
3
- HierarchyRequestError: 3,
4
- WrongDocumentError: 4,
5
- InvalidCharacterError: 5,
6
- NoModificationAllowedError: 7,
7
- NotFoundError: 8,
8
- NotSupportedError: 9,
9
- InUseAttributeError: 10,
10
- InvalidStateError: 11,
11
- SyntaxError: 12,
12
- InvalidModificationError: 13,
13
- NamespaceError: 14,
14
- InvalidAccessError: 15,
15
- TypeMismatchError: 17,
16
- SecurityError: 18,
17
- NetworkError: 19,
18
- AbortError: 20,
19
- URLMismatchError: 21,
20
- QuotaExceededError: 22,
21
- TimeoutError: 23,
22
- InvalidNodeTypeError: 24,
23
- DataCloneError: 25
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
- class _DOMExceptionPolyfill extends Error {
26
- code;
27
- constructor(message, name) {
28
- super(message);
29
- this.name = name || "Error";
30
- this.code = Object.hasOwn(DOMExceptionCodes, this.name) ? DOMExceptionCodes[this.name] : 0;
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 };
@@ -1,4 +1,8 @@
1
1
  import { DOMException } from "./index.js";
2
+
3
+ //#region src/register.ts
2
4
  if (typeof globalThis.DOMException === "undefined") {
3
- globalThis.DOMException = DOMException;
5
+ globalThis.DOMException = DOMException;
4
6
  }
7
+
8
+ //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gjsify/dom-exception",
3
- "version": "0.3.13",
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.13",
44
- "@gjsify/unit": "^0.3.13",
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
  }