@livestore/utils-dev 0.4.0-dev.9 → 0.5.0-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.tsbuildinfo +1 -0
- package/dist/node/DockerCompose/DockerCompose.d.ts +52 -0
- package/dist/node/DockerCompose/DockerCompose.d.ts.map +1 -0
- package/dist/node/DockerCompose/DockerCompose.js +158 -0
- package/dist/node/DockerCompose/DockerCompose.js.map +1 -0
- package/dist/node/DockerCompose/DockerCompose.test.d.ts +2 -0
- package/dist/node/DockerCompose/DockerCompose.test.d.ts.map +1 -0
- package/dist/node/{DockerComposeService/DockerComposeService.test.js → DockerCompose/DockerCompose.test.js} +18 -18
- package/dist/node/DockerCompose/DockerCompose.test.js.map +1 -0
- package/dist/node/DockerCompose/mod.d.ts +2 -0
- package/dist/node/DockerCompose/mod.d.ts.map +1 -0
- package/dist/node/DockerCompose/mod.js +2 -0
- package/dist/node/DockerCompose/mod.js.map +1 -0
- package/dist/node/FileLogger.d.ts +15 -8
- package/dist/node/FileLogger.d.ts.map +1 -1
- package/dist/node/FileLogger.js +64 -80
- package/dist/node/FileLogger.js.map +1 -1
- package/dist/node/cmd-log.d.ts +21 -0
- package/dist/node/cmd-log.d.ts.map +1 -0
- package/dist/node/cmd-log.js +58 -0
- package/dist/node/cmd-log.js.map +1 -0
- package/dist/node/cmd.d.ts +20 -14
- package/dist/node/cmd.d.ts.map +1 -1
- package/dist/node/cmd.js +248 -33
- package/dist/node/cmd.js.map +1 -1
- package/dist/node/cmd.test.d.ts +2 -0
- package/dist/node/cmd.test.d.ts.map +1 -0
- package/dist/node/cmd.test.js +103 -0
- package/dist/node/cmd.test.js.map +1 -0
- package/dist/node/mod.d.ts +5 -5
- package/dist/node/mod.d.ts.map +1 -1
- package/dist/node/mod.js +114 -66
- package/dist/node/mod.js.map +1 -1
- package/dist/node/workspace.d.ts +22 -0
- package/dist/node/workspace.d.ts.map +1 -0
- package/dist/node/workspace.js +26 -0
- package/dist/node/workspace.js.map +1 -0
- package/dist/node-vitest/Vitest.d.ts +17 -8
- package/dist/node-vitest/Vitest.d.ts.map +1 -1
- package/dist/node-vitest/Vitest.js +16 -16
- package/dist/node-vitest/Vitest.js.map +1 -1
- package/dist/node-vitest/Vitest.test.d.ts +6 -0
- package/dist/node-vitest/Vitest.test.d.ts.map +1 -1
- package/dist/node-vitest/Vitest.test.js +25 -10
- package/dist/node-vitest/Vitest.test.js.map +1 -1
- package/dist/wrangler/WranglerDevServer.d.ts +32 -20
- package/dist/wrangler/WranglerDevServer.d.ts.map +1 -1
- package/dist/wrangler/WranglerDevServer.js +79 -60
- package/dist/wrangler/WranglerDevServer.js.map +1 -1
- package/dist/wrangler/WranglerDevServer.test.js +31 -31
- package/dist/wrangler/WranglerDevServer.test.js.map +1 -1
- package/dist/wrangler/mod.d.ts +1 -1
- package/dist/wrangler/mod.d.ts.map +1 -1
- package/dist/wrangler/mod.js +1 -1
- package/dist/wrangler/mod.js.map +1 -1
- package/package.json +56 -21
- package/src/node/{DockerComposeService/DockerComposeService.test.ts → DockerCompose/DockerCompose.test.ts} +23 -20
- package/src/node/DockerCompose/DockerCompose.ts +328 -0
- package/src/node/DockerCompose/mod.ts +1 -0
- package/src/node/DockerCompose/test-fixtures/docker-compose.yml +4 -0
- package/src/node/FileLogger.ts +91 -115
- package/src/node/cmd-log.ts +95 -0
- package/src/node/cmd.test.ts +136 -0
- package/src/node/cmd.ts +431 -82
- package/src/node/mod.ts +152 -96
- package/src/node/workspace.ts +45 -0
- package/src/node-vitest/Vitest.test.ts +34 -10
- package/src/node-vitest/Vitest.ts +60 -66
- package/src/wrangler/WranglerDevServer.test.ts +38 -40
- package/src/wrangler/WranglerDevServer.ts +165 -108
- package/src/wrangler/fixtures/wrangler.toml +1 -1
- package/src/wrangler/mod.ts +1 -6
- package/dist/.tsbuildinfo.json +0 -1
- package/dist/node/DockerComposeService/DockerComposeService.d.ts +0 -58
- package/dist/node/DockerComposeService/DockerComposeService.d.ts.map +0 -1
- package/dist/node/DockerComposeService/DockerComposeService.js +0 -144
- package/dist/node/DockerComposeService/DockerComposeService.js.map +0 -1
- package/dist/node/DockerComposeService/DockerComposeService.test.d.ts +0 -2
- package/dist/node/DockerComposeService/DockerComposeService.test.d.ts.map +0 -1
- package/dist/node/DockerComposeService/DockerComposeService.test.js.map +0 -1
- package/src/node/DockerComposeService/DockerComposeService.ts +0 -328
- package/src/node/DockerComposeService/test-fixtures/docker-compose.yml +0 -4
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { Duration, Effect, FileSystem, HttpClient, Schema } from '@livestore/utils/effect';
|
|
2
|
-
declare const WranglerDevServerError_base: Schema.
|
|
3
|
-
readonly
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
port: typeof Schema.Number;
|
|
8
|
-
}>;
|
|
1
|
+
import { Cause, Context, Duration, Effect, FileSystem, HttpClient, Layer, Schedule, Schema } from '@livestore/utils/effect';
|
|
2
|
+
declare const WranglerDevServerError_base: Schema.Class<WranglerDevServerError, Schema.TaggedStruct<"WranglerDevServerError", {
|
|
3
|
+
readonly cause: Schema.Defect;
|
|
4
|
+
readonly message: Schema.String;
|
|
5
|
+
readonly port: Schema.Finite;
|
|
6
|
+
}>, Cause.YieldableError>;
|
|
9
7
|
/**
|
|
10
8
|
* Error type for WranglerDevServer operations
|
|
11
9
|
*/
|
|
@@ -14,31 +12,43 @@ export declare class WranglerDevServerError extends WranglerDevServerError_base
|
|
|
14
12
|
/**
|
|
15
13
|
* WranglerDevServer instance interface
|
|
16
14
|
*/
|
|
17
|
-
export interface
|
|
15
|
+
export interface Service {
|
|
18
16
|
readonly port: number;
|
|
19
17
|
readonly url: string;
|
|
20
18
|
}
|
|
21
19
|
/**
|
|
22
|
-
*
|
|
20
|
+
* Readiness and retry configuration for wrangler boot and HTTP health.
|
|
21
|
+
*
|
|
22
|
+
* Example: startupTimeout=20s, connectTimeout=5s, retrySchedule=recurs(1)
|
|
23
|
+
* - Give wrangler up to 20s to boot; if it succeeds, give the HTTP check up to 5s.
|
|
24
|
+
* - If wrangler fails/times out, retry boot once; each boot attempt gets its own 20s budget.
|
|
25
|
+
* connectTimeout should be shorter than startupTimeout because HTTP readiness should be fast after boot.
|
|
23
26
|
*/
|
|
24
|
-
export interface
|
|
27
|
+
export interface WranglerReadinessOptions {
|
|
28
|
+
/** Max time to wait for wrangler to report ready before retrying. */
|
|
29
|
+
startupTimeout?: Duration.Input;
|
|
30
|
+
/** Max time for the HTTP connectivity check after wrangler reports ready. */
|
|
31
|
+
connectTimeout?: Duration.Input;
|
|
32
|
+
/** Retry policy for startup attempts (applies when startupTimeout elapses or wrangler throws). */
|
|
33
|
+
retrySchedule?: Schedule.Schedule<unknown>;
|
|
34
|
+
}
|
|
35
|
+
export interface Options {
|
|
36
|
+
/** Path to wrangler.toml (defaults to cwd/wrangler.toml). */
|
|
25
37
|
wranglerConfigPath?: string;
|
|
38
|
+
/** Working directory wrangler should use. */
|
|
26
39
|
cwd: string;
|
|
27
40
|
/** The port to try first. The dev server may bind a different port if unavailable. */
|
|
28
41
|
preferredPort?: number;
|
|
29
42
|
/** @default false */
|
|
30
43
|
showLogs?: boolean;
|
|
44
|
+
/** Optional inspector port for wrangler dev. */
|
|
31
45
|
inspectorPort?: number;
|
|
32
|
-
|
|
46
|
+
/** Readiness and retry configuration for bringing up wrangler and confirming connectivity. */
|
|
47
|
+
readiness?: WranglerReadinessOptions;
|
|
33
48
|
}
|
|
34
|
-
declare const
|
|
35
|
-
readonly scoped: (args: StartWranglerDevServerArgs) => Effect.Effect<{
|
|
36
|
-
port: number;
|
|
37
|
-
url: string;
|
|
38
|
-
}, WranglerDevServerError, import("effect/Scope").Scope | FileSystem.FileSystem | HttpClient.HttpClient>;
|
|
39
|
-
}>;
|
|
49
|
+
declare const WranglerDevServer_base: Context.ServiceClass<WranglerDevServer, "@livestore/utils-dev/WranglerDevServer", Service>;
|
|
40
50
|
/**
|
|
41
|
-
* WranglerDevServer as an Effect.
|
|
51
|
+
* WranglerDevServer as an Effect service.
|
|
42
52
|
*
|
|
43
53
|
* This service provides the WranglerDevServer properties and can be accessed
|
|
44
54
|
* directly to get port and url.
|
|
@@ -46,7 +56,9 @@ declare const WranglerDevServerService_base: Effect.Service.Class<WranglerDevSer
|
|
|
46
56
|
* TODO: Allow for config to be passed in via code instead of `wrangler.toml` file
|
|
47
57
|
* (would need to be placed in temporary file as wrangler only accepts files as config)
|
|
48
58
|
*/
|
|
49
|
-
export declare class
|
|
59
|
+
export declare class WranglerDevServer extends WranglerDevServer_base {
|
|
50
60
|
}
|
|
61
|
+
export declare const make: (args: Options) => Effect.Effect<Service, WranglerDevServerError, import("effect/Scope").Scope | FileSystem.FileSystem | HttpClient.HttpClient>;
|
|
62
|
+
export declare const layer: (options: Options) => Layer.Layer<WranglerDevServer, WranglerDevServerError, FileSystem.FileSystem | HttpClient.HttpClient>;
|
|
51
63
|
export {};
|
|
52
64
|
//# sourceMappingURL=WranglerDevServer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WranglerDevServer.d.ts","sourceRoot":"","sources":["../../src/wrangler/WranglerDevServer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"WranglerDevServer.d.ts","sourceRoot":"","sources":["../../src/wrangler/WranglerDevServer.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,KAAK,EACL,OAAO,EACP,QAAQ,EACR,MAAM,EACN,UAAU,EACV,UAAU,EACV,KAAK,EACL,QAAQ,EACR,MAAM,EACP,MAAM,yBAAyB,CAAA;;;;;;AAGhC;;GAEG;AACH,qBAAa,sBAAuB,SAAQ,2BAM1C;CAAG;AAEL;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CAErB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,wBAAwB;IACvC,qEAAqE;IACrE,cAAc,CAAC,EAAE,QAAQ,CAAC,KAAK,CAAA;IAC/B,6EAA6E;IAC7E,cAAc,CAAC,EAAE,QAAQ,CAAC,KAAK,CAAA;IAC/B,kGAAkG;IAClG,aAAa,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;CAC3C;AAED,MAAM,WAAW,OAAO;IACtB,6DAA6D;IAC7D,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,6CAA6C;IAC7C,GAAG,EAAE,MAAM,CAAA;IACX,sFAAsF;IACtF,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,qBAAqB;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,gDAAgD;IAChD,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,8FAA8F;IAC9F,SAAS,CAAC,EAAE,wBAAwB,CAAA;CACrC;;AAED;;;;;;;;GAQG;AACH,qBAAa,iBAAkB,SAAQ,sBAEtC;CAAG;AAEJ,eAAO,MAAM,IAAI,GAAI,MAAM,OAAO,iIAkH/B,CAAA;AAEH,eAAO,MAAM,KAAK,GAAI,SAAS,OAAO,0GAAmD,CAAA"}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import * as path from 'node:path';
|
|
2
2
|
import * as Toml from '@iarna/toml';
|
|
3
|
+
import * as wrangler from 'wrangler';
|
|
3
4
|
import { IS_CI } from '@livestore/utils';
|
|
4
|
-
import { Cause, Duration, Effect, FileSystem, HttpClient, Schedule, Schema } from '@livestore/utils/effect';
|
|
5
|
+
import { Cause, Context, Duration, Effect, FileSystem, HttpClient, Layer, Schedule, Schema, } from '@livestore/utils/effect';
|
|
5
6
|
import { getFreePort } from '@livestore/utils/node';
|
|
6
|
-
import * as wrangler from 'wrangler';
|
|
7
7
|
/**
|
|
8
8
|
* Error type for WranglerDevServer operations
|
|
9
9
|
*/
|
|
10
|
-
export class WranglerDevServerError extends Schema.TaggedError()('WranglerDevServerError', {
|
|
11
|
-
cause: Schema.
|
|
10
|
+
export class WranglerDevServerError extends Schema.TaggedError('~@livestore/utils-dev/WranglerDevServerError')('WranglerDevServerError', {
|
|
11
|
+
cause: Schema.Defect(),
|
|
12
12
|
message: Schema.String,
|
|
13
|
-
port: Schema.
|
|
13
|
+
port: Schema.Finite,
|
|
14
14
|
}) {
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
|
-
* WranglerDevServer as an Effect.
|
|
17
|
+
* WranglerDevServer as an Effect service.
|
|
18
18
|
*
|
|
19
19
|
* This service provides the WranglerDevServer properties and can be accessed
|
|
20
20
|
* directly to get port and url.
|
|
@@ -22,69 +22,88 @@ export class WranglerDevServerError extends Schema.TaggedError()('WranglerDevSer
|
|
|
22
22
|
* TODO: Allow for config to be passed in via code instead of `wrangler.toml` file
|
|
23
23
|
* (would need to be placed in temporary file as wrangler only accepts files as config)
|
|
24
24
|
*/
|
|
25
|
-
export class
|
|
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
|
-
}) {
|
|
25
|
+
export class WranglerDevServer extends Context.Service()('@livestore/utils-dev/WranglerDevServer') {
|
|
74
26
|
}
|
|
27
|
+
export const make = (args) => Effect.gen(function* () {
|
|
28
|
+
const showLogs = args.showLogs ?? false;
|
|
29
|
+
// Allocate preferred port (Wrangler may bind a different one if unavailable)
|
|
30
|
+
const preferredPort = args.preferredPort ??
|
|
31
|
+
(yield* getFreePort.pipe(Effect.mapError((cause) => new WranglerDevServerError({ cause, message: 'Failed to get free port', port: -1 }))));
|
|
32
|
+
yield* Effect.annotateCurrentSpan({ preferredPort });
|
|
33
|
+
const configPath = path.resolve(args.wranglerConfigPath ?? path.join(args.cwd, 'wrangler.toml'));
|
|
34
|
+
const fs = yield* FileSystem.FileSystem;
|
|
35
|
+
const configContent = yield* fs.readFileString(configPath);
|
|
36
|
+
const parsedConfig = yield* Effect.try({
|
|
37
|
+
try: () => Toml.parse(configContent),
|
|
38
|
+
catch: (cause) => new Cause.UnknownError(cause),
|
|
39
|
+
}).pipe(Effect.andThen(Schema.decodeUnknownEffect(Schema.Struct({ main: Schema.String }))), Effect.mapError((error) => new WranglerDevServerError({ cause: error, message: 'Failed to parse wrangler config', port: -1 })));
|
|
40
|
+
const resolvedMainPath = yield* Effect.try({
|
|
41
|
+
try: () => path.resolve(args.cwd, parsedConfig.main),
|
|
42
|
+
catch: (cause) => new Cause.UnknownError(cause),
|
|
43
|
+
});
|
|
44
|
+
const readiness = args.readiness ?? {};
|
|
45
|
+
const startupTimeout = readiness.startupTimeout ?? Duration.seconds(IS_CI === true ? 30 : 10);
|
|
46
|
+
const startupTimeoutDuration = Duration.fromInputUnsafe(startupTimeout);
|
|
47
|
+
const devServer = yield* Effect.promise(() => wrangler.unstable_dev(resolvedMainPath, {
|
|
48
|
+
config: configPath,
|
|
49
|
+
port: preferredPort,
|
|
50
|
+
inspectorPort: args.inspectorPort ?? 0,
|
|
51
|
+
persistTo: path.join(args.cwd, '.wrangler/state'),
|
|
52
|
+
logLevel: showLogs === true ? 'debug' : 'none',
|
|
53
|
+
experimental: {
|
|
54
|
+
disableExperimentalWarning: true,
|
|
55
|
+
},
|
|
56
|
+
})).pipe(Effect.timeout(startupTimeout), Effect.mapError((cause) => new WranglerDevServerError({
|
|
57
|
+
cause,
|
|
58
|
+
message: `Failed to start wrangler dev server within ${Duration.format(startupTimeoutDuration)}`,
|
|
59
|
+
port: preferredPort,
|
|
60
|
+
})), Effect.tapError((error) => Effect.logError('Wrangler dev server failed to start', {
|
|
61
|
+
message: error.message,
|
|
62
|
+
preferredPort,
|
|
63
|
+
cwd: args.cwd,
|
|
64
|
+
})), Effect.retry(readiness.retrySchedule ?? Schedule.recurs(1)));
|
|
65
|
+
yield* Effect.addFinalizer(Effect.fn(function* (exit) {
|
|
66
|
+
if (exit._tag === 'Failure' && Cause.hasInterruptsOnly(exit.cause) === false) {
|
|
67
|
+
yield* Effect.logError('Closing wrangler dev server on failure', exit.cause);
|
|
68
|
+
}
|
|
69
|
+
yield* Effect.tryPromise(async () => {
|
|
70
|
+
await devServer.stop();
|
|
71
|
+
// TODO investigate whether we need to wait until exit (see workers-sdk repo/talk to Cloudflare team)
|
|
72
|
+
// await devServer.waitUntilExit()
|
|
73
|
+
});
|
|
74
|
+
}, Effect.timeout('5 seconds'), Effect.orDie, Effect.tapCauseLogPretty, Effect.withSpan('WranglerDevServer:stopDevServer')));
|
|
75
|
+
const actualPort = devServer.port;
|
|
76
|
+
const actualHost = devServer.address;
|
|
77
|
+
const url = `http://${actualHost}:${actualPort}`;
|
|
78
|
+
// Use longer timeout in CI environments to account for slower HTTP readiness
|
|
79
|
+
const defaultConnectivityTimeout = Duration.seconds(IS_CI === true ? 30 : 5);
|
|
80
|
+
const connectivityTimeout = readiness.connectTimeout ?? defaultConnectivityTimeout;
|
|
81
|
+
yield* verifyHttpConnectivity({ url, showLogs, connectTimeout: connectivityTimeout });
|
|
82
|
+
if (showLogs === true) {
|
|
83
|
+
yield* Effect.logDebug(`Wrangler dev server ready and accepting connections on port ${actualPort} (preferred: ${preferredPort})`);
|
|
84
|
+
}
|
|
85
|
+
return WranglerDevServer.of({
|
|
86
|
+
port: actualPort,
|
|
87
|
+
url,
|
|
88
|
+
});
|
|
89
|
+
}).pipe(Effect.mapError((error) => error instanceof WranglerDevServerError
|
|
90
|
+
? error
|
|
91
|
+
: new WranglerDevServerError({ cause: error, message: 'Failed to start wrangler dev server', port: -1 })), Effect.withSpan('WranglerDevServer', {
|
|
92
|
+
attributes: { preferredPort: args.preferredPort ?? 'auto', cwd: args.cwd },
|
|
93
|
+
}));
|
|
94
|
+
export const layer = (options) => Layer.effect(WranglerDevServer, make(options));
|
|
75
95
|
/**
|
|
76
96
|
* Verifies the server is actually accepting HTTP connections by making a test request
|
|
77
97
|
*/
|
|
78
98
|
const verifyHttpConnectivity = ({ url, showLogs, connectTimeout, }) => Effect.gen(function* () {
|
|
79
99
|
const client = yield* HttpClient.HttpClient;
|
|
80
|
-
if (showLogs) {
|
|
100
|
+
if (showLogs === true) {
|
|
81
101
|
yield* Effect.logDebug(`Verifying HTTP connectivity to ${url}`);
|
|
82
102
|
}
|
|
83
|
-
|
|
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({
|
|
103
|
+
yield* client.get(url).pipe(Effect.retry(Schedule.exponential('50 millis', 2).pipe(Schedule.jittered)), Effect.timeout(connectTimeout), Effect.mapError((error) => new WranglerDevServerError({
|
|
85
104
|
cause: error,
|
|
86
|
-
message: `Failed to establish HTTP connection to Wrangler server at ${url}
|
|
105
|
+
message: `Failed to establish HTTP connection to Wrangler server at ${url} (timeout: ${Duration.toMillis(Duration.fromInputUnsafe(connectTimeout))}ms)`,
|
|
87
106
|
port: 0,
|
|
88
|
-
}))
|
|
107
|
+
})), Effect.tap(() => (showLogs === true ? Effect.logDebug(`HTTP connectivity verified for ${url}`) : Effect.void)), Effect.asVoid, Effect.withSpan('verifyHttpConnectivity'));
|
|
89
108
|
});
|
|
90
109
|
//# sourceMappingURL=WranglerDevServer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WranglerDevServer.js","sourceRoot":"","sources":["../../src/wrangler/WranglerDevServer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"WranglerDevServer.js","sourceRoot":"","sources":["../../src/wrangler/WranglerDevServer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AAEjC,OAAO,KAAK,IAAI,MAAM,aAAa,CAAA;AACnC,OAAO,KAAK,QAAQ,MAAM,UAAU,CAAA;AAEpC,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACxC,OAAO,EACL,KAAK,EACL,OAAO,EACP,QAAQ,EACR,MAAM,EACN,UAAU,EACV,UAAU,EACV,KAAK,EACL,QAAQ,EACR,MAAM,GACP,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAEnD;;GAEG;AACH,MAAM,OAAO,sBAAuB,SAAQ,MAAM,CAAC,WAAW,CAC5D,8CAA8C,CAC/C,CAAC,wBAAwB,EAAE;IAC1B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE;IACtB,OAAO,EAAE,MAAM,CAAC,MAAM;IACtB,IAAI,EAAE,MAAM,CAAC,MAAM;CACpB,CAAC;CAAG;AA2CL;;;;;;;;GAQG;AACH,MAAM,OAAO,iBAAkB,SAAQ,OAAO,CAAC,OAAO,EAA8B,CAClF,wCAAwC,CACzC;CAAG;AAEJ,MA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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
1
|
import { expect } from 'vitest';
|
|
5
|
-
import {
|
|
2
|
+
import { Vitest } from '@livestore/utils-dev/node-vitest';
|
|
3
|
+
import { Effect, FetchHttpClient, Layer, Result } from '@livestore/utils/effect';
|
|
4
|
+
import { getFreePort, PlatformNode } from '@livestore/utils/node';
|
|
5
|
+
import * as WranglerDevServer from "./WranglerDevServer.js";
|
|
6
6
|
const testTimeout = 60_000;
|
|
7
|
-
const WranglerDevServerTest = (args = {}) =>
|
|
7
|
+
const WranglerDevServerTest = (args = {}) => WranglerDevServer.layer({
|
|
8
8
|
cwd: `${import.meta.dirname}/fixtures`,
|
|
9
9
|
...args,
|
|
10
10
|
}).pipe(Layer.provide(FetchHttpClient.layer));
|
|
@@ -12,15 +12,15 @@ Vitest.describe('WranglerDevServer', { timeout: testTimeout }, () => {
|
|
|
12
12
|
Vitest.describe('Basic Operations', () => {
|
|
13
13
|
const withBasicTest = (args = {}) => Vitest.makeWithTestCtx({
|
|
14
14
|
timeout: testTimeout,
|
|
15
|
-
makeLayer: () => WranglerDevServerTest(args).pipe(Layer.provide(PlatformNode.
|
|
15
|
+
makeLayer: () => WranglerDevServerTest(args).pipe(Layer.provide(PlatformNode.NodeServices.layer)),
|
|
16
16
|
});
|
|
17
|
-
Vitest.
|
|
18
|
-
const server = yield*
|
|
17
|
+
Vitest.live('should start wrangler dev server and return port', (test) => Effect.gen(function* () {
|
|
18
|
+
const server = yield* WranglerDevServer.WranglerDevServer;
|
|
19
19
|
expect(server.port).toBeGreaterThan(0);
|
|
20
20
|
expect(server.url).toMatch(/http:\/\/127.0.0.1:\d+/);
|
|
21
21
|
}).pipe(withBasicTest()(test)));
|
|
22
|
-
Vitest.
|
|
23
|
-
const server = yield*
|
|
22
|
+
Vitest.live('should use specified port when provided', (test) => Effect.andThen(getFreePort, (port) => Effect.gen(function* () {
|
|
23
|
+
const server = yield* WranglerDevServer.WranglerDevServer;
|
|
24
24
|
expect(server.port).toBe(port);
|
|
25
25
|
expect(server.url).toBe(`http://127.0.0.1:${port}`);
|
|
26
26
|
}).pipe(withBasicTest({ preferredPort: port })(test))));
|
|
@@ -28,47 +28,47 @@ Vitest.describe('WranglerDevServer', { timeout: testTimeout }, () => {
|
|
|
28
28
|
Vitest.describe('Error Handling', () => {
|
|
29
29
|
const withErrorTest = (args = {}) => Vitest.makeWithTestCtx({
|
|
30
30
|
timeout: testTimeout,
|
|
31
|
-
makeLayer: () => WranglerDevServerTest(args).pipe(Layer.provide(PlatformNode.
|
|
31
|
+
makeLayer: () => WranglerDevServerTest(args).pipe(Layer.provide(PlatformNode.NodeServices.layer)),
|
|
32
32
|
});
|
|
33
|
-
Vitest.
|
|
34
|
-
const error = yield*
|
|
33
|
+
Vitest.live('should handle missing wrangler.toml but should timeout', (test) => Effect.gen(function* () {
|
|
34
|
+
const error = yield* WranglerDevServer.WranglerDevServer.pipe(Effect.provide(WranglerDevServerTest({
|
|
35
35
|
cwd: '/tmp',
|
|
36
36
|
wranglerConfigPath: '/dev/null',
|
|
37
|
-
connectTimeout: '500 millis',
|
|
38
|
-
}).pipe(Layer.provide(PlatformNode.
|
|
39
|
-
expect(error).toBeInstanceOf(WranglerDevServerError);
|
|
37
|
+
readiness: { connectTimeout: '500 millis' },
|
|
38
|
+
}).pipe(Layer.provide(PlatformNode.NodeServices.layer))), Effect.flip);
|
|
39
|
+
expect(error).toBeInstanceOf(WranglerDevServer.WranglerDevServerError);
|
|
40
40
|
}).pipe(Vitest.withTestCtx(test)));
|
|
41
|
-
Vitest.
|
|
42
|
-
const result = yield*
|
|
41
|
+
Vitest.live('should handle invalid working directory', (test) => Effect.gen(function* () {
|
|
42
|
+
const result = yield* WranglerDevServer.WranglerDevServer.pipe(Effect.provide(WranglerDevServerTest({
|
|
43
43
|
cwd: '/completely/nonexistent/directory',
|
|
44
|
-
}).pipe(Layer.provide(PlatformNode.
|
|
45
|
-
expect(result._tag).toBe('
|
|
46
|
-
if (result._tag === '
|
|
47
|
-
expect(result.
|
|
44
|
+
}).pipe(Layer.provide(PlatformNode.NodeServices.layer))), Effect.result);
|
|
45
|
+
expect(result._tag).toBe('Failure');
|
|
46
|
+
if (result._tag === 'Failure') {
|
|
47
|
+
expect(result.failure).toBeInstanceOf(WranglerDevServer.WranglerDevServerError);
|
|
48
48
|
}
|
|
49
49
|
}).pipe(Vitest.withTestCtx(test)));
|
|
50
|
-
Vitest.
|
|
50
|
+
Vitest.live('should timeout if server fails to start', (test) => Effect.gen(function* () {
|
|
51
51
|
// Create a command that will never output "Ready on"
|
|
52
|
-
const result = yield*
|
|
52
|
+
const result = yield* WranglerDevServer.WranglerDevServer.pipe(
|
|
53
53
|
// Override the timeout for this test to be shorter
|
|
54
|
-
Effect.timeout('5 seconds'), Effect.
|
|
54
|
+
Effect.timeout('5 seconds'), Effect.result);
|
|
55
55
|
// This might succeed or fail depending on actual wrangler behavior
|
|
56
56
|
// The main point is testing timeout functionality
|
|
57
|
-
expect(['
|
|
57
|
+
expect(['Failure', 'Success']).toContain(result._tag);
|
|
58
58
|
}).pipe(withErrorTest()(test)));
|
|
59
59
|
});
|
|
60
60
|
Vitest.describe('Service Pattern', () => {
|
|
61
61
|
const withServiceTest = (args = {}) => Vitest.makeWithTestCtx({
|
|
62
62
|
timeout: testTimeout,
|
|
63
|
-
makeLayer: () => WranglerDevServerTest(args).pipe(Layer.provide(PlatformNode.
|
|
63
|
+
makeLayer: () => WranglerDevServerTest(args).pipe(Layer.provide(PlatformNode.NodeServices.layer)),
|
|
64
64
|
});
|
|
65
|
-
Vitest.
|
|
66
|
-
const server = yield*
|
|
65
|
+
Vitest.live('should work with service pattern', (test) => Effect.gen(function* () {
|
|
66
|
+
const server = yield* WranglerDevServer.WranglerDevServer;
|
|
67
67
|
expect(server.port).toBeGreaterThan(0);
|
|
68
68
|
expect(server.url).toMatch(/http:\/\/127.0.0.1:\d+/);
|
|
69
69
|
}).pipe(withServiceTest()(test)));
|
|
70
|
-
Vitest.
|
|
71
|
-
const server = yield*
|
|
70
|
+
Vitest.live('should work with custom port via service', (test) => Effect.andThen(getFreePort, (port) => Effect.gen(function* () {
|
|
71
|
+
const server = yield* WranglerDevServer.WranglerDevServer;
|
|
72
72
|
expect(server.port).toBe(port);
|
|
73
73
|
expect(server.url).toBe(`http://127.0.0.1:${port}`);
|
|
74
74
|
}).pipe(withServiceTest({ preferredPort: port })(test))));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WranglerDevServer.test.js","sourceRoot":"","sources":["../../src/wrangler/WranglerDevServer.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"WranglerDevServer.test.js","sourceRoot":"","sources":["../../src/wrangler/WranglerDevServer.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE/B,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAA;AACzD,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAChF,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAEjE,OAAO,KAAK,iBAAiB,MAAM,wBAAwB,CAAA;AAE3D,MAAM,WAAW,GAAG,MAAM,CAAA;AAE1B,MAAM,qBAAqB,GAAG,CAAC,OAA2C,EAAE,EAAE,EAAE,CAC9E,iBAAiB,CAAC,KAAK,CAAC;IACtB,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,E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ACF,CAAA;IACH,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
package/dist/wrangler/mod.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * as WranglerDevServer from './WranglerDevServer.ts';
|
|
2
2
|
//# sourceMappingURL=mod.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/wrangler/mod.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/wrangler/mod.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,iBAAiB,MAAM,wBAAwB,CAAA"}
|
package/dist/wrangler/mod.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * as WranglerDevServer from "./WranglerDevServer.js";
|
|
2
2
|
//# sourceMappingURL=mod.js.map
|
package/dist/wrangler/mod.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.js","sourceRoot":"","sources":["../../src/wrangler/mod.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"mod.js","sourceRoot":"","sources":["../../src/wrangler/mod.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,iBAAiB,MAAM,wBAAwB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@livestore/utils-dev",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0-dev.0",
|
|
4
|
+
"license": "Apache-2.0",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/livestorejs/livestore.git"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist",
|
|
11
|
+
"package.json",
|
|
12
|
+
"src"
|
|
13
|
+
],
|
|
4
14
|
"type": "module",
|
|
5
15
|
"sideEffects": [
|
|
6
16
|
"./src/node-vitest/global.ts",
|
|
@@ -11,29 +21,54 @@
|
|
|
11
21
|
"./node-vitest": "./dist/node-vitest/mod.js",
|
|
12
22
|
"./wrangler": "./dist/wrangler/mod.js"
|
|
13
23
|
},
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"access": "public"
|
|
26
|
+
},
|
|
14
27
|
"dependencies": {
|
|
15
|
-
"@effect/opentelemetry": "0.
|
|
16
|
-
"@effect/vitest": "0.
|
|
17
|
-
"@iarna/toml": "
|
|
28
|
+
"@effect/opentelemetry": "4.0.0-rc.111",
|
|
29
|
+
"@effect/vitest": "4.0.0-rc.111",
|
|
30
|
+
"@iarna/toml": "3.0.0",
|
|
18
31
|
"@opentelemetry/api": "1.9.0",
|
|
19
|
-
"@opentelemetry/exporter-metrics-otlp-http": "0.
|
|
20
|
-
"@opentelemetry/exporter-trace-otlp-http": "0.
|
|
21
|
-
"@opentelemetry/sdk-metrics": "2.0
|
|
22
|
-
"@opentelemetry/sdk-trace-base": "2.0
|
|
23
|
-
"@opentelemetry/sdk-trace-node": "2.0
|
|
24
|
-
"wrangler": "4.
|
|
25
|
-
"@livestore/utils": "0.
|
|
32
|
+
"@opentelemetry/exporter-metrics-otlp-http": "0.208.0",
|
|
33
|
+
"@opentelemetry/exporter-trace-otlp-http": "0.208.0",
|
|
34
|
+
"@opentelemetry/sdk-metrics": "2.2.0",
|
|
35
|
+
"@opentelemetry/sdk-trace-base": "2.2.0",
|
|
36
|
+
"@opentelemetry/sdk-trace-node": "2.2.0",
|
|
37
|
+
"wrangler": "4.42.2",
|
|
38
|
+
"@livestore/utils": "^0.5.0-dev.0"
|
|
26
39
|
},
|
|
27
|
-
"devDependencies": {
|
|
28
|
-
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
"
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@effect/opentelemetry": "4.0.0-rc.111",
|
|
42
|
+
"@effect/platform-browser": "4.0.0-rc.111",
|
|
43
|
+
"@effect/platform-bun": "4.0.0-rc.111",
|
|
44
|
+
"@effect/platform-node": "4.0.0-rc.111",
|
|
45
|
+
"@effect/platform-node-shared": "4.0.0-rc.111",
|
|
46
|
+
"@effect/vitest": "4.0.0-rc.111",
|
|
47
|
+
"@opentelemetry/api": "1.9.0",
|
|
48
|
+
"@opentelemetry/resources": "2.2.0",
|
|
49
|
+
"@standard-schema/spec": "1.1.0",
|
|
50
|
+
"effect": "4.0.0-rc.111",
|
|
51
|
+
"vitest": "4.1.9"
|
|
52
|
+
},
|
|
53
|
+
"peerDependencies": {
|
|
54
|
+
"@effect/opentelemetry": "^4.0.0-rc.111",
|
|
55
|
+
"@effect/platform-browser": "^4.0.0-rc.111",
|
|
56
|
+
"@effect/platform-bun": "^4.0.0-rc.111",
|
|
57
|
+
"@effect/platform-node": "^4.0.0-rc.111",
|
|
58
|
+
"@effect/platform-node-shared": "^4.0.0-rc.111",
|
|
59
|
+
"@effect/vitest": "^4.0.0-rc.111",
|
|
60
|
+
"@opentelemetry/api": "^1.9.0",
|
|
61
|
+
"@opentelemetry/resources": "^2.2.0",
|
|
62
|
+
"@standard-schema/spec": "^1.1.0",
|
|
63
|
+
"effect": "^4.0.0-rc.111"
|
|
64
|
+
},
|
|
65
|
+
"$genie": {
|
|
66
|
+
"source": "package.json.genie.ts",
|
|
67
|
+
"warning": "DO NOT EDIT - changes will be overwritten",
|
|
68
|
+
"workspaceClosureDirs": [
|
|
69
|
+
"packages/@livestore/utils",
|
|
70
|
+
"packages/@livestore/utils-dev"
|
|
71
|
+
]
|
|
37
72
|
},
|
|
38
73
|
"scripts": {
|
|
39
74
|
"test": "echo 'No tests for utils-dev'"
|