pixelkiln 0.46.0 → 0.47.0

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/index.js CHANGED
@@ -2101,6 +2101,10 @@ function pixelLabObjectUrl(generator, objectId) {
2101
2101
  const setId = objectId.split("#")[0];
2102
2102
  return setId ? `https://www.pixellab.ai/maps/tiles/${encodeURIComponent(setId)}` : null;
2103
2103
  }
2104
+ if (generator === "character") {
2105
+ const characterId = objectId.split("#")[0];
2106
+ return characterId ? `https://www.pixellab.ai/create-character/${encodeURIComponent(characterId)}` : null;
2107
+ }
2104
2108
  return null;
2105
2109
  }
2106
2110
  function characterCost(spec) {
@@ -8720,8 +8724,9 @@ async function fetchAssets(provider, specs, lock, lockPath, opts = {}) {
8720
8724
  const superseded = (entry.supersededOutputs ?? []).find(
8721
8725
  (output, oldIndex, all) => currentOutputPath(output, spec, oldIndex, all.length) === target
8722
8726
  );
8727
+ const outgoing = Boolean(superseded && currentHash === superseded.sha256);
8723
8728
  if (!opts.force) {
8724
- if (superseded && currentHash === superseded.sha256) {
8729
+ if (outgoing) {
8725
8730
  } else if (recorded || superseded) {
8726
8731
  throw new Error(
8727
8732
  `refusing to overwrite modified output ${target}; pass --force to replace it`
@@ -8732,6 +8737,14 @@ async function fetchAssets(provider, specs, lock, lockPath, opts = {}) {
8732
8737
  );
8733
8738
  }
8734
8739
  }
8740
+ if (outgoing && cacheDir) {
8741
+ try {
8742
+ const oldBytes = await readFile11(target);
8743
+ const oldMediaType = detectMediaType(oldBytes);
8744
+ if (oldMediaType) await cacheMedia(cacheDir, oldBytes, oldMediaType, currentHash);
8745
+ } catch {
8746
+ }
8747
+ }
8735
8748
  log(
8736
8749
  ` replace ${path17.relative(process.cwd(), target)}` + (opts.force ? " (--force)" : " (previous tracked generation)")
8737
8750
  );