darkreader 4.9.52 → 4.9.57

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/darkreader.js +189 -176
  3. package/package.json +37 -38
package/README.md CHANGED
@@ -16,7 +16,7 @@ If the help page doesn't answer your question, open up a new [discussion](https:
16
16
 
17
17
  ## How to contribute
18
18
 
19
- Read more about contributing to Dark Reader in [CONTRIBUTING.md](https://github.com/darkreader/darkreader/blob/master/CONTRIBUTING.md).
19
+ Read more about contributing to Dark Reader in [CONTRIBUTING.md](https://github.com/darkreader/darkreader/blob/main/CONTRIBUTING.md).
20
20
 
21
21
  ## Building for use
22
22
 
package/darkreader.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Dark Reader v4.9.52
2
+ * Dark Reader v4.9.57
3
3
  * https://darkreader.org/
4
4
  */
5
5
 
@@ -9,7 +9,7 @@
9
9
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.DarkReader = {}));
10
10
  })(this, (function (exports) { 'use strict';
11
11
 
12
- /*! *****************************************************************************
12
+ /******************************************************************************
13
13
  Copyright (c) Microsoft Corporation.
14
14
 
15
15
  Permission to use, copy, modify, and/or distribute this software for any
@@ -112,50 +112,58 @@
112
112
  return to.concat(ar || Array.prototype.slice.call(from));
113
113
  }
114
114
 
115
- var MessageType = {
116
- UI_GET_DATA: 'ui-get-data',
117
- UI_SUBSCRIBE_TO_CHANGES: 'ui-subscribe-to-changes',
118
- UI_UNSUBSCRIBE_FROM_CHANGES: 'ui-unsubscribe-from-changes',
119
- UI_CHANGE_SETTINGS: 'ui-change-settings',
120
- UI_SET_THEME: 'ui-set-theme',
121
- UI_SET_SHORTCUT: 'ui-set-shortcut',
122
- UI_TOGGLE_ACTIVE_TAB: 'ui-toggle-active-tab',
123
- UI_MARK_NEWS_AS_READ: 'ui-mark-news-as-read',
124
- UI_MARK_NEWS_AS_DISPLAYED: 'ui-mark-news-as-displayed',
125
- UI_LOAD_CONFIG: 'ui-load-config',
126
- UI_APPLY_DEV_DYNAMIC_THEME_FIXES: 'ui-apply-dev-dynamic-theme-fixes',
127
- UI_RESET_DEV_DYNAMIC_THEME_FIXES: 'ui-reset-dev-dynamic-theme-fixes',
128
- UI_APPLY_DEV_INVERSION_FIXES: 'ui-apply-dev-inversion-fixes',
129
- UI_RESET_DEV_INVERSION_FIXES: 'ui-reset-dev-inversion-fixes',
130
- UI_APPLY_DEV_STATIC_THEMES: 'ui-apply-dev-static-themes',
131
- UI_RESET_DEV_STATIC_THEMES: 'ui-reset-dev-static-themes',
132
- UI_SAVE_FILE: 'ui-save-file',
133
- UI_REQUEST_EXPORT_CSS: 'ui-request-export-css',
134
- BG_CHANGES: 'bg-changes',
135
- BG_ADD_CSS_FILTER: 'bg-add-css-filter',
136
- BG_ADD_STATIC_THEME: 'bg-add-static-theme',
137
- BG_ADD_SVG_FILTER: 'bg-add-svg-filter',
138
- BG_ADD_DYNAMIC_THEME: 'bg-add-dynamic-theme',
139
- BG_EXPORT_CSS: 'bg-export-css',
140
- BG_UNSUPPORTED_SENDER: 'bg-unsupported-sender',
141
- BG_CLEAN_UP: 'bg-clean-up',
142
- BG_RELOAD: 'bg-reload',
143
- BG_FETCH_RESPONSE: 'bg-fetch-response',
144
- BG_UI_UPDATE: 'bg-ui-update',
145
- BG_CSS_UPDATE: 'bg-css-update',
146
- CS_COLOR_SCHEME_CHANGE: 'cs-color-scheme-change',
147
- CS_FRAME_CONNECT: 'cs-frame-connect',
148
- CS_FRAME_FORGET: 'cs-frame-forget',
149
- CS_FRAME_FREEZE: 'cs-frame-freeze',
150
- CS_FRAME_RESUME: 'cs-frame-resume',
151
- CS_EXPORT_CSS_RESPONSE: 'cs-export-css-response',
152
- CS_FETCH: 'cs-fetch',
153
- CS_DARK_THEME_DETECTED: 'cs-dark-theme-detected',
154
- CS_DARK_THEME_NOT_DETECTED: 'cs-dark-theme-not-detected',
155
- };
115
+ var MessageType;
116
+ (function (MessageType) {
117
+ MessageType["UI_GET_DATA"] = "ui-get-data";
118
+ MessageType["UI_SUBSCRIBE_TO_CHANGES"] = "ui-subscribe-to-changes";
119
+ MessageType["UI_UNSUBSCRIBE_FROM_CHANGES"] = "ui-unsubscribe-from-changes";
120
+ MessageType["UI_CHANGE_SETTINGS"] = "ui-change-settings";
121
+ MessageType["UI_SET_THEME"] = "ui-set-theme";
122
+ MessageType["UI_SET_SHORTCUT"] = "ui-set-shortcut";
123
+ MessageType["UI_TOGGLE_ACTIVE_TAB"] = "ui-toggle-active-tab";
124
+ MessageType["UI_MARK_NEWS_AS_READ"] = "ui-mark-news-as-read";
125
+ MessageType["UI_MARK_NEWS_AS_DISPLAYED"] = "ui-mark-news-as-displayed";
126
+ MessageType["UI_LOAD_CONFIG"] = "ui-load-config";
127
+ MessageType["UI_APPLY_DEV_DYNAMIC_THEME_FIXES"] = "ui-apply-dev-dynamic-theme-fixes";
128
+ MessageType["UI_RESET_DEV_DYNAMIC_THEME_FIXES"] = "ui-reset-dev-dynamic-theme-fixes";
129
+ MessageType["UI_APPLY_DEV_INVERSION_FIXES"] = "ui-apply-dev-inversion-fixes";
130
+ MessageType["UI_RESET_DEV_INVERSION_FIXES"] = "ui-reset-dev-inversion-fixes";
131
+ MessageType["UI_APPLY_DEV_STATIC_THEMES"] = "ui-apply-dev-static-themes";
132
+ MessageType["UI_RESET_DEV_STATIC_THEMES"] = "ui-reset-dev-static-themes";
133
+ MessageType["UI_SAVE_FILE"] = "ui-save-file";
134
+ MessageType["UI_REQUEST_EXPORT_CSS"] = "ui-request-export-css";
135
+ MessageType["UI_COLOR_SCHEME_CHANGE"] = "ui-color-scheme-change";
136
+ MessageType["BG_CHANGES"] = "bg-changes";
137
+ MessageType["BG_ADD_CSS_FILTER"] = "bg-add-css-filter";
138
+ MessageType["BG_ADD_STATIC_THEME"] = "bg-add-static-theme";
139
+ MessageType["BG_ADD_SVG_FILTER"] = "bg-add-svg-filter";
140
+ MessageType["BG_ADD_DYNAMIC_THEME"] = "bg-add-dynamic-theme";
141
+ MessageType["BG_EXPORT_CSS"] = "bg-export-css";
142
+ MessageType["BG_UNSUPPORTED_SENDER"] = "bg-unsupported-sender";
143
+ MessageType["BG_CLEAN_UP"] = "bg-clean-up";
144
+ MessageType["BG_RELOAD"] = "bg-reload";
145
+ MessageType["BG_FETCH_RESPONSE"] = "bg-fetch-response";
146
+ MessageType["BG_UI_UPDATE"] = "bg-ui-update";
147
+ MessageType["BG_CSS_UPDATE"] = "bg-css-update";
148
+ MessageType["CS_COLOR_SCHEME_CHANGE"] = "cs-color-scheme-change";
149
+ MessageType["CS_FRAME_CONNECT"] = "cs-frame-connect";
150
+ MessageType["CS_FRAME_FORGET"] = "cs-frame-forget";
151
+ MessageType["CS_FRAME_FREEZE"] = "cs-frame-freeze";
152
+ MessageType["CS_FRAME_RESUME"] = "cs-frame-resume";
153
+ MessageType["CS_EXPORT_CSS_RESPONSE"] = "cs-export-css-response";
154
+ MessageType["CS_FETCH"] = "cs-fetch";
155
+ MessageType["CS_DARK_THEME_DETECTED"] = "cs-dark-theme-detected";
156
+ MessageType["CS_DARK_THEME_NOT_DETECTED"] = "cs-dark-theme-not-detected";
157
+ MessageType["CS_LOG"] = "cs-log";
158
+ })(MessageType || (MessageType = {}));
156
159
 
157
- var userAgent = typeof navigator === 'undefined' ? 'some useragent' : navigator.userAgent.toLowerCase();
158
- var platform = typeof navigator === 'undefined' ? 'some platform' : navigator.platform.toLowerCase();
160
+ var isNavigatorDefined = typeof navigator !== 'undefined';
161
+ var userAgent = isNavigatorDefined ? (navigator.userAgentData && Array.isArray(navigator.userAgentData.brands)) ?
162
+ navigator.userAgentData.brands.map(function (brand) { return "".concat(brand.brand.toLowerCase(), " ").concat(brand.version); }).join(' ') : navigator.userAgent.toLowerCase()
163
+ : 'some useragent';
164
+ var platform = isNavigatorDefined ? (navigator.userAgentData && typeof navigator.userAgentData.platform === 'string') ?
165
+ navigator.userAgentData.platform.toLowerCase() : navigator.platform.toLowerCase()
166
+ : 'some platform';
159
167
  var isChromium = userAgent.includes('chrome') || userAgent.includes('chromium');
160
168
  var isThunderbird = userAgent.includes('thunderbird');
161
169
  var isFirefox = userAgent.includes('firefox') || userAgent.includes('librewolf') || isThunderbird;
@@ -166,12 +174,19 @@
166
174
  var isSafari = userAgent.includes('safari') && !isChromium;
167
175
  var isWindows = platform.startsWith('win');
168
176
  var isMacOS = platform.startsWith('mac');
169
- userAgent.includes('mobile');
177
+ (isNavigatorDefined && navigator.userAgentData) ? navigator.userAgentData.mobile : userAgent.includes('mobile');
170
178
  var isShadowDomSupported = typeof ShadowRoot === 'function';
171
179
  var isMatchMediaChangeEventListenerSupported = (typeof MediaQueryList === 'function' &&
172
180
  typeof MediaQueryList.prototype.addEventListener === 'function');
173
181
  ((function () {
174
- var m = userAgent.match(/chrom[e|ium]\/([^ ]+)/);
182
+ var m = userAgent.match(/chrom(?:e|ium)(?:\/| )([^ ]+)/);
183
+ if (m && m[1]) {
184
+ return m[1];
185
+ }
186
+ return '';
187
+ }))();
188
+ ((function () {
189
+ var m = userAgent.match(/(?:firefox|librewolf)(?:\/| )([^ ]+)/);
175
190
  if (m && m[1]) {
176
191
  return m[1];
177
192
  }
@@ -186,7 +201,6 @@
186
201
  return false;
187
202
  }
188
203
  })();
189
- globalThis.chrome && globalThis.chrome.runtime && globalThis.chrome.runtime.getManifest && globalThis.chrome.runtime.getManifest().manifest_version === 3;
190
204
  var isCSSColorSchemePropSupported = (function () {
191
205
  if (typeof document === 'undefined') {
192
206
  return false;
@@ -456,16 +470,8 @@
456
470
  }
457
471
 
458
472
  function logInfo() {
459
- var args = [];
460
- for (var _i = 0; _i < arguments.length; _i++) {
461
- args[_i] = arguments[_i];
462
- }
463
473
  }
464
474
  function logWarn() {
465
- var args = [];
466
- for (var _i = 0; _i < arguments.length; _i++) {
467
- args[_i] = arguments[_i];
468
- }
469
475
  }
470
476
 
471
477
  function throttle(callback) {
@@ -570,7 +576,6 @@
570
576
  }
571
577
  else if (attempts >= MAX_ATTEMPTS_COUNT) {
572
578
  if (now - start < ATTEMPTS_INTERVAL) {
573
- logWarn("Node position watcher paused: retry in ".concat(RETRY_TIMEOUT, "ms"), node, prevSibling);
574
579
  timeoutId = setTimeout(function () {
575
580
  start = null;
576
581
  attempts = 0;
@@ -584,23 +589,19 @@
584
589
  }
585
590
  if (mode === 'parent') {
586
591
  if (prevSibling && prevSibling.parentNode !== parent) {
587
- logWarn('Unable to restore node position: sibling parent changed', node, prevSibling, parent);
588
592
  stop();
589
593
  return;
590
594
  }
591
595
  }
592
596
  if (mode === 'prev-sibling') {
593
597
  if (prevSibling.parentNode == null) {
594
- logWarn('Unable to restore node position: sibling was removed', node, prevSibling, parent);
595
598
  stop();
596
599
  return;
597
600
  }
598
601
  if (prevSibling.parentNode !== parent) {
599
- logWarn('Style was moved to another parent', node, prevSibling, parent);
600
602
  updateParent(prevSibling.parentNode);
601
603
  }
602
604
  }
603
- logWarn('Restoring node position', node, prevSibling, parent);
604
605
  parent.insertBefore(node, prevSibling ? prevSibling.nextSibling : parent.firstChild);
605
606
  observer.takeRecords();
606
607
  onRestore && onRestore();
@@ -925,7 +926,7 @@
925
926
  }
926
927
  }
927
928
  }
928
- var cssURLRegex = /url\((('.+?')|(".+?")|([^\)]*?))\)/g;
929
+ var cssURLRegex = /url\((('.*?')|(".*?")|([^\)]*?))\)/g;
929
930
  var cssImportRegex = /@import\s*(url\()?(('.+?')|(".+?")|([^\)]*?))\)? ?(screen)?;?/gi;
930
931
  function getCSSURLValue(cssURL) {
931
932
  return cssURL.trim().replace(/^url\((.*)\)$/, '$1').trim().replace(/^"(.*)"$/, '$1').replace(/^'(.*)'$/, '$1').replace(/(?:\\(.))/g, '$1');
@@ -941,7 +942,6 @@
941
942
  return "url(\"".concat(getAbsoluteURL(cssBasePath, pathValue), "\")");
942
943
  }
943
944
  catch (err) {
944
- logWarn('Not able to replace relative URL with Absolute URL, skipping');
945
945
  return match;
946
946
  }
947
947
  });
@@ -1108,6 +1108,36 @@
1108
1108
  return null;
1109
1109
  }
1110
1110
 
1111
+ var hslaParseCache = new Map();
1112
+ var rgbaParseCache = new Map();
1113
+ function parseColorWithCache($color) {
1114
+ $color = $color.trim();
1115
+ if (rgbaParseCache.has($color)) {
1116
+ return rgbaParseCache.get($color);
1117
+ }
1118
+ if ($color.includes('calc(')) {
1119
+ $color = lowerCalcExpression($color);
1120
+ }
1121
+ var color = parse($color);
1122
+ color && rgbaParseCache.set($color, color);
1123
+ return color;
1124
+ }
1125
+ function parseToHSLWithCache(color) {
1126
+ if (hslaParseCache.has(color)) {
1127
+ return hslaParseCache.get(color);
1128
+ }
1129
+ var rgb = parseColorWithCache(color);
1130
+ if (!rgb) {
1131
+ return null;
1132
+ }
1133
+ var hsl = rgbToHSL(rgb);
1134
+ hslaParseCache.set(color, hsl);
1135
+ return hsl;
1136
+ }
1137
+ function clearColorCache() {
1138
+ hslaParseCache.clear();
1139
+ rgbaParseCache.clear();
1140
+ }
1111
1141
  function hslToRGB(_a) {
1112
1142
  var h = _a.h, s = _a.s, l = _a.l, _b = _a.a, a = _b === void 0 ? 1 : _b;
1113
1143
  if (s === 0) {
@@ -1207,7 +1237,7 @@
1207
1237
  if ($color === 'transparent') {
1208
1238
  return { r: 0, g: 0, b: 0, a: 0 };
1209
1239
  }
1210
- throw new Error("Unable to parse ".concat($color));
1240
+ return null;
1211
1241
  }
1212
1242
  function getNumbers($color) {
1213
1243
  var numbers = [];
@@ -1284,7 +1314,7 @@
1284
1314
  return { r: r, g: g, b: b, a: a };
1285
1315
  }
1286
1316
  }
1287
- throw new Error("Unable to parse ".concat($hex));
1317
+ return null;
1288
1318
  }
1289
1319
  function getColorByName($color) {
1290
1320
  var n = knownColors.get($color);
@@ -1625,19 +1655,8 @@
1625
1655
  return theme[prop];
1626
1656
  }
1627
1657
  var colorModificationCache = new Map();
1628
- var colorParseCache$1 = new Map();
1629
- function parseToHSLWithCache(color) {
1630
- if (colorParseCache$1.has(color)) {
1631
- return colorParseCache$1.get(color);
1632
- }
1633
- var rgb = parse(color);
1634
- var hsl = rgbToHSL(rgb);
1635
- colorParseCache$1.set(color, hsl);
1636
- return hsl;
1637
- }
1638
1658
  function clearColorModificationCache() {
1639
1659
  colorModificationCache.clear();
1640
- colorParseCache$1.clear();
1641
1660
  }
1642
1661
  var rgbCacheKeys = ['r', 'g', 'b', 'a'];
1643
1662
  var themeCacheKeys$1 = ['mode', 'brightness', 'contrast', 'grayscale', 'sepia', 'darkSchemeBackgroundColor', 'darkSchemeTextColor', 'lightSchemeBackgroundColor', 'lightSchemeTextColor'];
@@ -2055,7 +2074,6 @@
2055
2074
  }
2056
2075
  var size = naturalWidth * naturalHeight * 4;
2057
2076
  if (size > MAX_IMAGE_SIZE) {
2058
- logInfo('Skipped large image analyzing(Larger than 5mb in memory)');
2059
2077
  return {
2060
2078
  isDark: false,
2061
2079
  isLight: false,
@@ -2205,11 +2223,14 @@
2205
2223
  return { property: property, value: modifier, important: getPriority(rule.style, property), sourceValue: value };
2206
2224
  }
2207
2225
  }
2226
+ else if (property === 'color-scheme') {
2227
+ return null;
2228
+ }
2208
2229
  else if ((property.includes('color') && property !== '-webkit-print-color-adjust') ||
2209
2230
  property === 'fill' ||
2210
2231
  property === 'stroke' ||
2211
2232
  property === 'stop-color') {
2212
- var modifier = getColorModifier(property, value);
2233
+ var modifier = getColorModifier(property, value, rule);
2213
2234
  if (modifier) {
2214
2235
  return { property: property, value: modifier, important: getPriority(rule.style, property), sourceValue: value };
2215
2236
  }
@@ -2247,7 +2268,7 @@
2247
2268
  lines.push(" color-scheme: ".concat(theme.mode === 1 ? 'dark' : 'dark light', " !important;"));
2248
2269
  lines.push('}');
2249
2270
  }
2250
- var bgSelectors = joinSelectors(isIFrame ? '' : 'html, body', styleSystemControls ? 'input, textarea, select, button' : '');
2271
+ var bgSelectors = joinSelectors(isIFrame ? '' : 'html, body', styleSystemControls ? 'input, textarea, select, button, dialog' : '');
2251
2272
  if (bgSelectors) {
2252
2273
  lines.push("".concat(bgSelectors, " {"));
2253
2274
  lines.push(" background-color: ".concat(modifyBackgroundColor({ r: 255, g: 255, b: 255 }, theme), ";"));
@@ -2288,7 +2309,7 @@
2288
2309
  foregroundColorSelection = modifyForegroundColor({ r: 255, g: 255, b: 255 }, __assign(__assign({}, theme), { grayscale: 0 }));
2289
2310
  }
2290
2311
  else {
2291
- var rgb = parse(theme.selectionColor);
2312
+ var rgb = parseColorWithCache(theme.selectionColor);
2292
2313
  var hsl = rgbToHSL(rgb);
2293
2314
  backgroundColorSelection = theme.selectionColor;
2294
2315
  if (hsl.l < 0.5) {
@@ -2330,7 +2351,7 @@
2330
2351
  colorCorner = modifyBackgroundColor({ r: 255, g: 255, b: 255 }, theme);
2331
2352
  }
2332
2353
  else {
2333
- var rgb = parse(theme.scrollbarColor);
2354
+ var rgb = parseColorWithCache(theme.scrollbarColor);
2334
2355
  var hsl_1 = rgbToHSL(rgb);
2335
2356
  var isLight = hsl_1.l > 0.5;
2336
2357
  var lighten = function (lighter) { return (__assign(__assign({}, hsl_1), { l: clamp(hsl_1.l + lighter, 0, 1) })); };
@@ -2383,45 +2404,27 @@
2383
2404
  'none',
2384
2405
  'unset',
2385
2406
  ]);
2386
- var colorParseCache = new Map();
2387
- function parseColorWithCache($color) {
2388
- $color = $color.trim();
2389
- if (colorParseCache.has($color)) {
2390
- return colorParseCache.get($color);
2391
- }
2392
- if ($color.includes('calc(')) {
2393
- $color = lowerCalcExpression($color);
2394
- }
2395
- var color = parse($color);
2396
- colorParseCache.set($color, color);
2397
- return color;
2398
- }
2399
- function tryParseColor($color) {
2400
- try {
2401
- return parseColorWithCache($color);
2402
- }
2403
- catch (err) {
2404
- return null;
2405
- }
2406
- }
2407
- function getColorModifier(prop, value) {
2407
+ function getColorModifier(prop, value, rule) {
2408
2408
  if (unparsableColors.has(value.toLowerCase())) {
2409
2409
  return value;
2410
2410
  }
2411
- try {
2412
- var rgb_1 = parseColorWithCache(value);
2413
- if (prop.includes('background')) {
2414
- return function (filter) { return modifyBackgroundColor(rgb_1, filter); };
2415
- }
2416
- if (prop.includes('border') || prop.includes('outline')) {
2417
- return function (filter) { return modifyBorderColor(rgb_1, filter); };
2411
+ var rgb = parseColorWithCache(value);
2412
+ if (!rgb) {
2413
+ return null;
2414
+ }
2415
+ if (prop.includes('background')) {
2416
+ if ((rule.style.webkitMaskImage && rule.style.webkitMaskImage !== 'none') ||
2417
+ (rule.style.webkitMask && !rule.style.webkitMask.startsWith('none')) ||
2418
+ (rule.style.mask && rule.style.mask !== 'none') ||
2419
+ (rule.style.getPropertyValue('mask-image') && rule.style.getPropertyValue('mask-image') !== 'none')) {
2420
+ return function (filter) { return modifyForegroundColor(rgb, filter); };
2418
2421
  }
2419
- return function (filter) { return modifyForegroundColor(rgb_1, filter); };
2422
+ return function (filter) { return modifyBackgroundColor(rgb, filter); };
2420
2423
  }
2421
- catch (err) {
2422
- logWarn('Color parse error', err);
2423
- return null;
2424
+ if (prop.includes('border') || prop.includes('outline')) {
2425
+ return function (filter) { return modifyBorderColor(rgb, filter); };
2424
2426
  }
2427
+ return function (filter) { return modifyForegroundColor(rgb, filter); };
2425
2428
  }
2426
2429
  var imageDetailsCache = new Map();
2427
2430
  var awaitingForImageLoading = new Map();
@@ -2467,22 +2470,22 @@
2467
2470
  .sort(function (a, b) { return a.index > b.index ? 1 : -1; });
2468
2471
  var getGradientModifier_1 = function (gradient) {
2469
2472
  var typeGradient = gradient.typeGradient, match = gradient.match, hasComma = gradient.hasComma;
2470
- var partsRegex = /([^\(\),]+(\([^\(\)]*(\([^\(\)]*\)*[^\(\)]*)?\))?[^\(\),]*),?/g;
2473
+ var partsRegex = /([^\(\),]+(\([^\(\)]*(\([^\(\)]*\)*[^\(\)]*)?\))?([^\(\), ]|( (?!calc)))*),?/g;
2471
2474
  var colorStopRegex = /^(from|color-stop|to)\(([^\(\)]*?,\s*)?(.*?)\)$/;
2472
2475
  var parts = getMatches(partsRegex, match, 1).map(function (part) {
2473
2476
  part = part.trim();
2474
- var rgb = tryParseColor(part);
2477
+ var rgb = parseColorWithCache(part);
2475
2478
  if (rgb) {
2476
2479
  return function (filter) { return modifyGradientColor(rgb, filter); };
2477
2480
  }
2478
2481
  var space = part.lastIndexOf(' ');
2479
- rgb = tryParseColor(part.substring(0, space));
2482
+ rgb = parseColorWithCache(part.substring(0, space));
2480
2483
  if (rgb) {
2481
2484
  return function (filter) { return "".concat(modifyGradientColor(rgb, filter), " ").concat(part.substring(space + 1)); };
2482
2485
  }
2483
2486
  var colorStopMatch = part.match(colorStopRegex);
2484
2487
  if (colorStopMatch) {
2485
- rgb = tryParseColor(colorStopMatch[3]);
2488
+ rgb = parseColorWithCache(colorStopMatch[3]);
2486
2489
  if (rgb) {
2487
2490
  return function (filter) { return "".concat(colorStopMatch[1], "(").concat(colorStopMatch[2] ? "".concat(colorStopMatch[2], ", ") : '').concat(modifyGradientColor(rgb, filter), ")"); };
2488
2491
  }
@@ -2499,6 +2502,7 @@
2499
2502
  return null;
2500
2503
  }
2501
2504
  var url = getCSSURLValue(urlValue);
2505
+ var isURLEmpty = url.length === 0;
2502
2506
  var parentStyleSheet = rule.parentStyleSheet;
2503
2507
  var baseURL = (parentStyleSheet && parentStyleSheet.href) ?
2504
2508
  getCSSBaseBath(parentStyleSheet.href) :
@@ -2510,6 +2514,9 @@
2510
2514
  return __generator(this, function (_a) {
2511
2515
  switch (_a.label) {
2512
2516
  case 0:
2517
+ if (isURLEmpty) {
2518
+ return [2, "url('')"];
2519
+ }
2513
2520
  if (!imageDetailsCache.has(url)) return [3, 1];
2514
2521
  imageDetails = imageDetailsCache.get(url);
2515
2522
  return [3, 7];
@@ -2586,13 +2593,28 @@
2586
2593
  };
2587
2594
  var modifiers_1 = [];
2588
2595
  var matchIndex_1 = 0;
2596
+ var prevHasComma_1 = false;
2589
2597
  matches_1.forEach(function (_a, i) {
2590
2598
  var type = _a.type, match = _a.match, index = _a.index, typeGradient = _a.typeGradient, hasComma = _a.hasComma, offset = _a.offset;
2591
2599
  var matchStart = index;
2592
2600
  var prefixStart = matchIndex_1;
2593
2601
  var matchEnd = matchStart + match.length + offset;
2594
2602
  matchIndex_1 = matchEnd;
2595
- prefixStart !== matchStart && modifiers_1.push(function () { return value.substring(prefixStart, matchStart); });
2603
+ if (prefixStart !== matchStart) {
2604
+ if (prevHasComma_1) {
2605
+ modifiers_1.push(function () {
2606
+ var betweenValue = value.substring(prefixStart, matchStart);
2607
+ if (betweenValue[0] === ',') {
2608
+ betweenValue = betweenValue.substring(1);
2609
+ }
2610
+ return betweenValue;
2611
+ });
2612
+ }
2613
+ else {
2614
+ modifiers_1.push(function () { return value.substring(prefixStart, matchStart); });
2615
+ }
2616
+ }
2617
+ prevHasComma_1 = hasComma || false;
2596
2618
  if (type === 'url') {
2597
2619
  modifiers_1.push(getURLModifier_1(match));
2598
2620
  }
@@ -2610,11 +2632,14 @@
2610
2632
  return asyncResults.filter(Boolean).join('');
2611
2633
  });
2612
2634
  }
2613
- return results.join('');
2635
+ var combinedResult = results.join('');
2636
+ if (combinedResult.endsWith(', initial')) {
2637
+ return combinedResult.slice(0, -9);
2638
+ }
2639
+ return combinedResult;
2614
2640
  };
2615
2641
  }
2616
2642
  catch (err) {
2617
- logWarn("Unable to parse gradient ".concat(value), err);
2618
2643
  return null;
2619
2644
  }
2620
2645
  }
@@ -2628,7 +2653,7 @@
2628
2653
  var matchIndex = value.indexOf(match, index_1);
2629
2654
  var matchEnd = matchIndex + match.length;
2630
2655
  index_1 = matchEnd;
2631
- var rgb = tryParseColor(match);
2656
+ var rgb = parseColorWithCache(match);
2632
2657
  if (!rgb) {
2633
2658
  notParsed_1++;
2634
2659
  return function () { return value.substring(prefixIndex, matchEnd); };
@@ -2645,7 +2670,6 @@
2645
2670
  };
2646
2671
  }
2647
2672
  catch (err) {
2648
- logWarn("Unable to parse shadow ".concat(value), err);
2649
2673
  return null;
2650
2674
  }
2651
2675
  }
@@ -2669,7 +2693,6 @@
2669
2693
  return variablesStore.getModifierForVarDependant(prop, value);
2670
2694
  }
2671
2695
  function cleanModificationCache() {
2672
- colorParseCache.clear();
2673
2696
  clearColorModificationCache();
2674
2697
  imageDetailsCache.clear();
2675
2698
  cleanImageProcessingCache();
@@ -2956,7 +2979,7 @@
2956
2979
  return;
2957
2980
  }
2958
2981
  this.definedVars.add(varName);
2959
- var color = tryParseColor(value);
2982
+ var color = parseColorWithCache(value);
2960
2983
  if (color) {
2961
2984
  this.unknownColorVars.add(varName);
2962
2985
  }
@@ -3234,11 +3257,11 @@
3234
3257
  }
3235
3258
  function handleRawValue(color, theme, modifyFunction) {
3236
3259
  var _a = parseRawValue(color), isRaw = _a.isRaw, newColor = _a.color;
3237
- var rgb = tryParseColor(newColor);
3260
+ var rgb = parseColorWithCache(newColor);
3238
3261
  if (rgb) {
3239
3262
  var outputColor = modifyFunction(rgb, theme);
3240
3263
  if (isRaw) {
3241
- var outputInRGB = tryParseColor(outputColor);
3264
+ var outputInRGB = parseColorWithCache(outputColor);
3242
3265
  return outputInRGB ? "".concat(outputInRGB.r, ", ").concat(outputInRGB.g, ", ").concat(outputInRGB.b) : outputColor;
3243
3266
  }
3244
3267
  return outputColor;
@@ -3507,7 +3530,7 @@
3507
3530
  function setCustomProp(targetCSSProp, modifierCSSProp, cssVal) {
3508
3531
  var isPropertyVariable = targetCSSProp.startsWith('--');
3509
3532
  var _a = isPropertyVariable ? {} : overrides[targetCSSProp], customProp = _a.customProp, dataAttr = _a.dataAttr;
3510
- var mod = getModifiableCSSDeclaration(modifierCSSProp, cssVal, {}, variablesStore, ignoreImageSelectors, null);
3533
+ var mod = getModifiableCSSDeclaration(modifierCSSProp, cssVal, { style: element.style }, variablesStore, ignoreImageSelectors, null);
3511
3534
  if (!mod) {
3512
3535
  return;
3513
3536
  }
@@ -3616,13 +3639,11 @@
3616
3639
  var observer = null;
3617
3640
  function changeMetaThemeColor(meta, theme) {
3618
3641
  srcMetaThemeColor = srcMetaThemeColor || meta.content;
3619
- try {
3620
- var color = parse(srcMetaThemeColor);
3621
- meta.content = modifyBackgroundColor(color, theme);
3622
- }
3623
- catch (err) {
3624
- logWarn(err);
3642
+ var color = parseColorWithCache(srcMetaThemeColor);
3643
+ if (!color) {
3644
+ return;
3625
3645
  }
3646
+ meta.content = modifyBackgroundColor(color, theme);
3626
3647
  }
3627
3648
  function changeMetaThemeColorWhenAvailable(theme) {
3628
3649
  var meta = document.querySelector(metaThemeColorSelector);
@@ -3931,6 +3952,7 @@
3931
3952
  (element instanceof HTMLLinkElement &&
3932
3953
  element.rel &&
3933
3954
  element.rel.toLowerCase().includes('stylesheet') &&
3955
+ element.href &&
3934
3956
  !element.disabled &&
3935
3957
  (isFirefox ? !element.href.startsWith('moz-extension://') : true) &&
3936
3958
  !isFontsGoogleApiStyle(element))) &&
@@ -4008,26 +4030,20 @@
4008
4030
  }
4009
4031
  function getRulesSync() {
4010
4032
  if (corsCopy) {
4011
- logInfo('[getRulesSync] Using cors-copy.');
4012
4033
  return corsCopy.sheet.cssRules;
4013
4034
  }
4014
4035
  if (containsCSSImport()) {
4015
- logInfo('[getRulesSync] CSSImport detected.');
4016
4036
  return null;
4017
4037
  }
4018
4038
  var cssRules = safeGetSheetRules();
4019
4039
  if (element instanceof HTMLLinkElement &&
4020
4040
  !isRelativeHrefOnAbsolutePath(element.href) &&
4021
4041
  hasImports(cssRules, false)) {
4022
- logInfo('[getRulesSync] CSSImportRule detected on non-local href.');
4023
4042
  return null;
4024
4043
  }
4025
4044
  if (hasImports(cssRules, true)) {
4026
- logInfo('[getRulesSync] Cross-Origin CSSImportRule detected.');
4027
4045
  return null;
4028
4046
  }
4029
- logInfo('[getRulesSync] Using cssRules.');
4030
- !cssRules && logWarn('[getRulesSync] cssRules is null, trying again.');
4031
4047
  return cssRules;
4032
4048
  }
4033
4049
  function insertStyle() {
@@ -4060,30 +4076,25 @@
4060
4076
  var loadingLinkId = ++loadingLinkCounter;
4061
4077
  function getRulesAsync() {
4062
4078
  return __awaiter(this, void 0, void 0, function () {
4063
- var cssText, cssBasePath, _a, cssRules, accessError, err_1, fullCSSText, err_2;
4079
+ var cssText, cssBasePath, _a, cssRules, accessError, fullCSSText;
4064
4080
  var _b;
4065
4081
  return __generator(this, function (_c) {
4066
4082
  switch (_c.label) {
4067
4083
  case 0:
4068
4084
  if (!(element instanceof HTMLLinkElement)) return [3, 7];
4069
4085
  _a = __read(getRulesOrError(), 2), cssRules = _a[0], accessError = _a[1];
4070
- if (accessError) {
4071
- logWarn(accessError);
4072
- }
4073
4086
  if (!((!cssRules && !accessError && !isSafari) ||
4074
4087
  (isSafari && !element.sheet) ||
4075
4088
  isStillLoadingError(accessError))) return [3, 5];
4076
4089
  _c.label = 1;
4077
4090
  case 1:
4078
4091
  _c.trys.push([1, 3, , 4]);
4079
- logInfo("Linkelement ".concat(loadingLinkId, " is not loaded yet and thus will be await for"), element);
4080
4092
  return [4, linkLoading(element, loadingLinkId)];
4081
4093
  case 2:
4082
4094
  _c.sent();
4083
4095
  return [3, 4];
4084
4096
  case 3:
4085
- err_1 = _c.sent();
4086
- logWarn(err_1);
4097
+ _c.sent();
4087
4098
  wasLoadingError = true;
4088
4099
  return [3, 4];
4089
4100
  case 4:
@@ -4091,9 +4102,6 @@
4091
4102
  return [2, null];
4092
4103
  }
4093
4104
  _b = __read(getRulesOrError(), 2), cssRules = _b[0], accessError = _b[1];
4094
- if (accessError) {
4095
- logWarn(accessError);
4096
- }
4097
4105
  _c.label = 5;
4098
4106
  case 5:
4099
4107
  if (cssRules) {
@@ -4129,8 +4137,7 @@
4129
4137
  corsCopy = createCORSCopy(element, fullCSSText);
4130
4138
  return [3, 12];
4131
4139
  case 11:
4132
- err_2 = _c.sent();
4133
- logWarn(err_2);
4140
+ _c.sent();
4134
4141
  return [3, 12];
4135
4142
  case 12:
4136
4143
  if (corsCopy) {
@@ -4147,7 +4154,6 @@
4147
4154
  var rules = getRulesSync();
4148
4155
  if (!rules) {
4149
4156
  if (options.secondRound) {
4150
- logWarn('Detected dead-lock at details(), returning early to prevent it.');
4151
4157
  return null;
4152
4158
  }
4153
4159
  if (isLoadingRules || wasLoadingError) {
@@ -4162,7 +4168,6 @@
4162
4168
  update();
4163
4169
  }
4164
4170
  }).catch(function (err) {
4165
- logWarn(err);
4166
4171
  isLoadingRules = false;
4167
4172
  loadingEnd();
4168
4173
  });
@@ -4239,7 +4244,6 @@
4239
4244
  function safeGetSheetRules() {
4240
4245
  var _a = __read(getRulesOrError(), 2), cssRules = _a[0], err = _a[1];
4241
4246
  if (err) {
4242
- logWarn(err);
4243
4247
  return null;
4244
4248
  }
4245
4249
  return cssRules;
@@ -4342,10 +4346,8 @@
4342
4346
  }
4343
4347
  moveCount++;
4344
4348
  if (moveCount > maxMoveCount) {
4345
- logWarn('Style sheet was moved multiple times', element);
4346
4349
  return;
4347
4350
  }
4348
- logWarn('Restore style', syncStyle, element);
4349
4351
  insertStyle();
4350
4352
  corsCopyPositionWatcher && corsCopyPositionWatcher.skip();
4351
4353
  syncStylePositionWatcher && syncStylePositionWatcher.skip();
@@ -4374,7 +4376,6 @@
4374
4376
  };
4375
4377
  var onLoad = function () {
4376
4378
  cleanUp();
4377
- logInfo("Linkelement ".concat(loadingId, " has been loaded"));
4378
4379
  resolve();
4379
4380
  };
4380
4381
  var onError = function () {
@@ -4415,7 +4416,7 @@
4415
4416
  function replaceCSSImports(cssText, basePath, cache) {
4416
4417
  if (cache === void 0) { cache = new Map(); }
4417
4418
  return __awaiter(this, void 0, void 0, function () {
4418
- var importMatches, importMatches_1, importMatches_1_1, match, importURL, absoluteURL, importedCSS, err_3, e_1_1;
4419
+ var importMatches, importMatches_1, importMatches_1_1, match, importURL, absoluteURL, importedCSS, e_1_1;
4419
4420
  var e_1, _a;
4420
4421
  return __generator(this, function (_b) {
4421
4422
  switch (_b.label) {
@@ -4449,8 +4450,7 @@
4449
4450
  importedCSS = _b.sent();
4450
4451
  return [3, 7];
4451
4452
  case 6:
4452
- err_3 = _b.sent();
4453
- logWarn(err_3);
4453
+ _b.sent();
4454
4454
  importedCSS = '';
4455
4455
  return [3, 7];
4456
4456
  case 7:
@@ -4674,7 +4674,7 @@
4674
4674
  onHugeMutations: handleHugeTreeMutations,
4675
4675
  });
4676
4676
  var attrObserver = new MutationObserver(handleAttributeMutations);
4677
- attrObserver.observe(root, { attributes: true, attributeFilter: ['rel', 'disabled', 'media'], subtree: true });
4677
+ attrObserver.observe(root, { attributes: true, attributeFilter: ['rel', 'disabled', 'media', 'href'], subtree: true });
4678
4678
  observers.push(treeObserver, attrObserver);
4679
4679
  observedRoots.add(root);
4680
4680
  }
@@ -4997,8 +4997,8 @@
4997
4997
  var darkSchemeBackgroundColor = filter.darkSchemeBackgroundColor, darkSchemeTextColor = filter.darkSchemeTextColor, lightSchemeBackgroundColor = filter.lightSchemeBackgroundColor, lightSchemeTextColor = filter.lightSchemeTextColor, mode = filter.mode;
4998
4998
  var schemeBackgroundColor = mode === 0 ? lightSchemeBackgroundColor : darkSchemeBackgroundColor;
4999
4999
  var schemeTextColor = mode === 0 ? lightSchemeTextColor : darkSchemeTextColor;
5000
- schemeBackgroundColor = modifyBackgroundColor(parse(schemeBackgroundColor), filter);
5001
- schemeTextColor = modifyForegroundColor(parse(schemeTextColor), filter);
5000
+ schemeBackgroundColor = modifyBackgroundColor(parseColorWithCache(schemeBackgroundColor), filter);
5001
+ schemeTextColor = modifyForegroundColor(parseColorWithCache(schemeTextColor), filter);
5002
5002
  variableStyle.textContent = [
5003
5003
  ":root {",
5004
5004
  " --darkreader-neutral-background: ".concat(schemeBackgroundColor, ";"),
@@ -5011,10 +5011,13 @@
5011
5011
  setupNodePositionWatcher(variableStyle, 'variables');
5012
5012
  var rootVarsStyle = createOrUpdateStyle('darkreader--root-vars');
5013
5013
  document.head.insertBefore(rootVarsStyle, variableStyle.nextSibling);
5014
- var proxyScript = createOrUpdateScript('darkreader--proxy');
5015
- proxyScript.append("(".concat(injectProxy, ")(!").concat(fixes && fixes.disableStyleSheetsProxy, ")"));
5016
- document.head.insertBefore(proxyScript, rootVarsStyle.nextSibling);
5017
- proxyScript.remove();
5014
+ var injectProxyArg = !(fixes && fixes.disableStyleSheetsProxy);
5015
+ {
5016
+ var proxyScript = createOrUpdateScript('darkreader--proxy');
5017
+ proxyScript.append("(".concat(injectProxy, ")(").concat(injectProxyArg, ")"));
5018
+ document.head.insertBefore(proxyScript, rootVarsStyle.nextSibling);
5019
+ proxyScript.remove();
5020
+ }
5018
5021
  }
5019
5022
  var shadowRootsWithOverrides = new Set();
5020
5023
  function createShadowStaticStyleOverrides(root) {
@@ -5040,11 +5043,10 @@
5040
5043
  }
5041
5044
  function replaceCSSTemplates($cssText) {
5042
5045
  return $cssText.replace(/\${(.+?)}/g, function (_, $color) {
5043
- var color = tryParseColor($color);
5046
+ var color = parseColorWithCache($color);
5044
5047
  if (color) {
5045
5048
  return modifyColor(color, filter);
5046
5049
  }
5047
- logWarn("Couldn't parse CSSTemplate's color.");
5048
5050
  return $color;
5049
5051
  });
5050
5052
  }
@@ -5091,7 +5093,6 @@
5091
5093
  var loadingStyles = new Set();
5092
5094
  function createManager(element) {
5093
5095
  var loadingStyleId = ++loadingStylesCounter;
5094
- logInfo("New manager for element, with loadingStyleID ".concat(loadingStyleId), element);
5095
5096
  function loadingStart() {
5096
5097
  if (!isDOMReady() || !didDocumentShowUp) {
5097
5098
  loadingStyles.add(loadingStyleId);
@@ -5105,7 +5106,6 @@
5105
5106
  function loadingEnd() {
5106
5107
  loadingStyles.delete(loadingStyleId);
5107
5108
  logInfo("Removed loadingStyle ".concat(loadingStyleId, ", now awaiting: ").concat(loadingStyles.size));
5108
- logInfo("To-do to be loaded", loadingStyles);
5109
5109
  if (loadingStyles.size === 0 && isDOMReady()) {
5110
5110
  cleanFallbackStyle();
5111
5111
  }
@@ -5143,7 +5143,6 @@
5143
5143
  cleanFallbackStyle();
5144
5144
  return;
5145
5145
  }
5146
- logWarn("DOM is ready, but still have styles being loaded.", loadingStyles);
5147
5146
  }
5148
5147
  var documentVisibilityListener = null;
5149
5148
  var didDocumentShowUp = !document.hidden;
@@ -5189,7 +5188,6 @@
5189
5188
  }
5190
5189
  }
5191
5190
  catch (err) {
5192
- logWarn('Error occured in handleAdoptedStyleSheets: ', err);
5193
5191
  }
5194
5192
  }
5195
5193
  function watchForUpdates() {
@@ -5201,7 +5199,6 @@
5201
5199
  .filter(function (style) { return !styleManagers.has(style); });
5202
5200
  var stylesToRestore = moved
5203
5201
  .filter(function (style) { return styleManagers.has(style); });
5204
- logInfo("Styles to be removed:", stylesToRemove);
5205
5202
  stylesToRemove.forEach(function (style) { return removeManager(style); });
5206
5203
  var newManagers = stylesToManage
5207
5204
  .map(function (style) { return createManager(style); });
@@ -5245,6 +5242,16 @@
5245
5242
  removeDOMReadyListener(onDOMReady);
5246
5243
  cleanReadyStateCompleteListeners();
5247
5244
  }
5245
+ var metaObserver;
5246
+ function addMetaListener() {
5247
+ metaObserver = new MutationObserver(function () {
5248
+ if (document.querySelector('meta[name="darkreader-lock"]')) {
5249
+ metaObserver.disconnect();
5250
+ removeDynamicTheme();
5251
+ }
5252
+ });
5253
+ metaObserver.observe(document.head, { childList: true, subtree: true });
5254
+ }
5248
5255
  function createDarkReaderInstanceMarker() {
5249
5256
  var metaElement = document.createElement('meta');
5250
5257
  metaElement.name = 'darkreader';
@@ -5252,6 +5259,9 @@
5252
5259
  document.head.appendChild(metaElement);
5253
5260
  }
5254
5261
  function isAnotherDarkReaderInstanceActive() {
5262
+ if (document.querySelector('meta[name="darkreader-lock"]')) {
5263
+ return true;
5264
+ }
5255
5265
  var meta = document.querySelector('meta[name="darkreader"]');
5256
5266
  if (meta) {
5257
5267
  if (meta.content !== INSTANCE_ID) {
@@ -5260,6 +5270,7 @@
5260
5270
  return false;
5261
5271
  }
5262
5272
  createDarkReaderInstanceMarker();
5273
+ addMetaListener();
5263
5274
  return false;
5264
5275
  }
5265
5276
  function createOrUpdateDynamicTheme(filterConfig, dynamicThemeFixes, iframe) {
@@ -5340,6 +5351,7 @@
5340
5351
  manager.destroy();
5341
5352
  });
5342
5353
  adoptedStyleManagers.splice(0);
5354
+ metaObserver && metaObserver.disconnect();
5343
5355
  }
5344
5356
  function cleanDynamicThemeCache() {
5345
5357
  variablesStore.clear();
@@ -5348,6 +5360,7 @@
5348
5360
  cancelRendering();
5349
5361
  stopWatchingForUpdates();
5350
5362
  cleanModificationCache();
5363
+ clearColorCache();
5351
5364
  }
5352
5365
 
5353
5366
  var blobRegex = /url\(\"(blob\:.*?)\"\)/g;
@@ -5370,7 +5383,7 @@
5370
5383
  });
5371
5384
  });
5372
5385
  }
5373
- var banner = "/*\n _______\n / \\\n .==. .==.\n (( ))==(( ))\n / \"==\" \"==\"\\\n /____|| || ||___\\\n ________ ____ ________ ___ ___\n | ___ \\ / \\ | ___ \\ | | / /\n | | \\ \\ / /\\ \\ | | \\ \\| |_/ /\n | | ) / /__\\ \\ | |__/ /| ___ \\\n | |__/ / ______ \\| ____ \\| | \\ \\\n_______|_______/__/ ____ \\__\\__|___\\__\\__|___\\__\\____\n| ___ \\ | ____/ / \\ | ___ \\ | ____| ___ \\\n| | \\ \\| |___ / /\\ \\ | | \\ \\| |___| | \\ \\\n| |__/ /| ____/ /__\\ \\ | | ) | ____| |__/ /\n| ____ \\| |__/ ______ \\| |__/ /| |___| ____ \\\n|__| \\__\\____/__/ \\__\\_______/ |______|__| \\__\\\n https://darkreader.org\n*/\n\n/*! Dark reader generated CSS | Licensed under MIT https://github.com/darkreader/darkreader/blob/master/LICENSE */\n";
5386
+ var banner = "/*\n _______\n / \\\n .==. .==.\n (( ))==(( ))\n / \"==\" \"==\"\\\n /____|| || ||___\\\n ________ ____ ________ ___ ___\n | ___ \\ / \\ | ___ \\ | | / /\n | | \\ \\ / /\\ \\ | | \\ \\| |_/ /\n | | ) / /__\\ \\ | |__/ /| ___ \\\n | |__/ / ______ \\| ____ \\| | \\ \\\n_______|_______/__/ ____ \\__\\__|___\\__\\__|___\\__\\____\n| ___ \\ | ____/ / \\ | ___ \\ | ____| ___ \\\n| | \\ \\| |___ / /\\ \\ | | \\ \\| |___| | \\ \\\n| |__/ /| ____/ /__\\ \\ | | ) | ____| |__/ /\n| ____ \\| |__/ ______ \\| |__/ /| |___| ____ \\\n|__| \\__\\____/__/ \\__\\_______/ |______|__| \\__\\\n https://darkreader.org\n*/\n\n/*! Dark reader generated CSS | Licensed under MIT https://github.com/darkreader/darkreader/blob/main/LICENSE */\n";
5374
5387
  function collectCSS() {
5375
5388
  return __awaiter(this, void 0, void 0, function () {
5376
5389
  function addStaticCSS(selector, comment) {
package/package.json CHANGED
@@ -1,10 +1,9 @@
1
1
  {
2
2
  "name": "darkreader",
3
- "version": "4.9.52",
3
+ "version": "4.9.57",
4
4
  "description": "Dark mode for every website",
5
5
  "scripts": {
6
6
  "api": "node tasks/build.js --api",
7
- "benchmark-server": "node tests/benchmark-server/index.js",
8
7
  "build": "node tasks/build.js --release",
9
8
  "build:all": "node tasks/build.js --debug --release --api",
10
9
  "code-style": "eslint --ignore-pattern '!.eslintplugin.js' --cache --fix -- 'src/**/*.ts' 'src/**/*.tsx' 'tasks/**/*.js' 'tests/[!coverage]**/*.js' 'tests/**/*.ts' '.eslintrc.js' 'index.d.ts' '.eslintplugin.js'",
@@ -17,15 +16,15 @@
17
16
  "test": "npm run test:unit",
18
17
  "test:all": "npm run test:unit; npm run test:browser; npm run test:inject; npm run test:project",
19
18
  "test:browser": "npm run debug && npm run test:chrome && npm run test:firefox",
20
- "test:chrome": "npm run debug && jest --config=tests/browser/jest.config.js --runInBand",
19
+ "test:chrome": "npm run debug -- --test --chrome && jest --config=tests/browser/jest.config.mjs --runInBand",
21
20
  "test:ci": "npm run test:unit",
22
- "test:coverage": "jest --config=tests/unit/jest.config.js --coverage",
23
- "test:firefox": " npm run debug && jest --config=tests/browser/jest.config.firefox.js --runInBand",
24
- "test:inject": "node --max-old-space-size=3072 node_modules/.bin/karma start ./tests/inject/karma.conf.js",
25
- "test:inject:debug": "node --max-old-space-size=3072 node_modules/.bin/karma start ./tests/inject/karma.conf.js --debug",
21
+ "test:coverage": "jest --config=tests/unit/jest.config.mjs --coverage",
22
+ "test:firefox": " npm run debug -- --test --firefox && jest --config=tests/browser/jest.config.firefox.mjs --runInBand",
23
+ "test:inject": "node --max-old-space-size=3072 node_modules/.bin/karma start ./tests/inject/karma.conf.cjs",
24
+ "test:inject:debug": "node --max-old-space-size=3072 node_modules/.bin/karma start ./tests/inject/karma.conf.cjs --debug",
26
25
  "test:project": "jest --config=tests/project/jest.config.js",
27
- "test:unit": "jest --config=tests/unit/jest.config.js",
28
- "test:unit:debug": "node --inspect-brk ./node_modules/jest/bin/jest --config=tests/unit/jest.config.js --runInBand --no-cache --watch",
26
+ "test:unit": "jest --config=tests/unit/jest.config.mjs",
27
+ "test:unit:debug": "node --inspect-brk ./node_modules/jest/bin/jest --config=tests/unit/jest.config.mjs --runInBand --no-cache --watch",
29
28
  "test:update-snapshots": "npm run test -- --updateSnapshot && npm run test:project -- --updateSnapshot",
30
29
  "translate-line": "node ./tasks/translate.js --line"
31
30
  },
@@ -54,49 +53,49 @@
54
53
  "url": "https://opencollective.com/darkreader/donate"
55
54
  },
56
55
  "devDependencies": {
57
- "@rollup/plugin-node-resolve": "13.1.3",
56
+ "@rollup/plugin-node-resolve": "13.3.0",
58
57
  "@rollup/plugin-replace": "4.0.0",
59
- "@rollup/plugin-typescript": "8.3.1",
60
- "@rollup/pluginutils": "4.2.0",
61
- "@types/chrome": "0.0.180",
62
- "@types/eslint": "8.4.1",
63
- "@types/jasmine": "4.0.0",
64
- "@types/jest": "27.4.1",
58
+ "@rollup/plugin-typescript": "8.3.4",
59
+ "@rollup/pluginutils": "4.2.1",
60
+ "@types/chrome": "0.0.195",
61
+ "@types/eslint": "8.4.6",
62
+ "@types/jasmine": "4.0.3",
63
+ "@types/jest": "28.1.7",
65
64
  "@types/karma": "6.3.3",
66
65
  "@types/karma-coverage": "2.0.1",
67
- "@types/node": "17.0.23",
68
- "@types/offscreencanvas": "2019.6.4",
69
- "@typescript-eslint/eslint-plugin": "5.16.0",
70
- "@typescript-eslint/parser": "5.16.0",
66
+ "@types/node": "18.7.8",
67
+ "@types/offscreencanvas": "2019.7.0",
68
+ "@typescript-eslint/eslint-plugin": "5.33.1",
69
+ "@typescript-eslint/parser": "5.33.1",
71
70
  "chokidar": "3.5.3",
72
- "eslint": "8.11.0",
71
+ "eslint": "8.22.0",
73
72
  "eslint-plugin-compat": "4.0.2",
74
- "eslint-plugin-import": "2.25.4",
73
+ "eslint-plugin-import": "2.26.0",
75
74
  "eslint-plugin-local": "1.0.0",
76
75
  "get-stream": "6.0.1",
77
- "globby": "13.1.1",
78
- "jasmine-core": "4.0.1",
79
- "jest": "27.5.1",
80
- "jest-extended": "2.0.0",
81
- "karma": "6.3.17",
76
+ "globby": "13.1.2",
77
+ "jasmine-core": "4.3.0",
78
+ "jest": "28.1.3",
79
+ "jest-extended": "3.0.2",
80
+ "karma": "6.4.0",
82
81
  "karma-chrome-launcher": "3.1.1",
83
82
  "karma-coverage": "2.2.0",
84
83
  "karma-firefox-launcher": "2.1.2",
85
- "karma-jasmine": "4.0.1",
84
+ "karma-jasmine": "5.1.0",
86
85
  "karma-rollup-preprocessor": "7.0.8",
87
86
  "karma-safari-launcher": "1.0.0",
88
- "karma-spec-reporter": "0.0.33",
89
- "less": "4.1.2",
87
+ "karma-spec-reporter": "0.0.34",
88
+ "less": "4.1.3",
90
89
  "malevic": "0.19.1",
91
- "prettier": "2.6.1",
92
- "puppeteer-core": "13.5.1",
93
- "rollup": "2.70.1",
90
+ "prettier": "2.7.1",
91
+ "puppeteer-core": "16.2.0",
92
+ "rollup": "2.78.1",
94
93
  "rollup-plugin-istanbul2": "2.0.2",
95
- "ts-jest": "27.1.4",
96
- "tslib": "2.3.1",
97
- "typescript": "4.6.3",
98
- "web-ext": "6.8.0",
99
- "ws": "8.5.0",
94
+ "ts-jest": "28.0.8",
95
+ "tslib": "2.4.0",
96
+ "typescript": "4.7.4",
97
+ "web-ext": "7.2.0",
98
+ "ws": "8.8.1",
100
99
  "yazl": "2.5.1"
101
100
  }
102
101
  }