extension-develop 3.9.1 → 3.9.3
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/module.cjs +151 -11
- package/package.json +1 -1
package/dist/module.cjs
CHANGED
|
@@ -128647,13 +128647,17 @@ var __webpack_modules__ = {
|
|
|
128647
128647
|
"use strict";
|
|
128648
128648
|
__webpack_require__.d(__webpack_exports__, {
|
|
128649
128649
|
CW: ()=>cleanupOldTempProfiles,
|
|
128650
|
+
J1: ()=>prepareChromiumProfileForLaunch,
|
|
128651
|
+
RE: ()=>markManagedEphemeralProfile,
|
|
128650
128652
|
aY: ()=>findAvailablePortNear,
|
|
128651
128653
|
jl: ()=>deriveDebugPortWithInstance,
|
|
128652
128654
|
ov: ()=>filterBrowserFlags
|
|
128653
128655
|
});
|
|
128654
128656
|
var fs__rspack_import_0 = __webpack_require__("fs");
|
|
128655
|
-
var
|
|
128656
|
-
var
|
|
128657
|
+
var os__rspack_import_1 = __webpack_require__("os");
|
|
128658
|
+
var path__rspack_import_2 = __webpack_require__("path");
|
|
128659
|
+
var net__rspack_import_3 = __webpack_require__("net");
|
|
128660
|
+
const MANAGED_EPHEMERAL_PROFILE_MARKER = '.extension-js-managed-profile';
|
|
128657
128661
|
function shortInstanceId(instanceId) {
|
|
128658
128662
|
return instanceId ? String(instanceId).slice(0, 8) : '';
|
|
128659
128663
|
}
|
|
@@ -128675,7 +128679,7 @@ var __webpack_modules__ = {
|
|
|
128675
128679
|
async function findAvailablePortNear(startPort, maxAttempts = 20, host = '127.0.0.1') {
|
|
128676
128680
|
function tryPort(port) {
|
|
128677
128681
|
return new Promise((resolve)=>{
|
|
128678
|
-
const server =
|
|
128682
|
+
const server = net__rspack_import_3.createServer();
|
|
128679
128683
|
server.once('error', ()=>{
|
|
128680
128684
|
resolve(false);
|
|
128681
128685
|
});
|
|
@@ -128693,6 +128697,77 @@ var __webpack_modules__ = {
|
|
|
128693
128697
|
}
|
|
128694
128698
|
return startPort;
|
|
128695
128699
|
}
|
|
128700
|
+
function isProcessLikelyAlive(pid) {
|
|
128701
|
+
if (!Number.isInteger(pid) || pid <= 0) return false;
|
|
128702
|
+
try {
|
|
128703
|
+
process.kill(pid, 0);
|
|
128704
|
+
return true;
|
|
128705
|
+
} catch {
|
|
128706
|
+
return false;
|
|
128707
|
+
}
|
|
128708
|
+
}
|
|
128709
|
+
function parseChromiumSingletonOwner(raw) {
|
|
128710
|
+
const value = String(raw || '').trim();
|
|
128711
|
+
const lastDash = value.lastIndexOf('-');
|
|
128712
|
+
if (lastDash <= 0) return null;
|
|
128713
|
+
const host = value.slice(0, lastDash).trim();
|
|
128714
|
+
const pid = parseInt(value.slice(lastDash + 1).trim(), 10);
|
|
128715
|
+
if (!host || !Number.isInteger(pid) || pid <= 0) return null;
|
|
128716
|
+
return {
|
|
128717
|
+
host,
|
|
128718
|
+
pid
|
|
128719
|
+
};
|
|
128720
|
+
}
|
|
128721
|
+
function readChromiumSingletonOwner(profilePath) {
|
|
128722
|
+
const lockPath = path__rspack_import_2.join(profilePath, 'SingletonLock');
|
|
128723
|
+
if (!fs__rspack_import_0.existsSync(lockPath)) return null;
|
|
128724
|
+
try {
|
|
128725
|
+
const stat = fs__rspack_import_0.lstatSync(lockPath);
|
|
128726
|
+
if (stat.isSymbolicLink()) return parseChromiumSingletonOwner(fs__rspack_import_0.readlinkSync(lockPath));
|
|
128727
|
+
} catch {}
|
|
128728
|
+
try {
|
|
128729
|
+
return parseChromiumSingletonOwner(fs__rspack_import_0.readFileSync(lockPath, 'utf8'));
|
|
128730
|
+
} catch {
|
|
128731
|
+
return null;
|
|
128732
|
+
}
|
|
128733
|
+
}
|
|
128734
|
+
function removeChromiumSingletonArtifacts(profilePath) {
|
|
128735
|
+
const removed = [];
|
|
128736
|
+
for (const name of [
|
|
128737
|
+
'SingletonLock',
|
|
128738
|
+
'SingletonSocket',
|
|
128739
|
+
'SingletonCookie'
|
|
128740
|
+
]){
|
|
128741
|
+
const full = path__rspack_import_2.join(profilePath, name);
|
|
128742
|
+
if (fs__rspack_import_0.existsSync(full)) try {
|
|
128743
|
+
fs__rspack_import_0.rmSync(full, {
|
|
128744
|
+
recursive: true,
|
|
128745
|
+
force: true
|
|
128746
|
+
});
|
|
128747
|
+
removed.push(name);
|
|
128748
|
+
} catch {}
|
|
128749
|
+
}
|
|
128750
|
+
return removed;
|
|
128751
|
+
}
|
|
128752
|
+
function prepareChromiumProfileForLaunch(profilePath) {
|
|
128753
|
+
const owner = readChromiumSingletonOwner(profilePath);
|
|
128754
|
+
if (!owner) return {
|
|
128755
|
+
removedArtifacts: []
|
|
128756
|
+
};
|
|
128757
|
+
const currentHost = os__rspack_import_1.hostname().trim().toLowerCase();
|
|
128758
|
+
const ownerHost = owner.host.trim().toLowerCase();
|
|
128759
|
+
const sameHost = currentHost.length > 0 && currentHost === ownerHost;
|
|
128760
|
+
const alive = isProcessLikelyAlive(owner.pid);
|
|
128761
|
+
if (!sameHost || !alive) return {
|
|
128762
|
+
removedArtifacts: removeChromiumSingletonArtifacts(profilePath)
|
|
128763
|
+
};
|
|
128764
|
+
throw new Error(`Chromium profile "${profilePath}" is already in use by process ${owner.pid} on host ${owner.host}. Close that browser session or use a different profile before starting Extension.js.`);
|
|
128765
|
+
}
|
|
128766
|
+
function markManagedEphemeralProfile(profilePath) {
|
|
128767
|
+
try {
|
|
128768
|
+
fs__rspack_import_0.writeFileSync(path__rspack_import_2.join(profilePath, MANAGED_EPHEMERAL_PROFILE_MARKER), 'managed-ephemeral-profile\n', 'utf8');
|
|
128769
|
+
} catch {}
|
|
128770
|
+
}
|
|
128696
128771
|
function cleanupOldTempProfiles(baseDir, excludeBasename, maxAgeHours = 12) {
|
|
128697
128772
|
try {
|
|
128698
128773
|
if (!fs__rspack_import_0.existsSync(baseDir)) return;
|
|
@@ -128703,9 +128778,11 @@ var __webpack_modules__ = {
|
|
|
128703
128778
|
for (const entry of entries){
|
|
128704
128779
|
if (!entry.isDirectory()) continue;
|
|
128705
128780
|
const name = entry.name;
|
|
128706
|
-
if (
|
|
128781
|
+
if ('dev' === name) continue;
|
|
128707
128782
|
if (excludeBasename && name === excludeBasename) continue;
|
|
128708
|
-
const full =
|
|
128783
|
+
const full = path__rspack_import_2.join(baseDir, name);
|
|
128784
|
+
const markerPath = path__rspack_import_2.join(full, MANAGED_EPHEMERAL_PROFILE_MARKER);
|
|
128785
|
+
if (!fs__rspack_import_0.existsSync(markerPath)) continue;
|
|
128709
128786
|
let mtime = 0;
|
|
128710
128787
|
try {
|
|
128711
128788
|
const st = fs__rspack_import_0.statSync(full);
|
|
@@ -128996,6 +129073,7 @@ var __webpack_modules__ = {
|
|
|
128996
129073
|
external_fs_.mkdirSync(ephemDir, {
|
|
128997
129074
|
recursive: true
|
|
128998
129075
|
});
|
|
129076
|
+
(0, shared_utils.RE)(ephemDir);
|
|
128999
129077
|
userProfilePath = ephemDir;
|
|
129000
129078
|
try {
|
|
129001
129079
|
const maxAgeHours = parseInt(String(process.env.EXTENSION_TMP_PROFILE_MAX_AGE_HOURS || ''), 10);
|
|
@@ -129003,12 +129081,15 @@ var __webpack_modules__ = {
|
|
|
129003
129081
|
} catch {}
|
|
129004
129082
|
}
|
|
129005
129083
|
}
|
|
129006
|
-
if (userProfilePath)
|
|
129084
|
+
if (userProfilePath) {
|
|
129007
129085
|
external_fs_.mkdirSync(userProfilePath, {
|
|
129008
129086
|
recursive: true
|
|
129009
129087
|
});
|
|
129010
|
-
|
|
129011
|
-
|
|
129088
|
+
(0, shared_utils.J1)(userProfilePath);
|
|
129089
|
+
try {
|
|
129090
|
+
seedChromiumPreferences(userProfilePath, configOptions.browser, configOptions.preferences);
|
|
129091
|
+
} catch {}
|
|
129092
|
+
}
|
|
129012
129093
|
const excludeFlags = configOptions.excludeBrowserFlags || [];
|
|
129013
129094
|
const filteredFlags = (0, shared_utils.ov)(DEFAULT_BROWSER_FLAGS, excludeFlags);
|
|
129014
129095
|
const cdpPort = (0, shared_utils.jl)(configOptions.port, configOptions.instanceId);
|
|
@@ -130370,6 +130451,7 @@ var __webpack_modules__ = {
|
|
|
130370
130451
|
external_fs_.mkdirSync(tmp, {
|
|
130371
130452
|
recursive: true
|
|
130372
130453
|
});
|
|
130454
|
+
(0, shared_utils.RE)(tmp);
|
|
130373
130455
|
profilePath = tmp;
|
|
130374
130456
|
}
|
|
130375
130457
|
try {
|
|
@@ -134607,6 +134689,57 @@ var __webpack_modules__ = {
|
|
|
134607
134689
|
function getPackageDirFromInstallRoot(dependencyId, installRoot) {
|
|
134608
134690
|
return path__rspack_import_1.join(installRoot, 'node_modules', ...dependencyId.split('/'));
|
|
134609
134691
|
}
|
|
134692
|
+
function listInstalledPackageDirs(nodeModulesDir) {
|
|
134693
|
+
if (!fs__rspack_import_0.existsSync(nodeModulesDir)) return [];
|
|
134694
|
+
try {
|
|
134695
|
+
const entries = fs__rspack_import_0.readdirSync(nodeModulesDir, {
|
|
134696
|
+
withFileTypes: true
|
|
134697
|
+
});
|
|
134698
|
+
const packageDirs = [];
|
|
134699
|
+
for (const entry of entries){
|
|
134700
|
+
if (!entry.isDirectory() || '.bin' === entry.name) continue;
|
|
134701
|
+
const entryPath = path__rspack_import_1.join(nodeModulesDir, entry.name);
|
|
134702
|
+
if (!entry.name.startsWith('@')) {
|
|
134703
|
+
packageDirs.push(entryPath);
|
|
134704
|
+
continue;
|
|
134705
|
+
}
|
|
134706
|
+
const scopedEntries = fs__rspack_import_0.readdirSync(entryPath, {
|
|
134707
|
+
withFileTypes: true
|
|
134708
|
+
});
|
|
134709
|
+
for (const scopedEntry of scopedEntries)if (scopedEntry.isDirectory()) packageDirs.push(path__rspack_import_1.join(entryPath, scopedEntry.name));
|
|
134710
|
+
}
|
|
134711
|
+
return packageDirs;
|
|
134712
|
+
} catch {
|
|
134713
|
+
return [];
|
|
134714
|
+
}
|
|
134715
|
+
}
|
|
134716
|
+
function findNestedPackageDir(dependencyId, installRoot) {
|
|
134717
|
+
const targetPackageJson = path__rspack_import_1.join(installRoot, 'node_modules', ...dependencyId.split('/'), 'package.json');
|
|
134718
|
+
if (fs__rspack_import_0.existsSync(targetPackageJson)) return path__rspack_import_1.dirname(targetPackageJson);
|
|
134719
|
+
const visited = new Set();
|
|
134720
|
+
const queue = [
|
|
134721
|
+
{
|
|
134722
|
+
nodeModulesDir: path__rspack_import_1.join(installRoot, 'node_modules'),
|
|
134723
|
+
depth: 0
|
|
134724
|
+
}
|
|
134725
|
+
];
|
|
134726
|
+
const maxDepth = 4;
|
|
134727
|
+
while(queue.length > 0){
|
|
134728
|
+
const current = queue.shift();
|
|
134729
|
+
if (visited.has(current.nodeModulesDir)) continue;
|
|
134730
|
+
visited.add(current.nodeModulesDir);
|
|
134731
|
+
const candidatePackageJson = path__rspack_import_1.join(current.nodeModulesDir, ...dependencyId.split('/'), 'package.json');
|
|
134732
|
+
if (fs__rspack_import_0.existsSync(candidatePackageJson)) return path__rspack_import_1.dirname(candidatePackageJson);
|
|
134733
|
+
if (current.depth >= maxDepth) continue;
|
|
134734
|
+
for (const packageDir of listInstalledPackageDirs(current.nodeModulesDir)){
|
|
134735
|
+
const nestedNodeModulesDir = path__rspack_import_1.join(packageDir, 'node_modules');
|
|
134736
|
+
if (fs__rspack_import_0.existsSync(nestedNodeModulesDir)) queue.push({
|
|
134737
|
+
nodeModulesDir: nestedNodeModulesDir,
|
|
134738
|
+
depth: current.depth + 1
|
|
134739
|
+
});
|
|
134740
|
+
}
|
|
134741
|
+
}
|
|
134742
|
+
}
|
|
134610
134743
|
function readPackageJsonFromDir(packageDir) {
|
|
134611
134744
|
const manifestPath = path__rspack_import_1.join(packageDir, 'package.json');
|
|
134612
134745
|
if (!fs__rspack_import_0.existsSync(manifestPath)) return;
|
|
@@ -134638,8 +134771,7 @@ var __webpack_modules__ = {
|
|
|
134638
134771
|
if (fs__rspack_import_0.existsSync(absoluteEntry)) return absoluteEntry;
|
|
134639
134772
|
}
|
|
134640
134773
|
}
|
|
134641
|
-
function
|
|
134642
|
-
const packageDir = getPackageDirFromInstallRoot(dependencyId, installRoot);
|
|
134774
|
+
function resolveFromPackageDir(packageDir) {
|
|
134643
134775
|
if (!fs__rspack_import_0.existsSync(packageDir)) return;
|
|
134644
134776
|
try {
|
|
134645
134777
|
return require.resolve(packageDir);
|
|
@@ -134649,6 +134781,14 @@ var __webpack_modules__ = {
|
|
|
134649
134781
|
const candidateEntries = getPackageEntryCandidates(pkg);
|
|
134650
134782
|
return resolveFirstExistingEntry(packageDir, candidateEntries);
|
|
134651
134783
|
}
|
|
134784
|
+
function resolveFromInstallRootPackageDir(dependencyId, installRoot) {
|
|
134785
|
+
const packageDir = getPackageDirFromInstallRoot(dependencyId, installRoot);
|
|
134786
|
+
const directResolution = resolveFromPackageDir(packageDir);
|
|
134787
|
+
if (directResolution) return directResolution;
|
|
134788
|
+
const nestedPackageDir = findNestedPackageDir(dependencyId, installRoot);
|
|
134789
|
+
if (!nestedPackageDir || nestedPackageDir === packageDir) return;
|
|
134790
|
+
return resolveFromPackageDir(nestedPackageDir);
|
|
134791
|
+
}
|
|
134652
134792
|
function verifyPackageInInstallRoot(packageId, installRoot) {
|
|
134653
134793
|
if (tryResolveWithBase(packageId, installRoot)) return true;
|
|
134654
134794
|
if (resolveFromInstallRootPackageDir(packageId, installRoot)) return true;
|
|
@@ -135459,7 +135599,7 @@ var __webpack_modules__ = {
|
|
|
135459
135599
|
},
|
|
135460
135600
|
"./package.json" (module) {
|
|
135461
135601
|
"use strict";
|
|
135462
|
-
module.exports = JSON.parse('{"rE":"3.9.
|
|
135602
|
+
module.exports = JSON.parse('{"rE":"3.9.3","El":{"@rspack/core":"^1.7.5","@rspack/dev-server":"^1.1.5","@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","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"}}');
|
|
135463
135603
|
}
|
|
135464
135604
|
};
|
|
135465
135605
|
var __webpack_module_cache__ = {};
|
package/package.json
CHANGED