@cogitator-ai/wasm-tools 0.5.6 → 0.5.9
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/README.md +0 -1
- package/dist/__tests__/index.test.d.ts +2 -0
- package/dist/__tests__/index.test.d.ts.map +1 -0
- package/dist/__tests__/index.test.js +226 -0
- package/dist/__tests__/index.test.js.map +1 -0
- package/dist/index.d.ts +1 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/manager/wasm-tool-manager.d.ts.map +1 -1
- package/dist/manager/wasm-tool-manager.js +16 -7
- package/dist/manager/wasm-tool-manager.js.map +1 -1
- package/dist/plugins/base64.js +1 -1
- package/dist/plugins/base64.js.map +1 -1
- package/dist/plugins/calc.d.ts.map +1 -1
- package/dist/plugins/calc.js +48 -33
- package/dist/plugins/calc.js.map +1 -1
- package/dist/plugins/compression.d.ts.map +1 -1
- package/dist/plugins/compression.js +69 -54
- package/dist/plugins/compression.js.map +1 -1
- package/dist/plugins/csv.d.ts.map +1 -1
- package/dist/plugins/csv.js +2 -1
- package/dist/plugins/csv.js.map +1 -1
- package/dist/plugins/hash.d.ts.map +1 -1
- package/dist/plugins/hash.js +15 -1
- package/dist/plugins/hash.js.map +1 -1
- package/dist/plugins/regex.js +2 -2
- package/dist/plugins/regex.js.map +1 -1
- package/dist/plugins/signing.d.ts.map +1 -1
- package/dist/plugins/signing.js +15 -4
- package/dist/plugins/signing.js.map +1 -1
- package/dist/plugins/slug.js +1 -1
- package/dist/plugins/slug.js.map +1 -1
- package/dist/plugins/xml.d.ts.map +1 -1
- package/dist/plugins/xml.js +7 -3
- package/dist/plugins/xml.js.map +1 -1
- package/dist/temp/base64.js +1 -1
- package/dist/temp/calc.js +45 -30
- package/dist/temp/compression.js +173 -49
- package/dist/temp/csv.js +2 -1
- package/dist/temp/hash.js +17 -1
- package/dist/temp/regex.js +2 -2
- package/dist/temp/signing.js +19 -4
- package/dist/temp/slug.js +1 -1
- package/dist/temp/xml.js +7 -1
- package/dist/wasm/base64.wasm +0 -0
- package/dist/wasm/calc.wasm +0 -0
- package/dist/wasm/compression.wasm +0 -0
- package/dist/wasm/csv.wasm +0 -0
- package/dist/wasm/datetime.wasm +0 -0
- package/dist/wasm/diff.wasm +0 -0
- package/dist/wasm/hash.wasm +0 -0
- package/dist/wasm/json.wasm +0 -0
- package/dist/wasm/markdown.wasm +0 -0
- package/dist/wasm/regex.wasm +0 -0
- package/dist/wasm/signing.wasm +0 -0
- package/dist/wasm/slug.wasm +0 -0
- package/dist/wasm/validation.wasm +0 -0
- package/dist/wasm/xml.wasm +0 -0
- package/package.json +1 -1
package/dist/temp/signing.js
CHANGED
|
@@ -24,6 +24,12 @@ __export(signing_exports, {
|
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(signing_exports);
|
|
26
26
|
function hexToBytes(hex) {
|
|
27
|
+
if (hex.length % 2 !== 0) {
|
|
28
|
+
throw new Error("Hex string must have even length");
|
|
29
|
+
}
|
|
30
|
+
if (!/^[0-9a-fA-F]*$/.test(hex)) {
|
|
31
|
+
throw new Error("Invalid hex characters");
|
|
32
|
+
}
|
|
27
33
|
const bytes = new Uint8Array(hex.length / 2);
|
|
28
34
|
for (let i = 0; i < hex.length; i += 2) {
|
|
29
35
|
bytes[i / 2] = parseInt(hex.substr(i, 2), 16);
|
|
@@ -43,10 +49,10 @@ function base64ToBytes(b64) {
|
|
|
43
49
|
for (let i = 0; i < B64.length; i++) lookup[B64[i]] = i;
|
|
44
50
|
let j = 0;
|
|
45
51
|
for (let i = 0; i < len; i += 4) {
|
|
46
|
-
const a = lookup[clean[i]]
|
|
47
|
-
const b = lookup[clean[i + 1]]
|
|
48
|
-
const c = lookup[clean[i + 2]]
|
|
49
|
-
const d = lookup[clean[i + 3]]
|
|
52
|
+
const a = lookup[clean[i]] ?? 0;
|
|
53
|
+
const b = lookup[clean[i + 1]] ?? 0;
|
|
54
|
+
const c = lookup[clean[i + 2]] ?? 0;
|
|
55
|
+
const d = lookup[clean[i + 3]] ?? 0;
|
|
50
56
|
out[j++] = a << 2 | b >> 4;
|
|
51
57
|
if (j < outLen) out[j++] = (b & 15) << 4 | c >> 2;
|
|
52
58
|
if (j < outLen) out[j++] = (c & 3) << 6 | d;
|
|
@@ -560,6 +566,15 @@ var TextEncoder = class {
|
|
|
560
566
|
bytes.push(c);
|
|
561
567
|
} else if (c < 2048) {
|
|
562
568
|
bytes.push(192 | c >> 6, 128 | c & 63);
|
|
569
|
+
} else if (c >= 55296 && c < 56320 && i + 1 < str.length) {
|
|
570
|
+
const c2 = str.charCodeAt(++i);
|
|
571
|
+
c = 65536 + ((c & 1023) << 10) + (c2 & 1023);
|
|
572
|
+
bytes.push(
|
|
573
|
+
240 | c >> 18,
|
|
574
|
+
128 | c >> 12 & 63,
|
|
575
|
+
128 | c >> 6 & 63,
|
|
576
|
+
128 | c & 63
|
|
577
|
+
);
|
|
563
578
|
} else {
|
|
564
579
|
bytes.push(224 | c >> 12, 128 | c >> 6 & 63, 128 | c & 63);
|
|
565
580
|
}
|
package/dist/temp/slug.js
CHANGED
|
@@ -160,7 +160,7 @@ function generateSlug(text, separator, lowercase, maxLength) {
|
|
|
160
160
|
slug2 = slug2.toLowerCase();
|
|
161
161
|
}
|
|
162
162
|
slug2 = slug2.replace(/[^a-zA-Z0-9\s-]/g, "").replace(/\s+/g, separator).replace(new RegExp(`${escapeRegex(separator)}+`, "g"), separator).replace(new RegExp(`^${escapeRegex(separator)}|${escapeRegex(separator)}$`, "g"), "");
|
|
163
|
-
if (maxLength && slug2.length > maxLength) {
|
|
163
|
+
if (maxLength !== void 0 && maxLength > 0 && slug2.length > maxLength) {
|
|
164
164
|
slug2 = slug2.substring(0, maxLength);
|
|
165
165
|
const lastSep = slug2.lastIndexOf(separator);
|
|
166
166
|
if (lastSep > maxLength * 0.5) {
|
package/dist/temp/xml.js
CHANGED
|
@@ -198,7 +198,13 @@ function queryXml(node, query) {
|
|
|
198
198
|
if (part.startsWith("@")) {
|
|
199
199
|
const attrName = part.slice(1);
|
|
200
200
|
if (Array.isArray(current)) {
|
|
201
|
-
|
|
201
|
+
const attrs = [];
|
|
202
|
+
for (const n of current) {
|
|
203
|
+
if (typeof n !== "string" && n.type === "element" && n.attributes?.[attrName]) {
|
|
204
|
+
attrs.push(n.attributes[attrName]);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
return attrs.length > 0 ? attrs : null;
|
|
202
208
|
}
|
|
203
209
|
if (current.type === "element" && current.attributes?.[attrName]) {
|
|
204
210
|
return current.attributes[attrName];
|
package/dist/wasm/base64.wasm
CHANGED
|
Binary file
|
package/dist/wasm/calc.wasm
CHANGED
|
Binary file
|
|
Binary file
|
package/dist/wasm/csv.wasm
CHANGED
|
Binary file
|
package/dist/wasm/datetime.wasm
CHANGED
|
Binary file
|
package/dist/wasm/diff.wasm
CHANGED
|
Binary file
|
package/dist/wasm/hash.wasm
CHANGED
|
Binary file
|
package/dist/wasm/json.wasm
CHANGED
|
Binary file
|
package/dist/wasm/markdown.wasm
CHANGED
|
Binary file
|
package/dist/wasm/regex.wasm
CHANGED
|
Binary file
|
package/dist/wasm/signing.wasm
CHANGED
|
Binary file
|
package/dist/wasm/slug.wasm
CHANGED
|
Binary file
|
|
Binary file
|
package/dist/wasm/xml.wasm
CHANGED
|
Binary file
|