mirror of
https://github.com/Nystik-gh/ignis.git
synced 2026-06-17 04:35:53 +00:00
shim randomUUID, bump version
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
import { randomBytes } from "./random-bytes.js";
|
||||
import { createHash } from "./create-hash.js";
|
||||
import { scrypt } from "./scrypt.js";
|
||||
import { randomUUID } from "./random-uuid.js";
|
||||
|
||||
export const cryptoShim = {
|
||||
randomBytes,
|
||||
createHash,
|
||||
scrypt,
|
||||
randomUUID,
|
||||
};
|
||||
|
||||
3
src/shims/crypto/random-uuid.js
Normal file
3
src/shims/crypto/random-uuid.js
Normal file
@@ -0,0 +1,3 @@
|
||||
export function randomUUID() {
|
||||
return crypto.randomUUID();
|
||||
}
|
||||
@@ -88,12 +88,17 @@ for (const [name, shim] of Object.entries(rawRegistry)) {
|
||||
const throwOnRequire = new Set(["btime", "get-fonts", "vibrancy-win"]);
|
||||
|
||||
window.require = function (moduleName) {
|
||||
if (throwOnRequire.has(moduleName)) {
|
||||
// Strip node: prefix if present
|
||||
const normalizedName = moduleName.startsWith("node:")
|
||||
? moduleName.slice(5)
|
||||
: moduleName;
|
||||
|
||||
if (throwOnRequire.has(normalizedName)) {
|
||||
throw new Error(`Cannot find module '${moduleName}'`);
|
||||
}
|
||||
|
||||
if (shimRegistry[moduleName]) {
|
||||
return shimRegistry[moduleName];
|
||||
if (shimRegistry[normalizedName]) {
|
||||
return shimRegistry[normalizedName];
|
||||
}
|
||||
|
||||
console.warn("[ignis] Unshimmed require:", moduleName);
|
||||
|
||||
Reference in New Issue
Block a user