@comper/mermaid-parser 1.0.10 → 1.0.11
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/dist/crypto-stub.d.ts +13 -0
- package/dist/crypto-stub.d.ts.map +1 -0
- package/dist/crypto-stub.js +40 -0
- package/dist/crypto-stub.js.map +1 -0
- package/package.json +6 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lightweight crypto stub for validation-only environments without Node.js APIs
|
|
3
|
+
* Provides minimal UUID generation without cryptographic guarantees
|
|
4
|
+
*/
|
|
5
|
+
declare function randomUUID(): string;
|
|
6
|
+
declare function randomFillSync(buffer: Uint8Array): Uint8Array;
|
|
7
|
+
export { randomUUID, randomFillSync };
|
|
8
|
+
declare const _default: {
|
|
9
|
+
randomUUID: typeof randomUUID;
|
|
10
|
+
randomFillSync: typeof randomFillSync;
|
|
11
|
+
};
|
|
12
|
+
export default _default;
|
|
13
|
+
//# sourceMappingURL=crypto-stub.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crypto-stub.d.ts","sourceRoot":"","sources":["../src/crypto-stub.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,iBAAS,UAAU,IAAI,MAAM,CAkB5B;AAED,iBAAS,cAAc,CAAC,MAAM,EAAE,UAAU,GAAG,UAAU,CAMtD;AAGD,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,CAAC;;;;;AACtC,wBAGE"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lightweight crypto stub for validation-only environments without Node.js APIs
|
|
3
|
+
* Provides minimal UUID generation without cryptographic guarantees
|
|
4
|
+
*/
|
|
5
|
+
// Simple pseudo-random UUID v4 generator (NOT cryptographically secure)
|
|
6
|
+
// Only use this for validation/testing, not for production security purposes
|
|
7
|
+
function randomUUID() {
|
|
8
|
+
// Generate a pseudo-random UUID v4
|
|
9
|
+
const hex = '0123456789abcdef';
|
|
10
|
+
let uuid = '';
|
|
11
|
+
for (let i = 0; i < 36; i++) {
|
|
12
|
+
if (i === 8 || i === 13 || i === 18 || i === 23) {
|
|
13
|
+
uuid += '-';
|
|
14
|
+
}
|
|
15
|
+
else if (i === 14) {
|
|
16
|
+
uuid += '4'; // Version 4
|
|
17
|
+
}
|
|
18
|
+
else if (i === 19) {
|
|
19
|
+
uuid += hex[(Math.random() * 4 | 8)]; // Variant bits
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
uuid += hex[Math.random() * 16 | 0];
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return uuid;
|
|
26
|
+
}
|
|
27
|
+
function randomFillSync(buffer) {
|
|
28
|
+
// Fill with pseudo-random values
|
|
29
|
+
for (let i = 0; i < buffer.length; i++) {
|
|
30
|
+
buffer[i] = Math.random() * 256 | 0;
|
|
31
|
+
}
|
|
32
|
+
return buffer;
|
|
33
|
+
}
|
|
34
|
+
// Export both named and default
|
|
35
|
+
export { randomUUID, randomFillSync };
|
|
36
|
+
export default {
|
|
37
|
+
randomUUID,
|
|
38
|
+
randomFillSync,
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=crypto-stub.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crypto-stub.js","sourceRoot":"","sources":["../src/crypto-stub.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,wEAAwE;AACxE,6EAA6E;AAC7E,SAAS,UAAU;IACjB,mCAAmC;IACnC,MAAM,GAAG,GAAG,kBAAkB,CAAC;IAC/B,IAAI,IAAI,GAAG,EAAE,CAAC;IAEd,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC;QAC5B,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC;YAChD,IAAI,IAAI,GAAG,CAAC;QACd,CAAC;aAAM,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC;YACpB,IAAI,IAAI,GAAG,CAAC,CAAC,YAAY;QAC3B,CAAC;aAAM,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC;YACpB,IAAI,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,eAAe;QACvD,CAAC;aAAM,CAAC;YACN,IAAI,IAAI,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;QACtC,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,cAAc,CAAC,MAAkB;IACxC,iCAAiC;IACjC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACvC,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG,CAAC,CAAC;IACtC,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,gCAAgC;AAChC,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,CAAC;AACtC,eAAe;IACb,UAAU;IACV,cAAc;CACf,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@comper/mermaid-parser",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.11",
|
|
4
4
|
"description": "Lightweight Mermaid diagram validator for server-side environments - validation without rendering",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -16,6 +16,11 @@
|
|
|
16
16
|
"types": "./dist/dompurify-stub.d.ts",
|
|
17
17
|
"import": "./dist/dompurify-stub.js",
|
|
18
18
|
"default": "./dist/dompurify-stub.js"
|
|
19
|
+
},
|
|
20
|
+
"./crypto-stub": {
|
|
21
|
+
"types": "./dist/crypto-stub.d.ts",
|
|
22
|
+
"import": "./dist/crypto-stub.js",
|
|
23
|
+
"default": "./dist/crypto-stub.js"
|
|
19
24
|
}
|
|
20
25
|
},
|
|
21
26
|
"files": [
|