@livestore/utils-dev 0.0.0-snapshot-e5a7caabcf7660aefa55568a44ed0fe306d00597 → 0.0.0-snapshot-9d8807d2c51c95b4df3556744702cea55dc7ded3

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 (82) hide show
  1. package/dist/.tsbuildinfo.json +1 -1
  2. package/dist/node/mod.d.ts +13 -5
  3. package/dist/node/mod.d.ts.map +1 -1
  4. package/dist/node/mod.js +42 -67
  5. package/dist/node/mod.js.map +1 -1
  6. package/dist/node-vitest/mod.d.ts +1 -2
  7. package/dist/node-vitest/mod.d.ts.map +1 -1
  8. package/dist/node-vitest/mod.js +1 -2
  9. package/dist/node-vitest/mod.js.map +1 -1
  10. package/dist/node-vitest/polyfill.d.ts +2 -0
  11. package/dist/node-vitest/polyfill.d.ts.map +1 -0
  12. package/dist/node-vitest/{global.js → polyfill.js} +1 -1
  13. package/dist/node-vitest/polyfill.js.map +1 -0
  14. package/package.json +22 -16
  15. package/src/node/mod.ts +82 -81
  16. package/src/node-vitest/mod.ts +1 -3
  17. package/dist/node/DockerComposeService/DockerComposeService.d.ts +0 -58
  18. package/dist/node/DockerComposeService/DockerComposeService.d.ts.map +0 -1
  19. package/dist/node/DockerComposeService/DockerComposeService.js +0 -144
  20. package/dist/node/DockerComposeService/DockerComposeService.js.map +0 -1
  21. package/dist/node/DockerComposeService/DockerComposeService.test.d.ts +0 -2
  22. package/dist/node/DockerComposeService/DockerComposeService.test.d.ts.map +0 -1
  23. package/dist/node/DockerComposeService/DockerComposeService.test.js +0 -64
  24. package/dist/node/DockerComposeService/DockerComposeService.test.js.map +0 -1
  25. package/dist/node/FileLogger.d.ts +0 -14
  26. package/dist/node/FileLogger.d.ts.map +0 -1
  27. package/dist/node/FileLogger.js +0 -151
  28. package/dist/node/FileLogger.js.map +0 -1
  29. package/dist/node/cmd-log.d.ts +0 -21
  30. package/dist/node/cmd-log.d.ts.map +0 -1
  31. package/dist/node/cmd-log.js +0 -50
  32. package/dist/node/cmd-log.js.map +0 -1
  33. package/dist/node/cmd.d.ts +0 -36
  34. package/dist/node/cmd.d.ts.map +0 -1
  35. package/dist/node/cmd.js +0 -234
  36. package/dist/node/cmd.js.map +0 -1
  37. package/dist/node/cmd.test.d.ts +0 -2
  38. package/dist/node/cmd.test.d.ts.map +0 -1
  39. package/dist/node/cmd.test.js +0 -101
  40. package/dist/node/cmd.test.js.map +0 -1
  41. package/dist/node-vitest/Vitest.d.ts +0 -52
  42. package/dist/node-vitest/Vitest.d.ts.map +0 -1
  43. package/dist/node-vitest/Vitest.js +0 -98
  44. package/dist/node-vitest/Vitest.js.map +0 -1
  45. package/dist/node-vitest/Vitest.test.d.ts +0 -2
  46. package/dist/node-vitest/Vitest.test.d.ts.map +0 -1
  47. package/dist/node-vitest/Vitest.test.js +0 -70
  48. package/dist/node-vitest/Vitest.test.js.map +0 -1
  49. package/dist/node-vitest/global.d.ts +0 -2
  50. package/dist/node-vitest/global.d.ts.map +0 -1
  51. package/dist/node-vitest/global.js.map +0 -1
  52. package/dist/wrangler/WranglerDevServer.d.ts +0 -52
  53. package/dist/wrangler/WranglerDevServer.d.ts.map +0 -1
  54. package/dist/wrangler/WranglerDevServer.js +0 -90
  55. package/dist/wrangler/WranglerDevServer.js.map +0 -1
  56. package/dist/wrangler/WranglerDevServer.test.d.ts +0 -2
  57. package/dist/wrangler/WranglerDevServer.test.d.ts.map +0 -1
  58. package/dist/wrangler/WranglerDevServer.test.js +0 -77
  59. package/dist/wrangler/WranglerDevServer.test.js.map +0 -1
  60. package/dist/wrangler/fixtures/cf-worker.d.ts +0 -8
  61. package/dist/wrangler/fixtures/cf-worker.d.ts.map +0 -1
  62. package/dist/wrangler/fixtures/cf-worker.js +0 -11
  63. package/dist/wrangler/fixtures/cf-worker.js.map +0 -1
  64. package/dist/wrangler/mod.d.ts +0 -2
  65. package/dist/wrangler/mod.d.ts.map +0 -1
  66. package/dist/wrangler/mod.js +0 -2
  67. package/dist/wrangler/mod.js.map +0 -1
  68. package/src/node/DockerComposeService/DockerComposeService.test.ts +0 -91
  69. package/src/node/DockerComposeService/DockerComposeService.ts +0 -328
  70. package/src/node/DockerComposeService/test-fixtures/docker-compose.yml +0 -4
  71. package/src/node/FileLogger.ts +0 -206
  72. package/src/node/cmd-log.ts +0 -92
  73. package/src/node/cmd.test.ts +0 -129
  74. package/src/node/cmd.ts +0 -419
  75. package/src/node-vitest/Vitest.test.ts +0 -112
  76. package/src/node-vitest/Vitest.ts +0 -238
  77. package/src/wrangler/WranglerDevServer.test.ts +0 -133
  78. package/src/wrangler/WranglerDevServer.ts +0 -180
  79. package/src/wrangler/fixtures/cf-worker.ts +0 -11
  80. package/src/wrangler/fixtures/wrangler.toml +0 -11
  81. package/src/wrangler/mod.ts +0 -6
  82. /package/src/node-vitest/{global.ts → polyfill.ts} +0 -0
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=global.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"global.d.ts","sourceRoot":"","sources":["../../src/node-vitest/global.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"global.js","sourceRoot":"","sources":["../../src/node-vitest/global.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,CAAC,KAAK,GAAG,IAAI,CAAA"}
@@ -1,52 +0,0 @@
1
- import { Duration, Effect, FileSystem, HttpClient, 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
- * Configuration for starting WranglerDevServer
23
- */
24
- export interface StartWranglerDevServerArgs {
25
- wranglerConfigPath?: string;
26
- cwd: string;
27
- /** The port to try first. The dev server may bind a different port if unavailable. */
28
- preferredPort?: number;
29
- /** @default false */
30
- showLogs?: boolean;
31
- inspectorPort?: number;
32
- connectTimeout?: Duration.DurationInput;
33
- }
34
- declare const WranglerDevServerService_base: Effect.Service.Class<WranglerDevServerService, "WranglerDevServerService", {
35
- readonly scoped: (args: StartWranglerDevServerArgs) => Effect.Effect<{
36
- port: number;
37
- url: string;
38
- }, WranglerDevServerError, import("effect/Scope").Scope | HttpClient.HttpClient | FileSystem.FileSystem>;
39
- }>;
40
- /**
41
- * WranglerDevServer as an Effect.Service.
42
- *
43
- * This service provides the WranglerDevServer properties and can be accessed
44
- * directly to get port and url.
45
- *
46
- * TODO: Allow for config to be passed in via code instead of `wrangler.toml` file
47
- * (would need to be placed in temporary file as wrangler only accepts files as config)
48
- */
49
- export declare class WranglerDevServerService extends WranglerDevServerService_base {
50
- }
51
- export {};
52
- //# sourceMappingURL=WranglerDevServer.d.ts.map
@@ -1 +0,0 @@
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,EAAY,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;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,GAAG,EAAE,MAAM,CAAA;IACX,sFAAsF;IACtF,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,qBAAqB;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,cAAc,CAAC,EAAE,QAAQ,CAAC,aAAa,CAAA;CACxC;;4BAYgB,0BAA0B;;;;;AAV3C;;;;;;;;GAQG;AACH,qBAAa,wBAAyB,SAAQ,6BAyF5C;CAAG"}
@@ -1,90 +0,0 @@
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 devServer = yield* Effect.promise(() => wrangler.unstable_dev(resolvedMainPath, {
38
- config: configPath,
39
- port: preferredPort,
40
- inspectorPort: args.inspectorPort ?? 0,
41
- persistTo: path.join(args.cwd, '.wrangler/state'),
42
- logLevel: showLogs ? 'debug' : 'none',
43
- experimental: {
44
- disableExperimentalWarning: true,
45
- },
46
- }));
47
- yield* Effect.addFinalizer(Effect.fn(function* (exit) {
48
- if (exit._tag === 'Failure' && Cause.isInterruptedOnly(exit.cause) === false) {
49
- yield* Effect.logError('Closing wrangler dev server on failure', exit.cause);
50
- }
51
- yield* Effect.tryPromise(async () => {
52
- await devServer.stop();
53
- // TODO investigate whether we need to wait until exit (see workers-sdk repo/talk to Cloudflare team)
54
- // await devServer.waitUntilExit()
55
- });
56
- }, Effect.timeout('5 seconds'), Effect.orDie, Effect.tapCauseLogPretty, Effect.withSpan('WranglerDevServerService:stopDevServer')));
57
- const actualPort = devServer.port;
58
- const actualHost = devServer.address;
59
- const url = `http://${actualHost}:${actualPort}`;
60
- // Use longer timeout in CI environments to account for slower startup times
61
- const defaultTimeout = Duration.seconds(IS_CI ? 30 : 5);
62
- yield* verifyHttpConnectivity({ url, showLogs, connectTimeout: args.connectTimeout ?? defaultTimeout });
63
- if (showLogs) {
64
- yield* Effect.logDebug(`Wrangler dev server ready and accepting connections on port ${actualPort} (preferred: ${preferredPort})`);
65
- }
66
- return {
67
- port: actualPort,
68
- url,
69
- };
70
- }).pipe(Effect.mapError((error) => new WranglerDevServerError({ cause: error, message: 'Failed to start wrangler dev server', port: -1 })), Effect.withSpan('WranglerDevServerService', {
71
- attributes: { preferredPort: args.preferredPort ?? 'auto', cwd: args.cwd },
72
- })),
73
- }) {
74
- }
75
- /**
76
- * Verifies the server is actually accepting HTTP connections by making a test request
77
- */
78
- const verifyHttpConnectivity = ({ url, showLogs, connectTimeout, }) => Effect.gen(function* () {
79
- const client = yield* HttpClient.HttpClient;
80
- if (showLogs) {
81
- yield* Effect.logDebug(`Verifying HTTP connectivity to ${url}`);
82
- }
83
- // Try to connect with retries using exponential backoff
84
- 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({
85
- cause: error,
86
- message: `Failed to establish HTTP connection to Wrangler server at ${url} after ${attemptCount} attempts (timeout: ${Duration.toMillis(connectTimeout)}ms)`,
87
- port: 0,
88
- }))), Effect.tap(() => (showLogs ? Effect.logDebug(`HTTP connectivity verified for ${url}`) : Effect.void)), Effect.asVoid, Effect.withSpan('verifyHttpConnectivity'));
89
- });
90
- //# sourceMappingURL=WranglerDevServer.js.map
@@ -1 +0,0 @@
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,O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AC,MAAM,CAAC,IAAI,CAAC,CAAC,EACrG,MAAM,CAAC,MAAM,EACb,MAAM,CAAC,QAAQ,CAAC,wBAAwB,CAAC,CAC1C,CAAA;AACH,CAAC,CAAC,CAAA"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=WranglerDevServer.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"WranglerDevServer.test.d.ts","sourceRoot":"","sources":["../../src/wrangler/WranglerDevServer.test.ts"],"names":[],"mappings":""}
@@ -1,77 +0,0 @@
1
- import { Effect, FetchHttpClient, Layer } from '@livestore/utils/effect';
2
- import { getFreePort, PlatformNode } from '@livestore/utils/node';
3
- import { Vitest } from '@livestore/utils-dev/node-vitest';
4
- import { expect } from 'vitest';
5
- import { WranglerDevServerError, WranglerDevServerService, } from "./WranglerDevServer.js";
6
- const testTimeout = 60_000;
7
- const WranglerDevServerTest = (args = {}) => WranglerDevServerService.Default({
8
- cwd: `${import.meta.dirname}/fixtures`,
9
- ...args,
10
- }).pipe(Layer.provide(FetchHttpClient.layer));
11
- Vitest.describe('WranglerDevServer', { timeout: testTimeout }, () => {
12
- Vitest.describe('Basic Operations', () => {
13
- const withBasicTest = (args = {}) => Vitest.makeWithTestCtx({
14
- timeout: testTimeout,
15
- makeLayer: () => WranglerDevServerTest(args).pipe(Layer.provide(PlatformNode.NodeContext.layer)),
16
- });
17
- Vitest.scopedLive('should start wrangler dev server and return port', (test) => Effect.gen(function* () {
18
- const server = yield* WranglerDevServerService;
19
- expect(server.port).toBeGreaterThan(0);
20
- expect(server.url).toMatch(/http:\/\/127.0.0.1:\d+/);
21
- }).pipe(withBasicTest()(test)));
22
- Vitest.scopedLive('should use specified port when provided', (test) => Effect.andThen(getFreePort, (port) => Effect.gen(function* () {
23
- const server = yield* WranglerDevServerService;
24
- expect(server.port).toBe(port);
25
- expect(server.url).toBe(`http://127.0.0.1:${port}`);
26
- }).pipe(withBasicTest({ preferredPort: port })(test))));
27
- });
28
- Vitest.describe('Error Handling', () => {
29
- const withErrorTest = (args = {}) => Vitest.makeWithTestCtx({
30
- timeout: testTimeout,
31
- makeLayer: () => WranglerDevServerTest(args).pipe(Layer.provide(PlatformNode.NodeContext.layer)),
32
- });
33
- Vitest.scopedLive('should handle missing wrangler.toml but should timeout', (test) => Effect.gen(function* () {
34
- const error = yield* WranglerDevServerService.pipe(Effect.provide(WranglerDevServerTest({
35
- cwd: '/tmp',
36
- wranglerConfigPath: '/dev/null',
37
- connectTimeout: '500 millis',
38
- }).pipe(Layer.provide(PlatformNode.NodeContext.layer))), Effect.flip);
39
- expect(error).toBeInstanceOf(WranglerDevServerError);
40
- }).pipe(Vitest.withTestCtx(test)));
41
- Vitest.scopedLive('should handle invalid working directory', (test) => Effect.gen(function* () {
42
- const result = yield* WranglerDevServerService.pipe(Effect.provide(WranglerDevServerTest({
43
- cwd: '/completely/nonexistent/directory',
44
- }).pipe(Layer.provide(PlatformNode.NodeContext.layer))), Effect.either);
45
- expect(result._tag).toBe('Left');
46
- if (result._tag === 'Left') {
47
- expect(result.left).toBeInstanceOf(WranglerDevServerError);
48
- }
49
- }).pipe(Vitest.withTestCtx(test)));
50
- Vitest.scopedLive('should timeout if server fails to start', (test) => Effect.gen(function* () {
51
- // Create a command that will never output "Ready on"
52
- const result = yield* WranglerDevServerService.pipe(
53
- // Override the timeout for this test to be shorter
54
- Effect.timeout('5 seconds'), Effect.either);
55
- // This might succeed or fail depending on actual wrangler behavior
56
- // The main point is testing timeout functionality
57
- expect(['Left', 'Right']).toContain(result._tag);
58
- }).pipe(withErrorTest()(test)));
59
- });
60
- Vitest.describe('Service Pattern', () => {
61
- const withServiceTest = (args = {}) => Vitest.makeWithTestCtx({
62
- timeout: testTimeout,
63
- makeLayer: () => WranglerDevServerTest(args).pipe(Layer.provide(PlatformNode.NodeContext.layer)),
64
- });
65
- Vitest.scopedLive('should work with service pattern', (test) => Effect.gen(function* () {
66
- const server = yield* WranglerDevServerService;
67
- expect(server.port).toBeGreaterThan(0);
68
- expect(server.url).toMatch(/http:\/\/127.0.0.1:\d+/);
69
- }).pipe(withServiceTest()(test)));
70
- Vitest.scopedLive('should work with custom port via service', (test) => Effect.andThen(getFreePort, (port) => Effect.gen(function* () {
71
- const server = yield* WranglerDevServerService;
72
- expect(server.port).toBe(port);
73
- expect(server.url).toBe(`http://127.0.0.1:${port}`);
74
- }).pipe(withServiceTest({ preferredPort: port })(test))));
75
- });
76
- });
77
- //# sourceMappingURL=WranglerDevServer.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"WranglerDevServer.test.js","sourceRoot":"","sources":["../../src/wrangler/WranglerDevServer.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AACxE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAA;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,EAEL,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,wBAAwB,CAAA;AAE/B,MAAM,WAAW,GAAG,MAAM,CAAA;AAE1B,MAAM,qBAAqB,GAAG,CAAC,OAA4C,EAAE,EAAE,EAAE,CAC/E,wBAAwB,CAAC,OAAO,CAAC;IAC/B,GAAG,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,WAAW;IACtC,GAAG,IAAI;CACR,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAA;AAE/C,MAAM,CAAC,QAAQ,CAAC,mBAAmB,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,EAAE,GAAG,EAAE;IAClE,MAAM,CAAC,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;QACvC,MAAM,aAAa,GAAG,CAAC,OAA4C,EAAE,EAAE,EAAE,CACvE,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C,EAAE,CAAC,IAAI,EAAE,EAAE,CAC7D,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;YAClB,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,wBAAwB,CAAA;YAE9C,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAA;YACtC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,wBAAwB,CAAC,CAAA;QACtD,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC,IAAI,CAAC,CAAC,CACjC,CAAA;QAED,MAAM,CAAC,UAAU,CAAC,0CAA0C,EAAE,CAAC,IAAI,EAAE,EAAE,CACrE,MAAM,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,EAAE,CACnC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;YAClB,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,wBAAwB,CAAA;YAE9C,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;YAC9B,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,oBAAoB,IAAI,EAAE,CAAC,CAAA;QACrD,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CACxD,CACF,CAAA;IACH,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -1,8 +0,0 @@
1
- declare const _default: {
2
- fetch(_request: Request): Promise<Response>;
3
- };
4
- export default _default;
5
- export declare class TestDO {
6
- fetch(_request: Request): Promise<Response>;
7
- }
8
- //# sourceMappingURL=cf-worker.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cf-worker.d.ts","sourceRoot":"","sources":["../../../src/wrangler/fixtures/cf-worker.ts"],"names":[],"mappings":";oBACwB,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC;;AADnD,wBAIC;AAED,qBAAa,MAAM;IACX,KAAK,CAAC,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC;CAGlD"}
@@ -1,11 +0,0 @@
1
- export default {
2
- async fetch(_request) {
3
- return new Response('Hello from Wrangler Dev Server test worker!');
4
- },
5
- };
6
- export class TestDO {
7
- async fetch(_request) {
8
- return new Response('Hello from Test Durable Object!');
9
- }
10
- }
11
- //# sourceMappingURL=cf-worker.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cf-worker.js","sourceRoot":"","sources":["../../../src/wrangler/fixtures/cf-worker.ts"],"names":[],"mappings":"AAAA,eAAe;IACb,KAAK,CAAC,KAAK,CAAC,QAAiB;QAC3B,OAAO,IAAI,QAAQ,CAAC,6CAA6C,CAAC,CAAA;IACpE,CAAC;CACF,CAAA;AAED,MAAM,OAAO,MAAM;IACjB,KAAK,CAAC,KAAK,CAAC,QAAiB;QAC3B,OAAO,IAAI,QAAQ,CAAC,iCAAiC,CAAC,CAAA;IACxD,CAAC;CACF"}
@@ -1,2 +0,0 @@
1
- export { type StartWranglerDevServerArgs, type WranglerDevServer, WranglerDevServerError, WranglerDevServerService, } from './WranglerDevServer.ts';
2
- //# sourceMappingURL=mod.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/wrangler/mod.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,0BAA0B,EAC/B,KAAK,iBAAiB,EACtB,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,wBAAwB,CAAA"}
@@ -1,2 +0,0 @@
1
- export { WranglerDevServerError, WranglerDevServerService, } from "./WranglerDevServer.js";
2
- //# sourceMappingURL=mod.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mod.js","sourceRoot":"","sources":["../../src/wrangler/mod.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,wBAAwB,CAAA"}
@@ -1,91 +0,0 @@
1
- import path from 'node:path'
2
- import { Duration, Effect, Layer, Stream } from '@livestore/utils/effect'
3
- import { PlatformNode } from '@livestore/utils/node'
4
- import { Vitest } from '@livestore/utils-dev/node-vitest'
5
- import { expect } from 'vitest'
6
- import { type DockerComposeArgs, DockerComposeService } from './DockerComposeService.ts'
7
-
8
- const testTimeout = 30_000
9
- const testFixturePath = path.join(import.meta.dirname, 'test-fixtures')
10
-
11
- const DockerComposeTest = (args: Partial<DockerComposeArgs> = {}) =>
12
- DockerComposeService.Default({
13
- cwd: testFixturePath,
14
- ...args,
15
- })
16
-
17
- Vitest.describe('DockerComposeService', { timeout: testTimeout }, () => {
18
- Vitest.describe('Basic Operations', () => {
19
- const withBasicTest = (args: Partial<DockerComposeArgs> = {}) =>
20
- Vitest.makeWithTestCtx({
21
- timeout: testTimeout,
22
- makeLayer: () => DockerComposeTest(args).pipe(Layer.provide(PlatformNode.NodeContext.layer)),
23
- })
24
-
25
- Vitest.scopedLive('can pull docker images', (test) =>
26
- Effect.gen(function* () {
27
- const dockerCompose = yield* DockerComposeService
28
-
29
- // Test that pull operation works (should succeed for hello-world image)
30
- yield* dockerCompose.pull
31
- }).pipe(withBasicTest()(test)),
32
- )
33
-
34
- Vitest.scopedLive('can start and stop docker compose services', (test) =>
35
- Effect.gen(function* () {
36
- const dockerCompose = yield* DockerComposeService
37
-
38
- // Start the service
39
- yield* dockerCompose.start({ detached: true })
40
-
41
- // Stop the service
42
- yield* dockerCompose.stop
43
- }).pipe(withBasicTest({ serviceName: 'hello-world' })(test)),
44
- )
45
-
46
- Vitest.scopedLive('can get logs from docker compose services', (test) =>
47
- Effect.gen(function* () {
48
- const dockerCompose = yield* DockerComposeService
49
-
50
- // Start the service first
51
- yield* dockerCompose.start({ detached: true })
52
-
53
- // Get logs (should contain at least the "Hello from Docker!" message)
54
- const firstLogLine = yield* dockerCompose.logs().pipe(Stream.runHead)
55
-
56
- expect(firstLogLine._tag).toBe('Some')
57
-
58
- // Stop the service
59
- yield* dockerCompose.stop
60
- }).pipe(withBasicTest({ serviceName: 'hello-world' })(test)),
61
- )
62
- })
63
-
64
- Vitest.describe('Health Check Operations', () => {
65
- const withHealthCheckTest = (args: Partial<DockerComposeArgs> = {}) =>
66
- Vitest.makeWithTestCtx({
67
- timeout: testTimeout,
68
- makeLayer: () => DockerComposeTest(args).pipe(Layer.provide(PlatformNode.NodeContext.layer)),
69
- })
70
-
71
- Vitest.scopedLive('handles health check timeout gracefully', (test) =>
72
- Effect.gen(function* () {
73
- const dockerCompose = yield* DockerComposeService
74
-
75
- // Test starting with a health check that will timeout (invalid URL)
76
- const result = yield* dockerCompose
77
- .start({
78
- detached: true,
79
- healthCheck: {
80
- url: 'http://localhost:99999/nonexistent',
81
- timeout: Duration.seconds(2),
82
- },
83
- })
84
- .pipe(Effect.either)
85
-
86
- // Should fail due to health check timeout
87
- expect(result._tag).toBe('Left')
88
- }).pipe(withHealthCheckTest({ serviceName: 'hello-world' })(test)),
89
- )
90
- })
91
- })