extension-develop 3.10.3 → 3.10.4-canary.1
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/215.cjs +350 -69
- package/dist/323.cjs +456 -26
- package/dist/324.cjs +15 -9
- package/dist/{270.cjs → 677.cjs} +3118 -504
- package/dist/ensure-hmr-for-scripts.cjs +50 -0
- package/dist/ensure-hmr-for-scripts.js +145 -0
- package/dist/feature-scripts-content-script-wrapper.cjs +237 -0
- package/dist/feature-scripts-content-script-wrapper.js +237 -0
- package/dist/main-world-bridge.js +127 -0
- package/dist/minimum-chromium-file.js +10 -0
- package/dist/minimum-firefox-file.js +10 -0
- package/dist/minimum-script-file.js +31 -0
- package/dist/module.cjs +1999 -1690
- package/dist/package.json +3 -0
- package/dist/resolve-paths-loader.js +1350 -0
- package/package.json +5 -5
- package/dist/add-hmr-accept-code.cjs +0 -91
- package/dist/content-script-wrapper.cjs +0 -319
- package/dist/extension-js-devtools/chrome/assets/developer-mode-off.f9a94937.jpeg +0 -0
- package/dist/extension-js-devtools/chrome/assets/developer-mode-on.ede80e5b.jpeg +0 -0
- package/dist/extension-js-devtools/chrome/assets/local-network-permission.4fae40a7.png +0 -0
- package/dist/extension-js-devtools/chrome/assets/logo.7dc70d61.png +0 -0
- package/dist/extension-js-devtools/chrome/background/service_worker.js +0 -26
- package/dist/extension-js-devtools/chrome/chrome_url_overrides/newtab.html +0 -23
- package/dist/extension-js-devtools/chrome/content_scripts/content-0.js +0 -5
- package/dist/extension-js-devtools/chrome/content_scripts/styles.24e59c3d.css +0 -2
- package/dist/extension-js-devtools/chrome/devtools/index.html +0 -12
- package/dist/extension-js-devtools/chrome/devtools/index.js +0 -1
- package/dist/extension-js-devtools/chrome/icons/logo.png +0 -0
- package/dist/extension-js-devtools/chrome/manifest.json +0 -57
- package/dist/extension-js-devtools/chrome/pages/centralized-logger.css +0 -2
- package/dist/extension-js-devtools/chrome/pages/centralized-logger.html +0 -12
- package/dist/extension-js-devtools/chrome/pages/centralized-logger.js +0 -15
- package/dist/extension-js-devtools/chrome/pages/welcome.css +0 -2
- package/dist/extension-js-devtools/chrome/pages/welcome.html +0 -11
- package/dist/extension-js-devtools/chrome/pages/welcome.js +0 -25
- package/dist/extension-js-devtools/chrome/scripts/logger-client.js +0 -1
- package/dist/extension-js-devtools/chromium/assets/developer-mode-off.f9a94937.jpeg +0 -0
- package/dist/extension-js-devtools/chromium/assets/developer-mode-on.ede80e5b.jpeg +0 -0
- package/dist/extension-js-devtools/chromium/assets/local-network-permission.4fae40a7.png +0 -0
- package/dist/extension-js-devtools/chromium/assets/logo.7dc70d61.png +0 -0
- package/dist/extension-js-devtools/chromium/background/service_worker.js +0 -26
- package/dist/extension-js-devtools/chromium/chrome_url_overrides/newtab.html +0 -23
- package/dist/extension-js-devtools/chromium/content_scripts/content-0.js +0 -5
- package/dist/extension-js-devtools/chromium/content_scripts/styles.24e59c3d.css +0 -2
- package/dist/extension-js-devtools/chromium/devtools/index.html +0 -12
- package/dist/extension-js-devtools/chromium/devtools/index.js +0 -1
- package/dist/extension-js-devtools/chromium/icons/logo.png +0 -0
- package/dist/extension-js-devtools/chromium/manifest.json +0 -57
- package/dist/extension-js-devtools/chromium/pages/centralized-logger.css +0 -2
- package/dist/extension-js-devtools/chromium/pages/centralized-logger.html +0 -12
- package/dist/extension-js-devtools/chromium/pages/centralized-logger.js +0 -15
- package/dist/extension-js-devtools/chromium/pages/welcome.css +0 -2
- package/dist/extension-js-devtools/chromium/pages/welcome.html +0 -11
- package/dist/extension-js-devtools/chromium/pages/welcome.js +0 -25
- package/dist/extension-js-devtools/chromium/scripts/logger-client.js +0 -1
- package/dist/extension-js-devtools/edge/assets/developer-mode-off.f9a94937.jpeg +0 -0
- package/dist/extension-js-devtools/edge/assets/developer-mode-on.ede80e5b.jpeg +0 -0
- package/dist/extension-js-devtools/edge/assets/local-network-permission.4fae40a7.png +0 -0
- package/dist/extension-js-devtools/edge/assets/logo.7dc70d61.png +0 -0
- package/dist/extension-js-devtools/edge/background/service_worker.js +0 -26
- package/dist/extension-js-devtools/edge/chrome_url_overrides/newtab.html +0 -23
- package/dist/extension-js-devtools/edge/content_scripts/content-0.js +0 -5
- package/dist/extension-js-devtools/edge/content_scripts/styles.24e59c3d.css +0 -2
- package/dist/extension-js-devtools/edge/devtools/index.html +0 -12
- package/dist/extension-js-devtools/edge/devtools/index.js +0 -1
- package/dist/extension-js-devtools/edge/icons/logo.png +0 -0
- package/dist/extension-js-devtools/edge/manifest.json +0 -57
- package/dist/extension-js-devtools/edge/pages/centralized-logger.css +0 -2
- package/dist/extension-js-devtools/edge/pages/centralized-logger.html +0 -12
- package/dist/extension-js-devtools/edge/pages/centralized-logger.js +0 -15
- package/dist/extension-js-devtools/edge/pages/welcome.css +0 -2
- package/dist/extension-js-devtools/edge/pages/welcome.html +0 -11
- package/dist/extension-js-devtools/edge/pages/welcome.js +0 -25
- package/dist/extension-js-devtools/edge/scripts/logger-client.js +0 -1
- package/dist/extension-js-devtools/firefox/assets/developer-mode-off.f9a94937.jpeg +0 -0
- package/dist/extension-js-devtools/firefox/assets/developer-mode-on.ede80e5b.jpeg +0 -0
- package/dist/extension-js-devtools/firefox/assets/local-network-permission.4fae40a7.png +0 -0
- package/dist/extension-js-devtools/firefox/assets/logo.7dc70d61.png +0 -0
- package/dist/extension-js-devtools/firefox/background/scripts.js +0 -26
- package/dist/extension-js-devtools/firefox/content_scripts/content-0.js +0 -5
- package/dist/extension-js-devtools/firefox/content_scripts/styles.24e59c3d.css +0 -2
- package/dist/extension-js-devtools/firefox/devtools/index.html +0 -12
- package/dist/extension-js-devtools/firefox/devtools/index.js +0 -1
- package/dist/extension-js-devtools/firefox/icons/logo.png +0 -0
- package/dist/extension-js-devtools/firefox/manifest.json +0 -42
- package/dist/extension-js-devtools/firefox/pages/centralized-logger.css +0 -2
- package/dist/extension-js-devtools/firefox/pages/centralized-logger.html +0 -12
- package/dist/extension-js-devtools/firefox/pages/centralized-logger.js +0 -15
- package/dist/extension-js-devtools/firefox/pages/welcome.css +0 -2
- package/dist/extension-js-devtools/firefox/pages/welcome.html +0 -11
- package/dist/extension-js-devtools/firefox/pages/welcome.js +0 -25
- package/dist/extension-js-devtools/firefox/scripts/logger-client.js +0 -1
- package/dist/extension-js-theme/chrome/manifest.json +0 -66
- package/dist/extension-js-theme/chromium/manifest.json +0 -66
- package/dist/extension-js-theme/edge/manifest.json +0 -66
- package/dist/extension-js-theme/firefox/manifest.json +0 -66
- package/dist/warn-no-default-export.cjs +0 -356
- package/webpack/webpack-lib/optional-dependencies.json +0 -20
package/dist/module.cjs
CHANGED
|
@@ -3,7 +3,7 @@ const __rslib_import_meta_url__ = /*#__PURE__*/ function() {
|
|
|
3
3
|
return "u" < typeof document ? new (require('url'.replace('', ''))).URL('file:' + __filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
|
|
4
4
|
}();
|
|
5
5
|
var __webpack_modules__ = {
|
|
6
|
-
"../../node_modules
|
|
6
|
+
"../../node_modules/immutable/dist/immutable.es.js" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
7
7
|
"use strict";
|
|
8
8
|
__webpack_require__.r(__webpack_exports__);
|
|
9
9
|
__webpack_require__.d(__webpack_exports__, {
|
|
@@ -3988,7 +3988,7 @@ var __webpack_modules__ = {
|
|
|
3988
3988
|
var version1 = "5.1.5";
|
|
3989
3989
|
var Iterable = Collection;
|
|
3990
3990
|
},
|
|
3991
|
-
"../../node_modules
|
|
3991
|
+
"../../node_modules/sass/sass.dart.js" () {
|
|
3992
3992
|
if (!globalThis._cliPkgExports) globalThis._cliPkgExports = [];
|
|
3993
3993
|
let _cliPkgExports = {};
|
|
3994
3994
|
globalThis._cliPkgExports.push(_cliPkgExports);
|
|
@@ -127118,8 +127118,8 @@ var __webpack_modules__ = {
|
|
|
127118
127118
|
})();
|
|
127119
127119
|
};
|
|
127120
127120
|
},
|
|
127121
|
-
"../../node_modules
|
|
127122
|
-
__webpack_require__("../../node_modules
|
|
127121
|
+
"../../node_modules/sass/sass.node.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
127122
|
+
__webpack_require__("../../node_modules/sass/sass.dart.js");
|
|
127123
127123
|
const library = globalThis._cliPkgExports.pop();
|
|
127124
127124
|
if (0 === globalThis._cliPkgExports.length) delete globalThis._cliPkgExports;
|
|
127125
127125
|
library.load({
|
|
@@ -127127,7 +127127,7 @@ var __webpack_modules__ = {
|
|
|
127127
127127
|
stream: __webpack_require__("stream"),
|
|
127128
127128
|
nodeModule: __webpack_require__("module"),
|
|
127129
127129
|
fs: __webpack_require__("fs"),
|
|
127130
|
-
immutable: __webpack_require__("../../node_modules
|
|
127130
|
+
immutable: __webpack_require__("../../node_modules/immutable/dist/immutable.es.js")
|
|
127131
127131
|
});
|
|
127132
127132
|
module.exports = library;
|
|
127133
127133
|
},
|
|
@@ -127515,623 +127515,6 @@ var __webpack_modules__ = {
|
|
|
127515
127515
|
};
|
|
127516
127516
|
}
|
|
127517
127517
|
},
|
|
127518
|
-
"./webpack/optional-deps-lib/cache-state.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
127519
|
-
"use strict";
|
|
127520
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
127521
|
-
M: ()=>prepareOptionalInstallState
|
|
127522
|
-
});
|
|
127523
|
-
var path__rspack_import_0 = __webpack_require__("path");
|
|
127524
|
-
var fs__rspack_import_1 = __webpack_require__("fs");
|
|
127525
|
-
var _package_json__rspack_import_2 = __webpack_require__("./package.json");
|
|
127526
|
-
var _webpack_lib_optional_dependencies__rspack_import_3 = __webpack_require__("./webpack/webpack-lib/optional-dependencies.ts");
|
|
127527
|
-
function parseJsonSafe(text) {
|
|
127528
|
-
const raw = 'string' == typeof text ? text : String(text || '');
|
|
127529
|
-
const s = raw && 0xfeff === raw.charCodeAt(0) ? raw.slice(1) : raw;
|
|
127530
|
-
return JSON.parse(s || '{}');
|
|
127531
|
-
}
|
|
127532
|
-
function ensureOptionalInstallBaseDir(installBaseDir) {
|
|
127533
|
-
fs__rspack_import_1.mkdirSync(installBaseDir, {
|
|
127534
|
-
recursive: true
|
|
127535
|
-
});
|
|
127536
|
-
const packageJsonPath = path__rspack_import_0.join(installBaseDir, 'package.json');
|
|
127537
|
-
if (!fs__rspack_import_1.existsSync(packageJsonPath)) fs__rspack_import_1.writeFileSync(packageJsonPath, JSON.stringify({
|
|
127538
|
-
name: `extensionjs-optional-deps-${_package_json__rspack_import_2.rE}`,
|
|
127539
|
-
private: true,
|
|
127540
|
-
version: _package_json__rspack_import_2.rE
|
|
127541
|
-
}, null, 2) + '\n');
|
|
127542
|
-
}
|
|
127543
|
-
function removePathIfExists(targetPath) {
|
|
127544
|
-
if (!fs__rspack_import_1.existsSync(targetPath)) return;
|
|
127545
|
-
fs__rspack_import_1.rmSync(targetPath, {
|
|
127546
|
-
recursive: true,
|
|
127547
|
-
force: true
|
|
127548
|
-
});
|
|
127549
|
-
}
|
|
127550
|
-
function resetOptionalInstallRoot(installBaseDir) {
|
|
127551
|
-
removePathIfExists(path__rspack_import_0.join(installBaseDir, 'node_modules'));
|
|
127552
|
-
removePathIfExists(path__rspack_import_0.join(installBaseDir, 'package-lock.json'));
|
|
127553
|
-
removePathIfExists(path__rspack_import_0.join(installBaseDir, 'npm-shrinkwrap.json'));
|
|
127554
|
-
removePathIfExists(path__rspack_import_0.join(installBaseDir, 'pnpm-lock.yaml'));
|
|
127555
|
-
removePathIfExists(path__rspack_import_0.join(installBaseDir, 'yarn.lock'));
|
|
127556
|
-
removePathIfExists(path__rspack_import_0.join(installBaseDir, 'bun.lock'));
|
|
127557
|
-
}
|
|
127558
|
-
function getPinnedOptionalDependencyMap(dependencies) {
|
|
127559
|
-
const specs = (0, _webpack_lib_optional_dependencies__rspack_import_3.ad)(dependencies);
|
|
127560
|
-
const pinned = {};
|
|
127561
|
-
for(let i = 0; i < dependencies.length; i++){
|
|
127562
|
-
const dependencyId = dependencies[i];
|
|
127563
|
-
const spec = specs[i] || '';
|
|
127564
|
-
const versionSeparator = spec.lastIndexOf('@');
|
|
127565
|
-
if (dependencyId && !(versionSeparator <= 0)) pinned[dependencyId] = spec.slice(versionSeparator + 1);
|
|
127566
|
-
}
|
|
127567
|
-
return pinned;
|
|
127568
|
-
}
|
|
127569
|
-
function ensureOptionalDependenciesManifest(installBaseDir, dependencies) {
|
|
127570
|
-
if (!dependencies.length) return;
|
|
127571
|
-
const packageJsonPath = path__rspack_import_0.join(installBaseDir, 'package.json');
|
|
127572
|
-
const current = parseJsonSafe(fs__rspack_import_1.readFileSync(packageJsonPath, 'utf8'));
|
|
127573
|
-
const nextOptionalDependencies = {
|
|
127574
|
-
...current.optionalDependencies || {},
|
|
127575
|
-
...getPinnedOptionalDependencyMap(dependencies)
|
|
127576
|
-
};
|
|
127577
|
-
const didChange = dependencies.some((dependencyId)=>current.optionalDependencies?.[dependencyId] !== nextOptionalDependencies[dependencyId]);
|
|
127578
|
-
if (!didChange) return;
|
|
127579
|
-
fs__rspack_import_1.writeFileSync(packageJsonPath, JSON.stringify({
|
|
127580
|
-
...current,
|
|
127581
|
-
private: true,
|
|
127582
|
-
optionalDependencies: nextOptionalDependencies
|
|
127583
|
-
}, null, 2) + '\n');
|
|
127584
|
-
}
|
|
127585
|
-
function prepareOptionalInstallState(input) {
|
|
127586
|
-
if (input.forceRecreateInstallRoot) resetOptionalInstallRoot(input.installBaseDir);
|
|
127587
|
-
ensureOptionalInstallBaseDir(input.installBaseDir);
|
|
127588
|
-
ensureOptionalDependenciesManifest(input.installBaseDir, input.dependencies);
|
|
127589
|
-
}
|
|
127590
|
-
},
|
|
127591
|
-
"./webpack/optional-deps-lib/index.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
127592
|
-
"use strict";
|
|
127593
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
127594
|
-
Dy: ()=>_installer_engine__rspack_import_0.D,
|
|
127595
|
-
He: ()=>_runtime_context__rspack_import_1.He,
|
|
127596
|
-
Iy: ()=>_runtime_context__rspack_import_1.Iy,
|
|
127597
|
-
tm: ()=>_installer_engine__rspack_import_0.t,
|
|
127598
|
-
ws: ()=>_runtime_context__rspack_import_1.ws
|
|
127599
|
-
});
|
|
127600
|
-
var _installer_engine__rspack_import_0 = __webpack_require__("./webpack/optional-deps-lib/installer-engine.ts");
|
|
127601
|
-
var _runtime_context__rspack_import_1 = __webpack_require__("./webpack/optional-deps-lib/runtime-context.ts");
|
|
127602
|
-
},
|
|
127603
|
-
"./webpack/optional-deps-lib/install-root-packages.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
127604
|
-
"use strict";
|
|
127605
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
127606
|
-
G: ()=>resolvePackageFromInstallRoot
|
|
127607
|
-
});
|
|
127608
|
-
var fs__rspack_import_0 = __webpack_require__("fs");
|
|
127609
|
-
var path__rspack_import_1 = __webpack_require__("path");
|
|
127610
|
-
function isPackageEntry(entry) {
|
|
127611
|
-
return entry.isDirectory() || entry.isSymbolicLink();
|
|
127612
|
-
}
|
|
127613
|
-
function getDirectPackageDir(dependencyId, installRoot) {
|
|
127614
|
-
return path__rspack_import_1.join(installRoot, 'node_modules', ...dependencyId.split('/'));
|
|
127615
|
-
}
|
|
127616
|
-
function listInstalledPackageDirs(nodeModulesDir) {
|
|
127617
|
-
if (!fs__rspack_import_0.existsSync(nodeModulesDir)) return [];
|
|
127618
|
-
try {
|
|
127619
|
-
const entries = fs__rspack_import_0.readdirSync(nodeModulesDir, {
|
|
127620
|
-
withFileTypes: true
|
|
127621
|
-
});
|
|
127622
|
-
const packageDirs = [];
|
|
127623
|
-
for (const entry of entries){
|
|
127624
|
-
if (!isPackageEntry(entry) || '.bin' === entry.name) continue;
|
|
127625
|
-
const entryPath = path__rspack_import_1.join(nodeModulesDir, entry.name);
|
|
127626
|
-
if (!entry.name.startsWith('@')) {
|
|
127627
|
-
packageDirs.push(entryPath);
|
|
127628
|
-
continue;
|
|
127629
|
-
}
|
|
127630
|
-
const scopedEntries = fs__rspack_import_0.readdirSync(entryPath, {
|
|
127631
|
-
withFileTypes: true
|
|
127632
|
-
});
|
|
127633
|
-
for (const scopedEntry of scopedEntries)if (isPackageEntry(scopedEntry)) packageDirs.push(path__rspack_import_1.join(entryPath, scopedEntry.name));
|
|
127634
|
-
}
|
|
127635
|
-
return packageDirs;
|
|
127636
|
-
} catch {
|
|
127637
|
-
return [];
|
|
127638
|
-
}
|
|
127639
|
-
}
|
|
127640
|
-
function findPackageDirInPnpmStore(dependencyId, installRoot) {
|
|
127641
|
-
const pnpmStoreDir = path__rspack_import_1.join(installRoot, 'node_modules', '.pnpm');
|
|
127642
|
-
if (!fs__rspack_import_0.existsSync(pnpmStoreDir)) return;
|
|
127643
|
-
try {
|
|
127644
|
-
const storeEntries = fs__rspack_import_0.readdirSync(pnpmStoreDir, {
|
|
127645
|
-
withFileTypes: true
|
|
127646
|
-
});
|
|
127647
|
-
for (const entry of storeEntries){
|
|
127648
|
-
if (!isPackageEntry(entry) || 'node_modules' === entry.name) continue;
|
|
127649
|
-
const candidatePackageJson = path__rspack_import_1.join(pnpmStoreDir, entry.name, 'node_modules', ...dependencyId.split('/'), 'package.json');
|
|
127650
|
-
if (fs__rspack_import_0.existsSync(candidatePackageJson)) return path__rspack_import_1.dirname(candidatePackageJson);
|
|
127651
|
-
}
|
|
127652
|
-
} catch {}
|
|
127653
|
-
}
|
|
127654
|
-
function findNestedPackageDir(dependencyId, installRoot) {
|
|
127655
|
-
const directPackageJson = path__rspack_import_1.join(getDirectPackageDir(dependencyId, installRoot), 'package.json');
|
|
127656
|
-
if (fs__rspack_import_0.existsSync(directPackageJson)) return path__rspack_import_1.dirname(directPackageJson);
|
|
127657
|
-
const fromPnpmStore = findPackageDirInPnpmStore(dependencyId, installRoot);
|
|
127658
|
-
if (fromPnpmStore) return fromPnpmStore;
|
|
127659
|
-
const visited = new Set();
|
|
127660
|
-
const queue = [
|
|
127661
|
-
{
|
|
127662
|
-
nodeModulesDir: path__rspack_import_1.join(installRoot, 'node_modules'),
|
|
127663
|
-
depth: 0
|
|
127664
|
-
}
|
|
127665
|
-
];
|
|
127666
|
-
const maxDepth = 4;
|
|
127667
|
-
while(queue.length > 0){
|
|
127668
|
-
const current = queue.shift();
|
|
127669
|
-
if (visited.has(current.nodeModulesDir)) continue;
|
|
127670
|
-
visited.add(current.nodeModulesDir);
|
|
127671
|
-
const candidatePackageJson = path__rspack_import_1.join(current.nodeModulesDir, ...dependencyId.split('/'), 'package.json');
|
|
127672
|
-
if (fs__rspack_import_0.existsSync(candidatePackageJson)) return path__rspack_import_1.dirname(candidatePackageJson);
|
|
127673
|
-
if (current.depth >= maxDepth) continue;
|
|
127674
|
-
for (const packageDir of listInstalledPackageDirs(current.nodeModulesDir)){
|
|
127675
|
-
const nestedNodeModulesDir = path__rspack_import_1.join(packageDir, 'node_modules');
|
|
127676
|
-
if (fs__rspack_import_0.existsSync(nestedNodeModulesDir)) queue.push({
|
|
127677
|
-
nodeModulesDir: nestedNodeModulesDir,
|
|
127678
|
-
depth: current.depth + 1
|
|
127679
|
-
});
|
|
127680
|
-
}
|
|
127681
|
-
}
|
|
127682
|
-
}
|
|
127683
|
-
function readPackageJsonFromDir(packageDir) {
|
|
127684
|
-
const manifestPath = path__rspack_import_1.join(packageDir, 'package.json');
|
|
127685
|
-
if (!fs__rspack_import_0.existsSync(manifestPath)) return;
|
|
127686
|
-
try {
|
|
127687
|
-
return JSON.parse(fs__rspack_import_0.readFileSync(manifestPath, 'utf8') || '{}');
|
|
127688
|
-
} catch {
|
|
127689
|
-
return;
|
|
127690
|
-
}
|
|
127691
|
-
}
|
|
127692
|
-
function getPackageEntryCandidates(pkg) {
|
|
127693
|
-
const candidateEntries = [];
|
|
127694
|
-
if ('string' == typeof pkg?.main) candidateEntries.push(pkg.main);
|
|
127695
|
-
if ('string' == typeof pkg?.module) candidateEntries.push(pkg.module);
|
|
127696
|
-
if ('string' == typeof pkg?.exports) candidateEntries.push(pkg.exports);
|
|
127697
|
-
const dotExport = pkg?.exports?.['.'];
|
|
127698
|
-
if ('string' == typeof dotExport) candidateEntries.push(dotExport);
|
|
127699
|
-
if (dotExport && 'object' == typeof dotExport) {
|
|
127700
|
-
if ('string' == typeof dotExport.require) candidateEntries.push(dotExport.require);
|
|
127701
|
-
if ('string' == typeof dotExport.default) candidateEntries.push(dotExport.default);
|
|
127702
|
-
if ('string' == typeof dotExport.import) candidateEntries.push(dotExport.import);
|
|
127703
|
-
}
|
|
127704
|
-
candidateEntries.push('index.js', 'index.cjs', 'index.mjs');
|
|
127705
|
-
return candidateEntries;
|
|
127706
|
-
}
|
|
127707
|
-
function resolveFromPackageDir(packageDir) {
|
|
127708
|
-
if (!fs__rspack_import_0.existsSync(packageDir)) return;
|
|
127709
|
-
const pkg = readPackageJsonFromDir(packageDir);
|
|
127710
|
-
if (!pkg) return;
|
|
127711
|
-
for (const relativeEntry of getPackageEntryCandidates(pkg)){
|
|
127712
|
-
const absoluteEntry = path__rspack_import_1.resolve(packageDir, relativeEntry);
|
|
127713
|
-
if (fs__rspack_import_0.existsSync(absoluteEntry)) return absoluteEntry;
|
|
127714
|
-
}
|
|
127715
|
-
}
|
|
127716
|
-
function resolvePackageFromInstallRoot(dependencyId, installRoot) {
|
|
127717
|
-
const packageDir = findNestedPackageDir(dependencyId, installRoot);
|
|
127718
|
-
if (!packageDir) return;
|
|
127719
|
-
return resolveFromPackageDir(packageDir);
|
|
127720
|
-
}
|
|
127721
|
-
},
|
|
127722
|
-
"./webpack/optional-deps-lib/installer-engine.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
127723
|
-
"use strict";
|
|
127724
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
127725
|
-
D: ()=>installOptionalDependenciesBatch,
|
|
127726
|
-
t: ()=>installOptionalDependencies
|
|
127727
|
-
});
|
|
127728
|
-
var pintor__rspack_import_0 = __webpack_require__("pintor");
|
|
127729
|
-
var pintor__rspack_import_0_default = /*#__PURE__*/ __webpack_require__.n(pintor__rspack_import_0);
|
|
127730
|
-
var _plugin_css_css_lib_messages__rspack_import_1 = __webpack_require__("./webpack/plugin-css/css-lib/messages.ts");
|
|
127731
|
-
var _webpack_lib_optional_dependencies__rspack_import_2 = __webpack_require__("./webpack/webpack-lib/optional-dependencies.ts");
|
|
127732
|
-
var _webpack_lib_package_manager__rspack_import_3 = __webpack_require__("./webpack/webpack-lib/package-manager.ts");
|
|
127733
|
-
var _cache_state__rspack_import_4 = __webpack_require__("./webpack/optional-deps-lib/cache-state.ts");
|
|
127734
|
-
var _install_root_packages__rspack_import_5 = __webpack_require__("./webpack/optional-deps-lib/install-root-packages.ts");
|
|
127735
|
-
var _runtime_context__rspack_import_6 = __webpack_require__("./webpack/optional-deps-lib/runtime-context.ts");
|
|
127736
|
-
function getMissingDependenciesAtInstallRoot(dependencies, installBaseDir) {
|
|
127737
|
-
return dependencies.filter((dependencyId)=>!(0, _install_root_packages__rspack_import_5.G)(dependencyId, installBaseDir));
|
|
127738
|
-
}
|
|
127739
|
-
function parseWslUncPath(value) {
|
|
127740
|
-
const match = /^\\\\wsl(?:\.localhost)?\\([^\\]+)\\(.+)$/.exec(value);
|
|
127741
|
-
if (!match) return null;
|
|
127742
|
-
const distro = match[1];
|
|
127743
|
-
const rel = match[2].replace(/\\/g, '/').replace(/^\/+/, '');
|
|
127744
|
-
return {
|
|
127745
|
-
distro,
|
|
127746
|
-
path: `/${rel}`
|
|
127747
|
-
};
|
|
127748
|
-
}
|
|
127749
|
-
function isWslMountPath(value) {
|
|
127750
|
-
return /^\/mnt\/[a-z]\//i.test(value);
|
|
127751
|
-
}
|
|
127752
|
-
function resolveWslContext(installBaseDir) {
|
|
127753
|
-
if ('win32' !== process.platform) return {
|
|
127754
|
-
useWsl: false
|
|
127755
|
-
};
|
|
127756
|
-
const trimmed = String(installBaseDir || '').trim();
|
|
127757
|
-
if (!trimmed) return {
|
|
127758
|
-
useWsl: false
|
|
127759
|
-
};
|
|
127760
|
-
const unc = parseWslUncPath(trimmed);
|
|
127761
|
-
if (unc) return {
|
|
127762
|
-
useWsl: true,
|
|
127763
|
-
distro: unc.distro,
|
|
127764
|
-
installDir: unc.path
|
|
127765
|
-
};
|
|
127766
|
-
if (isWslMountPath(trimmed)) return {
|
|
127767
|
-
useWsl: true,
|
|
127768
|
-
installDir: trimmed
|
|
127769
|
-
};
|
|
127770
|
-
return {
|
|
127771
|
-
useWsl: false
|
|
127772
|
-
};
|
|
127773
|
-
}
|
|
127774
|
-
function wrapCommandForWsl(command, context) {
|
|
127775
|
-
if (!context.useWsl) return command;
|
|
127776
|
-
const args = [
|
|
127777
|
-
...context.distro ? [
|
|
127778
|
-
'-d',
|
|
127779
|
-
context.distro
|
|
127780
|
-
] : [],
|
|
127781
|
-
'--'
|
|
127782
|
-
];
|
|
127783
|
-
args.push(command.command, ...command.args);
|
|
127784
|
-
return {
|
|
127785
|
-
command: 'wsl.exe',
|
|
127786
|
-
args
|
|
127787
|
-
};
|
|
127788
|
-
}
|
|
127789
|
-
function isMissingManagerError(error) {
|
|
127790
|
-
const err = error;
|
|
127791
|
-
return err?.code === 'ENOENT' || String(err?.message || '').includes('ENOENT') || String(err?.message || '').includes('not found');
|
|
127792
|
-
}
|
|
127793
|
-
function isInstallExitFailure(error) {
|
|
127794
|
-
return /Install failed with exit code \d+/.test(String(error?.message || error || ''));
|
|
127795
|
-
}
|
|
127796
|
-
async function execInstallWithFallback(command, options) {
|
|
127797
|
-
try {
|
|
127798
|
-
await (0, _webpack_lib_package_manager__rspack_import_3.Qt)(command.command, command.args, {
|
|
127799
|
-
cwd: options.cwd,
|
|
127800
|
-
stdio: 'inherit'
|
|
127801
|
-
});
|
|
127802
|
-
return;
|
|
127803
|
-
} catch (error) {
|
|
127804
|
-
if (options.fallbackNpmCommand && (isMissingManagerError(error) || options.allowFallbackOnFailure && isInstallExitFailure(error))) return void await (0, _webpack_lib_package_manager__rspack_import_3.Qt)(options.fallbackNpmCommand.command, options.fallbackNpmCommand.args, {
|
|
127805
|
-
cwd: options.cwd,
|
|
127806
|
-
stdio: 'inherit'
|
|
127807
|
-
});
|
|
127808
|
-
throw error;
|
|
127809
|
-
}
|
|
127810
|
-
}
|
|
127811
|
-
async function preferCorepackFallback(pm) {
|
|
127812
|
-
if ('npm' !== pm.name || pm.execPath || pm.runnerCommand) return pm;
|
|
127813
|
-
const npmUserAgent = process.env.npm_config_user_agent || '';
|
|
127814
|
-
const npmExecPath = process.env.npm_execpath || process.env.NPM_EXEC_PATH || '';
|
|
127815
|
-
if (npmUserAgent.includes('npm') || npmExecPath) return pm;
|
|
127816
|
-
try {
|
|
127817
|
-
const { spawnSync } = await import("child_process");
|
|
127818
|
-
const result = spawnSync('corepack', [
|
|
127819
|
-
'--version'
|
|
127820
|
-
], {
|
|
127821
|
-
stdio: 'ignore',
|
|
127822
|
-
windowsHide: true
|
|
127823
|
-
});
|
|
127824
|
-
if (result?.status === 0) return {
|
|
127825
|
-
name: 'pnpm',
|
|
127826
|
-
runnerCommand: 'corepack',
|
|
127827
|
-
runnerArgs: [
|
|
127828
|
-
'pnpm'
|
|
127829
|
-
]
|
|
127830
|
-
};
|
|
127831
|
-
} catch {}
|
|
127832
|
-
return pm;
|
|
127833
|
-
}
|
|
127834
|
-
function getOptionalInstallCommand(pm, dependencies, installBaseDir) {
|
|
127835
|
-
const pmName = pm.name;
|
|
127836
|
-
const dependencySpecs = (0, _webpack_lib_optional_dependencies__rspack_import_2.ad)(dependencies);
|
|
127837
|
-
if ('yarn' === pmName) return (0, _webpack_lib_package_manager__rspack_import_3.tj)(pm, [
|
|
127838
|
-
'--silent',
|
|
127839
|
-
'add',
|
|
127840
|
-
...dependencySpecs,
|
|
127841
|
-
'--cwd',
|
|
127842
|
-
installBaseDir,
|
|
127843
|
-
'--optional'
|
|
127844
|
-
]);
|
|
127845
|
-
if ('npm' === pmName) return getRootInstallCommand(pm, installBaseDir);
|
|
127846
|
-
if ('pnpm' === pmName) return (0, _webpack_lib_package_manager__rspack_import_3.tj)(pm, [
|
|
127847
|
-
'install',
|
|
127848
|
-
'--dir',
|
|
127849
|
-
installBaseDir,
|
|
127850
|
-
'--ignore-workspace',
|
|
127851
|
-
'--lockfile=false',
|
|
127852
|
-
'--silent'
|
|
127853
|
-
]);
|
|
127854
|
-
if ('bun' === pmName) return (0, _webpack_lib_package_manager__rspack_import_3.tj)(pm, [
|
|
127855
|
-
'add',
|
|
127856
|
-
...dependencySpecs,
|
|
127857
|
-
'--cwd',
|
|
127858
|
-
installBaseDir,
|
|
127859
|
-
'--optional'
|
|
127860
|
-
]);
|
|
127861
|
-
return (0, _webpack_lib_package_manager__rspack_import_3.tj)(pm, [
|
|
127862
|
-
'--silent',
|
|
127863
|
-
'install',
|
|
127864
|
-
...dependencySpecs,
|
|
127865
|
-
'--cwd',
|
|
127866
|
-
installBaseDir,
|
|
127867
|
-
'--optional'
|
|
127868
|
-
]);
|
|
127869
|
-
}
|
|
127870
|
-
function getRootInstallCommand(pm, installBaseDir) {
|
|
127871
|
-
const pmName = pm.name;
|
|
127872
|
-
const dirArgs = installBaseDir ? 'yarn' === pmName ? [
|
|
127873
|
-
'--cwd',
|
|
127874
|
-
installBaseDir
|
|
127875
|
-
] : 'pnpm' === pmName ? [
|
|
127876
|
-
'--dir',
|
|
127877
|
-
installBaseDir
|
|
127878
|
-
] : 'bun' === pmName ? [
|
|
127879
|
-
'--cwd',
|
|
127880
|
-
installBaseDir
|
|
127881
|
-
] : [
|
|
127882
|
-
'--prefix',
|
|
127883
|
-
installBaseDir
|
|
127884
|
-
] : [];
|
|
127885
|
-
if ('yarn' === pmName) return (0, _webpack_lib_package_manager__rspack_import_3.tj)(pm, [
|
|
127886
|
-
'install',
|
|
127887
|
-
'--silent',
|
|
127888
|
-
...dirArgs
|
|
127889
|
-
]);
|
|
127890
|
-
if ('npm' === pmName) return (0, _webpack_lib_package_manager__rspack_import_3.tj)(pm, [
|
|
127891
|
-
'install',
|
|
127892
|
-
'--silent',
|
|
127893
|
-
...dirArgs
|
|
127894
|
-
]);
|
|
127895
|
-
if ('pnpm' === pmName) return (0, _webpack_lib_package_manager__rspack_import_3.tj)(pm, [
|
|
127896
|
-
'install',
|
|
127897
|
-
'--silent',
|
|
127898
|
-
...dirArgs,
|
|
127899
|
-
'--ignore-workspace',
|
|
127900
|
-
'--lockfile=false'
|
|
127901
|
-
]);
|
|
127902
|
-
if ('bun' === pmName) return (0, _webpack_lib_package_manager__rspack_import_3.tj)(pm, [
|
|
127903
|
-
'install',
|
|
127904
|
-
...dirArgs
|
|
127905
|
-
]);
|
|
127906
|
-
return (0, _webpack_lib_package_manager__rspack_import_3.tj)(pm, [
|
|
127907
|
-
'install',
|
|
127908
|
-
'--silent',
|
|
127909
|
-
...dirArgs
|
|
127910
|
-
]);
|
|
127911
|
-
}
|
|
127912
|
-
async function runInstallAttempt(input) {
|
|
127913
|
-
const installCommand = getOptionalInstallCommand(input.pm, input.dependencies, input.wslContext.installDir || input.installBaseDir);
|
|
127914
|
-
const execCommand = wrapCommandForWsl(installCommand, input.wslContext);
|
|
127915
|
-
const fallbackNpmCommand = input.wslContext.useWsl ? void 0 : (0, _webpack_lib_package_manager__rspack_import_3.sX)([
|
|
127916
|
-
'--silent',
|
|
127917
|
-
'install',
|
|
127918
|
-
...(0, _webpack_lib_optional_dependencies__rspack_import_2.ad)(input.dependencies),
|
|
127919
|
-
'--prefix',
|
|
127920
|
-
input.installBaseDir,
|
|
127921
|
-
'--save-optional'
|
|
127922
|
-
]);
|
|
127923
|
-
await execInstallWithFallback(execCommand, {
|
|
127924
|
-
cwd: input.wslContext.useWsl ? void 0 : input.installBaseDir,
|
|
127925
|
-
fallbackNpmCommand,
|
|
127926
|
-
allowFallbackOnFailure: !input.wslContext.useWsl && 'npm' !== input.pm.name && void 0 !== fallbackNpmCommand
|
|
127927
|
-
});
|
|
127928
|
-
await new Promise((resolve)=>setTimeout(resolve, 500));
|
|
127929
|
-
const needsRootRelink = 'npm' !== input.pm.name && (input.isAuthor || input.dependencies.length > 1);
|
|
127930
|
-
if (!needsRootRelink) return;
|
|
127931
|
-
if (input.isAuthor) console.log(_plugin_css_css_lib_messages__rspack_import_1.cr(input.integration));
|
|
127932
|
-
const rootInstall = getRootInstallCommand(input.pm, input.wslContext.useWsl ? input.wslContext.installDir : void 0);
|
|
127933
|
-
const rootCommand = wrapCommandForWsl(rootInstall, input.wslContext);
|
|
127934
|
-
const rootFallbackCommand = input.wslContext.useWsl ? void 0 : (0, _webpack_lib_package_manager__rspack_import_3.sX)([
|
|
127935
|
-
'--silent',
|
|
127936
|
-
'install',
|
|
127937
|
-
'--prefix',
|
|
127938
|
-
input.installBaseDir
|
|
127939
|
-
]);
|
|
127940
|
-
await execInstallWithFallback(rootCommand, {
|
|
127941
|
-
cwd: input.wslContext.useWsl ? void 0 : input.installBaseDir,
|
|
127942
|
-
fallbackNpmCommand: rootFallbackCommand,
|
|
127943
|
-
allowFallbackOnFailure: !input.wslContext.useWsl && 'npm' !== input.pm.name && void 0 !== rootFallbackCommand
|
|
127944
|
-
});
|
|
127945
|
-
if (input.isAuthor) console.log(_plugin_css_css_lib_messages__rspack_import_1.ys(input.integration));
|
|
127946
|
-
}
|
|
127947
|
-
async function installOptionalDependencies(integration, dependencies, options) {
|
|
127948
|
-
if (!dependencies.length) return;
|
|
127949
|
-
let pm;
|
|
127950
|
-
let wslContext;
|
|
127951
|
-
let installBaseDir;
|
|
127952
|
-
try {
|
|
127953
|
-
installBaseDir = (0, _runtime_context__rspack_import_6.Iy)();
|
|
127954
|
-
(0, _cache_state__rspack_import_4.M)({
|
|
127955
|
-
installBaseDir,
|
|
127956
|
-
dependencies,
|
|
127957
|
-
forceRecreateInstallRoot: options?.forceRecreateInstallRoot
|
|
127958
|
-
});
|
|
127959
|
-
pm = (0, _webpack_lib_package_manager__rspack_import_3._c)({
|
|
127960
|
-
cwd: installBaseDir
|
|
127961
|
-
});
|
|
127962
|
-
wslContext = resolveWslContext(installBaseDir);
|
|
127963
|
-
if (!wslContext.useWsl) pm = await preferCorepackFallback(pm);
|
|
127964
|
-
const isAuthor = 'true' === process.env.EXTENSION_AUTHOR_MODE;
|
|
127965
|
-
const setupMessages = _plugin_css_css_lib_messages__rspack_import_1._j([
|
|
127966
|
-
integration
|
|
127967
|
-
], integration, isAuthor);
|
|
127968
|
-
const setupMessage = setupMessages[0];
|
|
127969
|
-
const hasIndex = Boolean(options?.index && options?.total);
|
|
127970
|
-
const setupMessageWithIndex = hasIndex ? setupMessage.replace('►►► ', `►►► [${options?.index}/${options?.total}] `) : setupMessage;
|
|
127971
|
-
if (isAuthor) console.warn(setupMessageWithIndex);
|
|
127972
|
-
else console.log(setupMessageWithIndex);
|
|
127973
|
-
await runInstallAttempt({
|
|
127974
|
-
pm,
|
|
127975
|
-
wslContext,
|
|
127976
|
-
installBaseDir,
|
|
127977
|
-
dependencies,
|
|
127978
|
-
isAuthor,
|
|
127979
|
-
integration
|
|
127980
|
-
});
|
|
127981
|
-
let missingDependencies = getMissingDependenciesAtInstallRoot(dependencies, installBaseDir);
|
|
127982
|
-
if (missingDependencies.length > 0 && 'npm' !== pm.name) {
|
|
127983
|
-
await runInstallAttempt({
|
|
127984
|
-
pm,
|
|
127985
|
-
wslContext,
|
|
127986
|
-
installBaseDir,
|
|
127987
|
-
dependencies: missingDependencies,
|
|
127988
|
-
isAuthor,
|
|
127989
|
-
integration
|
|
127990
|
-
});
|
|
127991
|
-
missingDependencies = getMissingDependenciesAtInstallRoot(dependencies, installBaseDir);
|
|
127992
|
-
}
|
|
127993
|
-
if (missingDependencies.length > 0) {
|
|
127994
|
-
(0, _cache_state__rspack_import_4.M)({
|
|
127995
|
-
installBaseDir,
|
|
127996
|
-
dependencies,
|
|
127997
|
-
forceRecreateInstallRoot: true
|
|
127998
|
-
});
|
|
127999
|
-
await runInstallAttempt({
|
|
128000
|
-
pm,
|
|
128001
|
-
wslContext,
|
|
128002
|
-
installBaseDir,
|
|
128003
|
-
dependencies,
|
|
128004
|
-
isAuthor,
|
|
128005
|
-
integration
|
|
128006
|
-
});
|
|
128007
|
-
missingDependencies = getMissingDependenciesAtInstallRoot(dependencies, installBaseDir);
|
|
128008
|
-
}
|
|
128009
|
-
if (missingDependencies.length > 0) throw new Error(`[${integration}] Optional dependency install reported success but packages are missing: ${missingDependencies.join(', ')}`);
|
|
128010
|
-
return true;
|
|
128011
|
-
} catch (error) {
|
|
128012
|
-
console.error('[extension.js][optional-deps] debug', {
|
|
128013
|
-
platform: process.platform,
|
|
128014
|
-
execPath: process.execPath,
|
|
128015
|
-
cwd: process.cwd(),
|
|
128016
|
-
path: process.env.PATH || process.env.Path,
|
|
128017
|
-
comspec: process.env.ComSpec,
|
|
128018
|
-
systemRoot: process.env.SystemRoot,
|
|
128019
|
-
npm_execpath: process.env.npm_execpath,
|
|
128020
|
-
npm_config_user_agent: process.env.npm_config_user_agent,
|
|
128021
|
-
npm_config_prefix: process.env.npm_config_prefix,
|
|
128022
|
-
npm_config_cache: process.env.npm_config_cache,
|
|
128023
|
-
npm_config_userconfig: process.env.npm_config_userconfig,
|
|
128024
|
-
installBaseDir,
|
|
128025
|
-
wslContext,
|
|
128026
|
-
pm,
|
|
128027
|
-
errorCode: error?.code,
|
|
128028
|
-
errorMessage: error instanceof Error ? error.message : String(error || 'unknown error')
|
|
128029
|
-
});
|
|
128030
|
-
const isAuthor = 'true' === process.env.EXTENSION_AUTHOR_MODE;
|
|
128031
|
-
if (isMissingManagerError(error)) console.error(_plugin_css_css_lib_messages__rspack_import_1.Vo(integration));
|
|
128032
|
-
else console.error(_plugin_css_css_lib_messages__rspack_import_1.DX(integration, error, isAuthor));
|
|
128033
|
-
return false;
|
|
128034
|
-
}
|
|
128035
|
-
}
|
|
128036
|
-
async function installOptionalDependenciesBatch(plans) {
|
|
128037
|
-
if (!plans.length) return;
|
|
128038
|
-
console.log(`${pintor__rspack_import_0_default().gray('►►►')} Found ${pintor__rspack_import_0_default().yellow(String(plans.length))} specialized integration${1 === plans.length ? '' : 's'} needing installation...`);
|
|
128039
|
-
for (const [index, plan] of plans.entries()){
|
|
128040
|
-
const didInstall = await installOptionalDependencies(plan.integration, plan.dependencies, {
|
|
128041
|
-
index: index + 1,
|
|
128042
|
-
total: plans.length
|
|
128043
|
-
});
|
|
128044
|
-
if (!didInstall) return false;
|
|
128045
|
-
}
|
|
128046
|
-
return true;
|
|
128047
|
-
}
|
|
128048
|
-
},
|
|
128049
|
-
"./webpack/optional-deps-lib/runtime-context.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
128050
|
-
"use strict";
|
|
128051
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
128052
|
-
He: ()=>resolveDevelopInstallRoot,
|
|
128053
|
-
Iy: ()=>resolveOptionalInstallRoot,
|
|
128054
|
-
ws: ()=>hasDependency
|
|
128055
|
-
});
|
|
128056
|
-
var path__rspack_import_0 = __webpack_require__("path");
|
|
128057
|
-
var fs__rspack_import_1 = __webpack_require__("fs");
|
|
128058
|
-
var os__rspack_import_2 = __webpack_require__("os");
|
|
128059
|
-
var _package_json__rspack_import_3 = __webpack_require__("./package.json");
|
|
128060
|
-
var _webpack_lib_check_build_dependencies__rspack_import_4 = __webpack_require__("./webpack/webpack-lib/check-build-dependencies.ts");
|
|
128061
|
-
function parseJsonSafe(text) {
|
|
128062
|
-
const raw = 'string' == typeof text ? text : String(text || '');
|
|
128063
|
-
const s = raw && 0xfeff === raw.charCodeAt(0) ? raw.slice(1) : raw;
|
|
128064
|
-
return JSON.parse(s || '{}');
|
|
128065
|
-
}
|
|
128066
|
-
function resolveDevelopRootFromDir(dir) {
|
|
128067
|
-
try {
|
|
128068
|
-
const packageJsonPath = path__rspack_import_0.join(dir, 'package.json');
|
|
128069
|
-
if (!fs__rspack_import_1.existsSync(packageJsonPath)) return;
|
|
128070
|
-
const pkg = parseJsonSafe(fs__rspack_import_1.readFileSync(packageJsonPath, 'utf8'));
|
|
128071
|
-
if (pkg?.name === 'extension-develop') return dir;
|
|
128072
|
-
} catch {}
|
|
128073
|
-
}
|
|
128074
|
-
function findDevelopRootFrom(startDir) {
|
|
128075
|
-
let currentDir = startDir;
|
|
128076
|
-
const maxDepth = 6;
|
|
128077
|
-
for(let i = 0; i < maxDepth; i++){
|
|
128078
|
-
const root = resolveDevelopRootFromDir(currentDir);
|
|
128079
|
-
if (root) return root;
|
|
128080
|
-
const parent = path__rspack_import_0.dirname(currentDir);
|
|
128081
|
-
if (parent === currentDir) break;
|
|
128082
|
-
currentDir = parent;
|
|
128083
|
-
}
|
|
128084
|
-
}
|
|
128085
|
-
function resolveDevelopInstallRoot() {
|
|
128086
|
-
const directRoot = (0, _webpack_lib_check_build_dependencies__rspack_import_4.w1)();
|
|
128087
|
-
if (directRoot) return directRoot;
|
|
128088
|
-
try {
|
|
128089
|
-
const candidateRoot = findDevelopRootFrom(__dirname);
|
|
128090
|
-
if (candidateRoot) return candidateRoot;
|
|
128091
|
-
} catch {}
|
|
128092
|
-
try {
|
|
128093
|
-
const pkgPath = require.resolve('extension-develop/package.json', {
|
|
128094
|
-
paths: [
|
|
128095
|
-
__dirname
|
|
128096
|
-
]
|
|
128097
|
-
});
|
|
128098
|
-
return resolveDevelopRootFromDir(path__rspack_import_0.dirname(pkgPath));
|
|
128099
|
-
} catch {
|
|
128100
|
-
return;
|
|
128101
|
-
}
|
|
128102
|
-
}
|
|
128103
|
-
function getExtensionJsCacheBaseDir() {
|
|
128104
|
-
const override = process.env.EXTENSION_JS_CACHE_DIR;
|
|
128105
|
-
if (override) return path__rspack_import_0.resolve(override);
|
|
128106
|
-
if ('win32' === process.platform && process.env.LOCALAPPDATA) return path__rspack_import_0.join(process.env.LOCALAPPDATA, 'extensionjs');
|
|
128107
|
-
if (process.env.XDG_CACHE_HOME) return path__rspack_import_0.join(process.env.XDG_CACHE_HOME, 'extensionjs');
|
|
128108
|
-
return path__rspack_import_0.join(os__rspack_import_2.homedir(), '.cache', 'extensionjs');
|
|
128109
|
-
}
|
|
128110
|
-
function resolveOptionalInstallRoot() {
|
|
128111
|
-
return path__rspack_import_0.join(getExtensionJsCacheBaseDir(), 'optional-deps', _package_json__rspack_import_3.rE);
|
|
128112
|
-
}
|
|
128113
|
-
function hasDependency(projectPath, dependency) {
|
|
128114
|
-
const findNearestPackageJsonDirectory = (startPath)=>{
|
|
128115
|
-
let currentDirectory = startPath;
|
|
128116
|
-
const maxDepth = 4;
|
|
128117
|
-
for(let i = 0; i < maxDepth; i++){
|
|
128118
|
-
const candidate = path__rspack_import_0.join(currentDirectory, 'package.json');
|
|
128119
|
-
if (fs__rspack_import_1.existsSync(candidate)) return currentDirectory;
|
|
128120
|
-
const parentDirectory = path__rspack_import_0.dirname(currentDirectory);
|
|
128121
|
-
if (parentDirectory === currentDirectory) break;
|
|
128122
|
-
currentDirectory = parentDirectory;
|
|
128123
|
-
}
|
|
128124
|
-
};
|
|
128125
|
-
const packageJsonDirectory = findNearestPackageJsonDirectory(projectPath);
|
|
128126
|
-
if (!packageJsonDirectory) return false;
|
|
128127
|
-
const packageJsonPath = path__rspack_import_0.join(packageJsonDirectory, 'package.json');
|
|
128128
|
-
if (!fs__rspack_import_1.existsSync(packageJsonPath)) return false;
|
|
128129
|
-
const parsed = parseJsonSafe(fs__rspack_import_1.readFileSync(packageJsonPath, 'utf8'));
|
|
128130
|
-
const dependencies = parsed.dependencies || {};
|
|
128131
|
-
const devDependencies = parsed.devDependencies || {};
|
|
128132
|
-
return !!dependencies[dependency] || !!devDependencies[dependency];
|
|
128133
|
-
}
|
|
128134
|
-
},
|
|
128135
127518
|
"./webpack/plugin-browsers/browsers-lib/banner.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
128136
127519
|
"use strict";
|
|
128137
127520
|
__webpack_require__.d(__webpack_exports__, {
|
|
@@ -128314,6 +127697,342 @@ var __webpack_modules__ = {
|
|
|
128314
127697
|
return true;
|
|
128315
127698
|
}
|
|
128316
127699
|
},
|
|
127700
|
+
"./webpack/plugin-browsers/browsers-lib/content-script-targets.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
127701
|
+
"use strict";
|
|
127702
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
127703
|
+
HE: ()=>isCanonicalContentScriptAsset,
|
|
127704
|
+
Il: ()=>selectContentScriptRules,
|
|
127705
|
+
JY: ()=>getChangedContentScriptEntryNames,
|
|
127706
|
+
Rt: ()=>normalizeModuleResourcePath,
|
|
127707
|
+
im: ()=>collectContentScriptDependencyPaths,
|
|
127708
|
+
iw: ()=>readContentScriptRules,
|
|
127709
|
+
lM: ()=>urlMatchesAnyContentScriptRule,
|
|
127710
|
+
nG: ()=>resolveEmittedContentScriptFile,
|
|
127711
|
+
wH: ()=>isContentScriptEntryName
|
|
127712
|
+
});
|
|
127713
|
+
var fs__rspack_import_0 = __webpack_require__("fs");
|
|
127714
|
+
var path__rspack_import_1 = __webpack_require__("path");
|
|
127715
|
+
var _plugin_web_extension_feature_scripts_contracts__rspack_import_2 = __webpack_require__("./webpack/plugin-web-extension/feature-scripts/contracts.ts");
|
|
127716
|
+
function isContentScriptEntryName(entryName) {
|
|
127717
|
+
return (0, _plugin_web_extension_feature_scripts_contracts__rspack_import_2.Mj)(entryName);
|
|
127718
|
+
}
|
|
127719
|
+
function isCanonicalContentScriptAsset(assetName) {
|
|
127720
|
+
return (0, _plugin_web_extension_feature_scripts_contracts__rspack_import_2.HE)(assetName);
|
|
127721
|
+
}
|
|
127722
|
+
function resolveEmittedContentScriptFile(extensionOutPath, index, ext) {
|
|
127723
|
+
const rel = 'js' === ext ? (0, _plugin_web_extension_feature_scripts_contracts__rspack_import_2.f6)(index) : (0, _plugin_web_extension_feature_scripts_contracts__rspack_import_2.J4)(index);
|
|
127724
|
+
const canonical = path__rspack_import_1.join(extensionOutPath, rel);
|
|
127725
|
+
if (fs__rspack_import_0.existsSync(canonical)) return canonical;
|
|
127726
|
+
const dir = path__rspack_import_1.join(extensionOutPath, "content_scripts");
|
|
127727
|
+
if (!fs__rspack_import_0.existsSync(dir)) return null;
|
|
127728
|
+
try {
|
|
127729
|
+
const re = new RegExp(`^content-${index}\\.[a-f0-9]+\\.${ext}$`, 'i');
|
|
127730
|
+
for (const name of fs__rspack_import_0.readdirSync(dir))if (re.test(name)) return path__rspack_import_1.join(dir, name);
|
|
127731
|
+
} catch {}
|
|
127732
|
+
return null;
|
|
127733
|
+
}
|
|
127734
|
+
function getChangedContentScriptEntryNames(modifiedFilePaths, dependencyPathsByEntry) {
|
|
127735
|
+
const changed = new Set();
|
|
127736
|
+
for (const modifiedFilePath of modifiedFilePaths)for (const [entryName, dependencyPaths] of dependencyPathsByEntry.entries()){
|
|
127737
|
+
if (dependencyPaths.has(modifiedFilePath)) {
|
|
127738
|
+
changed.add(entryName);
|
|
127739
|
+
continue;
|
|
127740
|
+
}
|
|
127741
|
+
for (const dependencyPath of dependencyPaths)if (modifiedFilePath.endsWith(dependencyPath)) {
|
|
127742
|
+
changed.add(entryName);
|
|
127743
|
+
break;
|
|
127744
|
+
}
|
|
127745
|
+
}
|
|
127746
|
+
return Array.from(changed).sort();
|
|
127747
|
+
}
|
|
127748
|
+
function collectContentScriptDependencyPaths(compilation) {
|
|
127749
|
+
const dependencyPathsByEntry = new Map();
|
|
127750
|
+
const entrypoints = compilation?.entrypoints;
|
|
127751
|
+
const chunkGraph = compilation?.chunkGraph;
|
|
127752
|
+
if (!entrypoints || !chunkGraph) return dependencyPathsByEntry;
|
|
127753
|
+
for (const [entryName, entrypoint] of entrypoints.entries()){
|
|
127754
|
+
if (!isContentScriptEntryName(entryName)) continue;
|
|
127755
|
+
const resourcePaths = new Set();
|
|
127756
|
+
const entrypointChunks = Array.from(entrypoint?.chunks || []);
|
|
127757
|
+
for (const chunk of entrypointChunks){
|
|
127758
|
+
const modulesIterable = chunkGraph.getChunkModulesIterable?.(chunk) || chunkGraph.getChunkModulesIterableBySourceType?.(chunk, "javascript") || chunkGraph.getChunkModules?.(chunk);
|
|
127759
|
+
if (modulesIterable) for (const module of modulesIterable)collectModuleResourcePaths(module, resourcePaths);
|
|
127760
|
+
}
|
|
127761
|
+
collectDeclaredEntryImportPaths(compilation, entryName, resourcePaths);
|
|
127762
|
+
collectTransitiveLocalDependencyPaths(resourcePaths);
|
|
127763
|
+
if (resourcePaths.size > 0) dependencyPathsByEntry.set(entryName, resourcePaths);
|
|
127764
|
+
}
|
|
127765
|
+
return dependencyPathsByEntry;
|
|
127766
|
+
}
|
|
127767
|
+
function collectModuleResourcePaths(module, resourcePaths, seen = new Set()) {
|
|
127768
|
+
if (!module || seen.has(module)) return;
|
|
127769
|
+
seen.add(module);
|
|
127770
|
+
const candidateResourcePaths = [
|
|
127771
|
+
module?.resource,
|
|
127772
|
+
module?.rootModule?.resource,
|
|
127773
|
+
module?.originalSource?.()?.resource
|
|
127774
|
+
];
|
|
127775
|
+
for (const resourcePath of candidateResourcePaths){
|
|
127776
|
+
const normalizedResourcePath = normalizeModuleResourcePath(resourcePath);
|
|
127777
|
+
if (normalizedResourcePath) resourcePaths.add(normalizedResourcePath);
|
|
127778
|
+
}
|
|
127779
|
+
const nestedCollections = [
|
|
127780
|
+
module?.modules,
|
|
127781
|
+
module?._modules,
|
|
127782
|
+
module?.children,
|
|
127783
|
+
module?.dependencies
|
|
127784
|
+
];
|
|
127785
|
+
for (const nestedCollection of nestedCollections)if (nestedCollection) for (const nestedModule of nestedCollection)collectModuleResourcePaths(nestedModule, resourcePaths, seen);
|
|
127786
|
+
}
|
|
127787
|
+
function collectDeclaredEntryImportPaths(compilation, entryName, resourcePaths) {
|
|
127788
|
+
const rawEntry = compilation?.options?.entry?.[entryName];
|
|
127789
|
+
const importSpecifiers = normalizeEntryImportSpecifiers(rawEntry);
|
|
127790
|
+
for (const importSpecifier of importSpecifiers){
|
|
127791
|
+
const normalizedImportPath = normalizeModuleResourcePath(importSpecifier);
|
|
127792
|
+
if (normalizedImportPath && fs__rspack_import_0.existsSync(normalizedImportPath)) {
|
|
127793
|
+
resourcePaths.add(normalizedImportPath);
|
|
127794
|
+
continue;
|
|
127795
|
+
}
|
|
127796
|
+
const dataUrlSource = decodeJavascriptDataUrl(importSpecifier);
|
|
127797
|
+
if (dataUrlSource) for (const referencedPath of extractReferencedSourcePaths(dataUrlSource))resourcePaths.add(referencedPath);
|
|
127798
|
+
}
|
|
127799
|
+
}
|
|
127800
|
+
function normalizeEntryImportSpecifiers(rawEntry) {
|
|
127801
|
+
if (!rawEntry) return [];
|
|
127802
|
+
if ('string' == typeof rawEntry) return [
|
|
127803
|
+
rawEntry
|
|
127804
|
+
];
|
|
127805
|
+
if (Array.isArray(rawEntry)) return rawEntry.map((value)=>String(value || ''));
|
|
127806
|
+
const entryImport = rawEntry?.import;
|
|
127807
|
+
if ('string' == typeof entryImport) return [
|
|
127808
|
+
entryImport
|
|
127809
|
+
];
|
|
127810
|
+
if (Array.isArray(entryImport)) return entryImport.map((value)=>String(value || ''));
|
|
127811
|
+
return [];
|
|
127812
|
+
}
|
|
127813
|
+
function decodeJavascriptDataUrl(specifier) {
|
|
127814
|
+
const value = String(specifier || '');
|
|
127815
|
+
if (!value.startsWith("data:text/javascript")) return;
|
|
127816
|
+
const commaIndex = value.indexOf(',');
|
|
127817
|
+
if (-1 === commaIndex) return;
|
|
127818
|
+
try {
|
|
127819
|
+
return decodeURIComponent(value.slice(commaIndex + 1));
|
|
127820
|
+
} catch {
|
|
127821
|
+
return;
|
|
127822
|
+
}
|
|
127823
|
+
}
|
|
127824
|
+
function extractReferencedSourcePaths(source) {
|
|
127825
|
+
const referencedPaths = new Set();
|
|
127826
|
+
const patterns = [
|
|
127827
|
+
/\bimport\s+(?:[^"'`]*?\s+from\s+)?["'`]([^"'`]+)["'`]/g,
|
|
127828
|
+
/\bexport\s+[^"'`]*?\s+from\s+["'`]([^"'`]+)["'`]/g,
|
|
127829
|
+
/\bimport\(\s*["'`]([^"'`]+)["'`]\s*\)/g,
|
|
127830
|
+
/\brequire\(\s*["'`]([^"'`]+)["'`]\s*\)/g,
|
|
127831
|
+
/new URL\(\s*["'`]([^"'`]+)["'`]\s*,\s*import\.meta\.url\s*\)/g
|
|
127832
|
+
];
|
|
127833
|
+
for (const pattern of patterns){
|
|
127834
|
+
let match;
|
|
127835
|
+
while(match = pattern.exec(source)){
|
|
127836
|
+
const normalizedResourcePath = normalizeModuleResourcePath(match[1]);
|
|
127837
|
+
if (normalizedResourcePath && fs__rspack_import_0.existsSync(normalizedResourcePath)) referencedPaths.add(normalizedResourcePath);
|
|
127838
|
+
}
|
|
127839
|
+
}
|
|
127840
|
+
return Array.from(referencedPaths);
|
|
127841
|
+
}
|
|
127842
|
+
function collectTransitiveLocalDependencyPaths(resourcePaths) {
|
|
127843
|
+
const queue = Array.from(resourcePaths);
|
|
127844
|
+
const seenFiles = new Set(queue);
|
|
127845
|
+
while(queue.length > 0){
|
|
127846
|
+
const currentPath = queue.shift();
|
|
127847
|
+
if (!currentPath || !fs__rspack_import_0.existsSync(currentPath)) continue;
|
|
127848
|
+
let stat;
|
|
127849
|
+
try {
|
|
127850
|
+
stat = fs__rspack_import_0.statSync(currentPath);
|
|
127851
|
+
} catch {
|
|
127852
|
+
continue;
|
|
127853
|
+
}
|
|
127854
|
+
if (!stat.isFile()) continue;
|
|
127855
|
+
let source = '';
|
|
127856
|
+
try {
|
|
127857
|
+
source = fs__rspack_import_0.readFileSync(currentPath, 'utf8');
|
|
127858
|
+
} catch {
|
|
127859
|
+
continue;
|
|
127860
|
+
}
|
|
127861
|
+
for (const dependencyPath of resolveLocalSourceDependencies(currentPath, source))if (!seenFiles.has(dependencyPath)) {
|
|
127862
|
+
seenFiles.add(dependencyPath);
|
|
127863
|
+
resourcePaths.add(dependencyPath);
|
|
127864
|
+
queue.push(dependencyPath);
|
|
127865
|
+
}
|
|
127866
|
+
}
|
|
127867
|
+
}
|
|
127868
|
+
function resolveLocalSourceDependencies(absoluteFilePath, source) {
|
|
127869
|
+
const resolvedPaths = new Set();
|
|
127870
|
+
const patterns = [
|
|
127871
|
+
/\bimport\s+(?:[^"'`]*?\s+from\s+)?["'`]([^"'`]+)["'`]/g,
|
|
127872
|
+
/\bexport\s+[^"'`]*?\s+from\s+["'`]([^"'`]+)["'`]/g,
|
|
127873
|
+
/\bimport\(\s*["'`]([^"'`]+)["'`]\s*\)/g,
|
|
127874
|
+
/\brequire\(\s*["'`]([^"'`]+)["'`]\s*\)/g,
|
|
127875
|
+
/new URL\(\s*["'`]([^"'`]+)["'`]\s*,\s*import\.meta\.url\s*\)/g
|
|
127876
|
+
];
|
|
127877
|
+
for (const pattern of patterns){
|
|
127878
|
+
let match;
|
|
127879
|
+
while(match = pattern.exec(source)){
|
|
127880
|
+
const specifier = String(match[1] || '');
|
|
127881
|
+
if (!specifier || !specifier.startsWith('.') && !specifier.startsWith('/')) continue;
|
|
127882
|
+
const resolvedPath = resolveLocalDependencyPath(absoluteFilePath, specifier);
|
|
127883
|
+
if (resolvedPath) resolvedPaths.add(resolvedPath);
|
|
127884
|
+
}
|
|
127885
|
+
}
|
|
127886
|
+
return Array.from(resolvedPaths);
|
|
127887
|
+
}
|
|
127888
|
+
function resolveLocalDependencyPath(absoluteFilePath, specifier) {
|
|
127889
|
+
const specifierWithoutQuery = String(specifier || '').replace(/[?#].*$/, '');
|
|
127890
|
+
if (!specifierWithoutQuery) return;
|
|
127891
|
+
const basePath = specifierWithoutQuery.startsWith('/') ? specifierWithoutQuery : path__rspack_import_1.resolve(path__rspack_import_1.dirname(absoluteFilePath), specifierWithoutQuery);
|
|
127892
|
+
const candidates = new Set([
|
|
127893
|
+
basePath
|
|
127894
|
+
]);
|
|
127895
|
+
const extensions = [
|
|
127896
|
+
'.ts',
|
|
127897
|
+
'.tsx',
|
|
127898
|
+
'.mts',
|
|
127899
|
+
'.cts',
|
|
127900
|
+
'.js',
|
|
127901
|
+
'.jsx',
|
|
127902
|
+
'.mjs',
|
|
127903
|
+
'.cjs',
|
|
127904
|
+
'.css',
|
|
127905
|
+
'.scss',
|
|
127906
|
+
'.sass',
|
|
127907
|
+
'.less'
|
|
127908
|
+
];
|
|
127909
|
+
for (const extension of extensions){
|
|
127910
|
+
candidates.add(`${basePath}${extension}`);
|
|
127911
|
+
candidates.add(path__rspack_import_1.join(basePath, `index${extension}`));
|
|
127912
|
+
}
|
|
127913
|
+
for (const candidate of candidates){
|
|
127914
|
+
const normalizedCandidate = normalizeModuleResourcePath(candidate);
|
|
127915
|
+
if (normalizedCandidate && fs__rspack_import_0.existsSync(normalizedCandidate)) return normalizedCandidate;
|
|
127916
|
+
}
|
|
127917
|
+
}
|
|
127918
|
+
function normalizeModuleResourcePath(resourcePath) {
|
|
127919
|
+
if ('string' != typeof resourcePath || 0 === resourcePath.length) return;
|
|
127920
|
+
let normalized = resourcePath.replace(/\\/g, '/').trim();
|
|
127921
|
+
if (!normalized) return;
|
|
127922
|
+
const loaderIndex = normalized.lastIndexOf('!');
|
|
127923
|
+
if (loaderIndex >= 0) normalized = normalized.slice(loaderIndex + 1);
|
|
127924
|
+
const queryIndex = normalized.search(/[?#]/);
|
|
127925
|
+
if (queryIndex >= 0) normalized = normalized.slice(0, queryIndex);
|
|
127926
|
+
normalized = normalized.trim();
|
|
127927
|
+
return normalized || void 0;
|
|
127928
|
+
}
|
|
127929
|
+
function readContentScriptRules(compilation, extensionRoot) {
|
|
127930
|
+
const manifest = readManifestFromCompilation(compilation) || readManifestFromDisk(extensionRoot) || {};
|
|
127931
|
+
return getContentScriptRulesFromManifest(manifest);
|
|
127932
|
+
}
|
|
127933
|
+
function getContentScriptRulesFromManifest(manifest) {
|
|
127934
|
+
const contentScripts = Array.isArray(manifest?.content_scripts) ? manifest.content_scripts : [];
|
|
127935
|
+
return contentScripts.map((contentScript, index)=>({
|
|
127936
|
+
index,
|
|
127937
|
+
world: contentScript?.world === 'MAIN' ? 'main' : 'extension',
|
|
127938
|
+
matches: normalizeStringArray(contentScript?.matches),
|
|
127939
|
+
excludeMatches: normalizeStringArray(contentScript?.exclude_matches),
|
|
127940
|
+
includeGlobs: normalizeStringArray(contentScript?.include_globs),
|
|
127941
|
+
excludeGlobs: normalizeStringArray(contentScript?.exclude_globs)
|
|
127942
|
+
}));
|
|
127943
|
+
}
|
|
127944
|
+
function selectContentScriptRules(rules, entryNames) {
|
|
127945
|
+
const selectedIndices = new Set();
|
|
127946
|
+
for (const entryName of entryNames){
|
|
127947
|
+
const index = (0, _plugin_web_extension_feature_scripts_contracts__rspack_import_2.WG)(entryName);
|
|
127948
|
+
if (void 0 !== index) selectedIndices.add(index);
|
|
127949
|
+
}
|
|
127950
|
+
return rules.filter((rule)=>selectedIndices.has(rule.index));
|
|
127951
|
+
}
|
|
127952
|
+
function urlMatchesContentScriptRule(rawUrl, rule) {
|
|
127953
|
+
const url = safeParseUrl(rawUrl);
|
|
127954
|
+
if (!url) return false;
|
|
127955
|
+
const hasPositiveMatch = rule.matches.some((pattern)=>urlMatchesPattern(url, pattern)) && (0 === rule.includeGlobs.length || rule.includeGlobs.some((glob)=>urlMatchesGlob(rawUrl, glob)));
|
|
127956
|
+
if (!hasPositiveMatch) return false;
|
|
127957
|
+
if (rule.excludeMatches.some((pattern)=>urlMatchesPattern(url, pattern))) return false;
|
|
127958
|
+
if (rule.excludeGlobs.some((glob)=>urlMatchesGlob(rawUrl, glob))) return false;
|
|
127959
|
+
return true;
|
|
127960
|
+
}
|
|
127961
|
+
function urlMatchesAnyContentScriptRule(rawUrl, rules) {
|
|
127962
|
+
return rules.some((rule)=>urlMatchesContentScriptRule(rawUrl, rule));
|
|
127963
|
+
}
|
|
127964
|
+
function readManifestFromCompilation(compilation) {
|
|
127965
|
+
try {
|
|
127966
|
+
const asset = compilation.getAsset?.('manifest.json');
|
|
127967
|
+
if (!asset?.source) return;
|
|
127968
|
+
return JSON.parse(String(asset.source.source()));
|
|
127969
|
+
} catch {
|
|
127970
|
+
return;
|
|
127971
|
+
}
|
|
127972
|
+
}
|
|
127973
|
+
function readManifestFromDisk(extensionRoot) {
|
|
127974
|
+
if (!extensionRoot) return;
|
|
127975
|
+
try {
|
|
127976
|
+
const manifestPath = path__rspack_import_1.join(extensionRoot, 'manifest.json');
|
|
127977
|
+
if (!fs__rspack_import_0.existsSync(manifestPath)) return;
|
|
127978
|
+
return JSON.parse(fs__rspack_import_0.readFileSync(manifestPath, 'utf8'));
|
|
127979
|
+
} catch {
|
|
127980
|
+
return;
|
|
127981
|
+
}
|
|
127982
|
+
}
|
|
127983
|
+
function normalizeStringArray(input) {
|
|
127984
|
+
return Array.isArray(input) ? input.filter((value)=>'string' == typeof value).map((value)=>value.trim()).filter(Boolean) : [];
|
|
127985
|
+
}
|
|
127986
|
+
function safeParseUrl(rawUrl) {
|
|
127987
|
+
try {
|
|
127988
|
+
return new URL(rawUrl);
|
|
127989
|
+
} catch {
|
|
127990
|
+
return;
|
|
127991
|
+
}
|
|
127992
|
+
}
|
|
127993
|
+
function urlMatchesPattern(url, pattern) {
|
|
127994
|
+
if (!pattern) return false;
|
|
127995
|
+
if ('<all_urls>' === pattern) return /^(https?|file|ftp|ws|wss):$/i.test(url.protocol);
|
|
127996
|
+
const parsedPattern = parseMatchPattern(pattern);
|
|
127997
|
+
if (!parsedPattern) return false;
|
|
127998
|
+
if (!schemeMatches(url, parsedPattern.scheme)) return false;
|
|
127999
|
+
if (!hostMatches(url, parsedPattern.host)) return false;
|
|
128000
|
+
const urlPath = `${url.pathname}${url.search}${url.hash}`;
|
|
128001
|
+
return wildcardToRegExp(parsedPattern.path).test(urlPath);
|
|
128002
|
+
}
|
|
128003
|
+
function parseMatchPattern(pattern) {
|
|
128004
|
+
const match = /^(\*|http|https|file|ftp|ws|wss):\/\/([^/]*)(\/.*)$/.exec(pattern);
|
|
128005
|
+
if (!match) return;
|
|
128006
|
+
return {
|
|
128007
|
+
scheme: match[1],
|
|
128008
|
+
host: match[2],
|
|
128009
|
+
path: match[3]
|
|
128010
|
+
};
|
|
128011
|
+
}
|
|
128012
|
+
function schemeMatches(url, scheme) {
|
|
128013
|
+
const protocol = url.protocol.replace(/:$/, '');
|
|
128014
|
+
if ('*' === scheme) return 'http' === protocol || 'https' === protocol;
|
|
128015
|
+
return protocol === scheme;
|
|
128016
|
+
}
|
|
128017
|
+
function hostMatches(url, hostPattern) {
|
|
128018
|
+
if ('*' === hostPattern) return true;
|
|
128019
|
+
if ('file:' === url.protocol) return '' === hostPattern || '*' === hostPattern;
|
|
128020
|
+
const hostname = url.hostname;
|
|
128021
|
+
if (!hostname) return false;
|
|
128022
|
+
if (hostPattern.startsWith('*.')) {
|
|
128023
|
+
const bareHost = hostPattern.slice(2);
|
|
128024
|
+
return hostname === bareHost || hostname.endsWith(`.${bareHost}`);
|
|
128025
|
+
}
|
|
128026
|
+
return hostname === hostPattern;
|
|
128027
|
+
}
|
|
128028
|
+
function urlMatchesGlob(rawUrl, glob) {
|
|
128029
|
+
return wildcardToRegExp(glob).test(rawUrl);
|
|
128030
|
+
}
|
|
128031
|
+
function wildcardToRegExp(pattern) {
|
|
128032
|
+
const escaped = pattern.replace(/[|\\{}()[\]^$+?.]/g, '\\$&');
|
|
128033
|
+
return new RegExp(`^${escaped.replace(/\*/g, '.*')}$`);
|
|
128034
|
+
}
|
|
128035
|
+
},
|
|
128317
128036
|
"./webpack/plugin-browsers/browsers-lib/instance-registry.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
128318
128037
|
"use strict";
|
|
128319
128038
|
__webpack_require__.d(__webpack_exports__, {
|
|
@@ -129289,6 +129008,82 @@ var __webpack_modules__ = {
|
|
|
129289
129008
|
return null;
|
|
129290
129009
|
}
|
|
129291
129010
|
},
|
|
129011
|
+
"./webpack/plugin-browsers/browsers-lib/runtime-options.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
129012
|
+
"use strict";
|
|
129013
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
129014
|
+
fT: ()=>toExtensionLoadList,
|
|
129015
|
+
pA: ()=>pickSharedBrowserRuntimeOptions,
|
|
129016
|
+
sl: ()=>publishUserExtensionRoot,
|
|
129017
|
+
zU: ()=>buildBrowserLaunchRequest
|
|
129018
|
+
});
|
|
129019
|
+
const sharedBrowserRuntimeOptionKeys = [
|
|
129020
|
+
'extension',
|
|
129021
|
+
'browser',
|
|
129022
|
+
'noOpen',
|
|
129023
|
+
'browserFlags',
|
|
129024
|
+
'excludeBrowserFlags',
|
|
129025
|
+
'profile',
|
|
129026
|
+
'preferences',
|
|
129027
|
+
'startingUrl',
|
|
129028
|
+
'instanceId',
|
|
129029
|
+
'port',
|
|
129030
|
+
'source',
|
|
129031
|
+
'watchSource',
|
|
129032
|
+
'sourceFormat',
|
|
129033
|
+
'sourceSummary',
|
|
129034
|
+
'sourceMeta',
|
|
129035
|
+
'sourceProbe',
|
|
129036
|
+
'sourceTree',
|
|
129037
|
+
'sourceConsole',
|
|
129038
|
+
'sourceDom',
|
|
129039
|
+
'sourceMaxBytes',
|
|
129040
|
+
'sourceRedact',
|
|
129041
|
+
'sourceIncludeShadow',
|
|
129042
|
+
'sourceDiff',
|
|
129043
|
+
'dryRun',
|
|
129044
|
+
'logLevel',
|
|
129045
|
+
'logContexts',
|
|
129046
|
+
'logFormat',
|
|
129047
|
+
'logTimestamps',
|
|
129048
|
+
'logColor',
|
|
129049
|
+
'logUrl',
|
|
129050
|
+
'logTab'
|
|
129051
|
+
];
|
|
129052
|
+
function pickSharedBrowserRuntimeOptions(options) {
|
|
129053
|
+
return sharedBrowserRuntimeOptionKeys.reduce((picked, key)=>{
|
|
129054
|
+
picked[key] = options[key];
|
|
129055
|
+
return picked;
|
|
129056
|
+
}, {});
|
|
129057
|
+
}
|
|
129058
|
+
function buildBrowserLaunchRequest(options, mode, extras) {
|
|
129059
|
+
return {
|
|
129060
|
+
browser: options.browser,
|
|
129061
|
+
browserFlags: options.browserFlags,
|
|
129062
|
+
excludeBrowserFlags: options.excludeBrowserFlags,
|
|
129063
|
+
profile: options.profile,
|
|
129064
|
+
preferences: options.preferences,
|
|
129065
|
+
startingUrl: options.startingUrl,
|
|
129066
|
+
port: options.port,
|
|
129067
|
+
mode,
|
|
129068
|
+
...extras || {}
|
|
129069
|
+
};
|
|
129070
|
+
}
|
|
129071
|
+
function toExtensionLoadList(extension) {
|
|
129072
|
+
return Array.isArray(extension) ? [
|
|
129073
|
+
...extension
|
|
129074
|
+
] : [
|
|
129075
|
+
extension
|
|
129076
|
+
];
|
|
129077
|
+
}
|
|
129078
|
+
function publishUserExtensionRoot(extension, setExtensionRoot) {
|
|
129079
|
+
try {
|
|
129080
|
+
const root = [
|
|
129081
|
+
...toExtensionLoadList(extension)
|
|
129082
|
+
].reverse().find((entry)=>'string' == typeof entry);
|
|
129083
|
+
if (root && setExtensionRoot) setExtensionRoot(String(root));
|
|
129084
|
+
} catch {}
|
|
129085
|
+
}
|
|
129086
|
+
},
|
|
129292
129087
|
"./webpack/plugin-browsers/browsers-lib/shared-utils.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
129293
129088
|
"use strict";
|
|
129294
129089
|
__webpack_require__.d(__webpack_exports__, {
|
|
@@ -129524,6 +129319,7 @@ var __webpack_modules__ = {
|
|
|
129524
129319
|
var output_binaries_resolver = __webpack_require__("./webpack/plugin-browsers/browsers-lib/output-binaries-resolver.ts");
|
|
129525
129320
|
var shared_utils = __webpack_require__("./webpack/plugin-browsers/browsers-lib/shared-utils.ts");
|
|
129526
129321
|
var banner = __webpack_require__("./webpack/plugin-browsers/browsers-lib/banner.ts");
|
|
129322
|
+
var runtime_options = __webpack_require__("./webpack/plugin-browsers/browsers-lib/runtime-options.ts");
|
|
129527
129323
|
var dev_server_messages = __webpack_require__("./webpack/dev-server/messages.ts");
|
|
129528
129324
|
var external_path_ = __webpack_require__("path");
|
|
129529
129325
|
const masterPreferences = {
|
|
@@ -129672,9 +129468,7 @@ var __webpack_modules__ = {
|
|
|
129672
129468
|
external_fs_.writeFileSync(preferencesPath, JSON.stringify(mergedPreferences), 'utf8');
|
|
129673
129469
|
}
|
|
129674
129470
|
function browserConfig(compilation, configOptions) {
|
|
129675
|
-
const extensionsToLoad =
|
|
129676
|
-
configOptions.extension
|
|
129677
|
-
];
|
|
129471
|
+
const extensionsToLoad = (0, runtime_options.fT)(configOptions.extension);
|
|
129678
129472
|
const sourceEnabled = !!(configOptions.source || configOptions.watchSource);
|
|
129679
129473
|
const devWantsCDP = compilation?.options?.mode === 'development';
|
|
129680
129474
|
const rawProfile = configOptions.profile;
|
|
@@ -129916,7 +129710,7 @@ var __webpack_modules__ = {
|
|
|
129916
129710
|
const loadExtensionFlag = args.chromiumConfig.find((flag)=>flag.startsWith('--load-extension='));
|
|
129917
129711
|
const extensionOutputPath = (0, extension_output_path.W)(args.compilation, loadExtensionFlag);
|
|
129918
129712
|
if (!extensionOutputPath) return;
|
|
129919
|
-
const ready = await (0, manifest_readiness.
|
|
129713
|
+
const ready = await (0, manifest_readiness.fR)(extensionOutputPath, {
|
|
129920
129714
|
timeoutMs: 10000
|
|
129921
129715
|
});
|
|
129922
129716
|
if (!ready) return;
|
|
@@ -129971,14 +129765,34 @@ var __webpack_modules__ = {
|
|
|
129971
129765
|
const normalized = normalizeBinaryPathForWsl(p);
|
|
129972
129766
|
return normalized || null;
|
|
129973
129767
|
};
|
|
129974
|
-
|
|
129975
|
-
|
|
129976
|
-
|
|
129977
|
-
|
|
129978
|
-
|
|
129768
|
+
const isUsableBinary = (p)=>Boolean(p && external_fs_.existsSync(p));
|
|
129769
|
+
const resolveManagedBinary = ()=>{
|
|
129770
|
+
try {
|
|
129771
|
+
const resolved = output_binaries_resolver.kI(compilation, 'chromium' === browser || 'chromium-based' === browser ? 'chromium' : 'edge' === browser ? 'edge' : 'chrome');
|
|
129772
|
+
const normalized = normalizePath(resolved || null);
|
|
129773
|
+
return isUsableBinary(normalized) ? normalized : null;
|
|
129774
|
+
} catch {
|
|
129775
|
+
return null;
|
|
129776
|
+
}
|
|
129777
|
+
};
|
|
129778
|
+
const resolveWslFallback = ()=>resolveWslWindowsBinary(browser);
|
|
129779
|
+
const getInstallGuidanceText = (target)=>{
|
|
129780
|
+
try {
|
|
129781
|
+
if ('edge' === target) return (0, external_edge_location_.getInstallGuidance)();
|
|
129782
|
+
if ('chromium' === target) return (0, external_chromium_location_.getInstallGuidance)();
|
|
129783
|
+
return (0, external_chrome_location2_.getInstallGuidance)();
|
|
129784
|
+
} catch {
|
|
129785
|
+
return `npx extension install ${target}`;
|
|
129786
|
+
}
|
|
129787
|
+
};
|
|
129788
|
+
const printInstallGuidance = (raw, browserName)=>{
|
|
129789
|
+
this.printEnhancedPuppeteerInstallHint(compilation, raw, browserName);
|
|
129790
|
+
printedGuidance = true;
|
|
129791
|
+
};
|
|
129792
|
+
browserBinaryLocation = resolveManagedBinary();
|
|
129979
129793
|
let skipDetection = Boolean(browserBinaryLocation);
|
|
129980
129794
|
if (!browserBinaryLocation && isWslEnv()) {
|
|
129981
|
-
const wslFallback =
|
|
129795
|
+
const wslFallback = resolveWslFallback();
|
|
129982
129796
|
if (wslFallback) {
|
|
129983
129797
|
browserBinaryLocation = wslFallback;
|
|
129984
129798
|
skipDetection = true;
|
|
@@ -130002,58 +129816,55 @@ var __webpack_modules__ = {
|
|
|
130002
129816
|
if (/\/google-chrome(?:-stable)?$/i.test(p)) return true;
|
|
130003
129817
|
return false;
|
|
130004
129818
|
};
|
|
130005
|
-
const getInstallGuidanceText = ()=>{
|
|
130006
|
-
try {
|
|
130007
|
-
return (0, external_chrome_location2_.getInstallGuidance)();
|
|
130008
|
-
} catch {
|
|
130009
|
-
return 'npx extension install chrome';
|
|
130010
|
-
}
|
|
130011
|
-
};
|
|
130012
129819
|
const managedCacheRoot = output_binaries_resolver.LB(compilation);
|
|
130013
129820
|
const managedEnvFor = (b)=>({
|
|
130014
129821
|
...process.env,
|
|
130015
129822
|
...output_binaries_resolver.$4(String(managedCacheRoot), b)
|
|
130016
129823
|
});
|
|
130017
129824
|
const isAuthorMode = 'true' === process.env.EXTENSION_AUTHOR_MODE;
|
|
130018
|
-
|
|
130019
|
-
|
|
130020
|
-
|
|
130021
|
-
|
|
130022
|
-
|
|
130023
|
-
|
|
130024
|
-
|
|
130025
|
-
|
|
130026
|
-
|
|
130027
|
-
|
|
130028
|
-
|
|
130029
|
-
|
|
130030
|
-
|
|
130031
|
-
printedGuidance = true;
|
|
130032
|
-
browserBinaryLocation = null;
|
|
130033
|
-
} else browserBinaryLocation = normalized;
|
|
130034
|
-
else browserBinaryLocation = null;
|
|
130035
|
-
} catch (err) {
|
|
130036
|
-
const env = managedEnvFor('chrome');
|
|
130037
|
-
let candidate = external_chrome_location2_default()(true, {
|
|
130038
|
-
env
|
|
130039
|
-
}) || null;
|
|
130040
|
-
const normalized = normalizePath(candidate || null);
|
|
130041
|
-
if (normalized) {
|
|
130042
|
-
if (looksOfficialChromeBinaryPath(normalized) && !isWslEnv()) {
|
|
130043
|
-
this.printEnhancedPuppeteerInstallHint(compilation, getInstallGuidanceText(), browser);
|
|
130044
|
-
printedGuidance = true;
|
|
130045
|
-
candidate = null;
|
|
130046
|
-
}
|
|
129825
|
+
const resolveChromeLikeBinary = ()=>{
|
|
129826
|
+
try {
|
|
129827
|
+
try {
|
|
129828
|
+
const env = managedEnvFor('chrome');
|
|
129829
|
+
const located = external_chrome_location2_default()(true, {
|
|
129830
|
+
env
|
|
129831
|
+
}) || null;
|
|
129832
|
+
if (!located) throw new Error(getInstallGuidanceText('chrome'));
|
|
129833
|
+
const normalized = normalizePath(located || null);
|
|
129834
|
+
if (isUsableBinary(normalized)) {
|
|
129835
|
+
if (looksOfficialChromeBinaryPath(normalized) && !isWslEnv()) {
|
|
129836
|
+
printInstallGuidance(getInstallGuidanceText('chrome'), browser);
|
|
129837
|
+
return null;
|
|
130047
129838
|
}
|
|
130048
|
-
|
|
130049
|
-
if (!browserBinaryLocation) browserBinaryLocation = resolveWslWindowsBinary(browser);
|
|
130050
|
-
if (!browserBinaryLocation) throw err;
|
|
129839
|
+
return normalized;
|
|
130051
129840
|
}
|
|
130052
|
-
|
|
130053
|
-
|
|
130054
|
-
|
|
130055
|
-
|
|
129841
|
+
return null;
|
|
129842
|
+
} catch (err) {
|
|
129843
|
+
const env = managedEnvFor('chrome');
|
|
129844
|
+
let candidate = external_chrome_location2_default()(true, {
|
|
129845
|
+
env
|
|
129846
|
+
}) || null;
|
|
129847
|
+
const normalized = normalizePath(candidate || null);
|
|
129848
|
+
if (normalized) {
|
|
129849
|
+
if (looksOfficialChromeBinaryPath(normalized) && !isWslEnv()) {
|
|
129850
|
+
printInstallGuidance(getInstallGuidanceText('chrome'), browser);
|
|
129851
|
+
candidate = null;
|
|
129852
|
+
}
|
|
129853
|
+
}
|
|
129854
|
+
const resolved = normalizePath(candidate || null);
|
|
129855
|
+
const fallback = resolved || resolveWslFallback();
|
|
129856
|
+
if (!fallback) throw err;
|
|
129857
|
+
return fallback;
|
|
130056
129858
|
}
|
|
129859
|
+
} catch (error) {
|
|
129860
|
+
printInstallGuidance(String(error), browser);
|
|
129861
|
+
return null;
|
|
129862
|
+
}
|
|
129863
|
+
};
|
|
129864
|
+
switch(browser){
|
|
129865
|
+
case 'chrome':
|
|
129866
|
+
if (isAuthorMode) console.log(messages.GqE(browser));
|
|
129867
|
+
if (!skipDetection) browserBinaryLocation = resolveChromeLikeBinary();
|
|
130057
129868
|
break;
|
|
130058
129869
|
case 'chromium':
|
|
130059
129870
|
if (isAuthorMode) console.log(messages.GqE(browser));
|
|
@@ -130076,7 +129887,7 @@ var __webpack_modules__ = {
|
|
|
130076
129887
|
if (external_fs_.existsSync(normalized)) browserBinaryLocation = normalized;
|
|
130077
129888
|
}
|
|
130078
129889
|
} catch {}
|
|
130079
|
-
if (!browserBinaryLocation) browserBinaryLocation =
|
|
129890
|
+
if (!browserBinaryLocation) browserBinaryLocation = resolveWslFallback();
|
|
130080
129891
|
break;
|
|
130081
129892
|
case 'edge':
|
|
130082
129893
|
if (isAuthorMode) console.log(messages.GqE(browser));
|
|
@@ -130099,33 +129910,19 @@ var __webpack_modules__ = {
|
|
|
130099
129910
|
browserBinaryLocation = fallback;
|
|
130100
129911
|
break;
|
|
130101
129912
|
}
|
|
130102
|
-
const guidance = (
|
|
130103
|
-
|
|
130104
|
-
return (0, external_edge_location_.getInstallGuidance)();
|
|
130105
|
-
} catch {
|
|
130106
|
-
return 'npx extension install edge';
|
|
130107
|
-
}
|
|
130108
|
-
})();
|
|
130109
|
-
this.printEnhancedPuppeteerInstallHint(compilation, guidance, 'edge');
|
|
130110
|
-
printedGuidance = true;
|
|
129913
|
+
const guidance = getInstallGuidanceText('edge');
|
|
129914
|
+
printInstallGuidance(guidance, 'edge');
|
|
130111
129915
|
browserBinaryLocation = null;
|
|
130112
129916
|
if (process.env.VITEST || process.env.VITEST_WORKER_ID) throw new Error('Chromium launch failed');
|
|
130113
129917
|
process.exit(1);
|
|
130114
129918
|
}
|
|
130115
129919
|
}
|
|
130116
129920
|
} catch {
|
|
130117
|
-
const guidance = (
|
|
130118
|
-
|
|
130119
|
-
return (0, external_edge_location_.getInstallGuidance)();
|
|
130120
|
-
} catch {
|
|
130121
|
-
return 'npx extension install edge';
|
|
130122
|
-
}
|
|
130123
|
-
})();
|
|
130124
|
-
const fallback = resolveWslWindowsBinary(browser);
|
|
129921
|
+
const guidance = getInstallGuidanceText('edge');
|
|
129922
|
+
const fallback = resolveWslFallback();
|
|
130125
129923
|
if (fallback) browserBinaryLocation = fallback;
|
|
130126
129924
|
else {
|
|
130127
|
-
|
|
130128
|
-
printedGuidance = true;
|
|
129925
|
+
printInstallGuidance(guidance, 'edge');
|
|
130129
129926
|
browserBinaryLocation = null;
|
|
130130
129927
|
}
|
|
130131
129928
|
if (!browserBinaryLocation) if (process.env.VITEST || process.env.VITEST_WORKER_ID) throw new Error('Chromium launch failed');
|
|
@@ -130155,85 +129952,24 @@ var __webpack_modules__ = {
|
|
|
130155
129952
|
if (external_fs_.existsSync(normalized)) browserBinaryLocation = normalized;
|
|
130156
129953
|
}
|
|
130157
129954
|
} catch {}
|
|
130158
|
-
if (!browserBinaryLocation) browserBinaryLocation =
|
|
129955
|
+
if (!browserBinaryLocation) browserBinaryLocation = resolveWslFallback();
|
|
130159
129956
|
break;
|
|
130160
129957
|
default:
|
|
130161
|
-
|
|
130162
|
-
try {
|
|
130163
|
-
const env = managedEnvFor('chrome');
|
|
130164
|
-
const located = external_chrome_location2_default()(true, {
|
|
130165
|
-
env
|
|
130166
|
-
}) || null;
|
|
130167
|
-
if (!located) throw new Error(getInstallGuidanceText());
|
|
130168
|
-
const normalized = normalizePath(located || null);
|
|
130169
|
-
if (normalized && external_fs_.existsSync(normalized)) if (looksOfficialChromeBinaryPath(normalized) && !isWslEnv()) {
|
|
130170
|
-
this.printEnhancedPuppeteerInstallHint(compilation, getInstallGuidanceText(), browser);
|
|
130171
|
-
printedGuidance = true;
|
|
130172
|
-
browserBinaryLocation = null;
|
|
130173
|
-
} else browserBinaryLocation = normalized;
|
|
130174
|
-
else browserBinaryLocation = null;
|
|
130175
|
-
} catch (err) {
|
|
130176
|
-
const env = managedEnvFor('chrome');
|
|
130177
|
-
let candidate = external_chrome_location2_default()(true, {
|
|
130178
|
-
env
|
|
130179
|
-
}) || null;
|
|
130180
|
-
const normalized = normalizePath(candidate || null);
|
|
130181
|
-
if (normalized) {
|
|
130182
|
-
if (looksOfficialChromeBinaryPath(normalized) && !isWslEnv()) {
|
|
130183
|
-
this.printEnhancedPuppeteerInstallHint(compilation, getInstallGuidanceText(), browser);
|
|
130184
|
-
printedGuidance = true;
|
|
130185
|
-
candidate = null;
|
|
130186
|
-
}
|
|
130187
|
-
}
|
|
130188
|
-
browserBinaryLocation = normalized;
|
|
130189
|
-
if (!browserBinaryLocation) browserBinaryLocation = resolveWslWindowsBinary(browser);
|
|
130190
|
-
if (!browserBinaryLocation) throw err;
|
|
130191
|
-
}
|
|
130192
|
-
} catch (e) {
|
|
130193
|
-
this.printEnhancedPuppeteerInstallHint(compilation, String(e), browser);
|
|
130194
|
-
printedGuidance = true;
|
|
130195
|
-
browserBinaryLocation = null;
|
|
130196
|
-
}
|
|
129958
|
+
browserBinaryLocation = resolveChromeLikeBinary();
|
|
130197
129959
|
break;
|
|
130198
129960
|
}
|
|
130199
129961
|
if (!browserBinaryLocation || !external_fs_.existsSync(browserBinaryLocation)) {
|
|
130200
|
-
|
|
130201
|
-
|
|
130202
|
-
const normalized = normalizePath(resolved || null);
|
|
130203
|
-
if (normalized && external_fs_.existsSync(normalized)) browserBinaryLocation = normalized;
|
|
130204
|
-
} catch {}
|
|
130205
|
-
if (!browserBinaryLocation) browserBinaryLocation = resolveWslWindowsBinary(browser);
|
|
129962
|
+
browserBinaryLocation = browserBinaryLocation || resolveManagedBinary();
|
|
129963
|
+
if (!browserBinaryLocation) browserBinaryLocation = resolveWslFallback();
|
|
130206
129964
|
if (!browserBinaryLocation || !external_fs_.existsSync(browserBinaryLocation)) {
|
|
130207
|
-
if ('chromium' === browser || 'chromium-based' === browser)
|
|
130208
|
-
const chromiumGuidance = (()=>{
|
|
130209
|
-
try {
|
|
130210
|
-
return (0, external_chromium_location_.getInstallGuidance)();
|
|
130211
|
-
} catch {
|
|
130212
|
-
return 'npx extension install chromium';
|
|
130213
|
-
}
|
|
130214
|
-
})();
|
|
130215
|
-
this.printEnhancedPuppeteerInstallHint(compilation, chromiumGuidance, 'chromium');
|
|
130216
|
-
printedGuidance = true;
|
|
130217
|
-
}
|
|
129965
|
+
if ('chromium' === browser || 'chromium-based' === browser) printInstallGuidance(getInstallGuidanceText('chromium'), 'chromium');
|
|
130218
129966
|
if (!printedGuidance && 'chromium' !== browser && 'chromium-based' !== browser) this.logger.error(messages.IhA(browser, browserBinaryLocation || ''));
|
|
130219
129967
|
if (process.env.VITEST || process.env.VITEST_WORKER_ID) throw new Error('Browser not installed or binary path not found');
|
|
130220
129968
|
process.exit(1);
|
|
130221
129969
|
}
|
|
130222
129970
|
}
|
|
130223
|
-
const extensionsToLoad =
|
|
130224
|
-
|
|
130225
|
-
] : [
|
|
130226
|
-
this.options.extension
|
|
130227
|
-
];
|
|
130228
|
-
try {
|
|
130229
|
-
const last = [
|
|
130230
|
-
...extensionsToLoad
|
|
130231
|
-
].reverse().find((e)=>'string' == typeof e);
|
|
130232
|
-
if (last) {
|
|
130233
|
-
const root = String(last);
|
|
130234
|
-
this.ctx.setExtensionRoot(root);
|
|
130235
|
-
}
|
|
130236
|
-
} catch {}
|
|
129971
|
+
const extensionsToLoad = (0, runtime_options.fT)(this.options.extension);
|
|
129972
|
+
(0, runtime_options.sl)(extensionsToLoad, this.ctx.setExtensionRoot);
|
|
130237
129973
|
let chromiumConfig = browserConfig(compilation, {
|
|
130238
129974
|
...this.options,
|
|
130239
129975
|
profile: this.options.profile,
|
|
@@ -130287,31 +130023,13 @@ var __webpack_modules__ = {
|
|
|
130287
130023
|
}
|
|
130288
130024
|
} catch {}
|
|
130289
130025
|
const cdpConfig = {
|
|
130290
|
-
|
|
130291
|
-
this.options
|
|
130292
|
-
|
|
130293
|
-
|
|
130294
|
-
|
|
130295
|
-
instanceId: this.options.instanceId,
|
|
130026
|
+
...(0, runtime_options.pA)({
|
|
130027
|
+
...this.options,
|
|
130028
|
+
extension: extensionsToLoad
|
|
130029
|
+
}),
|
|
130030
|
+
chromiumBinary: this.options.chromiumBinary,
|
|
130296
130031
|
bannerPrintedOnce: false,
|
|
130297
|
-
logLevel: this.options.logLevel,
|
|
130298
|
-
logContexts: this.options.logContexts,
|
|
130299
|
-
logUrl: this.options.logUrl,
|
|
130300
|
-
logTab: this.options.logTab,
|
|
130301
|
-
logFormat: this.options.logFormat,
|
|
130302
|
-
logTimestamps: this.options.logTimestamps,
|
|
130303
|
-
logColor: this.options.logColor,
|
|
130304
130032
|
cdpController: void 0,
|
|
130305
|
-
noOpen: this.options.noOpen,
|
|
130306
|
-
browserFlags: this.options.browserFlags,
|
|
130307
|
-
excludeBrowserFlags: this.options.excludeBrowserFlags,
|
|
130308
|
-
profile: this.options.profile,
|
|
130309
|
-
preferences: this.options.preferences,
|
|
130310
|
-
startingUrl: this.options.startingUrl,
|
|
130311
|
-
chromiumBinary: this.options.chromiumBinary,
|
|
130312
|
-
source: this.options.source,
|
|
130313
|
-
watchSource: this.options.watchSource,
|
|
130314
|
-
dryRun: this.options.dryRun,
|
|
130315
130033
|
browserVersionLine
|
|
130316
130034
|
};
|
|
130317
130035
|
if (enableCdp) {
|
|
@@ -130387,7 +130105,8 @@ var __webpack_modules__ = {
|
|
|
130387
130105
|
"./webpack/plugin-browsers/run-chromium/manifest-readiness.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
130388
130106
|
"use strict";
|
|
130389
130107
|
__webpack_require__.d(__webpack_exports__, {
|
|
130390
|
-
|
|
130108
|
+
aI: ()=>waitForStableExtensionOutput,
|
|
130109
|
+
fR: ()=>waitForStableManifest
|
|
130391
130110
|
});
|
|
130392
130111
|
var fs__rspack_import_0 = __webpack_require__("fs");
|
|
130393
130112
|
var path__rspack_import_1 = __webpack_require__("path");
|
|
@@ -130412,6 +130131,15 @@ var __webpack_modules__ = {
|
|
|
130412
130131
|
if (/[*?[\]{}]/.test(normalized)) return;
|
|
130413
130132
|
return normalized;
|
|
130414
130133
|
}
|
|
130134
|
+
function readStableFileSignature(filePath) {
|
|
130135
|
+
try {
|
|
130136
|
+
const stats = fs__rspack_import_0.statSync(filePath);
|
|
130137
|
+
if (!stats.isFile()) return;
|
|
130138
|
+
return `${stats.size}:${stats.mtimeMs}`;
|
|
130139
|
+
} catch {
|
|
130140
|
+
return;
|
|
130141
|
+
}
|
|
130142
|
+
}
|
|
130415
130143
|
function getManifestRequiredFiles(content) {
|
|
130416
130144
|
try {
|
|
130417
130145
|
const manifest = JSON.parse(content);
|
|
@@ -130465,6 +130193,52 @@ var __webpack_modules__ = {
|
|
|
130465
130193
|
}
|
|
130466
130194
|
return false;
|
|
130467
130195
|
}
|
|
130196
|
+
async function waitForStableFiles(outPath, relativeFiles, options) {
|
|
130197
|
+
const files = Array.from(new Set(relativeFiles.map(normalizeManifestFile).filter(Boolean)));
|
|
130198
|
+
if (0 === files.length) return true;
|
|
130199
|
+
const timeoutMs = options?.timeoutMs ?? 8000;
|
|
130200
|
+
const pollIntervalMs = options?.pollIntervalMs ?? 150;
|
|
130201
|
+
const stableReadsRequired = options?.stableReadsRequired ?? 2;
|
|
130202
|
+
const start = Date.now();
|
|
130203
|
+
let lastSignature = '';
|
|
130204
|
+
let stableReads = 0;
|
|
130205
|
+
while(Date.now() - start < timeoutMs){
|
|
130206
|
+
const currentSignatureParts = [];
|
|
130207
|
+
let allFilesReady = true;
|
|
130208
|
+
for (const relativeFile of files){
|
|
130209
|
+
const absoluteFilePath = path__rspack_import_1.join(outPath, relativeFile);
|
|
130210
|
+
const fileSignature = readStableFileSignature(absoluteFilePath);
|
|
130211
|
+
if (!fileSignature) {
|
|
130212
|
+
allFilesReady = false;
|
|
130213
|
+
break;
|
|
130214
|
+
}
|
|
130215
|
+
currentSignatureParts.push(`${relativeFile}:${fileSignature}`);
|
|
130216
|
+
}
|
|
130217
|
+
if (allFilesReady) {
|
|
130218
|
+
const currentSignature = currentSignatureParts.sort().join('|');
|
|
130219
|
+
if (currentSignature === lastSignature) stableReads += 1;
|
|
130220
|
+
else {
|
|
130221
|
+
lastSignature = currentSignature;
|
|
130222
|
+
stableReads = 1;
|
|
130223
|
+
}
|
|
130224
|
+
if (stableReads >= stableReadsRequired) return true;
|
|
130225
|
+
} else {
|
|
130226
|
+
lastSignature = '';
|
|
130227
|
+
stableReads = 0;
|
|
130228
|
+
}
|
|
130229
|
+
await sleep(pollIntervalMs);
|
|
130230
|
+
}
|
|
130231
|
+
return false;
|
|
130232
|
+
}
|
|
130233
|
+
async function waitForStableExtensionOutput(outPath, options) {
|
|
130234
|
+
const manifestPath = path__rspack_import_1.join(outPath, 'manifest.json');
|
|
130235
|
+
const manifestReady = await waitForStableManifest(outPath, options);
|
|
130236
|
+
if (!manifestReady) return false;
|
|
130237
|
+
const manifestContent = readValidManifest(manifestPath);
|
|
130238
|
+
if (!manifestContent) return false;
|
|
130239
|
+
const requiredFiles = getManifestRequiredFiles(manifestContent);
|
|
130240
|
+
return waitForStableFiles(outPath, requiredFiles, options);
|
|
130241
|
+
}
|
|
130468
130242
|
},
|
|
130469
130243
|
"./webpack/plugin-browsers/run-firefox/firefox-context/index.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
130470
130244
|
"use strict";
|
|
@@ -130531,6 +130305,7 @@ var __webpack_modules__ = {
|
|
|
130531
130305
|
var shared_utils = __webpack_require__("./webpack/plugin-browsers/browsers-lib/shared-utils.ts");
|
|
130532
130306
|
var instance_registry = __webpack_require__("./webpack/plugin-browsers/browsers-lib/instance-registry.ts");
|
|
130533
130307
|
var dev_server_messages = __webpack_require__("./webpack/dev-server/messages.ts");
|
|
130308
|
+
var runtime_options = __webpack_require__("./webpack/plugin-browsers/browsers-lib/runtime-options.ts");
|
|
130534
130309
|
var external_child_process_ = __webpack_require__("child_process");
|
|
130535
130310
|
function setupFirefoxProcessHandlers(browser, childRef, cleanupInstance) {
|
|
130536
130311
|
let isCleaningUp = false;
|
|
@@ -130589,6 +130364,8 @@ var __webpack_modules__ = {
|
|
|
130589
130364
|
process.exit(1);
|
|
130590
130365
|
});
|
|
130591
130366
|
}
|
|
130367
|
+
var external_path_ = __webpack_require__("path");
|
|
130368
|
+
var external_path_default = /*#__PURE__*/ __webpack_require__.n(external_path_);
|
|
130592
130369
|
var messaging_client = __webpack_require__("./webpack/plugin-browsers/run-firefox/firefox-source-inspection/remote-firefox/messaging-client.ts");
|
|
130593
130370
|
function requestErrorToMessage(error) {
|
|
130594
130371
|
if (error instanceof Error) return String(error);
|
|
@@ -130607,7 +130384,6 @@ var __webpack_modules__ = {
|
|
|
130607
130384
|
return code === codeWanted;
|
|
130608
130385
|
}
|
|
130609
130386
|
var firefox_utils = __webpack_require__("./webpack/plugin-browsers/run-firefox/firefox-source-inspection/remote-firefox/firefox-utils.ts");
|
|
130610
|
-
var external_path_ = __webpack_require__("path");
|
|
130611
130387
|
function resolveAddonDirectory(baseDir, inputPath) {
|
|
130612
130388
|
let candidate = inputPath.replace(/\"/g, '');
|
|
130613
130389
|
if (!external_path_.isAbsolute(candidate)) candidate = external_path_.resolve(baseDir, candidate);
|
|
@@ -130689,6 +130465,8 @@ var __webpack_modules__ = {
|
|
|
130689
130465
|
}
|
|
130690
130466
|
var logging = __webpack_require__("./webpack/plugin-browsers/run-firefox/firefox-source-inspection/remote-firefox/logging.ts");
|
|
130691
130467
|
var source_inspect = __webpack_require__("./webpack/plugin-browsers/run-firefox/firefox-source-inspection/remote-firefox/source-inspect.ts");
|
|
130468
|
+
var content_script_targets = __webpack_require__("./webpack/plugin-browsers/browsers-lib/content-script-targets.ts");
|
|
130469
|
+
var manifest_readiness = __webpack_require__("./webpack/plugin-browsers/run-chromium/manifest-readiness.ts");
|
|
130692
130470
|
function _define_property(obj, key, value) {
|
|
130693
130471
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
130694
130472
|
value: value,
|
|
@@ -130699,9 +130477,48 @@ var __webpack_modules__ = {
|
|
|
130699
130477
|
else obj[key] = value;
|
|
130700
130478
|
return obj;
|
|
130701
130479
|
}
|
|
130480
|
+
function emitFirefoxAgentDebugLog(payload) {
|
|
130481
|
+
const line = JSON.stringify({
|
|
130482
|
+
sessionId: 'a87efc',
|
|
130483
|
+
timestamp: Date.now(),
|
|
130484
|
+
...payload
|
|
130485
|
+
});
|
|
130486
|
+
fetch('http://127.0.0.1:7795/ingest/9eb8f923-a325-4455-a46c-a6e706558307', {
|
|
130487
|
+
method: 'POST',
|
|
130488
|
+
headers: {
|
|
130489
|
+
'Content-Type': 'application/json',
|
|
130490
|
+
'X-Debug-Session-Id': 'a87efc'
|
|
130491
|
+
},
|
|
130492
|
+
body: line
|
|
130493
|
+
}).catch(()=>{});
|
|
130494
|
+
try {
|
|
130495
|
+
let dir = external_path_default().resolve(process.cwd());
|
|
130496
|
+
for(let depth = 0; depth < 24; depth++){
|
|
130497
|
+
if ((0, external_fs_.existsSync)(external_path_default().join(dir, 'programs', 'develop', 'package.json'))) {
|
|
130498
|
+
const filePath = external_path_default().join(dir, '.cursor', 'debug-a87efc.log');
|
|
130499
|
+
(0, external_fs_.mkdirSync)(external_path_default().dirname(filePath), {
|
|
130500
|
+
recursive: true
|
|
130501
|
+
});
|
|
130502
|
+
(0, external_fs_.appendFileSync)(filePath, `${line}\n`);
|
|
130503
|
+
return;
|
|
130504
|
+
}
|
|
130505
|
+
const parent = external_path_default().dirname(dir);
|
|
130506
|
+
if (parent === dir) break;
|
|
130507
|
+
dir = parent;
|
|
130508
|
+
}
|
|
130509
|
+
} catch {}
|
|
130510
|
+
}
|
|
130702
130511
|
const MAX_RETRIES = 150;
|
|
130703
130512
|
const RETRY_INTERVAL = 1000;
|
|
130704
130513
|
class RemoteFirefox {
|
|
130514
|
+
selectPrimaryAddonPath(compilation, candidateAddonPaths) {
|
|
130515
|
+
const normalizedOutputPath = String(compilation?.options?.output?.path || '').replace(/\\/g, '/');
|
|
130516
|
+
if (normalizedOutputPath) {
|
|
130517
|
+
const matchingAddonPath = candidateAddonPaths.find((candidateAddonPath)=>String(candidateAddonPath || '').replace(/\\/g, '/') === normalizedOutputPath);
|
|
130518
|
+
if (matchingAddonPath) return matchingAddonPath;
|
|
130519
|
+
}
|
|
130520
|
+
return candidateAddonPaths[candidateAddonPaths.length - 1];
|
|
130521
|
+
}
|
|
130705
130522
|
resolveRdpPort(compilation) {
|
|
130706
130523
|
const instanceId = this.options?.instanceId;
|
|
130707
130524
|
const devPort = compilation?.options?.devServer?.port;
|
|
@@ -130736,9 +130553,7 @@ var __webpack_modules__ = {
|
|
|
130736
130553
|
}
|
|
130737
130554
|
async installAddons(compilation) {
|
|
130738
130555
|
const { devtools } = this.options;
|
|
130739
|
-
const rawExtensions = (
|
|
130740
|
-
this.options.extension
|
|
130741
|
-
]);
|
|
130556
|
+
const rawExtensions = (0, runtime_options.fT)(this.options.extension);
|
|
130742
130557
|
const unique = Array.from(new Set(rawExtensions.filter((p)=>'string' == typeof p && p.length > 0)));
|
|
130743
130558
|
const userFirst = unique.sort((a, b)=>{
|
|
130744
130559
|
const isAManager = /extensions\/[a-z-]+-manager/.test(a);
|
|
@@ -130753,31 +130568,71 @@ var __webpack_modules__ = {
|
|
|
130753
130568
|
let addonsActor = await getAddonsActorWithRetry(client, this.cachedAddonsActor);
|
|
130754
130569
|
if (addonsActor) this.cachedAddonsActor = addonsActor;
|
|
130755
130570
|
const candidateAddonPaths = computeCandidateAddonPaths(compilation, extensionsToLoad);
|
|
130571
|
+
const primaryAddonPath = this.selectPrimaryAddonPath(compilation, candidateAddonPaths);
|
|
130572
|
+
try {
|
|
130573
|
+
const outPath = String(compilation?.options?.output?.path || '').replace(/\\/g, '/');
|
|
130574
|
+
emitFirefoxAgentDebugLog({
|
|
130575
|
+
runId: process.env.EXTENSION_INSTANCE_ID || 'firefox-install',
|
|
130576
|
+
hypothesisId: 'H-COMP-3',
|
|
130577
|
+
location: 'remote-firefox/index.ts:installAddons:paths',
|
|
130578
|
+
message: 'Firefox candidate add-on paths and primary selection',
|
|
130579
|
+
data: {
|
|
130580
|
+
normalizedOutputPath: outPath,
|
|
130581
|
+
primaryAddonPath: primaryAddonPath ? String(primaryAddonPath).replace(/\\/g, '/') : null,
|
|
130582
|
+
candidateAddonPaths: candidateAddonPaths.map((p)=>String(p).replace(/\\/g, '/')),
|
|
130583
|
+
devtools: Boolean(devtools)
|
|
130584
|
+
}
|
|
130585
|
+
});
|
|
130586
|
+
} catch {}
|
|
130587
|
+
for (const addonPath of candidateAddonPaths)try {
|
|
130588
|
+
const ready = await (0, manifest_readiness.aI)(addonPath, {
|
|
130589
|
+
timeoutMs: 10000,
|
|
130590
|
+
pollIntervalMs: 150,
|
|
130591
|
+
stableReadsRequired: 2
|
|
130592
|
+
});
|
|
130593
|
+
if (!ready && 'true' === process.env.EXTENSION_AUTHOR_MODE) console.warn(`[plugin-browsers] Firefox add-on output did not fully settle before install: ${addonPath}`);
|
|
130594
|
+
} catch {}
|
|
130756
130595
|
if ('true' === process.env.EXTENSION_AUTHOR_MODE) try {
|
|
130757
130596
|
console.log('[plugin-browsers] Firefox add-on paths:', candidateAddonPaths);
|
|
130758
130597
|
} catch {}
|
|
130598
|
+
let primaryUserAddonId;
|
|
130759
130599
|
for (const [index, addonPath] of candidateAddonPaths.entries()){
|
|
130760
130600
|
const isManager = /extensions\/[a-z-]+-manager/.test(String(addonPath));
|
|
130761
130601
|
const isDevtoolsEnabled = 0 === index && Boolean(devtools);
|
|
130762
130602
|
try {
|
|
130763
130603
|
const installResponse = await installTemporaryAddon(client, String(addonsActor || ''), addonPath, isDevtoolsEnabled);
|
|
130764
|
-
|
|
130765
|
-
|
|
130766
|
-
|
|
130767
|
-
|
|
130604
|
+
const maybeIdRaw = installResponse?.addon?.id;
|
|
130605
|
+
const maybeId = 'string' == typeof maybeIdRaw && maybeIdRaw.length > 0 ? maybeIdRaw : null;
|
|
130606
|
+
if (primaryAddonPath && String(addonPath) === String(primaryAddonPath) && maybeId) primaryUserAddonId = maybeId;
|
|
130607
|
+
emitFirefoxAgentDebugLog({
|
|
130608
|
+
runId: process.env.EXTENSION_INSTANCE_ID || 'firefox-install',
|
|
130609
|
+
hypothesisId: 'H-COMP-1',
|
|
130610
|
+
location: 'remote-firefox/index.ts:installAddons:each',
|
|
130611
|
+
message: 'Firefox temporary add-on installed',
|
|
130612
|
+
data: {
|
|
130613
|
+
index,
|
|
130614
|
+
addonPath: String(addonPath).replace(/\\/g, '/'),
|
|
130615
|
+
isManager,
|
|
130616
|
+
isDevtoolsEnabled,
|
|
130617
|
+
addonId: maybeId,
|
|
130618
|
+
setDerivedExtensionIdFromThisInstall: Boolean(primaryAddonPath && String(addonPath) === String(primaryAddonPath) && maybeId),
|
|
130619
|
+
matchesPrimary: Boolean(primaryAddonPath) && String(addonPath) === String(primaryAddonPath)
|
|
130620
|
+
}
|
|
130621
|
+
});
|
|
130768
130622
|
if (isManager) await waitForManagerWelcome(client);
|
|
130769
130623
|
} catch (err) {
|
|
130770
130624
|
const message = requestErrorToMessage(err);
|
|
130771
130625
|
throw new Error(messages.WVu(this.options.browser, message));
|
|
130772
130626
|
}
|
|
130773
130627
|
}
|
|
130628
|
+
if (primaryUserAddonId) this.derivedExtensionId = primaryUserAddonId;
|
|
130774
130629
|
try {
|
|
130775
|
-
if (this.needsReinstall &&
|
|
130630
|
+
if (this.needsReinstall && primaryAddonPath) {
|
|
130776
130631
|
const toActor = addonsActor;
|
|
130777
130632
|
if (toActor) await client.request({
|
|
130778
130633
|
to: toActor,
|
|
130779
130634
|
type: 'installTemporaryAddon',
|
|
130780
|
-
addonPath:
|
|
130635
|
+
addonPath: primaryAddonPath,
|
|
130781
130636
|
openDevTools: false
|
|
130782
130637
|
});
|
|
130783
130638
|
this.needsReinstall = false;
|
|
@@ -130786,7 +130641,17 @@ var __webpack_modules__ = {
|
|
|
130786
130641
|
try {
|
|
130787
130642
|
if (!this.derivedExtensionId) this.derivedExtensionId = await deriveMozExtensionId(client);
|
|
130788
130643
|
} catch {}
|
|
130789
|
-
|
|
130644
|
+
emitFirefoxAgentDebugLog({
|
|
130645
|
+
runId: process.env.EXTENSION_INSTANCE_ID || 'firefox-install',
|
|
130646
|
+
hypothesisId: 'H-COMP-2',
|
|
130647
|
+
location: 'remote-firefox/index.ts:installAddons:derived-id',
|
|
130648
|
+
message: 'Firefox derivedExtensionId after installs + deriveMozExtensionId',
|
|
130649
|
+
data: {
|
|
130650
|
+
derivedExtensionId: this.derivedExtensionId || null,
|
|
130651
|
+
lastInstalledAddonPath: primaryAddonPath ? String(primaryAddonPath).replace(/\\/g, '/') : null
|
|
130652
|
+
}
|
|
130653
|
+
});
|
|
130654
|
+
this.lastInstalledAddonPath = primaryAddonPath;
|
|
130790
130655
|
const bannerPrinted = await (0, firefox_utils.Rv)(candidateAddonPaths, 'firefox', this.derivedExtensionId, this.options.browserVersionLine);
|
|
130791
130656
|
if (!bannerPrinted) throw new Error(messages.WVu(this.options.browser, 'Failed to print runningInDevelopment banner; add-on may not be installed.'));
|
|
130792
130657
|
}
|
|
@@ -130804,7 +130669,7 @@ var __webpack_modules__ = {
|
|
|
130804
130669
|
});
|
|
130805
130670
|
const types = Array.isArray(desc?.types) ? desc.types : [];
|
|
130806
130671
|
this.cachedSupportsReload = types.includes('reloadAddon') || types.includes('reloadTemporaryAddon');
|
|
130807
|
-
try {
|
|
130672
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) try {
|
|
130808
130673
|
console.log(messages.lID(this.cachedSupportsReload ? 'native' : 'reinstall'));
|
|
130809
130674
|
} catch {}
|
|
130810
130675
|
} catch {
|
|
@@ -130845,7 +130710,7 @@ var __webpack_modules__ = {
|
|
|
130845
130710
|
const normalized = (changedAssets || []).map((n)=>String(n || '')).map((n)=>n.replace(/\\/g, '/'));
|
|
130846
130711
|
const isManifestChanged = normalized.includes('manifest.json');
|
|
130847
130712
|
const isLocalesChanged = normalized.some((n)=>/(^|\/)__?locales\/.+\.json$/i.test(n));
|
|
130848
|
-
const isContentScriptChanged = normalized.some((n)=>/(^|\/)content_scripts\/content-\d
|
|
130713
|
+
const isContentScriptChanged = normalized.some((n)=>/(^|\/)content_scripts\/content-\d+(?:\.[a-f0-9]+)?\.(js|css)$/i.test(n));
|
|
130849
130714
|
let isServiceWorkerChanged = false;
|
|
130850
130715
|
try {
|
|
130851
130716
|
const manifestAsset = compilation.getAsset?.('manifest.json');
|
|
@@ -130864,6 +130729,48 @@ var __webpack_modules__ = {
|
|
|
130864
130729
|
await this.reloadAddonOrReinstall(client);
|
|
130865
130730
|
} catch {}
|
|
130866
130731
|
}
|
|
130732
|
+
async reloadMatchingTabsForContentScripts(rules) {
|
|
130733
|
+
if (0 === rules.length) return 0;
|
|
130734
|
+
try {
|
|
130735
|
+
const rdpPort = this.resolveRdpPort();
|
|
130736
|
+
const client = this.client || await this.connectClient(rdpPort);
|
|
130737
|
+
await this.reloadAddonOrReinstall(client);
|
|
130738
|
+
await new Promise((resolve)=>setTimeout(resolve, 300));
|
|
130739
|
+
const tabs = await client.getTargets();
|
|
130740
|
+
let reloadedTabs = 0;
|
|
130741
|
+
for (const tab of tabs || []){
|
|
130742
|
+
const descriptorActor = String(tab?.actor || '');
|
|
130743
|
+
const descriptorConsoleActor = String(tab?.consoleActor || tab?.webConsoleActor || '');
|
|
130744
|
+
const url = String(tab?.url || '');
|
|
130745
|
+
if (!descriptorActor || !url) continue;
|
|
130746
|
+
if (!(0, content_script_targets.lM)(url, rules)) continue;
|
|
130747
|
+
let targetActor = descriptorActor;
|
|
130748
|
+
let consoleActor = descriptorConsoleActor;
|
|
130749
|
+
try {
|
|
130750
|
+
const detail = await client.getTargetFromDescriptor(descriptorActor);
|
|
130751
|
+
if (detail.targetActor) targetActor = detail.targetActor;
|
|
130752
|
+
if (detail.consoleActor) consoleActor = detail.consoleActor;
|
|
130753
|
+
} catch {}
|
|
130754
|
+
try {
|
|
130755
|
+
try {
|
|
130756
|
+
await client.attach(targetActor);
|
|
130757
|
+
} catch {}
|
|
130758
|
+
await client.navigate(targetActor, url);
|
|
130759
|
+
await client.waitForLoadEvent(targetActor);
|
|
130760
|
+
reloadedTabs += 1;
|
|
130761
|
+
} catch {
|
|
130762
|
+
if (!consoleActor) continue;
|
|
130763
|
+
try {
|
|
130764
|
+
await client.navigateViaScript(consoleActor, url);
|
|
130765
|
+
reloadedTabs += 1;
|
|
130766
|
+
} catch {}
|
|
130767
|
+
}
|
|
130768
|
+
}
|
|
130769
|
+
return reloadedTabs;
|
|
130770
|
+
} catch {
|
|
130771
|
+
return 0;
|
|
130772
|
+
}
|
|
130773
|
+
}
|
|
130867
130774
|
async inspectSource(compilation, opts) {
|
|
130868
130775
|
try {
|
|
130869
130776
|
const rdpPort = this.resolveRdpPort(compilation);
|
|
@@ -130939,6 +130846,9 @@ var __webpack_modules__ = {
|
|
|
130939
130846
|
if ('function' == typeof rf.hardReloadIfNeeded) await rf.hardReloadIfNeeded(compilation, changedAssets);
|
|
130940
130847
|
else await this.remote.installAddons(compilation);
|
|
130941
130848
|
}
|
|
130849
|
+
async reloadMatchingTabsForContentScripts(rules) {
|
|
130850
|
+
return this.remote.reloadMatchingTabsForContentScripts(rules);
|
|
130851
|
+
}
|
|
130942
130852
|
async enableUnifiedLogging(opts) {
|
|
130943
130853
|
await this.remote.enableUnifiedLogging(opts);
|
|
130944
130854
|
}
|
|
@@ -130947,7 +130857,6 @@ var __webpack_modules__ = {
|
|
|
130947
130857
|
rdp_extension_controller_define_property(this, "debugPort", void 0);
|
|
130948
130858
|
this.remote = new RemoteFirefox({
|
|
130949
130859
|
extension: plugin.extension,
|
|
130950
|
-
extensionsToLoad: plugin.extensionsToLoad,
|
|
130951
130860
|
browser: plugin.browser,
|
|
130952
130861
|
browserFlags: plugin.browserFlags,
|
|
130953
130862
|
profile: plugin.profile,
|
|
@@ -131075,7 +130984,7 @@ var __webpack_modules__ = {
|
|
|
131075
130984
|
const excludeFlags = configOptions.excludeBrowserFlags || [];
|
|
131076
130985
|
const filteredFlags = (browserFlags || []).filter((flag)=>excludeFlags.every((ex)=>!String(flag).startsWith(ex)));
|
|
131077
130986
|
if (filteredFlags.length > 0) binaryArgs.push(...filteredFlags);
|
|
131078
|
-
if (configOptions.startingUrl && !configOptions.noOpen) binaryArgs.push(String(configOptions.startingUrl));
|
|
130987
|
+
if (configOptions.startingUrl && !configOptions.noOpen) binaryArgs.push('--url', String(configOptions.startingUrl));
|
|
131079
130988
|
const outPath = compilation.options.output?.path || external_path_.resolve(process.cwd(), 'dist/firefox');
|
|
131080
130989
|
const distRoot = external_path_.dirname(outPath);
|
|
131081
130990
|
const useSystemProfile = 'true' === String(process.env.EXTENSION_USE_SYSTEM_PROFILE || process.env.EXTJS_USE_SYSTEM_PROFILE || '').toLowerCase().trim();
|
|
@@ -131297,15 +131206,7 @@ var __webpack_modules__ = {
|
|
|
131297
131206
|
return;
|
|
131298
131207
|
}
|
|
131299
131208
|
if (this.ctx.didLaunch) return void done();
|
|
131300
|
-
await this.launch(stats.compilation,
|
|
131301
|
-
browser: this.host.browser,
|
|
131302
|
-
browserFlags: this.host.browserFlags,
|
|
131303
|
-
profile: this.host.profile,
|
|
131304
|
-
preferences: this.host.preferences,
|
|
131305
|
-
startingUrl: this.host.startingUrl,
|
|
131306
|
-
mode: stats.compilation.options.mode,
|
|
131307
|
-
port: this.host.port
|
|
131308
|
-
});
|
|
131209
|
+
await this.launch(stats.compilation, (0, runtime_options.zU)(this.host, stats.compilation.options.mode));
|
|
131309
131210
|
this.ctx.logger?.info?.(messages.ACl(this.host.browser, stats.compilation.options.mode));
|
|
131310
131211
|
this.ctx.logger?.info?.(dev_server_messages.Gc(stats.compilation.options.mode, this.host.browser));
|
|
131311
131212
|
this.ctx.didLaunch = true;
|
|
@@ -131321,21 +131222,40 @@ var __webpack_modules__ = {
|
|
|
131321
131222
|
const compilationErrors = compilation?.errors || [];
|
|
131322
131223
|
if (compilationErrors.length > 0) return void this.ctx.logger?.info?.(messages.y7j());
|
|
131323
131224
|
if ('true' === process.env.EXTENSION_AUTHOR_MODE) this.ctx.logger?.info?.(messages.A9Y());
|
|
131225
|
+
const normalizePath = (value)=>{
|
|
131226
|
+
const normalized = value ? normalizeBinaryPathForWsl(value) : null;
|
|
131227
|
+
return normalized && external_fs_.existsSync(normalized) ? normalized : null;
|
|
131228
|
+
};
|
|
131229
|
+
const resolveManagedBinary = ()=>normalizePath((0, output_binaries_resolver.kI)(compilation, 'firefox') || null);
|
|
131230
|
+
const resolveWslFallback = ()=>resolveWslWindowsBinary();
|
|
131231
|
+
const getInstallGuidanceText = ()=>{
|
|
131232
|
+
try {
|
|
131233
|
+
return (0, external_firefox_location2_.getInstallGuidance)();
|
|
131234
|
+
} catch {
|
|
131235
|
+
return 'npx extension install firefox';
|
|
131236
|
+
}
|
|
131237
|
+
};
|
|
131238
|
+
const exitForLaunchFailure = (message)=>{
|
|
131239
|
+
if (message) console.error(message);
|
|
131240
|
+
process.exit(1);
|
|
131241
|
+
};
|
|
131242
|
+
const getGeckoBinaryErrorMessage = ()=>this.host.geckoBinary ? messages.DhR(this.host.geckoBinary) : messages.jk4();
|
|
131243
|
+
const failGeckoBinaryRequirement = ()=>exitForLaunchFailure(getGeckoBinaryErrorMessage());
|
|
131244
|
+
const throwOrExitNotInstalled = ()=>{
|
|
131245
|
+
if (process.env.VITEST || process.env.VITEST_WORKER_ID) throw new Error('Firefox not installed or binary path not found');
|
|
131246
|
+
process.exit(1);
|
|
131247
|
+
};
|
|
131324
131248
|
if (this.host.dryRun || process.env.VITEST || process.env.VITEST_WORKER_ID) {
|
|
131325
131249
|
try {
|
|
131326
131250
|
logFirefoxDryRun('firefox-mock-binary', '--binary-args=""');
|
|
131327
131251
|
} catch {}
|
|
131328
131252
|
return;
|
|
131329
131253
|
}
|
|
131330
|
-
let browserBinaryLocation = (
|
|
131331
|
-
if (browserBinaryLocation) {
|
|
131332
|
-
const normalized = normalizeBinaryPathForWsl(browserBinaryLocation);
|
|
131333
|
-
browserBinaryLocation = normalized && external_fs_.existsSync(normalized) ? normalized : null;
|
|
131334
|
-
}
|
|
131254
|
+
let browserBinaryLocation = resolveManagedBinary();
|
|
131335
131255
|
let skipDetection = Boolean(browserBinaryLocation);
|
|
131336
131256
|
const engineBased = 'gecko-based' === this.host.browser || 'firefox-based' === this.host.browser;
|
|
131337
131257
|
if (!browserBinaryLocation && !engineBased && isWslEnv()) {
|
|
131338
|
-
const wslFallback =
|
|
131258
|
+
const wslFallback = resolveWslFallback();
|
|
131339
131259
|
if (wslFallback) {
|
|
131340
131260
|
browserBinaryLocation = wslFallback;
|
|
131341
131261
|
skipDetection = true;
|
|
@@ -131343,16 +131263,11 @@ var __webpack_modules__ = {
|
|
|
131343
131263
|
}
|
|
131344
131264
|
try {
|
|
131345
131265
|
if (this.host.geckoBinary && 'string' == typeof this.host.geckoBinary) {
|
|
131346
|
-
const normalized =
|
|
131347
|
-
if (normalized
|
|
131348
|
-
else
|
|
131349
|
-
|
|
131350
|
-
|
|
131351
|
-
}
|
|
131352
|
-
} else if (!skipDetection) if (engineBased) {
|
|
131353
|
-
console.error(messages.jk4());
|
|
131354
|
-
process.exit(1);
|
|
131355
|
-
} else {
|
|
131266
|
+
const normalized = normalizePath(this.host.geckoBinary);
|
|
131267
|
+
if (normalized) browserBinaryLocation = normalized;
|
|
131268
|
+
else failGeckoBinaryRequirement();
|
|
131269
|
+
} else if (!skipDetection) if (engineBased) failGeckoBinaryRequirement();
|
|
131270
|
+
else {
|
|
131356
131271
|
const cacheRoot = (0, output_binaries_resolver.LB)(compilation);
|
|
131357
131272
|
const env = {
|
|
131358
131273
|
...process.env,
|
|
@@ -131361,39 +131276,27 @@ var __webpack_modules__ = {
|
|
|
131361
131276
|
const located = external_firefox_location2_default()(true, {
|
|
131362
131277
|
env
|
|
131363
131278
|
});
|
|
131364
|
-
const normalized =
|
|
131365
|
-
if (normalized
|
|
131279
|
+
const normalized = normalizePath(located);
|
|
131280
|
+
if (normalized) browserBinaryLocation = normalized;
|
|
131366
131281
|
}
|
|
131367
131282
|
} catch (_error) {
|
|
131368
|
-
|
|
131369
|
-
process.exit(1);
|
|
131283
|
+
failGeckoBinaryRequirement();
|
|
131370
131284
|
}
|
|
131371
131285
|
if (!browserBinaryLocation || !browserBinaryLocation.trim() || !external_fs_.existsSync(browserBinaryLocation)) {
|
|
131372
|
-
const
|
|
131373
|
-
|
|
131374
|
-
if (
|
|
131375
|
-
else
|
|
131376
|
-
|
|
131377
|
-
process.exit(1);
|
|
131378
|
-
} else {
|
|
131379
|
-
const wslFallback = resolveWslWindowsBinary();
|
|
131286
|
+
const normalizedFallback = resolveManagedBinary();
|
|
131287
|
+
if (normalizedFallback) browserBinaryLocation = normalizedFallback;
|
|
131288
|
+
else if (engineBased || this.host.geckoBinary) failGeckoBinaryRequirement();
|
|
131289
|
+
else {
|
|
131290
|
+
const wslFallback = resolveWslFallback();
|
|
131380
131291
|
if (wslFallback) browserBinaryLocation = wslFallback;
|
|
131381
131292
|
else {
|
|
131382
|
-
|
|
131383
|
-
|
|
131384
|
-
return (0, external_firefox_location2_.getInstallGuidance)();
|
|
131385
|
-
} catch {
|
|
131386
|
-
return 'npx extension install firefox';
|
|
131387
|
-
}
|
|
131388
|
-
})();
|
|
131389
|
-
this.printInstallHint(compilation, guidance);
|
|
131390
|
-
if (process.env.VITEST || process.env.VITEST_WORKER_ID) throw new Error('Firefox not installed or binary path not found');
|
|
131391
|
-
process.exit(1);
|
|
131293
|
+
this.printInstallHint(compilation, getInstallGuidanceText());
|
|
131294
|
+
throwOrExitNotInstalled();
|
|
131392
131295
|
}
|
|
131393
131296
|
}
|
|
131394
131297
|
}
|
|
131395
131298
|
const binaryPath = browserBinaryLocation;
|
|
131396
|
-
const wslFallbackBinary = isWslEnv() && !engineBased ?
|
|
131299
|
+
const wslFallbackBinary = isWslEnv() && !engineBased ? resolveWslFallback() : null;
|
|
131397
131300
|
try {
|
|
131398
131301
|
this.host.browserVersionLine = (0, external_firefox_location2_.getFirefoxVersion)(binaryPath, {
|
|
131399
131302
|
allowExec: true
|
|
@@ -131402,17 +131305,8 @@ var __webpack_modules__ = {
|
|
|
131402
131305
|
try {
|
|
131403
131306
|
await FirefoxBinaryDetector.validateFirefoxBinary(binaryPath);
|
|
131404
131307
|
} catch {}
|
|
131405
|
-
const extensionsToLoad =
|
|
131406
|
-
|
|
131407
|
-
] : [
|
|
131408
|
-
this.host.extension
|
|
131409
|
-
];
|
|
131410
|
-
try {
|
|
131411
|
-
const last = [
|
|
131412
|
-
...extensionsToLoad
|
|
131413
|
-
].reverse().find((e)=>'string' == typeof e);
|
|
131414
|
-
if (last && 'function' == typeof this.ctx.setExtensionRoot) this.ctx.setExtensionRoot(String(last));
|
|
131415
|
-
} catch {}
|
|
131308
|
+
const extensionsToLoad = (0, runtime_options.fT)(this.host.extension);
|
|
131309
|
+
(0, runtime_options.sl)(extensionsToLoad, 'function' == typeof this.ctx.setExtensionRoot ? this.ctx.setExtensionRoot : void 0);
|
|
131416
131310
|
const desiredDebugPort = (0, shared_utils.jl)(this.host.port, this.host.instanceId);
|
|
131417
131311
|
const debugPort = await (0, shared_utils.aY)(desiredDebugPort);
|
|
131418
131312
|
(0, instance_registry.UF)(this.host.instanceId, {
|
|
@@ -131438,32 +131332,9 @@ var __webpack_modules__ = {
|
|
|
131438
131332
|
if (profileMatch) {
|
|
131439
131333
|
const profilePath = profileMatch[1];
|
|
131440
131334
|
const { binary, args } = FirefoxBinaryDetector.generateFirefoxArgs(binaryPath, profilePath, debugPort, firefoxArgs);
|
|
131441
|
-
|
|
131442
|
-
|
|
131443
|
-
|
|
131444
|
-
'pipe',
|
|
131445
|
-
'pipe'
|
|
131446
|
-
] : [
|
|
131447
|
-
'ignore',
|
|
131448
|
-
'ignore',
|
|
131449
|
-
'ignore'
|
|
131450
|
-
] : [
|
|
131451
|
-
'pipe',
|
|
131452
|
-
'pipe',
|
|
131453
|
-
'pipe'
|
|
131454
|
-
];
|
|
131455
|
-
this.child = await spawnFirefoxProcess({
|
|
131456
|
-
binary,
|
|
131457
|
-
args,
|
|
131458
|
-
stdio,
|
|
131459
|
-
fallbackBinary: wslFallbackBinary,
|
|
131460
|
-
logger: this.ctx.logger
|
|
131461
|
-
});
|
|
131462
|
-
this.wireChildLifecycle(compilation, debugPort, desiredDebugPort);
|
|
131463
|
-
const ctrl = await setupRdpAfterLaunch({
|
|
131464
|
-
...this.host,
|
|
131465
|
-
extensionsToLoad
|
|
131466
|
-
}, compilation, debugPort);
|
|
131335
|
+
this.child = await this.spawnFirefoxChild(binary, args, wslFallbackBinary);
|
|
131336
|
+
this.wireChildLifecycle();
|
|
131337
|
+
const ctrl = await setupRdpAfterLaunch(this.host, compilation, debugPort);
|
|
131467
131338
|
this.host.rdpController = ctrl;
|
|
131468
131339
|
this.ctx.setController(ctrl, debugPort);
|
|
131469
131340
|
this.scheduleWatchTimeout();
|
|
@@ -131489,32 +131360,42 @@ var __webpack_modules__ = {
|
|
|
131489
131360
|
'--disable-renderer-backgrounding',
|
|
131490
131361
|
...firefoxArgs
|
|
131491
131362
|
];
|
|
131492
|
-
|
|
131493
|
-
|
|
131494
|
-
'pipe',
|
|
131495
|
-
'pipe',
|
|
131496
|
-
'pipe'
|
|
131497
|
-
] : [
|
|
131498
|
-
'ignore',
|
|
131499
|
-
'ignore',
|
|
131500
|
-
'ignore'
|
|
131501
|
-
] : [
|
|
131502
|
-
'pipe',
|
|
131503
|
-
'pipe',
|
|
131504
|
-
'pipe'
|
|
131505
|
-
];
|
|
131506
|
-
this.child = await spawnFirefoxProcess({
|
|
131507
|
-
binary: binaryPath,
|
|
131508
|
-
args,
|
|
131509
|
-
stdio,
|
|
131510
|
-
fallbackBinary: wslFallbackBinary,
|
|
131511
|
-
logger: this.ctx.logger
|
|
131512
|
-
});
|
|
131513
|
-
this.wireChildLifecycle(compilation, debugPort, desiredDebugPort);
|
|
131363
|
+
this.child = await this.spawnFirefoxChild(binaryPath, args, wslFallbackBinary);
|
|
131364
|
+
this.wireChildLifecycle();
|
|
131514
131365
|
this.scheduleWatchTimeout();
|
|
131515
131366
|
}
|
|
131516
131367
|
}
|
|
131517
|
-
|
|
131368
|
+
resolveSpawnStdio() {
|
|
131369
|
+
if ('win32' !== process.platform) return [
|
|
131370
|
+
'pipe',
|
|
131371
|
+
'pipe',
|
|
131372
|
+
'pipe'
|
|
131373
|
+
];
|
|
131374
|
+
return 'true' === process.env.EXTENSION_AUTHOR_MODE ? [
|
|
131375
|
+
'pipe',
|
|
131376
|
+
'pipe',
|
|
131377
|
+
'pipe'
|
|
131378
|
+
] : [
|
|
131379
|
+
'ignore',
|
|
131380
|
+
'ignore',
|
|
131381
|
+
'ignore'
|
|
131382
|
+
];
|
|
131383
|
+
}
|
|
131384
|
+
async spawnFirefoxChild(binary, args, fallbackBinary) {
|
|
131385
|
+
return await spawnFirefoxProcess({
|
|
131386
|
+
binary,
|
|
131387
|
+
args,
|
|
131388
|
+
stdio: this.resolveSpawnStdio(),
|
|
131389
|
+
fallbackBinary,
|
|
131390
|
+
logger: this.ctx.logger
|
|
131391
|
+
});
|
|
131392
|
+
}
|
|
131393
|
+
pipeChildOutput(child) {
|
|
131394
|
+
if ('true' !== process.env.EXTENSION_AUTHOR_MODE) return;
|
|
131395
|
+
child.stdout?.pipe(process.stdout);
|
|
131396
|
+
child.stderr?.pipe(process.stderr);
|
|
131397
|
+
}
|
|
131398
|
+
wireChildLifecycle() {
|
|
131518
131399
|
const child = this.child;
|
|
131519
131400
|
if (!child) return;
|
|
131520
131401
|
child.on('error', (error)=>{
|
|
@@ -131530,10 +131411,7 @@ var __webpack_modules__ = {
|
|
|
131530
131411
|
if ('true' === process.env.EXTENSION_AUTHOR_MODE) this.ctx.logger?.info?.(messages.Tho(this.host.browser));
|
|
131531
131412
|
this.cleanupInstance().catch(()=>{});
|
|
131532
131413
|
});
|
|
131533
|
-
|
|
131534
|
-
child.stdout?.pipe(process.stdout);
|
|
131535
|
-
child.stderr?.pipe(process.stderr);
|
|
131536
|
-
}
|
|
131414
|
+
this.pipeChildOutput(child);
|
|
131537
131415
|
setupFirefoxProcessHandlers(this.host.browser, ()=>this.child, ()=>this.cleanupInstance());
|
|
131538
131416
|
}
|
|
131539
131417
|
async cleanupInstance() {
|
|
@@ -131585,6 +131463,277 @@ var __webpack_modules__ = {
|
|
|
131585
131463
|
}
|
|
131586
131464
|
}
|
|
131587
131465
|
},
|
|
131466
|
+
"./webpack/plugin-browsers/run-firefox/firefox-source-inspection/remote-firefox/evaluate.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
131467
|
+
"use strict";
|
|
131468
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
131469
|
+
QX: ()=>mergeShadowIntoMain,
|
|
131470
|
+
XT: ()=>resolveActorForEvaluation,
|
|
131471
|
+
_3: ()=>evaluate,
|
|
131472
|
+
_e: ()=>evaluateRaw,
|
|
131473
|
+
jU: ()=>extractShadowContent,
|
|
131474
|
+
vA: ()=>coerceResponseToString,
|
|
131475
|
+
wt: ()=>serializeDocument
|
|
131476
|
+
});
|
|
131477
|
+
__webpack_require__("./webpack/plugin-browsers/browsers-lib/messages.ts");
|
|
131478
|
+
const EVALUATION_TIMEOUT_MS = 8000;
|
|
131479
|
+
const EVALUATION_TYPES = [
|
|
131480
|
+
'evaluateJSAsync',
|
|
131481
|
+
'evalWithOptions',
|
|
131482
|
+
'evaluateJS',
|
|
131483
|
+
'eval'
|
|
131484
|
+
];
|
|
131485
|
+
function buildEvaluationPayload(tabId, expression, type) {
|
|
131486
|
+
const payload = {
|
|
131487
|
+
to: tabId,
|
|
131488
|
+
type,
|
|
131489
|
+
text: expression
|
|
131490
|
+
};
|
|
131491
|
+
if ('evalWithOptions' === type) payload.options = {
|
|
131492
|
+
url: '',
|
|
131493
|
+
selectedNodeActor: void 0,
|
|
131494
|
+
frameActor: void 0
|
|
131495
|
+
};
|
|
131496
|
+
return payload;
|
|
131497
|
+
}
|
|
131498
|
+
function getMessageUnsubscriber(client, listener) {
|
|
131499
|
+
if ('function' != typeof client.on) return;
|
|
131500
|
+
client.on('message', listener);
|
|
131501
|
+
return ()=>{
|
|
131502
|
+
if ('function' == typeof client.off) return void client.off('message', listener);
|
|
131503
|
+
if ('function' == typeof client.removeListener) client.removeListener('message', listener);
|
|
131504
|
+
};
|
|
131505
|
+
}
|
|
131506
|
+
async function requestEvaluation(client, tabId, expression, type) {
|
|
131507
|
+
if ('evaluateJSAsync' !== type) return await client.request(buildEvaluationPayload(tabId, expression, type));
|
|
131508
|
+
let expectedResultId = '';
|
|
131509
|
+
let cleanup = ()=>{};
|
|
131510
|
+
let pendingMessage;
|
|
131511
|
+
const asyncResult = new Promise((resolve)=>{
|
|
131512
|
+
const unsubscribe = getMessageUnsubscriber(client, onMessage);
|
|
131513
|
+
if (!unsubscribe) return void resolve({
|
|
131514
|
+
ok: false,
|
|
131515
|
+
error: new Error('RDP client does not support async evaluation events')
|
|
131516
|
+
});
|
|
131517
|
+
const timeout = setTimeout(()=>{
|
|
131518
|
+
unsubscribe();
|
|
131519
|
+
resolve({
|
|
131520
|
+
ok: false,
|
|
131521
|
+
error: new Error('Timed out waiting for Firefox async evaluation result')
|
|
131522
|
+
});
|
|
131523
|
+
}, EVALUATION_TIMEOUT_MS);
|
|
131524
|
+
cleanup = ()=>{
|
|
131525
|
+
clearTimeout(timeout);
|
|
131526
|
+
unsubscribe();
|
|
131527
|
+
};
|
|
131528
|
+
function onMessage(message) {
|
|
131529
|
+
const payload = message || {};
|
|
131530
|
+
if ('evaluationResult' !== payload.type) return;
|
|
131531
|
+
if (!expectedResultId) {
|
|
131532
|
+
pendingMessage = payload;
|
|
131533
|
+
return;
|
|
131534
|
+
}
|
|
131535
|
+
if (String(payload.resultID || '') !== expectedResultId) return;
|
|
131536
|
+
cleanup();
|
|
131537
|
+
payload.error ? resolve({
|
|
131538
|
+
ok: false,
|
|
131539
|
+
error: payload
|
|
131540
|
+
}) : resolve({
|
|
131541
|
+
ok: true,
|
|
131542
|
+
value: message
|
|
131543
|
+
});
|
|
131544
|
+
}
|
|
131545
|
+
});
|
|
131546
|
+
try {
|
|
131547
|
+
const response = await client.request(buildEvaluationPayload(tabId, expression, type));
|
|
131548
|
+
if (response?.type === 'evaluationResult') {
|
|
131549
|
+
cleanup();
|
|
131550
|
+
return response;
|
|
131551
|
+
}
|
|
131552
|
+
expectedResultId = String(response?.resultID || '');
|
|
131553
|
+
if (!expectedResultId) {
|
|
131554
|
+
cleanup();
|
|
131555
|
+
return response;
|
|
131556
|
+
}
|
|
131557
|
+
if (pendingMessage && String(pendingMessage.resultID || '') === expectedResultId) {
|
|
131558
|
+
cleanup();
|
|
131559
|
+
return pendingMessage;
|
|
131560
|
+
}
|
|
131561
|
+
const outcome = await asyncResult;
|
|
131562
|
+
if (!outcome.ok) throw outcome.error;
|
|
131563
|
+
return outcome.value;
|
|
131564
|
+
} catch (error) {
|
|
131565
|
+
cleanup();
|
|
131566
|
+
throw error;
|
|
131567
|
+
}
|
|
131568
|
+
}
|
|
131569
|
+
async function evaluate(client, tabId, expression) {
|
|
131570
|
+
let lastError = null;
|
|
131571
|
+
for (const type of EVALUATION_TYPES)try {
|
|
131572
|
+
const response = await requestEvaluation(client, tabId, expression, type);
|
|
131573
|
+
const r = response ?? {};
|
|
131574
|
+
if (void 0 !== r.result) return r.result;
|
|
131575
|
+
if (void 0 !== r.value) return r.value;
|
|
131576
|
+
return r;
|
|
131577
|
+
} catch (err) {
|
|
131578
|
+
lastError = err;
|
|
131579
|
+
}
|
|
131580
|
+
throw lastError || new Error('Failed to evaluate expression');
|
|
131581
|
+
}
|
|
131582
|
+
async function evaluateRaw(client, tabId, expression) {
|
|
131583
|
+
let lastError = null;
|
|
131584
|
+
for (const type of EVALUATION_TYPES)try {
|
|
131585
|
+
return await requestEvaluation(client, tabId, expression, type);
|
|
131586
|
+
} catch (err) {
|
|
131587
|
+
lastError = err;
|
|
131588
|
+
}
|
|
131589
|
+
throw lastError || new Error('Failed to evaluate expression (raw)');
|
|
131590
|
+
}
|
|
131591
|
+
async function coerceResponseToString(client, tabId, response, opts = {
|
|
131592
|
+
fallbackToFullDocument: true
|
|
131593
|
+
}) {
|
|
131594
|
+
const r = response ?? {};
|
|
131595
|
+
const value = r.result ?? r.value ?? r;
|
|
131596
|
+
if ('string' == typeof value) return value;
|
|
131597
|
+
if (value && 'string' == typeof value.value) return value.value;
|
|
131598
|
+
if (value && 'string' == typeof value.text) return value.text;
|
|
131599
|
+
if (value && value.preview && 'string' == typeof value.preview.text) return value.preview.text;
|
|
131600
|
+
if (value && 'longString' === value.type) {
|
|
131601
|
+
const initial = value.initial || '';
|
|
131602
|
+
const length = 'number' == typeof value.length ? value.length : initial.length;
|
|
131603
|
+
const actor = value.actor;
|
|
131604
|
+
if (actor && 'number' == typeof length) try {
|
|
131605
|
+
const full = await client.request({
|
|
131606
|
+
to: actor,
|
|
131607
|
+
type: 'substring',
|
|
131608
|
+
start: 0,
|
|
131609
|
+
end: length
|
|
131610
|
+
});
|
|
131611
|
+
if (full && 'string' == typeof full.substring) return full.substring;
|
|
131612
|
+
} catch {}
|
|
131613
|
+
return String(initial);
|
|
131614
|
+
}
|
|
131615
|
+
if (opts.fallbackToFullDocument) try {
|
|
131616
|
+
const serialized = await evaluateRaw(client, tabId, 'new XMLSerializer().serializeToString(document)');
|
|
131617
|
+
const asString = await coerceResponseToString(client, tabId, serialized, {
|
|
131618
|
+
fallbackToFullDocument: false
|
|
131619
|
+
});
|
|
131620
|
+
if ('string' == typeof asString && asString.length > 0) return asString;
|
|
131621
|
+
} catch {}
|
|
131622
|
+
return String(value);
|
|
131623
|
+
}
|
|
131624
|
+
async function resolveActorForEvaluation(client, descriptorActor, consoleActorHint) {
|
|
131625
|
+
let actor = consoleActorHint || descriptorActor;
|
|
131626
|
+
try {
|
|
131627
|
+
const detail = await client.getTargetFromDescriptor?.(descriptorActor) || void 0;
|
|
131628
|
+
const best = detail?.webExtensionInspectedWindowActor || detail?.consoleActor;
|
|
131629
|
+
if (best) actor = best;
|
|
131630
|
+
} catch {}
|
|
131631
|
+
return actor;
|
|
131632
|
+
}
|
|
131633
|
+
async function serializeDocument(client, actorToUse) {
|
|
131634
|
+
try {
|
|
131635
|
+
const response = await evaluateRaw(client, actorToUse, '(()=>{try{return String(new XMLSerializer().serializeToString(document));}catch(e){return String(document.documentElement.outerHTML)}})()');
|
|
131636
|
+
return await coerceResponseToString(client, actorToUse, response);
|
|
131637
|
+
} catch {}
|
|
131638
|
+
try {
|
|
131639
|
+
const response = await evaluateRaw(client, actorToUse, '(()=>String(document.documentElement.outerHTML))()');
|
|
131640
|
+
return await coerceResponseToString(client, actorToUse, response, {
|
|
131641
|
+
fallbackToFullDocument: false
|
|
131642
|
+
});
|
|
131643
|
+
} catch {}
|
|
131644
|
+
return '';
|
|
131645
|
+
}
|
|
131646
|
+
async function extractShadowContent(client, actorToUse) {
|
|
131647
|
+
const expr = `(() => { try {
|
|
131648
|
+
const selector = '#extension-root,[data-extension-root]:not([data-extension-root="extension-js-devtools"])';
|
|
131649
|
+
const preferHost = function(root) {
|
|
131650
|
+
const nodes = Array.from(root.querySelectorAll(selector));
|
|
131651
|
+
return nodes.find(function(node) {
|
|
131652
|
+
try {
|
|
131653
|
+
const rootKind = String(node.getAttribute('data-extension-root') || '');
|
|
131654
|
+
return (
|
|
131655
|
+
String(node.id || '') === 'extension-root' ||
|
|
131656
|
+
rootKind === 'true' ||
|
|
131657
|
+
(rootKind.length > 0 && rootKind !== 'extension-js-devtools')
|
|
131658
|
+
);
|
|
131659
|
+
} catch (e) {
|
|
131660
|
+
return false;
|
|
131661
|
+
}
|
|
131662
|
+
}) || nodes[0] || null;
|
|
131663
|
+
};
|
|
131664
|
+
const host = preferHost(document);
|
|
131665
|
+
if (!host || !host.shadowRoot) return '';
|
|
131666
|
+
const shadowRoot = host.shadowRoot;
|
|
131667
|
+
const s = new XMLSerializer();
|
|
131668
|
+
const stylesheetCss = Array.from(shadowRoot.styleSheets || [])
|
|
131669
|
+
.map(function(sheet) {
|
|
131670
|
+
try {
|
|
131671
|
+
return Array.from(sheet.cssRules || []).map(function(rule) {
|
|
131672
|
+
return String(rule.cssText || '');
|
|
131673
|
+
}).join('\\n');
|
|
131674
|
+
} catch (e) {
|
|
131675
|
+
return '';
|
|
131676
|
+
}
|
|
131677
|
+
})
|
|
131678
|
+
.filter(Boolean)
|
|
131679
|
+
.join('\\n');
|
|
131680
|
+
const adoptedCss = Array.from(shadowRoot.adoptedStyleSheets || [])
|
|
131681
|
+
.map(function(sheet) {
|
|
131682
|
+
try {
|
|
131683
|
+
return Array.from(sheet.cssRules || []).map(function(rule) {
|
|
131684
|
+
return String(rule.cssText || '');
|
|
131685
|
+
}).join('\\n');
|
|
131686
|
+
} catch (e) {
|
|
131687
|
+
return '';
|
|
131688
|
+
}
|
|
131689
|
+
})
|
|
131690
|
+
.filter(Boolean)
|
|
131691
|
+
.join('\\n');
|
|
131692
|
+
const stylesheetMarkup = stylesheetCss ? '<style>' + stylesheetCss + '</style>' : '';
|
|
131693
|
+
const adoptedMarkup = adoptedCss ? '<style>' + adoptedCss + '</style>' : '';
|
|
131694
|
+
const childMarkup = Array.from(shadowRoot.childNodes).map(function(node) {
|
|
131695
|
+
try {
|
|
131696
|
+
if (node && node.nodeType === 1 && String(node.nodeName || '').toLowerCase() === 'style') {
|
|
131697
|
+
return '<style>' + String(node.textContent || '') + '</style>';
|
|
131698
|
+
}
|
|
131699
|
+
return s.serializeToString(node);
|
|
131700
|
+
} catch (e) {
|
|
131701
|
+
return '';
|
|
131702
|
+
}
|
|
131703
|
+
}).join('');
|
|
131704
|
+
return stylesheetMarkup + adoptedMarkup + childMarkup;
|
|
131705
|
+
} catch { return ''; } })()`;
|
|
131706
|
+
const looksIncomplete = (html)=>!html || html.length < 100 || !/content_script/.test(html);
|
|
131707
|
+
let attempts = 0;
|
|
131708
|
+
let html = '';
|
|
131709
|
+
while(attempts < 6){
|
|
131710
|
+
try {
|
|
131711
|
+
const response = await evaluateRaw(client, actorToUse, expr);
|
|
131712
|
+
html = await coerceResponseToString(client, actorToUse, response, {
|
|
131713
|
+
fallbackToFullDocument: false
|
|
131714
|
+
});
|
|
131715
|
+
if (!looksIncomplete(html)) break;
|
|
131716
|
+
} catch {}
|
|
131717
|
+
attempts += 1;
|
|
131718
|
+
await new Promise((r)=>setTimeout(r, 150));
|
|
131719
|
+
}
|
|
131720
|
+
if (html && /<html[\s>]/i.test(html)) html = '';
|
|
131721
|
+
return html;
|
|
131722
|
+
}
|
|
131723
|
+
function mergeShadowIntoMain(mainHTML, shadowContent) {
|
|
131724
|
+
if (!shadowContent) return mainHTML;
|
|
131725
|
+
let merged = mainHTML;
|
|
131726
|
+
try {
|
|
131727
|
+
const hasRoot = /<div id=(["'])extension-root\1/i.test(merged);
|
|
131728
|
+
if (hasRoot) {
|
|
131729
|
+
const replacedEmpty = merged.replace(/<div id=(["'])extension-root\1[^>]*><\/div>/i, `<div id="extension-root">${shadowContent}</div>`);
|
|
131730
|
+
if (replacedEmpty !== merged) return replacedEmpty;
|
|
131731
|
+
merged = merged.replace(/<div id=(["'])extension-root\1[^>]*>[\s\S]*?<\/div>/i, `<div id="extension-root">${shadowContent}</div>`);
|
|
131732
|
+
} else merged = /<\/body>/i.test(merged) ? merged.replace(/<\/body>/i, `<div id="extension-root">${shadowContent}</div></body>`) : `${merged}\n<div id=\"extension-root\">${shadowContent}</div>`;
|
|
131733
|
+
} catch {}
|
|
131734
|
+
return merged;
|
|
131735
|
+
}
|
|
131736
|
+
},
|
|
131588
131737
|
"./webpack/plugin-browsers/run-firefox/firefox-source-inspection/remote-firefox/firefox-utils.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
131589
131738
|
"use strict";
|
|
131590
131739
|
__webpack_require__.d(__webpack_exports__, {
|
|
@@ -131941,6 +132090,93 @@ var __webpack_modules__ = {
|
|
|
131941
132090
|
super(...args), _define_property(this, "conn", void 0), _define_property(this, "incoming", Buffer.alloc(0)), _define_property(this, "active", new Map()), _define_property(this, "pending", []);
|
|
131942
132091
|
}
|
|
131943
132092
|
}
|
|
132093
|
+
const ASYNC_EVALUATION_TIMEOUT_MS = 8000;
|
|
132094
|
+
const EVALUATION_TYPES = [
|
|
132095
|
+
'evaluateJSAsync',
|
|
132096
|
+
'evalWithOptions',
|
|
132097
|
+
'evaluateJS',
|
|
132098
|
+
'eval'
|
|
132099
|
+
];
|
|
132100
|
+
function buildEvaluationPayload(to, text, type) {
|
|
132101
|
+
const payload = {
|
|
132102
|
+
to,
|
|
132103
|
+
type,
|
|
132104
|
+
text
|
|
132105
|
+
};
|
|
132106
|
+
if ('evalWithOptions' === type) payload.options = {
|
|
132107
|
+
url: '',
|
|
132108
|
+
selectedNodeActor: void 0,
|
|
132109
|
+
frameActor: void 0
|
|
132110
|
+
};
|
|
132111
|
+
return payload;
|
|
132112
|
+
}
|
|
132113
|
+
async function requestEvaluationWithType(transport, payload) {
|
|
132114
|
+
if ('evaluateJSAsync' !== payload.type) return await transport.request(payload);
|
|
132115
|
+
let expectedResultId = '';
|
|
132116
|
+
let cleanup = ()=>{};
|
|
132117
|
+
let pendingMessage;
|
|
132118
|
+
const asyncResult = new Promise((resolve)=>{
|
|
132119
|
+
const listener = (message)=>{
|
|
132120
|
+
if ('evaluationResult' !== message.type) return;
|
|
132121
|
+
if (!expectedResultId) {
|
|
132122
|
+
pendingMessage = message;
|
|
132123
|
+
return;
|
|
132124
|
+
}
|
|
132125
|
+
if (String(message.resultID || '') !== expectedResultId) return;
|
|
132126
|
+
cleanup();
|
|
132127
|
+
message.error ? resolve({
|
|
132128
|
+
ok: false,
|
|
132129
|
+
error: message
|
|
132130
|
+
}) : resolve({
|
|
132131
|
+
ok: true,
|
|
132132
|
+
value: message
|
|
132133
|
+
});
|
|
132134
|
+
};
|
|
132135
|
+
const timeout = setTimeout(()=>{
|
|
132136
|
+
transport.removeListener('message', listener);
|
|
132137
|
+
resolve({
|
|
132138
|
+
ok: false,
|
|
132139
|
+
error: new Error('Timed out waiting for Firefox async evaluation result')
|
|
132140
|
+
});
|
|
132141
|
+
}, ASYNC_EVALUATION_TIMEOUT_MS);
|
|
132142
|
+
cleanup = ()=>{
|
|
132143
|
+
clearTimeout(timeout);
|
|
132144
|
+
transport.removeListener('message', listener);
|
|
132145
|
+
};
|
|
132146
|
+
transport.on('message', listener);
|
|
132147
|
+
});
|
|
132148
|
+
try {
|
|
132149
|
+
const response = await transport.request(payload);
|
|
132150
|
+
if (response?.type === 'evaluationResult') {
|
|
132151
|
+
cleanup();
|
|
132152
|
+
return response;
|
|
132153
|
+
}
|
|
132154
|
+
expectedResultId = String(response?.resultID || '');
|
|
132155
|
+
if (!expectedResultId) {
|
|
132156
|
+
cleanup();
|
|
132157
|
+
return response;
|
|
132158
|
+
}
|
|
132159
|
+
if (pendingMessage && String(pendingMessage.resultID || '') === expectedResultId) {
|
|
132160
|
+
cleanup();
|
|
132161
|
+
return pendingMessage;
|
|
132162
|
+
}
|
|
132163
|
+
const outcome = await asyncResult;
|
|
132164
|
+
if (!outcome.ok) throw outcome.error;
|
|
132165
|
+
return outcome.value;
|
|
132166
|
+
} catch (error) {
|
|
132167
|
+
cleanup();
|
|
132168
|
+
throw error;
|
|
132169
|
+
}
|
|
132170
|
+
}
|
|
132171
|
+
async function requestEvaluation(transport, to, text) {
|
|
132172
|
+
let lastError = null;
|
|
132173
|
+
for (const type of EVALUATION_TYPES)try {
|
|
132174
|
+
return await requestEvaluationWithType(transport, buildEvaluationPayload(to, text, type));
|
|
132175
|
+
} catch (error) {
|
|
132176
|
+
lastError = error;
|
|
132177
|
+
}
|
|
132178
|
+
throw lastError || new Error('Failed to evaluate Firefox RDP expression');
|
|
132179
|
+
}
|
|
131944
132180
|
async function listTabs(transport) {
|
|
131945
132181
|
const response = await transport.request({
|
|
131946
132182
|
to: 'root',
|
|
@@ -131975,22 +132211,16 @@ var __webpack_modules__ = {
|
|
|
131975
132211
|
});
|
|
131976
132212
|
}
|
|
131977
132213
|
async function navigateViaScript(transport, consoleActor, url) {
|
|
131978
|
-
await transport.
|
|
131979
|
-
to: consoleActor,
|
|
131980
|
-
type: 'evaluateJS',
|
|
131981
|
-
text: `window.location.assign(${JSON.stringify(url)})`
|
|
131982
|
-
});
|
|
132214
|
+
await requestEvaluation(transport, consoleActor, `(() => { window.location.assign(${JSON.stringify(url)}); return true; })()`);
|
|
131983
132215
|
}
|
|
131984
132216
|
async function waitForPageReady(transport, consoleActor, url, timeoutMs = 8000) {
|
|
131985
132217
|
const start = Date.now();
|
|
131986
132218
|
while(Date.now() - start < timeoutMs){
|
|
131987
132219
|
try {
|
|
131988
|
-
const response = await transport.
|
|
131989
|
-
|
|
131990
|
-
|
|
131991
|
-
|
|
131992
|
-
});
|
|
131993
|
-
const value = response?.result || {};
|
|
132220
|
+
const response = await requestEvaluation(transport, consoleActor, "JSON.stringify({href: String(location.href), ready: String(document.readyState)})");
|
|
132221
|
+
const raw = response?.result ?? response?.value ?? response;
|
|
132222
|
+
const serialized = 'string' == typeof raw ? raw : 'string' == typeof raw?.value ? raw.value : 'string' == typeof raw?.text ? raw.text : '';
|
|
132223
|
+
const value = serialized ? JSON.parse(serialized) : {};
|
|
131994
132224
|
if ('string' == typeof value?.href && value.href.startsWith(url) && ('interactive' === value.ready || 'complete' === value.ready)) return;
|
|
131995
132225
|
} catch {}
|
|
131996
132226
|
await new Promise((resolve)=>setTimeout(resolve, 200));
|
|
@@ -132012,159 +132242,7 @@ var __webpack_modules__ = {
|
|
|
132012
132242
|
}, 10000);
|
|
132013
132243
|
});
|
|
132014
132244
|
}
|
|
132015
|
-
|
|
132016
|
-
const tryTypes = [
|
|
132017
|
-
'evaluateJS',
|
|
132018
|
-
'evaluateJSAsync',
|
|
132019
|
-
'eval',
|
|
132020
|
-
'evalWithOptions'
|
|
132021
|
-
];
|
|
132022
|
-
let lastError = null;
|
|
132023
|
-
for (const type of tryTypes)try {
|
|
132024
|
-
const payload = {
|
|
132025
|
-
to: tabId,
|
|
132026
|
-
type,
|
|
132027
|
-
text: expression
|
|
132028
|
-
};
|
|
132029
|
-
if ('evalWithOptions' === type) payload.options = {
|
|
132030
|
-
url: '',
|
|
132031
|
-
selectedNodeActor: void 0,
|
|
132032
|
-
frameActor: void 0
|
|
132033
|
-
};
|
|
132034
|
-
const response = await client.request(payload);
|
|
132035
|
-
const r = response ?? {};
|
|
132036
|
-
if (void 0 !== r.result) return r.result;
|
|
132037
|
-
if (void 0 !== r.value) return r.value;
|
|
132038
|
-
return r;
|
|
132039
|
-
} catch (err) {
|
|
132040
|
-
lastError = err;
|
|
132041
|
-
}
|
|
132042
|
-
throw lastError || new Error('Failed to evaluate expression');
|
|
132043
|
-
}
|
|
132044
|
-
async function evaluateRaw(client, tabId, expression) {
|
|
132045
|
-
const tryTypes = [
|
|
132046
|
-
'evaluateJS',
|
|
132047
|
-
'evaluateJSAsync',
|
|
132048
|
-
'eval',
|
|
132049
|
-
'evalWithOptions'
|
|
132050
|
-
];
|
|
132051
|
-
let lastError = null;
|
|
132052
|
-
for (const type of tryTypes)try {
|
|
132053
|
-
const payload = {
|
|
132054
|
-
to: tabId,
|
|
132055
|
-
type,
|
|
132056
|
-
text: expression
|
|
132057
|
-
};
|
|
132058
|
-
if ('evalWithOptions' === type) payload.options = {
|
|
132059
|
-
url: '',
|
|
132060
|
-
selectedNodeActor: void 0,
|
|
132061
|
-
frameActor: void 0
|
|
132062
|
-
};
|
|
132063
|
-
return await client.request(payload);
|
|
132064
|
-
} catch (err) {
|
|
132065
|
-
lastError = err;
|
|
132066
|
-
}
|
|
132067
|
-
throw lastError || new Error('Failed to evaluate expression (raw)');
|
|
132068
|
-
}
|
|
132069
|
-
async function coerceResponseToString(client, tabId, response, opts = {
|
|
132070
|
-
fallbackToFullDocument: true
|
|
132071
|
-
}) {
|
|
132072
|
-
const r = response ?? {};
|
|
132073
|
-
const value = r.result ?? r.value ?? r;
|
|
132074
|
-
if ('string' == typeof value) return value;
|
|
132075
|
-
if (value && 'string' == typeof value.value) return value.value;
|
|
132076
|
-
if (value && 'string' == typeof value.text) return value.text;
|
|
132077
|
-
if (value && value.preview && 'string' == typeof value.preview.text) return value.preview.text;
|
|
132078
|
-
if (value && 'longString' === value.type) {
|
|
132079
|
-
const initial = value.initial || '';
|
|
132080
|
-
const length = 'number' == typeof value.length ? value.length : initial.length;
|
|
132081
|
-
const actor = value.actor;
|
|
132082
|
-
if (actor && 'number' == typeof length) try {
|
|
132083
|
-
const full = await client.request({
|
|
132084
|
-
to: actor,
|
|
132085
|
-
type: 'substring',
|
|
132086
|
-
start: 0,
|
|
132087
|
-
end: length
|
|
132088
|
-
});
|
|
132089
|
-
if (full && 'string' == typeof full.substring) return full.substring;
|
|
132090
|
-
} catch {}
|
|
132091
|
-
return String(initial);
|
|
132092
|
-
}
|
|
132093
|
-
if (opts.fallbackToFullDocument) try {
|
|
132094
|
-
const serialized = await evaluateRaw(client, tabId, 'new XMLSerializer().serializeToString(document)');
|
|
132095
|
-
const asString = await coerceResponseToString(client, tabId, serialized, {
|
|
132096
|
-
fallbackToFullDocument: false
|
|
132097
|
-
});
|
|
132098
|
-
if ('string' == typeof asString && asString.length > 0) return asString;
|
|
132099
|
-
} catch {}
|
|
132100
|
-
return String(value);
|
|
132101
|
-
}
|
|
132102
|
-
async function resolveActorForEvaluation(client, descriptorActor, consoleActorHint) {
|
|
132103
|
-
let actor = consoleActorHint || descriptorActor;
|
|
132104
|
-
try {
|
|
132105
|
-
const detail = await client.getTargetFromDescriptor?.(descriptorActor) || void 0;
|
|
132106
|
-
const best = detail?.webExtensionInspectedWindowActor || detail?.consoleActor;
|
|
132107
|
-
if (best) actor = best;
|
|
132108
|
-
} catch {}
|
|
132109
|
-
return actor;
|
|
132110
|
-
}
|
|
132111
|
-
async function serializeDocument(client, actorToUse) {
|
|
132112
|
-
try {
|
|
132113
|
-
const response = await client.request({
|
|
132114
|
-
to: actorToUse,
|
|
132115
|
-
type: 'evaluateJS',
|
|
132116
|
-
text: '(()=>{try{return String(new XMLSerializer().serializeToString(document));}catch(e){return String(document.documentElement.outerHTML)}})()'
|
|
132117
|
-
});
|
|
132118
|
-
return await coerceResponseToString(client, actorToUse, response);
|
|
132119
|
-
} catch {}
|
|
132120
|
-
try {
|
|
132121
|
-
const response = await client.request({
|
|
132122
|
-
to: actorToUse,
|
|
132123
|
-
type: 'evaluateJS',
|
|
132124
|
-
text: '(()=>String(document.documentElement.outerHTML))()'
|
|
132125
|
-
});
|
|
132126
|
-
return await coerceResponseToString(client, actorToUse, response, {
|
|
132127
|
-
fallbackToFullDocument: false
|
|
132128
|
-
});
|
|
132129
|
-
} catch {}
|
|
132130
|
-
return '';
|
|
132131
|
-
}
|
|
132132
|
-
async function extractShadowContent(client, actorToUse) {
|
|
132133
|
-
const expr = "(() => { try { const host = document.getElementById('extension-root'); if (!host || !host.shadowRoot) return ''; const s = new XMLSerializer(); return Array.from(host.shadowRoot.childNodes).map(n => { try { return s.serializeToString(n) } catch (e) { return '' } }).join(''); } catch { return ''; } })()";
|
|
132134
|
-
const looksIncomplete = (html)=>!html || html.length < 100 || !/content_script/.test(html);
|
|
132135
|
-
let attempts = 0;
|
|
132136
|
-
let html = '';
|
|
132137
|
-
while(attempts < 6){
|
|
132138
|
-
try {
|
|
132139
|
-
const response = await client.request({
|
|
132140
|
-
to: actorToUse,
|
|
132141
|
-
type: 'evaluateJS',
|
|
132142
|
-
text: expr
|
|
132143
|
-
});
|
|
132144
|
-
html = await coerceResponseToString(client, actorToUse, response, {
|
|
132145
|
-
fallbackToFullDocument: false
|
|
132146
|
-
});
|
|
132147
|
-
if (!looksIncomplete(html)) break;
|
|
132148
|
-
} catch {}
|
|
132149
|
-
attempts += 1;
|
|
132150
|
-
await new Promise((r)=>setTimeout(r, 150));
|
|
132151
|
-
}
|
|
132152
|
-
if (html && /<html[\s>]/i.test(html)) html = '';
|
|
132153
|
-
return html;
|
|
132154
|
-
}
|
|
132155
|
-
function mergeShadowIntoMain(mainHTML, shadowContent) {
|
|
132156
|
-
if (!shadowContent) return mainHTML;
|
|
132157
|
-
let merged = mainHTML;
|
|
132158
|
-
try {
|
|
132159
|
-
const hasRoot = /<div id=(["'])extension-root\1/i.test(merged);
|
|
132160
|
-
if (hasRoot) {
|
|
132161
|
-
const replacedEmpty = merged.replace(/<div id=(["'])extension-root\1[^>]*><\/div>/i, `<div id="extension-root">${shadowContent}</div>`);
|
|
132162
|
-
if (replacedEmpty !== merged) return replacedEmpty;
|
|
132163
|
-
merged = merged.replace(/<div id=(["'])extension-root\1[^>]*>[\s\S]*?<\/div>/i, `<div id="extension-root">${shadowContent}</div>`);
|
|
132164
|
-
} else merged = /<\/body>/i.test(merged) ? merged.replace(/<\/body>/i, `<div id="extension-root">${shadowContent}</div></body>`) : `${merged}\n<div id=\"extension-root\">${shadowContent}</div>`;
|
|
132165
|
-
} catch {}
|
|
132166
|
-
return merged;
|
|
132167
|
-
}
|
|
132245
|
+
var evaluate = __webpack_require__("./webpack/plugin-browsers/run-firefox/firefox-source-inspection/remote-firefox/evaluate.ts");
|
|
132168
132246
|
function messaging_client_define_property(obj, key, value) {
|
|
132169
132247
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
132170
132248
|
value: value,
|
|
@@ -132246,27 +132324,27 @@ var __webpack_modules__ = {
|
|
|
132246
132324
|
await waitForLoadEvent(this.transport, tabId);
|
|
132247
132325
|
}
|
|
132248
132326
|
async evaluate(tabId, expression) {
|
|
132249
|
-
return evaluate(this, tabId, expression);
|
|
132327
|
+
return (0, evaluate._3)(this, tabId, expression);
|
|
132250
132328
|
}
|
|
132251
132329
|
async evaluateRaw(tabId, expression) {
|
|
132252
|
-
return
|
|
132330
|
+
return (0, evaluate._e)(this, tabId, expression);
|
|
132253
132331
|
}
|
|
132254
132332
|
async coerceResponseToString(tabId, response, opts = {
|
|
132255
132333
|
fallbackToFullDocument: true
|
|
132256
132334
|
}) {
|
|
132257
|
-
return
|
|
132335
|
+
return (0, evaluate.vA)(this, tabId, response, opts);
|
|
132258
132336
|
}
|
|
132259
132337
|
async resolveActorForEvaluation(descriptorActor, consoleActorHint) {
|
|
132260
|
-
return
|
|
132338
|
+
return (0, evaluate.XT)(this, descriptorActor, consoleActorHint);
|
|
132261
132339
|
}
|
|
132262
132340
|
async serializeDocument(actorToUse) {
|
|
132263
|
-
return
|
|
132341
|
+
return (0, evaluate.wt)(this, actorToUse);
|
|
132264
132342
|
}
|
|
132265
132343
|
async extractShadowContent(actorToUse) {
|
|
132266
|
-
return
|
|
132344
|
+
return (0, evaluate.jU)(this, actorToUse);
|
|
132267
132345
|
}
|
|
132268
132346
|
mergeShadowIntoMain(mainHTML, shadowContent) {
|
|
132269
|
-
return
|
|
132347
|
+
return (0, evaluate.QX)(mainHTML, shadowContent);
|
|
132270
132348
|
}
|
|
132271
132349
|
async getPageHTML(descriptorActor, consoleActorHint) {
|
|
132272
132350
|
console.log(messages.XOv());
|
|
@@ -132289,7 +132367,7 @@ var __webpack_modules__ = {
|
|
|
132289
132367
|
const shadowContent = await this.extractShadowContent(actorToUse);
|
|
132290
132368
|
if (!shadowContent) return mainHTML;
|
|
132291
132369
|
try {
|
|
132292
|
-
const mergedResp = await this.evaluateRaw(actorToUse, "(() => { try { var cloned = document.documentElement.cloneNode(true); var
|
|
132370
|
+
const mergedResp = await this.evaluateRaw(actorToUse, "(() => { try { var selector = '#extension-root,[data-extension-root]:not([data-extension-root=\"extension-js-devtools\"])'; var serializeShadowRoot = function(shadowRoot, serializer) { if (!shadowRoot) return ''; var stylesheetCss = Array.from(shadowRoot.styleSheets || []).map(function(sheet) { try { return Array.from(sheet.cssRules || []).map(function(rule) { return String(rule.cssText || ''); }).join('\\n'); } catch (e) { return ''; } }).filter(Boolean).join('\\n'); var adoptedCss = Array.from(shadowRoot.adoptedStyleSheets || []).map(function(sheet) { try { return Array.from(sheet.cssRules || []).map(function(rule) { return String(rule.cssText || ''); }).join('\\n'); } catch (e) { return ''; } }).filter(Boolean).join('\\n'); var stylesheetMarkup = stylesheetCss ? '<style>' + stylesheetCss + '</style>' : ''; var adoptedMarkup = adoptedCss ? '<style>' + adoptedCss + '</style>' : ''; var childMarkup = Array.from(shadowRoot.childNodes || []).map(function(node) { try { if (node && node.nodeType === 1 && String(node.nodeName || '').toLowerCase() === 'style') { return '<style>' + String(node.textContent || '') + '</style>'; } return serializer.serializeToString(node); } catch (e) { return ''; } }).join(''); return stylesheetMarkup + adoptedMarkup + childMarkup; }; var cloned = document.documentElement.cloneNode(true); var clonedHosts = Array.from(cloned.querySelectorAll(selector)); var liveHosts = Array.from(document.querySelectorAll(selector)); if (!clonedHosts.length) { var body = cloned.querySelector('body') || cloned; var newRoot = document.createElement('div'); newRoot.id='extension-root'; body.appendChild(newRoot); clonedHosts = [newRoot]; } var s = new XMLSerializer(); for (var i = 0; i < clonedHosts.length; i++) { var host = clonedHosts[i]; var live = liveHosts[i]; var shadow = ''; try { if (live && live.shadowRoot) { shadow = serializeShadowRoot(live.shadowRoot, s); } } catch (e) {} try { host.innerHTML = shadow; } catch (e) {} } return String('<!DOCTYPE html>' + (cloned.outerHTML || document.documentElement.outerHTML)); } catch(e) { try { return String(document.documentElement.outerHTML); } catch(_) { return '' } } })()");
|
|
132293
132371
|
const mergedHtml = await this.coerceResponseToString(actorToUse, mergedResp, {
|
|
132294
132372
|
fallbackToFullDocument: false
|
|
132295
132373
|
});
|
|
@@ -132317,9 +132395,20 @@ var __webpack_modules__ = {
|
|
|
132317
132395
|
VJ: ()=>navigateTo,
|
|
132318
132396
|
oc: ()=>ensureTabForUrl
|
|
132319
132397
|
});
|
|
132398
|
+
function normalizeInspectableUrl(rawUrl) {
|
|
132399
|
+
try {
|
|
132400
|
+
const parsed = new URL(String(rawUrl || ''));
|
|
132401
|
+
if (('http:' === parsed.protocol || 'https:' === parsed.protocol) && '/' === parsed.pathname) parsed.pathname = '';
|
|
132402
|
+
parsed.hash = '';
|
|
132403
|
+
return parsed.toString();
|
|
132404
|
+
} catch {
|
|
132405
|
+
return String(rawUrl || '').trim().replace(/\/$/, '');
|
|
132406
|
+
}
|
|
132407
|
+
}
|
|
132320
132408
|
async function ensureTabForUrl(client, urlToInspect) {
|
|
132321
132409
|
const targets = await client.getTargets();
|
|
132322
|
-
|
|
132410
|
+
const normalizedUrlToInspect = normalizeInspectableUrl(urlToInspect);
|
|
132411
|
+
let tab = (targets || []).find((t)=>t && normalizeInspectableUrl(t.url) === normalizedUrlToInspect && t.actor);
|
|
132323
132412
|
if (!tab) tab = (targets || []).find((t)=>t && (t.actor || t.outerWindowID)) || (targets || [])[0];
|
|
132324
132413
|
if (!tab || !tab.actor) return null;
|
|
132325
132414
|
return {
|
|
@@ -132331,6 +132420,18 @@ var __webpack_modules__ = {
|
|
|
132331
132420
|
try {
|
|
132332
132421
|
const detail = await client.getTargetFromDescriptor(tabActor);
|
|
132333
132422
|
const consoleActor = detail.consoleActor || consoleActorHint || tabActor;
|
|
132423
|
+
const currentUrl = await client.evaluate(consoleActor, 'String(location.href || "")');
|
|
132424
|
+
const sameDocumentTarget = 'string' == typeof currentUrl && normalizeInspectableUrl(currentUrl) === normalizeInspectableUrl(url);
|
|
132425
|
+
if (sameDocumentTarget) {
|
|
132426
|
+
let targetActor = tabActor;
|
|
132427
|
+
if (detail.targetActor) targetActor = String(detail.targetActor || targetActor);
|
|
132428
|
+
try {
|
|
132429
|
+
await client.attach(targetActor);
|
|
132430
|
+
} catch {}
|
|
132431
|
+
await client.navigate(targetActor, url);
|
|
132432
|
+
await client.waitForLoadEvent(targetActor);
|
|
132433
|
+
return;
|
|
132434
|
+
}
|
|
132334
132435
|
await client.navigateViaScript(consoleActor, url);
|
|
132335
132436
|
await client.waitForPageReady(consoleActor, url, 8000);
|
|
132336
132437
|
return;
|
|
@@ -132347,6 +132448,7 @@ var __webpack_modules__ = {
|
|
|
132347
132448
|
await client.waitForLoadEvent(targetActor);
|
|
132348
132449
|
}
|
|
132349
132450
|
async function getPageHTML(client, descriptorActor, consoleActorHint) {
|
|
132451
|
+
if ('function' == typeof client.getPageHTML) return await client.getPageHTML(descriptorActor, consoleActorHint);
|
|
132350
132452
|
try {
|
|
132351
132453
|
const titleResp = await client.evaluateRaw(descriptorActor, 'String(document.title)');
|
|
132352
132454
|
await client.coerceResponseToString?.(descriptorActor, titleResp);
|
|
@@ -132362,9 +132464,32 @@ var __webpack_modules__ = {
|
|
|
132362
132464
|
if (!mainHTML) return '';
|
|
132363
132465
|
}
|
|
132364
132466
|
const shadowContent = await client.extractShadowContent?.(descriptorActor);
|
|
132467
|
+
fetch('http://127.0.0.1:7795/ingest/9eb8f923-a325-4455-a46c-a6e706558307', {
|
|
132468
|
+
method: 'POST',
|
|
132469
|
+
headers: {
|
|
132470
|
+
'Content-Type': 'application/json',
|
|
132471
|
+
'X-Debug-Session-Id': 'a87efc'
|
|
132472
|
+
},
|
|
132473
|
+
body: JSON.stringify({
|
|
132474
|
+
sessionId: 'a87efc',
|
|
132475
|
+
runId: process.env.EXTENSION_INSTANCE_ID || 'firefox-source-inspection',
|
|
132476
|
+
hypothesisId: 'H3',
|
|
132477
|
+
location: 'remote-firefox/source-inspect.ts:getPageHTML',
|
|
132478
|
+
message: 'Firefox page HTML extraction snapshot',
|
|
132479
|
+
data: {
|
|
132480
|
+
descriptorActor,
|
|
132481
|
+
consoleActorHint,
|
|
132482
|
+
mainHtmlLength: 'string' == typeof mainHTML ? mainHTML.length : 0,
|
|
132483
|
+
shadowContentLength: 'string' == typeof shadowContent ? shadowContent.length : 0,
|
|
132484
|
+
mainHasRoot: 'string' == typeof mainHTML && /#extension-root|data-extension-root/i.test(mainHTML),
|
|
132485
|
+
shadowHasContentMarkers: 'string' == typeof shadowContent && /content_script|content_title|js-probe|iskilar_box/i.test(shadowContent)
|
|
132486
|
+
},
|
|
132487
|
+
timestamp: Date.now()
|
|
132488
|
+
})
|
|
132489
|
+
}).catch(()=>{});
|
|
132365
132490
|
if (!shadowContent) return mainHTML;
|
|
132366
132491
|
try {
|
|
132367
|
-
const mergedResp = await client.evaluateRaw(descriptorActor, "(() => { try { var cloned = document.documentElement.cloneNode(true); var
|
|
132492
|
+
const mergedResp = await client.evaluateRaw(descriptorActor, "(() => { try { var selector = '#extension-root,[data-extension-root]:not([data-extension-root=\"extension-js-devtools\"])'; var serializeShadowRoot = function(shadowRoot, serializer) { if (!shadowRoot) return ''; var stylesheetCss = Array.from(shadowRoot.styleSheets || []).map(function(sheet) { try { return Array.from(sheet.cssRules || []).map(function(rule) { return String(rule.cssText || ''); }).join('\\n'); } catch (e) { return ''; } }).filter(Boolean).join('\\n'); var adoptedCss = Array.from(shadowRoot.adoptedStyleSheets || []).map(function(sheet) { try { return Array.from(sheet.cssRules || []).map(function(rule) { return String(rule.cssText || ''); }).join('\\n'); } catch (e) { return ''; } }).filter(Boolean).join('\\n'); var stylesheetMarkup = stylesheetCss ? '<style>' + stylesheetCss + '</style>' : ''; var adoptedMarkup = adoptedCss ? '<style>' + adoptedCss + '</style>' : ''; var childMarkup = Array.from(shadowRoot.childNodes || []).map(function(node) { try { if (node && node.nodeType === 1 && String(node.nodeName || '').toLowerCase() === 'style') { return '<style>' + String(node.textContent || '') + '</style>'; } return serializer.serializeToString(node); } catch (e) { return ''; } }).join(''); return stylesheetMarkup + adoptedMarkup + childMarkup; }; var cloned = document.documentElement.cloneNode(true); var clonedHosts = Array.from(cloned.querySelectorAll(selector)); var liveHosts = Array.from(document.querySelectorAll(selector)); if (!clonedHosts.length) { var body = cloned.querySelector('body') || cloned; var newRoot = document.createElement('div'); newRoot.id='extension-root'; body.appendChild(newRoot); clonedHosts = [newRoot]; } var s = new XMLSerializer(); for (var i = 0; i < clonedHosts.length; i++) { var host = clonedHosts[i]; var live = liveHosts[i]; var shadow = ''; try { if (live && live.shadowRoot) { shadow = serializeShadowRoot(live.shadowRoot, s); } } catch (e) {} try { host.innerHTML = shadow; } catch (e) {} } return String('<!DOCTYPE html>' + (cloned.outerHTML || document.documentElement.outerHTML)); } catch(e) { try { return String(document.documentElement.outerHTML); } catch(_) { return '' } } })()");
|
|
132368
132493
|
const mergedHtml = await client.coerceResponseToString?.(descriptorActor, mergedResp, {
|
|
132369
132494
|
fallbackToFullDocument: false
|
|
132370
132495
|
});
|
|
@@ -132379,7 +132504,8 @@ var __webpack_modules__ = {
|
|
|
132379
132504
|
try {
|
|
132380
132505
|
const targets = await client.getTargets();
|
|
132381
132506
|
const byActor = targets.find((t)=>t && t.actor === tabActor);
|
|
132382
|
-
const
|
|
132507
|
+
const normalizedUrlToInspect = normalizeInspectableUrl(urlToInspect);
|
|
132508
|
+
const byUrl = targets.find((t)=>t && normalizeInspectableUrl(t.url) === normalizedUrlToInspect);
|
|
132383
132509
|
const match = byActor || byUrl;
|
|
132384
132510
|
const consoleActor = match?.consoleActor || match?.webConsoleActor;
|
|
132385
132511
|
if ('string' == typeof consoleActor && consoleActor.length > 0) return consoleActor;
|
|
@@ -132394,19 +132520,169 @@ var __webpack_modules__ = {
|
|
|
132394
132520
|
return tabActor;
|
|
132395
132521
|
}
|
|
132396
132522
|
async function waitForContentScriptInjectionMethod(client, consoleActor) {
|
|
132397
|
-
const deadline = Date.now() +
|
|
132523
|
+
const deadline = Date.now() + 12000;
|
|
132398
132524
|
while(Date.now() < deadline){
|
|
132399
132525
|
try {
|
|
132400
132526
|
const injected = await client.evaluate(consoleActor, `(() => {
|
|
132401
|
-
const root = document.
|
|
132527
|
+
const root = document.querySelector('#extension-root,[data-extension-root]:not([data-extension-root="extension-js-devtools"])');
|
|
132402
132528
|
if (!root || !root.shadowRoot) return false;
|
|
132529
|
+
const meaningfulChild = Array.from(root.shadowRoot.childNodes || []).some((node) => {
|
|
132530
|
+
if (!node) return false;
|
|
132531
|
+
if (node.nodeType === Node.TEXT_NODE) {
|
|
132532
|
+
return String(node.textContent || '').trim().length > 0;
|
|
132533
|
+
}
|
|
132534
|
+
if (node.nodeType !== Node.ELEMENT_NODE) return false;
|
|
132535
|
+
const element = node;
|
|
132536
|
+
const tagName = String(element.nodeName || '').toLowerCase();
|
|
132537
|
+
if (tagName === 'style') return false;
|
|
132538
|
+
const text = String(element.textContent || '').trim();
|
|
132539
|
+
return text.length > 0 || element.childElementCount > 0;
|
|
132540
|
+
});
|
|
132541
|
+
if (meaningfulChild) return true;
|
|
132403
132542
|
const html = root.shadowRoot.innerHTML || '';
|
|
132404
|
-
return html
|
|
132543
|
+
return /<(?!style\\b)[a-z][^>]*>/i.test(html);
|
|
132405
132544
|
})()`);
|
|
132406
|
-
if (injected)
|
|
132545
|
+
if (injected) {
|
|
132546
|
+
try {
|
|
132547
|
+
const snapshot = await client.evaluate(consoleActor, `(() => {
|
|
132548
|
+
try {
|
|
132549
|
+
const hosts = Array.from(document.querySelectorAll('#extension-root,[data-extension-root]:not([data-extension-root="extension-js-devtools"])'));
|
|
132550
|
+
return JSON.stringify({
|
|
132551
|
+
readyState: document.readyState,
|
|
132552
|
+
hostCount: hosts.length,
|
|
132553
|
+
hosts: hosts.slice(0, 6).map((host, index) => {
|
|
132554
|
+
const shadow = host && host.shadowRoot;
|
|
132555
|
+
const html = shadow ? String(shadow.innerHTML || '') : '';
|
|
132556
|
+
const meaningfulChild = shadow ? Array.from(shadow.childNodes || []).some((node) => {
|
|
132557
|
+
try {
|
|
132558
|
+
if (!node) return false;
|
|
132559
|
+
if (node.nodeType === Node.TEXT_NODE) {
|
|
132560
|
+
return String(node.textContent || '').trim().length > 0;
|
|
132561
|
+
}
|
|
132562
|
+
if (node.nodeType !== Node.ELEMENT_NODE) return false;
|
|
132563
|
+
const element = node;
|
|
132564
|
+
const tagName = String(element.nodeName || '').toLowerCase();
|
|
132565
|
+
if (tagName === 'style') return false;
|
|
132566
|
+
const text = String(element.textContent || '').trim();
|
|
132567
|
+
return text.length > 0 || element.childElementCount > 0;
|
|
132568
|
+
} catch {
|
|
132569
|
+
return false;
|
|
132570
|
+
}
|
|
132571
|
+
}) : false;
|
|
132572
|
+
return {
|
|
132573
|
+
index,
|
|
132574
|
+
id: host && host.id ? String(host.id) : '',
|
|
132575
|
+
rootAttr: host && host.getAttribute ? String(host.getAttribute('data-extension-root') || '') : '',
|
|
132576
|
+
hasShadow: !!shadow,
|
|
132577
|
+
shadowChildCount: shadow ? shadow.childNodes.length : 0,
|
|
132578
|
+
shadowElementCount: shadow ? shadow.querySelectorAll('*').length : 0,
|
|
132579
|
+
meaningfulChild,
|
|
132580
|
+
shadowHtmlSnippet: html.slice(0, 200)
|
|
132581
|
+
};
|
|
132582
|
+
})
|
|
132583
|
+
});
|
|
132584
|
+
} catch (error) {
|
|
132585
|
+
return JSON.stringify({error: String(error && error.message || error)});
|
|
132586
|
+
}
|
|
132587
|
+
})()`);
|
|
132588
|
+
fetch('http://127.0.0.1:7795/ingest/9eb8f923-a325-4455-a46c-a6e706558307', {
|
|
132589
|
+
method: 'POST',
|
|
132590
|
+
headers: {
|
|
132591
|
+
'Content-Type': 'application/json',
|
|
132592
|
+
'X-Debug-Session-Id': 'a87efc'
|
|
132593
|
+
},
|
|
132594
|
+
body: JSON.stringify({
|
|
132595
|
+
sessionId: 'a87efc',
|
|
132596
|
+
runId: process.env.EXTENSION_INSTANCE_ID || 'firefox-source-inspection',
|
|
132597
|
+
hypothesisId: 'H2',
|
|
132598
|
+
location: 'remote-firefox/source-inspect.ts:waitForContentScriptInjectionMethod:success',
|
|
132599
|
+
message: 'Firefox injection waiter succeeded',
|
|
132600
|
+
data: {
|
|
132601
|
+
consoleActor,
|
|
132602
|
+
snapshot
|
|
132603
|
+
},
|
|
132604
|
+
timestamp: Date.now()
|
|
132605
|
+
})
|
|
132606
|
+
}).catch(()=>{});
|
|
132607
|
+
} catch {}
|
|
132608
|
+
return true;
|
|
132609
|
+
}
|
|
132407
132610
|
} catch {}
|
|
132408
132611
|
await new Promise((r)=>setTimeout(r, 200));
|
|
132409
132612
|
}
|
|
132613
|
+
try {
|
|
132614
|
+
const snapshot = await client.evaluate(consoleActor, `(() => {
|
|
132615
|
+
try {
|
|
132616
|
+
const hosts = Array.from(document.querySelectorAll('#extension-root,[data-extension-root]:not([data-extension-root="extension-js-devtools"])'));
|
|
132617
|
+
const selected = document.querySelector('#extension-root,[data-extension-root]:not([data-extension-root="extension-js-devtools"])');
|
|
132618
|
+
const selectedShadow = selected && selected.shadowRoot;
|
|
132619
|
+
return JSON.stringify({
|
|
132620
|
+
readyState: document.readyState,
|
|
132621
|
+
href: String(location.href || ''),
|
|
132622
|
+
title: String(document.title || ''),
|
|
132623
|
+
hostCount: hosts.length,
|
|
132624
|
+
selectedHost: selected ? {
|
|
132625
|
+
id: selected.id ? String(selected.id) : '',
|
|
132626
|
+
rootAttr: selected.getAttribute ? String(selected.getAttribute('data-extension-root') || '') : '',
|
|
132627
|
+
hasShadow: !!selectedShadow,
|
|
132628
|
+
shadowHtmlSnippet: selectedShadow ? String(selectedShadow.innerHTML || '').slice(0, 200) : ''
|
|
132629
|
+
} : null,
|
|
132630
|
+
hosts: hosts.slice(0, 6).map((host, index) => {
|
|
132631
|
+
const shadow = host && host.shadowRoot;
|
|
132632
|
+
const html = shadow ? String(shadow.innerHTML || '') : '';
|
|
132633
|
+
const meaningfulChild = shadow ? Array.from(shadow.childNodes || []).some((node) => {
|
|
132634
|
+
try {
|
|
132635
|
+
if (!node) return false;
|
|
132636
|
+
if (node.nodeType === Node.TEXT_NODE) {
|
|
132637
|
+
return String(node.textContent || '').trim().length > 0;
|
|
132638
|
+
}
|
|
132639
|
+
if (node.nodeType !== Node.ELEMENT_NODE) return false;
|
|
132640
|
+
const element = node;
|
|
132641
|
+
const tagName = String(element.nodeName || '').toLowerCase();
|
|
132642
|
+
if (tagName === 'style') return false;
|
|
132643
|
+
const text = String(element.textContent || '').trim();
|
|
132644
|
+
return text.length > 0 || element.childElementCount > 0;
|
|
132645
|
+
} catch {
|
|
132646
|
+
return false;
|
|
132647
|
+
}
|
|
132648
|
+
}) : false;
|
|
132649
|
+
return {
|
|
132650
|
+
index,
|
|
132651
|
+
id: host && host.id ? String(host.id) : '',
|
|
132652
|
+
rootAttr: host && host.getAttribute ? String(host.getAttribute('data-extension-root') || '') : '',
|
|
132653
|
+
hasShadow: !!shadow,
|
|
132654
|
+
shadowChildCount: shadow ? shadow.childNodes.length : 0,
|
|
132655
|
+
shadowElementCount: shadow ? shadow.querySelectorAll('*').length : 0,
|
|
132656
|
+
meaningfulChild,
|
|
132657
|
+
shadowHtmlSnippet: html.slice(0, 200)
|
|
132658
|
+
};
|
|
132659
|
+
})
|
|
132660
|
+
});
|
|
132661
|
+
} catch (error) {
|
|
132662
|
+
return JSON.stringify({error: String(error && error.message || error)});
|
|
132663
|
+
}
|
|
132664
|
+
})()`);
|
|
132665
|
+
fetch('http://127.0.0.1:7795/ingest/9eb8f923-a325-4455-a46c-a6e706558307', {
|
|
132666
|
+
method: 'POST',
|
|
132667
|
+
headers: {
|
|
132668
|
+
'Content-Type': 'application/json',
|
|
132669
|
+
'X-Debug-Session-Id': 'a87efc'
|
|
132670
|
+
},
|
|
132671
|
+
body: JSON.stringify({
|
|
132672
|
+
sessionId: 'a87efc',
|
|
132673
|
+
runId: process.env.EXTENSION_INSTANCE_ID || 'firefox-source-inspection',
|
|
132674
|
+
hypothesisId: 'H2',
|
|
132675
|
+
location: 'remote-firefox/source-inspect.ts:waitForContentScriptInjectionMethod:timeout',
|
|
132676
|
+
message: 'Firefox injection waiter timed out',
|
|
132677
|
+
data: {
|
|
132678
|
+
consoleActor,
|
|
132679
|
+
snapshot
|
|
132680
|
+
},
|
|
132681
|
+
timestamp: Date.now()
|
|
132682
|
+
})
|
|
132683
|
+
}).catch(()=>{});
|
|
132684
|
+
} catch {}
|
|
132685
|
+
return false;
|
|
132410
132686
|
}
|
|
132411
132687
|
},
|
|
132412
132688
|
"./webpack/plugin-compilation/compilation-lib/shared-state.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
@@ -132464,14 +132740,9 @@ var __webpack_modules__ = {
|
|
|
132464
132740
|
"./webpack/plugin-css/css-lib/messages.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
132465
132741
|
"use strict";
|
|
132466
132742
|
__webpack_require__.d(__webpack_exports__, {
|
|
132467
|
-
DX: ()=>optionalInstallFailed,
|
|
132468
132743
|
Se: ()=>missingSassDependency,
|
|
132469
|
-
Vo: ()=>optionalInstallManagerMissing,
|
|
132470
|
-
_j: ()=>optionalToolingSetup,
|
|
132471
|
-
cr: ()=>optionalToolingRootInstall,
|
|
132472
132744
|
fD: ()=>cssConfigsDetected,
|
|
132473
132745
|
uo: ()=>cssIntegrationsEnabled,
|
|
132474
|
-
ys: ()=>optionalToolingReady,
|
|
132475
132746
|
zA: ()=>isUsingIntegration
|
|
132476
132747
|
});
|
|
132477
132748
|
var pintor__rspack_import_0 = __webpack_require__("pintor");
|
|
@@ -132487,36 +132758,6 @@ var __webpack_modules__ = {
|
|
|
132487
132758
|
function isUsingIntegration(name) {
|
|
132488
132759
|
return `${pintor__rspack_import_0_default().gray('►►►')} Using ${pintor__rspack_import_0_default().brightBlue(name)}...`;
|
|
132489
132760
|
}
|
|
132490
|
-
function optionalToolingSetup(integrations, fallback, isAuthor) {
|
|
132491
|
-
const list = integrations && integrations.length > 0 ? integrations : [
|
|
132492
|
-
fallback
|
|
132493
|
-
];
|
|
132494
|
-
const prefix = isAuthor ? pintor__rspack_import_0_default().brightMagenta('►►► Author says') : pintor__rspack_import_0_default().gray('►►►');
|
|
132495
|
-
const suffix = 'true' === process.env.EXTENSION_ONE_TIME_INSTALL_HINT ? ' (this is a one time operation)' : '';
|
|
132496
|
-
return list.map((integration)=>`${prefix} Installing specialized dependencies for ${integration}...${suffix}`);
|
|
132497
|
-
}
|
|
132498
|
-
function optionalToolingRootInstall(integration) {
|
|
132499
|
-
return `${pintor__rspack_import_0_default().brightMagenta('►►► Author says')} [${integration}] Installing root dependencies for dev...`;
|
|
132500
|
-
}
|
|
132501
|
-
function optionalToolingReady(integration) {
|
|
132502
|
-
return `${pintor__rspack_import_0_default().brightMagenta('►►► Author says')} ${integration} tooling ready.`;
|
|
132503
|
-
}
|
|
132504
|
-
function optionalInstallFailed(integration, error, isAuthor) {
|
|
132505
|
-
const prefix = isAuthor ? pintor__rspack_import_0_default().brightMagenta('ERROR Author says') : pintor__rspack_import_0_default().red('ERROR');
|
|
132506
|
-
return `${prefix} [${integration}] Failed to install dependencies.\n${pintor__rspack_import_0_default().red(String(error?.message || error))}`;
|
|
132507
|
-
}
|
|
132508
|
-
function optionalInstallManagerMissing(integration) {
|
|
132509
|
-
const prefix = pintor__rspack_import_0_default().red('ERROR');
|
|
132510
|
-
return [
|
|
132511
|
-
`${prefix} [${integration}] No supported package manager found in PATH.`,
|
|
132512
|
-
'Install pnpm, npm, or yarn and retry.',
|
|
132513
|
-
'If you use pnpm, ensure it is available in your environment (e.g. corepack or PATH).',
|
|
132514
|
-
'Override detection with:',
|
|
132515
|
-
` ${pintor__rspack_import_0_default().gray('EXTENSION_JS_PACKAGE_MANAGER=pnpm|npm|yarn|bun')}`,
|
|
132516
|
-
` ${pintor__rspack_import_0_default().gray('EXTENSION_JS_PM_EXEC_PATH=/path/to/npm-cli.js')}`,
|
|
132517
|
-
'If you are on WSL, run the CLI inside a WSL shell so PATH is consistent.'
|
|
132518
|
-
].join('\n');
|
|
132519
|
-
}
|
|
132520
132761
|
function missingSassDependency() {
|
|
132521
132762
|
const prefix = pintor__rspack_import_0_default().red('►►►');
|
|
132522
132763
|
return [
|
|
@@ -132545,12 +132786,12 @@ var __webpack_modules__ = {
|
|
|
132545
132786
|
var pintor__rspack_import_1 = __webpack_require__("pintor");
|
|
132546
132787
|
var pintor__rspack_import_1_default = /*#__PURE__*/ __webpack_require__.n(pintor__rspack_import_1);
|
|
132547
132788
|
var _css_lib_messages__rspack_import_2 = __webpack_require__("./webpack/plugin-css/css-lib/messages.ts");
|
|
132548
|
-
var
|
|
132789
|
+
var optional_deps_lib__rspack_import_3 = __webpack_require__("optional-deps-lib");
|
|
132549
132790
|
var _css_lib_is_content_script__rspack_import_4 = __webpack_require__("./webpack/plugin-css/css-lib/is-content-script.ts");
|
|
132550
132791
|
var _webpack_lib_optional_deps_resolver__rspack_import_5 = __webpack_require__("./webpack/webpack-lib/optional-deps-resolver.ts");
|
|
132551
132792
|
let userMessageDelivered = false;
|
|
132552
132793
|
function isUsingLess(projectPath) {
|
|
132553
|
-
if ((0,
|
|
132794
|
+
if ((0, optional_deps_lib__rspack_import_3.hasDependency)(projectPath, 'less')) {
|
|
132554
132795
|
if (!userMessageDelivered) {
|
|
132555
132796
|
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(`${pintor__rspack_import_1_default().brightMagenta('►►► Author says')} ${_css_lib_messages__rspack_import_2.zA('LESS')}`);
|
|
132556
132797
|
userMessageDelivered = true;
|
|
@@ -132615,7 +132856,7 @@ var __webpack_modules__ = {
|
|
|
132615
132856
|
var pintor__rspack_import_3 = __webpack_require__("pintor");
|
|
132616
132857
|
var pintor__rspack_import_3_default = /*#__PURE__*/ __webpack_require__.n(pintor__rspack_import_3);
|
|
132617
132858
|
var _css_lib_messages__rspack_import_4 = __webpack_require__("./webpack/plugin-css/css-lib/messages.ts");
|
|
132618
|
-
var
|
|
132859
|
+
var optional_deps_lib__rspack_import_5 = __webpack_require__("optional-deps-lib");
|
|
132619
132860
|
var _tailwind__rspack_import_6 = __webpack_require__("./webpack/plugin-css/css-tools/tailwind.ts");
|
|
132620
132861
|
var _webpack_lib_optional_deps_resolver__rspack_import_7 = __webpack_require__("./webpack/webpack-lib/optional-deps-resolver.ts");
|
|
132621
132862
|
let userMessageDelivered = false;
|
|
@@ -132764,7 +133005,7 @@ var __webpack_modules__ = {
|
|
|
132764
133005
|
}
|
|
132765
133006
|
}
|
|
132766
133007
|
function isUsingPostCss(projectPath) {
|
|
132767
|
-
if ((0,
|
|
133008
|
+
if ((0, optional_deps_lib__rspack_import_5.hasDependency)(projectPath, 'postcss')) {
|
|
132768
133009
|
if (!userMessageDelivered) {
|
|
132769
133010
|
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(`${pintor__rspack_import_3_default().brightMagenta('►►► Author says')} ${_css_lib_messages__rspack_import_4.zA('PostCSS')}`);
|
|
132770
133011
|
userMessageDelivered = true;
|
|
@@ -132898,7 +133139,7 @@ var __webpack_modules__ = {
|
|
|
132898
133139
|
} catch {}
|
|
132899
133140
|
const bypassUserConfigForTailwindCompat = !!pluginsFromOptions && !!userPostCssConfig && userConfigMentionsTailwind && userConfigUsesDirectTailwindReference;
|
|
132900
133141
|
if (userConfigIsCjsInEsm || bypassUserConfigForTailwindCompat) try {
|
|
132901
|
-
if ((0,
|
|
133142
|
+
if ((0, optional_deps_lib__rspack_import_5.hasDependency)(projectPath, 'autoprefixer')) {
|
|
132902
133143
|
const req = (0, module__rspack_import_2.createRequire)(path__rspack_import_0.join(projectPath, 'package.json'));
|
|
132903
133144
|
const autoprefixerMod = req('autoprefixer');
|
|
132904
133145
|
const autoprefixerPlugin = 'function' == typeof autoprefixerMod ? autoprefixerMod() : autoprefixerMod?.default && 'function' == typeof autoprefixerMod.default ? autoprefixerMod.default() : void 0;
|
|
@@ -132942,11 +133183,12 @@ var __webpack_modules__ = {
|
|
|
132942
133183
|
var pintor__rspack_import_2 = __webpack_require__("pintor");
|
|
132943
133184
|
var pintor__rspack_import_2_default = /*#__PURE__*/ __webpack_require__.n(pintor__rspack_import_2);
|
|
132944
133185
|
var _css_lib_messages__rspack_import_3 = __webpack_require__("./webpack/plugin-css/css-lib/messages.ts");
|
|
132945
|
-
var
|
|
132946
|
-
var
|
|
133186
|
+
var optional_deps_lib__rspack_import_4 = __webpack_require__("optional-deps-lib");
|
|
133187
|
+
var _webpack_lib_develop_context__rspack_import_5 = __webpack_require__("./webpack/webpack-lib/develop-context.ts");
|
|
133188
|
+
var _webpack_lib_optional_deps_resolver__rspack_import_6 = __webpack_require__("./webpack/webpack-lib/optional-deps-resolver.ts");
|
|
132947
133189
|
let userMessageDelivered = false;
|
|
132948
133190
|
function isUsingSass(projectPath) {
|
|
132949
|
-
if ((0,
|
|
133191
|
+
if ((0, optional_deps_lib__rspack_import_4.hasDependency)(projectPath, 'sass')) {
|
|
132950
133192
|
if (!userMessageDelivered) {
|
|
132951
133193
|
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(`${pintor__rspack_import_2_default().brightMagenta('►►► Author says')} ${_css_lib_messages__rspack_import_3.zA('SASS')}`);
|
|
132952
133194
|
userMessageDelivered = true;
|
|
@@ -132956,7 +133198,7 @@ var __webpack_modules__ = {
|
|
|
132956
133198
|
return false;
|
|
132957
133199
|
}
|
|
132958
133200
|
function resolveSassImplementation(projectPath) {
|
|
132959
|
-
const extensionRoot = (0,
|
|
133201
|
+
const extensionRoot = (0, _webpack_lib_develop_context__rspack_import_5.H)();
|
|
132960
133202
|
const bases = [
|
|
132961
133203
|
projectPath,
|
|
132962
133204
|
extensionRoot || void 0,
|
|
@@ -132969,7 +133211,7 @@ var __webpack_modules__ = {
|
|
|
132969
133211
|
return mod;
|
|
132970
133212
|
} catch {}
|
|
132971
133213
|
try {
|
|
132972
|
-
let mod = __webpack_require__("../../node_modules
|
|
133214
|
+
let mod = __webpack_require__("../../node_modules/sass/sass.node.js");
|
|
132973
133215
|
if (mod && 'object' == typeof mod && 'default' in mod) mod = mod.default;
|
|
132974
133216
|
return mod;
|
|
132975
133217
|
} catch {
|
|
@@ -132991,7 +133233,7 @@ var __webpack_modules__ = {
|
|
|
132991
133233
|
}
|
|
132992
133234
|
async function maybeUseSass(projectPath) {
|
|
132993
133235
|
if (!isUsingSass(projectPath)) return [];
|
|
132994
|
-
const sassLoaderPath = await (0,
|
|
133236
|
+
const sassLoaderPath = await (0, _webpack_lib_optional_deps_resolver__rspack_import_6.xr)({
|
|
132995
133237
|
contractId: 'sass',
|
|
132996
133238
|
projectPath,
|
|
132997
133239
|
dependencyId: 'sass-loader'
|
|
@@ -133030,10 +133272,10 @@ var __webpack_modules__ = {
|
|
|
133030
133272
|
var pintor__rspack_import_2 = __webpack_require__("pintor");
|
|
133031
133273
|
var pintor__rspack_import_2_default = /*#__PURE__*/ __webpack_require__.n(pintor__rspack_import_2);
|
|
133032
133274
|
var _css_lib_messages__rspack_import_3 = __webpack_require__("./webpack/plugin-css/css-lib/messages.ts");
|
|
133033
|
-
var
|
|
133275
|
+
var optional_deps_lib__rspack_import_4 = __webpack_require__("optional-deps-lib");
|
|
133034
133276
|
let userMessageDelivered = false;
|
|
133035
133277
|
function isUsingTailwind(projectPath) {
|
|
133036
|
-
const isUsingTailwind = (0,
|
|
133278
|
+
const isUsingTailwind = (0, optional_deps_lib__rspack_import_4.hasDependency)(projectPath, 'tailwindcss') || (0, optional_deps_lib__rspack_import_4.hasDependency)(projectPath, '@tailwindcss/postcss');
|
|
133037
133279
|
if (isUsingTailwind) {
|
|
133038
133280
|
if (!userMessageDelivered) {
|
|
133039
133281
|
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(`${pintor__rspack_import_2_default().brightMagenta('►►► Author says')} ${_css_lib_messages__rspack_import_3.zA('Tailwind')}`);
|
|
@@ -133054,11 +133296,12 @@ var __webpack_modules__ = {
|
|
|
133054
133296
|
"./webpack/plugin-js-frameworks/frameworks-lib/integrations.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
133055
133297
|
"use strict";
|
|
133056
133298
|
__webpack_require__.d(__webpack_exports__, {
|
|
133057
|
-
Dy: ()=>
|
|
133299
|
+
Dy: ()=>optional_deps_lib__rspack_import_0.installOptionalDependenciesBatch,
|
|
133058
133300
|
qQ: ()=>isUsingJSFramework,
|
|
133059
|
-
ws: ()=>
|
|
133301
|
+
ws: ()=>optional_deps_lib__rspack_import_0.hasDependency
|
|
133060
133302
|
});
|
|
133061
|
-
var
|
|
133303
|
+
var optional_deps_lib__rspack_import_0 = __webpack_require__("optional-deps-lib");
|
|
133304
|
+
__webpack_require__("./webpack/webpack-lib/develop-context.ts");
|
|
133062
133305
|
function isUsingJSFramework(projectPath) {
|
|
133063
133306
|
const frameworks = [
|
|
133064
133307
|
'react',
|
|
@@ -133068,7 +133311,7 @@ var __webpack_modules__ = {
|
|
|
133068
133311
|
'solid-js',
|
|
133069
133312
|
'preact'
|
|
133070
133313
|
];
|
|
133071
|
-
return frameworks.some((fw)=>
|
|
133314
|
+
return frameworks.some((fw)=>(0, optional_deps_lib__rspack_import_0.hasDependency)(projectPath, fw));
|
|
133072
133315
|
}
|
|
133073
133316
|
},
|
|
133074
133317
|
"./webpack/plugin-js-frameworks/js-frameworks-lib/load-loader-options.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
@@ -133245,7 +133488,7 @@ var __webpack_modules__ = {
|
|
|
133245
133488
|
}
|
|
133246
133489
|
return false;
|
|
133247
133490
|
}
|
|
133248
|
-
async function maybeUseReact(projectPath) {
|
|
133491
|
+
async function maybeUseReact(projectPath, options = {}) {
|
|
133249
133492
|
if (!isUsingReact(projectPath)) return;
|
|
133250
133493
|
const requireFromProject = (0, module__rspack_import_1.createRequire)(path__rspack_import_0.join(projectPath, 'package.json'));
|
|
133251
133494
|
let reactPath;
|
|
@@ -133274,6 +133517,11 @@ var __webpack_modules__ = {
|
|
|
133274
133517
|
if (reactDomClientPath) alias['react-dom/client'] = reactDomClientPath;
|
|
133275
133518
|
if (jsxRuntimePath) alias['react/jsx-runtime'] = jsxRuntimePath;
|
|
133276
133519
|
if (jsxDevRuntimePath) alias['react/jsx-dev-runtime'] = jsxDevRuntimePath;
|
|
133520
|
+
if (true === options.disableRefresh) return {
|
|
133521
|
+
plugins: [],
|
|
133522
|
+
loaders: void 0,
|
|
133523
|
+
alias
|
|
133524
|
+
};
|
|
133277
133525
|
(0, _webpack_lib_optional_deps_resolver__rspack_import_5.Eh)({
|
|
133278
133526
|
contractId: 'react-refresh',
|
|
133279
133527
|
projectPath,
|
|
@@ -133287,7 +133535,10 @@ var __webpack_modules__ = {
|
|
|
133287
133535
|
});
|
|
133288
133536
|
const reactPlugins = [
|
|
133289
133537
|
new ReactRefreshPlugin({
|
|
133290
|
-
overlay: false
|
|
133538
|
+
overlay: false,
|
|
133539
|
+
...void 0 === options.refreshExclude ? {} : {
|
|
133540
|
+
exclude: options.refreshExclude
|
|
133541
|
+
}
|
|
133291
133542
|
})
|
|
133292
133543
|
];
|
|
133293
133544
|
return {
|
|
@@ -133821,6 +134072,52 @@ var __webpack_modules__ = {
|
|
|
133821
134072
|
}
|
|
133822
134073
|
_define_property(PlaywrightPlugin, "name", 'plugin-playwright');
|
|
133823
134074
|
},
|
|
134075
|
+
"./webpack/plugin-web-extension/feature-scripts/contracts.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
134076
|
+
"use strict";
|
|
134077
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
134078
|
+
$t: ()=>EXTENSIONJS_CONTENT_SCRIPT_LAYER,
|
|
134079
|
+
HE: ()=>isCanonicalContentScriptAsset,
|
|
134080
|
+
J4: ()=>getCanonicalContentScriptCssAssetName,
|
|
134081
|
+
Mj: ()=>isCanonicalContentScriptEntryName,
|
|
134082
|
+
WG: ()=>parseCanonicalContentScriptEntryIndex,
|
|
134083
|
+
Y0: ()=>getCanonicalContentScriptEntryName,
|
|
134084
|
+
es: ()=>parseCanonicalContentScriptAsset,
|
|
134085
|
+
f6: ()=>getCanonicalContentScriptJsAssetName
|
|
134086
|
+
});
|
|
134087
|
+
const EXTENSIONJS_CONTENT_SCRIPT_LAYER = "extensionjs-content-script";
|
|
134088
|
+
const CANONICAL_CONTENT_SCRIPT_ENTRY_PREFIX = "content_scripts/content-";
|
|
134089
|
+
function getCanonicalContentScriptEntryName(index) {
|
|
134090
|
+
return `${CANONICAL_CONTENT_SCRIPT_ENTRY_PREFIX}${index}`;
|
|
134091
|
+
}
|
|
134092
|
+
function getCanonicalContentScriptJsAssetName(index) {
|
|
134093
|
+
return `${getCanonicalContentScriptEntryName(index)}.js`;
|
|
134094
|
+
}
|
|
134095
|
+
function getCanonicalContentScriptCssAssetName(index) {
|
|
134096
|
+
return `${getCanonicalContentScriptEntryName(index)}.css`;
|
|
134097
|
+
}
|
|
134098
|
+
function parseCanonicalContentScriptEntryIndex(entryName) {
|
|
134099
|
+
const match = /^content_scripts\/content-(\d+)$/.exec(String(entryName || ''));
|
|
134100
|
+
if (!match) return;
|
|
134101
|
+
const index = Number(match[1]);
|
|
134102
|
+
return Number.isInteger(index) ? index : void 0;
|
|
134103
|
+
}
|
|
134104
|
+
function isCanonicalContentScriptEntryName(entryName) {
|
|
134105
|
+
return void 0 !== parseCanonicalContentScriptEntryIndex(entryName);
|
|
134106
|
+
}
|
|
134107
|
+
function parseCanonicalContentScriptAsset(assetName) {
|
|
134108
|
+
const match = /^content_scripts\/content-(\d+)(?:\.[a-f0-9]+)?\.(js|css)$/i.exec(String(assetName || ''));
|
|
134109
|
+
if (!match) return;
|
|
134110
|
+
const index = Number(match[1]);
|
|
134111
|
+
if (!Number.isInteger(index)) return;
|
|
134112
|
+
return {
|
|
134113
|
+
index,
|
|
134114
|
+
extension: match[2]
|
|
134115
|
+
};
|
|
134116
|
+
}
|
|
134117
|
+
function isCanonicalContentScriptAsset(assetName) {
|
|
134118
|
+
return void 0 !== parseCanonicalContentScriptAsset(assetName);
|
|
134119
|
+
}
|
|
134120
|
+
},
|
|
133824
134121
|
"./webpack/webpack-lib/check-build-dependencies.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
133825
134122
|
"use strict";
|
|
133826
134123
|
__webpack_require__.d(__webpack_exports__, {
|
|
@@ -134185,6 +134482,82 @@ var __webpack_modules__ = {
|
|
|
134185
134482
|
};
|
|
134186
134483
|
}
|
|
134187
134484
|
},
|
|
134485
|
+
"./webpack/webpack-lib/develop-context.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
134486
|
+
"use strict";
|
|
134487
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
134488
|
+
G: ()=>resolveDevelopDistFile,
|
|
134489
|
+
H: ()=>resolveDevelopInstallRoot
|
|
134490
|
+
});
|
|
134491
|
+
var path__rspack_import_0 = __webpack_require__("path");
|
|
134492
|
+
var fs__rspack_import_1 = __webpack_require__("fs");
|
|
134493
|
+
var _check_build_dependencies__rspack_import_2 = __webpack_require__("./webpack/webpack-lib/check-build-dependencies.ts");
|
|
134494
|
+
var _package_json__rspack_import_3 = __webpack_require__("./package.json");
|
|
134495
|
+
if (!process.env.EXTENSION_JS_OPTIONAL_DEPS_VERSION) process.env.EXTENSION_JS_OPTIONAL_DEPS_VERSION = _package_json__rspack_import_3.rE;
|
|
134496
|
+
function parseJsonSafe(text) {
|
|
134497
|
+
const raw = 'string' == typeof text ? text : String(text || '');
|
|
134498
|
+
const s = raw && 0xfeff === raw.charCodeAt(0) ? raw.slice(1) : raw;
|
|
134499
|
+
return JSON.parse(s || '{}');
|
|
134500
|
+
}
|
|
134501
|
+
function resolveDevelopRootFromDir(dir) {
|
|
134502
|
+
try {
|
|
134503
|
+
const packageJsonPath = path__rspack_import_0.join(dir, 'package.json');
|
|
134504
|
+
if (!fs__rspack_import_1.existsSync(packageJsonPath)) return;
|
|
134505
|
+
const pkg = parseJsonSafe(fs__rspack_import_1.readFileSync(packageJsonPath, 'utf8'));
|
|
134506
|
+
if (pkg?.name === 'extension-develop') return dir;
|
|
134507
|
+
} catch {}
|
|
134508
|
+
}
|
|
134509
|
+
function findDevelopRootFrom(startDir) {
|
|
134510
|
+
let currentDir = startDir;
|
|
134511
|
+
const maxDepth = 6;
|
|
134512
|
+
for(let i = 0; i < maxDepth; i++){
|
|
134513
|
+
const root = resolveDevelopRootFromDir(currentDir);
|
|
134514
|
+
if (root) return root;
|
|
134515
|
+
const parent = path__rspack_import_0.dirname(currentDir);
|
|
134516
|
+
if (parent === currentDir) break;
|
|
134517
|
+
currentDir = parent;
|
|
134518
|
+
}
|
|
134519
|
+
}
|
|
134520
|
+
function resolveDevelopInstallRoot() {
|
|
134521
|
+
const envRoot = process.env.EXTENSION_DEVELOP_ROOT;
|
|
134522
|
+
if (envRoot) {
|
|
134523
|
+
const resolvedEnvRoot = resolveDevelopRootFromDir(path__rspack_import_0.resolve(envRoot));
|
|
134524
|
+
if (resolvedEnvRoot) return resolvedEnvRoot;
|
|
134525
|
+
}
|
|
134526
|
+
const directRoot = (0, _check_build_dependencies__rspack_import_2.w1)();
|
|
134527
|
+
if (directRoot) return directRoot;
|
|
134528
|
+
try {
|
|
134529
|
+
const candidateRoot = findDevelopRootFrom(__dirname);
|
|
134530
|
+
if (candidateRoot) return candidateRoot;
|
|
134531
|
+
} catch {}
|
|
134532
|
+
try {
|
|
134533
|
+
const pkgPath = require.resolve('extension-develop/package.json', {
|
|
134534
|
+
paths: [
|
|
134535
|
+
__dirname
|
|
134536
|
+
]
|
|
134537
|
+
});
|
|
134538
|
+
return resolveDevelopRootFromDir(path__rspack_import_0.dirname(pkgPath));
|
|
134539
|
+
} catch {
|
|
134540
|
+
return;
|
|
134541
|
+
}
|
|
134542
|
+
}
|
|
134543
|
+
function resolveDevelopDistFile(stem) {
|
|
134544
|
+
const installRoot = resolveDevelopInstallRoot();
|
|
134545
|
+
const distRoot = installRoot ? path__rspack_import_0.join(installRoot, 'dist') : path__rspack_import_0.resolve(__dirname, '..');
|
|
134546
|
+
const base = path__rspack_import_0.join(distRoot, stem);
|
|
134547
|
+
const candidates = [
|
|
134548
|
+
`${base}.js`,
|
|
134549
|
+
`${base}.cjs`,
|
|
134550
|
+
`${base}.mjs`,
|
|
134551
|
+
base
|
|
134552
|
+
];
|
|
134553
|
+
for (const candidate of candidates)if (fs__rspack_import_1.existsSync(candidate)) {
|
|
134554
|
+
if ('1' === process.env.EXTENSION_DEBUG_DEVELOP_ROOT) console.log(`[extjs:develop-root] ${stem} -> ${candidate} (installRoot=${installRoot || '<none>'})`);
|
|
134555
|
+
return candidate;
|
|
134556
|
+
}
|
|
134557
|
+
if ('1' === process.env.EXTENSION_DEBUG_DEVELOP_ROOT) console.log(`[extjs:develop-root] ${stem} -> ${base} (fallback, installRoot=${installRoot || '<none>'})`);
|
|
134558
|
+
return base;
|
|
134559
|
+
}
|
|
134560
|
+
},
|
|
134188
134561
|
"./webpack/webpack-lib/extensions-to-load.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
134189
134562
|
"use strict";
|
|
134190
134563
|
__webpack_require__.d(__webpack_exports__, {
|
|
@@ -134253,7 +134626,7 @@ var __webpack_modules__ = {
|
|
|
134253
134626
|
var fs__rspack_import_1 = __webpack_require__("fs");
|
|
134254
134627
|
var crypto__rspack_import_2 = __webpack_require__("crypto");
|
|
134255
134628
|
var _package_json__rspack_import_3 = __webpack_require__("./package.json");
|
|
134256
|
-
var
|
|
134629
|
+
var _develop_context__rspack_import_4 = __webpack_require__("./webpack/webpack-lib/develop-context.ts");
|
|
134257
134630
|
function getInstallCacheDir(packageRoot) {
|
|
134258
134631
|
return path__rspack_import_0.join(packageRoot, '.cache', 'extensionjs', 'install');
|
|
134259
134632
|
}
|
|
@@ -134312,7 +134685,7 @@ var __webpack_modules__ = {
|
|
|
134312
134685
|
}
|
|
134313
134686
|
}
|
|
134314
134687
|
function getInstallMarkerPath(projectPath) {
|
|
134315
|
-
const packageRoot = (0,
|
|
134688
|
+
const packageRoot = (0, _develop_context__rspack_import_4.H)();
|
|
134316
134689
|
if (!packageRoot) return;
|
|
134317
134690
|
const cacheDir = getInstallCacheDir(packageRoot);
|
|
134318
134691
|
return path__rspack_import_0.join(cacheDir, `${getProjectKey(projectPath)}.json`);
|
|
@@ -134781,54 +135154,11 @@ var __webpack_modules__ = {
|
|
|
134781
135154
|
return `${getLoggingPrefix('error')} Your project declares dependencies that are managed by ${pintor__rspack_import_2_default().blue('Extension.js')} and referenced in ${pintor__rspack_import_2_default().underline('extension.config.js')}\n${pintor__rspack_import_2_default().red('This can cause version conflicts and break the development/build process.')}\n\n${pintor__rspack_import_2_default().gray('Managed dependencies (remove these from your package.json):')}\n${list}\n\n${pintor__rspack_import_2_default().gray('PATH')} ${pintor__rspack_import_2_default().underline(userPackageJsonPath)}\nIf you need a different version, open an issue so we can consider bundling it safely.\nOperation aborted.`;
|
|
134782
135155
|
}
|
|
134783
135156
|
},
|
|
134784
|
-
"./webpack/webpack-lib/optional-dependencies.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
134785
|
-
"use strict";
|
|
134786
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
134787
|
-
ad: ()=>resolveOptionalDependencySpecs,
|
|
134788
|
-
oR: ()=>getOptionalDependenciesSignature
|
|
134789
|
-
});
|
|
134790
|
-
var fs__rspack_import_0 = __webpack_require__("fs");
|
|
134791
|
-
var path__rspack_import_1 = __webpack_require__("path");
|
|
134792
|
-
var crypto__rspack_import_2 = __webpack_require__("crypto");
|
|
134793
|
-
function getOptionalDependenciesPath() {
|
|
134794
|
-
const candidates = [
|
|
134795
|
-
path__rspack_import_1.join(__dirname, 'optional-dependencies.json'),
|
|
134796
|
-
path__rspack_import_1.resolve(__dirname, '..', 'webpack', 'webpack-lib', 'optional-dependencies.json')
|
|
134797
|
-
];
|
|
134798
|
-
for (const candidate of candidates)if (fs__rspack_import_0.existsSync(candidate)) return candidate;
|
|
134799
|
-
return candidates[0];
|
|
134800
|
-
}
|
|
134801
|
-
function loadOptionalDependencies() {
|
|
134802
|
-
const metadataPath = getOptionalDependenciesPath();
|
|
134803
|
-
if (!fs__rspack_import_0.existsSync(metadataPath)) throw new Error(`optional-dependencies.json not found at ${metadataPath}. This indicates a corrupted installation.`);
|
|
134804
|
-
try {
|
|
134805
|
-
const content = fs__rspack_import_0.readFileSync(metadataPath, 'utf8');
|
|
134806
|
-
const parsed = JSON.parse(content);
|
|
134807
|
-
if (!parsed || 'object' != typeof parsed || Array.isArray(parsed)) throw new Error('optional-dependencies.json must contain an object');
|
|
134808
|
-
return parsed;
|
|
134809
|
-
} catch (error) {
|
|
134810
|
-
throw new Error(`Failed to load optional-dependencies.json: ${error.message}`);
|
|
134811
|
-
}
|
|
134812
|
-
}
|
|
134813
|
-
function resolveOptionalDependencySpecs(dependencies) {
|
|
134814
|
-
const metadata = loadOptionalDependencies();
|
|
134815
|
-
const missingFromMetadata = dependencies.filter((dep)=>!(dep in metadata));
|
|
134816
|
-
if (missingFromMetadata.length > 0) throw new Error(`Dependencies not found in optional-dependencies.json: ${missingFromMetadata.join(', ')}`);
|
|
134817
|
-
return dependencies.map((dep)=>`${dep}@${metadata[dep]}`);
|
|
134818
|
-
}
|
|
134819
|
-
function getOptionalDependenciesSignature() {
|
|
134820
|
-
const metadata = loadOptionalDependencies();
|
|
134821
|
-
const stable = JSON.stringify(Object.keys(metadata).sort().reduce((acc, key)=>{
|
|
134822
|
-
acc[key] = metadata[key];
|
|
134823
|
-
return acc;
|
|
134824
|
-
}, {}));
|
|
134825
|
-
return (0, crypto__rspack_import_2.createHash)('sha1').update(stable).digest('hex');
|
|
134826
|
-
}
|
|
134827
|
-
},
|
|
134828
135157
|
"./webpack/webpack-lib/optional-deps-contracts.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
134829
135158
|
"use strict";
|
|
134830
135159
|
__webpack_require__.d(__webpack_exports__, {
|
|
134831
|
-
|
|
135160
|
+
I7: ()=>getContractsSignature,
|
|
135161
|
+
uw: ()=>getOptionalDependencyContract
|
|
134832
135162
|
});
|
|
134833
135163
|
function installRootRules(packageIds) {
|
|
134834
135164
|
return packageIds.map((packageId)=>({
|
|
@@ -134844,7 +135174,7 @@ var __webpack_modules__ = {
|
|
|
134844
135174
|
id: "typescript",
|
|
134845
135175
|
integration: 'TypeScript',
|
|
134846
135176
|
installPackages: [
|
|
134847
|
-
"typescript"
|
|
135177
|
+
"typescript@5.9.3"
|
|
134848
135178
|
],
|
|
134849
135179
|
verificationRules: installRootRules([
|
|
134850
135180
|
"typescript"
|
|
@@ -134854,8 +135184,8 @@ var __webpack_modules__ = {
|
|
|
134854
135184
|
id: 'react-refresh',
|
|
134855
135185
|
integration: 'React',
|
|
134856
135186
|
installPackages: [
|
|
134857
|
-
'react-refresh',
|
|
134858
|
-
'@rspack/plugin-react-refresh'
|
|
135187
|
+
'react-refresh@0.18.0',
|
|
135188
|
+
'@rspack/plugin-react-refresh@1.6.0'
|
|
134859
135189
|
],
|
|
134860
135190
|
verificationRules: [
|
|
134861
135191
|
...installRootRules([
|
|
@@ -134873,10 +135203,10 @@ var __webpack_modules__ = {
|
|
|
134873
135203
|
id: 'preact-refresh',
|
|
134874
135204
|
integration: 'Preact',
|
|
134875
135205
|
installPackages: [
|
|
134876
|
-
'@prefresh/core',
|
|
134877
|
-
'@prefresh/utils',
|
|
134878
|
-
'@rspack/plugin-preact-refresh',
|
|
134879
|
-
'preact'
|
|
135206
|
+
'@prefresh/core@1.5.9',
|
|
135207
|
+
'@prefresh/utils@1.2.1',
|
|
135208
|
+
'@rspack/plugin-preact-refresh@1.1.4',
|
|
135209
|
+
'preact@10.27.2'
|
|
134880
135210
|
],
|
|
134881
135211
|
verificationRules: [
|
|
134882
135212
|
...installRootRules([
|
|
@@ -134906,9 +135236,9 @@ var __webpack_modules__ = {
|
|
|
134906
135236
|
id: 'vue',
|
|
134907
135237
|
integration: 'Vue',
|
|
134908
135238
|
installPackages: [
|
|
134909
|
-
'vue-loader',
|
|
134910
|
-
'@vue/compiler-sfc',
|
|
134911
|
-
'vue'
|
|
135239
|
+
'vue-loader@17.4.2',
|
|
135240
|
+
'@vue/compiler-sfc@3.5.26',
|
|
135241
|
+
'vue@3.5.26'
|
|
134912
135242
|
],
|
|
134913
135243
|
verificationRules: [
|
|
134914
135244
|
...installRootRules([
|
|
@@ -134927,8 +135257,8 @@ var __webpack_modules__ = {
|
|
|
134927
135257
|
id: 'svelte',
|
|
134928
135258
|
integration: 'Svelte',
|
|
134929
135259
|
installPackages: [
|
|
134930
|
-
"typescript",
|
|
134931
|
-
'svelte-loader'
|
|
135260
|
+
"typescript@5.9.3",
|
|
135261
|
+
'svelte-loader@3.2.4'
|
|
134932
135262
|
],
|
|
134933
135263
|
verificationRules: installRootRules([
|
|
134934
135264
|
"typescript",
|
|
@@ -134939,8 +135269,8 @@ var __webpack_modules__ = {
|
|
|
134939
135269
|
id: 'less',
|
|
134940
135270
|
integration: 'LESS',
|
|
134941
135271
|
installPackages: [
|
|
134942
|
-
'less',
|
|
134943
|
-
'less-loader'
|
|
135272
|
+
'less@4.5.1',
|
|
135273
|
+
'less-loader@12.3.0'
|
|
134944
135274
|
],
|
|
134945
135275
|
verificationRules: installRootRules([
|
|
134946
135276
|
'less',
|
|
@@ -134951,8 +135281,8 @@ var __webpack_modules__ = {
|
|
|
134951
135281
|
id: 'postcss',
|
|
134952
135282
|
integration: 'PostCSS',
|
|
134953
135283
|
installPackages: [
|
|
134954
|
-
'postcss',
|
|
134955
|
-
'postcss-loader'
|
|
135284
|
+
'postcss@8.5.6',
|
|
135285
|
+
'postcss-loader@8.2.0'
|
|
134956
135286
|
],
|
|
134957
135287
|
verificationRules: installRootRules([
|
|
134958
135288
|
'postcss',
|
|
@@ -134963,10 +135293,10 @@ var __webpack_modules__ = {
|
|
|
134963
135293
|
id: 'sass',
|
|
134964
135294
|
integration: 'SASS',
|
|
134965
135295
|
installPackages: [
|
|
134966
|
-
'postcss-loader',
|
|
134967
|
-
'postcss-scss',
|
|
134968
|
-
'postcss-preset-env',
|
|
134969
|
-
'sass-loader'
|
|
135296
|
+
'postcss-loader@8.2.0',
|
|
135297
|
+
'postcss-scss@4.0.9',
|
|
135298
|
+
'postcss-preset-env@11.1.1',
|
|
135299
|
+
'sass-loader@16.0.6'
|
|
134970
135300
|
],
|
|
134971
135301
|
verificationRules: installRootRules([
|
|
134972
135302
|
'postcss-loader',
|
|
@@ -134981,6 +135311,10 @@ var __webpack_modules__ = {
|
|
|
134981
135311
|
if (!contract) throw new Error(`Unknown optional dependency contract: ${contractId}`);
|
|
134982
135312
|
return contract;
|
|
134983
135313
|
}
|
|
135314
|
+
function getContractsSignature() {
|
|
135315
|
+
const allSpecs = Object.values(OPTIONAL_DEPENDENCY_CONTRACTS).flatMap((c)=>c.installPackages).sort();
|
|
135316
|
+
return allSpecs.join('::');
|
|
135317
|
+
}
|
|
134984
135318
|
},
|
|
134985
135319
|
"./webpack/webpack-lib/optional-deps-resolver.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
134986
135320
|
"use strict";
|
|
@@ -134996,8 +135330,8 @@ var __webpack_modules__ = {
|
|
|
134996
135330
|
var fs__rspack_import_0 = __webpack_require__("fs");
|
|
134997
135331
|
var path__rspack_import_1 = __webpack_require__("path");
|
|
134998
135332
|
var module__rspack_import_2 = __webpack_require__("module");
|
|
134999
|
-
var
|
|
135000
|
-
var
|
|
135333
|
+
var optional_deps_lib__rspack_import_3 = __webpack_require__("optional-deps-lib");
|
|
135334
|
+
var _develop_context__rspack_import_4 = __webpack_require__("./webpack/webpack-lib/develop-context.ts");
|
|
135001
135335
|
var _optional_deps_contracts__rspack_import_5 = __webpack_require__("./webpack/webpack-lib/optional-deps-contracts.ts");
|
|
135002
135336
|
const installSingleFlight = new Map();
|
|
135003
135337
|
function toInstallRootContract(integration, contractId, installDependencies, verifyPackageIds) {
|
|
@@ -135020,8 +135354,8 @@ var __webpack_modules__ = {
|
|
|
135020
135354
|
return toInstallRootContract(input.integration, input.integration, installDependencies, verifyPackageIds);
|
|
135021
135355
|
}
|
|
135022
135356
|
function getResolutionBases(projectPath) {
|
|
135023
|
-
const optionalInstallRoot = (0,
|
|
135024
|
-
const extensionRoot = (0,
|
|
135357
|
+
const optionalInstallRoot = (0, optional_deps_lib__rspack_import_3.resolveOptionalInstallRoot)();
|
|
135358
|
+
const extensionRoot = (0, _develop_context__rspack_import_4.H)();
|
|
135025
135359
|
const bases = [
|
|
135026
135360
|
projectPath,
|
|
135027
135361
|
optionalInstallRoot && fs__rspack_import_0.existsSync(optionalInstallRoot) ? optionalInstallRoot : void 0,
|
|
@@ -135073,7 +135407,7 @@ var __webpack_modules__ = {
|
|
|
135073
135407
|
if (installRoot.includes('.pnpm')) return resolveFromInstallRootPackageDir(dependencyId, path__rspack_import_1.join(installRoot, '..', '..'));
|
|
135074
135408
|
}
|
|
135075
135409
|
function resolveFromInstallRootPackageDir(dependencyId, installRoot) {
|
|
135076
|
-
return (0,
|
|
135410
|
+
return (0, optional_deps_lib__rspack_import_3.resolvePackageFromInstallRoot)(dependencyId, installRoot);
|
|
135077
135411
|
}
|
|
135078
135412
|
function verifyPackageInInstallRoot(packageId, installRoot) {
|
|
135079
135413
|
if (resolveFromInstallRootPackageDir(packageId, installRoot)) return true;
|
|
@@ -135120,7 +135454,7 @@ var __webpack_modules__ = {
|
|
|
135120
135454
|
return rule.packageId;
|
|
135121
135455
|
}
|
|
135122
135456
|
}
|
|
135123
|
-
function getContractVerificationFailuresFromKnownLocations(contract, projectPath, installRoot = (0,
|
|
135457
|
+
function getContractVerificationFailuresFromKnownLocations(contract, projectPath, installRoot = (0, optional_deps_lib__rspack_import_3.resolveOptionalInstallRoot)()) {
|
|
135124
135458
|
const resolvedByPackage = new Map();
|
|
135125
135459
|
const resolvePackage = (packageId)=>{
|
|
135126
135460
|
if (!resolvedByPackage.has(packageId)) resolvedByPackage.set(packageId, resolveFromKnownLocations(packageId, projectPath, installRoot));
|
|
@@ -135142,7 +135476,7 @@ var __webpack_modules__ = {
|
|
|
135142
135476
|
}
|
|
135143
135477
|
return dedupeFailures(failures);
|
|
135144
135478
|
}
|
|
135145
|
-
function getContractVerificationFailuresAtInstallRoot(contract, installRoot = (0,
|
|
135479
|
+
function getContractVerificationFailuresAtInstallRoot(contract, installRoot = (0, optional_deps_lib__rspack_import_3.resolveOptionalInstallRoot)()) {
|
|
135146
135480
|
const resolvedByPackage = new Map();
|
|
135147
135481
|
const resolvePackage = (packageId)=>{
|
|
135148
135482
|
if (!resolvedByPackage.has(packageId)) resolvedByPackage.set(packageId, installRoot ? resolveFromInstallRootPackageDir(packageId, installRoot) : void 0);
|
|
@@ -135191,7 +135525,7 @@ var __webpack_modules__ = {
|
|
|
135191
135525
|
};
|
|
135192
135526
|
}
|
|
135193
135527
|
async function runInstallAndVerify(input) {
|
|
135194
|
-
const didInstall = await (0,
|
|
135528
|
+
const didInstall = await (0, optional_deps_lib__rspack_import_3.installOptionalDependencies)(input.integration, input.installDependencies);
|
|
135195
135529
|
if (!didInstall) {
|
|
135196
135530
|
const diagnostics = buildDiagnostics({
|
|
135197
135531
|
integration: input.integration,
|
|
@@ -135218,15 +135552,21 @@ var __webpack_modules__ = {
|
|
|
135218
135552
|
}
|
|
135219
135553
|
const missingAfterInstall = getContractVerificationFailuresAtInstallRoot(input.contract, input.installRoot);
|
|
135220
135554
|
if (missingAfterInstall.length > 0) {
|
|
135221
|
-
await (0,
|
|
135555
|
+
await (0, optional_deps_lib__rspack_import_3.installOptionalDependencies)(input.integration, input.installDependencies);
|
|
135222
135556
|
const missingAfterRetry = getContractVerificationFailuresAtInstallRoot(input.contract, input.installRoot);
|
|
135223
135557
|
if (0 === missingAfterRetry.length) return;
|
|
135224
|
-
const
|
|
135558
|
+
const missingIdSet = new Set(missingAfterRetry);
|
|
135559
|
+
const missingSpecs = input.contract.installPackages.filter((spec)=>{
|
|
135560
|
+
const atIdx = spec.lastIndexOf('@');
|
|
135561
|
+
const id = atIdx > 0 ? spec.slice(0, atIdx) : spec;
|
|
135562
|
+
return missingIdSet.has(id);
|
|
135563
|
+
});
|
|
135564
|
+
const didInstallMissingOnly = await (0, optional_deps_lib__rspack_import_3.installOptionalDependencies)(input.integration, missingSpecs.length > 0 ? missingSpecs : missingAfterRetry);
|
|
135225
135565
|
if (didInstallMissingOnly) {
|
|
135226
135566
|
const missingAfterTargetedTopUp = getContractVerificationFailuresAtInstallRoot(input.contract, input.installRoot);
|
|
135227
135567
|
if (0 === missingAfterTargetedTopUp.length) return;
|
|
135228
135568
|
}
|
|
135229
|
-
const didRecoverWithCleanInstall = await (0,
|
|
135569
|
+
const didRecoverWithCleanInstall = await (0, optional_deps_lib__rspack_import_3.installOptionalDependencies)(input.integration, input.contract.installPackages, {
|
|
135230
135570
|
forceRecreateInstallRoot: true
|
|
135231
135571
|
});
|
|
135232
135572
|
if (didRecoverWithCleanInstall) {
|
|
@@ -135246,7 +135586,7 @@ var __webpack_modules__ = {
|
|
|
135246
135586
|
}
|
|
135247
135587
|
}
|
|
135248
135588
|
async function ensureInstalledAndVerified(input) {
|
|
135249
|
-
const installRoot = (0,
|
|
135589
|
+
const installRoot = (0, optional_deps_lib__rspack_import_3.resolveOptionalInstallRoot)();
|
|
135250
135590
|
const key = [
|
|
135251
135591
|
installRoot || 'missing-install-root',
|
|
135252
135592
|
...input.installDependencies.slice().sort()
|
|
@@ -135270,7 +135610,7 @@ var __webpack_modules__ = {
|
|
|
135270
135610
|
}
|
|
135271
135611
|
}
|
|
135272
135612
|
function resolveOptionalDependencySync(dependencyId, projectPath) {
|
|
135273
|
-
const installRoot = (0,
|
|
135613
|
+
const installRoot = (0, optional_deps_lib__rspack_import_3.resolveOptionalInstallRoot)();
|
|
135274
135614
|
const resolved = resolveFromKnownLocations(dependencyId, projectPath, installRoot);
|
|
135275
135615
|
if (resolved) return resolved;
|
|
135276
135616
|
const bases = getResolutionBases(projectPath);
|
|
@@ -135280,7 +135620,7 @@ var __webpack_modules__ = {
|
|
|
135280
135620
|
const contract = getVerificationContract(input);
|
|
135281
135621
|
const installDependencies = contract.installPackages;
|
|
135282
135622
|
const verifyPackageIds = contract.installPackages;
|
|
135283
|
-
const installRoot = (0,
|
|
135623
|
+
const installRoot = (0, optional_deps_lib__rspack_import_3.resolveOptionalInstallRoot)();
|
|
135284
135624
|
const resolvedBeforeInstall = resolveFromKnownLocations(input.dependencyId, input.projectPath, installRoot);
|
|
135285
135625
|
const missingBeforeInstall = getContractVerificationFailuresFromKnownLocations(contract, input.projectPath, installRoot);
|
|
135286
135626
|
if (resolvedBeforeInstall && 0 === missingBeforeInstall.length) return resolvedBeforeInstall;
|
|
@@ -135325,7 +135665,7 @@ var __webpack_modules__ = {
|
|
|
135325
135665
|
const contract = getVerificationContract(input);
|
|
135326
135666
|
const installDependencies = contract.installPackages;
|
|
135327
135667
|
const verifyPackageIds = contract.installPackages;
|
|
135328
|
-
const installRoot = (0,
|
|
135668
|
+
const installRoot = (0, optional_deps_lib__rspack_import_3.resolveOptionalInstallRoot)();
|
|
135329
135669
|
const resolvedFromInstallRoot = installRoot ? resolveFromInstallRootPackageDir(input.dependencyId, installRoot) : void 0;
|
|
135330
135670
|
const missingFromInstallRoot = getContractVerificationFailuresAtInstallRoot(contract, installRoot);
|
|
135331
135671
|
if (resolvedFromInstallRoot && 0 === missingFromInstallRoot.length) return resolvedFromInstallRoot;
|
|
@@ -135380,7 +135720,7 @@ var __webpack_modules__ = {
|
|
|
135380
135720
|
integration: input.integration,
|
|
135381
135721
|
dependencyId: input.dependencyId,
|
|
135382
135722
|
projectPath: input.projectPath,
|
|
135383
|
-
installRoot: (0,
|
|
135723
|
+
installRoot: (0, optional_deps_lib__rspack_import_3.resolveOptionalInstallRoot)(),
|
|
135384
135724
|
installDependencies: input.installDependencies || [
|
|
135385
135725
|
input.dependencyId
|
|
135386
135726
|
],
|
|
@@ -135429,7 +135769,7 @@ var __webpack_modules__ = {
|
|
|
135429
135769
|
return input.moduleAdapter ? input.moduleAdapter(loaded) : loaded;
|
|
135430
135770
|
}
|
|
135431
135771
|
async function ensureOptionalContractPackageResolved(input) {
|
|
135432
|
-
const contract = (0, _optional_deps_contracts__rspack_import_5.
|
|
135772
|
+
const contract = (0, _optional_deps_contracts__rspack_import_5.uw)(input.contractId);
|
|
135433
135773
|
return ensureOptionalPackageResolved({
|
|
135434
135774
|
integration: contract.integration,
|
|
135435
135775
|
projectPath: input.projectPath,
|
|
@@ -135438,7 +135778,7 @@ var __webpack_modules__ = {
|
|
|
135438
135778
|
});
|
|
135439
135779
|
}
|
|
135440
135780
|
async function ensureOptionalContractModuleLoaded(input) {
|
|
135441
|
-
const contract = (0, _optional_deps_contracts__rspack_import_5.
|
|
135781
|
+
const contract = (0, _optional_deps_contracts__rspack_import_5.uw)(input.contractId);
|
|
135442
135782
|
return ensureOptionalModuleLoaded({
|
|
135443
135783
|
integration: contract.integration,
|
|
135444
135784
|
projectPath: input.projectPath,
|
|
@@ -135448,7 +135788,7 @@ var __webpack_modules__ = {
|
|
|
135448
135788
|
});
|
|
135449
135789
|
}
|
|
135450
135790
|
function resolveOptionalContractPackageWithoutInstall(input) {
|
|
135451
|
-
const contract = (0, _optional_deps_contracts__rspack_import_5.
|
|
135791
|
+
const contract = (0, _optional_deps_contracts__rspack_import_5.uw)(input.contractId);
|
|
135452
135792
|
return resolveOptionalPackageWithoutInstall({
|
|
135453
135793
|
integration: contract.integration,
|
|
135454
135794
|
projectPath: input.projectPath,
|
|
@@ -135457,7 +135797,7 @@ var __webpack_modules__ = {
|
|
|
135457
135797
|
});
|
|
135458
135798
|
}
|
|
135459
135799
|
function loadOptionalContractModuleWithoutInstall(input) {
|
|
135460
|
-
const contract = (0, _optional_deps_contracts__rspack_import_5.
|
|
135800
|
+
const contract = (0, _optional_deps_contracts__rspack_import_5.uw)(input.contractId);
|
|
135461
135801
|
return loadOptionalModuleWithoutInstall({
|
|
135462
135802
|
integration: contract.integration,
|
|
135463
135803
|
projectPath: input.projectPath,
|
|
@@ -135467,391 +135807,6 @@ var __webpack_modules__ = {
|
|
|
135467
135807
|
});
|
|
135468
135808
|
}
|
|
135469
135809
|
},
|
|
135470
|
-
"./webpack/webpack-lib/package-json.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
135471
|
-
"use strict";
|
|
135472
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
135473
|
-
Pb: ()=>findNearestPackageJsonSync,
|
|
135474
|
-
cy: ()=>findNearestPackageJson,
|
|
135475
|
-
t7: ()=>validatePackageJson
|
|
135476
|
-
});
|
|
135477
|
-
var path__rspack_import_0 = __webpack_require__("path");
|
|
135478
|
-
var fs__rspack_import_1 = __webpack_require__("fs");
|
|
135479
|
-
async function findUpLocal(filename, options) {
|
|
135480
|
-
const root = path__rspack_import_0.parse(options.cwd).root;
|
|
135481
|
-
let currentDir = options.cwd;
|
|
135482
|
-
while(true){
|
|
135483
|
-
const candidate = path__rspack_import_0.join(currentDir, filename);
|
|
135484
|
-
try {
|
|
135485
|
-
const stat = await fs__rspack_import_1.promises.stat(candidate);
|
|
135486
|
-
if (stat.isFile()) return candidate;
|
|
135487
|
-
} catch {}
|
|
135488
|
-
if (currentDir === root) return;
|
|
135489
|
-
currentDir = path__rspack_import_0.dirname(currentDir);
|
|
135490
|
-
}
|
|
135491
|
-
}
|
|
135492
|
-
function findUpLocalSync(filename, options) {
|
|
135493
|
-
const root = path__rspack_import_0.parse(options.cwd).root;
|
|
135494
|
-
let currentDir = options.cwd;
|
|
135495
|
-
while(true){
|
|
135496
|
-
const candidate = path__rspack_import_0.join(currentDir, filename);
|
|
135497
|
-
try {
|
|
135498
|
-
const stat = fs__rspack_import_1.statSync(candidate);
|
|
135499
|
-
if (stat.isFile()) return candidate;
|
|
135500
|
-
} catch {}
|
|
135501
|
-
if (currentDir === root) return;
|
|
135502
|
-
currentDir = path__rspack_import_0.dirname(currentDir);
|
|
135503
|
-
}
|
|
135504
|
-
}
|
|
135505
|
-
async function findNearestPackageJson(manifestPath) {
|
|
135506
|
-
try {
|
|
135507
|
-
const manifestDir = path__rspack_import_0.dirname(manifestPath);
|
|
135508
|
-
const packageJsonPath = await findUpLocal('package.json', {
|
|
135509
|
-
cwd: manifestDir
|
|
135510
|
-
});
|
|
135511
|
-
return packageJsonPath || null;
|
|
135512
|
-
} catch (error) {
|
|
135513
|
-
console.warn('Failed to find package.json:', error);
|
|
135514
|
-
return null;
|
|
135515
|
-
}
|
|
135516
|
-
}
|
|
135517
|
-
function findNearestPackageJsonSync(manifestPath) {
|
|
135518
|
-
try {
|
|
135519
|
-
const manifestDir = path__rspack_import_0.dirname(manifestPath);
|
|
135520
|
-
const packageJsonPath = findUpLocalSync('package.json', {
|
|
135521
|
-
cwd: manifestDir
|
|
135522
|
-
});
|
|
135523
|
-
return packageJsonPath || null;
|
|
135524
|
-
} catch (error) {
|
|
135525
|
-
console.warn('Failed to find package.json:', error);
|
|
135526
|
-
return null;
|
|
135527
|
-
}
|
|
135528
|
-
}
|
|
135529
|
-
function validatePackageJson(packageJsonPath) {
|
|
135530
|
-
try {
|
|
135531
|
-
if (!fs__rspack_import_1.existsSync(packageJsonPath)) return false;
|
|
135532
|
-
const content = fs__rspack_import_1.readFileSync(packageJsonPath, 'utf-8');
|
|
135533
|
-
JSON.parse(content);
|
|
135534
|
-
return true;
|
|
135535
|
-
} catch (error) {
|
|
135536
|
-
console.warn('Invalid package.json at:', packageJsonPath, error);
|
|
135537
|
-
return false;
|
|
135538
|
-
}
|
|
135539
|
-
}
|
|
135540
|
-
},
|
|
135541
|
-
"./webpack/webpack-lib/package-manager.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
135542
|
-
"use strict";
|
|
135543
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
135544
|
-
Qt: ()=>execInstallCommand,
|
|
135545
|
-
_c: ()=>resolvePackageManager,
|
|
135546
|
-
sX: ()=>buildNpmCliFallback,
|
|
135547
|
-
tj: ()=>buildInstallCommand
|
|
135548
|
-
});
|
|
135549
|
-
var fs__rspack_import_0 = __webpack_require__("fs");
|
|
135550
|
-
var path__rspack_import_1 = __webpack_require__("path");
|
|
135551
|
-
var child_process__rspack_import_2 = __webpack_require__("child_process");
|
|
135552
|
-
var module__rspack_import_3 = __webpack_require__("module");
|
|
135553
|
-
const require1 = (0, module__rspack_import_3.createRequire)(__rslib_import_meta_url__);
|
|
135554
|
-
function normalizePackageManager(value) {
|
|
135555
|
-
if (!value) return;
|
|
135556
|
-
const lower = value.toLowerCase().trim();
|
|
135557
|
-
if ('pnpm' === lower) return 'pnpm';
|
|
135558
|
-
if ('yarn' === lower) return 'yarn';
|
|
135559
|
-
if ('bun' === lower) return 'bun';
|
|
135560
|
-
if ('npm' === lower) return 'npm';
|
|
135561
|
-
}
|
|
135562
|
-
function inferPackageManagerFromPath(value) {
|
|
135563
|
-
if (!value) return;
|
|
135564
|
-
const lower = value.toLowerCase();
|
|
135565
|
-
if (lower.includes('pnpm')) return 'pnpm';
|
|
135566
|
-
if (lower.includes('yarn')) return 'yarn';
|
|
135567
|
-
if (lower.includes('bun')) return 'bun';
|
|
135568
|
-
if (lower.includes('npm')) return 'npm';
|
|
135569
|
-
}
|
|
135570
|
-
function getPackageManagerOverride() {
|
|
135571
|
-
const name = normalizePackageManager(process.env.EXTENSION_JS_PACKAGE_MANAGER);
|
|
135572
|
-
const execPath = process.env.EXTENSION_JS_PM_EXEC_PATH || process.env.npm_execpath || process.env.NPM_EXEC_PATH;
|
|
135573
|
-
if (!name && !execPath) return;
|
|
135574
|
-
const inferredName = name || inferPackageManagerFromPath(execPath) || 'npm';
|
|
135575
|
-
return {
|
|
135576
|
-
name: inferredName,
|
|
135577
|
-
execPath
|
|
135578
|
-
};
|
|
135579
|
-
}
|
|
135580
|
-
function detectPackageManagerFromEnv() {
|
|
135581
|
-
const userAgent = process.env.npm_config_user_agent || '';
|
|
135582
|
-
const execPath = process.env.npm_execpath || process.env.NPM_EXEC_PATH || '';
|
|
135583
|
-
if (userAgent.includes('pnpm')) return {
|
|
135584
|
-
name: 'pnpm',
|
|
135585
|
-
execPath: execPath || void 0
|
|
135586
|
-
};
|
|
135587
|
-
if (userAgent.includes('yarn')) return {
|
|
135588
|
-
name: 'yarn',
|
|
135589
|
-
execPath: execPath || void 0
|
|
135590
|
-
};
|
|
135591
|
-
if (userAgent.includes('bun')) return {
|
|
135592
|
-
name: 'bun',
|
|
135593
|
-
execPath: execPath || void 0
|
|
135594
|
-
};
|
|
135595
|
-
if (userAgent.includes('npm')) return {
|
|
135596
|
-
name: 'npm',
|
|
135597
|
-
execPath: execPath || void 0
|
|
135598
|
-
};
|
|
135599
|
-
if (execPath) {
|
|
135600
|
-
const inferred = inferPackageManagerFromPath(execPath) || 'npm';
|
|
135601
|
-
return {
|
|
135602
|
-
name: inferred,
|
|
135603
|
-
execPath
|
|
135604
|
-
};
|
|
135605
|
-
}
|
|
135606
|
-
}
|
|
135607
|
-
function resolveNpmCliFromNode(execPath) {
|
|
135608
|
-
const execDir = path__rspack_import_1.dirname(execPath);
|
|
135609
|
-
const candidates = [
|
|
135610
|
-
path__rspack_import_1.join(execDir, 'node_modules', 'npm', 'bin', 'npm-cli.js'),
|
|
135611
|
-
path__rspack_import_1.join(execDir, '..', 'lib', 'node_modules', 'npm', 'bin', 'npm-cli.js'),
|
|
135612
|
-
path__rspack_import_1.join(execDir, '..', 'node_modules', 'npm', 'bin', 'npm-cli.js')
|
|
135613
|
-
];
|
|
135614
|
-
for (const candidate of candidates)if (fs__rspack_import_0.existsSync(candidate)) return candidate;
|
|
135615
|
-
}
|
|
135616
|
-
function resolveBundledNpmCliPath() {
|
|
135617
|
-
if (process.env.EXTENSION_JS_PM_EXEC_PATH) {
|
|
135618
|
-
const overridePath = process.env.EXTENSION_JS_PM_EXEC_PATH;
|
|
135619
|
-
if (overridePath && fs__rspack_import_0.existsSync(overridePath)) return overridePath;
|
|
135620
|
-
}
|
|
135621
|
-
try {
|
|
135622
|
-
const resolved = require1.resolve('npm/bin/npm-cli.js', {
|
|
135623
|
-
paths: [
|
|
135624
|
-
process.cwd(),
|
|
135625
|
-
__dirname
|
|
135626
|
-
]
|
|
135627
|
-
});
|
|
135628
|
-
if (resolved && fs__rspack_import_0.existsSync(resolved)) return resolved;
|
|
135629
|
-
} catch {}
|
|
135630
|
-
return resolveNpmCliFromNode(process.execPath);
|
|
135631
|
-
}
|
|
135632
|
-
function isWindowsExecutablePath(value) {
|
|
135633
|
-
if (!value || 'win32' !== process.platform) return false;
|
|
135634
|
-
return /\.(cmd|bat|exe)$/i.test(value);
|
|
135635
|
-
}
|
|
135636
|
-
function isNodeScriptPath(value) {
|
|
135637
|
-
if (!value) return false;
|
|
135638
|
-
return /\.(mjs|cjs|js)$/i.test(value);
|
|
135639
|
-
}
|
|
135640
|
-
function resolveWindowsCommandPath(command) {
|
|
135641
|
-
if ('win32' !== process.platform) return;
|
|
135642
|
-
try {
|
|
135643
|
-
const systemRoot = process.env.SystemRoot || 'C:\\Windows';
|
|
135644
|
-
const whereExe = path__rspack_import_1.join(systemRoot, 'System32', 'where.exe');
|
|
135645
|
-
const whereCommand = fs__rspack_import_0.existsSync(whereExe) ? whereExe : 'where';
|
|
135646
|
-
const output = (0, child_process__rspack_import_2.execFileSync)(whereCommand, [
|
|
135647
|
-
command
|
|
135648
|
-
], {
|
|
135649
|
-
encoding: 'utf8',
|
|
135650
|
-
stdio: [
|
|
135651
|
-
'ignore',
|
|
135652
|
-
'pipe',
|
|
135653
|
-
'ignore'
|
|
135654
|
-
],
|
|
135655
|
-
windowsHide: true
|
|
135656
|
-
});
|
|
135657
|
-
const candidates = String(output).split(/\r?\n/).map((line)=>line.trim()).filter(Boolean);
|
|
135658
|
-
const cmdMatch = candidates.find((line)=>/\.cmd$/i.test(line));
|
|
135659
|
-
return cmdMatch || candidates[0];
|
|
135660
|
-
} catch {
|
|
135661
|
-
return;
|
|
135662
|
-
}
|
|
135663
|
-
}
|
|
135664
|
-
function resolveUnixCommandPath(command) {
|
|
135665
|
-
if ('win32' === process.platform) return;
|
|
135666
|
-
try {
|
|
135667
|
-
const output = (0, child_process__rspack_import_2.execFileSync)('which', [
|
|
135668
|
-
command
|
|
135669
|
-
], {
|
|
135670
|
-
encoding: 'utf8',
|
|
135671
|
-
stdio: [
|
|
135672
|
-
'ignore',
|
|
135673
|
-
'pipe',
|
|
135674
|
-
'ignore'
|
|
135675
|
-
]
|
|
135676
|
-
});
|
|
135677
|
-
const candidate = String(output).trim();
|
|
135678
|
-
return candidate || void 0;
|
|
135679
|
-
} catch {
|
|
135680
|
-
return;
|
|
135681
|
-
}
|
|
135682
|
-
}
|
|
135683
|
-
function resolveCommandOnPath(command) {
|
|
135684
|
-
return resolveWindowsCommandPath(command) || resolveUnixCommandPath(command) || void 0;
|
|
135685
|
-
}
|
|
135686
|
-
function canRunCorepack() {
|
|
135687
|
-
try {
|
|
135688
|
-
const fallback = require1('child_process');
|
|
135689
|
-
const spawnSync = child_process__rspack_import_2.spawnSync?.mock !== void 0 ? child_process__rspack_import_2.spawnSync : fallback.spawnSync || child_process__rspack_import_2.spawnSync;
|
|
135690
|
-
const result = spawnSync('corepack', [
|
|
135691
|
-
'--version'
|
|
135692
|
-
], {
|
|
135693
|
-
stdio: 'ignore',
|
|
135694
|
-
windowsHide: true
|
|
135695
|
-
});
|
|
135696
|
-
return result?.status === 0;
|
|
135697
|
-
} catch {
|
|
135698
|
-
return false;
|
|
135699
|
-
}
|
|
135700
|
-
}
|
|
135701
|
-
function detectByLockfile(cwd) {
|
|
135702
|
-
if (!cwd) return;
|
|
135703
|
-
const hasPnpmLock = fs__rspack_import_0.existsSync(path__rspack_import_1.join(cwd, 'pnpm-lock.yaml'));
|
|
135704
|
-
const hasYarnLock = fs__rspack_import_0.existsSync(path__rspack_import_1.join(cwd, 'yarn.lock'));
|
|
135705
|
-
const hasNpmLock = fs__rspack_import_0.existsSync(path__rspack_import_1.join(cwd, 'package-lock.json'));
|
|
135706
|
-
if (hasPnpmLock) return 'pnpm';
|
|
135707
|
-
if (hasYarnLock) return 'yarn';
|
|
135708
|
-
if (hasNpmLock) return 'npm';
|
|
135709
|
-
}
|
|
135710
|
-
function hydrateResolvedPackageManager(name) {
|
|
135711
|
-
const resolvedCommand = resolveCommandOnPath(name);
|
|
135712
|
-
if (resolvedCommand) return {
|
|
135713
|
-
name,
|
|
135714
|
-
execPath: resolvedCommand
|
|
135715
|
-
};
|
|
135716
|
-
if ('npm' === name) {
|
|
135717
|
-
const bundledNpmCli = resolveBundledNpmCliPath();
|
|
135718
|
-
if (bundledNpmCli) return {
|
|
135719
|
-
name: 'npm',
|
|
135720
|
-
execPath: bundledNpmCli,
|
|
135721
|
-
runnerCommand: process.execPath,
|
|
135722
|
-
runnerArgs: [
|
|
135723
|
-
bundledNpmCli
|
|
135724
|
-
]
|
|
135725
|
-
};
|
|
135726
|
-
}
|
|
135727
|
-
}
|
|
135728
|
-
function resolvePackageManager(opts) {
|
|
135729
|
-
const lockPm = detectByLockfile(opts?.cwd);
|
|
135730
|
-
if (lockPm) {
|
|
135731
|
-
const hydrated = hydrateResolvedPackageManager(lockPm);
|
|
135732
|
-
if (hydrated) return hydrated;
|
|
135733
|
-
return {
|
|
135734
|
-
name: lockPm
|
|
135735
|
-
};
|
|
135736
|
-
}
|
|
135737
|
-
const override = getPackageManagerOverride();
|
|
135738
|
-
if (override) return override;
|
|
135739
|
-
const envPm = detectPackageManagerFromEnv();
|
|
135740
|
-
if (envPm) return envPm;
|
|
135741
|
-
const candidates = [
|
|
135742
|
-
'pnpm',
|
|
135743
|
-
'yarn',
|
|
135744
|
-
'bun'
|
|
135745
|
-
];
|
|
135746
|
-
for (const candidate of candidates){
|
|
135747
|
-
const resolved = resolveCommandOnPath(candidate);
|
|
135748
|
-
if (resolved) return {
|
|
135749
|
-
name: candidate,
|
|
135750
|
-
execPath: resolved
|
|
135751
|
-
};
|
|
135752
|
-
}
|
|
135753
|
-
const corepackPath = resolveCommandOnPath('corepack');
|
|
135754
|
-
if (corepackPath || canRunCorepack()) return {
|
|
135755
|
-
name: 'pnpm',
|
|
135756
|
-
runnerCommand: corepackPath || 'corepack',
|
|
135757
|
-
runnerArgs: [
|
|
135758
|
-
'pnpm'
|
|
135759
|
-
]
|
|
135760
|
-
};
|
|
135761
|
-
const bundledNpmCli = resolveBundledNpmCliPath();
|
|
135762
|
-
if (bundledNpmCli) return {
|
|
135763
|
-
name: 'npm',
|
|
135764
|
-
execPath: bundledNpmCli,
|
|
135765
|
-
runnerCommand: process.execPath,
|
|
135766
|
-
runnerArgs: [
|
|
135767
|
-
bundledNpmCli
|
|
135768
|
-
]
|
|
135769
|
-
};
|
|
135770
|
-
return {
|
|
135771
|
-
name: 'npm'
|
|
135772
|
-
};
|
|
135773
|
-
}
|
|
135774
|
-
function buildExecEnv() {
|
|
135775
|
-
if ('win32' !== process.platform) return;
|
|
135776
|
-
const nodeDir = path__rspack_import_1.dirname(process.execPath);
|
|
135777
|
-
const pathSep = path__rspack_import_1.delimiter;
|
|
135778
|
-
const existing = process.env.PATH || process.env.Path || '';
|
|
135779
|
-
if (existing.includes(nodeDir)) return;
|
|
135780
|
-
return {
|
|
135781
|
-
...process.env,
|
|
135782
|
-
PATH: `${nodeDir}${pathSep}${existing}`.trim(),
|
|
135783
|
-
Path: `${nodeDir}${pathSep}${existing}`.trim()
|
|
135784
|
-
};
|
|
135785
|
-
}
|
|
135786
|
-
function buildInstallCommand(pm, args) {
|
|
135787
|
-
if (pm.runnerCommand) return {
|
|
135788
|
-
command: pm.runnerCommand,
|
|
135789
|
-
args: [
|
|
135790
|
-
...pm.runnerArgs || [],
|
|
135791
|
-
...args
|
|
135792
|
-
]
|
|
135793
|
-
};
|
|
135794
|
-
if (pm.execPath) {
|
|
135795
|
-
if (isWindowsExecutablePath(pm.execPath)) return {
|
|
135796
|
-
command: pm.execPath,
|
|
135797
|
-
args
|
|
135798
|
-
};
|
|
135799
|
-
if (isNodeScriptPath(pm.execPath)) return {
|
|
135800
|
-
command: process.execPath,
|
|
135801
|
-
args: [
|
|
135802
|
-
pm.execPath,
|
|
135803
|
-
...args
|
|
135804
|
-
]
|
|
135805
|
-
};
|
|
135806
|
-
return {
|
|
135807
|
-
command: pm.execPath,
|
|
135808
|
-
args
|
|
135809
|
-
};
|
|
135810
|
-
}
|
|
135811
|
-
return {
|
|
135812
|
-
command: pm.name,
|
|
135813
|
-
args
|
|
135814
|
-
};
|
|
135815
|
-
}
|
|
135816
|
-
function buildNpmCliFallback(args) {
|
|
135817
|
-
const npmCli = resolveBundledNpmCliPath();
|
|
135818
|
-
if (!npmCli) return;
|
|
135819
|
-
return {
|
|
135820
|
-
command: process.execPath,
|
|
135821
|
-
args: [
|
|
135822
|
-
npmCli,
|
|
135823
|
-
...args
|
|
135824
|
-
]
|
|
135825
|
-
};
|
|
135826
|
-
}
|
|
135827
|
-
function buildSpawnInvocation(command, args) {
|
|
135828
|
-
return {
|
|
135829
|
-
command,
|
|
135830
|
-
args
|
|
135831
|
-
};
|
|
135832
|
-
}
|
|
135833
|
-
function execInstallCommand(command, args, options) {
|
|
135834
|
-
const invocation = buildSpawnInvocation(command, args);
|
|
135835
|
-
const env = buildExecEnv();
|
|
135836
|
-
const stdio = options?.stdio ?? 'ignore';
|
|
135837
|
-
const useShell = 'win32' === process.platform && /\.(cmd|bat)$/i.test(invocation.command);
|
|
135838
|
-
return new Promise((resolve, reject)=>{
|
|
135839
|
-
const child = (0, child_process__rspack_import_2.spawn)(invocation.command, invocation.args, {
|
|
135840
|
-
cwd: options?.cwd,
|
|
135841
|
-
stdio,
|
|
135842
|
-
env: env || process.env,
|
|
135843
|
-
...useShell ? {
|
|
135844
|
-
shell: true
|
|
135845
|
-
} : {}
|
|
135846
|
-
});
|
|
135847
|
-
child.on('close', (code)=>{
|
|
135848
|
-
if (0 !== code) reject(new Error(`Install failed with exit code ${code}`));
|
|
135849
|
-
else resolve();
|
|
135850
|
-
});
|
|
135851
|
-
child.on('error', (error)=>reject(error));
|
|
135852
|
-
});
|
|
135853
|
-
}
|
|
135854
|
-
},
|
|
135855
135810
|
"./webpack/webpack-lib/paths.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
135856
135811
|
"use strict";
|
|
135857
135812
|
__webpack_require__.d(__webpack_exports__, {
|
|
@@ -136057,6 +136012,10 @@ var __webpack_modules__ = {
|
|
|
136057
136012
|
"use strict";
|
|
136058
136013
|
module.exports = require("node:module");
|
|
136059
136014
|
},
|
|
136015
|
+
"optional-deps-lib" (module) {
|
|
136016
|
+
"use strict";
|
|
136017
|
+
module.exports = require("optional-deps-lib");
|
|
136018
|
+
},
|
|
136060
136019
|
os (module) {
|
|
136061
136020
|
"use strict";
|
|
136062
136021
|
module.exports = require("os");
|
|
@@ -136103,7 +136062,7 @@ var __webpack_modules__ = {
|
|
|
136103
136062
|
},
|
|
136104
136063
|
"./package.json" (module) {
|
|
136105
136064
|
"use strict";
|
|
136106
|
-
module.exports = JSON.parse('{"rE":"3.10.
|
|
136065
|
+
module.exports = JSON.parse('{"rE":"3.10.4-canary.1","El":{"@rspack/core":"^1.7.5","@rspack/dev-server":"^1.2.1","@swc/core":"^1.15.8","@swc/helpers":"^0.5.18","adm-zip":"^0.5.16","browser-extension-manifest-fields":"^2.2.1","case-sensitive-paths-webpack-plugin":"^2.4.0","chrome-location2":"4.0.0","chromium-location":"2.0.0","content-security-policy-parser":"^0.6.0","cross-spawn":"^7.0.6","dotenv":"^17.2.3","edge-location":"2.2.0","extension-from-store":"^0.1.1","firefox-location2":"3.0.0","go-git-it":"^5.1.1","ignore":"^7.0.5","loader-utils":"^3.3.1","magic-string":"^0.30.21","optional-deps-lib":"0.1.1","parse5":"^8.0.0","parse5-utilities":"^1.0.0","pintor":"0.3.0","schema-utils":"^4.3.3","tiny-glob":"^0.2.9","unique-names-generator":"^4.7.1","webextension-polyfill":"^0.12.0","webpack-merge":"^6.0.1","webpack-target-webextension":"^2.1.3","ws":"^8.19.0"}}');
|
|
136107
136066
|
}
|
|
136108
136067
|
};
|
|
136109
136068
|
var __webpack_module_cache__ = {};
|
|
@@ -136198,7 +136157,42 @@ var __webpack_exports__ = {};
|
|
|
136198
136157
|
var external_path_ = __webpack_require__("path");
|
|
136199
136158
|
var external_fs_ = __webpack_require__("fs");
|
|
136200
136159
|
var messages = __webpack_require__("./webpack/webpack-lib/messages.ts");
|
|
136201
|
-
|
|
136160
|
+
async function findUpLocal(filename, options) {
|
|
136161
|
+
const root = external_path_.parse(options.cwd).root;
|
|
136162
|
+
let currentDir = options.cwd;
|
|
136163
|
+
while(true){
|
|
136164
|
+
const candidate = external_path_.join(currentDir, filename);
|
|
136165
|
+
try {
|
|
136166
|
+
const stat = await external_fs_.promises.stat(candidate);
|
|
136167
|
+
if (stat.isFile()) return candidate;
|
|
136168
|
+
} catch {}
|
|
136169
|
+
if (currentDir === root) return;
|
|
136170
|
+
currentDir = external_path_.dirname(currentDir);
|
|
136171
|
+
}
|
|
136172
|
+
}
|
|
136173
|
+
async function findNearestPackageJson(manifestPath) {
|
|
136174
|
+
try {
|
|
136175
|
+
const manifestDir = external_path_.dirname(manifestPath);
|
|
136176
|
+
const packageJsonPath = await findUpLocal('package.json', {
|
|
136177
|
+
cwd: manifestDir
|
|
136178
|
+
});
|
|
136179
|
+
return packageJsonPath || null;
|
|
136180
|
+
} catch (error) {
|
|
136181
|
+
console.warn('Failed to find package.json:', error);
|
|
136182
|
+
return null;
|
|
136183
|
+
}
|
|
136184
|
+
}
|
|
136185
|
+
function validatePackageJson(packageJsonPath) {
|
|
136186
|
+
try {
|
|
136187
|
+
if (!external_fs_.existsSync(packageJsonPath)) return false;
|
|
136188
|
+
const content = external_fs_.readFileSync(packageJsonPath, 'utf-8');
|
|
136189
|
+
JSON.parse(content);
|
|
136190
|
+
return true;
|
|
136191
|
+
} catch (error) {
|
|
136192
|
+
console.warn('Invalid package.json at:', packageJsonPath, error);
|
|
136193
|
+
return false;
|
|
136194
|
+
}
|
|
136195
|
+
}
|
|
136202
136196
|
const isUrl = (url)=>{
|
|
136203
136197
|
try {
|
|
136204
136198
|
new URL(url);
|
|
@@ -136326,7 +136320,7 @@ var __webpack_exports__ = {};
|
|
|
136326
136320
|
const rel = external_path_.relative(baseDir, candidatePath);
|
|
136327
136321
|
return Boolean(rel && !rel.startsWith('..') && !external_path_.isAbsolute(rel));
|
|
136328
136322
|
};
|
|
136329
|
-
const packageJsonPathFromProject = await (
|
|
136323
|
+
const packageJsonPathFromProject = await findNearestPackageJson(external_path_.join(projectPath, 'manifest.json'));
|
|
136330
136324
|
const packageJsonDirFromProject = packageJsonPathFromProject ? external_path_.dirname(packageJsonPathFromProject) : void 0;
|
|
136331
136325
|
const rootManifestPath = external_path_.join(projectPath, 'manifest.json');
|
|
136332
136326
|
const srcManifestPath = external_path_.join(projectPath, 'src', 'manifest.json');
|
|
@@ -136350,7 +136344,7 @@ var __webpack_exports__ = {};
|
|
|
136350
136344
|
if (foundManifest) manifestPath = foundManifest;
|
|
136351
136345
|
else throw new Error(messages.dx(manifestPath));
|
|
136352
136346
|
}
|
|
136353
|
-
const packageJsonPath = await (
|
|
136347
|
+
const packageJsonPath = await findNearestPackageJson(manifestPath);
|
|
136354
136348
|
const packageJsonDir = packageJsonPath ? external_path_.dirname(packageJsonPath) : void 0;
|
|
136355
136349
|
if (packageJsonDir) {
|
|
136356
136350
|
const publicRoot = external_path_.join(packageJsonDir, 'public');
|
|
@@ -136362,7 +136356,7 @@ var __webpack_exports__ = {};
|
|
|
136362
136356
|
else throw new Error(messages.dx(fallbackRoot));
|
|
136363
136357
|
}
|
|
136364
136358
|
}
|
|
136365
|
-
if (!packageJsonPath || !(
|
|
136359
|
+
if (!packageJsonPath || !validatePackageJson(packageJsonPath)) return {
|
|
136366
136360
|
manifestPath
|
|
136367
136361
|
};
|
|
136368
136362
|
return {
|
|
@@ -136404,7 +136398,297 @@ var __webpack_exports__ = {};
|
|
|
136404
136398
|
}
|
|
136405
136399
|
var paths = __webpack_require__("./webpack/webpack-lib/paths.ts");
|
|
136406
136400
|
var check_build_dependencies = __webpack_require__("./webpack/webpack-lib/check-build-dependencies.ts");
|
|
136407
|
-
var
|
|
136401
|
+
var external_child_process_ = __webpack_require__("child_process");
|
|
136402
|
+
const package_manager_require = (0, external_module_.createRequire)(__rslib_import_meta_url__);
|
|
136403
|
+
function normalizePackageManager(value) {
|
|
136404
|
+
if (!value) return;
|
|
136405
|
+
const lower = value.toLowerCase().trim();
|
|
136406
|
+
if ('pnpm' === lower) return 'pnpm';
|
|
136407
|
+
if ('yarn' === lower) return 'yarn';
|
|
136408
|
+
if ('bun' === lower) return 'bun';
|
|
136409
|
+
if ('npm' === lower) return 'npm';
|
|
136410
|
+
}
|
|
136411
|
+
function inferPackageManagerFromPath(value) {
|
|
136412
|
+
if (!value) return;
|
|
136413
|
+
const lower = value.toLowerCase();
|
|
136414
|
+
if (lower.includes('pnpm')) return 'pnpm';
|
|
136415
|
+
if (lower.includes('yarn')) return 'yarn';
|
|
136416
|
+
if (lower.includes('bun')) return 'bun';
|
|
136417
|
+
if (lower.includes('npm')) return 'npm';
|
|
136418
|
+
}
|
|
136419
|
+
function getPackageManagerOverride() {
|
|
136420
|
+
const name = normalizePackageManager(process.env.EXTENSION_JS_PACKAGE_MANAGER);
|
|
136421
|
+
const execPath = process.env.EXTENSION_JS_PM_EXEC_PATH || process.env.npm_execpath || process.env.NPM_EXEC_PATH;
|
|
136422
|
+
if (!name && !execPath) return;
|
|
136423
|
+
const inferredName = name || inferPackageManagerFromPath(execPath) || 'npm';
|
|
136424
|
+
return {
|
|
136425
|
+
name: inferredName,
|
|
136426
|
+
execPath
|
|
136427
|
+
};
|
|
136428
|
+
}
|
|
136429
|
+
function detectPackageManagerFromEnv() {
|
|
136430
|
+
const userAgent = process.env.npm_config_user_agent || '';
|
|
136431
|
+
const execPath = process.env.npm_execpath || process.env.NPM_EXEC_PATH || '';
|
|
136432
|
+
if (userAgent.includes('pnpm')) return {
|
|
136433
|
+
name: 'pnpm',
|
|
136434
|
+
execPath: execPath || void 0
|
|
136435
|
+
};
|
|
136436
|
+
if (userAgent.includes('yarn')) return {
|
|
136437
|
+
name: 'yarn',
|
|
136438
|
+
execPath: execPath || void 0
|
|
136439
|
+
};
|
|
136440
|
+
if (userAgent.includes('bun')) return {
|
|
136441
|
+
name: 'bun',
|
|
136442
|
+
execPath: execPath || void 0
|
|
136443
|
+
};
|
|
136444
|
+
if (userAgent.includes('npm')) return {
|
|
136445
|
+
name: 'npm',
|
|
136446
|
+
execPath: execPath || void 0
|
|
136447
|
+
};
|
|
136448
|
+
if (execPath) {
|
|
136449
|
+
const inferred = inferPackageManagerFromPath(execPath) || 'npm';
|
|
136450
|
+
return {
|
|
136451
|
+
name: inferred,
|
|
136452
|
+
execPath
|
|
136453
|
+
};
|
|
136454
|
+
}
|
|
136455
|
+
}
|
|
136456
|
+
function resolveNpmCliFromNode(execPath) {
|
|
136457
|
+
const execDir = external_path_.dirname(execPath);
|
|
136458
|
+
const candidates = [
|
|
136459
|
+
external_path_.join(execDir, 'node_modules', 'npm', 'bin', 'npm-cli.js'),
|
|
136460
|
+
external_path_.join(execDir, '..', 'lib', 'node_modules', 'npm', 'bin', 'npm-cli.js'),
|
|
136461
|
+
external_path_.join(execDir, '..', 'node_modules', 'npm', 'bin', 'npm-cli.js')
|
|
136462
|
+
];
|
|
136463
|
+
for (const candidate of candidates)if (external_fs_.existsSync(candidate)) return candidate;
|
|
136464
|
+
}
|
|
136465
|
+
function resolveBundledNpmCliPath() {
|
|
136466
|
+
if (process.env.EXTENSION_JS_PM_EXEC_PATH) {
|
|
136467
|
+
const overridePath = process.env.EXTENSION_JS_PM_EXEC_PATH;
|
|
136468
|
+
if (overridePath && external_fs_.existsSync(overridePath)) return overridePath;
|
|
136469
|
+
}
|
|
136470
|
+
try {
|
|
136471
|
+
const resolved = package_manager_require.resolve('npm/bin/npm-cli.js', {
|
|
136472
|
+
paths: [
|
|
136473
|
+
process.cwd(),
|
|
136474
|
+
__dirname
|
|
136475
|
+
]
|
|
136476
|
+
});
|
|
136477
|
+
if (resolved && external_fs_.existsSync(resolved)) return resolved;
|
|
136478
|
+
} catch {}
|
|
136479
|
+
return resolveNpmCliFromNode(process.execPath);
|
|
136480
|
+
}
|
|
136481
|
+
function isWindowsExecutablePath(value) {
|
|
136482
|
+
if (!value || 'win32' !== process.platform) return false;
|
|
136483
|
+
return /\.(cmd|bat|exe)$/i.test(value);
|
|
136484
|
+
}
|
|
136485
|
+
function isNodeScriptPath(value) {
|
|
136486
|
+
if (!value) return false;
|
|
136487
|
+
return /\.(mjs|cjs|js)$/i.test(value);
|
|
136488
|
+
}
|
|
136489
|
+
function resolveWindowsCommandPath(command) {
|
|
136490
|
+
if ('win32' !== process.platform) return;
|
|
136491
|
+
try {
|
|
136492
|
+
const systemRoot = process.env.SystemRoot || 'C:\\Windows';
|
|
136493
|
+
const whereExe = external_path_.join(systemRoot, 'System32', 'where.exe');
|
|
136494
|
+
const whereCommand = external_fs_.existsSync(whereExe) ? whereExe : 'where';
|
|
136495
|
+
const output = (0, external_child_process_.execFileSync)(whereCommand, [
|
|
136496
|
+
command
|
|
136497
|
+
], {
|
|
136498
|
+
encoding: 'utf8',
|
|
136499
|
+
stdio: [
|
|
136500
|
+
'ignore',
|
|
136501
|
+
'pipe',
|
|
136502
|
+
'ignore'
|
|
136503
|
+
],
|
|
136504
|
+
windowsHide: true
|
|
136505
|
+
});
|
|
136506
|
+
const candidates = String(output).split(/\r?\n/).map((line)=>line.trim()).filter(Boolean);
|
|
136507
|
+
const cmdMatch = candidates.find((line)=>/\.cmd$/i.test(line));
|
|
136508
|
+
return cmdMatch || candidates[0];
|
|
136509
|
+
} catch {
|
|
136510
|
+
return;
|
|
136511
|
+
}
|
|
136512
|
+
}
|
|
136513
|
+
function resolveUnixCommandPath(command) {
|
|
136514
|
+
if ('win32' === process.platform) return;
|
|
136515
|
+
try {
|
|
136516
|
+
const output = (0, external_child_process_.execFileSync)('which', [
|
|
136517
|
+
command
|
|
136518
|
+
], {
|
|
136519
|
+
encoding: 'utf8',
|
|
136520
|
+
stdio: [
|
|
136521
|
+
'ignore',
|
|
136522
|
+
'pipe',
|
|
136523
|
+
'ignore'
|
|
136524
|
+
]
|
|
136525
|
+
});
|
|
136526
|
+
const candidate = String(output).trim();
|
|
136527
|
+
return candidate || void 0;
|
|
136528
|
+
} catch {
|
|
136529
|
+
return;
|
|
136530
|
+
}
|
|
136531
|
+
}
|
|
136532
|
+
function resolveCommandOnPath(command) {
|
|
136533
|
+
return resolveWindowsCommandPath(command) || resolveUnixCommandPath(command) || void 0;
|
|
136534
|
+
}
|
|
136535
|
+
function canRunCorepack() {
|
|
136536
|
+
try {
|
|
136537
|
+
const fallback = package_manager_require('child_process');
|
|
136538
|
+
const spawnSync = external_child_process_.spawnSync?.mock !== void 0 ? external_child_process_.spawnSync : fallback.spawnSync || external_child_process_.spawnSync;
|
|
136539
|
+
const result = spawnSync('corepack', [
|
|
136540
|
+
'--version'
|
|
136541
|
+
], {
|
|
136542
|
+
stdio: 'ignore',
|
|
136543
|
+
windowsHide: true
|
|
136544
|
+
});
|
|
136545
|
+
return result?.status === 0;
|
|
136546
|
+
} catch {
|
|
136547
|
+
return false;
|
|
136548
|
+
}
|
|
136549
|
+
}
|
|
136550
|
+
function detectByLockfile(cwd) {
|
|
136551
|
+
if (!cwd) return;
|
|
136552
|
+
const hasPnpmLock = external_fs_.existsSync(external_path_.join(cwd, 'pnpm-lock.yaml'));
|
|
136553
|
+
const hasYarnLock = external_fs_.existsSync(external_path_.join(cwd, 'yarn.lock'));
|
|
136554
|
+
const hasNpmLock = external_fs_.existsSync(external_path_.join(cwd, 'package-lock.json'));
|
|
136555
|
+
if (hasPnpmLock) return 'pnpm';
|
|
136556
|
+
if (hasYarnLock) return 'yarn';
|
|
136557
|
+
if (hasNpmLock) return 'npm';
|
|
136558
|
+
}
|
|
136559
|
+
function hydrateResolvedPackageManager(name) {
|
|
136560
|
+
const resolvedCommand = resolveCommandOnPath(name);
|
|
136561
|
+
if (resolvedCommand) return {
|
|
136562
|
+
name,
|
|
136563
|
+
execPath: resolvedCommand
|
|
136564
|
+
};
|
|
136565
|
+
if ('npm' === name) {
|
|
136566
|
+
const bundledNpmCli = resolveBundledNpmCliPath();
|
|
136567
|
+
if (bundledNpmCli) return {
|
|
136568
|
+
name: 'npm',
|
|
136569
|
+
execPath: bundledNpmCli,
|
|
136570
|
+
runnerCommand: process.execPath,
|
|
136571
|
+
runnerArgs: [
|
|
136572
|
+
bundledNpmCli
|
|
136573
|
+
]
|
|
136574
|
+
};
|
|
136575
|
+
}
|
|
136576
|
+
}
|
|
136577
|
+
function package_manager_resolvePackageManager(opts) {
|
|
136578
|
+
const lockPm = detectByLockfile(opts?.cwd);
|
|
136579
|
+
if (lockPm) {
|
|
136580
|
+
const hydrated = hydrateResolvedPackageManager(lockPm);
|
|
136581
|
+
if (hydrated) return hydrated;
|
|
136582
|
+
return {
|
|
136583
|
+
name: lockPm
|
|
136584
|
+
};
|
|
136585
|
+
}
|
|
136586
|
+
const override = getPackageManagerOverride();
|
|
136587
|
+
if (override) return override;
|
|
136588
|
+
const envPm = detectPackageManagerFromEnv();
|
|
136589
|
+
if (envPm) return envPm;
|
|
136590
|
+
const candidates = [
|
|
136591
|
+
'pnpm',
|
|
136592
|
+
'yarn',
|
|
136593
|
+
'bun'
|
|
136594
|
+
];
|
|
136595
|
+
for (const candidate of candidates){
|
|
136596
|
+
const resolved = resolveCommandOnPath(candidate);
|
|
136597
|
+
if (resolved) return {
|
|
136598
|
+
name: candidate,
|
|
136599
|
+
execPath: resolved
|
|
136600
|
+
};
|
|
136601
|
+
}
|
|
136602
|
+
const corepackPath = resolveCommandOnPath('corepack');
|
|
136603
|
+
if (corepackPath || canRunCorepack()) return {
|
|
136604
|
+
name: 'pnpm',
|
|
136605
|
+
runnerCommand: corepackPath || 'corepack',
|
|
136606
|
+
runnerArgs: [
|
|
136607
|
+
'pnpm'
|
|
136608
|
+
]
|
|
136609
|
+
};
|
|
136610
|
+
const bundledNpmCli = resolveBundledNpmCliPath();
|
|
136611
|
+
if (bundledNpmCli) return {
|
|
136612
|
+
name: 'npm',
|
|
136613
|
+
execPath: bundledNpmCli,
|
|
136614
|
+
runnerCommand: process.execPath,
|
|
136615
|
+
runnerArgs: [
|
|
136616
|
+
bundledNpmCli
|
|
136617
|
+
]
|
|
136618
|
+
};
|
|
136619
|
+
return {
|
|
136620
|
+
name: 'npm'
|
|
136621
|
+
};
|
|
136622
|
+
}
|
|
136623
|
+
function buildExecEnv() {
|
|
136624
|
+
if ('win32' !== process.platform) return;
|
|
136625
|
+
const nodeDir = external_path_.dirname(process.execPath);
|
|
136626
|
+
const pathSep = external_path_.delimiter;
|
|
136627
|
+
const existing = process.env.PATH || process.env.Path || '';
|
|
136628
|
+
if (existing.includes(nodeDir)) return;
|
|
136629
|
+
return {
|
|
136630
|
+
...process.env,
|
|
136631
|
+
PATH: `${nodeDir}${pathSep}${existing}`.trim(),
|
|
136632
|
+
Path: `${nodeDir}${pathSep}${existing}`.trim()
|
|
136633
|
+
};
|
|
136634
|
+
}
|
|
136635
|
+
function buildInstallCommand(pm, args) {
|
|
136636
|
+
if (pm.runnerCommand) return {
|
|
136637
|
+
command: pm.runnerCommand,
|
|
136638
|
+
args: [
|
|
136639
|
+
...pm.runnerArgs || [],
|
|
136640
|
+
...args
|
|
136641
|
+
]
|
|
136642
|
+
};
|
|
136643
|
+
if (pm.execPath) {
|
|
136644
|
+
if (isWindowsExecutablePath(pm.execPath)) return {
|
|
136645
|
+
command: pm.execPath,
|
|
136646
|
+
args
|
|
136647
|
+
};
|
|
136648
|
+
if (isNodeScriptPath(pm.execPath)) return {
|
|
136649
|
+
command: process.execPath,
|
|
136650
|
+
args: [
|
|
136651
|
+
pm.execPath,
|
|
136652
|
+
...args
|
|
136653
|
+
]
|
|
136654
|
+
};
|
|
136655
|
+
return {
|
|
136656
|
+
command: pm.execPath,
|
|
136657
|
+
args
|
|
136658
|
+
};
|
|
136659
|
+
}
|
|
136660
|
+
return {
|
|
136661
|
+
command: pm.name,
|
|
136662
|
+
args
|
|
136663
|
+
};
|
|
136664
|
+
}
|
|
136665
|
+
function buildSpawnInvocation(command, args) {
|
|
136666
|
+
return {
|
|
136667
|
+
command,
|
|
136668
|
+
args
|
|
136669
|
+
};
|
|
136670
|
+
}
|
|
136671
|
+
function execInstallCommand(command, args, options) {
|
|
136672
|
+
const invocation = buildSpawnInvocation(command, args);
|
|
136673
|
+
const env = buildExecEnv();
|
|
136674
|
+
const stdio = options?.stdio ?? 'ignore';
|
|
136675
|
+
const useShell = 'win32' === process.platform && /\.(cmd|bat)$/i.test(invocation.command);
|
|
136676
|
+
return new Promise((resolve, reject)=>{
|
|
136677
|
+
const child = (0, external_child_process_.spawn)(invocation.command, invocation.args, {
|
|
136678
|
+
cwd: options?.cwd,
|
|
136679
|
+
stdio,
|
|
136680
|
+
env: env || process.env,
|
|
136681
|
+
...useShell ? {
|
|
136682
|
+
shell: true
|
|
136683
|
+
} : {}
|
|
136684
|
+
});
|
|
136685
|
+
child.on('close', (code)=>{
|
|
136686
|
+
if (0 !== code) reject(new Error(`Install failed with exit code ${code}`));
|
|
136687
|
+
else resolve();
|
|
136688
|
+
});
|
|
136689
|
+
child.on('error', (error)=>reject(error));
|
|
136690
|
+
});
|
|
136691
|
+
}
|
|
136408
136692
|
function clearLine() {
|
|
136409
136693
|
if (!process.stdout.isTTY) return;
|
|
136410
136694
|
process.stdout.write('\r');
|
|
@@ -136477,7 +136761,7 @@ var __webpack_exports__ = {};
|
|
|
136477
136761
|
const originalDirectory = process.cwd();
|
|
136478
136762
|
try {
|
|
136479
136763
|
process.chdir(packageRoot);
|
|
136480
|
-
const pm = (
|
|
136764
|
+
const pm = package_manager_resolvePackageManager({
|
|
136481
136765
|
cwd: packageRoot
|
|
136482
136766
|
});
|
|
136483
136767
|
const installArgs = getInstallArgs(pm.name, dependencies, dependenciesMap);
|
|
@@ -136492,9 +136776,9 @@ var __webpack_exports__ = {};
|
|
|
136492
136776
|
});
|
|
136493
136777
|
if (!progressEnabled) console.log(progressLabel);
|
|
136494
136778
|
if (isAuthor) console.warn(messages.TL('build dependencies'));
|
|
136495
|
-
const command = (
|
|
136779
|
+
const command = buildInstallCommand(pm, installArgs);
|
|
136496
136780
|
try {
|
|
136497
|
-
await (
|
|
136781
|
+
await execInstallCommand(command.command, command.args, {
|
|
136498
136782
|
cwd: packageRoot,
|
|
136499
136783
|
stdio
|
|
136500
136784
|
});
|
|
@@ -136605,7 +136889,7 @@ var __webpack_exports__ = {};
|
|
|
136605
136889
|
const progressLabel = messages.Vy();
|
|
136606
136890
|
try {
|
|
136607
136891
|
process.chdir(projectPath);
|
|
136608
|
-
const pm = (
|
|
136892
|
+
const pm = package_manager_resolvePackageManager({
|
|
136609
136893
|
cwd: process.cwd()
|
|
136610
136894
|
});
|
|
136611
136895
|
let dependenciesArgs = install_dependencies_getInstallArgs();
|
|
@@ -136625,8 +136909,8 @@ var __webpack_exports__ = {};
|
|
|
136625
136909
|
const stdio = isAuthor ? 'inherit' : 'ignore';
|
|
136626
136910
|
console.log(progressLabel);
|
|
136627
136911
|
if (isAuthor) console.warn(messages.TL('project dependencies'));
|
|
136628
|
-
const command = (
|
|
136629
|
-
await (
|
|
136912
|
+
const command = buildInstallCommand(pm, dependenciesArgs);
|
|
136913
|
+
await execInstallCommand(command.command, command.args, {
|
|
136630
136914
|
cwd: projectPath,
|
|
136631
136915
|
stdio
|
|
136632
136916
|
});
|
|
@@ -136663,8 +136947,8 @@ var __webpack_exports__ = {};
|
|
|
136663
136947
|
var external_pintor_ = __webpack_require__("pintor");
|
|
136664
136948
|
var external_pintor_default = /*#__PURE__*/ __webpack_require__.n(external_pintor_);
|
|
136665
136949
|
var external_crypto_ = __webpack_require__("crypto");
|
|
136666
|
-
var
|
|
136667
|
-
var
|
|
136950
|
+
var develop_context = __webpack_require__("./webpack/webpack-lib/develop-context.ts");
|
|
136951
|
+
var optional_deps_contracts = __webpack_require__("./webpack/webpack-lib/optional-deps-contracts.ts");
|
|
136668
136952
|
function getPreflightCacheDir(packageRoot) {
|
|
136669
136953
|
return external_path_.join(packageRoot, '.cache', 'extensionjs', 'preflight');
|
|
136670
136954
|
}
|
|
@@ -136675,7 +136959,7 @@ var __webpack_exports__ = {};
|
|
|
136675
136959
|
return external_path_.join(cacheDir, 'version.json');
|
|
136676
136960
|
}
|
|
136677
136961
|
function getProjectDepsHash(projectPath) {
|
|
136678
|
-
const optionalDepsSignature = (0,
|
|
136962
|
+
const optionalDepsSignature = (0, optional_deps_contracts.I7)();
|
|
136679
136963
|
try {
|
|
136680
136964
|
const packageJsonPath = external_path_.join(projectPath, 'package.json');
|
|
136681
136965
|
if (!external_fs_.existsSync(packageJsonPath)) return (0, external_crypto_.createHash)('sha1').update(JSON.stringify({
|
|
@@ -136731,7 +137015,7 @@ var __webpack_exports__ = {};
|
|
|
136731
137015
|
}
|
|
136732
137016
|
}
|
|
136733
137017
|
function getPreflightMarkerPath(projectPath) {
|
|
136734
|
-
const packageRoot = (0,
|
|
137018
|
+
const packageRoot = (0, develop_context.H)();
|
|
136735
137019
|
if (!packageRoot) return;
|
|
136736
137020
|
const cacheDir = getPreflightCacheDir(packageRoot);
|
|
136737
137021
|
return external_path_.join(cacheDir, `${getProjectKey(projectPath)}.json`);
|
|
@@ -136781,7 +137065,6 @@ var __webpack_exports__ = {};
|
|
|
136781
137065
|
}));
|
|
136782
137066
|
} catch {}
|
|
136783
137067
|
}
|
|
136784
|
-
var optional_deps_contracts = __webpack_require__("./webpack/webpack-lib/optional-deps-contracts.ts");
|
|
136785
137068
|
var react = __webpack_require__("./webpack/plugin-js-frameworks/js-tools/react.ts");
|
|
136786
137069
|
var preact = __webpack_require__("./webpack/plugin-js-frameworks/js-tools/preact.ts");
|
|
136787
137070
|
var vue = __webpack_require__("./webpack/plugin-js-frameworks/js-tools/vue.ts");
|
|
@@ -136794,7 +137077,7 @@ var __webpack_exports__ = {};
|
|
|
136794
137077
|
var js_frameworks_lib_messages = __webpack_require__("./webpack/plugin-js-frameworks/js-frameworks-lib/messages.ts");
|
|
136795
137078
|
var optional_deps_resolver = __webpack_require__("./webpack/webpack-lib/optional-deps-resolver.ts");
|
|
136796
137079
|
function getInstallRootVerificationFailures(contractIds) {
|
|
136797
|
-
return Array.from(new Set(contractIds.flatMap((contractId)=>(0, optional_deps_resolver.lr)((0, optional_deps_contracts.
|
|
137080
|
+
return Array.from(new Set(contractIds.flatMap((contractId)=>(0, optional_deps_resolver.lr)((0, optional_deps_contracts.uw)(contractId)))));
|
|
136798
137081
|
}
|
|
136799
137082
|
async function verifyContractsResolvedAtInstallRoot(contractIds) {
|
|
136800
137083
|
let failures = getInstallRootVerificationFailures(contractIds);
|
|
@@ -136830,7 +137113,7 @@ var __webpack_exports__ = {};
|
|
|
136830
137113
|
};
|
|
136831
137114
|
const addActiveContract = (contractId)=>{
|
|
136832
137115
|
activeContractIds.push(contractId);
|
|
136833
|
-
usedIntegrations.push((0, optional_deps_contracts.
|
|
137116
|
+
usedIntegrations.push((0, optional_deps_contracts.uw)(contractId).integration);
|
|
136834
137117
|
};
|
|
136835
137118
|
const usesTypeScript = (0, typescript.eE)(projectPath);
|
|
136836
137119
|
const usesReact = (0, react.S)(projectPath);
|
|
@@ -136851,7 +137134,7 @@ var __webpack_exports__ = {};
|
|
|
136851
137134
|
if (usesPostCss) usedIntegrations.push('PostCSS');
|
|
136852
137135
|
} else addActiveContract('postcss');
|
|
136853
137136
|
for (const contractId of Array.from(new Set(activeContractIds))){
|
|
136854
|
-
const contract = (0, optional_deps_contracts.
|
|
137137
|
+
const contract = (0, optional_deps_contracts.uw)(contractId);
|
|
136855
137138
|
const failures = (0, optional_deps_resolver.OE)(contract, projectPath);
|
|
136856
137139
|
if (0 !== failures.length) {
|
|
136857
137140
|
contractsNeedingInstall.push(contractId);
|
|
@@ -136862,8 +137145,8 @@ var __webpack_exports__ = {};
|
|
|
136862
137145
|
const uniqueIntegrations = Array.from(new Set(usedIntegrations));
|
|
136863
137146
|
const installPlans = uniqueIntegrations.map((integration)=>({
|
|
136864
137147
|
integration,
|
|
136865
|
-
|
|
136866
|
-
})).filter((plan)=>plan.
|
|
137148
|
+
dependencySpecs: missingByIntegration[integration] || []
|
|
137149
|
+
})).filter((plan)=>plan.dependencySpecs.length > 0);
|
|
136867
137150
|
const didInstall = await (0, integrations.Dy)(installPlans);
|
|
136868
137151
|
if (!didInstall) throw new Error('[Optional] Optional dependencies failed to install.');
|
|
136869
137152
|
await verifyContractsResolvedAtInstallRoot(Array.from(new Set(contractsNeedingInstall)));
|
|
@@ -136899,17 +137182,17 @@ var __webpack_exports__ = {};
|
|
|
136899
137182
|
];
|
|
136900
137183
|
const missing = requiredFiles.filter((file)=>!external_fs_.existsSync(file));
|
|
136901
137184
|
if (0 === missing.length) return;
|
|
136902
|
-
const pm = (
|
|
137185
|
+
const pm = package_manager_resolvePackageManager({
|
|
136903
137186
|
cwd: developRoot
|
|
136904
137187
|
});
|
|
136905
|
-
const command = (
|
|
137188
|
+
const command = buildInstallCommand(pm, [
|
|
136906
137189
|
'run',
|
|
136907
137190
|
'compile'
|
|
136908
137191
|
]);
|
|
136909
137192
|
const isAuthor = 'true' === process.env.EXTENSION_AUTHOR_MODE;
|
|
136910
137193
|
const stdio = isAuthor ? 'inherit' : 'ignore';
|
|
136911
137194
|
if (isAuthor) console.warn(messages.TL('extension-develop build artifacts (dist missing)'));
|
|
136912
|
-
await (
|
|
137195
|
+
await execInstallCommand(command.command, command.args, {
|
|
136913
137196
|
cwd: developRoot,
|
|
136914
137197
|
stdio
|
|
136915
137198
|
});
|
|
@@ -136944,7 +137227,7 @@ var __webpack_exports__ = {};
|
|
|
136944
137227
|
__webpack_require__.e("552").then(__webpack_require__.bind(__webpack_require__, "./webpack/webpack-lib/stats-handler.ts")),
|
|
136945
137228
|
Promise.all([
|
|
136946
137229
|
__webpack_require__.e("215"),
|
|
136947
|
-
__webpack_require__.e("
|
|
137230
|
+
__webpack_require__.e("677")
|
|
136948
137231
|
]).then(__webpack_require__.bind(__webpack_require__, "./webpack/webpack-config.ts"))
|
|
136949
137232
|
]);
|
|
136950
137233
|
const debug = isAuthor;
|
|
@@ -137089,7 +137372,7 @@ var __webpack_exports__ = {};
|
|
|
137089
137372
|
if ('true' === process.env.EXTENSION_DEV_DRY_RUN) return;
|
|
137090
137373
|
const { devServer } = await Promise.all([
|
|
137091
137374
|
__webpack_require__.e("215"),
|
|
137092
|
-
__webpack_require__.e("
|
|
137375
|
+
__webpack_require__.e("677"),
|
|
137093
137376
|
__webpack_require__.e("324")
|
|
137094
137377
|
]).then(__webpack_require__.bind(__webpack_require__, "./webpack/dev-server/index.ts"));
|
|
137095
137378
|
await devServer(projectStructure, {
|
|
@@ -137164,22 +137447,13 @@ var __webpack_exports__ = {};
|
|
|
137164
137447
|
var dark_mode = __webpack_require__("./webpack/webpack-lib/dark-mode.ts");
|
|
137165
137448
|
var output_binaries_resolver = __webpack_require__("./webpack/plugin-browsers/browsers-lib/output-binaries-resolver.ts");
|
|
137166
137449
|
var banner = __webpack_require__("./webpack/plugin-browsers/browsers-lib/banner.ts");
|
|
137450
|
+
var runtime_options = __webpack_require__("./webpack/plugin-browsers/browsers-lib/runtime-options.ts");
|
|
137167
137451
|
var chromium_context = __webpack_require__("./webpack/plugin-browsers/run-chromium/chromium-context/index.ts");
|
|
137168
137452
|
var chromium_launch = __webpack_require__("./webpack/plugin-browsers/run-chromium/chromium-launch/index.ts");
|
|
137169
137453
|
var firefox_context = __webpack_require__("./webpack/plugin-browsers/run-firefox/firefox-context/index.ts");
|
|
137170
137454
|
var firefox_launch = __webpack_require__("./webpack/plugin-browsers/run-firefox/firefox-launch/index.ts");
|
|
137171
|
-
|
|
137172
|
-
|
|
137173
|
-
let exitScheduled = false;
|
|
137174
|
-
const scheduleExitOnSignal = ()=>{
|
|
137175
|
-
if (exitScheduled) return;
|
|
137176
|
-
exitScheduled = true;
|
|
137177
|
-
setTimeout(()=>process.exit(0), 10);
|
|
137178
|
-
};
|
|
137179
|
-
process.once('SIGINT', scheduleExitOnSignal);
|
|
137180
|
-
process.once('SIGTERM', scheduleExitOnSignal);
|
|
137181
|
-
process.once('SIGHUP', scheduleExitOnSignal);
|
|
137182
|
-
const compilationLike = {
|
|
137455
|
+
function createPreviewCompilationLike(opts) {
|
|
137456
|
+
return {
|
|
137183
137457
|
options: {
|
|
137184
137458
|
mode: 'production',
|
|
137185
137459
|
context: opts.contextDir,
|
|
@@ -137189,8 +137463,9 @@ var __webpack_exports__ = {};
|
|
|
137189
137463
|
},
|
|
137190
137464
|
errors: []
|
|
137191
137465
|
};
|
|
137192
|
-
|
|
137193
|
-
|
|
137466
|
+
}
|
|
137467
|
+
function buildPreviewPluginOptions(opts) {
|
|
137468
|
+
return {
|
|
137194
137469
|
extension: opts.extensionsToLoad,
|
|
137195
137470
|
browser: opts.browser,
|
|
137196
137471
|
noOpen: opts.noOpen,
|
|
@@ -137204,47 +137479,81 @@ var __webpack_exports__ = {};
|
|
|
137204
137479
|
geckoBinary: opts.geckoBinary,
|
|
137205
137480
|
instanceId: opts.instanceId,
|
|
137206
137481
|
port: opts.port,
|
|
137207
|
-
source: sourceEnabled ? opts.source : void 0,
|
|
137208
|
-
watchSource: sourceEnabled ? opts.watchSource : void 0,
|
|
137209
137482
|
dryRun: opts.dryRun
|
|
137210
137483
|
};
|
|
137484
|
+
}
|
|
137485
|
+
function buildPreviewChromiumOptions(opts) {
|
|
137486
|
+
const pluginOptions = buildPreviewPluginOptions(opts);
|
|
137487
|
+
return {
|
|
137488
|
+
extension: pluginOptions.extension,
|
|
137489
|
+
browser: pluginOptions.browser,
|
|
137490
|
+
noOpen: pluginOptions.noOpen,
|
|
137491
|
+
profile: pluginOptions.profile,
|
|
137492
|
+
preferences: pluginOptions.preferences,
|
|
137493
|
+
browserFlags: pluginOptions.browserFlags,
|
|
137494
|
+
excludeBrowserFlags: pluginOptions.excludeBrowserFlags,
|
|
137495
|
+
startingUrl: pluginOptions.startingUrl,
|
|
137496
|
+
chromiumBinary: pluginOptions.chromiumBinary,
|
|
137497
|
+
instanceId: pluginOptions.instanceId,
|
|
137498
|
+
port: pluginOptions.port,
|
|
137499
|
+
dryRun: pluginOptions.dryRun
|
|
137500
|
+
};
|
|
137501
|
+
}
|
|
137502
|
+
function buildPreviewFirefoxOptions(opts) {
|
|
137503
|
+
const pluginOptions = buildPreviewPluginOptions(opts);
|
|
137504
|
+
return {
|
|
137505
|
+
extension: pluginOptions.extension,
|
|
137506
|
+
browser: pluginOptions.browser,
|
|
137507
|
+
profile: pluginOptions.profile,
|
|
137508
|
+
preferences: pluginOptions.preferences,
|
|
137509
|
+
browserFlags: pluginOptions.browserFlags,
|
|
137510
|
+
startingUrl: pluginOptions.startingUrl,
|
|
137511
|
+
geckoBinary: pluginOptions.geckoBinary,
|
|
137512
|
+
instanceId: pluginOptions.instanceId,
|
|
137513
|
+
port: pluginOptions.port,
|
|
137514
|
+
dryRun: pluginOptions.dryRun
|
|
137515
|
+
};
|
|
137516
|
+
}
|
|
137517
|
+
function buildPreviewBannerOptions(opts) {
|
|
137518
|
+
return {
|
|
137519
|
+
browser: opts.browser,
|
|
137520
|
+
outPath: opts.outPath,
|
|
137521
|
+
includeExtensionId: true,
|
|
137522
|
+
includeRunId: false,
|
|
137523
|
+
readyPath: opts.readyPath
|
|
137524
|
+
};
|
|
137525
|
+
}
|
|
137526
|
+
async function runOnlyPreviewBrowser(opts) {
|
|
137527
|
+
let exitScheduled = false;
|
|
137528
|
+
const scheduleExitOnSignal = ()=>{
|
|
137529
|
+
if (exitScheduled) return;
|
|
137530
|
+
exitScheduled = true;
|
|
137531
|
+
setTimeout(()=>process.exit(0), 10);
|
|
137532
|
+
};
|
|
137533
|
+
process.once('SIGINT', scheduleExitOnSignal);
|
|
137534
|
+
process.once('SIGTERM', scheduleExitOnSignal);
|
|
137535
|
+
process.once('SIGHUP', scheduleExitOnSignal);
|
|
137536
|
+
const compilationLike = createPreviewCompilationLike(opts);
|
|
137537
|
+
const previewPluginOptions = buildPreviewPluginOptions(opts);
|
|
137538
|
+
const bannerOptions = buildPreviewBannerOptions(opts);
|
|
137539
|
+
(0, output_binaries_resolver.LB)(compilationLike);
|
|
137211
137540
|
if ('chrome' === opts.browser || 'edge' === opts.browser || 'chromium' === opts.browser || 'chromium-based' === opts.browser) {
|
|
137212
137541
|
const ctx = (0, chromium_context.g)();
|
|
137213
|
-
const launcher = new chromium_launch.f(
|
|
137542
|
+
const launcher = new chromium_launch.f(buildPreviewChromiumOptions(opts), ctx);
|
|
137214
137543
|
await launcher.runOnce(compilationLike, {
|
|
137215
137544
|
enableCdpPostLaunch: false
|
|
137216
137545
|
});
|
|
137217
|
-
await (0, banner.M)(
|
|
137218
|
-
browser: opts.browser,
|
|
137219
|
-
outPath: opts.outPath,
|
|
137220
|
-
includeExtensionId: true,
|
|
137221
|
-
includeRunId: false,
|
|
137222
|
-
readyPath: opts.readyPath
|
|
137223
|
-
});
|
|
137546
|
+
await (0, banner.M)(bannerOptions);
|
|
137224
137547
|
return;
|
|
137225
137548
|
}
|
|
137226
137549
|
if ('firefox' === opts.browser || 'gecko-based' === opts.browser || 'firefox-based' === opts.browser) {
|
|
137227
137550
|
const ctx = (0, firefox_context.D)();
|
|
137228
|
-
const launcher = new firefox_launch.c(
|
|
137229
|
-
await launcher.runOnce(compilationLike, {
|
|
137230
|
-
|
|
137231
|
-
|
|
137232
|
-
|
|
137233
|
-
|
|
137234
|
-
preferences: opts.preferences,
|
|
137235
|
-
browserFlags: opts.browserFlags,
|
|
137236
|
-
excludeBrowserFlags: opts.excludeBrowserFlags,
|
|
137237
|
-
startingUrl: opts.startingUrl,
|
|
137238
|
-
geckoBinary: opts.geckoBinary,
|
|
137239
|
-
port: opts.port
|
|
137240
|
-
});
|
|
137241
|
-
await (0, banner.M)({
|
|
137242
|
-
browser: opts.browser,
|
|
137243
|
-
outPath: opts.outPath,
|
|
137244
|
-
includeExtensionId: true,
|
|
137245
|
-
includeRunId: false,
|
|
137246
|
-
readyPath: opts.readyPath
|
|
137247
|
-
});
|
|
137551
|
+
const launcher = new firefox_launch.c(buildPreviewFirefoxOptions(opts), ctx);
|
|
137552
|
+
await launcher.runOnce(compilationLike, (0, runtime_options.zU)(previewPluginOptions, 'production', {
|
|
137553
|
+
persistProfile: previewPluginOptions.persistProfile,
|
|
137554
|
+
geckoBinary: previewPluginOptions.geckoBinary
|
|
137555
|
+
}));
|
|
137556
|
+
await (0, banner.M)(bannerOptions);
|
|
137248
137557
|
return;
|
|
137249
137558
|
}
|
|
137250
137559
|
throw new Error(`Unsupported browser: ${String(opts.browser)}`);
|