@livestore/utils-dev 0.4.0 → 0.5.0-dev.0
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/.tsbuildinfo +1 -1
- package/dist/node/DockerCompose/DockerCompose.d.ts +52 -0
- package/dist/node/DockerCompose/DockerCompose.d.ts.map +1 -0
- package/dist/node/DockerCompose/DockerCompose.js +158 -0
- package/dist/node/DockerCompose/DockerCompose.js.map +1 -0
- package/dist/node/DockerCompose/DockerCompose.test.d.ts +2 -0
- package/dist/node/DockerCompose/DockerCompose.test.d.ts.map +1 -0
- package/dist/node/{DockerComposeService/DockerComposeService.test.js → DockerCompose/DockerCompose.test.js} +16 -16
- package/dist/node/DockerCompose/DockerCompose.test.js.map +1 -0
- package/dist/node/DockerCompose/mod.d.ts +2 -0
- package/dist/node/DockerCompose/mod.d.ts.map +1 -0
- package/dist/node/DockerCompose/mod.js +2 -0
- package/dist/node/DockerCompose/mod.js.map +1 -0
- package/dist/node/FileLogger.d.ts +15 -8
- package/dist/node/FileLogger.d.ts.map +1 -1
- package/dist/node/FileLogger.js +63 -79
- package/dist/node/FileLogger.js.map +1 -1
- package/dist/node/cmd-log.d.ts.map +1 -1
- package/dist/node/cmd-log.js +19 -8
- package/dist/node/cmd-log.js.map +1 -1
- package/dist/node/cmd.d.ts +10 -12
- package/dist/node/cmd.d.ts.map +1 -1
- package/dist/node/cmd.js +73 -36
- package/dist/node/cmd.js.map +1 -1
- package/dist/node/cmd.test.js +17 -17
- package/dist/node/cmd.test.js.map +1 -1
- package/dist/node/mod.d.ts +4 -5
- package/dist/node/mod.d.ts.map +1 -1
- package/dist/node/mod.js +58 -55
- package/dist/node/mod.js.map +1 -1
- package/dist/node/workspace.d.ts +2 -2
- package/dist/node/workspace.d.ts.map +1 -1
- package/dist/node/workspace.js +7 -7
- package/dist/node/workspace.js.map +1 -1
- package/dist/node-vitest/Vitest.d.ts +17 -8
- package/dist/node-vitest/Vitest.d.ts.map +1 -1
- package/dist/node-vitest/Vitest.js +5 -5
- package/dist/node-vitest/Vitest.js.map +1 -1
- package/dist/node-vitest/Vitest.test.d.ts +3 -5
- package/dist/node-vitest/Vitest.test.d.ts.map +1 -1
- package/dist/node-vitest/Vitest.test.js +14 -3
- package/dist/node-vitest/Vitest.test.js.map +1 -1
- package/dist/wrangler/WranglerDevServer.d.ts +15 -20
- package/dist/wrangler/WranglerDevServer.d.ts.map +1 -1
- package/dist/wrangler/WranglerDevServer.js +77 -71
- package/dist/wrangler/WranglerDevServer.js.map +1 -1
- package/dist/wrangler/WranglerDevServer.test.js +28 -28
- package/dist/wrangler/WranglerDevServer.test.js.map +1 -1
- package/dist/wrangler/mod.d.ts +1 -1
- package/dist/wrangler/mod.d.ts.map +1 -1
- package/dist/wrangler/mod.js +1 -1
- package/dist/wrangler/mod.js.map +1 -1
- package/package.json +19 -37
- package/src/node/{DockerComposeService/DockerComposeService.test.ts → DockerCompose/DockerCompose.test.ts} +18 -18
- package/src/node/DockerCompose/DockerCompose.ts +328 -0
- package/src/node/DockerCompose/mod.ts +1 -0
- package/src/node/FileLogger.ts +89 -114
- package/src/node/cmd-log.ts +21 -10
- package/src/node/cmd.test.ts +19 -17
- package/src/node/cmd.ts +117 -86
- package/src/node/mod.ts +112 -104
- package/src/node/workspace.ts +9 -10
- package/src/node-vitest/Vitest.test.ts +22 -3
- package/src/node-vitest/Vitest.ts +32 -42
- package/src/wrangler/WranglerDevServer.test.ts +33 -37
- package/src/wrangler/WranglerDevServer.ts +145 -129
- package/src/wrangler/mod.ts +1 -6
- package/dist/node/DockerComposeService/DockerComposeService.d.ts +0 -63
- package/dist/node/DockerComposeService/DockerComposeService.d.ts.map +0 -1
- package/dist/node/DockerComposeService/DockerComposeService.js +0 -149
- package/dist/node/DockerComposeService/DockerComposeService.js.map +0 -1
- package/dist/node/DockerComposeService/DockerComposeService.test.d.ts +0 -2
- package/dist/node/DockerComposeService/DockerComposeService.test.d.ts.map +0 -1
- package/dist/node/DockerComposeService/DockerComposeService.test.js.map +0 -1
- package/src/node/DockerComposeService/DockerComposeService.ts +0 -343
- /package/src/node/{DockerComposeService → DockerCompose}/test-fixtures/docker-compose.yml +0 -0
package/dist/node/mod.js
CHANGED
|
@@ -1,22 +1,17 @@
|
|
|
1
1
|
import { performance } from 'node:perf_hooks';
|
|
2
|
-
import * as OtelNodeSdk from '@effect/opentelemetry/NodeSdk';
|
|
3
2
|
import * as otel from '@opentelemetry/api';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { PeriodicExportingMetricReader } from '@opentelemetry/sdk-metrics';
|
|
7
|
-
import { BatchSpanProcessor } from '@opentelemetry/sdk-trace-base';
|
|
8
|
-
import { IS_BUN, isNonEmptyString } from '@livestore/utils';
|
|
9
|
-
import { Config, Effect, FiberRef, Layer, LogLevel, OtelTracer, Schema } from '@livestore/utils/effect';
|
|
3
|
+
import { IS_BUN } from '@livestore/utils';
|
|
4
|
+
import { Config, Context, Effect, Exit, FetchHttpClient, Layer, Option, OtelTracer, Otlp, Schema, } from '@livestore/utils/effect';
|
|
10
5
|
import { OtelLiveDummy } from '@livestore/utils/node';
|
|
11
6
|
export { OTLPMetricExporter } from '@opentelemetry/exporter-metrics-otlp-http';
|
|
12
7
|
export { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';
|
|
13
8
|
export * from "./cmd.js";
|
|
14
|
-
export
|
|
9
|
+
export * from "./DockerCompose/mod.js";
|
|
15
10
|
export * as FileLogger from "./FileLogger.js";
|
|
16
11
|
export * from "./workspace.js";
|
|
17
12
|
export const OtelLiveHttp = ({ serviceName, rootSpanName, rootSpanAttributes, parentSpan, skipLogUrl, traceNodeBootstrap, } = {}) => Effect.gen(function* () {
|
|
18
13
|
const configRes = yield* Config.all({
|
|
19
|
-
exporterUrl: Config.
|
|
14
|
+
exporterUrl: Config.nonEmptyString('OTEL_EXPORTER_OTLP_ENDPOINT'),
|
|
20
15
|
serviceName: serviceName !== undefined
|
|
21
16
|
? Config.succeed(serviceName)
|
|
22
17
|
: Config.string('OTEL_SERVICE_NAME').pipe(Config.withDefault('livestore-utils-dev')),
|
|
@@ -26,61 +21,62 @@ export const OtelLiveHttp = ({ serviceName, rootSpanName, rootSpanAttributes, pa
|
|
|
26
21
|
}).pipe(Effect.option);
|
|
27
22
|
if (configRes._tag === 'None') {
|
|
28
23
|
const RootSpanLive = Layer.span('DummyRoot', {});
|
|
29
|
-
return RootSpanLive.pipe(Layer.provideMerge(OtelLiveDummy));
|
|
24
|
+
return withTracerReference(RootSpanLive.pipe(Layer.provideMerge(OtelLiveDummy)));
|
|
30
25
|
}
|
|
31
26
|
const config = configRes.value;
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
metricReader,
|
|
40
|
-
spanProcessor: new BatchSpanProcessor(new OTLPTraceExporter({ url: `${config.exporterUrl}/v1/traces`, headers: {} }), { scheduledDelayMillis: 50 }),
|
|
41
|
-
})).pipe(
|
|
42
|
-
// If an OpenTelemetry backend is not available, the `OtelNodeSdk` layer
|
|
43
|
-
// will ignore the error when attempting to connect and emit a debug log
|
|
44
|
-
// stating the reason for the error (in this case `ECONNREFUSED`). This
|
|
45
|
-
// can cause problems for programs which rely on clean `stdout` (e.g.
|
|
46
|
-
// command-line applications). To remedy this, the below code sets the
|
|
47
|
-
// minimum log level `FiberRef` to `"None"` for the duration of the
|
|
48
|
-
// `OtelNodeSdk`'s layer constructor.
|
|
49
|
-
//
|
|
50
|
-
// This can likely be removed when Livestore is migrated to the Effect
|
|
51
|
-
// native Otlp exporters.
|
|
52
|
-
Layer.locally(FiberRef.currentMinimumLogLevel, LogLevel.None));
|
|
27
|
+
const OtelLive = Otlp.layerJson({
|
|
28
|
+
baseUrl: config.exporterUrl,
|
|
29
|
+
metricsExportInterval: 1000,
|
|
30
|
+
tracerExportInterval: 50,
|
|
31
|
+
resource: { serviceName: config.serviceName },
|
|
32
|
+
}).pipe(Layer.provide(FetchHttpClient.layer));
|
|
33
|
+
const OtelTracerLive = Layer.succeed(OtelTracer.OtelTracer, otel.trace.getTracer(config.serviceName));
|
|
53
34
|
const RootSpanLive = Layer.span(config.rootSpanName, {
|
|
54
35
|
attributes: { config, ...rootSpanAttributes },
|
|
55
|
-
onEnd: skipLogUrl === true ? undefined : (span) =>
|
|
36
|
+
onEnd: skipLogUrl === true ? undefined : (span) => logTraceUiUrlForTraceId()(span.traceId),
|
|
56
37
|
parent: parentSpan,
|
|
57
38
|
});
|
|
58
|
-
const
|
|
39
|
+
const baseLayer = RootSpanLive.pipe(Layer.provideMerge(Layer.mergeAll(OtelLive, OtelTracerLive)));
|
|
40
|
+
const memoMap = yield* Layer.makeMemoMap;
|
|
41
|
+
const layer = Layer.fromBuild((_, scope) => Layer.buildWithMemoMap(baseLayer, memoMap, scope));
|
|
59
42
|
if (traceNodeBootstrap === true && IS_BUN === false) {
|
|
60
43
|
/**
|
|
61
44
|
* Create a span representing the Node.js bootstrap duration.
|
|
62
45
|
* Note: Skipped in Bun since performance.nodeTiming is not properly supported.
|
|
63
46
|
*/
|
|
64
47
|
yield* Effect.gen(function* () {
|
|
65
|
-
const tracer = yield*
|
|
66
|
-
const currentSpan = yield*
|
|
48
|
+
const tracer = yield* Effect.tracer;
|
|
49
|
+
const currentSpan = yield* Effect.currentSpan;
|
|
67
50
|
const { nodeTiming, endAbs, durationAttr } = computeBootstrapTiming();
|
|
68
|
-
const bootSpan = tracer.
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
51
|
+
const bootSpan = tracer.span({
|
|
52
|
+
name: 'node-bootstrap',
|
|
53
|
+
parent: Option.some(currentSpan),
|
|
54
|
+
annotations: Context.empty(),
|
|
55
|
+
links: [],
|
|
56
|
+
startTime: millisToNanos(IS_BUN === true && typeof nodeTiming.nodeStart === 'number'
|
|
57
|
+
? nodeTiming.nodeStart
|
|
58
|
+
: performance.timeOrigin + nodeTiming.nodeStart),
|
|
59
|
+
kind: 'internal',
|
|
60
|
+
root: false,
|
|
61
|
+
sampled: true,
|
|
62
|
+
});
|
|
63
|
+
for (const [key, value] of Object.entries({
|
|
64
|
+
'node.timing.nodeStart': nodeTiming.nodeStart,
|
|
65
|
+
'node.timing.environment': nodeTiming.environment,
|
|
66
|
+
'node.timing.bootstrapComplete': nodeTiming.bootstrapComplete,
|
|
67
|
+
'node.timing.loopStart': nodeTiming.loopStart,
|
|
68
|
+
'node.timing.duration': durationAttr,
|
|
69
|
+
})) {
|
|
70
|
+
if (value !== undefined)
|
|
71
|
+
bootSpan.attribute(key, value);
|
|
72
|
+
}
|
|
73
|
+
bootSpan.end(millisToNanos(endAbs), Exit.void);
|
|
79
74
|
}).pipe(Effect.provide(layer), Effect.orDie);
|
|
80
75
|
}
|
|
81
|
-
return layer;
|
|
82
|
-
}).pipe(Layer.
|
|
83
|
-
export const logTraceUiUrlForSpan = (printMsg) => (span) =>
|
|
76
|
+
return withTracerReference(layer);
|
|
77
|
+
}).pipe(Layer.unwrap);
|
|
78
|
+
export const logTraceUiUrlForSpan = (printMsg) => (span) => logTraceUiUrlForTraceId(printMsg)(span.spanContext().traceId);
|
|
79
|
+
const logTraceUiUrlForTraceId = (printMsg) => (traceId) => getTracingBackendUrl(traceId).pipe(Effect.tap((url) => {
|
|
84
80
|
if (url === undefined) {
|
|
85
81
|
return Effect.logWarning('No tracing backend url found');
|
|
86
82
|
}
|
|
@@ -93,25 +89,25 @@ export const logTraceUiUrlForSpan = (printMsg) => (span) => getTracingBackendUrl
|
|
|
93
89
|
}
|
|
94
90
|
}
|
|
95
91
|
}));
|
|
96
|
-
export const getTracingBackendUrl = (
|
|
97
|
-
const endpoint = yield* Config.string('GRAFANA_ENDPOINT').pipe(Config.option
|
|
92
|
+
export const getTracingBackendUrl = (traceIdOrSpan) => Effect.gen(function* () {
|
|
93
|
+
const endpoint = yield* Config.string('GRAFANA_ENDPOINT').pipe(Config.option);
|
|
98
94
|
if (endpoint._tag === 'None')
|
|
99
95
|
return;
|
|
100
|
-
const traceId =
|
|
96
|
+
const traceId = typeof traceIdOrSpan === 'string' ? traceIdOrSpan : traceIdOrSpan.spanContext().traceId;
|
|
101
97
|
// Grafana + Tempo
|
|
102
98
|
const grafanaEndpoint = endpoint.value;
|
|
103
|
-
const left = yield* Schema.
|
|
99
|
+
const left = yield* Schema.encodeEffect(Schema.fromJsonString(Schema.Unknown))({
|
|
104
100
|
datasource: 'tempo',
|
|
105
101
|
queries: [{ query: traceId, queryType: 'traceql', refId: 'A' }],
|
|
106
102
|
range: { from: 'now-1h', to: 'now' },
|
|
107
|
-
})
|
|
103
|
+
});
|
|
108
104
|
const searchParams = new URLSearchParams({
|
|
109
105
|
orgId: '1',
|
|
110
106
|
left,
|
|
111
107
|
});
|
|
112
108
|
// TODO make dynamic via env var
|
|
113
109
|
return `${grafanaEndpoint}/explore?${searchParams.toString()}`;
|
|
114
|
-
});
|
|
110
|
+
}).pipe(Effect.orDie);
|
|
115
111
|
/**
|
|
116
112
|
* Compute absolute start/end timestamps for the Node.js bootstrap span in a
|
|
117
113
|
* way that works in both Node and Bun.
|
|
@@ -156,4 +152,11 @@ const computeBootstrapTiming = () => {
|
|
|
156
152
|
: nodeTiming.duration;
|
|
157
153
|
return { nodeTiming, startAbs, endAbs, durationAttr };
|
|
158
154
|
};
|
|
155
|
+
const millisToNanos = (millis) => BigInt(Math.round(millis * 1_000_000));
|
|
156
|
+
/**
|
|
157
|
+
* Effect v4 installs `Tracer.Tracer` through a `Context.Reference` fiber ref.
|
|
158
|
+
* The OTEL layers set that reference at runtime, but their layer output type is
|
|
159
|
+
* `never`, so we localize the public compatibility assertion here.
|
|
160
|
+
*/
|
|
161
|
+
const withTracerReference = (layer) => layer;
|
|
159
162
|
//# sourceMappingURL=mod.js.map
|
package/dist/node/mod.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.js","sourceRoot":"","sources":["../../src/node/mod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAE7C,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"mod.js","sourceRoot":"","sources":["../../src/node/mod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAE7C,OAAO,KAAK,IAAI,MAAM,oBAAoB,CAAA;AAE1C,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAEL,MAAM,EACN,OAAO,EACP,MAAM,EACN,IAAI,EACJ,eAAe,EACf,KAAK,EACL,MAAM,EACN,UAAU,EACV,IAAI,EACJ,MAAM,GACP,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAErD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAA;AAC9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAA;AAC3E,cAAc,UAAU,CAAA;AACxB,cAAc,wBAAwB,CAAA;AACtC,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAA;AAC7C,cAAc,gBAAgB,CAAA;AAE9B,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,EAC3B,WAAW,EACX,YAAY,EACZ,kBAAkB,EAClB,UAAU,EACV,UAAU,EACV,kBAAkB,MAQhB,EAAE,EAA0E,EAAE,CAChF,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAClB,MAAM,SAAS,GAAG,KAAK,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;QAClC,WAAW,EAAE,MAAM,CAAC,cAAc,CAAC,6BAA6B,CAAC;QACjE,WAAW,EACT,WAAW,KAAK,SAAS;YACvB,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC;YAC7B,CAAC,CAAC,MAAM,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,GAAG,UAAU,CAAA;YAChC,OAAO,OAAO,SAAS,KAAK,QAAQ,IAAI,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAA;QACvE,CAAC,CAAC,EAAE;QACN,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAA;IAEzB,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAW,CAAA;AAChE,CAAC,CAAA;AAED,MAAM,aAAa,GAAG,CAAC,MAAc,EAAU,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC,CAAA;AAExF;;;;GAIG;AACH,MAAM,mBAAmB,GAAG,CAC1B,KAAgC,EACW,EAAE,CAAC,KAAkD,CAAA"}
|
package/dist/node/workspace.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Context, Layer } from '@livestore/utils/effect';
|
|
2
2
|
export type WorkspaceInfo = string;
|
|
3
|
-
declare const CurrentWorkingDirectory_base: Context.
|
|
3
|
+
declare const CurrentWorkingDirectory_base: Context.ServiceClass<CurrentWorkingDirectory, "CurrentWorkingDirectory", string>;
|
|
4
4
|
/** Current working directory. */
|
|
5
5
|
export declare class CurrentWorkingDirectory extends CurrentWorkingDirectory_base {
|
|
6
6
|
/** Layer that captures the process cwd once. */
|
|
@@ -8,7 +8,7 @@ export declare class CurrentWorkingDirectory extends CurrentWorkingDirectory_bas
|
|
|
8
8
|
/** Override CWD for tests or nested invocations. */
|
|
9
9
|
static fromPath: (cwd: string) => Layer.Layer<CurrentWorkingDirectory, never, never>;
|
|
10
10
|
}
|
|
11
|
-
declare const LivestoreWorkspace_base: Context.
|
|
11
|
+
declare const LivestoreWorkspace_base: Context.ServiceClass<LivestoreWorkspace, "LivestoreWorkspace", string>;
|
|
12
12
|
/** Livestore workspace root (env required). */
|
|
13
13
|
export declare class LivestoreWorkspace extends LivestoreWorkspace_base {
|
|
14
14
|
/** Resolve from WORKSPACE_ROOT env. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../../src/node/workspace.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAU,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAEhE,MAAM,MAAM,aAAa,GAAG,MAAM,CAAA;;AAElC,iCAAiC;AACjC,qBAAa,uBAAwB,SAAQ,
|
|
1
|
+
{"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../../src/node/workspace.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAU,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAEhE,MAAM,MAAM,aAAa,GAAG,MAAM,CAAA;;AAElC,iCAAiC;AACjC,qBAAa,uBAAwB,SAAQ,4BAE5C;IACC,gDAAgD;IAChD,MAAM,CAAC,IAAI,qDAGV;IAED,oDAAoD;IACpD,MAAM,CAAC,QAAQ,GAAI,KAAK,MAAM,wDAA4E;CAC3G;;AAED,+CAA+C;AAC/C,qBAAa,kBAAmB,SAAQ,uBAA0E;IAChH,uCAAuC;IACvC,MAAM,CAAC,IAAI,gDAMV;IAED,sCAAsC;IACtC,MAAM,CAAC,QAAQ,GAAI,MAAM,MAAM,mDAAmE;IAElG,uGAAuG;IACvG,MAAM,CAAC,KAAK,GAAI,oDAAoD,CAAC,UAAU,MAAM,qEAOlF;CACJ"}
|
package/dist/node/workspace.js
CHANGED
|
@@ -2,25 +2,25 @@ import path from 'node:path';
|
|
|
2
2
|
import { shouldNeverHappen } from '@livestore/utils';
|
|
3
3
|
import { Context, Effect, Layer } from '@livestore/utils/effect';
|
|
4
4
|
/** Current working directory. */
|
|
5
|
-
export class CurrentWorkingDirectory extends Context.
|
|
5
|
+
export class CurrentWorkingDirectory extends Context.Service()('CurrentWorkingDirectory') {
|
|
6
6
|
/** Layer that captures the process cwd once. */
|
|
7
|
-
static live = Layer.effect(CurrentWorkingDirectory, Effect.sync(() => process.cwd()));
|
|
7
|
+
static live = Layer.effect(CurrentWorkingDirectory, Effect.sync(() => CurrentWorkingDirectory.of(process.cwd())));
|
|
8
8
|
/** Override CWD for tests or nested invocations. */
|
|
9
|
-
static fromPath = (cwd) => Layer.succeed(CurrentWorkingDirectory, cwd);
|
|
9
|
+
static fromPath = (cwd) => Layer.succeed(CurrentWorkingDirectory, CurrentWorkingDirectory.of(cwd));
|
|
10
10
|
}
|
|
11
11
|
/** Livestore workspace root (env required). */
|
|
12
|
-
export class LivestoreWorkspace extends Context.
|
|
12
|
+
export class LivestoreWorkspace extends Context.Service()('LivestoreWorkspace') {
|
|
13
13
|
/** Resolve from WORKSPACE_ROOT env. */
|
|
14
14
|
static live = Layer.effect(LivestoreWorkspace, Effect.sync(() => {
|
|
15
15
|
const root = process.env.WORKSPACE_ROOT ?? shouldNeverHappen('WORKSPACE_ROOT is not set');
|
|
16
|
-
return root;
|
|
16
|
+
return LivestoreWorkspace.of(root);
|
|
17
17
|
}));
|
|
18
18
|
/** Provide a fixed Livestore root. */
|
|
19
|
-
static fromPath = (root) => Layer.succeed(LivestoreWorkspace, root);
|
|
19
|
+
static fromPath = (root) => Layer.succeed(LivestoreWorkspace, LivestoreWorkspace.of(root));
|
|
20
20
|
/** Derive a CurrentWorkingDirectory layer from the Livestore workspace root (with optional subpath) */
|
|
21
21
|
static toCwd = (/** Relative path to the Livestore workspace root */ subPath) => Layer.effect(CurrentWorkingDirectory, Effect.gen(function* () {
|
|
22
22
|
const root = yield* LivestoreWorkspace;
|
|
23
|
-
return path.join(root, subPath ?? '');
|
|
23
|
+
return CurrentWorkingDirectory.of(path.join(root, subPath ?? ''));
|
|
24
24
|
}));
|
|
25
25
|
}
|
|
26
26
|
//# sourceMappingURL=workspace.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace.js","sourceRoot":"","sources":["../../src/node/workspace.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW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AAC,EAAE,CAAC,IAAI,CAAC,CAAA;IACpC,CAAC,CAAC,CACH,CAAA;IAED,sCAAsC;IACtC,MAAM,CAAC,QAAQ,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,kBAAkB,EAAE,kBAAkB,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAA;IAElG,uGAAuG;IACvG,MAAM,CAAC,KAAK,GAAG,CAAC,oDAAoD,CAAC,OAAgB,EAAE,EAAE,CACvF,KAAK,CAAC,MAAM,CACV,uBAAuB,EACvB,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;QAClB,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,kBAAkB,CAAA;QACtC,OAAO,uBAAuB,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,IAAI,EAAE,CAAC,CAAC,CAAA;IACnE,CAAC,CAAC,CACH,CAAA"}
|
|
@@ -2,19 +2,21 @@ import type * as Vitest from '@effect/vitest';
|
|
|
2
2
|
import { type Cause, Duration, Effect, type FastCheck as FC, Layer, type OtelTracer, type Schema, type Scope } from '@livestore/utils/effect';
|
|
3
3
|
export * from '@effect/vitest';
|
|
4
4
|
export declare const DEBUGGER_ACTIVE: boolean;
|
|
5
|
-
|
|
5
|
+
type WithoutTestCtxServices<R> = Exclude<Exclude<R, OtelTracer.OtelTracer>, Scope.Scope>;
|
|
6
|
+
type WithoutLayerAndTestCtxServices<R, ROut> = Exclude<Exclude<R, ROut | OtelTracer.OtelTracer>, Scope.Scope>;
|
|
7
|
+
export declare const makeWithTestCtx: <ROut = never, E1 = never, RIn = never>(ctxParams: WithTestCtxParams<ROut, E1, RIn>) => (testContext: Vitest.TestContext) => <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E | E1 | Cause.TimeoutError, WithoutTestCtxServices<RIn> | WithoutLayerAndTestCtxServices<R, ROut>>;
|
|
6
8
|
export type WithTestCtxParams<ROut, E1, RIn> = {
|
|
7
9
|
suffix?: string;
|
|
8
10
|
makeLayer?: (testContext: Vitest.TestContext) => Layer.Layer<ROut, E1, RIn | Scope.Scope>;
|
|
9
|
-
timeout?: Duration.
|
|
11
|
+
timeout?: Duration.Input;
|
|
10
12
|
forceOtel?: boolean;
|
|
11
13
|
};
|
|
12
14
|
export declare const withTestCtx: <ROut = never, E1 = never, RIn = never>(testContext: Vitest.TestContext, { suffix, makeLayer, timeout, forceOtel, }?: {
|
|
13
15
|
suffix?: string;
|
|
14
|
-
makeLayer?: (testContext: Vitest.TestContext) => Layer.Layer<ROut, E1, RIn>;
|
|
15
|
-
timeout?: Duration.
|
|
16
|
+
makeLayer?: (testContext: Vitest.TestContext) => Layer.Layer<ROut, E1, RIn | Scope.Scope>;
|
|
17
|
+
timeout?: Duration.Input;
|
|
16
18
|
forceOtel?: boolean;
|
|
17
|
-
}) => <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E | E1 | Cause.
|
|
19
|
+
}) => <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E | E1 | Cause.TimeoutError, WithoutTestCtxServices<RIn> | WithoutLayerAndTestCtxServices<R, ROut>>;
|
|
18
20
|
/**
|
|
19
21
|
* Shared properties for all enhanced test context phases
|
|
20
22
|
*/
|
|
@@ -35,6 +37,15 @@ export type EnhancedTestContext = (EnhancedTestContextBase & {
|
|
|
35
37
|
/** Number of shrinking attempts */
|
|
36
38
|
shrinkAttempt: number;
|
|
37
39
|
});
|
|
40
|
+
/**
|
|
41
|
+
* Normalizes propOptions to ensure @effect/vitest receives correct fastCheck structure
|
|
42
|
+
*/
|
|
43
|
+
type ArbitraryValues<Arbs extends Vitest.Vitest.Arbitraries> = {
|
|
44
|
+
[K in keyof Arbs]: Arbs[K] extends FC.Arbitrary<infer T> ? T : Arbs[K] extends Schema.Schema<infer T> ? T : never;
|
|
45
|
+
};
|
|
46
|
+
type PropOptions<Arbs extends Vitest.Vitest.Arbitraries> = Omit<Vitest.TestOptions, 'fastCheck'> & {
|
|
47
|
+
fastCheck?: FC.Parameters<ArbitraryValues<Arbs>>;
|
|
48
|
+
};
|
|
38
49
|
/**
|
|
39
50
|
* Equivalent to Vitest.prop but provides enhanced context including shrinking progress visibility
|
|
40
51
|
*
|
|
@@ -46,7 +57,5 @@ export type EnhancedTestContext = (EnhancedTestContextBase & {
|
|
|
46
57
|
*
|
|
47
58
|
* TODO: Upstream to Effect
|
|
48
59
|
*/
|
|
49
|
-
export declare const asProp: <Arbs extends Vitest.Vitest.Arbitraries, A, E, R>(api: Vitest.Vitest.Tester<R>, name: string, arbitraries: Arbs, test: Vitest.Vitest.TestFunction<A, E, R, [
|
|
50
|
-
fastCheck?: FC.Parameters<{ [K in keyof Arbs]: Arbs[K] extends FC.Arbitrary<infer T> ? T : Schema.Schema.Type<Arbs[K]>; }>;
|
|
51
|
-
})) => void;
|
|
60
|
+
export declare const asProp: <Arbs extends Vitest.Vitest.Arbitraries, A, E, R>(api: Vitest.Vitest.Tester<R>, name: string, arbitraries: Arbs, test: Vitest.Vitest.TestFunction<A, E, R, [ArbitraryValues<Arbs>, Vitest.TestContext, EnhancedTestContext]>, propOptions: number | PropOptions<Arbs>) => void;
|
|
52
61
|
//# sourceMappingURL=Vitest.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Vitest.d.ts","sourceRoot":"","sources":["../../src/node-vitest/Vitest.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,MAAM,gBAAgB,CAAA;AAG7C,OAAO,EACL,KAAK,KAAK,EACV,QAAQ,EACR,MAAM,EACN,KAAK,SAAS,IAAI,EAAE,EAEpB,KAAK,EACL,KAAK,UAAU,EAEf,KAAK,MAAM,EACX,KAAK,KAAK,EACX,MAAM,yBAAyB,CAAA;AAKhC,cAAc,gBAAgB,CAAA;AAE9B,eAAO,MAAM,eAAe,SAAwE,CAAA;AAEpG,eAAO,MAAM,eAAe,EAAE,CAAC,IAAI,G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C,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAC5B,MAAM,MAAM,EACZ,aAAa,IAAI,EACjB,MAAM,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,WAAW,EAAE,mBAAmB,CAAC,CAAC,EAC3G,aAAa,MAAM,GAAG,WAAW,CAAC,IAAI,CAAC,SA2CxC,CAAA"}
|
|
@@ -8,7 +8,10 @@ export const DEBUGGER_ACTIVE = Boolean(process.env.DEBUGGER_ACTIVE ?? inspector.
|
|
|
8
8
|
export const makeWithTestCtx = (ctxParams) => (testContext) => withTestCtx(testContext, ctxParams);
|
|
9
9
|
export const withTestCtx = (testContext, { suffix, makeLayer, timeout = IS_CI === true ? 60_000 : 10_000, forceOtel = false, } = {}) => (self) => {
|
|
10
10
|
const spanName = `${testContext.task.suite?.name}:${testContext.task.name}${suffix !== undefined ? `:${suffix}` : ''}`;
|
|
11
|
+
// `Layer.empty` provides `never`, which is narrower than an arbitrary generic
|
|
12
|
+
// `ROut`; widen it for the no-layer branch so `Effect.provide` can typecheck.
|
|
11
13
|
const layer = makeLayer?.(testContext) ?? Layer.empty;
|
|
14
|
+
const timeoutDuration = Duration.fromInputUnsafe(timeout);
|
|
12
15
|
const otelLayer = DEBUGGER_ACTIVE === true || forceOtel === true
|
|
13
16
|
? OtelLiveHttp({ rootSpanName: spanName, serviceName: 'vitest-runner', skipLogUrl: false })
|
|
14
17
|
: OtelLiveDummy;
|
|
@@ -16,14 +19,11 @@ export const withTestCtx = (testContext, { suffix, makeLayer, timeout = IS_CI ==
|
|
|
16
19
|
return self.pipe(DEBUGGER_ACTIVE === true
|
|
17
20
|
? identity
|
|
18
21
|
: Effect.logWarnIfTakesLongerThan({
|
|
19
|
-
duration: Duration.toMillis(
|
|
20
|
-
label: `${spanName} approaching timeout (timeout: ${Duration.format(
|
|
22
|
+
duration: Duration.toMillis(timeoutDuration) * 0.8,
|
|
23
|
+
label: `${spanName} approaching timeout (timeout: ${Duration.format(timeoutDuration)})`,
|
|
21
24
|
}), DEBUGGER_ACTIVE === true ? identity : Effect.timeout(timeout), Effect.provide(combinedLayer), Effect.scoped, // We need to scope the effect manually here because otherwise the span is not closed
|
|
22
25
|
Effect.annotateLogs({ suffix }));
|
|
23
26
|
};
|
|
24
|
-
/**
|
|
25
|
-
* Normalizes propOptions to ensure @effect/vitest receives correct fastCheck structure
|
|
26
|
-
*/
|
|
27
27
|
const normalizePropOptions = (propOptions) => {
|
|
28
28
|
// If it's a number, treat as timeout and add our default fastCheck
|
|
29
29
|
if (Predicate.isObject(propOptions) === false) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Vitest.js","sourceRoot":"","sources":["../../src/node-vitest/Vitest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAA;AAI3C,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACxC,OAAO,EAEL,QAAQ,EACR,MAAM,EAEN,QAAQ,EACR,KAAK,EAEL,SAAS,GAGV,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAErD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,cAAc,gBAAgB,CAAA;AAE9B,MAAM,CAAC,MAAM,eAAe,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,SAAS,CAAC,GAAG,EAAE,KAAK,SAAS,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"Vitest.js","sourceRoot":"","sources":["../../src/node-vitest/Vitest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAA;AAI3C,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACxC,OAAO,EAEL,QAAQ,EACR,MAAM,EAEN,QAAQ,EACR,KA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Ae;aAChB,CAAA;QAEP,OAAO,IAAI,CAAC,UAAU,EAAE,GAAG,EAAE,eAAe,CAAC,CAAA;IAC/C,CAAC,EACD,qBAAqB,CACtB,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { Schema } from '@livestore/utils/effect';
|
|
2
|
-
declare const TestError_base: Schema.
|
|
3
|
-
readonly
|
|
4
|
-
}
|
|
5
|
-
message: typeof Schema.String;
|
|
6
|
-
}>;
|
|
2
|
+
declare const TestError_base: Schema.Class<TestError, Schema.TaggedStruct<"TestError", {
|
|
3
|
+
readonly message: Schema.String;
|
|
4
|
+
}>, import("effect/Cause").YieldableError>;
|
|
7
5
|
export declare class TestError extends TestError_base {
|
|
8
6
|
}
|
|
9
7
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Vitest.test.d.ts","sourceRoot":"","sources":["../../src/node-vitest/Vitest.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,MAAM,EAAE,MAAM,yBAAyB,CAAA
|
|
1
|
+
{"version":3,"file":"Vitest.test.d.ts","sourceRoot":"","sources":["../../src/node-vitest/Vitest.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,MAAM,EAAE,MAAM,yBAAyB,CAAA;;;;AAInE,qBAAa,SAAU,SAAQ,cAE7B;CAAG"}
|
|
@@ -9,7 +9,7 @@ export class TestError extends Schema.TaggedError()('TestError', {
|
|
|
9
9
|
Vitest.describe('Vitest.asProp', () => {
|
|
10
10
|
const IntArbitrary = FastCheck.integer({ min: 1, max: 100 });
|
|
11
11
|
// Always-passing test - should only show initial phase
|
|
12
|
-
Vitest.asProp(Vitest.
|
|
12
|
+
Vitest.asProp(Vitest.live, 'always-pass test (shows only initial runs)', [IntArbitrary], (properties, _ctx, enhanced) => Effect.gen(function* () {
|
|
13
13
|
const [value] = properties;
|
|
14
14
|
if (value === undefined) {
|
|
15
15
|
return yield* new TestError({ message: 'Value is undefined' });
|
|
@@ -22,9 +22,20 @@ Vitest.describe('Vitest.asProp', () => {
|
|
|
22
22
|
// This test always passes, so no shrinking will occur
|
|
23
23
|
return;
|
|
24
24
|
}), { fastCheck: { numRuns: 4 } });
|
|
25
|
+
Vitest.asProp(Vitest.live, 'converts record-form schemas to arbitraries', {
|
|
26
|
+
count: Schema.Int,
|
|
27
|
+
payload: Schema.Struct({
|
|
28
|
+
label: Schema.String,
|
|
29
|
+
note: Schema.optional(Schema.String),
|
|
30
|
+
}),
|
|
31
|
+
}, ({ count, payload }) => Effect.sync(() => {
|
|
32
|
+
Vitest.expect(Number.isInteger(count)).toBe(true);
|
|
33
|
+
Vitest.expect(typeof payload.label).toBe('string');
|
|
34
|
+
Vitest.expect(payload.note === undefined || typeof payload.note === 'string').toBe(true);
|
|
35
|
+
}), { fastCheck: { numRuns: 10 } });
|
|
25
36
|
// Failing test - should show initial + shrinking phases
|
|
26
37
|
let alreadyFailed = false;
|
|
27
|
-
Vitest.asProp(Vitest.
|
|
38
|
+
Vitest.asProp(Vitest.live, 'failing test (shows initial runs + shrinking)', [IntArbitrary], (properties, ctx, enhanced) => Effect.gen(function* () {
|
|
28
39
|
const [value] = properties;
|
|
29
40
|
if (value === undefined) {
|
|
30
41
|
return yield* new TestError({ message: 'Value is undefined' });
|
|
@@ -46,7 +57,7 @@ Vitest.describe('Vitest.asProp', () => {
|
|
|
46
57
|
return;
|
|
47
58
|
}), { fastCheck: { numRuns: 3 } });
|
|
48
59
|
// Test with endOnFailure: true - should not show shrinking
|
|
49
|
-
Vitest.asProp(Vitest.
|
|
60
|
+
Vitest.asProp(Vitest.live, 'failing test with endOnFailure (no shrinking)', [IntArbitrary], (properties, _ctx, enhanced) => Effect.gen(function* () {
|
|
50
61
|
const [value] = properties;
|
|
51
62
|
if (value === undefined) {
|
|
52
63
|
return yield* new TestError({ message: 'Value is undefined' });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Vitest.test.js","sourceRoot":"","sources":["../../src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YAClB,gFAAgF;YAChF,4EAA4E;YAC5E,4EAA4E;YAC5E,+DAA+D;YAC/D,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;SACtB;QACD,KAAK,EAAE,IAAI;KACZ,CACF,CAAA;AACH,CAAC,CAAC,CAAA"}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { Duration, Effect, FileSystem, HttpClient, Schedule, Schema } from '@livestore/utils/effect';
|
|
2
|
-
declare const WranglerDevServerError_base: Schema.
|
|
3
|
-
readonly
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
port: typeof Schema.Number;
|
|
8
|
-
}>;
|
|
1
|
+
import { Cause, Context, Duration, Effect, FileSystem, HttpClient, Layer, Schedule, Schema } from '@livestore/utils/effect';
|
|
2
|
+
declare const WranglerDevServerError_base: Schema.Class<WranglerDevServerError, Schema.TaggedStruct<"WranglerDevServerError", {
|
|
3
|
+
readonly cause: Schema.Defect;
|
|
4
|
+
readonly message: Schema.String;
|
|
5
|
+
readonly port: Schema.Finite;
|
|
6
|
+
}>, Cause.YieldableError>;
|
|
9
7
|
/**
|
|
10
8
|
* Error type for WranglerDevServer operations
|
|
11
9
|
*/
|
|
@@ -14,7 +12,7 @@ export declare class WranglerDevServerError extends WranglerDevServerError_base
|
|
|
14
12
|
/**
|
|
15
13
|
* WranglerDevServer instance interface
|
|
16
14
|
*/
|
|
17
|
-
export interface
|
|
15
|
+
export interface Service {
|
|
18
16
|
readonly port: number;
|
|
19
17
|
readonly url: string;
|
|
20
18
|
}
|
|
@@ -28,13 +26,13 @@ export interface WranglerDevServer {
|
|
|
28
26
|
*/
|
|
29
27
|
export interface WranglerReadinessOptions {
|
|
30
28
|
/** Max time to wait for wrangler to report ready before retrying. */
|
|
31
|
-
startupTimeout?: Duration.
|
|
29
|
+
startupTimeout?: Duration.Input;
|
|
32
30
|
/** Max time for the HTTP connectivity check after wrangler reports ready. */
|
|
33
|
-
connectTimeout?: Duration.
|
|
31
|
+
connectTimeout?: Duration.Input;
|
|
34
32
|
/** Retry policy for startup attempts (applies when startupTimeout elapses or wrangler throws). */
|
|
35
33
|
retrySchedule?: Schedule.Schedule<unknown>;
|
|
36
34
|
}
|
|
37
|
-
export interface
|
|
35
|
+
export interface Options {
|
|
38
36
|
/** Path to wrangler.toml (defaults to cwd/wrangler.toml). */
|
|
39
37
|
wranglerConfigPath?: string;
|
|
40
38
|
/** Working directory wrangler should use. */
|
|
@@ -48,14 +46,9 @@ export interface StartWranglerDevServerArgs {
|
|
|
48
46
|
/** Readiness and retry configuration for bringing up wrangler and confirming connectivity. */
|
|
49
47
|
readiness?: WranglerReadinessOptions;
|
|
50
48
|
}
|
|
51
|
-
declare const
|
|
52
|
-
readonly scoped: (args: StartWranglerDevServerArgs) => Effect.Effect<{
|
|
53
|
-
port: number;
|
|
54
|
-
url: string;
|
|
55
|
-
}, WranglerDevServerError, import("effect/Scope").Scope | FileSystem.FileSystem | HttpClient.HttpClient>;
|
|
56
|
-
}>;
|
|
49
|
+
declare const WranglerDevServer_base: Context.ServiceClass<WranglerDevServer, "@livestore/utils-dev/WranglerDevServer", Service>;
|
|
57
50
|
/**
|
|
58
|
-
* WranglerDevServer as an Effect.
|
|
51
|
+
* WranglerDevServer as an Effect service.
|
|
59
52
|
*
|
|
60
53
|
* This service provides the WranglerDevServer properties and can be accessed
|
|
61
54
|
* directly to get port and url.
|
|
@@ -63,7 +56,9 @@ declare const WranglerDevServerService_base: Effect.Service.Class<WranglerDevSer
|
|
|
63
56
|
* TODO: Allow for config to be passed in via code instead of `wrangler.toml` file
|
|
64
57
|
* (would need to be placed in temporary file as wrangler only accepts files as config)
|
|
65
58
|
*/
|
|
66
|
-
export declare class
|
|
59
|
+
export declare class WranglerDevServer extends WranglerDevServer_base {
|
|
67
60
|
}
|
|
61
|
+
export declare const make: (args: Options) => Effect.Effect<Service, WranglerDevServerError, import("effect/Scope").Scope | FileSystem.FileSystem | HttpClient.HttpClient>;
|
|
62
|
+
export declare const layer: (options: Options) => Layer.Layer<WranglerDevServer, WranglerDevServerError, FileSystem.FileSystem | HttpClient.HttpClient>;
|
|
68
63
|
export {};
|
|
69
64
|
//# sourceMappingURL=WranglerDevServer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WranglerDevServer.d.ts","sourceRoot":"","sources":["../../src/wrangler/WranglerDevServer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"WranglerDevServer.d.ts","sourceRoot":"","sources":["../../src/wrangler/WranglerDevServer.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,KAAK,EACL,OAAO,EACP,QAAQ,EACR,MAAM,EACN,UAAU,EACV,UAAU,EACV,KAAK,EACL,QAAQ,EACR,MAAM,EACP,MAAM,yBAAyB,CAAA;;;;;;AAGhC;;GAEG;AACH,qBAAa,sBAAuB,SAAQ,2BAM1C;CAAG;AAEL;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CAErB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,wBAAwB;IACvC,qEAAqE;IACrE,cAAc,CAAC,EAAE,QAAQ,CAAC,KAAK,CAAA;IAC/B,6EAA6E;IAC7E,cAAc,CAAC,EAAE,QAAQ,CAAC,KAAK,CAAA;IAC/B,kGAAkG;IAClG,aAAa,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;CAC3C;AAED,MAAM,WAAW,OAAO;IACtB,6DAA6D;IAC7D,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,6CAA6C;IAC7C,GAAG,EAAE,MAAM,CAAA;IACX,sFAAsF;IACtF,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,qBAAqB;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,gDAAgD;IAChD,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,8FAA8F;IAC9F,SAAS,CAAC,EAAE,wBAAwB,CAAA;CACrC;;AAED;;;;;;;;GAQG;AACH,qBAAa,iBAAkB,SAAQ,sBAEtC;CAAG;AAEJ,eAAO,MAAM,IAAI,GAAI,MAAM,OAAO,iIAkH/B,CAAA;AAEH,eAAO,MAAM,KAAK,GAAI,SAAS,OAAO,0GAAmD,CAAA"}
|