pixelkiln 0.86.2 → 0.86.3
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 +23 -2
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +23 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +23 -2
- package/dist/index.js.map +1 -1
- package/docs/CLI.md +6 -3
- package/docs/LIBRARY.md +7 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -15398,6 +15398,12 @@ async function currentArt(entry, spec) {
|
|
|
15398
15398
|
}
|
|
15399
15399
|
return { path: file, contentType, width, height };
|
|
15400
15400
|
}
|
|
15401
|
+
async function cachedFrame(url) {
|
|
15402
|
+
if (!url.startsWith("file://")) return null;
|
|
15403
|
+
const file = url.slice("file://".length);
|
|
15404
|
+
const contentType = mediaTypeFromExtension(file) ?? detectMediaType(await (0, import_promises18.readFile)(file).catch(() => Buffer.alloc(0))) ?? "application/octet-stream";
|
|
15405
|
+
return { path: file, contentType };
|
|
15406
|
+
}
|
|
15401
15407
|
async function prepareReview(provider, lock, opts = {}) {
|
|
15402
15408
|
const log = opts.onProgress ?? (() => {
|
|
15403
15409
|
});
|
|
@@ -15407,6 +15413,7 @@ async function prepareReview(provider, lock, opts = {}) {
|
|
|
15407
15413
|
);
|
|
15408
15414
|
const reviewAssets = /* @__PURE__ */ new Map();
|
|
15409
15415
|
const prefix = opts.routePrefix ?? "";
|
|
15416
|
+
const providerUrls = /* @__PURE__ */ new Map();
|
|
15410
15417
|
const groups = [];
|
|
15411
15418
|
for (const [key, entry] of Object.entries(lock.entries)) {
|
|
15412
15419
|
if (entry.provider !== provider.id || selectedKeys && !selectedKeys.has(key)) continue;
|
|
@@ -15415,7 +15422,19 @@ async function prepareReview(provider, lock, opts = {}) {
|
|
|
15415
15422
|
const spec = specByKey.get(key);
|
|
15416
15423
|
const state = await provider.poll(entry.reviewObjectId, entry.generator, { spec, metadata: entry.providerMetadata?.[provider.id] });
|
|
15417
15424
|
if (state.status !== "review" && state.status !== "review-set" || (state.status === "review" ? !state.candidateUrls.length : !state.frameUrls.length)) continue;
|
|
15418
|
-
const
|
|
15425
|
+
const urls = state.status === "review" ? state.candidateUrls : state.frameUrls;
|
|
15426
|
+
const frameUrls = [];
|
|
15427
|
+
const frameAssets = [];
|
|
15428
|
+
for (const [index, url] of urls.entries()) {
|
|
15429
|
+
const cached = await cachedFrame(url);
|
|
15430
|
+
if (!cached) {
|
|
15431
|
+
frameUrls.push(url);
|
|
15432
|
+
continue;
|
|
15433
|
+
}
|
|
15434
|
+
const route = `${prefix}/review-frame/${encodeURIComponent(String(groups.length))}/${index}`;
|
|
15435
|
+
frameAssets.push([route, cached]);
|
|
15436
|
+
frameUrls.push(route);
|
|
15437
|
+
}
|
|
15419
15438
|
const sourceRoute = spec?.revision ? `${prefix}/revision-source/${encodeURIComponent(String(groups.length))}` : null;
|
|
15420
15439
|
if (sourceRoute && spec?.revision) {
|
|
15421
15440
|
reviewAssets.set(sourceRoute, {
|
|
@@ -15428,6 +15447,8 @@ async function prepareReview(provider, lock, opts = {}) {
|
|
|
15428
15447
|
if (current && currentRoute) {
|
|
15429
15448
|
reviewAssets.set(currentRoute, { path: current.path, contentType: current.contentType });
|
|
15430
15449
|
}
|
|
15450
|
+
for (const [route, asset] of frameAssets) reviewAssets.set(route, asset);
|
|
15451
|
+
providerUrls.set(key, urls);
|
|
15431
15452
|
groups.push({
|
|
15432
15453
|
key,
|
|
15433
15454
|
assetId: entry.assetId,
|
|
@@ -15510,7 +15531,7 @@ async function prepareReview(provider, lock, opts = {}) {
|
|
|
15510
15531
|
status: "selected",
|
|
15511
15532
|
objectId,
|
|
15512
15533
|
candidateIndex: index,
|
|
15513
|
-
sourceUrl: sourceUrl ??
|
|
15534
|
+
sourceUrl: sourceUrl ?? providerUrls.get(key)?.[index] ?? null,
|
|
15514
15535
|
sourceUrls: [],
|
|
15515
15536
|
provider: provider.id,
|
|
15516
15537
|
providerMetadata: metadata ? {
|