extension-develop 3.9.0 → 3.9.1-canary.233.8976161
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 +170 -35
- 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 {
|
|
@@ -131966,30 +132048,25 @@ var __webpack_modules__ = {
|
|
|
131966
132048
|
const setupMessageWithIndex = hasIndex ? setupMessage.replace('►►► ', `►►► [${options?.index}/${options?.total}] `) : setupMessage;
|
|
131967
132049
|
if (isAuthor) console.warn(setupMessageWithIndex);
|
|
131968
132050
|
else console.log(setupMessageWithIndex);
|
|
131969
|
-
|
|
131970
|
-
|
|
131971
|
-
|
|
131972
|
-
|
|
131973
|
-
|
|
131974
|
-
|
|
131975
|
-
|
|
131976
|
-
|
|
131977
|
-
|
|
131978
|
-
|
|
131979
|
-
|
|
131980
|
-
|
|
131981
|
-
|
|
131982
|
-
|
|
131983
|
-
|
|
131984
|
-
await execInstallWithFallback(execCommand, {
|
|
131985
|
-
cwd: wslContext.useWsl ? void 0 : installBaseDir,
|
|
131986
|
-
fallbackNpmCommand,
|
|
131987
|
-
allowFallbackOnFailure: !wslContext.useWsl && 'npm' !== pm.name && void 0 !== fallbackNpmCommand
|
|
131988
|
-
});
|
|
131989
|
-
}
|
|
132051
|
+
const installCommand = getOptionalInstallCommand(pm, dependencies, wslContext.installDir || installBaseDir);
|
|
132052
|
+
const execCommand = wrapCommandForWsl(installCommand, wslContext);
|
|
132053
|
+
const fallbackNpmCommand = wslContext.useWsl ? void 0 : (0, _webpack_lib_package_manager__rspack_import_8.sX)([
|
|
132054
|
+
'--silent',
|
|
132055
|
+
'install',
|
|
132056
|
+
...(0, _webpack_lib_optional_dependencies__rspack_import_7.ad)(dependencies),
|
|
132057
|
+
'--prefix',
|
|
132058
|
+
installBaseDir,
|
|
132059
|
+
'--save-optional'
|
|
132060
|
+
]);
|
|
132061
|
+
await execInstallWithFallback(execCommand, {
|
|
132062
|
+
cwd: wslContext.useWsl ? void 0 : installBaseDir,
|
|
132063
|
+
fallbackNpmCommand,
|
|
132064
|
+
allowFallbackOnFailure: !wslContext.useWsl && 'npm' !== pm.name && void 0 !== fallbackNpmCommand
|
|
132065
|
+
});
|
|
131990
132066
|
await new Promise((resolve)=>setTimeout(resolve, 500));
|
|
131991
|
-
|
|
131992
|
-
|
|
132067
|
+
const needsRootRelink = isAuthor || dependencies.length > 1;
|
|
132068
|
+
if (needsRootRelink) {
|
|
132069
|
+
if (isAuthor) console.log(_messages__rspack_import_3.cr(integration));
|
|
131993
132070
|
const rootInstall = getRootInstallCommand(pm, wslContext.useWsl ? wslContext.installDir : void 0);
|
|
131994
132071
|
const rootCommand = wrapCommandForWsl(rootInstall, wslContext);
|
|
131995
132072
|
const rootFallbackCommand = wslContext.useWsl ? void 0 : (0, _webpack_lib_package_manager__rspack_import_8.sX)([
|
|
@@ -132003,7 +132080,7 @@ var __webpack_modules__ = {
|
|
|
132003
132080
|
fallbackNpmCommand: rootFallbackCommand,
|
|
132004
132081
|
allowFallbackOnFailure: !wslContext.useWsl && 'npm' !== pm.name && void 0 !== rootFallbackCommand
|
|
132005
132082
|
});
|
|
132006
|
-
console.log(_messages__rspack_import_3.ys(integration));
|
|
132083
|
+
if (isAuthor) console.log(_messages__rspack_import_3.ys(integration));
|
|
132007
132084
|
}
|
|
132008
132085
|
return true;
|
|
132009
132086
|
} catch (error) {
|
|
@@ -134612,6 +134689,57 @@ var __webpack_modules__ = {
|
|
|
134612
134689
|
function getPackageDirFromInstallRoot(dependencyId, installRoot) {
|
|
134613
134690
|
return path__rspack_import_1.join(installRoot, 'node_modules', ...dependencyId.split('/'));
|
|
134614
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
|
+
}
|
|
134615
134743
|
function readPackageJsonFromDir(packageDir) {
|
|
134616
134744
|
const manifestPath = path__rspack_import_1.join(packageDir, 'package.json');
|
|
134617
134745
|
if (!fs__rspack_import_0.existsSync(manifestPath)) return;
|
|
@@ -134643,8 +134771,7 @@ var __webpack_modules__ = {
|
|
|
134643
134771
|
if (fs__rspack_import_0.existsSync(absoluteEntry)) return absoluteEntry;
|
|
134644
134772
|
}
|
|
134645
134773
|
}
|
|
134646
|
-
function
|
|
134647
|
-
const packageDir = getPackageDirFromInstallRoot(dependencyId, installRoot);
|
|
134774
|
+
function resolveFromPackageDir(packageDir) {
|
|
134648
134775
|
if (!fs__rspack_import_0.existsSync(packageDir)) return;
|
|
134649
134776
|
try {
|
|
134650
134777
|
return require.resolve(packageDir);
|
|
@@ -134654,6 +134781,14 @@ var __webpack_modules__ = {
|
|
|
134654
134781
|
const candidateEntries = getPackageEntryCandidates(pkg);
|
|
134655
134782
|
return resolveFirstExistingEntry(packageDir, candidateEntries);
|
|
134656
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
|
+
}
|
|
134657
134792
|
function verifyPackageInInstallRoot(packageId, installRoot) {
|
|
134658
134793
|
if (tryResolveWithBase(packageId, installRoot)) return true;
|
|
134659
134794
|
if (resolveFromInstallRootPackageDir(packageId, installRoot)) return true;
|
|
@@ -135464,7 +135599,7 @@ var __webpack_modules__ = {
|
|
|
135464
135599
|
},
|
|
135465
135600
|
"./package.json" (module) {
|
|
135466
135601
|
"use strict";
|
|
135467
|
-
module.exports = JSON.parse('{"rE":"3.9.
|
|
135602
|
+
module.exports = JSON.parse('{"rE":"3.9.1-canary.233.8976161","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"}}');
|
|
135468
135603
|
}
|
|
135469
135604
|
};
|
|
135470
135605
|
var __webpack_module_cache__ = {};
|
package/package.json
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"webpack/webpack-lib/optional-dependencies.json"
|
|
26
26
|
],
|
|
27
27
|
"name": "extension-develop",
|
|
28
|
-
"version": "3.9.
|
|
28
|
+
"version": "3.9.1-canary.233.8976161",
|
|
29
29
|
"description": "Develop, build, preview, and package Extension.js projects.",
|
|
30
30
|
"author": {
|
|
31
31
|
"name": "Cezar Augusto",
|