extension-install 4.1.31 → 4.1.32
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/corepack-registry.d.ts +3 -0
- package/dist/lib/messages.d.ts +1 -1
- package/dist/lib/messaging.d.ts +12 -4
- package/dist/module.cjs +59 -7
- package/dist/module.d.ts +2 -1
- package/package.json +1 -1
package/dist/lib/messages.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { InstallBrowserTarget } from './browser-target.js';
|
|
2
2
|
import type { CommandResult } from './runner.js';
|
|
3
|
-
export declare function installingBrowser(browser: InstallBrowserTarget, destination: string): string;
|
|
3
|
+
export declare function installingBrowser(browser: InstallBrowserTarget, destination: string, defaulted: boolean): string;
|
|
4
4
|
export declare function installSucceeded(browser: InstallBrowserTarget, destination: string): string;
|
|
5
5
|
export declare function installFailed(browser: InstallBrowserTarget, command: string, args: string[], result: CommandResult): string;
|
|
6
6
|
export declare function installIncomplete(browser: InstallBrowserTarget, destination: string, removed: boolean): string;
|
package/dist/lib/messaging.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export declare function isMachineOutput(): boolean;
|
|
|
7
7
|
export declare function humanLine(...parts: unknown[]): void;
|
|
8
8
|
export declare function humanWarn(...parts: unknown[]): void;
|
|
9
9
|
export declare function humanError(...parts: unknown[]): void;
|
|
10
|
+
export declare function debugLine(...parts: unknown[]): void;
|
|
10
11
|
export declare const fmt: {
|
|
11
12
|
heading: (title: string) => string;
|
|
12
13
|
label: (key: string) => string;
|
|
@@ -91,7 +92,6 @@ export declare const CODES: {
|
|
|
91
92
|
readonly E_CONFIG_LOAD: 'E_CONFIG_LOAD';
|
|
92
93
|
readonly E_MANAGED_DEP_CONFLICT: 'E_MANAGED_DEP_CONFLICT';
|
|
93
94
|
readonly E_TYPES_EMIT: 'E_TYPES_EMIT';
|
|
94
|
-
readonly E_TSCONFIG_MISSING: 'E_TSCONFIG_MISSING';
|
|
95
95
|
readonly E_OPTIONAL_DEP_UNRESOLVED: 'E_OPTIONAL_DEP_UNRESOLVED';
|
|
96
96
|
readonly E_OPTIONAL_DEP_LOAD: 'E_OPTIONAL_DEP_LOAD';
|
|
97
97
|
readonly E_OPTIONAL_DEP_UNKNOWN: 'E_OPTIONAL_DEP_UNKNOWN';
|
|
@@ -107,11 +107,9 @@ export declare const CODES: {
|
|
|
107
107
|
readonly E_CSS_PARSE: 'E_CSS_PARSE';
|
|
108
108
|
readonly E_CSS_PREPROCESSOR_MISSING: 'E_CSS_PREPROCESSOR_MISSING';
|
|
109
109
|
readonly E_CSS_DEAD_REF: 'E_CSS_DEAD_REF';
|
|
110
|
-
readonly E_INTEGRATION_INSTALL: 'E_INTEGRATION_INSTALL';
|
|
111
110
|
readonly E_POLYFILL_NOT_FOUND: 'E_POLYFILL_NOT_FOUND';
|
|
112
111
|
readonly E_LOCALES_LAYOUT: 'E_LOCALES_LAYOUT';
|
|
113
112
|
readonly E_WAR_INVALID: 'E_WAR_INVALID';
|
|
114
|
-
readonly E_MATCH_PATTERN_INVALID: 'E_MATCH_PATTERN_INVALID';
|
|
115
113
|
readonly E_BACKGROUND_REQUIRED: 'E_BACKGROUND_REQUIRED';
|
|
116
114
|
readonly E_CONTENT_SCRIPT_SYNTAX: 'E_CONTENT_SCRIPT_SYNTAX';
|
|
117
115
|
readonly E_NO_ENTRYPOINTS: 'E_NO_ENTRYPOINTS';
|
|
@@ -130,7 +128,6 @@ export declare const CODES: {
|
|
|
130
128
|
readonly E_BROWSER_START_TIMEOUT: 'E_BROWSER_START_TIMEOUT';
|
|
131
129
|
readonly E_LAUNCH_SKIPPED_COMPILE_ERRORS: 'E_LAUNCH_SKIPPED_COMPILE_ERRORS';
|
|
132
130
|
readonly E_INSTANCE_AMBIGUOUS: 'E_INSTANCE_AMBIGUOUS';
|
|
133
|
-
readonly E_WSL_INTEROP: 'E_WSL_INTEROP';
|
|
134
131
|
readonly E_EXTENSION_LOAD_REFUSED: 'E_EXTENSION_LOAD_REFUSED';
|
|
135
132
|
readonly E_ADDON_INSTALL: 'E_ADDON_INSTALL';
|
|
136
133
|
readonly E_BROWSER_CONNECT: 'E_BROWSER_CONNECT';
|
|
@@ -142,6 +139,7 @@ export declare const CODES: {
|
|
|
142
139
|
readonly E_RDP_PROTOCOL: 'E_RDP_PROTOCOL';
|
|
143
140
|
readonly E_PORT_IN_USE: 'E_PORT_IN_USE';
|
|
144
141
|
readonly E_SESSION_STOPPED: 'E_SESSION_STOPPED';
|
|
142
|
+
readonly E_SESSION_EXISTS: 'E_SESSION_EXISTS';
|
|
145
143
|
readonly E_LOGS_STREAM_GAP: 'E_LOGS_STREAM_GAP';
|
|
146
144
|
readonly E_BROWSER_INSTALL_PRIVILEGE: 'E_BROWSER_INSTALL_PRIVILEGE';
|
|
147
145
|
readonly E_UNINSTALL_NOOP: 'E_UNINSTALL_NOOP';
|
|
@@ -153,6 +151,15 @@ export interface EnvelopeErrorRefs {
|
|
|
153
151
|
path?: string;
|
|
154
152
|
version?: string;
|
|
155
153
|
}
|
|
154
|
+
export interface Diagnostic {
|
|
155
|
+
code?: ErrorCode;
|
|
156
|
+
message: string;
|
|
157
|
+
file?: string;
|
|
158
|
+
line?: number;
|
|
159
|
+
column?: number;
|
|
160
|
+
severity: 'error' | 'warning';
|
|
161
|
+
name?: string;
|
|
162
|
+
}
|
|
156
163
|
export interface EnvelopeError {
|
|
157
164
|
code: ErrorCode;
|
|
158
165
|
message: string;
|
|
@@ -160,6 +167,7 @@ export interface EnvelopeError {
|
|
|
160
167
|
engine?: string;
|
|
161
168
|
hint?: string;
|
|
162
169
|
refs?: EnvelopeErrorRefs;
|
|
170
|
+
details?: Diagnostic[];
|
|
163
171
|
}
|
|
164
172
|
export interface Envelope<T = unknown> {
|
|
165
173
|
schema: typeof ENVELOPE_SCHEMA;
|
package/dist/module.cjs
CHANGED
|
@@ -138,6 +138,7 @@ function removeBrowserDir(browser) {
|
|
|
138
138
|
}
|
|
139
139
|
const external_pintor_namespaceObject = require("pintor");
|
|
140
140
|
var external_pintor_default = /*#__PURE__*/ __webpack_require__.n(external_pintor_namespaceObject);
|
|
141
|
+
const external_node_util_namespaceObject = require("node:util");
|
|
141
142
|
const GLYPH = '⏵⏵⏵';
|
|
142
143
|
const DEBUG_GLYPH = '···';
|
|
143
144
|
new Set([
|
|
@@ -164,7 +165,7 @@ function isMachineOutput() {
|
|
|
164
165
|
return MACHINE_OUTPUT_VALUES.has(String(process.env.EXTENSION_OUTPUT || '').trim().toLowerCase());
|
|
165
166
|
}
|
|
166
167
|
function humanLine(...parts) {
|
|
167
|
-
if (isMachineOutput()) return;
|
|
168
|
+
if (isMachineOutput()) return void process.stderr.write(`${(0, external_node_util_namespaceObject.format)(...parts)}\n`);
|
|
168
169
|
console.log(...parts);
|
|
169
170
|
}
|
|
170
171
|
function humanWarn(...parts) {
|
|
@@ -206,8 +207,9 @@ new Set([
|
|
|
206
207
|
function titleCase(value) {
|
|
207
208
|
return value.length ? value[0].toUpperCase() + value.slice(1) : value;
|
|
208
209
|
}
|
|
209
|
-
function installingBrowser(browser, destination) {
|
|
210
|
-
|
|
210
|
+
function installingBrowser(browser, destination, defaulted) {
|
|
211
|
+
const why = defaulted ? ', the default when no browser is named' : '';
|
|
212
|
+
return `${prefix('info')} Installing ${external_pintor_default().blue(titleCase(browser))}${why}…\n${fmt.label('PATH')} ${fmt.val(destination)}`;
|
|
211
213
|
}
|
|
212
214
|
function installSucceeded(browser, destination) {
|
|
213
215
|
return `${prefix('success')} ${external_pintor_default().blue(titleCase(browser))} is installed.\n${fmt.label('PATH')} ${fmt.val(destination)}`;
|
|
@@ -242,6 +244,44 @@ function uninstallNoop(browser, checkedPath) {
|
|
|
242
244
|
}
|
|
243
245
|
const external_node_child_process_namespaceObject = require("node:child_process");
|
|
244
246
|
const external_cross_spawn_namespaceObject = require("cross-spawn");
|
|
247
|
+
const NPMRC_REGISTRY = /^\s*registry\s*=\s*(.*?)\s*$/;
|
|
248
|
+
const PUBLIC_REGISTRY_HOSTS = [
|
|
249
|
+
'registry.npmjs.org',
|
|
250
|
+
'registry.yarnpkg.com'
|
|
251
|
+
];
|
|
252
|
+
function readEnv(source, name) {
|
|
253
|
+
const key = Object.keys(source).find((candidate)=>candidate.toLowerCase() === name.toLowerCase() && source[candidate]);
|
|
254
|
+
return void 0 === key ? void 0 : source[key];
|
|
255
|
+
}
|
|
256
|
+
function readNpmrcRegistry(projectDir) {
|
|
257
|
+
let registry;
|
|
258
|
+
try {
|
|
259
|
+
for (const line of external_node_fs_namespaceObject.readFileSync(external_node_path_namespaceObject.join(projectDir, '.npmrc'), 'utf8').split(/\r?\n/)){
|
|
260
|
+
const match = NPMRC_REGISTRY.exec(line);
|
|
261
|
+
if (match) registry = match[1].replace(/^(['"])(.*)\1$/, '$2');
|
|
262
|
+
}
|
|
263
|
+
} catch {}
|
|
264
|
+
return registry;
|
|
265
|
+
}
|
|
266
|
+
function privateRegistry(value) {
|
|
267
|
+
const raw = String(value || '').trim();
|
|
268
|
+
if (!raw || raw.includes('${')) return;
|
|
269
|
+
try {
|
|
270
|
+
const url = new URL(raw);
|
|
271
|
+
if ('http:' !== url.protocol && 'https:' !== url.protocol) return;
|
|
272
|
+
if (PUBLIC_REGISTRY_HOSTS.includes(url.hostname)) return;
|
|
273
|
+
return url.href.replace(/\/+$/, '');
|
|
274
|
+
} catch {
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
function corepackRegistryEnv(source, projectDir) {
|
|
279
|
+
if (readEnv(source, 'COREPACK_NPM_REGISTRY')) return {};
|
|
280
|
+
const registry = privateRegistry(readEnv(source, 'npm_config_registry') || readNpmrcRegistry(projectDir));
|
|
281
|
+
return registry ? {
|
|
282
|
+
COREPACK_NPM_REGISTRY: registry
|
|
283
|
+
} : {};
|
|
284
|
+
}
|
|
245
285
|
function buildExecEnv(base) {
|
|
246
286
|
if ('win32' !== process.platform) return base;
|
|
247
287
|
const nodeDir = external_node_path_default().dirname(process.execPath);
|
|
@@ -331,12 +371,24 @@ function browserInstallArgs(target, destination) {
|
|
|
331
371
|
];
|
|
332
372
|
}
|
|
333
373
|
function browserInstallEnv(target, destination) {
|
|
374
|
+
const env = withCorepackRegistry(process.env, process.cwd());
|
|
334
375
|
if ('edge' === target) return {
|
|
335
|
-
...
|
|
376
|
+
...env,
|
|
336
377
|
PLAYWRIGHT_BROWSERS_PATH: destination
|
|
337
378
|
};
|
|
379
|
+
return env;
|
|
380
|
+
}
|
|
381
|
+
function withCorepackRegistry(base, projectDir) {
|
|
382
|
+
const pin = corepackRegistryEnv(base, projectDir);
|
|
383
|
+
const env = {
|
|
384
|
+
...base
|
|
385
|
+
};
|
|
386
|
+
if (pin.COREPACK_NPM_REGISTRY) {
|
|
387
|
+
for (const key of Object.keys(env))if ('corepack_npm_registry' === key.toLowerCase()) Reflect.deleteProperty(env, key);
|
|
388
|
+
}
|
|
338
389
|
return {
|
|
339
|
-
...
|
|
390
|
+
...env,
|
|
391
|
+
...pin
|
|
340
392
|
};
|
|
341
393
|
}
|
|
342
394
|
async function runCommand(command, args, opts) {
|
|
@@ -430,11 +482,11 @@ function discardUnusableInstallTree(destination) {
|
|
|
430
482
|
});
|
|
431
483
|
return true;
|
|
432
484
|
}
|
|
433
|
-
async function extensionInstall({ browser, locateInstalledBinary }) {
|
|
485
|
+
async function extensionInstall({ browser, defaulted, locateInstalledBinary }) {
|
|
434
486
|
const target = normalizeBrowserName(browser);
|
|
435
487
|
const destination = resolveBrowserInstallDir(target);
|
|
436
488
|
if ('edge' === target && runner_edgeInstallNeedsInteractivePrivilegedSession()) throw new BrowserInstallPrivilegeError(edgeInstallNeedsInteractivePrivilegedSession());
|
|
437
|
-
humanLine(installingBrowser(target, destination));
|
|
489
|
+
humanLine(installingBrowser(target, destination, Boolean(defaulted)));
|
|
438
490
|
const cmd = browserInstallCommand(target);
|
|
439
491
|
const args = browserInstallArgs(target, destination);
|
|
440
492
|
const env = browserInstallEnv(target, destination);
|
package/dist/module.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export { BrowserInstallPrivilegeError, BrowserNotInstallableError, isBrowserInst
|
|
|
3
3
|
export type { InstallBrowserTarget };
|
|
4
4
|
export interface InstallOptions {
|
|
5
5
|
browser: string;
|
|
6
|
+
defaulted?: boolean;
|
|
6
7
|
locateInstalledBinary: (destination: string, browser: InstallBrowserTarget) => string | null;
|
|
7
8
|
}
|
|
8
9
|
export interface UninstallOptions {
|
|
@@ -16,5 +17,5 @@ export interface UninstallResult {
|
|
|
16
17
|
}
|
|
17
18
|
export declare function getManagedBrowsersCacheRoot(): string;
|
|
18
19
|
export declare function getManagedBrowserInstallDir(browser: string): string;
|
|
19
|
-
export declare function extensionInstall({ browser, locateInstalledBinary }: InstallOptions): Promise<void>;
|
|
20
|
+
export declare function extensionInstall({ browser, defaulted, locateInstalledBinary }: InstallOptions): Promise<void>;
|
|
20
21
|
export declare function extensionUninstall({ browser, all }: UninstallOptions): Promise<UninstallResult[]>;
|