extension-develop 3.14.2 → 3.14.3-canary.283.2985d42
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.
- package/dist/{144.cjs → 740.cjs} +49 -44
- package/dist/module.cjs +117 -71
- package/dist/preview.cjs +1 -1
- package/package.json +1 -1
package/dist/{144.cjs → 740.cjs}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
exports.ids = [
|
|
3
|
-
"
|
|
3
|
+
"740"
|
|
4
4
|
];
|
|
5
5
|
exports.modules = {
|
|
6
6
|
"./dev-server/compiler-hooks.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
@@ -151,7 +151,6 @@ exports.modules = {
|
|
|
151
151
|
return patchedManifest;
|
|
152
152
|
}
|
|
153
153
|
var lib_paths = __webpack_require__("./lib/paths.ts");
|
|
154
|
-
var dark_mode = __webpack_require__("./lib/dark-mode.ts");
|
|
155
154
|
var messages = __webpack_require__("./lib/messages.ts");
|
|
156
155
|
var extensions_to_load = __webpack_require__("./lib/extensions-to-load.ts");
|
|
157
156
|
var external_module_ = __webpack_require__("module");
|
|
@@ -824,30 +823,10 @@ exports.modules = {
|
|
|
824
823
|
}
|
|
825
824
|
};
|
|
826
825
|
}
|
|
827
|
-
|
|
828
|
-
const CANONICAL_CONTENT_SCRIPT_ENTRY_PREFIX = "content_scripts/content-";
|
|
829
|
-
function getCanonicalContentScriptEntryName(index) {
|
|
830
|
-
return `${CANONICAL_CONTENT_SCRIPT_ENTRY_PREFIX}${index}`;
|
|
831
|
-
}
|
|
832
|
-
function getCanonicalContentScriptJsAssetName(index) {
|
|
833
|
-
return `${getCanonicalContentScriptEntryName(index)}.js`;
|
|
834
|
-
}
|
|
835
|
-
function getCanonicalContentScriptCssAssetName(index) {
|
|
836
|
-
return `${getCanonicalContentScriptEntryName(index)}.css`;
|
|
837
|
-
}
|
|
838
|
-
function parseCanonicalContentScriptAsset(assetName) {
|
|
839
|
-
const match = /^content_scripts\/content-(\d+)(?:\.[a-f0-9]+)?\.(js|css)$/i.exec(String(assetName || ''));
|
|
840
|
-
if (!match) return;
|
|
841
|
-
const index = Number(match[1]);
|
|
842
|
-
if (!Number.isInteger(index)) return;
|
|
843
|
-
return {
|
|
844
|
-
index,
|
|
845
|
-
extension: match[2]
|
|
846
|
-
};
|
|
847
|
-
}
|
|
826
|
+
var contracts = __webpack_require__("./plugin-web-extension/feature-scripts/contracts.ts");
|
|
848
827
|
function isBundledContentPath(filePath, ext) {
|
|
849
828
|
const normalized = String(filePath || '').replace(/\\/g, '/');
|
|
850
|
-
const bundledAsset =
|
|
829
|
+
const bundledAsset = (0, contracts.es)(normalized);
|
|
851
830
|
return bundledAsset?.extension === ext;
|
|
852
831
|
}
|
|
853
832
|
function isAlreadyBundledContentScripts(contentScripts) {
|
|
@@ -881,7 +860,7 @@ exports.modules = {
|
|
|
881
860
|
result.push({
|
|
882
861
|
...rest,
|
|
883
862
|
js: [
|
|
884
|
-
getFilename(
|
|
863
|
+
getFilename((0, contracts.f6)(bridgeIndex), 'main-world-bridge.js')
|
|
885
864
|
],
|
|
886
865
|
css: []
|
|
887
866
|
});
|
|
@@ -889,10 +868,10 @@ exports.modules = {
|
|
|
889
868
|
result.push({
|
|
890
869
|
...original[index] || {},
|
|
891
870
|
js: [
|
|
892
|
-
...new Set(contentJs.map((js)=>getFilename(
|
|
871
|
+
...new Set(contentJs.map((js)=>getFilename((0, contracts.f6)(index), js)))
|
|
893
872
|
],
|
|
894
873
|
css: [
|
|
895
|
-
...new Set(contentCss.map((css)=>getFilename(
|
|
874
|
+
...new Set(contentCss.map((css)=>getFilename((0, contracts.J4)(index), css)))
|
|
896
875
|
]
|
|
897
876
|
});
|
|
898
877
|
}
|
|
@@ -1472,8 +1451,20 @@ exports.modules = {
|
|
|
1472
1451
|
bannerPrinted: false,
|
|
1473
1452
|
pendingCompilationLine: ''
|
|
1474
1453
|
};
|
|
1454
|
+
function markBannerPrinted() {
|
|
1455
|
+
sharedState.bannerPrinted = true;
|
|
1456
|
+
if (sharedState.pendingCompilationLine) {
|
|
1457
|
+
console.log(sharedState.pendingCompilationLine);
|
|
1458
|
+
sharedState.pendingCompilationLine = '';
|
|
1459
|
+
}
|
|
1460
|
+
}
|
|
1475
1461
|
function isBannerPrinted() {
|
|
1476
|
-
|
|
1462
|
+
if (sharedState.bannerPrinted) return true;
|
|
1463
|
+
if ('true' === process.env.EXTENSION_CLI_BANNER_PRINTED) {
|
|
1464
|
+
markBannerPrinted();
|
|
1465
|
+
return true;
|
|
1466
|
+
}
|
|
1467
|
+
return false;
|
|
1477
1468
|
}
|
|
1478
1469
|
function setPendingCompilationLine(line) {
|
|
1479
1470
|
sharedState.pendingCompilationLine = line;
|
|
@@ -3051,7 +3042,7 @@ exports.modules = {
|
|
|
3051
3042
|
] : [];
|
|
3052
3043
|
const hasReactRefreshLoader = uses.some((useEntry)=>String(useEntry?.loader || '').includes('react-refresh-loader'));
|
|
3053
3044
|
if (hasReactRefreshLoader) rule.issuerLayer = {
|
|
3054
|
-
not:
|
|
3045
|
+
not: contracts.$t
|
|
3055
3046
|
};
|
|
3056
3047
|
if (Array.isArray(rule.oneOf)) this.patchReactRefreshRules(rule.oneOf);
|
|
3057
3048
|
if (Array.isArray(rule.rules)) this.patchReactRefreshRules(rule.rules);
|
|
@@ -3180,7 +3171,7 @@ exports.modules = {
|
|
|
3180
3171
|
const swcRules = [
|
|
3181
3172
|
{
|
|
3182
3173
|
...swcRuleBase,
|
|
3183
|
-
layer:
|
|
3174
|
+
layer: contracts.$t,
|
|
3184
3175
|
include: (resourcePath)=>Array.from(new Set([
|
|
3185
3176
|
tsRoot,
|
|
3186
3177
|
...swcIncludeDirs
|
|
@@ -3204,8 +3195,8 @@ exports.modules = {
|
|
|
3204
3195
|
},
|
|
3205
3196
|
{
|
|
3206
3197
|
...swcRuleBase,
|
|
3207
|
-
issuerLayer:
|
|
3208
|
-
layer:
|
|
3198
|
+
issuerLayer: contracts.$t,
|
|
3199
|
+
layer: contracts.$t,
|
|
3209
3200
|
use: {
|
|
3210
3201
|
...swcLoaderBase,
|
|
3211
3202
|
options: {
|
|
@@ -3226,7 +3217,7 @@ exports.modules = {
|
|
|
3226
3217
|
{
|
|
3227
3218
|
...swcRuleBase,
|
|
3228
3219
|
issuerLayer: {
|
|
3229
|
-
not:
|
|
3220
|
+
not: contracts.$t
|
|
3230
3221
|
},
|
|
3231
3222
|
exclude: [
|
|
3232
3223
|
...swcRuleBase.exclude,
|
|
@@ -3408,7 +3399,7 @@ exports.modules = {
|
|
|
3408
3399
|
};
|
|
3409
3400
|
}
|
|
3410
3401
|
function resolveDevContentScriptDeclaredPath(declaredPath, _groupIndex, ext, assetNames) {
|
|
3411
|
-
const parsed =
|
|
3402
|
+
const parsed = (0, contracts.es)(declaredPath);
|
|
3412
3403
|
if (!parsed || parsed.extension !== ext) return declaredPath;
|
|
3413
3404
|
const hashed = findHashedContentScriptAsset(assetNames, parsed.index, ext);
|
|
3414
3405
|
return hashed || declaredPath;
|
|
@@ -5675,7 +5666,7 @@ exports.modules = {
|
|
|
5675
5666
|
external_path_.dirname(this.manifestPath)
|
|
5676
5667
|
],
|
|
5677
5668
|
issuerLayer: {
|
|
5678
|
-
not:
|
|
5669
|
+
not: contracts.$t
|
|
5679
5670
|
},
|
|
5680
5671
|
exclude: [
|
|
5681
5672
|
/([\\/])node_modules\1/,
|
|
@@ -5816,7 +5807,7 @@ exports.modules = {
|
|
|
5816
5807
|
const cs = contentScripts[i];
|
|
5817
5808
|
if (cs?.world !== 'MAIN') continue;
|
|
5818
5809
|
const bridgeIndex = originalCount + bridgeOrdinal++;
|
|
5819
|
-
bridgeScripts[
|
|
5810
|
+
bridgeScripts[(0, contracts.Y0)(bridgeIndex)] = bridgeSource;
|
|
5820
5811
|
}
|
|
5821
5812
|
} catch {}
|
|
5822
5813
|
return bridgeScripts;
|
|
@@ -5969,7 +5960,7 @@ exports.modules = {
|
|
|
5969
5960
|
} : {
|
|
5970
5961
|
import: finalEntryImports,
|
|
5971
5962
|
...isContentScriptFeature(feature) || isScriptsFolderFeature(feature) ? {
|
|
5972
|
-
layer:
|
|
5963
|
+
layer: contracts.$t
|
|
5973
5964
|
} : {}
|
|
5974
5965
|
};
|
|
5975
5966
|
}
|
|
@@ -7349,11 +7340,11 @@ Set background.noDynamicEntryWarning to true to disable this warning.
|
|
|
7349
7340
|
let bridgeOrdinal = 0;
|
|
7350
7341
|
for(let i = 0; i < csList.length; i++){
|
|
7351
7342
|
const cs = csList[i];
|
|
7352
|
-
const bundleId =
|
|
7343
|
+
const bundleId = (0, contracts.f6)(i);
|
|
7353
7344
|
const isMain = cs?.world === 'MAIN';
|
|
7354
7345
|
if (isMain) {
|
|
7355
7346
|
const bridgeIndex = originalCount + bridgeOrdinal++;
|
|
7356
|
-
const bridgeBundleId =
|
|
7347
|
+
const bridgeBundleId = (0, contracts.f6)(bridgeIndex);
|
|
7357
7348
|
contentScriptsMeta[bundleId] = {
|
|
7358
7349
|
index: i,
|
|
7359
7350
|
bundleId,
|
|
@@ -8898,11 +8889,6 @@ Set background.noDynamicEntryWarning to true to disable this warning.
|
|
|
8898
8889
|
console.log(messages.jM(unpackedExtensionDirsToLoad));
|
|
8899
8890
|
if (void 0 !== devOptions.extensions && 0 === companionUnpackedExtensionDirs.length) console.warn(messages.yp());
|
|
8900
8891
|
}
|
|
8901
|
-
(0, dark_mode.U)({
|
|
8902
|
-
browser: devOptions.browser,
|
|
8903
|
-
browserFlags: devOptions.browserFlags,
|
|
8904
|
-
preferences: devOptions.preferences
|
|
8905
|
-
});
|
|
8906
8892
|
const plugins = [
|
|
8907
8893
|
new CompilationPlugin({
|
|
8908
8894
|
manifestPath,
|
|
@@ -8992,9 +8978,28 @@ Set background.noDynamicEntryWarning to true to disable this warning.
|
|
|
8992
8978
|
conditionNames: [
|
|
8993
8979
|
'browser',
|
|
8994
8980
|
'import',
|
|
8981
|
+
'require',
|
|
8995
8982
|
'module',
|
|
8996
8983
|
'default'
|
|
8997
8984
|
],
|
|
8985
|
+
byDependency: {
|
|
8986
|
+
esm: {
|
|
8987
|
+
conditionNames: [
|
|
8988
|
+
'browser',
|
|
8989
|
+
'import',
|
|
8990
|
+
'module',
|
|
8991
|
+
'default'
|
|
8992
|
+
]
|
|
8993
|
+
},
|
|
8994
|
+
commonjs: {
|
|
8995
|
+
conditionNames: [
|
|
8996
|
+
'browser',
|
|
8997
|
+
'require',
|
|
8998
|
+
'module',
|
|
8999
|
+
'default'
|
|
9000
|
+
]
|
|
9001
|
+
}
|
|
9002
|
+
},
|
|
8998
9003
|
aliasFields: [
|
|
8999
9004
|
'browser'
|
|
9000
9005
|
],
|
package/dist/module.cjs
CHANGED
|
@@ -357,51 +357,6 @@ var __webpack_modules__ = {
|
|
|
357
357
|
return false;
|
|
358
358
|
}
|
|
359
359
|
},
|
|
360
|
-
"./lib/dark-mode.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
361
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
362
|
-
U: ()=>withDarkMode
|
|
363
|
-
});
|
|
364
|
-
function getDarkModeDefaults(browser) {
|
|
365
|
-
if ('chrome' === browser || 'edge' === browser || 'chromium' === browser || 'chromium-based' === browser) return {
|
|
366
|
-
browserFlags: [
|
|
367
|
-
'--force-dark-mode',
|
|
368
|
-
'--enable-features=WebUIDarkMode'
|
|
369
|
-
],
|
|
370
|
-
preferences: {}
|
|
371
|
-
};
|
|
372
|
-
if ('firefox' === browser || 'gecko-based' === browser || 'firefox-based' === browser) return {
|
|
373
|
-
browserFlags: [],
|
|
374
|
-
preferences: {
|
|
375
|
-
'ui.systemUsesDarkTheme': 1,
|
|
376
|
-
'layout.css.prefers-color-scheme.content-override': 2,
|
|
377
|
-
'devtools.theme': 'dark'
|
|
378
|
-
}
|
|
379
|
-
};
|
|
380
|
-
return {
|
|
381
|
-
browserFlags: [],
|
|
382
|
-
preferences: {}
|
|
383
|
-
};
|
|
384
|
-
}
|
|
385
|
-
function withDarkMode(config) {
|
|
386
|
-
const defaults = getDarkModeDefaults(config.browser);
|
|
387
|
-
const existingFlags = Array.isArray(config.browserFlags) ? [
|
|
388
|
-
...config.browserFlags
|
|
389
|
-
] : [];
|
|
390
|
-
const nextFlags = [
|
|
391
|
-
...existingFlags
|
|
392
|
-
];
|
|
393
|
-
for (const flag of defaults.browserFlags || [])if (!nextFlags.some((f)=>String(f).trim() === flag)) nextFlags.push(flag);
|
|
394
|
-
const nextPreferences = {
|
|
395
|
-
...config.preferences || {},
|
|
396
|
-
...Object.fromEntries(Object.entries(defaults.preferences || {}).filter(([k])=>!(k in (config.preferences || {}))))
|
|
397
|
-
};
|
|
398
|
-
return {
|
|
399
|
-
...config,
|
|
400
|
-
browserFlags: nextFlags,
|
|
401
|
-
preferences: nextPreferences
|
|
402
|
-
};
|
|
403
|
-
}
|
|
404
|
-
},
|
|
405
360
|
"./lib/develop-context.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
406
361
|
__webpack_require__.d(__webpack_exports__, {
|
|
407
362
|
G5: ()=>resolveDevelopDistFile,
|
|
@@ -2149,6 +2104,36 @@ var __webpack_modules__ = {
|
|
|
2149
2104
|
};
|
|
2150
2105
|
}
|
|
2151
2106
|
},
|
|
2107
|
+
"./plugin-web-extension/feature-scripts/contracts.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
2108
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
2109
|
+
$t: ()=>EXTENSIONJS_CONTENT_SCRIPT_LAYER,
|
|
2110
|
+
J4: ()=>getCanonicalContentScriptCssAssetName,
|
|
2111
|
+
Y0: ()=>getCanonicalContentScriptEntryName,
|
|
2112
|
+
es: ()=>parseCanonicalContentScriptAsset,
|
|
2113
|
+
f6: ()=>getCanonicalContentScriptJsAssetName
|
|
2114
|
+
});
|
|
2115
|
+
const EXTENSIONJS_CONTENT_SCRIPT_LAYER = "extensionjs-content-script";
|
|
2116
|
+
const CANONICAL_CONTENT_SCRIPT_ENTRY_PREFIX = "content_scripts/content-";
|
|
2117
|
+
function getCanonicalContentScriptEntryName(index) {
|
|
2118
|
+
return `${CANONICAL_CONTENT_SCRIPT_ENTRY_PREFIX}${index}`;
|
|
2119
|
+
}
|
|
2120
|
+
function getCanonicalContentScriptJsAssetName(index) {
|
|
2121
|
+
return `${getCanonicalContentScriptEntryName(index)}.js`;
|
|
2122
|
+
}
|
|
2123
|
+
function getCanonicalContentScriptCssAssetName(index) {
|
|
2124
|
+
return `${getCanonicalContentScriptEntryName(index)}.css`;
|
|
2125
|
+
}
|
|
2126
|
+
function parseCanonicalContentScriptAsset(assetName) {
|
|
2127
|
+
const match = /^content_scripts\/content-(\d+)(?:\.[a-f0-9]+)?\.(js|css)$/i.exec(String(assetName || ''));
|
|
2128
|
+
if (!match) return;
|
|
2129
|
+
const index = Number(match[1]);
|
|
2130
|
+
if (!Number.isInteger(index)) return;
|
|
2131
|
+
return {
|
|
2132
|
+
index,
|
|
2133
|
+
extension: match[2]
|
|
2134
|
+
};
|
|
2135
|
+
}
|
|
2136
|
+
},
|
|
2152
2137
|
"@rspack/core" (module) {
|
|
2153
2138
|
module.exports = require("@rspack/core");
|
|
2154
2139
|
},
|
|
@@ -2216,7 +2201,7 @@ var __webpack_modules__ = {
|
|
|
2216
2201
|
module.exports = require("webpack-merge");
|
|
2217
2202
|
},
|
|
2218
2203
|
"./package.json" (module) {
|
|
2219
|
-
module.exports = JSON.parse('{"rE":"3.14.
|
|
2204
|
+
module.exports = JSON.parse('{"rE":"3.14.3-canary.283.2985d42","El":{"@prefresh/core":"1.5.9","@prefresh/utils":"1.2.1","@rspack/core":"^1.7.5","@rspack/dev-server":"^1.2.1","@rspack/plugin-preact-refresh":"1.1.4","@rspack/plugin-react-refresh":"1.6.0","@swc/core":"^1.15.8","@swc/helpers":"^0.5.18","@vue/compiler-sfc":"3.5.26","adm-zip":"^0.5.16","browser-extension-manifest-fields":"^2.2.1","case-sensitive-paths-webpack-plugin":"^2.4.0","content-security-policy-parser":"^0.6.0","cross-spawn":"^7.0.6","dotenv":"^17.2.3","extension-from-store":"^0.1.1","go-git-it":"^5.1.5","ignore":"^7.0.5","less":"4.5.1","less-loader":"12.3.0","loader-utils":"^3.3.1","magic-string":"^0.30.21","parse5-utilities":"^1.0.0","pintor":"0.3.0","postcss":"8.5.6","postcss-loader":"8.2.0","postcss-preset-env":"11.1.1","postcss-scss":"4.0.9","preact":"10.27.3","react-refresh":"0.18.0","sass-loader":"16.0.6","schema-utils":"^4.3.3","svelte-loader":"3.2.4","tiny-glob":"^0.2.9","typescript":"5.9.3","unique-names-generator":"^4.7.1","vue":"3.5.26","vue-loader":"17.4.2","webextension-polyfill":"^0.12.0","webpack-merge":"^6.0.1","webpack-target-webextension":"^2.1.3"}}');
|
|
2220
2205
|
}
|
|
2221
2206
|
};
|
|
2222
2207
|
var __webpack_module_cache__ = {};
|
|
@@ -2894,7 +2879,7 @@ var __webpack_exports__ = {};
|
|
|
2894
2879
|
Promise.resolve(require1('@rspack/core')),
|
|
2895
2880
|
import("webpack-merge"),
|
|
2896
2881
|
__webpack_require__.e("750").then(__webpack_require__.bind(__webpack_require__, "./lib/stats-handler.ts")),
|
|
2897
|
-
__webpack_require__.e("
|
|
2882
|
+
__webpack_require__.e("740").then(__webpack_require__.bind(__webpack_require__, "./rspack-config.ts"))
|
|
2898
2883
|
]);
|
|
2899
2884
|
const debug = isAuthor;
|
|
2900
2885
|
if (projectStructure.packageJsonPath) assertNoManagedDependencyConflicts(projectStructure.packageJsonPath, manifestDir);
|
|
@@ -3010,6 +2995,7 @@ var __webpack_exports__ = {};
|
|
|
3010
2995
|
}
|
|
3011
2996
|
var sanitize = __webpack_require__("./lib/sanitize.ts");
|
|
3012
2997
|
const external_node_events_namespaceObject = require("node:events");
|
|
2998
|
+
var contracts = __webpack_require__("./plugin-web-extension/feature-scripts/contracts.ts");
|
|
3013
2999
|
function _define_property(obj, key, value) {
|
|
3014
3000
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
3015
3001
|
value: value,
|
|
@@ -3025,21 +3011,18 @@ var __webpack_exports__ = {};
|
|
|
3025
3011
|
class BrowsersPlugin {
|
|
3026
3012
|
apply(compiler) {
|
|
3027
3013
|
let pendingReloadReason;
|
|
3014
|
+
let pendingChangedSources = [];
|
|
3028
3015
|
compiler.hooks.watchRun.tap(BrowsersPlugin.name, ()=>{
|
|
3029
3016
|
pendingReloadReason = void 0;
|
|
3017
|
+
pendingChangedSources = [];
|
|
3030
3018
|
const modifiedFiles = compiler.modifiedFiles;
|
|
3031
3019
|
if (!modifiedFiles || 0 === modifiedFiles.size) return;
|
|
3020
|
+
const contextDir = compiler.options.context || '';
|
|
3032
3021
|
for (const file of modifiedFiles){
|
|
3033
|
-
const
|
|
3034
|
-
|
|
3035
|
-
if (normalized.includes('manifest.json'))
|
|
3036
|
-
|
|
3037
|
-
return;
|
|
3038
|
-
}
|
|
3039
|
-
if (normalized.includes('_locales/')) {
|
|
3040
|
-
pendingReloadReason = 'full';
|
|
3041
|
-
return;
|
|
3042
|
-
}
|
|
3022
|
+
const normalized = external_path_.relative(contextDir, file).replace(/\\/g, '/');
|
|
3023
|
+
pendingChangedSources.push(normalized);
|
|
3024
|
+
if (normalized.includes('manifest.json')) pendingReloadReason = 'full';
|
|
3025
|
+
else if (normalized.includes('_locales/')) pendingReloadReason = 'full';
|
|
3043
3026
|
}
|
|
3044
3027
|
});
|
|
3045
3028
|
compiler.hooks.done.tapPromise(BrowsersPlugin.name, async (stats)=>{
|
|
@@ -3054,20 +3037,24 @@ var __webpack_exports__ = {};
|
|
|
3054
3037
|
if (!this.isFirstCompile && pendingReloadReason) reloadInstruction = {
|
|
3055
3038
|
type: pendingReloadReason
|
|
3056
3039
|
};
|
|
3057
|
-
else if (!this.isFirstCompile) {
|
|
3058
|
-
const
|
|
3059
|
-
const hasServiceWorkerChange =
|
|
3040
|
+
else if (!this.isFirstCompile && pendingChangedSources.length > 0) {
|
|
3041
|
+
const isServiceWorkerSource = (rel)=>/(^|\/)background(\.|\/)/i.test(rel) || /service[-_.]?worker/i.test(rel);
|
|
3042
|
+
const hasServiceWorkerChange = pendingChangedSources.some(isServiceWorkerSource);
|
|
3060
3043
|
if (hasServiceWorkerChange) reloadInstruction = {
|
|
3061
3044
|
type: 'service-worker',
|
|
3062
|
-
changedAssets
|
|
3045
|
+
changedAssets: pendingChangedSources
|
|
3063
3046
|
};
|
|
3064
|
-
else
|
|
3065
|
-
const
|
|
3066
|
-
if (
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3047
|
+
else {
|
|
3048
|
+
const contentScriptCount = readContentScriptCount(compilation, outputPath);
|
|
3049
|
+
if (contentScriptCount > 0) {
|
|
3050
|
+
const entries = [];
|
|
3051
|
+
for(let i = 0; i < contentScriptCount; i++)entries.push((0, contracts.Y0)(i));
|
|
3052
|
+
reloadInstruction = {
|
|
3053
|
+
type: "content-scripts",
|
|
3054
|
+
changedContentScriptEntries: entries,
|
|
3055
|
+
changedAssets: pendingChangedSources
|
|
3056
|
+
};
|
|
3057
|
+
}
|
|
3071
3058
|
}
|
|
3072
3059
|
}
|
|
3073
3060
|
const wasFirstCompile = this.isFirstCompile;
|
|
@@ -3121,6 +3108,26 @@ var __webpack_exports__ = {};
|
|
|
3121
3108
|
}
|
|
3122
3109
|
}
|
|
3123
3110
|
_define_property(BrowsersPlugin, "name", 'plugin-browsers');
|
|
3111
|
+
function readContentScriptCount(compilation, outputPath) {
|
|
3112
|
+
try {
|
|
3113
|
+
const asset = compilation.getAsset?.('manifest.json');
|
|
3114
|
+
if (asset?.source) {
|
|
3115
|
+
const manifest = JSON.parse(String(asset.source.source()));
|
|
3116
|
+
const list = manifest?.content_scripts;
|
|
3117
|
+
if (Array.isArray(list)) return list.length;
|
|
3118
|
+
}
|
|
3119
|
+
} catch {}
|
|
3120
|
+
try {
|
|
3121
|
+
const fs = __webpack_require__("fs");
|
|
3122
|
+
const manifestPath = external_path_.join(outputPath, 'manifest.json');
|
|
3123
|
+
if (fs.existsSync(manifestPath)) {
|
|
3124
|
+
const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8'));
|
|
3125
|
+
const list = manifest?.content_scripts;
|
|
3126
|
+
if (Array.isArray(list)) return list.length;
|
|
3127
|
+
}
|
|
3128
|
+
} catch {}
|
|
3129
|
+
return 0;
|
|
3130
|
+
}
|
|
3124
3131
|
var typescript = __webpack_require__("./plugin-js-frameworks/js-tools/typescript.ts");
|
|
3125
3132
|
async function extensionDev(pathOrRemoteUrl, devOptions) {
|
|
3126
3133
|
let browsersPlugin;
|
|
@@ -3190,7 +3197,7 @@ var __webpack_exports__ = {};
|
|
|
3190
3197
|
}
|
|
3191
3198
|
if ('true' === process.env.EXTENSION_DEV_DRY_RUN) return emitter;
|
|
3192
3199
|
const { devServer } = await Promise.all([
|
|
3193
|
-
__webpack_require__.e("
|
|
3200
|
+
__webpack_require__.e("740"),
|
|
3194
3201
|
__webpack_require__.e("481")
|
|
3195
3202
|
]).then(__webpack_require__.bind(__webpack_require__, "./dev-server/index.ts"));
|
|
3196
3203
|
await devServer(projectStructure, {
|
|
@@ -3263,7 +3270,46 @@ var __webpack_exports__ = {};
|
|
|
3263
3270
|
return unique;
|
|
3264
3271
|
}
|
|
3265
3272
|
var extensions_to_load = __webpack_require__("./lib/extensions-to-load.ts");
|
|
3266
|
-
|
|
3273
|
+
function getDarkModeDefaults(browser) {
|
|
3274
|
+
if ('chrome' === browser || 'edge' === browser || 'chromium' === browser || 'chromium-based' === browser) return {
|
|
3275
|
+
browserFlags: [
|
|
3276
|
+
'--force-dark-mode',
|
|
3277
|
+
'--enable-features=WebUIDarkMode'
|
|
3278
|
+
],
|
|
3279
|
+
preferences: {}
|
|
3280
|
+
};
|
|
3281
|
+
if ('firefox' === browser || 'gecko-based' === browser || 'firefox-based' === browser) return {
|
|
3282
|
+
browserFlags: [],
|
|
3283
|
+
preferences: {
|
|
3284
|
+
'ui.systemUsesDarkTheme': 1,
|
|
3285
|
+
'layout.css.prefers-color-scheme.content-override': 2,
|
|
3286
|
+
'devtools.theme': 'dark'
|
|
3287
|
+
}
|
|
3288
|
+
};
|
|
3289
|
+
return {
|
|
3290
|
+
browserFlags: [],
|
|
3291
|
+
preferences: {}
|
|
3292
|
+
};
|
|
3293
|
+
}
|
|
3294
|
+
function withDarkMode(config) {
|
|
3295
|
+
const defaults = getDarkModeDefaults(config.browser);
|
|
3296
|
+
const existingFlags = Array.isArray(config.browserFlags) ? [
|
|
3297
|
+
...config.browserFlags
|
|
3298
|
+
] : [];
|
|
3299
|
+
const nextFlags = [
|
|
3300
|
+
...existingFlags
|
|
3301
|
+
];
|
|
3302
|
+
for (const flag of defaults.browserFlags || [])if (!nextFlags.some((f)=>String(f).trim() === flag)) nextFlags.push(flag);
|
|
3303
|
+
const nextPreferences = {
|
|
3304
|
+
...config.preferences || {},
|
|
3305
|
+
...Object.fromEntries(Object.entries(defaults.preferences || {}).filter(([k])=>!(k in (config.preferences || {}))))
|
|
3306
|
+
};
|
|
3307
|
+
return {
|
|
3308
|
+
...config,
|
|
3309
|
+
browserFlags: nextFlags,
|
|
3310
|
+
preferences: nextPreferences
|
|
3311
|
+
};
|
|
3312
|
+
}
|
|
3267
3313
|
var dev_server_messages = __webpack_require__("./dev-server/messages.ts");
|
|
3268
3314
|
async function extensionPreview(pathOrRemoteUrl, previewOptions, browserLauncher) {
|
|
3269
3315
|
const projectStructure = await getProjectStructure(pathOrRemoteUrl);
|
|
@@ -3329,7 +3375,7 @@ var __webpack_exports__ = {};
|
|
|
3329
3375
|
chromiumBinary: mergedChromiumBinary,
|
|
3330
3376
|
geckoBinary: mergedGeckoBinary
|
|
3331
3377
|
};
|
|
3332
|
-
const darkDefaults = (
|
|
3378
|
+
const darkDefaults = withDarkMode({
|
|
3333
3379
|
browser,
|
|
3334
3380
|
browserFlags: merged.browserFlags,
|
|
3335
3381
|
preferences: merged.preferences
|
package/dist/preview.cjs
CHANGED
|
@@ -150,7 +150,7 @@ var __webpack_modules__ = {
|
|
|
150
150
|
module.exports = require("pintor");
|
|
151
151
|
},
|
|
152
152
|
"./package.json" (module) {
|
|
153
|
-
module.exports = JSON.parse('{"rE":"3.14.
|
|
153
|
+
module.exports = JSON.parse('{"rE":"3.14.3-canary.283.2985d42","El":{"@prefresh/core":"1.5.9","@prefresh/utils":"1.2.1","@rspack/core":"^1.7.5","@rspack/dev-server":"^1.2.1","@rspack/plugin-preact-refresh":"1.1.4","@rspack/plugin-react-refresh":"1.6.0","@swc/core":"^1.15.8","@swc/helpers":"^0.5.18","@vue/compiler-sfc":"3.5.26","adm-zip":"^0.5.16","browser-extension-manifest-fields":"^2.2.1","case-sensitive-paths-webpack-plugin":"^2.4.0","content-security-policy-parser":"^0.6.0","cross-spawn":"^7.0.6","dotenv":"^17.2.3","extension-from-store":"^0.1.1","go-git-it":"^5.1.5","ignore":"^7.0.5","less":"4.5.1","less-loader":"12.3.0","loader-utils":"^3.3.1","magic-string":"^0.30.21","parse5-utilities":"^1.0.0","pintor":"0.3.0","postcss":"8.5.6","postcss-loader":"8.2.0","postcss-preset-env":"11.1.1","postcss-scss":"4.0.9","preact":"10.27.3","react-refresh":"0.18.0","sass-loader":"16.0.6","schema-utils":"^4.3.3","svelte-loader":"3.2.4","tiny-glob":"^0.2.9","typescript":"5.9.3","unique-names-generator":"^4.7.1","vue":"3.5.26","vue-loader":"17.4.2","webextension-polyfill":"^0.12.0","webpack-merge":"^6.0.1","webpack-target-webextension":"^2.1.3"}}');
|
|
154
154
|
}
|
|
155
155
|
};
|
|
156
156
|
var __webpack_module_cache__ = {};
|
package/package.json
CHANGED