aboutsummaryrefslogtreecommitdiffstats
path: root/config/webpack/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'config/webpack/plugins')
-rw-r--r--config/webpack/plugins/create-injected-shared-modules-webpack-plugin.js9
-rw-r--r--config/webpack/plugins/create-manifest-webpack-plugin/index.js26
-rw-r--r--config/webpack/plugins/create-rules-webpack-plugin.js5
-rw-r--r--config/webpack/plugins/inject-script-webpack-plugin.js9
4 files changed, 27 insertions, 22 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 21cff34..6cd8523 100644
--- a/config/webpack/plugins/create-injected-shared-modules-webpack-plugin.js
+++ b/config/webpack/plugins/create-injected-shared-modules-webpack-plugin.js
@@ -1,4 +1,5 @@
import path from "path";
+
import webpack from "webpack";
import { getFileName } from "../utils/build-file.js";
@@ -22,7 +23,7 @@ class CreateInjectedSharedModulesPlugin {
* @param {import("webpack").Compiler} compiler
*/
apply(compiler) {
- compiler.hooks.compilation.tap("CreateInjectedSharedModulesPlugin", compilation => {
+ compiler.hooks.compilation.tap("CreateInjectedSharedModulesPlugin", (compilation) => {
compilation.hooks.processAssets.tap(
{
name: "CreateInjectedSharedModulesPlugin",
@@ -30,13 +31,13 @@ class CreateInjectedSharedModulesPlugin {
},
(_assets) => {
const injectedSharedScripts = this.sortedSharedModules
- .filter(sharedModule => this.injectedSharedModulesImportedCount[sharedModule] > 0)
- .map(sharedModule => `shared/${getFileName(sharedModule, "shared")}.js`);
+ .filter((sharedModule) => this.injectedSharedModulesImportedCount[sharedModule] > 0)
+ .map((sharedModule) => `shared/${getFileName(sharedModule, "shared")}.js`);
if (injectedSharedScripts.length > 0) {
const scriptInjectorModuleName = getFileName("script-injector", "shared", true);
const injectionCode = injectedSharedScripts
- .map(injectedScript => `$${scriptInjectorModuleName}.injectScriptHead("shared/${path.basename(injectedScript)}");`)
+ .map((injectedScript) => `$${scriptInjectorModuleName}.injectScriptHead("shared/${path.basename(injectedScript)}");`)
.join("");
compilation.emitAsset(
`shared/${getFileName("injected-shared-modules", "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 7328d5d..f5a4963 100644
--- a/config/webpack/plugins/create-manifest-webpack-plugin/index.js
+++ b/config/webpack/plugins/create-manifest-webpack-plugin/index.js
@@ -1,14 +1,16 @@
-import webpack from "webpack";
-import path from "path";
import fs from "fs";
+import path from "path";
+
+import webpack from "webpack";
-import { getScriptRuntimeFromType } from "../../utils/script-runtime.js";
import { getFileName } from "../../utils/build-file.js";
+import { getScriptRuntimeFromType } from "../../utils/script-runtime.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"),
- ),
+ path.resolve("config/webpack/plugins/create-manifest-webpack-plugin/manifest-template.json")
+ )
);
/**
@@ -44,7 +46,7 @@ class CreateManifestPlugin {
name: "CreateManifestPlugin",
stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL
},
- assets => {
+ (assets) => {
manifest.version = JSON.parse(fs.readFileSync((path.resolve(ROOT_DIR, "package.json")))).version;
manifest.content_scripts = [];
let resources = [];
@@ -69,12 +71,12 @@ class CreateManifestPlugin {
}
manifest.content_scripts.push({
- matches: [`*://banglarbhumi.gov.in/BanglarBhumi/*`],
+ matches: ["*://banglarbhumi.gov.in/BanglarBhumi/*"],
js: this.sortedSharedModules
- .filter(sharedModule => this.sharedModulesImportedCount[sharedModule] > 0)
- .map(sharedModule => `shared/${getFileName(sharedModule, "shared")}.js`)
+ .filter((sharedModule) => this.sharedModulesImportedCount[sharedModule] > 0)
+ .map((sharedModule) => `shared/${getFileName(sharedModule, "shared")}.js`)
.concat(arrangedScripts["*"]["document_start"])
- .filter(x => x != null),
+ .filter((x) => x != null),
run_at: "document_start"
});
@@ -102,8 +104,8 @@ class CreateManifestPlugin {
}
const injectedSharedModules = this.sortedSharedModules
- .filter(sharedModule => this.injectedSharedModulesImportedCount[sharedModule] > 0)
- .map(sharedModule => `shared/${getFileName(sharedModule, "shared")}.js`);
+ .filter((sharedModule) => this.injectedSharedModulesImportedCount[sharedModule] > 0)
+ .map((sharedModule) => `shared/${getFileName(sharedModule, "shared")}.js`);
if (injectedSharedModules.length > 0) {
resources = resources.concat(injectedSharedModules);
diff --git a/config/webpack/plugins/create-rules-webpack-plugin.js b/config/webpack/plugins/create-rules-webpack-plugin.js
index 993ac31..10e5fdd 100644
--- a/config/webpack/plugins/create-rules-webpack-plugin.js
+++ b/config/webpack/plugins/create-rules-webpack-plugin.js
@@ -1,5 +1,6 @@
-import path from "path";
import fs from "fs";
+import path from "path";
+
import webpack from "webpack";
/**
@@ -12,7 +13,7 @@ class CreateRulesPlugin {
* @param {import("webpack").Compiler} compiler
*/
apply(compiler) {
- compiler.hooks.compilation.tap("CreateRulesPlugin", compilation => {
+ compiler.hooks.compilation.tap("CreateRulesPlugin", (compilation) => {
compilation.hooks.processAssets.tap(
{
name: "CreateRulesPlugin",
diff --git a/config/webpack/plugins/inject-script-webpack-plugin.js b/config/webpack/plugins/inject-script-webpack-plugin.js
index 4f76ca8..0a5d784 100644
--- a/config/webpack/plugins/inject-script-webpack-plugin.js
+++ b/config/webpack/plugins/inject-script-webpack-plugin.js
@@ -1,6 +1,7 @@
-import webpack from "webpack";
import path from "path";
+import webpack from "webpack";
+
import { getFileName } from "../utils/build-file.js";
import { getInjectedCode } from "../utils/injected-code.js";
@@ -15,17 +16,17 @@ class InjectScriptPlugin {
* @param {import("webpack").Compiler} compiler
*/
apply(compiler) {
- compiler.hooks.compilation.tap("InjectScriptPlugin", compilation => {
+ compiler.hooks.compilation.tap("InjectScriptPlugin", (compilation) => {
compilation.hooks.processAssets.tapPromise(
{
name: "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())
+ const injectedCodeResponse = getInjectedCode(compilation.getAsset(assetName).source.source());
const scriptInjectorModuleName = getFileName("script-injector", "shared", true);
compilation.updateAsset(
assetName,