aboutsummaryrefslogtreecommitdiffstats
path: root/config/webpack/plugins/create-manifest-webpack-plugin
diff options
context:
space:
mode:
authorArpit Chakladar <54011232+arpitchakladar@users.noreply.github.com>2025-06-13 20:11:35 +0000
committerGitHub <noreply@github.com>2025-06-13 20:11:35 +0000
commitca20de409d08ec5abe2d3275bb97cfc5e8c164b3 (patch)
treea13b48386e20bf69e7ede0bfff4715c17b90549d /config/webpack/plugins/create-manifest-webpack-plugin
parentcaa9c3f705730886cab911cb241703a10494581c (diff)
parent54467df36805eabf9113d1bb84d7434b331cd167 (diff)
downloadbanglar-bhumi-utils-ca20de409d08ec5abe2d3275bb97cfc5e8c164b3.tar.gz
banglar-bhumi-utils-ca20de409d08ec5abe2d3275bb97cfc5e8c164b3.zip
Merge pull request #2 from arpitchakladar/dev/porting-to-firefox
Dev/implementing OCR for captcha autofill
Diffstat (limited to 'config/webpack/plugins/create-manifest-webpack-plugin')
-rw-r--r--config/webpack/plugins/create-manifest-webpack-plugin/index.js28
-rw-r--r--config/webpack/plugins/create-manifest-webpack-plugin/manifest-template.json5
2 files changed, 22 insertions, 11 deletions
diff --git a/config/webpack/plugins/create-manifest-webpack-plugin/index.js b/config/webpack/plugins/create-manifest-webpack-plugin/index.js
index 8dc0ae4..6f1e2be 100644
--- a/config/webpack/plugins/create-manifest-webpack-plugin/index.js
+++ b/config/webpack/plugins/create-manifest-webpack-plugin/index.js
@@ -1,10 +1,15 @@
-const { sources } = require("webpack");
-const path = require("path");
-
-const { getScriptRuntimeFromType } = webpackRequire("utils/script-runtime");
-const { getFileName } = webpackRequire("utils/build-file");
-const scripts = webpackRequire("utils/scripts");
-const manifest = webpackRequire("plugins/create-manifest-webpack-plugin/manifest-template.json");
+import webpack from "webpack";
+import path from "path";
+import fs from "fs";
+
+import { getScriptRuntimeFromType } from "../../utils/script-runtime.js";
+import { getFileName } from "../../utils/build-file.js";
+import scripts from "../../utils/scripts.js";
+const manifest = JSON.parse(
+ fs.readFileSync(
+ path.resolve("config/webpack/plugins/create-manifest-webpack-plugin/manifest-template.json"),
+ ),
+);
class CreateManifestPlugin {
constructor({ sharedModulesImportedCount, injectedSharedModulesImportedCount, sortedSharedModules }) {
@@ -21,7 +26,7 @@ class CreateManifestPlugin {
stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL
},
assets => {
- manifest.version = require(path.resolve(ROOT_DIR, "package.json")).version;
+ manifest.version = JSON.parse(fs.readFileSync((path.resolve(ROOT_DIR, "package.json")))).version;
manifest.content_scripts = [];
let resources = [];
@@ -97,9 +102,11 @@ class CreateManifestPlugin {
];
}
+ manifest.background = { service_worker: "background.js" };
+
compilation.emitAsset(
"manifest.json",
- new sources.RawSource(
+ new webpack.sources.RawSource(
JSON.stringify(
manifest,
undefined,
@@ -115,4 +122,5 @@ class CreateManifestPlugin {
}
}
-module.exports = CreateManifestPlugin;
+export default CreateManifestPlugin;
+
diff --git a/config/webpack/plugins/create-manifest-webpack-plugin/manifest-template.json b/config/webpack/plugins/create-manifest-webpack-plugin/manifest-template.json
index d1d29f4..52496b6 100644
--- a/config/webpack/plugins/create-manifest-webpack-plugin/manifest-template.json
+++ b/config/webpack/plugins/create-manifest-webpack-plugin/manifest-template.json
@@ -1,7 +1,7 @@
{
"manifest_version": 3,
"name": "Banglar Bhumi Utils",
- "permissions": ["scripting", "declarativeNetRequest"],
+ "permissions": ["offscreen", "scripting", "declarativeNetRequest"],
"description": "A chrome extension to improve functionality of the banglarbhumi.gov.in website.",
"icons": {
"512": "icon512.png"
@@ -12,5 +12,8 @@
"enabled": true,
"path": "rules.json"
}]
+ },
+ "content_security_policy": {
+ "extension_pages": "script-src 'self' 'wasm-unsafe-eval'; object-src 'self';"
}
}