From 8c8e9f44bed871d54442c45e6d4464ab41eb3f96 Mon Sep 17 00:00:00 2001 From: Joabesv Date: Wed, 14 Feb 2024 00:09:39 -0300 Subject: [PATCH 01/21] feat: autoImport components --- package.json | 1 + vite.config.js | 5 +++ yarn.lock | 100 ++++++++++++++++++++++++++++++++++++++++++++++--- 3 files changed, 100 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 1d85dec..74c237e 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,7 @@ "npm-run-all": "^4.1.5", "rimraf": "^5.0.5", "tsup": "^8.0.1", + "unplugin-vue-components": "^0.26.0", "vite": "^5.1.1" }, "dependencies": { diff --git a/vite.config.js b/vite.config.js index 79894e3..7098e91 100644 --- a/vite.config.js +++ b/vite.config.js @@ -2,6 +2,7 @@ import { resolve, dirname, relative } from "node:path"; import { fileURLToPath } from "node:url"; import { defineConfig } from "vite"; import Vue2 from "@vitejs/plugin-vue2"; +import Components from "unplugin-vue-components/vite"; const EsmDirname = dirname(fileURLToPath(import.meta.url)); @@ -37,6 +38,10 @@ export default defineConfig(({ command }) => { }, plugins: [ Vue2(), + Components({ + dirs: [resolvePath("src/components")], + dts: false, + }), { name: "assets-rewrite", enforce: "post", diff --git a/yarn.lock b/yarn.lock index a252751..557c45b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,6 +2,11 @@ # yarn lockfile v1 +"@antfu/utils@^0.7.6": + version "0.7.7" + resolved "https://registry.yarnpkg.com/@antfu/utils/-/utils-0.7.7.tgz#26ea493a831b4f3a85475e7157be02fb4eab51fb" + integrity sha512-gFPqTG7otEJ8uP6wrhDv6mqwGWYZKNvAcCq6u9hOj0c+IKCEsY4L1oC9trPq2SaWIzAfHvqfBDxF591JkMf+kg== + "@babel/parser@^7.18.4": version "7.23.9" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.23.9.tgz#7b903b6149b0f8fa7ad564af646c4c38a77fc44b" @@ -153,7 +158,7 @@ resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.1.2.tgz#7c6cf998d6d20b914c0a55a91ae928ff25965e72" integrity sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw== -"@jridgewell/sourcemap-codec@^1.4.10", "@jridgewell/sourcemap-codec@^1.4.14": +"@jridgewell/sourcemap-codec@^1.4.10", "@jridgewell/sourcemap-codec@^1.4.14", "@jridgewell/sourcemap-codec@^1.4.15": version "1.4.15" resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz#d7c6e6755c78567a951e04ab52ef0fd26de59f32" integrity sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg== @@ -192,6 +197,15 @@ resolved "https://registry.yarnpkg.com/@pkgjs/parseargs/-/parseargs-0.11.0.tgz#a77ea742fab25775145434eb1d2328cf5013ac33" integrity sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg== +"@rollup/pluginutils@^5.0.4": + version "5.1.0" + resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-5.1.0.tgz#7e53eddc8c7f483a4ad0b94afb1f7f5fd3c771e0" + integrity sha512-XTIWOPPcpvyKI6L1NHo0lFlCyznUEyPmPY1mc3KpPVDYulHSTvyeLNVW00QTLIAFNhR3kYnJTQHeGqU4M3n09g== + dependencies: + "@types/estree" "^1.0.0" + estree-walker "^2.0.2" + picomatch "^2.3.1" + "@rollup/rollup-android-arm-eabi@4.9.6": version "4.9.6" resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.9.6.tgz#66b8d9cb2b3a474d115500f9ebaf43e2126fe496" @@ -272,7 +286,7 @@ resolved "https://registry.yarnpkg.com/@types/configstore/-/configstore-4.0.0.tgz#cb718f9507e9ee73782f40d07aaca1cd747e36fa" integrity sha512-SvCBBPzOIe/3Tu7jTl2Q8NjITjLmq9m7obzjSyb8PXWWZ31xVK6w4T6v8fOx+lrgQnqk3Yxc00LDolFsSakKCA== -"@types/estree@1.0.5": +"@types/estree@1.0.5", "@types/estree@^1.0.0": version "1.0.5" resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.5.tgz#a6ce3e556e00fd9895dd872dd172ad0d4bd687f4" integrity sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw== @@ -460,6 +474,11 @@ accepts@~1.3.5, accepts@~1.3.8: mime-types "~2.1.34" negotiator "0.6.3" +acorn@^8.11.3: + version "8.11.3" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.11.3.tgz#71e0b14e13a4ec160724b38fb7b0f233b1b81d7a" + integrity sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg== + ajv@^6.12.3: version "6.12.6" resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" @@ -914,7 +933,7 @@ chardet@^0.7.0: resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.7.0.tgz#90094849f0937f2eedc2425d0d28a9e5f0cbad9e" integrity sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA== -chokidar@^3.5.1, chokidar@^3.6.0: +chokidar@^3.5.1, chokidar@^3.5.3, chokidar@^3.6.0: version "3.6.0" resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.6.0.tgz#197c6cc669ef2a8dc5e7b4d97ee4e092c3eb0d5b" integrity sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw== @@ -1279,7 +1298,7 @@ debug@2.6.9: dependencies: ms "2.0.0" -debug@^4.3.1: +debug@^4.3.1, debug@^4.3.4: version "4.3.4" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== @@ -1558,6 +1577,11 @@ esprima@^4.0.0: resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== +estree-walker@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-2.0.2.tgz#52f010178c2a4c117a7757cfe942adb7d2da4cac" + integrity sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w== + etag@~1.8.1: version "1.8.1" resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" @@ -1657,7 +1681,7 @@ fast-deep-equal@^3.1.1: resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== -fast-glob@^3.2.9: +fast-glob@^3.2.9, fast-glob@^3.3.1: version "3.3.2" resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.3.2.tgz#a904501e57cfdd2ffcded45e99a54fef55e46129" integrity sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow== @@ -2209,6 +2233,13 @@ is-ci@^1.0.10: dependencies: ci-info "^1.5.0" +is-core-module@^2.13.0: + version "2.13.1" + resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.13.1.tgz#ad0d7532c6fea9da1ebdc82742d74525c6273384" + integrity sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw== + dependencies: + hasown "^2.0.0" + is-core-module@^2.9.0: version "2.11.0" resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.11.0.tgz#ad4cb3e3863e814523c96f3f58d26cc570ff0144" @@ -2546,6 +2577,11 @@ loader-utils@^0.2.16: json5 "^0.5.0" object-assign "^4.0.1" +local-pkg@^0.4.3: + version "0.4.3" + resolved "https://registry.yarnpkg.com/local-pkg/-/local-pkg-0.4.3.tgz#0ff361ab3ae7f1c19113d9bb97b98b905dbc4963" + integrity sha512-SFppqq5p42fe2qcZQqqEOiVRXl+WCP1MdT6k7BDEW1j++sp5fIY+/fdRQitvKgB5BrBcmrs5m/L0v2FrU5MY1g== + lodash.memoize@^4.1.2: version "4.1.2" resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe" @@ -2591,6 +2627,13 @@ lru-cache@^4.0.0, lru-cache@^4.0.1: resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-10.2.0.tgz#0bd445ca57363465900f4d1f9bd8db343a4d95c3" integrity sha512-2bIM8x+VAf6JT4bKAljS1qUWgMsqZRPGJS6FSahIMPVvctcNhyVp7AJu7quxOW9jwkryBReKZY5tY5JYv2n/7Q== +magic-string@^0.30.3: + version "0.30.7" + resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.30.7.tgz#0cecd0527d473298679da95a2d7aeb8c64048505" + integrity sha512-8vBuFF/I/+OSLRmdf2wwFCJCz+nSn0m6DPvGH1fS/KiQoSaR+sETbov0eIk9KhEKy8CYqIkIAnbohxT/4H0kuA== + dependencies: + "@jridgewell/sourcemap-codec" "^1.4.15" + make-dir@^1.0.0: version "1.3.0" resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-1.3.0.tgz#79c1033b80515bd6d24ec9933e860ca75ee27f0c" @@ -2685,7 +2728,7 @@ minimatch@^3.0.4: dependencies: brace-expansion "^1.1.7" -minimatch@^9.0.1: +minimatch@^9.0.1, minimatch@^9.0.3: version "9.0.3" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.3.tgz#a6e00c3de44c3a542bfaae70abfc22420a6da825" integrity sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg== @@ -3594,6 +3637,15 @@ resolve@^1.1.7, resolve@^1.10.0: path-parse "^1.0.7" supports-preserve-symlinks-flag "^1.0.0" +resolve@^1.22.4: + version "1.22.8" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.8.tgz#b6c87a9f2aa06dfab52e3d70ac8cde321fa5a48d" + integrity sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw== + dependencies: + is-core-module "^2.13.0" + path-parse "^1.0.7" + supports-preserve-symlinks-flag "^1.0.0" + restore-cursor@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf" @@ -4306,6 +4358,32 @@ unpipe@1.0.0, unpipe@~1.0.0: resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec" integrity sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ== +unplugin-vue-components@^0.26.0: + version "0.26.0" + resolved "https://registry.yarnpkg.com/unplugin-vue-components/-/unplugin-vue-components-0.26.0.tgz#6d79caa770039a1eb3d7c09fdd28778ea20afef3" + integrity sha512-s7IdPDlnOvPamjunVxw8kNgKNK8A5KM1YpK5j/p97jEKTjlPNrA0nZBiSfAKKlK1gWZuyWXlKL5dk3EDw874LQ== + dependencies: + "@antfu/utils" "^0.7.6" + "@rollup/pluginutils" "^5.0.4" + chokidar "^3.5.3" + debug "^4.3.4" + fast-glob "^3.3.1" + local-pkg "^0.4.3" + magic-string "^0.30.3" + minimatch "^9.0.3" + resolve "^1.22.4" + unplugin "^1.4.0" + +unplugin@^1.4.0: + version "1.7.1" + resolved "https://registry.yarnpkg.com/unplugin/-/unplugin-1.7.1.tgz#009571e3128640f4e327f33680d2db27afaf1e11" + integrity sha512-JqzORDAPxxs8ErLV4x+LL7bk5pk3YlcWqpSNsIkAZj972KzFZLClc/ekppahKkOczGkwIG6ElFgdOgOlK4tXZw== + dependencies: + acorn "^8.11.3" + chokidar "^3.5.3" + webpack-sources "^3.2.3" + webpack-virtual-modules "^0.6.1" + unzip-response@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/unzip-response/-/unzip-response-2.0.1.tgz#d2f0f737d16b0615e72a6935ed04214572d56f97" @@ -4477,6 +4555,16 @@ webidl-conversions@^4.0.2: resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-4.0.2.tgz#a855980b1f0b6b359ba1d5d9fb39ae941faa63ad" integrity sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg== +webpack-sources@^3.2.3: + version "3.2.3" + resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-3.2.3.tgz#2d4daab8451fd4b240cc27055ff6a0c2ccea0cde" + integrity sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w== + +webpack-virtual-modules@^0.6.1: + version "0.6.1" + resolved "https://registry.yarnpkg.com/webpack-virtual-modules/-/webpack-virtual-modules-0.6.1.tgz#ac6fdb9c5adb8caecd82ec241c9631b7a3681b6f" + integrity sha512-poXpCylU7ExuvZK8z+On3kX+S8o/2dQ/SVYueKA0D4WEMXROXgY8Ez50/bQEUmvoSMMrWcrJqCHuhAbsiwg7Dg== + whatwg-url@^7.0.0: version "7.1.0" resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-7.1.0.tgz#c2c492f1eca612988efd3d2266be1b9fc6170d06" From 11f9e0d3bb24e08c1b6fc279106b0db87f2d6585 Mon Sep 17 00:00:00 2001 From: Joabesv Date: Wed, 14 Feb 2024 00:27:44 -0300 Subject: [PATCH 02/21] refac: content script --- src/scripts/contentscript.js | 114 +++++++++++++++++++---------------- 1 file changed, 62 insertions(+), 52 deletions(-) diff --git a/src/scripts/contentscript.js b/src/scripts/contentscript.js index b17e162..3be7503 100644 --- a/src/scripts/contentscript.js +++ b/src/scripts/contentscript.js @@ -1,25 +1,28 @@ -// CSS imports -import "element-ui/lib/theme-chalk/index.css"; - import $ from "jquery"; import _ from "lodash"; +// CSS imports +import "element-ui/lib/theme-chalk/index.css"; +import "vuetify/dist/vuetify.min.css"; + import { ufabcMatricula } from "../services/UFABCMatricula"; import { setupStorage } from "../utils/setupStorage"; import { extensionUtils } from "../utils/extensionUtils"; import { NextStorage } from "../services/NextStorage"; const isBrowser = typeof chrome != "undefined" && !!chrome.storage; -let matricula_url; + +/** @type {string[] | null} */ +let matriculasURL; if (process.env.NODE_ENV == "production") { - matricula_url = [ + matriculasURL = [ "matricula.ufabc.edu.br/matricula", "ufabc-matricula.cdd.naoseiprogramar.com.br/snapshot", "api.ufabcnext.com/snapshot", ]; } else { - matricula_url = [ + matriculasURL = [ "matricula.ufabc.edu.br/matricula", "api.ufabcnext.com/snapshot", "api.ufabcnext.com/snapshot/backup.html", @@ -40,7 +43,12 @@ if (!isBrowser) { } async function load() { - const currentUrl = document.location.href; + const INJECT_CONTENT_DELAY = 1_500; + const currentUrl = new URL(document.location.href); + const shouldExecuteScript = matriculasURL.some( + (url) => `${currentUrl.hostname}${currentUrl.pathname}` === url + ); + // add cross-domain local storage extensionUtils.injectScript("lib/xdLocalStorage.min.js"); extensionUtils.injectIframe("pages/iframe.html"); @@ -49,50 +57,52 @@ async function load() { setupStorage(); await import("./contentScriptPortal"); - if (matricula_url.some((url) => currentUrl.indexOf(url) != -1)) { - // update teachers locally - setTimeout(async () => { - let lastUpdate = null; - try { - lastUpdate = await NextStorage.getItem("ufabc-extension-last"); - } catch (err) { - lastUpdate = Date.now(); - } finally { - ufabcMatricula.updateProfessors(lastUpdate); - } - - // this is the main vue app - // i.e, where all the filters live - const anchor = document.createElement("div"); - anchor.setAttribute("id", "app"); - $("#meio").prepend(anchor); - - //inject styles - extensionUtils.injectStyle("styles/main.css"); - - // manda as informacoes para o servidor - ufabcMatricula.sendAlunoData(); - - // load vue app modal - const modal = document.createElement("div"); - modal.setAttribute("id", "modal"); - modal.setAttribute("data-app", true); - document.body.append(modal); - - // load vue app teacherReview - const teacherReview = document.createElement("div"); - teacherReview.setAttribute("id", "teacherReview"); - teacherReview.setAttribute("data-app", true); - document.body.append(teacherReview); - - // load vue app review subjects - const reviewSubject = document.createElement("div"); - reviewSubject.setAttribute("id", "review-subject"); - reviewSubject.setAttribute("data-app", true); - document.body.append(reviewSubject); - - // inject Vue app - extensionUtils.injectScript("scripts/main.js"); - }, 1500); + if (!shouldExecuteScript) { + return; } + + setTimeout(async () => { + // update teachers locally + let lastUpdate = null; + try { + lastUpdate = await NextStorage.getItem("ufabc-extension-last"); + } catch (err) { + lastUpdate = Date.now(); + } finally { + ufabcMatricula.updateProfessors(lastUpdate); + } + + // this is the main vue app + // i.e, where all the filters live + const anchor = document.createElement("div"); + anchor.setAttribute("id", "app"); + $("#meio").prepend(anchor); + + //inject styles + extensionUtils.injectStyle("styles/main.css"); + + // manda as informacoes para o servidor + ufabcMatricula.sendAlunoData(); + + // load vue app modal + const modal = document.createElement("div"); + modal.setAttribute("id", "modal"); + modal.setAttribute("data-app", true); + document.body.append(modal); + + // load vue app teacherReview + const teacherReview = document.createElement("div"); + teacherReview.setAttribute("id", "teacherReview"); + teacherReview.setAttribute("data-app", true); + document.body.append(teacherReview); + + // load vue app review subjects + const reviewSubject = document.createElement("div"); + reviewSubject.setAttribute("id", "review-subject"); + reviewSubject.setAttribute("data-app", true); + document.body.append(reviewSubject); + + // inject Vue app + extensionUtils.injectScript("scripts/main.js"); + }, INJECT_CONTENT_DELAY); } From 960edf04df20a906f4c98a7b0fd2315450d50453 Mon Sep 17 00:00:00 2001 From: Joabesv Date: Wed, 14 Feb 2024 09:34:39 -0300 Subject: [PATCH 03/21] feat: add prettier --- package.json | 1 + prettier.config.js | 8 ++++++++ yarn.lock | 5 +++++ 3 files changed, 14 insertions(+) create mode 100644 prettier.config.js diff --git a/package.json b/package.json index 74c237e..16411f2 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,7 @@ "fs-extra": "^11.2.0", "kolorist": "^1.8.0", "npm-run-all": "^4.1.5", + "prettier": "^3.2.5", "rimraf": "^5.0.5", "tsup": "^8.0.1", "unplugin-vue-components": "^0.26.0", diff --git a/prettier.config.js b/prettier.config.js new file mode 100644 index 0000000..7b4e4e3 --- /dev/null +++ b/prettier.config.js @@ -0,0 +1,8 @@ +export default { + printWidth: 80, + tabWidth: 2, + singleQuote: false, + trailingComma: "all", + arrowParens: "always", + semi: true, +}; diff --git a/yarn.lock b/yarn.lock index 557c45b..abfdca8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3419,6 +3419,11 @@ prepend-http@^1.0.0, prepend-http@^1.0.1: resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-1.0.4.tgz#d4f4562b0ce3696e41ac52d0e002e57a635dc6dc" integrity sha512-PhmXi5XmoyKw1Un4E+opM2KcsJInDvKyuOumcjjw3waw86ZNjHwVUOOWLc4bCzLdcKNaWBH9e99sbWzDQsVaYg== +prettier@^3.2.5: + version "3.2.5" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.2.5.tgz#e52bc3090586e824964a8813b09aba6233b28368" + integrity sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A== + progress@^2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8" From 190fba1a6fae59fa26abf40b9dfc415081eea13c Mon Sep 17 00:00:00 2001 From: Joabesv Date: Wed, 14 Feb 2024 09:44:27 -0300 Subject: [PATCH 04/21] chore: unify build on vite --- tasks/utils.js | 3 ++ vite.config.background.js | 33 ++++++++++++ vite.config.content.js | 33 ++++++++++++ vite.config.js | 103 ++++++++++++++++++++------------------ 4 files changed, 124 insertions(+), 48 deletions(-) create mode 100644 vite.config.background.js create mode 100644 vite.config.content.js diff --git a/tasks/utils.js b/tasks/utils.js index 1381e12..edb7f41 100644 --- a/tasks/utils.js +++ b/tasks/utils.js @@ -1,8 +1,11 @@ import { dirname } from "node:path"; import { fileURLToPath } from "node:url"; +import { resolve } from "node:path"; import { bgCyan, black } from "kolorist"; export const EsmDirname = dirname(fileURLToPath(import.meta.url)); +export const isDev = process.env.NODE_ENV !== "prod"; +export const resolvePath = (...args) => resolve(EsmDirname, ...args); export function logger(name, message) { console.log(black(bgCyan(` ${name} `)), message); diff --git a/vite.config.background.js b/vite.config.background.js new file mode 100644 index 0000000..c127eab --- /dev/null +++ b/vite.config.background.js @@ -0,0 +1,33 @@ +import { defineConfig } from "vite"; +import { sharedViteConfig } from "./vite.config"; +import packageJson from "./package.json" with { type: "json" }; +import { resolvePath } from "./tasks/utils"; + +// bundling the service_worker using Vite +export default defineConfig({ + ...sharedViteConfig, + define: { + __DEV__: isDev, + __NAME__: JSON.stringify(packageJson.name), + // vite need those envs to be json parsable (i dont know why) + "process.env.NODE_ENV": JSON.stringify(isDev ? "dev" : "prod"), + }, + build: { + watch: isDev ? {} : undefined, + outDir: resolvePath("extension/dist/background"), + cssCodeSplit: false, + emptyOutDir: false, + sourcemap: isDev ? "inline" : false, + lib: { + entry: resolvePath("src/scripts/background.js"), + name: packageJson.name, + formats: ["iife"], + }, + rollupOptions: { + output: { + entryFileNames: "background.global.js", + extend: true, + }, + }, + }, +}); diff --git a/vite.config.content.js b/vite.config.content.js new file mode 100644 index 0000000..2c8ff31 --- /dev/null +++ b/vite.config.content.js @@ -0,0 +1,33 @@ +import { defineConfig } from "vite"; +import { sharedViteConfig } from "./vite.config"; +import packageJson from "./package.json" with { type: "json" }; +import { resolvePath } from "./tasks/utils"; + +// bundling the content script using Vite +export default defineConfig({ + ...sharedViteConfig, + define: { + __DEV__: isDev, + __NAME__: JSON.stringify(packageJson.name), + // vite need those envs to be json parsable (i dont know why) + "process.env.NODE_ENV": JSON.stringify(isDev ? "dev" : "prod"), + }, + build: { + watch: isDev ? {} : undefined, + outDir: resolvePath("extension/dist/contentScripts"), + cssCodeSplit: false, + emptyOutDir: false, + sourcemap: isDev ? "inline" : false, + lib: { + entry: resolvePath("src/scripts/contentscript.js"), + name: packageJson.name, + formats: ["iife"], + }, + rollupOptions: { + output: { + entryFileNames: "contentscript.global.js", + extend: true, + }, + }, + }, +}); diff --git a/vite.config.js b/vite.config.js index 7098e91..dbc2f70 100644 --- a/vite.config.js +++ b/vite.config.js @@ -1,61 +1,68 @@ import { resolve, dirname, relative } from "node:path"; -import { fileURLToPath } from "node:url"; import { defineConfig } from "vite"; import Vue2 from "@vitejs/plugin-vue2"; import Components from "unplugin-vue-components/vite"; +import packageJson from './package.json' with { type: "json" } +import { isDev, PORT, EsmDirname } from './tasks/utils'; -const EsmDirname = dirname(fileURLToPath(import.meta.url)); - -const PORT = 5001; const resolvePath = (...args) => resolve(EsmDirname, ...args); -export default defineConfig(({ command }) => { - const isDev = command === "serve"; - - return { - root: resolvePath("src"), - base: isDev ? `http://localhost:${PORT}/` : undefined, - resolve: { - alias: { - "@/": `${resolvePath("src")}/`, - }, +/**@type {import('vite').UserConfig;} */ +export const sharedViteConfig = { + root: resolvePath("src"), + resolve: { + alias: { + "@/": `${resolvePath("src")}/`, }, - server: { - port: PORT, - hmr: { - host: "localhost", + }, + plugins: [ + Vue2(), + Components({ + dirs: [resolvePath("src/components")], + dts: false, + }), + { + name: "assets-rewrite", + enforce: "post", + apply: "build", + transformIndexHtml(html, { path }) { + return html.replace( + /"\/assets\//g, + `"${relative(dirname(path), "/assets")}/` + ); }, }, - build: { - outDir: resolvePath("extension/prod"), - emptyOutDir: false, - sourcemap: isDev ? "inline" : false, - rollupOptions: { - input: { - popup: resolvePath("src/views/Popup/index.html"), - }, - }, + ], + optimizeDeps: { + include: ["vue", "@vueuse/core"], + }, + define: { + __DEV__: isDev, + __NAME__: JSON.stringify(packageJson.name), + }, +}; + +export default defineConfig(({ command }) => ({ + ...sharedViteConfig, + base: command === "serve" ? `http://localhost:${PORT}/` : "/dist/", + server: { + port: PORT, + hmr: { + host: "localhost", + }, + }, + build: { + watch: isDev ? {} : undefined, + outDir: resolvePath("extension/dist"), + emptyOutDir: false, + sourcemap: isDev ? "inline" : false, + terserOptions: { + mangle: false, }, - plugins: [ - Vue2(), - Components({ - dirs: [resolvePath("src/components")], - dts: false, - }), - { - name: "assets-rewrite", - enforce: "post", - apply: "build", - transformIndexHtml(html, { path }) { - return html.replace( - /"\/assets\//g, - `"${relative(dirname(path), "/assets")}/` - ); - }, + rollupOptions: { + input: { + popup: resolvePath("src/views/Popup/index.html"), }, - ], - optimizeDeps: { - include: ["vue", "@vueuse/core"], }, - }; -}); + }, +})); From e9dd8216eee0882a5d848a5c4f0f98bd4d2b2c0b Mon Sep 17 00:00:00 2001 From: Joabesv Date: Wed, 14 Feb 2024 10:05:01 -0300 Subject: [PATCH 05/21] chore: unify scripts --- src/views/Popup/main.js | 2 +- tasks/{manifest.dev.js => manifest.js} | 6 ++-- tasks/manifest.prod.js | 23 ------------ tasks/mvsw.dev.js | 50 -------------------------- tasks/mvsw.prod.js | 50 -------------------------- tasks/{prepare.dev.js => prepare.js} | 24 ++++++------- tasks/prepare.prod.js | 5 --- 7 files changed, 15 insertions(+), 145 deletions(-) rename tasks/{manifest.dev.js => manifest.js} (77%) delete mode 100644 tasks/manifest.prod.js delete mode 100644 tasks/mvsw.dev.js delete mode 100644 tasks/mvsw.prod.js rename tasks/{prepare.dev.js => prepare.js} (71%) delete mode 100644 tasks/prepare.prod.js diff --git a/src/views/Popup/main.js b/src/views/Popup/main.js index 7ed57d5..67ae733 100644 --- a/src/views/Popup/main.js +++ b/src/views/Popup/main.js @@ -6,7 +6,7 @@ import Popup from "./Popup.vue"; Vue.use(Vuetify); -var app = new Vue({ +new Vue({ el: "#app", data: { name: "popup-next-extension", diff --git a/tasks/manifest.dev.js b/tasks/manifest.js similarity index 77% rename from tasks/manifest.dev.js rename to tasks/manifest.js index c935574..ba1a636 100644 --- a/tasks/manifest.dev.js +++ b/tasks/manifest.js @@ -9,13 +9,13 @@ const resolvePath = (...args) => resolve(EsmDirname, "..", ...args); export async function writeManifest() { const manifest = await getManifest(); - const normalizedPath = resolvePath("extension/dev/manifest.json"); + const normalizedPath = resolvePath("extension/manifest.json"); // TODO: remove fs-extra await ensureFile(normalizedPath); await writeFile( - resolvePath("extension/dev/manifest.json"), - JSON.stringify(manifest, null, 2) + resolvePath("extension/manifest.json"), + JSON.stringify(manifest, null, 2), ); logger("PRE", "write manifest.json"); } diff --git a/tasks/manifest.prod.js b/tasks/manifest.prod.js deleted file mode 100644 index a4d720b..0000000 --- a/tasks/manifest.prod.js +++ /dev/null @@ -1,23 +0,0 @@ -import { ensureFile } from "fs-extra"; -import { writeFile } from "node:fs/promises"; -import { resolve } from "node:path"; -import { getManifest } from "../src/manifest.js"; -import { EsmDirname, logger } from "./utils.js"; - -const resolvePath = (...args) => resolve(EsmDirname, "..", ...args); - -export async function writeManifest() { - const manifest = await getManifest(); - - const normalizedPath = resolvePath("extension/prod/manifest.json"); - - // TODO: remove fs-extra - await ensureFile(normalizedPath); - await writeFile( - resolvePath("extension/prod/manifest.json"), - JSON.stringify(manifest, null, 2) - ); - logger("PRE", "write manifest.json"); -} - -writeManifest(); diff --git a/tasks/mvsw.dev.js b/tasks/mvsw.dev.js deleted file mode 100644 index 5be69c9..0000000 --- a/tasks/mvsw.dev.js +++ /dev/null @@ -1,50 +0,0 @@ -import { resolve } from "node:path"; -import { cp, rename, rm } from "node:fs/promises"; -import { logger } from "./utils.js"; - -(async () => { - try { - await cp(resolve("src/assets"), resolve("extension/dev/assets"), { - recursive: true, - }); - await cp(resolve("src/styles"), resolve("extension/dev/styles"), { - recursive: true, - }); - await cp(resolve("src/pages"), resolve("extension/dev/pages"), { - recursive: true, - }); - await cp(resolve("src/lib"), resolve("extension/dev/lib"), { - recursive: true, - }); - await rename( - resolve("extension/dev/dist/lib/init.global.js"), - resolve("extension/dev/lib/init.js") - ); - await rename( - resolve("extension/dev/dist/lib/xdLocalStorage.min.global.js"), - resolve("extension/dev/lib/xdLocalStorage.min.js") - ); - await rename( - resolve( - "extension/dev/dist/lib/xdLocalStoragePostMessageApi.min.global.js" - ), - resolve("extension/dev/lib/xdLocalStoragePostMessageApi.min.js") - ); - await rename( - resolve("extension/dev/dist/scripts/background.global.js"), - resolve("extension/dev/background.js") - ); - await rename( - resolve("extension/dev/dist/scripts/contentscript.global.js"), - resolve("extension/dev/contentscript.js") - ); - await rename( - resolve("extension/dev/dist/scripts/contentScriptPortal.global.js"), - resolve("extension/dev/contentScriptPortal.js") - ); - await rm(resolve("extension/dev/dist"), { recursive: true }); - logger("BUILD:DEV", "Builded extension successfully!"); - } catch (error) { - console.error("error moving files", error); - } -})(); diff --git a/tasks/mvsw.prod.js b/tasks/mvsw.prod.js deleted file mode 100644 index de0097d..0000000 --- a/tasks/mvsw.prod.js +++ /dev/null @@ -1,50 +0,0 @@ -import { resolve } from "node:path"; -import { cp, rename, rm } from "node:fs/promises"; -import { logger } from "./utils.js"; - -(async () => { - try { - await cp(resolve("src/assets"), resolve("extension/prod/assets"), { - recursive: true, - }); - await cp(resolve("src/styles"), resolve("extension/prod/styles"), { - recursive: true, - }); - await cp(resolve("src/pages"), resolve("extension/prod/pages"), { - recursive: true, - }); - await cp(resolve("src/lib"), resolve("extension/prod/lib"), { - recursive: true, - }); - await rename( - resolve("extension/prod/dist/lib/init.global.js"), - resolve("extension/prod/lib/init.js") - ); - await rename( - resolve("extension/prod/dist/lib/xdLocalStorage.min.global.js"), - resolve("extension/prod/lib/xdLocalStorage.min.js") - ); - await rename( - resolve( - "extension/prod/dist/lib/xdLocalStoragePostMessageApi.min.global.js" - ), - resolve("extension/prod/lib/xdLocalStoragePostMessageApi.min.js") - ); - await rename( - resolve("extension/prod/dist/scripts/background.global.js"), - resolve("extension/prod/background.js") - ); - await rename( - resolve("extension/prod/dist/scripts/contentscript.global.js"), - resolve("extension/prod/contentscript.js") - ); - await rename( - resolve("extension/prod/dist/scripts/contentScriptPortal.global.js"), - resolve("extension/prod/contentScriptPortal.js") - ); - await rm(resolve("extension/prod/dist"), { recursive: true }); - logger("BUILD:PROD", "Builded extension successfully!"); - } catch (error) { - console.error("error moving files [PROD]", error); - } -})(); diff --git a/tasks/prepare.dev.js b/tasks/prepare.js similarity index 71% rename from tasks/prepare.dev.js rename to tasks/prepare.js index 67a8085..f04c95b 100644 --- a/tasks/prepare.dev.js +++ b/tasks/prepare.js @@ -1,52 +1,50 @@ -// generate stub index.html files for dev entry +import { watch } from "chokidar"; import { mkdir, readFile, writeFile } from "node:fs/promises"; import { execSync } from "node:child_process"; import { resolve } from "node:path"; -import { watch } from "chokidar"; import { existsSync } from "node:fs"; -import { EsmDirname, logger, PORT } from "./utils.js"; +import { EsmDirname, logger, PORT, isDev } from "./utils.js"; const resolvePath = (...args) => resolve(EsmDirname, "..", ...args); -const isDev = process.env.NODE_ENV !== "prod"; - const ensureDir = async (dir) => { if (!existsSync(dir)) { await mkdir(dir, { recursive: true }); } }; +// generate stub index.html files for dev entry async function stubHtml() { const views = ["Popup"]; for (const view of views) { - await ensureDir(resolvePath(`extension/dev/views/${view}`)); + await ensureDir(resolvePath(`extension/dist/views/${view}`)); let data = await readFile( resolvePath(`src/views/${view}/index.html`), - "utf-8" + "utf-8", ); data = data .replace( '"./main.js"', - `"http://localhost:${PORT}/views/${view}/main.js"` + `"http://localhost:${PORT}/views/${view}/main.js"`, ) .replace( '
', - '
Vite server did not start
' + '
Vite server did not start
', ); await writeFile( - resolvePath(`extension/dev/views/${view}/index.html`), + resolvePath(`extension/dist/views/${view}/index.html`), data, - "utf-8" + "utf-8", ); logger("PRE", `stub ${view}`); } } function writeManifest() { - execSync("node ./tasks/manifest.dev.js", { stdio: "inherit" }); + execSync("node ./tasks/manifest.js", { stdio: "inherit" }); } writeManifest(); @@ -60,6 +58,6 @@ if (isDev) { "change", () => { writeManifest(); - } + }, ); } diff --git a/tasks/prepare.prod.js b/tasks/prepare.prod.js deleted file mode 100644 index 7947399..0000000 --- a/tasks/prepare.prod.js +++ /dev/null @@ -1,5 +0,0 @@ -import { execSync } from "node:child_process"; - -(function writeManifest() { - execSync("node ./tasks/manifest.prod.js", { stdio: "inherit" }); -})(); From 81a9ff55f7a81cb13eee1baddda7067c2fdd7bd6 Mon Sep 17 00:00:00 2001 From: Joabesv Date: Wed, 14 Feb 2024 10:29:31 -0300 Subject: [PATCH 06/21] chore: use resolvePath on utils --- tasks/manifest.js | 5 +---- tasks/prepare.js | 5 +---- tasks/utils.js | 2 +- vite.config.js | 9 ++++----- 4 files changed, 7 insertions(+), 14 deletions(-) diff --git a/tasks/manifest.js b/tasks/manifest.js index ba1a636..6b6369d 100644 --- a/tasks/manifest.js +++ b/tasks/manifest.js @@ -1,10 +1,7 @@ import { writeFile } from "node:fs/promises"; import { ensureFile } from "fs-extra"; import { getManifest } from "../src/manifest.js"; -import { resolve } from "node:path"; -import { EsmDirname, logger } from "./utils.js"; - -const resolvePath = (...args) => resolve(EsmDirname, "..", ...args); +import { logger, resolvePath } from "./utils.js"; export async function writeManifest() { const manifest = await getManifest(); diff --git a/tasks/prepare.js b/tasks/prepare.js index f04c95b..cff5503 100644 --- a/tasks/prepare.js +++ b/tasks/prepare.js @@ -1,11 +1,8 @@ import { watch } from "chokidar"; import { mkdir, readFile, writeFile } from "node:fs/promises"; import { execSync } from "node:child_process"; -import { resolve } from "node:path"; import { existsSync } from "node:fs"; -import { EsmDirname, logger, PORT, isDev } from "./utils.js"; - -const resolvePath = (...args) => resolve(EsmDirname, "..", ...args); +import { logger, PORT, isDev, resolvePath } from "./utils.js"; const ensureDir = async (dir) => { if (!existsSync(dir)) { diff --git a/tasks/utils.js b/tasks/utils.js index edb7f41..69c8511 100644 --- a/tasks/utils.js +++ b/tasks/utils.js @@ -5,7 +5,7 @@ import { bgCyan, black } from "kolorist"; export const EsmDirname = dirname(fileURLToPath(import.meta.url)); export const isDev = process.env.NODE_ENV !== "prod"; -export const resolvePath = (...args) => resolve(EsmDirname, ...args); +export const resolvePath = (...args) => resolve(EsmDirname, "..", ...args); export function logger(name, message) { console.log(black(bgCyan(` ${name} `)), message); diff --git a/vite.config.js b/vite.config.js index dbc2f70..c49cd2c 100644 --- a/vite.config.js +++ b/vite.config.js @@ -1,11 +1,10 @@ import { resolve, dirname, relative } from "node:path"; +import { fileURLToPath } from "node:url"; import { defineConfig } from "vite"; import Vue2 from "@vitejs/plugin-vue2"; import Components from "unplugin-vue-components/vite"; -import packageJson from './package.json' with { type: "json" } -import { isDev, PORT, EsmDirname } from './tasks/utils'; - -const resolvePath = (...args) => resolve(EsmDirname, ...args); +import packageJson from "./package.json" with { type: "json" }; +import { isDev, PORT, resolvePath } from "./tasks/utils"; /**@type {import('vite').UserConfig;} */ export const sharedViteConfig = { @@ -28,7 +27,7 @@ export const sharedViteConfig = { transformIndexHtml(html, { path }) { return html.replace( /"\/assets\//g, - `"${relative(dirname(path), "/assets")}/` + `"${relative(dirname(path), "/assets")}/`, ); }, }, From c89bc444970f039f1f8e67088dcabb0b09d47a31 Mon Sep 17 00:00:00 2001 From: Joabesv Date: Wed, 14 Feb 2024 10:29:46 -0300 Subject: [PATCH 07/21] fix: add missing imports --- vite.config.background.js | 2 +- vite.config.content.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/vite.config.background.js b/vite.config.background.js index c127eab..a085084 100644 --- a/vite.config.background.js +++ b/vite.config.background.js @@ -1,7 +1,7 @@ import { defineConfig } from "vite"; import { sharedViteConfig } from "./vite.config"; import packageJson from "./package.json" with { type: "json" }; -import { resolvePath } from "./tasks/utils"; +import { resolvePath, isDev } from "./tasks/utils"; // bundling the service_worker using Vite export default defineConfig({ diff --git a/vite.config.content.js b/vite.config.content.js index 2c8ff31..d62d8b4 100644 --- a/vite.config.content.js +++ b/vite.config.content.js @@ -1,7 +1,7 @@ import { defineConfig } from "vite"; import { sharedViteConfig } from "./vite.config"; import packageJson from "./package.json" with { type: "json" }; -import { resolvePath } from "./tasks/utils"; +import { resolvePath, isDev } from "./tasks/utils"; // bundling the content script using Vite export default defineConfig({ From e6f2fbac548ea50ea5f72f38e19cfecf4eb1cdbb Mon Sep 17 00:00:00 2001 From: Joabesv Date: Wed, 14 Feb 2024 10:32:49 -0300 Subject: [PATCH 08/21] chore: update scripts --- package.json | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 16411f2..dca038d 100644 --- a/package.json +++ b/package.json @@ -5,16 +5,17 @@ "type": "module", "description": "Adiciona funcionalidades novas ao sistema de matricula da UFABC", "scripts": { - "dev": "rimraf extension/dev && run-p dev:*", - "dev:prepare": "node --no-warnings=ExperimentalWarning tasks/prepare.dev.js dev", + "dev": "yarn clear && NODE_ENV=dev run-p dev:*", + "dev:prepare": "node tasks/prepare.js", + "dev:background": "yarn build:background --mode dev", "dev:web": "vite", - "dev:js": "yarn run build:dev --watch src", - "build": "NODE_ENV=prod run-s clear build:web build:prepare build:prod", - "build:prepare": "node tasks/prepare.prod.js build", + "dev:js": "yarn run build:js --mode dev", + "build": "NODE_ENV=prod run-s clear build:web build:prepare build:background build:js", + "build:prepare": "node tasks/prepare.js", + "build:background": "vite build --config vite.config.background.js", "build:web": "vite build", - "build:dev": "tsup --onSuccess 'node --no-warnings=ExperimentalWarning tasks/mvsw.dev.js'", - "build:prod": "tsup --onSuccess 'node --no-warnings=ExperimentalWarning tasks/mvsw.prod.js'", - "clear": "rimraf extension/prod" + "build:js": "vite build --config vite.config.content.js", + "clear": "rimraf --glob extension/dist extension/manifest.json extension.*" }, "standard": { "globals": [ From d63d1ae2d0edd2fa7ba390c0d7259885ce845e9b Mon Sep 17 00:00:00 2001 From: Joabesv Date: Wed, 14 Feb 2024 11:32:14 -0300 Subject: [PATCH 09/21] fix: script extension --- .gitignore | 11 ++++++++++- src/manifest.js | 4 ++-- vite.config.background.js | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 5302287..daf8285 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,13 @@ npm-debug.log dist/ packages/ -extension + +src/components.d.ts +extension/manifest.json + +*.crx +*.local +*.log +*.pem +*.xpi +*.zip diff --git a/src/manifest.js b/src/manifest.js index 491adb0..44c26f6 100644 --- a/src/manifest.js +++ b/src/manifest.js @@ -15,7 +15,7 @@ export async function getManifest() { 128: "./assets/icon-128.png", }, background: { - service_worker: "background.js", + service_worker: "dist/background/background.mjs", }, permissions: ["storage"], host_permissions: [ @@ -28,7 +28,7 @@ export async function getManifest() { content_scripts: [ { all_frames: true, - js: ["contentscript.js"], + js: ["dist/contentScripts/contentscript.global.js"], matches: [ "http://*.ufabc.edu.br/*", "https://*.ufabc.edu.br/*", diff --git a/vite.config.background.js b/vite.config.background.js index a085084..64ac3c5 100644 --- a/vite.config.background.js +++ b/vite.config.background.js @@ -25,7 +25,7 @@ export default defineConfig({ }, rollupOptions: { output: { - entryFileNames: "background.global.js", + entryFileNames: "background.mjs", extend: true, }, }, From 19a0cd91d99c3877fa0e44c02d383e5ee9801ec7 Mon Sep 17 00:00:00 2001 From: Joabesv Date: Wed, 14 Feb 2024 11:35:17 -0300 Subject: [PATCH 10/21] chore: move assets to extension --- {src => extension}/assets/error.svg | 0 {src => extension}/assets/icon-128.png | Bin {src => extension}/assets/icon-16.png | Bin {src => extension}/assets/icon-19.png | Bin {src => extension}/assets/icon-38.png | Bin {src => extension}/assets/loading.svg | 0 {src => extension}/assets/logo-white.svg | 0 {src => extension}/assets/logo.svg | 0 {src => extension}/assets/refresh.png | Bin {src => extension}/assets/refresh_small.png | Bin {src => extension}/assets/ring.gif | Bin src/manifest.js | 6 +++--- 12 files changed, 3 insertions(+), 3 deletions(-) rename {src => extension}/assets/error.svg (100%) rename {src => extension}/assets/icon-128.png (100%) rename {src => extension}/assets/icon-16.png (100%) rename {src => extension}/assets/icon-19.png (100%) rename {src => extension}/assets/icon-38.png (100%) rename {src => extension}/assets/loading.svg (100%) rename {src => extension}/assets/logo-white.svg (100%) rename {src => extension}/assets/logo.svg (100%) rename {src => extension}/assets/refresh.png (100%) rename {src => extension}/assets/refresh_small.png (100%) rename {src => extension}/assets/ring.gif (100%) diff --git a/src/assets/error.svg b/extension/assets/error.svg similarity index 100% rename from src/assets/error.svg rename to extension/assets/error.svg diff --git a/src/assets/icon-128.png b/extension/assets/icon-128.png similarity index 100% rename from src/assets/icon-128.png rename to extension/assets/icon-128.png diff --git a/src/assets/icon-16.png b/extension/assets/icon-16.png similarity index 100% rename from src/assets/icon-16.png rename to extension/assets/icon-16.png diff --git a/src/assets/icon-19.png b/extension/assets/icon-19.png similarity index 100% rename from src/assets/icon-19.png rename to extension/assets/icon-19.png diff --git a/src/assets/icon-38.png b/extension/assets/icon-38.png similarity index 100% rename from src/assets/icon-38.png rename to extension/assets/icon-38.png diff --git a/src/assets/loading.svg b/extension/assets/loading.svg similarity index 100% rename from src/assets/loading.svg rename to extension/assets/loading.svg diff --git a/src/assets/logo-white.svg b/extension/assets/logo-white.svg similarity index 100% rename from src/assets/logo-white.svg rename to extension/assets/logo-white.svg diff --git a/src/assets/logo.svg b/extension/assets/logo.svg similarity index 100% rename from src/assets/logo.svg rename to extension/assets/logo.svg diff --git a/src/assets/refresh.png b/extension/assets/refresh.png similarity index 100% rename from src/assets/refresh.png rename to extension/assets/refresh.png diff --git a/src/assets/refresh_small.png b/extension/assets/refresh_small.png similarity index 100% rename from src/assets/refresh_small.png rename to extension/assets/refresh_small.png diff --git a/src/assets/ring.gif b/extension/assets/ring.gif similarity index 100% rename from src/assets/ring.gif rename to extension/assets/ring.gif diff --git a/src/manifest.js b/src/manifest.js index 44c26f6..16db369 100644 --- a/src/manifest.js +++ b/src/manifest.js @@ -11,8 +11,8 @@ export async function getManifest() { version: pkg.version, description: pkg.description, icons: { - 16: "./assets/icon-16.png", - 128: "./assets/icon-128.png", + 16: "assets/icon-16.png", + 128: "assets/icon-128.png", }, background: { service_worker: "dist/background/background.mjs", @@ -55,7 +55,7 @@ export async function getManifest() { 38: "assets/icon-38.png", }, default_title: "Next Extension", - default_popup: "./views/Popup/index.html", + default_popup: "dist/views/Popup/index.html", }, content_security_policy: { extension_pages: "script-src 'self'; object-src 'self'", From b151f4762141b8be9ff3e4a9f5ebc3a546b05244 Mon Sep 17 00:00:00 2001 From: Joabesv Date: Wed, 14 Feb 2024 11:38:02 -0300 Subject: [PATCH 11/21] chore: remove tsup --- package.json | 1 - tsup.config.js | 20 ---- yarn.lock | 311 ++----------------------------------------------- 3 files changed, 11 insertions(+), 321 deletions(-) delete mode 100644 tsup.config.js diff --git a/package.json b/package.json index dca038d..8297768 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,6 @@ "npm-run-all": "^4.1.5", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "tsup": "^8.0.1", "unplugin-vue-components": "^0.26.0", "vite": "^5.1.1" }, diff --git a/tsup.config.js b/tsup.config.js deleted file mode 100644 index 51b6776..0000000 --- a/tsup.config.js +++ /dev/null @@ -1,20 +0,0 @@ -import { defineConfig } from "tsup"; - -const isDev = process.env.NODE_ENV !== "prod"; - -export default defineConfig({ - entry: [ - "src/scripts/background.js", - "src/scripts/contentscript.js", - "src/scripts/contentScriptPortal.js", - "src/lib/*.cjs", - ], - target: "node20", - format: "iife", - outDir: isDev ? "extension/dev/dist" : "extension/prod/dist", - splitting: false, - minify: isDev ? false : true, - env: { - NODE_ENV: isDev ? "dev" : "prod", - }, -}); diff --git a/yarn.lock b/yarn.lock index abfdca8..09a67fc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -139,38 +139,11 @@ wrap-ansi "^8.1.0" wrap-ansi-cjs "npm:wrap-ansi@^7.0.0" -"@jridgewell/gen-mapping@^0.3.2": - version "0.3.3" - resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz#7e02e6eb5df901aaedb08514203b096614024098" - integrity sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ== - dependencies: - "@jridgewell/set-array" "^1.0.1" - "@jridgewell/sourcemap-codec" "^1.4.10" - "@jridgewell/trace-mapping" "^0.3.9" - -"@jridgewell/resolve-uri@^3.1.0": - version "3.1.1" - resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz#c08679063f279615a3326583ba3a90d1d82cc721" - integrity sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA== - -"@jridgewell/set-array@^1.0.1": - version "1.1.2" - resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.1.2.tgz#7c6cf998d6d20b914c0a55a91ae928ff25965e72" - integrity sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw== - -"@jridgewell/sourcemap-codec@^1.4.10", "@jridgewell/sourcemap-codec@^1.4.14", "@jridgewell/sourcemap-codec@^1.4.15": +"@jridgewell/sourcemap-codec@^1.4.15": version "1.4.15" resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz#d7c6e6755c78567a951e04ab52ef0fd26de59f32" integrity sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg== -"@jridgewell/trace-mapping@^0.3.9": - version "0.3.22" - resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.22.tgz#72a621e5de59f5f1ef792d0793a82ee20f645e4c" - integrity sha512-Wf963MzWtA2sjrNt+g18IAln9lKnlRp+K2eH4jjIoF1wYeq3aMREpG09xhlhdzS0EjwU7qmUJYangWa+151vZw== - dependencies: - "@jridgewell/resolve-uri" "^3.1.0" - "@jridgewell/sourcemap-codec" "^1.4.14" - "@nodelib/fs.scandir@2.1.5": version "2.1.5" resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5" @@ -555,11 +528,6 @@ ansi-styles@^6.1.0: resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-6.2.1.tgz#0e62320cf99c21afff3b3012192546aacbfb05c5" integrity sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug== -any-promise@^1.0.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/any-promise/-/any-promise-1.3.0.tgz#abc6afeedcea52e809cdc0376aed3ce39635d17f" - integrity sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A== - anymatch@~3.1.2: version "3.1.3" resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.3.tgz#790c58b19ba1720a84205b57c618d5ad8524973e" @@ -596,11 +564,6 @@ array-flatten@1.1.1: resolved "https://registry.yarnpkg.com/array-flatten/-/array-flatten-1.1.1.tgz#9a5f699051b1e7073328f2a008968b64ea2955d2" integrity sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg== -array-union@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/array-union/-/array-union-2.1.0.tgz#b798420adbeb1de828d84acd8a2e23d3efe85e8d" - integrity sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw== - arraybuffer.prototype.slice@^1.0.2: version "1.0.3" resolved "https://registry.yarnpkg.com/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.3.tgz#097972f4255e41bc3425e37dc3f6421cf9aefde6" @@ -808,13 +771,6 @@ browserslist@^4.12.0: node-releases "^2.0.8" update-browserslist-db "^1.0.10" -bundle-require@^4.0.0: - version "4.0.2" - resolved "https://registry.yarnpkg.com/bundle-require/-/bundle-require-4.0.2.tgz#65fc74ff14eabbba36d26c9a6161bd78fff6b29e" - integrity sha512-jwzPOChofl67PSTW2SGubV9HBQAhhR2i6nskiOThauo9dzwDUgOWQScFVaJkjEfYX+UXiD+LEx8EblQMc2wIag== - dependencies: - load-tsconfig "^0.2.3" - bytes@3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.0.0.tgz#d32815404d689699f85a4ea4fa8755dd13a96048" @@ -825,11 +781,6 @@ bytes@3.1.2: resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.2.tgz#8b0beeb98605adf1b128fa4386403c009e0221a5" integrity sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg== -cac@^6.7.12: - version "6.7.14" - resolved "https://registry.yarnpkg.com/cac/-/cac-6.7.14.tgz#804e1e6f506ee363cb0e3ccbb09cad5dd9870959" - integrity sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ== - call-bind@^1.0.0, call-bind@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.2.tgz#b1d4e89e688119c3c9a903ad30abb2f6a919be3c" @@ -933,7 +884,7 @@ chardet@^0.7.0: resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.7.0.tgz#90094849f0937f2eedc2425d0d28a9e5f0cbad9e" integrity sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA== -chokidar@^3.5.1, chokidar@^3.5.3, chokidar@^3.6.0: +chokidar@^3.5.3, chokidar@^3.6.0: version "3.6.0" resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.6.0.tgz#197c6cc669ef2a8dc5e7b4d97ee4e092c3eb0d5b" integrity sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw== @@ -1065,11 +1016,6 @@ commander@^2.19.0: resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== -commander@^4.0.0: - version "4.1.1" - resolved "https://registry.yarnpkg.com/commander/-/commander-4.1.1.tgz#9fd602bd936294e9e9ef46a3f4d6964044b18068" - integrity sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA== - compressible@~2.0.16: version "2.0.18" resolved "https://registry.yarnpkg.com/compressible/-/compressible-2.0.18.tgz#af53cca6b070d4c3c0750fbd77286a6d7cc46fba" @@ -1204,7 +1150,7 @@ cross-spawn@^6.0.5: shebang-command "^1.2.0" which "^1.2.9" -cross-spawn@^7.0.0, cross-spawn@^7.0.3: +cross-spawn@^7.0.0: version "7.0.3" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== @@ -1298,7 +1244,7 @@ debug@2.6.9: dependencies: ms "2.0.0" -debug@^4.3.1, debug@^4.3.4: +debug@^4.3.4: version "4.3.4" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== @@ -1374,13 +1320,6 @@ destroy@1.2.0: resolved "https://registry.yarnpkg.com/destroy/-/destroy-1.2.0.tgz#4803735509ad8be552934c67df614f94e66fa015" integrity sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg== -dir-glob@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-3.0.1.tgz#56dbf73d992a4a93ba1584f4534063fd2e41717f" - integrity sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA== - dependencies: - path-type "^4.0.0" - dot-prop@^4.1.0, dot-prop@^4.2.1: version "4.2.1" resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-4.2.1.tgz#45884194a71fc2cda71cbb4bceb3a4dd2f433ba4" @@ -1523,7 +1462,7 @@ es-to-primitive@^1.2.1: is-date-object "^1.0.1" is-symbol "^1.0.2" -esbuild@^0.19.2, esbuild@^0.19.3: +esbuild@^0.19.3: version "0.19.12" resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.19.12.tgz#dc82ee5dc79e82f5a5c3b4323a2a641827db3e04" integrity sha512-aARqgq8roFBj054KvQr5f1sFu0D65G+miZRCuJyJ0G13Zwx7vRar5Zhn2tkQNzIXcBrNVsv/8stehpj+GAjgbg== @@ -1600,21 +1539,6 @@ execa@^0.7.0: signal-exit "^3.0.0" strip-eof "^1.0.0" -execa@^5.0.0: - version "5.1.1" - resolved "https://registry.yarnpkg.com/execa/-/execa-5.1.1.tgz#f80ad9cbf4298f7bd1d4c9555c21e93741c411dd" - integrity sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg== - dependencies: - cross-spawn "^7.0.3" - get-stream "^6.0.0" - human-signals "^2.1.0" - is-stream "^2.0.0" - merge-stream "^2.0.0" - npm-run-path "^4.0.1" - onetime "^5.1.2" - signal-exit "^3.0.3" - strip-final-newline "^2.0.0" - express@^4.16.4: version "4.18.2" resolved "https://registry.yarnpkg.com/express/-/express-4.18.2.tgz#3fabe08296e930c796c19e3c516979386ba9fd59" @@ -1681,7 +1605,7 @@ fast-deep-equal@^3.1.1: resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== -fast-glob@^3.2.9, fast-glob@^3.3.1: +fast-glob@^3.3.1: version "3.3.2" resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.3.2.tgz#a904501e57cfdd2ffcded45e99a54fef55e46129" integrity sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow== @@ -1867,11 +1791,6 @@ get-stream@^3.0.0: resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14" integrity sha512-GlhdIUuVakc8SJ6kK0zAFbiGzRFzNnY4jUuEbV9UROo4Y+0Ny4fjvcZFVTeDA4odpFyOQzaw6hXukJSq/f28sQ== -get-stream@^6.0.0: - version "6.0.1" - resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-6.0.1.tgz#a262d8eef67aced57c2852ad6167526a43cbf7b7" - integrity sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg== - get-symbol-description@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/get-symbol-description/-/get-symbol-description-1.0.0.tgz#7fdb81c900101fbd564dd5f1a30af5aadc1e58d6" @@ -1894,7 +1813,7 @@ glob-parent@^5.1.2, glob-parent@~5.1.2: dependencies: is-glob "^4.0.1" -glob@^10.3.10, glob@^10.3.7: +glob@^10.3.7: version "10.3.10" resolved "https://registry.yarnpkg.com/glob/-/glob-10.3.10.tgz#0351ebb809fd187fe421ab96af83d3a70715df4b" integrity sha512-fa46+tv1Ak0UPK1TOy/pZrIybNNt4HCv7SDzwyfiOZkvZLEbjsZkJBPtDHVshZjbecAoAGSC20MjLDG/qr679g== @@ -1919,18 +1838,6 @@ globalthis@^1.0.3: dependencies: define-properties "^1.1.3" -globby@^11.0.3: - version "11.1.0" - resolved "https://registry.yarnpkg.com/globby/-/globby-11.1.0.tgz#bd4be98bb042f83d796f7e3811991fbe82a0d34b" - integrity sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g== - dependencies: - array-union "^2.1.0" - dir-glob "^3.0.1" - fast-glob "^3.2.9" - ignore "^5.2.0" - merge2 "^1.4.1" - slash "^3.0.0" - gopd@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.0.1.tgz#29ff76de69dac7489b7c0918a5788e56477c332c" @@ -2092,11 +1999,6 @@ http-signature@~1.2.0: jsprim "^1.2.2" sshpk "^1.7.0" -human-signals@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-2.1.0.tgz#dc91fcba42e4d06e4abaed33b3e7a3c02f514ea0" - integrity sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw== - iconv-lite@0.4.24, iconv-lite@^0.4.24: version "0.4.24" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" @@ -2104,11 +2006,6 @@ iconv-lite@0.4.24, iconv-lite@^0.4.24: dependencies: safer-buffer ">= 2.1.2 < 3" -ignore@^5.2.0: - version "5.3.1" - resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.3.1.tgz#5073e554cd42c5b33b394375f538b8593e34d4ef" - integrity sha512-5Fytz/IraMjqpwfd34ke28PTVMjZjJG2MPn5t7OE4eUCUNf8BAa7b5WUS9/Qvr6mwOQS7Mk6vdsMno5he+T8Xw== - import-lazy@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/import-lazy/-/import-lazy-2.1.0.tgz#05698e3d45c88e8d7e9d92cb0584e77f096f3e43" @@ -2358,11 +2255,6 @@ is-stream@^1.0.0, is-stream@^1.1.0: resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" integrity sha512-uQPm8kcs47jx38atAcWTVxyltQYoPT68y9aWYdV6yWXSyW8mzSat0TL6CiWdZeCdF3KrAvpVtnHbTv4RN+rqdQ== -is-stream@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.1.tgz#fac1e3d53b97ad5a9d0ae9cef2389f5810a5c077" - integrity sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg== - is-string@^1.0.5, is-string@^1.0.7: version "1.0.7" resolved "https://registry.yarnpkg.com/is-string/-/is-string-1.0.7.tgz#0dd12bf2006f255bb58f695110eff7491eebc0fd" @@ -2443,11 +2335,6 @@ jackspeak@^2.3.5: optionalDependencies: "@pkgjs/parseargs" "^0.11.0" -joycon@^3.0.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/joycon/-/joycon-3.1.1.tgz#bce8596d6ae808f8b68168f5fc69280996894f03" - integrity sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw== - jquery@>=1.12.0, jquery@^3.2.1: version "3.6.4" resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.6.4.tgz#ba065c188142100be4833699852bf7c24dc0252f" @@ -2542,16 +2429,6 @@ latest-version@^3.0.0: dependencies: package-json "^4.0.0" -lilconfig@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/lilconfig/-/lilconfig-3.0.0.tgz#f8067feb033b5b74dab4602a5f5029420be749bc" - integrity sha512-K2U4W2Ff5ibV7j7ydLr+zLAkIg5JJ4lPn1Ltsdt+Tz/IjQ8buJ55pZAxoP34lqIiwtF9iAvtLv3JGv7CAyAg+g== - -lines-and-columns@^1.1.6: - version "1.2.4" - resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632" - integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg== - load-json-file@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-4.0.0.tgz#2f5f45ab91e33216234fd53adab668eb4ec0993b" @@ -2562,11 +2439,6 @@ load-json-file@^4.0.0: pify "^3.0.0" strip-bom "^3.0.0" -load-tsconfig@^0.2.3: - version "0.2.5" - resolved "https://registry.yarnpkg.com/load-tsconfig/-/load-tsconfig-0.2.5.tgz#453b8cd8961bfb912dea77eb6c168fe8cca3d3a1" - integrity sha512-IXO6OCs9yg8tMKzfPZ1YmheJbZCiEsnBdcB03l0OcfK9prKnJb96siuHCr5Fl37/yo9DnKU+TLpxzTUspw9shg== - loader-utils@^0.2.16: version "0.2.17" resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-0.2.17.tgz#f86e6374d43205a6e6c60e9196f17c0299bfb348" @@ -2587,11 +2459,6 @@ lodash.memoize@^4.1.2: resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe" integrity sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag== -lodash.sortby@^4.7.0: - version "4.7.0" - resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438" - integrity sha512-HDWXG8isMntAyRF5vZ7xKuEvOhT4AhlRt/3czTSjvGUxjYCBVRQY48ViDHyfYz9VIoBkW4TMGQNapx+l3RUwdA== - lodash.uniq@^4.5.0: version "4.5.0" resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773" @@ -2666,12 +2533,7 @@ merge-descriptors@1.0.1: resolved "https://registry.yarnpkg.com/merge-descriptors/-/merge-descriptors-1.0.1.tgz#b00aaa556dd8b44568150ec9d1b953f3f90cbb61" integrity sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w== -merge-stream@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" - integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== - -merge2@^1.3.0, merge2@^1.4.1: +merge2@^1.3.0: version "1.4.1" resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== @@ -2716,11 +2578,6 @@ mimic-fn@^1.0.0: resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022" integrity sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ== -mimic-fn@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" - integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== - minimatch@^3.0.4: version "3.1.2" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" @@ -2777,15 +2634,6 @@ mute-stream@0.0.7: resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" integrity sha512-r65nCZhrbXXb6dXOACihYApHw2Q6pV0M3V0PSxd74N0+D8nzAdEAITq2oAjA1jVnKI+tGvEBUpqiMh0+rW6zDQ== -mz@^2.7.0: - version "2.7.0" - resolved "https://registry.yarnpkg.com/mz/-/mz-2.7.0.tgz#95008057a56cafadc2bc63dde7f9ff6955948e32" - integrity sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q== - dependencies: - any-promise "^1.0.0" - object-assign "^4.0.1" - thenify-all "^1.0.0" - nanoid@^3.3.7: version "3.3.7" resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.7.tgz#d0c301a691bc8d54efa0a2226ccf3fe2fd656bd8" @@ -2863,13 +2711,6 @@ npm-run-path@^2.0.0: dependencies: path-key "^2.0.0" -npm-run-path@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-4.0.1.tgz#b7ecd1e5ed53da8e37a55e1c2269e0b97ed748ea" - integrity sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw== - dependencies: - path-key "^3.0.0" - num2fraction@^1.2.2: version "1.2.2" resolved "https://registry.yarnpkg.com/num2fraction/-/num2fraction-1.2.2.tgz#6f682b6a027a4e9ddfa4564cd2589d1d4e669ede" @@ -2929,13 +2770,6 @@ onetime@^2.0.0: dependencies: mimic-fn "^1.0.0" -onetime@^5.1.2: - version "5.1.2" - resolved "https://registry.yarnpkg.com/onetime/-/onetime-5.1.2.tgz#d0e96ebb56b07476df1dd9c4806e5237985ca45e" - integrity sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg== - dependencies: - mimic-fn "^2.1.0" - ora@^3.2.0: version "3.4.0" resolved "https://registry.yarnpkg.com/ora/-/ora-3.4.0.tgz#bf0752491059a3ef3ed4c85097531de9fdbcd318" @@ -3003,7 +2837,7 @@ path-key@^2.0.0, path-key@^2.0.1: resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" integrity sha512-fEHGKCSmUSDPv4uoj8AlD+joPlq3peND+HRYyxFz4KPw4z926S/b8rIuFs2FYJg3BwsxJf6A9/3eIdLaYC+9Dw== -path-key@^3.0.0, path-key@^3.1.0: +path-key@^3.1.0: version "3.1.1" resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== @@ -3033,11 +2867,6 @@ path-type@^3.0.0: dependencies: pify "^3.0.0" -path-type@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" - integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw== - performance-now@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" @@ -3073,11 +2902,6 @@ pify@^3.0.0: resolved "https://registry.yarnpkg.com/pify/-/pify-3.0.0.tgz#e5a4acd2c101fdf3d9a4d07f0dbc4db49dd28176" integrity sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg== -pirates@^4.0.1: - version "4.0.6" - resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.6.tgz#3018ae32ecfcff6c29ba2267cbf21166ac1f36b9" - integrity sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg== - postcss-calc@^5.2.0: version "5.3.1" resolved "https://registry.yarnpkg.com/postcss-calc/-/postcss-calc-5.3.1.tgz#77bae7ca928ad85716e2fda42f261bf7c1d65b5e" @@ -3177,14 +3001,6 @@ postcss-load-config@^1.0.0-rc: postcss-load-options "^1.2.0" postcss-load-plugins "^2.3.0" -postcss-load-config@^4.0.1: - version "4.0.2" - resolved "https://registry.yarnpkg.com/postcss-load-config/-/postcss-load-config-4.0.2.tgz#7159dcf626118d33e299f485d6afe4aff7c4a3e3" - integrity sha512-bSVhyJGL00wMVoPUzAVAnbEoWyqRxkjv64tUl427SKnPrENtq6hJwUojroMz2VB+Q1edmi4IfrAPpami5VVgMQ== - dependencies: - lilconfig "^3.0.0" - yaml "^2.3.4" - postcss-load-options@^1.0.2, postcss-load-options@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/postcss-load-options/-/postcss-load-options-1.2.0.tgz#b098b1559ddac2df04bc0bb375f99a5cfe2b6d8c" @@ -3628,11 +3444,6 @@ resize-observer-polyfill@^1.5.0: resolved "https://registry.yarnpkg.com/resize-observer-polyfill/-/resize-observer-polyfill-1.5.1.tgz#0e9020dd3d21024458d4ebd27e23e40269810464" integrity sha512-LwZrotdHOo12nQuZlHEmtuXdqGoOD0OhaxopaNFxWzInpEgaLWoVuAMbTzixuosCx2nEG58ngzW3vxdWoxIgdg== -resolve-from@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-5.0.0.tgz#c35225843df8f776df21c57557bc087e9dfdfc69" - integrity sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw== - resolve@^1.1.7, resolve@^1.10.0: version "1.22.1" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.1.tgz#27cb2ebb53f91abb49470a928bba7558066ac177" @@ -3671,7 +3482,7 @@ rimraf@^5.0.5: dependencies: glob "^10.3.7" -rollup@^4.0.2, rollup@^4.2.0: +rollup@^4.2.0: version "4.9.6" resolved "https://registry.yarnpkg.com/rollup/-/rollup-4.9.6.tgz#4515facb0318ecca254a2ee1315e22e09efc50a0" integrity sha512-05lzkCS2uASX0CiLFybYfVkwNbKZG5NFQ6Go0VWyogFTXXbR039UVsegViTntkk4OglHBdF54ccApXRRuXRbsg== @@ -3861,7 +3672,7 @@ side-channel@^1.0.4: get-intrinsic "^1.0.2" object-inspect "^1.9.0" -signal-exit@^3.0.0, signal-exit@^3.0.2, signal-exit@^3.0.3: +signal-exit@^3.0.0, signal-exit@^3.0.2: version "3.0.7" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9" integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ== @@ -3871,11 +3682,6 @@ signal-exit@^4.0.1: resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-4.1.0.tgz#952188c1cbd546070e2dd20d0f41c0ae0530cb04" integrity sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw== -slash@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" - integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== - sort-keys@^1.0.0: version "1.1.2" resolved "https://registry.yarnpkg.com/sort-keys/-/sort-keys-1.1.2.tgz#441b6d4d346798f1b4e49e8920adfba0e543f9ad" @@ -3893,13 +3699,6 @@ source-map-js@^1.0.2: resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.0.2.tgz#adbc361d9c62df380125e7f161f71c826f1e490c" integrity sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw== -source-map@0.8.0-beta.0: - version "0.8.0-beta.0" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.8.0-beta.0.tgz#d4c1bb42c3f7ee925f005927ba10709e0d1d1f11" - integrity sha512-2ymg6oRBpebeZi9UUNsgQ89bhx01TcTkmNTGnNO88imTmbSgy4nfujrgVEFKWpMTEGA11EDkTt7mqObTPdigIA== - dependencies: - whatwg-url "^7.0.0" - source-map@^0.5.3, source-map@^0.5.6: version "0.5.7" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" @@ -4080,29 +3879,11 @@ strip-eof@^1.0.0: resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf" integrity sha512-7FCwGGmx8mD5xQd3RPUvnSpUXHM3BWuzjtpD4TXsfcZ9EL4azvVVUscFYwD9nx8Kh+uCBC00XBtAykoMHwTh8Q== -strip-final-newline@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-2.0.0.tgz#89b852fb2fcbe936f6f4b3187afb0a12c1ab58ad" - integrity sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA== - strip-json-comments@~2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" integrity sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ== -sucrase@^3.20.3: - version "3.35.0" - resolved "https://registry.yarnpkg.com/sucrase/-/sucrase-3.35.0.tgz#57f17a3d7e19b36d8995f06679d121be914ae263" - integrity sha512-8EbVDiu9iN/nESwxeSxDKe0dunta1GOlHufmSSXxMD2z2/tMZpDMpvXQGsc+ajGo8y2uYUmixaSRUc/QPoQ0GA== - dependencies: - "@jridgewell/gen-mapping" "^0.3.2" - commander "^4.0.0" - glob "^10.3.10" - lines-and-columns "^1.1.6" - mz "^2.7.0" - pirates "^4.0.1" - ts-interface-checker "^0.1.9" - supports-color@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" @@ -4147,20 +3928,6 @@ term-size@^1.2.0: dependencies: execa "^0.7.0" -thenify-all@^1.0.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/thenify-all/-/thenify-all-1.6.0.tgz#1a1918d402d8fc3f98fbf234db0bcc8cc10e9726" - integrity sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA== - dependencies: - thenify ">= 3.1.0 < 4" - -"thenify@>= 3.1.0 < 4": - version "3.3.1" - resolved "https://registry.yarnpkg.com/thenify/-/thenify-3.3.1.tgz#8932e686a4066038a016dd9e2ca46add9838a95f" - integrity sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw== - dependencies: - any-promise "^1.0.0" - throttle-debounce@^1.0.1: version "1.1.0" resolved "https://registry.yarnpkg.com/throttle-debounce/-/throttle-debounce-1.1.0.tgz#51853da37be68a155cb6e827b3514a3c422e89cd" @@ -4215,48 +3982,11 @@ tough-cookie@^2.3.3, tough-cookie@~2.5.0: psl "^1.1.28" punycode "^2.1.1" -tr46@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/tr46/-/tr46-1.0.1.tgz#a8b13fd6bfd2489519674ccde55ba3693b706d09" - integrity sha512-dTpowEjclQ7Kgx5SdBkqRzVhERQXov8/l9Ft9dVM9fmg0W0KQSVaXX9T4i6twCPNtYiZM53lpSSUAwJbFPOHxA== - dependencies: - punycode "^2.1.0" - -tree-kill@^1.2.2: - version "1.2.2" - resolved "https://registry.yarnpkg.com/tree-kill/-/tree-kill-1.2.2.tgz#4ca09a9092c88b73a7cdc5e8a01b507b0790a0cc" - integrity sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A== - -ts-interface-checker@^0.1.9: - version "0.1.13" - resolved "https://registry.yarnpkg.com/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz#784fd3d679722bc103b1b4b8030bcddb5db2a699" - integrity sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA== - tslib@^1.9.0: version "1.14.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== -tsup@^8.0.1: - version "8.0.1" - resolved "https://registry.yarnpkg.com/tsup/-/tsup-8.0.1.tgz#04a0170f7bbe77e81da3b53006b0a40282291833" - integrity sha512-hvW7gUSG96j53ZTSlT4j/KL0q1Q2l6TqGBFc6/mu/L46IoNWqLLUzLRLP1R8Q7xrJTmkDxxDoojV5uCVs1sVOg== - dependencies: - bundle-require "^4.0.0" - cac "^6.7.12" - chokidar "^3.5.1" - debug "^4.3.1" - esbuild "^0.19.2" - execa "^5.0.0" - globby "^11.0.3" - joycon "^3.0.1" - postcss-load-config "^4.0.1" - resolve-from "^5.0.0" - rollup "^4.0.2" - source-map "0.8.0-beta.0" - sucrase "^3.20.3" - tree-kill "^1.2.2" - tunnel-agent@^0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd" @@ -4555,11 +4285,6 @@ wcwidth@^1.0.1: dependencies: defaults "^1.0.3" -webidl-conversions@^4.0.2: - version "4.0.2" - resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-4.0.2.tgz#a855980b1f0b6b359ba1d5d9fb39ae941faa63ad" - integrity sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg== - webpack-sources@^3.2.3: version "3.2.3" resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-3.2.3.tgz#2d4daab8451fd4b240cc27055ff6a0c2ccea0cde" @@ -4570,15 +4295,6 @@ webpack-virtual-modules@^0.6.1: resolved "https://registry.yarnpkg.com/webpack-virtual-modules/-/webpack-virtual-modules-0.6.1.tgz#ac6fdb9c5adb8caecd82ec241c9631b7a3681b6f" integrity sha512-poXpCylU7ExuvZK8z+On3kX+S8o/2dQ/SVYueKA0D4WEMXROXgY8Ez50/bQEUmvoSMMrWcrJqCHuhAbsiwg7Dg== -whatwg-url@^7.0.0: - version "7.1.0" - resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-7.1.0.tgz#c2c492f1eca612988efd3d2266be1b9fc6170d06" - integrity sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg== - dependencies: - lodash.sortby "^4.7.0" - tr46 "^1.0.1" - webidl-conversions "^4.0.2" - whet.extend@~0.9.9: version "0.9.9" resolved "https://registry.yarnpkg.com/whet.extend/-/whet.extend-0.9.9.tgz#f877d5bf648c97e5aa542fadc16d6a259b9c11a1" @@ -4670,8 +4386,3 @@ yallist@^2.1.2: version "2.1.2" resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52" integrity sha512-ncTzHV7NvsQZkYe1DW7cbDLm0YpzHmZF5r/iyP3ZnQtMiJ+pjzisCiMNI+Sj+xQF5pXhSHxSB3uDbsBTzY/c2A== - -yaml@^2.3.4: - version "2.3.4" - resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.3.4.tgz#53fc1d514be80aabf386dc6001eb29bf3b7523b2" - integrity sha512-8aAvwVUSHpfEqTQ4w/KMlf3HcRdt50E5ODIQJBw1fQ5RL34xabzxtUlzTXVqc4rkZsPbvrXKWnABCD7kWSmocA== From 2b56f09e1ea699928385001ecc2f71e9bfd362ce Mon Sep 17 00:00:00 2001 From: Joabesv Date: Thu, 15 Feb 2024 00:17:29 -0300 Subject: [PATCH 12/21] feat: build some necessary files --- package.json | 6 +++--- tasks/prepare.js | 10 +++++++++- vite.config.files.js | 37 +++++++++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+), 4 deletions(-) create mode 100644 vite.config.files.js diff --git a/package.json b/package.json index 8297768..279b3f7 100644 --- a/package.json +++ b/package.json @@ -10,17 +10,17 @@ "dev:background": "yarn build:background --mode dev", "dev:web": "vite", "dev:js": "yarn run build:js --mode dev", + "dev:general": "yarn run build:general --mode dev", "build": "NODE_ENV=prod run-s clear build:web build:prepare build:background build:js", "build:prepare": "node tasks/prepare.js", "build:background": "vite build --config vite.config.background.js", "build:web": "vite build", "build:js": "vite build --config vite.config.content.js", + "build:general": "vite build --config vite.config.files.js", "clear": "rimraf --glob extension/dist extension/manifest.json extension.*" }, "standard": { - "globals": [ - "chrome" - ] + "globals": ["chrome"] }, "devDependencies": { "@vitejs/plugin-vue2": "^2.3.1", diff --git a/tasks/prepare.js b/tasks/prepare.js index cff5503..0702ed7 100644 --- a/tasks/prepare.js +++ b/tasks/prepare.js @@ -1,7 +1,8 @@ import { watch } from "chokidar"; -import { mkdir, readFile, writeFile } from "node:fs/promises"; +import { cp, mkdir, readFile, writeFile } from "node:fs/promises"; import { execSync } from "node:child_process"; import { existsSync } from "node:fs"; +import { resolve } from "node:path"; import { logger, PORT, isDev, resolvePath } from "./utils.js"; const ensureDir = async (dir) => { @@ -10,6 +11,12 @@ const ensureDir = async (dir) => { } }; +async function moveHTMLAssets() { + await cp(resolve("src/pages"), resolve("extension/dist/pages"), { + recursive: true, + }); +} + // generate stub index.html files for dev entry async function stubHtml() { const views = ["Popup"]; @@ -45,6 +52,7 @@ function writeManifest() { } writeManifest(); +await moveHTMLAssets(); if (isDev) { stubHtml(); diff --git a/vite.config.files.js b/vite.config.files.js new file mode 100644 index 0000000..c247e7b --- /dev/null +++ b/vite.config.files.js @@ -0,0 +1,37 @@ +import { defineConfig } from "vite"; +import { sharedViteConfig } from "./vite.config"; +import packageJson from "./package.json" with { type: "json" }; +import { resolvePath, isDev } from "./tasks/utils"; + +// bundling the content script using Vite +export default defineConfig({ + ...sharedViteConfig, + define: { + __DEV__: isDev, + __NAME__: JSON.stringify(packageJson.name), + // vite need those envs to be json parsable (i dont know why) + "process.env.NODE_ENV": JSON.stringify(isDev ? "dev" : "prod"), + }, + build: { + watch: isDev ? {} : undefined, + outDir: resolvePath("extension/dist/lib"), + cssCodeSplit: false, + emptyOutDir: false, + sourcemap: isDev ? "inline" : false, + lib: { + name: packageJson.name, + entry: [ + resolvePath("src/lib/init.cjs"), + resolvePath("src/lib/xdLocalStorage.min.cjs"), + resolvePath("src/lib/xdLocalStoragePostMessageApi.min.cjs"), + ], + formats: ["cjs"], + }, + rollupOptions: { + output: { + entryFileNames: "[name].js", + extend: true, + }, + }, + }, +}); From fb5db3aaa7504036e589c70a02d76698d4007911 Mon Sep 17 00:00:00 2001 From: Joabesv Date: Thu, 15 Feb 2024 00:23:02 -0300 Subject: [PATCH 13/21] chore: move static html files to extension --- {src => extension}/pages/iframe.html | 0 {src => extension}/pages/matricula/corte.html | 0 .../pages/matricula/fragments/matriculasNumber.html | 0 .../pages/matricula/fragments/professorPopover.html | 0 tasks/prepare.js | 12 ++++++------ 5 files changed, 6 insertions(+), 6 deletions(-) rename {src => extension}/pages/iframe.html (100%) rename {src => extension}/pages/matricula/corte.html (100%) rename {src => extension}/pages/matricula/fragments/matriculasNumber.html (100%) rename {src => extension}/pages/matricula/fragments/professorPopover.html (100%) diff --git a/src/pages/iframe.html b/extension/pages/iframe.html similarity index 100% rename from src/pages/iframe.html rename to extension/pages/iframe.html diff --git a/src/pages/matricula/corte.html b/extension/pages/matricula/corte.html similarity index 100% rename from src/pages/matricula/corte.html rename to extension/pages/matricula/corte.html diff --git a/src/pages/matricula/fragments/matriculasNumber.html b/extension/pages/matricula/fragments/matriculasNumber.html similarity index 100% rename from src/pages/matricula/fragments/matriculasNumber.html rename to extension/pages/matricula/fragments/matriculasNumber.html diff --git a/src/pages/matricula/fragments/professorPopover.html b/extension/pages/matricula/fragments/professorPopover.html similarity index 100% rename from src/pages/matricula/fragments/professorPopover.html rename to extension/pages/matricula/fragments/professorPopover.html diff --git a/tasks/prepare.js b/tasks/prepare.js index 0702ed7..808f34c 100644 --- a/tasks/prepare.js +++ b/tasks/prepare.js @@ -11,11 +11,11 @@ const ensureDir = async (dir) => { } }; -async function moveHTMLAssets() { - await cp(resolve("src/pages"), resolve("extension/dist/pages"), { - recursive: true, - }); -} +// async function moveHTMLAssets() { +// await cp(resolve("src/pages"), resolve("extension/dist/pages"), { +// recursive: true, +// }); +// } // generate stub index.html files for dev entry async function stubHtml() { @@ -52,7 +52,7 @@ function writeManifest() { } writeManifest(); -await moveHTMLAssets(); +// await moveHTMLAssets(); if (isDev) { stubHtml(); From 08febb7db70960cc7d2c879d62c6d1906411857b Mon Sep 17 00:00:00 2001 From: Joabesv Date: Sat, 17 Feb 2024 16:33:47 -0300 Subject: [PATCH 14/21] wip: matriculas component --- package.json | 3 - src/scripts/contentScriptPortal.js | 28 +++---- src/scripts/contentscript.js | 71 ++++++++++------ .../contentscripts/views/Matricula.vue | 84 +++++++++++++++++++ src/views/Matricula.vue | 18 ++-- 5 files changed, 149 insertions(+), 55 deletions(-) create mode 100644 src/scripts/contentscripts/views/Matricula.vue diff --git a/package.json b/package.json index 279b3f7..3d3f2eb 100644 --- a/package.json +++ b/package.json @@ -19,9 +19,6 @@ "build:general": "vite build --config vite.config.files.js", "clear": "rimraf --glob extension/dist extension/manifest.json extension.*" }, - "standard": { - "globals": ["chrome"] - }, "devDependencies": { "@vitejs/plugin-vue2": "^2.3.1", "chokidar": "^3.6.0", diff --git a/src/scripts/contentScriptPortal.js b/src/scripts/contentScriptPortal.js index dd90b4e..9fdea45 100644 --- a/src/scripts/contentScriptPortal.js +++ b/src/scripts/contentScriptPortal.js @@ -15,7 +15,7 @@ const toast = new Toastify({ text: `

Atualizando suas informações...

\n\n NÃO SAIA DESSA PÁGINA, @@ -44,19 +44,19 @@ if (isPortalAluno) { anchor.setAttribute("id", "app"); document.body.append(anchor); - extensionUtils.injectStyle("styles/portal.css"); + extensionUtils.injectStyle("./style.css"); toastr.info( - "Clique em Ficha Individual para atualizar suas informações!" + "Clique em Ficha Individual para atualizar suas informações!", ); } else if (isFichasIndividuais) { - extensionUtils.injectStyle("styles/portal.css"); + // extensionUtils.injectStyle("styles/portal.css"); toast.showToast(); iterateTabelaCursosAndSaveToLocalStorage(); } else if (isStudentFicha) { - extensionUtils.injectStyle("styles/portal.css"); + // extensionUtils.injectStyle("styles/portal.css"); } function iterateTabelaCursosAndSaveToLocalStorage() { @@ -98,7 +98,7 @@ async function getFichaAluno(fichaAlunoUrl, nomeDoCurso, anoDaGrade) { const ra = /.*?(\d+).*/g.exec( - ficha_obj.find("#page").children("p")[2].innerText + ficha_obj.find("#page").children("p")[2].innerText, )[1] || "some ra"; const storageRA = "ufabc-extension-ra-" + getEmailAluno(); @@ -108,32 +108,32 @@ async function getFichaAluno(fichaAlunoUrl, nomeDoCurso, anoDaGrade) { "https://aluno.ufabc.edu.br" + fichaAlunoUrl, { timeout: 60 * 1 * 1000, // 1 minute - } + }, ); const disciplinasCategory = ficha_obj.find( - ".quantidades:last-child tbody tr td" + ".quantidades:last-child tbody tr td", ); // free const totalCreditsCoursedFree = toNumber(disciplinasCategory[2]); const totalPercentageCoursedFree = toNumber(disciplinasCategory[3]); const totalCreditsFree = Math.round( - (totalCreditsCoursedFree * 100) / totalPercentageCoursedFree + (totalCreditsCoursedFree * 100) / totalPercentageCoursedFree, ); // mandatory const totalCreditsCoursedMandatory = toNumber(disciplinasCategory[7]); const totalPercentageCoursedMandatory = toNumber(disciplinasCategory[8]); const totalCreditsMandatory = Math.round( - (totalCreditsCoursedMandatory * 100) / totalPercentageCoursedMandatory + (totalCreditsCoursedMandatory * 100) / totalPercentageCoursedMandatory, ); // limited const totalCreditsCoursedLimited = toNumber(disciplinasCategory[12]); const totalPercentageCoursedLimited = toNumber(disciplinasCategory[13]); const totalCreditsLimited = Math.round( - (totalCreditsCoursedLimited * 100) / totalPercentageCoursedLimited + (totalCreditsCoursedLimited * 100) / totalPercentageCoursedLimited, ); await nextApi.post( @@ -153,7 +153,7 @@ async function getFichaAluno(fichaAlunoUrl, nomeDoCurso, anoDaGrade) { }, { timeout: 60 * 1 * 1000, // 1 minute - } + }, ); curso.ra = ra; @@ -171,7 +171,7 @@ async function getFichaAluno(fichaAlunoUrl, nomeDoCurso, anoDaGrade) { text: `
Não foi possível salvar seus dados, recarregue a página e aguarde.
`, @@ -216,7 +216,7 @@ async function saveToLocalStorage(curso) { `Suas informações foram salvas! Disciplinas do curso do ${curso.curso} para o usuário ${getEmailAluno()}. `, - { timeout: 100000 } + { timeout: 100000 }, ); } diff --git a/src/scripts/contentscript.js b/src/scripts/contentscript.js index 3be7503..d5e9601 100644 --- a/src/scripts/contentscript.js +++ b/src/scripts/contentscript.js @@ -1,5 +1,6 @@ import $ from "jquery"; import _ from "lodash"; +import Vue from "vue"; // CSS imports import "element-ui/lib/theme-chalk/index.css"; @@ -9,6 +10,7 @@ import { ufabcMatricula } from "../services/UFABCMatricula"; import { setupStorage } from "../utils/setupStorage"; import { extensionUtils } from "../utils/extensionUtils"; import { NextStorage } from "../services/NextStorage"; +import Matricula from "./contentscripts/views/Matricula.vue"; const isBrowser = typeof chrome != "undefined" && !!chrome.storage; @@ -46,13 +48,14 @@ async function load() { const INJECT_CONTENT_DELAY = 1_500; const currentUrl = new URL(document.location.href); const shouldExecuteScript = matriculasURL.some( - (url) => `${currentUrl.hostname}${currentUrl.pathname}` === url + (url) => `${currentUrl.hostname}${currentUrl.pathname}` === url, ); // add cross-domain local storage + extensionUtils.injectScript("lib/init.js"); extensionUtils.injectScript("lib/xdLocalStorage.min.js"); + extensionUtils.injectIframe("pages/iframe.html"); - extensionUtils.injectScript("lib/init.js"); setupStorage(); await import("./contentScriptPortal"); @@ -74,35 +77,53 @@ async function load() { // this is the main vue app // i.e, where all the filters live - const anchor = document.createElement("div"); - anchor.setAttribute("id", "app"); - $("#meio").prepend(anchor); + const container = document.createElement("div"); + container.id = __NAME__; + const root = document.createElement("div"); + const styleEl = document.createElement("link"); + const shadowDOM = + container.attachShadow?.({ mode: __DEV__ ? "open" : "closed" }) || + container; + styleEl.setAttribute("rel", "stylesheet"); + styleEl.setAttribute("href", chrome.runtime.getURL("dist/style.css")); + shadowDOM.appendChild(styleEl); + shadowDOM.appendChild(root); + + container.setAttribute("id", "app"); + $("#meio").prepend(container); + new Vue({ + el: "#app", + data: { + name: "popup-next-extension", + }, + render: (h) => h(Matricula), + }); //inject styles - extensionUtils.injectStyle("styles/main.css"); + // extensionUtils.injectStyle("./style.css"); // manda as informacoes para o servidor ufabcMatricula.sendAlunoData(); - // load vue app modal - const modal = document.createElement("div"); - modal.setAttribute("id", "modal"); - modal.setAttribute("data-app", true); - document.body.append(modal); - - // load vue app teacherReview - const teacherReview = document.createElement("div"); - teacherReview.setAttribute("id", "teacherReview"); - teacherReview.setAttribute("data-app", true); - document.body.append(teacherReview); - - // load vue app review subjects - const reviewSubject = document.createElement("div"); - reviewSubject.setAttribute("id", "review-subject"); - reviewSubject.setAttribute("data-app", true); - document.body.append(reviewSubject); - - // inject Vue app + // // load vue app modal + // const modal = document.createElement("div"); + // modal.setAttribute("id", "modal"); + // modal.setAttribute("data-app", true); + // document.body.append(modal); + + // // load vue app teacherReview + // const teacherReview = document.createElement("div"); + // teacherReview.setAttribute("id", "teacherReview"); + // teacherReview.setAttribute("data-app", true); + // document.body.append(teacherReview); + + // // load vue app review subjects + // const reviewSubject = document.createElement("div"); + // reviewSubject.setAttribute("id", "review-subject"); + // reviewSubject.setAttribute("data-app", true); + // document.body.append(reviewSubject); + + // // inject Vue app extensionUtils.injectScript("scripts/main.js"); }, INJECT_CONTENT_DELAY); } diff --git a/src/scripts/contentscripts/views/Matricula.vue b/src/scripts/contentscripts/views/Matricula.vue new file mode 100644 index 0000000..afdea58 --- /dev/null +++ b/src/scripts/contentscripts/views/Matricula.vue @@ -0,0 +1,84 @@ + + + + + diff --git a/src/views/Matricula.vue b/src/views/Matricula.vue index 4b24199..56cffbe 100644 --- a/src/views/Matricula.vue +++ b/src/views/Matricula.vue @@ -88,6 +88,7 @@
+ + Next Storage diff --git a/src/lib/init.cjs b/src/lib/init.cjs index 1d6267c..f7f58c3 100644 --- a/src/lib/init.cjs +++ b/src/lib/init.cjs @@ -1,6 +1,6 @@ import { extensionUtils } from "../utils/extensionUtils"; -xdLocalStorage.init({ +window.xdLocalStorage.init({ /* required */ iframeUrl: extensionUtils.extensionURL("pages/iframe.html"), //an option function to be called right after the iframe was loaded and ready for action diff --git a/src/manifest.js b/src/manifest.js index eda2183..cbf1a4a 100644 --- a/src/manifest.js +++ b/src/manifest.js @@ -1,5 +1,5 @@ import pkg from "../package.json" with { type: "json" }; -import { isDev } from "../tasks/utils.js"; +import { isDev, PORT } from "../tasks/utils.js"; export async function getManifest() { // update this file to update this manifest.json @@ -58,7 +58,7 @@ export async function getManifest() { }, content_security_policy: { extension_pages: isDev - ? `script-src 'self' http://localhost:${port}; object-src 'self'` + ? `script-src 'self' http://localhost:${PORT}; object-src 'self'` : "script-src 'self'; object-src 'self'", }, web_accessible_resources: [ From 54443cf273a251b50cec50464762e46c8f7a8513 Mon Sep 17 00:00:00 2001 From: Joabesv Date: Wed, 21 Feb 2024 23:12:57 -0300 Subject: [PATCH 20/21] fix: insert of iframe --- src/lib/init.cjs | 2 +- src/scripts/contentscript.js | 22 +++++++++++----------- src/utils/extensionUtils.js | 6 ++---- 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/src/lib/init.cjs b/src/lib/init.cjs index f7f58c3..cafad90 100644 --- a/src/lib/init.cjs +++ b/src/lib/init.cjs @@ -1,4 +1,4 @@ -import { extensionUtils } from "../utils/extensionUtils"; +import { extensionUtils } from "@/utils/extensionUtils"; window.xdLocalStorage.init({ /* required */ diff --git a/src/scripts/contentscript.js b/src/scripts/contentscript.js index d5e9601..c928c79 100644 --- a/src/scripts/contentscript.js +++ b/src/scripts/contentscript.js @@ -6,10 +6,10 @@ import Vue from "vue"; import "element-ui/lib/theme-chalk/index.css"; import "vuetify/dist/vuetify.min.css"; -import { ufabcMatricula } from "../services/UFABCMatricula"; -import { setupStorage } from "../utils/setupStorage"; -import { extensionUtils } from "../utils/extensionUtils"; -import { NextStorage } from "../services/NextStorage"; +import { ufabcMatricula } from "@/services/UFABCMatricula"; +import { NextStorage } from "@/services/NextStorage"; +import { setupStorage } from "@/utils/setupStorage"; +import { extensionUtils } from "@/utils/extensionUtils"; import Matricula from "./contentscripts/views/Matricula.vue"; const isBrowser = typeof chrome != "undefined" && !!chrome.storage; @@ -52,10 +52,9 @@ async function load() { ); // add cross-domain local storage - extensionUtils.injectScript("lib/init.js"); - extensionUtils.injectScript("lib/xdLocalStorage.min.js"); - + extensionUtils.injectScript("dist/lib/xdLocalStorage.min.js"); extensionUtils.injectIframe("pages/iframe.html"); + extensionUtils.injectScript("dist/lib/init.js"); setupStorage(); await import("./contentScriptPortal"); @@ -80,13 +79,14 @@ async function load() { const container = document.createElement("div"); container.id = __NAME__; const root = document.createElement("div"); - const styleEl = document.createElement("link"); + const shadowDOM = container.attachShadow?.({ mode: __DEV__ ? "open" : "closed" }) || container; - styleEl.setAttribute("rel", "stylesheet"); - styleEl.setAttribute("href", chrome.runtime.getURL("dist/style.css")); - shadowDOM.appendChild(styleEl); + + shadowDOM.appendChild( + extensionUtils.injectStyle("dist/contentScripts/style.css"), + ); shadowDOM.appendChild(root); container.setAttribute("id", "app"); diff --git a/src/utils/extensionUtils.js b/src/utils/extensionUtils.js index d949a4b..b7111c5 100644 --- a/src/utils/extensionUtils.js +++ b/src/utils/extensionUtils.js @@ -3,16 +3,14 @@ import is from "is_js"; class ExtensionUtils { IS_BROWSER = typeof chrome !== "undefined" && !!chrome.storage; - #EXTENSION_ID = this.IS_BROWSER - ? chrome.i18n.getMessage("@@extension_id") - : null; + #EXTENSION_ID = this.IS_BROWSER ? chrome.runtime.id : null; extensionURL(link) { if (this.#EXTENSION_ID) { const prefix = is.chrome() ? "chrome-extension://" : "moz-extension://"; return `${prefix}${this.#EXTENSION_ID}/${link.replace(/^\//, "")}`; } else { - // fallback in case we cant detect the browser + // this fallback is necessary because of the `src/lib` return `https://next-extension.captain.sv.ufabcnext.com/static/${link}`; } } From 49826a9064cb7d4a230c13b4daa37cb5d45a8d85 Mon Sep 17 00:00:00 2001 From: Joabesv Date: Thu, 22 Feb 2024 09:21:10 -0300 Subject: [PATCH 21/21] refac: script portal --- src/scripts/contentScriptPortal.js | 160 ++++++++++++++++------------- 1 file changed, 88 insertions(+), 72 deletions(-) diff --git a/src/scripts/contentScriptPortal.js b/src/scripts/contentScriptPortal.js index 13b6e40..1011180 100644 --- a/src/scripts/contentScriptPortal.js +++ b/src/scripts/contentScriptPortal.js @@ -53,7 +53,6 @@ if (isPortalAluno) { ); } else if (isFichasIndividuais) { extensionUtils.injectStyle("dist/contentScripts/style.css"); - toast.showToast(); iterateTabelaCursosAndSaveToLocalStorage(); @@ -62,21 +61,27 @@ if (isPortalAluno) { } function iterateTabelaCursosAndSaveToLocalStorage() { - var tabelaCursos = $("tbody").children().slice(1); + const tabelaCursos = $("tbody").children().slice(1); let count = 0; tabelaCursos.each(async function () { - var linhaCurso = $(this).children(); + const linhaCurso = $(this).children(); + + const coursename = $(linhaCurso[0]).children("a").text(); + const fichaAlunoURL = $(linhaCurso[1]).children("a").attr("href"); + const gradeYear = $(linhaCurso[2]).text(); - var nomeDoCurso = $(linhaCurso[0]).children("a").text(); - var fichaAlunoUrl = $(linhaCurso[1]).children("a").attr("href"); - var anoDaGrade = $(linhaCurso[2]).text(); + const curso = await getFichaAluno(fichaAlunoURL, coursename, fichaAlunoURL); + console.log(curso); + if (count === 0) { + toast.hideToast(); + } - const curso = await getFichaAluno(fichaAlunoUrl, nomeDoCurso, anoDaGrade); - if (count == 0) toast.hideToast(); count++; - if (!curso) return; + if (!curso) { + return; + } curso.curso = linhaCurso[0].innerText.replace("Novo", ""); curso.turno = linhaCurso[3].innerText; @@ -88,32 +93,38 @@ function iterateTabelaCursosAndSaveToLocalStorage() { } async function getFichaAluno(fichaAlunoUrl, nomeDoCurso, anoDaGrade) { + const STUDENT_FICHA_TIMEOUT = 60 * 1000; try { - var curso = {}; - var ficha_url = fichaAlunoUrl.replace(".json", ""); + const curso = {}; + const ficha_url = fichaAlunoUrl.replace(".json", ""); - const ficha = await Axios.get("https://aluno.ufabc.edu.br" + ficha_url, { - timeout: 60 * 1 * 1000, // 1 minute - }); - const ficha_obj = $($.parseHTML(ficha.data)); - const info = ficha_obj.find(".coeficientes tbody tr td"); + const { data: ficha } = await Axios.get( + `https://aluno.ufabc.edu.br${ficha_url}`, + { + timeout: STUDENT_FICHA_TIMEOUT, + }, + ); + + const parsedStudentFicha = $($.parseHTML(ficha)); - const ra = - /.*?(\d+).*/g.exec( - ficha_obj.find("#page").children("p")[2].innerText, - )[1] || "some ra"; + const info = parsedStudentFicha.find(".coeficientes tbody tr td"); + const rawStudentCourseAndRa = parsedStudentFicha + .find("#page") + .children("p")[2].innerText; - const storageRA = "ufabc-extension-ra-" + getEmailAluno(); + const [, ra] = /.*?(\d+).*/g.exec(rawStudentCourseAndRa); + + const storageRA = `ufabc-extension-ra-${emailAluno()}`; await NextStorage.setItem(storageRA, ra); - const jsonFicha = await Axios.get( - "https://aluno.ufabc.edu.br" + fichaAlunoUrl, + const { data: jsonFicha } = await Axios.get( + `https://aluno.ufabc.edu.br${fichaAlunoUrl}`, { - timeout: 60 * 1 * 1000, // 1 minute + timeout: STUDENT_FICHA_TIMEOUT, }, ); - const disciplinasCategory = ficha_obj.find( + const disciplinasCategory = parsedStudentFicha.find( ".quantidades:last-child tbody tr td", ); @@ -138,37 +149,35 @@ async function getFichaAluno(fichaAlunoUrl, nomeDoCurso, anoDaGrade) { (totalCreditsCoursedLimited * 100) / totalPercentageCoursedLimited, ); - await nextApi.post( - "/histories", - { - ra: ra, - disciplinas: jsonFicha.data, - curso: nomeDoCurso, - grade: anoDaGrade, - - // credits total - mandatory_credits_number: totalCreditsMandatory, - limited_credits_number: totalCreditsLimited, - free_credits_number: totalCreditsFree, - credits_total: - totalCreditsMandatory + totalCreditsLimited + totalCreditsFree, - }, - { - timeout: 60 * 1 * 1000, // 1 minute - }, - ); + const userHistory = { + ra, + disciplinas: jsonFicha, + curso: nomeDoCurso, + grade: anoDaGrade, + + // credits total + mandatory_credits_number: totalCreditsMandatory, + limited_credits_number: totalCreditsLimited, + free_credits_number: totalCreditsFree, + credits_total: + totalCreditsMandatory + totalCreditsLimited + totalCreditsFree, + }; + + await nextApi.post("/histories", userHistory, { + timeout: STUDENT_FICHA_TIMEOUT, + }); curso.ra = ra; curso.cp = toNumber(info[0]); curso.cr = toNumber(info[1]); curso.ca = toNumber(info[2]); - curso.quads = ficha_obj.find(".ano_periodo").length; + curso.quads = parsedStudentFicha.find(".ano_periodo").length; - curso.cursadas = jsonFicha.data; + curso.cursadas = jsonFicha; return curso; } catch (err) { - console.log(err); + console.error("some bad happened", err); Toastify({ text: `
@@ -190,56 +199,63 @@ async function getFichaAluno(fichaAlunoUrl, nomeDoCurso, anoDaGrade) { } } -function getEmailAluno() { - return $("#top li") - .last() - .text() - .replace(/\s*/, "") - .split("|")[0] - .replace(" ", "") - .toLowerCase(); -} - -function toNumber(el) { - return parseFloat(el.innerText.replace(",", ".")); -} - async function saveToLocalStorage(curso) { - const storageUser = "ufabc-extension-" + getEmailAluno(); + const storageUser = `ufabc-extension-${emailAluno()}`; let user = await NextStorage.getItem(storageUser); - if (!user || _.isEmpty(user)) user = []; + + if (!user || _.isEmpty(user)) { + user = []; + } user.push(curso); + user = _.uniqBy(user, "curso"); await NextStorage.setItem(storageUser, user); + const SUCCESS_TOAST_TTL = 100000; + toastr.success( `Suas informações foram salvas! Disciplinas do curso do ${curso.curso} - para o usuário ${getEmailAluno()}. + para o usuário ${emailAluno()}. `, - { timeout: 100000 }, + { timeout: SUCCESS_TOAST_TTL }, ); } async function saveStudentsToLocalStorage(curso) { - const storageUser = "ufabc-extension-" + getEmailAluno(); + const storageUser = `ufabc-extension-${emailAluno()}`; const cursos = await NextStorage.getItem(storageUser); - const ra = (curso && curso.ra) || null; + const ra = curso?.ra || null; let allSavedStudents = []; const students = await NextStorage.getItem("ufabc-extension-students"); - if (students && students.length) { + if (students?.length) { allSavedStudents.push(...students); } - allSavedStudents = allSavedStudents.filter((student) => student.ra != ra); + allSavedStudents = allSavedStudents.filter((student) => student.ra !== ra); const student = { - cursos: cursos, - ra: ra, - name: getEmailAluno(), + cursos, + ra, + name: emailAluno(), lastUpdate: Date.now(), }; + allSavedStudents.unshift(student); await NextStorage.setItem("ufabc-extension-students", allSavedStudents); } + +function toNumber(el) { + return parseFloat(el.innerText.replace(",", ".")); +} + +function emailAluno() { + const alunoUFABCHTMLHeader = $("#top li").last(); + const [rawAlunoLoginName] = alunoUFABCHTMLHeader + .text() + .replace(/\s*/, "") + .split("|"); + const alunoLoginName = rawAlunoLoginName.replace(" ", "").toLowerCase(); + return alunoLoginName; +}