extension-develop 3.5.0-next.22 → 3.5.0-next.24
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/323.cjs +46 -7
- package/dist/module.cjs +16 -53
- package/package.json +1 -1
package/dist/323.cjs
CHANGED
|
@@ -14,30 +14,69 @@ exports.modules = {
|
|
|
14
14
|
var external_fs_ = __webpack_require__("fs");
|
|
15
15
|
async function deriveExtensionIdFromTargetsHelper(cdp, outPath, maxRetries = 20, backoffMs = 200) {
|
|
16
16
|
let expectedName;
|
|
17
|
+
let expectedVersion;
|
|
18
|
+
let expectedManifestVersion;
|
|
19
|
+
let expectedNameIsMsg = false;
|
|
17
20
|
try {
|
|
18
21
|
const manifest = JSON.parse(external_fs_.readFileSync(external_path_.join(outPath, 'manifest.json'), 'utf-8'));
|
|
19
22
|
expectedName = manifest?.name;
|
|
23
|
+
expectedVersion = manifest?.version;
|
|
24
|
+
expectedManifestVersion = manifest?.manifest_version;
|
|
25
|
+
expectedNameIsMsg = 'string' == typeof expectedName && /__MSG_/i.test(expectedName);
|
|
26
|
+
if (expectedNameIsMsg) {
|
|
27
|
+
const defaultLocale = String(manifest?.default_locale || '').trim();
|
|
28
|
+
const msgKeyMatch = String(expectedName || '').match(/__MSG_([^_]+)__/i);
|
|
29
|
+
const msgKey = msgKeyMatch ? msgKeyMatch[1] : '';
|
|
30
|
+
if (defaultLocale && msgKey) try {
|
|
31
|
+
const messagesPath = external_path_.join(outPath, '_locales', defaultLocale, 'messages.json');
|
|
32
|
+
if (external_fs_.existsSync(messagesPath)) {
|
|
33
|
+
const messagesJson = JSON.parse(external_fs_.readFileSync(messagesPath, 'utf-8'));
|
|
34
|
+
const resolved = String(messagesJson?.[msgKey]?.message || '').trim();
|
|
35
|
+
if (resolved) {
|
|
36
|
+
expectedName = resolved;
|
|
37
|
+
expectedNameIsMsg = false;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
} catch {}
|
|
41
|
+
}
|
|
20
42
|
} catch {}
|
|
21
43
|
let retries = 0;
|
|
22
44
|
while(retries <= maxRetries){
|
|
23
45
|
try {
|
|
24
46
|
const targets = await cdp.getTargets();
|
|
25
|
-
|
|
47
|
+
let firstEvalId = null;
|
|
48
|
+
let evalIdCount = 0;
|
|
49
|
+
for (const t of targets || []){
|
|
26
50
|
const url = String(t?.url || '');
|
|
27
51
|
const type = String(t?.type || '');
|
|
28
|
-
|
|
52
|
+
const typeOk = [
|
|
53
|
+
'service_worker',
|
|
54
|
+
'background_page',
|
|
55
|
+
'worker'
|
|
56
|
+
].includes(type);
|
|
57
|
+
if (!typeOk) continue;
|
|
58
|
+
if (url && !url.startsWith('chrome-extension://')) continue;
|
|
29
59
|
const targetId = t?.targetId;
|
|
30
60
|
if (targetId) try {
|
|
31
61
|
const sessionId = await cdp.attachToTarget(targetId);
|
|
32
62
|
if (!sessionId) continue;
|
|
33
63
|
await cdp.sendCommand('Runtime.enable', {}, sessionId);
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
64
|
+
const info = await cdp.evaluate(sessionId, '(()=>{try{const m=chrome.runtime.getManifest?.();return {id:chrome.runtime?.id||"",name:m?.name||"",version:m?.version||"",manifestVersion:m?.manifest_version||0}}catch(_){return null}})()');
|
|
65
|
+
const id = String(info?.id || '').trim();
|
|
66
|
+
if (!id) continue;
|
|
67
|
+
evalIdCount += 1;
|
|
68
|
+
if (!firstEvalId) firstEvalId = id;
|
|
69
|
+
const gotName = String(info?.name || '');
|
|
70
|
+
const gotVersion = String(info?.version || '');
|
|
71
|
+
const gotManifestVersion = Number(info?.manifestVersion || 0);
|
|
72
|
+
const nameMatches = expectedName && !expectedNameIsMsg ? gotName === expectedName : false;
|
|
73
|
+
const versionMatches = expectedVersion ? gotVersion === expectedVersion : false;
|
|
74
|
+
const manifestVersionMatches = expectedManifestVersion ? gotManifestVersion === expectedManifestVersion : false;
|
|
75
|
+
if (nameMatches) return id;
|
|
76
|
+
if (expectedVersion && versionMatches && (expectedManifestVersion ? manifestVersionMatches : true)) return id;
|
|
39
77
|
} catch {}
|
|
40
78
|
}
|
|
79
|
+
if (1 === evalIdCount && firstEvalId) return firstEvalId;
|
|
41
80
|
for (const t of targets || []){
|
|
42
81
|
const url = String(t?.url || '');
|
|
43
82
|
const type = String(t?.type || '');
|
package/dist/module.cjs
CHANGED
|
@@ -127935,16 +127935,6 @@ var __webpack_modules__ = {
|
|
|
127935
127935
|
} catch {}
|
|
127936
127936
|
const browserLabel = effectiveBrowserLine && effectiveBrowserLine.trim().length > 0 ? effectiveBrowserLine.trim() : capitalize(String(browser || 'unknown'));
|
|
127937
127937
|
const cleanId = String(id || '').trim();
|
|
127938
|
-
const urlScheme = 'firefox' === browser || 'gecko-based' === browser ? 'moz-extension' : 'chrome-extension';
|
|
127939
|
-
cleanId.length;
|
|
127940
|
-
(()=>{
|
|
127941
|
-
if ('firefox' === browser || 'gecko-based' === browser) return 'about:debugging#/runtime/this-firefox';
|
|
127942
|
-
if ('chrome' === browser || 'chromium' === browser || 'chromium-based' === browser || 'edge' === browser) return cleanId.length > 0 ? `chrome://extensions/?id=${cleanId}` : 'chrome://extensions';
|
|
127943
|
-
return cleanId.length > 0 ? `${urlScheme}://${cleanId}` : '(temporary)';
|
|
127944
|
-
})();
|
|
127945
|
-
('firefox' === browser || 'gecko-based' === browser) && 'true' === process.env.EXTENSION_AUTHOR_MODE && cleanId.length;
|
|
127946
|
-
hostPermissions && hostPermissions.length;
|
|
127947
|
-
permissions && permissions.length;
|
|
127948
127938
|
const lines = [];
|
|
127949
127939
|
const includeExtensionId = opts?.includeExtensionId !== false;
|
|
127950
127940
|
const updateNotice = updateSuffix ? ` ${updateSuffix}` : '';
|
|
@@ -133077,39 +133067,18 @@ var __webpack_modules__ = {
|
|
|
133077
133067
|
} catch {}
|
|
133078
133068
|
return resolveNpmCliFromNode(process.execPath);
|
|
133079
133069
|
}
|
|
133080
|
-
function resolveWindowsCmdExe() {
|
|
133081
|
-
if ('win32' !== process.platform) return 'cmd.exe';
|
|
133082
|
-
const comspec = process.env.ComSpec;
|
|
133083
|
-
if (comspec && fs__rspack_import_0.existsSync(comspec)) return comspec;
|
|
133084
|
-
const systemRoot = process.env.SystemRoot || 'C:\\Windows';
|
|
133085
|
-
const fallback = path__rspack_import_1.join(systemRoot, 'System32', 'cmd.exe');
|
|
133086
|
-
if (fs__rspack_import_0.existsSync(fallback)) return fallback;
|
|
133087
|
-
return 'cmd.exe';
|
|
133088
|
-
}
|
|
133089
133070
|
function isWindowsExecutablePath(value) {
|
|
133090
133071
|
if (!value || 'win32' !== process.platform) return false;
|
|
133091
133072
|
return /\.(cmd|bat|exe)$/i.test(value);
|
|
133092
133073
|
}
|
|
133093
|
-
function shouldUseCmdExe(command) {
|
|
133094
|
-
if ('win32' !== process.platform) return false;
|
|
133095
|
-
if (/\.(cmd|bat)$/i.test(command)) return true;
|
|
133096
|
-
return [
|
|
133097
|
-
'npm',
|
|
133098
|
-
'pnpm',
|
|
133099
|
-
'yarn',
|
|
133100
|
-
'corepack',
|
|
133101
|
-
'bun'
|
|
133102
|
-
].includes(command);
|
|
133103
|
-
}
|
|
133104
133074
|
function resolveWindowsCommandPath(command) {
|
|
133105
133075
|
if ('win32' !== process.platform) return;
|
|
133106
133076
|
try {
|
|
133107
|
-
const
|
|
133108
|
-
const
|
|
133109
|
-
|
|
133110
|
-
|
|
133111
|
-
|
|
133112
|
-
`where ${command}`
|
|
133077
|
+
const systemRoot = process.env.SystemRoot || 'C:\\Windows';
|
|
133078
|
+
const whereExe = path__rspack_import_1.join(systemRoot, 'System32', 'where.exe');
|
|
133079
|
+
const whereCommand = fs__rspack_import_0.existsSync(whereExe) ? whereExe : 'where';
|
|
133080
|
+
const output = (0, child_process__rspack_import_2.execFileSync)(whereCommand, [
|
|
133081
|
+
command
|
|
133113
133082
|
], {
|
|
133114
133083
|
encoding: 'utf8',
|
|
133115
133084
|
stdio: [
|
|
@@ -133188,10 +133157,15 @@ var __webpack_modules__ = {
|
|
|
133188
133157
|
];
|
|
133189
133158
|
for (const candidate of candidates){
|
|
133190
133159
|
const resolved = resolveCommandOnPath(candidate);
|
|
133191
|
-
if (resolved)
|
|
133192
|
-
|
|
133193
|
-
|
|
133194
|
-
|
|
133160
|
+
if (resolved) {
|
|
133161
|
+
if ('win32' === process.platform && /\.(cmd|bat)$/i.test(resolved)) return {
|
|
133162
|
+
name: candidate
|
|
133163
|
+
};
|
|
133164
|
+
return {
|
|
133165
|
+
name: candidate,
|
|
133166
|
+
execPath: resolved
|
|
133167
|
+
};
|
|
133168
|
+
}
|
|
133195
133169
|
}
|
|
133196
133170
|
const corepackPath = resolveCommandOnPath('corepack');
|
|
133197
133171
|
if (corepackPath || canRunCorepack()) return {
|
|
@@ -133264,21 +133238,10 @@ var __webpack_modules__ = {
|
|
|
133264
133238
|
};
|
|
133265
133239
|
}
|
|
133266
133240
|
function buildSpawnInvocation(command, args) {
|
|
133267
|
-
|
|
133241
|
+
return {
|
|
133268
133242
|
command,
|
|
133269
133243
|
args
|
|
133270
133244
|
};
|
|
133271
|
-
const cmdExe = resolveWindowsCmdExe();
|
|
133272
|
-
return {
|
|
133273
|
-
command: cmdExe,
|
|
133274
|
-
args: [
|
|
133275
|
-
'/d',
|
|
133276
|
-
'/s',
|
|
133277
|
-
'/c',
|
|
133278
|
-
command,
|
|
133279
|
-
...args
|
|
133280
|
-
]
|
|
133281
|
-
};
|
|
133282
133245
|
}
|
|
133283
133246
|
function execInstallCommand(command, args, options) {
|
|
133284
133247
|
const invocation = buildSpawnInvocation(command, args);
|
|
@@ -133580,7 +133543,7 @@ var __webpack_modules__ = {
|
|
|
133580
133543
|
},
|
|
133581
133544
|
"./package.json" (module) {
|
|
133582
133545
|
"use strict";
|
|
133583
|
-
module.exports = JSON.parse('{"rE":"3.5.0-next.
|
|
133546
|
+
module.exports = JSON.parse('{"rE":"3.5.0-next.24","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","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"}}');
|
|
133584
133547
|
}
|
|
133585
133548
|
};
|
|
133586
133549
|
var __webpack_module_cache__ = {};
|
package/package.json
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"webpack/webpack-lib/build-dependencies.json"
|
|
25
25
|
],
|
|
26
26
|
"name": "extension-develop",
|
|
27
|
-
"version": "3.5.0-next.
|
|
27
|
+
"version": "3.5.0-next.24",
|
|
28
28
|
"description": "Develop, build, preview, and package Extension.js projects.",
|
|
29
29
|
"author": {
|
|
30
30
|
"name": "Cezar Augusto",
|