Skip to content

Commit

Permalink
Much faster startup
Browse files Browse the repository at this point in the history
  • Loading branch information
Bill13579 committed Sep 5, 2024
1 parent 887785f commit 9a4e773
Show file tree
Hide file tree
Showing 9 changed files with 567 additions and 2,206 deletions.
1 change: 1 addition & 0 deletions chrome.webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,5 @@ module.exports = {
// syncWebAssembly: true,
topLevelAwait: true,
},
cache: false,
};
2,718 changes: 541 additions & 2,177 deletions package-lock.json

Large diffs are not rendered by default.

11 changes: 4 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,16 @@
"private": true,
"scripts": {
"build:cartographer": "cd cartographer && wasm-pack build && cd ..",

"gen-manifest:chrome": "node gen-manifest.js chrome",
"gen-manifest:webext": "node gen-manifest.js webext",
"gen-manifest:firefox": "npm run gen-manifest:webext",

"build:chrome": "npm run build:cartographer && webpack --config chrome.webpack.config.js && npm run gen-manifest:chrome",
"build:chrome.dev": "npm run build:cartographer && webpack --config chrome.webpack.dev.config.js && npm run gen-manifest:chrome",
"build:webext": "npm run build:cartographer && webpack --config webext.webpack.config.js && npm run gen-manifest:webext",
"build:webext.dev": "npm run build:cartographer && webpack --config webext.webpack.dev.config.js && npm run gen-manifest:webext",
"build:firefox": "npm run build:webext",
"build:firefox.dev": "npm run build:webext.dev",

"build:v2-compat": "node build-v2-compat",

"clean:background": "rimraf dist/background/background.js* dist/background/captureTab.js* dist/background/commands.js* dist/background/tmpClear.js*",
"clean:content": "rimraf dist/content/content.js*",
"clean:options": "rimraf dist/options/options.js*",
Expand All @@ -43,14 +39,15 @@
"eslint": "^8.34.0",
"rimraf": "^3.0.2",
"webextension-polyfill": "^0.10.0",
"webpack": "^5.75.0",
"webpack-cli": "^5.0.1"
"webpack": "^5.94.0",
"webpack-cli": "^5.1.4"
},
"dependencies": {
"dompurify": "^3.0.1",
"get-favicons": "github:Bill13579/get-favicons",
"marked": "^4.2.12",
"proxy-polyfill": "^0.3.2",
"smoothscroll-polyfill": "^0.4.4"
"smoothscroll-polyfill": "^0.4.4",
"tabby": "file:"
}
}
4 changes: 2 additions & 2 deletions src/background/captureTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
* Capture various information about the tab (e.g. captureTab screenshot, indexing for full-text search)
*/

import "Polyfill"
import "Polyfill";
import { TTabActions } from "../tapi/taction";
import { callContentScript } from "../tapi/content";
import { $localtmp$ } from "../tapi/store";
import { greet, index, init_shard, parse_query, query, shard_doc, shard_uninitialized, unindex, unshard_doc, update_stats } from "../../cartographer/pkg/cartographer";
import { index, init_shard, parse_query, query, shard_doc, shard_uninitialized, unindex, unshard_doc, update_stats } from "../../cartographer/pkg/cartographer";

let _captureTabAbortController;

Expand Down
4 changes: 2 additions & 2 deletions src/background/commands.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import "Polyfill"
import "Polyfill";
import { $local$ } from "../tapi/store";
import { StorageSpacePersistentObject } from "../tapi/storeobj";

import { TTabActions, TWindowActions } from "../tapi/taction"
import { TTabActions, TWindowActions } from "../tapi/taction";
import { closeTabby, cycleLayout, LAYOUT_POPUP, openTabby } from "./exports";

// For tracking the tab and window last selected by the user
Expand Down
8 changes: 4 additions & 4 deletions src/background/exports.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import "Polyfill"
import "Polyfill";

import { $local$ } from "../tapi/store"
import { resolveDefault } from "../options/exports"
import { TTabActions, TWindowActions } from "../tapi/taction"
import { $local$ } from "../tapi/store";
import { resolveDefault } from "../options/exports";
import { TTabActions, TWindowActions } from "../tapi/taction";

export const LAYOUT_POPUP = "popup";
export const LAYOUT_STANDALONE = "standalone";
Expand Down
3 changes: 1 addition & 2 deletions src/popup/details.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import "Polyfill"
import { TTabActions } from "../tapi/taction";
import "Polyfill";

export class DetailsController {
constructor() {
Expand Down
23 changes: 11 additions & 12 deletions src/popup/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,18 @@
// return workers.length === window.__workersReady;
// };

import "Polyfill"
import "Polyfill";

import { TSession, TSessionListener } from "tapi/tsession";
import { TSession } from "tapi/tsession";
import { TTabActions, TWindowActions } from "../tapi/taction";
import { callContentScript } from "../tapi/content";
import { DetailsController } from "./details";
import { TUIEditableColorDot, TUIEditableDiv, TUIEditableLabel } from "./editablespan";
import { parse_query, shard_doc, query as query_all } from "../../cartographer/pkg/cartographer";
import { TUIEditableDiv, TUIEditableLabel } from "./editablespan";

import { $local$, $localtmp$, $sync$, normal } from "../tapi/store";
import { $local$, $localtmp$, $sync$ } from "../tapi/store";
import { openContextMenu, TUIMenu, TUIMenuDropdown, TUIMenuFlexLayout, TUIMenuHR, TUIMenuItem, TUIMenuLabel, TUIMenuListLayout } from "./menu";
import { resolveDefault } from "../options/exports"
import { closeTabby, cycleLayout, LAYOUT_POPUP, LAYOUT_SIDEBAR, openTabby } from "../background/exports"
import { resolveDefault } from "../options/exports";
import { closeTabby, LAYOUT_POPUP } from "../background/exports";
import { hasSFLvt2, restoreSFLvt2 } from "./tabby2-compat";
import { TargetBrowser } from "../polyfill";

Expand Down Expand Up @@ -1768,23 +1767,23 @@ class TUITabsList extends TUIListDataInterpret {

(async () => {
// Fulfill options before doing anything else
$local$.fulfill("option:popup-theme", (popupTheme) => {
await $local$.fulfill("option:popup-theme", async (popupTheme) => {
document.querySelector(":root").setAttribute("data-theme", popupTheme);
if (popupTheme === "") {
$local$.fulfillOnce("option:popup-custom-theme", (popupCustomTheme) => {
await $local$.fulfillOnce("option:popup-custom-theme", (popupCustomTheme) => {
// Load custom CSS
document.getElementById("theming").appendChild(document.createTextNode(popupCustomTheme));
}, resolveDefault("option:popup-custom-theme"));
}
}, resolveDefault("option:popup-theme"));
$local$.fulfill("option:popup-size", (popupSize) => {
await $local$.fulfill("option:popup-size", (popupSize) => {
document.documentElement.style.setProperty("--width", `${Math.min(popupSize[0], 800)}px`);
document.documentElement.style.setProperty("--height", `${Math.min(popupSize[1], 600)}px`);
}, resolveDefault("option:popup-size"));
$local$.fulfill("option:popup-scale", (popupScale) => {
await $local$.fulfill("option:popup-scale", (popupScale) => {
document.documentElement.style.setProperty("--scale", `${popupScale}`);
}, resolveDefault("option:popup-scale"));
$local$.fulfill("option:show-tab-info", (showTabInfo) => {
await $local$.fulfill("option:show-tab-info", (showTabInfo) => {
if (window.__TUI_SIDEBAR) showTabInfo = 1;
if (showTabInfo === 1) {
document.querySelector("#main").setAttribute("data-no-details-pane", "");
Expand Down
1 change: 1 addition & 0 deletions webext.webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,5 @@ module.exports = {
// syncWebAssembly: true,
topLevelAwait: true,
},
cache: false,
};

0 comments on commit 9a4e773

Please sign in to comment.