diff --git a/haxelib.json b/haxelib.json new file mode 100644 index 0000000..fe4cd5d --- /dev/null +++ b/haxelib.json @@ -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" +} \ No newline at end of file diff --git a/src/kiss_firefox/API.hx b/src/kiss_firefox/API.hx new file mode 100644 index 0000000..e60a43b --- /dev/null +++ b/src/kiss_firefox/API.hx @@ -0,0 +1,7 @@ +package kiss_firefox; + +@:native("") +extern class API { + @:native("browser") + static var browser:webextension_polyfill.Browser; +} \ No newline at end of file diff --git a/template/.gitignore b/template/.gitignore index bdf1172..3914005 100644 --- a/template/.gitignore +++ b/template/.gitignore @@ -1,2 +1,4 @@ bin/ +libs/ +node_modules/ *.zip \ No newline at end of file diff --git a/template/build.hxml b/template/build.hxml index 6c934ea..8621660 100644 --- a/template/build.hxml +++ b/template/build.hxml @@ -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/\* \ No newline at end of file +-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 \ No newline at end of file diff --git a/template/manifest.json b/template/manifest.json index d00fecd..d341033 100644 --- a/template/manifest.json +++ b/template/manifest.json @@ -13,7 +13,7 @@ "content_scripts": [ { "matches": [], - "js": ["bin/main.js"] + "js": ["bin/browser-polyfill.js", "bin/main.js"] } ] } diff --git a/template/package.json b/template/package.json index df4e86f..a67e4df 100644 --- a/template/package.json +++ b/template/package.json @@ -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" diff --git a/template/src/template/Main_.kiss b/template/src/template/Main_.kiss index eac1a75..e17e983 100644 --- a/template/src/template/Main_.kiss +++ b/template/src/template/Main_.kiss @@ -1 +1,2 @@ +(import kiss_firefox.API) (set js.Lib.global.document.body.style.border "5px solid red") \ No newline at end of file