paper-snapshot-cli 0.1.4 → 0.1.5
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/bin.mjs +10 -3
- package/package.json +1 -1
package/dist/bin.mjs
CHANGED
|
@@ -54613,7 +54613,7 @@ const NodeInfo = fromJsonString(Struct({
|
|
|
54613
54613
|
const layer = succeed$3(Service, Service.of({ connect: fn("Paper.connect")(function* (settings) {
|
|
54614
54614
|
const client = new Client({
|
|
54615
54615
|
name: "paper-snapshot",
|
|
54616
|
-
version: "0.1.
|
|
54616
|
+
version: "0.1.5"
|
|
54617
54617
|
});
|
|
54618
54618
|
yield* acquireRelease(tryPromise({
|
|
54619
54619
|
try: () => client.connect(new StdioClientTransport({
|
|
@@ -55070,6 +55070,13 @@ const target = (job, input, name, layout) => {
|
|
|
55070
55070
|
position
|
|
55071
55071
|
});
|
|
55072
55072
|
};
|
|
55073
|
+
/** "Title · host"; a page titled only with its host is named by its URL instead. */
|
|
55074
|
+
const defaultName = (title, url) => {
|
|
55075
|
+
const parsed = URL.parse(url);
|
|
55076
|
+
if (parsed === null) return title;
|
|
55077
|
+
const path = parsed.pathname === "/" ? "" : parsed.pathname.replace(/\/$/, "");
|
|
55078
|
+
return title === "" || title === parsed.host ? `${parsed.host}${path}` : `${title} · ${parsed.host}`;
|
|
55079
|
+
};
|
|
55073
55080
|
const slug = (text) => text.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "").slice(0, 60) || "snapshot";
|
|
55074
55081
|
const handler = fn("paper-snapshot")(function* (input) {
|
|
55075
55082
|
const fs = yield* FileSystem;
|
|
@@ -55155,7 +55162,7 @@ const handler = fn("paper-snapshot")(function* (input) {
|
|
|
55155
55162
|
captureTimeout: millis(input.captureTimeout)
|
|
55156
55163
|
});
|
|
55157
55164
|
})).pipe(flatMap$1((snapshot) => gen(function* () {
|
|
55158
|
-
const name = getOrElse(job.name, () =>
|
|
55165
|
+
const name = getOrElse(job.name, () => defaultName(snapshot.title, snapshot.url));
|
|
55159
55166
|
const warned = Object.entries(snapshot.warnings).filter(([, count]) => count > 0);
|
|
55160
55167
|
if (warned.length > 0) yield* logWarning(`${name}: ${warned.map(([kind, count]) => `${count} ${kind}`).join(", ")}`);
|
|
55161
55168
|
const out = map$9(input.out, (location) => batch ? path.join(location, `${job.index + 1}-${slug(name)}.html`) : location);
|
|
@@ -55280,7 +55287,7 @@ const LoggerLive = layer$4([make$6((options) => {
|
|
|
55280
55287
|
process.stderr.write(`${mark} ${text}\n`);
|
|
55281
55288
|
})]);
|
|
55282
55289
|
const MainLive = mergeAll(layer$2, layer$1.pipe(provide$2(layer$3)), layer).pipe(provideMerge(layer$5), provideMerge(LoggerLive));
|
|
55283
|
-
run$1(command, { version: "0.1.
|
|
55290
|
+
run$1(command, { version: "0.1.5" }).pipe(tapError((error) => isCliError(error) ? void_ : error$1(`paper-snapshot: ${error.message}`)), tapDefect((defect) => error$1(`paper-snapshot: unexpected error: ${defect instanceof Error ? defect.stack ?? defect.message : String(defect)}`)), provide(MainLive), runMain({
|
|
55284
55291
|
disableErrorReporting: true,
|
|
55285
55292
|
teardown: (exit, onExit) => defaultTeardown(exit, (code) => {
|
|
55286
55293
|
onExit(code);
|
package/package.json
CHANGED