@teambit/pnpm 1.0.1136 → 1.0.1138
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/pnpm-prune-modules.js +18 -1
- package/dist/pnpm-prune-modules.js.map +1 -1
- package/dist/pnpm.package-manager.js +11 -0
- package/dist/pnpm.package-manager.js.map +1 -1
- package/dist/preserve-loaded-virtual-store-dirs.d.ts +50 -0
- package/dist/preserve-loaded-virtual-store-dirs.js +287 -0
- package/dist/preserve-loaded-virtual-store-dirs.js.map +1 -0
- package/dist/preserve-loaded-virtual-store-dirs.spec.d.ts +1 -0
- package/dist/preserve-loaded-virtual-store-dirs.spec.js +232 -0
- package/dist/preserve-loaded-virtual-store-dirs.spec.js.map +1 -0
- package/dist/{preview-1786219819000.js → preview-1786400681343.js} +2 -2
- package/package.json +10 -10
|
@@ -32,6 +32,13 @@ function _dependenciesPnpm() {
|
|
|
32
32
|
};
|
|
33
33
|
return data;
|
|
34
34
|
}
|
|
35
|
+
function _preserveLoadedVirtualStoreDirs() {
|
|
36
|
+
const data = require("./preserve-loaded-virtual-store-dirs");
|
|
37
|
+
_preserveLoadedVirtualStoreDirs = function () {
|
|
38
|
+
return data;
|
|
39
|
+
};
|
|
40
|
+
return data;
|
|
41
|
+
}
|
|
35
42
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
36
43
|
let lockfileFsPromise;
|
|
37
44
|
function loadLockfileFs() {
|
|
@@ -62,7 +69,17 @@ async function pnpmPruneModules(rootDir) {
|
|
|
62
69
|
ignoreIncompatible: false
|
|
63
70
|
});
|
|
64
71
|
const dirsShouldBePresent = Object.keys(lockfile?.packages ?? {}).map(depPath => (0, _dependenciesPnpm().depPathToDirName)(depPath));
|
|
65
|
-
|
|
72
|
+
const extraneous = (0, _lodash().difference)(pkgDirs, dirsShouldBePresent);
|
|
73
|
+
// the usual case, and the one worth keeping cheap: scanning the loaded modules below is
|
|
74
|
+
// proportional to how much this process has loaded, and with nothing to remove it decides nothing
|
|
75
|
+
if (extraneous.length === 0) return;
|
|
76
|
+
// never remove a directory the running process has loaded modules from. an install that re-keys
|
|
77
|
+
// a loaded package to a new peer hash restores the old directory so deferred requires keep
|
|
78
|
+
// working (see preserve-loaded-virtual-store-dirs.ts); that directory is intentionally absent
|
|
79
|
+
// from the lockfile, and deleting it here would re-break exactly what the restore fixed. a later
|
|
80
|
+
// command's prune, whose process has nothing loaded from it, cleans it up.
|
|
81
|
+
const loadedByThisProcess = (0, _preserveLoadedVirtualStoreDirs().loadedVirtualStoreDirNames)(virtualStoreDir);
|
|
82
|
+
await Promise.all(extraneous.filter(dir => !loadedByThisProcess.has(dir)).map(dir => _fsExtra().default.remove(_path().default.join(virtualStoreDir, dir))));
|
|
66
83
|
}
|
|
67
84
|
|
|
68
85
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_fsExtra","data","_interopRequireDefault","require","_path","_lodash","_dependenciesPnpm","e","__esModule","default","lockfileFsPromise","loadLockfileFs","loadEsm","lockfileFs","pnpmPruneModules","rootDir","virtualStoreDir","path","join","pkgDirs","readPackageDirsFromVirtualStore","length","readCurrentLockfile","lockfile","ignoreIncompatible","dirsShouldBePresent","Object","keys","packages","map","depPath","depPathToDirName","Promise","all","
|
|
1
|
+
{"version":3,"names":["_fsExtra","data","_interopRequireDefault","require","_path","_lodash","_dependenciesPnpm","_preserveLoadedVirtualStoreDirs","e","__esModule","default","lockfileFsPromise","loadLockfileFs","loadEsm","lockfileFs","pnpmPruneModules","rootDir","virtualStoreDir","path","join","pkgDirs","readPackageDirsFromVirtualStore","length","readCurrentLockfile","lockfile","ignoreIncompatible","dirsShouldBePresent","Object","keys","packages","map","depPath","depPathToDirName","extraneous","difference","loadedByThisProcess","loadedVirtualStoreDirNames","Promise","all","filter","dir","has","fs","remove","allDirs","readdir","err","code"],"sources":["pnpm-prune-modules.ts"],"sourcesContent":["import fs from 'fs-extra';\nimport path from 'path';\nimport { difference } from 'lodash';\nimport type * as LockfileFs from '@pnpm/lockfile.fs';\nimport { depPathToDirName } from '@teambit/dependencies.pnpm.dep-path';\nimport { loadedVirtualStoreDirNames } from './preserve-loaded-virtual-store-dirs';\n\ntype LockfileFsModule = typeof LockfileFs;\nlet lockfileFsPromise: Promise<LockfileFsModule> | undefined;\n\nfunction loadLockfileFs(): Promise<LockfileFsModule> {\n lockfileFsPromise ??= (async () => {\n const { loadEsm } = require('./load-pnpm-esm.cjs') as {\n loadEsm: () => Promise<{ lockfileFs: LockfileFsModule }>;\n };\n const { lockfileFs } = await loadEsm();\n return lockfileFs;\n })();\n return lockfileFsPromise;\n}\n\n/**\n * Reads the private lockfile at node_modules/.pnpm/lock.yaml\n * and removes any directories from node_modules/.pnpm that are not listed in the lockfile.\n */\nexport async function pnpmPruneModules(rootDir: string): Promise<void> {\n const virtualStoreDir = path.join(rootDir, 'node_modules/.pnpm');\n const pkgDirs = await readPackageDirsFromVirtualStore(virtualStoreDir);\n if (pkgDirs.length === 0) return;\n const { readCurrentLockfile } = await loadLockfileFs();\n const lockfile = await readCurrentLockfile(virtualStoreDir, { ignoreIncompatible: false });\n const dirsShouldBePresent = Object.keys(lockfile?.packages ?? {}).map((depPath) => depPathToDirName(depPath));\n const extraneous = difference(pkgDirs, dirsShouldBePresent);\n // the usual case, and the one worth keeping cheap: scanning the loaded modules below is\n // proportional to how much this process has loaded, and with nothing to remove it decides nothing\n if (extraneous.length === 0) return;\n // never remove a directory the running process has loaded modules from. an install that re-keys\n // a loaded package to a new peer hash restores the old directory so deferred requires keep\n // working (see preserve-loaded-virtual-store-dirs.ts); that directory is intentionally absent\n // from the lockfile, and deleting it here would re-break exactly what the restore fixed. a later\n // command's prune, whose process has nothing loaded from it, cleans it up.\n const loadedByThisProcess = loadedVirtualStoreDirNames(virtualStoreDir);\n await Promise.all(\n extraneous\n .filter((dir) => !loadedByThisProcess.has(dir))\n .map((dir) => fs.remove(path.join(virtualStoreDir, dir)))\n );\n}\n\n/**\n * The project-local virtual store may hold no package directories at all: with the global virtual\n * store enabled the packages live under `<storeDir>/links` (pruned by the engine itself) and only\n * `lock.yaml` and the hoisted `node_modules` remain here. A `lockfileOnly` install leaves the\n * directory missing entirely. Both cases mean \"nothing for us to prune\".\n */\nasync function readPackageDirsFromVirtualStore(virtualStoreDir: string): Promise<string[]> {\n let allDirs: string[];\n try {\n allDirs = await fs.readdir(virtualStoreDir);\n } catch (err: any) {\n if (err.code === 'ENOENT') return [];\n throw err;\n }\n return allDirs.filter((dir) => dir !== 'lock.yaml' && dir !== 'node_modules');\n}\n"],"mappings":";;;;;;AAAA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,MAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,KAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,QAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,OAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAK,kBAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,iBAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,gCAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,+BAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAkF,SAAAC,uBAAAM,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAGlF,IAAIG,iBAAwD;AAE5D,SAASC,cAAcA,CAAA,EAA8B;EACnDD,iBAA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AAI,CAACF,eAAe,EAAEuB,GAAG,CAAC,CAAC,CAC5D,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,eAAenB,+BAA+BA,CAACJ,eAAuB,EAAqB;EACzF,IAAI2B,OAAiB;EACrB,IAAI;IACFA,OAAO,GAAG,MAAMF,kBAAE,CAACG,OAAO,CAAC5B,eAAe,CAAC;EAC7C,CAAC,CAAC,OAAO6B,GAAQ,EAAE;IACjB,IAAIA,GAAG,CAACC,IAAI,KAAK,QAAQ,EAAE,OAAO,EAAE;IACpC,MAAMD,GAAG;EACX;EACA,OAAOF,OAAO,CAACL,MAAM,CAAEC,GAAG,IAAKA,GAAG,KAAK,WAAW,IAAIA,GAAG,KAAK,cAAc,CAAC;AAC/E","ignoreList":[]}
|
|
@@ -102,6 +102,13 @@ function _pnpmPruneModules() {
|
|
|
102
102
|
};
|
|
103
103
|
return data;
|
|
104
104
|
}
|
|
105
|
+
function _preserveLoadedVirtualStoreDirs() {
|
|
106
|
+
const data = require("./preserve-loaded-virtual-store-dirs");
|
|
107
|
+
_preserveLoadedVirtualStoreDirs = function () {
|
|
108
|
+
return data;
|
|
109
|
+
};
|
|
110
|
+
return data;
|
|
111
|
+
}
|
|
105
112
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
106
113
|
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; }
|
|
107
114
|
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; }
|
|
@@ -248,6 +255,9 @@ class PnpmPackageManager {
|
|
|
248
255
|
}
|
|
249
256
|
this.modulesManifestCache.delete(rootDir);
|
|
250
257
|
const hoistPattern = resolveHoistPattern(installOptions.hoistPatterns, config.hoistPattern);
|
|
258
|
+
// packages this process already loaded modules from must stay requireable even if this install
|
|
259
|
+
// re-keys them to a new peer hash - see preserve-loaded-virtual-store-dirs.ts
|
|
260
|
+
const loadedVirtualStoreDirs = (0, _preserveLoadedVirtualStoreDirs().snapshotLoadedVirtualStoreDirs)(rootDir);
|
|
251
261
|
const {
|
|
252
262
|
dependenciesChanged,
|
|
253
263
|
rebuild,
|
|
@@ -308,6 +318,7 @@ class PnpmPackageManager {
|
|
|
308
318
|
// this.logger.console('-------------------------END PNPM OUTPUT-------------------------');
|
|
309
319
|
// this.logger.consoleSuccess('installing dependencies using pnpm');
|
|
310
320
|
}
|
|
321
|
+
await (0, _preserveLoadedVirtualStoreDirs().restoreRemovedLoadedVirtualStoreDirs)(loadedVirtualStoreDirs, this.logger);
|
|
311
322
|
return {
|
|
312
323
|
dependenciesChanged,
|
|
313
324
|
rebuild,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_dependencyResolver","data","require","_pkgEntities","_harmonyModules","_fs","_interopRequireDefault","_lodash","_lockfile","_depsInspection","_depsInspection2","_legacy","_legacy2","_path","_lockfileDepsGraphConverter","_readConfig","_pnpmPruneModules","e","__esModule","default","ownKeys","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","pnpmEsmPromise","loadPnpmEsm","loadEsm","lockfileFs","modulesYaml","PnpmPackageManager","constructor","depResolver","logger","cloud","Map","dir","config","warnings","readConfig","fetchRetries","memoize","dependenciesGraphToLockfile","dependenciesGraph","opts","initLockfileDepsGraphConverter","registries","Registries","Registry","generateResolverAndFetcher","resolve","graphLockfile","convertGraphToLockfile","readWantedLockfile","writeLockfileFile","convertToLockfileFile","convertLockfileObjectToLockfileFile","existingLockfile","rootDir","ignoreIncompatible","mergedLockfile","mergeGraphLockfileIntoExisting","assign","bit","restoredFromModel","lockfilePath","join","debug","process","env","DEPS_GRAPH_LOG","console","log","install","manifests","installOptions","getRegistries","proxyConfig","getProxyConfig","networkConfig","getNetworkConfig","packageManagerConfigRootDir","isFeatureEnabled","DEPS_GRAPH","rootComponents","rootComponentsForCapsules","cacheDir","error","message","hidePackageManagerOutput","off","useNesting","extendWithComponentsFromDir","nmSelfReferences","values","manifest","name","devDependencies","modulesManifestCache","delete","hoistPattern","resolveHoistPattern","hoistPatterns","dependenciesChanged","rebuild","storeDir","depsRequiringBuild","autoInstallPeers","dedupePeers","enableModulesDir","engineStrict","excludeLinksFromLockfile","lockfileOnly","minimumReleaseAge","minimumReleaseAgeExclude","neverBuiltDependencies","allowScripts","dangerouslyAllowAllScripts","nodeLinker","nodeVersion","includeOptionalDeps","ignorePackageManifest","dedupeInjectedDeps","dryRun","overrides","publicHoistPattern","shamefullyHoist","hoistWorkspacePackages","hoistInjectedDependencies","packageImportMethod","enableGlobalVirtualStore","globalVirtualStoreDir","patchedDependencies","packageExtensions","preferOffline","sideEffectsCacheRead","sideEffectsCache","sideEffectsCacheWrite","pnpmHomeDir","updateAll","reportOptions","appendOnly","optimizeReportForNonTerminal","BIT_CLI_SERVER_NO_TTY","stdout","ServerSendOutStream","undefined","throttleProgress","hideProgressPrefix","hideLifecycleOutput","peerDependencyRules","returnListOfDepsRequiringBuild","forcedHarmonyVersion","on","getPeerDependencyIssues","lynx","resolveRemoteVersion","packageName","options","fullMetadata","configuredUserAgent","userAgent","username","getCurrentUser","result","explicitSettings","Set","maxSockets","has","networkConcurrency","fetchTimeout","fetchRetryMaxtimeout","fetchRetryMintimeout","strictSsl","strictSSL","ca","cert","key","pnpmRegistry","defaultRegistry","uri","alwaysAuth","authHeaderValue","originalAuthType","originalAuthValue","pnpmScoped","omit","scopesRegistries","reduce","acc","scopedRegName","scopedReg","replace","BIT_CLOUD_REGISTRY","getInjectedDirs","componentDir","modulesState","_readModulesManifest","injectedDeps","lockfileDir","get","readModulesManifest","modulesManifest","set","getWorkspaceDepsOfBitRoots","fromEntries","map","getGlobalVirtualStoreDir","pruneModules","pnpmPruneModules","findUsages","depName","lockfile","importerIds","importers","id","includes","BIT_ROOTS_DIR","projectPaths","importerInfoMap","importerId","pkgJson","tryReadPackageJson","version","trees","buildDependentsTree","include","dependencies","optionalDependencies","nameFormatter","scope","componentId","renderDependentsTree","depth","Infinity","long","calcDependenciesGraph","originalLockfile","componentRootDir","componentRelativeDir","pkgName","component","components","componentImporterId","compRootDir","split","hasComponentRootImporter","Boolean","filterByImporterIds","clonedImporters","structuredClone","importer","workspacePkgName","componentIdByPkgName","ref","startsWith","depType","partialLockfile","filterLockfileByImporters","failOnMissingDependencies","skipped","graph","convertLockfileToGraph","state","_consumer","exports","hoistPatternsFromBitConfig","hoistPatternFromPnpmConfig","isDefaultHoistPattern","pkgDir","JSON","parse","fs","readFileSync","existing","graphImporter","entries","existingImporter","existingBit","graphBit","mergedDepsRequiringBuild","Array","from","sort","merged","lockfileVersion","packages","mergeEntryRecords","snapshots","pruneUnreachableLockfileEntries","graphEntry","existingEntry","reachablePackages","reachableSnapshots","stack","visit","depPath","current","pop","add","removePeerSuffix","snapshot","dep","pkgId","bitAttrs","suffixStart","indexOf","slice"],"sources":["pnpm.package-manager.ts"],"sourcesContent":["import type { CloudMain } from '@teambit/cloud';\nimport { extendWithComponentsFromDir, BIT_CLOUD_REGISTRY } from '@teambit/dependency-resolver';\nimport type {\n DependencyResolverMain,\n InstallationContext,\n PackageManager,\n PackageManagerInstallOptions,\n PackageManagerResolveRemoteVersionOptions,\n ResolvedPackageVersion,\n PackageManagerProxyConfig,\n PackageManagerNetworkConfig,\n CalcDepsGraphOptions,\n} from '@teambit/dependency-resolver';\nimport { Registries, Registry } from '@teambit/pkg.entities.registry';\nimport { DEPS_GRAPH, isFeatureEnabled } from '@teambit/harmony.modules.feature-toggle';\nimport type { Logger } from '@teambit/logger';\nimport { type LockfileFile } from '@pnpm/lockfile.types';\nimport fs from 'fs';\nimport { memoize, omit } from 'lodash';\nimport { filterLockfileByImporters } from '@pnpm/lockfile.filtering';\nimport type { PeerDependencyIssuesByProjects, ResolvedConfig } from '@pnpm/napi';\nimport { type ProjectId, type ProjectManifest, type DepPath } from '@pnpm/types';\nimport type * as LockfileFs from '@pnpm/lockfile.fs';\nimport type { Modules } from '@pnpm/installing.modules-yaml';\nimport type * as ModulesYaml from '@pnpm/installing.modules-yaml';\nimport type { ImporterInfo } from '@pnpm/deps.inspection.tree-builder';\nimport { buildDependentsTree } from '@pnpm/deps.inspection.tree-builder';\nimport { renderDependentsTree } from '@pnpm/deps.inspection.list';\nimport { BIT_ROOTS_DIR } from '@teambit/legacy.constants';\nimport { ServerSendOutStream } from '@teambit/legacy.logger';\nimport { join } from 'path';\nimport {\n convertLockfileToGraph,\n convertGraphToLockfile,\n init as initLockfileDepsGraphConverter,\n} from './lockfile-deps-graph-converter';\nimport { readConfig } from './read-config';\nimport { pnpmPruneModules } from './pnpm-prune-modules';\nimport type { RebuildFn } from './lynx';\nimport type * as LynxModule from './lynx';\nimport { type DependenciesGraph } from '@teambit/objects';\n\nexport type { RebuildFn };\n\nexport interface InstallResult {\n dependenciesChanged: boolean;\n rebuild: RebuildFn;\n storeDir: string;\n depsRequiringBuild?: DepPath[];\n}\n\ntype ReadConfigResult = Promise<{ config: ResolvedConfig; warnings: string[] }>;\ntype LockfileFsModule = typeof LockfileFs;\ntype ModulesYamlModule = typeof ModulesYaml;\nlet pnpmEsmPromise: Promise<{ lockfileFs: LockfileFsModule; modulesYaml: ModulesYamlModule }> | undefined;\n\nfunction loadPnpmEsm(): Promise<{ lockfileFs: LockfileFsModule; modulesYaml: ModulesYamlModule }> {\n pnpmEsmPromise ??= (async () => {\n const { loadEsm } = require('./load-pnpm-esm.cjs') as {\n loadEsm: () => Promise<{ lockfileFs: LockfileFsModule; modulesYaml: ModulesYamlModule }>;\n };\n const { lockfileFs, modulesYaml } = await loadEsm();\n return { lockfileFs, modulesYaml };\n })();\n return pnpmEsmPromise;\n}\n\nexport class PnpmPackageManager implements PackageManager {\n readonly name = 'pnpm';\n readonly modulesManifestCache: Map<string, Modules> = new Map();\n private username: string;\n\n private _readConfig = async (dir?: string): ReadConfigResult => {\n const { config, warnings } = await readConfig(dir);\n if (config?.fetchRetries && config?.fetchRetries < 5) {\n config.fetchRetries = 5;\n return { config, warnings };\n }\n\n return { config, warnings };\n };\n\n public readConfig: (dir?: string) => ReadConfigResult = memoize(this._readConfig);\n\n constructor(\n private depResolver: DependencyResolverMain,\n private logger: Logger,\n private cloud: CloudMain\n ) {}\n\n async dependenciesGraphToLockfile(\n dependenciesGraph: DependenciesGraph,\n opts: {\n cacheDir: string;\n manifests: Record<string, ProjectManifest>;\n rootDir: string;\n registries?: Registries;\n proxyConfig?: PackageManagerProxyConfig;\n networkConfig?: PackageManagerNetworkConfig;\n }\n ) {\n await initLockfileDepsGraphConverter();\n const registries = opts.registries ?? new Registries(new Registry('https://node-registry.bit.cloud', false), {});\n // eslint-disable-next-line global-require, import/no-dynamic-require\n const { generateResolverAndFetcher } = require('./lynx') as typeof LynxModule;\n const { resolve } = await generateResolverAndFetcher({\n ...opts,\n registries,\n });\n const graphLockfile: LockfileFile = await convertGraphToLockfile(dependenciesGraph, {\n ...opts,\n resolve,\n });\n const {\n lockfileFs: { readWantedLockfile, writeLockfileFile, convertToLockfileFile: convertLockfileObjectToLockfileFile },\n } = await loadPnpmEsm();\n // Merge the graph-derived subset into any existing wanted lockfile rather than\n // overwriting. Only the importers, packages, and snapshots referenced by the\n // imported components' subgraph are re-stated here; every other workspace dep's\n // locked version must be preserved so pnpm doesn't re-resolve it to a newer\n // registry version.\n const existingLockfile = await readWantedLockfile(opts.rootDir, { ignoreIncompatible: true });\n const mergedLockfile = existingLockfile\n ? mergeGraphLockfileIntoExisting(convertLockfileObjectToLockfileFile(existingLockfile), graphLockfile)\n : graphLockfile;\n Object.assign(mergedLockfile, {\n bit: {\n ...(mergedLockfile as LockfileFile & { bit?: Record<string, unknown> }).bit,\n restoredFromModel: true,\n },\n });\n const lockfilePath = join(opts.rootDir, 'pnpm-lock.yaml');\n await writeLockfileFile(lockfilePath, mergedLockfile);\n this.logger.debug(`generated a lockfile from dependencies graph at ${lockfilePath}`);\n if (process.env.DEPS_GRAPH_LOG) {\n // eslint-disable-next-line no-console\n console.log(`generated a lockfile from dependencies graph at ${lockfilePath}`);\n }\n }\n\n async install(\n { rootDir, manifests }: InstallationContext,\n installOptions: PackageManagerInstallOptions = {}\n ): Promise<InstallResult> {\n // require it dynamically for performance purpose. the pnpm package require many files - do not move to static import\n // eslint-disable-next-line global-require, import/no-dynamic-require\n const { install } = require('./lynx');\n\n const registries = await this.depResolver.getRegistries();\n const proxyConfig = await this.depResolver.getProxyConfig();\n const networkConfig = await this.depResolver.getNetworkConfig();\n const { config } = await this.readConfig(installOptions.packageManagerConfigRootDir);\n if (\n installOptions.dependenciesGraph &&\n isFeatureEnabled(DEPS_GRAPH) &&\n (installOptions.rootComponents || installOptions.rootComponentsForCapsules)\n ) {\n try {\n await this.dependenciesGraphToLockfile(installOptions.dependenciesGraph, {\n manifests,\n rootDir,\n registries,\n proxyConfig,\n networkConfig,\n cacheDir: config.cacheDir,\n });\n } catch (error) {\n // If the lockfile could not be created for some reason, it will be created later during installation.\n this.logger.error((error as Error).message);\n }\n }\n\n this.logger.debug(`running installation in root dir ${rootDir}`);\n this.logger.debug('components manifests for installation', manifests);\n if (!installOptions.hidePackageManagerOutput) {\n // this.logger.setStatusLine('installing dependencies using pnpm');\n // turn off the logger because it interrupts the pnpm output\n // this.logger.console('-------------------------PNPM OUTPUT-------------------------');\n this.logger.off();\n }\n if (!installOptions.useNesting && installOptions.rootComponentsForCapsules) {\n manifests = await extendWithComponentsFromDir(rootDir, manifests);\n }\n if (installOptions.nmSelfReferences) {\n Object.values(manifests).forEach((manifest) => {\n if (manifest.name) {\n manifest.devDependencies = {\n [manifest.name]: 'link:.',\n ...manifest.devDependencies,\n };\n }\n });\n }\n this.modulesManifestCache.delete(rootDir);\n const hoistPattern = resolveHoistPattern(installOptions.hoistPatterns, config.hoistPattern);\n const { dependenciesChanged, rebuild, storeDir, depsRequiringBuild } = await install(\n rootDir,\n manifests,\n config.storeDir,\n config.cacheDir,\n registries,\n proxyConfig,\n networkConfig,\n {\n autoInstallPeers: installOptions.autoInstallPeers ?? true,\n dedupePeers: installOptions.dedupePeers ?? true,\n enableModulesDir: installOptions.enableModulesDir,\n engineStrict: installOptions.engineStrict ?? config.engineStrict,\n excludeLinksFromLockfile: installOptions.excludeLinksFromLockfile,\n lockfileOnly: installOptions.lockfileOnly,\n minimumReleaseAge: installOptions.minimumReleaseAge,\n minimumReleaseAgeExclude: installOptions.minimumReleaseAgeExclude,\n neverBuiltDependencies: installOptions.neverBuiltDependencies,\n allowScripts: installOptions.allowScripts,\n dangerouslyAllowAllScripts: installOptions.dangerouslyAllowAllScripts,\n nodeLinker: installOptions.nodeLinker,\n nodeVersion: installOptions.nodeVersion ?? config.nodeVersion,\n includeOptionalDeps: installOptions.includeOptionalDeps,\n ignorePackageManifest: installOptions.ignorePackageManifest,\n dedupeInjectedDeps: installOptions.dedupeInjectedDeps ?? false,\n dryRun: installOptions.dependenciesGraph == null && installOptions.dryRun,\n overrides: installOptions.overrides,\n hoistPattern,\n publicHoistPattern: config.shamefullyHoist\n ? ['*']\n : ['@eslint/plugin-*', '*eslint-plugin*', '@prettier/plugin-*', '*prettier-plugin-*'],\n hoistWorkspacePackages: installOptions.hoistWorkspacePackages ?? false,\n hoistInjectedDependencies: installOptions.hoistInjectedDependencies,\n packageImportMethod: installOptions.packageImportMethod ?? config.packageImportMethod,\n enableGlobalVirtualStore: installOptions.enableGlobalVirtualStore,\n globalVirtualStoreDir: installOptions.globalVirtualStoreDir,\n patchedDependencies: installOptions.patchedDependencies,\n packageExtensions: installOptions.packageExtensions,\n preferOffline: installOptions.preferOffline,\n rootComponents: installOptions.rootComponents,\n rootComponentsForCapsules: installOptions.rootComponentsForCapsules,\n sideEffectsCacheRead: installOptions.sideEffectsCache ?? true,\n sideEffectsCacheWrite: installOptions.sideEffectsCache ?? true,\n pnpmHomeDir: config.pnpmHomeDir,\n updateAll: installOptions.updateAll,\n hidePackageManagerOutput: installOptions.hidePackageManagerOutput,\n reportOptions: {\n appendOnly: installOptions.optimizeReportForNonTerminal,\n process: process.env.BIT_CLI_SERVER_NO_TTY ? { ...process, stdout: new ServerSendOutStream() } : undefined,\n throttleProgress: installOptions.throttleProgress,\n hideProgressPrefix: installOptions.hideProgressPrefix,\n hideLifecycleOutput: installOptions.hideLifecycleOutput,\n peerDependencyRules: installOptions.peerDependencyRules,\n },\n returnListOfDepsRequiringBuild: installOptions.returnListOfDepsRequiringBuild,\n forcedHarmonyVersion: installOptions.forcedHarmonyVersion,\n },\n this.logger\n );\n if (!installOptions.hidePackageManagerOutput) {\n this.logger.on();\n // Make a divider row to improve output\n // this.logger.console('-------------------------END PNPM OUTPUT-------------------------');\n // this.logger.consoleSuccess('installing dependencies using pnpm');\n }\n return { dependenciesChanged, rebuild, storeDir, depsRequiringBuild };\n }\n\n async getPeerDependencyIssues(\n rootDir: string,\n manifests: Record<string, ProjectManifest>,\n installOptions: PackageManagerInstallOptions = {}\n ): Promise<PeerDependencyIssuesByProjects> {\n const proxyConfig = await this.depResolver.getProxyConfig();\n const networkConfig = await this.depResolver.getNetworkConfig();\n const registries = await this.depResolver.getRegistries();\n // require it dynamically for performance purpose. the pnpm package require many files - do not move to static import\n // eslint-disable-next-line global-require, import/no-dynamic-require\n const lynx = require('./lynx');\n const { config } = await this.readConfig(installOptions.packageManagerConfigRootDir);\n return lynx.getPeerDependencyIssues(manifests, {\n storeDir: config.storeDir,\n cacheDir: config.cacheDir,\n proxyConfig,\n registries,\n rootDir,\n networkConfig,\n overrides: installOptions.overrides,\n packageImportMethod: installOptions.packageImportMethod ?? config.packageImportMethod,\n });\n }\n\n async resolveRemoteVersion(\n packageName: string,\n options: PackageManagerResolveRemoteVersionOptions\n ): Promise<ResolvedPackageVersion> {\n // require it dynamically for performance purpose. the pnpm package require many files - do not move to static import\n // eslint-disable-next-line global-require, import/no-dynamic-require\n const { resolveRemoteVersion } = require('./lynx');\n const registries = await this.depResolver.getRegistries();\n const proxyConfig = await this.depResolver.getProxyConfig();\n const networkConfig = await this.depResolver.getNetworkConfig();\n const { config } = await this.readConfig(options.packageManagerConfigRootDir);\n return resolveRemoteVersion(packageName, {\n rootDir: options.rootDir,\n cacheDir: config.cacheDir,\n registries,\n proxyConfig,\n networkConfig,\n fullMetadata: options.fullMetadata,\n });\n }\n\n async getProxyConfig?(): Promise<PackageManagerProxyConfig> {\n // eslint-disable-next-line global-require, import/no-dynamic-require\n const { getProxyConfig } = require('./get-proxy-config');\n const { config } = await this.readConfig();\n return getProxyConfig(config);\n }\n\n async getNetworkConfig?(): Promise<PackageManagerNetworkConfig> {\n const { config } = await this.readConfig();\n const configuredUserAgent = config.userAgent;\n if (!configuredUserAgent && !this.username) {\n this.username = (await this.cloud.getCurrentUser())?.username ?? 'anonymous';\n }\n const result: PackageManagerNetworkConfig = {\n userAgent: configuredUserAgent ?? `bit user/${this.username}`,\n };\n // The resolved config carries the engine's defaults for the numeric\n // network settings, and anything returned here overrides Bit's global\n // network config in the dependency resolver's merge, so only settings the\n // user explicitly configured may pass through.\n const explicitSettings = new Set(config.explicitSettings);\n if (config.maxSockets != null && explicitSettings.has('maxSockets')) {\n result.maxSockets = config.maxSockets;\n }\n if (config.networkConcurrency != null && explicitSettings.has('networkConcurrency')) {\n result.networkConcurrency = config.networkConcurrency;\n }\n if (config.fetchRetries != null && explicitSettings.has('fetchRetries')) {\n result.fetchRetries = config.fetchRetries;\n }\n if (config.fetchTimeout != null && explicitSettings.has('fetchTimeout')) {\n result.fetchTimeout = config.fetchTimeout;\n }\n if (config.fetchRetryMaxtimeout != null && explicitSettings.has('fetchRetryMaxtimeout')) {\n result.fetchRetryMaxtimeout = config.fetchRetryMaxtimeout;\n }\n if (config.fetchRetryMintimeout != null && explicitSettings.has('fetchRetryMintimeout')) {\n result.fetchRetryMintimeout = config.fetchRetryMintimeout;\n }\n // Unlike the numeric settings above, strictSsl/ca/cert/key are optional\n // in the engine's projection and populated only when explicitly\n // configured (the engine applies its own defaults at client-build\n // time), so presence is already the explicit gate.\n if (config.strictSsl != null) {\n result.strictSSL = config.strictSsl;\n }\n if (config.ca != null) {\n result.ca = config.ca;\n }\n if (config.cert != null) {\n result.cert = config.cert;\n }\n if (config.key != null) {\n result.key = config.key;\n }\n return result;\n }\n\n async getRegistries(): Promise<Registries> {\n // eslint-disable-next-line global-require, import/no-dynamic-require\n const { getRegistries } = require('./get-registries');\n const { config } = await this.readConfig();\n const pnpmRegistry = await getRegistries(config);\n const defaultRegistry = new Registry(\n pnpmRegistry.default.uri,\n pnpmRegistry.default.alwaysAuth,\n pnpmRegistry.default.authHeaderValue,\n pnpmRegistry.default.originalAuthType,\n pnpmRegistry.default.originalAuthValue\n );\n\n const pnpmScoped = omit(pnpmRegistry, ['default']);\n const scopesRegistries: Record<string, Registry> = Object.keys(pnpmScoped).reduce((acc, scopedRegName) => {\n const scopedReg = pnpmScoped[scopedRegName];\n const name = scopedRegName.replace('@', '');\n acc[name] = new Registry(\n scopedReg.uri,\n scopedReg.alwaysAuth,\n scopedReg.authHeaderValue,\n scopedReg.originalAuthType,\n scopedReg.originalAuthValue\n );\n return acc;\n }, {});\n\n // Add bit registry server if not exist\n if (!scopesRegistries.bit) {\n scopesRegistries.bit = new Registry(BIT_CLOUD_REGISTRY, true);\n }\n\n return new Registries(defaultRegistry, scopesRegistries);\n }\n\n async getInjectedDirs(rootDir: string, componentDir: string, packageName: string): Promise<string[]> {\n const modulesState = await this._readModulesManifest(rootDir);\n if (modulesState?.injectedDeps == null) return [];\n return modulesState.injectedDeps[`node_modules/${packageName}`] ?? modulesState.injectedDeps[componentDir] ?? [];\n }\n\n async _readModulesManifest(lockfileDir: string): Promise<Modules | undefined> {\n if (this.modulesManifestCache.has(lockfileDir)) {\n return this.modulesManifestCache.get(lockfileDir);\n }\n const {\n modulesYaml: { readModulesManifest },\n } = await loadPnpmEsm();\n const modulesManifest = await readModulesManifest(join(lockfileDir, 'node_modules'));\n if (modulesManifest) {\n this.modulesManifestCache.set(lockfileDir, modulesManifest);\n }\n return modulesManifest ?? undefined;\n }\n\n getWorkspaceDepsOfBitRoots(manifests: ProjectManifest[]): Record<string, string> {\n return Object.fromEntries(manifests.map((manifest) => [manifest.name, 'workspace:*']));\n }\n\n /**\n * pnpm's own shared `<storeDir>/links`.\n *\n * Bit used to carve out a private `<storeDir>/bit-links/<installationId>` root, because the core\n * aspects had to be mirrored at the root of the virtual store for the published envs to reach\n * them, and such a mirror cannot be shared with the pnpm CLI or another bit installation. They now\n * go to the project-local hoisted directory instead (see\n * `DependencyLinker.linkCoreAspectsToHoistedStore`), so nothing is written inside the store and\n * the shared directory can be used - slots are reused across bit versions and with every other\n * pnpm project, upgrades stay incremental, and `pnpm store prune` can account for them.\n */\n async getGlobalVirtualStoreDir({\n packageManagerConfigRootDir,\n }: {\n packageManagerConfigRootDir?: string;\n installationId: string;\n }): Promise<string> {\n const { config } = await this.readConfig(packageManagerConfigRootDir);\n return config.globalVirtualStoreDir ?? join(config.storeDir, 'links');\n }\n\n async pruneModules(rootDir: string): Promise<void> {\n return pnpmPruneModules(rootDir);\n }\n\n async findUsages(depName: string, opts: { lockfileDir: string; depth?: number }): Promise<string> {\n const {\n lockfileFs: { readWantedLockfile },\n } = await loadPnpmEsm();\n const lockfile = await readWantedLockfile(opts.lockfileDir, { ignoreIncompatible: false });\n if (!lockfile) return '';\n const importerIds = Object.keys(lockfile.importers ?? {}).filter((id) => !id.includes(`${BIT_ROOTS_DIR}/`));\n const projectPaths = importerIds.map((id) => join(opts.lockfileDir, id));\n const importerInfoMap = new Map<string, ImporterInfo>();\n for (const importerId of importerIds) {\n const pkgJson = tryReadPackageJson(join(opts.lockfileDir, importerId));\n importerInfoMap.set(importerId, {\n name: pkgJson?.name ?? importerId,\n version: pkgJson?.version ?? '',\n });\n }\n const trees = await buildDependentsTree([depName], projectPaths, {\n include: {\n dependencies: true,\n devDependencies: true,\n optionalDependencies: true,\n },\n lockfileDir: opts.lockfileDir,\n registries: {\n default: 'https://registry.npmjs.org',\n },\n importerInfoMap,\n lockfile,\n nameFormatter({ manifest }) {\n if ('componentId' in manifest) {\n const { scope, name } = manifest.componentId as { scope: string; name: string };\n return `${scope}/${name}`;\n }\n return manifest.name;\n },\n });\n return renderDependentsTree(trees, {\n depth: opts.depth ?? Infinity,\n long: false,\n });\n }\n\n /**\n * Calculating the dependencies graph of a given component using the lockfile.\n */\n async calcDependenciesGraph(opts: CalcDepsGraphOptions): Promise<void> {\n await initLockfileDepsGraphConverter();\n const {\n lockfileFs: { readWantedLockfile, convertToLockfileFile: convertLockfileObjectToLockfileFile },\n } = await loadPnpmEsm();\n const originalLockfile = await readWantedLockfile(opts.rootDir, { ignoreIncompatible: false });\n if (!originalLockfile) {\n return;\n }\n for (const { componentRootDir, componentRelativeDir, pkgName, component } of opts.components) {\n const componentImporterId = (componentRelativeDir || '.') as ProjectId;\n let compRootDir: string | undefined;\n if (componentRootDir && !originalLockfile.importers[componentRootDir] && componentRootDir.includes('@')) {\n compRootDir = componentRootDir.split('@')[0];\n } else {\n compRootDir = componentRootDir;\n }\n if (!originalLockfile.importers[componentImporterId]) {\n continue;\n }\n const hasComponentRootImporter =\n compRootDir != null && Boolean(originalLockfile.importers[compRootDir as ProjectId]);\n const filterByImporterIds = [componentImporterId];\n if (hasComponentRootImporter && compRootDir !== componentImporterId) {\n filterByImporterIds.push(compRootDir as ProjectId);\n }\n // Only clone the importers that will be mutated, reuse the rest of the lockfile as-is\n const clonedImporters: Record<string, any> = {};\n for (const importerId of filterByImporterIds) {\n if (originalLockfile.importers[importerId]) {\n clonedImporters[importerId] = structuredClone(originalLockfile.importers[importerId]);\n }\n }\n const lockfile = {\n ...originalLockfile,\n importers: { ...originalLockfile.importers, ...clonedImporters },\n };\n for (const importerId of filterByImporterIds) {\n const importer = lockfile.importers[importerId];\n if (importer == null) continue;\n for (const workspacePkgName of opts.componentIdByPkgName.keys()) {\n if (workspacePkgName === pkgName) continue;\n // In the component's own importer, an injected sibling (a \"file:\"\n // ref) is a real direct dependency of this component — the graph\n // converter rewrites it to the component's semver id. Entries in\n // any other importer (e.g. the capsule/workspace root) merely\n // wire the workspace together and must not leak into this\n // component's graph.\n if (importerId === componentImporterId) {\n const ref =\n importer.dependencies?.[workspacePkgName] ??\n importer.devDependencies?.[workspacePkgName] ??\n importer.optionalDependencies?.[workspacePkgName];\n if (typeof ref === 'string' && ref.startsWith('file:')) continue;\n }\n for (const depType of [\n 'dependencies',\n 'devDependencies',\n 'optionalDependencies',\n 'specifiers',\n 'dependenciesMeta',\n ]) {\n delete importer[depType]?.[workspacePkgName];\n }\n }\n }\n // Filters the lockfile so that it only includes packages related to the given component.\n const partialLockfile = convertLockfileObjectToLockfileFile(\n filterLockfileByImporters(lockfile, filterByImporterIds, {\n include: {\n dependencies: true,\n devDependencies: true,\n optionalDependencies: true,\n },\n failOnMissingDependencies: false,\n skipped: new Set(),\n })\n );\n const graph = convertLockfileToGraph(partialLockfile, {\n ...opts,\n componentRootDir: hasComponentRootImporter ? compRootDir : undefined,\n componentRelativeDir: componentImporterId,\n pkgName,\n });\n component.state._consumer.dependenciesGraph = graph;\n }\n }\n}\n\nfunction resolveHoistPattern(hoistPatternsFromBitConfig?: string[], hoistPatternFromPnpmConfig?: string[]): string[] {\n if (hoistPatternsFromBitConfig == null) return hoistPatternFromPnpmConfig ?? ['*'];\n if (\n isDefaultHoistPattern(hoistPatternsFromBitConfig) &&\n hoistPatternFromPnpmConfig &&\n !isDefaultHoistPattern(hoistPatternFromPnpmConfig)\n ) {\n return hoistPatternFromPnpmConfig;\n }\n return hoistPatternsFromBitConfig;\n}\n\nfunction isDefaultHoistPattern(hoistPattern: string[]): boolean {\n return hoistPattern.length === 1 && hoistPattern[0] === '*';\n}\n\nfunction tryReadPackageJson(pkgDir: string) {\n try {\n return JSON.parse(fs.readFileSync(join(pkgDir, 'package.json'), 'utf8'));\n } catch {\n return undefined;\n }\n}\n\n// Merge a graph-derived lockfile into an existing wanted lockfile. The graph lockfile is\n// authoritative for keys it contains (a re-imported component can change the resolution\n// of its own deps), but must not erase packages, snapshots, or importer entries that are\n// only known to the existing lockfile. convertGraphToLockfile emits importer entries for\n// every workspace project, but only populates deps for manifests whose keys appear in the\n// graph's root edge — so per-importer overlay (instead of overwrite) is what keeps\n// unrelated workspace importers intact.\n//\n// Packages and snapshots are deep-merged per key so that pnpm-managed metadata the graph\n// doesn't round-trip (e.g. `optional`, `transitivePeerDependencies`, `dev`) survives on\n// entries the graph also knows about.\nfunction mergeGraphLockfileIntoExisting(existing: LockfileFile, graph: LockfileFile): LockfileFile {\n const importers: NonNullable<LockfileFile['importers']> = { ...existing.importers };\n for (const [importerId, graphImporter] of Object.entries(graph.importers ?? {})) {\n const existingImporter = importers[importerId];\n if (!existingImporter) {\n importers[importerId] = graphImporter;\n continue;\n }\n importers[importerId] = {\n ...existingImporter,\n dependencies: { ...existingImporter.dependencies, ...graphImporter.dependencies },\n devDependencies: { ...existingImporter.devDependencies, ...graphImporter.devDependencies },\n optionalDependencies: {\n ...existingImporter.optionalDependencies,\n ...graphImporter.optionalDependencies,\n },\n };\n }\n const existingBit = (existing as LockfileFile & { bit?: { depsRequiringBuild?: string[] } }).bit;\n const graphBit = (graph as LockfileFile & { bit?: { depsRequiringBuild?: string[] } }).bit;\n const mergedDepsRequiringBuild = Array.from(\n new Set([...(existingBit?.depsRequiringBuild ?? []), ...(graphBit?.depsRequiringBuild ?? [])])\n ).sort();\n const merged = {\n ...existing,\n // Keep the existing lockfile's schema version. convertGraphToLockfile hardcodes\n // lockfileVersion: '9.0', so preferring graph.lockfileVersion would silently\n // downgrade workspaces whose pnpm already writes a newer schema and trigger a\n // full rewrite on the next install.\n lockfileVersion: existing.lockfileVersion ?? graph.lockfileVersion,\n importers,\n packages: mergeEntryRecords(existing.packages, graph.packages),\n snapshots: mergeEntryRecords(existing.snapshots, graph.snapshots),\n };\n if (existingBit || graphBit) {\n (merged as LockfileFile & { bit?: Record<string, unknown> }).bit = {\n ...existingBit,\n ...graphBit,\n depsRequiringBuild: mergedDepsRequiringBuild,\n };\n }\n pruneUnreachableLockfileEntries(merged);\n return merged;\n}\n\nfunction mergeEntryRecords<T extends object>(\n existing: Record<string, T> | undefined,\n graph: Record<string, T> | undefined\n): Record<string, T> | undefined {\n if (!existing) return graph;\n if (!graph) return existing;\n const merged: Record<string, T> = { ...existing };\n for (const [key, graphEntry] of Object.entries(graph)) {\n const existingEntry = merged[key];\n merged[key] = existingEntry ? ({ ...existingEntry, ...graphEntry } as T) : graphEntry;\n }\n return merged;\n}\n\nfunction pruneUnreachableLockfileEntries(lockfile: LockfileFile): void {\n const reachablePackages = new Set<string>();\n const reachableSnapshots = new Set<string>();\n // An explicit stack: deep dependency chains would overflow the call\n // stack with a recursive walk.\n const stack: string[] = [];\n const visit = (depPath: string) => {\n stack.push(depPath);\n while (stack.length > 0) {\n const current = stack.pop()!;\n if (reachableSnapshots.has(current)) continue;\n reachableSnapshots.add(current);\n reachablePackages.add(removePeerSuffix(current));\n const snapshot = lockfile.snapshots?.[current];\n if (!snapshot) continue;\n for (const depType of ['dependencies', 'optionalDependencies'] as const) {\n for (const [name, ref] of Object.entries(snapshot[depType] ?? {}) as Array<[string, string]>) {\n if (ref.startsWith('link:') || ref.startsWith('file:')) continue;\n stack.push(`${name}@${ref}`);\n }\n }\n }\n };\n for (const importer of Object.values(lockfile.importers ?? {})) {\n for (const depType of ['dependencies', 'devDependencies', 'optionalDependencies'] as const) {\n for (const [name, dep] of Object.entries(importer[depType] ?? {}) as Array<\n [string, { version?: string } | string]\n >) {\n const version = typeof dep === 'string' ? dep : dep.version;\n if (!version || version.startsWith('link:') || version.startsWith('file:')) continue;\n visit(`${name}@${version}`);\n }\n }\n }\n for (const pkgId of Object.keys(lockfile.packages ?? {})) {\n if (!reachablePackages.has(pkgId)) {\n delete lockfile.packages![pkgId];\n }\n }\n for (const depPath of Object.keys(lockfile.snapshots ?? {})) {\n if (!reachableSnapshots.has(depPath)) {\n delete lockfile.snapshots![depPath];\n }\n }\n const bitAttrs = (lockfile as LockfileFile & { bit?: { depsRequiringBuild?: string[] } }).bit;\n if (bitAttrs?.depsRequiringBuild) {\n bitAttrs.depsRequiringBuild = bitAttrs.depsRequiringBuild.filter((depPath) =>\n reachablePackages.has(removePeerSuffix(depPath))\n );\n }\n}\n\nfunction removePeerSuffix(depPath: string): string {\n const suffixStart = depPath.indexOf('(');\n return suffixStart === -1 ? depPath : depPath.slice(0, suffixStart);\n}\n"],"mappings":";;;;;;AACA,SAAAA,oBAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,mBAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAYA,SAAAE,aAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,YAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,gBAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,eAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAI,IAAA;EAAA,MAAAJ,IAAA,GAAAK,sBAAA,CAAAJ,OAAA;EAAAG,GAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,QAAA;EAAA,MAAAN,IAAA,GAAAC,OAAA;EAAAK,OAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA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,WAAW,KAAK,CAAC,CAAC,GAAGT,OAAO,GAAGA,OAAO,CAACW,KAAK,CAAC,CAAC,EAAEF,WAAW,CAAC;AACrE","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_dependencyResolver","data","require","_pkgEntities","_harmonyModules","_fs","_interopRequireDefault","_lodash","_lockfile","_depsInspection","_depsInspection2","_legacy","_legacy2","_path","_lockfileDepsGraphConverter","_readConfig","_pnpmPruneModules","_preserveLoadedVirtualStoreDirs","e","__esModule","default","ownKeys","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","pnpmEsmPromise","loadPnpmEsm","loadEsm","lockfileFs","modulesYaml","PnpmPackageManager","constructor","depResolver","logger","cloud","Map","dir","config","warnings","readConfig","fetchRetries","memoize","dependenciesGraphToLockfile","dependenciesGraph","opts","initLockfileDepsGraphConverter","registries","Registries","Registry","generateResolverAndFetcher","resolve","graphLockfile","convertGraphToLockfile","readWantedLockfile","writeLockfileFile","convertToLockfileFile","convertLockfileObjectToLockfileFile","existingLockfile","rootDir","ignoreIncompatible","mergedLockfile","mergeGraphLockfileIntoExisting","assign","bit","restoredFromModel","lockfilePath","join","debug","process","env","DEPS_GRAPH_LOG","console","log","install","manifests","installOptions","getRegistries","proxyConfig","getProxyConfig","networkConfig","getNetworkConfig","packageManagerConfigRootDir","isFeatureEnabled","DEPS_GRAPH","rootComponents","rootComponentsForCapsules","cacheDir","error","message","hidePackageManagerOutput","off","useNesting","extendWithComponentsFromDir","nmSelfReferences","values","manifest","name","devDependencies","modulesManifestCache","delete","hoistPattern","resolveHoistPattern","hoistPatterns","loadedVirtualStoreDirs","snapshotLoadedVirtualStoreDirs","dependenciesChanged","rebuild","storeDir","depsRequiringBuild","autoInstallPeers","dedupePeers","enableModulesDir","engineStrict","excludeLinksFromLockfile","lockfileOnly","minimumReleaseAge","minimumReleaseAgeExclude","neverBuiltDependencies","allowScripts","dangerouslyAllowAllScripts","nodeLinker","nodeVersion","includeOptionalDeps","ignorePackageManifest","dedupeInjectedDeps","dryRun","overrides","publicHoistPattern","shamefullyHoist","hoistWorkspacePackages","hoistInjectedDependencies","packageImportMethod","enableGlobalVirtualStore","globalVirtualStoreDir","patchedDependencies","packageExtensions","preferOffline","sideEffectsCacheRead","sideEffectsCache","sideEffectsCacheWrite","pnpmHomeDir","updateAll","reportOptions","appendOnly","optimizeReportForNonTerminal","BIT_CLI_SERVER_NO_TTY","stdout","ServerSendOutStream","undefined","throttleProgress","hideProgressPrefix","hideLifecycleOutput","peerDependencyRules","returnListOfDepsRequiringBuild","forcedHarmonyVersion","on","restoreRemovedLoadedVirtualStoreDirs","getPeerDependencyIssues","lynx","resolveRemoteVersion","packageName","options","fullMetadata","configuredUserAgent","userAgent","username","getCurrentUser","result","explicitSettings","Set","maxSockets","has","networkConcurrency","fetchTimeout","fetchRetryMaxtimeout","fetchRetryMintimeout","strictSsl","strictSSL","ca","cert","key","pnpmRegistry","defaultRegistry","uri","alwaysAuth","authHeaderValue","originalAuthType","originalAuthValue","pnpmScoped","omit","scopesRegistries","reduce","acc","scopedRegName","scopedReg","replace","BIT_CLOUD_REGISTRY","getInjectedDirs","componentDir","modulesState","_readModulesManifest","injectedDeps","lockfileDir","get","readModulesManifest","modulesManifest","set","getWorkspaceDepsOfBitRoots","fromEntries","map","getGlobalVirtualStoreDir","pruneModules","pnpmPruneModules","findUsages","depName","lockfile","importerIds","importers","id","includes","BIT_ROOTS_DIR","projectPaths","importerInfoMap","importerId","pkgJson","tryReadPackageJson","version","trees","buildDependentsTree","include","dependencies","optionalDependencies","nameFormatter","scope","componentId","renderDependentsTree","depth","Infinity","long","calcDependenciesGraph","originalLockfile","componentRootDir","componentRelativeDir","pkgName","component","components","componentImporterId","compRootDir","split","hasComponentRootImporter","Boolean","filterByImporterIds","clonedImporters","structuredClone","importer","workspacePkgName","componentIdByPkgName","ref","startsWith","depType","partialLockfile","filterLockfileByImporters","failOnMissingDependencies","skipped","graph","convertLockfileToGraph","state","_consumer","exports","hoistPatternsFromBitConfig","hoistPatternFromPnpmConfig","isDefaultHoistPattern","pkgDir","JSON","parse","fs","readFileSync","existing","graphImporter","entries","existingImporter","existingBit","graphBit","mergedDepsRequiringBuild","Array","from","sort","merged","lockfileVersion","packages","mergeEntryRecords","snapshots","pruneUnreachableLockfileEntries","graphEntry","existingEntry","reachablePackages","reachableSnapshots","stack","visit","depPath","current","pop","add","removePeerSuffix","snapshot","dep","pkgId","bitAttrs","suffixStart","indexOf","slice"],"sources":["pnpm.package-manager.ts"],"sourcesContent":["import type { CloudMain } from '@teambit/cloud';\nimport { extendWithComponentsFromDir, BIT_CLOUD_REGISTRY } from '@teambit/dependency-resolver';\nimport type {\n DependencyResolverMain,\n InstallationContext,\n PackageManager,\n PackageManagerInstallOptions,\n PackageManagerResolveRemoteVersionOptions,\n ResolvedPackageVersion,\n PackageManagerProxyConfig,\n PackageManagerNetworkConfig,\n CalcDepsGraphOptions,\n} from '@teambit/dependency-resolver';\nimport { Registries, Registry } from '@teambit/pkg.entities.registry';\nimport { DEPS_GRAPH, isFeatureEnabled } from '@teambit/harmony.modules.feature-toggle';\nimport type { Logger } from '@teambit/logger';\nimport { type LockfileFile } from '@pnpm/lockfile.types';\nimport fs from 'fs';\nimport { memoize, omit } from 'lodash';\nimport { filterLockfileByImporters } from '@pnpm/lockfile.filtering';\nimport type { PeerDependencyIssuesByProjects, ResolvedConfig } from '@pnpm/napi';\nimport { type ProjectId, type ProjectManifest, type DepPath } from '@pnpm/types';\nimport type * as LockfileFs from '@pnpm/lockfile.fs';\nimport type { Modules } from '@pnpm/installing.modules-yaml';\nimport type * as ModulesYaml from '@pnpm/installing.modules-yaml';\nimport type { ImporterInfo } from '@pnpm/deps.inspection.tree-builder';\nimport { buildDependentsTree } from '@pnpm/deps.inspection.tree-builder';\nimport { renderDependentsTree } from '@pnpm/deps.inspection.list';\nimport { BIT_ROOTS_DIR } from '@teambit/legacy.constants';\nimport { ServerSendOutStream } from '@teambit/legacy.logger';\nimport { join } from 'path';\nimport {\n convertLockfileToGraph,\n convertGraphToLockfile,\n init as initLockfileDepsGraphConverter,\n} from './lockfile-deps-graph-converter';\nimport { readConfig } from './read-config';\nimport { pnpmPruneModules } from './pnpm-prune-modules';\nimport {\n snapshotLoadedVirtualStoreDirs,\n restoreRemovedLoadedVirtualStoreDirs,\n} from './preserve-loaded-virtual-store-dirs';\nimport type { RebuildFn } from './lynx';\nimport type * as LynxModule from './lynx';\nimport { type DependenciesGraph } from '@teambit/objects';\n\nexport type { RebuildFn };\n\nexport interface InstallResult {\n dependenciesChanged: boolean;\n rebuild: RebuildFn;\n storeDir: string;\n depsRequiringBuild?: DepPath[];\n}\n\ntype ReadConfigResult = Promise<{ config: ResolvedConfig; warnings: string[] }>;\ntype LockfileFsModule = typeof LockfileFs;\ntype ModulesYamlModule = typeof ModulesYaml;\nlet pnpmEsmPromise: Promise<{ lockfileFs: LockfileFsModule; modulesYaml: ModulesYamlModule }> | undefined;\n\nfunction loadPnpmEsm(): Promise<{ lockfileFs: LockfileFsModule; modulesYaml: ModulesYamlModule }> {\n pnpmEsmPromise ??= (async () => {\n const { loadEsm } = require('./load-pnpm-esm.cjs') as {\n loadEsm: () => Promise<{ lockfileFs: LockfileFsModule; modulesYaml: ModulesYamlModule }>;\n };\n const { lockfileFs, modulesYaml } = await loadEsm();\n return { lockfileFs, modulesYaml };\n })();\n return pnpmEsmPromise;\n}\n\nexport class PnpmPackageManager implements PackageManager {\n readonly name = 'pnpm';\n readonly modulesManifestCache: Map<string, Modules> = new Map();\n private username: string;\n\n private _readConfig = async (dir?: string): ReadConfigResult => {\n const { config, warnings } = await readConfig(dir);\n if (config?.fetchRetries && config?.fetchRetries < 5) {\n config.fetchRetries = 5;\n return { config, warnings };\n }\n\n return { config, warnings };\n };\n\n public readConfig: (dir?: string) => ReadConfigResult = memoize(this._readConfig);\n\n constructor(\n private depResolver: DependencyResolverMain,\n private logger: Logger,\n private cloud: CloudMain\n ) {}\n\n async dependenciesGraphToLockfile(\n dependenciesGraph: DependenciesGraph,\n opts: {\n cacheDir: string;\n manifests: Record<string, ProjectManifest>;\n rootDir: string;\n registries?: Registries;\n proxyConfig?: PackageManagerProxyConfig;\n networkConfig?: PackageManagerNetworkConfig;\n }\n ) {\n await initLockfileDepsGraphConverter();\n const registries = opts.registries ?? new Registries(new Registry('https://node-registry.bit.cloud', false), {});\n // eslint-disable-next-line global-require, import/no-dynamic-require\n const { generateResolverAndFetcher } = require('./lynx') as typeof LynxModule;\n const { resolve } = await generateResolverAndFetcher({\n ...opts,\n registries,\n });\n const graphLockfile: LockfileFile = await convertGraphToLockfile(dependenciesGraph, {\n ...opts,\n resolve,\n });\n const {\n lockfileFs: { readWantedLockfile, writeLockfileFile, convertToLockfileFile: convertLockfileObjectToLockfileFile },\n } = await loadPnpmEsm();\n // Merge the graph-derived subset into any existing wanted lockfile rather than\n // overwriting. Only the importers, packages, and snapshots referenced by the\n // imported components' subgraph are re-stated here; every other workspace dep's\n // locked version must be preserved so pnpm doesn't re-resolve it to a newer\n // registry version.\n const existingLockfile = await readWantedLockfile(opts.rootDir, { ignoreIncompatible: true });\n const mergedLockfile = existingLockfile\n ? mergeGraphLockfileIntoExisting(convertLockfileObjectToLockfileFile(existingLockfile), graphLockfile)\n : graphLockfile;\n Object.assign(mergedLockfile, {\n bit: {\n ...(mergedLockfile as LockfileFile & { bit?: Record<string, unknown> }).bit,\n restoredFromModel: true,\n },\n });\n const lockfilePath = join(opts.rootDir, 'pnpm-lock.yaml');\n await writeLockfileFile(lockfilePath, mergedLockfile);\n this.logger.debug(`generated a lockfile from dependencies graph at ${lockfilePath}`);\n if (process.env.DEPS_GRAPH_LOG) {\n // eslint-disable-next-line no-console\n console.log(`generated a lockfile from dependencies graph at ${lockfilePath}`);\n }\n }\n\n async install(\n { rootDir, manifests }: InstallationContext,\n installOptions: PackageManagerInstallOptions = {}\n ): Promise<InstallResult> {\n // require it dynamically for performance purpose. the pnpm package require many files - do not move to static import\n // eslint-disable-next-line global-require, import/no-dynamic-require\n const { install } = require('./lynx');\n\n const registries = await this.depResolver.getRegistries();\n const proxyConfig = await this.depResolver.getProxyConfig();\n const networkConfig = await this.depResolver.getNetworkConfig();\n const { config } = await this.readConfig(installOptions.packageManagerConfigRootDir);\n if (\n installOptions.dependenciesGraph &&\n isFeatureEnabled(DEPS_GRAPH) &&\n (installOptions.rootComponents || installOptions.rootComponentsForCapsules)\n ) {\n try {\n await this.dependenciesGraphToLockfile(installOptions.dependenciesGraph, {\n manifests,\n rootDir,\n registries,\n proxyConfig,\n networkConfig,\n cacheDir: config.cacheDir,\n });\n } catch (error) {\n // If the lockfile could not be created for some reason, it will be created later during installation.\n this.logger.error((error as Error).message);\n }\n }\n\n this.logger.debug(`running installation in root dir ${rootDir}`);\n this.logger.debug('components manifests for installation', manifests);\n if (!installOptions.hidePackageManagerOutput) {\n // this.logger.setStatusLine('installing dependencies using pnpm');\n // turn off the logger because it interrupts the pnpm output\n // this.logger.console('-------------------------PNPM OUTPUT-------------------------');\n this.logger.off();\n }\n if (!installOptions.useNesting && installOptions.rootComponentsForCapsules) {\n manifests = await extendWithComponentsFromDir(rootDir, manifests);\n }\n if (installOptions.nmSelfReferences) {\n Object.values(manifests).forEach((manifest) => {\n if (manifest.name) {\n manifest.devDependencies = {\n [manifest.name]: 'link:.',\n ...manifest.devDependencies,\n };\n }\n });\n }\n this.modulesManifestCache.delete(rootDir);\n const hoistPattern = resolveHoistPattern(installOptions.hoistPatterns, config.hoistPattern);\n // packages this process already loaded modules from must stay requireable even if this install\n // re-keys them to a new peer hash - see preserve-loaded-virtual-store-dirs.ts\n const loadedVirtualStoreDirs = snapshotLoadedVirtualStoreDirs(rootDir);\n const { dependenciesChanged, rebuild, storeDir, depsRequiringBuild } = await install(\n rootDir,\n manifests,\n config.storeDir,\n config.cacheDir,\n registries,\n proxyConfig,\n networkConfig,\n {\n autoInstallPeers: installOptions.autoInstallPeers ?? true,\n dedupePeers: installOptions.dedupePeers ?? true,\n enableModulesDir: installOptions.enableModulesDir,\n engineStrict: installOptions.engineStrict ?? config.engineStrict,\n excludeLinksFromLockfile: installOptions.excludeLinksFromLockfile,\n lockfileOnly: installOptions.lockfileOnly,\n minimumReleaseAge: installOptions.minimumReleaseAge,\n minimumReleaseAgeExclude: installOptions.minimumReleaseAgeExclude,\n neverBuiltDependencies: installOptions.neverBuiltDependencies,\n allowScripts: installOptions.allowScripts,\n dangerouslyAllowAllScripts: installOptions.dangerouslyAllowAllScripts,\n nodeLinker: installOptions.nodeLinker,\n nodeVersion: installOptions.nodeVersion ?? config.nodeVersion,\n includeOptionalDeps: installOptions.includeOptionalDeps,\n ignorePackageManifest: installOptions.ignorePackageManifest,\n dedupeInjectedDeps: installOptions.dedupeInjectedDeps ?? false,\n dryRun: installOptions.dependenciesGraph == null && installOptions.dryRun,\n overrides: installOptions.overrides,\n hoistPattern,\n publicHoistPattern: config.shamefullyHoist\n ? ['*']\n : ['@eslint/plugin-*', '*eslint-plugin*', '@prettier/plugin-*', '*prettier-plugin-*'],\n hoistWorkspacePackages: installOptions.hoistWorkspacePackages ?? false,\n hoistInjectedDependencies: installOptions.hoistInjectedDependencies,\n packageImportMethod: installOptions.packageImportMethod ?? config.packageImportMethod,\n enableGlobalVirtualStore: installOptions.enableGlobalVirtualStore,\n globalVirtualStoreDir: installOptions.globalVirtualStoreDir,\n patchedDependencies: installOptions.patchedDependencies,\n packageExtensions: installOptions.packageExtensions,\n preferOffline: installOptions.preferOffline,\n rootComponents: installOptions.rootComponents,\n rootComponentsForCapsules: installOptions.rootComponentsForCapsules,\n sideEffectsCacheRead: installOptions.sideEffectsCache ?? true,\n sideEffectsCacheWrite: installOptions.sideEffectsCache ?? true,\n pnpmHomeDir: config.pnpmHomeDir,\n updateAll: installOptions.updateAll,\n hidePackageManagerOutput: installOptions.hidePackageManagerOutput,\n reportOptions: {\n appendOnly: installOptions.optimizeReportForNonTerminal,\n process: process.env.BIT_CLI_SERVER_NO_TTY ? { ...process, stdout: new ServerSendOutStream() } : undefined,\n throttleProgress: installOptions.throttleProgress,\n hideProgressPrefix: installOptions.hideProgressPrefix,\n hideLifecycleOutput: installOptions.hideLifecycleOutput,\n peerDependencyRules: installOptions.peerDependencyRules,\n },\n returnListOfDepsRequiringBuild: installOptions.returnListOfDepsRequiringBuild,\n forcedHarmonyVersion: installOptions.forcedHarmonyVersion,\n },\n this.logger\n );\n if (!installOptions.hidePackageManagerOutput) {\n this.logger.on();\n // Make a divider row to improve output\n // this.logger.console('-------------------------END PNPM OUTPUT-------------------------');\n // this.logger.consoleSuccess('installing dependencies using pnpm');\n }\n await restoreRemovedLoadedVirtualStoreDirs(loadedVirtualStoreDirs, this.logger);\n return { dependenciesChanged, rebuild, storeDir, depsRequiringBuild };\n }\n\n async getPeerDependencyIssues(\n rootDir: string,\n manifests: Record<string, ProjectManifest>,\n installOptions: PackageManagerInstallOptions = {}\n ): Promise<PeerDependencyIssuesByProjects> {\n const proxyConfig = await this.depResolver.getProxyConfig();\n const networkConfig = await this.depResolver.getNetworkConfig();\n const registries = await this.depResolver.getRegistries();\n // require it dynamically for performance purpose. the pnpm package require many files - do not move to static import\n // eslint-disable-next-line global-require, import/no-dynamic-require\n const lynx = require('./lynx');\n const { config } = await this.readConfig(installOptions.packageManagerConfigRootDir);\n return lynx.getPeerDependencyIssues(manifests, {\n storeDir: config.storeDir,\n cacheDir: config.cacheDir,\n proxyConfig,\n registries,\n rootDir,\n networkConfig,\n overrides: installOptions.overrides,\n packageImportMethod: installOptions.packageImportMethod ?? config.packageImportMethod,\n });\n }\n\n async resolveRemoteVersion(\n packageName: string,\n options: PackageManagerResolveRemoteVersionOptions\n ): Promise<ResolvedPackageVersion> {\n // require it dynamically for performance purpose. the pnpm package require many files - do not move to static import\n // eslint-disable-next-line global-require, import/no-dynamic-require\n const { resolveRemoteVersion } = require('./lynx');\n const registries = await this.depResolver.getRegistries();\n const proxyConfig = await this.depResolver.getProxyConfig();\n const networkConfig = await this.depResolver.getNetworkConfig();\n const { config } = await this.readConfig(options.packageManagerConfigRootDir);\n return resolveRemoteVersion(packageName, {\n rootDir: options.rootDir,\n cacheDir: config.cacheDir,\n registries,\n proxyConfig,\n networkConfig,\n fullMetadata: options.fullMetadata,\n });\n }\n\n async getProxyConfig?(): Promise<PackageManagerProxyConfig> {\n // eslint-disable-next-line global-require, import/no-dynamic-require\n const { getProxyConfig } = require('./get-proxy-config');\n const { config } = await this.readConfig();\n return getProxyConfig(config);\n }\n\n async getNetworkConfig?(): Promise<PackageManagerNetworkConfig> {\n const { config } = await this.readConfig();\n const configuredUserAgent = config.userAgent;\n if (!configuredUserAgent && !this.username) {\n this.username = (await this.cloud.getCurrentUser())?.username ?? 'anonymous';\n }\n const result: PackageManagerNetworkConfig = {\n userAgent: configuredUserAgent ?? `bit user/${this.username}`,\n };\n // The resolved config carries the engine's defaults for the numeric\n // network settings, and anything returned here overrides Bit's global\n // network config in the dependency resolver's merge, so only settings the\n // user explicitly configured may pass through.\n const explicitSettings = new Set(config.explicitSettings);\n if (config.maxSockets != null && explicitSettings.has('maxSockets')) {\n result.maxSockets = config.maxSockets;\n }\n if (config.networkConcurrency != null && explicitSettings.has('networkConcurrency')) {\n result.networkConcurrency = config.networkConcurrency;\n }\n if (config.fetchRetries != null && explicitSettings.has('fetchRetries')) {\n result.fetchRetries = config.fetchRetries;\n }\n if (config.fetchTimeout != null && explicitSettings.has('fetchTimeout')) {\n result.fetchTimeout = config.fetchTimeout;\n }\n if (config.fetchRetryMaxtimeout != null && explicitSettings.has('fetchRetryMaxtimeout')) {\n result.fetchRetryMaxtimeout = config.fetchRetryMaxtimeout;\n }\n if (config.fetchRetryMintimeout != null && explicitSettings.has('fetchRetryMintimeout')) {\n result.fetchRetryMintimeout = config.fetchRetryMintimeout;\n }\n // Unlike the numeric settings above, strictSsl/ca/cert/key are optional\n // in the engine's projection and populated only when explicitly\n // configured (the engine applies its own defaults at client-build\n // time), so presence is already the explicit gate.\n if (config.strictSsl != null) {\n result.strictSSL = config.strictSsl;\n }\n if (config.ca != null) {\n result.ca = config.ca;\n }\n if (config.cert != null) {\n result.cert = config.cert;\n }\n if (config.key != null) {\n result.key = config.key;\n }\n return result;\n }\n\n async getRegistries(): Promise<Registries> {\n // eslint-disable-next-line global-require, import/no-dynamic-require\n const { getRegistries } = require('./get-registries');\n const { config } = await this.readConfig();\n const pnpmRegistry = await getRegistries(config);\n const defaultRegistry = new Registry(\n pnpmRegistry.default.uri,\n pnpmRegistry.default.alwaysAuth,\n pnpmRegistry.default.authHeaderValue,\n pnpmRegistry.default.originalAuthType,\n pnpmRegistry.default.originalAuthValue\n );\n\n const pnpmScoped = omit(pnpmRegistry, ['default']);\n const scopesRegistries: Record<string, Registry> = Object.keys(pnpmScoped).reduce((acc, scopedRegName) => {\n const scopedReg = pnpmScoped[scopedRegName];\n const name = scopedRegName.replace('@', '');\n acc[name] = new Registry(\n scopedReg.uri,\n scopedReg.alwaysAuth,\n scopedReg.authHeaderValue,\n scopedReg.originalAuthType,\n scopedReg.originalAuthValue\n );\n return acc;\n }, {});\n\n // Add bit registry server if not exist\n if (!scopesRegistries.bit) {\n scopesRegistries.bit = new Registry(BIT_CLOUD_REGISTRY, true);\n }\n\n return new Registries(defaultRegistry, scopesRegistries);\n }\n\n async getInjectedDirs(rootDir: string, componentDir: string, packageName: string): Promise<string[]> {\n const modulesState = await this._readModulesManifest(rootDir);\n if (modulesState?.injectedDeps == null) return [];\n return modulesState.injectedDeps[`node_modules/${packageName}`] ?? modulesState.injectedDeps[componentDir] ?? [];\n }\n\n async _readModulesManifest(lockfileDir: string): Promise<Modules | undefined> {\n if (this.modulesManifestCache.has(lockfileDir)) {\n return this.modulesManifestCache.get(lockfileDir);\n }\n const {\n modulesYaml: { readModulesManifest },\n } = await loadPnpmEsm();\n const modulesManifest = await readModulesManifest(join(lockfileDir, 'node_modules'));\n if (modulesManifest) {\n this.modulesManifestCache.set(lockfileDir, modulesManifest);\n }\n return modulesManifest ?? undefined;\n }\n\n getWorkspaceDepsOfBitRoots(manifests: ProjectManifest[]): Record<string, string> {\n return Object.fromEntries(manifests.map((manifest) => [manifest.name, 'workspace:*']));\n }\n\n /**\n * pnpm's own shared `<storeDir>/links`.\n *\n * Bit used to carve out a private `<storeDir>/bit-links/<installationId>` root, because the core\n * aspects had to be mirrored at the root of the virtual store for the published envs to reach\n * them, and such a mirror cannot be shared with the pnpm CLI or another bit installation. They now\n * go to the project-local hoisted directory instead (see\n * `DependencyLinker.linkCoreAspectsToHoistedStore`), so nothing is written inside the store and\n * the shared directory can be used - slots are reused across bit versions and with every other\n * pnpm project, upgrades stay incremental, and `pnpm store prune` can account for them.\n */\n async getGlobalVirtualStoreDir({\n packageManagerConfigRootDir,\n }: {\n packageManagerConfigRootDir?: string;\n installationId: string;\n }): Promise<string> {\n const { config } = await this.readConfig(packageManagerConfigRootDir);\n return config.globalVirtualStoreDir ?? join(config.storeDir, 'links');\n }\n\n async pruneModules(rootDir: string): Promise<void> {\n return pnpmPruneModules(rootDir);\n }\n\n async findUsages(depName: string, opts: { lockfileDir: string; depth?: number }): Promise<string> {\n const {\n lockfileFs: { readWantedLockfile },\n } = await loadPnpmEsm();\n const lockfile = await readWantedLockfile(opts.lockfileDir, { ignoreIncompatible: false });\n if (!lockfile) return '';\n const importerIds = Object.keys(lockfile.importers ?? {}).filter((id) => !id.includes(`${BIT_ROOTS_DIR}/`));\n const projectPaths = importerIds.map((id) => join(opts.lockfileDir, id));\n const importerInfoMap = new Map<string, ImporterInfo>();\n for (const importerId of importerIds) {\n const pkgJson = tryReadPackageJson(join(opts.lockfileDir, importerId));\n importerInfoMap.set(importerId, {\n name: pkgJson?.name ?? importerId,\n version: pkgJson?.version ?? '',\n });\n }\n const trees = await buildDependentsTree([depName], projectPaths, {\n include: {\n dependencies: true,\n devDependencies: true,\n optionalDependencies: true,\n },\n lockfileDir: opts.lockfileDir,\n registries: {\n default: 'https://registry.npmjs.org',\n },\n importerInfoMap,\n lockfile,\n nameFormatter({ manifest }) {\n if ('componentId' in manifest) {\n const { scope, name } = manifest.componentId as { scope: string; name: string };\n return `${scope}/${name}`;\n }\n return manifest.name;\n },\n });\n return renderDependentsTree(trees, {\n depth: opts.depth ?? Infinity,\n long: false,\n });\n }\n\n /**\n * Calculating the dependencies graph of a given component using the lockfile.\n */\n async calcDependenciesGraph(opts: CalcDepsGraphOptions): Promise<void> {\n await initLockfileDepsGraphConverter();\n const {\n lockfileFs: { readWantedLockfile, convertToLockfileFile: convertLockfileObjectToLockfileFile },\n } = await loadPnpmEsm();\n const originalLockfile = await readWantedLockfile(opts.rootDir, { ignoreIncompatible: false });\n if (!originalLockfile) {\n return;\n }\n for (const { componentRootDir, componentRelativeDir, pkgName, component } of opts.components) {\n const componentImporterId = (componentRelativeDir || '.') as ProjectId;\n let compRootDir: string | undefined;\n if (componentRootDir && !originalLockfile.importers[componentRootDir] && componentRootDir.includes('@')) {\n compRootDir = componentRootDir.split('@')[0];\n } else {\n compRootDir = componentRootDir;\n }\n if (!originalLockfile.importers[componentImporterId]) {\n continue;\n }\n const hasComponentRootImporter =\n compRootDir != null && Boolean(originalLockfile.importers[compRootDir as ProjectId]);\n const filterByImporterIds = [componentImporterId];\n if (hasComponentRootImporter && compRootDir !== componentImporterId) {\n filterByImporterIds.push(compRootDir as ProjectId);\n }\n // Only clone the importers that will be mutated, reuse the rest of the lockfile as-is\n const clonedImporters: Record<string, any> = {};\n for (const importerId of filterByImporterIds) {\n if (originalLockfile.importers[importerId]) {\n clonedImporters[importerId] = structuredClone(originalLockfile.importers[importerId]);\n }\n }\n const lockfile = {\n ...originalLockfile,\n importers: { ...originalLockfile.importers, ...clonedImporters },\n };\n for (const importerId of filterByImporterIds) {\n const importer = lockfile.importers[importerId];\n if (importer == null) continue;\n for (const workspacePkgName of opts.componentIdByPkgName.keys()) {\n if (workspacePkgName === pkgName) continue;\n // In the component's own importer, an injected sibling (a \"file:\"\n // ref) is a real direct dependency of this component — the graph\n // converter rewrites it to the component's semver id. Entries in\n // any other importer (e.g. the capsule/workspace root) merely\n // wire the workspace together and must not leak into this\n // component's graph.\n if (importerId === componentImporterId) {\n const ref =\n importer.dependencies?.[workspacePkgName] ??\n importer.devDependencies?.[workspacePkgName] ??\n importer.optionalDependencies?.[workspacePkgName];\n if (typeof ref === 'string' && ref.startsWith('file:')) continue;\n }\n for (const depType of [\n 'dependencies',\n 'devDependencies',\n 'optionalDependencies',\n 'specifiers',\n 'dependenciesMeta',\n ]) {\n delete importer[depType]?.[workspacePkgName];\n }\n }\n }\n // Filters the lockfile so that it only includes packages related to the given component.\n const partialLockfile = convertLockfileObjectToLockfileFile(\n filterLockfileByImporters(lockfile, filterByImporterIds, {\n include: {\n dependencies: true,\n devDependencies: true,\n optionalDependencies: true,\n },\n failOnMissingDependencies: false,\n skipped: new Set(),\n })\n );\n const graph = convertLockfileToGraph(partialLockfile, {\n ...opts,\n componentRootDir: hasComponentRootImporter ? compRootDir : undefined,\n componentRelativeDir: componentImporterId,\n pkgName,\n });\n component.state._consumer.dependenciesGraph = graph;\n }\n }\n}\n\nfunction resolveHoistPattern(hoistPatternsFromBitConfig?: string[], hoistPatternFromPnpmConfig?: string[]): string[] {\n if (hoistPatternsFromBitConfig == null) return hoistPatternFromPnpmConfig ?? ['*'];\n if (\n isDefaultHoistPattern(hoistPatternsFromBitConfig) &&\n hoistPatternFromPnpmConfig &&\n !isDefaultHoistPattern(hoistPatternFromPnpmConfig)\n ) {\n return hoistPatternFromPnpmConfig;\n }\n return hoistPatternsFromBitConfig;\n}\n\nfunction isDefaultHoistPattern(hoistPattern: string[]): boolean {\n return hoistPattern.length === 1 && hoistPattern[0] === '*';\n}\n\nfunction tryReadPackageJson(pkgDir: string) {\n try {\n return JSON.parse(fs.readFileSync(join(pkgDir, 'package.json'), 'utf8'));\n } catch {\n return undefined;\n }\n}\n\n// Merge a graph-derived lockfile into an existing wanted lockfile. The graph lockfile is\n// authoritative for keys it contains (a re-imported component can change the resolution\n// of its own deps), but must not erase packages, snapshots, or importer entries that are\n// only known to the existing lockfile. convertGraphToLockfile emits importer entries for\n// every workspace project, but only populates deps for manifests whose keys appear in the\n// graph's root edge — so per-importer overlay (instead of overwrite) is what keeps\n// unrelated workspace importers intact.\n//\n// Packages and snapshots are deep-merged per key so that pnpm-managed metadata the graph\n// doesn't round-trip (e.g. `optional`, `transitivePeerDependencies`, `dev`) survives on\n// entries the graph also knows about.\nfunction mergeGraphLockfileIntoExisting(existing: LockfileFile, graph: LockfileFile): LockfileFile {\n const importers: NonNullable<LockfileFile['importers']> = { ...existing.importers };\n for (const [importerId, graphImporter] of Object.entries(graph.importers ?? {})) {\n const existingImporter = importers[importerId];\n if (!existingImporter) {\n importers[importerId] = graphImporter;\n continue;\n }\n importers[importerId] = {\n ...existingImporter,\n dependencies: { ...existingImporter.dependencies, ...graphImporter.dependencies },\n devDependencies: { ...existingImporter.devDependencies, ...graphImporter.devDependencies },\n optionalDependencies: {\n ...existingImporter.optionalDependencies,\n ...graphImporter.optionalDependencies,\n },\n };\n }\n const existingBit = (existing as LockfileFile & { bit?: { depsRequiringBuild?: string[] } }).bit;\n const graphBit = (graph as LockfileFile & { bit?: { depsRequiringBuild?: string[] } }).bit;\n const mergedDepsRequiringBuild = Array.from(\n new Set([...(existingBit?.depsRequiringBuild ?? []), ...(graphBit?.depsRequiringBuild ?? [])])\n ).sort();\n const merged = {\n ...existing,\n // Keep the existing lockfile's schema version. convertGraphToLockfile hardcodes\n // lockfileVersion: '9.0', so preferring graph.lockfileVersion would silently\n // downgrade workspaces whose pnpm already writes a newer schema and trigger a\n // full rewrite on the next install.\n lockfileVersion: existing.lockfileVersion ?? graph.lockfileVersion,\n importers,\n packages: mergeEntryRecords(existing.packages, graph.packages),\n snapshots: mergeEntryRecords(existing.snapshots, graph.snapshots),\n };\n if (existingBit || graphBit) {\n (merged as LockfileFile & { bit?: Record<string, unknown> }).bit = {\n ...existingBit,\n ...graphBit,\n depsRequiringBuild: mergedDepsRequiringBuild,\n };\n }\n pruneUnreachableLockfileEntries(merged);\n return merged;\n}\n\nfunction mergeEntryRecords<T extends object>(\n existing: Record<string, T> | undefined,\n graph: Record<string, T> | undefined\n): Record<string, T> | undefined {\n if (!existing) return graph;\n if (!graph) return existing;\n const merged: Record<string, T> = { ...existing };\n for (const [key, graphEntry] of Object.entries(graph)) {\n const existingEntry = merged[key];\n merged[key] = existingEntry ? ({ ...existingEntry, ...graphEntry } as T) : graphEntry;\n }\n return merged;\n}\n\nfunction pruneUnreachableLockfileEntries(lockfile: LockfileFile): void {\n const reachablePackages = new Set<string>();\n const reachableSnapshots = new Set<string>();\n // An explicit stack: deep dependency chains would overflow the call\n // stack with a recursive walk.\n const stack: string[] = [];\n const visit = (depPath: string) => {\n stack.push(depPath);\n while (stack.length > 0) {\n const current = stack.pop()!;\n if (reachableSnapshots.has(current)) continue;\n reachableSnapshots.add(current);\n reachablePackages.add(removePeerSuffix(current));\n const snapshot = lockfile.snapshots?.[current];\n if (!snapshot) continue;\n for (const depType of ['dependencies', 'optionalDependencies'] as const) {\n for (const [name, ref] of Object.entries(snapshot[depType] ?? {}) as Array<[string, string]>) {\n if (ref.startsWith('link:') || ref.startsWith('file:')) continue;\n stack.push(`${name}@${ref}`);\n }\n }\n }\n };\n for (const importer of Object.values(lockfile.importers ?? {})) {\n for (const depType of ['dependencies', 'devDependencies', 'optionalDependencies'] as const) {\n for (const [name, dep] of Object.entries(importer[depType] ?? {}) as Array<\n [string, { version?: string } | string]\n >) {\n const version = typeof dep === 'string' ? dep : dep.version;\n if (!version || version.startsWith('link:') || version.startsWith('file:')) continue;\n visit(`${name}@${version}`);\n }\n }\n }\n for (const pkgId of Object.keys(lockfile.packages ?? {})) {\n if (!reachablePackages.has(pkgId)) {\n delete lockfile.packages![pkgId];\n }\n }\n for (const depPath of Object.keys(lockfile.snapshots ?? {})) {\n if (!reachableSnapshots.has(depPath)) {\n delete lockfile.snapshots![depPath];\n }\n }\n const bitAttrs = (lockfile as LockfileFile & { bit?: { depsRequiringBuild?: string[] } }).bit;\n if (bitAttrs?.depsRequiringBuild) {\n bitAttrs.depsRequiringBuild = bitAttrs.depsRequiringBuild.filter((depPath) =>\n reachablePackages.has(removePeerSuffix(depPath))\n );\n }\n}\n\nfunction removePeerSuffix(depPath: string): string {\n const suffixStart = depPath.indexOf('(');\n return suffixStart === -1 ? depPath : depPath.slice(0, suffixStart);\n}\n"],"mappings":";;;;;;AACA,SAAAA,oBAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,mBAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAYA,SAAAE,aAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,YAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,gBAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,eAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAI,IAAA;EAAA,MAAAJ,IAAA,GAAAK,sBAAA,CAAAJ,OAAA;EAAAG,GAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,QAAA;EAAA,MAAAN,IAAA,GAAAC,OAAA;EAAAK,OAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,UAAA;EAAA,MAAAP,IAAA,GAAAC,OAAA;EAAAM,SAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAOA,SAAAQ,gBAAA;EAAA,MAAAR,IAAA,GAAAC,OAAA;EAAAO,eAAA,YAAAA,CAAA;IAAA,OAAAR,IAA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CAACU,OAAO,CAAC,GAAG,CAAC;EACxC,OAAOD,WAAW,KAAK,CAAC,CAAC,GAAGT,OAAO,GAAGA,OAAO,CAACW,KAAK,CAAC,CAAC,EAAEF,WAAW,CAAC;AACrE","ignoreList":[]}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { Logger } from '@teambit/logger';
|
|
2
|
+
export interface LoadedVirtualStoreDir {
|
|
3
|
+
/** directory name directly under node_modules/.pnpm, e.g. "@teambit+aspect@1.0.1042_<peers>" */
|
|
4
|
+
dirName: string;
|
|
5
|
+
/** absolute path of that directory */
|
|
6
|
+
dirPath: string;
|
|
7
|
+
/** name of the package the cached modules belong to, e.g. "@teambit/aspect" */
|
|
8
|
+
pkgName: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* the virtual-store directories currently backing loaded modules (require.cache plus the recorded
|
|
12
|
+
* ESM loads), with the package each one holds. require.cache keys are realpaths, and the ESM
|
|
13
|
+
* recorder stores realpaths alongside the given spellings, so a module reached through a
|
|
14
|
+
* dependency symlink is attributed to the directory that really owns it.
|
|
15
|
+
*/
|
|
16
|
+
export declare function snapshotLoadedVirtualStoreDirs(rootDir: string): LoadedVirtualStoreDir[];
|
|
17
|
+
/**
|
|
18
|
+
* restore every snapshotted directory the install removed, copying it from a directory holding the
|
|
19
|
+
* same name@version under a different peer hash. best-effort: a failure to restore leaves things no
|
|
20
|
+
* worse than without this module.
|
|
21
|
+
*
|
|
22
|
+
* restores run sequentially, deliberately: this sits right after every install, where the engine
|
|
23
|
+
* has just saturated the disk, and each restore is a recursive copy. the common case is zero
|
|
24
|
+
* removed directories (the checks are cheap), and when there are any, there are few - serial
|
|
25
|
+
* keeps the worst case from piling unbounded deep copies on top of each other in constrained
|
|
26
|
+
* CI/container environments.
|
|
27
|
+
*/
|
|
28
|
+
export declare function restoreRemovedLoadedVirtualStoreDirs(snapshot: LoadedVirtualStoreDir[], logger?: Logger): Promise<void>;
|
|
29
|
+
/**
|
|
30
|
+
* the directory names under the given virtual store that back loaded modules (require.cache plus
|
|
31
|
+
* the recorded ESM loads). used by pnpmPruneModules to leave alone what the running process is
|
|
32
|
+
* using.
|
|
33
|
+
*/
|
|
34
|
+
export declare function loadedVirtualStoreDirNames(virtualStoreDir: string): Set<string>;
|
|
35
|
+
/**
|
|
36
|
+
* a directory holding the same name@version as the missing one, under a different peer hash.
|
|
37
|
+
* exported for tests.
|
|
38
|
+
*
|
|
39
|
+
* the version is read off the missing directory's own name rather than parsed structurally: the
|
|
40
|
+
* name is `<escaped-pkg-name>@<version>[_<suffix>]` where the escaped name (\/ replaced by +) is
|
|
41
|
+
* known exactly, and `_` cannot appear in a semver version, so everything between the name's `@`
|
|
42
|
+
* and the first `_` after it is the version.
|
|
43
|
+
*
|
|
44
|
+
* a donor is only equivalent if it holds the same files. differing peer sets do not affect them -
|
|
45
|
+
* they only change the sibling dependency symlinks - but a patch does, and pnpm encodes one in the
|
|
46
|
+
* same suffix as a `patch_hash=<hash>` segment. so a patched directory is never a donor for an
|
|
47
|
+
* unpatched one or for one patched differently: without the check, the process would go on reading
|
|
48
|
+
* files that do not match the modules it already loaded.
|
|
49
|
+
*/
|
|
50
|
+
export declare function findDonorDirName(missingDirName: string, pkgName: string, currentDirs: string[]): string | undefined;
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.findDonorDirName = findDonorDirName;
|
|
7
|
+
exports.loadedVirtualStoreDirNames = loadedVirtualStoreDirNames;
|
|
8
|
+
exports.restoreRemovedLoadedVirtualStoreDirs = restoreRemovedLoadedVirtualStoreDirs;
|
|
9
|
+
exports.snapshotLoadedVirtualStoreDirs = snapshotLoadedVirtualStoreDirs;
|
|
10
|
+
function _fsExtra() {
|
|
11
|
+
const data = _interopRequireDefault(require("fs-extra"));
|
|
12
|
+
_fsExtra = function () {
|
|
13
|
+
return data;
|
|
14
|
+
};
|
|
15
|
+
return data;
|
|
16
|
+
}
|
|
17
|
+
function _path() {
|
|
18
|
+
const data = _interopRequireDefault(require("path"));
|
|
19
|
+
_path = function () {
|
|
20
|
+
return data;
|
|
21
|
+
};
|
|
22
|
+
return data;
|
|
23
|
+
}
|
|
24
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
25
|
+
/**
|
|
26
|
+
* Keeps packages the running process has loaded from `node_modules/.pnpm` requireable across an
|
|
27
|
+
* install that relocates them.
|
|
28
|
+
*
|
|
29
|
+
* pnpm keys a virtual-store directory by the package's peer-resolution hash, so an install that
|
|
30
|
+
* changes the dependency set gives the same name@version a NEW directory and deletes the one this
|
|
31
|
+
* process loaded its modules from. Node keeps the loaded module objects, but not the files - so any
|
|
32
|
+
* require the loaded code deferred past load time resolves against the deleted directory and throws
|
|
33
|
+
* MODULE_NOT_FOUND. Any package loaded out of the workspace's own virtual store is exposed to this,
|
|
34
|
+
* and an env is the worst case: `@teambit/aspect`, for instance, defers
|
|
35
|
+
* `require('./babel/babel-config')` until `getCompiler()` is called - which the install flow itself
|
|
36
|
+
* does right after the package-manager run, when it compiles components and reloads envs. The whole
|
|
37
|
+
* install then dies with `Cannot find module './babel/babel-config'`.
|
|
38
|
+
*
|
|
39
|
+
* Replacing the in-memory instances instead is not an option: every reload path (reloadMovedEnvs,
|
|
40
|
+
* loading components as aspects) has to consult the registered env to do its work, and consulting
|
|
41
|
+
* it is exactly what throws. So the fix follows the same rule an OS applies to a running binary's
|
|
42
|
+
* deleted files: what the process has loaded stays available for the process's lifetime. The
|
|
43
|
+
* snapshot records which virtual-store directories back modules in `require.cache`; after the
|
|
44
|
+
* install, any of them that vanished is restored from its re-keyed twin - same name@version, new
|
|
45
|
+
* peer hash - whose package content is identical (it comes from the same tarball; the peer set only
|
|
46
|
+
* affects the dependency symlinks alongside it, which are relative and stay valid from the restored
|
|
47
|
+
* location). A differently patched twin is not such a donor and `findDonorDirName` excludes it.
|
|
48
|
+
*
|
|
49
|
+
* The restored directory is intentionally absent from the lockfile. `pnpmPruneModules` skips
|
|
50
|
+
* directories that back `require.cache` entries for the same reason this module exists, and a later
|
|
51
|
+
* command's prune - whose process has nothing loaded from it - removes it.
|
|
52
|
+
*
|
|
53
|
+
* CJS modules are found in `require.cache`. ESM modules live in node's ESM module map, which has
|
|
54
|
+
* no enumeration API, so aspect-loader records every file it loads through dynamic `import()` in a
|
|
55
|
+
* `Symbol.for`-keyed global set (see aspect-loader's record-loaded-esm-file.ts, the writer side of
|
|
56
|
+
* this contract - keep the two in sync; a symbol rather than an import because the dependency
|
|
57
|
+
* between these packages runs the other way). For ESM only entry files are recorded, not their
|
|
58
|
+
* transitive static imports - those are fully loaded into memory and are not re-read, while an
|
|
59
|
+
* entry's own package directory, where deferred imports and config-file reads point, is restored
|
|
60
|
+
* wholly.
|
|
61
|
+
*/
|
|
62
|
+
const LOADED_ESM_FILES = Symbol.for('bit.loaded-esm-module-files');
|
|
63
|
+
function loadedModuleFiles() {
|
|
64
|
+
return [...Object.keys(require.cache), ...recordedEsmFiles()];
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* the ESM loads aspect-loader recorded. the contract is a global under a well-known symbol, so it
|
|
69
|
+
* is held by convention rather than by types and anything could occupy the key - a value that is
|
|
70
|
+
* not a set of paths is treated as absent rather than allowed to throw, since this runs inside
|
|
71
|
+
* every install and prune, where CJS preservation still works without it.
|
|
72
|
+
*/
|
|
73
|
+
function recordedEsmFiles() {
|
|
74
|
+
const recorded = globalThis[LOADED_ESM_FILES];
|
|
75
|
+
if (!recorded || typeof recorded[Symbol.iterator] !== 'function') return [];
|
|
76
|
+
return [...recorded].filter(file => typeof file === 'string');
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* the spellings of the virtual store that loaded module paths can start with: the given one and its
|
|
81
|
+
* realpath. node resolves a module's filename through its realpath, so the require.cache keys for a
|
|
82
|
+
* workspace reached through a symlink - the normal case on macOS, where a temp dir under /var is
|
|
83
|
+
* really under /private/var - are spelled differently from the rootDir the install was handed.
|
|
84
|
+
* Comparing against the given spelling alone would match nothing there and silently turn the whole
|
|
85
|
+
* preservation into a no-op. The given spelling is kept too, for --preserve-symlinks.
|
|
86
|
+
*/
|
|
87
|
+
function virtualStoreDirSpellings(virtualStoreDir) {
|
|
88
|
+
const resolved = _path().default.resolve(virtualStoreDir);
|
|
89
|
+
let real;
|
|
90
|
+
try {
|
|
91
|
+
real = _fsExtra().default.realpathSync(resolved);
|
|
92
|
+
} catch {
|
|
93
|
+
return [resolved]; // not there yet (a first install, a lockfile-only run) - nothing is loaded from it either
|
|
94
|
+
}
|
|
95
|
+
return real === resolved ? [resolved] : [resolved, real];
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* the loaded module files (require.cache plus the recorded ESM loads) that live under the given
|
|
100
|
+
* virtual store, as the spelling of the store each one matched plus the path segments below it.
|
|
101
|
+
*/
|
|
102
|
+
function* loadedFilesUnderVirtualStore(virtualStoreDir) {
|
|
103
|
+
const stores = virtualStoreDirSpellings(virtualStoreDir).map(dir => ({
|
|
104
|
+
dir,
|
|
105
|
+
prefix: `${dir}${_path().default.sep}`
|
|
106
|
+
}));
|
|
107
|
+
for (const filename of loadedModuleFiles()) {
|
|
108
|
+
const store = stores.find(({
|
|
109
|
+
prefix
|
|
110
|
+
}) => filename.startsWith(prefix));
|
|
111
|
+
if (!store) continue;
|
|
112
|
+
yield {
|
|
113
|
+
storeDir: store.dir,
|
|
114
|
+
segments: filename.slice(store.prefix.length).split(_path().default.sep)
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* the virtual-store directories currently backing loaded modules (require.cache plus the recorded
|
|
120
|
+
* ESM loads), with the package each one holds. require.cache keys are realpaths, and the ESM
|
|
121
|
+
* recorder stores realpaths alongside the given spellings, so a module reached through a
|
|
122
|
+
* dependency symlink is attributed to the directory that really owns it.
|
|
123
|
+
*/
|
|
124
|
+
function snapshotLoadedVirtualStoreDirs(rootDir) {
|
|
125
|
+
const virtualStoreDir = _path().default.join(_path().default.resolve(rootDir), 'node_modules', '.pnpm');
|
|
126
|
+
const byDirName = new Map();
|
|
127
|
+
for (const {
|
|
128
|
+
storeDir,
|
|
129
|
+
segments
|
|
130
|
+
} of loadedFilesUnderVirtualStore(virtualStoreDir)) {
|
|
131
|
+
const dirName = segments[0];
|
|
132
|
+
if (!dirName) continue;
|
|
133
|
+
const pkgName = parsePkgName(segments);
|
|
134
|
+
if (!pkgName) continue;
|
|
135
|
+
// a slot also holds its dependencies, as symlinks under the same node_modules. a path that kept
|
|
136
|
+
// such a spelling instead of being realpathed (--preserve-symlinks, or an ESM load recorded by
|
|
137
|
+
// the name it was given) names the dependency, not the package the slot is keyed by - and a
|
|
138
|
+
// slot attributed to the wrong package finds no donor and never gets restored. prefer whichever
|
|
139
|
+
// loaded path names the owner, whatever order the paths arrive in; keep a non-owner attribution
|
|
140
|
+
// only as a fallback, for a slot named after something other than <pkg>@<version> (a tarball or
|
|
141
|
+
// git dependency), where no path can match and a restore was never possible anyway.
|
|
142
|
+
const previous = byDirName.get(dirName);
|
|
143
|
+
if (previous && (isSlotOfPkg(previous.dirName, previous.pkgName) || !isSlotOfPkg(dirName, pkgName))) continue;
|
|
144
|
+
// the dir is spelled the way the file that revealed it was, so the later existence check and
|
|
145
|
+
// restore address the same directory node reached the loaded module through
|
|
146
|
+
byDirName.set(dirName, {
|
|
147
|
+
dirName,
|
|
148
|
+
dirPath: _path().default.join(storeDir, dirName),
|
|
149
|
+
pkgName
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
return [...byDirName.values()];
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* restore every snapshotted directory the install removed, copying it from a directory holding the
|
|
157
|
+
* same name@version under a different peer hash. best-effort: a failure to restore leaves things no
|
|
158
|
+
* worse than without this module.
|
|
159
|
+
*
|
|
160
|
+
* restores run sequentially, deliberately: this sits right after every install, where the engine
|
|
161
|
+
* has just saturated the disk, and each restore is a recursive copy. the common case is zero
|
|
162
|
+
* removed directories (the checks are cheap), and when there are any, there are few - serial
|
|
163
|
+
* keeps the worst case from piling unbounded deep copies on top of each other in constrained
|
|
164
|
+
* CI/container environments.
|
|
165
|
+
*/
|
|
166
|
+
async function restoreRemovedLoadedVirtualStoreDirs(snapshot, logger) {
|
|
167
|
+
if (snapshot.length === 0) return;
|
|
168
|
+
const removed = [];
|
|
169
|
+
for (const dir of snapshot) {
|
|
170
|
+
// eslint-disable-next-line no-await-in-loop
|
|
171
|
+
if (!(await _fsExtra().default.pathExists(dir.dirPath))) removed.push(dir);
|
|
172
|
+
}
|
|
173
|
+
if (removed.length === 0) return;
|
|
174
|
+
const startTime = Date.now();
|
|
175
|
+
const virtualStoreDir = _path().default.dirname(removed[0].dirPath);
|
|
176
|
+
let currentDirs;
|
|
177
|
+
try {
|
|
178
|
+
currentDirs = await _fsExtra().default.readdir(virtualStoreDir);
|
|
179
|
+
} catch {
|
|
180
|
+
return; // no virtual store left (e.g. hoisted install) - nothing to restore from
|
|
181
|
+
}
|
|
182
|
+
let restored = 0;
|
|
183
|
+
for (const dir of removed) {
|
|
184
|
+
// eslint-disable-next-line no-await-in-loop
|
|
185
|
+
if (await restoreOneDir(dir, virtualStoreDir, currentDirs, logger)) restored += 1;
|
|
186
|
+
}
|
|
187
|
+
logger?.debug(`preserve-loaded-virtual-store-dirs: the install removed ${removed.length} loaded dir(s), restored ${restored} in ${Date.now() - startTime}ms`);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/** restore one removed directory from a same-version donor. returns whether a copy was made. */
|
|
191
|
+
async function restoreOneDir({
|
|
192
|
+
dirName,
|
|
193
|
+
dirPath,
|
|
194
|
+
pkgName
|
|
195
|
+
}, virtualStoreDir, currentDirs, logger) {
|
|
196
|
+
const donorDirName = findDonorDirName(dirName, pkgName, currentDirs);
|
|
197
|
+
if (!donorDirName) {
|
|
198
|
+
logger?.debug(`preserve-loaded-virtual-store-dirs: ${dirName} was removed by the install and no same-version donor exists; ` + `modules loaded from it may fail deferred requires`);
|
|
199
|
+
return false;
|
|
200
|
+
}
|
|
201
|
+
const donorPath = _path().default.join(virtualStoreDir, donorDirName);
|
|
202
|
+
try {
|
|
203
|
+
// guard against a donor that does not actually hold the package's files
|
|
204
|
+
if (!(await _fsExtra().default.pathExists(_path().default.join(donorPath, 'node_modules', pkgName)))) return false;
|
|
205
|
+
// dereference:false keeps the donor's dependency symlinks as symlinks; they are relative
|
|
206
|
+
// (../<other-dir>/node_modules/<dep>) and stay valid from the restored location.
|
|
207
|
+
await _fsExtra().default.copy(donorPath, dirPath, {
|
|
208
|
+
dereference: false,
|
|
209
|
+
overwrite: false,
|
|
210
|
+
errorOnExist: false
|
|
211
|
+
});
|
|
212
|
+
logger?.debug(`preserve-loaded-virtual-store-dirs: restored ${dirName} (loaded by this process, removed by the install) from ${donorDirName}`);
|
|
213
|
+
return true;
|
|
214
|
+
} catch (err) {
|
|
215
|
+
logger?.warn(`preserve-loaded-virtual-store-dirs: failed restoring ${dirName}: ${err.message}`);
|
|
216
|
+
return false;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* the directory names under the given virtual store that back loaded modules (require.cache plus
|
|
222
|
+
* the recorded ESM loads). used by pnpmPruneModules to leave alone what the running process is
|
|
223
|
+
* using.
|
|
224
|
+
*/
|
|
225
|
+
function loadedVirtualStoreDirNames(virtualStoreDir) {
|
|
226
|
+
const dirNames = new Set();
|
|
227
|
+
for (const {
|
|
228
|
+
segments
|
|
229
|
+
} of loadedFilesUnderVirtualStore(virtualStoreDir)) {
|
|
230
|
+
if (segments[0]) dirNames.add(segments[0]);
|
|
231
|
+
}
|
|
232
|
+
return dirNames;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* a directory holding the same name@version as the missing one, under a different peer hash.
|
|
237
|
+
* exported for tests.
|
|
238
|
+
*
|
|
239
|
+
* the version is read off the missing directory's own name rather than parsed structurally: the
|
|
240
|
+
* name is `<escaped-pkg-name>@<version>[_<suffix>]` where the escaped name (\/ replaced by +) is
|
|
241
|
+
* known exactly, and `_` cannot appear in a semver version, so everything between the name's `@`
|
|
242
|
+
* and the first `_` after it is the version.
|
|
243
|
+
*
|
|
244
|
+
* a donor is only equivalent if it holds the same files. differing peer sets do not affect them -
|
|
245
|
+
* they only change the sibling dependency symlinks - but a patch does, and pnpm encodes one in the
|
|
246
|
+
* same suffix as a `patch_hash=<hash>` segment. so a patched directory is never a donor for an
|
|
247
|
+
* unpatched one or for one patched differently: without the check, the process would go on reading
|
|
248
|
+
* files that do not match the modules it already loaded.
|
|
249
|
+
*/
|
|
250
|
+
function findDonorDirName(missingDirName, pkgName, currentDirs) {
|
|
251
|
+
if (!isSlotOfPkg(missingDirName, pkgName)) return undefined;
|
|
252
|
+
const namePrefix = slotNamePrefix(pkgName);
|
|
253
|
+
const version = missingDirName.slice(namePrefix.length).split('_')[0];
|
|
254
|
+
const exact = `${namePrefix}${version}`;
|
|
255
|
+
const wantedPatch = patchHashOf(missingDirName, exact);
|
|
256
|
+
return currentDirs.find(dir => dir !== missingDirName && (dir === exact || dir.startsWith(`${exact}_`)) && patchHashOf(dir, exact) === wantedPatch);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/** how a virtual-store dir name for the given package begins: the name with `/` escaped to `+` */
|
|
260
|
+
function slotNamePrefix(pkgName) {
|
|
261
|
+
return `${pkgName.replace(/\//g, '+')}@`;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/** whether the given virtual-store dir is the slot of the given package rather than of another */
|
|
265
|
+
function isSlotOfPkg(dirName, pkgName) {
|
|
266
|
+
return dirName.startsWith(slotNamePrefix(pkgName));
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/** the patch a virtual-store dir name encodes in the suffix following `<name>@<version>`, if any */
|
|
270
|
+
function patchHashOf(dirName, namePlusVersion) {
|
|
271
|
+
return dirName.slice(namePlusVersion.length).match(/(?:^|_)patch_hash=([^_]+)/)?.[1];
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/** the package name owning a file at .pnpm/<dir>/node_modules/<pkgName>/..., or undefined */
|
|
275
|
+
function parsePkgName(relativeSegments) {
|
|
276
|
+
// relativeSegments: [<dirName>, 'node_modules', <segment>, ...]
|
|
277
|
+
if (relativeSegments[1] !== 'node_modules') return undefined;
|
|
278
|
+
const first = relativeSegments[2];
|
|
279
|
+
if (!first) return undefined;
|
|
280
|
+
if (first.startsWith('@')) {
|
|
281
|
+
const second = relativeSegments[3];
|
|
282
|
+
return second ? `${first}/${second}` : undefined;
|
|
283
|
+
}
|
|
284
|
+
return first;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
//# sourceMappingURL=preserve-loaded-virtual-store-dirs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_fsExtra","data","_interopRequireDefault","require","_path","e","__esModule","default","LOADED_ESM_FILES","Symbol","for","loadedModuleFiles","Object","keys","cache","recordedEsmFiles","recorded","globalThis","iterator","filter","file","virtualStoreDirSpellings","virtualStoreDir","resolved","path","resolve","real","fs","realpathSync","loadedFilesUnderVirtualStore","stores","map","dir","prefix","sep","filename","store","find","startsWith","storeDir","segments","slice","length","split","snapshotLoadedVirtualStoreDirs","rootDir","join","byDirName","Map","dirName","pkgName","parsePkgName","previous","get","isSlotOfPkg","set","dirPath","values","restoreRemovedLoadedVirtualStoreDirs","snapshot","logger","removed","pathExists","push","startTime","Date","now","dirname","currentDirs","readdir","restored","restoreOneDir","debug","donorDirName","findDonorDirName","donorPath","copy","dereference","overwrite","errorOnExist","err","warn","message","loadedVirtualStoreDirNames","dirNames","Set","add","missingDirName","undefined","namePrefix","slotNamePrefix","version","exact","wantedPatch","patchHashOf","replace","namePlusVersion","match","relativeSegments","first","second"],"sources":["preserve-loaded-virtual-store-dirs.ts"],"sourcesContent":["import fs from 'fs-extra';\nimport path from 'path';\nimport type { Logger } from '@teambit/logger';\n\n/**\n * Keeps packages the running process has loaded from `node_modules/.pnpm` requireable across an\n * install that relocates them.\n *\n * pnpm keys a virtual-store directory by the package's peer-resolution hash, so an install that\n * changes the dependency set gives the same name@version a NEW directory and deletes the one this\n * process loaded its modules from. Node keeps the loaded module objects, but not the files - so any\n * require the loaded code deferred past load time resolves against the deleted directory and throws\n * MODULE_NOT_FOUND. Any package loaded out of the workspace's own virtual store is exposed to this,\n * and an env is the worst case: `@teambit/aspect`, for instance, defers\n * `require('./babel/babel-config')` until `getCompiler()` is called - which the install flow itself\n * does right after the package-manager run, when it compiles components and reloads envs. The whole\n * install then dies with `Cannot find module './babel/babel-config'`.\n *\n * Replacing the in-memory instances instead is not an option: every reload path (reloadMovedEnvs,\n * loading components as aspects) has to consult the registered env to do its work, and consulting\n * it is exactly what throws. So the fix follows the same rule an OS applies to a running binary's\n * deleted files: what the process has loaded stays available for the process's lifetime. The\n * snapshot records which virtual-store directories back modules in `require.cache`; after the\n * install, any of them that vanished is restored from its re-keyed twin - same name@version, new\n * peer hash - whose package content is identical (it comes from the same tarball; the peer set only\n * affects the dependency symlinks alongside it, which are relative and stay valid from the restored\n * location). A differently patched twin is not such a donor and `findDonorDirName` excludes it.\n *\n * The restored directory is intentionally absent from the lockfile. `pnpmPruneModules` skips\n * directories that back `require.cache` entries for the same reason this module exists, and a later\n * command's prune - whose process has nothing loaded from it - removes it.\n *\n * CJS modules are found in `require.cache`. ESM modules live in node's ESM module map, which has\n * no enumeration API, so aspect-loader records every file it loads through dynamic `import()` in a\n * `Symbol.for`-keyed global set (see aspect-loader's record-loaded-esm-file.ts, the writer side of\n * this contract - keep the two in sync; a symbol rather than an import because the dependency\n * between these packages runs the other way). For ESM only entry files are recorded, not their\n * transitive static imports - those are fully loaded into memory and are not re-read, while an\n * entry's own package directory, where deferred imports and config-file reads point, is restored\n * wholly.\n */\nconst LOADED_ESM_FILES = Symbol.for('bit.loaded-esm-module-files');\n\nfunction loadedModuleFiles(): string[] {\n return [...Object.keys(require.cache), ...recordedEsmFiles()];\n}\n\n/**\n * the ESM loads aspect-loader recorded. the contract is a global under a well-known symbol, so it\n * is held by convention rather than by types and anything could occupy the key - a value that is\n * not a set of paths is treated as absent rather than allowed to throw, since this runs inside\n * every install and prune, where CJS preservation still works without it.\n */\nfunction recordedEsmFiles(): string[] {\n const recorded = (globalThis as { [LOADED_ESM_FILES]?: unknown })[LOADED_ESM_FILES] as\n | Iterable<unknown>\n | undefined;\n if (!recorded || typeof recorded[Symbol.iterator] !== 'function') return [];\n return [...recorded].filter((file): file is string => typeof file === 'string');\n}\n\n/**\n * the spellings of the virtual store that loaded module paths can start with: the given one and its\n * realpath. node resolves a module's filename through its realpath, so the require.cache keys for a\n * workspace reached through a symlink - the normal case on macOS, where a temp dir under /var is\n * really under /private/var - are spelled differently from the rootDir the install was handed.\n * Comparing against the given spelling alone would match nothing there and silently turn the whole\n * preservation into a no-op. The given spelling is kept too, for --preserve-symlinks.\n */\nfunction virtualStoreDirSpellings(virtualStoreDir: string): string[] {\n const resolved = path.resolve(virtualStoreDir);\n let real: string;\n try {\n real = fs.realpathSync(resolved);\n } catch {\n return [resolved]; // not there yet (a first install, a lockfile-only run) - nothing is loaded from it either\n }\n return real === resolved ? [resolved] : [resolved, real];\n}\n\n/**\n * the loaded module files (require.cache plus the recorded ESM loads) that live under the given\n * virtual store, as the spelling of the store each one matched plus the path segments below it.\n */\nfunction* loadedFilesUnderVirtualStore(virtualStoreDir: string): Generator<{ storeDir: string; segments: string[] }> {\n const stores = virtualStoreDirSpellings(virtualStoreDir).map((dir) => ({ dir, prefix: `${dir}${path.sep}` }));\n for (const filename of loadedModuleFiles()) {\n const store = stores.find(({ prefix }) => filename.startsWith(prefix));\n if (!store) continue;\n yield { storeDir: store.dir, segments: filename.slice(store.prefix.length).split(path.sep) };\n }\n}\n\nexport interface LoadedVirtualStoreDir {\n /** directory name directly under node_modules/.pnpm, e.g. \"@teambit+aspect@1.0.1042_<peers>\" */\n dirName: string;\n /** absolute path of that directory */\n dirPath: string;\n /** name of the package the cached modules belong to, e.g. \"@teambit/aspect\" */\n pkgName: string;\n}\n\n/**\n * the virtual-store directories currently backing loaded modules (require.cache plus the recorded\n * ESM loads), with the package each one holds. require.cache keys are realpaths, and the ESM\n * recorder stores realpaths alongside the given spellings, so a module reached through a\n * dependency symlink is attributed to the directory that really owns it.\n */\nexport function snapshotLoadedVirtualStoreDirs(rootDir: string): LoadedVirtualStoreDir[] {\n const virtualStoreDir = path.join(path.resolve(rootDir), 'node_modules', '.pnpm');\n const byDirName = new Map<string, LoadedVirtualStoreDir>();\n for (const { storeDir, segments } of loadedFilesUnderVirtualStore(virtualStoreDir)) {\n const dirName = segments[0];\n if (!dirName) continue;\n const pkgName = parsePkgName(segments);\n if (!pkgName) continue;\n // a slot also holds its dependencies, as symlinks under the same node_modules. a path that kept\n // such a spelling instead of being realpathed (--preserve-symlinks, or an ESM load recorded by\n // the name it was given) names the dependency, not the package the slot is keyed by - and a\n // slot attributed to the wrong package finds no donor and never gets restored. prefer whichever\n // loaded path names the owner, whatever order the paths arrive in; keep a non-owner attribution\n // only as a fallback, for a slot named after something other than <pkg>@<version> (a tarball or\n // git dependency), where no path can match and a restore was never possible anyway.\n const previous = byDirName.get(dirName);\n if (previous && (isSlotOfPkg(previous.dirName, previous.pkgName) || !isSlotOfPkg(dirName, pkgName))) continue;\n // the dir is spelled the way the file that revealed it was, so the later existence check and\n // restore address the same directory node reached the loaded module through\n byDirName.set(dirName, { dirName, dirPath: path.join(storeDir, dirName), pkgName });\n }\n return [...byDirName.values()];\n}\n\n/**\n * restore every snapshotted directory the install removed, copying it from a directory holding the\n * same name@version under a different peer hash. best-effort: a failure to restore leaves things no\n * worse than without this module.\n *\n * restores run sequentially, deliberately: this sits right after every install, where the engine\n * has just saturated the disk, and each restore is a recursive copy. the common case is zero\n * removed directories (the checks are cheap), and when there are any, there are few - serial\n * keeps the worst case from piling unbounded deep copies on top of each other in constrained\n * CI/container environments.\n */\nexport async function restoreRemovedLoadedVirtualStoreDirs(\n snapshot: LoadedVirtualStoreDir[],\n logger?: Logger\n): Promise<void> {\n if (snapshot.length === 0) return;\n const removed: LoadedVirtualStoreDir[] = [];\n for (const dir of snapshot) {\n // eslint-disable-next-line no-await-in-loop\n if (!(await fs.pathExists(dir.dirPath))) removed.push(dir);\n }\n if (removed.length === 0) return;\n const startTime = Date.now();\n const virtualStoreDir = path.dirname(removed[0].dirPath);\n let currentDirs: string[];\n try {\n currentDirs = await fs.readdir(virtualStoreDir);\n } catch {\n return; // no virtual store left (e.g. hoisted install) - nothing to restore from\n }\n let restored = 0;\n for (const dir of removed) {\n // eslint-disable-next-line no-await-in-loop\n if (await restoreOneDir(dir, virtualStoreDir, currentDirs, logger)) restored += 1;\n }\n logger?.debug(\n `preserve-loaded-virtual-store-dirs: the install removed ${removed.length} loaded dir(s), restored ${restored} in ${\n Date.now() - startTime\n }ms`\n );\n}\n\n/** restore one removed directory from a same-version donor. returns whether a copy was made. */\nasync function restoreOneDir(\n { dirName, dirPath, pkgName }: LoadedVirtualStoreDir,\n virtualStoreDir: string,\n currentDirs: string[],\n logger?: Logger\n): Promise<boolean> {\n const donorDirName = findDonorDirName(dirName, pkgName, currentDirs);\n if (!donorDirName) {\n logger?.debug(\n `preserve-loaded-virtual-store-dirs: ${dirName} was removed by the install and no same-version donor exists; ` +\n `modules loaded from it may fail deferred requires`\n );\n return false;\n }\n const donorPath = path.join(virtualStoreDir, donorDirName);\n try {\n // guard against a donor that does not actually hold the package's files\n if (!(await fs.pathExists(path.join(donorPath, 'node_modules', pkgName)))) return false;\n // dereference:false keeps the donor's dependency symlinks as symlinks; they are relative\n // (../<other-dir>/node_modules/<dep>) and stay valid from the restored location.\n await fs.copy(donorPath, dirPath, { dereference: false, overwrite: false, errorOnExist: false });\n logger?.debug(\n `preserve-loaded-virtual-store-dirs: restored ${dirName} (loaded by this process, removed by the install) from ${donorDirName}`\n );\n return true;\n } catch (err: any) {\n logger?.warn(`preserve-loaded-virtual-store-dirs: failed restoring ${dirName}: ${err.message}`);\n return false;\n }\n}\n\n/**\n * the directory names under the given virtual store that back loaded modules (require.cache plus\n * the recorded ESM loads). used by pnpmPruneModules to leave alone what the running process is\n * using.\n */\nexport function loadedVirtualStoreDirNames(virtualStoreDir: string): Set<string> {\n const dirNames = new Set<string>();\n for (const { segments } of loadedFilesUnderVirtualStore(virtualStoreDir)) {\n if (segments[0]) dirNames.add(segments[0]);\n }\n return dirNames;\n}\n\n/**\n * a directory holding the same name@version as the missing one, under a different peer hash.\n * exported for tests.\n *\n * the version is read off the missing directory's own name rather than parsed structurally: the\n * name is `<escaped-pkg-name>@<version>[_<suffix>]` where the escaped name (\\/ replaced by +) is\n * known exactly, and `_` cannot appear in a semver version, so everything between the name's `@`\n * and the first `_` after it is the version.\n *\n * a donor is only equivalent if it holds the same files. differing peer sets do not affect them -\n * they only change the sibling dependency symlinks - but a patch does, and pnpm encodes one in the\n * same suffix as a `patch_hash=<hash>` segment. so a patched directory is never a donor for an\n * unpatched one or for one patched differently: without the check, the process would go on reading\n * files that do not match the modules it already loaded.\n */\nexport function findDonorDirName(missingDirName: string, pkgName: string, currentDirs: string[]): string | undefined {\n if (!isSlotOfPkg(missingDirName, pkgName)) return undefined;\n const namePrefix = slotNamePrefix(pkgName);\n const version = missingDirName.slice(namePrefix.length).split('_')[0];\n const exact = `${namePrefix}${version}`;\n const wantedPatch = patchHashOf(missingDirName, exact);\n return currentDirs.find(\n (dir) =>\n dir !== missingDirName &&\n (dir === exact || dir.startsWith(`${exact}_`)) &&\n patchHashOf(dir, exact) === wantedPatch\n );\n}\n\n/** how a virtual-store dir name for the given package begins: the name with `/` escaped to `+` */\nfunction slotNamePrefix(pkgName: string): string {\n return `${pkgName.replace(/\\//g, '+')}@`;\n}\n\n/** whether the given virtual-store dir is the slot of the given package rather than of another */\nfunction isSlotOfPkg(dirName: string, pkgName: string): boolean {\n return dirName.startsWith(slotNamePrefix(pkgName));\n}\n\n/** the patch a virtual-store dir name encodes in the suffix following `<name>@<version>`, if any */\nfunction patchHashOf(dirName: string, namePlusVersion: string): string | undefined {\n return dirName.slice(namePlusVersion.length).match(/(?:^|_)patch_hash=([^_]+)/)?.[1];\n}\n\n/** the package name owning a file at .pnpm/<dir>/node_modules/<pkgName>/..., or undefined */\nfunction parsePkgName(relativeSegments: string[]): string | undefined {\n // relativeSegments: [<dirName>, 'node_modules', <segment>, ...]\n if (relativeSegments[1] !== 'node_modules') return undefined;\n const first = relativeSegments[2];\n if (!first) return undefined;\n if (first.startsWith('@')) {\n const second = relativeSegments[3];\n return second ? `${first}/${second}` : undefined;\n }\n return first;\n}\n"],"mappings":";;;;;;;;;AAAA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,MAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,KAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAwB,SAAAC,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAGxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMG,gBAAgB,GAAGC,MAAM,CAACC,GAAG,CAAC,6BAA6B,CAAC;AAElE,SAASC,iBAAiBA,CAAA,EAAa;EACrC,OAAO,CAAC,GAAGC,MAAM,CAACC,IAAI,CAACV,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AAC+C,gBAA0B,EAAsB;EACpE;EACA,IAAIA,gBAAgB,CAAC,CAAC,CAAC,KAAK,cAAc,EAAE,OAAOV,SAAS;EAC5D,MAAMW,KAAK,GAAGD,gBAAgB,CAAC,CAAC,CAAC;EACjC,IAAI,CAACC,KAAK,EAAE,OAAOX,SAAS;EAC5B,IAAIW,KAAK,CAAC7D,UAAU,CAAC,GAAG,CAAC,EAAE;IACzB,MAAM8D,MAAM,GAAGF,gBAAgB,CAAC,CAAC,CAAC;IAClC,OAAOE,MAAM,GAAG,GAAGD,KAAK,IAAIC,MAAM,EAAE,GAAGZ,SAAS;EAClD;EACA,OAAOW,KAAK;AACd","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _chai() {
|
|
4
|
+
const data = require("chai");
|
|
5
|
+
_chai = function () {
|
|
6
|
+
return data;
|
|
7
|
+
};
|
|
8
|
+
return data;
|
|
9
|
+
}
|
|
10
|
+
function _fsExtra() {
|
|
11
|
+
const data = _interopRequireDefault(require("fs-extra"));
|
|
12
|
+
_fsExtra = function () {
|
|
13
|
+
return data;
|
|
14
|
+
};
|
|
15
|
+
return data;
|
|
16
|
+
}
|
|
17
|
+
function _os() {
|
|
18
|
+
const data = _interopRequireDefault(require("os"));
|
|
19
|
+
_os = function () {
|
|
20
|
+
return data;
|
|
21
|
+
};
|
|
22
|
+
return data;
|
|
23
|
+
}
|
|
24
|
+
function _path() {
|
|
25
|
+
const data = _interopRequireDefault(require("path"));
|
|
26
|
+
_path = function () {
|
|
27
|
+
return data;
|
|
28
|
+
};
|
|
29
|
+
return data;
|
|
30
|
+
}
|
|
31
|
+
function _preserveLoadedVirtualStoreDirs() {
|
|
32
|
+
const data = require("./preserve-loaded-virtual-store-dirs");
|
|
33
|
+
_preserveLoadedVirtualStoreDirs = function () {
|
|
34
|
+
return data;
|
|
35
|
+
};
|
|
36
|
+
return data;
|
|
37
|
+
}
|
|
38
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
39
|
+
describe('findDonorDirName()', () => {
|
|
40
|
+
it('should find a directory holding the same name@version under a different peer hash', () => {
|
|
41
|
+
const dirs = ['@teambit+aspect@1.0.1042_@apollo+client@3.14.1_452750bf6cbf39e91ae03fa2952ea516', '@teambit+aspect@1.0.1043_452750bf6cbf39e91ae03fa2952ea516', 'lodash@4.17.21'];
|
|
42
|
+
(0, _chai().expect)((0, _preserveLoadedVirtualStoreDirs().findDonorDirName)('@teambit+aspect@1.0.1042_fad919769e36a84e6cf4fd53cf9f0ee0', '@teambit/aspect', dirs)).to.equal('@teambit+aspect@1.0.1042_@apollo+client@3.14.1_452750bf6cbf39e91ae03fa2952ea516');
|
|
43
|
+
});
|
|
44
|
+
it('should accept a peerless directory as donor for a peer-hashed one', () => {
|
|
45
|
+
(0, _chai().expect)((0, _preserveLoadedVirtualStoreDirs().findDonorDirName)('@teambit+aspect@1.0.1042_fad9', '@teambit/aspect', ['@teambit+aspect@1.0.1042'])).to.equal('@teambit+aspect@1.0.1042');
|
|
46
|
+
});
|
|
47
|
+
it('should not match a different version', () => {
|
|
48
|
+
(0, _chai().expect)((0, _preserveLoadedVirtualStoreDirs().findDonorDirName)('@teambit+aspect@1.0.1042_fad9', '@teambit/aspect', ['@teambit+aspect@1.0.1043_fad9'])).to.equal(undefined);
|
|
49
|
+
});
|
|
50
|
+
it('should not match a version that merely starts with the wanted one', () => {
|
|
51
|
+
(0, _chai().expect)((0, _preserveLoadedVirtualStoreDirs().findDonorDirName)('lodash@4.17.2', 'lodash', ['lodash@4.17.21'])).to.equal(undefined);
|
|
52
|
+
});
|
|
53
|
+
it('should not return the missing directory itself', () => {
|
|
54
|
+
(0, _chai().expect)((0, _preserveLoadedVirtualStoreDirs().findDonorDirName)('lodash@4.17.21', 'lodash', ['lodash@4.17.21'])).to.equal(undefined);
|
|
55
|
+
});
|
|
56
|
+
it('should handle package names containing underscores', () => {
|
|
57
|
+
(0, _chai().expect)((0, _preserveLoadedVirtualStoreDirs().findDonorDirName)('weird_name@1.0.0_abc', 'weird_name', ['weird_name@1.0.0_def'])).to.equal('weird_name@1.0.0_def');
|
|
58
|
+
});
|
|
59
|
+
it('should not accept a patched directory as donor for an unpatched one', () => {
|
|
60
|
+
// a patch changes the package's own files, so the donor would not match the modules already
|
|
61
|
+
// loaded from the missing directory - unlike a differing peer set, which changes only the
|
|
62
|
+
// sibling symlinks
|
|
63
|
+
const dirs = ['foo@1.0.0_patch_hash=deadbeef', 'foo@1.0.0_patch_hash=deadbeef_react@18.0.0'];
|
|
64
|
+
(0, _chai().expect)((0, _preserveLoadedVirtualStoreDirs().findDonorDirName)('foo@1.0.0', 'foo', dirs)).to.equal(undefined);
|
|
65
|
+
});
|
|
66
|
+
it('should not accept a differently patched directory as donor', () => {
|
|
67
|
+
const dirs = ['foo@1.0.0_patch_hash=cafe', 'foo@1.0.0'];
|
|
68
|
+
(0, _chai().expect)((0, _preserveLoadedVirtualStoreDirs().findDonorDirName)('foo@1.0.0_patch_hash=deadbeef', 'foo', dirs)).to.equal(undefined);
|
|
69
|
+
});
|
|
70
|
+
it('should accept a same-patch directory under a different peer hash as donor', () => {
|
|
71
|
+
const dirs = ['foo@1.0.0_patch_hash=deadbeef_react@18.0.0', 'foo@1.0.0_patch_hash=cafe'];
|
|
72
|
+
(0, _chai().expect)((0, _preserveLoadedVirtualStoreDirs().findDonorDirName)('foo@1.0.0_patch_hash=deadbeef_react@17.0.0', 'foo', dirs)).to.equal('foo@1.0.0_patch_hash=deadbeef_react@18.0.0');
|
|
73
|
+
});
|
|
74
|
+
it('should handle prerelease versions', () => {
|
|
75
|
+
(0, _chai().expect)((0, _preserveLoadedVirtualStoreDirs().findDonorDirName)('typescript@5.0.0-beta_abc', 'typescript', ['typescript@5.0.0-beta_def'])).to.equal('typescript@5.0.0-beta_def');
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
describe('loaded-module scanning', () => {
|
|
79
|
+
const rootDir = _path().default.join(__dirname, 'fake-ws-for-spec');
|
|
80
|
+
const virtualStoreDir = _path().default.join(rootDir, 'node_modules', '.pnpm');
|
|
81
|
+
const dirName = '@teambit+aspect@1.0.1042_somehash';
|
|
82
|
+
const cachedFile = _path().default.join(virtualStoreDir, dirName, 'node_modules', '@teambit', 'aspect', 'dist', 'env.js');
|
|
83
|
+
const outsideFile = _path().default.join(rootDir, 'node_modules', '@teambit', 'other', 'index.js');
|
|
84
|
+
// the same global-set contract aspect-loader's record-loaded-esm-file.ts writes to
|
|
85
|
+
const LOADED_ESM_FILES = Symbol.for('bit.loaded-esm-module-files');
|
|
86
|
+
const esmDirName = '@my+esm-env@2.0.0_peerhash';
|
|
87
|
+
const esmFile = _path().default.join(virtualStoreDir, esmDirName, 'node_modules', '@my', 'esm-env', 'dist', 'index.mjs');
|
|
88
|
+
const globalRecord = globalThis;
|
|
89
|
+
let previousEsmSet;
|
|
90
|
+
before(() => {
|
|
91
|
+
// require.cache keys just need to exist; the files behind them do not
|
|
92
|
+
require.cache[cachedFile] = {};
|
|
93
|
+
require.cache[outsideFile] = {};
|
|
94
|
+
previousEsmSet = globalRecord[LOADED_ESM_FILES];
|
|
95
|
+
globalRecord[LOADED_ESM_FILES] = new Set([esmFile]);
|
|
96
|
+
});
|
|
97
|
+
after(() => {
|
|
98
|
+
delete require.cache[cachedFile];
|
|
99
|
+
delete require.cache[outsideFile];
|
|
100
|
+
if (previousEsmSet) globalRecord[LOADED_ESM_FILES] = previousEsmSet;else delete globalRecord[LOADED_ESM_FILES];
|
|
101
|
+
});
|
|
102
|
+
it('snapshotLoadedVirtualStoreDirs() should attribute a cached file to its slot dir and package', () => {
|
|
103
|
+
const snapshot = (0, _preserveLoadedVirtualStoreDirs().snapshotLoadedVirtualStoreDirs)(rootDir);
|
|
104
|
+
const entry = snapshot.find(dir => dir.dirName === dirName);
|
|
105
|
+
(0, _chai().expect)(entry).to.not.equal(undefined);
|
|
106
|
+
(0, _chai().expect)(entry.pkgName).to.equal('@teambit/aspect');
|
|
107
|
+
(0, _chai().expect)(entry.dirPath).to.equal(_path().default.join(virtualStoreDir, dirName));
|
|
108
|
+
});
|
|
109
|
+
it('snapshotLoadedVirtualStoreDirs() should include recorded ESM loads', () => {
|
|
110
|
+
const snapshot = (0, _preserveLoadedVirtualStoreDirs().snapshotLoadedVirtualStoreDirs)(rootDir);
|
|
111
|
+
const entry = snapshot.find(dir => dir.dirName === esmDirName);
|
|
112
|
+
(0, _chai().expect)(entry).to.not.equal(undefined);
|
|
113
|
+
(0, _chai().expect)(entry.pkgName).to.equal('@my/esm-env');
|
|
114
|
+
});
|
|
115
|
+
it('snapshotLoadedVirtualStoreDirs() should ignore cached files outside the virtual store', () => {
|
|
116
|
+
const snapshot = (0, _preserveLoadedVirtualStoreDirs().snapshotLoadedVirtualStoreDirs)(rootDir);
|
|
117
|
+
(0, _chai().expect)(snapshot).to.have.lengthOf(2);
|
|
118
|
+
});
|
|
119
|
+
it('loadedVirtualStoreDirNames() should return CJS and ESM slot dir names', () => {
|
|
120
|
+
(0, _chai().expect)([...(0, _preserveLoadedVirtualStoreDirs().loadedVirtualStoreDirNames)(virtualStoreDir)].sort()).to.deep.equal([dirName, esmDirName].sort());
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
describe('a slot whose dependency was loaded through its symlink spelling', () => {
|
|
124
|
+
// a slot holds its dependencies as symlinks under the same node_modules. a path that kept that
|
|
125
|
+
// spelling instead of being realpathed names the dependency, while the slot is keyed by its owner
|
|
126
|
+
const rootDir = _path().default.join(__dirname, 'fake-ws-for-symlinked-dep-spec');
|
|
127
|
+
const virtualStoreDir = _path().default.join(rootDir, 'node_modules', '.pnpm');
|
|
128
|
+
const dirName = '@teambit+aspect@1.0.1042_somehash';
|
|
129
|
+
const depFile = _path().default.join(virtualStoreDir, dirName, 'node_modules', 'lodash', 'index.js');
|
|
130
|
+
const ownerFile = _path().default.join(virtualStoreDir, dirName, 'node_modules', '@teambit', 'aspect', 'dist', 'env.js');
|
|
131
|
+
afterEach(() => {
|
|
132
|
+
delete require.cache[depFile];
|
|
133
|
+
delete require.cache[ownerFile];
|
|
134
|
+
});
|
|
135
|
+
it('should attribute the slot to its owner even when the dependency was seen first', () => {
|
|
136
|
+
require.cache[depFile] = {};
|
|
137
|
+
require.cache[ownerFile] = {};
|
|
138
|
+
const snapshot = (0, _preserveLoadedVirtualStoreDirs().snapshotLoadedVirtualStoreDirs)(rootDir);
|
|
139
|
+
(0, _chai().expect)(snapshot).to.have.lengthOf(1);
|
|
140
|
+
// attributing it to lodash would leave findDonorDirName() unable to match the slot, so the
|
|
141
|
+
// removed directory would never be restored
|
|
142
|
+
(0, _chai().expect)(snapshot[0].pkgName).to.equal('@teambit/aspect');
|
|
143
|
+
(0, _chai().expect)((0, _preserveLoadedVirtualStoreDirs().findDonorDirName)(dirName, snapshot[0].pkgName, [`@teambit+aspect@1.0.1042_otherhash`])).to.equal('@teambit+aspect@1.0.1042_otherhash');
|
|
144
|
+
});
|
|
145
|
+
it('should fall back to the only package it saw when none names the slot', () => {
|
|
146
|
+
// a slot named after something other than <pkg>@<version> - a tarball or git dependency - which
|
|
147
|
+
// no loaded path can match and which was never restorable anyway
|
|
148
|
+
const tarballDir = 'foo.tgz_hash';
|
|
149
|
+
const tarballFile = _path().default.join(virtualStoreDir, tarballDir, 'node_modules', 'foo', 'index.js');
|
|
150
|
+
require.cache[tarballFile] = {};
|
|
151
|
+
try {
|
|
152
|
+
const entry = (0, _preserveLoadedVirtualStoreDirs().snapshotLoadedVirtualStoreDirs)(rootDir).find(dir => dir.dirName === tarballDir);
|
|
153
|
+
(0, _chai().expect)(entry?.pkgName).to.equal('foo');
|
|
154
|
+
} finally {
|
|
155
|
+
delete require.cache[tarballFile];
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
describe('a global ESM record of the wrong type', () => {
|
|
160
|
+
// the record is a global under a well-known symbol, so nothing stops another party from
|
|
161
|
+
// occupying the key. an install must not die over it
|
|
162
|
+
const LOADED_ESM_FILES = Symbol.for('bit.loaded-esm-module-files');
|
|
163
|
+
const globalRecord = globalThis;
|
|
164
|
+
const rootDir = _path().default.join(__dirname, 'fake-ws-for-spec');
|
|
165
|
+
let previousEsmSet;
|
|
166
|
+
before(() => {
|
|
167
|
+
previousEsmSet = globalRecord[LOADED_ESM_FILES];
|
|
168
|
+
});
|
|
169
|
+
afterEach(() => {
|
|
170
|
+
delete globalRecord[LOADED_ESM_FILES];
|
|
171
|
+
});
|
|
172
|
+
after(() => {
|
|
173
|
+
if (previousEsmSet) globalRecord[LOADED_ESM_FILES] = previousEsmSet;else delete globalRecord[LOADED_ESM_FILES];
|
|
174
|
+
});
|
|
175
|
+
it('should be ignored rather than thrown over', () => {
|
|
176
|
+
globalRecord[LOADED_ESM_FILES] = {
|
|
177
|
+
not: 'a set'
|
|
178
|
+
};
|
|
179
|
+
(0, _chai().expect)(() => (0, _preserveLoadedVirtualStoreDirs().snapshotLoadedVirtualStoreDirs)(rootDir)).to.not.throw();
|
|
180
|
+
(0, _chai().expect)(() => (0, _preserveLoadedVirtualStoreDirs().loadedVirtualStoreDirNames)(_path().default.join(rootDir, 'node_modules', '.pnpm'))).to.not.throw();
|
|
181
|
+
});
|
|
182
|
+
it('should keep the entries that are paths when the record holds mixed values', () => {
|
|
183
|
+
const dirName = 'lodash@4.17.21';
|
|
184
|
+
const file = _path().default.join(rootDir, 'node_modules', '.pnpm', dirName, 'node_modules', 'lodash', 'index.js');
|
|
185
|
+
globalRecord[LOADED_ESM_FILES] = new Set([42, file]);
|
|
186
|
+
(0, _chai().expect)([...(0, _preserveLoadedVirtualStoreDirs().loadedVirtualStoreDirNames)(_path().default.join(rootDir, 'node_modules', '.pnpm'))]).to.deep.equal([dirName]);
|
|
187
|
+
});
|
|
188
|
+
});
|
|
189
|
+
describe('loaded-module scanning in a workspace reached through a symlink', () => {
|
|
190
|
+
// node resolves a module's filename through its realpath, so require.cache is keyed by the real
|
|
191
|
+
// spelling even when the install was handed the symlinked one. this is the everyday case on
|
|
192
|
+
// macOS, where a temp dir under /var is really under /private/var.
|
|
193
|
+
const tmpDir = _fsExtra().default.realpathSync(_os().default.tmpdir());
|
|
194
|
+
const realRoot = _path().default.join(tmpDir, 'preserve-loaded-vsd-spec-real');
|
|
195
|
+
const linkedRoot = _path().default.join(tmpDir, 'preserve-loaded-vsd-spec-link');
|
|
196
|
+
const dirName = '@teambit+aspect@1.0.1042_somehash';
|
|
197
|
+
const realSlotDir = _path().default.join(realRoot, 'node_modules', '.pnpm', dirName);
|
|
198
|
+
const realCachedFile = _path().default.join(realSlotDir, 'node_modules', '@teambit', 'aspect', 'dist', 'env.js');
|
|
199
|
+
let symlinksSupported = true;
|
|
200
|
+
before(() => {
|
|
201
|
+
_fsExtra().default.removeSync(linkedRoot);
|
|
202
|
+
_fsExtra().default.removeSync(realRoot);
|
|
203
|
+
_fsExtra().default.mkdirpSync(_path().default.dirname(realCachedFile));
|
|
204
|
+
try {
|
|
205
|
+
_fsExtra().default.symlinkSync(realRoot, linkedRoot, 'dir');
|
|
206
|
+
} catch {
|
|
207
|
+
symlinksSupported = false; // unprivileged Windows
|
|
208
|
+
}
|
|
209
|
+
require.cache[realCachedFile] = {};
|
|
210
|
+
});
|
|
211
|
+
after(() => {
|
|
212
|
+
delete require.cache[realCachedFile];
|
|
213
|
+
_fsExtra().default.removeSync(linkedRoot);
|
|
214
|
+
_fsExtra().default.removeSync(realRoot);
|
|
215
|
+
});
|
|
216
|
+
it('snapshotLoadedVirtualStoreDirs() should find a slot loaded by its realpath', function () {
|
|
217
|
+
if (!symlinksSupported) this.skip();
|
|
218
|
+
const snapshot = (0, _preserveLoadedVirtualStoreDirs().snapshotLoadedVirtualStoreDirs)(linkedRoot);
|
|
219
|
+
(0, _chai().expect)(snapshot.map(dir => dir.dirName)).to.deep.equal([dirName]);
|
|
220
|
+
(0, _chai().expect)(snapshot[0].pkgName).to.equal('@teambit/aspect');
|
|
221
|
+
// the recorded path addresses the same directory the module was loaded from, so the existence
|
|
222
|
+
// check and the restore that follow act on it rather than on a path that never matched
|
|
223
|
+
(0, _chai().expect)(_fsExtra().default.realpathSync(snapshot[0].dirPath)).to.equal(realSlotDir);
|
|
224
|
+
});
|
|
225
|
+
it('loadedVirtualStoreDirNames() should find it through the symlinked spelling', function () {
|
|
226
|
+
if (!symlinksSupported) this.skip();
|
|
227
|
+
const dirNames = (0, _preserveLoadedVirtualStoreDirs().loadedVirtualStoreDirNames)(_path().default.join(linkedRoot, 'node_modules', '.pnpm'));
|
|
228
|
+
(0, _chai().expect)([...dirNames]).to.deep.equal([dirName]);
|
|
229
|
+
});
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
//# sourceMappingURL=preserve-loaded-virtual-store-dirs.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_chai","data","require","_fsExtra","_interopRequireDefault","_os","_path","_preserveLoadedVirtualStoreDirs","e","__esModule","default","describe","it","dirs","expect","findDonorDirName","to","equal","undefined","rootDir","path","join","__dirname","virtualStoreDir","dirName","cachedFile","outsideFile","LOADED_ESM_FILES","Symbol","for","esmDirName","esmFile","globalRecord","globalThis","previousEsmSet","before","cache","Set","after","snapshot","snapshotLoadedVirtualStoreDirs","entry","find","dir","not","pkgName","dirPath","have","lengthOf","loadedVirtualStoreDirNames","sort","deep","depFile","ownerFile","afterEach","tarballDir","tarballFile","throw","file","tmpDir","fs","realpathSync","os","tmpdir","realRoot","linkedRoot","realSlotDir","realCachedFile","symlinksSupported","removeSync","mkdirpSync","dirname","symlinkSync","skip","map","dirNames"],"sources":["preserve-loaded-virtual-store-dirs.spec.ts"],"sourcesContent":["import { expect } from 'chai';\nimport fs from 'fs-extra';\nimport os from 'os';\nimport path from 'path';\nimport {\n findDonorDirName,\n loadedVirtualStoreDirNames,\n snapshotLoadedVirtualStoreDirs,\n} from './preserve-loaded-virtual-store-dirs';\n\ndescribe('findDonorDirName()', () => {\n it('should find a directory holding the same name@version under a different peer hash', () => {\n const dirs = [\n '@teambit+aspect@1.0.1042_@apollo+client@3.14.1_452750bf6cbf39e91ae03fa2952ea516',\n '@teambit+aspect@1.0.1043_452750bf6cbf39e91ae03fa2952ea516',\n 'lodash@4.17.21',\n ];\n expect(\n findDonorDirName('@teambit+aspect@1.0.1042_fad919769e36a84e6cf4fd53cf9f0ee0', '@teambit/aspect', dirs)\n ).to.equal('@teambit+aspect@1.0.1042_@apollo+client@3.14.1_452750bf6cbf39e91ae03fa2952ea516');\n });\n it('should accept a peerless directory as donor for a peer-hashed one', () => {\n expect(findDonorDirName('@teambit+aspect@1.0.1042_fad9', '@teambit/aspect', ['@teambit+aspect@1.0.1042'])).to.equal(\n '@teambit+aspect@1.0.1042'\n );\n });\n it('should not match a different version', () => {\n expect(\n findDonorDirName('@teambit+aspect@1.0.1042_fad9', '@teambit/aspect', ['@teambit+aspect@1.0.1043_fad9'])\n ).to.equal(undefined);\n });\n it('should not match a version that merely starts with the wanted one', () => {\n expect(findDonorDirName('lodash@4.17.2', 'lodash', ['lodash@4.17.21'])).to.equal(undefined);\n });\n it('should not return the missing directory itself', () => {\n expect(findDonorDirName('lodash@4.17.21', 'lodash', ['lodash@4.17.21'])).to.equal(undefined);\n });\n it('should handle package names containing underscores', () => {\n expect(findDonorDirName('weird_name@1.0.0_abc', 'weird_name', ['weird_name@1.0.0_def'])).to.equal(\n 'weird_name@1.0.0_def'\n );\n });\n it('should not accept a patched directory as donor for an unpatched one', () => {\n // a patch changes the package's own files, so the donor would not match the modules already\n // loaded from the missing directory - unlike a differing peer set, which changes only the\n // sibling symlinks\n const dirs = ['foo@1.0.0_patch_hash=deadbeef', 'foo@1.0.0_patch_hash=deadbeef_react@18.0.0'];\n expect(findDonorDirName('foo@1.0.0', 'foo', dirs)).to.equal(undefined);\n });\n it('should not accept a differently patched directory as donor', () => {\n const dirs = ['foo@1.0.0_patch_hash=cafe', 'foo@1.0.0'];\n expect(findDonorDirName('foo@1.0.0_patch_hash=deadbeef', 'foo', dirs)).to.equal(undefined);\n });\n it('should accept a same-patch directory under a different peer hash as donor', () => {\n const dirs = ['foo@1.0.0_patch_hash=deadbeef_react@18.0.0', 'foo@1.0.0_patch_hash=cafe'];\n expect(findDonorDirName('foo@1.0.0_patch_hash=deadbeef_react@17.0.0', 'foo', dirs)).to.equal(\n 'foo@1.0.0_patch_hash=deadbeef_react@18.0.0'\n );\n });\n it('should handle prerelease versions', () => {\n expect(findDonorDirName('typescript@5.0.0-beta_abc', 'typescript', ['typescript@5.0.0-beta_def'])).to.equal(\n 'typescript@5.0.0-beta_def'\n );\n });\n});\n\ndescribe('loaded-module scanning', () => {\n const rootDir = path.join(__dirname, 'fake-ws-for-spec');\n const virtualStoreDir = path.join(rootDir, 'node_modules', '.pnpm');\n const dirName = '@teambit+aspect@1.0.1042_somehash';\n const cachedFile = path.join(virtualStoreDir, dirName, 'node_modules', '@teambit', 'aspect', 'dist', 'env.js');\n const outsideFile = path.join(rootDir, 'node_modules', '@teambit', 'other', 'index.js');\n // the same global-set contract aspect-loader's record-loaded-esm-file.ts writes to\n const LOADED_ESM_FILES = Symbol.for('bit.loaded-esm-module-files');\n const esmDirName = '@my+esm-env@2.0.0_peerhash';\n const esmFile = path.join(virtualStoreDir, esmDirName, 'node_modules', '@my', 'esm-env', 'dist', 'index.mjs');\n const globalRecord = globalThis as { [LOADED_ESM_FILES]?: Set<string> };\n let previousEsmSet: Set<string> | undefined;\n\n before(() => {\n // require.cache keys just need to exist; the files behind them do not\n require.cache[cachedFile] = {} as any;\n require.cache[outsideFile] = {} as any;\n previousEsmSet = globalRecord[LOADED_ESM_FILES];\n globalRecord[LOADED_ESM_FILES] = new Set([esmFile]);\n });\n after(() => {\n delete require.cache[cachedFile];\n delete require.cache[outsideFile];\n if (previousEsmSet) globalRecord[LOADED_ESM_FILES] = previousEsmSet;\n else delete globalRecord[LOADED_ESM_FILES];\n });\n\n it('snapshotLoadedVirtualStoreDirs() should attribute a cached file to its slot dir and package', () => {\n const snapshot = snapshotLoadedVirtualStoreDirs(rootDir);\n const entry = snapshot.find((dir) => dir.dirName === dirName);\n expect(entry).to.not.equal(undefined);\n expect(entry!.pkgName).to.equal('@teambit/aspect');\n expect(entry!.dirPath).to.equal(path.join(virtualStoreDir, dirName));\n });\n it('snapshotLoadedVirtualStoreDirs() should include recorded ESM loads', () => {\n const snapshot = snapshotLoadedVirtualStoreDirs(rootDir);\n const entry = snapshot.find((dir) => dir.dirName === esmDirName);\n expect(entry).to.not.equal(undefined);\n expect(entry!.pkgName).to.equal('@my/esm-env');\n });\n it('snapshotLoadedVirtualStoreDirs() should ignore cached files outside the virtual store', () => {\n const snapshot = snapshotLoadedVirtualStoreDirs(rootDir);\n expect(snapshot).to.have.lengthOf(2);\n });\n it('loadedVirtualStoreDirNames() should return CJS and ESM slot dir names', () => {\n expect([...loadedVirtualStoreDirNames(virtualStoreDir)].sort()).to.deep.equal([dirName, esmDirName].sort());\n });\n});\n\ndescribe('a slot whose dependency was loaded through its symlink spelling', () => {\n // a slot holds its dependencies as symlinks under the same node_modules. a path that kept that\n // spelling instead of being realpathed names the dependency, while the slot is keyed by its owner\n const rootDir = path.join(__dirname, 'fake-ws-for-symlinked-dep-spec');\n const virtualStoreDir = path.join(rootDir, 'node_modules', '.pnpm');\n const dirName = '@teambit+aspect@1.0.1042_somehash';\n const depFile = path.join(virtualStoreDir, dirName, 'node_modules', 'lodash', 'index.js');\n const ownerFile = path.join(virtualStoreDir, dirName, 'node_modules', '@teambit', 'aspect', 'dist', 'env.js');\n\n afterEach(() => {\n delete require.cache[depFile];\n delete require.cache[ownerFile];\n });\n\n it('should attribute the slot to its owner even when the dependency was seen first', () => {\n require.cache[depFile] = {} as any;\n require.cache[ownerFile] = {} as any;\n const snapshot = snapshotLoadedVirtualStoreDirs(rootDir);\n expect(snapshot).to.have.lengthOf(1);\n // attributing it to lodash would leave findDonorDirName() unable to match the slot, so the\n // removed directory would never be restored\n expect(snapshot[0].pkgName).to.equal('@teambit/aspect');\n expect(findDonorDirName(dirName, snapshot[0].pkgName, [`@teambit+aspect@1.0.1042_otherhash`])).to.equal(\n '@teambit+aspect@1.0.1042_otherhash'\n );\n });\n it('should fall back to the only package it saw when none names the slot', () => {\n // a slot named after something other than <pkg>@<version> - a tarball or git dependency - which\n // no loaded path can match and which was never restorable anyway\n const tarballDir = 'foo.tgz_hash';\n const tarballFile = path.join(virtualStoreDir, tarballDir, 'node_modules', 'foo', 'index.js');\n require.cache[tarballFile] = {} as any;\n try {\n const entry = snapshotLoadedVirtualStoreDirs(rootDir).find((dir) => dir.dirName === tarballDir);\n expect(entry?.pkgName).to.equal('foo');\n } finally {\n delete require.cache[tarballFile];\n }\n });\n});\n\ndescribe('a global ESM record of the wrong type', () => {\n // the record is a global under a well-known symbol, so nothing stops another party from\n // occupying the key. an install must not die over it\n const LOADED_ESM_FILES = Symbol.for('bit.loaded-esm-module-files');\n const globalRecord = globalThis as { [LOADED_ESM_FILES]?: unknown };\n const rootDir = path.join(__dirname, 'fake-ws-for-spec');\n let previousEsmSet: unknown;\n\n before(() => {\n previousEsmSet = globalRecord[LOADED_ESM_FILES];\n });\n afterEach(() => {\n delete globalRecord[LOADED_ESM_FILES];\n });\n after(() => {\n if (previousEsmSet) globalRecord[LOADED_ESM_FILES] = previousEsmSet;\n else delete globalRecord[LOADED_ESM_FILES];\n });\n\n it('should be ignored rather than thrown over', () => {\n globalRecord[LOADED_ESM_FILES] = { not: 'a set' };\n expect(() => snapshotLoadedVirtualStoreDirs(rootDir)).to.not.throw();\n expect(() => loadedVirtualStoreDirNames(path.join(rootDir, 'node_modules', '.pnpm'))).to.not.throw();\n });\n it('should keep the entries that are paths when the record holds mixed values', () => {\n const dirName = 'lodash@4.17.21';\n const file = path.join(rootDir, 'node_modules', '.pnpm', dirName, 'node_modules', 'lodash', 'index.js');\n globalRecord[LOADED_ESM_FILES] = new Set([42, file]);\n expect([...loadedVirtualStoreDirNames(path.join(rootDir, 'node_modules', '.pnpm'))]).to.deep.equal([dirName]);\n });\n});\n\ndescribe('loaded-module scanning in a workspace reached through a symlink', () => {\n // node resolves a module's filename through its realpath, so require.cache is keyed by the real\n // spelling even when the install was handed the symlinked one. this is the everyday case on\n // macOS, where a temp dir under /var is really under /private/var.\n const tmpDir = fs.realpathSync(os.tmpdir());\n const realRoot = path.join(tmpDir, 'preserve-loaded-vsd-spec-real');\n const linkedRoot = path.join(tmpDir, 'preserve-loaded-vsd-spec-link');\n const dirName = '@teambit+aspect@1.0.1042_somehash';\n const realSlotDir = path.join(realRoot, 'node_modules', '.pnpm', dirName);\n const realCachedFile = path.join(realSlotDir, 'node_modules', '@teambit', 'aspect', 'dist', 'env.js');\n let symlinksSupported = true;\n\n before(() => {\n fs.removeSync(linkedRoot);\n fs.removeSync(realRoot);\n fs.mkdirpSync(path.dirname(realCachedFile));\n try {\n fs.symlinkSync(realRoot, linkedRoot, 'dir');\n } catch {\n symlinksSupported = false; // unprivileged Windows\n }\n require.cache[realCachedFile] = {} as any;\n });\n after(() => {\n delete require.cache[realCachedFile];\n fs.removeSync(linkedRoot);\n fs.removeSync(realRoot);\n });\n\n it('snapshotLoadedVirtualStoreDirs() should find a slot loaded by its realpath', function () {\n if (!symlinksSupported) this.skip();\n const snapshot = snapshotLoadedVirtualStoreDirs(linkedRoot);\n expect(snapshot.map((dir) => dir.dirName)).to.deep.equal([dirName]);\n expect(snapshot[0].pkgName).to.equal('@teambit/aspect');\n // the recorded path addresses the same directory the module was loaded from, so the existence\n // check and the restore that follow act on it rather than on a path that never matched\n expect(fs.realpathSync(snapshot[0].dirPath)).to.equal(realSlotDir);\n });\n it('loadedVirtualStoreDirNames() should find it through the symlinked spelling', function () {\n if (!symlinksSupported) this.skip();\n const dirNames = loadedVirtualStoreDirNames(path.join(linkedRoot, 'node_modules', '.pnpm'));\n expect([...dirNames]).to.deep.equal([dirName]);\n });\n});\n"],"mappings":";;AAAA,SAAAA,MAAA;EAAA,MAAAC,I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CAAC,CAAC,CAAC,CAACM,OAAO,CAAC,CAAC7B,EAAE,CAACC,KAAK,CAAC,iBAAiB,CAAC;IACvD;IACA;IACA,IAAAH,cAAM,EAAC8C,kBAAE,CAACC,YAAY,CAACtB,QAAQ,CAAC,CAAC,CAAC,CAACO,OAAO,CAAC,CAAC,CAAC9B,EAAE,CAACC,KAAK,CAACiD,WAAW,CAAC;EACpE,CAAC,CAAC;EACFtD,EAAE,CAAC,4EAA4E,EAAE,YAAY;IAC3F,IAAI,CAACwD,iBAAiB,EAAE,IAAI,CAACK,IAAI,CAAC,CAAC;IACnC,MAAME,QAAQ,GAAG,IAAA1B,4DAA0B,EAAC7B,eAAI,CAACC,IAAI,CAAC4C,UAAU,EAAE,cAAc,EAAE,OAAO,CAAC,CAAC;IAC3F,IAAAnD,cAAM,EAAC,CAAC,GAAG6D,QAAQ,CAAC,CAAC,CAAC3D,EAAE,CAACmC,IAAI,CAAClC,KAAK,CAAC,CAACO,OAAO,CAAC,CAAC;EAChD,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.dependencies_pnpm@1.0.
|
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.dependencies_pnpm@1.0.
|
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.dependencies_pnpm@1.0.1138/dist/pnpm.composition.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.dependencies_pnpm@1.0.1138/dist/pnpm.docs.mdx';
|
|
3
3
|
|
|
4
4
|
export const compositions = [compositions_0];
|
|
5
5
|
export const overview = [overview_0];
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/pnpm",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1138",
|
|
4
4
|
"homepage": "https://bit.cloud/teambit/dependencies/pnpm",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.dependencies",
|
|
8
8
|
"name": "pnpm",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.1138"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@pnpm/napi": "12.0.0-rc.1",
|
|
@@ -30,20 +30,20 @@
|
|
|
30
30
|
"@pnpm/lockfile.filtering": "1100.2.2",
|
|
31
31
|
"@teambit/bit-error": "0.0.404",
|
|
32
32
|
"@teambit/component-package-version": "0.0.460",
|
|
33
|
+
"@teambit/logger": "0.0.1457",
|
|
33
34
|
"@teambit/dependencies.pnpm.dep-path": "1.0.1",
|
|
35
|
+
"@teambit/legacy.constants": "0.0.41",
|
|
34
36
|
"@teambit/pkg.entities.registry": "0.0.4",
|
|
35
37
|
"@teambit/harmony": "0.4.12",
|
|
36
|
-
"@teambit/ui-foundation.ui.use-box.menu": "1.0.16",
|
|
37
|
-
"@teambit/dependency-resolver": "1.0.1097",
|
|
38
|
-
"@teambit/objects": "0.0.604",
|
|
39
|
-
"@teambit/logger": "0.0.1457",
|
|
40
|
-
"@teambit/legacy.constants": "0.0.41",
|
|
41
38
|
"@teambit/cli": "0.0.1364",
|
|
42
|
-
"@teambit/cloud": "0.0.1396",
|
|
43
39
|
"@teambit/harmony.modules.feature-toggle": "0.0.53",
|
|
44
40
|
"@teambit/legacy.logger": "0.0.56",
|
|
45
|
-
"@teambit/
|
|
46
|
-
"@teambit/
|
|
41
|
+
"@teambit/ui-foundation.ui.use-box.menu": "1.0.16",
|
|
42
|
+
"@teambit/dependency-resolver": "1.0.1099",
|
|
43
|
+
"@teambit/objects": "0.0.606",
|
|
44
|
+
"@teambit/cloud": "0.0.1398",
|
|
45
|
+
"@teambit/component": "1.0.1099",
|
|
46
|
+
"@teambit/ui": "1.0.1099"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@types/lodash": "4.14.165",
|