isolated-deps 0.1.0

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/index.js ADDED
@@ -0,0 +1,954 @@
1
+ import * as __WEBPACK_EXTERNAL_MODULE_pintor__ from "pintor";
2
+ import * as __WEBPACK_EXTERNAL_MODULE_fs__ from "fs";
3
+ import * as __WEBPACK_EXTERNAL_MODULE_path__ from "path";
4
+ import * as __WEBPACK_EXTERNAL_MODULE_child_process__ from "child_process";
5
+ import * as __WEBPACK_EXTERNAL_MODULE_module__ from "module";
6
+ import * as __WEBPACK_EXTERNAL_MODULE_url__ from "url";
7
+ import * as __WEBPACK_EXTERNAL_MODULE_os__ from "os";
8
+ function optionalToolingSetup(integrations, fallback, isAuthor) {
9
+ const list = integrations && integrations.length > 0 ? integrations : [
10
+ fallback
11
+ ];
12
+ const prefix = isAuthor ? __WEBPACK_EXTERNAL_MODULE_pintor__["default"].brightMagenta("\u25BA\u25BA\u25BA Author says") : __WEBPACK_EXTERNAL_MODULE_pintor__["default"].gray("\u25BA\u25BA\u25BA");
13
+ const suffix = 'true' === process.env.EXTENSION_ONE_TIME_INSTALL_HINT ? ' (this is a one time operation)' : '';
14
+ return list.map((integration)=>`${prefix} Installing specialized dependencies for ${integration}...${suffix}`);
15
+ }
16
+ function optionalToolingRootInstall(integration) {
17
+ return `${__WEBPACK_EXTERNAL_MODULE_pintor__["default"].brightMagenta("\u25BA\u25BA\u25BA Author says")} [${integration}] Installing root dependencies for dev...`;
18
+ }
19
+ function optionalToolingReady(integration) {
20
+ return `${__WEBPACK_EXTERNAL_MODULE_pintor__["default"].brightMagenta("\u25BA\u25BA\u25BA Author says")} ${integration} tooling ready.`;
21
+ }
22
+ function optionalInstallFailed(integration, error, isAuthor) {
23
+ const prefix = isAuthor ? __WEBPACK_EXTERNAL_MODULE_pintor__["default"].brightMagenta('ERROR Author says') : __WEBPACK_EXTERNAL_MODULE_pintor__["default"].red('ERROR');
24
+ return `${prefix} [${integration}] Failed to install dependencies.\n${__WEBPACK_EXTERNAL_MODULE_pintor__["default"].red(String((null == error ? void 0 : error.message) || error))}`;
25
+ }
26
+ function optionalInstallManagerMissing(integration) {
27
+ const prefix = __WEBPACK_EXTERNAL_MODULE_pintor__["default"].red('ERROR');
28
+ return [
29
+ `${prefix} [${integration}] No supported package manager found in PATH.`,
30
+ 'Install pnpm, npm, yarn, or bun and retry.',
31
+ 'If you use pnpm, ensure it is available in your environment (e.g. corepack or PATH).',
32
+ 'Override detection with:',
33
+ ` ${__WEBPACK_EXTERNAL_MODULE_pintor__["default"].gray('EXTENSION_JS_PACKAGE_MANAGER=pnpm|npm|yarn|bun')}`,
34
+ ` ${__WEBPACK_EXTERNAL_MODULE_pintor__["default"].gray('EXTENSION_JS_PM_EXEC_PATH=/path/to/npm-cli.js')}`,
35
+ 'If you are on WSL, run the CLI inside a WSL shell so PATH is consistent.'
36
+ ].join('\n');
37
+ }
38
+ function parseOptionalDependencySpec(spec) {
39
+ const normalized = String(spec || '').trim();
40
+ const versionSeparator = normalized.lastIndexOf('@');
41
+ if (versionSeparator <= 0) throw new Error(`Expected an exact dependency spec like "postcss@8.5.6" or "@scope/pkg@1.2.3", received "${spec}".`);
42
+ const packageId = normalized.slice(0, versionSeparator);
43
+ const versionSpecifier = normalized.slice(versionSeparator + 1);
44
+ if (!packageId || !versionSpecifier) throw new Error(`Expected an exact dependency spec like "postcss@8.5.6" or "@scope/pkg@1.2.3", received "${spec}".`);
45
+ return {
46
+ packageId,
47
+ versionSpecifier
48
+ };
49
+ }
50
+ function getPackageIdFromSpec(spec) {
51
+ return parseOptionalDependencySpec(spec).packageId;
52
+ }
53
+ function getVersionSpecifierFromSpec(spec) {
54
+ return parseOptionalDependencySpec(spec).versionSpecifier;
55
+ }
56
+ const package_manager_require = (0, __WEBPACK_EXTERNAL_MODULE_module__.createRequire)(import.meta.url);
57
+ const package_manager_currentDir = __WEBPACK_EXTERNAL_MODULE_path__.dirname((0, __WEBPACK_EXTERNAL_MODULE_url__.fileURLToPath)(import.meta.url));
58
+ function getRuntimeRequire() {
59
+ return globalThis.__OPTIONAL_DEPS_REQUIRE__ || package_manager_require;
60
+ }
61
+ function normalizePackageManager(value) {
62
+ if (!value) return;
63
+ const lower = value.toLowerCase().trim();
64
+ if ('pnpm' === lower) return 'pnpm';
65
+ if ('yarn' === lower) return 'yarn';
66
+ if ('bun' === lower) return 'bun';
67
+ if ('npm' === lower) return 'npm';
68
+ }
69
+ function inferPackageManagerFromPath(value) {
70
+ if (!value) return;
71
+ const lower = value.toLowerCase();
72
+ if (lower.includes('pnpm')) return 'pnpm';
73
+ if (lower.includes('yarn')) return 'yarn';
74
+ if (lower.includes('bun')) return 'bun';
75
+ if (lower.includes('npm')) return 'npm';
76
+ }
77
+ function getPackageManagerOverride() {
78
+ const name = normalizePackageManager(process.env.EXTENSION_JS_PACKAGE_MANAGER);
79
+ const explicitExecPath = process.env.EXTENSION_JS_PM_EXEC_PATH;
80
+ const inheritedExecPath = process.env.npm_execpath || process.env.NPM_EXEC_PATH || void 0;
81
+ const execPath = explicitExecPath || (name ? void 0 : inheritedExecPath);
82
+ if (!name && !execPath) return;
83
+ const inferredName = name || inferPackageManagerFromPath(execPath) || 'npm';
84
+ return {
85
+ name: inferredName,
86
+ execPath
87
+ };
88
+ }
89
+ function detectPackageManagerFromEnv() {
90
+ const userAgent = process.env.npm_config_user_agent || '';
91
+ const execPath = process.env.npm_execpath || process.env.NPM_EXEC_PATH || '';
92
+ if (userAgent.includes('pnpm')) return {
93
+ name: 'pnpm',
94
+ execPath: execPath || void 0
95
+ };
96
+ if (userAgent.includes('yarn')) return {
97
+ name: 'yarn',
98
+ execPath: execPath || void 0
99
+ };
100
+ if (userAgent.includes('bun')) return {
101
+ name: 'bun',
102
+ execPath: execPath || void 0
103
+ };
104
+ if (userAgent.includes('npm')) return {
105
+ name: 'npm',
106
+ execPath: execPath || void 0
107
+ };
108
+ if (execPath) {
109
+ const inferred = inferPackageManagerFromPath(execPath) || 'npm';
110
+ return {
111
+ name: inferred,
112
+ execPath
113
+ };
114
+ }
115
+ }
116
+ function resolveNpmCliFromNode(execPath) {
117
+ const execDir = __WEBPACK_EXTERNAL_MODULE_path__.dirname(execPath);
118
+ const candidates = [
119
+ __WEBPACK_EXTERNAL_MODULE_path__.join(execDir, 'node_modules', 'npm', 'bin', 'npm-cli.js'),
120
+ __WEBPACK_EXTERNAL_MODULE_path__.join(execDir, '..', 'lib', 'node_modules', 'npm', 'bin', 'npm-cli.js'),
121
+ __WEBPACK_EXTERNAL_MODULE_path__.join(execDir, '..', 'node_modules', 'npm', 'bin', 'npm-cli.js')
122
+ ];
123
+ for (const candidate of candidates)if (__WEBPACK_EXTERNAL_MODULE_fs__.existsSync(candidate)) return candidate;
124
+ }
125
+ function resolveBundledNpmCliPath() {
126
+ if (process.env.EXTENSION_JS_PM_EXEC_PATH) {
127
+ const overridePath = process.env.EXTENSION_JS_PM_EXEC_PATH;
128
+ if (overridePath && __WEBPACK_EXTERNAL_MODULE_fs__.existsSync(overridePath)) return overridePath;
129
+ }
130
+ try {
131
+ const resolved = getRuntimeRequire().resolve('npm/bin/npm-cli.js', {
132
+ paths: [
133
+ process.cwd(),
134
+ package_manager_currentDir
135
+ ]
136
+ });
137
+ if (resolved && __WEBPACK_EXTERNAL_MODULE_fs__.existsSync(resolved)) return resolved;
138
+ } catch {}
139
+ return resolveNpmCliFromNode(process.execPath);
140
+ }
141
+ function isWindowsExecutablePath(value) {
142
+ if (!value || 'win32' !== process.platform) return false;
143
+ return /\.(cmd|bat|exe)$/i.test(value);
144
+ }
145
+ function isNodeScriptPath(value) {
146
+ if (!value) return false;
147
+ return /\.(mjs|cjs|js)$/i.test(value);
148
+ }
149
+ function resolveWindowsCommandPath(command) {
150
+ if ('win32' !== process.platform) return;
151
+ try {
152
+ const systemRoot = process.env.SystemRoot || 'C:\\Windows';
153
+ const whereExe = __WEBPACK_EXTERNAL_MODULE_path__.join(systemRoot, 'System32', 'where.exe');
154
+ const whereCommand = __WEBPACK_EXTERNAL_MODULE_fs__.existsSync(whereExe) ? whereExe : 'where';
155
+ const output = (0, __WEBPACK_EXTERNAL_MODULE_child_process__.execFileSync)(whereCommand, [
156
+ command
157
+ ], {
158
+ encoding: 'utf8',
159
+ stdio: [
160
+ 'ignore',
161
+ 'pipe',
162
+ 'ignore'
163
+ ],
164
+ windowsHide: true
165
+ });
166
+ const candidates = String(output).split(/\r?\n/).map((line)=>line.trim()).filter(Boolean);
167
+ const cmdMatch = candidates.find((line)=>/\.cmd$/i.test(line));
168
+ return cmdMatch || candidates[0];
169
+ } catch {
170
+ return;
171
+ }
172
+ }
173
+ function resolveUnixCommandPath(command) {
174
+ if ('win32' === process.platform) return;
175
+ try {
176
+ const output = (0, __WEBPACK_EXTERNAL_MODULE_child_process__.execFileSync)('which', [
177
+ command
178
+ ], {
179
+ encoding: 'utf8',
180
+ stdio: [
181
+ 'ignore',
182
+ 'pipe',
183
+ 'ignore'
184
+ ]
185
+ });
186
+ const candidate = String(output).trim();
187
+ return candidate || void 0;
188
+ } catch {
189
+ return;
190
+ }
191
+ }
192
+ function resolveCommandOnPath(command) {
193
+ return resolveWindowsCommandPath(command) || resolveUnixCommandPath(command) || void 0;
194
+ }
195
+ function canRunCorepack() {
196
+ try {
197
+ const fallback = getRuntimeRequire()('child_process');
198
+ const spawnSync = (null === __WEBPACK_EXTERNAL_MODULE_child_process__.spawnSync || void 0 === __WEBPACK_EXTERNAL_MODULE_child_process__.spawnSync ? void 0 : __WEBPACK_EXTERNAL_MODULE_child_process__.spawnSync.mock) !== void 0 ? __WEBPACK_EXTERNAL_MODULE_child_process__.spawnSync : fallback.spawnSync || __WEBPACK_EXTERNAL_MODULE_child_process__.spawnSync;
199
+ const result = spawnSync('corepack', [
200
+ '--version'
201
+ ], {
202
+ stdio: 'ignore',
203
+ windowsHide: true
204
+ });
205
+ return (null == result ? void 0 : result.status) === 0;
206
+ } catch {
207
+ return false;
208
+ }
209
+ }
210
+ function detectByLockfile(cwd) {
211
+ if (!cwd) return;
212
+ const hasPnpmLock = __WEBPACK_EXTERNAL_MODULE_fs__.existsSync(__WEBPACK_EXTERNAL_MODULE_path__.join(cwd, 'pnpm-lock.yaml'));
213
+ const hasYarnLock = __WEBPACK_EXTERNAL_MODULE_fs__.existsSync(__WEBPACK_EXTERNAL_MODULE_path__.join(cwd, 'yarn.lock'));
214
+ const hasNpmLock = __WEBPACK_EXTERNAL_MODULE_fs__.existsSync(__WEBPACK_EXTERNAL_MODULE_path__.join(cwd, 'package-lock.json'));
215
+ if (hasPnpmLock) return 'pnpm';
216
+ if (hasYarnLock) return 'yarn';
217
+ if (hasNpmLock) return 'npm';
218
+ }
219
+ function hydrateResolvedPackageManager(name) {
220
+ const resolvedCommand = resolveCommandOnPath(name);
221
+ if (resolvedCommand) return {
222
+ name,
223
+ execPath: resolvedCommand
224
+ };
225
+ if ('npm' === name) {
226
+ const bundledNpmCli = resolveBundledNpmCliPath();
227
+ if (bundledNpmCli) return {
228
+ name: 'npm',
229
+ execPath: bundledNpmCli,
230
+ runnerCommand: process.execPath,
231
+ runnerArgs: [
232
+ bundledNpmCli
233
+ ]
234
+ };
235
+ }
236
+ }
237
+ function resolvePackageManager(opts) {
238
+ const lockPm = detectByLockfile(null == opts ? void 0 : opts.cwd);
239
+ if (lockPm) {
240
+ const hydrated = hydrateResolvedPackageManager(lockPm);
241
+ if (hydrated) return hydrated;
242
+ return {
243
+ name: lockPm
244
+ };
245
+ }
246
+ const override = getPackageManagerOverride();
247
+ if (override) return override;
248
+ const envPm = detectPackageManagerFromEnv();
249
+ if (envPm) return envPm;
250
+ const candidates = [
251
+ 'pnpm',
252
+ 'yarn',
253
+ 'bun'
254
+ ];
255
+ for (const candidate of candidates){
256
+ const resolved = resolveCommandOnPath(candidate);
257
+ if (resolved) return {
258
+ name: candidate,
259
+ execPath: resolved
260
+ };
261
+ }
262
+ const corepackPath = resolveCommandOnPath('corepack');
263
+ if (corepackPath || canRunCorepack()) return {
264
+ name: 'pnpm',
265
+ runnerCommand: corepackPath || 'corepack',
266
+ runnerArgs: [
267
+ 'pnpm'
268
+ ]
269
+ };
270
+ const bundledNpmCli = resolveBundledNpmCliPath();
271
+ if (bundledNpmCli) return {
272
+ name: 'npm',
273
+ execPath: bundledNpmCli,
274
+ runnerCommand: process.execPath,
275
+ runnerArgs: [
276
+ bundledNpmCli
277
+ ]
278
+ };
279
+ return {
280
+ name: 'npm'
281
+ };
282
+ }
283
+ function buildExecEnv() {
284
+ if ('win32' !== process.platform) return;
285
+ const nodeDir = __WEBPACK_EXTERNAL_MODULE_path__.dirname(process.execPath);
286
+ const pathSep = __WEBPACK_EXTERNAL_MODULE_path__.delimiter;
287
+ const existing = process.env.PATH || process.env.Path || '';
288
+ if (existing.includes(nodeDir)) return;
289
+ return {
290
+ ...process.env,
291
+ PATH: `${nodeDir}${pathSep}${existing}`.trim(),
292
+ Path: `${nodeDir}${pathSep}${existing}`.trim()
293
+ };
294
+ }
295
+ function buildInstallCommand(pm, args) {
296
+ if (pm.runnerCommand) return {
297
+ command: pm.runnerCommand,
298
+ args: [
299
+ ...pm.runnerArgs || [],
300
+ ...args
301
+ ]
302
+ };
303
+ if (pm.execPath) {
304
+ if (isWindowsExecutablePath(pm.execPath)) return {
305
+ command: pm.execPath,
306
+ args
307
+ };
308
+ if (isNodeScriptPath(pm.execPath)) return {
309
+ command: process.execPath,
310
+ args: [
311
+ pm.execPath,
312
+ ...args
313
+ ]
314
+ };
315
+ return {
316
+ command: pm.execPath,
317
+ args
318
+ };
319
+ }
320
+ return {
321
+ command: pm.name,
322
+ args
323
+ };
324
+ }
325
+ function buildNpmCliFallback(args) {
326
+ const npmCli = resolveBundledNpmCliPath();
327
+ if (!npmCli) return;
328
+ return {
329
+ command: process.execPath,
330
+ args: [
331
+ npmCli,
332
+ ...args
333
+ ]
334
+ };
335
+ }
336
+ function buildSpawnInvocation(command, args) {
337
+ return {
338
+ command,
339
+ args
340
+ };
341
+ }
342
+ function execInstallCommand(command, args, options) {
343
+ const invocation = buildSpawnInvocation(command, args);
344
+ const env = buildExecEnv();
345
+ const stdio = (null == options ? void 0 : options.stdio) ?? 'ignore';
346
+ const useShell = 'win32' === process.platform && /\.(cmd|bat)$/i.test(invocation.command);
347
+ return new Promise((resolve, reject)=>{
348
+ const child = (0, __WEBPACK_EXTERNAL_MODULE_child_process__.spawn)(invocation.command, invocation.args, {
349
+ cwd: null == options ? void 0 : options.cwd,
350
+ stdio,
351
+ env: (null == options ? void 0 : options.env) || env || process.env,
352
+ ...useShell ? {
353
+ shell: true
354
+ } : {}
355
+ });
356
+ child.on('close', (code)=>{
357
+ if (0 !== code) reject(new Error(`Install failed with exit code ${code}`));
358
+ else resolve();
359
+ });
360
+ child.on('error', (error)=>reject(error));
361
+ });
362
+ }
363
+ var package_namespaceObject = {
364
+ i8: "0.1.0"
365
+ };
366
+ function parseJsonSafe(text) {
367
+ const raw = 'string' == typeof text ? text : String(text || '');
368
+ const s = raw && 0xfeff === raw.charCodeAt(0) ? raw.slice(1) : raw;
369
+ return JSON.parse(s || '{}');
370
+ }
371
+ function ensureOptionalInstallBaseDir(installBaseDir) {
372
+ __WEBPACK_EXTERNAL_MODULE_fs__.mkdirSync(installBaseDir, {
373
+ recursive: true
374
+ });
375
+ const packageJsonPath = __WEBPACK_EXTERNAL_MODULE_path__.join(installBaseDir, 'package.json');
376
+ if (!__WEBPACK_EXTERNAL_MODULE_fs__.existsSync(packageJsonPath)) __WEBPACK_EXTERNAL_MODULE_fs__.writeFileSync(packageJsonPath, JSON.stringify({
377
+ name: `extensionjs-optional-deps-${package_namespaceObject.i8}`,
378
+ private: true,
379
+ version: package_namespaceObject.i8
380
+ }, null, 2) + '\n');
381
+ }
382
+ function removePathIfExists(targetPath) {
383
+ if (!__WEBPACK_EXTERNAL_MODULE_fs__.existsSync(targetPath)) return;
384
+ __WEBPACK_EXTERNAL_MODULE_fs__.rmSync(targetPath, {
385
+ recursive: true,
386
+ force: true
387
+ });
388
+ }
389
+ function resetOptionalInstallRoot(installBaseDir) {
390
+ removePathIfExists(__WEBPACK_EXTERNAL_MODULE_path__.join(installBaseDir, 'node_modules'));
391
+ removePathIfExists(__WEBPACK_EXTERNAL_MODULE_path__.join(installBaseDir, 'package-lock.json'));
392
+ removePathIfExists(__WEBPACK_EXTERNAL_MODULE_path__.join(installBaseDir, 'npm-shrinkwrap.json'));
393
+ removePathIfExists(__WEBPACK_EXTERNAL_MODULE_path__.join(installBaseDir, 'pnpm-lock.yaml'));
394
+ removePathIfExists(__WEBPACK_EXTERNAL_MODULE_path__.join(installBaseDir, 'yarn.lock'));
395
+ removePathIfExists(__WEBPACK_EXTERNAL_MODULE_path__.join(installBaseDir, 'bun.lock'));
396
+ }
397
+ function getOptionalDependencyMap(dependencySpecs) {
398
+ const dependencyMap = {};
399
+ for (const spec of dependencySpecs){
400
+ const dependencyId = getPackageIdFromSpec(spec);
401
+ dependencyMap[dependencyId] = getVersionSpecifierFromSpec(spec);
402
+ }
403
+ return dependencyMap;
404
+ }
405
+ function ensureOptionalDependenciesManifest(installBaseDir, dependencySpecs) {
406
+ if (!dependencySpecs.length) return;
407
+ const packageJsonPath = __WEBPACK_EXTERNAL_MODULE_path__.join(installBaseDir, 'package.json');
408
+ const current = parseJsonSafe(__WEBPACK_EXTERNAL_MODULE_fs__.readFileSync(packageJsonPath, 'utf8'));
409
+ const nextOptionalDependencies = {
410
+ ...current.optionalDependencies || {},
411
+ ...getOptionalDependencyMap(dependencySpecs)
412
+ };
413
+ const didChange = dependencySpecs.some((spec)=>{
414
+ var _current_optionalDependencies;
415
+ return (null == (_current_optionalDependencies = current.optionalDependencies) ? void 0 : _current_optionalDependencies[getPackageIdFromSpec(spec)]) !== nextOptionalDependencies[getPackageIdFromSpec(spec)];
416
+ });
417
+ if (!didChange) return;
418
+ __WEBPACK_EXTERNAL_MODULE_fs__.writeFileSync(packageJsonPath, JSON.stringify({
419
+ ...current,
420
+ private: true,
421
+ optionalDependencies: nextOptionalDependencies
422
+ }, null, 2) + '\n');
423
+ }
424
+ function prepareOptionalInstallState(input) {
425
+ if (input.forceRecreateInstallRoot) resetOptionalInstallRoot(input.installBaseDir);
426
+ ensureOptionalInstallBaseDir(input.installBaseDir);
427
+ ensureOptionalDependenciesManifest(input.installBaseDir, input.dependencySpecs);
428
+ }
429
+ function isPackageEntry(entry) {
430
+ return entry.isDirectory() || entry.isSymbolicLink();
431
+ }
432
+ function getDirectPackageDir(dependencyId, installRoot) {
433
+ return __WEBPACK_EXTERNAL_MODULE_path__.join(installRoot, 'node_modules', ...dependencyId.split('/'));
434
+ }
435
+ function listInstalledPackageDirs(nodeModulesDir) {
436
+ if (!__WEBPACK_EXTERNAL_MODULE_fs__.existsSync(nodeModulesDir)) return [];
437
+ try {
438
+ const entries = __WEBPACK_EXTERNAL_MODULE_fs__.readdirSync(nodeModulesDir, {
439
+ withFileTypes: true
440
+ });
441
+ const packageDirs = [];
442
+ for (const entry of entries){
443
+ if (!isPackageEntry(entry) || '.bin' === entry.name) continue;
444
+ const entryPath = __WEBPACK_EXTERNAL_MODULE_path__.join(nodeModulesDir, entry.name);
445
+ if (!entry.name.startsWith('@')) {
446
+ packageDirs.push(entryPath);
447
+ continue;
448
+ }
449
+ const scopedEntries = __WEBPACK_EXTERNAL_MODULE_fs__.readdirSync(entryPath, {
450
+ withFileTypes: true
451
+ });
452
+ for (const scopedEntry of scopedEntries)if (isPackageEntry(scopedEntry)) packageDirs.push(__WEBPACK_EXTERNAL_MODULE_path__.join(entryPath, scopedEntry.name));
453
+ }
454
+ return packageDirs;
455
+ } catch {
456
+ return [];
457
+ }
458
+ }
459
+ function findPackageDirInPnpmStore(dependencyId, installRoot) {
460
+ const pnpmStoreDir = __WEBPACK_EXTERNAL_MODULE_path__.join(installRoot, 'node_modules', '.pnpm');
461
+ if (!__WEBPACK_EXTERNAL_MODULE_fs__.existsSync(pnpmStoreDir)) return;
462
+ try {
463
+ const storeEntries = __WEBPACK_EXTERNAL_MODULE_fs__.readdirSync(pnpmStoreDir, {
464
+ withFileTypes: true
465
+ });
466
+ for (const entry of storeEntries){
467
+ if (!isPackageEntry(entry) || 'node_modules' === entry.name) continue;
468
+ const candidatePackageJson = __WEBPACK_EXTERNAL_MODULE_path__.join(pnpmStoreDir, entry.name, 'node_modules', ...dependencyId.split('/'), 'package.json');
469
+ if (__WEBPACK_EXTERNAL_MODULE_fs__.existsSync(candidatePackageJson)) return __WEBPACK_EXTERNAL_MODULE_path__.dirname(candidatePackageJson);
470
+ }
471
+ } catch {}
472
+ }
473
+ function findNestedPackageDir(dependencyId, installRoot) {
474
+ const directPackageJson = __WEBPACK_EXTERNAL_MODULE_path__.join(getDirectPackageDir(dependencyId, installRoot), 'package.json');
475
+ if (__WEBPACK_EXTERNAL_MODULE_fs__.existsSync(directPackageJson)) return __WEBPACK_EXTERNAL_MODULE_path__.dirname(directPackageJson);
476
+ const fromPnpmStore = findPackageDirInPnpmStore(dependencyId, installRoot);
477
+ if (fromPnpmStore) return fromPnpmStore;
478
+ const visited = new Set();
479
+ const queue = [
480
+ {
481
+ nodeModulesDir: __WEBPACK_EXTERNAL_MODULE_path__.join(installRoot, 'node_modules'),
482
+ depth: 0
483
+ }
484
+ ];
485
+ const maxDepth = 4;
486
+ while(queue.length > 0){
487
+ const current = queue.shift();
488
+ if (visited.has(current.nodeModulesDir)) continue;
489
+ visited.add(current.nodeModulesDir);
490
+ const candidatePackageJson = __WEBPACK_EXTERNAL_MODULE_path__.join(current.nodeModulesDir, ...dependencyId.split('/'), 'package.json');
491
+ if (__WEBPACK_EXTERNAL_MODULE_fs__.existsSync(candidatePackageJson)) return __WEBPACK_EXTERNAL_MODULE_path__.dirname(candidatePackageJson);
492
+ if (current.depth >= maxDepth) continue;
493
+ for (const packageDir of listInstalledPackageDirs(current.nodeModulesDir)){
494
+ const nestedNodeModulesDir = __WEBPACK_EXTERNAL_MODULE_path__.join(packageDir, 'node_modules');
495
+ if (__WEBPACK_EXTERNAL_MODULE_fs__.existsSync(nestedNodeModulesDir)) queue.push({
496
+ nodeModulesDir: nestedNodeModulesDir,
497
+ depth: current.depth + 1
498
+ });
499
+ }
500
+ }
501
+ }
502
+ function readPackageJsonFromDir(packageDir) {
503
+ const manifestPath = __WEBPACK_EXTERNAL_MODULE_path__.join(packageDir, 'package.json');
504
+ if (!__WEBPACK_EXTERNAL_MODULE_fs__.existsSync(manifestPath)) return;
505
+ try {
506
+ return JSON.parse(__WEBPACK_EXTERNAL_MODULE_fs__.readFileSync(manifestPath, 'utf8') || '{}');
507
+ } catch {
508
+ return;
509
+ }
510
+ }
511
+ function getPackageEntryCandidates(pkg) {
512
+ var _pkg_exports;
513
+ const candidateEntries = [];
514
+ if ('string' == typeof (null == pkg ? void 0 : pkg.main)) candidateEntries.push(pkg.main);
515
+ if ('string' == typeof (null == pkg ? void 0 : pkg.module)) candidateEntries.push(pkg.module);
516
+ if ('string' == typeof (null == pkg ? void 0 : pkg.exports)) candidateEntries.push(pkg.exports);
517
+ const dotExport = null == pkg ? void 0 : null == (_pkg_exports = pkg.exports) ? void 0 : _pkg_exports['.'];
518
+ if ('string' == typeof dotExport) candidateEntries.push(dotExport);
519
+ if (dotExport && 'object' == typeof dotExport) {
520
+ if ('string' == typeof dotExport.require) candidateEntries.push(dotExport.require);
521
+ if ('string' == typeof dotExport.default) candidateEntries.push(dotExport.default);
522
+ if ('string' == typeof dotExport.import) candidateEntries.push(dotExport.import);
523
+ }
524
+ candidateEntries.push('index.js', 'index.cjs', 'index.mjs');
525
+ return candidateEntries;
526
+ }
527
+ function resolveFromPackageDir(packageDir) {
528
+ if (!__WEBPACK_EXTERNAL_MODULE_fs__.existsSync(packageDir)) return;
529
+ const pkg = readPackageJsonFromDir(packageDir);
530
+ if (!pkg) return;
531
+ for (const relativeEntry of getPackageEntryCandidates(pkg)){
532
+ const absoluteEntry = __WEBPACK_EXTERNAL_MODULE_path__.resolve(packageDir, relativeEntry);
533
+ if (__WEBPACK_EXTERNAL_MODULE_fs__.existsSync(absoluteEntry)) return absoluteEntry;
534
+ }
535
+ }
536
+ function resolvePackageFromInstallRoot(dependencyId, installRoot) {
537
+ const packageDir = findNestedPackageDir(dependencyId, installRoot);
538
+ if (!packageDir) return;
539
+ return resolveFromPackageDir(packageDir);
540
+ }
541
+ const runtime_context_require = (0, __WEBPACK_EXTERNAL_MODULE_module__.createRequire)(import.meta.url);
542
+ const runtime_context_currentDir = __WEBPACK_EXTERNAL_MODULE_path__.dirname((0, __WEBPACK_EXTERNAL_MODULE_url__.fileURLToPath)(import.meta.url));
543
+ function runtime_context_getRuntimeRequire() {
544
+ return globalThis.__OPTIONAL_DEPS_REQUIRE__ || runtime_context_require;
545
+ }
546
+ function runtime_context_parseJsonSafe(text) {
547
+ const raw = 'string' == typeof text ? text : String(text || '');
548
+ const s = raw && 0xfeff === raw.charCodeAt(0) ? raw.slice(1) : raw;
549
+ return JSON.parse(s || '{}');
550
+ }
551
+ function resolveDevelopRootFromDir(dir) {
552
+ try {
553
+ const packageJsonPath = __WEBPACK_EXTERNAL_MODULE_path__.join(dir, 'package.json');
554
+ if (!__WEBPACK_EXTERNAL_MODULE_fs__.existsSync(packageJsonPath)) return;
555
+ const pkg = runtime_context_parseJsonSafe(__WEBPACK_EXTERNAL_MODULE_fs__.readFileSync(packageJsonPath, 'utf8'));
556
+ if ((null == pkg ? void 0 : pkg.name) === 'extension-develop') return dir;
557
+ } catch {}
558
+ }
559
+ function findDevelopRootFrom(startDir) {
560
+ let currentDir = startDir;
561
+ const maxDepth = 6;
562
+ for(let i = 0; i < maxDepth; i++){
563
+ const root = resolveDevelopRootFromDir(currentDir);
564
+ if (root) return root;
565
+ const parent = __WEBPACK_EXTERNAL_MODULE_path__.dirname(currentDir);
566
+ if (parent === currentDir) break;
567
+ currentDir = parent;
568
+ }
569
+ }
570
+ function resolveDevelopInstallRoot() {
571
+ const directRoot = findExtensionDevelopRoot();
572
+ if (directRoot) return directRoot;
573
+ try {
574
+ const candidateRoot = findDevelopRootFrom(runtime_context_currentDir);
575
+ if (candidateRoot) return candidateRoot;
576
+ } catch {}
577
+ try {
578
+ const pkgPath = runtime_context_getRuntimeRequire().resolve('extension-develop/package.json', {
579
+ paths: [
580
+ runtime_context_currentDir
581
+ ]
582
+ });
583
+ return resolveDevelopRootFromDir(__WEBPACK_EXTERNAL_MODULE_path__.dirname(pkgPath));
584
+ } catch {
585
+ return;
586
+ }
587
+ }
588
+ function findExtensionDevelopRoot() {
589
+ const webpackDir = __WEBPACK_EXTERNAL_MODULE_path__.resolve(runtime_context_currentDir, '..');
590
+ const packageRoot = __WEBPACK_EXTERNAL_MODULE_path__.resolve(webpackDir, '..');
591
+ const packageJsonPath = __WEBPACK_EXTERNAL_MODULE_path__.join(packageRoot, 'package.json');
592
+ if (!__WEBPACK_EXTERNAL_MODULE_fs__.existsSync(packageJsonPath)) return null;
593
+ try {
594
+ const pkg = JSON.parse(__WEBPACK_EXTERNAL_MODULE_fs__.readFileSync(packageJsonPath, 'utf8'));
595
+ if ('extension-develop' === pkg.name) return packageRoot;
596
+ } catch {}
597
+ return null;
598
+ }
599
+ function getExtensionJsCacheBaseDir() {
600
+ const override = process.env.EXTENSION_JS_CACHE_DIR;
601
+ if (override) return __WEBPACK_EXTERNAL_MODULE_path__.resolve(override);
602
+ if ('win32' === process.platform && process.env.LOCALAPPDATA) return __WEBPACK_EXTERNAL_MODULE_path__.join(process.env.LOCALAPPDATA, 'extensionjs');
603
+ if (process.env.XDG_CACHE_HOME) return __WEBPACK_EXTERNAL_MODULE_path__.join(process.env.XDG_CACHE_HOME, 'extensionjs');
604
+ return __WEBPACK_EXTERNAL_MODULE_path__.join(__WEBPACK_EXTERNAL_MODULE_os__.homedir(), '.cache', 'extensionjs');
605
+ }
606
+ function resolveOptionalInstallRoot() {
607
+ const version = process.env.EXTENSION_JS_OPTIONAL_DEPS_VERSION || package_namespaceObject.i8;
608
+ return __WEBPACK_EXTERNAL_MODULE_path__.join(getExtensionJsCacheBaseDir(), 'optional-deps', version);
609
+ }
610
+ function hasDependency(projectPath, dependency) {
611
+ const findNearestPackageJsonDirectory = (startPath)=>{
612
+ let currentDirectory = startPath;
613
+ const maxDepth = 4;
614
+ for(let i = 0; i < maxDepth; i++){
615
+ const candidate = __WEBPACK_EXTERNAL_MODULE_path__.join(currentDirectory, 'package.json');
616
+ if (__WEBPACK_EXTERNAL_MODULE_fs__.existsSync(candidate)) return currentDirectory;
617
+ const parentDirectory = __WEBPACK_EXTERNAL_MODULE_path__.dirname(currentDirectory);
618
+ if (parentDirectory === currentDirectory) break;
619
+ currentDirectory = parentDirectory;
620
+ }
621
+ };
622
+ const packageJsonDirectory = findNearestPackageJsonDirectory(projectPath);
623
+ if (!packageJsonDirectory) return false;
624
+ const packageJsonPath = __WEBPACK_EXTERNAL_MODULE_path__.join(packageJsonDirectory, 'package.json');
625
+ if (!__WEBPACK_EXTERNAL_MODULE_fs__.existsSync(packageJsonPath)) return false;
626
+ const parsed = runtime_context_parseJsonSafe(__WEBPACK_EXTERNAL_MODULE_fs__.readFileSync(packageJsonPath, 'utf8'));
627
+ const dependencies = parsed.dependencies || {};
628
+ const devDependencies = parsed.devDependencies || {};
629
+ return !!dependencies[dependency] || !!devDependencies[dependency];
630
+ }
631
+ function getMissingDependenciesAtInstallRoot(dependencyIds, installBaseDir) {
632
+ return dependencyIds.filter((dependencyId)=>!resolvePackageFromInstallRoot(dependencyId, installBaseDir));
633
+ }
634
+ function filterSpecsByPackageIds(dependencySpecs, dependencyIds) {
635
+ const wantedIds = new Set(dependencyIds);
636
+ return dependencySpecs.filter((spec)=>wantedIds.has(getPackageIdFromSpec(spec)));
637
+ }
638
+ function parseWslUncPath(value) {
639
+ const match = /^\\\\wsl(?:\.localhost)?\\([^\\]+)\\(.+)$/.exec(value);
640
+ if (!match) return null;
641
+ const distro = match[1];
642
+ const rel = match[2].replace(/\\/g, '/').replace(/^\/+/, '');
643
+ return {
644
+ distro,
645
+ path: `/${rel}`
646
+ };
647
+ }
648
+ function isWslMountPath(value) {
649
+ return /^\/mnt\/[a-z]\//i.test(value);
650
+ }
651
+ function resolveWslContext(installBaseDir) {
652
+ if ('win32' !== process.platform) return {
653
+ useWsl: false
654
+ };
655
+ const trimmed = String(installBaseDir || '').trim();
656
+ if (!trimmed) return {
657
+ useWsl: false
658
+ };
659
+ const unc = parseWslUncPath(trimmed);
660
+ if (unc) return {
661
+ useWsl: true,
662
+ distro: unc.distro,
663
+ installDir: unc.path
664
+ };
665
+ if (isWslMountPath(trimmed)) return {
666
+ useWsl: true,
667
+ installDir: trimmed
668
+ };
669
+ return {
670
+ useWsl: false
671
+ };
672
+ }
673
+ function wrapCommandForWsl(command, context) {
674
+ if (!context.useWsl) return command;
675
+ const args = [
676
+ ...context.distro ? [
677
+ '-d',
678
+ context.distro
679
+ ] : [],
680
+ '--'
681
+ ];
682
+ args.push(command.command, ...command.args);
683
+ return {
684
+ command: 'wsl.exe',
685
+ args
686
+ };
687
+ }
688
+ function isMissingManagerError(error) {
689
+ const err = error;
690
+ return (null == err ? void 0 : err.code) === 'ENOENT' || String((null == err ? void 0 : err.message) || '').includes('ENOENT') || String((null == err ? void 0 : err.message) || '').includes('not found');
691
+ }
692
+ function isInstallExitFailure(error) {
693
+ return /Install failed with exit code \d+/.test(String((null == error ? void 0 : error.message) || error || ''));
694
+ }
695
+ async function execInstallWithFallback(command, options) {
696
+ try {
697
+ await execInstallCommand(command.command, command.args, {
698
+ cwd: options.cwd,
699
+ env: options.env,
700
+ stdio: 'inherit'
701
+ });
702
+ return;
703
+ } catch (error) {
704
+ if (options.fallbackNpmCommand && (isMissingManagerError(error) || options.allowFallbackOnFailure && isInstallExitFailure(error))) return void await execInstallCommand(options.fallbackNpmCommand.command, options.fallbackNpmCommand.args, {
705
+ cwd: options.cwd,
706
+ env: options.env,
707
+ stdio: 'inherit'
708
+ });
709
+ throw error;
710
+ }
711
+ }
712
+ async function preferCorepackFallback(pm) {
713
+ if ('npm' !== pm.name || pm.execPath || pm.runnerCommand) return pm;
714
+ const npmUserAgent = process.env.npm_config_user_agent || '';
715
+ const npmExecPath = process.env.npm_execpath || process.env.NPM_EXEC_PATH || '';
716
+ if (npmUserAgent.includes('npm') || npmExecPath) return pm;
717
+ try {
718
+ const { spawnSync } = await import("child_process");
719
+ const result = spawnSync('corepack', [
720
+ '--version'
721
+ ], {
722
+ stdio: 'ignore',
723
+ windowsHide: true
724
+ });
725
+ if ((null == result ? void 0 : result.status) === 0) return {
726
+ name: 'pnpm',
727
+ runnerCommand: 'corepack',
728
+ runnerArgs: [
729
+ 'pnpm'
730
+ ]
731
+ };
732
+ } catch {}
733
+ return pm;
734
+ }
735
+ function getOptionalInstallCommand(pm, dependencySpecs, installBaseDir) {
736
+ const pmName = pm.name;
737
+ if ('yarn' === pmName) return buildInstallCommand(pm, [
738
+ '--cwd',
739
+ installBaseDir,
740
+ 'add',
741
+ ...dependencySpecs,
742
+ '--optional'
743
+ ]);
744
+ if ('npm' === pmName) return getRootInstallCommand(pm, installBaseDir);
745
+ if ('pnpm' === pmName) return buildInstallCommand(pm, [
746
+ 'install',
747
+ '--dir',
748
+ installBaseDir,
749
+ '--ignore-workspace',
750
+ '--lockfile=false',
751
+ '--silent'
752
+ ]);
753
+ if ('bun' === pmName) return buildInstallCommand(pm, [
754
+ 'add',
755
+ ...dependencySpecs,
756
+ '--cwd',
757
+ installBaseDir,
758
+ '--optional'
759
+ ]);
760
+ return buildInstallCommand(pm, [
761
+ '--silent',
762
+ 'install',
763
+ ...dependencySpecs,
764
+ '--cwd',
765
+ installBaseDir,
766
+ '--optional'
767
+ ]);
768
+ }
769
+ function getRootInstallCommand(pm, installBaseDir) {
770
+ const pmName = pm.name;
771
+ const dirArgs = installBaseDir ? 'yarn' === pmName ? [
772
+ '--cwd',
773
+ installBaseDir
774
+ ] : 'pnpm' === pmName ? [
775
+ '--dir',
776
+ installBaseDir
777
+ ] : 'bun' === pmName ? [
778
+ '--cwd',
779
+ installBaseDir
780
+ ] : [
781
+ '--prefix',
782
+ installBaseDir
783
+ ] : [];
784
+ if ('yarn' === pmName) return buildInstallCommand(pm, [
785
+ ...dirArgs,
786
+ 'install'
787
+ ]);
788
+ if ('npm' === pmName) return buildInstallCommand(pm, [
789
+ 'install',
790
+ '--silent',
791
+ ...dirArgs
792
+ ]);
793
+ if ('pnpm' === pmName) return buildInstallCommand(pm, [
794
+ 'install',
795
+ '--silent',
796
+ ...dirArgs,
797
+ '--ignore-workspace',
798
+ '--lockfile=false'
799
+ ]);
800
+ if ('bun' === pmName) return buildInstallCommand(pm, [
801
+ 'install',
802
+ ...dirArgs
803
+ ]);
804
+ return buildInstallCommand(pm, [
805
+ 'install',
806
+ '--silent',
807
+ ...dirArgs
808
+ ]);
809
+ }
810
+ async function runInstallAttempt(input) {
811
+ const env = 'yarn' === input.pm.name ? {
812
+ ...process.env,
813
+ YARN_ENABLE_IMMUTABLE_INSTALLS: 'false',
814
+ YARN_NODE_LINKER: 'node-modules'
815
+ } : process.env;
816
+ const installCommand = getOptionalInstallCommand(input.pm, input.dependencySpecs, input.wslContext.installDir || input.installBaseDir);
817
+ const execCommand = wrapCommandForWsl(installCommand, input.wslContext);
818
+ const fallbackNpmCommand = input.wslContext.useWsl ? void 0 : buildNpmCliFallback([
819
+ '--silent',
820
+ 'install',
821
+ ...input.dependencySpecs,
822
+ '--prefix',
823
+ input.installBaseDir,
824
+ '--save-optional'
825
+ ]);
826
+ await execInstallWithFallback(execCommand, {
827
+ cwd: input.wslContext.useWsl ? void 0 : input.installBaseDir,
828
+ env,
829
+ fallbackNpmCommand,
830
+ allowFallbackOnFailure: !input.wslContext.useWsl && 'npm' !== input.pm.name && void 0 !== fallbackNpmCommand
831
+ });
832
+ await new Promise((resolve)=>setTimeout(resolve, 500));
833
+ const needsRootRelink = 'npm' !== input.pm.name && (input.isAuthor || input.dependencySpecs.length > 1);
834
+ if (!needsRootRelink) return;
835
+ if (input.isAuthor) console.log(optionalToolingRootInstall(input.integration));
836
+ const rootInstall = getRootInstallCommand(input.pm, input.wslContext.useWsl ? input.wslContext.installDir : void 0);
837
+ const rootCommand = wrapCommandForWsl(rootInstall, input.wslContext);
838
+ const rootFallbackCommand = input.wslContext.useWsl ? void 0 : buildNpmCliFallback([
839
+ '--silent',
840
+ 'install',
841
+ '--prefix',
842
+ input.installBaseDir
843
+ ]);
844
+ await execInstallWithFallback(rootCommand, {
845
+ cwd: input.wslContext.useWsl ? void 0 : input.installBaseDir,
846
+ env,
847
+ fallbackNpmCommand: rootFallbackCommand,
848
+ allowFallbackOnFailure: !input.wslContext.useWsl && 'npm' !== input.pm.name && void 0 !== rootFallbackCommand
849
+ });
850
+ if (input.isAuthor) console.log(optionalToolingReady(input.integration));
851
+ }
852
+ async function installOptionalDependencies(integration, dependencySpecs, options) {
853
+ if (!dependencySpecs.length) return;
854
+ let pm;
855
+ let wslContext;
856
+ let installBaseDir;
857
+ const dependencyIds = dependencySpecs.map((spec)=>getPackageIdFromSpec(spec));
858
+ try {
859
+ installBaseDir = resolveOptionalInstallRoot();
860
+ prepareOptionalInstallState({
861
+ installBaseDir,
862
+ dependencySpecs,
863
+ forceRecreateInstallRoot: null == options ? void 0 : options.forceRecreateInstallRoot
864
+ });
865
+ pm = resolvePackageManager({
866
+ cwd: installBaseDir
867
+ });
868
+ wslContext = resolveWslContext(installBaseDir);
869
+ if (!wslContext.useWsl) pm = await preferCorepackFallback(pm);
870
+ const isAuthor = 'true' === process.env.EXTENSION_AUTHOR_MODE;
871
+ const setupMessages = optionalToolingSetup([
872
+ integration
873
+ ], integration, isAuthor);
874
+ const setupMessage = setupMessages[0];
875
+ const hasIndex = Boolean((null == options ? void 0 : options.index) && (null == options ? void 0 : options.total));
876
+ const setupMessageWithIndex = hasIndex ? setupMessage.replace("\u25BA\u25BA\u25BA ", `\u{25BA}\u{25BA}\u{25BA} [${null == options ? void 0 : options.index}/${null == options ? void 0 : options.total}] `) : setupMessage;
877
+ if (isAuthor) console.warn(setupMessageWithIndex);
878
+ else console.log(setupMessageWithIndex);
879
+ await runInstallAttempt({
880
+ pm,
881
+ wslContext,
882
+ installBaseDir,
883
+ dependencySpecs,
884
+ isAuthor,
885
+ integration
886
+ });
887
+ let missingDependencies = getMissingDependenciesAtInstallRoot(dependencyIds, installBaseDir);
888
+ if (missingDependencies.length > 0 && 'npm' !== pm.name) {
889
+ await runInstallAttempt({
890
+ pm,
891
+ wslContext,
892
+ installBaseDir,
893
+ dependencySpecs: filterSpecsByPackageIds(dependencySpecs, missingDependencies),
894
+ isAuthor,
895
+ integration
896
+ });
897
+ missingDependencies = getMissingDependenciesAtInstallRoot(dependencyIds, installBaseDir);
898
+ }
899
+ if (missingDependencies.length > 0) {
900
+ prepareOptionalInstallState({
901
+ installBaseDir,
902
+ dependencySpecs,
903
+ forceRecreateInstallRoot: true
904
+ });
905
+ await runInstallAttempt({
906
+ pm,
907
+ wslContext,
908
+ installBaseDir,
909
+ dependencySpecs,
910
+ isAuthor,
911
+ integration
912
+ });
913
+ missingDependencies = getMissingDependenciesAtInstallRoot(dependencyIds, installBaseDir);
914
+ }
915
+ if (missingDependencies.length > 0) throw new Error(`[${integration}] Optional dependency install reported success but packages are missing: ${missingDependencies.join(', ')}`);
916
+ return true;
917
+ } catch (error) {
918
+ console.error('[extension.js][optional-deps] debug', {
919
+ platform: process.platform,
920
+ execPath: process.execPath,
921
+ cwd: process.cwd(),
922
+ path: process.env.PATH || process.env.Path,
923
+ comspec: process.env.ComSpec,
924
+ systemRoot: process.env.SystemRoot,
925
+ npm_execpath: process.env.npm_execpath,
926
+ npm_config_user_agent: process.env.npm_config_user_agent,
927
+ npm_config_prefix: process.env.npm_config_prefix,
928
+ npm_config_cache: process.env.npm_config_cache,
929
+ npm_config_userconfig: process.env.npm_config_userconfig,
930
+ installBaseDir,
931
+ wslContext,
932
+ pm,
933
+ errorCode: null == error ? void 0 : error.code,
934
+ errorMessage: error instanceof Error ? error.message : String(error || 'unknown error')
935
+ });
936
+ const isAuthor = 'true' === process.env.EXTENSION_AUTHOR_MODE;
937
+ if (isMissingManagerError(error)) console.error(optionalInstallManagerMissing(integration));
938
+ else console.error(optionalInstallFailed(integration, error, isAuthor));
939
+ return false;
940
+ }
941
+ }
942
+ async function installOptionalDependenciesBatch(plans) {
943
+ if (!plans.length) return;
944
+ console.log(`${__WEBPACK_EXTERNAL_MODULE_pintor__["default"].gray("\u25BA\u25BA\u25BA")} Found ${__WEBPACK_EXTERNAL_MODULE_pintor__["default"].yellow(String(plans.length))} specialized integration${1 === plans.length ? '' : 's'} needing installation...`);
945
+ for (const [index, plan] of plans.entries()){
946
+ const didInstall = await installOptionalDependencies(plan.integration, plan.dependencySpecs, {
947
+ index: index + 1,
948
+ total: plans.length
949
+ });
950
+ if (!didInstall) return false;
951
+ }
952
+ return true;
953
+ }
954
+ export { hasDependency, installOptionalDependencies, installOptionalDependenciesBatch, resolveDevelopInstallRoot, resolveOptionalInstallRoot, resolvePackageFromInstallRoot };