@livestore/utils-dev 0.0.0-snapshot-1c345a0e6695466bdc7c4483444e7b3513620261 → 0.0.0-snapshot-92c31f56117b4fd377b66f55163ed565795c5e4c

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 (72) hide show
  1. package/dist/.tsbuildinfo.json +1 -1
  2. package/dist/node/DockerComposeService/DockerComposeService.d.ts +48 -0
  3. package/dist/node/DockerComposeService/DockerComposeService.d.ts.map +1 -0
  4. package/dist/node/DockerComposeService/DockerComposeService.js +107 -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/FileLogger.d.ts +14 -0
  11. package/dist/node/FileLogger.d.ts.map +1 -0
  12. package/dist/node/FileLogger.js +151 -0
  13. package/dist/node/FileLogger.js.map +1 -0
  14. package/dist/node/WranglerDevServer/WranglerDevServer.d.ts +51 -0
  15. package/dist/node/WranglerDevServer/WranglerDevServer.d.ts.map +1 -0
  16. package/dist/node/WranglerDevServer/WranglerDevServer.js +102 -0
  17. package/dist/node/WranglerDevServer/WranglerDevServer.js.map +1 -0
  18. package/dist/node/WranglerDevServer/WranglerDevServer.test.d.ts +2 -0
  19. package/dist/node/WranglerDevServer/WranglerDevServer.test.d.ts.map +1 -0
  20. package/dist/node/WranglerDevServer/WranglerDevServer.test.js +186 -0
  21. package/dist/node/WranglerDevServer/WranglerDevServer.test.js.map +1 -0
  22. package/dist/node/WranglerDevServer/fixtures/cf-worker.d.ts +8 -0
  23. package/dist/node/WranglerDevServer/fixtures/cf-worker.d.ts.map +1 -0
  24. package/dist/node/WranglerDevServer/fixtures/cf-worker.js +11 -0
  25. package/dist/node/WranglerDevServer/fixtures/cf-worker.js.map +1 -0
  26. package/dist/node/WranglerDevServer/process-tree-manager.d.ts +55 -0
  27. package/dist/node/WranglerDevServer/process-tree-manager.d.ts.map +1 -0
  28. package/dist/node/WranglerDevServer/process-tree-manager.js +178 -0
  29. package/dist/node/WranglerDevServer/process-tree-manager.js.map +1 -0
  30. package/dist/node/cmd.d.ts +27 -0
  31. package/dist/node/cmd.d.ts.map +1 -0
  32. package/dist/node/cmd.js +55 -0
  33. package/dist/node/cmd.js.map +1 -0
  34. package/dist/node/mod.d.ts +7 -13
  35. package/dist/node/mod.d.ts.map +1 -1
  36. package/dist/node/mod.js +22 -37
  37. package/dist/node/mod.js.map +1 -1
  38. package/dist/node-vitest/Vitest.d.ts +52 -0
  39. package/dist/node-vitest/Vitest.d.ts.map +1 -0
  40. package/dist/node-vitest/Vitest.js +98 -0
  41. package/dist/node-vitest/Vitest.js.map +1 -0
  42. package/dist/node-vitest/Vitest.test.d.ts +2 -0
  43. package/dist/node-vitest/Vitest.test.d.ts.map +1 -0
  44. package/dist/node-vitest/Vitest.test.js +59 -0
  45. package/dist/node-vitest/Vitest.test.js.map +1 -0
  46. package/dist/node-vitest/global.d.ts +2 -0
  47. package/dist/node-vitest/global.d.ts.map +1 -0
  48. package/dist/node-vitest/{polyfill.js → global.js} +1 -1
  49. package/dist/node-vitest/global.js.map +1 -0
  50. package/dist/node-vitest/mod.d.ts +2 -1
  51. package/dist/node-vitest/mod.d.ts.map +1 -1
  52. package/dist/node-vitest/mod.js +2 -1
  53. package/dist/node-vitest/mod.js.map +1 -1
  54. package/package.json +16 -23
  55. package/src/node/DockerComposeService/DockerComposeService.test.ts +91 -0
  56. package/src/node/DockerComposeService/DockerComposeService.ts +252 -0
  57. package/src/node/DockerComposeService/test-fixtures/docker-compose.yml +4 -0
  58. package/src/node/FileLogger.ts +206 -0
  59. package/src/node/WranglerDevServer/WranglerDevServer.test.ts +268 -0
  60. package/src/node/WranglerDevServer/WranglerDevServer.ts +206 -0
  61. package/src/node/WranglerDevServer/fixtures/cf-worker.ts +11 -0
  62. package/src/node/WranglerDevServer/fixtures/wrangler.toml +11 -0
  63. package/src/node/WranglerDevServer/process-tree-manager.ts +263 -0
  64. package/src/node/cmd.ts +99 -0
  65. package/src/node/mod.ts +39 -77
  66. package/src/node-vitest/Vitest.test.ts +101 -0
  67. package/src/node-vitest/Vitest.ts +221 -0
  68. package/src/node-vitest/mod.ts +3 -1
  69. package/dist/node-vitest/polyfill.d.ts +0 -2
  70. package/dist/node-vitest/polyfill.d.ts.map +0 -1
  71. package/dist/node-vitest/polyfill.js.map +0 -1
  72. /package/src/node-vitest/{polyfill.ts → global.ts} +0 -0
@@ -0,0 +1,186 @@
1
+ import { Effect, Exit, Fiber, Layer, Scope } from '@livestore/utils/effect';
2
+ import { 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 withTestCtx = Vitest.makeWithTestCtx({
8
+ timeout: testTimeout,
9
+ makeLayer: () => PlatformNode.NodeContext.layer,
10
+ });
11
+ const WranglerDevServerTest = (args = {}) => WranglerDevServerService.Default({
12
+ cwd: `${import.meta.dirname}/fixtures`,
13
+ ...args,
14
+ });
15
+ Vitest.describe('WranglerDevServer', { timeout: testTimeout }, () => {
16
+ Vitest.describe('Basic Operations', () => {
17
+ const withBasicTest = (args = {}) => Vitest.makeWithTestCtx({
18
+ timeout: testTimeout,
19
+ makeLayer: () => WranglerDevServerTest(args).pipe(Layer.provide(PlatformNode.NodeContext.layer)),
20
+ });
21
+ Vitest.scopedLive('should start wrangler dev server and return port', (test) => Effect.gen(function* () {
22
+ const server = yield* WranglerDevServerService;
23
+ expect(server.port).toBeGreaterThan(0);
24
+ expect(server.url).toMatch(/http:\/\/localhost:\d+/);
25
+ expect(typeof server.processId).toBe('number');
26
+ expect(server.processId).toBeGreaterThan(0);
27
+ }).pipe(withBasicTest()(test)));
28
+ Vitest.scopedLive('should use specified port when provided', (test) => Effect.gen(function* () {
29
+ const server = yield* WranglerDevServerService;
30
+ expect(server.port).toBe(54443);
31
+ expect(server.url).toBe(`http://localhost:54443`);
32
+ }).pipe(withBasicTest({ port: 54443 })(test)));
33
+ });
34
+ Vitest.describe('Resource Management', () => {
35
+ Vitest.scopedLive('should cleanup processes on scope close', (test) => Effect.gen(function* () {
36
+ let processId;
37
+ // Create a separate scope for the server
38
+ const serverScope = yield* Scope.make();
39
+ const server = yield* Effect.provide(WranglerDevServerService, WranglerDevServerTest().pipe(Layer.provide(PlatformNode.NodeContext.layer))).pipe(Scope.extend(serverScope));
40
+ processId = server.processId;
41
+ expect(processId).toBeGreaterThan(0);
42
+ expect(server.port).toBeGreaterThan(0);
43
+ expect(server.url).toMatch(/http:\/\/localhost:\d+/);
44
+ // Close scope to trigger cleanup
45
+ yield* Scope.close(serverScope, Exit.succeed(void 0));
46
+ // Wait for cleanup to complete
47
+ yield* Effect.sleep('2 seconds');
48
+ // Verify process is terminated
49
+ const isRunning2 = yield* Effect.promise(() => {
50
+ try {
51
+ process.kill(processId, 0);
52
+ return Promise.resolve(true);
53
+ }
54
+ catch {
55
+ return Promise.resolve(false);
56
+ }
57
+ });
58
+ expect(isRunning2).toBe(false);
59
+ }).pipe(withTestCtx(test)));
60
+ Vitest.scopedLive('should handle interruption with fast cleanup', (test) => Effect.gen(function* () {
61
+ let processId;
62
+ const fiber = yield* Effect.fork(Effect.provide(Effect.gen(function* () {
63
+ const server = yield* WranglerDevServerService;
64
+ processId = server.processId;
65
+ yield* Effect.sleep('30 seconds'); // Keep running
66
+ return server;
67
+ }), WranglerDevServerTest().pipe(Layer.provide(PlatformNode.NodeContext.layer))));
68
+ // Wait for server to start
69
+ yield* Effect.sleep('3 seconds');
70
+ expect(processId).toBeGreaterThan(0);
71
+ // Interrupt and measure cleanup time
72
+ const start = Date.now();
73
+ yield* Fiber.interrupt(fiber);
74
+ const elapsed = Date.now() - start;
75
+ // Should use fast cleanup (500ms timeout) + some overhead
76
+ expect(elapsed).toBeLessThan(1500); // Allow some overhead
77
+ // Wait for cleanup to complete
78
+ yield* Effect.sleep('1 second');
79
+ // Verify process is terminated
80
+ const isRunningAfter = yield* Effect.promise(() => {
81
+ try {
82
+ process.kill(processId, 0);
83
+ return Promise.resolve(true);
84
+ }
85
+ catch {
86
+ return Promise.resolve(false);
87
+ }
88
+ });
89
+ expect(isRunningAfter).toBe(false);
90
+ }).pipe(withTestCtx(test)));
91
+ });
92
+ Vitest.describe('Error Handling', () => {
93
+ const withErrorTest = (args = {}) => Vitest.makeWithTestCtx({
94
+ timeout: testTimeout,
95
+ makeLayer: () => WranglerDevServerTest(args).pipe(Layer.provide(PlatformNode.NodeContext.layer)),
96
+ });
97
+ Vitest.scopedLive('should handle missing wrangler.toml', (test) => Effect.gen(function* () {
98
+ // Since Wrangler can work without a config file, let's test with a truly invalid scenario
99
+ const result = yield* WranglerDevServerService.pipe(Effect.either);
100
+ // Note: Wrangler might still succeed even with /dev/null, so this test
101
+ // verifies our implementation handles the case properly, whether it succeeds or fails
102
+ expect(['Left', 'Right']).toContain(result._tag);
103
+ if (result._tag === 'Left') {
104
+ // If it fails, it should be a wrapped error
105
+ expect(result.left).toBeInstanceOf(WranglerDevServerError);
106
+ }
107
+ else {
108
+ // If it succeeds, the server should be properly configured
109
+ expect(result.right.port).toBeGreaterThan(0);
110
+ }
111
+ }).pipe(withErrorTest({ cwd: '/tmp', wranglerConfigPath: '/dev/null' })(test)));
112
+ Vitest.scopedLive('should handle invalid working directory', (test) => Effect.gen(function* () {
113
+ const result = yield* WranglerDevServerService.pipe(Effect.provide(WranglerDevServerTest({
114
+ cwd: '/completely/nonexistent/directory',
115
+ }).pipe(Layer.provide(PlatformNode.NodeContext.layer))), Effect.either);
116
+ expect(result._tag).toBe('Left');
117
+ if (result._tag === 'Left') {
118
+ expect(result.left).toBeInstanceOf(WranglerDevServerError);
119
+ }
120
+ }).pipe(Vitest.withTestCtx(test)));
121
+ Vitest.scopedLive('should timeout if server fails to start', (test) => Effect.gen(function* () {
122
+ // Create a command that will never output "Ready on"
123
+ const result = yield* WranglerDevServerService.pipe(
124
+ // Override the timeout for this test to be shorter
125
+ Effect.timeout('5 seconds'), Effect.either);
126
+ // This might succeed or fail depending on actual wrangler behavior
127
+ // The main point is testing timeout functionality
128
+ expect(['Left', 'Right']).toContain(result._tag);
129
+ }).pipe(withErrorTest()(test)));
130
+ });
131
+ Vitest.describe('Process Tree Cleanup', () => {
132
+ const withCleanupTest = (args = {}) => Vitest.makeWithTestCtx({
133
+ timeout: testTimeout,
134
+ makeLayer: () => WranglerDevServerTest(args).pipe(Layer.provide(PlatformNode.NodeContext.layer)),
135
+ });
136
+ Vitest.scopedLive('should clean up child workerd processes', (test) => Effect.gen(function* () {
137
+ let processId;
138
+ const server = yield* WranglerDevServerService;
139
+ processId = server.processId;
140
+ // Wait for wrangler to spawn workerd children
141
+ yield* Effect.sleep('3 seconds');
142
+ // Find any child processes (workerd)
143
+ const children = yield* Effect.promise(async () => {
144
+ const { exec } = require('node:child_process');
145
+ const { promisify } = require('node:util');
146
+ const execAsync = promisify(exec);
147
+ try {
148
+ if (!processId)
149
+ throw new Error('processId is undefined');
150
+ const { stdout } = await execAsync(`ps -o pid,ppid -ax | grep -E "^\\s*[0-9]+\\s+${processId}\\s*$"`);
151
+ return stdout
152
+ .trim()
153
+ .split('\n')
154
+ .map((line) => {
155
+ const match = line.trim().match(/^\s*(\d+)\s+\d+\s*$/);
156
+ return match?.[1] ? Number.parseInt(match[1], 10) : null;
157
+ })
158
+ .filter((pid) => pid !== null);
159
+ }
160
+ catch {
161
+ return [];
162
+ }
163
+ });
164
+ console.log(`Found ${children.length} child processes:`, children);
165
+ // The scope will close here and should clean up all processes
166
+ }).pipe(withCleanupTest()(test)));
167
+ });
168
+ Vitest.describe('Service Pattern', () => {
169
+ const withServiceTest = (args = {}) => Vitest.makeWithTestCtx({
170
+ timeout: testTimeout,
171
+ makeLayer: () => WranglerDevServerTest(args).pipe(Layer.provide(PlatformNode.NodeContext.layer)),
172
+ });
173
+ Vitest.scopedLive('should work with service pattern', (test) => Effect.gen(function* () {
174
+ const server = yield* WranglerDevServerService;
175
+ expect(server.port).toBeGreaterThan(0);
176
+ expect(server.url).toMatch(/http:\/\/localhost:\d+/);
177
+ expect(server.processId).toBeGreaterThan(0);
178
+ }).pipe(withServiceTest()(test)));
179
+ Vitest.scopedLive('should work with custom port via service', (test) => Effect.gen(function* () {
180
+ const server = yield* WranglerDevServerService;
181
+ expect(server.port).toBe(54444);
182
+ expect(server.url).toBe('http://localhost:54444');
183
+ }).pipe(withServiceTest({ port: 54444 })(test)));
184
+ });
185
+ });
186
+ //# sourceMappingURL=WranglerDevServer.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WranglerDevServer.test.js","sourceRoot":"","sources":["../../../src/node/WranglerDevServer/WranglerDevServer.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACpD,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,WAAW,GAAG,MAAM,CAAC,eAAe,CAAC;IACzC,OAAO,EAAE,WAAW;IACpB,SAAS,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,WAAW,CAAC,KAAK;CAChD,CAAC,CAAA;AAEF,MAAM,qBAAqB,GAAG,CAAC,OAA4C,EAAE,EAAE,EAAE,CAC/E,wBAAwB,CAAC,OAAO,CAAC;IA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C,UAAU,CAAC,0CAA0C,EAAE,CAAC,IAAI,EAAE,EAAE,CACrE,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,KAAK,CAAC,CAAA;YAC/B,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAA;QACnD,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAChD,CAAA;IACH,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -0,0 +1,8 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cf-worker.d.ts","sourceRoot":"","sources":["../../../../src/node/WranglerDevServer/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"}
@@ -0,0 +1,11 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cf-worker.js","sourceRoot":"","sources":["../../../../src/node/WranglerDevServer/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"}
@@ -0,0 +1,55 @@
1
+ import { type CommandExecutor, Effect, Schema, type Scope } from '@livestore/utils/effect';
2
+ declare const ProcessTreeError_base: Schema.TaggedErrorClass<ProcessTreeError, "ProcessTreeError", {
3
+ readonly _tag: Schema.tag<"ProcessTreeError">;
4
+ } & {
5
+ cause: typeof Schema.Unknown;
6
+ message: typeof Schema.String;
7
+ pid: typeof Schema.Number;
8
+ }>;
9
+ export declare class ProcessTreeError extends ProcessTreeError_base {
10
+ }
11
+ /**
12
+ * Finds all child processes of a given parent PID
13
+ */
14
+ export declare const findChildProcesses: (parentPid: number) => Effect.Effect<number[], never, CommandExecutor.CommandExecutor | Scope.Scope>;
15
+ /**
16
+ * Recursively finds all descendants of a process
17
+ */
18
+ export declare const findProcessTree: (rootPid: number) => Effect.Effect<number[], never, CommandExecutor.CommandExecutor | Scope.Scope>;
19
+ /**
20
+ * Checks if a process is running
21
+ */
22
+ export declare const isProcessRunning: (pid: number) => Effect.Effect<boolean, never, never>;
23
+ /**
24
+ * Kills a process tree with escalating signals
25
+ */
26
+ export declare const killProcessTree: (rootPid: number, options?: {
27
+ timeout?: number;
28
+ signals?: NodeJS.Signals[];
29
+ includeRoot?: boolean;
30
+ }) => Effect.Effect<{
31
+ killedPids: number[];
32
+ failedPids: number[];
33
+ }, never, CommandExecutor.CommandExecutor | Scope.Scope>;
34
+ /**
35
+ * Finds orphaned processes by name pattern
36
+ */
37
+ export declare const findOrphanedProcesses: (namePattern: string) => Effect.Effect<number[], never, CommandExecutor.CommandExecutor | Scope.Scope>;
38
+ /**
39
+ * Defensive cleanup for orphaned processes matching given patterns.
40
+ *
41
+ * This function provides fallback cleanup for edge cases where normal process
42
+ * termination mechanisms fail (e.g., hard crashes, SIGKILL before cleanup runs,
43
+ * or limitations in synchronous exit handlers). While proper process tree cleanup
44
+ * should prevent orphans in most cases, this serves as a safety net for scenarios
45
+ * where child processes become orphaned despite cleanup efforts.
46
+ *
47
+ * @param processPatterns - Array of process name patterns to search for (e.g., ['wrangler', 'workerd'])
48
+ * @returns Object with arrays of successfully cleaned and failed PIDs
49
+ */
50
+ export declare const cleanupOrphanedProcesses: (processPatterns: string[]) => Effect.Effect<{
51
+ cleaned: number[];
52
+ failed: number[];
53
+ }, never, CommandExecutor.CommandExecutor | Scope.Scope>;
54
+ export {};
55
+ //# sourceMappingURL=process-tree-manager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"process-tree-manager.d.ts","sourceRoot":"","sources":["../../../src/node/WranglerDevServer/process-tree-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,eAAe,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,KAAK,EAAU,MAAM,yBAAyB,CAAA;;;;;;;;AAE3G,qBAAa,gBAAiB,SAAQ,qBAIpC;CAAG;AAEL;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAC7B,WAAW,MAAM,KAChB,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,eAAe,CAAC,eAAe,GAAG,KAAK,CAAC,KAAK,CA2B3E,CAAA;AAEJ;;GAEG;AACH,eAAO,MAAM,eAAe,GAC1B,SAAS,MAAM,KACd,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,eAAe,CAAC,eAAe,GAAG,KAAK,CAAC,KAAK,CAkB3E,CAAA;AAEJ;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAAI,KAAK,MAAM,KAAG,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,EAAE,KAAK,CAQ9E,CAAA;AAEJ;;GAEG;AACH,eAAO,MAAM,eAAe,GAC1B,SAAS,MAAM,EACf,UAAS;IACP,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,OAAO,EAAE,CAAA;IAC1B,WAAW,CAAC,EAAE,OAAO,CAAA;CACjB,KACL,MAAM,CAAC,MAAM,CACd;IAAE,UAAU,EAAE,MAAM,EAAE,CAAC;IAAC,UAAU,EAAE,MAAM,EAAE,CAAA;CAAE,EAC9C,KAAK,EACL,eAAe,CAAC,eAAe,GAAG,KAAK,CAAC,KAAK,CAsE3C,CAAA;AAEJ;;GAEG;AACH,eAAO,MAAM,qBAAqB,GAChC,aAAa,MAAM,KAClB,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,eAAe,CAAC,eAAe,GAAG,KAAK,CAAC,KAAK,CA8B3E,CAAA;AAEJ;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,wBAAwB,GACnC,iBAAiB,MAAM,EAAE,KACxB,MAAM,CAAC,MAAM,CAAC;IAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,EAAE,KAAK,EAAE,eAAe,CAAC,eAAe,GAAG,KAAK,CAAC,KAAK,CA8C1G,CAAA"}
@@ -0,0 +1,178 @@
1
+ import { Command, Effect, Schema, Stream } from '@livestore/utils/effect';
2
+ export class ProcessTreeError extends Schema.TaggedError()('ProcessTreeError', {
3
+ cause: Schema.Unknown,
4
+ message: Schema.String,
5
+ pid: Schema.Number,
6
+ }) {
7
+ }
8
+ /**
9
+ * Finds all child processes of a given parent PID
10
+ */
11
+ export const findChildProcesses = (parentPid) => Effect.gen(function* () {
12
+ const result = yield* Command.make('ps', '-o', 'pid,ppid', '-ax').pipe(Command.start, Effect.flatMap((command) => command.stdout.pipe(Stream.decodeText('utf8'), Stream.runCollect, Effect.map((chunks) => Array.from(chunks).join('')))), Effect.catchAll(() => Effect.succeed('')));
13
+ if (!result)
14
+ return [];
15
+ const lines = result.split('\n');
16
+ const pattern = new RegExp(`^\\s*([0-9]+)\\s+${parentPid}\\s*$`);
17
+ const childPids = lines
18
+ .map((line) => {
19
+ const match = line.trim().match(pattern);
20
+ return match ? Number.parseInt(match[1], 10) : null;
21
+ })
22
+ .filter((pid) => pid !== null);
23
+ return childPids;
24
+ });
25
+ /**
26
+ * Recursively finds all descendants of a process
27
+ */
28
+ export const findProcessTree = (rootPid) => Effect.gen(function* () {
29
+ const allPids = new Set([rootPid]);
30
+ const toProcess = [rootPid];
31
+ while (toProcess.length > 0) {
32
+ const currentPid = toProcess.pop();
33
+ const children = yield* findChildProcesses(currentPid);
34
+ for (const childPid of children) {
35
+ if (!allPids.has(childPid)) {
36
+ allPids.add(childPid);
37
+ toProcess.push(childPid);
38
+ }
39
+ }
40
+ }
41
+ return Array.from(allPids);
42
+ });
43
+ /**
44
+ * Checks if a process is running
45
+ */
46
+ export const isProcessRunning = (pid) => Effect.sync(() => {
47
+ try {
48
+ process.kill(pid, 0);
49
+ return true;
50
+ }
51
+ catch {
52
+ return false;
53
+ }
54
+ });
55
+ /**
56
+ * Kills a process tree with escalating signals
57
+ */
58
+ export const killProcessTree = (rootPid, options = {}) => Effect.gen(function* () {
59
+ const { timeout = 5000, signals = ['SIGTERM', 'SIGKILL'], includeRoot = true } = options;
60
+ // Find all processes in the tree
61
+ const allPids = yield* findProcessTree(rootPid);
62
+ const pidsToKill = includeRoot ? allPids : allPids.filter((pid) => pid !== rootPid);
63
+ if (pidsToKill.length === 0) {
64
+ return { killedPids: [], failedPids: [] };
65
+ }
66
+ const killedPids = [];
67
+ const failedPids = [];
68
+ // Try each signal with timeout
69
+ for (const signal of signals) {
70
+ // Check which processes are still running and not yet killed
71
+ const stillRunningChecks = yield* Effect.all(pidsToKill
72
+ .filter((pid) => !killedPids.includes(pid))
73
+ .map((pid) => isProcessRunning(pid).pipe(Effect.map((running) => ({ pid, running })))));
74
+ const remainingPids = stillRunningChecks.filter(({ running }) => running).map(({ pid }) => pid);
75
+ if (remainingPids.length === 0)
76
+ break;
77
+ // Send signal to all remaining processes
78
+ for (const pid of remainingPids) {
79
+ yield* Effect.sync(() => {
80
+ try {
81
+ process.kill(pid, signal);
82
+ }
83
+ catch {
84
+ // Process might already be dead, continue
85
+ }
86
+ });
87
+ }
88
+ // Wait for processes to terminate with polling
89
+ const waitStart = Date.now();
90
+ while (Date.now() - waitStart < timeout) {
91
+ const runningChecks = yield* Effect.all(remainingPids.map((pid) => isProcessRunning(pid).pipe(Effect.map((running) => ({ pid, running })))));
92
+ const stillRunning = runningChecks.filter(({ running }) => running).map(({ pid }) => pid);
93
+ if (stillRunning.length === 0) {
94
+ // All processes terminated
95
+ killedPids.push(...remainingPids);
96
+ break;
97
+ }
98
+ // Short sleep before checking again
99
+ yield* Effect.sleep('100 millis');
100
+ }
101
+ }
102
+ // Check final status
103
+ const finalChecks = yield* Effect.all(pidsToKill.map((pid) => isProcessRunning(pid).pipe(Effect.map((running) => ({ pid, running })))));
104
+ for (const { pid, running } of finalChecks) {
105
+ if (!killedPids.includes(pid) && running) {
106
+ failedPids.push(pid);
107
+ }
108
+ }
109
+ return { killedPids, failedPids };
110
+ });
111
+ /**
112
+ * Finds orphaned processes by name pattern
113
+ */
114
+ export const findOrphanedProcesses = (namePattern) => Effect.gen(function* () {
115
+ // Find processes that match the pattern and have init (PID 1) as parent
116
+ const result = yield* Command.make('ps', '-eo', 'pid,ppid,comm').pipe(Command.start, Effect.flatMap((command) => command.stdout.pipe(Stream.decodeText('utf8'), Stream.runCollect, Effect.map((chunks) => Array.from(chunks).join('')))), Effect.catchAll(() => Effect.succeed('')));
117
+ if (!result)
118
+ return [];
119
+ const lines = result.split('\n');
120
+ const patternRegex = new RegExp(namePattern);
121
+ const parentRegex = /^\s*(\d+)\s+1\s+/;
122
+ const orphanedPids = lines
123
+ .filter((line) => patternRegex.test(line))
124
+ .map((line) => {
125
+ const match = line.trim().match(parentRegex);
126
+ return match ? Number.parseInt(match[1], 10) : null;
127
+ })
128
+ .filter((pid) => pid !== null);
129
+ return orphanedPids;
130
+ });
131
+ /**
132
+ * Defensive cleanup for orphaned processes matching given patterns.
133
+ *
134
+ * This function provides fallback cleanup for edge cases where normal process
135
+ * termination mechanisms fail (e.g., hard crashes, SIGKILL before cleanup runs,
136
+ * or limitations in synchronous exit handlers). While proper process tree cleanup
137
+ * should prevent orphans in most cases, this serves as a safety net for scenarios
138
+ * where child processes become orphaned despite cleanup efforts.
139
+ *
140
+ * @param processPatterns - Array of process name patterns to search for (e.g., ['wrangler', 'workerd'])
141
+ * @returns Object with arrays of successfully cleaned and failed PIDs
142
+ */
143
+ export const cleanupOrphanedProcesses = (processPatterns) => Effect.gen(function* () {
144
+ const cleaned = [];
145
+ const failed = [];
146
+ // Find all orphaned processes matching the patterns
147
+ const allOrphanedPids = [];
148
+ const patternCounts = {};
149
+ for (const pattern of processPatterns) {
150
+ const orphaned = yield* findOrphanedProcesses(pattern);
151
+ allOrphanedPids.push(...orphaned);
152
+ patternCounts[pattern] = orphaned.length;
153
+ }
154
+ if (allOrphanedPids.length === 0) {
155
+ return { cleaned, failed };
156
+ }
157
+ const patternSummary = Object.entries(patternCounts)
158
+ .map(([pattern, count]) => `${count} ${pattern}`)
159
+ .join(', ');
160
+ yield* Effect.logInfo(`Found ${allOrphanedPids.length} orphaned processes (${patternSummary}): ${allOrphanedPids.join(', ')}`);
161
+ for (const pid of allOrphanedPids) {
162
+ const result = yield* killProcessTree(pid, {
163
+ timeout: 2000,
164
+ signals: ['SIGTERM', 'SIGKILL'],
165
+ includeRoot: true,
166
+ }).pipe(Effect.orElse(() => Effect.succeed({ killedPids: [], failedPids: [pid] })));
167
+ if (result.failedPids.length === 0) {
168
+ cleaned.push(...result.killedPids);
169
+ yield* Effect.logInfo(`Cleaned up orphaned process tree starting with ${pid} (${result.killedPids.length} processes)`);
170
+ }
171
+ else {
172
+ failed.push(pid, ...result.failedPids);
173
+ yield* Effect.logWarning(`Failed to clean up some processes in tree ${pid}: ${result.failedPids.join(', ')}`);
174
+ }
175
+ }
176
+ return { cleaned, failed };
177
+ });
178
+ //# sourceMappingURL=process-tree-manager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"process-tree-manager.js","sourceRoot":"","sources":["../../../src/node/WranglerDevServer/process-tree-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAwB,MAAM,EAAE,MAAM,EAAc,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAE3G,MAAM,OAAO,gBAAiB,SAAQ,MAAM,CAAC,WAAW,EAAoB,CAAC,kBAAkB,EAAE;IAC/F,KAAK,EAAE,MAAM,CAAC,OAAO;IACrB,OAAO,EAAE,MAAM,CAAC,MAAM;IACtB,GAAG,EAAE,MAAM,CAAC,MAAM;CACnB,CAAC;CAAG;AAEL;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,SAAiB,EAC8D,EAAE,CACjF,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAClB,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC,IAAI,CACpE,OAAO,CAAC,KAAK,EACb,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CACzB,OAAO,CAAC,MAAM,CAAC,IAAI,CACjB,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,EACzB,MAAM,CAAC,UAAU,EACjB,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CACpD,CACF,EACD,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAC1C,CAAA;IAED,IAAI,CAAC,MAAM;QAAE,OAAO,EAAE,CAA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zC,OAAO,EAAE,IAAI;YACb,OAAO,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC;YAC/B,WAAW,EAAE,IAAI;SAClB,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,UAAU,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;QAEnF,IAAI,MAAM,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACnC,OAAO,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,UAAU,CAAC,CAAA;YAClC,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CACnB,kDAAkD,GAAG,KAAK,MAAM,CAAC,UAAU,CAAC,MAAM,aAAa,CAChG,CAAA;QACH,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,MAAM,CAAC,UAAU,CAAC,CAAA;YACtC,KAAK,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,6CAA6C,GAAG,KAAK,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;QAC/G,CAAC;IACH,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,CAAA;AAC5B,CAAC,CAAC,CAAA"}
@@ -0,0 +1,27 @@
1
+ import { type CommandExecutor, Effect, type PlatformError, Schema } from '@livestore/utils/effect';
2
+ export declare const cmd: (commandInput: string | (string | undefined)[], options?: {
3
+ cwd?: string;
4
+ stderr?: 'inherit' | 'pipe';
5
+ stdout?: 'inherit' | 'pipe';
6
+ shell?: boolean;
7
+ env?: Record<string, string | undefined>;
8
+ } | undefined) => Effect.Effect<CommandExecutor.ExitCode, PlatformError.PlatformError | CmdError, CommandExecutor.CommandExecutor>;
9
+ export declare const cmdText: (commandInput: string | (string | undefined)[], options?: {
10
+ cwd?: string;
11
+ stderr?: 'inherit' | 'pipe';
12
+ runInShell?: boolean;
13
+ env?: Record<string, string | undefined>;
14
+ }) => Effect.Effect<string, PlatformError.PlatformError, CommandExecutor.CommandExecutor>;
15
+ declare const CmdError_base: Schema.TaggedErrorClass<CmdError, "CmdError", {
16
+ readonly _tag: Schema.tag<"CmdError">;
17
+ } & {
18
+ command: typeof Schema.String;
19
+ args: Schema.Array$<typeof Schema.String>;
20
+ cwd: typeof Schema.String;
21
+ env: Schema.Record$<typeof Schema.String, Schema.UndefinedOr<typeof Schema.String>>;
22
+ stderr: Schema.Literal<["inherit", "pipe"]>;
23
+ }>;
24
+ export declare class CmdError extends CmdError_base {
25
+ }
26
+ export {};
27
+ //# sourceMappingURL=cmd.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cmd.d.ts","sourceRoot":"","sources":["../../src/node/cmd.ts"],"names":[],"mappings":"AACA,OAAO,EAAW,KAAK,eAAe,EAAE,MAAM,EAAY,KAAK,aAAa,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAErH,eAAO,MAAM,GAAG,EAAE,CAChB,YAAY,EAAE,MAAM,GAAG,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,EAC7C,OAAO,CAAC,EACJ;IACE,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,SAAS,GAAG,MAAM,CAAA;IAC3B,MAAM,CAAC,EAAE,SAAS,GAAG,MAAM,CAAA;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAA;CACzC,GACD,SAAS,KACV,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,QAAQ,EAAE,aAAa,CAAC,aAAa,GAAG,QAAQ,EAAE,eAAe,CAAC,eAAe,CAyChH,CAAA;AAEJ,eAAO,MAAM,OAAO,EAAE,CACpB,YAAY,EAAE,MAAM,GAAG,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,EAC7C,OAAO,CAAC,EAAE;IACR,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,SAAS,GAAG,MAAM,CAAA;IAC3B,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAA;CACzC,KACE,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,aAAa,EAAE,eAAe,CAAC,eAAe,CAyBtF,CAAA;;;;;;;;;;AAED,qBAAa,QAAS,SAAQ,aAM5B;CAAG"}
@@ -0,0 +1,55 @@
1
+ import { isNotUndefined, shouldNeverHappen } from '@livestore/utils';
2
+ import { Command, Effect, identity, Schema } from '@livestore/utils/effect';
3
+ export const cmd = Effect.fn('cmd')(function* (commandInput, options) {
4
+ const cwd = options?.cwd ?? process.env.WORKSPACE_ROOT ?? shouldNeverHappen('WORKSPACE_ROOT is not set');
5
+ const [command, ...args] = Array.isArray(commandInput)
6
+ ? commandInput.filter(isNotUndefined)
7
+ : commandInput.split(' ');
8
+ const debugEnvStr = Object.entries(options?.env ?? {})
9
+ .map(([key, value]) => `${key}='${value}' `)
10
+ .join('');
11
+ const subshellStr = options?.shell ? ' (in subshell)' : '';
12
+ const commandDebugStr = debugEnvStr + [command, ...args].join(' ');
13
+ yield* Effect.logDebug(`Running '${commandDebugStr}' in '${cwd}'${subshellStr}`);
14
+ yield* Effect.annotateCurrentSpan({ 'span.label': commandDebugStr, cwd, command, args });
15
+ return yield* Command.make(command, ...args).pipe(
16
+ // TODO don't forward abort signal to the command
17
+ Command.stdin('inherit'), // Forward stdin to the command
18
+ // inherit = Stream stdout to process.stdout, pipe = Stream stdout to process.stderr
19
+ Command.stdout(options?.stdout ?? 'inherit'),
20
+ // inherit = Stream stderr to process.stderr, pipe = Stream stderr to process.stdout
21
+ Command.stderr(options?.stderr ?? 'inherit'), Command.workingDirectory(cwd), options?.shell ? Command.runInShell(true) : identity, Command.env(options?.env ?? {}), Command.exitCode, Effect.tap((exitCode) => exitCode === 0
22
+ ? Effect.void
23
+ : Effect.fail(CmdError.make({
24
+ command: command,
25
+ args,
26
+ cwd,
27
+ env: options?.env ?? {},
28
+ stderr: options?.stderr ?? 'inherit',
29
+ }))));
30
+ });
31
+ export const cmdText = Effect.fn('cmdText')(function* (commandInput, options) {
32
+ const cwd = options?.cwd ?? process.env.WORKSPACE_ROOT ?? shouldNeverHappen('WORKSPACE_ROOT is not set');
33
+ const [command, ...args] = Array.isArray(commandInput)
34
+ ? commandInput.filter(isNotUndefined)
35
+ : commandInput.split(' ');
36
+ const debugEnvStr = Object.entries(options?.env ?? {})
37
+ .map(([key, value]) => `${key}='${value}' `)
38
+ .join('');
39
+ const commandDebugStr = debugEnvStr + [command, ...args].join(' ');
40
+ const subshellStr = options?.runInShell ? ' (in subshell)' : '';
41
+ yield* Effect.logDebug(`Running '${commandDebugStr}' in '${cwd}'${subshellStr}`);
42
+ yield* Effect.annotateCurrentSpan({ 'span.label': commandDebugStr, command, cwd });
43
+ return yield* Command.make(command, ...args).pipe(
44
+ // inherit = Stream stderr to process.stderr, pipe = Stream stderr to process.stdout
45
+ Command.stderr(options?.stderr ?? 'inherit'), Command.workingDirectory(cwd), options?.runInShell ? Command.runInShell(true) : identity, Command.env(options?.env ?? {}), Command.string);
46
+ });
47
+ export class CmdError extends Schema.TaggedError()('CmdError', {
48
+ command: Schema.String,
49
+ args: Schema.Array(Schema.String),
50
+ cwd: Schema.String,
51
+ env: Schema.Record({ key: Schema.String, value: Schema.String.pipe(Schema.UndefinedOr) }),
52
+ stderr: Schema.Literal('inherit', 'pipe'),
53
+ }) {
54
+ }
55
+ //# sourceMappingURL=cmd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cmd.js","sourceRoot":"","sources":["../../src/node/cmd.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,kBAAk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A;AACH,CAAC,CACF,CAAA;AAED,MAAM,OAAO,QAAS,SAAQ,MAAM,CAAC,WAAW,EAAY,CAAC,UAAU,EAAE;IACvE,OAAO,EAAE,MAAM,CAAC,MAAM;IACtB,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC;IACjC,GAAG,EAAE,MAAM,CAAC,MAAM;IAClB,GAAG,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC;IACzF,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC;CAC1C,CAAC;CAAG"}
@@ -1,8 +1,13 @@
1
- import type { CommandExecutor, PlatformError, Tracer } from '@livestore/utils/effect';
1
+ import type { Tracer } from '@livestore/utils/effect';
2
2
  import { Effect, Layer, OtelTracer } from '@livestore/utils/effect';
3
3
  import * as otel from '@opentelemetry/api';
4
- export { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';
5
4
  export { OTLPMetricExporter } from '@opentelemetry/exporter-metrics-otlp-http';
5
+ export { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';
6
+ export * from './cmd.ts';
7
+ export { type DockerComposeArgs, DockerComposeError, type DockerComposeOperations, DockerComposeService, type LogsOptions, type StartOptions, startDockerComposeServicesScoped, } from './DockerComposeService/DockerComposeService.ts';
8
+ export * as FileLogger from './FileLogger.ts';
9
+ export * from './WranglerDevServer/process-tree-manager.ts';
10
+ export { type StartWranglerDevServerArgs, type WranglerDevServer, WranglerDevServerError, WranglerDevServerService, } from './WranglerDevServer/WranglerDevServer.ts';
6
11
  export declare const OtelLiveHttp: ({ serviceName, rootSpanName, rootSpanAttributes, parentSpan, skipLogUrl, traceNodeBootstrap, }?: {
7
12
  serviceName?: string;
8
13
  rootSpanName?: string;
@@ -13,15 +18,4 @@ export declare const OtelLiveHttp: ({ serviceName, rootSpanName, rootSpanAttribu
13
18
  }) => Layer.Layer<OtelTracer.OtelTracer | Tracer.ParentSpan, never, never>;
14
19
  export declare const logTraceUiUrlForSpan: (printMsg?: (url: string) => string) => (span: otel.Span) => Effect.Effect<string | undefined, never, never>;
15
20
  export declare const getTracingBackendUrl: (span: otel.Span) => Effect.Effect<string | undefined, never, never>;
16
- export declare const cmd: (commandInput: string | (string | undefined)[], options?: {
17
- cwd?: string;
18
- shell?: boolean;
19
- env?: Record<string, string | undefined>;
20
- } | undefined) => Effect.Effect<CommandExecutor.ExitCode, PlatformError.PlatformError, CommandExecutor.CommandExecutor>;
21
- export declare const cmdText: (commandInput: string | (string | undefined)[], options?: {
22
- cwd?: string;
23
- stderr?: 'inherit' | 'pipe';
24
- runInShell?: boolean;
25
- env?: Record<string, string | undefined>;
26
- }) => Effect.Effect<string, PlatformError.PlatformError, CommandExecutor.CommandExecutor>;
27
21
  //# sourceMappingURL=mod.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/node/mod.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AACrF,OAAO,EAAmB,MAAM,EAAY,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAE9F,OAAO,KAAK,IAAI,MAAM,oBAAoB,CAAA;AAM1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAA;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAA;AAE9E,eAAO,MAAM,YAAY,GAAI,iGAO1B;IACD,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC,OAAO,CAAA;IAC3B,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EA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