effect-start 0.25.0 → 0.27.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/package.json +20 -86
- package/src/Entity.ts +6 -6
- package/src/FileRouterCodegen.ts +4 -4
- package/src/FileSystem.ts +4 -8
- package/src/RouteHook.ts +1 -1
- package/src/RouteSse.ts +3 -3
- package/src/SqlIntrospect.ts +2 -2
- package/src/Start.ts +102 -2
- package/src/Values.ts +11 -0
- package/src/bun/BunRoute.ts +1 -1
- package/src/bun/BunRuntime.ts +5 -5
- package/src/hyper/HyperHtml.ts +11 -7
- package/src/hyper/jsx.d.ts +1 -1
- package/src/lint/plugin.js +174 -4
- package/src/sql/SqlClient.ts +355 -0
- package/src/sql/bun/index.ts +117 -50
- package/src/sql/index.ts +1 -1
- package/src/sql/libsql/index.ts +91 -77
- package/src/sql/libsql/libsql.d.ts +4 -1
- package/src/sql/mssql/index.ts +141 -108
- package/src/sql/mssql/mssql.d.ts +1 -0
- package/src/testing/TestLogger.ts +4 -4
- package/src/x/tailwind/compile.ts +6 -14
- package/dist/ChildProcess.js +0 -42
- package/dist/Commander.js +0 -410
- package/dist/ContentNegotiation.js +0 -465
- package/dist/Cookies.js +0 -371
- package/dist/Development.js +0 -94
- package/dist/Effectify.js +0 -27
- package/dist/Entity.js +0 -289
- package/dist/Fetch.js +0 -192
- package/dist/FilePathPattern.js +0 -97
- package/dist/FileRouter.js +0 -204
- package/dist/FileRouterCodegen.js +0 -298
- package/dist/FileSystem.js +0 -132
- package/dist/Http.js +0 -107
- package/dist/PathPattern.js +0 -451
- package/dist/PlatformError.js +0 -40
- package/dist/PlatformRuntime.js +0 -71
- package/dist/Route.js +0 -143
- package/dist/RouteBody.js +0 -92
- package/dist/RouteError.js +0 -76
- package/dist/RouteHook.js +0 -64
- package/dist/RouteHttp.js +0 -367
- package/dist/RouteHttpTracer.js +0 -90
- package/dist/RouteMount.js +0 -86
- package/dist/RouteSchema.js +0 -271
- package/dist/RouteSse.js +0 -94
- package/dist/RouteTree.js +0 -119
- package/dist/RouteTrie.js +0 -179
- package/dist/SchemaExtra.js +0 -99
- package/dist/Socket.js +0 -40
- package/dist/SqlIntrospect.js +0 -515
- package/dist/Start.js +0 -79
- package/dist/StartApp.js +0 -3
- package/dist/StreamExtra.js +0 -135
- package/dist/System.js +0 -38
- package/dist/TuplePathPattern.js +0 -74
- package/dist/Unique.js +0 -226
- package/dist/Values.js +0 -52
- package/dist/bun/BunBundle.js +0 -186
- package/dist/bun/BunChildProcessSpawner.js +0 -142
- package/dist/bun/BunImportTrackerPlugin.js +0 -91
- package/dist/bun/BunRoute.js +0 -157
- package/dist/bun/BunRuntime.js +0 -41
- package/dist/bun/BunServer.js +0 -285
- package/dist/bun/BunVirtualFilesPlugin.js +0 -54
- package/dist/bun/_BunEnhancedResolve.js +0 -127
- package/dist/bun/index.js +0 -5
- package/dist/bundler/Bundle.js +0 -92
- package/dist/bundler/BundleFiles.js +0 -154
- package/dist/bundler/BundleRoute.js +0 -62
- package/dist/client/Overlay.js +0 -33
- package/dist/client/ScrollState.js +0 -106
- package/dist/client/index.js +0 -97
- package/dist/console/Console.js +0 -42
- package/dist/console/ConsoleErrors.js +0 -211
- package/dist/console/ConsoleLogger.js +0 -56
- package/dist/console/ConsoleMetrics.js +0 -72
- package/dist/console/ConsoleProcess.js +0 -59
- package/dist/console/ConsoleStore.js +0 -72
- package/dist/console/ConsoleTracer.js +0 -107
- package/dist/console/Simulation.js +0 -784
- package/dist/console/index.js +0 -3
- package/dist/console/routes/tree.js +0 -30
- package/dist/datastar/actions/fetch.js +0 -536
- package/dist/datastar/actions/peek.js +0 -13
- package/dist/datastar/actions/setAll.js +0 -19
- package/dist/datastar/actions/toggleAll.js +0 -19
- package/dist/datastar/attributes/attr.js +0 -49
- package/dist/datastar/attributes/bind.js +0 -194
- package/dist/datastar/attributes/class.js +0 -54
- package/dist/datastar/attributes/computed.js +0 -25
- package/dist/datastar/attributes/effect.js +0 -10
- package/dist/datastar/attributes/indicator.js +0 -33
- package/dist/datastar/attributes/init.js +0 -27
- package/dist/datastar/attributes/jsonSignals.js +0 -33
- package/dist/datastar/attributes/on.js +0 -81
- package/dist/datastar/attributes/onIntersect.js +0 -53
- package/dist/datastar/attributes/onInterval.js +0 -31
- package/dist/datastar/attributes/onSignalPatch.js +0 -51
- package/dist/datastar/attributes/ref.js +0 -11
- package/dist/datastar/attributes/show.js +0 -32
- package/dist/datastar/attributes/signals.js +0 -18
- package/dist/datastar/attributes/style.js +0 -57
- package/dist/datastar/attributes/text.js +0 -29
- package/dist/datastar/engine.js +0 -1145
- package/dist/datastar/index.js +0 -25
- package/dist/datastar/utils.js +0 -250
- package/dist/datastar/watchers/patchElements.js +0 -486
- package/dist/datastar/watchers/patchSignals.js +0 -14
- package/dist/experimental/EncryptedCookies.js +0 -328
- package/dist/experimental/index.js +0 -1
- package/dist/hyper/Hyper.js +0 -28
- package/dist/hyper/HyperHtml.js +0 -165
- package/dist/hyper/HyperNode.js +0 -13
- package/dist/hyper/HyperRoute.js +0 -45
- package/dist/hyper/html.js +0 -30
- package/dist/hyper/index.js +0 -5
- package/dist/hyper/jsx-runtime.js +0 -14
- package/dist/index.js +0 -8
- package/dist/node/NodeFileSystem.js +0 -675
- package/dist/node/NodeUtils.js +0 -23
- package/dist/sql/Sql.js +0 -8
- package/dist/sql/bun/index.js +0 -142
- package/dist/sql/index.js +0 -1
- package/dist/sql/libsql/index.js +0 -156
- package/dist/sql/mssql/docker.js +0 -110
- package/dist/sql/mssql/index.js +0 -194
- package/dist/testing/TestLogger.js +0 -42
- package/dist/testing/index.js +0 -2
- package/dist/testing/utils.js +0 -61
- package/dist/x/cloudflare/CloudflareTunnel.js +0 -63
- package/dist/x/cloudflare/index.js +0 -1
- package/dist/x/tailscale/TailscaleTunnel.js +0 -94
- package/dist/x/tailscale/index.js +0 -1
- package/dist/x/tailwind/TailwindPlugin.js +0 -294
- package/dist/x/tailwind/compile.js +0 -210
- package/dist/x/tailwind/plugin.js +0 -17
- package/src/console/Console.ts +0 -42
- package/src/console/ConsoleErrors.ts +0 -213
- package/src/console/ConsoleLogger.ts +0 -56
- package/src/console/ConsoleMetrics.ts +0 -72
- package/src/console/ConsoleProcess.ts +0 -59
- package/src/console/ConsoleStore.ts +0 -187
- package/src/console/ConsoleTracer.ts +0 -107
- package/src/console/Simulation.ts +0 -814
- package/src/console/console.html +0 -340
- package/src/console/index.ts +0 -3
- package/src/console/routes/errors/route.tsx +0 -97
- package/src/console/routes/fiberDetail.tsx +0 -54
- package/src/console/routes/fibers/route.tsx +0 -45
- package/src/console/routes/git/route.tsx +0 -64
- package/src/console/routes/layout.tsx +0 -4
- package/src/console/routes/logs/route.tsx +0 -77
- package/src/console/routes/metrics/route.tsx +0 -36
- package/src/console/routes/route.tsx +0 -8
- package/src/console/routes/routes/route.tsx +0 -30
- package/src/console/routes/services/route.tsx +0 -21
- package/src/console/routes/system/route.tsx +0 -43
- package/src/console/routes/traceDetail.tsx +0 -22
- package/src/console/routes/traces/route.tsx +0 -81
- package/src/console/routes/tree.ts +0 -30
- package/src/console/ui/Errors.tsx +0 -76
- package/src/console/ui/Fibers.tsx +0 -321
- package/src/console/ui/Git.tsx +0 -182
- package/src/console/ui/Logs.tsx +0 -46
- package/src/console/ui/Metrics.tsx +0 -78
- package/src/console/ui/Routes.tsx +0 -125
- package/src/console/ui/Services.tsx +0 -273
- package/src/console/ui/Shell.tsx +0 -62
- package/src/console/ui/System.tsx +0 -131
- package/src/console/ui/Traces.tsx +0 -426
- package/src/sql/Sql.ts +0 -51
package/src/sql/mssql/index.ts
CHANGED
|
@@ -5,26 +5,8 @@ import * as GlobalValue from "effect/GlobalValue"
|
|
|
5
5
|
import * as Layer from "effect/Layer"
|
|
6
6
|
import * as Option from "effect/Option"
|
|
7
7
|
import type * as Mssql from "mssql"
|
|
8
|
-
import * as Sql from "../
|
|
9
|
-
|
|
10
|
-
export interface MssqlConfig {
|
|
11
|
-
readonly server: string
|
|
12
|
-
readonly database?: string
|
|
13
|
-
readonly user?: string
|
|
14
|
-
readonly password?: string
|
|
15
|
-
readonly port?: number
|
|
16
|
-
readonly pool?: {
|
|
17
|
-
readonly max?: number
|
|
18
|
-
readonly min?: number
|
|
19
|
-
readonly idleTimeoutMillis?: number
|
|
20
|
-
}
|
|
21
|
-
readonly options?: {
|
|
22
|
-
readonly encrypt?: boolean
|
|
23
|
-
readonly trustServerCertificate?: boolean
|
|
24
|
-
readonly requestTimeout?: number
|
|
25
|
-
readonly connectionTimeout?: number
|
|
26
|
-
}
|
|
27
|
-
}
|
|
8
|
+
import * as Sql from "../SqlClient.ts"
|
|
9
|
+
import * as Values from "../../Values.ts"
|
|
28
10
|
|
|
29
11
|
const wrapError = (error: unknown): Sql.SqlError =>
|
|
30
12
|
new Sql.SqlError({
|
|
@@ -35,17 +17,33 @@ const wrapError = (error: unknown): Sql.SqlError =>
|
|
|
35
17
|
cause: error,
|
|
36
18
|
})
|
|
37
19
|
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
20
|
+
const dialect = Sql.mssqlDialect
|
|
21
|
+
const makeSpanAttributes = (
|
|
22
|
+
config: Mssql.config & {
|
|
23
|
+
readonly url?: string
|
|
24
|
+
readonly spanAttributes?: Record<string, unknown>
|
|
25
|
+
},
|
|
26
|
+
): Record<string, unknown> =>
|
|
27
|
+
{
|
|
28
|
+
const parsed = (() => {
|
|
29
|
+
if (typeof config.url !== "string") return undefined
|
|
30
|
+
try {
|
|
31
|
+
return new URL(config.url)
|
|
32
|
+
} catch {
|
|
33
|
+
return undefined
|
|
34
|
+
}
|
|
35
|
+
})()
|
|
36
|
+
const dbFromPath = parsed?.pathname.replace(/^\/+/, "") || undefined
|
|
37
|
+
const parsedPort = parsed?.port ? Number(parsed.port) : undefined
|
|
43
38
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
39
|
+
return Values.compact({
|
|
40
|
+
...(config.spanAttributes ?? {}),
|
|
41
|
+
"db.system.name": "microsoft.sql_server",
|
|
42
|
+
"db.namespace": config.database ?? dbFromPath,
|
|
43
|
+
"server.address": config.server ?? parsed?.hostname,
|
|
44
|
+
"server.port": config.port ?? parsedPort,
|
|
45
|
+
})
|
|
46
|
+
}
|
|
49
47
|
|
|
50
48
|
const addInputs = (request: Mssql.Request, values: Array<unknown>) => {
|
|
51
49
|
for (let i = 0; i < values.length; i++) {
|
|
@@ -53,7 +51,7 @@ const addInputs = (request: Mssql.Request, values: Array<unknown>) => {
|
|
|
53
51
|
}
|
|
54
52
|
}
|
|
55
53
|
|
|
56
|
-
interface
|
|
54
|
+
interface TransactionConnection {
|
|
57
55
|
readonly transaction: Mssql.Transaction
|
|
58
56
|
readonly depth: number
|
|
59
57
|
}
|
|
@@ -66,45 +64,71 @@ const loadMssql = () => import("mssql") as Promise<MssqlModule>
|
|
|
66
64
|
|
|
67
65
|
const currentTransaction = GlobalValue.globalValue(
|
|
68
66
|
Symbol.for("effect-start/sql/mssql/currentTransaction"),
|
|
69
|
-
() => FiberRef.unsafeMake<Option.Option<
|
|
67
|
+
() => FiberRef.unsafeMake<Option.Option<TransactionConnection>>(Option.none()),
|
|
70
68
|
)
|
|
71
69
|
|
|
70
|
+
const makeRequest = (
|
|
71
|
+
pool: Mssql.ConnectionPool,
|
|
72
|
+
txOpt: Option.Option<TransactionConnection>,
|
|
73
|
+
values: Array<unknown>,
|
|
74
|
+
): Mssql.Request => {
|
|
75
|
+
const request = Option.isSome(txOpt) ? txOpt.value.transaction.request() : pool.request()
|
|
76
|
+
addInputs(request, values)
|
|
77
|
+
return request
|
|
78
|
+
}
|
|
79
|
+
|
|
72
80
|
const executeQuery = <T>(
|
|
73
81
|
pool: Mssql.ConnectionPool,
|
|
74
82
|
text: string,
|
|
75
83
|
values: Array<unknown>,
|
|
76
84
|
): Effect.Effect<ReadonlyArray<T>, Sql.SqlError> =>
|
|
77
|
-
Effect.flatMap(FiberRef.get(currentTransaction), (txOpt) =>
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
return Effect.tryPromise({
|
|
81
|
-
try: () => request.query<T>(text),
|
|
85
|
+
Effect.flatMap(FiberRef.get(currentTransaction), (txOpt) =>
|
|
86
|
+
Effect.tryPromise({
|
|
87
|
+
try: () => makeRequest(pool, txOpt, values).query<T>(text),
|
|
82
88
|
catch: wrapError,
|
|
83
|
-
}).pipe(Effect.map((result) => result.recordset ?? []))
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
const runQuery = <T>(
|
|
87
|
-
pool: Mssql.ConnectionPool,
|
|
88
|
-
strings: TemplateStringsArray,
|
|
89
|
-
values: Array<unknown>,
|
|
90
|
-
): Effect.Effect<ReadonlyArray<T>, Sql.SqlError> => {
|
|
91
|
-
const { text, values: params } = buildQuery(strings, values)
|
|
92
|
-
return executeQuery(pool, text, params)
|
|
93
|
-
}
|
|
89
|
+
}).pipe(Effect.map((result) => result.recordset ?? [])),
|
|
90
|
+
)
|
|
94
91
|
|
|
95
92
|
const runUnsafe = <T>(
|
|
96
93
|
pool: Mssql.ConnectionPool,
|
|
97
94
|
query: string,
|
|
98
95
|
values?: Array<unknown>,
|
|
99
96
|
): Effect.Effect<ReadonlyArray<T>, Sql.SqlError> =>
|
|
100
|
-
Effect.flatMap(FiberRef.get(currentTransaction), (txOpt) =>
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
return Effect.tryPromise({
|
|
104
|
-
try: () => request.query<T>(query),
|
|
97
|
+
Effect.flatMap(FiberRef.get(currentTransaction), (txOpt) =>
|
|
98
|
+
Effect.tryPromise({
|
|
99
|
+
try: () => makeRequest(pool, txOpt, values ?? []).query<T>(query),
|
|
105
100
|
catch: wrapError,
|
|
106
|
-
}).pipe(Effect.map((result) => result.recordset ?? []))
|
|
107
|
-
|
|
101
|
+
}).pipe(Effect.map((result) => result.recordset ?? [])),
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
const makeTaggedTemplate = (pool: Mssql.ConnectionPool) => {
|
|
105
|
+
const unsafeFn = <T = any>(query: string, values?: Array<unknown>) =>
|
|
106
|
+
runUnsafe<T>(pool, query, values)
|
|
107
|
+
|
|
108
|
+
return <T = any>(
|
|
109
|
+
strings: TemplateStringsArray,
|
|
110
|
+
...values: Array<unknown>
|
|
111
|
+
): Effect.Effect<ReadonlyArray<T>, Sql.SqlError> => {
|
|
112
|
+
if (Sql.hasFragments(values)) {
|
|
113
|
+
const compiled = Sql.interpolate(dialect, strings, values)
|
|
114
|
+
return unsafeFn<T>(compiled.sql, compiled.parameters)
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
let text = strings[0]
|
|
118
|
+
for (let i = 0; i < values.length; i++) text += `@p${i + 1}` + strings[i + 1]
|
|
119
|
+
return executeQuery<T>(pool, text, values)
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
const makeQuery = (
|
|
124
|
+
pool: Mssql.ConnectionPool,
|
|
125
|
+
spanAttributes: ReadonlyArray<readonly [string, unknown]>,
|
|
126
|
+
): Sql.Connection => {
|
|
127
|
+
const query = makeTaggedTemplate(pool)
|
|
128
|
+
const unsafe: Sql.Connection["unsafe"] = <T = any>(query: string, values?: Array<unknown>) =>
|
|
129
|
+
runUnsafe<T>(pool, query, values)
|
|
130
|
+
return Sql.connection(query, unsafe, { spanAttributes, dialect })
|
|
131
|
+
}
|
|
108
132
|
|
|
109
133
|
const makeWithTransaction =
|
|
110
134
|
(pool: Mssql.ConnectionPool) =>
|
|
@@ -161,63 +185,72 @@ const makeWithTransaction =
|
|
|
161
185
|
}),
|
|
162
186
|
)
|
|
163
187
|
|
|
164
|
-
export const layer = (
|
|
188
|
+
export const layer = (
|
|
189
|
+
config: Mssql.config & {
|
|
190
|
+
readonly url?: string
|
|
191
|
+
readonly spanAttributes?: Record<string, unknown>
|
|
192
|
+
},
|
|
193
|
+
): Layer.Layer<Sql.SqlClient, Sql.SqlError> =>
|
|
165
194
|
Layer.scoped(
|
|
166
195
|
Sql.SqlClient,
|
|
167
|
-
Effect.
|
|
168
|
-
Effect.
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
196
|
+
Effect.map(
|
|
197
|
+
Effect.acquireRelease(
|
|
198
|
+
Effect.tryPromise({
|
|
199
|
+
try: async () => {
|
|
200
|
+
const mssql = await loadMssql()
|
|
201
|
+
const driverConfig = { ...config } as Record<string, unknown>
|
|
202
|
+
delete driverConfig.spanAttributes
|
|
203
|
+
delete driverConfig.url
|
|
204
|
+
const pool = await new mssql.ConnectionPool(driverConfig as unknown as Mssql.config).connect()
|
|
205
|
+
return { mssql, pool }
|
|
206
|
+
},
|
|
207
|
+
catch: wrapError,
|
|
208
|
+
}).pipe(
|
|
209
|
+
Effect.map((options) => {
|
|
210
|
+
const driverConfig = { ...config } as Record<string, unknown>
|
|
211
|
+
delete driverConfig.spanAttributes
|
|
212
|
+
delete driverConfig.url
|
|
213
|
+
const spanAttributes = Object.entries(makeSpanAttributes(config))
|
|
214
|
+
const query = makeTaggedTemplate(options.pool)
|
|
215
|
+
const unsafeFn: Sql.Connection["unsafe"] = <T = any>(
|
|
216
|
+
query: string,
|
|
217
|
+
values?: Array<unknown>,
|
|
218
|
+
) => runUnsafe<T>(options.pool, query, values)
|
|
219
|
+
const use: Sql.SqlClient["use"] = (fn) =>
|
|
220
|
+
Effect.tryPromise({ try: () => Promise.resolve(fn(options.pool)), catch: wrapError })
|
|
221
|
+
|
|
222
|
+
return {
|
|
223
|
+
client: Sql.make({
|
|
224
|
+
query,
|
|
225
|
+
unsafe: unsafeFn,
|
|
226
|
+
withTransaction: makeWithTransaction(options.pool),
|
|
227
|
+
spanAttributes,
|
|
228
|
+
dialect,
|
|
229
|
+
reserve: Effect.acquireRelease(
|
|
230
|
+
Effect.tryPromise({
|
|
231
|
+
try: () =>
|
|
232
|
+
new options.mssql.ConnectionPool({
|
|
233
|
+
...driverConfig,
|
|
234
|
+
pool: { max: 1, min: 1 },
|
|
235
|
+
} as unknown as Mssql.config).connect(),
|
|
236
|
+
catch: wrapError,
|
|
237
|
+
}),
|
|
238
|
+
(reserved: Mssql.ConnectionPool) =>
|
|
239
|
+
Effect.tryPromise({ try: () => reserved.close(), catch: () => void 0 }).pipe(
|
|
240
|
+
Effect.asVoid,
|
|
241
|
+
Effect.orDie,
|
|
212
242
|
),
|
|
243
|
+
).pipe(
|
|
244
|
+
Effect.map((reserved): Sql.Connection => makeQuery(reserved, spanAttributes)),
|
|
213
245
|
),
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
use,
|
|
217
|
-
}
|
|
218
|
-
)
|
|
219
|
-
|
|
246
|
+
use,
|
|
247
|
+
}),
|
|
248
|
+
close: use((pool) => pool.close()),
|
|
249
|
+
}
|
|
250
|
+
}),
|
|
251
|
+
),
|
|
252
|
+
(handle) => handle.close.pipe(Effect.orDie),
|
|
220
253
|
),
|
|
221
|
-
(
|
|
254
|
+
(handle) => handle.client,
|
|
222
255
|
),
|
|
223
256
|
)
|
package/src/sql/mssql/mssql.d.ts
CHANGED
|
@@ -24,13 +24,13 @@ export function layer(): Layer.Layer<TestLogger> {
|
|
|
24
24
|
const messages = yield* Ref.make<Array<string>>([])
|
|
25
25
|
const mutableRef = (messages as any).ref as MutableRef.MutableRef<Array<string>>
|
|
26
26
|
|
|
27
|
-
const customLogger = Logger.make((
|
|
28
|
-
const causeStr = !Cause.isEmpty(cause)
|
|
29
|
-
? ` ${Cause.pretty(cause, { renderErrorCause: true })}`
|
|
27
|
+
const customLogger = Logger.make((options) => {
|
|
28
|
+
const causeStr = !Cause.isEmpty(options.cause)
|
|
29
|
+
? ` ${Cause.pretty(options.cause, { renderErrorCause: true })}`
|
|
30
30
|
: ""
|
|
31
31
|
MutableRef.update(mutableRef, (msgs) => [
|
|
32
32
|
...msgs,
|
|
33
|
-
`[${logLevel._tag}] ${String(message)}${causeStr}`,
|
|
33
|
+
`[${options.logLevel._tag}] ${String(options.message)}${causeStr}`,
|
|
34
34
|
])
|
|
35
35
|
})
|
|
36
36
|
|
|
@@ -20,24 +20,16 @@ export interface CompileOptions {
|
|
|
20
20
|
customJsResolver?: Resolver
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
function createCompileOptions({
|
|
24
|
-
base,
|
|
25
|
-
from,
|
|
26
|
-
polyfills,
|
|
27
|
-
onDependency,
|
|
28
|
-
|
|
29
|
-
customCssResolver,
|
|
30
|
-
customJsResolver,
|
|
31
|
-
}: CompileOptions) {
|
|
23
|
+
function createCompileOptions(options: CompileOptions) {
|
|
32
24
|
return {
|
|
33
|
-
base,
|
|
34
|
-
polyfills,
|
|
35
|
-
from,
|
|
25
|
+
base: options.base,
|
|
26
|
+
polyfills: options.polyfills,
|
|
27
|
+
from: options.from,
|
|
36
28
|
async loadModule(id: string, base: string) {
|
|
37
|
-
return loadModule(id, base, onDependency, customJsResolver)
|
|
29
|
+
return loadModule(id, base, options.onDependency, options.customJsResolver)
|
|
38
30
|
},
|
|
39
31
|
async loadStylesheet(id: string, sheetBase: string) {
|
|
40
|
-
let sheet = await loadStylesheet(id, sheetBase, onDependency, customCssResolver)
|
|
32
|
+
let sheet = await loadStylesheet(id, sheetBase, options.onDependency, options.customCssResolver)
|
|
41
33
|
|
|
42
34
|
return sheet
|
|
43
35
|
},
|
package/dist/ChildProcess.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Adapted from upcomnig Effect 4 aka effect-smol.
|
|
3
|
-
*
|
|
4
|
-
* Kept a minimal interface without tempaltes and file descirptor
|
|
5
|
-
* to keep it compatible if it lands in the core (ie. not in seperate platform package.)
|
|
6
|
-
*/
|
|
7
|
-
import * as Context from "effect/Context"
|
|
8
|
-
import * as Effect from "effect/Effect"
|
|
9
|
-
import * as Pipeable from "effect/Pipeable"
|
|
10
|
-
import * as Predicate from "effect/Predicate"
|
|
11
|
-
import * as Utils from "effect/Utils"
|
|
12
|
-
|
|
13
|
-
const TypeId = Symbol.for("effect-start/ChildProcess/Command")
|
|
14
|
-
|
|
15
|
-
const CommandProto = {
|
|
16
|
-
[TypeId]: TypeId,
|
|
17
|
-
pipe() {
|
|
18
|
-
return Pipeable.pipeArguments(this, arguments)
|
|
19
|
-
},
|
|
20
|
-
[Symbol.iterator]() {
|
|
21
|
-
return new Utils.SingleShotGen(new Utils.YieldWrap(spawn(this)))
|
|
22
|
-
},
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export const isCommand = (u) => Predicate.hasProperty(u, TypeId)
|
|
26
|
-
|
|
27
|
-
export const make = (
|
|
28
|
-
command,
|
|
29
|
-
args,
|
|
30
|
-
options,
|
|
31
|
-
) =>
|
|
32
|
-
Object.assign(Object.create(CommandProto), {
|
|
33
|
-
command,
|
|
34
|
-
args: args ?? [],
|
|
35
|
-
...options,
|
|
36
|
-
})
|
|
37
|
-
|
|
38
|
-
export class ChildProcessSpawner extends Context.Tag("effect-start/ChildProcessSpawner")() {}
|
|
39
|
-
|
|
40
|
-
export const spawn = (
|
|
41
|
-
command,
|
|
42
|
-
) => Effect.flatMap(ChildProcessSpawner, (spawner) => spawner.spawn(command))
|