| 1 | --- pnpm.mjs |
| 2 | +++ pnpm-target-cache.mjs |
| 3 | @@ -155612,7 +155612,7 @@ |
| 4 | } |
| 5 | function calcDepState(depsGraph, cache, depPath, opts3) { |
| 6 | const ownPin = readSnapshotRuntimePin(depsGraph[depPath]?.children); |
| 7 | - let result2 = engineName(ownPin ?? opts3.nodeVersion); |
| 8 | + let result2 = opts3.includeDepGraphHash ? "darwin;arm64;node26" : engineName(ownPin ?? opts3.nodeVersion); |
| 9 | if (opts3.includeDepGraphHash) { |
| 10 | const depGraphHash = calcDepGraphHash(depsGraph, cache, /* @__PURE__ */ new Set(), depPath, opts3.supportedArchitectures); |
| 11 | result2 += `;deps=${depGraphHash}`; |
| 12 | @@ -163136,12 +163136,7 @@ |
| 13 | unsafePerm: opts3.unsafePerm || false, |
| 14 | userAgent: opts3.userAgent |
| 15 | }; |
| 16 | - await runLifecycleHooksConcurrently(["preinstall", "install", "postinstall", "prepublish", "prepare"], Object.values(ctx.projects), opts3.childConcurrency || 5, scriptsOpts); |
| 17 | - for (const { id, manifest } of Object.values(ctx.projects)) { |
| 18 | - if (manifest?.scripts != null && (!opts3.pending || ctx.pendingBuilds.includes(id))) { |
| 19 | - ctx.pendingBuilds.splice(ctx.pendingBuilds.indexOf(id), 1); |
| 20 | - } |
| 21 | - } |
| 22 | + process.stderr.write(JSON.stringify({guestPending:ctx.pendingBuilds})+"\n"); |
| 23 | await writeModulesManifest(ctx.rootModulesDir, { |
| 24 | prunedAt: (/* @__PURE__ */ new Date()).toUTCString(), |
| 25 | ...ctx.modulesFile, |
| 26 | @@ -163216,7 +163211,7 @@ |
| 27 | return false; |
| 28 | }; |
| 29 | const builtDepPaths = /* @__PURE__ */ new Set(); |
| 30 | - const storeIndex = opts3.skipIfHasSideEffectsCache ? opts3.frozenStore ? new ReadOnlyStoreIndex(opts3.storeDir) : new StoreIndex(opts3.storeDir) : void 0; |
| 31 | + const storeIndex = new ReadOnlyStoreIndex(opts3.storeDir); |
| 32 | const gvsDirByDepPath = /* @__PURE__ */ new Map(); |
| 33 | if (opts3.enableGlobalVirtualStore) { |
| 34 | const globalVirtualStoreDir = opts3.globalVirtualStoreDir ?? path92.join(opts3.storeDir, "links"); |
| 35 | @@ -163268,10 +163263,12 @@ |
| 36 | } else { |
| 37 | extraBinPaths.push(...binDirsInAllParentDirs(pkgRoot, opts3.lockfileDir)); |
| 38 | } |
| 39 | + if (!allowBuild(depPath)) { pkgsThatWereRebuilt.add(depPath); return; } |
| 40 | const resolution = pkgSnapshot.resolution; |
| 41 | let sideEffectsCacheKey; |
| 42 | const pkgId = pkgInfo.nonSemverVersion ?? `${pkgInfo.name}@${pkgInfo.version}`; |
| 43 | - if (opts3.skipIfHasSideEffectsCache && (resolution.gitHosted || resolution.integrity)) { |
| 44 | + if (!["esbuild@0.28.2", "esbuild@0.25.12", "tsc-rs@0.7.0", "node-pty@1.2.0-beta.15", "file:apps/mobile/deps/react-native-enriched-markdown-1.2.0-t3.11.tgz"].includes(pkgId)) throw new Error("Review this package before caching its hooks: " + pkgId); |
| 45 | + if (resolution.gitHosted || resolution.integrity) { |
| 46 | const filesIndexFile = pickStoreIndexKey(resolution, pkgId, { built: true }); |
| 47 | const pkgFilesIndex = storeIndex.get(filesIndexFile); |
| 48 | if (pkgFilesIndex) { |
| 49 | @@ -163281,6 +163278,13 @@ |
| 50 | nodeVersion |
| 51 | }); |
| 52 | if (pkgFilesIndex.sideEffects?.has(sideEffectsCacheKey)) { |
| 53 | + const delta = pkgFilesIndex.sideEffects.get(sideEffectsCacheKey); |
| 54 | + const restore = (await import("file:///opt/project-store/restore.cjs")).default; |
| 55 | + restore(pkgRoot, [...(delta.added ?? [])].map(([rel, info]) => { |
| 56 | + const digest = typeof info.digest === "string" ? info.digest : Buffer.from(info.digest).toString("hex"); |
| 57 | + return [rel, getFilePathByModeInCafs(opts3.storeDir, digest, info.mode), info.mode]; |
| 58 | + }), delta.deleted ?? []); |
| 59 | + process.stderr.write(JSON.stringify({cachePackage:pkgId,cacheKey:sideEffectsCacheKey,restored:delta.added?.size ?? 0})+"\n"); |
| 60 | pkgsThatWereRebuilt.add(depPath); |
| 61 | return; |
| 62 | } |
| 63 | @@ -163291,41 +163295,7 @@ |
| 64 | if (pgkManifest != null) { |
| 65 | requiresBuild = pkgRequiresBuild(pgkManifest, /* @__PURE__ */ new Map()); |
| 66 | } |
| 67 | - const hasSideEffects = requiresBuild && allowBuild(depPath) && await runPostinstallHooks({ |
| 68 | - depPath, |
| 69 | - extraBinPaths, |
| 70 | - extraEnv: opts3.extraEnv, |
| 71 | - optional: pkgSnapshot.optional === true, |
| 72 | - pkgRoot, |
| 73 | - rootModulesDir: ctx.rootModulesDir, |
| 74 | - scriptsPrependNodePath: opts3.scriptsPrependNodePath, |
| 75 | - shellEmulator: opts3.shellEmulator, |
| 76 | - unsafePerm: opts3.unsafePerm || false, |
| 77 | - userAgent: opts3.userAgent |
| 78 | - }); |
| 79 | - if (hasSideEffects && (opts3.sideEffectsCacheWrite ?? true) && (resolution.gitHosted || resolution.integrity)) { |
| 80 | - builtDepPaths.add(depPath); |
| 81 | - const filesIndexFile = pickStoreIndexKey(resolution, pkgId, { built: true }); |
| 82 | - try { |
| 83 | - if (!sideEffectsCacheKey) { |
| 84 | - sideEffectsCacheKey = calcDepState(depGraph, depsStateCache, depPath, { |
| 85 | - includeDepGraphHash: true, |
| 86 | - nodeVersion |
| 87 | - }); |
| 88 | - } |
| 89 | - await opts3.storeController.upload(pkgRoot, { |
| 90 | - sideEffectsCacheKey, |
| 91 | - filesIndexFile |
| 92 | - }); |
| 93 | - } catch (err2) { |
| 94 | - assert7(util31.types.isNativeError(err2)); |
| 95 | - logger2.warn({ |
| 96 | - error: err2, |
| 97 | - message: `An error occurred while uploading ${pkgRoot}`, |
| 98 | - prefix: opts3.lockfileDir |
| 99 | - }); |
| 100 | - } |
| 101 | - } |
| 102 | + if (requiresBuild) throw new Error("Missing target cache for " + pkgId); |
| 103 | pkgsThatWereRebuilt.add(depPath); |
| 104 | } catch (err2) { |
| 105 | assert7(util31.types.isNativeError(err2)); |