@livestore/utils-dev 0.4.0-dev.2 → 0.4.0-dev.20

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.
Files changed (73) hide show
  1. package/dist/.tsbuildinfo.json +1 -1
  2. package/dist/node/DockerComposeService/DockerComposeService.d.ts +58 -0
  3. package/dist/node/DockerComposeService/DockerComposeService.d.ts.map +1 -0
  4. package/dist/node/DockerComposeService/DockerComposeService.js +144 -0
  5. package/dist/node/DockerComposeService/DockerComposeService.js.map +1 -0
  6. package/dist/node/DockerComposeService/DockerComposeService.test.d.ts +2 -0
  7. package/dist/node/DockerComposeService/DockerComposeService.test.d.ts.map +1 -0
  8. package/dist/node/DockerComposeService/DockerComposeService.test.js +64 -0
  9. package/dist/node/DockerComposeService/DockerComposeService.test.js.map +1 -0
  10. package/dist/node/cmd-log.d.ts +21 -0
  11. package/dist/node/cmd-log.d.ts.map +1 -0
  12. package/dist/node/cmd-log.js +47 -0
  13. package/dist/node/cmd-log.js.map +1 -0
  14. package/dist/node/cmd.d.ts +35 -0
  15. package/dist/node/cmd.d.ts.map +1 -0
  16. package/dist/node/cmd.js +235 -0
  17. package/dist/node/cmd.js.map +1 -0
  18. package/dist/node/cmd.test.d.ts +2 -0
  19. package/dist/node/cmd.test.d.ts.map +1 -0
  20. package/dist/node/cmd.test.js +102 -0
  21. package/dist/node/cmd.test.js.map +1 -0
  22. package/dist/node/mod.d.ts +5 -26
  23. package/dist/node/mod.d.ts.map +1 -1
  24. package/dist/node/mod.js +52 -59
  25. package/dist/node/mod.js.map +1 -1
  26. package/dist/node/workspace.d.ts +22 -0
  27. package/dist/node/workspace.d.ts.map +1 -0
  28. package/dist/node/workspace.js +26 -0
  29. package/dist/node/workspace.js.map +1 -0
  30. package/dist/node-vitest/Vitest.d.ts +41 -7
  31. package/dist/node-vitest/Vitest.d.ts.map +1 -1
  32. package/dist/node-vitest/Vitest.js +82 -5
  33. package/dist/node-vitest/Vitest.js.map +1 -1
  34. package/dist/node-vitest/Vitest.test.d.ts +2 -0
  35. package/dist/node-vitest/Vitest.test.d.ts.map +1 -0
  36. package/dist/node-vitest/Vitest.test.js +70 -0
  37. package/dist/node-vitest/Vitest.test.js.map +1 -0
  38. package/dist/wrangler/WranglerDevServer.d.ts +69 -0
  39. package/dist/wrangler/WranglerDevServer.d.ts.map +1 -0
  40. package/dist/wrangler/WranglerDevServer.js +103 -0
  41. package/dist/wrangler/WranglerDevServer.js.map +1 -0
  42. package/dist/wrangler/WranglerDevServer.test.d.ts +2 -0
  43. package/dist/wrangler/WranglerDevServer.test.d.ts.map +1 -0
  44. package/dist/wrangler/WranglerDevServer.test.js +77 -0
  45. package/dist/wrangler/WranglerDevServer.test.js.map +1 -0
  46. package/dist/wrangler/fixtures/cf-worker.d.ts +8 -0
  47. package/dist/wrangler/fixtures/cf-worker.d.ts.map +1 -0
  48. package/dist/wrangler/fixtures/cf-worker.js +11 -0
  49. package/dist/wrangler/fixtures/cf-worker.js.map +1 -0
  50. package/dist/wrangler/mod.d.ts +2 -0
  51. package/dist/wrangler/mod.d.ts.map +1 -0
  52. package/dist/wrangler/mod.js +2 -0
  53. package/dist/wrangler/mod.js.map +1 -0
  54. package/package.json +11 -10
  55. package/src/node/DockerComposeService/DockerComposeService.test.ts +91 -0
  56. package/src/node/DockerComposeService/DockerComposeService.ts +328 -0
  57. package/src/node/DockerComposeService/test-fixtures/docker-compose.yml +4 -0
  58. package/src/node/cmd-log.ts +87 -0
  59. package/src/node/cmd.test.ts +130 -0
  60. package/src/node/cmd.ts +420 -0
  61. package/src/node/mod.ts +63 -116
  62. package/src/node/workspace.ts +45 -0
  63. package/src/node-vitest/Vitest.test.ts +112 -0
  64. package/src/node-vitest/Vitest.ts +193 -17
  65. package/src/wrangler/WranglerDevServer.test.ts +133 -0
  66. package/src/wrangler/WranglerDevServer.ts +220 -0
  67. package/src/wrangler/fixtures/cf-worker.ts +11 -0
  68. package/src/wrangler/fixtures/wrangler.toml +11 -0
  69. package/src/wrangler/mod.ts +6 -0
  70. package/dist/node-vitest/polyfill.d.ts +0 -2
  71. package/dist/node-vitest/polyfill.d.ts.map +0 -1
  72. package/dist/node-vitest/polyfill.js +0 -3
  73. package/dist/node-vitest/polyfill.js.map +0 -1
@@ -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,WAAW,MAAM,+BAA+B,CAAA;AAC5D,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAE9F,OAAO,EACL,OAAO,EACP,MAAM,EACN,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,UAAU,EACV,MAAM,GACP,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AACrD,OAAO,KAAK,IAAI,MAAM,oBAAoB,CAAA;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAA;AAC9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAA;AAC3E,OAAO,EAAE,6BAA6B,EAAE,MAAM,4BAA4B,CAAA;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAA;AAElE,OAAO,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAA;AAC9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAA;AAE3E,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAA;AAE7C,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,EAC3B,WAAW,EACX,YAAY,EACZ,kBAAkB,EAClB,UAAU,EACV,UAAU,EACV,kBAAkB,MAQhB,EAAE,EAAwE,EAAE,CAC9E,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IACl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Q,EAAE,MAAM,EAAE,YAAY,EAAW,CAAA;AAChE,CAAC,CAAA"}
@@ -0,0 +1,22 @@
1
+ import { Context, Layer } from '@livestore/utils/effect';
2
+ export type WorkspaceInfo = string;
3
+ declare const CurrentWorkingDirectory_base: Context.TagClass<CurrentWorkingDirectory, "CurrentWorkingDirectory", string>;
4
+ /** Current working directory. */
5
+ export declare class CurrentWorkingDirectory extends CurrentWorkingDirectory_base {
6
+ /** Layer that captures the process cwd once. */
7
+ static live: Layer.Layer<CurrentWorkingDirectory, never, never>;
8
+ /** Override CWD for tests or nested invocations. */
9
+ static fromPath: (cwd: string) => Layer.Layer<CurrentWorkingDirectory, never, never>;
10
+ }
11
+ declare const LivestoreWorkspace_base: Context.TagClass<LivestoreWorkspace, "LivestoreWorkspace", string>;
12
+ /** Livestore workspace root (env required). */
13
+ export declare class LivestoreWorkspace extends LivestoreWorkspace_base {
14
+ /** Resolve from WORKSPACE_ROOT env. */
15
+ static live: Layer.Layer<LivestoreWorkspace, never, never>;
16
+ /** Provide a fixed Livestore root. */
17
+ static fromPath: (root: string) => Layer.Layer<LivestoreWorkspace, never, never>;
18
+ /** Derive a CurrentWorkingDirectory layer from the Livestore workspace root (with optional subpath) */
19
+ static toCwd: (/** Relative path to the Livestore workspace root */ subPath?: string) => Layer.Layer<CurrentWorkingDirectory, never, LivestoreWorkspace>;
20
+ }
21
+ export {};
22
+ //# sourceMappingURL=workspace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../../src/node/workspace.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAU,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAEhE,MAAM,MAAM,aAAa,GAAG,MAAM,CAAA;;AAElC,iCAAiC;AACjC,qBAAa,uBAAwB,SAAQ,4BAG1C;IACD,gDAAgD;IAChD,MAAM,CAAC,IAAI,qDAGV;IAED,oDAAoD;IACpD,MAAM,CAAC,QAAQ,GAAI,KAAK,MAAM,wDAAgD;CAC/E;;AAED,+CAA+C;AAC/C,qBAAa,kBAAmB,SAAQ,uBAAsE;IAC5G,uCAAuC;IACvC,MAAM,CAAC,IAAI,gDAMV;IAED,sCAAsC;IACtC,MAAM,CAAC,QAAQ,GAAI,MAAM,MAAM,mDAA4C;IAE3E,uGAAuG;IACvG,MAAM,CAAC,KAAK,GAAI,oDAAoD,CAAC,UAAU,MAAM,qEAOlF;CACJ"}
@@ -0,0 +1,26 @@
1
+ import path from 'node:path';
2
+ import { shouldNeverHappen } from '@livestore/utils';
3
+ import { Context, Effect, Layer } from '@livestore/utils/effect';
4
+ /** Current working directory. */
5
+ export class CurrentWorkingDirectory extends Context.Tag('CurrentWorkingDirectory')() {
6
+ /** Layer that captures the process cwd once. */
7
+ static live = Layer.effect(CurrentWorkingDirectory, Effect.sync(() => process.cwd()));
8
+ /** Override CWD for tests or nested invocations. */
9
+ static fromPath = (cwd) => Layer.succeed(CurrentWorkingDirectory, cwd);
10
+ }
11
+ /** Livestore workspace root (env required). */
12
+ export class LivestoreWorkspace extends Context.Tag('LivestoreWorkspace')() {
13
+ /** Resolve from WORKSPACE_ROOT env. */
14
+ static live = Layer.effect(LivestoreWorkspace, Effect.sync(() => {
15
+ const root = process.env.WORKSPACE_ROOT ?? shouldNeverHappen('WORKSPACE_ROOT is not set');
16
+ return root;
17
+ }));
18
+ /** Provide a fixed Livestore root. */
19
+ static fromPath = (root) => Layer.succeed(LivestoreWorkspace, root);
20
+ /** Derive a CurrentWorkingDirectory layer from the Livestore workspace root (with optional subpath) */
21
+ static toCwd = (/** Relative path to the Livestore workspace root */ subPath) => Layer.effect(CurrentWorkingDirectory, Effect.gen(function* () {
22
+ const root = yield* LivestoreWorkspace;
23
+ return path.join(root, subPath ?? '');
24
+ }));
25
+ }
26
+ //# sourceMappingURL=workspace.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace.js","sourceRoot":"","sources":["../../src/node/workspace.ts"],"names":[],"mappings":"AAAA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AAG,KAAK,CAAC,CAAC,kBAAkB,CAAA;QACtC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,IAAI,EAAE,CAAC,CAAA;IACvC,CAAC,CAAC,CACH,CAAA"}
@@ -1,18 +1,52 @@
1
1
  import type * as Vitest from '@effect/vitest';
2
- import { type Cause, Duration, Effect, Layer, type OtelTracer, type Scope } from '@livestore/utils/effect';
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
- export declare const makeWithTestCtx: <R1 = never, E1 = never>(ctxParams: WithTestCtxParams<R1, E1>) => (testContext: Vitest.TestContext) => <A, E>(self: Effect.Effect<A, E, OtelTracer.OtelTracer | Scope.Scope | R1>) => Effect.Effect<A, Cause.TimeoutException | E1 | E, Scope.Scope>;
6
- export type WithTestCtxParams<R1 = never, E1 = never> = {
5
+ 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.TimeoutException, Exclude<RIn, OtelTracer.OtelTracer | Scope.Scope> | Exclude<R, ROut | OtelTracer.OtelTracer | Scope.Scope>>;
6
+ export type WithTestCtxParams<ROut, E1, RIn> = {
7
7
  suffix?: string;
8
- makeLayer?: (testContext: Vitest.TestContext) => Layer.Layer<R1, E1, Scope.Scope>;
8
+ makeLayer?: (testContext: Vitest.TestContext) => Layer.Layer<ROut, E1, RIn | Scope.Scope>;
9
9
  timeout?: Duration.DurationInput;
10
10
  forceOtel?: boolean;
11
11
  };
12
- export declare const withTestCtx: <R1 = never, E1 = never>(testContext: Vitest.TestContext, { suffix, makeLayer, timeout, forceOtel, }?: {
12
+ export declare const withTestCtx: <ROut = never, E1 = never, RIn = never>(testContext: Vitest.TestContext, { suffix, makeLayer, timeout, forceOtel, }?: {
13
13
  suffix?: string;
14
- makeLayer?: (testContext: Vitest.TestContext) => Layer.Layer<R1, E1, Scope.Scope>;
14
+ makeLayer?: (testContext: Vitest.TestContext) => Layer.Layer<ROut, E1, RIn>;
15
15
  timeout?: Duration.DurationInput;
16
16
  forceOtel?: boolean;
17
- }) => <A, E>(self: Effect.Effect<A, E, Scope.Scope | OtelTracer.OtelTracer | R1>) => Effect.Effect<A, E | Cause.TimeoutException | E1, Scope.Scope>;
17
+ }) => <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E | E1 | Cause.TimeoutException, Exclude<RIn, OtelTracer.OtelTracer | Scope.Scope> | Exclude<R, ROut | OtelTracer.OtelTracer | Scope.Scope>>;
18
+ /**
19
+ * Shared properties for all enhanced test context phases
20
+ */
21
+ export interface EnhancedTestContextBase {
22
+ numRuns: number;
23
+ /** 0-based index */
24
+ runIndex: number;
25
+ /** Total number of executions including initial runs and shrinking attempts */
26
+ totalExecutions: number;
27
+ }
28
+ /**
29
+ * Enhanced context for property-based tests that includes shrinking phase information
30
+ */
31
+ export type EnhancedTestContext = (EnhancedTestContextBase & {
32
+ _tag: 'initial';
33
+ }) | (EnhancedTestContextBase & {
34
+ _tag: 'shrinking';
35
+ /** Number of shrinking attempts */
36
+ shrinkAttempt: number;
37
+ });
38
+ /**
39
+ * Equivalent to Vitest.prop but provides enhanced context including shrinking progress visibility
40
+ *
41
+ * This function enhances the standard property-based testing by providing clear information about
42
+ * whether FastCheck is in the initial testing phase or the shrinking phase, solving the confusion
43
+ * where tests show "Run 26/6" when FastCheck's shrinking algorithm is active.
44
+ *
45
+ * TODO: allow for upper timelimit instead of / additional to `numRuns`
46
+ *
47
+ * TODO: Upstream to Effect
48
+ */
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, [{ [K in keyof Arbs]: Arbs[K] extends FC.Arbitrary<infer T> ? T : Schema.Schema.Type<Arbs[K]>; }, Vitest.TestContext, EnhancedTestContext]>, propOptions: number | (Vitest.TestOptions & {
50
+ fastCheck?: FC.Parameters<{ [K in keyof Arbs]: Arbs[K] extends FC.Arbitrary<infer T> ? T : Schema.Schema.Type<Arbs[K]>; }>;
51
+ })) => void;
18
52
  //# sourceMappingURL=Vitest.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Vitest.d.ts","sourceRoot":"","sources":["../../src/node-vitest/Vitest.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,MAAM,gBAAgB,CAAA;AAE7C,OAAO,EAAE,KAAK,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAY,KAAK,EAAE,KAAK,UAAU,EAAE,KAAK,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAIpH,cAAc,gBAAgB,CAAA;AAE9B,eAAO,MAAM,eAAe,SAAwE,CAAA;AAEpG,eAAO,MAAM,eAAe,GACzB,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,KAAK,EAAE,WAAW,iBAAiB,CAAC,EAAE,EAAE,EAAE,CAAC,MAC5D,aAAa,MAAM,CAAC,WAAW,MAyB/B,CAAC,EAAE,CAAC,wIAxBgC,CAAA;AAEvC,MAAM,MAAM,iBAAiB,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,KAAK,IAAI;IACtD,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,SAAS,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,CAAC,WAAW,KAAK,KAAK,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,EAAE,KAAK,CAAC,KAAK,CAAC,CAAA;IACjF,OAAO,CAAC,EAAE,QAAQ,CAAC,aAAa,CAAA;IAChC,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB,CAAA;AAED,eAAO,MAAM,WAAW,GACrB,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,KAAK,EACrB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AAS,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,GACvB,CAAC,IAAI,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAC3F,CAAC,CAAA;CACH,CAAC,SA0CP,CAAA"}
@@ -1,6 +1,6 @@
1
1
  import * as inspector from 'node:inspector';
2
2
  import { IS_CI } from '@livestore/utils';
3
- import { Duration, Effect, identity, Layer } from '@livestore/utils/effect';
3
+ import { Duration, Effect, identity, Layer, Predicate, } from '@livestore/utils/effect';
4
4
  import { OtelLiveDummy } from '@livestore/utils/node';
5
5
  import { OtelLiveHttp } from "../node/mod.js";
6
6
  export * from '@effect/vitest';
@@ -8,14 +8,91 @@ 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 ? 60_000 : 10_000, forceOtel = false, } = {}) => (self) => {
10
10
  const spanName = `${testContext.task.suite?.name}:${testContext.task.name}${suffix ? `:${suffix}` : ''}`;
11
- const layer = makeLayer?.(testContext);
12
- const otelLayer = DEBUGGER_ACTIVE || forceOtel ? OtelLiveHttp({ serviceName: 'vitest-runner', skipLogUrl: false }) : OtelLiveDummy;
11
+ const layer = makeLayer?.(testContext) ?? Layer.empty;
12
+ const otelLayer = DEBUGGER_ACTIVE || forceOtel
13
+ ? OtelLiveHttp({ rootSpanName: spanName, serviceName: 'vitest-runner', skipLogUrl: false })
14
+ : OtelLiveDummy;
15
+ const combinedLayer = layer.pipe(Layer.provideMerge(otelLayer));
13
16
  return self.pipe(DEBUGGER_ACTIVE
14
17
  ? identity
15
18
  : Effect.logWarnIfTakesLongerThan({
16
19
  duration: Duration.toMillis(timeout) * 0.8,
17
20
  label: `${spanName} approaching timeout (timeout: ${Duration.format(timeout)})`,
18
- }), DEBUGGER_ACTIVE ? identity : Effect.timeout(timeout), Effect.provide(otelLayer), Effect.provide(layer ?? Layer.empty), Effect.scoped, // We need to scope the effect manually here because otherwise the span is not closed
19
- Effect.withSpan(spanName), Effect.annotateLogs({ suffix }));
21
+ }), DEBUGGER_ACTIVE ? 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
+ Effect.annotateLogs({ suffix }));
23
+ };
24
+ /**
25
+ * Normalizes propOptions to ensure @effect/vitest receives correct fastCheck structure
26
+ */
27
+ const normalizePropOptions = (propOptions) => {
28
+ // If it's a number, treat as timeout and add our default fastCheck
29
+ if (!Predicate.isObject(propOptions)) {
30
+ return {
31
+ timeout: propOptions,
32
+ fastCheck: { numRuns: 100 },
33
+ };
34
+ }
35
+ // If no fastCheck property, add it with our default numRuns
36
+ if (!propOptions.fastCheck) {
37
+ return {
38
+ ...propOptions,
39
+ fastCheck: { numRuns: 100 },
40
+ };
41
+ }
42
+ // If fastCheck exists but no numRuns, add our default
43
+ if (propOptions.fastCheck && !propOptions.fastCheck.numRuns) {
44
+ return {
45
+ ...propOptions,
46
+ fastCheck: {
47
+ ...propOptions.fastCheck,
48
+ numRuns: 100,
49
+ },
50
+ };
51
+ }
52
+ // If everything is properly structured, pass through
53
+ return propOptions;
54
+ };
55
+ /**
56
+ * Equivalent to Vitest.prop but provides enhanced context including shrinking progress visibility
57
+ *
58
+ * This function enhances the standard property-based testing by providing clear information about
59
+ * whether FastCheck is in the initial testing phase or the shrinking phase, solving the confusion
60
+ * where tests show "Run 26/6" when FastCheck's shrinking algorithm is active.
61
+ *
62
+ * TODO: allow for upper timelimit instead of / additional to `numRuns`
63
+ *
64
+ * TODO: Upstream to Effect
65
+ */
66
+ export const asProp = (api, name, arbitraries, test, propOptions) => {
67
+ const normalizedPropOptions = normalizePropOptions(propOptions);
68
+ const numRuns = normalizedPropOptions.fastCheck?.numRuns ?? 100;
69
+ let runIndex = 0;
70
+ let shrinkAttempts = 0;
71
+ let totalExecutions = 0;
72
+ return api.prop(name, arbitraries, (properties, ctx) => {
73
+ if (ctx.signal.aborted) {
74
+ return ctx.skip('Test aborted');
75
+ }
76
+ totalExecutions++;
77
+ const isInShrinkingPhase = runIndex >= numRuns;
78
+ if (isInShrinkingPhase) {
79
+ shrinkAttempts++;
80
+ }
81
+ const enhancedContext = isInShrinkingPhase
82
+ ? {
83
+ _tag: 'shrinking',
84
+ numRuns,
85
+ runIndex: runIndex++,
86
+ shrinkAttempt: shrinkAttempts,
87
+ totalExecutions,
88
+ }
89
+ : {
90
+ _tag: 'initial',
91
+ numRuns,
92
+ runIndex: runIndex++,
93
+ totalExecutions,
94
+ };
95
+ return test(properties, ctx, enhancedContext);
96
+ }, normalizedPropOptions);
20
97
  };
21
98
  //# sourceMappingURL=Vitest.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Vitest.js","sourceRoot":"","sources":["../../src/node-vitest/Vitest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAA;AAE3C,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACxC,OAAO,EAAc,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAA+B,MAAM,yBAAyB,CAAA;AACpH,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AACrD,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;AAEpG,MAAM,CAAC,MAAM,eAAe,GAC1B,CAAyB,SAAoC,EAAE,EAAE,CACjE,CAAC,WAA+B,EAAE,EAAE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YACH,CAAC,CAAC;gBACE,IAAI,EAAE,SAAS;gBACf,OAAO;gBACP,QAAQ,EAAE,QAAQ,EAAE;gBACpB,eAAe;aAChB,CAAA;QAEL,OAAO,IAAI,CAAC,UAAU,EAAE,GAAG,EAAE,eAAe,CAAC,CAAA;IAC/C,CAAC,EACD,qBAAqB,CACtB,CAAA;AACH,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Vitest.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Vitest.test.d.ts","sourceRoot":"","sources":["../../src/node-vitest/Vitest.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,70 @@
1
+ import { Effect, FastCheck } from '@livestore/utils/effect';
2
+ import * as Vitest from "./Vitest.js";
3
+ // Demonstrate enhanced asProp functionality with clear shrinking progress
4
+ // This showcases the fix for the "Run 26/6" bug and accurate shrinking detection
5
+ Vitest.describe('Vitest.asProp', () => {
6
+ const IntArbitrary = FastCheck.integer({ min: 1, max: 100 });
7
+ // Always-passing test - should only show initial phase
8
+ Vitest.asProp(Vitest.scopedLive, 'always-pass test (shows only initial runs)', [IntArbitrary], (properties, _ctx, enhanced) => Effect.gen(function* () {
9
+ const [value] = properties;
10
+ if (value === undefined) {
11
+ return yield* Effect.fail(new Error('Value is undefined'));
12
+ }
13
+ console.log(`✅ ALWAYS-PASS [${enhanced._tag.toUpperCase()}]: ` +
14
+ (enhanced._tag === 'initial'
15
+ ? `Run ${enhanced.runIndex + 1}/${enhanced.numRuns}`
16
+ : `Shrink #${enhanced.shrinkAttempt} (finding minimal counterexample)`) +
17
+ `, value=${value}, total=${enhanced.totalExecutions}`);
18
+ // This test always passes, so no shrinking will occur
19
+ return;
20
+ }), { fastCheck: { numRuns: 4 } });
21
+ // Failing test - should show initial + shrinking phases
22
+ let alreadyFailed = false;
23
+ Vitest.asProp(Vitest.scopedLive, 'failing test (shows initial runs + shrinking)', [IntArbitrary], (properties, ctx, enhanced) => Effect.gen(function* () {
24
+ const [value] = properties;
25
+ if (value === undefined) {
26
+ return yield* Effect.fail(new Error('Value is undefined'));
27
+ }
28
+ const displayInfo = enhanced._tag === 'initial'
29
+ ? `Run ${enhanced.runIndex + 1}/${enhanced.numRuns}`
30
+ : `Shrink #${enhanced.shrinkAttempt} (finding minimal counterexample)`;
31
+ const status = value > 80 ? '💥' : '✅';
32
+ console.log(`${status} FAILING-TEST [${enhanced._tag.toUpperCase()}]: ${displayInfo}, value=${value}, total=${enhanced.totalExecutions}`);
33
+ // Fail when value is greater than 80 to trigger shrinking
34
+ if (value > 80) {
35
+ alreadyFailed = true;
36
+ return yield* Effect.fail(new Error(`Value ${value} is too large (> 80)`));
37
+ }
38
+ if (alreadyFailed && enhanced._tag === 'shrinking') {
39
+ ctx.skip("For the sake of this test, we don't want to fail but want to skip");
40
+ return;
41
+ }
42
+ return;
43
+ }), { fastCheck: { numRuns: 3 } });
44
+ // Test with endOnFailure: true - should not show shrinking
45
+ Vitest.asProp(Vitest.scopedLive, 'failing test with endOnFailure (no shrinking)', [IntArbitrary], (properties, _ctx, enhanced) => Effect.gen(function* () {
46
+ const [value] = properties;
47
+ if (value === undefined) {
48
+ return yield* Effect.fail(new Error('Value is undefined'));
49
+ }
50
+ console.log(`🚫 END-ON-FAILURE [${enhanced._tag.toUpperCase()}]: ` +
51
+ `Run ${enhanced.runIndex + 1}/${enhanced.numRuns}, value=${value}, total=${enhanced.totalExecutions}`);
52
+ // This will fail but shrinking is disabled
53
+ if (value > 50) {
54
+ return yield* Effect.fail(new Error(`Value ${value} is too large (> 50) - but no shrinking!`));
55
+ }
56
+ return;
57
+ }), {
58
+ fastCheck: {
59
+ numRuns: 5,
60
+ endOnFailure: true,
61
+ // Provide explicit samples so the second run crosses >50. Randomly drawing five
62
+ // integers has ~3% chance to stay ≤ 50, which would break the `fails: true`
63
+ // expectation even though shrinking remains disabled. The examples keep the
64
+ // demo readable while leaving the remaining runs to FastCheck.
65
+ examples: [[5], [66]],
66
+ },
67
+ fails: true,
68
+ });
69
+ });
70
+ //# sourceMappingURL=Vitest.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Vitest.test.js","sourceRoot":"","sources":["../../src/node-vitest/Vitest.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAC3D,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AAErC,0EAA0E;AAC1E,iFAAiF;AAEjF,MAAM,CAAC,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IACpC,MAAM,YAAY,GAAG,SAAS,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAA;IAE5D,uDAAuD;IACvD,MAAM,CAAC,MAAM,CACX,MAAM,CAAC,UAAU,EACjB,4CAA4C,EAC5C,CAAC,YAAY,CAAC,EACd,CAAC,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,CAC7B,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;QAClB,MAAM,CAAC,KAAK,CAAC,GAAG,UAAU,CAAA;QAC1B,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,OAAO,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC,CAAA;QAC5D,CAAC;QAED,OAAO,CAAC,GAAG,CACT,kBAAkB,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK;YAChD,CAAC,QAAQ,CAAC,IAAI,KAAK,SAAS;gBAC1B,CAAC,CAAC,OAAO,QAAQ,CAAC,QAAQ,GAAG,CAAC,IAAI,QAAQ,CAAC,OAAO,EAAE;gBACpD,CAAC,CAAC,WAAW,QAAQ,CAAC,aAAa,mCAAmC,CAAC;YACzE,WAAW,KAAK,WAAW,QAAQ,CAAC,eAAe,EAAE,CACxD,CAAA;QAED,sDAAsD;QACtD,OAAM;IACR,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,IAAI;KACZ,CACF,CAAA;AACH,CAAC,CAAC,CAAA"}
@@ -0,0 +1,69 @@
1
+ import { Duration, Effect, FileSystem, HttpClient, Schedule, Schema } from '@livestore/utils/effect';
2
+ declare const WranglerDevServerError_base: Schema.TaggedErrorClass<WranglerDevServerError, "WranglerDevServerError", {
3
+ readonly _tag: Schema.tag<"WranglerDevServerError">;
4
+ } & {
5
+ cause: typeof Schema.Unknown;
6
+ message: typeof Schema.String;
7
+ port: typeof Schema.Number;
8
+ }>;
9
+ /**
10
+ * Error type for WranglerDevServer operations
11
+ */
12
+ export declare class WranglerDevServerError extends WranglerDevServerError_base {
13
+ }
14
+ /**
15
+ * WranglerDevServer instance interface
16
+ */
17
+ export interface WranglerDevServer {
18
+ readonly port: number;
19
+ readonly url: string;
20
+ }
21
+ /**
22
+ * Readiness and retry configuration for wrangler boot and HTTP health.
23
+ *
24
+ * Example: startupTimeout=20s, connectTimeout=5s, retrySchedule=recurs(1)
25
+ * - Give wrangler up to 20s to boot; if it succeeds, give the HTTP check up to 5s.
26
+ * - If wrangler fails/times out, retry boot once; each boot attempt gets its own 20s budget.
27
+ * connectTimeout should be shorter than startupTimeout because HTTP readiness should be fast after boot.
28
+ */
29
+ export interface WranglerReadinessOptions {
30
+ /** Max time to wait for wrangler to report ready before retrying. */
31
+ startupTimeout?: Duration.DurationInput;
32
+ /** Max time for the HTTP connectivity check after wrangler reports ready. */
33
+ connectTimeout?: Duration.DurationInput;
34
+ /** Retry policy for startup attempts (applies when startupTimeout elapses or wrangler throws). */
35
+ retrySchedule?: Schedule.Schedule<unknown, unknown, never>;
36
+ }
37
+ export interface StartWranglerDevServerArgs {
38
+ /** Path to wrangler.toml (defaults to cwd/wrangler.toml). */
39
+ wranglerConfigPath?: string;
40
+ /** Working directory wrangler should use. */
41
+ cwd: string;
42
+ /** The port to try first. The dev server may bind a different port if unavailable. */
43
+ preferredPort?: number;
44
+ /** @default false */
45
+ showLogs?: boolean;
46
+ /** Optional inspector port for wrangler dev. */
47
+ inspectorPort?: number;
48
+ /** Readiness and retry configuration for bringing up wrangler and confirming connectivity. */
49
+ readiness?: WranglerReadinessOptions;
50
+ }
51
+ declare const WranglerDevServerService_base: Effect.Service.Class<WranglerDevServerService, "WranglerDevServerService", {
52
+ readonly scoped: (args: StartWranglerDevServerArgs) => Effect.Effect<{
53
+ port: number;
54
+ url: string;
55
+ }, WranglerDevServerError, import("effect/Scope").Scope | HttpClient.HttpClient | FileSystem.FileSystem>;
56
+ }>;
57
+ /**
58
+ * WranglerDevServer as an Effect.Service.
59
+ *
60
+ * This service provides the WranglerDevServer properties and can be accessed
61
+ * directly to get port and url.
62
+ *
63
+ * TODO: Allow for config to be passed in via code instead of `wrangler.toml` file
64
+ * (would need to be placed in temporary file as wrangler only accepts files as config)
65
+ */
66
+ export declare class WranglerDevServerService extends WranglerDevServerService_base {
67
+ }
68
+ export {};
69
+ //# sourceMappingURL=WranglerDevServer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WranglerDevServer.d.ts","sourceRoot":"","sources":["../../src/wrangler/WranglerDevServer.ts"],"names":[],"mappings":"AAGA,OAAO,EAAS,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;;;;;;;;AAI3G;;GAEG;AACH,qBAAa,sBAAuB,SAAQ,2BAI1C;CAAG;AAEL;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,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,aAAa,CAAA;IACvC,6EAA6E;IAC7E,cAAc,CAAC,EAAE,QAAQ,CAAC,aAAa,CAAA;IACvC,kGAAkG;IAClG,aAAa,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,CAAA;CAC3D;AAED,MAAM,WAAW,0BAA0B;IACzC,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;;4BAYgB,0BAA0B;;;;;AAV3C;;;;;;;;GAQG;AACH,qBAAa,wBAAyB,SAAQ,6BA+G5C;CAAG"}
@@ -0,0 +1,103 @@
1
+ import * as path from 'node:path';
2
+ import * as Toml from '@iarna/toml';
3
+ import { IS_CI } from '@livestore/utils';
4
+ import { Cause, Duration, Effect, FileSystem, HttpClient, Schedule, Schema } from '@livestore/utils/effect';
5
+ import { getFreePort } from '@livestore/utils/node';
6
+ import * as wrangler from 'wrangler';
7
+ /**
8
+ * Error type for WranglerDevServer operations
9
+ */
10
+ export class WranglerDevServerError extends Schema.TaggedError()('WranglerDevServerError', {
11
+ cause: Schema.Unknown,
12
+ message: Schema.String,
13
+ port: Schema.Number,
14
+ }) {
15
+ }
16
+ /**
17
+ * WranglerDevServer as an Effect.Service.
18
+ *
19
+ * This service provides the WranglerDevServer properties and can be accessed
20
+ * directly to get port and url.
21
+ *
22
+ * TODO: Allow for config to be passed in via code instead of `wrangler.toml` file
23
+ * (would need to be placed in temporary file as wrangler only accepts files as config)
24
+ */
25
+ export class WranglerDevServerService extends Effect.Service()('WranglerDevServerService', {
26
+ scoped: (args) => Effect.gen(function* () {
27
+ const showLogs = args.showLogs ?? false;
28
+ // Allocate preferred port (Wrangler may bind a different one if unavailable)
29
+ const preferredPort = args.preferredPort ??
30
+ (yield* getFreePort.pipe(Effect.mapError((cause) => new WranglerDevServerError({ cause, message: 'Failed to get free port', port: -1 }))));
31
+ yield* Effect.annotateCurrentSpan({ preferredPort });
32
+ const configPath = path.resolve(args.wranglerConfigPath ?? path.join(args.cwd, 'wrangler.toml'));
33
+ const fs = yield* FileSystem.FileSystem;
34
+ const configContent = yield* fs.readFileString(configPath);
35
+ const parsedConfig = yield* Effect.try(() => Toml.parse(configContent)).pipe(Effect.andThen(Schema.decodeUnknown(Schema.Struct({ main: Schema.String }))), Effect.mapError((error) => new WranglerDevServerError({ cause: error, message: 'Failed to parse wrangler config', port: -1 })));
36
+ const resolvedMainPath = yield* Effect.try(() => path.resolve(args.cwd, parsedConfig.main));
37
+ const readiness = args.readiness ?? {};
38
+ const startupTimeout = readiness.startupTimeout ?? Duration.seconds(IS_CI ? 30 : 10);
39
+ const devServer = yield* Effect.promise(() => wrangler.unstable_dev(resolvedMainPath, {
40
+ config: configPath,
41
+ port: preferredPort,
42
+ inspectorPort: args.inspectorPort ?? 0,
43
+ persistTo: path.join(args.cwd, '.wrangler/state'),
44
+ logLevel: showLogs ? 'debug' : 'none',
45
+ experimental: {
46
+ disableExperimentalWarning: true,
47
+ },
48
+ })).pipe(Effect.timeout(startupTimeout), Effect.mapError((cause) => new WranglerDevServerError({
49
+ cause,
50
+ message: `Failed to start wrangler dev server within ${Duration.format(startupTimeout)}`,
51
+ port: preferredPort,
52
+ })), Effect.tapError((error) => Effect.logError('Wrangler dev server failed to start', {
53
+ message: error.message,
54
+ preferredPort,
55
+ cwd: args.cwd,
56
+ })), Effect.retry(readiness.retrySchedule ?? Schedule.recurs(1)));
57
+ yield* Effect.addFinalizer(Effect.fn(function* (exit) {
58
+ if (exit._tag === 'Failure' && Cause.isInterruptedOnly(exit.cause) === false) {
59
+ yield* Effect.logError('Closing wrangler dev server on failure', exit.cause);
60
+ }
61
+ yield* Effect.tryPromise(async () => {
62
+ await devServer.stop();
63
+ // TODO investigate whether we need to wait until exit (see workers-sdk repo/talk to Cloudflare team)
64
+ // await devServer.waitUntilExit()
65
+ });
66
+ }, Effect.timeout('5 seconds'), Effect.orDie, Effect.tapCauseLogPretty, Effect.withSpan('WranglerDevServerService:stopDevServer')));
67
+ const actualPort = devServer.port;
68
+ const actualHost = devServer.address;
69
+ const url = `http://${actualHost}:${actualPort}`;
70
+ // Use longer timeout in CI environments to account for slower HTTP readiness
71
+ const defaultConnectivityTimeout = Duration.seconds(IS_CI ? 30 : 5);
72
+ const connectivityTimeout = readiness.connectTimeout ?? defaultConnectivityTimeout;
73
+ yield* verifyHttpConnectivity({ url, showLogs, connectTimeout: connectivityTimeout });
74
+ if (showLogs) {
75
+ yield* Effect.logDebug(`Wrangler dev server ready and accepting connections on port ${actualPort} (preferred: ${preferredPort})`);
76
+ }
77
+ return {
78
+ port: actualPort,
79
+ url,
80
+ };
81
+ }).pipe(Effect.mapError((error) => error instanceof WranglerDevServerError
82
+ ? error
83
+ : new WranglerDevServerError({ cause: error, message: 'Failed to start wrangler dev server', port: -1 })), Effect.withSpan('WranglerDevServerService', {
84
+ attributes: { preferredPort: args.preferredPort ?? 'auto', cwd: args.cwd },
85
+ })),
86
+ }) {
87
+ }
88
+ /**
89
+ * Verifies the server is actually accepting HTTP connections by making a test request
90
+ */
91
+ const verifyHttpConnectivity = ({ url, showLogs, connectTimeout, }) => Effect.gen(function* () {
92
+ const client = yield* HttpClient.HttpClient;
93
+ if (showLogs) {
94
+ yield* Effect.logDebug(`Verifying HTTP connectivity to ${url}`);
95
+ }
96
+ // Try to connect with retries using exponential backoff
97
+ yield* client.get(url).pipe(Effect.retryOrElse(Schedule.exponential('50 millis', 2).pipe(Schedule.jittered, Schedule.intersect(Schedule.elapsed.pipe(Schedule.whileOutput(Duration.lessThanOrEqualTo(connectTimeout)))), Schedule.compose(Schedule.count)), (error, attemptCount) => Effect.fail(new WranglerDevServerError({
98
+ cause: error,
99
+ message: `Failed to establish HTTP connection to Wrangler server at ${url} after ${attemptCount} attempts (timeout: ${Duration.toMillis(connectTimeout)}ms)`,
100
+ port: 0,
101
+ }))), Effect.tap(() => (showLogs ? Effect.logDebug(`HTTP connectivity verified for ${url}`) : Effect.void)), Effect.asVoid, Effect.withSpan('verifyHttpConnectivity'));
102
+ });
103
+ //# sourceMappingURL=WranglerDevServer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WranglerDevServer.js","sourceRoot":"","sources":["../../src/wrangler/WranglerDevServer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AACjC,OAAO,KAAK,IAAI,MAAM,aAAa,CAAA;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACxC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAC3G,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,KAAK,QAAQ,MAAM,UAAU,CAAA;AAEpC;;GAEG;AACH,MAAM,OAAO,sBAAuB,SAAQ,MAAM,CAAC,WAAW,EAA0B,CAAC,wBAAwB,EAAE;IACjH,KAAK,EAAE,MAAM,CAAC,OAAO;IACrB,OAAO,EAAE,MAAM,CAAC,MAAM;IACtB,IAAI,EAAE,MAAM,CAAC,MAAM;CACpB,CAAC;CAAG;AA2CL;;;;;;;;GAQG;AACH,MAAM,OAAO,wBAAyB,SAAQ,MAAM,CAAC,OAAO,EAA4B,CAAC,0BAA0B,EAAE;IACnH,MAAM,EAAE,CAAC,IAAgC,EAAE,EAAE,CAC3C,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;QAClB,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,IAAI,KAAK,CAAA;QAEvC,6EAA6E;QAC7E,MAAM,aAAa,GACjB,IAAI,CAAC,aAAa;YAClB,CAAC,KAAK,CAAC,CAAC,WAAW,CAAC,IAAI,CACtB,MAAM,CAAC,QAAQ,CACb,CAA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KAAK,EAAE,YAAY,EAAE,EAAE,CACtB,MAAM,CAAC,IAAI,CACT,IAAI,sBAAsB,CAAC;QACzB,KAAK,EAAE,KAAK;QACZ,OAAO,EAAE,6DAA6D,GAAG,UAAU,YAAY,uBAAuB,QAAQ,CAAC,QAAQ,CAAC,cAAc,CAAC,KAAK;QAC5J,IAAI,EAAE,CAAC;KACR,CAAC,CACH,CACJ,EACD,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,kCAAkC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,EACrG,MAAM,CAAC,MAAM,EACb,MAAM,CAAC,QAAQ,CAAC,wBAAwB,CAAC,CAC1C,CAAA;AACH,CAAC,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=WranglerDevServer.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WranglerDevServer.test.d.ts","sourceRoot":"","sources":["../../src/wrangler/WranglerDevServer.test.ts"],"names":[],"mappings":""}