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.cjs CHANGED
@@ -2400,6 +2400,10 @@ function pixelLabObjectUrl(generator, objectId) {
2400
2400
  const setId = objectId.split("#")[0];
2401
2401
  return setId ? `https://www.pixellab.ai/maps/tiles/${encodeURIComponent(setId)}` : null;
2402
2402
  }
2403
+ if (generator === "character") {
2404
+ const characterId = objectId.split("#")[0];
2405
+ return characterId ? `https://www.pixellab.ai/create-character/${encodeURIComponent(characterId)}` : null;
2406
+ }
2403
2407
  return null;
2404
2408
  }
2405
2409
  function characterCost(spec) {
@@ -9019,8 +9023,9 @@ async function fetchAssets(provider, specs, lock, lockPath, opts = {}) {
9019
9023
  const superseded = (entry.supersededOutputs ?? []).find(
9020
9024
  (output, oldIndex, all) => currentOutputPath(output, spec, oldIndex, all.length) === target
9021
9025
  );
9026
+ const outgoing = Boolean(superseded && currentHash === superseded.sha256);
9022
9027
  if (!opts.force) {
9023
- if (superseded && currentHash === superseded.sha256) {
9028
+ if (outgoing) {
9024
9029
  } else if (recorded || superseded) {
9025
9030
  throw new Error(
9026
9031
  `refusing to overwrite modified output ${target}; pass --force to replace it`
@@ -9031,6 +9036,14 @@ async function fetchAssets(provider, specs, lock, lockPath, opts = {}) {
9031
9036
  );
9032
9037
  }
9033
9038
  }
9039
+ if (outgoing && cacheDir) {
9040
+ try {
9041
+ const oldBytes = await (0, import_promises11.readFile)(target);
9042
+ const oldMediaType = detectMediaType(oldBytes);
9043
+ if (oldMediaType) await cacheMedia(cacheDir, oldBytes, oldMediaType, currentHash);
9044
+ } catch {
9045
+ }
9046
+ }
9034
9047
  log(
9035
9048
  ` replace ${import_node_path18.default.relative(process.cwd(), target)}` + (opts.force ? " (--force)" : " (previous tracked generation)")
9036
9049
  );