using parcel for js bundling. it works!

This commit is contained in:
Ryan Breen
2023-01-12 22:17:01 -05:00
parent 210e61c35b
commit e4dc8870eb
7 changed files with 2678 additions and 3 deletions

View File

@@ -0,0 +1,4 @@
node_modules/
*.build.js*
.parcel-cache/
dist/

View File

@@ -1,4 +1,7 @@
import { generatePrivateKey } from "nostr-tools";
browser.runtime.onMessage.addListener((request, sender, sendResponse) => {
console.log(generatePrivateKey());
console.log("Received request: ", request);
if (request.greeting === "hello")

View File

@@ -15,11 +15,11 @@
},
"background": {
"service_worker": "background.js"
"service_worker": "dist/background.js"
},
"content_scripts": [{
"js": [ "content.js" ],
"js": [ "dist/content.js" ],
"matches": [ "<all_urls>" ]
}],
@@ -39,7 +39,7 @@
"web_accessible_resources": [
{
"resources": ["nostr.js"],
"resources": ["dist/nostr.js"],
"matches": ["<all_urls>"]
}
]

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,22 @@
{
"name": "nostore",
"version": "1.0.0",
"description": "",
"source": [
"background.js",
"content.js",
"nostr.js",
"popup.js"
],
"scripts": {
"build": "parcel build",
"watch": "parcel watch",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"nostr-tools": "^1.1.1",
"parcel": "^2.8.2"
}
}

View File

@@ -2,6 +2,8 @@ async function savePrivateKey(event) {
event.preventDefault();
let privKey = document.getElementById('priv-key');
browser.storage.local.set({ "priv-key": privKey.value });
console.log('setting private key');
await browser.runtime.sendMessage({greeting: 'hello'});
}
async function getPrivateKey() {