aboutsummaryrefslogtreecommitdiffstats
path: root/config/webpack
diff options
context:
space:
mode:
authorArpit Chakladar <arpitchakladar+git@gmail.com>2026-07-13 20:56:46 +0530
committerArpit Chakladar <arpitchakladar+git@gmail.com>2026-07-13 21:01:07 +0530
commit20c3b38f24d79df8843f17985a7d13533d4e0d10 (patch)
tree4fd85847db3976ffc64f3be012455d61624ace43 /config/webpack
parent6f6c263a072c9df4e826d8ebb2035c82a87be7e0 (diff)
downloadbanglar-bhumi-utils-20c3b38f24d79df8843f17985a7d13533d4e0d10.tar.gz
banglar-bhumi-utils-20c3b38f24d79df8843f17985a7d13533d4e0d10.zip
refactor: some minor refactoring to config files
Diffstat (limited to 'config/webpack')
-rw-r--r--config/webpack/plugins/create-injected-shared-modules-webpack-plugin.js2
-rw-r--r--config/webpack/plugins/create-manifest-webpack-plugin/index.js2
-rw-r--r--config/webpack/plugins/create-rules-webpack-plugin.js2
-rw-r--r--config/webpack/plugins/inject-script-webpack-plugin.js2
-rw-r--r--config/webpack/utils/build-file.js2
-rw-r--r--config/webpack/utils/injected-code.js2
-rw-r--r--config/webpack/utils/inline-javascript.js4
-rw-r--r--config/webpack/utils/script-runtime.js2
8 files changed, 10 insertions, 8 deletions
diff --git a/config/webpack/plugins/create-injected-shared-modules-webpack-plugin.js b/config/webpack/plugins/create-injected-shared-modules-webpack-plugin.js
index 6201a01..21cff34 100644
--- a/config/webpack/plugins/create-injected-shared-modules-webpack-plugin.js
+++ b/config/webpack/plugins/create-injected-shared-modules-webpack-plugin.js
@@ -28,7 +28,7 @@ class CreateInjectedSharedModulesPlugin {
name: "CreateInjectedSharedModulesPlugin",
stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL
},
- assets => {
+ (_assets) => {
const injectedSharedScripts = this.sortedSharedModules
.filter(sharedModule => this.injectedSharedModulesImportedCount[sharedModule] > 0)
.map(sharedModule => `shared/${getFileName(sharedModule, "shared")}.js`);
diff --git a/config/webpack/plugins/create-manifest-webpack-plugin/index.js b/config/webpack/plugins/create-manifest-webpack-plugin/index.js
index f012f1e..7328d5d 100644
--- a/config/webpack/plugins/create-manifest-webpack-plugin/index.js
+++ b/config/webpack/plugins/create-manifest-webpack-plugin/index.js
@@ -38,7 +38,7 @@ class CreateManifestPlugin {
* @param {import("webpack").Compiler} compiler
*/
apply(compiler) {
- compiler.hooks.compilation.tap("CreateManifestPlugin", compilation => {
+ compiler.hooks.compilation.tap("CreateManifestPlugin", (compilation) => {
compilation.hooks.processAssets.tap(
{
name: "CreateManifestPlugin",
diff --git a/config/webpack/plugins/create-rules-webpack-plugin.js b/config/webpack/plugins/create-rules-webpack-plugin.js
index 55b60f7..993ac31 100644
--- a/config/webpack/plugins/create-rules-webpack-plugin.js
+++ b/config/webpack/plugins/create-rules-webpack-plugin.js
@@ -18,7 +18,7 @@ class CreateRulesPlugin {
name: "CreateRulesPlugin",
stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL
},
- assets => {
+ (_assets) => {
const ruleFileNames = fs.readdirSync(path.resolve(SOURCE_DIR, "rules"));
const rules = [];
let ruleId = 1;
diff --git a/config/webpack/plugins/inject-script-webpack-plugin.js b/config/webpack/plugins/inject-script-webpack-plugin.js
index 43c5d9f..4f76ca8 100644
--- a/config/webpack/plugins/inject-script-webpack-plugin.js
+++ b/config/webpack/plugins/inject-script-webpack-plugin.js
@@ -22,7 +22,7 @@ class InjectScriptPlugin {
stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL,
additionalAssets: true
},
- async assets => {
+ async (assets) => {
for (const assetName in assets) {
if (/\.js$/.test(assetName)) {
const injectedCodeResponse = getInjectedCode(compilation.getAsset(assetName).source.source())
diff --git a/config/webpack/utils/build-file.js b/config/webpack/utils/build-file.js
index 17f0b03..e09747d 100644
--- a/config/webpack/utils/build-file.js
+++ b/config/webpack/utils/build-file.js
@@ -10,7 +10,7 @@ import crypto from "crypto";
* @param {boolean} justHash - When true, always return only the hash part.
* @returns {string} The transformed filename.
*/
-export const getFileName = (fileName, prefix, justHash = false) => {
+export function getFileName(fileName, prefix, justHash = false) {
let hash = crypto
.createHash("md5")
.update(`${prefix}-${fileName}`)
diff --git a/config/webpack/utils/injected-code.js b/config/webpack/utils/injected-code.js
index 2b8f750..f91fd4a 100644
--- a/config/webpack/utils/injected-code.js
+++ b/config/webpack/utils/injected-code.js
@@ -23,7 +23,7 @@ const getHash = url =>
* @param {string} code - The compiled JavaScript bundle.
* @returns {[string, string]} A tuple of [transformedCode, extensionAssetsJSON].
*/
-export const getInjectedCode = code => {
+export function getInjectedCode(code) {
const extensionAssets = {};
let i = 0;
diff --git a/config/webpack/utils/inline-javascript.js b/config/webpack/utils/inline-javascript.js
index 205bda4..501f852 100644
--- a/config/webpack/utils/inline-javascript.js
+++ b/config/webpack/utils/inline-javascript.js
@@ -5,4 +5,6 @@
* @param {string} code - The JavaScript source to inline.
* @returns {string} A `data:text/javascript;base64,…` URI.
*/
-export const inlineJavascript = code => `data:text/javascript;base64,${Buffer.from(code).toString("base64")}`;
+export function inlineJavascript(code) {
+ return `data:text/javascript;base64,${Buffer.from(code).toString("base64")}`;
+}
diff --git a/config/webpack/utils/script-runtime.js b/config/webpack/utils/script-runtime.js
index 1c23922..2745d54 100644
--- a/config/webpack/utils/script-runtime.js
+++ b/config/webpack/utils/script-runtime.js
@@ -9,7 +9,7 @@
* @param {string} scriptType - The script type from scripts.json.
* @returns {string} The corresponding `run_at` value.
*/
-export const getScriptRuntimeFromType = scriptType => {
+export function getScriptRuntimeFromType(scriptType) {
switch (scriptType) {
case "before":
case "injected-after":