extension-install 4.1.25 → 4.1.27
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/lib/messaging.d.ts +1 -0
- package/dist/lib/runner.d.ts +1 -0
- package/dist/module.cjs +52 -16
- package/package.json +2 -1
package/dist/lib/messaging.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ export interface CardInput {
|
|
|
26
26
|
}
|
|
27
27
|
export declare const MAX_CARD_ROWS = 3;
|
|
28
28
|
export declare function card(input?: CardInput): string;
|
|
29
|
+
export declare function browserDisplayName(browser: string): string;
|
|
29
30
|
export declare function browserRowValue(browser: string, versionLine?: string): string;
|
|
30
31
|
export declare function isCardKeyClaimed(key: string): boolean;
|
|
31
32
|
export declare function claimCardKey(key: string): boolean;
|
package/dist/lib/runner.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { InstallBrowserTarget } from './browser-target.js';
|
|
2
2
|
export declare function browserInstallCommand(_target: InstallBrowserTarget): string;
|
|
3
|
+
export declare function browserInstallCwd(): string;
|
|
3
4
|
export declare function browserInstallArgs(target: InstallBrowserTarget, destination: string): string[];
|
|
4
5
|
export declare function browserInstallEnv(target: InstallBrowserTarget, destination: string): NodeJS.ProcessEnv;
|
|
5
6
|
export declare function runCommand(command: string, args: string[], opts: {
|
package/dist/module.cjs
CHANGED
|
@@ -177,6 +177,8 @@ new Set([
|
|
|
177
177
|
'firefox-based',
|
|
178
178
|
'gecko-based',
|
|
179
179
|
'librewolf',
|
|
180
|
+
'zen',
|
|
181
|
+
'floorp',
|
|
180
182
|
'waterfox'
|
|
181
183
|
]);
|
|
182
184
|
function titleCase(value) {
|
|
@@ -226,29 +228,63 @@ function buildExecEnv(base) {
|
|
|
226
228
|
Path: updated
|
|
227
229
|
};
|
|
228
230
|
}
|
|
231
|
+
function readMajorVersion(userAgent, name) {
|
|
232
|
+
const match = userAgent.match(new RegExp(`${name}/(\\d+)`));
|
|
233
|
+
return match ? Number(match[1]) : null;
|
|
234
|
+
}
|
|
229
235
|
function detectCurrentPackageManager() {
|
|
230
236
|
const userAgent = String(process.env.npm_config_user_agent || '').toLowerCase();
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
237
|
+
for (const name of [
|
|
238
|
+
'pnpm',
|
|
239
|
+
'yarn',
|
|
240
|
+
'bun',
|
|
241
|
+
'npm'
|
|
242
|
+
])if (userAgent.includes(name)) return {
|
|
243
|
+
name,
|
|
244
|
+
major: readMajorVersion(userAgent, name)
|
|
245
|
+
};
|
|
235
246
|
const execPath = String(process.env.npm_execpath || process.env.NPM_EXEC_PATH || '').toLowerCase();
|
|
236
|
-
if (execPath.includes('pnpm')) return
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
247
|
+
if (execPath.includes('pnpm')) return {
|
|
248
|
+
name: 'pnpm',
|
|
249
|
+
major: null
|
|
250
|
+
};
|
|
251
|
+
if (execPath.includes('yarn')) return {
|
|
252
|
+
name: 'yarn',
|
|
253
|
+
major: null
|
|
254
|
+
};
|
|
255
|
+
if (execPath.includes('bun')) return {
|
|
256
|
+
name: 'bun',
|
|
257
|
+
major: null
|
|
258
|
+
};
|
|
259
|
+
return {
|
|
260
|
+
name: 'npm',
|
|
261
|
+
major: null
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
function currentPackageRunner() {
|
|
265
|
+
const { name, major } = detectCurrentPackageManager();
|
|
266
|
+
if ('pnpm' === name) return 'pnpm';
|
|
267
|
+
if ('bun' === name) return 'bunx';
|
|
268
|
+
if ('yarn' === name && null !== major && major >= 2) return 'yarn';
|
|
269
|
+
return 'npx';
|
|
240
270
|
}
|
|
241
271
|
function browserInstallCommand(_target) {
|
|
242
|
-
const
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
272
|
+
const runner = currentPackageRunner();
|
|
273
|
+
return 'win32' === process.platform ? `${runner}.cmd` : runner;
|
|
274
|
+
}
|
|
275
|
+
function browserInstallCwd() {
|
|
276
|
+
if ('npx' !== currentPackageRunner()) return process.cwd();
|
|
277
|
+
const cacheRoot = resolveBrowsersCacheRoot();
|
|
278
|
+
external_node_fs_default().mkdirSync(cacheRoot, {
|
|
279
|
+
recursive: true
|
|
280
|
+
});
|
|
281
|
+
return cacheRoot;
|
|
246
282
|
}
|
|
247
283
|
function browserInstallArgs(target, destination) {
|
|
248
|
-
const
|
|
249
|
-
const packageRunnerPrefix = 'pnpm' ===
|
|
284
|
+
const runner = currentPackageRunner();
|
|
285
|
+
const packageRunnerPrefix = 'pnpm' === runner || 'yarn' === runner ? [
|
|
250
286
|
'dlx'
|
|
251
|
-
] : '
|
|
287
|
+
] : 'bunx' === runner ? [] : [
|
|
252
288
|
'-y'
|
|
253
289
|
];
|
|
254
290
|
if ('edge' === target) return [
|
|
@@ -361,7 +397,7 @@ async function extensionInstall({ browser }) {
|
|
|
361
397
|
const args = browserInstallArgs(target, destination);
|
|
362
398
|
const env = browserInstallEnv(target, destination);
|
|
363
399
|
const result = await runCommand(cmd, args, {
|
|
364
|
-
cwd:
|
|
400
|
+
cwd: browserInstallCwd(),
|
|
365
401
|
env
|
|
366
402
|
});
|
|
367
403
|
if (0 !== result.code) {
|
package/package.json
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"dist"
|
|
24
24
|
],
|
|
25
25
|
"name": "extension-install",
|
|
26
|
-
"version": "4.1.
|
|
26
|
+
"version": "4.1.27",
|
|
27
27
|
"description": "Managed browser installer/uninstaller for Extension.js",
|
|
28
28
|
"author": {
|
|
29
29
|
"name": "Cezar Augusto",
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"url": "https://cezaraugusto.com"
|
|
32
32
|
},
|
|
33
33
|
"homepage": "https://github.com/extension-js/extension.js/tree/main/programs/install#readme",
|
|
34
|
+
"funding": "https://github.com/sponsors/cezaraugusto",
|
|
34
35
|
"bugs": {
|
|
35
36
|
"url": "https://github.com/extension-js/extension.js/issues"
|
|
36
37
|
},
|