A Chromium and Firefox extension for viewing github Repository sizes, and Downloading files/subdirectories. It also features a simple tooling workflow that is capable of auto-generate web-extensions with: pure Typescript, Deno, and ES-modules. Along with the ability to bundle with minification and common-code-splitting.
create a build process for generating bookmarkletes that function in the same way as the extension, with user predefined config and storage values
come up with a better logo (how about a seppukucat with a katana and a man bun?)
design a better and more universal SimpleStorage class.
currently, your storage api and techniques might be a bit finicky given their blackbox-like handling of first-time assignments/empty storage entries.
a lot of the first-time values are assined by the option.ts script. and it shouldn't be like that since option.ts should ideally deal only with the ui of option.html.
setup a default-value system and link it to the "reset" button in the options.html page.
this one won't work, because window.localStorage can only store Record<string, string>, whereas our schema has arrays and objects as values inside of it.
I could encode the values as json when "setting", and parse that json back when "getting", but that's for later.
temporary map/object storage , so that it can work across different environments, including bookmarklets
folders with only one subfolder (and no files) are previewed as "folder/subfolder" in the github table-view ui.
as a result, I am unable to match the retrieved folder sizes with the associated table row, since the table row is identified by the name "folder/subfolder", where as the folder sizes has it stored as the key "folder".
potential fix: make table rows be identifiable by the name string before any slashes ("/")
publish to extension stores (chrome store, edge store, and firefox)
test extension in chromium
test extension in firefox:
ISSUE: firefox can't do dynamic imports of "web_accessible_resources". fixing this will require discovering an alternate bypass. moved to a separate issue thread: #3
parsing the name of a branch with a forward slash "/" will fail.
this is because the script always assumes that the portion after the slash contains a subdirectory, and not that it could be part of the branch name.
example:
parsing the branch feature/xyz of repo_name under user_name, and subdirectory /src/: https://github.com/user_name/repo_name/tree/feature/xyz/src
will fail. because it gets parsed as branch = "feature", subdir = "/xyz/src/"
The extension's content_script.js can't run in Firefox because it relies on dynamically importing its dependency javascript files by referencing it indirectly through github.com, and then on the other hand, making the dependency javascript files available to github.com via injection ("web_accessible_resources" in manifest.json).
This issue in Firefox has been known for a long time (mozilla bug (1536094)), and it seems like there's no progress towards a resolution given that it might introduce security breaches.
Console log when running the extension on Firefox:
disable code splitting, and bundle the endpoint typescript files as whole. But that would ruin my entire shiny toolchain's purpose, so I will not go that route.
What will a potential fix need?:
It'll have to entirely avoid the usage of indirect dynamic script importation through the abuse of "web_accessible_resources"
potentially use a service background worker that hands out dynamically requested scripts. this technique is mentioned by some in the mozilla bug page (1536094).
problem with this approach: esbuild will not be able to correctly generate a dependency graph, because the location of the scripts will no longer be a static compile time string. again: it'll ruin the whole toolchain's purpose of compiling directly referenced typescript source files.