Compare commits
3 Commits
4dd54a4f8b
...
cba2a126ae
Author | SHA1 | Date |
---|---|---|
Derrick Hammer | cba2a126ae | |
Derrick Hammer | 6f5e0765d6 | |
Derrick Hammer | 6cc15997f8 |
4
build.js
4
build.js
|
@ -3,12 +3,12 @@ import esbuild from "esbuild";
|
||||||
esbuild.buildSync({
|
esbuild.buildSync({
|
||||||
entryPoints: ["src/index.ts"],
|
entryPoints: ["src/index.ts"],
|
||||||
outfile: "dist/index.js",
|
outfile: "dist/index.js",
|
||||||
format: "esm",
|
format: "iife",
|
||||||
bundle: true,
|
bundle: true,
|
||||||
legalComments: "external",
|
legalComments: "external",
|
||||||
// minify: true
|
// minify: true
|
||||||
define: {
|
define: {
|
||||||
global: "self",
|
global: "self",
|
||||||
},
|
},
|
||||||
inject:['timers.js']
|
inject: ["timers.js", "polyfill.js"],
|
||||||
});
|
});
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
"@libp2p/utils": "^3.0.6",
|
"@libp2p/utils": "^3.0.6",
|
||||||
"@lumeweb/kernel-swarm-client": "git+https://git.lumeweb.com/LumeWeb/kernel-swarm-client.git",
|
"@lumeweb/kernel-swarm-client": "git+https://git.lumeweb.com/LumeWeb/kernel-swarm-client.git",
|
||||||
"@multiformats/mafmt": "^11.1.2",
|
"@multiformats/mafmt": "^11.1.2",
|
||||||
|
"@peculiar/webcrypto": "git+https://git.lumeweb.com/LumeWeb/webcrypto.git",
|
||||||
"b4a": "^1.6.3",
|
"b4a": "^1.6.3",
|
||||||
"blockstore-idb": "^1.1.0",
|
"blockstore-idb": "^1.1.0",
|
||||||
"buffer": "^6.0.3",
|
"buffer": "^6.0.3",
|
||||||
|
@ -72,6 +73,7 @@
|
||||||
"@types/streamx": "^2.9.1",
|
"@types/streamx": "^2.9.1",
|
||||||
"@types/ws": "^8.5.4",
|
"@types/ws": "^8.5.4",
|
||||||
"cli-progress": "^3.12.0",
|
"cli-progress": "^3.12.0",
|
||||||
|
"crypto-browserify": "^3.12.0",
|
||||||
"esbuild": "^0.14.54",
|
"esbuild": "^0.14.54",
|
||||||
"http-browserify": "^1.7.0",
|
"http-browserify": "^1.7.0",
|
||||||
"hyperswarm": "^4.4.0",
|
"hyperswarm": "^4.4.0",
|
||||||
|
@ -98,6 +100,8 @@
|
||||||
"timers": "timers-browserify",
|
"timers": "timers-browserify",
|
||||||
"path": "path-browserify",
|
"path": "path-browserify",
|
||||||
"os": "os-browserify",
|
"os": "os-browserify",
|
||||||
"net": "./src/net.ts"
|
"net": "./src/net.ts",
|
||||||
|
"crypto": "crypto-browserify",
|
||||||
|
"stream": "stream-browserify"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
import { Crypto } from "@peculiar/webcrypto";
|
||||||
|
import { Buffer } from "buffer";
|
||||||
|
|
||||||
|
let globalCrypto = self.crypto;
|
||||||
|
if (!globalCrypto.subtle) {
|
||||||
|
let subtleCrypto = new Crypto().subtle;
|
||||||
|
Object.defineProperty(globalCrypto, "subtle", {
|
||||||
|
get() {
|
||||||
|
return subtleCrypto;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
export { Buffer };
|
Loading…
Reference in New Issue