@ricsam/quickjs-encoding 0.2.10 → 0.2.12

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.
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@ricsam/quickjs-encoding",
3
- "version": "0.2.10",
3
+ "version": "0.2.12",
4
4
  "type": "commonjs"
5
5
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@ricsam/quickjs-encoding",
3
- "version": "0.2.10",
3
+ "version": "0.2.12",
4
4
  "type": "module"
5
5
  }
@@ -0,0 +1,34 @@
1
+ /**
2
+ * QuickJS Global Type Definitions for @ricsam/quickjs-encoding
3
+ *
4
+ * These types define the globals injected by setupEncoding() into a QuickJS context.
5
+ * Use these types to typecheck user code that will run inside QuickJS.
6
+ */
7
+
8
+ export {};
9
+
10
+ declare global {
11
+ /**
12
+ * Decodes a Base64-encoded string.
13
+ *
14
+ * @param encodedData - The Base64 string to decode
15
+ * @returns The decoded string
16
+ * @throws DOMException if the input is not valid Base64
17
+ *
18
+ * @example
19
+ * atob("SGVsbG8="); // "Hello"
20
+ */
21
+ function atob(encodedData: string): string;
22
+
23
+ /**
24
+ * Encodes a string to Base64.
25
+ *
26
+ * @param stringToEncode - The string to encode (must contain only Latin1 characters)
27
+ * @returns The Base64 encoded string
28
+ * @throws DOMException if the string contains characters outside Latin1 range (0-255)
29
+ *
30
+ * @example
31
+ * btoa("Hello"); // "SGVsbG8="
32
+ */
33
+ function btoa(stringToEncode: string): string;
34
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ricsam/quickjs-encoding",
3
- "version": "0.2.10",
3
+ "version": "0.2.12",
4
4
  "main": "./dist/cjs/index.cjs",
5
5
  "types": "./dist/types/index.d.ts",
6
6
  "exports": {
@@ -8,6 +8,9 @@
8
8
  "types": "./dist/types/index.d.ts",
9
9
  "require": "./dist/cjs/index.cjs",
10
10
  "import": "./dist/mjs/index.mjs"
11
+ },
12
+ "./quickjs": {
13
+ "types": "./dist/types/quickjs.d.ts"
11
14
  }
12
15
  },
13
16
  "scripts": {
@@ -16,7 +19,7 @@
16
19
  "typecheck": "tsc --noEmit"
17
20
  },
18
21
  "dependencies": {
19
- "@ricsam/quickjs-core": "^0.2.10",
22
+ "@ricsam/quickjs-core": "^0.2.12",
20
23
  "quickjs-emscripten": "^0.31.0"
21
24
  },
22
25
  "peerDependencies": {