paper-snapshot-cli 0.1.0 → 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/bin.mjs +70 -11
- package/package.json +1 -1
package/dist/bin.mjs
CHANGED
|
@@ -6974,6 +6974,11 @@ const causeElectDefects = (self) => hasDies(self) && hasFails(self) ? causeFromR
|
|
|
6974
6974
|
*/
|
|
6975
6975
|
const findRecoverableError = (self) => hasDies(self) ? fail$7(causeElectDefects(self)) : findError(self);
|
|
6976
6976
|
/** @internal */
|
|
6977
|
+
const findDefect = (self) => {
|
|
6978
|
+
const reason = self.reasons.find(isDieReason$1);
|
|
6979
|
+
return reason ? succeed$6(reason.defect) : fail$7(self);
|
|
6980
|
+
};
|
|
6981
|
+
/** @internal */
|
|
6977
6982
|
const hasInterrupts$1 = (self) => self.reasons.some(isInterruptReason);
|
|
6978
6983
|
/** @internal */
|
|
6979
6984
|
const causeFilterInterruptors = (self) => {
|
|
@@ -7891,6 +7896,8 @@ const tapCauseFilter = /*#__PURE__*/ dual(3, (self, filter, f) => catchCause$1(s
|
|
|
7891
7896
|
/** @internal */
|
|
7892
7897
|
const tapError$1 = /*#__PURE__*/ dual(2, (self, f) => tapCauseFilter(self, findError, (e) => f(e)));
|
|
7893
7898
|
/** @internal */
|
|
7899
|
+
const tapDefect$1 = /*#__PURE__*/ dual(2, (self, f) => tapCauseFilter(self, findDefect, (_) => f(_)));
|
|
7900
|
+
/** @internal */
|
|
7894
7901
|
const catchIf = /*#__PURE__*/ dual((args) => isEffect$1(args[0]), (self, predicate, f, orElse) => catchCause$1(self, (cause) => {
|
|
7895
7902
|
const error = findRecoverableError(cause);
|
|
7896
7903
|
if (isFailure$1(error)) return failCause$3(error.failure);
|
|
@@ -12851,6 +12858,42 @@ const tapError = tapError$1;
|
|
|
12851
12858
|
*/
|
|
12852
12859
|
const tapCause = tapCause$1;
|
|
12853
12860
|
/**
|
|
12861
|
+
* Runs an effectful operation when the source effect dies with a defect.
|
|
12862
|
+
*
|
|
12863
|
+
* **Details**
|
|
12864
|
+
*
|
|
12865
|
+
* Use this for diagnostics such as logging unexpected thrown exceptions or
|
|
12866
|
+
* values passed to `die`. Recoverable failures are not handled. When the
|
|
12867
|
+
* operation succeeds, the original defect is preserved; if the operation fails,
|
|
12868
|
+
* its error is also represented in the returned effect.
|
|
12869
|
+
*
|
|
12870
|
+
* **Example** (Observing defects)
|
|
12871
|
+
*
|
|
12872
|
+
* ```ts import.meta.vitest
|
|
12873
|
+
* import { Effect, Exit } from "effect"
|
|
12874
|
+
* const output: Array<unknown> = []
|
|
12875
|
+
*
|
|
12876
|
+
* // Simulate a severe failure in the system
|
|
12877
|
+
* const task2: Effect.Effect<number> = Effect.die(
|
|
12878
|
+
* "Something went wrong"
|
|
12879
|
+
* )
|
|
12880
|
+
*
|
|
12881
|
+
* // Log the defect using tapDefect
|
|
12882
|
+
* const tapping2 = Effect.tapDefect(
|
|
12883
|
+
* task2,
|
|
12884
|
+
* (defect) => Effect.sync(() => { output.push(`defect: ${defect}`) })
|
|
12885
|
+
* )
|
|
12886
|
+
*
|
|
12887
|
+
* void output.push(Effect.runSyncExit(tapping2))
|
|
12888
|
+
* output // => ["defect: Something went wrong", Exit.die("Something went wrong")]
|
|
12889
|
+
* ```
|
|
12890
|
+
*
|
|
12891
|
+
* @stability stable
|
|
12892
|
+
* @category error handling
|
|
12893
|
+
* @since 2.0.0
|
|
12894
|
+
*/
|
|
12895
|
+
const tapDefect = tapDefect$1;
|
|
12896
|
+
/**
|
|
12854
12897
|
* Discards both the success and failure values of an effect.
|
|
12855
12898
|
*
|
|
12856
12899
|
* **When to use**
|
|
@@ -37078,11 +37121,14 @@ const fixColspans = (page) => step$1("colspans", () => page.evaluate(() => {
|
|
|
37078
37121
|
const tableWidth = table.getBoundingClientRect().width;
|
|
37079
37122
|
const rowWidths = rows.map((row) => row.getBoundingClientRect().width);
|
|
37080
37123
|
const cellWidths = rows.map((row) => [...row.cells].map((cell) => cell.getBoundingClientRect().width));
|
|
37124
|
+
const inlines = rows.flatMap((row) => [...row.cells]).flatMap((cell) => [...cell.children]).filter((child) => child instanceof HTMLElement && getComputedStyle(child).display.startsWith("inline"));
|
|
37125
|
+
const inlineWidths = inlines.map((child) => child.getBoundingClientRect().width);
|
|
37081
37126
|
const touched = [
|
|
37082
37127
|
table,
|
|
37083
37128
|
...sections,
|
|
37084
37129
|
...rows,
|
|
37085
|
-
...rows.flatMap((row) => [...row.cells])
|
|
37130
|
+
...rows.flatMap((row) => [...row.cells]),
|
|
37131
|
+
...inlines
|
|
37086
37132
|
];
|
|
37087
37133
|
const before = touched.map((element) => element.getAttribute("style"));
|
|
37088
37134
|
log.push(() => touched.forEach((element, index) => {
|
|
@@ -37108,6 +37154,10 @@ const fixColspans = (page) => step$1("colspans", () => page.evaluate(() => {
|
|
|
37108
37154
|
cell.style.setProperty("width", `${cellWidths[rowIndex]?.[cellIndex] ?? 0}px`);
|
|
37109
37155
|
});
|
|
37110
37156
|
});
|
|
37157
|
+
inlines.forEach((child, index) => {
|
|
37158
|
+
if (getComputedStyle(child).display === "inline") child.style.setProperty("display", "inline-block");
|
|
37159
|
+
child.style.setProperty("width", `${inlineWidths[index] ?? 0}px`);
|
|
37160
|
+
});
|
|
37111
37161
|
}
|
|
37112
37162
|
return tables.size;
|
|
37113
37163
|
})).pipe(flatMap$1(decodeAt$1("colspans", Finite$3)));
|
|
@@ -38122,17 +38172,26 @@ const apply = (base, entry) => ({
|
|
|
38122
38172
|
rightOf: override(entry.rightOf, base.rightOf),
|
|
38123
38173
|
replace: override(entry.replace, base.replace)
|
|
38124
38174
|
});
|
|
38125
|
-
|
|
38175
|
+
const localHost = /^(?:localhost|[^/:]+\.(?:localhost|local|test)|127\.\d+\.\d+\.\d+|0\.0\.0\.0|10\.\d+\.\d+\.\d+|192\.168\.\d+\.\d+|172\.(?:1[6-9]|2\d|3[01])\.\d+\.\d+|\[::1\])(?::\d+)?(?:[/?#]|$)/i;
|
|
38176
|
+
const isPath = (url) => url.startsWith("/") || url.startsWith(".");
|
|
38177
|
+
/** `localhost:3000` and `example.com/pricing` get a scheme: http for local hosts, https otherwise. */
|
|
38178
|
+
const withScheme = (url) => isPath(url) || /^[a-z][a-z\d+.-]*:\/\//i.test(url) || /^(?:about|data|file):/i.test(url) ? url : `${localHost.test(url) ? "http" : "https"}://${url}`;
|
|
38179
|
+
/** Paths like `/pricing` resolve against the base URL (or the first full URL in the run). */
|
|
38126
38180
|
const resolveUrls = (jobs, baseUrl) => gen(function* () {
|
|
38127
|
-
const
|
|
38128
|
-
|
|
38129
|
-
|
|
38181
|
+
const normalized = jobs.map((job) => ({
|
|
38182
|
+
...job,
|
|
38183
|
+
url: map$9(job.url, withScheme)
|
|
38184
|
+
}));
|
|
38185
|
+
const base = orElse$2(map$9(baseUrl, withScheme), () => fromNullishOr(normalized.flatMap((job) => toArray(job.url)).find((url) => !isPath(url))));
|
|
38186
|
+
return yield* forEach$1(normalized, (job) => {
|
|
38187
|
+
if (isNone(job.url) || !isPath(job.url.value)) return succeed$2(job);
|
|
38130
38188
|
const relative = job.url.value;
|
|
38131
|
-
|
|
38132
|
-
|
|
38133
|
-
|
|
38189
|
+
const resolved = flatMap$4(base, (origin) => fromNullishOr(URL.parse(relative, origin)?.href));
|
|
38190
|
+
return match$5(resolved, {
|
|
38191
|
+
onNone: () => fail$3(new ManifestError({ message: `"${relative}" is a path; start with a full URL or pass --base-url` })),
|
|
38192
|
+
onSome: (url) => succeed$2({
|
|
38134
38193
|
...job,
|
|
38135
|
-
url: some(
|
|
38194
|
+
url: some(url)
|
|
38136
38195
|
})
|
|
38137
38196
|
});
|
|
38138
38197
|
});
|
|
@@ -54708,7 +54767,7 @@ const NodeInfo = fromJsonString(Struct({
|
|
|
54708
54767
|
const layer = succeed$3(Service, Service.of({ connect: fn("Paper.connect")(function* (settings) {
|
|
54709
54768
|
const client = new Client({
|
|
54710
54769
|
name: "paper-snapshot",
|
|
54711
|
-
version: "0.1.
|
|
54770
|
+
version: "0.1.2"
|
|
54712
54771
|
});
|
|
54713
54772
|
yield* acquireRelease(tryPromise({
|
|
54714
54773
|
try: () => client.connect(new StdioClientTransport({
|
|
@@ -55363,7 +55422,7 @@ const command = make$3("paper-snapshot", flags, run).pipe(withDescription("Snaps
|
|
|
55363
55422
|
//#region src/bin.ts
|
|
55364
55423
|
const LoggerLive = mergeAll(layer$4([consolePretty()]), succeed$3(LogToStderr, true));
|
|
55365
55424
|
const MainLive = mergeAll(layer$2, layer$1.pipe(provide$2(layer$3)), layer).pipe(provideMerge(layer$5), provideMerge(LoggerLive));
|
|
55366
|
-
run$1(command, { version: "0.1.
|
|
55425
|
+
run$1(command, { version: "0.1.2" }).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({
|
|
55367
55426
|
disableErrorReporting: true,
|
|
55368
55427
|
teardown: (exit, onExit) => defaultTeardown(exit, (code) => {
|
|
55369
55428
|
onExit(code);
|
package/package.json
CHANGED