@teambit/pnpm 1.0.1259 → 1.0.1260

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/lynx.js CHANGED
@@ -9,6 +9,8 @@ exports.getPeerDependencyIssues = getPeerDependencyIssues;
9
9
  exports.install = install;
10
10
  exports.mergeBitLockfileAttrs = mergeBitLockfileAttrs;
11
11
  exports.packageNameOfDepPath = packageNameOfDepPath;
12
+ exports.removeCoreDependencies = removeCoreDependencies;
13
+ exports.removedCoreDependencyOverrides = removedCoreDependencyOverrides;
12
14
  exports.resolveRemoteVersion = resolveRemoteVersion;
13
15
  exports.resolveScriptPolicies = resolveScriptPolicies;
14
16
  exports.sortDepsRequiringBuild = sortDepsRequiringBuild;
@@ -119,6 +121,8 @@ function _buildScriptsPath() {
119
121
  }
120
122
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
121
123
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
124
+ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
125
+ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
122
126
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
123
127
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
124
128
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
@@ -254,12 +258,58 @@ async function getPeerDependencyIssues(manifestsByPaths, opts) {
254
258
  */
255
259
 
256
260
  /**
257
- * Recorded as the lockfile's `pnpmfileChecksum`, so pnpm reuses the resolved
258
- * dependencies across installs instead of treating the readPackage hooks as
259
- * untracked and resolving everything again. Bump it when the hooks change what
260
- * they do to dependency manifests, so existing lockfiles are resolved again.
261
+ * `@teambit/legacy` and `@teambit/harmony` are never installed: the running bit
262
+ * installation provides them, and Bit links them itself. Harmony is kept when
263
+ * the workspace forces its version, which the caller then sets as a regular
264
+ * override.
261
265
  */
262
- const READ_PACKAGE_HOOKS_CHECKSUM = 'bit-1';
266
+ function removedCoreDependencies(forcedHarmonyVersion) {
267
+ return forcedHarmonyVersion ? ['@teambit/legacy'] : ['@teambit/legacy', '@teambit/harmony'];
268
+ }
269
+
270
+ /**
271
+ * The overrides remove the core dependencies from every manifest the engine
272
+ * resolves, peer dependencies included. The `@*` selector matches only semver
273
+ * ranges, so the `link:` dependencies Bit's linker adds stay. A registry
274
+ * package declares nothing else, while a workspace project may also use
275
+ * `workspace:`, `file:` or `npm:` specs: `removeCoreDependencies` removes those
276
+ * from the workspace manifests before the install.
277
+ */
278
+ function removedCoreDependencyOverrides(forcedHarmonyVersion) {
279
+ return Object.fromEntries(removedCoreDependencies(forcedHarmonyVersion).map(name => [`${name}@*`, '-']));
280
+ }
281
+
282
+ /**
283
+ * Removes the core dependencies from a workspace project's manifest, whatever
284
+ * their spec, except the `link:` dependencies Bit's linker adds.
285
+ */
286
+ function removeCoreDependencies(manifest, forcedHarmonyVersion) {
287
+ let result = manifest;
288
+ for (const name of removedCoreDependencies(forcedHarmonyVersion)) {
289
+ const dependency = result.dependencies?.[name];
290
+ if (dependency != null && !dependency.startsWith('link:')) {
291
+ const _ref = result.dependencies,
292
+ {
293
+ [name]: _removed
294
+ } = _ref,
295
+ dependencies = _objectWithoutProperties(_ref, [name].map(_toPropertyKey));
296
+ result = _objectSpread(_objectSpread({}, result), {}, {
297
+ dependencies
298
+ });
299
+ }
300
+ if (result.peerDependencies?.[name] != null) {
301
+ const _result$peerDependenc = result.peerDependencies,
302
+ {
303
+ [name]: _removed
304
+ } = _result$peerDependenc,
305
+ peerDependencies = _objectWithoutProperties(_result$peerDependenc, [name].map(_toPropertyKey));
306
+ result = _objectSpread(_objectSpread({}, result), {}, {
307
+ peerDependencies
308
+ });
309
+ }
310
+ }
311
+ return result;
312
+ }
263
313
  async function install(rootDir, manifestsByPaths, storeDir, cacheDir, registries, proxyConfig = {}, networkConfig = {}, options, logger) {
264
314
  const externalDependencies = new Set();
265
315
  const hooks = createReadPackageHooks(options);
@@ -273,6 +323,7 @@ async function install(rootDir, manifestsByPaths, storeDir, cacheDir, registries
273
323
  }
274
324
  }
275
325
  const overrides = _objectSpread({}, options.overrides);
326
+ Object.assign(overrides, removedCoreDependencyOverrides(options.forcedHarmonyVersion));
276
327
  if (options.forcedHarmonyVersion) {
277
328
  // Harmony needs to be a singleton, so if a specific version was requested for the workspace,
278
329
  // we force that version accross the whole dependency graph.
@@ -297,27 +348,22 @@ async function install(rootDir, manifestsByPaths, storeDir, cacheDir, registries
297
348
  neverBuiltDependencies: options.neverBuiltDependencies
298
349
  });
299
350
 
300
- // The in-memory importer manifests are transformed up front (with each
301
- // importer's own directory as workspaceDir). The dependency manifests are
302
- // transformed lazily by the engine through the readPackageHook (which has no
303
- // workspaceDir).
304
- const projects = Object.entries(manifestsByPaths).map(([dir, manifest]) => ({
305
- rootDir: dir,
306
- manifest: applyReadPackageHooks(hooks, manifest, dir)
307
- }));
308
- // When the engine resolves a workspace project as a dependency (an injected
309
- // "file:" instance), it hands the hook that project's importer manifest —
310
- // which the up-front transform above already stripped of workspace-sibling
311
- // deps. The instance must keep those deps (they become the component's graph
312
- // edges), so substitute the project's raw manifest, identified by the
313
- // lockfile-root-relative directory the engine passes for directory
314
- // resolutions. pnpm's TS engine reaches the same split by keeping raw
315
- // project manifests and applying the hook chain contextually.
316
- const readPackageHookForDeps = (manifest, resolvedDir) => {
317
- const rawManifest = resolvedDir ? manifestsByPaths[(0, _path().join)(rootDir, resolvedDir)] : undefined;
318
- const resolvedManifest = applyReadPackageHooks(hooks, rawManifest ?? manifest);
319
- return removeScriptsFromNeverBuiltPackages(resolvedManifest, scriptPolicies.neverBuildPackageNames);
320
- };
351
+ // The importer manifests are transformed here, with each importer's own
352
+ // directory as workspaceDir. The engine needs no readPackage hook for the
353
+ // dependency manifests: the core dependencies are removed by the overrides
354
+ // above (and from the workspace manifests here), and a workspace project resolved as a dependency (an injected
355
+ // "file:" instance) gets its raw manifest through `dependencyManifest`. The
356
+ // instance must keep the workspace-sibling deps the importer transform
357
+ // strips, because they become the component's graph edges.
358
+ const projects = Object.entries(manifestsByPaths).map(([dir, projectManifest]) => {
359
+ const rawManifest = removeCoreDependencies(projectManifest, options.forcedHarmonyVersion);
360
+ const manifest = applyReadPackageHooks(hooks, rawManifest, dir);
361
+ return {
362
+ rootDir: dir,
363
+ manifest: manifest,
364
+ dependencyManifest: (0, _lodash().isEqual)(manifest, rawManifest) ? undefined : rawManifest
365
+ };
366
+ });
321
367
  const installOptions = {
322
368
  dir: rootDir,
323
369
  projects,
@@ -328,7 +374,6 @@ async function install(rootDir, manifestsByPaths, storeDir, cacheDir, registries
328
374
  proxyConfig: toNodeApiProxyConfig(proxyConfig),
329
375
  networkConfig: toNodeApiNetworkConfig(networkConfig),
330
376
  overrides,
331
- readPackageHookChecksum: READ_PACKAGE_HOOKS_CHECKSUM,
332
377
  nodeLinker: options.nodeLinker,
333
378
  // Resolve bare-semver deps on workspace components (incl. auto-installed
334
379
  // peers naming a sibling component) from the workspace instead of the
@@ -420,7 +465,7 @@ async function install(rootDir, manifestsByPaths, storeDir, cacheDir, registries
420
465
  // install alongside `depsRequiringBuild`.
421
466
  const preInstallBitAttrs = await readBitLockfileAttrs(rootDir);
422
467
  restoreWantedLockfile = await removeWantedLockfileForUpdate(rootDir, options.updateAll);
423
- installPromise = nodeApi().install(installOptions, undefined, readPackageHookForDeps, onOutput);
468
+ installPromise = nodeApi().install(installOptions, undefined, undefined, onOutput);
424
469
  installsRunning[rootDir] = installPromise;
425
470
  const installResult = await installPromise;
426
471
  resolvedStoreDir = installResult.storeDir;
@@ -492,18 +537,13 @@ function resolveScriptPolicies({
492
537
  }) {
493
538
  const allowBuilds = {};
494
539
  if (dangerouslyAllowAllScripts) {
495
- if (!neverBuiltDependencies?.length) {
496
- return {
497
- allowBuilds,
498
- dangerouslyAllowAllBuilds: true
499
- };
500
- }
501
- for (const pkg of neverBuiltDependencies) {
540
+ // The engine checks `allowBuilds` denials before the allow-all flag.
541
+ for (const pkg of neverBuiltDependencies ?? []) {
502
542
  allowBuilds[pkg] = false;
503
543
  }
504
544
  return {
505
545
  allowBuilds,
506
- neverBuildPackageNames: neverBuiltDependencies
546
+ dangerouslyAllowAllBuilds: true
507
547
  };
508
548
  }
509
549
  for (const [packageDescriptor, allowedScript] of Object.entries(allowScripts ?? {})) {
@@ -529,12 +569,6 @@ function resolveScriptPolicies({
529
569
  allowBuilds
530
570
  };
531
571
  }
532
- function removeScriptsFromNeverBuiltPackages(manifest, neverBuildPackageNames) {
533
- if (!manifest.name || !manifest.scripts || !neverBuildPackageNames?.includes(manifest.name)) return manifest;
534
- return _objectSpread(_objectSpread({}, manifest), {}, {
535
- scripts: undefined
536
- });
537
- }
538
572
  const APPROVE_BUILDS_INSTRUCTION_TEXT = 'Update the "allowScripts" field under "teambit.dependencies/dependency-resolver" in workspace.jsonc. \nSet to true to allow, false to explicitly disallow. \nExample: allowScripts: { "esbuild": true, "core-js": false }. \nThis is a security-sensitive setting: enabling scripts may allow arbitrary code execution during install.';
539
573
 
540
574
  /**
@@ -582,20 +616,14 @@ function reporterOutputStream(opts) {
582
616
  }
583
617
 
584
618
  /**
585
- * This function returns the list of hooks that are passed to pnpm
586
- * for transforming the manifests of dependencies during installation.
619
+ * The transforms Bit applies to the importer manifests (the workspace projects)
620
+ * before passing them to pnpm. Dependency manifests are not transformed.
587
621
  */
588
622
  function createReadPackageHooks(options) {
589
623
  const readPackage = [];
590
624
  if (options?.rootComponents && !options?.rootComponentsForCapsules) {
591
625
  readPackage.push(readPackageHook);
592
626
  }
593
- readPackage.push(removeLegacyFromDeps);
594
- if (!options.forcedHarmonyVersion) {
595
- // If the workspace did not specify a harmony version in a root policy,
596
- // then we remove harmony from any dependencies, so that the one linked from bvm is used.
597
- readPackage.push(removeHarmonyFromDeps);
598
- }
599
627
  if (options?.rootComponentsForCapsules) {
600
628
  readPackage.push(readPackageHookForCapsules);
601
629
  }
@@ -617,37 +645,6 @@ function readPackageHookForCapsules(pkg, workspaceDir) {
617
645
  return pkg;
618
646
  }
619
647
 
620
- /**
621
- * @teambit/legacy should never be installed as a dependency.
622
- * It is linked from bvm.
623
- */
624
- function removeLegacyFromDeps(pkg) {
625
- if (pkg.dependencies != null) {
626
- if (pkg.dependencies['@teambit/legacy'] && !pkg.dependencies['@teambit/legacy'].startsWith('link:')) {
627
- delete pkg.dependencies['@teambit/legacy'];
628
- }
629
- }
630
- if (pkg.peerDependencies != null) {
631
- if (pkg.peerDependencies['@teambit/legacy']) {
632
- delete pkg.peerDependencies['@teambit/legacy'];
633
- }
634
- }
635
- return pkg;
636
- }
637
- function removeHarmonyFromDeps(pkg) {
638
- if (pkg.dependencies != null) {
639
- if (pkg.dependencies['@teambit/harmony'] && !pkg.dependencies['@teambit/harmony'].startsWith('link:')) {
640
- delete pkg.dependencies['@teambit/harmony'];
641
- }
642
- }
643
- if (pkg.peerDependencies != null) {
644
- if (pkg.peerDependencies['@teambit/harmony']) {
645
- delete pkg.peerDependencies['@teambit/harmony'];
646
- }
647
- }
648
- return pkg;
649
- }
650
-
651
648
  /**
652
649
  * This hook is used when installation happens in a Bit workspace.
653
650
  * We need a different hook for this case because unlike in a capsule, in a workspace,
package/dist/lynx.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["_path","data","require","_fs","_chalk","_interopRequireDefault","_semver","_parsePackageName","_pluginTrustedDeps","nodeApi","_interopRequireWildcard","_nerfDart","_bitError","_legacy","_dependenciesPnpm","_lodash","_pnpmErrorToBitError","_readConfig","_buildScriptsPath","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ownKeys","keys","getOwnPropertySymbols","filter","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","_toPropertyKey","value","configurable","writable","_toPrimitive","Symbol","toPrimitive","TypeError","String","Number","UNTRUSTED_PACKAGE_NAMES","installsRunning","toNodeApiProxyConfig","proxyConfig","httpProxy","httpsProxy","noProxy","toNodeApiNetworkConfig","networkConfig","ca","cert","key","localAddress","strictSsl","strictSSL","maxSockets","networkConcurrency","fetchRetries","fetchRetryFactor","fetchRetryMintimeout","fetchRetryMaxtimeout","fetchTimeout","userAgent","buildAuthHeaderByUri","registries","result","registry","values","scopes","uri","authHeaderValue","toNerfDart","defaultRegistry","applyReadPackageHooks","hooks","manifest","workspaceDir","reduce","m","hook","generateResolverAndFetcher","cacheDir","fullMetadata","pnpmConfig","readConfig","authHeaderByUri","config","registriesMap","toMap","resolve","wantedDep","resolveOpts","resolveDependency","dir","projectDir","lockfileDir","process","cwd","undefined","getPeerDependencyIssues","manifestsByPaths","opts","projects","entries","map","rootDir","storeDir","overrides","peersSuffixMaxLength","virtualStoreDirMaxLength","VIRTUAL_STORE_DIR_MAX_LENGTH","err","pnpmErrorToBitError","READ_PACKAGE_HOOKS_CHECKSUM","install","options","logger","externalDependencies","Set","createReadPackageHooks","rootComponents","rootComponentsForCapsules","name","add","forcedHarmonyVersion","dependenciesMeta","hoistPattern","size","hoistInjectedDependencies","pkgName","scriptPolicies","resolveScriptPolicies","allowScripts","dangerouslyAllowAllScripts","neverBuiltDependencies","readPackageHookForDeps","resolvedDir","rawManifest","join","resolvedManifest","removeScriptsFromNeverBuiltPackages","neverBuildPackageNames","installOptions","readPackageHookChecksum","nodeLinker","linkWorkspacePackages","publicHoistPattern","allowBuilds","dangerouslyAllowAllBuilds","autoInstallPeers","excludeLinksFromLockfile","lockfileOnly","packageImportMethod","preferOffline","enableGlobalVirtualStore","globalVirtualStoreDir","patchedDependencies","packageExtensions","dedupePeerDependents","dedupePeers","dedupeDirectDeps","dedupeInjectedDeps","injectWorkspacePackages","includeOptionalDeps","update","updateAll","depth","nodeVersion","engineStrict","minimumReleaseAge","minimumReleaseAgeExclude","trustLockfile","ignorePackageManifest","hoistWorkspacePackages","enableModulesDir","resolvePeersFromWorkspaceRoot","frozenLockfile","preferFrozenLockfile","peerDependencyRules","allowAny","ignoreMissing","reportOptions","strictDepBuilds","pnpmHomeDir","returnListOfDepsRequiringBuild","reporter","hidePackageManagerOutput","toReporterOptions","hideAddedPkgsProgress","dependenciesChanged","depsRequiringBuild","resolvedStoreDir","dryRun","prepareBuildScriptsPath","installPromise","restoreWantedLockfile","onOutput","reporterOutput","preInstallBitAttrs","readBitLockfileAttrs","removeWantedLockfileForUpdate","installResult","sortedDepsRequiringBuild","sortDepsRequiringBuild","bitAttrs","mergeBitLockfileAttrs","addBitAttributesToLockfile","stats","added","removed","linkedToRoot","warn","rebuild","pending","selectedNames","pendingBuildNames","rebuildReportOptions","appendOnly","hideLifecycleOutput","lockfilePath","lockfileContent","fs","readFile","code","unlink","writeFile","pkg","packageDescriptor","allowedScript","trustedPkgName","TRUSTED_PACKAGE_NAMES","untrustedPkgName","scripts","includes","APPROVE_BUILDS_INSTRUCTION_TEXT","stream","reporterOutputStream","throttleProgress","hideProgressPrefix","ignoredBuildsInstructionText","hideLinkedPkgsDiff","width","columns","Math","max","color","chalk","level","chunk","write","outputStream","stdout","readPackage","readPackageHook","removeLegacyFromDeps","removeHarmonyFromDeps","readPackageHookForCapsules","dependencies","peerDependencies","startsWith","BIT_ROOTS_DIR","readWorkspacePackageHook","newDeps","version","resolveRemoteVersion","packageName","preferredVersions","parsedPackage","parsePackageName","alias","bareSpecifier","val","BitError","wantedRange","semver","validRange","isSemver","resolvedVia","message","normalizedBareSpecifier","sort","preInstallAttrs","packageNameOfDepPath","recorded","depPath","versionAt","indexOf","slice","replace","lockfile","readLockfile","bit","attrs","merged","isEqual","writeLockfile"],"sources":["lynx.ts"],"sourcesContent":["import { join } from 'path';\nimport { promises as fs } from 'fs';\nimport chalk from 'chalk';\nimport semver from 'semver';\nimport parsePackageName from 'parse-package-name';\nimport { TRUSTED_PACKAGE_NAMES } from '@pnpm/plugin-trusted-deps';\nimport type {\n PackageManifest,\n ProjectManifest,\n ReadPackageHook,\n PeerDependencyRules,\n DependencyManifest,\n DepPath,\n} from '@pnpm/types';\nimport * as nodeApi from '@pnpm/napi';\nimport type { PeerDependencyIssuesByProjects } from '@pnpm/napi';\nimport { type LockfileFile } from '@pnpm/lockfile.types';\nimport type { Registries } from '@teambit/pkg.entities.registry';\nimport toNerfDart from 'nerf-dart';\nimport type {\n ResolvedPackageVersion,\n PackageManagerProxyConfig,\n PackageManagerNetworkConfig,\n PackageExtension,\n} from '@teambit/dependency-resolver';\nimport { BitError } from '@teambit/bit-error';\nimport { BIT_ROOTS_DIR } from '@teambit/legacy.constants';\nimport type { Logger } from '@teambit/logger';\nimport { VIRTUAL_STORE_DIR_MAX_LENGTH } from '@teambit/dependencies.pnpm.dep-path';\nimport { isEqual } from 'lodash';\nimport { pnpmErrorToBitError } from './pnpm-error-to-bit-error';\nimport { readConfig } from './read-config';\nimport { prepareBuildScriptsPath } from './build-scripts-path';\n\n/**\n * Packages that are known to have risky or unnecessary build scripts.\n * These packages will be disallowed from running scripts by default,\n * unless the user explicitly allows them in `allowScripts`.\n */\nconst UNTRUSTED_PACKAGE_NAMES = ['es5-ext', 'less', 'protobufjs', 'ssh', 'core-js-pure', 'core-js'];\n\nconst installsRunning: Record<string, Promise<any>> = {};\n\n/**\n * Minimal structural signature of the `resolve` function returned by\n * `generateResolverAndFetcher`. It mirrors what the old\n * `@pnpm/installing.client` `ResolveFunction` exposed, but is backed by\n * `@pnpm/napi`'s `resolveDependency`.\n */\ntype ResolveOpts = {\n lockfileDir?: string;\n projectDir?: string;\n preferredVersions?: Record<string, unknown>;\n registry?: string;\n};\ntype ResolveFunction = (\n wantedDependency: nodeApi.WantedDependency,\n opts: ResolveOpts\n) => Promise<nodeApi.ResolveResult>;\n\nfunction toNodeApiProxyConfig(proxyConfig: PackageManagerProxyConfig): nodeApi.ProxyConfig {\n return {\n httpProxy: proxyConfig.httpProxy,\n httpsProxy: proxyConfig.httpsProxy,\n noProxy: proxyConfig.noProxy,\n };\n}\n\nfunction toNodeApiNetworkConfig(networkConfig: PackageManagerNetworkConfig): nodeApi.NetworkConfig {\n return {\n ca: networkConfig.ca,\n cert: networkConfig.cert,\n key: networkConfig.key,\n localAddress: networkConfig.localAddress,\n strictSsl: networkConfig.strictSSL,\n maxSockets: networkConfig.maxSockets,\n networkConcurrency: networkConfig.networkConcurrency,\n fetchRetries: networkConfig.fetchRetries,\n fetchRetryFactor: networkConfig.fetchRetryFactor,\n fetchRetryMintimeout: networkConfig.fetchRetryMintimeout,\n fetchRetryMaxtimeout: networkConfig.fetchRetryMaxtimeout,\n fetchTimeout: networkConfig.fetchTimeout,\n userAgent: networkConfig.userAgent,\n };\n}\n\n/**\n * Pre-computed `Authorization` headers keyed by nerf-darted registry URI\n * (plus `''` for the default registry) — the shape `@pnpm/napi` applies\n * directly. Bit's registries model already carries ready-to-send header\n * values (from the engine's `readConfig` plus Bit's own cloud token), so no\n * npmrc-style credential round-trip is needed.\n */\nfunction buildAuthHeaderByUri(registries: Registries): Record<string, string> {\n const result: Record<string, string> = {};\n for (const registry of Object.values(registries.scopes)) {\n if (registry.uri && registry.authHeaderValue) {\n result[toNerfDart(registry.uri)] = registry.authHeaderValue;\n }\n }\n const { defaultRegistry } = registries;\n if (defaultRegistry?.authHeaderValue) {\n if (defaultRegistry.uri) {\n result[toNerfDart(defaultRegistry.uri)] = defaultRegistry.authHeaderValue;\n }\n result[''] = defaultRegistry.authHeaderValue;\n }\n return result;\n}\n\n/**\n * Compose the list of read-package hooks into a single synchronous transform.\n * The Bit hooks are all synchronous, so the accumulator stays synchronous even\n * though the pnpm `ReadPackageHook` type allows returning a promise.\n */\nfunction applyReadPackageHooks(\n hooks: ReadPackageHook[],\n manifest: PackageManifest,\n workspaceDir?: string\n): PackageManifest {\n return hooks.reduce<PackageManifest>((m, hook) => hook(m, workspaceDir) as PackageManifest, manifest);\n}\n\nexport async function generateResolverAndFetcher({\n cacheDir,\n registries,\n proxyConfig,\n networkConfig,\n fullMetadata,\n}: {\n cacheDir: string;\n registries: Registries;\n proxyConfig?: PackageManagerProxyConfig;\n networkConfig?: PackageManagerNetworkConfig;\n fullMetadata?: boolean;\n}): Promise<{ resolve: ResolveFunction }> {\n const pnpmConfig = await readConfig();\n // The engine-resolved `.npmrc` headers first; Bit's own registries model\n // (which carries the cloud token) wins on conflict.\n const authHeaderByUri = { ...pnpmConfig.config.authHeaderByUri, ...buildAuthHeaderByUri(registries) };\n const registriesMap = registries.toMap();\n const resolve: ResolveFunction = (wantedDep, resolveOpts) =>\n nodeApi.resolveDependency(wantedDep, {\n dir: resolveOpts.projectDir || resolveOpts.lockfileDir || process.cwd(),\n cacheDir,\n registries: registriesMap,\n authHeaderByUri,\n proxyConfig: proxyConfig ? toNodeApiProxyConfig(proxyConfig) : undefined,\n networkConfig: networkConfig ? toNodeApiNetworkConfig(networkConfig) : undefined,\n fullMetadata,\n });\n return { resolve };\n}\n\nexport async function getPeerDependencyIssues(\n manifestsByPaths: Record<string, any>,\n opts: {\n storeDir?: string;\n cacheDir: string;\n registries: Registries;\n rootDir: string;\n proxyConfig: PackageManagerProxyConfig;\n networkConfig: PackageManagerNetworkConfig;\n overrides?: Record<string, string>;\n packageImportMethod?: 'auto' | 'hardlink' | 'copy' | 'clone';\n pnpmHomeDir?: string;\n }\n): Promise<PeerDependencyIssuesByProjects> {\n const projects: nodeApi.NodeApiProject[] = Object.entries(manifestsByPaths).map(([rootDir, manifest]) => ({\n rootDir,\n manifest: manifest as nodeApi.PackageManifest,\n }));\n try {\n return await nodeApi.getPeerDependencyIssues({\n dir: opts.rootDir,\n projects,\n storeDir: opts.storeDir,\n cacheDir: opts.cacheDir,\n overrides: opts.overrides,\n peersSuffixMaxLength: 1000,\n registries: opts.registries.toMap(),\n authHeaderByUri: buildAuthHeaderByUri(opts.registries),\n proxyConfig: toNodeApiProxyConfig(opts.proxyConfig),\n networkConfig: toNodeApiNetworkConfig(opts.networkConfig),\n virtualStoreDirMaxLength: VIRTUAL_STORE_DIR_MAX_LENGTH,\n });\n } catch (err: any) {\n throw pnpmErrorToBitError(err);\n }\n}\n\nexport type RebuildFn = (opts?: { pending?: boolean; skipIfHasSideEffectsCache?: boolean }) => Promise<void>;\n\n/**\n * A stream the engine's rendered output can be written to. `columns` is\n * how the frame is sized; a stream that is not a terminal has none, and\n * the reporter falls back to pnpm's 80-column default.\n */\nexport type OutputStream = NodeJS.WritableStream & { columns?: number };\n\nexport interface ReportOptions {\n appendOnly?: boolean;\n throttleProgress?: number;\n hideAddedPkgsProgress?: boolean;\n hideProgressPrefix?: boolean;\n hideLifecycleOutput?: boolean;\n peerDependencyRules?: PeerDependencyRules;\n /** Defaults to `process.stdout`. */\n outputStream?: OutputStream;\n}\n\n/**\n * Recorded as the lockfile's `pnpmfileChecksum`, so pnpm reuses the resolved\n * dependencies across installs instead of treating the readPackage hooks as\n * untracked and resolving everything again. Bump it when the hooks change what\n * they do to dependency manifests, so existing lockfiles are resolved again.\n */\nconst READ_PACKAGE_HOOKS_CHECKSUM = 'bit-1';\n\nexport async function install(\n rootDir: string,\n manifestsByPaths: Record<string, ProjectManifest>,\n storeDir: string | undefined,\n cacheDir: string,\n registries: Registries,\n proxyConfig: PackageManagerProxyConfig = {},\n networkConfig: PackageManagerNetworkConfig = {},\n options: {\n updateAll?: boolean;\n nodeLinker?: 'hoisted' | 'isolated';\n overrides?: Record<string, string>;\n rootComponents?: boolean;\n rootComponentsForCapsules?: boolean;\n includeOptionalDeps?: boolean;\n reportOptions?: ReportOptions;\n hidePackageManagerOutput?: boolean;\n hoistInjectedDependencies?: boolean;\n dryRun?: boolean;\n dedupePeers?: boolean;\n dedupeInjectedDeps?: boolean;\n forcedHarmonyVersion?: string;\n allowScripts?: Record<string, boolean | 'warn'>;\n dangerouslyAllowAllScripts?: boolean;\n neverBuiltDependencies?: string[];\n autoInstallPeers?: boolean;\n publicHoistPattern?: string[];\n hoistPattern?: string[];\n lockfileOnly?: boolean;\n nodeVersion?: string;\n enableModulesDir?: boolean;\n engineStrict?: boolean;\n excludeLinksFromLockfile?: boolean;\n minimumReleaseAge?: number;\n minimumReleaseAgeExclude?: string[];\n ignorePackageManifest?: boolean;\n hoistWorkspacePackages?: boolean;\n returnListOfDepsRequiringBuild?: boolean;\n packageImportMethod?: 'auto' | 'hardlink' | 'copy' | 'clone';\n enableGlobalVirtualStore?: boolean;\n globalVirtualStoreDir?: string;\n patchedDependencies?: Record<string, string>;\n packageExtensions?: Record<string, PackageExtension>;\n pnpmHomeDir?: string;\n preferOffline?: boolean;\n // Accepted for backward-compatibility with the previous pnpm engine, but the\n // Rust engine manages the side-effects cache internally.\n sideEffectsCacheRead?: boolean;\n sideEffectsCacheWrite?: boolean;\n },\n logger?: Logger\n): Promise<{ dependenciesChanged: boolean; rebuild: RebuildFn; storeDir: string; depsRequiringBuild?: DepPath[] }> {\n const externalDependencies = new Set<string>();\n const hooks = createReadPackageHooks(options);\n if (options?.rootComponents && !options?.rootComponentsForCapsules) {\n for (const [dir, { name }] of Object.entries(manifestsByPaths)) {\n if (dir !== rootDir && name) {\n externalDependencies.add(name);\n }\n }\n }\n const overrides = {\n ...options.overrides,\n };\n if (options.forcedHarmonyVersion) {\n // Harmony needs to be a singleton, so if a specific version was requested for the workspace,\n // we force that version accross the whole dependency graph.\n overrides['@teambit/harmony'] = options.forcedHarmonyVersion;\n }\n if (!manifestsByPaths[rootDir].dependenciesMeta) {\n manifestsByPaths = {\n ...manifestsByPaths,\n [rootDir]: {\n ...manifestsByPaths[rootDir],\n dependenciesMeta: {},\n },\n };\n }\n const hoistPattern = options.hoistPattern ?? ['*'];\n if (hoistPattern.length > 0 && externalDependencies.size > 0 && !options.hoistInjectedDependencies) {\n for (const pkgName of externalDependencies) {\n hoistPattern.push(`!${pkgName}`);\n }\n }\n const scriptPolicies = resolveScriptPolicies({\n allowScripts: options.allowScripts,\n dangerouslyAllowAllScripts: options.dangerouslyAllowAllScripts,\n neverBuiltDependencies: options.neverBuiltDependencies,\n });\n\n // The in-memory importer manifests are transformed up front (with each\n // importer's own directory as workspaceDir). The dependency manifests are\n // transformed lazily by the engine through the readPackageHook (which has no\n // workspaceDir).\n const projects: nodeApi.NodeApiProject[] = Object.entries(manifestsByPaths).map(([dir, manifest]) => ({\n rootDir: dir,\n manifest: applyReadPackageHooks(\n hooks,\n manifest as unknown as PackageManifest,\n dir\n ) as unknown as nodeApi.PackageManifest,\n }));\n // When the engine resolves a workspace project as a dependency (an injected\n // \"file:\" instance), it hands the hook that project's importer manifest —\n // which the up-front transform above already stripped of workspace-sibling\n // deps. The instance must keep those deps (they become the component's graph\n // edges), so substitute the project's raw manifest, identified by the\n // lockfile-root-relative directory the engine passes for directory\n // resolutions. pnpm's TS engine reaches the same split by keeping raw\n // project manifests and applying the hook chain contextually.\n const readPackageHookForDeps = (manifest: nodeApi.PackageManifest, resolvedDir?: string): nodeApi.PackageManifest => {\n const rawManifest = resolvedDir ? manifestsByPaths[join(rootDir, resolvedDir)] : undefined;\n const resolvedManifest = applyReadPackageHooks(\n hooks,\n (rawManifest ?? manifest) as unknown as PackageManifest\n ) as unknown as nodeApi.PackageManifest;\n return removeScriptsFromNeverBuiltPackages(resolvedManifest, scriptPolicies.neverBuildPackageNames);\n };\n\n const installOptions: nodeApi.InstallOptions = {\n dir: rootDir,\n projects,\n storeDir,\n cacheDir,\n registries: registries.toMap(),\n authHeaderByUri: buildAuthHeaderByUri(registries),\n proxyConfig: toNodeApiProxyConfig(proxyConfig),\n networkConfig: toNodeApiNetworkConfig(networkConfig),\n overrides,\n readPackageHookChecksum: READ_PACKAGE_HOOKS_CHECKSUM,\n nodeLinker: options.nodeLinker,\n // Resolve bare-semver deps on workspace components (incl. auto-installed\n // peers naming a sibling component) from the workspace instead of the\n // registry — otherwise an unpublished component peer 404s. `'deep'` so\n // transitive component deps link locally too.\n linkWorkspacePackages: 'deep',\n hoistPattern,\n publicHoistPattern: options.publicHoistPattern,\n externalDependencies: [...externalDependencies],\n allowBuilds: scriptPolicies.allowBuilds as Record<string, boolean>,\n dangerouslyAllowAllBuilds: scriptPolicies.dangerouslyAllowAllBuilds,\n // `neverBuiltDependencies` is already folded into `allowBuilds` above by\n // `resolveScriptPolicies`; the binding rejects a non-empty pass-through.\n autoInstallPeers: options.autoInstallPeers,\n excludeLinksFromLockfile: options.excludeLinksFromLockfile ?? true,\n lockfileOnly: options.lockfileOnly ?? false,\n packageImportMethod: options.packageImportMethod,\n preferOffline: options.preferOffline,\n virtualStoreDirMaxLength: VIRTUAL_STORE_DIR_MAX_LENGTH,\n // The hoisted linker copies packages straight into `node_modules` instead of symlinking them\n // out of a virtual store, so there is no virtual store for the global one to replace.\n enableGlobalVirtualStore: options.nodeLinker === 'hoisted' ? false : options.enableGlobalVirtualStore,\n globalVirtualStoreDir: options.globalVirtualStoreDir,\n patchedDependencies: options.patchedDependencies,\n packageExtensions: options.packageExtensions,\n peersSuffixMaxLength: 1000,\n dedupePeerDependents: true,\n dedupePeers: options.dedupePeers,\n dedupeDirectDeps: true,\n dedupeInjectedDeps: options.dedupeInjectedDeps,\n injectWorkspacePackages: true,\n includeOptionalDeps: options.includeOptionalDeps !== false,\n // `update` re-resolves the whole graph; the binding ignores `depth` (there\n // are no package selectors), but pass a finite full-depth value for parity\n // with the old engine's `depth: Infinity` update-all call.\n update: options.updateAll,\n depth: options.updateAll ? 1000 : undefined,\n nodeVersion: options.nodeVersion,\n engineStrict: options.engineStrict,\n // pnpm v12 defaults minimumReleaseAge to 1440 when the option is absent.\n // bit.cloud packuments are huge (a version per snap) and their abbreviated\n // form carries no `time` field, so the maturity cutoff forces a full-\n // packument upgrade fetch for every component on a cold resolve. Disable\n // the policy unless the workspace opts in.\n minimumReleaseAge: options.minimumReleaseAge ?? 0,\n minimumReleaseAgeExclude: options.minimumReleaseAgeExclude,\n // Bit lockfiles are trusted workspace input. Keep installs compatible with\n // lockfiles generated before pnpm v12 added registry resolution verification.\n trustLockfile: true,\n ignorePackageManifest: options.ignorePackageManifest,\n hoistWorkspacePackages: options.hoistWorkspacePackages,\n enableModulesDir: options.enableModulesDir,\n resolvePeersFromWorkspaceRoot: true,\n frozenLockfile: options.updateAll ? false : undefined,\n preferFrozenLockfile: !options.updateAll,\n // Suppress peer-dependency warnings by default (allow any version, ignore\n // missing), letting the workspace's own rules override.\n peerDependencyRules: {\n allowAny: ['*'],\n ignoreMissing: ['*'],\n ...options.reportOptions?.peerDependencyRules,\n } as nodeApi.PeerDependencyRules,\n // Bit reports the deps requiring a build in the lockfile instead of failing.\n strictDepBuilds: false,\n pnpmHomeDir: options.pnpmHomeDir,\n // Report every package with install scripts (not just blocked ones) in\n // `depsRequiringBuild`, so the `bit:` lockfile block lists them even\n // though Bit allows the builds to run.\n returnListOfDepsRequiringBuild: true,\n reporter: options.hidePackageManagerOutput\n ? undefined\n : toReporterOptions({ ...options.reportOptions, hideAddedPkgsProgress: options.lockfileOnly }),\n };\n\n let dependenciesChanged = false;\n let depsRequiringBuild: DepPath[] | undefined;\n let resolvedStoreDir = storeDir;\n if (!options.dryRun) {\n // Dependency build scripts inherit this process's PATH. Set up inside the\n // guard, so a dry run neither writes the wrapper nor touches the env.\n prepareBuildScriptsPath(logger);\n let installPromise: Promise<nodeApi.InstallResult> | undefined;\n let restoreWantedLockfile: (() => Promise<void>) | undefined;\n const onOutput = options.hidePackageManagerOutput ? undefined : reporterOutput(options.reportOptions);\n try {\n await installsRunning[rootDir];\n // The engine rewrites pnpm-lock.yaml from its typed model, which\n // does not round-trip Bit's `bit:` extension block (the v11 TS\n // engine mutated the loaded object in place, so the block\n // survived). Capture it up front and re-assert it after the\n // install alongside `depsRequiringBuild`.\n const preInstallBitAttrs = await readBitLockfileAttrs(rootDir);\n restoreWantedLockfile = await removeWantedLockfileForUpdate(rootDir, options.updateAll);\n installPromise = nodeApi.install(installOptions, undefined, readPackageHookForDeps, onOutput);\n installsRunning[rootDir] = installPromise;\n const installResult: nodeApi.InstallResult = await installPromise;\n resolvedStoreDir = installResult.storeDir;\n const sortedDepsRequiringBuild = sortDepsRequiringBuild(installResult.depsRequiringBuild);\n const bitAttrs = mergeBitLockfileAttrs(preInstallBitAttrs, sortedDepsRequiringBuild);\n if (bitAttrs != null) {\n await addBitAttributesToLockfile(rootDir, bitAttrs);\n }\n depsRequiringBuild = sortedDepsRequiringBuild as unknown as DepPath[] | undefined;\n dependenciesChanged =\n installResult.stats.added + installResult.stats.removed + installResult.stats.linkedToRoot > 0;\n } catch (err: any) {\n await restoreWantedLockfile?.();\n if (logger) {\n logger.warn('got an error from the pnpm install function', err);\n }\n throw pnpmErrorToBitError(err);\n } finally {\n if (installPromise && installsRunning[rootDir] === installPromise) {\n delete installsRunning[rootDir];\n }\n }\n }\n return {\n dependenciesChanged,\n // The engine has no skipIfHasSideEffectsCache selector; a pending rebuild\n // is expressed as a selection of the packages the lockfile records as\n // needing a build.\n rebuild: async ({ pending } = {}) => {\n const selectedNames = pending ? await pendingBuildNames(rootDir, depsRequiringBuild) : undefined;\n if (selectedNames?.length === 0) return;\n // Reached without an install of its own after a dry run.\n prepareBuildScriptsPath(logger);\n // Same output routing as the install: the CLI server's stream has to\n // carry the rebuild's output too, not just the install's.\n const rebuildReportOptions: ReportOptions = {\n ...options.reportOptions,\n appendOnly: true,\n hideLifecycleOutput: true,\n };\n await nodeApi.rebuild(\n {\n ...installOptions,\n storeDir: resolvedStoreDir,\n reporter: options.hidePackageManagerOutput ? undefined : toReporterOptions(rebuildReportOptions),\n },\n undefined,\n selectedNames,\n options.hidePackageManagerOutput ? undefined : reporterOutput(rebuildReportOptions)\n );\n },\n storeDir: resolvedStoreDir ?? '',\n depsRequiringBuild,\n };\n}\n\nasync function removeWantedLockfileForUpdate(\n rootDir: string,\n updateAll?: boolean\n): Promise<(() => Promise<void>) | undefined> {\n if (!updateAll) return undefined;\n const lockfilePath = join(rootDir, 'pnpm-lock.yaml');\n let lockfileContent: Buffer;\n try {\n lockfileContent = await fs.readFile(lockfilePath);\n } catch (err: any) {\n if (err?.code === 'ENOENT') return undefined;\n throw err;\n }\n await fs.unlink(lockfilePath);\n return async () => {\n await fs.writeFile(lockfilePath, lockfileContent);\n };\n}\n\ntype ScriptPolicyConfig = {\n allowScripts?: Record<string, boolean | 'warn'>;\n dangerouslyAllowAllScripts?: boolean;\n neverBuiltDependencies?: string[];\n};\n\nexport function resolveScriptPolicies({\n allowScripts,\n dangerouslyAllowAllScripts,\n neverBuiltDependencies,\n}: ScriptPolicyConfig): {\n allowBuilds: Record<string, boolean | string>;\n dangerouslyAllowAllBuilds?: boolean;\n neverBuildPackageNames?: string[];\n} {\n const allowBuilds: Record<string, boolean | string> = {};\n if (dangerouslyAllowAllScripts) {\n if (!neverBuiltDependencies?.length) {\n return { allowBuilds, dangerouslyAllowAllBuilds: true };\n }\n for (const pkg of neverBuiltDependencies) {\n allowBuilds[pkg] = false;\n }\n return { allowBuilds, neverBuildPackageNames: neverBuiltDependencies };\n }\n for (const [packageDescriptor, allowedScript] of Object.entries(allowScripts ?? {})) {\n if (allowedScript === true || allowedScript === false) {\n allowBuilds[packageDescriptor] = allowedScript;\n }\n // String values (e.g. 'warn') are placeholders — ignore them; pnpm warns about these.\n }\n for (const trustedPkgName of TRUSTED_PACKAGE_NAMES) {\n if (allowScripts?.[trustedPkgName] == null) {\n allowBuilds[trustedPkgName] = true;\n }\n }\n for (const untrustedPkgName of UNTRUSTED_PACKAGE_NAMES) {\n if (allowScripts?.[untrustedPkgName] !== true) {\n allowBuilds[untrustedPkgName] = false;\n }\n }\n for (const pkg of neverBuiltDependencies ?? []) {\n allowBuilds[pkg] = false;\n }\n return { allowBuilds };\n}\n\nfunction removeScriptsFromNeverBuiltPackages(\n manifest: nodeApi.PackageManifest,\n neverBuildPackageNames?: string[]\n): nodeApi.PackageManifest {\n if (!manifest.name || !manifest.scripts || !neverBuildPackageNames?.includes(manifest.name)) return manifest;\n return {\n ...manifest,\n scripts: undefined,\n };\n}\n\nconst APPROVE_BUILDS_INSTRUCTION_TEXT =\n 'Update the \"allowScripts\" field under \"teambit.dependencies/dependency-resolver\" in workspace.jsonc. \\nSet to true to allow, false to explicitly disallow. \\nExample: allowScripts: { \"esbuild\": true, \"core-js\": false }. \\nThis is a security-sensitive setting: enabling scripts may allow arbitrary code execution during install.';\n\n/**\n * How the engine should render pnpm's output. Every field maps onto the\n * pnpm reporting option of the same name.\n */\nfunction toReporterOptions(opts?: ReportOptions): nodeApi.ReporterOptions {\n const stream = reporterOutputStream(opts);\n return {\n appendOnly: opts?.appendOnly ?? false,\n throttleProgress: opts?.throttleProgress ?? 200,\n hideAddedPkgsProgress: opts?.hideAddedPkgsProgress,\n hideProgressPrefix: opts?.hideProgressPrefix,\n hideLifecycleOutput: opts?.hideLifecycleOutput,\n ignoredBuildsInstructionText: APPROVE_BUILDS_INSTRUCTION_TEXT,\n // Core aspects Bit links in are excluded from the summary to reduce\n // noise. Other @teambit/ dependencies still show; only the ones\n // symlinked from outside the workspace are hidden.\n hideLinkedPkgsDiff: ['@teambit/*'],\n // pnpm's `outputMaxWidth`, floored: a terminal reporting one or two\n // columns would otherwise ask the engine to wrap at zero.\n width: stream.columns ? Math.max(stream.columns - 2, 1) : 80,\n // chalk is the switch Bit already flips for its own output (the CLI\n // server enables it per request and resets it afterwards), so the\n // engine follows it rather than probing the terminal itself.\n color: chalk.level > 0,\n };\n}\n\n/**\n * Where the engine's rendered output goes. It has to be written through\n * the JS stream rather than by the engine itself: Bit monkey-patches\n * `process.stdout.write` to mirror output to a tty, and the CLI server\n * swaps in a stream that forwards to connected editors — a write from Rust\n * would bypass both.\n */\nfunction reporterOutput(opts?: ReportOptions): (chunk: string) => void {\n const stream = reporterOutputStream(opts);\n return (chunk) => {\n stream.write(chunk);\n };\n}\n\nfunction reporterOutputStream(opts?: ReportOptions): OutputStream {\n return opts?.outputStream ?? process.stdout;\n}\n\n/**\n * This function returns the list of hooks that are passed to pnpm\n * for transforming the manifests of dependencies during installation.\n */\nexport function createReadPackageHooks(options: {\n rootComponents?: boolean;\n rootComponentsForCapsules?: boolean;\n forcedHarmonyVersion?: string;\n}): ReadPackageHook[] {\n const readPackage: ReadPackageHook[] = [];\n if (options?.rootComponents && !options?.rootComponentsForCapsules) {\n readPackage.push(readPackageHook as ReadPackageHook);\n }\n readPackage.push(removeLegacyFromDeps as ReadPackageHook);\n if (!options.forcedHarmonyVersion) {\n // If the workspace did not specify a harmony version in a root policy,\n // then we remove harmony from any dependencies, so that the one linked from bvm is used.\n readPackage.push(removeHarmonyFromDeps as ReadPackageHook);\n }\n if (options?.rootComponentsForCapsules) {\n readPackage.push(readPackageHookForCapsules as ReadPackageHook);\n }\n return readPackage;\n}\n\n/**\n * This hook is used when installation is executed inside a capsule.\n * The components in the capsules should get their peer dependencies installed,\n * so this hook converts any peer dependencies into runtime dependencies.\n */\nfunction readPackageHookForCapsules(pkg: PackageManifest, workspaceDir?: string): PackageManifest {\n // workspaceDir is set only for workspace packages\n if (workspaceDir) {\n return {\n ...pkg,\n dependencies: {\n ...pkg.peerDependencies,\n ...pkg.dependencies,\n },\n };\n }\n return pkg;\n}\n\n/**\n * @teambit/legacy should never be installed as a dependency.\n * It is linked from bvm.\n */\nfunction removeLegacyFromDeps(pkg: PackageManifest): PackageManifest {\n if (pkg.dependencies != null) {\n if (pkg.dependencies['@teambit/legacy'] && !pkg.dependencies['@teambit/legacy'].startsWith('link:')) {\n delete pkg.dependencies['@teambit/legacy'];\n }\n }\n if (pkg.peerDependencies != null) {\n if (pkg.peerDependencies['@teambit/legacy']) {\n delete pkg.peerDependencies['@teambit/legacy'];\n }\n }\n return pkg;\n}\n\nfunction removeHarmonyFromDeps(pkg: PackageManifest): PackageManifest {\n if (pkg.dependencies != null) {\n if (pkg.dependencies['@teambit/harmony'] && !pkg.dependencies['@teambit/harmony'].startsWith('link:')) {\n delete pkg.dependencies['@teambit/harmony'];\n }\n }\n if (pkg.peerDependencies != null) {\n if (pkg.peerDependencies['@teambit/harmony']) {\n delete pkg.peerDependencies['@teambit/harmony'];\n }\n }\n return pkg;\n}\n\n/**\n * This hook is used when installation happens in a Bit workspace.\n * We need a different hook for this case because unlike in a capsule, in a workspace,\n * the package manager only links workspace components to subdependencies.\n * For direct dependencies, Bit's linking is used.\n */\nfunction readPackageHook(pkg: PackageManifest, workspaceDir?: string): PackageManifest {\n // workspaceDir is set only for workspace packages\n if (workspaceDir && !workspaceDir.includes(BIT_ROOTS_DIR)) {\n return readWorkspacePackageHook(pkg);\n }\n return pkg;\n}\n\n/**\n * This hook is used when installation happens in a Bit workspace.\n * It is applied on workspace projects, and it removes any references to other workspace projects.\n * This is needed because Bit has its own linking for workspace projects.\n * pnpm should not override the links created by Bit.\n * Otherwise, the IDE would reference workspace projects from inside `node_modules/.pnpm`.\n */\nfunction readWorkspacePackageHook(pkg: PackageManifest): PackageManifest {\n const newDeps = {};\n for (const [name, version] of Object.entries(pkg.dependencies ?? {})) {\n if (!version.startsWith('workspace:')) {\n newDeps[name] = version;\n }\n }\n return {\n ...pkg,\n dependencies: {\n ...pkg.peerDependencies,\n ...newDeps,\n },\n };\n}\n\nexport async function resolveRemoteVersion(\n packageName: string,\n {\n rootDir,\n cacheDir,\n fullMetadata,\n registries,\n proxyConfig,\n networkConfig,\n }: {\n rootDir: string;\n cacheDir: string;\n fullMetadata?: boolean;\n registries: Registries;\n proxyConfig?: PackageManagerProxyConfig;\n networkConfig?: PackageManagerNetworkConfig;\n }\n): Promise<ResolvedPackageVersion> {\n const { resolve } = await generateResolverAndFetcher({\n cacheDir,\n fullMetadata,\n networkConfig,\n proxyConfig,\n registries,\n });\n const resolveOpts = {\n lockfileDir: rootDir,\n preferredVersions: {},\n projectDir: rootDir,\n registry: '',\n };\n try {\n const parsedPackage = parsePackageName(packageName);\n const wantedDep: nodeApi.WantedDependency = {\n alias: parsedPackage.name,\n // parse-package-name returns an empty string when no version is present,\n // but the engine resolves only undefined (or an explicit range) as \"latest\".\n bareSpecifier: parsedPackage.version || undefined,\n };\n const val = await resolve(wantedDep, resolveOpts);\n if (!val.manifest) {\n throw new BitError('The resolved package has no manifest');\n }\n const manifest = val.manifest as unknown as DependencyManifest;\n const wantedRange =\n parsedPackage.version && semver.validRange(parsedPackage.version) ? parsedPackage.version : undefined;\n\n return {\n packageName: manifest.name,\n version: manifest.version,\n wantedRange,\n isSemver: true,\n resolvedVia: val.resolvedVia,\n manifest,\n };\n } catch (e: any) {\n if (!e.message?.includes('is not a valid string')) {\n throw pnpmErrorToBitError(e);\n }\n // The provided package is probably a git url or path to a folder\n const wantedDep: nodeApi.WantedDependency = {\n alias: undefined,\n bareSpecifier: packageName,\n };\n const val = await resolve(wantedDep, resolveOpts);\n if (!val.manifest) {\n throw new BitError('The resolved package has no manifest');\n }\n if (!val.normalizedBareSpecifier) {\n throw new BitError('The resolved package has no version');\n }\n const manifest = val.manifest as unknown as DependencyManifest;\n return {\n packageName: manifest.name,\n version: val.normalizedBareSpecifier,\n isSemver: false,\n resolvedVia: val.resolvedVia,\n manifest,\n };\n }\n}\n\n/**\n * Sort the engine's `depsRequiringBuild` for a stable lockfile block, or\n * return undefined when the install did not compute the list at all —\n * it was served from the frozen-lockfile path, or the engine predates\n * `returnListOfDepsRequiringBuild`. Undefined is not an empty list: the\n * install has no answer, so the recorded one has to stand.\n */\nexport function sortDepsRequiringBuild(depsRequiringBuild: string[] | undefined): string[] | undefined {\n return depsRequiringBuild == null ? undefined : [...depsRequiringBuild].sort();\n}\n\n/**\n * The `bit:` attributes to re-assert after an install, or undefined when\n * there is nothing to write. See {@link sortDepsRequiringBuild} for why\n * an uncomputed list leaves the recorded one untouched.\n */\nexport function mergeBitLockfileAttrs(\n preInstallAttrs: Partial<BitLockfileAttributes> | undefined,\n sortedDepsRequiringBuild: string[] | undefined\n): Partial<BitLockfileAttributes> | undefined {\n if (sortedDepsRequiringBuild == null) return preInstallAttrs;\n return { ...preInstallAttrs, depsRequiringBuild: sortedDepsRequiringBuild };\n}\n\n/**\n * The packages a pending rebuild selects: the ones the install reported as\n * needing a build, or the ones the lockfile's `bit:` block records when the\n * install was served from the lockfile. Undefined when neither has a list,\n * which leaves the selection to the engine.\n *\n * An empty recorded list is not trusted: a lockfile restored from a\n * dependency graph that was built without build information records an\n * empty list too, so only the install's own answer can prove there is\n * nothing to build.\n */\nasync function pendingBuildNames(\n rootDir: string,\n depsRequiringBuild: string[] | undefined\n): Promise<string[] | undefined> {\n if (depsRequiringBuild) return depsRequiringBuild.map(packageNameOfDepPath);\n const recorded = (await readBitLockfileAttrs(rootDir))?.depsRequiringBuild;\n return recorded?.length ? recorded.map(packageNameOfDepPath) : undefined;\n}\n\n/**\n * `@scope/name@1.0.0(peer@2.0.0)` -> `@scope/name`. The engine matches a\n * rebuild selection by package name. A package name carries no `@` past its\n * scope prefix, while a version may (a git or tarball resolution such as\n * `git+ssh://git@github.com/...`), so the name ends at the first `@` after\n * the start.\n */\nexport function packageNameOfDepPath(depPath: string): string {\n const versionAt = depPath.indexOf('@', 1);\n return versionAt > 0 ? depPath.slice(0, versionAt) : depPath.replace(/\\(.*$/, '');\n}\n\n/**\n * Read the `bit:` extension block of the workspace's wanted lockfile,\n * or undefined when there is no lockfile or no block.\n */\nasync function readBitLockfileAttrs(rootDir: string): Promise<Partial<BitLockfileAttributes> | undefined> {\n try {\n const lockfile = await nodeApi.readLockfile<BitLockfileFile>({ dir: rootDir });\n return lockfile?.bit;\n } catch {\n // A malformed lockfile fails the install itself later with a proper\n // error; there is nothing to preserve here.\n return undefined;\n }\n}\n\n/**\n * Re-assert Bit's `bit:` extension block on the wanted lockfile after\n * an engine install rewrote it. Merges over whatever the file has, so\n * an attribute captured before the install (e.g. `restoredFromModel`)\n * survives the rewrite.\n */\nasync function addBitAttributesToLockfile(rootDir: string, attrs: Partial<BitLockfileAttributes>) {\n const lockfile = await nodeApi.readLockfile<BitLockfileFile>({ dir: rootDir });\n if (lockfile == null) return;\n const merged = { ...lockfile.bit, ...attrs };\n if (isEqual(lockfile.bit, merged)) return;\n lockfile.bit = merged as BitLockfileAttributes;\n await nodeApi.writeLockfile({ dir: rootDir, lockfile });\n}\n\n/**\n * A `pnpm-lock.yaml` as the engine reads and writes it, plus the `bit:`\n * block Bit records beside pnpm's own keys. The engine preserves top-level\n * keys it does not define, so reading, editing that block, and writing the\n * file back leaves everything else untouched.\n */\nexport interface BitLockfileFile extends LockfileFile {\n bit?: BitLockfileAttributes;\n}\n\nexport interface BitLockfileAttributes {\n depsRequiringBuild: string[];\n restoredFromModel?: boolean;\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA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BA,CAAC9F,OAAe,EAAuD;EACxG,IAAI;IACF,MAAMwL,QAAQ,GAAG,MAAM9S,OAAO,CAAD,CAAC,CAAC+S,YAAY,CAAkB;MAAErM,GAAG,EAAEY;IAAQ,CAAC,CAAC;IAC9E,OAAOwL,QAAQ,EAAEE,GAAG;EACtB,CAAC,CAAC,MAAM;IACN;IACA;IACA,OAAOjM,SAAS;EAClB;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe4G,0BAA0BA,CAACrG,OAAe,EAAE2L,KAAqC,EAAE;EAChG,MAAMH,QAAQ,GAAG,MAAM9S,OAAO,CAAD,CAAC,CAAC+S,YAAY,CAAkB;IAAErM,GAAG,EAAEY;EAAQ,CAAC,CAAC;EAC9E,IAAIwL,QAAQ,IAAI,IAAI,EAAE;EACtB,MAAMI,MAAM,GAAA9Q,aAAA,CAAAA,aAAA,KAAQ0Q,QAAQ,CAACE,GAAG,GAAKC,KAAK,CAAE;EAC5C,IAAI,IAAAE,iBAAO,EAACL,QAAQ,CAACE,GAAG,EAAEE,MAAM,CAAC,EAAE;EACnCJ,QAAQ,CAACE,GAAG,GAAGE,MAA+B;EAC9C,MAAMlT,OAAO,CAAD,CAAC,CAACoT,aAAa,CAAC;IAAE1M,GAAG,EAAEY,OAAO;IAAEwL;EAAS,CAAC,CAAC;AACzD;;AAEA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
1
+ {"version":3,"names":["_path","data","require","_fs","_chalk","_interopRequireDefault","_semver","_parsePackageName","_pluginTrustedDeps","nodeApi","_interopRequireWildcard","_nerfDart","_bitError","_legacy","_dependenciesPnpm","_lodash","_pnpmErrorToBitError","_readConfig","_buildScriptsPath","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_objectWithoutProperties","_objectWithoutPropertiesLoose","getOwnPropertySymbols","length","indexOf","propertyIsEnumerable","ownKeys","keys","filter","enumerable","push","apply","_objectSpread","arguments","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","_toPropertyKey","value","configurable","writable","_toPrimitive","Symbol","toPrimitive","TypeError","String","Number","UNTRUSTED_PACKAGE_NAMES","installsRunning","toNodeApiProxyConfig","proxyConfig","httpProxy","httpsProxy","noProxy","toNodeApiNetworkConfig","networkConfig","ca","cert","key","localAddress","strictSsl","strictSSL","maxSockets","networkConcurrency","fetchRetries","fetchRetryFactor","fetchRetryMintimeout","fetchRetryMaxtimeout","fetchTimeout","userAgent","buildAuthHeaderByUri","registries","result","registry","values","scopes","uri","authHeaderValue","toNerfDart","defaultRegistry","applyReadPackageHooks","hooks","manifest","workspaceDir","reduce","m","hook","generateResolverAndFetcher","cacheDir","fullMetadata","pnpmConfig","readConfig","authHeaderByUri","config","registriesMap","toMap","resolve","wantedDep","resolveOpts","resolveDependency","dir","projectDir","lockfileDir","process","cwd","undefined","getPeerDependencyIssues","manifestsByPaths","opts","projects","entries","map","rootDir","storeDir","overrides","peersSuffixMaxLength","virtualStoreDirMaxLength","VIRTUAL_STORE_DIR_MAX_LENGTH","err","pnpmErrorToBitError","removedCoreDependencies","forcedHarmonyVersion","removedCoreDependencyOverrides","fromEntries","name","removeCoreDependencies","dependency","dependencies","startsWith","_ref","_removed","peerDependencies","_result$peerDependenc","install","options","logger","externalDependencies","Set","createReadPackageHooks","rootComponents","rootComponentsForCapsules","add","assign","dependenciesMeta","hoistPattern","size","hoistInjectedDependencies","pkgName","scriptPolicies","resolveScriptPolicies","allowScripts","dangerouslyAllowAllScripts","neverBuiltDependencies","projectManifest","rawManifest","dependencyManifest","isEqual","installOptions","nodeLinker","linkWorkspacePackages","publicHoistPattern","allowBuilds","dangerouslyAllowAllBuilds","autoInstallPeers","excludeLinksFromLockfile","lockfileOnly","packageImportMethod","preferOffline","enableGlobalVirtualStore","globalVirtualStoreDir","patchedDependencies","packageExtensions","dedupePeerDependents","dedupePeers","dedupeDirectDeps","dedupeInjectedDeps","injectWorkspacePackages","includeOptionalDeps","update","updateAll","depth","nodeVersion","engineStrict","minimumReleaseAge","minimumReleaseAgeExclude","trustLockfile","ignorePackageManifest","hoistWorkspacePackages","enableModulesDir","resolvePeersFromWorkspaceRoot","frozenLockfile","preferFrozenLockfile","peerDependencyRules","allowAny","ignoreMissing","reportOptions","strictDepBuilds","pnpmHomeDir","returnListOfDepsRequiringBuild","reporter","hidePackageManagerOutput","toReporterOptions","hideAddedPkgsProgress","dependenciesChanged","depsRequiringBuild","resolvedStoreDir","dryRun","prepareBuildScriptsPath","installPromise","restoreWantedLockfile","onOutput","reporterOutput","preInstallBitAttrs","readBitLockfileAttrs","removeWantedLockfileForUpdate","installResult","sortedDepsRequiringBuild","sortDepsRequiringBuild","bitAttrs","mergeBitLockfileAttrs","addBitAttributesToLockfile","stats","added","removed","linkedToRoot","warn","rebuild","pending","selectedNames","pendingBuildNames","rebuildReportOptions","appendOnly","hideLifecycleOutput","lockfilePath","join","lockfileContent","fs","readFile","code","unlink","writeFile","pkg","packageDescriptor","allowedScript","trustedPkgName","TRUSTED_PACKAGE_NAMES","untrustedPkgName","APPROVE_BUILDS_INSTRUCTION_TEXT","stream","reporterOutputStream","throttleProgress","hideProgressPrefix","ignoredBuildsInstructionText","hideLinkedPkgsDiff","width","columns","Math","max","color","chalk","level","chunk","write","outputStream","stdout","readPackage","readPackageHook","readPackageHookForCapsules","includes","BIT_ROOTS_DIR","readWorkspacePackageHook","newDeps","version","resolveRemoteVersion","packageName","preferredVersions","parsedPackage","parsePackageName","alias","bareSpecifier","val","BitError","wantedRange","semver","validRange","isSemver","resolvedVia","message","normalizedBareSpecifier","sort","preInstallAttrs","packageNameOfDepPath","recorded","depPath","versionAt","slice","replace","lockfile","readLockfile","bit","attrs","merged","writeLockfile"],"sources":["lynx.ts"],"sourcesContent":["import { join } from 'path';\nimport { promises as fs } from 'fs';\nimport chalk from 'chalk';\nimport semver from 'semver';\nimport parsePackageName from 'parse-package-name';\nimport { TRUSTED_PACKAGE_NAMES } from '@pnpm/plugin-trusted-deps';\nimport type {\n PackageManifest,\n ProjectManifest,\n ReadPackageHook,\n PeerDependencyRules,\n DependencyManifest,\n DepPath,\n} from '@pnpm/types';\nimport * as nodeApi from '@pnpm/napi';\nimport type { PeerDependencyIssuesByProjects } from '@pnpm/napi';\nimport { type LockfileFile } from '@pnpm/lockfile.types';\nimport type { Registries } from '@teambit/pkg.entities.registry';\nimport toNerfDart from 'nerf-dart';\nimport type {\n ResolvedPackageVersion,\n PackageManagerProxyConfig,\n PackageManagerNetworkConfig,\n PackageExtension,\n} from '@teambit/dependency-resolver';\nimport { BitError } from '@teambit/bit-error';\nimport { BIT_ROOTS_DIR } from '@teambit/legacy.constants';\nimport type { Logger } from '@teambit/logger';\nimport { VIRTUAL_STORE_DIR_MAX_LENGTH } from '@teambit/dependencies.pnpm.dep-path';\nimport { isEqual } from 'lodash';\nimport { pnpmErrorToBitError } from './pnpm-error-to-bit-error';\nimport { readConfig } from './read-config';\nimport { prepareBuildScriptsPath } from './build-scripts-path';\n\n/**\n * Packages that are known to have risky or unnecessary build scripts.\n * These packages will be disallowed from running scripts by default,\n * unless the user explicitly allows them in `allowScripts`.\n */\nconst UNTRUSTED_PACKAGE_NAMES = ['es5-ext', 'less', 'protobufjs', 'ssh', 'core-js-pure', 'core-js'];\n\nconst installsRunning: Record<string, Promise<any>> = {};\n\n/**\n * Minimal structural signature of the `resolve` function returned by\n * `generateResolverAndFetcher`. It mirrors what the old\n * `@pnpm/installing.client` `ResolveFunction` exposed, but is backed by\n * `@pnpm/napi`'s `resolveDependency`.\n */\ntype ResolveOpts = {\n lockfileDir?: string;\n projectDir?: string;\n preferredVersions?: Record<string, unknown>;\n registry?: string;\n};\ntype ResolveFunction = (\n wantedDependency: nodeApi.WantedDependency,\n opts: ResolveOpts\n) => Promise<nodeApi.ResolveResult>;\n\nfunction toNodeApiProxyConfig(proxyConfig: PackageManagerProxyConfig): nodeApi.ProxyConfig {\n return {\n httpProxy: proxyConfig.httpProxy,\n httpsProxy: proxyConfig.httpsProxy,\n noProxy: proxyConfig.noProxy,\n };\n}\n\nfunction toNodeApiNetworkConfig(networkConfig: PackageManagerNetworkConfig): nodeApi.NetworkConfig {\n return {\n ca: networkConfig.ca,\n cert: networkConfig.cert,\n key: networkConfig.key,\n localAddress: networkConfig.localAddress,\n strictSsl: networkConfig.strictSSL,\n maxSockets: networkConfig.maxSockets,\n networkConcurrency: networkConfig.networkConcurrency,\n fetchRetries: networkConfig.fetchRetries,\n fetchRetryFactor: networkConfig.fetchRetryFactor,\n fetchRetryMintimeout: networkConfig.fetchRetryMintimeout,\n fetchRetryMaxtimeout: networkConfig.fetchRetryMaxtimeout,\n fetchTimeout: networkConfig.fetchTimeout,\n userAgent: networkConfig.userAgent,\n };\n}\n\n/**\n * Pre-computed `Authorization` headers keyed by nerf-darted registry URI\n * (plus `''` for the default registry) — the shape `@pnpm/napi` applies\n * directly. Bit's registries model already carries ready-to-send header\n * values (from the engine's `readConfig` plus Bit's own cloud token), so no\n * npmrc-style credential round-trip is needed.\n */\nfunction buildAuthHeaderByUri(registries: Registries): Record<string, string> {\n const result: Record<string, string> = {};\n for (const registry of Object.values(registries.scopes)) {\n if (registry.uri && registry.authHeaderValue) {\n result[toNerfDart(registry.uri)] = registry.authHeaderValue;\n }\n }\n const { defaultRegistry } = registries;\n if (defaultRegistry?.authHeaderValue) {\n if (defaultRegistry.uri) {\n result[toNerfDart(defaultRegistry.uri)] = defaultRegistry.authHeaderValue;\n }\n result[''] = defaultRegistry.authHeaderValue;\n }\n return result;\n}\n\n/**\n * Compose the list of read-package hooks into a single synchronous transform.\n * The Bit hooks are all synchronous, so the accumulator stays synchronous even\n * though the pnpm `ReadPackageHook` type allows returning a promise.\n */\nfunction applyReadPackageHooks(\n hooks: ReadPackageHook[],\n manifest: PackageManifest,\n workspaceDir?: string\n): PackageManifest {\n return hooks.reduce<PackageManifest>((m, hook) => hook(m, workspaceDir) as PackageManifest, manifest);\n}\n\nexport async function generateResolverAndFetcher({\n cacheDir,\n registries,\n proxyConfig,\n networkConfig,\n fullMetadata,\n}: {\n cacheDir: string;\n registries: Registries;\n proxyConfig?: PackageManagerProxyConfig;\n networkConfig?: PackageManagerNetworkConfig;\n fullMetadata?: boolean;\n}): Promise<{ resolve: ResolveFunction }> {\n const pnpmConfig = await readConfig();\n // The engine-resolved `.npmrc` headers first; Bit's own registries model\n // (which carries the cloud token) wins on conflict.\n const authHeaderByUri = { ...pnpmConfig.config.authHeaderByUri, ...buildAuthHeaderByUri(registries) };\n const registriesMap = registries.toMap();\n const resolve: ResolveFunction = (wantedDep, resolveOpts) =>\n nodeApi.resolveDependency(wantedDep, {\n dir: resolveOpts.projectDir || resolveOpts.lockfileDir || process.cwd(),\n cacheDir,\n registries: registriesMap,\n authHeaderByUri,\n proxyConfig: proxyConfig ? toNodeApiProxyConfig(proxyConfig) : undefined,\n networkConfig: networkConfig ? toNodeApiNetworkConfig(networkConfig) : undefined,\n fullMetadata,\n });\n return { resolve };\n}\n\nexport async function getPeerDependencyIssues(\n manifestsByPaths: Record<string, any>,\n opts: {\n storeDir?: string;\n cacheDir: string;\n registries: Registries;\n rootDir: string;\n proxyConfig: PackageManagerProxyConfig;\n networkConfig: PackageManagerNetworkConfig;\n overrides?: Record<string, string>;\n packageImportMethod?: 'auto' | 'hardlink' | 'copy' | 'clone';\n pnpmHomeDir?: string;\n }\n): Promise<PeerDependencyIssuesByProjects> {\n const projects: nodeApi.NodeApiProject[] = Object.entries(manifestsByPaths).map(([rootDir, manifest]) => ({\n rootDir,\n manifest: manifest as nodeApi.PackageManifest,\n }));\n try {\n return await nodeApi.getPeerDependencyIssues({\n dir: opts.rootDir,\n projects,\n storeDir: opts.storeDir,\n cacheDir: opts.cacheDir,\n overrides: opts.overrides,\n peersSuffixMaxLength: 1000,\n registries: opts.registries.toMap(),\n authHeaderByUri: buildAuthHeaderByUri(opts.registries),\n proxyConfig: toNodeApiProxyConfig(opts.proxyConfig),\n networkConfig: toNodeApiNetworkConfig(opts.networkConfig),\n virtualStoreDirMaxLength: VIRTUAL_STORE_DIR_MAX_LENGTH,\n });\n } catch (err: any) {\n throw pnpmErrorToBitError(err);\n }\n}\n\nexport type RebuildFn = (opts?: { pending?: boolean; skipIfHasSideEffectsCache?: boolean }) => Promise<void>;\n\n/**\n * A stream the engine's rendered output can be written to. `columns` is\n * how the frame is sized; a stream that is not a terminal has none, and\n * the reporter falls back to pnpm's 80-column default.\n */\nexport type OutputStream = NodeJS.WritableStream & { columns?: number };\n\nexport interface ReportOptions {\n appendOnly?: boolean;\n throttleProgress?: number;\n hideAddedPkgsProgress?: boolean;\n hideProgressPrefix?: boolean;\n hideLifecycleOutput?: boolean;\n peerDependencyRules?: PeerDependencyRules;\n /** Defaults to `process.stdout`. */\n outputStream?: OutputStream;\n}\n\n/**\n * `@teambit/legacy` and `@teambit/harmony` are never installed: the running bit\n * installation provides them, and Bit links them itself. Harmony is kept when\n * the workspace forces its version, which the caller then sets as a regular\n * override.\n */\nfunction removedCoreDependencies(forcedHarmonyVersion?: string): string[] {\n return forcedHarmonyVersion ? ['@teambit/legacy'] : ['@teambit/legacy', '@teambit/harmony'];\n}\n\n/**\n * The overrides remove the core dependencies from every manifest the engine\n * resolves, peer dependencies included. The `@*` selector matches only semver\n * ranges, so the `link:` dependencies Bit's linker adds stay. A registry\n * package declares nothing else, while a workspace project may also use\n * `workspace:`, `file:` or `npm:` specs: `removeCoreDependencies` removes those\n * from the workspace manifests before the install.\n */\nexport function removedCoreDependencyOverrides(forcedHarmonyVersion?: string): Record<string, string> {\n return Object.fromEntries(removedCoreDependencies(forcedHarmonyVersion).map((name) => [`${name}@*`, '-']));\n}\n\n/**\n * Removes the core dependencies from a workspace project's manifest, whatever\n * their spec, except the `link:` dependencies Bit's linker adds.\n */\nexport function removeCoreDependencies<T extends PackageManifest>(manifest: T, forcedHarmonyVersion?: string): T {\n let result = manifest;\n for (const name of removedCoreDependencies(forcedHarmonyVersion)) {\n const dependency = result.dependencies?.[name];\n if (dependency != null && !dependency.startsWith('link:')) {\n const { [name]: _removed, ...dependencies } = result.dependencies!;\n result = { ...result, dependencies };\n }\n if (result.peerDependencies?.[name] != null) {\n const { [name]: _removed, ...peerDependencies } = result.peerDependencies;\n result = { ...result, peerDependencies };\n }\n }\n return result;\n}\n\nexport async function install(\n rootDir: string,\n manifestsByPaths: Record<string, ProjectManifest>,\n storeDir: string | undefined,\n cacheDir: string,\n registries: Registries,\n proxyConfig: PackageManagerProxyConfig = {},\n networkConfig: PackageManagerNetworkConfig = {},\n options: {\n updateAll?: boolean;\n nodeLinker?: 'hoisted' | 'isolated';\n overrides?: Record<string, string>;\n rootComponents?: boolean;\n rootComponentsForCapsules?: boolean;\n includeOptionalDeps?: boolean;\n reportOptions?: ReportOptions;\n hidePackageManagerOutput?: boolean;\n hoistInjectedDependencies?: boolean;\n dryRun?: boolean;\n dedupePeers?: boolean;\n dedupeInjectedDeps?: boolean;\n forcedHarmonyVersion?: string;\n allowScripts?: Record<string, boolean | 'warn'>;\n dangerouslyAllowAllScripts?: boolean;\n neverBuiltDependencies?: string[];\n autoInstallPeers?: boolean;\n publicHoistPattern?: string[];\n hoistPattern?: string[];\n lockfileOnly?: boolean;\n nodeVersion?: string;\n enableModulesDir?: boolean;\n engineStrict?: boolean;\n excludeLinksFromLockfile?: boolean;\n minimumReleaseAge?: number;\n minimumReleaseAgeExclude?: string[];\n ignorePackageManifest?: boolean;\n hoistWorkspacePackages?: boolean;\n returnListOfDepsRequiringBuild?: boolean;\n packageImportMethod?: 'auto' | 'hardlink' | 'copy' | 'clone';\n enableGlobalVirtualStore?: boolean;\n globalVirtualStoreDir?: string;\n patchedDependencies?: Record<string, string>;\n packageExtensions?: Record<string, PackageExtension>;\n pnpmHomeDir?: string;\n preferOffline?: boolean;\n // Accepted for backward-compatibility with the previous pnpm engine, but the\n // Rust engine manages the side-effects cache internally.\n sideEffectsCacheRead?: boolean;\n sideEffectsCacheWrite?: boolean;\n },\n logger?: Logger\n): Promise<{ dependenciesChanged: boolean; rebuild: RebuildFn; storeDir: string; depsRequiringBuild?: DepPath[] }> {\n const externalDependencies = new Set<string>();\n const hooks = createReadPackageHooks(options);\n if (options?.rootComponents && !options?.rootComponentsForCapsules) {\n for (const [dir, { name }] of Object.entries(manifestsByPaths)) {\n if (dir !== rootDir && name) {\n externalDependencies.add(name);\n }\n }\n }\n const overrides = {\n ...options.overrides,\n };\n Object.assign(overrides, removedCoreDependencyOverrides(options.forcedHarmonyVersion));\n if (options.forcedHarmonyVersion) {\n // Harmony needs to be a singleton, so if a specific version was requested for the workspace,\n // we force that version accross the whole dependency graph.\n overrides['@teambit/harmony'] = options.forcedHarmonyVersion;\n }\n if (!manifestsByPaths[rootDir].dependenciesMeta) {\n manifestsByPaths = {\n ...manifestsByPaths,\n [rootDir]: {\n ...manifestsByPaths[rootDir],\n dependenciesMeta: {},\n },\n };\n }\n const hoistPattern = options.hoistPattern ?? ['*'];\n if (hoistPattern.length > 0 && externalDependencies.size > 0 && !options.hoistInjectedDependencies) {\n for (const pkgName of externalDependencies) {\n hoistPattern.push(`!${pkgName}`);\n }\n }\n const scriptPolicies = resolveScriptPolicies({\n allowScripts: options.allowScripts,\n dangerouslyAllowAllScripts: options.dangerouslyAllowAllScripts,\n neverBuiltDependencies: options.neverBuiltDependencies,\n });\n\n // The importer manifests are transformed here, with each importer's own\n // directory as workspaceDir. The engine needs no readPackage hook for the\n // dependency manifests: the core dependencies are removed by the overrides\n // above (and from the workspace manifests here), and a workspace project resolved as a dependency (an injected\n // \"file:\" instance) gets its raw manifest through `dependencyManifest`. The\n // instance must keep the workspace-sibling deps the importer transform\n // strips, because they become the component's graph edges.\n const projects: nodeApi.NodeApiProject[] = Object.entries(manifestsByPaths).map(([dir, projectManifest]) => {\n const rawManifest = removeCoreDependencies(\n projectManifest as unknown as PackageManifest,\n options.forcedHarmonyVersion\n );\n const manifest = applyReadPackageHooks(hooks, rawManifest, dir);\n return {\n rootDir: dir,\n manifest: manifest as unknown as nodeApi.PackageManifest,\n dependencyManifest: isEqual(manifest, rawManifest)\n ? undefined\n : (rawManifest as unknown as nodeApi.PackageManifest),\n };\n });\n\n const installOptions: nodeApi.InstallOptions = {\n dir: rootDir,\n projects,\n storeDir,\n cacheDir,\n registries: registries.toMap(),\n authHeaderByUri: buildAuthHeaderByUri(registries),\n proxyConfig: toNodeApiProxyConfig(proxyConfig),\n networkConfig: toNodeApiNetworkConfig(networkConfig),\n overrides,\n nodeLinker: options.nodeLinker,\n // Resolve bare-semver deps on workspace components (incl. auto-installed\n // peers naming a sibling component) from the workspace instead of the\n // registry — otherwise an unpublished component peer 404s. `'deep'` so\n // transitive component deps link locally too.\n linkWorkspacePackages: 'deep',\n hoistPattern,\n publicHoistPattern: options.publicHoistPattern,\n externalDependencies: [...externalDependencies],\n allowBuilds: scriptPolicies.allowBuilds as Record<string, boolean>,\n dangerouslyAllowAllBuilds: scriptPolicies.dangerouslyAllowAllBuilds,\n // `neverBuiltDependencies` is already folded into `allowBuilds` above by\n // `resolveScriptPolicies`; the binding rejects a non-empty pass-through.\n autoInstallPeers: options.autoInstallPeers,\n excludeLinksFromLockfile: options.excludeLinksFromLockfile ?? true,\n lockfileOnly: options.lockfileOnly ?? false,\n packageImportMethod: options.packageImportMethod,\n preferOffline: options.preferOffline,\n virtualStoreDirMaxLength: VIRTUAL_STORE_DIR_MAX_LENGTH,\n // The hoisted linker copies packages straight into `node_modules` instead of symlinking them\n // out of a virtual store, so there is no virtual store for the global one to replace.\n enableGlobalVirtualStore: options.nodeLinker === 'hoisted' ? false : options.enableGlobalVirtualStore,\n globalVirtualStoreDir: options.globalVirtualStoreDir,\n patchedDependencies: options.patchedDependencies,\n packageExtensions: options.packageExtensions,\n peersSuffixMaxLength: 1000,\n dedupePeerDependents: true,\n dedupePeers: options.dedupePeers,\n dedupeDirectDeps: true,\n dedupeInjectedDeps: options.dedupeInjectedDeps,\n injectWorkspacePackages: true,\n includeOptionalDeps: options.includeOptionalDeps !== false,\n // `update` re-resolves the whole graph; the binding ignores `depth` (there\n // are no package selectors), but pass a finite full-depth value for parity\n // with the old engine's `depth: Infinity` update-all call.\n update: options.updateAll,\n depth: options.updateAll ? 1000 : undefined,\n nodeVersion: options.nodeVersion,\n engineStrict: options.engineStrict,\n // pnpm v12 defaults minimumReleaseAge to 1440 when the option is absent.\n // bit.cloud packuments are huge (a version per snap) and their abbreviated\n // form carries no `time` field, so the maturity cutoff forces a full-\n // packument upgrade fetch for every component on a cold resolve. Disable\n // the policy unless the workspace opts in.\n minimumReleaseAge: options.minimumReleaseAge ?? 0,\n minimumReleaseAgeExclude: options.minimumReleaseAgeExclude,\n // Bit lockfiles are trusted workspace input. Keep installs compatible with\n // lockfiles generated before pnpm v12 added registry resolution verification.\n trustLockfile: true,\n ignorePackageManifest: options.ignorePackageManifest,\n hoistWorkspacePackages: options.hoistWorkspacePackages,\n enableModulesDir: options.enableModulesDir,\n resolvePeersFromWorkspaceRoot: true,\n frozenLockfile: options.updateAll ? false : undefined,\n preferFrozenLockfile: !options.updateAll,\n // Suppress peer-dependency warnings by default (allow any version, ignore\n // missing), letting the workspace's own rules override.\n peerDependencyRules: {\n allowAny: ['*'],\n ignoreMissing: ['*'],\n ...options.reportOptions?.peerDependencyRules,\n } as nodeApi.PeerDependencyRules,\n // Bit reports the deps requiring a build in the lockfile instead of failing.\n strictDepBuilds: false,\n pnpmHomeDir: options.pnpmHomeDir,\n // Report every package with install scripts (not just blocked ones) in\n // `depsRequiringBuild`, so the `bit:` lockfile block lists them even\n // though Bit allows the builds to run.\n returnListOfDepsRequiringBuild: true,\n reporter: options.hidePackageManagerOutput\n ? undefined\n : toReporterOptions({ ...options.reportOptions, hideAddedPkgsProgress: options.lockfileOnly }),\n };\n\n let dependenciesChanged = false;\n let depsRequiringBuild: DepPath[] | undefined;\n let resolvedStoreDir = storeDir;\n if (!options.dryRun) {\n // Dependency build scripts inherit this process's PATH. Set up inside the\n // guard, so a dry run neither writes the wrapper nor touches the env.\n prepareBuildScriptsPath(logger);\n let installPromise: Promise<nodeApi.InstallResult> | undefined;\n let restoreWantedLockfile: (() => Promise<void>) | undefined;\n const onOutput = options.hidePackageManagerOutput ? undefined : reporterOutput(options.reportOptions);\n try {\n await installsRunning[rootDir];\n // The engine rewrites pnpm-lock.yaml from its typed model, which\n // does not round-trip Bit's `bit:` extension block (the v11 TS\n // engine mutated the loaded object in place, so the block\n // survived). Capture it up front and re-assert it after the\n // install alongside `depsRequiringBuild`.\n const preInstallBitAttrs = await readBitLockfileAttrs(rootDir);\n restoreWantedLockfile = await removeWantedLockfileForUpdate(rootDir, options.updateAll);\n installPromise = nodeApi.install(installOptions, undefined, undefined, onOutput);\n installsRunning[rootDir] = installPromise;\n const installResult: nodeApi.InstallResult = await installPromise;\n resolvedStoreDir = installResult.storeDir;\n const sortedDepsRequiringBuild = sortDepsRequiringBuild(installResult.depsRequiringBuild);\n const bitAttrs = mergeBitLockfileAttrs(preInstallBitAttrs, sortedDepsRequiringBuild);\n if (bitAttrs != null) {\n await addBitAttributesToLockfile(rootDir, bitAttrs);\n }\n depsRequiringBuild = sortedDepsRequiringBuild as unknown as DepPath[] | undefined;\n dependenciesChanged =\n installResult.stats.added + installResult.stats.removed + installResult.stats.linkedToRoot > 0;\n } catch (err: any) {\n await restoreWantedLockfile?.();\n if (logger) {\n logger.warn('got an error from the pnpm install function', err);\n }\n throw pnpmErrorToBitError(err);\n } finally {\n if (installPromise && installsRunning[rootDir] === installPromise) {\n delete installsRunning[rootDir];\n }\n }\n }\n return {\n dependenciesChanged,\n // The engine has no skipIfHasSideEffectsCache selector; a pending rebuild\n // is expressed as a selection of the packages the lockfile records as\n // needing a build.\n rebuild: async ({ pending } = {}) => {\n const selectedNames = pending ? await pendingBuildNames(rootDir, depsRequiringBuild) : undefined;\n if (selectedNames?.length === 0) return;\n // Reached without an install of its own after a dry run.\n prepareBuildScriptsPath(logger);\n // Same output routing as the install: the CLI server's stream has to\n // carry the rebuild's output too, not just the install's.\n const rebuildReportOptions: ReportOptions = {\n ...options.reportOptions,\n appendOnly: true,\n hideLifecycleOutput: true,\n };\n await nodeApi.rebuild(\n {\n ...installOptions,\n storeDir: resolvedStoreDir,\n reporter: options.hidePackageManagerOutput ? undefined : toReporterOptions(rebuildReportOptions),\n },\n undefined,\n selectedNames,\n options.hidePackageManagerOutput ? undefined : reporterOutput(rebuildReportOptions)\n );\n },\n storeDir: resolvedStoreDir ?? '',\n depsRequiringBuild,\n };\n}\n\nasync function removeWantedLockfileForUpdate(\n rootDir: string,\n updateAll?: boolean\n): Promise<(() => Promise<void>) | undefined> {\n if (!updateAll) return undefined;\n const lockfilePath = join(rootDir, 'pnpm-lock.yaml');\n let lockfileContent: Buffer;\n try {\n lockfileContent = await fs.readFile(lockfilePath);\n } catch (err: any) {\n if (err?.code === 'ENOENT') return undefined;\n throw err;\n }\n await fs.unlink(lockfilePath);\n return async () => {\n await fs.writeFile(lockfilePath, lockfileContent);\n };\n}\n\ntype ScriptPolicyConfig = {\n allowScripts?: Record<string, boolean | 'warn'>;\n dangerouslyAllowAllScripts?: boolean;\n neverBuiltDependencies?: string[];\n};\n\nexport function resolveScriptPolicies({\n allowScripts,\n dangerouslyAllowAllScripts,\n neverBuiltDependencies,\n}: ScriptPolicyConfig): {\n allowBuilds: Record<string, boolean | string>;\n dangerouslyAllowAllBuilds?: boolean;\n} {\n const allowBuilds: Record<string, boolean | string> = {};\n if (dangerouslyAllowAllScripts) {\n // The engine checks `allowBuilds` denials before the allow-all flag.\n for (const pkg of neverBuiltDependencies ?? []) {\n allowBuilds[pkg] = false;\n }\n return { allowBuilds, dangerouslyAllowAllBuilds: true };\n }\n for (const [packageDescriptor, allowedScript] of Object.entries(allowScripts ?? {})) {\n if (allowedScript === true || allowedScript === false) {\n allowBuilds[packageDescriptor] = allowedScript;\n }\n // String values (e.g. 'warn') are placeholders — ignore them; pnpm warns about these.\n }\n for (const trustedPkgName of TRUSTED_PACKAGE_NAMES) {\n if (allowScripts?.[trustedPkgName] == null) {\n allowBuilds[trustedPkgName] = true;\n }\n }\n for (const untrustedPkgName of UNTRUSTED_PACKAGE_NAMES) {\n if (allowScripts?.[untrustedPkgName] !== true) {\n allowBuilds[untrustedPkgName] = false;\n }\n }\n for (const pkg of neverBuiltDependencies ?? []) {\n allowBuilds[pkg] = false;\n }\n return { allowBuilds };\n}\n\nconst APPROVE_BUILDS_INSTRUCTION_TEXT =\n 'Update the \"allowScripts\" field under \"teambit.dependencies/dependency-resolver\" in workspace.jsonc. \\nSet to true to allow, false to explicitly disallow. \\nExample: allowScripts: { \"esbuild\": true, \"core-js\": false }. \\nThis is a security-sensitive setting: enabling scripts may allow arbitrary code execution during install.';\n\n/**\n * How the engine should render pnpm's output. Every field maps onto the\n * pnpm reporting option of the same name.\n */\nfunction toReporterOptions(opts?: ReportOptions): nodeApi.ReporterOptions {\n const stream = reporterOutputStream(opts);\n return {\n appendOnly: opts?.appendOnly ?? false,\n throttleProgress: opts?.throttleProgress ?? 200,\n hideAddedPkgsProgress: opts?.hideAddedPkgsProgress,\n hideProgressPrefix: opts?.hideProgressPrefix,\n hideLifecycleOutput: opts?.hideLifecycleOutput,\n ignoredBuildsInstructionText: APPROVE_BUILDS_INSTRUCTION_TEXT,\n // Core aspects Bit links in are excluded from the summary to reduce\n // noise. Other @teambit/ dependencies still show; only the ones\n // symlinked from outside the workspace are hidden.\n hideLinkedPkgsDiff: ['@teambit/*'],\n // pnpm's `outputMaxWidth`, floored: a terminal reporting one or two\n // columns would otherwise ask the engine to wrap at zero.\n width: stream.columns ? Math.max(stream.columns - 2, 1) : 80,\n // chalk is the switch Bit already flips for its own output (the CLI\n // server enables it per request and resets it afterwards), so the\n // engine follows it rather than probing the terminal itself.\n color: chalk.level > 0,\n };\n}\n\n/**\n * Where the engine's rendered output goes. It has to be written through\n * the JS stream rather than by the engine itself: Bit monkey-patches\n * `process.stdout.write` to mirror output to a tty, and the CLI server\n * swaps in a stream that forwards to connected editors — a write from Rust\n * would bypass both.\n */\nfunction reporterOutput(opts?: ReportOptions): (chunk: string) => void {\n const stream = reporterOutputStream(opts);\n return (chunk) => {\n stream.write(chunk);\n };\n}\n\nfunction reporterOutputStream(opts?: ReportOptions): OutputStream {\n return opts?.outputStream ?? process.stdout;\n}\n\n/**\n * The transforms Bit applies to the importer manifests (the workspace projects)\n * before passing them to pnpm. Dependency manifests are not transformed.\n */\nexport function createReadPackageHooks(options: {\n rootComponents?: boolean;\n rootComponentsForCapsules?: boolean;\n}): ReadPackageHook[] {\n const readPackage: ReadPackageHook[] = [];\n if (options?.rootComponents && !options?.rootComponentsForCapsules) {\n readPackage.push(readPackageHook as ReadPackageHook);\n }\n if (options?.rootComponentsForCapsules) {\n readPackage.push(readPackageHookForCapsules as ReadPackageHook);\n }\n return readPackage;\n}\n\n/**\n * This hook is used when installation is executed inside a capsule.\n * The components in the capsules should get their peer dependencies installed,\n * so this hook converts any peer dependencies into runtime dependencies.\n */\nfunction readPackageHookForCapsules(pkg: PackageManifest, workspaceDir?: string): PackageManifest {\n // workspaceDir is set only for workspace packages\n if (workspaceDir) {\n return {\n ...pkg,\n dependencies: {\n ...pkg.peerDependencies,\n ...pkg.dependencies,\n },\n };\n }\n return pkg;\n}\n\n/**\n * This hook is used when installation happens in a Bit workspace.\n * We need a different hook for this case because unlike in a capsule, in a workspace,\n * the package manager only links workspace components to subdependencies.\n * For direct dependencies, Bit's linking is used.\n */\nfunction readPackageHook(pkg: PackageManifest, workspaceDir?: string): PackageManifest {\n // workspaceDir is set only for workspace packages\n if (workspaceDir && !workspaceDir.includes(BIT_ROOTS_DIR)) {\n return readWorkspacePackageHook(pkg);\n }\n return pkg;\n}\n\n/**\n * This hook is used when installation happens in a Bit workspace.\n * It is applied on workspace projects, and it removes any references to other workspace projects.\n * This is needed because Bit has its own linking for workspace projects.\n * pnpm should not override the links created by Bit.\n * Otherwise, the IDE would reference workspace projects from inside `node_modules/.pnpm`.\n */\nfunction readWorkspacePackageHook(pkg: PackageManifest): PackageManifest {\n const newDeps = {};\n for (const [name, version] of Object.entries(pkg.dependencies ?? {})) {\n if (!version.startsWith('workspace:')) {\n newDeps[name] = version;\n }\n }\n return {\n ...pkg,\n dependencies: {\n ...pkg.peerDependencies,\n ...newDeps,\n },\n };\n}\n\nexport async function resolveRemoteVersion(\n packageName: string,\n {\n rootDir,\n cacheDir,\n fullMetadata,\n registries,\n proxyConfig,\n networkConfig,\n }: {\n rootDir: string;\n cacheDir: string;\n fullMetadata?: boolean;\n registries: Registries;\n proxyConfig?: PackageManagerProxyConfig;\n networkConfig?: PackageManagerNetworkConfig;\n }\n): Promise<ResolvedPackageVersion> {\n const { resolve } = await generateResolverAndFetcher({\n cacheDir,\n fullMetadata,\n networkConfig,\n proxyConfig,\n registries,\n });\n const resolveOpts = {\n lockfileDir: rootDir,\n preferredVersions: {},\n projectDir: rootDir,\n registry: '',\n };\n try {\n const parsedPackage = parsePackageName(packageName);\n const wantedDep: nodeApi.WantedDependency = {\n alias: parsedPackage.name,\n // parse-package-name returns an empty string when no version is present,\n // but the engine resolves only undefined (or an explicit range) as \"latest\".\n bareSpecifier: parsedPackage.version || undefined,\n };\n const val = await resolve(wantedDep, resolveOpts);\n if (!val.manifest) {\n throw new BitError('The resolved package has no manifest');\n }\n const manifest = val.manifest as unknown as DependencyManifest;\n const wantedRange =\n parsedPackage.version && semver.validRange(parsedPackage.version) ? parsedPackage.version : undefined;\n\n return {\n packageName: manifest.name,\n version: manifest.version,\n wantedRange,\n isSemver: true,\n resolvedVia: val.resolvedVia,\n manifest,\n };\n } catch (e: any) {\n if (!e.message?.includes('is not a valid string')) {\n throw pnpmErrorToBitError(e);\n }\n // The provided package is probably a git url or path to a folder\n const wantedDep: nodeApi.WantedDependency = {\n alias: undefined,\n bareSpecifier: packageName,\n };\n const val = await resolve(wantedDep, resolveOpts);\n if (!val.manifest) {\n throw new BitError('The resolved package has no manifest');\n }\n if (!val.normalizedBareSpecifier) {\n throw new BitError('The resolved package has no version');\n }\n const manifest = val.manifest as unknown as DependencyManifest;\n return {\n packageName: manifest.name,\n version: val.normalizedBareSpecifier,\n isSemver: false,\n resolvedVia: val.resolvedVia,\n manifest,\n };\n }\n}\n\n/**\n * Sort the engine's `depsRequiringBuild` for a stable lockfile block, or\n * return undefined when the install did not compute the list at all —\n * it was served from the frozen-lockfile path, or the engine predates\n * `returnListOfDepsRequiringBuild`. Undefined is not an empty list: the\n * install has no answer, so the recorded one has to stand.\n */\nexport function sortDepsRequiringBuild(depsRequiringBuild: string[] | undefined): string[] | undefined {\n return depsRequiringBuild == null ? undefined : [...depsRequiringBuild].sort();\n}\n\n/**\n * The `bit:` attributes to re-assert after an install, or undefined when\n * there is nothing to write. See {@link sortDepsRequiringBuild} for why\n * an uncomputed list leaves the recorded one untouched.\n */\nexport function mergeBitLockfileAttrs(\n preInstallAttrs: Partial<BitLockfileAttributes> | undefined,\n sortedDepsRequiringBuild: string[] | undefined\n): Partial<BitLockfileAttributes> | undefined {\n if (sortedDepsRequiringBuild == null) return preInstallAttrs;\n return { ...preInstallAttrs, depsRequiringBuild: sortedDepsRequiringBuild };\n}\n\n/**\n * The packages a pending rebuild selects: the ones the install reported as\n * needing a build, or the ones the lockfile's `bit:` block records when the\n * install was served from the lockfile. Undefined when neither has a list,\n * which leaves the selection to the engine.\n *\n * An empty recorded list is not trusted: a lockfile restored from a\n * dependency graph that was built without build information records an\n * empty list too, so only the install's own answer can prove there is\n * nothing to build.\n */\nasync function pendingBuildNames(\n rootDir: string,\n depsRequiringBuild: string[] | undefined\n): Promise<string[] | undefined> {\n if (depsRequiringBuild) return depsRequiringBuild.map(packageNameOfDepPath);\n const recorded = (await readBitLockfileAttrs(rootDir))?.depsRequiringBuild;\n return recorded?.length ? recorded.map(packageNameOfDepPath) : undefined;\n}\n\n/**\n * `@scope/name@1.0.0(peer@2.0.0)` -> `@scope/name`. The engine matches a\n * rebuild selection by package name. A package name carries no `@` past its\n * scope prefix, while a version may (a git or tarball resolution such as\n * `git+ssh://git@github.com/...`), so the name ends at the first `@` after\n * the start.\n */\nexport function packageNameOfDepPath(depPath: string): string {\n const versionAt = depPath.indexOf('@', 1);\n return versionAt > 0 ? depPath.slice(0, versionAt) : depPath.replace(/\\(.*$/, '');\n}\n\n/**\n * Read the `bit:` extension block of the workspace's wanted lockfile,\n * or undefined when there is no lockfile or no block.\n */\nasync function readBitLockfileAttrs(rootDir: string): Promise<Partial<BitLockfileAttributes> | undefined> {\n try {\n const lockfile = await nodeApi.readLockfile<BitLockfileFile>({ dir: rootDir });\n return lockfile?.bit;\n } catch {\n // A malformed lockfile fails the install itself later with a proper\n // error; there is nothing to preserve here.\n return undefined;\n }\n}\n\n/**\n * Re-assert Bit's `bit:` extension block on the wanted lockfile after\n * an engine install rewrote it. Merges over whatever the file has, so\n * an attribute captured before the install (e.g. `restoredFromModel`)\n * survives the rewrite.\n */\nasync function addBitAttributesToLockfile(rootDir: string, attrs: Partial<BitLockfileAttributes>) {\n const lockfile = await nodeApi.readLockfile<BitLockfileFile>({ dir: rootDir });\n if (lockfile == null) return;\n const merged = { ...lockfile.bit, ...attrs };\n if (isEqual(lockfile.bit, merged)) return;\n lockfile.bit = merged as BitLockfileAttributes;\n await nodeApi.writeLockfile({ dir: rootDir, lockfile });\n}\n\n/**\n * A `pnpm-lock.yaml` as the engine reads and writes it, plus the `bit:`\n * block Bit records beside pnpm's own keys. The engine preserves top-level\n * keys it does not define, so reading, editing that block, and writing the\n * file back leaves everything else untouched.\n */\nexport interface BitLockfileFile extends LockfileFile {\n bit?: BitLockfileAttributes;\n}\n\nexport interface BitLockfileAttributes {\n depsRequiringBuild: string[];\n restoredFromModel?: boolean;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,IAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,GAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA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