@kaleidal/relikt 0.1.1 → 0.1.2
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/relikt.js +41 -48
- package/package.json +1 -1
package/dist/relikt.js
CHANGED
|
@@ -24978,6 +24978,9 @@ function exhibitSlug(date, label) {
|
|
|
24978
24978
|
function shotFile(partId, viewport, theme) {
|
|
24979
24979
|
return `${layout.shots}/${partId}/${theme ? `${viewport}-${theme}` : viewport}.png`;
|
|
24980
24980
|
}
|
|
24981
|
+
function flowFile(title) {
|
|
24982
|
+
return `${layout.flows}/${slugify2(title) || "flow"}.webm`;
|
|
24983
|
+
}
|
|
24981
24984
|
function isDedupable(path) {
|
|
24982
24985
|
return path.startsWith("visual/") || path.startsWith(`${layout.artifacts}/`);
|
|
24983
24986
|
}
|
|
@@ -25012,7 +25015,7 @@ async function treeHash(files) {
|
|
|
25012
25015
|
var encoder = new TextEncoder;
|
|
25013
25016
|
// src/exhibit/exhibit.ts
|
|
25014
25017
|
import { existsSync } from "node:fs";
|
|
25015
|
-
import { mkdir as mkdir2, readFile as readFile2, writeFile as writeFile2 } from "node:fs/promises";
|
|
25018
|
+
import { mkdir as mkdir2, readFile as readFile2, rm, writeFile as writeFile2 } from "node:fs/promises";
|
|
25016
25019
|
import { dirname as dirname2, join as join2, relative } from "node:path";
|
|
25017
25020
|
|
|
25018
25021
|
// src/util/run.ts
|
|
@@ -25145,6 +25148,11 @@ class Exhibit {
|
|
|
25145
25148
|
await mkdir2(dirname2(full), { recursive: true });
|
|
25146
25149
|
return full;
|
|
25147
25150
|
}
|
|
25151
|
+
async freshFile(file) {
|
|
25152
|
+
const full = await this.ensureDir(file);
|
|
25153
|
+
await rm(full, { force: true });
|
|
25154
|
+
return full;
|
|
25155
|
+
}
|
|
25148
25156
|
part(id, init) {
|
|
25149
25157
|
let part = this.manifest.parts.find((existing) => existing.id === id);
|
|
25150
25158
|
if (!part) {
|
|
@@ -25234,7 +25242,7 @@ async function whoamiCommand() {
|
|
|
25234
25242
|
}
|
|
25235
25243
|
|
|
25236
25244
|
// src/exhibit/artifacts.ts
|
|
25237
|
-
import { copyFile, open as open2, rm, stat } from "node:fs/promises";
|
|
25245
|
+
import { copyFile, open as open2, rm as rm2, stat } from "node:fs/promises";
|
|
25238
25246
|
import { basename } from "node:path";
|
|
25239
25247
|
|
|
25240
25248
|
// src/util/hash.ts
|
|
@@ -25343,7 +25351,7 @@ async function detect(path) {
|
|
|
25343
25351
|
async function addArtifact(exhibit, source, overrides = {}) {
|
|
25344
25352
|
const file = `${layout.artifacts}/${basename(source)}`;
|
|
25345
25353
|
const target = await exhibit.ensureDir(file);
|
|
25346
|
-
await
|
|
25354
|
+
await rm2(target, { force: true });
|
|
25347
25355
|
await copyFile(source, target);
|
|
25348
25356
|
const detected = await detect(target);
|
|
25349
25357
|
const artifact = {
|
|
@@ -25364,7 +25372,7 @@ async function addSourceTarball(exhibit, cwd) {
|
|
|
25364
25372
|
const commit = exhibit.manifest.source.commit?.slice(0, 12) ?? "worktree";
|
|
25365
25373
|
const file = `${layout.artifacts}/source-${commit}.tar.gz`;
|
|
25366
25374
|
const target = await exhibit.ensureDir(file);
|
|
25367
|
-
await
|
|
25375
|
+
await rm2(target, { force: true });
|
|
25368
25376
|
await run("sh", ["-c", `git ls-files -z -co --exclude-standard | tar --null --ignore-failed-read -T - -czf "$0"`, target], { cwd: root });
|
|
25369
25377
|
const artifact = {
|
|
25370
25378
|
file,
|
|
@@ -25463,11 +25471,11 @@ import { readFile as readFile4, stat as stat2 } from "node:fs/promises";
|
|
|
25463
25471
|
import { join as join6 } from "node:path";
|
|
25464
25472
|
|
|
25465
25473
|
// src/util/fs.ts
|
|
25466
|
-
import { mkdir as mkdir3, rm as
|
|
25474
|
+
import { mkdir as mkdir3, rm as rm3, writeFile as writeFile3 } from "node:fs/promises";
|
|
25467
25475
|
import { dirname as dirname3 } from "node:path";
|
|
25468
25476
|
async function writeFresh(path, data) {
|
|
25469
25477
|
await mkdir3(dirname3(path), { recursive: true });
|
|
25470
|
-
await
|
|
25478
|
+
await rm3(path, { force: true });
|
|
25471
25479
|
await writeFile3(path, data);
|
|
25472
25480
|
}
|
|
25473
25481
|
|
|
@@ -25617,9 +25625,7 @@ async function replayCommand(reference, port) {
|
|
|
25617
25625
|
}
|
|
25618
25626
|
|
|
25619
25627
|
// src/capture/desktop/session.ts
|
|
25620
|
-
import {
|
|
25621
|
-
import { tmpdir as tmpdir2 } from "node:os";
|
|
25622
|
-
import { dirname as dirname5, join as join14 } from "node:path";
|
|
25628
|
+
import { readFile as readFile6, rm as rm5 } from "node:fs/promises";
|
|
25623
25629
|
|
|
25624
25630
|
// src/capture/options.ts
|
|
25625
25631
|
var desktopViewports = {
|
|
@@ -26556,7 +26562,7 @@ class NativeApp {
|
|
|
26556
26562
|
}
|
|
26557
26563
|
|
|
26558
26564
|
// src/capture/desktop/display/display.ts
|
|
26559
|
-
import { mkdtemp, rm as
|
|
26565
|
+
import { mkdtemp, rm as rm4 } from "node:fs/promises";
|
|
26560
26566
|
import { tmpdir } from "node:os";
|
|
26561
26567
|
import { join as join13 } from "node:path";
|
|
26562
26568
|
|
|
@@ -27165,7 +27171,7 @@ class HiddenDisplay {
|
|
|
27165
27171
|
const base = { ...userEnvironment(), XDG_RUNTIME_DIR: dir, DBUS_SESSION_BUS_ADDRESS: bus.address, AT_SPI_BUS_ADDRESS: bus.address };
|
|
27166
27172
|
const sway = await Sway.start(dir, base).catch(async (error) => {
|
|
27167
27173
|
await bus.close();
|
|
27168
|
-
await
|
|
27174
|
+
await rm4(dir, { recursive: true, force: true });
|
|
27169
27175
|
throw error;
|
|
27170
27176
|
});
|
|
27171
27177
|
const env = {
|
|
@@ -27221,7 +27227,7 @@ class HiddenDisplay {
|
|
|
27221
27227
|
this.pointer.close();
|
|
27222
27228
|
await this.sway.stop();
|
|
27223
27229
|
await this.bus.close();
|
|
27224
|
-
await
|
|
27230
|
+
await rm4(this.dir, { recursive: true, force: true });
|
|
27225
27231
|
}
|
|
27226
27232
|
}
|
|
27227
27233
|
|
|
@@ -27380,8 +27386,8 @@ class DesktopSession {
|
|
|
27380
27386
|
async startFlow(title) {
|
|
27381
27387
|
if (this.flow)
|
|
27382
27388
|
throw new Error(`A flow named "${this.flow.title}" is already recording`);
|
|
27383
|
-
const file =
|
|
27384
|
-
const recording = await this.display.record(file);
|
|
27389
|
+
const file = flowFile(title);
|
|
27390
|
+
const recording = await this.display.record(await this.exhibit.freshFile(file));
|
|
27385
27391
|
this.flow = { title, file, startedAt: Date.now(), parts: [], viewport: this.viewport, recording };
|
|
27386
27392
|
}
|
|
27387
27393
|
async stopFlow() {
|
|
@@ -27390,13 +27396,8 @@ class DesktopSession {
|
|
|
27390
27396
|
throw new Error("No flow is recording");
|
|
27391
27397
|
this.flow = undefined;
|
|
27392
27398
|
await flow.recording.stop();
|
|
27393
|
-
const file = `${layout.flows}/${slugify2(flow.title) || "flow"}.webm`;
|
|
27394
|
-
const target = await this.exhibit.ensureDir(file);
|
|
27395
|
-
await rm4(target, { force: true });
|
|
27396
|
-
await rename2(flow.file, target);
|
|
27397
|
-
await rm4(dirname5(flow.file), { recursive: true, force: true });
|
|
27398
27399
|
this.exhibit.addFlow({
|
|
27399
|
-
file,
|
|
27400
|
+
file: flow.file,
|
|
27400
27401
|
title: flow.title,
|
|
27401
27402
|
seconds: (Date.now() - flow.startedAt) / 1000,
|
|
27402
27403
|
width: flow.viewport.width,
|
|
@@ -27404,7 +27405,7 @@ class DesktopSession {
|
|
|
27404
27405
|
parts: [...new Set(flow.parts)]
|
|
27405
27406
|
});
|
|
27406
27407
|
await this.exhibit.save();
|
|
27407
|
-
return file;
|
|
27408
|
+
return flow.file;
|
|
27408
27409
|
}
|
|
27409
27410
|
wantsDarkPass() {
|
|
27410
27411
|
return !this.liveThemes && this.journal.some((step) => step.action === "capture" && (step.options.themes ?? themes).includes("dark"));
|
|
@@ -27440,7 +27441,7 @@ class DesktopSession {
|
|
|
27440
27441
|
this.flow = undefined;
|
|
27441
27442
|
await this.app.close().finally(() => this.display.close());
|
|
27442
27443
|
if (flow)
|
|
27443
|
-
await
|
|
27444
|
+
await rm5(this.exhibit.path(flow.file), { force: true });
|
|
27444
27445
|
}
|
|
27445
27446
|
}
|
|
27446
27447
|
|
|
@@ -27555,14 +27556,11 @@ async function walkDesktop(session, log) {
|
|
|
27555
27556
|
}
|
|
27556
27557
|
|
|
27557
27558
|
// src/capture/web/session.ts
|
|
27558
|
-
import { mkdtemp as mkdtemp3, rename as rename3, rm as rm6 } from "node:fs/promises";
|
|
27559
|
-
import { tmpdir as tmpdir3 } from "node:os";
|
|
27560
|
-
import { join as join17 } from "node:path";
|
|
27561
27559
|
import { chromium } from "playwright-core";
|
|
27562
27560
|
|
|
27563
27561
|
// src/replay/build.ts
|
|
27564
|
-
import { copyFile as copyFile2, mkdir as mkdir6, rm as
|
|
27565
|
-
import { join as
|
|
27562
|
+
import { copyFile as copyFile2, mkdir as mkdir6, rm as rm6 } from "node:fs/promises";
|
|
27563
|
+
import { join as join14 } from "node:path";
|
|
27566
27564
|
|
|
27567
27565
|
// ../replay-runtime/dist/shim.js
|
|
27568
27566
|
var shim_default = `(()=>{var l="relikt:not-archived";function d(e){let t=Date,r=t.now(),a=()=>e+(t.now()-r);class n extends t{constructor(...c){if(c.length===0)super(a());else super(...c)}static now(){return a()}}globalThis.Date=new Proxy(n,{apply:()=>new n().toString()})}var o,p;function m(){if(o?.isConnected)return o;o=document.createElement("relikt-notice");let e=o.attachShadow({mode:"closed"});return e.innerHTML=\`<style>
|
|
@@ -27581,8 +27579,8 @@ var replayBodiesDir = `${replayRuntimeDir}/${replayLayout.bodies}`;
|
|
|
27581
27579
|
async function writeReplay(exhibit, archive) {
|
|
27582
27580
|
const root = exhibit.path(layout.replay);
|
|
27583
27581
|
const runtime = exhibit.path(replayRuntimeDir);
|
|
27584
|
-
const shots =
|
|
27585
|
-
await
|
|
27582
|
+
const shots = join14(runtime, "shots");
|
|
27583
|
+
await rm6(shots, { recursive: true, force: true });
|
|
27586
27584
|
await mkdir6(shots, { recursive: true });
|
|
27587
27585
|
const fallbacks = [];
|
|
27588
27586
|
for (const part of exhibit.manifest.parts) {
|
|
@@ -27590,14 +27588,14 @@ async function writeReplay(exhibit, archive) {
|
|
|
27590
27588
|
if (part.type !== "route" || !part.path || !shot)
|
|
27591
27589
|
continue;
|
|
27592
27590
|
const name = `${part.id}.png`;
|
|
27593
|
-
await copyFile2(exhibit.path(shot.file),
|
|
27591
|
+
await copyFile2(exhibit.path(shot.file), join14(shots, name));
|
|
27594
27592
|
fallbacks.push({ path: new URL(part.path, archive.origin).pathname, shot: name });
|
|
27595
27593
|
}
|
|
27596
27594
|
const complete = { ...archive, fallbacks };
|
|
27597
|
-
await writeFresh(
|
|
27598
|
-
await writeFresh(
|
|
27599
|
-
await writeFresh(
|
|
27600
|
-
await writeFresh(
|
|
27595
|
+
await writeFresh(join14(root, replayLayout.bootstrap), bootstrapHtml(archive.start, exhibit.manifest.project));
|
|
27596
|
+
await writeFresh(join14(root, replayLayout.worker), sw_default);
|
|
27597
|
+
await writeFresh(join14(runtime, replayLayout.shim), shim_default);
|
|
27598
|
+
await writeFresh(join14(runtime, replayLayout.archive), JSON.stringify(complete));
|
|
27601
27599
|
for (const part of exhibit.manifest.parts) {
|
|
27602
27600
|
if (part.type === "route" && part.path && !part.capture.includes("replayable"))
|
|
27603
27601
|
part.capture.unshift("replayable");
|
|
@@ -27709,7 +27707,7 @@ function scrubStorage(entries) {
|
|
|
27709
27707
|
// src/capture/web/recorder.ts
|
|
27710
27708
|
import { existsSync as existsSync7 } from "node:fs";
|
|
27711
27709
|
import { mkdir as mkdir7, writeFile as writeFile7 } from "node:fs/promises";
|
|
27712
|
-
import { join as
|
|
27710
|
+
import { join as join15 } from "node:path";
|
|
27713
27711
|
var credentialBody = /passw|token|secret|otp|api[-_]?key/i;
|
|
27714
27712
|
|
|
27715
27713
|
class Recorder {
|
|
@@ -27737,7 +27735,7 @@ class Recorder {
|
|
|
27737
27735
|
}
|
|
27738
27736
|
async storeBody(bytes) {
|
|
27739
27737
|
const hash = sha256(bytes);
|
|
27740
|
-
const path =
|
|
27738
|
+
const path = join15(this.bodiesDir, hash);
|
|
27741
27739
|
if (!existsSync7(path)) {
|
|
27742
27740
|
await mkdir7(this.bodiesDir, { recursive: true });
|
|
27743
27741
|
await writeFile7(path, bytes);
|
|
@@ -27892,10 +27890,9 @@ class WebSession {
|
|
|
27892
27890
|
async startFlow(title) {
|
|
27893
27891
|
if (this.flow)
|
|
27894
27892
|
throw new Error(`A flow named "${this.flow.title}" is already recording`);
|
|
27895
|
-
const
|
|
27896
|
-
const file = join17(dir, "flow.webm");
|
|
27893
|
+
const file = flowFile(title);
|
|
27897
27894
|
const viewport = this.page.viewportSize() ?? home2;
|
|
27898
|
-
await this.page.screencast.start({ path: file, size: viewport });
|
|
27895
|
+
await this.page.screencast.start({ path: await this.exhibit.freshFile(file), size: viewport });
|
|
27899
27896
|
const actions = await this.page.screencast.showActions({ cursor: "pointer", duration: 400 });
|
|
27900
27897
|
this.flow = {
|
|
27901
27898
|
title,
|
|
@@ -27915,12 +27912,8 @@ class WebSession {
|
|
|
27915
27912
|
throw new Error("No flow is recording");
|
|
27916
27913
|
this.flow = undefined;
|
|
27917
27914
|
await flow.stop();
|
|
27918
|
-
const file = `${layout.flows}/${slugify2(flow.title) || "flow"}.webm`;
|
|
27919
|
-
const target = await this.exhibit.ensureDir(file);
|
|
27920
|
-
await rm6(target, { force: true });
|
|
27921
|
-
await rename3(flow.file, target);
|
|
27922
27915
|
this.exhibit.addFlow({
|
|
27923
|
-
file,
|
|
27916
|
+
file: flow.file,
|
|
27924
27917
|
title: flow.title,
|
|
27925
27918
|
seconds: (Date.now() - flow.startedAt) / 1000,
|
|
27926
27919
|
width: flow.viewport.width,
|
|
@@ -27928,7 +27921,7 @@ class WebSession {
|
|
|
27928
27921
|
parts: [...new Set(flow.parts)]
|
|
27929
27922
|
});
|
|
27930
27923
|
await this.exhibit.save();
|
|
27931
|
-
return file;
|
|
27924
|
+
return flow.file;
|
|
27932
27925
|
}
|
|
27933
27926
|
async finish() {
|
|
27934
27927
|
if (this.flow)
|
|
@@ -28123,7 +28116,7 @@ async function searchCommand(query) {
|
|
|
28123
28116
|
// src/commands/setup.ts
|
|
28124
28117
|
import { spawn as spawn7 } from "node:child_process";
|
|
28125
28118
|
import { createRequire as createRequire3 } from "node:module";
|
|
28126
|
-
import { dirname as
|
|
28119
|
+
import { dirname as dirname5, join as join16 } from "node:path";
|
|
28127
28120
|
async function checks3() {
|
|
28128
28121
|
const tools = [
|
|
28129
28122
|
["tesseract", "screenshot search"],
|
|
@@ -28144,7 +28137,7 @@ async function checks3() {
|
|
|
28144
28137
|
}
|
|
28145
28138
|
function installChromium() {
|
|
28146
28139
|
const require2 = createRequire3(import.meta.url);
|
|
28147
|
-
const cli =
|
|
28140
|
+
const cli = join16(dirname5(require2.resolve("playwright-core/package.json")), "cli.js");
|
|
28148
28141
|
return new Promise((resolve, reject) => {
|
|
28149
28142
|
const child = spawn7(process.execPath, [cli, "install", "chromium"], { stdio: "inherit" });
|
|
28150
28143
|
child.on("close", (code) => code === 0 ? resolve() : reject(new Error("Installing Chromium failed")));
|
|
@@ -36679,7 +36672,7 @@ class StdioServerTransport {
|
|
|
36679
36672
|
// package.json
|
|
36680
36673
|
var package_default = {
|
|
36681
36674
|
name: "@kaleidal/relikt",
|
|
36682
|
-
version: "0.1.
|
|
36675
|
+
version: "0.1.2",
|
|
36683
36676
|
description: "Preserve software before it is killed or redesigned: screenshots, flows, offline replays and the actual files.",
|
|
36684
36677
|
keywords: [
|
|
36685
36678
|
"archive",
|