1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 08:43:33 +00:00

[PM-1072] Convert autofill.js to Typescript (#5376)

* Rename autofill.js to ts and update webpack

* Remove wrapping function

* Remove unreachable data-onepassword-title code

* Remove unused post-submit logic

* Run prettier

* Remove unused fake tested code

* Add typing

* Disable certain eslint rules or fix eslint violations

* Update modifications list

* Remove unnecessary/confusing types

* Checkout autofill.js from master

* Add ENV switch for autofill versions

* Rename autofill.ts to avoid confusion

* Use string union type for FillScriptOp
This commit is contained in:
Thomas Rittson
2023-05-18 13:35:13 -04:00
committed by GitHub
parent 3f7a63b2c6
commit 3577b7c100
4 changed files with 1423 additions and 7 deletions

View File

@@ -14,8 +14,10 @@ if (process.env.NODE_ENV == null) {
}
const ENV = (process.env.ENV = process.env.NODE_ENV);
const manifestVersion = process.env.MANIFEST_VERSION == 3 ? 3 : 2;
const autofillVersion = process.env.AUTOFILL_VERSION == 2 ? 2 : 1;
console.log(`Building Manifest Version ${manifestVersion} app`);
console.log(`Using Autofill v${autofillVersion}`);
const envConfig = configurator.load(ENV);
configurator.log(envConfig);
@@ -141,7 +143,6 @@ const mainConfig = {
entry: {
"popup/polyfills": "./src/popup/polyfills.ts",
"popup/main": "./src/popup/main.ts",
"content/autofill": "./src/autofill/content/autofill.js",
"content/autofiller": "./src/autofill/content/autofiller.ts",
"content/notificationBar": "./src/autofill/content/notification-bar.ts",
"content/contextMenuHandler": "./src/autofill/content/context-menu-handler.ts",
@@ -301,4 +302,12 @@ if (manifestVersion == 2) {
configs.push(backgroundConfig);
}
if (autofillVersion == 2) {
// Typescript refactors (WIP)
mainConfig.entry["content/autofill"] = "./src/autofill/content/autofillv2.ts";
} else {
// Javascript (used in production)
mainConfig.entry["content/autofill"] = "./src/autofill/content/autofill.js";
}
module.exports = configs;