diff --git a/src/allPages.ts b/src/allPages.ts index 1e3a352..0538e80 100644 --- a/src/allPages.ts +++ b/src/allPages.ts @@ -1,46 +1,68 @@ +import { HomePage } from "./pages/Home"; +import { KeyValueDeletePage } from "./pages/KeyValue/KeyValueDelete"; +import { KeyValueNewPage } from "./pages/KeyValue/KeyValueNew"; +import { KeyValueSecretEditPage } from "./pages/KeyValue/KeyValueSecretsEdit"; +import { KeyValueSecretPage } from "./pages/KeyValue/KeyValueSecret"; +import { KeyValueVersionsPage } from "./pages/KeyValue/KeyValueVersions"; +import { KeyValueViewPage } from "./pages/KeyValue/KeyValueView"; +import { LoginPage } from "./pages/Login"; +import { MePage } from "./pages/Me"; +import { NewKVEnginePage } from "./pages/NewEngines/NewKVEngine"; +import { NewSecretsEnginePage } from "./pages/NewSecretsEngine"; +import { NewTOTPEnginePage } from "./pages/NewEngines/NewTOTPEngine"; +import { NewTOTPPage } from "./pages/TOTP/NewTOTP"; +import { NewTransitEnginePage } from "./pages/NewEngines/NewTransitEngine"; +import { NewTransitKeyPage } from "./pages/Transit/NewTransitKey"; import { Page } from "./types/Page"; +import { PwGenPage } from "./pages/PwGen"; +import { SetLanguagePage } from "./pages/SetLanguage"; +import { SetVaultURLPage } from "./pages/SetVaultURL"; +import { TOTPViewPage } from "./pages/TOTP/TOTPView"; +import { TransitDecryptPage } from "./pages/Transit/TransitDecrypt"; +import { TransitEncryptPage } from "./pages/Transit/TransitEncrypt"; +import { TransitRewrapPage } from "./pages/Transit/TransitRewrap"; +import { TransitViewPage } from "./pages/Transit/TransitView"; +import { TransitViewSecretPage } from "./pages/Transit/TransitViewSecret"; +import { UnsealPage } from "./pages/Unseal"; import { getObjectKeys } from "./utils"; /* eslint-disable */ import { PageType } from "z-pagerouter"; /* eslint-enable */ -type importType = Promise<{ - default: { new (...args: unknown[]): Page }; -}>; - type pagesList = { - [key: string]: importType; + [key: string]: Page; }; export const allPages: pagesList = { - HOME: import("./pages/Home"), - ME: import("./pages/Me"), - TOTP: import("./pages/TOTP/TOTPView"), - NEW_TOTP: import("./pages/TOTP/NewTOTP"), - LOGIN: import("./pages/Login"), - SET_VAULT_URL: import("./pages/SetVaultURL"), - UNSEAL: import("./pages/Unseal"), - SET_LANGUAGE: import("./pages/SetLanguage"), - TRANSIT_NEW_KEY: import("./pages/Transit/NewTransitKey"), - TRANSIT_VIEW: import("./pages/Transit/TransitView"), - TRANSIT_VIEW_SECRET: import("./pages/Transit/TransitViewSecret"), - TRANSIT_ENCRYPT: import("./pages/Transit/TransitEncrypt"), - TRANSIT_DECRYPT: import("./pages/Transit/TransitDecrypt"), - TRANSIT_REWRAP: import("./pages/Transit/TransitRewrap"), - KEY_VALUE_VIEW: import("./pages/KeyValue/KeyValueView"), - KEY_VALUE_SECRET: import("./pages/KeyValue/KeyValueSecret"), - KEY_VALUE_VERSIONS: import("./pages/KeyValue/KeyValueVersions"), - KEY_VALUE_NEW_SECRET: import("./pages/KeyValue/KeyValueNew"), - KEY_VALUE_DELETE: import("./pages/KeyValue/KeyValueDelete"), - KEY_VALUE_SECRET_EDIT: import("./pages/KeyValue/KeyValueSecretsEdit"), - PW_GEN: import("./pages/PwGen"), - NEW_SECRETS_ENGINE: import("./pages/NewSecretsEngine"), - NEW_KV_ENGINE: import("./pages/NewEngines/NewKVEngine"), - NEW_TOTP_ENGINE: import("./pages/NewEngines/NewTOTPEngine"), - NEW_TRANSIT_ENGINE: import("./pages/NewEngines/NewTransitEngine"), + HOME: new HomePage(), + ME: new MePage(), + TOTP: new TOTPViewPage(), + NEW_TOTP: new NewTOTPPage(), + LOGIN: new LoginPage(), + SET_VAULT_URL: new SetVaultURLPage(), + UNSEAL: new UnsealPage(), + SET_LANGUAGE: new SetLanguagePage(), + TRANSIT_NEW_KEY: new NewTransitKeyPage(), + TRANSIT_VIEW: new TransitViewPage(), + TRANSIT_VIEW_SECRET: new TransitViewSecretPage(), + TRANSIT_ENCRYPT: new TransitEncryptPage(), + TRANSIT_DECRYPT: new TransitDecryptPage(), + TRANSIT_REWRAP: new TransitRewrapPage(), + KEY_VALUE_VIEW: new KeyValueViewPage(), + KEY_VALUE_SECRET: new KeyValueSecretPage(), + KEY_VALUE_VERSIONS: new KeyValueVersionsPage(), + KEY_VALUE_NEW_SECRET: new KeyValueNewPage(), + KEY_VALUE_DELETE: new KeyValueDeletePage(), + KEY_VALUE_SECRET_EDIT: new KeyValueSecretEditPage(), + PW_GEN: new PwGenPage(), + NEW_SECRETS_ENGINE: new NewSecretsEnginePage(), + NEW_KV_ENGINE: new NewKVEnginePage(), + NEW_TOTP_ENGINE: new NewTOTPEnginePage(), + NEW_TRANSIT_ENGINE: new NewTransitEnginePage(), }; + // This should implement all o PageListType class PageList { constructor(pages: pagesList) { @@ -52,7 +74,7 @@ class PageList { return getObjectKeys(this.pages); } async getPage(pageID: string): Promise { - return new (await this.pages[pageID]).default(); + return this.pages[pageID]; } } diff --git a/src/pages/Home.ts b/src/pages/Home.ts index e28001d..b9edc6a 100644 --- a/src/pages/Home.ts +++ b/src/pages/Home.ts @@ -134,5 +134,3 @@ export class HomePage extends Page { return i18next.t("home_page_title"); } } - -export { HomePage as default }; diff --git a/src/pages/KeyValue/KeyValueDelete.ts b/src/pages/KeyValue/KeyValueDelete.ts index 381230f..1c34e10 100644 --- a/src/pages/KeyValue/KeyValueDelete.ts +++ b/src/pages/KeyValue/KeyValueDelete.ts @@ -55,5 +55,3 @@ export class KeyValueDeletePage extends Page { return i18next.t("kv_delete_title"); } } - -export { KeyValueDeletePage as default }; diff --git a/src/pages/KeyValue/KeyValueNew.ts b/src/pages/KeyValue/KeyValueNew.ts index e877107..93ecd41 100644 --- a/src/pages/KeyValue/KeyValueNew.ts +++ b/src/pages/KeyValue/KeyValueNew.ts @@ -90,4 +90,3 @@ export class KeyValueNewPage extends Page { return i18next.t("kv_new_title"); } } -export { KeyValueNewPage as default }; diff --git a/src/pages/KeyValue/KeyValueSecret.ts b/src/pages/KeyValue/KeyValueSecret.ts index e2c4f78..e19024a 100644 --- a/src/pages/KeyValue/KeyValueSecret.ts +++ b/src/pages/KeyValue/KeyValueSecret.ts @@ -186,5 +186,3 @@ export class KeyValueSecretPage extends Page { return i18next.t("kv_secret_title"); } } - -export { KeyValueSecretPage as default }; diff --git a/src/pages/KeyValue/KeyValueSecretsEdit.ts b/src/pages/KeyValue/KeyValueSecretsEdit.ts index 3baf5de..52e8b5f 100644 --- a/src/pages/KeyValue/KeyValueSecretsEdit.ts +++ b/src/pages/KeyValue/KeyValueSecretsEdit.ts @@ -87,4 +87,3 @@ export class KeyValueSecretEditPage extends Page { return i18next.t("kv_sec_edit_title"); } } -export { KeyValueSecretEditPage as default }; diff --git a/src/pages/KeyValue/KeyValueVersions.ts b/src/pages/KeyValue/KeyValueVersions.ts index 3500ecf..bbd15de 100644 --- a/src/pages/KeyValue/KeyValueVersions.ts +++ b/src/pages/KeyValue/KeyValueVersions.ts @@ -54,5 +54,3 @@ export class KeyValueVersionsPage extends Page { return i18next.t("kv_sec_versions_title"); } } - -export { KeyValueVersionsPage as default }; diff --git a/src/pages/KeyValue/KeyValueView.ts b/src/pages/KeyValue/KeyValueView.ts index 5a77cc9..71f34ba 100644 --- a/src/pages/KeyValue/KeyValueView.ts +++ b/src/pages/KeyValue/KeyValueView.ts @@ -104,5 +104,3 @@ export class KeyValueViewPage extends Page { return i18next.t("kv_view_title"); } } - -export { KeyValueViewPage as default }; diff --git a/src/pages/Login.ts b/src/pages/Login.ts index 6dc7f1c..b588e85 100644 --- a/src/pages/Login.ts +++ b/src/pages/Login.ts @@ -174,5 +174,3 @@ export class LoginPage extends Page { return i18next.t("log_in_title"); } } - -export { LoginPage as default }; diff --git a/src/pages/Me.ts b/src/pages/Me.ts index d9f7b1c..b63e9ab 100644 --- a/src/pages/Me.ts +++ b/src/pages/Me.ts @@ -98,5 +98,3 @@ export class MePage extends Page { return i18next.t("me_page_title"); } } - -export { MePage as default }; diff --git a/src/pages/NewEngines/NewKVEngine.ts b/src/pages/NewEngines/NewKVEngine.ts index be30aed..306c6dc 100644 --- a/src/pages/NewEngines/NewKVEngine.ts +++ b/src/pages/NewEngines/NewKVEngine.ts @@ -85,5 +85,3 @@ export class NewKVEnginePage extends Page { return i18next.t("new_kv_engine_title"); } } - -export { NewKVEnginePage as default }; diff --git a/src/pages/NewEngines/NewTOTPEngine.ts b/src/pages/NewEngines/NewTOTPEngine.ts index 1c5ec7d..382064d 100644 --- a/src/pages/NewEngines/NewTOTPEngine.ts +++ b/src/pages/NewEngines/NewTOTPEngine.ts @@ -67,5 +67,3 @@ export class NewTOTPEnginePage extends Page { return i18next.t("new_totp_engine_title"); } } - -export { NewTOTPEnginePage as default }; diff --git a/src/pages/NewEngines/NewTransitEngine.ts b/src/pages/NewEngines/NewTransitEngine.ts index de72b62..0566932 100644 --- a/src/pages/NewEngines/NewTransitEngine.ts +++ b/src/pages/NewEngines/NewTransitEngine.ts @@ -67,5 +67,3 @@ export class NewTransitEnginePage extends Page { return i18next.t("new_transit_engine_title"); } } - -export { NewTransitEnginePage as default }; diff --git a/src/pages/NewSecretsEngine.ts b/src/pages/NewSecretsEngine.ts index 57171e7..cc0776f 100644 --- a/src/pages/NewSecretsEngine.ts +++ b/src/pages/NewSecretsEngine.ts @@ -45,5 +45,3 @@ export class NewSecretsEnginePage extends Page { return i18next.t("new_secrets_engine_title"); } } - -export { NewSecretsEnginePage as default }; diff --git a/src/pages/PwGen.ts b/src/pages/PwGen.ts index c9483fe..b72e48f 100644 --- a/src/pages/PwGen.ts +++ b/src/pages/PwGen.ts @@ -146,5 +146,3 @@ export class PwGenPage extends Page { return i18next.t("password_generator_title"); } } - -export { PwGenPage as default }; diff --git a/src/pages/SetLanguage.ts b/src/pages/SetLanguage.ts index 6441cac..7d5d0ef 100644 --- a/src/pages/SetLanguage.ts +++ b/src/pages/SetLanguage.ts @@ -67,5 +67,3 @@ export class SetLanguagePage extends Page { return i18next.t("set_language_title"); } } - -export { SetLanguagePage as default }; diff --git a/src/pages/SetVaultURL.ts b/src/pages/SetVaultURL.ts index bf44e36..e4d8d83 100644 --- a/src/pages/SetVaultURL.ts +++ b/src/pages/SetVaultURL.ts @@ -52,5 +52,3 @@ export class SetVaultURLPage extends Page { return "Set Vault URL"; } } - -export { SetVaultURLPage as default }; diff --git a/src/pages/TOTP/NewTOTP.ts b/src/pages/TOTP/NewTOTP.ts index 0351f79..17623b9 100644 --- a/src/pages/TOTP/NewTOTP.ts +++ b/src/pages/TOTP/NewTOTP.ts @@ -114,5 +114,3 @@ export class NewTOTPPage extends Page { return i18next.t("totp_new_title"); } } - -export { NewTOTPPage as default }; diff --git a/src/pages/TOTP/TOTPView.ts b/src/pages/TOTP/TOTPView.ts index 9739314..7ec65ae 100644 --- a/src/pages/TOTP/TOTPView.ts +++ b/src/pages/TOTP/TOTPView.ts @@ -113,5 +113,3 @@ export class TOTPViewPage extends Page { return i18next.t("totp_view_title"); } } - -export { TOTPViewPage as default }; diff --git a/src/pages/Transit/NewTransitKey.ts b/src/pages/Transit/NewTransitKey.ts index d88e6be..362a4fc 100644 --- a/src/pages/Transit/NewTransitKey.ts +++ b/src/pages/Transit/NewTransitKey.ts @@ -95,5 +95,3 @@ export class NewTransitKeyPage extends Page { return i18next.t("transit_new_key_title"); } } - -export { NewTransitKeyPage as default }; diff --git a/src/pages/Transit/TransitDecrypt.ts b/src/pages/Transit/TransitDecrypt.ts index 1ded3e3..b2c53c2 100644 --- a/src/pages/Transit/TransitDecrypt.ts +++ b/src/pages/Transit/TransitDecrypt.ts @@ -122,5 +122,3 @@ export class TransitDecryptPage extends Page { return i18next.t("transit_decrypt_title"); } } - -export { TransitDecryptPage as default }; diff --git a/src/pages/Transit/TransitEncrypt.ts b/src/pages/Transit/TransitEncrypt.ts index cd45dc9..3f02c1e 100644 --- a/src/pages/Transit/TransitEncrypt.ts +++ b/src/pages/Transit/TransitEncrypt.ts @@ -120,5 +120,3 @@ export class TransitEncryptPage extends Page { return i18next.t("transit_encrypt_title"); } } - -export { TransitEncryptPage as default }; diff --git a/src/pages/Transit/TransitRewrap.ts b/src/pages/Transit/TransitRewrap.ts index 88f3efb..426e4a4 100644 --- a/src/pages/Transit/TransitRewrap.ts +++ b/src/pages/Transit/TransitRewrap.ts @@ -113,5 +113,3 @@ export class TransitRewrapPage extends Page { return i18next.t("transit_rewrap_title"); } } - -export { TransitRewrapPage as default }; diff --git a/src/pages/Transit/TransitView.ts b/src/pages/Transit/TransitView.ts index ad87d94..7450d46 100644 --- a/src/pages/Transit/TransitView.ts +++ b/src/pages/Transit/TransitView.ts @@ -78,5 +78,3 @@ export class TransitViewPage extends Page { return i18next.t("transit_view_title"); } } - -export { TransitViewPage as default }; diff --git a/src/pages/Transit/TransitViewSecret.ts b/src/pages/Transit/TransitViewSecret.ts index 3a1aea9..24dce71 100644 --- a/src/pages/Transit/TransitViewSecret.ts +++ b/src/pages/Transit/TransitViewSecret.ts @@ -66,5 +66,3 @@ export class TransitViewSecretPage extends Page { return i18next.t("transit_view_secret_title"); } } - -export { TransitViewSecretPage as default }; diff --git a/src/pages/Unseal.ts b/src/pages/Unseal.ts index bf9ff50..139f52e 100644 --- a/src/pages/Unseal.ts +++ b/src/pages/Unseal.ts @@ -192,5 +192,3 @@ export class UnsealPage extends Page { return i18next.t("unseal_vault_text"); } } - -export { UnsealPage as default }; diff --git a/tsconfig.json b/tsconfig.json index b19f4e0..1285d12 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,7 +3,7 @@ "outDir": "./dist/", "noImplicitAny": false, "allowSyntheticDefaultImports": true, - "module": "es2020", + "module": "es6", "target": "es2019", "strictBindCallApply": true, "noImplicitThis": true, diff --git a/webpack.config.js b/webpack.config.js index 6096886..3c04412 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -22,8 +22,7 @@ module.exports = { entry: './src/main.ts', output: { path: path.resolve(__dirname, 'dist'), - chunkFilename: '[name].js', - filename: '[name].[contenthash].js', + filename: 'bundle.js', }, stats: { preset: VERBOSE ? "detailed" : "normal", @@ -45,11 +44,7 @@ module.exports = { modules: ['node_modules'], extensions: ['.tsx', '.ts', '.js', ".mjs"], }, - optimization: { - splitChunks: { - chunks: 'all', - }, - }, + module: { rules: [ {