Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build using webpack #1828

Open
wants to merge 148 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
148 commits
Select commit Hold shift + click to select a range
b4aa1c4
to src [pre]
tophf Sep 30, 2024
7fa95a1
WIP
tophf Sep 29, 2024
3912311
WIP split csslint+parserlib
tophf Oct 1, 2024
273bcda
WIP csslint
tophf Oct 1, 2024
28e25de
WIP
tophf Oct 1, 2024
a43535a
WIP
tophf Oct 2, 2024
692f39a
WIP rollup is bad at html and code splitting
tophf Oct 3, 2024
8a3dc11
WIP webpack (libraries)
tophf Oct 5, 2024
08813f2
WIP webpack (pages)
tophf Oct 6, 2024
17cf8c0
WIP webpack (failed splitting common chunk)
tophf Oct 7, 2024
82b5f2e
WIP webpack (done splitting common chunk)
tophf Oct 7, 2024
6e272f1
WIP webpack (done splitting common chunk) v2
tophf Oct 8, 2024
b30989e
WIP manage
tophf Oct 8, 2024
5051f52
bg prefs
tophf Oct 9, 2024
c005c2b
fix manage->render
tophf Oct 9, 2024
59f4fa2
fix manage->render + `?.`
tophf Oct 9, 2024
7311421
patch webpack `global`
tophf Oct 9, 2024
f7f8e73
skip reinjection
tophf Oct 9, 2024
2703261
load theme synchronously
tophf Oct 9, 2024
e9ee463
build jsonlint, remove /vendors
tophf Oct 9, 2024
5073162
clone $$ only when necessary
tophf Oct 9, 2024
d35e7a4
fix bg api & router
tophf Oct 9, 2024
62af62d
remove rollup config
tophf Oct 9, 2024
968b7ee
simplify isTab check
tophf Oct 9, 2024
af80803
fix openURL when non-tabbed window is active
tophf Oct 11, 2024
273a586
fix tests + webpack disk cache
tophf Oct 11, 2024
ae3bb88
fix tests v2 + update eslint
tophf Oct 11, 2024
7cea8de
fix github action: use node 20
tophf Oct 11, 2024
12b6b18
fix dynamic imports for cjs
tophf Oct 11, 2024
b6b7ae3
disable fs cache
tophf Oct 11, 2024
56b406f
import themer once
tophf Oct 11, 2024
a8621b8
enable ci build artifacts
tophf Oct 11, 2024
fea3cb9
fix editor settings listeners
tophf Oct 11, 2024
41832ae
disable ci build artifacts (webpack hangs)
tophf Oct 11, 2024
3becd89
fix window.bgReady and window.messageBox
tophf Oct 11, 2024
7784b69
export LZ_KEY separately
tophf Oct 11, 2024
8d7b392
fix `template` getter
tophf Oct 11, 2024
ce61f75
enable webpack fs cache and disable reports
tophf Oct 11, 2024
e0632a5
load ui files on demand
tophf Oct 11, 2024
7690f37
export section-util separately
tophf Oct 11, 2024
492f1df
load css only when needed
tophf Oct 11, 2024
ce1bf65
flatten search state
tophf Oct 11, 2024
0b75d25
fix unload guard
tophf Oct 12, 2024
a0db56f
fix auto-localization
tophf Oct 12, 2024
39e2e5b
use "Style manager" as title
tophf Oct 12, 2024
0bda951
simplify $create, $toFragment, tNodeList
tophf Oct 12, 2024
023ae05
reuse hasOwn
tophf Oct 12, 2024
f5af8f1
make zips
tophf Oct 13, 2024
abce7cd
patch transitions in Chrome which is still affected
tophf Oct 15, 2024
40cb2b1
MV3 WIP
tophf Oct 16, 2024
0fb70f6
MV3 WIP2
tophf Oct 17, 2024
02e1073
save the customized part of linter config
tophf Oct 17, 2024
e8f8559
export URLS and UA separately
tophf Oct 17, 2024
3ee8e64
fix import-via-drop
tophf Oct 17, 2024
cd51301
simplify URLS.supported + inline URLS.configureCommands
tophf Oct 17, 2024
eb74870
MV3 WIP: get data synchronously in own pages
tophf Oct 17, 2024
4e29b00
restore simplified prefs.ready
tophf Oct 17, 2024
e3e5014
WIP SharedWorker, add isDark to clientData URL
tophf Oct 20, 2024
6b3efcc
WIP download via fetch()
tophf Oct 20, 2024
9e4eb44
WIP sync
tophf Oct 21, 2024
c6bcd5e
WIP sync p2
tophf Oct 22, 2024
c06e619
WIP sync p3
tophf Oct 22, 2024
ff7405a
WIP sessionData
tophf Oct 24, 2024
a73b6a5
fix webpack config
tophf Oct 24, 2024
2b1407e
fix preinjection
tophf Oct 24, 2024
64b250d
fix wrapper on libs without exports
tophf Oct 24, 2024
d86f6ea
scatter dom and toolbox
tophf Oct 24, 2024
16d956c
fix navman conditions
tophf Oct 25, 2024
062b518
fix port comms
tophf Oct 25, 2024
abf9e69
fix usw publish/disconnect
tophf Oct 25, 2024
37d391a
fix spinner animation
tophf Oct 25, 2024
2e1f0cc
add DNR debug log
tophf Oct 25, 2024
b9bf185
fix tests
tophf Oct 25, 2024
4b9b664
throttle chromeSync on error
tophf Oct 25, 2024
aa03aa3
use safeTimeout in SW
tophf Oct 27, 2024
757a041
fix eslint no-use-before-define
tophf Oct 27, 2024
c84465a
webpack progress in `zip` + fix RawEnv
tophf Oct 27, 2024
00b8551
use keepAlive for chromeSync
tophf Oct 27, 2024
7bdc6ee
simplify clientData param
tophf Oct 27, 2024
8fdce97
fix debounce and module order
tophf Oct 27, 2024
7f1f394
ci: use nodejs verion from package.json
tophf Oct 27, 2024
af9459b
fix Chrome detection in MV3
tophf Oct 28, 2024
03dad2d
save the state in IndexedDB
tophf Oct 28, 2024
341b636
treeshaking for unused modules
tophf Oct 28, 2024
06b8100
fix clientData bgReady and popup
tophf Oct 29, 2024
d113a11
fix keepAlive
tophf Oct 29, 2024
8a5df50
set class="mobile" on <html>
tophf Oct 29, 2024
c45024d
reorganize folders: sw, icon, css, js
tophf Oct 29, 2024
338bf59
add keepAlive option + fix raciness
tophf Oct 30, 2024
9f25254
detect possible FOUC + sort vars - isTab
tophf Oct 30, 2024
46a0492
reuse setClientData in MV2
tophf Oct 30, 2024
dbdbab3
implement xhrInject and patchCSP for MV3
tophf Oct 30, 2024
1122a8a
reuse setClientData in MV2 p2
tophf Oct 30, 2024
6b7c2b1
fix word breaking and html in tooltips
tophf Oct 30, 2024
9328adc
fix data-clickable detector
tophf Oct 30, 2024
b3bfe0e
fix usercss redirection
tophf Oct 30, 2024
d948eb7
use real id in WRB note
tophf Oct 30, 2024
41d5130
avoid soft hyphens after punctuation
tophf Oct 30, 2024
27d113f
fix and simplify context-menus
tophf Oct 30, 2024
bb7591f
fix preloadPopupData when styles are off
tophf Oct 30, 2024
e4ef83f
fix target blank for links in i18n
tophf Oct 30, 2024
2bf98ff
remove patcher info as it seems abandoned
tophf Oct 30, 2024
81b379a
fix keepAlive
tophf Oct 31, 2024
803676d
popup: simplify UI for disableAll and buttons
tophf Oct 31, 2024
c098053
restore installer UI translation
tophf Nov 1, 2024
1520c65
use_dynamic_url is bugged in Chrome
tophf Nov 1, 2024
a4ecdb2
add FOUC info
tophf Nov 1, 2024
06a8710
use tBody properly in popup
tophf Nov 1, 2024
6b0f447
use DNR for XHR
tophf Nov 1, 2024
0eca8f3
make master switch status clickable
tophf Nov 1, 2024
aba3e71
limit onRuleMatchedDebug to DEBUG builds
tophf Nov 2, 2024
dc71cf8
don't wake up on tab close/open
tophf Nov 2, 2024
f594c7c
fix lock tracking
tophf Nov 2, 2024
5b5f509
fix popup data in Vivaldi
tophf Nov 2, 2024
ca3c0e6
fix write as usercss without template
tophf Nov 2, 2024
5109646
don't mangle exports
tophf Nov 2, 2024
5265d0b
simplify devtools->edit redirect
tophf Nov 2, 2024
8445b5c
fix state db
tophf Nov 3, 2024
6c3ccc8
track tab removed via onbeforeunload
tophf Nov 3, 2024
ec135d6
fix context menus + eslint warnings
tophf Nov 4, 2024
043635e
keepAlive 0 by default to conform to webstore
tophf Nov 4, 2024
ead160a
don't wake up on main_frame unload
tophf Nov 4, 2024
0825376
faster db startup in Firefox
tophf Nov 5, 2024
1426680
inline consts.js
tophf Nov 5, 2024
ce03a9e
fix patchCSP option
tophf Nov 5, 2024
97bd9d3
fix reload command
tophf Nov 5, 2024
42278e6
ignore bfcache error
tophf Nov 5, 2024
0b3664c
fix and simplify FF detection in own pages
tophf Nov 6, 2024
638e1a1
don't broadcast backgroundReady in MV3
tophf Nov 6, 2024
f723266
build beta as MV3
tophf Nov 6, 2024
cc965ce
re-inject after toggling in MV3
tophf Nov 6, 2024
6bf3827
retry chrome.sync on error
tophf Nov 7, 2024
7c205b9
simplify API: use one-time sendMessage
tophf Nov 7, 2024
5248fc8
fix bfcache port
tophf Nov 8, 2024
b32a8a9
fix popup on unsupported urls
tophf Nov 8, 2024
a556b88
fix BUILD checks
tophf Nov 9, 2024
44fd70c
fix #1836: ensure buttons fit in the popup
tophf Nov 9, 2024
38192a3
update preset-env
tophf Nov 9, 2024
a6a46b0
fix MV2 build
tophf Nov 9, 2024
4696b20
fix scrollbar in options for Chrome < 72
tophf Nov 10, 2024
e3d05d8
fix direct API invocation in MV2
tophf Nov 10, 2024
ff3a374
fix clientData in MV3
tophf Nov 10, 2024
ad427ad
fix leaky Promise.race
tophf Nov 10, 2024
4a99404
resolve a todo, extract ownId
tophf Nov 11, 2024
6664a50
use bgReady._deps
tophf Nov 13, 2024
706d48b
reuse db connection, faster universal xxxMany
tophf Nov 13, 2024
1a33db9
fix #1837: use a fake redirect_uri for chrome.identity
tophf Nov 13, 2024
14c330d
3.0.1 fix lz observation
tophf Nov 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix MV2 build
  • Loading branch information
tophf committed Nov 9, 2024
commit a6a46b089499943aa0cad2cc05abf9447a83753b
1 change: 0 additions & 1 deletion src/background/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,3 @@ export let isVivaldi = !!(browserWindows && CHROME) && (async () => {
})();

window._ready = bgReady;
if (!process.env.MV3) window._bg = true; // for IS_BG check
1 change: 1 addition & 0 deletions src/background/intro.js
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
process.env.API = {}; // `global.API` will be used by msg.js
if (!process.env.MV3) global._bg = true; // for IS_BG check
6 changes: 3 additions & 3 deletions src/background/tab-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ export const set = (tabId, ...args) => {
}
if (!del) obj[lastKey] = value;
else if (obj) delete obj[lastKey];
stateDb.set(tabId, obj0);
if (process.env.MV3) stateDb.set(tabId, obj0);
};

export const remove = tabId => {
cache.delete(tabId);
stateDb.remove(tabId);
if (process.env.MV3) stateDb.remove(tabId);
};

bgReady.then(() => {
Expand All @@ -62,7 +62,7 @@ bgReady.then(() => {
if ((obj = cache.get(tabId))) oldUrl = obj.url;
else cache.set(tabId, obj = {});
obj.url = url;
stateDb.set(tabId, obj);
if (process.env.MV3) stateDb.set(tabId, obj);
for (const fn of onUrl) fn(tabId, url, oldUrl);
});
});
Expand Down
16 changes: 16 additions & 0 deletions src/js/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,19 @@ if (process.env.MV3) {
});
global.browser = createProxy(chrome);
}

if (!process.env.MV3 && !DOMTokenList.prototype.replace) {
// TODO: remove when minimum_chrome_version >= 61
global.URLSearchParams = class extends URLSearchParams {
constructor(init) {
if (init && typeof init === 'object') {
super();
for (const [key, val] of init[Symbol.iterator] ? init : Object.entries(init)) {
this.set(key, val);
}
} else {
super(...arguments);
}
}
};
}
2 changes: 1 addition & 1 deletion src/js/dom-on-load.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ onExtension(request => {
});
// Removing transition-suppressor rule
if (!CHROME || CHROME < 93) {
nextSheet: for (const {sheet} of document.styleSheets) {
nextSheet: for (const sheet of document.styleSheets) {
for (let i = 0, rule; (rule = sheet.cssRules[i]); i++) {
if (/#\\1\s?transition-suppressor/.test(rule.cssText)) {
sheet.deleteRule(i);
Expand Down
2 changes: 1 addition & 1 deletion src/js/prefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {onStorageChanged} from './util-webext';
let busy, setReady;

/** @type {StylusClientData & {then: (cb: (data: StylusClientData) => ?) => Promise}} */
export const clientData = process.env.ENTRY === true && (
export const clientData = !process.env.IS_BG && (
global[process.env.CLIENT_DATA] ??= API.setClientData(null, {
url: location.href,
dark: isCssDarkScheme(),
Expand Down
2 changes: 1 addition & 1 deletion src/js/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export const debounce = /*@__PURE__*/(() => {
}
})();

export const makePropertyPopProxy = () => new Proxy({}, {
export const makePropertyPopProxy = data => new Proxy(data, {
get: (obj, k, v) => ((
(v = obj[k]),
delete obj[k],
Expand Down
6 changes: 3 additions & 3 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ const VARS = {
};
const RAW_VARS = {
API: 'global.API', // hiding the global from IDE
DEBUGLOG: process.env.DEBUG ? 'console.log' : 'null?.',
DEBUGWARN: process.env.DEBUG ? 'console.warn' : 'null?.',
DEBUGLOG: (process.env.DEBUG ? '' : 'null&&') + 'console.log',
DEBUGWARN: (process.env.DEBUG ? '' : 'null&&') + 'console.warn',
KEEP_ALIVE: '1&&',
};
const BANNER = '{const global = this, window = global;';
Expand Down Expand Up @@ -139,7 +139,7 @@ const getBaseConfig = () => ({
test: /\.(png|svg|jpe?g|gif|ttf)$/i,
type: 'asset/resource',
}, {
test: /\.m?js$/,
test: /\.m?js(\?.*)?$/,
exclude: [ROOT + 'node_modules/'],
loader: 'babel-loader',
options: {root: ROOT},
Expand Down
Loading