extension 4.1.13 → 4.1.15
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/browsers.cjs +107 -1
- package/dist/cli.cjs +169 -11
- package/dist/extension/browsers/browsers-lib/first-run-install.d.ts +4 -0
- package/dist/extension/browsers/browsers-lib/messages.d.ts +4 -0
- package/dist/extension/helpers/browser-install-outcome.d.ts +10 -0
- package/dist/extension/helpers/telemetry-cli.d.ts +12 -2
- package/package.json +4 -4
package/dist/browsers.cjs
CHANGED
|
@@ -891,6 +891,20 @@ var __webpack_modules__ = {
|
|
|
891
891
|
function rdpInvalidRequestPayload() {
|
|
892
892
|
return `${getLoggingPrefix('error')} Received an unreadable Firefox remote debugging message.\nThe debugging connection is out of sync with the browser, usually after a crash or an abrupt reload.\nRestart the dev session.\nIf it repeats, report it with your Firefox version.`;
|
|
893
893
|
}
|
|
894
|
+
function firstRunInstallOffer(browser) {
|
|
895
|
+
const name = managedBrowserDisplayName(browser);
|
|
896
|
+
return `${getLoggingPrefix('info')} ${name} is not installed yet.\nExtension.js runs your extension in a version-pinned browser with an isolated profile, so it never touches the browser you use every day.\n${pintor__rspack_import_8_default().gray('NO DOWNLOAD')} ${pintor__rspack_import_8_default().blue('--browser=edge')} or ${pintor__rspack_import_8_default().blue('--browser=brave')} use a browser already on this machine, and ${pintor__rspack_import_8_default().blue('--chromium-binary')} ${pintor__rspack_import_8_default().gray('<abs-path>')} pins any binary, including your own Chrome.`;
|
|
897
|
+
}
|
|
898
|
+
function firstRunInstallQuestion(browser) {
|
|
899
|
+
const name = managedBrowserDisplayName(browser);
|
|
900
|
+
return `${getLoggingPrefix('info')} Download ${name} now? ${pintor__rspack_import_8_default().gray('[Y/n]')} `;
|
|
901
|
+
}
|
|
902
|
+
function firstRunInstallDeclined(browser) {
|
|
903
|
+
return `${getLoggingPrefix('info')} Skipped the download.\nRun ${pintor__rspack_import_8_default().blue(`npx extension install ${browser}`)} when you want it, or pass one of the no-download options above.`;
|
|
904
|
+
}
|
|
905
|
+
function firstRunInstallFailed(browser, reason) {
|
|
906
|
+
return `${getLoggingPrefix('warn')} The download did not finish.\n${pintor__rspack_import_8_default().gray('REASON')} ${reason}\nRun ${pintor__rspack_import_8_default().blue(`npx extension install ${browser}`)} to see the full output.`;
|
|
907
|
+
}
|
|
894
908
|
__webpack_require__.d(__webpack_exports__, {
|
|
895
909
|
$q: ()=>safariDefaultBundleIdNote,
|
|
896
910
|
$w: ()=>bestEffortBannerPrintFailed,
|
|
@@ -909,6 +923,7 @@ var __webpack_modules__ = {
|
|
|
909
923
|
F1: ()=>cdpClientBrowserConnectionEstablished,
|
|
910
924
|
F4: ()=>enhancedProcessManagementUncaughtException,
|
|
911
925
|
FF: ()=>cdpClientFoundTargets,
|
|
926
|
+
FW: ()=>firstRunInstallQuestion,
|
|
912
927
|
Fm: ()=>connectionClosedError,
|
|
913
928
|
G3: ()=>safariRequiresMacOS,
|
|
914
929
|
GB: ()=>waitingForBrowserDebugger,
|
|
@@ -928,6 +943,7 @@ var __webpack_modules__ = {
|
|
|
928
943
|
MS: ()=>errorConnectingToBrowser,
|
|
929
944
|
N4: ()=>enhancedProcessManagementUnhandledRejection,
|
|
930
945
|
NO: ()=>mv3BackgroundScriptsNotSupportedByChromium,
|
|
946
|
+
NT: ()=>firstRunInstallDeclined,
|
|
931
947
|
Nk: ()=>chromiumDryRunNotLaunching,
|
|
932
948
|
Q0: ()=>chromiumDryRunBinary,
|
|
933
949
|
Rl: ()=>safariBuilt,
|
|
@@ -959,6 +975,7 @@ var __webpack_modules__ = {
|
|
|
959
975
|
fR: ()=>cdpClientConnectionError,
|
|
960
976
|
fd: ()=>safariRegistered,
|
|
961
977
|
fw: ()=>safariOpening,
|
|
978
|
+
gX: ()=>firstRunInstallFailed,
|
|
962
979
|
hE: ()=>cdpClientConnectionClosed,
|
|
963
980
|
io: ()=>emptyLine,
|
|
964
981
|
jP: ()=>rdpInvalidRequestPayload,
|
|
@@ -969,6 +986,7 @@ var __webpack_modules__ = {
|
|
|
969
986
|
l9: ()=>parsingPacketError,
|
|
970
987
|
lO: ()=>firefoxDryRunArgs,
|
|
971
988
|
l_: ()=>safariConverted,
|
|
989
|
+
lk: ()=>firstRunInstallOffer,
|
|
972
990
|
ne: ()=>requireChromiumBinaryForChromiumBased,
|
|
973
991
|
nn: ()=>chromeProcessExited,
|
|
974
992
|
oB: ()=>safariSettingsPreserved,
|
|
@@ -2196,6 +2214,63 @@ var __webpack_modules__ = {
|
|
|
2196
2214
|
var external_yandex_location_default = /*#__PURE__*/ __webpack_require__.n(external_yandex_location_namespaceObject);
|
|
2197
2215
|
var messaging = __webpack_require__("./helpers/messaging.ts");
|
|
2198
2216
|
var banner = __webpack_require__("./browsers/browsers-lib/banner.ts");
|
|
2217
|
+
const external_node_readline_namespaceObject = require("node:readline");
|
|
2218
|
+
var external_node_readline_default = /*#__PURE__*/ __webpack_require__.n(external_node_readline_namespaceObject);
|
|
2219
|
+
var browser_install_outcome = __webpack_require__("./helpers/browser-install-outcome.ts");
|
|
2220
|
+
var messages = __webpack_require__("./browsers/browsers-lib/messages.ts");
|
|
2221
|
+
function isCI() {
|
|
2222
|
+
const v = process.env;
|
|
2223
|
+
return Boolean(v.CI || v.GITHUB_ACTIONS || v.GITLAB_CI || v.BUILDKITE || v.CIRCLECI || v.TRAVIS);
|
|
2224
|
+
}
|
|
2225
|
+
function canPromptForInstall() {
|
|
2226
|
+
if (process.env.VITEST || process.env.VITEST_WORKER_ID) return false;
|
|
2227
|
+
if (process.env.EXTENSION_NO_INSTALL_PROMPT) return false;
|
|
2228
|
+
if (isCI()) return false;
|
|
2229
|
+
return Boolean(process.stdin.isTTY && process.stdout.isTTY);
|
|
2230
|
+
}
|
|
2231
|
+
function askToInstall(question) {
|
|
2232
|
+
return new Promise((resolve)=>{
|
|
2233
|
+
const rl = external_node_readline_default().createInterface({
|
|
2234
|
+
input: process.stdin,
|
|
2235
|
+
output: process.stdout
|
|
2236
|
+
});
|
|
2237
|
+
const finish = (answer)=>{
|
|
2238
|
+
try {
|
|
2239
|
+
rl.close();
|
|
2240
|
+
} catch {}
|
|
2241
|
+
resolve(answer);
|
|
2242
|
+
};
|
|
2243
|
+
rl.question(question, (answer)=>{
|
|
2244
|
+
const normalized = String(answer || '').trim().toLowerCase();
|
|
2245
|
+
finish('n' !== normalized && 'no' !== normalized);
|
|
2246
|
+
});
|
|
2247
|
+
rl.on('SIGINT', ()=>finish(false));
|
|
2248
|
+
});
|
|
2249
|
+
}
|
|
2250
|
+
async function offerManagedInstall(target) {
|
|
2251
|
+
if (!canPromptForInstall()) return false;
|
|
2252
|
+
(0, messaging._w)(messages.lk(target));
|
|
2253
|
+
(0, browser_install_outcome.rQ)('offered', target);
|
|
2254
|
+
const accepted = await askToInstall(messages.FW(target));
|
|
2255
|
+
if (!accepted) {
|
|
2256
|
+
(0, browser_install_outcome.rQ)('declined', target);
|
|
2257
|
+
(0, messaging._w)(messages.NT(target));
|
|
2258
|
+
return false;
|
|
2259
|
+
}
|
|
2260
|
+
const startedAt = Date.now();
|
|
2261
|
+
try {
|
|
2262
|
+
const { extensionInstall } = await import("extension-install");
|
|
2263
|
+
await extensionInstall({
|
|
2264
|
+
browser: target
|
|
2265
|
+
});
|
|
2266
|
+
(0, browser_install_outcome.rQ)('accepted', target, (Date.now() - startedAt) / 1000);
|
|
2267
|
+
return true;
|
|
2268
|
+
} catch (error) {
|
|
2269
|
+
(0, browser_install_outcome.rQ)('failed', target, (Date.now() - startedAt) / 1000);
|
|
2270
|
+
(0, messaging._w)(messages.gX(target, error instanceof Error ? error.message : String(error)));
|
|
2271
|
+
return false;
|
|
2272
|
+
}
|
|
2273
|
+
}
|
|
2199
2274
|
var instance_registry = __webpack_require__("./browsers/browsers-lib/instance-registry.ts");
|
|
2200
2275
|
const MSG_REFERENCE = /__MSG_([A-Za-z0-9_@]+?)__/g;
|
|
2201
2276
|
function collectMsgReferences(value) {
|
|
@@ -2416,7 +2491,6 @@ var __webpack_modules__ = {
|
|
|
2416
2491
|
return false;
|
|
2417
2492
|
}
|
|
2418
2493
|
}
|
|
2419
|
-
var messages = __webpack_require__("./browsers/browsers-lib/messages.ts");
|
|
2420
2494
|
var output_binaries_resolver = __webpack_require__("./browsers/browsers-lib/output-binaries-resolver.ts");
|
|
2421
2495
|
var process_teardown = __webpack_require__("./browsers/browsers-lib/process-teardown.ts");
|
|
2422
2496
|
var ready_message = __webpack_require__("./browsers/browsers-lib/ready-message.ts");
|
|
@@ -3208,6 +3282,26 @@ var __webpack_modules__ = {
|
|
|
3208
3282
|
browserBinaryLocation = normalized;
|
|
3209
3283
|
}
|
|
3210
3284
|
}
|
|
3285
|
+
if (!browserBinaryLocation || !external_node_fs_.existsSync(browserBinaryLocation)) {
|
|
3286
|
+
const offerTarget = 'chromium' === browser ? 'chrome' : 'chrome' === browser || 'edge' === browser ? browser : null;
|
|
3287
|
+
if (offerTarget && await offerManagedInstall(offerTarget)) {
|
|
3288
|
+
const justInstalled = ()=>{
|
|
3289
|
+
try {
|
|
3290
|
+
const env = managedEnvFor(offerTarget);
|
|
3291
|
+
const located = 'edge' === offerTarget ? external_edge_location_default()({
|
|
3292
|
+
env
|
|
3293
|
+
}) : external_chrome_location2_default()(true, {
|
|
3294
|
+
env
|
|
3295
|
+
});
|
|
3296
|
+
return normalizePath(located || null);
|
|
3297
|
+
} catch {
|
|
3298
|
+
return null;
|
|
3299
|
+
}
|
|
3300
|
+
};
|
|
3301
|
+
const resolved = resolveManagedBinary() || justInstalled();
|
|
3302
|
+
if (isUsableBinary(resolved)) browserBinaryLocation = resolved;
|
|
3303
|
+
}
|
|
3304
|
+
}
|
|
3211
3305
|
if (!browserBinaryLocation || !external_node_fs_.existsSync(browserBinaryLocation)) {
|
|
3212
3306
|
if ('chromium' === browser || 'chromium-based' === browser) printInstallGuidance(getInstallGuidanceText('chromium'), 'chromium');
|
|
3213
3307
|
if (!printedGuidance && 'chromium' !== browser && 'chromium-based' !== browser) this.logger.error(messages.Ih(browser, browserBinaryLocation || ''));
|
|
@@ -6186,6 +6280,18 @@ var __webpack_modules__ = {
|
|
|
6186
6280
|
P: ()=>createSafariPackager
|
|
6187
6281
|
});
|
|
6188
6282
|
},
|
|
6283
|
+
"./helpers/browser-install-outcome.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
6284
|
+
function recordBrowserInstall(outcome, browser, seconds) {
|
|
6285
|
+
({
|
|
6286
|
+
...'number' == typeof seconds && Number.isFinite(seconds) && seconds >= 0 ? {
|
|
6287
|
+
seconds: Math.round(seconds)
|
|
6288
|
+
} : {}
|
|
6289
|
+
});
|
|
6290
|
+
}
|
|
6291
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
6292
|
+
rQ: ()=>recordBrowserInstall
|
|
6293
|
+
});
|
|
6294
|
+
},
|
|
6189
6295
|
"./helpers/messaging.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
6190
6296
|
var pintor__rspack_import_0 = __webpack_require__("pintor");
|
|
6191
6297
|
var pintor__rspack_import_0_default = /*#__PURE__*/ __webpack_require__.n(pintor__rspack_import_0);
|
package/dist/cli.cjs
CHANGED
|
@@ -892,6 +892,20 @@ var __webpack_modules__ = {
|
|
|
892
892
|
function rdpInvalidRequestPayload() {
|
|
893
893
|
return `${getLoggingPrefix('error')} Received an unreadable Firefox remote debugging message.\nThe debugging connection is out of sync with the browser, usually after a crash or an abrupt reload.\nRestart the dev session.\nIf it repeats, report it with your Firefox version.`;
|
|
894
894
|
}
|
|
895
|
+
function firstRunInstallOffer(browser) {
|
|
896
|
+
const name = managedBrowserDisplayName(browser);
|
|
897
|
+
return `${getLoggingPrefix('info')} ${name} is not installed yet.\nExtension.js runs your extension in a version-pinned browser with an isolated profile, so it never touches the browser you use every day.\n${pintor__rspack_import_8_default().gray('NO DOWNLOAD')} ${pintor__rspack_import_8_default().blue('--browser=edge')} or ${pintor__rspack_import_8_default().blue('--browser=brave')} use a browser already on this machine, and ${pintor__rspack_import_8_default().blue('--chromium-binary')} ${pintor__rspack_import_8_default().gray('<abs-path>')} pins any binary, including your own Chrome.`;
|
|
898
|
+
}
|
|
899
|
+
function firstRunInstallQuestion(browser) {
|
|
900
|
+
const name = managedBrowserDisplayName(browser);
|
|
901
|
+
return `${getLoggingPrefix('info')} Download ${name} now? ${pintor__rspack_import_8_default().gray('[Y/n]')} `;
|
|
902
|
+
}
|
|
903
|
+
function firstRunInstallDeclined(browser) {
|
|
904
|
+
return `${getLoggingPrefix('info')} Skipped the download.\nRun ${pintor__rspack_import_8_default().blue(`npx extension install ${browser}`)} when you want it, or pass one of the no-download options above.`;
|
|
905
|
+
}
|
|
906
|
+
function firstRunInstallFailed(browser, reason) {
|
|
907
|
+
return `${getLoggingPrefix('warn')} The download did not finish.\n${pintor__rspack_import_8_default().gray('REASON')} ${reason}\nRun ${pintor__rspack_import_8_default().blue(`npx extension install ${browser}`)} to see the full output.`;
|
|
908
|
+
}
|
|
895
909
|
__webpack_require__.d(__webpack_exports__, {
|
|
896
910
|
$q: ()=>safariDefaultBundleIdNote,
|
|
897
911
|
$w: ()=>bestEffortBannerPrintFailed,
|
|
@@ -910,6 +924,7 @@ var __webpack_modules__ = {
|
|
|
910
924
|
F1: ()=>cdpClientBrowserConnectionEstablished,
|
|
911
925
|
F4: ()=>enhancedProcessManagementUncaughtException,
|
|
912
926
|
FF: ()=>cdpClientFoundTargets,
|
|
927
|
+
FW: ()=>firstRunInstallQuestion,
|
|
913
928
|
Fm: ()=>connectionClosedError,
|
|
914
929
|
G3: ()=>safariRequiresMacOS,
|
|
915
930
|
GB: ()=>waitingForBrowserDebugger,
|
|
@@ -929,6 +944,7 @@ var __webpack_modules__ = {
|
|
|
929
944
|
MS: ()=>errorConnectingToBrowser,
|
|
930
945
|
N4: ()=>enhancedProcessManagementUnhandledRejection,
|
|
931
946
|
NO: ()=>mv3BackgroundScriptsNotSupportedByChromium,
|
|
947
|
+
NT: ()=>firstRunInstallDeclined,
|
|
932
948
|
Nk: ()=>chromiumDryRunNotLaunching,
|
|
933
949
|
Q0: ()=>chromiumDryRunBinary,
|
|
934
950
|
Rl: ()=>safariBuilt,
|
|
@@ -960,6 +976,7 @@ var __webpack_modules__ = {
|
|
|
960
976
|
fR: ()=>cdpClientConnectionError,
|
|
961
977
|
fd: ()=>safariRegistered,
|
|
962
978
|
fw: ()=>safariOpening,
|
|
979
|
+
gX: ()=>firstRunInstallFailed,
|
|
963
980
|
hE: ()=>cdpClientConnectionClosed,
|
|
964
981
|
io: ()=>emptyLine,
|
|
965
982
|
jP: ()=>rdpInvalidRequestPayload,
|
|
@@ -970,6 +987,7 @@ var __webpack_modules__ = {
|
|
|
970
987
|
l9: ()=>parsingPacketError,
|
|
971
988
|
lO: ()=>firefoxDryRunArgs,
|
|
972
989
|
l_: ()=>safariConverted,
|
|
990
|
+
lk: ()=>firstRunInstallOffer,
|
|
973
991
|
ne: ()=>requireChromiumBinaryForChromiumBased,
|
|
974
992
|
nn: ()=>chromeProcessExited,
|
|
975
993
|
oB: ()=>safariSettingsPreserved,
|
|
@@ -2187,6 +2205,63 @@ var __webpack_modules__ = {
|
|
|
2187
2205
|
var external_yandex_location_default = /*#__PURE__*/ __webpack_require__.n(external_yandex_location_namespaceObject);
|
|
2188
2206
|
var messaging = __webpack_require__("./helpers/messaging.ts");
|
|
2189
2207
|
var banner = __webpack_require__("./browsers/browsers-lib/banner.ts");
|
|
2208
|
+
const external_node_readline_namespaceObject = require("node:readline");
|
|
2209
|
+
var external_node_readline_default = /*#__PURE__*/ __webpack_require__.n(external_node_readline_namespaceObject);
|
|
2210
|
+
var browser_install_outcome = __webpack_require__("./helpers/browser-install-outcome.ts");
|
|
2211
|
+
var messages = __webpack_require__("./browsers/browsers-lib/messages.ts");
|
|
2212
|
+
function isCI() {
|
|
2213
|
+
const v = process.env;
|
|
2214
|
+
return Boolean(v.CI || v.GITHUB_ACTIONS || v.GITLAB_CI || v.BUILDKITE || v.CIRCLECI || v.TRAVIS);
|
|
2215
|
+
}
|
|
2216
|
+
function canPromptForInstall() {
|
|
2217
|
+
if (process.env.VITEST || process.env.VITEST_WORKER_ID) return false;
|
|
2218
|
+
if (process.env.EXTENSION_NO_INSTALL_PROMPT) return false;
|
|
2219
|
+
if (isCI()) return false;
|
|
2220
|
+
return Boolean(process.stdin.isTTY && process.stdout.isTTY);
|
|
2221
|
+
}
|
|
2222
|
+
function askToInstall(question) {
|
|
2223
|
+
return new Promise((resolve)=>{
|
|
2224
|
+
const rl = external_node_readline_default().createInterface({
|
|
2225
|
+
input: process.stdin,
|
|
2226
|
+
output: process.stdout
|
|
2227
|
+
});
|
|
2228
|
+
const finish = (answer)=>{
|
|
2229
|
+
try {
|
|
2230
|
+
rl.close();
|
|
2231
|
+
} catch {}
|
|
2232
|
+
resolve(answer);
|
|
2233
|
+
};
|
|
2234
|
+
rl.question(question, (answer)=>{
|
|
2235
|
+
const normalized = String(answer || '').trim().toLowerCase();
|
|
2236
|
+
finish('n' !== normalized && 'no' !== normalized);
|
|
2237
|
+
});
|
|
2238
|
+
rl.on('SIGINT', ()=>finish(false));
|
|
2239
|
+
});
|
|
2240
|
+
}
|
|
2241
|
+
async function offerManagedInstall(target) {
|
|
2242
|
+
if (!canPromptForInstall()) return false;
|
|
2243
|
+
(0, messaging._w)(messages.lk(target));
|
|
2244
|
+
(0, browser_install_outcome.rQ)('offered', target);
|
|
2245
|
+
const accepted = await askToInstall(messages.FW(target));
|
|
2246
|
+
if (!accepted) {
|
|
2247
|
+
(0, browser_install_outcome.rQ)('declined', target);
|
|
2248
|
+
(0, messaging._w)(messages.NT(target));
|
|
2249
|
+
return false;
|
|
2250
|
+
}
|
|
2251
|
+
const startedAt = Date.now();
|
|
2252
|
+
try {
|
|
2253
|
+
const { extensionInstall } = await import("extension-install");
|
|
2254
|
+
await extensionInstall({
|
|
2255
|
+
browser: target
|
|
2256
|
+
});
|
|
2257
|
+
(0, browser_install_outcome.rQ)('accepted', target, (Date.now() - startedAt) / 1000);
|
|
2258
|
+
return true;
|
|
2259
|
+
} catch (error) {
|
|
2260
|
+
(0, browser_install_outcome.rQ)('failed', target, (Date.now() - startedAt) / 1000);
|
|
2261
|
+
(0, messaging._w)(messages.gX(target, error instanceof Error ? error.message : String(error)));
|
|
2262
|
+
return false;
|
|
2263
|
+
}
|
|
2264
|
+
}
|
|
2190
2265
|
var instance_registry = __webpack_require__("./browsers/browsers-lib/instance-registry.ts");
|
|
2191
2266
|
const MSG_REFERENCE = /__MSG_([A-Za-z0-9_@]+?)__/g;
|
|
2192
2267
|
function collectMsgReferences(value) {
|
|
@@ -2407,7 +2482,6 @@ var __webpack_modules__ = {
|
|
|
2407
2482
|
return false;
|
|
2408
2483
|
}
|
|
2409
2484
|
}
|
|
2410
|
-
var messages = __webpack_require__("./browsers/browsers-lib/messages.ts");
|
|
2411
2485
|
var output_binaries_resolver = __webpack_require__("./browsers/browsers-lib/output-binaries-resolver.ts");
|
|
2412
2486
|
var process_teardown = __webpack_require__("./browsers/browsers-lib/process-teardown.ts");
|
|
2413
2487
|
var ready_message = __webpack_require__("./browsers/browsers-lib/ready-message.ts");
|
|
@@ -3199,6 +3273,26 @@ var __webpack_modules__ = {
|
|
|
3199
3273
|
browserBinaryLocation = normalized;
|
|
3200
3274
|
}
|
|
3201
3275
|
}
|
|
3276
|
+
if (!browserBinaryLocation || !external_node_fs_.existsSync(browserBinaryLocation)) {
|
|
3277
|
+
const offerTarget = 'chromium' === browser ? 'chrome' : 'chrome' === browser || 'edge' === browser ? browser : null;
|
|
3278
|
+
if (offerTarget && await offerManagedInstall(offerTarget)) {
|
|
3279
|
+
const justInstalled = ()=>{
|
|
3280
|
+
try {
|
|
3281
|
+
const env = managedEnvFor(offerTarget);
|
|
3282
|
+
const located = 'edge' === offerTarget ? external_edge_location_default()({
|
|
3283
|
+
env
|
|
3284
|
+
}) : external_chrome_location2_default()(true, {
|
|
3285
|
+
env
|
|
3286
|
+
});
|
|
3287
|
+
return normalizePath(located || null);
|
|
3288
|
+
} catch {
|
|
3289
|
+
return null;
|
|
3290
|
+
}
|
|
3291
|
+
};
|
|
3292
|
+
const resolved = resolveManagedBinary() || justInstalled();
|
|
3293
|
+
if (isUsableBinary(resolved)) browserBinaryLocation = resolved;
|
|
3294
|
+
}
|
|
3295
|
+
}
|
|
3202
3296
|
if (!browserBinaryLocation || !external_node_fs_.existsSync(browserBinaryLocation)) {
|
|
3203
3297
|
if ('chromium' === browser || 'chromium-based' === browser) printInstallGuidance(getInstallGuidanceText('chromium'), 'chromium');
|
|
3204
3298
|
if (!printedGuidance && 'chromium' !== browser && 'chromium-based' !== browser) this.logger.error(messages.Ih(browser, browserBinaryLocation || ''));
|
|
@@ -6177,6 +6271,25 @@ var __webpack_modules__ = {
|
|
|
6177
6271
|
P: ()=>createSafariPackager
|
|
6178
6272
|
});
|
|
6179
6273
|
},
|
|
6274
|
+
"./helpers/browser-install-outcome.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
6275
|
+
let record = null;
|
|
6276
|
+
function recordBrowserInstall(outcome, browser, seconds) {
|
|
6277
|
+
record = {
|
|
6278
|
+
outcome,
|
|
6279
|
+
browser,
|
|
6280
|
+
...'number' == typeof seconds && Number.isFinite(seconds) && seconds >= 0 ? {
|
|
6281
|
+
seconds: Math.round(seconds)
|
|
6282
|
+
} : {}
|
|
6283
|
+
};
|
|
6284
|
+
}
|
|
6285
|
+
function readBrowserInstall() {
|
|
6286
|
+
return record;
|
|
6287
|
+
}
|
|
6288
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
6289
|
+
rQ: ()=>recordBrowserInstall,
|
|
6290
|
+
w6: ()=>readBrowserInstall
|
|
6291
|
+
});
|
|
6292
|
+
},
|
|
6180
6293
|
"./helpers/messaging.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
6181
6294
|
var pintor__rspack_import_0 = __webpack_require__("pintor");
|
|
6182
6295
|
var pintor__rspack_import_0_default = /*#__PURE__*/ __webpack_require__.n(pintor__rspack_import_0);
|
|
@@ -6497,6 +6610,7 @@ var __webpack_modules__ = {
|
|
|
6497
6610
|
var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_);
|
|
6498
6611
|
var external_pintor_ = __webpack_require__("pintor");
|
|
6499
6612
|
var external_pintor_default = /*#__PURE__*/ __webpack_require__.n(external_pintor_);
|
|
6613
|
+
var browser_install_outcome = __webpack_require__("./helpers/browser-install-outcome.ts");
|
|
6500
6614
|
let cachedPackageJson = null;
|
|
6501
6615
|
function getCliPackageJson() {
|
|
6502
6616
|
if (cachedPackageJson) return cachedPackageJson;
|
|
@@ -6512,6 +6626,7 @@ var __webpack_modules__ = {
|
|
|
6512
6626
|
}
|
|
6513
6627
|
throw new Error('Extension.js CLI package.json not found.');
|
|
6514
6628
|
}
|
|
6629
|
+
var messaging = __webpack_require__("./helpers/messaging.ts");
|
|
6515
6630
|
var external_node_crypto_ = __webpack_require__("node:crypto");
|
|
6516
6631
|
var external_node_crypto_default = /*#__PURE__*/ __webpack_require__.n(external_node_crypto_);
|
|
6517
6632
|
var external_node_os_ = __webpack_require__("node:os");
|
|
@@ -7147,14 +7262,23 @@ var __webpack_modules__ = {
|
|
|
7147
7262
|
].join('\n');
|
|
7148
7263
|
}
|
|
7149
7264
|
const KNOWN_COMMANDS = new Set([
|
|
7265
|
+
'build',
|
|
7266
|
+
'capabilities',
|
|
7150
7267
|
'create',
|
|
7151
7268
|
'dev',
|
|
7152
|
-
'
|
|
7153
|
-
'
|
|
7154
|
-
'
|
|
7269
|
+
'doctor',
|
|
7270
|
+
'eval',
|
|
7271
|
+
'inspect',
|
|
7155
7272
|
'install',
|
|
7156
|
-
'
|
|
7273
|
+
'logs',
|
|
7274
|
+
'open',
|
|
7275
|
+
'preview',
|
|
7276
|
+
'publish',
|
|
7277
|
+
'reload',
|
|
7278
|
+
'start',
|
|
7279
|
+
'storage',
|
|
7157
7280
|
'telemetry',
|
|
7281
|
+
'uninstall',
|
|
7158
7282
|
'unknown'
|
|
7159
7283
|
]);
|
|
7160
7284
|
function detectInvokedCommand(argv) {
|
|
@@ -7187,8 +7311,17 @@ var __webpack_modules__ = {
|
|
|
7187
7311
|
if (templateAliasFor(name)) return name;
|
|
7188
7312
|
}
|
|
7189
7313
|
function telemetryCommandContext(command, argv = process.argv) {
|
|
7190
|
-
|
|
7314
|
+
const install = (0, browser_install_outcome.w6)();
|
|
7315
|
+
const installContext = install ? {
|
|
7316
|
+
browser_install: install.outcome,
|
|
7317
|
+
browser_install_browser: install.browser,
|
|
7318
|
+
...void 0 === install.seconds ? {} : {
|
|
7319
|
+
browser_install_seconds: install.seconds
|
|
7320
|
+
}
|
|
7321
|
+
} : {};
|
|
7322
|
+
if ('create' !== command) return installContext;
|
|
7191
7323
|
return {
|
|
7324
|
+
...installContext,
|
|
7192
7325
|
template: advertisedTemplateName(readArgValue(argv, [
|
|
7193
7326
|
'--template',
|
|
7194
7327
|
'-t'
|
|
@@ -7232,12 +7365,29 @@ var __webpack_modules__ = {
|
|
|
7232
7365
|
...telemetryCommandContext(command)
|
|
7233
7366
|
});
|
|
7234
7367
|
}
|
|
7235
|
-
function
|
|
7368
|
+
function telemetryFailureCode(code) {
|
|
7369
|
+
if ('string' != typeof code) return;
|
|
7370
|
+
return Object.prototype.hasOwnProperty.call(messaging.Lp, code) ? code : void 0;
|
|
7371
|
+
}
|
|
7372
|
+
function telemetryExitCode(exitCode) {
|
|
7373
|
+
if ('number' != typeof exitCode) return;
|
|
7374
|
+
if (!Number.isInteger(exitCode) || exitCode < 0 || exitCode > 255) return;
|
|
7375
|
+
return exitCode;
|
|
7376
|
+
}
|
|
7377
|
+
function markCommandFailure(command = invoked, details = {}) {
|
|
7236
7378
|
if (!markTracked()) return;
|
|
7379
|
+
const code = telemetryFailureCode(details.code);
|
|
7380
|
+
const exitCode = telemetryExitCode(details.exitCode);
|
|
7237
7381
|
telemetry.track('command_failed', {
|
|
7238
7382
|
command,
|
|
7239
7383
|
success: false,
|
|
7240
7384
|
version: telemetry_cli_version,
|
|
7385
|
+
...code ? {
|
|
7386
|
+
code
|
|
7387
|
+
} : {},
|
|
7388
|
+
...void 0 === exitCode ? {} : {
|
|
7389
|
+
exit_code: exitCode
|
|
7390
|
+
},
|
|
7241
7391
|
...telemetryCommandContext(command)
|
|
7242
7392
|
});
|
|
7243
7393
|
}
|
|
@@ -7403,7 +7553,6 @@ var __webpack_modules__ = {
|
|
|
7403
7553
|
const bridgeSpecifier = 'extension-develop/bridge';
|
|
7404
7554
|
return await import(bridgeSpecifier);
|
|
7405
7555
|
}
|
|
7406
|
-
var messaging = __webpack_require__("./helpers/messaging.ts");
|
|
7407
7556
|
function getLoggingPrefix(type) {
|
|
7408
7557
|
return (0, messaging.Pl)(type);
|
|
7409
7558
|
}
|
|
@@ -9108,7 +9257,10 @@ Cross-browser compatibility
|
|
|
9108
9257
|
cliVersion: getCliPackageJson().version
|
|
9109
9258
|
});
|
|
9110
9259
|
} catch (error) {
|
|
9111
|
-
markCommandFailure(
|
|
9260
|
+
markCommandFailure(void 0, {
|
|
9261
|
+
code: createErrorCode(error),
|
|
9262
|
+
exitCode: 1
|
|
9263
|
+
});
|
|
9112
9264
|
if (!asJson) throw error;
|
|
9113
9265
|
console.log(JSON.stringify(messaging.Pr.fail('create', 'failed', {
|
|
9114
9266
|
code: createErrorCode(error),
|
|
@@ -10775,13 +10927,19 @@ Cross-browser compatibility
|
|
|
10775
10927
|
if (isCommanderError(err)) {
|
|
10776
10928
|
const exitCode = commanderExitCode(err);
|
|
10777
10929
|
if (0 === exitCode) process.exit(0);
|
|
10778
|
-
markCommandFailure(
|
|
10930
|
+
markCommandFailure(void 0, {
|
|
10931
|
+
code: messaging.Lp.E_ARGS,
|
|
10932
|
+
exitCode
|
|
10933
|
+
});
|
|
10779
10934
|
console.error(commanderHumanError(err, commandName));
|
|
10780
10935
|
if (asJson) writeStdoutFrame(commanderErrorEnvelope(err, commandName));
|
|
10781
10936
|
await exitAfterDrain(exitCode);
|
|
10782
10937
|
return;
|
|
10783
10938
|
}
|
|
10784
|
-
markCommandFailure(
|
|
10939
|
+
markCommandFailure(void 0, {
|
|
10940
|
+
code: telemetryFailureCode(err?.code) || messaging.Lp.E_INTERNAL,
|
|
10941
|
+
exitCode: 1
|
|
10942
|
+
});
|
|
10785
10943
|
console.error(unhandledError(err));
|
|
10786
10944
|
if (asJson && !isErrorFramed(err)) writeStdoutFrame(internalErrorEnvelope(err, commandName));
|
|
10787
10945
|
await exitAfterDrain(1);
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export type InstallableTarget = 'chrome' | 'chromium' | 'edge' | 'firefox';
|
|
2
|
+
export declare function canPromptForInstall(): boolean;
|
|
3
|
+
export declare function askToInstall(question: string): Promise<boolean>;
|
|
4
|
+
export declare function offerManagedInstall(target: InstallableTarget): Promise<boolean>;
|
|
@@ -140,4 +140,8 @@ export declare function requireGeckoBinaryForGeckoBased(): string;
|
|
|
140
140
|
export declare function invalidChromiumBinaryPath(p: string): string;
|
|
141
141
|
export declare function invalidGeckoBinaryPath(p: string): string;
|
|
142
142
|
export declare function rdpInvalidRequestPayload(): string;
|
|
143
|
+
export declare function firstRunInstallOffer(browser: string): string;
|
|
144
|
+
export declare function firstRunInstallQuestion(browser: string): string;
|
|
145
|
+
export declare function firstRunInstallDeclined(browser: string): string;
|
|
146
|
+
export declare function firstRunInstallFailed(browser: string, reason: string): string;
|
|
143
147
|
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type BrowserInstallOutcome = 'offered' | 'accepted' | 'declined' | 'failed';
|
|
2
|
+
interface BrowserInstallRecord {
|
|
3
|
+
outcome: BrowserInstallOutcome;
|
|
4
|
+
browser: string;
|
|
5
|
+
seconds?: number;
|
|
6
|
+
}
|
|
7
|
+
export declare function recordBrowserInstall(outcome: BrowserInstallOutcome, browser: string, seconds?: number): void;
|
|
8
|
+
export declare function readBrowserInstall(): BrowserInstallRecord | null;
|
|
9
|
+
export declare function resetBrowserInstall(): void;
|
|
10
|
+
export {};
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { Telemetry, type TelemetrySource } from './telemetry';
|
|
2
|
-
type KnownCommand = 'create' | 'dev' | '
|
|
2
|
+
type KnownCommand = 'build' | 'capabilities' | 'create' | 'dev' | 'doctor' | 'eval' | 'inspect' | 'install' | 'logs' | 'open' | 'preview' | 'publish' | 'reload' | 'start' | 'storage' | 'telemetry' | 'uninstall' | 'unknown';
|
|
3
|
+
export declare const KNOWN_COMMANDS: ReadonlySet<KnownCommand>;
|
|
3
4
|
export declare function detectInvokedCommand(argv: string[]): KnownCommand;
|
|
4
5
|
export declare function advertisedTemplateName(value: string | undefined): string | undefined;
|
|
5
6
|
export declare function telemetryCommandContext(command: string, argv?: string[]): {
|
|
6
7
|
template?: string;
|
|
7
8
|
source?: string;
|
|
9
|
+
browser_install?: string;
|
|
10
|
+
browser_install_browser?: string;
|
|
11
|
+
browser_install_seconds?: number;
|
|
8
12
|
};
|
|
9
13
|
export declare const telemetry: Telemetry;
|
|
10
14
|
export declare function getTelemetryConsent(): {
|
|
@@ -16,5 +20,11 @@ export declare function setTelemetryConsent(value: 'enabled' | 'disabled'): {
|
|
|
16
20
|
path: string | null;
|
|
17
21
|
};
|
|
18
22
|
export declare function markCommandSuccess(command?: KnownCommand): void;
|
|
19
|
-
export
|
|
23
|
+
export interface CommandFailureDetails {
|
|
24
|
+
code?: unknown;
|
|
25
|
+
exitCode?: unknown;
|
|
26
|
+
}
|
|
27
|
+
export declare function telemetryFailureCode(code: unknown): string | undefined;
|
|
28
|
+
export declare function telemetryExitCode(exitCode: unknown): number | undefined;
|
|
29
|
+
export declare function markCommandFailure(command?: KnownCommand, details?: CommandFailureDetails): void;
|
|
20
30
|
export {};
|
package/package.json
CHANGED
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"extension": "./bin/extension.cjs"
|
|
39
39
|
},
|
|
40
40
|
"name": "extension",
|
|
41
|
-
"version": "4.1.
|
|
41
|
+
"version": "4.1.15",
|
|
42
42
|
"description": "The cross-browser extension framework. Build Chrome, Edge, Firefox, and Safari extensions with no build configuration.",
|
|
43
43
|
"homepage": "https://extension.js.org/",
|
|
44
44
|
"bugs": {
|
|
@@ -106,9 +106,9 @@
|
|
|
106
106
|
"vivaldi-location2": "2.1.1",
|
|
107
107
|
"waterfox-location": "2.1.1",
|
|
108
108
|
"yandex-location": "2.1.1",
|
|
109
|
-
"extension-create": "4.1.
|
|
110
|
-
"extension-develop": "4.1.
|
|
111
|
-
"extension-install": "4.1.
|
|
109
|
+
"extension-create": "4.1.15",
|
|
110
|
+
"extension-develop": "4.1.15",
|
|
111
|
+
"extension-install": "4.1.15",
|
|
112
112
|
"commander": "^15.0.0",
|
|
113
113
|
"pintor": "0.3.0",
|
|
114
114
|
"semver": "^7.7.3",
|