| 1 | --- pnpm.cjs |
| 2 | +++ pnpm-darwin-rebuild.cjs |
| 3 | @@ -128122,7 +128122,7 @@ |
| 4 | var dependency_path_1 = require_lib87(); |
| 5 | var crypto_object_hasher_1 = require_lib119(); |
| 6 | function calcDepState(depsGraph, cache, depPath, opts) { |
| 7 | - let result2 = constants_1.ENGINE_NAME; |
| 8 | + let result2 = opts.includeDepGraphHash ? "darwin;arm64;node26" : constants_1.ENGINE_NAME; |
| 9 | if (opts.includeDepGraphHash) { |
| 10 | const depGraphHash = calcDepGraphHash(depsGraph, cache, /* @__PURE__ */ new Set(), depPath); |
| 11 | result2 += `;deps=${depGraphHash}`; |
| 12 | @@ -130347,12 +130347,6 @@ |
| 13 | storeController: store.ctrl, |
| 14 | unsafePerm: opts.unsafePerm || false |
| 15 | }; |
| 16 | - await (0, lifecycle_1.runLifecycleHooksConcurrently)(["preinstall", "install", "postinstall", "prepublish", "prepare"], Object.values(ctx.projects), opts.childConcurrency || 5, scriptsOpts); |
| 17 | - for (const { id, manifest } of Object.values(ctx.projects)) { |
| 18 | - if (manifest?.scripts != null && (!opts.pending || ctx.pendingBuilds.includes(id))) { |
| 19 | - ctx.pendingBuilds.splice(ctx.pendingBuilds.indexOf(id), 1); |
| 20 | - } |
| 21 | - } |
| 22 | await (0, modules_yaml_1.writeModulesManifest)(ctx.rootModulesDir, { |
| 23 | prunedAt: (/* @__PURE__ */ new Date()).toUTCString(), |
| 24 | ...ctx.modulesFile, |
| 25 | @@ -130445,10 +130439,12 @@ |
| 26 | } else { |
| 27 | extraBinPaths.push(...binDirsInAllParentDirs(pkgRoot, opts.lockfileDir)); |
| 28 | } |
| 29 | + if (!allowBuild(pkgInfo.name, pkgInfo.version, depPath)) { pkgsThatWereRebuilt.add(depPath); return; } |
| 30 | const resolution = pkgSnapshot.resolution; |
| 31 | let sideEffectsCacheKey; |
| 32 | const pkgId = `${pkgInfo.name}@${pkgInfo.version}`; |
| 33 | - if (opts.skipIfHasSideEffectsCache && resolution.integrity) { |
| 34 | + if (!["esbuild@0.28.0", "sharp@0.34.5", "msgpackr-extract@3.0.3", "@parcel/watcher@2.5.6"].includes(pkgId)) throw new Error("Review this package before caching its hooks: " + pkgId); |
| 35 | + if (resolution.integrity) { |
| 36 | const filesIndexFile = (0, store_cafs_1.getIndexFilePathInCafs)(opts.storeDir, resolution.integrity.toString(), pkgId); |
| 37 | let pkgFilesIndex; |
| 38 | try { |
| 39 | @@ -130460,58 +130456,16 @@ |
| 40 | includeDepGraphHash: true |
| 41 | }); |
| 42 | if (pkgFilesIndex.sideEffects?.[sideEffectsCacheKey]) { |
| 43 | + const delta = pkgFilesIndex.sideEffects[sideEffectsCacheKey]; |
| 44 | + require("/opt/project-store/restore.cjs")(pkgRoot, |
| 45 | + Object.entries(delta.added ?? {}).map(([rel, info]) => [rel, store_cafs_1.getFilePathByModeInCafs(opts.storeDir, info.integrity, info.mode), info.mode]), delta.deleted ?? []); |
| 46 | + process.stderr.write(JSON.stringify({cachePackage:pkgId,cacheKey:sideEffectsCacheKey,restored:Object.keys(delta.added ?? {}).length})+"\n"); |
| 47 | pkgsThatWereRebuilt.add(depPath); |
| 48 | return; |
| 49 | } |
| 50 | } |
| 51 | } |
| 52 | - let requiresBuild = true; |
| 53 | - const pgkManifest = await (0, read_package_json_1.safeReadPackageJsonFromDir)(pkgRoot); |
| 54 | - if (pgkManifest != null) { |
| 55 | - requiresBuild = (0, exec_pkg_requires_build_1.pkgRequiresBuild)(pgkManifest, {}); |
| 56 | - } |
| 57 | - const hasSideEffects = requiresBuild && allowBuild(pkgInfo.name, pkgInfo.version, depPath) && await (0, lifecycle_1.runPostinstallHooks)({ |
| 58 | - depPath, |
| 59 | - extraBinPaths, |
| 60 | - extraEnv: opts.extraEnv, |
| 61 | - optional: pkgSnapshot.optional === true, |
| 62 | - pkgRoot, |
| 63 | - rawConfig: opts.rawConfig, |
| 64 | - rootModulesDir: ctx.rootModulesDir, |
| 65 | - scriptsPrependNodePath: opts.scriptsPrependNodePath, |
| 66 | - shellEmulator: opts.shellEmulator, |
| 67 | - unsafePerm: opts.unsafePerm || false |
| 68 | - }); |
| 69 | - if (hasSideEffects && (opts.sideEffectsCacheWrite ?? true) && resolution.integrity) { |
| 70 | - builtDepPaths.add(depPath); |
| 71 | - const filesIndexFile = (0, store_cafs_1.getIndexFilePathInCafs)(opts.storeDir, resolution.integrity.toString(), pkgId); |
| 72 | - try { |
| 73 | - if (!sideEffectsCacheKey) { |
| 74 | - sideEffectsCacheKey = (0, calc_dep_state_1.calcDepState)(depGraph, depsStateCache, depPath, { |
| 75 | - includeDepGraphHash: true |
| 76 | - }); |
| 77 | - } |
| 78 | - await opts.storeController.upload(pkgRoot, { |
| 79 | - sideEffectsCacheKey, |
| 80 | - filesIndexFile |
| 81 | - }); |
| 82 | - } catch (err) { |
| 83 | - (0, assert_1.default)(util_1.default.types.isNativeError(err)); |
| 84 | - if ("statusCode" in err && err.statusCode === 403) { |
| 85 | - logger_1.logger.warn({ |
| 86 | - message: `The store server disabled upload requests, could not upload ${pkgRoot}`, |
| 87 | - prefix: opts.lockfileDir |
| 88 | - }); |
| 89 | - } else { |
| 90 | - logger_1.logger.warn({ |
| 91 | - error: err, |
| 92 | - message: `An error occurred while uploading ${pkgRoot}`, |
| 93 | - prefix: opts.lockfileDir |
| 94 | - }); |
| 95 | - } |
| 96 | - } |
| 97 | - } |
| 98 | - pkgsThatWereRebuilt.add(depPath); |
| 99 | + throw new Error("Missing target cache for " + pkgId); |
| 100 | } catch (err) { |
| 101 | (0, assert_1.default)(util_1.default.types.isNativeError(err)); |
| 102 | if (pkgSnapshot.optional) { |