add API polyfill to kiss-firefox

This commit is contained in:
2023-04-19 20:56:15 -06:00
parent 54fd3368fa
commit bfb601cc2d
7 changed files with 31 additions and 3 deletions

16
haxelib.json Normal file
View File

@@ -0,0 +1,16 @@
{
"name": "kiss-firefox",
"description": "Make Firefox extensions with Kisslang",
"classPath": "src/",
"dependencies": {
"kiss": ""
},
"url": "https://github.com/NQNStudios/kisslang",
"contributors": [
"NQNStudios"
],
"version": "0.0.0",
"releasenote": "",
"tags": [],
"license": "LGPL"
}

7
src/kiss_firefox/API.hx Normal file
View File

@@ -0,0 +1,7 @@
package kiss_firefox;
@:native("")
extern class API {
@:native("browser")
static var browser:webextension_polyfill.Browser;
}

2
template/.gitignore vendored
View File

@@ -1,2 +1,4 @@
bin/
libs/
node_modules/
*.zip

View File

@@ -1,7 +1,8 @@
-lib kiss
-lib kiss-firefox
-lib webextension-polyfill
-cp src
-dce full
--main template.Main
--js bin/main.js
-cmd zip -r template.zip . -x *.git* -x *.hxml -x *.zip -x src/\* -x node_modules/\*
-cmd cp node_modules/webextension-polyfill/dist/browser-polyfill.js* bin/ && zip -r template.zip . -x *.git* -x *.hxml -x *.zip -x src/\* -x node_modules/\* -x libs/\* -x test.sh

View File

@@ -13,7 +13,7 @@
"content_scripts": [
{
"matches": [],
"js": ["bin/main.js"]
"js": ["bin/browser-polyfill.js", "bin/main.js"]
}
]
}

View File

@@ -7,7 +7,8 @@
"postinstall": "dts2hx --all"
},
"dependencies": {
"@types/webextension-polyfill": "^0.10.0"
"@types/webextension-polyfill": "^0.10.0",
"webextension-polyfill": "^0.10.0"
},
"devDependencies": {
"dts2hx": "^0.19.0"

View File

@@ -1 +1,2 @@
(import kiss_firefox.API)
(set js.Lib.global.document.body.style.border "5px solid red")