0.1.0 #1

Merged
Thilawyn merged 81 commits from next into master 2025-07-17 21:17:57 +02:00
Showing only changes of commit 671156daff - Show all commits

View File

@@ -170,29 +170,39 @@ export namespace make {
i: (_: H, props: NoInfer<P>) => Effect.Effect<React.ReactNode, EOut, ROut>, i: (_: H, props: NoInfer<P>) => Effect.Effect<React.ReactNode, EOut, ROut>,
): Component<EOut, ROut, P> ): Component<EOut, ROut, P>
} }
export interface Options {
readonly untraced?: boolean
readonly finalizerExecutionMode?: "sync" | "fork"
readonly finalizerExecutionStrategy?: ExecutionStrategy.ExecutionStrategy
}
} }
export const make: make.Gen = (...pipeables: readonly [any]) => { export const make: (
const displayName: string = !String.isEmpty(pipeables[0].name) ? pipeables[0].name : undefined & make.Gen
& ((
spanName: string,
spanOptions?: Tracer.SpanOptions,
) => make.Gen)
) = (spanNameOrBody: Function | string, ...pipeables: any[]) => {
if (typeof spanNameOrBody !== "string") {
const displayName = displayNameFromBody(spanNameOrBody)
return Object.setPrototypeOf({ return Object.setPrototypeOf({
body: displayName body: displayName
? Effect.fn(displayName)(...pipeables) ? Effect.fn(displayName)(spanNameOrBody as any, ...pipeables as [])
: Effect.fn(...pipeables), : Effect.fn(spanNameOrBody as any, ...pipeables),
displayName, displayName,
}, ComponentProto) }, ComponentProto)
} }
else {
export const makeUntraced: make.Gen = (...pipeables: readonly [any]) => Object.setPrototypeOf({ const spanOptions = pipeables[0]
body: Effect.fnUntraced(...pipeables), return (body: any, ...pipeables: any[]) => Object.setPrototypeOf({
displayName: !String.isEmpty(pipeables[0].name) ? pipeables[0].name : undefined, body: Effect.fn(spanNameOrBody, spanOptions)(body, ...pipeables as []),
displayName: displayNameFromBody(body) ?? spanNameOrBody,
}, ComponentProto) }, ComponentProto)
}
}
export const makeUntraced: make.Gen = (body: Function, ...pipeables: any[]) => Object.setPrototypeOf({
body: Effect.fnUntraced(body as any, ...pipeables as []),
displayName: displayNameFromBody(body),
}, ComponentProto)
const displayNameFromBody = (body: Function) => !String.isEmpty(body.name) ? body.name : undefined
export const withRuntime: { export const withRuntime: {