@r_masseater/web-vitals-flow 0.0.0 → 0.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@r_masseater/web-vitals-flow",
3
- "version": "0.0.0",
3
+ "version": "0.0.2",
4
4
  "description": "Measure Core Web Vitals of page loads and same-origin link transitions with Lighthouse user flows, take the median of several runs, and fail when LCP, INP or CLS misses Lighthouse's passing score.",
5
5
  "keywords": [
6
6
  "cls",
@@ -42,7 +42,7 @@
42
42
  "puppeteer-core": "25.16.0"
43
43
  },
44
44
  "devDependencies": {
45
- "@r_masseater/vitest-otlp": "0.0.0",
45
+ "@r_masseater/vitest-otlp": "0.0.2",
46
46
  "@types/node": "26.6.6",
47
47
  "vite-plus": "1.4.0"
48
48
  },
package/dist/main.mjs DELETED
@@ -1,198 +0,0 @@
1
- #!/usr/bin/env node
2
- import { NodeRuntime, NodeServices } from "@effect/platform-node";
3
- import { Array, Console, Effect, FileSystem, Layer, Number, Option, Path, Schema, String, pipe } from "effect";
4
- import { Argument, Command, Flag } from "effect/cli";
5
- import { FetchHttpClient } from "effect/http";
6
- import { OtlpSerialization, OtlpTracer } from "effect/observability";
7
- import { Launcher } from "chrome-launcher";
8
- import { startFlow } from "lighthouse";
9
- import { launch } from "puppeteer-core";
10
- // src/flow.ts
11
- const taggedError$1 = Schema.TaggedError;
12
- var BrowserError = class extends taggedError$1()("BrowserError", { cause: Schema.Unknown }) {};
13
- const attempt = (evaluate) => Effect.tryPromise({
14
- try: evaluate,
15
- catch: (cause) => BrowserError.make({ cause })
16
- });
17
- const openBrowser = (chromeFlags) => Effect.gen(function* open() {
18
- const installation = yield* Effect.try({
19
- try: () => Launcher.getFirstInstallation(),
20
- catch: (cause) => BrowserError.make({ cause })
21
- });
22
- const executablePath = yield* Option.fromNullishOr(installation).pipe(Effect.fromOption, Effect.mapError(() => BrowserError.make({ cause: "Chrome was not found. Set CHROME_PATH to its executable." })));
23
- return yield* attempt(() => launch({
24
- executablePath,
25
- args: [...chromeFlags]
26
- }));
27
- });
28
- const missingLink = (target) => BrowserError.make({ cause: `No link to ${target} was found` });
29
- const withoutHash = (url) => {
30
- const parsed = new URL(url);
31
- parsed.hash = "";
32
- return parsed.href;
33
- };
34
- const hrefsOn = (page) => attempt(() => page.$$eval("a[href]", (anchors) => {
35
- const hrefs = [];
36
- for (const anchor of anchors) if (anchor.origin === location.origin) hrefs.push(anchor.href);
37
- return hrefs;
38
- }));
39
- const linksOn = (page) => Effect.map(hrefsOn(page), (hrefs) => pipe(hrefs, Array.map((href) => withoutHash(href)), Array.dedupe, Array.filter((href) => href !== withoutHash(page.url()))));
40
- const clickLink = (page, target) => Effect.gen(function* click() {
41
- const anchors = yield* attempt(() => page.$$("a[href]"));
42
- const reads = pipe(anchors, Array.map((anchor) => anchor.evaluate((element) => element.href)));
43
- const hrefs = yield* attempt(() => Promise.all(reads));
44
- const index = yield* Array.findFirstIndex(hrefs, (href) => withoutHash(href) === target).pipe(Effect.fromOption, Effect.mapError(() => missingLink(target)));
45
- const anchor = yield* Array.get(anchors, index).pipe(Effect.fromOption, Effect.mapError(() => missingLink(target)));
46
- yield* attempt(() => Promise.all([page.waitForFunction((href) => {
47
- const here = new URL(location.href);
48
- here.hash = "";
49
- return here.href === href && document.readyState === "complete";
50
- }, {}, target), anchor.click()]));
51
- });
52
- const measureFlow = Effect.fn("web-vitals.flow")(function* measureFlow(urls, chromeFlags) {
53
- const browser = yield* Effect.acquireRelease(openBrowser(chromeFlags), (opened) => Effect.promise(() => opened.close()));
54
- const page = yield* attempt(() => browser.newPage());
55
- const flow = yield* attempt(() => startFlow(page, { name: "web-vitals" }));
56
- for (const url of urls) {
57
- yield* attempt(() => flow.navigate(url, { name: `load ${url}` })).pipe(Effect.withSpan("web-vitals.load", { attributes: { url } }));
58
- for (const link of yield* linksOn(page)) yield* Effect.gen(function* transition() {
59
- yield* attempt(() => page.goto(url, { waitUntil: "load" }));
60
- yield* attempt(() => flow.startTimespan({ name: `${url} -> ${link}` }));
61
- yield* clickLink(page, link);
62
- yield* attempt(() => flow.endTimespan());
63
- }).pipe(Effect.withSpan("web-vitals.transition", { attributes: {
64
- from: url,
65
- to: link
66
- } }));
67
- }
68
- return {
69
- result: yield* attempt(() => flow.createFlowResult()).pipe(Effect.withSpan("web-vitals.audit")),
70
- html: yield* attempt(() => flow.generateReport())
71
- };
72
- }, Effect.scoped);
73
- // src/metrics.ts
74
- const PASSING_SCORE = .9;
75
- const SCORE_DIGITS = 2;
76
- const SHIFT_DIGITS = 3;
77
- const LABEL_WIDTH = 4;
78
- const VALUE_WIDTH = 9;
79
- const HALVES = 2;
80
- const milliseconds = (value) => `${Math.round(value).toString()}ms`;
81
- const unitless = (value) => value.toFixed(SHIFT_DIGITS);
82
- const METRICS = [
83
- {
84
- audit: "largest-contentful-paint",
85
- label: "LCP",
86
- core: true,
87
- format: milliseconds
88
- },
89
- {
90
- audit: "interaction-to-next-paint",
91
- label: "INP",
92
- core: true,
93
- format: milliseconds
94
- },
95
- {
96
- audit: "cumulative-layout-shift",
97
- label: "CLS",
98
- core: true,
99
- format: unitless
100
- },
101
- {
102
- audit: "first-contentful-paint",
103
- label: "FCP",
104
- core: false,
105
- format: milliseconds
106
- },
107
- {
108
- audit: "server-response-time",
109
- label: "TTFB",
110
- core: false,
111
- format: milliseconds
112
- },
113
- {
114
- audit: "total-blocking-time",
115
- label: "TBT",
116
- core: false,
117
- format: milliseconds
118
- }
119
- ];
120
- const measurementOf = (step, metric) => Option.fromNullishOr(step.lhr.audits[metric.audit]).pipe(Option.flatMap((result) => Option.all({
121
- value: Option.fromNullishOr(result.numericValue),
122
- score: Option.fromNullishOr(result.score)
123
- })), Option.map(({ value, score }) => ({
124
- metric,
125
- value,
126
- score
127
- })));
128
- const vitalsOf = (flow) => pipe(flow.steps, Array.map((step) => ({
129
- name: step.name,
130
- measurements: pipe(METRICS, Array.map((metric) => measurementOf(step, metric)), Array.getSomes)
131
- })));
132
- const medianOf = (measurements) => pipe(measurements, Array.sortWith((measurement) => measurement.value, Number.Order), (sorted) => pipe(sorted, Array.get(Math.floor(sorted.length / HALVES))));
133
- const medianStepOf = (runs, step) => ({
134
- name: step.name,
135
- measurements: pipe(step.measurements, Array.map(({ metric }) => pipe(runs, Array.flatMap((steps) => pipe(steps, Array.findFirst((candidate) => candidate.name === step.name), Option.flatMap((candidate) => pipe(candidate.measurements, Array.findFirst((measured) => measured.metric === metric))), Option.toArray)), medianOf)), Array.getSomes)
136
- });
137
- const medianVitalsOf = (flows) => {
138
- const runs = pipe(flows, Array.map((flow) => vitalsOf(flow)));
139
- return pipe(Array.head(runs), Option.match({
140
- onNone: () => [],
141
- onSome: (first) => pipe(first, Array.map((step) => medianStepOf(runs, step)))
142
- }));
143
- };
144
- const isPoor = (measurement) => measurement.metric.core && measurement.score < PASSING_SCORE;
145
- const failuresOf = (steps) => pipe(steps, Array.flatMap((step) => pipe(step.measurements, Array.filter(isPoor), Array.map((measurement) => `${step.name}: ${measurement.metric.label}`))));
146
- const lineOf = (measurement) => {
147
- const label = pipe(measurement.metric.label, String.padEnd(LABEL_WIDTH));
148
- const value = pipe(measurement.metric.format(measurement.value), String.padStart(VALUE_WIDTH));
149
- return pipe([
150
- ` ${label}`,
151
- value,
152
- ` score ${measurement.score.toFixed(SCORE_DIGITS)}`
153
- ], Array.join(" "));
154
- };
155
- const tableOf = (steps) => pipe(steps, Array.flatMap((step) => [step.name, ...pipe(step.measurements, Array.map(lineOf))]), Array.join("\n"));
156
- const summarize = (flows) => {
157
- const steps = medianVitalsOf(flows);
158
- return {
159
- table: tableOf(steps),
160
- failures: failuresOf(steps)
161
- };
162
- };
163
- // src/main.ts
164
- const MINIMUM_URLS = 1;
165
- const FIRST_RUN = 1;
166
- const DEFAULT_RUNS = 5;
167
- const taggedError = Schema.TaggedError;
168
- var PoorVitals = class extends taggedError()("PoorVitals", { failures: Schema.Array(Schema.String) }) {};
169
- const tracing = OtlpTracer.layerFromConfig({ resource: { serviceName: "web-vitals-flow" } }).pipe(Layer.provide(OtlpSerialization.layerJson), Layer.provide(FetchHttpClient.layer));
170
- const services = Layer.mergeAll(tracing, NodeServices.layer);
171
- const encodeJson = Schema.encodeUnknownEffect(Schema.fromJsonString(Schema.Unknown));
172
- const command = Command.make("web-vitals-flow", {
173
- urls: Argument.String("url").pipe(Argument.atLeast(MINIMUM_URLS), Argument.withDescription("Pages to load; each same-origin link on them is also clicked")),
174
- chromeFlags: Flag.String("chrome-flags").pipe(Flag.withDefault(""), Flag.withDescription("Space-separated flags passed to Chrome")),
175
- runs: Flag.Int("runs").pipe(Flag.withDefault(DEFAULT_RUNS), Flag.withDescription("How many times the flow runs; each step is judged by its median")),
176
- reportDirectory: Flag.String("report-dir").pipe(Flag.withDefault("report"), Flag.withDescription("Where flow-<run>.html and flow-<run>.json are written"))
177
- }, ({ urls, chromeFlags, runs, reportDirectory }) => Effect.gen(function* measure() {
178
- const flags = pipe(chromeFlags, String.split(" "), Array.filter(Boolean));
179
- const fileSystem = yield* FileSystem.FileSystem;
180
- const path = yield* Path.Path;
181
- yield* fileSystem.makeDirectory(reportDirectory, { recursive: true });
182
- const results = yield* Effect.forEach(Array.range(FIRST_RUN, runs), (run) => Effect.gen(function* measureRun() {
183
- const { result, html } = yield* measureFlow(urls, flags);
184
- yield* fileSystem.writeFileString(path.join(reportDirectory, `flow-${run.toString()}.html`), html);
185
- yield* fileSystem.writeFileString(path.join(reportDirectory, `flow-${run.toString()}.json`), yield* encodeJson(result));
186
- return result;
187
- }));
188
- const { table, failures } = summarize(results);
189
- yield* Console.log(table);
190
- return yield* Array.match(failures, {
191
- onEmpty: () => Effect.void,
192
- onNonEmpty: (poor) => Effect.fail(PoorVitals.make({ failures: poor }))
193
- });
194
- }));
195
- NodeRuntime.runMain(Layer.build(services).pipe(Effect.flatMap((context) => Effect.provideContext(Command.run(command, { version: "0.0.0" }), context)), Effect.scoped));
196
- export {};
197
-
198
- //# sourceMappingURL=main.mjs.map
package/dist/main.mjs.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"main.mjs","names":["taggedError"],"sources":["../src/flow.ts","../src/metrics.ts","../src/main.ts"],"sourcesContent":["import { Launcher } from \"chrome-launcher\";\nimport { Array, Effect, Option, Schema, pipe } from \"effect\";\nimport { startFlow } from \"lighthouse\";\nimport { launch } from \"puppeteer-core\";\nimport type { Browser, Page } from \"puppeteer-core\";\n\nconst taggedError = Schema.TaggedError;\n\nclass BrowserError extends taggedError<BrowserError, { readonly brand: unique symbol }>()(\n \"BrowserError\",\n { cause: Schema.Unknown },\n) {}\n\nconst attempt = <Value>(evaluate: () => Promise<Value>): Effect.Effect<Value, BrowserError> =>\n Effect.tryPromise({ try: evaluate, catch: (cause) => BrowserError.make({ cause }) });\n\nconst openBrowser = (chromeFlags: readonly string[]): Effect.Effect<Browser, BrowserError> =>\n Effect.gen(function* open() {\n const installation = yield* Effect.try({\n try: () => Launcher.getFirstInstallation(),\n catch: (cause) => BrowserError.make({ cause }),\n });\n const executablePath = yield* Option.fromNullishOr(installation).pipe(\n Effect.fromOption,\n Effect.mapError(() =>\n BrowserError.make({\n cause: \"Chrome was not found. Set CHROME_PATH to its executable.\",\n }),\n ),\n );\n return yield* attempt(() => launch({ executablePath, args: [...chromeFlags] }));\n });\n\nconst missingLink = (target: string): BrowserError =>\n BrowserError.make({ cause: `No link to ${target} was found` });\n\nconst withoutHash = (url: string): string => {\n const parsed = new URL(url);\n parsed.hash = \"\";\n return parsed.href;\n};\n\nconst hrefsOn = (page: Page): Effect.Effect<readonly string[], BrowserError> =>\n attempt(() =>\n page.$$eval(\"a[href]\", (anchors) => {\n const hrefs: string[] = [];\n for (const anchor of anchors) {\n if (anchor.origin === location.origin) {\n hrefs.push(anchor.href);\n }\n }\n return hrefs;\n }),\n );\n\nconst linksOn = (page: Page): Effect.Effect<readonly string[], BrowserError> =>\n Effect.map(hrefsOn(page), (hrefs) =>\n pipe(\n hrefs,\n Array.map((href) => withoutHash(href)),\n Array.dedupe,\n Array.filter((href) => href !== withoutHash(page.url())),\n ),\n );\n\nconst clickLink = (page: Page, target: string): Effect.Effect<void, BrowserError> =>\n Effect.gen(function* click() {\n const anchors = yield* attempt(() => page.$$(\"a[href]\"));\n const reads = pipe(\n anchors,\n Array.map((anchor) => anchor.evaluate((element) => element.href)),\n );\n const hrefs = yield* attempt(() => Promise.all(reads));\n const index = yield* Array.findFirstIndex(hrefs, (href) => withoutHash(href) === target).pipe(\n Effect.fromOption,\n Effect.mapError(() => missingLink(target)),\n );\n const anchor = yield* Array.get(anchors, index).pipe(\n Effect.fromOption,\n Effect.mapError(() => missingLink(target)),\n );\n yield* attempt(() =>\n Promise.all([\n page.waitForFunction(\n (href) => {\n const here = new URL(location.href);\n here.hash = \"\";\n return here.href === href && document.readyState === \"complete\";\n },\n {},\n target,\n ),\n anchor.click(),\n ]),\n );\n });\n\nconst measureFlow = Effect.fn(\"web-vitals.flow\")(function* measureFlow(\n urls: readonly string[],\n chromeFlags: readonly string[],\n) {\n const browser = yield* Effect.acquireRelease(openBrowser(chromeFlags), (opened) =>\n Effect.promise(() => opened.close()),\n );\n const page = yield* attempt(() => browser.newPage());\n const flow = yield* attempt(() => startFlow(page, { name: \"web-vitals\" }));\n for (const url of urls) {\n yield* attempt(() => flow.navigate(url, { name: `load ${url}` })).pipe(\n Effect.withSpan(\"web-vitals.load\", { attributes: { url } }),\n );\n for (const link of yield* linksOn(page)) {\n yield* Effect.gen(function* transition() {\n yield* attempt(() => page.goto(url, { waitUntil: \"load\" }));\n yield* attempt(() => flow.startTimespan({ name: `${url} -> ${link}` }));\n yield* clickLink(page, link);\n yield* attempt(() => flow.endTimespan());\n }).pipe(Effect.withSpan(\"web-vitals.transition\", { attributes: { from: url, to: link } }));\n }\n }\n const result = yield* attempt(() => flow.createFlowResult()).pipe(\n Effect.withSpan(\"web-vitals.audit\"),\n );\n const html = yield* attempt(() => flow.generateReport());\n return { result, html };\n}, Effect.scoped);\n\nexport { measureFlow };\n","import { Array, Number, Option, String, pipe } from \"effect\";\nimport type { FlowResult } from \"lighthouse\";\n\nconst PASSING_SCORE = 0.9;\nconst SCORE_DIGITS = 2;\nconst SHIFT_DIGITS = 3;\nconst LABEL_WIDTH = 4;\nconst VALUE_WIDTH = 9;\nconst HALVES = 2;\n\nconst milliseconds = (value: number): string => `${Math.round(value).toString()}ms`;\n\nconst unitless = (value: number): string => value.toFixed(SHIFT_DIGITS);\n\nconst METRICS = [\n { audit: \"largest-contentful-paint\", label: \"LCP\", core: true, format: milliseconds },\n { audit: \"interaction-to-next-paint\", label: \"INP\", core: true, format: milliseconds },\n { audit: \"cumulative-layout-shift\", label: \"CLS\", core: true, format: unitless },\n { audit: \"first-contentful-paint\", label: \"FCP\", core: false, format: milliseconds },\n { audit: \"server-response-time\", label: \"TTFB\", core: false, format: milliseconds },\n { audit: \"total-blocking-time\", label: \"TBT\", core: false, format: milliseconds },\n] as const;\n\ntype Metric = (typeof METRICS)[number];\n\ninterface Measurement {\n readonly metric: Metric;\n readonly value: number;\n readonly score: number;\n}\n\ninterface StepVitals {\n readonly name: string;\n readonly measurements: readonly Measurement[];\n}\n\nconst measurementOf = (step: FlowResult.Step, metric: Metric): Option.Option<Measurement> =>\n Option.fromNullishOr(step.lhr.audits[metric.audit]).pipe(\n Option.flatMap((result) =>\n Option.all({\n value: Option.fromNullishOr(result.numericValue),\n score: Option.fromNullishOr(result.score),\n }),\n ),\n Option.map(({ value, score }) => ({ metric, value, score })),\n );\n\nconst vitalsOf = (flow: FlowResult): readonly StepVitals[] =>\n pipe(\n flow.steps,\n Array.map((step) => ({\n name: step.name,\n measurements: pipe(\n METRICS,\n Array.map((metric) => measurementOf(step, metric)),\n Array.getSomes,\n ),\n })),\n );\n\nconst medianOf = (measurements: readonly Measurement[]): Option.Option<Measurement> =>\n pipe(\n measurements,\n Array.sortWith((measurement) => measurement.value, Number.Order),\n (sorted) => pipe(sorted, Array.get(Math.floor(sorted.length / HALVES))),\n );\n\nconst medianStepOf = (runs: readonly (readonly StepVitals[])[], step: StepVitals): StepVitals => ({\n name: step.name,\n measurements: pipe(\n step.measurements,\n Array.map(({ metric }) =>\n pipe(\n runs,\n Array.flatMap((steps) =>\n pipe(\n steps,\n Array.findFirst((candidate) => candidate.name === step.name),\n Option.flatMap((candidate) =>\n pipe(\n candidate.measurements,\n Array.findFirst((measured) => measured.metric === metric),\n ),\n ),\n Option.toArray,\n ),\n ),\n medianOf,\n ),\n ),\n Array.getSomes,\n ),\n});\n\nconst medianVitalsOf = (flows: readonly FlowResult[]): readonly StepVitals[] => {\n const runs = pipe(\n flows,\n Array.map((flow) => vitalsOf(flow)),\n );\n return pipe(\n Array.head(runs),\n Option.match({\n onNone: () => [],\n onSome: (first) =>\n pipe(\n first,\n Array.map((step) => medianStepOf(runs, step)),\n ),\n }),\n );\n};\n\nconst isPoor = (measurement: Measurement): boolean =>\n measurement.metric.core && measurement.score < PASSING_SCORE;\n\nconst failuresOf = (steps: readonly StepVitals[]): readonly string[] =>\n pipe(\n steps,\n Array.flatMap((step) =>\n pipe(\n step.measurements,\n Array.filter(isPoor),\n Array.map((measurement) => `${step.name}: ${measurement.metric.label}`),\n ),\n ),\n );\n\nconst lineOf = (measurement: Measurement): string => {\n const label = pipe(measurement.metric.label, String.padEnd(LABEL_WIDTH));\n const value = pipe(measurement.metric.format(measurement.value), String.padStart(VALUE_WIDTH));\n return pipe(\n [` ${label}`, value, ` score ${measurement.score.toFixed(SCORE_DIGITS)}`],\n Array.join(\" \"),\n );\n};\n\nconst tableOf = (steps: readonly StepVitals[]): string =>\n pipe(\n steps,\n Array.flatMap((step) => [step.name, ...pipe(step.measurements, Array.map(lineOf))]),\n Array.join(\"\\n\"),\n );\n\nconst summarize = (\n flows: readonly FlowResult[],\n): { readonly table: string; readonly failures: readonly string[] } => {\n const steps = medianVitalsOf(flows);\n return { table: tableOf(steps), failures: failuresOf(steps) };\n};\n\nexport { summarize };\n","import { NodeRuntime, NodeServices } from \"@effect/platform-node\";\nimport { Array, Console, Effect, FileSystem, Layer, Path, Schema, String, pipe } from \"effect\";\nimport { Argument, Command, Flag } from \"effect/cli\";\nimport { FetchHttpClient } from \"effect/http\";\nimport { OtlpSerialization, OtlpTracer } from \"effect/observability\";\n\nimport { measureFlow } from \"./flow.ts\";\nimport { summarize } from \"./metrics.ts\";\n\nconst MINIMUM_URLS = 1;\nconst FIRST_RUN = 1;\nconst DEFAULT_RUNS = 5;\n\nconst taggedError = Schema.TaggedError;\n\nclass PoorVitals extends taggedError<PoorVitals, { readonly brand: unique symbol }>()(\n \"PoorVitals\",\n { failures: Schema.Array(Schema.String) },\n) {}\n\nconst tracing = OtlpTracer.layerFromConfig({\n resource: { serviceName: \"web-vitals-flow\" },\n}).pipe(Layer.provide(OtlpSerialization.layerJson), Layer.provide(FetchHttpClient.layer));\n\nconst services = Layer.mergeAll(tracing, NodeServices.layer);\n\nconst encodeJson = Schema.encodeUnknownEffect(Schema.fromJsonString(Schema.Unknown));\n\nconst command = Command.make(\n \"web-vitals-flow\",\n {\n urls: Argument.String(\"url\").pipe(\n Argument.atLeast(MINIMUM_URLS),\n Argument.withDescription(\"Pages to load; each same-origin link on them is also clicked\"),\n ),\n chromeFlags: Flag.String(\"chrome-flags\").pipe(\n Flag.withDefault(\"\"),\n Flag.withDescription(\"Space-separated flags passed to Chrome\"),\n ),\n runs: Flag.Int(\"runs\").pipe(\n Flag.withDefault(DEFAULT_RUNS),\n Flag.withDescription(\"How many times the flow runs; each step is judged by its median\"),\n ),\n reportDirectory: Flag.String(\"report-dir\").pipe(\n Flag.withDefault(\"report\"),\n Flag.withDescription(\"Where flow-<run>.html and flow-<run>.json are written\"),\n ),\n },\n ({ urls, chromeFlags, runs, reportDirectory }) =>\n Effect.gen(function* measure() {\n const flags = pipe(chromeFlags, String.split(\" \"), Array.filter(Boolean));\n const fileSystem = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n yield* fileSystem.makeDirectory(reportDirectory, { recursive: true });\n const results = yield* Effect.forEach(Array.range(FIRST_RUN, runs), (run) =>\n Effect.gen(function* measureRun() {\n const { result, html } = yield* measureFlow(urls, flags);\n yield* fileSystem.writeFileString(\n path.join(reportDirectory, `flow-${run.toString()}.html`),\n html,\n );\n yield* fileSystem.writeFileString(\n path.join(reportDirectory, `flow-${run.toString()}.json`),\n yield* encodeJson(result),\n );\n return result;\n }),\n );\n const { table, failures } = summarize(results);\n yield* Console.log(table);\n return yield* Array.match(failures, {\n onEmpty: () => Effect.void,\n onNonEmpty: (poor) => Effect.fail(PoorVitals.make({ failures: poor })),\n });\n }),\n);\n\nNodeRuntime.runMain(\n Layer.build(services).pipe(\n Effect.flatMap((context) =>\n Effect.provideContext(Command.run(command, { version: \"0.0.0\" }), context),\n ),\n Effect.scoped,\n ),\n);\n"],"mappings":";;;;;;;;;;AAMA,MAAMA,gBAAc,OAAO;AAE3B,IAAM,eAAN,cAA2BA,cAA6D,CAAC,CACvF,gBACA,EAAE,OAAO,OAAO,QAAQ,CAC1B,CAAC,CAAC,CAAC;AAEH,MAAM,WAAkB,aACtB,OAAO,WAAW;CAAE,KAAK;CAAU,QAAQ,UAAU,aAAa,KAAK,EAAE,MAAM,CAAC;AAAE,CAAC;AAErF,MAAM,eAAe,gBACnB,OAAO,IAAI,UAAU,OAAO;CAC1B,MAAM,eAAe,OAAO,OAAO,IAAI;EACrC,WAAW,SAAS,qBAAqB;EACzC,QAAQ,UAAU,aAAa,KAAK,EAAE,MAAM,CAAC;CAC/C,CAAC;CACD,MAAM,iBAAiB,OAAO,OAAO,cAAc,YAAY,CAAC,CAAC,KAC/D,OAAO,YACP,OAAO,eACL,aAAa,KAAK,EAChB,OAAO,2DACT,CAAC,CACH,CACF;CACA,OAAO,OAAO,cAAc,OAAO;EAAE;EAAgB,MAAM,CAAC,GAAG,WAAW;CAAE,CAAC,CAAC;AAChF,CAAC;AAEH,MAAM,eAAe,WACnB,aAAa,KAAK,EAAE,OAAO,cAAc,OAAO,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