pixelkiln 0.46.0 → 0.46.1

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/cli.js CHANGED
@@ -8088,8 +8088,9 @@ async function fetchAssets(provider, specs, lock, lockPath, opts = {}) {
8088
8088
  const superseded = (entry.supersededOutputs ?? []).find(
8089
8089
  (output, oldIndex, all) => currentOutputPath(output, spec, oldIndex, all.length) === target
8090
8090
  );
8091
+ const outgoing = Boolean(superseded && currentHash === superseded.sha256);
8091
8092
  if (!opts.force) {
8092
- if (superseded && currentHash === superseded.sha256) {
8093
+ if (outgoing) {
8093
8094
  } else if (recorded || superseded) {
8094
8095
  throw new Error(
8095
8096
  `refusing to overwrite modified output ${target}; pass --force to replace it`
@@ -8100,6 +8101,14 @@ async function fetchAssets(provider, specs, lock, lockPath, opts = {}) {
8100
8101
  );
8101
8102
  }
8102
8103
  }
8104
+ if (outgoing && cacheDir) {
8105
+ try {
8106
+ const oldBytes = await readFile7(target);
8107
+ const oldMediaType = detectMediaType(oldBytes);
8108
+ if (oldMediaType) await cacheMedia(cacheDir, oldBytes, oldMediaType, currentHash);
8109
+ } catch {
8110
+ }
8111
+ }
8103
8112
  log2(
8104
8113
  ` replace ${path14.relative(process.cwd(), target)}` + (opts.force ? " (--force)" : " (previous tracked generation)")
8105
8114
  );