effect-start 0.28.0 → 0.30.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/README.md +1 -1
- package/dist/Cookies.d.ts +9 -41
- package/dist/Cookies.d.ts.map +1 -1
- package/dist/Cookies.js +2 -2
- package/dist/Cookies.js.map +1 -1
- package/dist/Development.d.ts +7 -21
- package/dist/Development.d.ts.map +1 -1
- package/dist/Development.js +6 -8
- package/dist/Development.js.map +1 -1
- package/dist/Entity.d.ts +5 -6
- package/dist/Entity.d.ts.map +1 -1
- package/dist/Entity.js +10 -7
- package/dist/Entity.js.map +1 -1
- package/dist/Fetch.d.ts +15 -4
- package/dist/Fetch.d.ts.map +1 -1
- package/dist/Fetch.js +74 -1
- package/dist/Fetch.js.map +1 -1
- package/dist/FileRouter.d.ts +4 -7
- package/dist/FileRouter.d.ts.map +1 -1
- package/dist/FileRouter.js +38 -29
- package/dist/FileRouter.js.map +1 -1
- package/dist/FileRouterCodegen.d.ts +2 -2
- package/dist/FileRouterCodegen.d.ts.map +1 -1
- package/dist/FileRouterCodegen.js +9 -21
- package/dist/FileRouterCodegen.js.map +1 -1
- package/dist/FileSystem.d.ts +39 -39
- package/dist/FileSystem.d.ts.map +1 -1
- package/dist/FileSystem.js +5 -3
- package/dist/FileSystem.js.map +1 -1
- package/dist/GlobalLayer.d.ts +2 -2
- package/dist/GlobalLayer.d.ts.map +1 -1
- package/dist/GlobalLayer.js +2 -2
- package/dist/GlobalLayer.js.map +1 -1
- package/dist/Html.d.ts +32 -0
- package/dist/Html.d.ts.map +1 -0
- package/dist/{hyper/HyperHtml.js → Html.js} +45 -26
- package/dist/Html.js.map +1 -0
- package/dist/PlatformRuntime.d.ts.map +1 -1
- package/dist/PlatformRuntime.js.map +1 -1
- package/dist/Route.d.ts +22 -9
- package/dist/Route.d.ts.map +1 -1
- package/dist/Route.js +25 -4
- package/dist/Route.js.map +1 -1
- package/dist/RouteBody.d.ts +14 -7
- package/dist/RouteBody.d.ts.map +1 -1
- package/dist/RouteBody.js +38 -27
- package/dist/RouteBody.js.map +1 -1
- package/dist/RouteError.js.map +1 -1
- package/dist/RouteHook.d.ts.map +1 -1
- package/dist/RouteHook.js.map +1 -1
- package/dist/RouteHttp.d.ts +1 -1
- package/dist/RouteHttp.d.ts.map +1 -1
- package/dist/RouteHttp.js +56 -32
- package/dist/RouteHttp.js.map +1 -1
- package/dist/RouteHttpTracer.d.ts.map +1 -1
- package/dist/RouteHttpTracer.js.map +1 -1
- package/dist/RouteMount.d.ts +2 -2
- package/dist/RouteMount.d.ts.map +1 -1
- package/dist/RouteMount.js +2 -2
- package/dist/RouteMount.js.map +1 -1
- package/dist/RouteSchema.d.ts +2 -2
- package/dist/RouteSchema.d.ts.map +1 -1
- package/dist/RouteSchema.js +2 -2
- package/dist/RouteSchema.js.map +1 -1
- package/dist/RouteSse.d.ts +9 -10
- package/dist/RouteSse.d.ts.map +1 -1
- package/dist/RouteSse.js +8 -12
- package/dist/RouteSse.js.map +1 -1
- package/dist/RouteTree.d.ts +2 -2
- package/dist/RouteTree.d.ts.map +1 -1
- package/dist/RouteTree.js +2 -2
- package/dist/RouteTree.js.map +1 -1
- package/dist/RouteTrie.js +1 -1
- package/dist/RouteTrie.js.map +1 -1
- package/dist/Socket.d.ts +13 -18
- package/dist/Socket.d.ts.map +1 -1
- package/dist/Socket.js +12 -13
- package/dist/Socket.js.map +1 -1
- package/dist/Start.d.ts +15 -23
- package/dist/Start.d.ts.map +1 -1
- package/dist/Start.js +17 -6
- package/dist/Start.js.map +1 -1
- package/dist/System.d.ts +20 -5
- package/dist/System.d.ts.map +1 -1
- package/dist/System.js +12 -42
- package/dist/System.js.map +1 -1
- package/dist/Unique.d.ts.map +1 -1
- package/dist/Unique.js.map +1 -1
- package/dist/{ChildProcess.d.ts → _ChildProcess.d.ts} +14 -15
- package/dist/_ChildProcess.d.ts.map +1 -0
- package/dist/{ChildProcess.js → _ChildProcess.js} +2 -2
- package/dist/_ChildProcess.js.map +1 -0
- package/dist/{ContentNegotiation.d.ts → _ContentNegotiation.d.ts} +1 -1
- package/dist/_ContentNegotiation.d.ts.map +1 -0
- package/dist/{ContentNegotiation.js → _ContentNegotiation.js} +1 -1
- package/dist/_ContentNegotiation.js.map +1 -0
- package/dist/{Docker.d.ts → _Docker.d.ts} +2 -2
- package/dist/_Docker.d.ts.map +1 -0
- package/dist/{Docker.js → _Docker.js} +1 -1
- package/dist/_Docker.js.map +1 -0
- package/dist/{Effectify.d.ts → _Effectify.d.ts} +1 -1
- package/dist/_Effectify.d.ts.map +1 -0
- package/dist/{Effectify.js → _Effectify.js} +1 -1
- package/dist/_Effectify.js.map +1 -0
- package/dist/{Http.d.ts → _Http.d.ts} +1 -8
- package/dist/_Http.d.ts.map +1 -0
- package/dist/{Http.js → _Http.js} +1 -17
- package/dist/_Http.js.map +1 -0
- package/dist/{PathPattern.d.ts → _PathPattern.d.ts} +12 -1
- package/dist/_PathPattern.d.ts.map +1 -0
- package/dist/{PathPattern.js → _PathPattern.js} +86 -1
- package/dist/_PathPattern.js.map +1 -0
- package/dist/_SchemaExtra.d.ts +4 -0
- package/dist/_SchemaExtra.d.ts.map +1 -0
- package/dist/{SchemaExtra.js → _SchemaExtra.js} +4 -4
- package/dist/_SchemaExtra.js.map +1 -0
- package/dist/{StartApp.d.ts → _StartApp.d.ts} +1 -1
- package/dist/_StartApp.d.ts.map +1 -0
- package/dist/{StartApp.js → _StartApp.js} +1 -1
- package/dist/_StartApp.js.map +1 -0
- package/dist/{StreamExtra.d.ts → _StreamExtra.d.ts} +5 -5
- package/dist/_StreamExtra.d.ts.map +1 -0
- package/dist/{StreamExtra.js → _StreamExtra.js} +1 -1
- package/dist/_StreamExtra.js.map +1 -0
- package/dist/{Values.d.ts → _Values.d.ts} +3 -3
- package/dist/_Values.d.ts.map +1 -0
- package/dist/{Values.js → _Values.js} +1 -1
- package/dist/_Values.js.map +1 -0
- package/dist/bun/BunBundle.d.ts +2 -2
- package/dist/bun/BunBundle.d.ts.map +1 -1
- package/dist/bun/BunBundle.js.map +1 -1
- package/dist/bun/BunChildProcessSpawner.d.ts +1 -1
- package/dist/bun/BunChildProcessSpawner.d.ts.map +1 -1
- package/dist/bun/BunChildProcessSpawner.js +9 -9
- package/dist/bun/BunChildProcessSpawner.js.map +1 -1
- package/dist/bun/BunImportTrackerPlugin.d.ts +2 -2
- package/dist/bun/BunImportTrackerPlugin.d.ts.map +1 -1
- package/dist/bun/BunImportTrackerPlugin.js.map +1 -1
- package/dist/bun/BunRoute.d.ts +2 -2
- package/dist/bun/BunRoute.d.ts.map +1 -1
- package/dist/bun/BunRoute.js +108 -40
- package/dist/bun/BunRoute.js.map +1 -1
- package/dist/bun/BunRuntime.js.map +1 -1
- package/dist/bun/BunServer.d.ts +5 -5
- package/dist/bun/BunServer.d.ts.map +1 -1
- package/dist/bun/BunServer.js +3 -3
- package/dist/bun/BunServer.js.map +1 -1
- package/dist/bun/BunVirtualFilesPlugin.js.map +1 -1
- package/dist/bun/_BunEnhancedResolve.d.ts.map +1 -1
- package/dist/bun/_BunEnhancedResolve.js.map +1 -1
- package/dist/bun/_empty.html +0 -0
- package/dist/bundler/Bundle.d.ts +2 -2
- package/dist/bundler/Bundle.d.ts.map +1 -1
- package/dist/bundler/Bundle.js.map +1 -1
- package/dist/bundler/BundleFiles.d.ts +1 -1
- package/dist/bundler/BundleFiles.d.ts.map +1 -1
- package/dist/bundler/BundleFiles.js.map +1 -1
- package/dist/bundler/BundleRoute.d.ts +6 -5
- package/dist/bundler/BundleRoute.d.ts.map +1 -1
- package/dist/bundler/BundleRoute.js +2 -2
- package/dist/bundler/BundleRoute.js.map +1 -1
- package/dist/cli/Argument.d.ts +26 -0
- package/dist/cli/Argument.d.ts.map +1 -0
- package/dist/cli/Argument.js +31 -0
- package/dist/cli/Argument.js.map +1 -0
- package/dist/cli/CliError.d.ts +15 -0
- package/dist/cli/CliError.d.ts.map +1 -0
- package/dist/cli/CliError.js +54 -0
- package/dist/cli/CliError.js.map +1 -0
- package/dist/cli/Command.d.ts +61 -0
- package/dist/cli/Command.d.ts.map +1 -0
- package/dist/cli/Command.js +453 -0
- package/dist/cli/Command.js.map +1 -0
- package/dist/cli/Flag.d.ts +32 -0
- package/dist/cli/Flag.d.ts.map +1 -0
- package/dist/cli/Flag.js +35 -0
- package/dist/cli/Flag.js.map +1 -0
- package/dist/cli/HelpDoc.d.ts +28 -0
- package/dist/cli/HelpDoc.d.ts.map +1 -0
- package/dist/cli/HelpDoc.js +40 -0
- package/dist/cli/HelpDoc.js.map +1 -0
- package/dist/cli/Param.d.ts +71 -0
- package/dist/cli/Param.d.ts.map +1 -0
- package/dist/cli/Param.js +236 -0
- package/dist/cli/Param.js.map +1 -0
- package/dist/cli/Primitive.d.ts +22 -0
- package/dist/cli/Primitive.d.ts.map +1 -0
- package/dist/cli/Primitive.js +73 -0
- package/dist/cli/Primitive.js.map +1 -0
- package/dist/cli/index.d.ts +8 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +8 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/client/Overlay.js.map +1 -1
- package/dist/client/ScrollState.js.map +1 -1
- package/dist/client/index.js.map +1 -1
- package/dist/cloudflare/CloudflareTunnel.d.ts +12 -0
- package/dist/cloudflare/CloudflareTunnel.d.ts.map +1 -0
- package/dist/{x/cloudflare → cloudflare}/CloudflareTunnel.js +1 -1
- package/dist/cloudflare/CloudflareTunnel.js.map +1 -0
- package/dist/cloudflare/index.d.ts.map +1 -0
- package/dist/cloudflare/index.js.map +1 -0
- package/dist/datastar/actions/fetch.js.map +1 -1
- package/dist/datastar/actions/peek.js.map +1 -1
- package/dist/datastar/actions/setAll.js.map +1 -1
- package/dist/datastar/actions/toggleAll.js.map +1 -1
- package/dist/datastar/attributes/attr.js.map +1 -1
- package/dist/datastar/attributes/bind.js.map +1 -1
- package/dist/datastar/attributes/class.js.map +1 -1
- package/dist/datastar/attributes/computed.js.map +1 -1
- package/dist/datastar/attributes/indicator.js.map +1 -1
- package/dist/datastar/attributes/init.js.map +1 -1
- package/dist/datastar/attributes/jsonSignals.js.map +1 -1
- package/dist/datastar/attributes/on.js.map +1 -1
- package/dist/datastar/attributes/onIntersect.js.map +1 -1
- package/dist/datastar/attributes/onInterval.js.map +1 -1
- package/dist/datastar/attributes/onSignalPatch.js.map +1 -1
- package/dist/datastar/attributes/ref.js.map +1 -1
- package/dist/datastar/attributes/show.js.map +1 -1
- package/dist/datastar/attributes/signals.js.map +1 -1
- package/dist/datastar/attributes/style.js.map +1 -1
- package/dist/datastar/attributes/text.js.map +1 -1
- package/dist/datastar/engine.d.ts +5 -5
- package/dist/datastar/engine.d.ts.map +1 -1
- package/dist/datastar/engine.js.map +1 -1
- package/dist/datastar/utils.d.ts +1 -1
- package/dist/datastar/utils.d.ts.map +1 -1
- package/dist/datastar/utils.js.map +1 -1
- package/dist/datastar/watchers/patchElements.js +3 -1
- package/dist/datastar/watchers/patchElements.js.map +1 -1
- package/dist/datastar/watchers/patchSignals.js.map +1 -1
- package/dist/experimental/EncryptedCookies.d.ts +4 -4
- package/dist/experimental/EncryptedCookies.d.ts.map +1 -1
- package/dist/experimental/EncryptedCookies.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/jsx-runtime.d.ts +8 -0
- package/dist/jsx-runtime.d.ts.map +1 -0
- package/dist/{hyper/jsx-runtime.js → jsx-runtime.js} +2 -2
- package/dist/jsx-runtime.js.map +1 -0
- package/dist/lint/plugin.d.ts +18 -15
- package/dist/lint/plugin.d.ts.map +1 -1
- package/dist/lint/plugin.js +76 -80
- package/dist/lint/plugin.js.map +1 -1
- package/dist/node/NodeFileSystem.d.ts +3 -3
- package/dist/node/NodeFileSystem.d.ts.map +1 -1
- package/dist/node/NodeFileSystem.js +8 -7
- package/dist/node/NodeFileSystem.js.map +1 -1
- package/dist/node/NodeUtils.d.ts.map +1 -1
- package/dist/node/NodeUtils.js.map +1 -1
- package/dist/sql/SqlCache.d.ts +1 -0
- package/dist/sql/SqlCache.d.ts.map +1 -1
- package/dist/sql/SqlCache.js +5 -1
- package/dist/sql/SqlCache.js.map +1 -1
- package/dist/sql/SqlClient.js +1 -1
- package/dist/sql/SqlClient.js.map +1 -1
- package/dist/{SqlIntrospect.d.ts → sql/SqlIntrospect.d.ts} +3 -3
- package/dist/sql/SqlIntrospect.d.ts.map +1 -0
- package/dist/{SqlIntrospect.js → sql/SqlIntrospect.js} +1 -1
- package/dist/sql/SqlIntrospect.js.map +1 -0
- package/dist/sql/bun/index.d.ts +3 -3
- package/dist/sql/bun/index.d.ts.map +1 -1
- package/dist/sql/bun/index.js +1 -1
- package/dist/sql/bun/index.js.map +1 -1
- package/dist/sql/index.d.ts +1 -0
- package/dist/sql/index.d.ts.map +1 -1
- package/dist/sql/index.js +1 -0
- package/dist/sql/index.js.map +1 -1
- package/dist/sql/libsql/index.d.ts +1 -1
- package/dist/sql/libsql/index.d.ts.map +1 -1
- package/dist/sql/libsql/index.js +2 -2
- package/dist/sql/libsql/index.js.map +1 -1
- package/dist/sql/mssql/index.d.ts +3 -3
- package/dist/sql/mssql/index.d.ts.map +1 -1
- package/dist/sql/mssql/index.js +1 -1
- package/dist/sql/mssql/index.js.map +1 -1
- package/dist/sql/postgres/index.d.ts +1 -1
- package/dist/sql/postgres/index.d.ts.map +1 -1
- package/dist/sql/postgres/index.js.map +1 -1
- package/dist/studio/Simulation.d.ts.map +1 -0
- package/dist/studio/Simulation.js.map +1 -0
- package/dist/{tower/Tower.d.ts → studio/Studio.d.ts} +4 -4
- package/dist/studio/Studio.d.ts.map +1 -0
- package/dist/studio/Studio.js +30 -0
- package/dist/studio/Studio.js.map +1 -0
- package/dist/studio/StudioErrors.d.ts +4 -0
- package/dist/studio/StudioErrors.d.ts.map +1 -0
- package/dist/{tower/TowerErrors.js → studio/StudioErrors.js} +6 -6
- package/dist/studio/StudioErrors.js.map +1 -0
- package/dist/{tower/TowerLogger.d.ts → studio/StudioLogger.d.ts} +1 -1
- package/dist/studio/StudioLogger.d.ts.map +1 -0
- package/dist/{tower/TowerLogger.js → studio/StudioLogger.js} +7 -7
- package/dist/studio/StudioLogger.js.map +1 -0
- package/dist/studio/StudioMetrics.d.ts +4 -0
- package/dist/studio/StudioMetrics.d.ts.map +1 -0
- package/dist/{tower/TowerMetrics.js → studio/StudioMetrics.js} +3 -3
- package/dist/studio/StudioMetrics.js.map +1 -0
- package/dist/studio/StudioProcess.d.ts +4 -0
- package/dist/studio/StudioProcess.d.ts.map +1 -0
- package/dist/{tower/TowerProcess.js → studio/StudioProcess.js} +3 -3
- package/dist/studio/StudioProcess.js.map +1 -0
- package/dist/{tower/TowerStore.d.ts → studio/StudioStore.d.ts} +33 -33
- package/dist/studio/StudioStore.d.ts.map +1 -0
- package/dist/{tower/TowerStore.js → studio/StudioStore.js} +5 -5
- package/dist/studio/StudioStore.js.map +1 -0
- package/dist/studio/StudioTracer.d.ts +4 -0
- package/dist/studio/StudioTracer.d.ts.map +1 -0
- package/dist/{tower/TowerTracer.js → studio/StudioTracer.js} +21 -21
- package/dist/studio/StudioTracer.js.map +1 -0
- package/dist/studio/index.d.ts +4 -0
- package/dist/studio/index.d.ts.map +1 -0
- package/dist/studio/index.js +4 -0
- package/dist/studio/index.js.map +1 -0
- package/dist/{tower/routes/logs → studio/routes/errors}/route.d.ts +1 -1
- package/dist/{tower/routes/metrics → studio/routes/errors}/route.d.ts.map +1 -1
- package/dist/studio/routes/errors/route.js +42 -0
- package/dist/studio/routes/errors/route.js.map +1 -0
- package/dist/{tower → studio}/routes/fiberDetail.d.ts +1 -1
- package/dist/studio/routes/fiberDetail.d.ts.map +1 -0
- package/dist/{tower → studio}/routes/fiberDetail.js +8 -9
- package/dist/studio/routes/fiberDetail.js.map +1 -0
- package/dist/{tower/routes/traces → studio/routes/fibers}/route.d.ts +1 -1
- package/dist/studio/routes/fibers/route.d.ts.map +1 -0
- package/dist/studio/routes/fibers/route.js +24 -0
- package/dist/studio/routes/fibers/route.js.map +1 -0
- package/dist/studio/routes/layout.d.ts.map +1 -0
- package/{src/tower → dist/studio}/routes/layout.html +1 -1
- package/dist/studio/routes/layout.js.map +1 -0
- package/dist/{tower/routes/errors → studio/routes/logs}/route.d.ts +1 -1
- package/dist/studio/routes/logs/route.d.ts.map +1 -0
- package/dist/studio/routes/logs/route.js +29 -0
- package/dist/studio/routes/logs/route.js.map +1 -0
- package/dist/{tower → studio}/routes/metrics/route.d.ts +1 -1
- package/dist/studio/routes/metrics/route.d.ts.map +1 -0
- package/dist/studio/routes/metrics/route.js +17 -0
- package/dist/studio/routes/metrics/route.js.map +1 -0
- package/dist/{tower → studio}/routes/route.d.ts +2 -2
- package/dist/studio/routes/route.d.ts.map +1 -0
- package/dist/studio/routes/route.js +6 -0
- package/dist/studio/routes/route.js.map +1 -0
- package/dist/{tower → studio}/routes/routes/route.d.ts +1 -1
- package/dist/studio/routes/routes/route.d.ts.map +1 -0
- package/dist/{tower → studio}/routes/routes/route.js +3 -6
- package/dist/studio/routes/routes/route.js.map +1 -0
- package/dist/{tower → studio}/routes/services/route.d.ts +1 -1
- package/dist/studio/routes/services/route.d.ts.map +1 -0
- package/dist/studio/routes/services/route.js +12 -0
- package/dist/studio/routes/services/route.js.map +1 -0
- package/dist/{tower → studio}/routes/system/route.d.ts +1 -1
- package/dist/studio/routes/system/route.d.ts.map +1 -0
- package/dist/studio/routes/system/route.js +18 -0
- package/dist/studio/routes/system/route.js.map +1 -0
- package/dist/{tower → studio}/routes/traceDetail.d.ts +1 -1
- package/dist/studio/routes/traceDetail.d.ts.map +1 -0
- package/dist/studio/routes/traceDetail.js +19 -0
- package/dist/studio/routes/traceDetail.js.map +1 -0
- package/dist/{tower/routes/fibers → studio/routes/traces}/route.d.ts +1 -1
- package/dist/studio/routes/traces/route.d.ts.map +1 -0
- package/dist/studio/routes/traces/route.js +29 -0
- package/dist/studio/routes/traces/route.js.map +1 -0
- package/dist/{tower → studio}/routes/tree.d.ts +47 -47
- package/dist/studio/routes/tree.d.ts.map +1 -0
- package/dist/studio/routes/tree.js.map +1 -0
- package/dist/studio/ui/Errors.d.ts +5 -0
- package/dist/studio/ui/Errors.d.ts.map +1 -0
- package/dist/studio/ui/Errors.js +17 -0
- package/dist/studio/ui/Errors.js.map +1 -0
- package/dist/{tower → studio}/ui/Fibers.d.ts +7 -7
- package/dist/studio/ui/Fibers.d.ts.map +1 -0
- package/dist/studio/ui/Fibers.js +134 -0
- package/dist/studio/ui/Fibers.js.map +1 -0
- package/dist/studio/ui/Logs.d.ts +5 -0
- package/dist/studio/ui/Logs.d.ts.map +1 -0
- package/dist/{tower → studio}/ui/Logs.js +2 -3
- package/dist/studio/ui/Logs.js.map +1 -0
- package/dist/studio/ui/Metrics.d.ts +5 -0
- package/dist/studio/ui/Metrics.d.ts.map +1 -0
- package/dist/{tower → studio}/ui/Metrics.js +4 -11
- package/dist/studio/ui/Metrics.js.map +1 -0
- package/dist/{tower → studio}/ui/Routes.d.ts +1 -1
- package/dist/studio/ui/Routes.d.ts.map +1 -0
- package/dist/{tower → studio}/ui/Routes.js +4 -12
- package/dist/studio/ui/Routes.js.map +1 -0
- package/dist/{tower → studio}/ui/Services.d.ts +1 -1
- package/dist/studio/ui/Services.d.ts.map +1 -0
- package/dist/{tower → studio}/ui/Services.js +2 -9
- package/dist/studio/ui/Services.js.map +1 -0
- package/dist/{tower → studio}/ui/Shell.d.ts +2 -2
- package/dist/studio/ui/Shell.d.ts.map +1 -0
- package/dist/studio/ui/Shell.js +8 -0
- package/dist/studio/ui/Shell.js.map +1 -0
- package/dist/studio/ui/System.d.ts +5 -0
- package/dist/studio/ui/System.d.ts.map +1 -0
- package/dist/studio/ui/System.js +36 -0
- package/dist/studio/ui/System.js.map +1 -0
- package/dist/studio/ui/Traces.d.ts +13 -0
- package/dist/studio/ui/Traces.d.ts.map +1 -0
- package/dist/studio/ui/Traces.js +182 -0
- package/dist/studio/ui/Traces.js.map +1 -0
- package/dist/tailscale/TailscaleTunnel.d.ts +16 -0
- package/dist/tailscale/TailscaleTunnel.d.ts.map +1 -0
- package/dist/{x/tailscale → tailscale}/TailscaleTunnel.js +4 -5
- package/dist/tailscale/TailscaleTunnel.js.map +1 -0
- package/dist/tailscale/index.d.ts.map +1 -0
- package/dist/tailscale/index.js.map +1 -0
- package/dist/{x/tailwind → tailwind}/TailwindPlugin.d.ts +5 -5
- package/dist/tailwind/TailwindPlugin.d.ts.map +1 -0
- package/dist/tailwind/TailwindPlugin.js.map +1 -0
- package/dist/tailwind/compile.d.ts.map +1 -0
- package/dist/{x/tailwind → tailwind}/compile.js +1 -1
- package/dist/tailwind/compile.js.map +1 -0
- package/dist/tailwind/index.d.ts +3 -0
- package/dist/tailwind/index.d.ts.map +1 -0
- package/dist/tailwind/index.js +3 -0
- package/dist/tailwind/index.js.map +1 -0
- package/dist/tailwind/plugin.d.ts.map +1 -0
- package/dist/{x/tailwind → tailwind}/plugin.js +1 -1
- package/dist/{x/tailwind → tailwind}/plugin.js.map +1 -1
- package/dist/testing/TestLogger.js.map +1 -1
- package/dist/testing/utils.d.ts +3 -1
- package/dist/testing/utils.d.ts.map +1 -1
- package/dist/testing/utils.js +39 -0
- package/dist/testing/utils.js.map +1 -1
- package/package.json +53 -71
- package/src/Cookies.ts +4 -8
- package/src/Development.ts +21 -21
- package/src/Entity.ts +24 -19
- package/src/Fetch.ts +101 -5
- package/src/FileRouter.ts +45 -48
- package/src/FileRouterCodegen.ts +9 -23
- package/src/FileSystem.ts +43 -63
- package/src/GlobalLayer.ts +4 -2
- package/src/{hyper/HyperHtml.ts → Html.ts} +90 -30
- package/src/Route.ts +69 -13
- package/src/RouteBody.ts +88 -63
- package/src/RouteHttp.ts +152 -114
- package/src/RouteMount.ts +4 -4
- package/src/RouteSchema.ts +2 -2
- package/src/RouteSse.ts +28 -37
- package/src/RouteTree.ts +2 -2
- package/src/RouteTrie.ts +1 -1
- package/src/Socket.ts +17 -27
- package/src/Start.ts +39 -47
- package/src/System.ts +41 -65
- package/src/{ChildProcess.ts → _ChildProcess.ts} +14 -23
- package/src/{Docker.ts → _Docker.ts} +1 -1
- package/src/{Http.ts → _Http.ts} +0 -28
- package/src/{PathPattern.ts → _PathPattern.ts} +105 -0
- package/src/{SchemaExtra.ts → _SchemaExtra.ts} +3 -4
- package/src/bun/BunChildProcessSpawner.ts +9 -9
- package/src/bun/BunRoute.ts +130 -45
- package/src/bun/BunServer.ts +4 -3
- package/src/bundler/BundleRoute.ts +2 -2
- package/src/cli/Argument.ts +45 -0
- package/src/cli/CliError.ts +68 -0
- package/src/cli/Command.ts +685 -0
- package/src/cli/Flag.ts +63 -0
- package/src/cli/HelpDoc.ts +67 -0
- package/src/cli/Param.ts +418 -0
- package/src/cli/Primitive.ts +94 -0
- package/src/cli/index.ts +7 -0
- package/src/{x/cloudflare → cloudflare}/CloudflareTunnel.ts +1 -1
- package/src/datastar/watchers/patchElements.ts +4 -2
- package/src/index.ts +2 -0
- package/src/jsx-runtime.ts +15 -0
- package/src/{hyper/jsx.d.ts → jsx.d.ts} +3 -3
- package/src/lint/plugin.js +86 -97
- package/src/node/NodeFileSystem.ts +15 -14
- package/src/sql/SqlCache.ts +14 -1
- package/src/sql/SqlClient.ts +1 -1
- package/src/{SqlIntrospect.ts → sql/SqlIntrospect.ts} +1 -1
- package/src/sql/bun/index.ts +1 -1
- package/src/sql/index.ts +1 -0
- package/src/sql/libsql/index.ts +1 -1
- package/src/sql/mssql/index.ts +1 -1
- package/src/studio/Studio.ts +47 -0
- package/src/{tower/TowerErrors.ts → studio/StudioErrors.ts} +13 -13
- package/src/{tower/TowerLogger.ts → studio/StudioLogger.ts} +10 -10
- package/src/{tower/TowerMetrics.ts → studio/StudioMetrics.ts} +5 -5
- package/src/{tower/TowerProcess.ts → studio/StudioProcess.ts} +4 -4
- package/src/{tower/TowerStore.ts → studio/StudioStore.ts} +37 -37
- package/src/{tower/TowerTracer.ts → studio/StudioTracer.ts} +25 -25
- package/src/studio/index.ts +3 -0
- package/src/{tower → studio}/routes/errors/route.tsx +7 -8
- package/src/{tower → studio}/routes/fiberDetail.tsx +9 -10
- package/src/{tower → studio}/routes/fibers/route.tsx +13 -14
- package/src/studio/routes/layout.html +340 -0
- package/src/{tower → studio}/routes/logs/route.tsx +7 -8
- package/src/{tower → studio}/routes/metrics/route.tsx +8 -9
- package/src/studio/routes/route.tsx +8 -0
- package/src/{tower → studio}/routes/routes/route.tsx +3 -4
- package/src/{tower → studio}/routes/services/route.tsx +3 -4
- package/src/{tower → studio}/routes/system/route.tsx +8 -9
- package/src/{tower → studio}/routes/traceDetail.tsx +6 -7
- package/src/{tower → studio}/routes/traces/route.tsx +8 -9
- package/src/{tower → studio}/ui/Errors.tsx +3 -3
- package/src/{tower → studio}/ui/Fibers.tsx +7 -7
- package/src/{tower → studio}/ui/Logs.tsx +3 -3
- package/src/{tower → studio}/ui/Metrics.tsx +4 -4
- package/src/{tower → studio}/ui/Shell.tsx +1 -1
- package/src/{tower → studio}/ui/System.tsx +2 -2
- package/src/{tower → studio}/ui/Traces.tsx +16 -16
- package/src/{x/tailscale → tailscale}/TailscaleTunnel.ts +4 -5
- package/src/{x/tailwind → tailwind}/compile.ts +1 -1
- package/src/tailwind/index.ts +2 -0
- package/src/{x/tailwind → tailwind}/plugin.ts +1 -1
- package/src/testing/utils.ts +59 -0
- package/dist/ChildProcess.d.ts.map +0 -1
- package/dist/ChildProcess.js.map +0 -1
- package/dist/Commander.d.ts +0 -101
- package/dist/Commander.d.ts.map +0 -1
- package/dist/Commander.js +0 -327
- package/dist/Commander.js.map +0 -1
- package/dist/ContentNegotiation.d.ts.map +0 -1
- package/dist/ContentNegotiation.js.map +0 -1
- package/dist/Docker.d.ts.map +0 -1
- package/dist/Docker.js.map +0 -1
- package/dist/Effectify.d.ts.map +0 -1
- package/dist/Effectify.js.map +0 -1
- package/dist/FilePathPattern.d.ts +0 -30
- package/dist/FilePathPattern.d.ts.map +0 -1
- package/dist/FilePathPattern.js +0 -87
- package/dist/FilePathPattern.js.map +0 -1
- package/dist/Http.d.ts.map +0 -1
- package/dist/Http.js.map +0 -1
- package/dist/PathPattern.d.ts.map +0 -1
- package/dist/PathPattern.js.map +0 -1
- package/dist/PlatformError.d.ts +0 -39
- package/dist/PlatformError.d.ts.map +0 -1
- package/dist/PlatformError.js +0 -26
- package/dist/PlatformError.js.map +0 -1
- package/dist/SchemaExtra.d.ts +0 -8
- package/dist/SchemaExtra.d.ts.map +0 -1
- package/dist/SchemaExtra.js.map +0 -1
- package/dist/SqlIntrospect.d.ts.map +0 -1
- package/dist/SqlIntrospect.js.map +0 -1
- package/dist/StartApp.d.ts.map +0 -1
- package/dist/StartApp.js.map +0 -1
- package/dist/StreamExtra.d.ts.map +0 -1
- package/dist/StreamExtra.js.map +0 -1
- package/dist/TuplePathPattern.d.ts +0 -10
- package/dist/TuplePathPattern.d.ts.map +0 -1
- package/dist/TuplePathPattern.js +0 -69
- package/dist/TuplePathPattern.js.map +0 -1
- package/dist/Values.d.ts.map +0 -1
- package/dist/Values.js.map +0 -1
- package/dist/hyper/Hyper.d.ts +0 -26
- package/dist/hyper/Hyper.d.ts.map +0 -1
- package/dist/hyper/Hyper.js +0 -24
- package/dist/hyper/Hyper.js.map +0 -1
- package/dist/hyper/HyperHtml.d.ts +0 -24
- package/dist/hyper/HyperHtml.d.ts.map +0 -1
- package/dist/hyper/HyperHtml.js.map +0 -1
- package/dist/hyper/HyperHtml.test.d.ts +0 -2
- package/dist/hyper/HyperHtml.test.d.ts.map +0 -1
- package/dist/hyper/HyperHtml.test.js +0 -283
- package/dist/hyper/HyperHtml.test.js.map +0 -1
- package/dist/hyper/HyperNode.d.ts +0 -15
- package/dist/hyper/HyperNode.d.ts.map +0 -1
- package/dist/hyper/HyperNode.js +0 -12
- package/dist/hyper/HyperNode.js.map +0 -1
- package/dist/hyper/HyperRoute.d.ts +0 -9
- package/dist/hyper/HyperRoute.d.ts.map +0 -1
- package/dist/hyper/HyperRoute.js +0 -33
- package/dist/hyper/HyperRoute.js.map +0 -1
- package/dist/hyper/HyperRoute.test.d.ts +0 -2
- package/dist/hyper/HyperRoute.test.d.ts.map +0 -1
- package/dist/hyper/HyperRoute.test.js +0 -86
- package/dist/hyper/HyperRoute.test.js.map +0 -1
- package/dist/hyper/html.d.ts +0 -11
- package/dist/hyper/html.d.ts.map +0 -1
- package/dist/hyper/html.js +0 -31
- package/dist/hyper/html.js.map +0 -1
- package/dist/hyper/index.d.ts +0 -7
- package/dist/hyper/index.d.ts.map +0 -1
- package/dist/hyper/index.js +0 -6
- package/dist/hyper/index.js.map +0 -1
- package/dist/hyper/jsx-runtime.d.ts +0 -8
- package/dist/hyper/jsx-runtime.d.ts.map +0 -1
- package/dist/hyper/jsx-runtime.js.map +0 -1
- package/dist/tower/Simulation.d.ts.map +0 -1
- package/dist/tower/Simulation.js.map +0 -1
- package/dist/tower/Tower.d.ts.map +0 -1
- package/dist/tower/Tower.js +0 -30
- package/dist/tower/Tower.js.map +0 -1
- package/dist/tower/TowerErrors.d.ts +0 -4
- package/dist/tower/TowerErrors.d.ts.map +0 -1
- package/dist/tower/TowerErrors.js.map +0 -1
- package/dist/tower/TowerLogger.d.ts.map +0 -1
- package/dist/tower/TowerLogger.js.map +0 -1
- package/dist/tower/TowerMetrics.d.ts +0 -4
- package/dist/tower/TowerMetrics.d.ts.map +0 -1
- package/dist/tower/TowerMetrics.js.map +0 -1
- package/dist/tower/TowerProcess.d.ts +0 -4
- package/dist/tower/TowerProcess.d.ts.map +0 -1
- package/dist/tower/TowerProcess.js.map +0 -1
- package/dist/tower/TowerStore.d.ts.map +0 -1
- package/dist/tower/TowerStore.js.map +0 -1
- package/dist/tower/TowerTracer.d.ts +0 -4
- package/dist/tower/TowerTracer.d.ts.map +0 -1
- package/dist/tower/TowerTracer.js.map +0 -1
- package/dist/tower/index.d.ts +0 -4
- package/dist/tower/index.d.ts.map +0 -1
- package/dist/tower/index.js +0 -4
- package/dist/tower/index.js.map +0 -1
- package/dist/tower/routes/errors/route.d.ts.map +0 -1
- package/dist/tower/routes/errors/route.js +0 -47
- package/dist/tower/routes/errors/route.js.map +0 -1
- package/dist/tower/routes/fiberDetail.d.ts.map +0 -1
- package/dist/tower/routes/fiberDetail.js.map +0 -1
- package/dist/tower/routes/fibers/route.d.ts.map +0 -1
- package/dist/tower/routes/fibers/route.js +0 -27
- package/dist/tower/routes/fibers/route.js.map +0 -1
- package/dist/tower/routes/layout.d.ts.map +0 -1
- package/dist/tower/routes/layout.js.map +0 -1
- package/dist/tower/routes/logs/route.d.ts.map +0 -1
- package/dist/tower/routes/logs/route.js +0 -36
- package/dist/tower/routes/logs/route.js.map +0 -1
- package/dist/tower/routes/metrics/route.js +0 -20
- package/dist/tower/routes/metrics/route.js.map +0 -1
- package/dist/tower/routes/route.d.ts.map +0 -1
- package/dist/tower/routes/route.js +0 -6
- package/dist/tower/routes/route.js.map +0 -1
- package/dist/tower/routes/routes/route.d.ts.map +0 -1
- package/dist/tower/routes/routes/route.js.map +0 -1
- package/dist/tower/routes/services/route.d.ts.map +0 -1
- package/dist/tower/routes/services/route.js +0 -15
- package/dist/tower/routes/services/route.js.map +0 -1
- package/dist/tower/routes/system/route.d.ts.map +0 -1
- package/dist/tower/routes/system/route.js +0 -21
- package/dist/tower/routes/system/route.js.map +0 -1
- package/dist/tower/routes/traceDetail.d.ts.map +0 -1
- package/dist/tower/routes/traceDetail.js +0 -20
- package/dist/tower/routes/traceDetail.js.map +0 -1
- package/dist/tower/routes/traces/route.d.ts.map +0 -1
- package/dist/tower/routes/traces/route.js +0 -36
- package/dist/tower/routes/traces/route.js.map +0 -1
- package/dist/tower/routes/tree.d.ts.map +0 -1
- package/dist/tower/routes/tree.js.map +0 -1
- package/dist/tower/ui/Errors.d.ts +0 -5
- package/dist/tower/ui/Errors.d.ts.map +0 -1
- package/dist/tower/ui/Errors.js +0 -30
- package/dist/tower/ui/Errors.js.map +0 -1
- package/dist/tower/ui/Fibers.d.ts.map +0 -1
- package/dist/tower/ui/Fibers.js +0 -157
- package/dist/tower/ui/Fibers.js.map +0 -1
- package/dist/tower/ui/Logs.d.ts +0 -5
- package/dist/tower/ui/Logs.d.ts.map +0 -1
- package/dist/tower/ui/Logs.js.map +0 -1
- package/dist/tower/ui/Metrics.d.ts +0 -5
- package/dist/tower/ui/Metrics.d.ts.map +0 -1
- package/dist/tower/ui/Metrics.js.map +0 -1
- package/dist/tower/ui/Routes.d.ts.map +0 -1
- package/dist/tower/ui/Routes.js.map +0 -1
- package/dist/tower/ui/Services.d.ts.map +0 -1
- package/dist/tower/ui/Services.js.map +0 -1
- package/dist/tower/ui/Shell.d.ts.map +0 -1
- package/dist/tower/ui/Shell.js +0 -12
- package/dist/tower/ui/Shell.js.map +0 -1
- package/dist/tower/ui/System.d.ts +0 -5
- package/dist/tower/ui/System.d.ts.map +0 -1
- package/dist/tower/ui/System.js +0 -65
- package/dist/tower/ui/System.js.map +0 -1
- package/dist/tower/ui/Traces.d.ts +0 -13
- package/dist/tower/ui/Traces.d.ts.map +0 -1
- package/dist/tower/ui/Traces.js +0 -219
- package/dist/tower/ui/Traces.js.map +0 -1
- package/dist/x/cloudflare/CloudflareTunnel.d.ts +0 -11
- package/dist/x/cloudflare/CloudflareTunnel.d.ts.map +0 -1
- package/dist/x/cloudflare/CloudflareTunnel.js.map +0 -1
- package/dist/x/cloudflare/index.d.ts.map +0 -1
- package/dist/x/cloudflare/index.js.map +0 -1
- package/dist/x/tailscale/TailscaleTunnel.d.ts +0 -16
- package/dist/x/tailscale/TailscaleTunnel.d.ts.map +0 -1
- package/dist/x/tailscale/TailscaleTunnel.js.map +0 -1
- package/dist/x/tailscale/index.d.ts.map +0 -1
- package/dist/x/tailscale/index.js.map +0 -1
- package/dist/x/tailwind/TailwindPlugin.d.ts.map +0 -1
- package/dist/x/tailwind/TailwindPlugin.js.map +0 -1
- package/dist/x/tailwind/compile.d.ts.map +0 -1
- package/dist/x/tailwind/compile.js.map +0 -1
- package/dist/x/tailwind/plugin.d.ts.map +0 -1
- package/src/Commander.ts +0 -585
- package/src/FilePathPattern.ts +0 -115
- package/src/PlatformError.ts +0 -73
- package/src/TuplePathPattern.ts +0 -75
- package/src/hyper/Hyper.ts +0 -55
- package/src/hyper/HyperNode.ts +0 -34
- package/src/hyper/HyperRoute.ts +0 -59
- package/src/hyper/html.ts +0 -47
- package/src/hyper/index.ts +0 -6
- package/src/hyper/jsx-runtime.ts +0 -15
- package/src/tower/Tower.ts +0 -47
- package/src/tower/index.ts +0 -3
- package/src/tower/routes/route.tsx +0 -8
- /package/dist/{x/cloudflare → cloudflare}/index.d.ts +0 -0
- /package/dist/{x/cloudflare → cloudflare}/index.js +0 -0
- /package/dist/{tower → studio}/Simulation.d.ts +0 -0
- /package/dist/{tower → studio}/Simulation.js +0 -0
- /package/dist/{tower → studio}/routes/layout.d.ts +0 -0
- /package/dist/{tower → studio}/routes/layout.js +0 -0
- /package/dist/{tower → studio}/routes/tree.js +0 -0
- /package/dist/{x/tailscale → tailscale}/index.d.ts +0 -0
- /package/dist/{x/tailscale → tailscale}/index.js +0 -0
- /package/dist/{x/tailwind → tailwind}/TailwindPlugin.js +0 -0
- /package/dist/{x/tailwind → tailwind}/compile.d.ts +0 -0
- /package/dist/{x/tailwind → tailwind}/plugin.d.ts +0 -0
- /package/src/{ContentNegotiation.ts → _ContentNegotiation.ts} +0 -0
- /package/src/{Effectify.ts → _Effectify.ts} +0 -0
- /package/src/{StartApp.ts → _StartApp.ts} +0 -0
- /package/src/{StreamExtra.ts → _StreamExtra.ts} +0 -0
- /package/src/{Values.ts → _Values.ts} +0 -0
- /package/src/{x/cloudflare → cloudflare}/index.ts +0 -0
- /package/src/{tower → studio}/Simulation.ts +0 -0
- /package/src/{tower → studio}/routes/layout.tsx +0 -0
- /package/src/{tower → studio}/routes/tree.ts +0 -0
- /package/src/{tower → studio}/ui/Routes.tsx +0 -0
- /package/src/{tower → studio}/ui/Services.tsx +0 -0
- /package/src/{x/tailscale → tailscale}/index.ts +0 -0
- /package/src/{x/tailwind → tailwind}/TailwindPlugin.ts +0 -0
package/src/Fetch.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as Data from "effect/Data"
|
|
2
2
|
import * as Effect from "effect/Effect"
|
|
3
3
|
import * as Schedule from "effect/Schedule"
|
|
4
|
+
import * as Stream from "effect/Stream"
|
|
4
5
|
import * as Entity from "./Entity.ts"
|
|
5
6
|
|
|
6
|
-
const TypeId
|
|
7
|
-
type TypeId = typeof TypeId
|
|
7
|
+
const TypeId = "~effect-start/FetchClient" as const
|
|
8
8
|
|
|
9
|
-
export type FetchEntity = Entity.Entity<
|
|
9
|
+
export type FetchEntity = Entity.Entity<Stream.Stream<Uint8Array, FetchError, never>, FetchError>
|
|
10
10
|
|
|
11
11
|
export class FetchError extends Data.TaggedError("FetchError")<{
|
|
12
12
|
readonly reason: "Network" | "Status"
|
|
@@ -28,7 +28,7 @@ const tryFetch: Middleware = (request) =>
|
|
|
28
28
|
try: () => globalThis.fetch(request),
|
|
29
29
|
catch: (e) => new FetchError({ reason: "Network", cause: e, request }),
|
|
30
30
|
}),
|
|
31
|
-
(response) => Entity.fromResponse(response, request)
|
|
31
|
+
(response) => Entity.fromResponse<FetchError>(response, request),
|
|
32
32
|
)
|
|
33
33
|
|
|
34
34
|
const defaultMiddleware: ReadonlyArray<Middleware> = [tryFetch]
|
|
@@ -64,7 +64,7 @@ function withTrace<E, R>(
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
export interface FetchClient<E = never, R = never> {
|
|
67
|
-
readonly [TypeId]: TypeId
|
|
67
|
+
readonly [TypeId]: typeof TypeId
|
|
68
68
|
readonly middleware: ReadonlyArray<Middleware<any, any>>
|
|
69
69
|
readonly fetch: (
|
|
70
70
|
input: string | URL | Request,
|
|
@@ -172,6 +172,20 @@ const ClientProto: any = {
|
|
|
172
172
|
use,
|
|
173
173
|
}
|
|
174
174
|
|
|
175
|
+
type WebHandler = (request: Request) => Response | Promise<Response>
|
|
176
|
+
|
|
177
|
+
export function fromHandler(handler: WebHandler): FetchClient {
|
|
178
|
+
const transport: Middleware = (request) =>
|
|
179
|
+
Effect.map(
|
|
180
|
+
Effect.tryPromise({
|
|
181
|
+
try: () => Promise.resolve(handler(request)),
|
|
182
|
+
catch: (e) => new FetchError({ reason: "Network", cause: e, request }),
|
|
183
|
+
}),
|
|
184
|
+
(response) => Entity.fromResponse<FetchError>(response, request),
|
|
185
|
+
)
|
|
186
|
+
return use(transport)
|
|
187
|
+
}
|
|
188
|
+
|
|
175
189
|
export function filterStatus(
|
|
176
190
|
predicate: (status: number) => boolean,
|
|
177
191
|
options?: {
|
|
@@ -269,3 +283,85 @@ export function retry(options: {
|
|
|
269
283
|
)
|
|
270
284
|
}) as Middleware
|
|
271
285
|
}
|
|
286
|
+
|
|
287
|
+
interface SseEvent {
|
|
288
|
+
data?: string | undefined
|
|
289
|
+
type?: string
|
|
290
|
+
retry?: number
|
|
291
|
+
id?: string
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
export function sse(_options?: {
|
|
295
|
+
readonly retry?: Schedule.Schedule<any, any, any>
|
|
296
|
+
}): (entity: FetchEntity) => Stream.Stream<SseEvent, FetchError> {
|
|
297
|
+
return (entity) => {
|
|
298
|
+
const contentType = entity.headers["content-type"] ?? ""
|
|
299
|
+
if (!contentType.includes("text/event-stream")) {
|
|
300
|
+
return Stream.fail(
|
|
301
|
+
new FetchError({
|
|
302
|
+
reason: "Status",
|
|
303
|
+
cause: new Error(`Expected content-type text/event-stream, got: ${contentType}`),
|
|
304
|
+
response: entity,
|
|
305
|
+
}),
|
|
306
|
+
)
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
const byteStream = entity.body as Stream.Stream<Uint8Array, FetchError, never>
|
|
310
|
+
const decoder = new TextDecoder()
|
|
311
|
+
const empty = {
|
|
312
|
+
partial: "",
|
|
313
|
+
eventType: undefined as string | undefined,
|
|
314
|
+
dataLines: [] as Array<string>,
|
|
315
|
+
retryMs: undefined as number | undefined,
|
|
316
|
+
lastEventId: undefined as string | undefined,
|
|
317
|
+
}
|
|
318
|
+
type Acc = typeof empty
|
|
319
|
+
|
|
320
|
+
return byteStream.pipe(
|
|
321
|
+
Stream.mapAccum(empty, (acc, chunk: Uint8Array): [Acc, Array<string>] => {
|
|
322
|
+
const text = acc.partial + decoder.decode(chunk, { stream: true })
|
|
323
|
+
const parts = text.split("\n")
|
|
324
|
+
const partial = parts.pop()!
|
|
325
|
+
const lines = parts.map((l) => (l.endsWith("\r") ? l.slice(0, -1) : l))
|
|
326
|
+
return [{ ...acc, partial }, lines]
|
|
327
|
+
}),
|
|
328
|
+
Stream.flatMap(Stream.fromIterable),
|
|
329
|
+
Stream.mapAccum(empty, (acc, line: string): [Acc, SseEvent | undefined] => {
|
|
330
|
+
if (line === "") {
|
|
331
|
+
if (acc.dataLines.length > 0) {
|
|
332
|
+
const event: SseEvent = { data: acc.dataLines.join("\n") }
|
|
333
|
+
if (acc.eventType !== undefined) event.type = acc.eventType
|
|
334
|
+
if (acc.retryMs !== undefined) event.retry = acc.retryMs
|
|
335
|
+
if (acc.lastEventId !== undefined) event.id = acc.lastEventId
|
|
336
|
+
return [{ ...empty, lastEventId: acc.lastEventId }, event]
|
|
337
|
+
}
|
|
338
|
+
return [{ ...empty, lastEventId: acc.lastEventId }, undefined]
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
if (line.startsWith(":")) return [acc, undefined]
|
|
342
|
+
|
|
343
|
+
const colonIdx = line.indexOf(":")
|
|
344
|
+
const field = colonIdx === -1 ? line : line.slice(0, colonIdx)
|
|
345
|
+
let value = colonIdx === -1 ? "" : line.slice(colonIdx + 1)
|
|
346
|
+
if (value.startsWith(" ")) value = value.slice(1)
|
|
347
|
+
|
|
348
|
+
switch (field) {
|
|
349
|
+
case "event":
|
|
350
|
+
return [{ ...acc, eventType: value }, undefined]
|
|
351
|
+
case "data":
|
|
352
|
+
return [{ ...acc, dataLines: [...acc.dataLines, value] }, undefined]
|
|
353
|
+
case "retry": {
|
|
354
|
+
const n = parseInt(value, 10)
|
|
355
|
+
if (!isNaN(n)) return [{ ...acc, retryMs: n }, undefined]
|
|
356
|
+
return [acc, undefined]
|
|
357
|
+
}
|
|
358
|
+
case "id":
|
|
359
|
+
return [{ ...acc, lastEventId: value }, undefined]
|
|
360
|
+
default:
|
|
361
|
+
return [acc, undefined]
|
|
362
|
+
}
|
|
363
|
+
}),
|
|
364
|
+
Stream.filter((event): event is SseEvent => event !== undefined),
|
|
365
|
+
)
|
|
366
|
+
}
|
|
367
|
+
}
|
package/src/FileRouter.ts
CHANGED
|
@@ -8,11 +8,10 @@ import * as Stream from "effect/Stream"
|
|
|
8
8
|
import * as NPath from "node:path"
|
|
9
9
|
import * as NUrl from "node:url"
|
|
10
10
|
import * as Development from "./Development.ts"
|
|
11
|
-
import * as FilePathPattern from "./FilePathPattern.ts"
|
|
12
11
|
import * as FileRouterCodegen from "./FileRouterCodegen.ts"
|
|
13
12
|
import * as NodeUtils from "./node/NodeUtils.ts"
|
|
14
|
-
import
|
|
15
|
-
import type * as
|
|
13
|
+
import * as PathPattern from "./_PathPattern.ts"
|
|
14
|
+
import type * as System from "./System.ts"
|
|
16
15
|
import * as Route from "./Route.ts"
|
|
17
16
|
import * as RouteTree from "./RouteTree.ts"
|
|
18
17
|
|
|
@@ -32,15 +31,12 @@ export type FileRoutes = {
|
|
|
32
31
|
[path: PathPattern.PathPattern]: [LazyRouteModule, ...LazyRouteModule[]]
|
|
33
32
|
}
|
|
34
33
|
|
|
35
|
-
export type Segment = FilePathPattern.Segment
|
|
36
|
-
|
|
37
34
|
export type FileRoute = {
|
|
38
35
|
handle: "route" | "layer"
|
|
39
36
|
// eg. `/about/route.tsx`, `/users/[userId]/route.tsx`, `/(admin)/users/route.tsx`
|
|
40
37
|
modulePath: `/${string}`
|
|
41
|
-
// eg. `/about`, `/users
|
|
42
|
-
routePath:
|
|
43
|
-
segments: Array<Segment>
|
|
38
|
+
// eg. `/about`, `/users/:userId`, `/users` (groups stripped)
|
|
39
|
+
routePath: PathPattern.PathPattern
|
|
44
40
|
}
|
|
45
41
|
|
|
46
42
|
/**
|
|
@@ -52,40 +48,26 @@ export type FileRoute = {
|
|
|
52
48
|
*/
|
|
53
49
|
export type OrderedFileRoutes = Array<FileRoute>
|
|
54
50
|
|
|
55
|
-
const ROUTE_PATH_REGEX =
|
|
51
|
+
const ROUTE_PATH_REGEX = /^(.*\/)?(route|layer)\.(jsx?|tsx?)$/
|
|
56
52
|
|
|
57
53
|
export function parseRoute(path: string): FileRoute | null {
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
const handleMatch =
|
|
62
|
-
lastSeg?._tag === "LiteralSegment" && lastSeg.value.match(/^(route|layer)\.(tsx?|jsx?)$/)
|
|
63
|
-
const handle = handleMatch ? (handleMatch[1] as "route" | "layer") : null
|
|
64
|
-
|
|
65
|
-
if (!handle) {
|
|
66
|
-
return null
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
const pathSegments = segs.slice(0, -1)
|
|
70
|
-
|
|
71
|
-
const validated = FilePathPattern.validate(FilePathPattern.format(pathSegments))
|
|
72
|
-
if (Either.isLeft(validated)) {
|
|
54
|
+
const normalizedPath = path.replace(/^\/+/, "")
|
|
55
|
+
const matched = normalizedPath.match(ROUTE_PATH_REGEX)
|
|
56
|
+
if (!matched) {
|
|
73
57
|
return null
|
|
74
58
|
}
|
|
75
59
|
|
|
76
|
-
const
|
|
77
|
-
|
|
60
|
+
const routeDir = matched[1]?.replace(/\/$/, "") ?? ""
|
|
61
|
+
const handle = matched[2] as "route" | "layer"
|
|
62
|
+
const routePathResult = PathPattern.fromFilePath(routeDir)
|
|
63
|
+
if (Either.isLeft(routePathResult)) {
|
|
78
64
|
return null
|
|
79
65
|
}
|
|
80
66
|
|
|
81
|
-
const routePathSegments = pathSegments.filter((seg) => seg._tag !== "GroupSegment")
|
|
82
|
-
const routePath = FilePathPattern.format(routePathSegments)
|
|
83
|
-
|
|
84
67
|
return {
|
|
85
68
|
handle,
|
|
86
|
-
modulePath: `/${
|
|
87
|
-
routePath,
|
|
88
|
-
segments: pathSegments,
|
|
69
|
+
modulePath: `/${normalizedPath}`,
|
|
70
|
+
routePath: routePathResult.right,
|
|
89
71
|
}
|
|
90
72
|
}
|
|
91
73
|
|
|
@@ -123,7 +105,7 @@ export function layer(
|
|
|
123
105
|
treePath = NUrl.fileURLToPath(treePath)
|
|
124
106
|
}
|
|
125
107
|
if (NPath.extname(treePath) === "") {
|
|
126
|
-
treePath = NPath.join(treePath, "server.
|
|
108
|
+
treePath = NPath.join(treePath, ".server.ts")
|
|
127
109
|
}
|
|
128
110
|
|
|
129
111
|
const routesPath = NPath.dirname(treePath)
|
|
@@ -142,7 +124,7 @@ export function layer(
|
|
|
142
124
|
|
|
143
125
|
// Watch for changes (only when Development service is available)
|
|
144
126
|
yield* Function.pipe(
|
|
145
|
-
Development.
|
|
127
|
+
Development.events,
|
|
146
128
|
Stream.filter((e) => e._tag !== "Reload" && e.path.startsWith(relativeRoutesPath)),
|
|
147
129
|
Stream.runForEach(() => FileRouterCodegen.update(routesPath, treeFilename)),
|
|
148
130
|
Effect.fork,
|
|
@@ -158,15 +140,30 @@ export function fromFileRoutes(fileRoutes: FileRoutes): Effect.Effect<RouteTree.
|
|
|
158
140
|
const mounts: RouteTree.InputRouteMap = {}
|
|
159
141
|
|
|
160
142
|
for (const [path, loaders] of Object.entries(fileRoutes)) {
|
|
161
|
-
const modules = yield* Effect.forEach(loaders, (loader) => Effect.promise(() => loader()))
|
|
162
|
-
|
|
163
143
|
const allRoutes: RouteTree.RouteTuple = [] as unknown as RouteTree.RouteTuple
|
|
164
144
|
|
|
165
|
-
for (const
|
|
166
|
-
|
|
167
|
-
|
|
145
|
+
for (const loader of loaders) {
|
|
146
|
+
const result = yield* Effect.either(
|
|
147
|
+
Effect.tryPromise({
|
|
148
|
+
try: () => loader(),
|
|
149
|
+
catch: (cause) => new FileRouterError({ reason: "Import", cause, path }),
|
|
150
|
+
}),
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
if (Either.isLeft(result)) {
|
|
154
|
+
const error = result.left
|
|
155
|
+
for (const route of Route.use(
|
|
156
|
+
Route.render((): Effect.Effect<string, FileRouterError> => Effect.fail(error)),
|
|
157
|
+
)) {
|
|
168
158
|
;(allRoutes as Array<any>).push(route)
|
|
169
159
|
}
|
|
160
|
+
} else {
|
|
161
|
+
const m = result.right
|
|
162
|
+
if (Route.isRouteSet(m.default)) {
|
|
163
|
+
for (const route of m.default) {
|
|
164
|
+
;(allRoutes as Array<any>).push(route)
|
|
165
|
+
}
|
|
166
|
+
}
|
|
170
167
|
}
|
|
171
168
|
}
|
|
172
169
|
|
|
@@ -179,11 +176,7 @@ export function fromFileRoutes(fileRoutes: FileRoutes): Effect.Effect<RouteTree.
|
|
|
179
176
|
|
|
180
177
|
export function walkRoutesDirectory(
|
|
181
178
|
dir: string,
|
|
182
|
-
): Effect.Effect<
|
|
183
|
-
OrderedFileRoutes,
|
|
184
|
-
PlatformError.PlatformError | FileRouterError,
|
|
185
|
-
FileSystem.FileSystem
|
|
186
|
-
> {
|
|
179
|
+
): Effect.Effect<OrderedFileRoutes, System.SystemError | FileRouterError, FileSystem.FileSystem> {
|
|
187
180
|
return Effect.gen(function* () {
|
|
188
181
|
const fs = yield* FileSystem.FileSystem
|
|
189
182
|
const files = yield* fs.readDirectory(dir, { recursive: true })
|
|
@@ -209,10 +202,14 @@ export function getFileRoutes(
|
|
|
209
202
|
})
|
|
210
203
|
.filter((route): route is FileRoute => route !== null)
|
|
211
204
|
.toSorted((a, b) => {
|
|
212
|
-
const aDepth = a.
|
|
213
|
-
const bDepth = b.
|
|
214
|
-
const aHasRest = a.
|
|
215
|
-
|
|
205
|
+
const aDepth = a.modulePath.split("/").filter(Boolean).length - 1
|
|
206
|
+
const bDepth = b.modulePath.split("/").filter(Boolean).length - 1
|
|
207
|
+
const aHasRest = a.routePath
|
|
208
|
+
.split("/")
|
|
209
|
+
.some((seg) => seg.startsWith(":") && seg.endsWith("*"))
|
|
210
|
+
const bHasRest = b.routePath
|
|
211
|
+
.split("/")
|
|
212
|
+
.some((seg) => seg.startsWith(":") && seg.endsWith("*"))
|
|
216
213
|
|
|
217
214
|
return (
|
|
218
215
|
// rest is a dominant factor (routes with rest come last)
|
package/src/FileRouterCodegen.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import * as FileSystem from "./FileSystem.ts"
|
|
2
2
|
import * as Effect from "effect/Effect"
|
|
3
|
-
import * as Either from "effect/Either"
|
|
4
3
|
import * as Schema from "effect/Schema"
|
|
5
4
|
import * as NPath from "node:path"
|
|
6
|
-
import * as FilePathPattern from "./FilePathPattern.ts"
|
|
7
5
|
import * as FileRouter from "./FileRouter.ts"
|
|
8
|
-
import * as
|
|
6
|
+
import * as PathPattern from "./_PathPattern.ts"
|
|
7
|
+
import * as SchemaExtra from "./_SchemaExtra.ts"
|
|
9
8
|
|
|
10
9
|
export function validateRouteModule(module: unknown): module is FileRouter.RouteModule {
|
|
11
10
|
if (typeof module !== "object" || module === null) {
|
|
@@ -20,17 +19,11 @@ export function validateRouteModule(module: unknown): module is FileRouter.Route
|
|
|
20
19
|
return true
|
|
21
20
|
}
|
|
22
21
|
|
|
23
|
-
export function generatePathParamsSchema(
|
|
24
|
-
segments: ReadonlyArray<FilePathPattern.Segment>,
|
|
25
|
-
): Schema.Struct<any> | null {
|
|
22
|
+
export function generatePathParamsSchema(path: PathPattern.PathPattern): Schema.Struct<any> | null {
|
|
26
23
|
const fields: Record<PropertyKey, Schema.Schema.Any | Schema.PropertySignature.All> = {}
|
|
27
24
|
|
|
28
|
-
for (const
|
|
29
|
-
|
|
30
|
-
fields[segment.name] = Schema.String
|
|
31
|
-
} else if (segment._tag === "RestSegment") {
|
|
32
|
-
fields[segment.name] = Schema.optional(Schema.String)
|
|
33
|
-
}
|
|
25
|
+
for (const param of PathPattern.params(path)) {
|
|
26
|
+
fields[param.name] = param.optional ? Schema.optional(Schema.String) : Schema.String
|
|
34
27
|
}
|
|
35
28
|
|
|
36
29
|
if (Object.keys(fields).length === 0) {
|
|
@@ -54,7 +47,7 @@ export function validateRouteModules(
|
|
|
54
47
|
|
|
55
48
|
for (const handle of routeHandles) {
|
|
56
49
|
const routeModulePath = NPath.resolve(path, handle.modulePath)
|
|
57
|
-
const expectedSchema = generatePathParamsSchema(handle.
|
|
50
|
+
const expectedSchema = generatePathParamsSchema(handle.routePath)
|
|
58
51
|
|
|
59
52
|
const fileExists = yield* fs
|
|
60
53
|
.exists(routeModulePath)
|
|
@@ -144,20 +137,13 @@ export function generateCode(fileRoutes: FileRouter.OrderedFileRoutes): string |
|
|
|
144
137
|
currentPath = parentPath || "/"
|
|
145
138
|
}
|
|
146
139
|
|
|
147
|
-
// Convert file-style path to colon-style PathPattern
|
|
148
|
-
const pathPatternResult = FilePathPattern.toPathPattern(path)
|
|
149
|
-
if (Either.isLeft(pathPatternResult)) {
|
|
150
|
-
continue
|
|
151
|
-
}
|
|
152
|
-
const pathPattern = pathPatternResult.right
|
|
153
|
-
|
|
154
140
|
// Order: route first, then layers from innermost to outermost
|
|
155
141
|
const loaders: Array<string> = [
|
|
156
142
|
`() => import(".${route.modulePath}")`,
|
|
157
143
|
...allLayers.reverse().map((layer) => `() => import(".${layer.modulePath}")`),
|
|
158
144
|
]
|
|
159
145
|
|
|
160
|
-
entries.push({ path
|
|
146
|
+
entries.push({ path, loaders })
|
|
161
147
|
}
|
|
162
148
|
|
|
163
149
|
// No routes found - don't create file
|
|
@@ -188,7 +174,7 @@ ${routeEntries},
|
|
|
188
174
|
*/
|
|
189
175
|
export function update(
|
|
190
176
|
routesPath: string,
|
|
191
|
-
treePath = "server.
|
|
177
|
+
treePath = ".server.ts",
|
|
192
178
|
): Effect.Effect<void, FileRouter.FileRouterError, FileSystem.FileSystem> {
|
|
193
179
|
return Effect.gen(function* () {
|
|
194
180
|
treePath = NPath.resolve(routesPath, treePath)
|
|
@@ -259,7 +245,7 @@ export function update(
|
|
|
259
245
|
|
|
260
246
|
export function dump(
|
|
261
247
|
routesPath: string,
|
|
262
|
-
treePath = "server.
|
|
248
|
+
treePath = ".server.ts",
|
|
263
249
|
): Effect.Effect<void, FileRouter.FileRouterError, FileSystem.FileSystem> {
|
|
264
250
|
return Effect.gen(function* () {
|
|
265
251
|
treePath = NPath.resolve(routesPath, treePath)
|
package/src/FileSystem.ts
CHANGED
|
@@ -12,108 +12,93 @@ import * as Option from "effect/Option"
|
|
|
12
12
|
import * as Sink from "effect/Sink"
|
|
13
13
|
import type * as Scope from "effect/Scope"
|
|
14
14
|
import * as Stream from "effect/Stream"
|
|
15
|
-
import * as
|
|
15
|
+
import * as System from "./System.ts"
|
|
16
16
|
|
|
17
17
|
export interface FileSystem {
|
|
18
18
|
readonly access: (
|
|
19
19
|
path: string,
|
|
20
20
|
options?: AccessFileOptions,
|
|
21
|
-
) => Effect.Effect<void,
|
|
21
|
+
) => Effect.Effect<void, System.SystemError>
|
|
22
22
|
readonly copy: (
|
|
23
23
|
fromPath: string,
|
|
24
24
|
toPath: string,
|
|
25
25
|
options?: CopyOptions,
|
|
26
|
-
) => Effect.Effect<void,
|
|
27
|
-
readonly copyFile: (
|
|
28
|
-
|
|
29
|
-
toPath: string,
|
|
30
|
-
) => Effect.Effect<void, PlatformError.PlatformError>
|
|
31
|
-
readonly chmod: (path: string, mode: number) => Effect.Effect<void, PlatformError.PlatformError>
|
|
26
|
+
) => Effect.Effect<void, System.SystemError>
|
|
27
|
+
readonly copyFile: (fromPath: string, toPath: string) => Effect.Effect<void, System.SystemError>
|
|
28
|
+
readonly chmod: (path: string, mode: number) => Effect.Effect<void, System.SystemError>
|
|
32
29
|
readonly chown: (
|
|
33
30
|
path: string,
|
|
34
31
|
uid: number,
|
|
35
32
|
gid: number,
|
|
36
|
-
) => Effect.Effect<void,
|
|
37
|
-
readonly exists: (path: string) => Effect.Effect<boolean,
|
|
38
|
-
readonly link: (
|
|
39
|
-
fromPath: string,
|
|
40
|
-
toPath: string,
|
|
41
|
-
) => Effect.Effect<void, PlatformError.PlatformError>
|
|
33
|
+
) => Effect.Effect<void, System.SystemError>
|
|
34
|
+
readonly exists: (path: string) => Effect.Effect<boolean, System.SystemError>
|
|
35
|
+
readonly link: (fromPath: string, toPath: string) => Effect.Effect<void, System.SystemError>
|
|
42
36
|
readonly makeDirectory: (
|
|
43
37
|
path: string,
|
|
44
38
|
options?: MakeDirectoryOptions,
|
|
45
|
-
) => Effect.Effect<void,
|
|
39
|
+
) => Effect.Effect<void, System.SystemError>
|
|
46
40
|
readonly makeTempDirectory: (
|
|
47
41
|
options?: MakeTempDirectoryOptions,
|
|
48
|
-
) => Effect.Effect<string,
|
|
42
|
+
) => Effect.Effect<string, System.SystemError>
|
|
49
43
|
readonly makeTempDirectoryScoped: (
|
|
50
44
|
options?: MakeTempDirectoryOptions,
|
|
51
|
-
) => Effect.Effect<string,
|
|
45
|
+
) => Effect.Effect<string, System.SystemError, Scope.Scope>
|
|
52
46
|
readonly makeTempFile: (
|
|
53
47
|
options?: MakeTempFileOptions,
|
|
54
|
-
) => Effect.Effect<string,
|
|
48
|
+
) => Effect.Effect<string, System.SystemError>
|
|
55
49
|
readonly makeTempFileScoped: (
|
|
56
50
|
options?: MakeTempFileOptions,
|
|
57
|
-
) => Effect.Effect<string,
|
|
51
|
+
) => Effect.Effect<string, System.SystemError, Scope.Scope>
|
|
58
52
|
readonly open: (
|
|
59
53
|
path: string,
|
|
60
54
|
options?: OpenFileOptions,
|
|
61
|
-
) => Effect.Effect<File,
|
|
55
|
+
) => Effect.Effect<File, System.SystemError, Scope.Scope>
|
|
62
56
|
readonly readDirectory: (
|
|
63
57
|
path: string,
|
|
64
58
|
options?: ReadDirectoryOptions,
|
|
65
|
-
) => Effect.Effect<Array<string>,
|
|
66
|
-
readonly readFile: (path: string) => Effect.Effect<Uint8Array,
|
|
59
|
+
) => Effect.Effect<Array<string>, System.SystemError>
|
|
60
|
+
readonly readFile: (path: string) => Effect.Effect<Uint8Array, System.SystemError>
|
|
67
61
|
readonly readFileString: (
|
|
68
62
|
path: string,
|
|
69
63
|
encoding?: string,
|
|
70
|
-
) => Effect.Effect<string,
|
|
71
|
-
readonly readLink: (path: string) => Effect.Effect<string,
|
|
72
|
-
readonly realPath: (path: string) => Effect.Effect<string,
|
|
64
|
+
) => Effect.Effect<string, System.SystemError>
|
|
65
|
+
readonly readLink: (path: string) => Effect.Effect<string, System.SystemError>
|
|
66
|
+
readonly realPath: (path: string) => Effect.Effect<string, System.SystemError>
|
|
73
67
|
readonly remove: (
|
|
74
68
|
path: string,
|
|
75
69
|
options?: RemoveOptions,
|
|
76
|
-
) => Effect.Effect<void,
|
|
77
|
-
readonly rename: (
|
|
78
|
-
oldPath: string,
|
|
79
|
-
newPath: string,
|
|
80
|
-
) => Effect.Effect<void, PlatformError.PlatformError>
|
|
70
|
+
) => Effect.Effect<void, System.SystemError>
|
|
71
|
+
readonly rename: (oldPath: string, newPath: string) => Effect.Effect<void, System.SystemError>
|
|
81
72
|
readonly sink: (
|
|
82
73
|
path: string,
|
|
83
74
|
options?: SinkOptions,
|
|
84
|
-
) => Sink.Sink<void, Uint8Array, never,
|
|
85
|
-
readonly stat: (path: string) => Effect.Effect<File.Info,
|
|
75
|
+
) => Sink.Sink<void, Uint8Array, never, System.SystemError>
|
|
76
|
+
readonly stat: (path: string) => Effect.Effect<File.Info, System.SystemError>
|
|
86
77
|
readonly stream: (
|
|
87
78
|
path: string,
|
|
88
79
|
options?: StreamOptions,
|
|
89
|
-
) => Stream.Stream<Uint8Array,
|
|
90
|
-
readonly symlink: (
|
|
91
|
-
|
|
92
|
-
toPath: string,
|
|
93
|
-
) => Effect.Effect<void, PlatformError.PlatformError>
|
|
94
|
-
readonly truncate: (
|
|
95
|
-
path: string,
|
|
96
|
-
length?: SizeInput,
|
|
97
|
-
) => Effect.Effect<void, PlatformError.PlatformError>
|
|
80
|
+
) => Stream.Stream<Uint8Array, System.SystemError>
|
|
81
|
+
readonly symlink: (fromPath: string, toPath: string) => Effect.Effect<void, System.SystemError>
|
|
82
|
+
readonly truncate: (path: string, length?: SizeInput) => Effect.Effect<void, System.SystemError>
|
|
98
83
|
readonly utimes: (
|
|
99
84
|
path: string,
|
|
100
85
|
atime: Date | number,
|
|
101
86
|
mtime: Date | number,
|
|
102
|
-
) => Effect.Effect<void,
|
|
87
|
+
) => Effect.Effect<void, System.SystemError>
|
|
103
88
|
readonly watch: (
|
|
104
89
|
path: string,
|
|
105
90
|
options?: WatchOptions,
|
|
106
|
-
) => Stream.Stream<WatchEvent,
|
|
91
|
+
) => Stream.Stream<WatchEvent, System.SystemError>
|
|
107
92
|
readonly writeFile: (
|
|
108
93
|
path: string,
|
|
109
94
|
data: Uint8Array,
|
|
110
95
|
options?: WriteFileOptions,
|
|
111
|
-
) => Effect.Effect<void,
|
|
96
|
+
) => Effect.Effect<void, System.SystemError>
|
|
112
97
|
readonly writeFileString: (
|
|
113
98
|
path: string,
|
|
114
99
|
data: string,
|
|
115
100
|
options?: WriteFileStringOptions,
|
|
116
|
-
) => Effect.Effect<void,
|
|
101
|
+
) => Effect.Effect<void, System.SystemError>
|
|
117
102
|
}
|
|
118
103
|
|
|
119
104
|
export const FileSystem: Context.Tag<FileSystem, FileSystem> = Context.GenericTag<FileSystem>(
|
|
@@ -202,16 +187,16 @@ export type FileTypeId = typeof FileTypeId
|
|
|
202
187
|
export interface File {
|
|
203
188
|
readonly [FileTypeId]: FileTypeId
|
|
204
189
|
readonly fd: File.Descriptor
|
|
205
|
-
readonly stat: Effect.Effect<File.Info,
|
|
190
|
+
readonly stat: Effect.Effect<File.Info, System.SystemError>
|
|
206
191
|
readonly seek: (offset: SizeInput, from: SeekMode) => Effect.Effect<void>
|
|
207
|
-
readonly sync: Effect.Effect<void,
|
|
208
|
-
readonly read: (buffer: Uint8Array) => Effect.Effect<Size,
|
|
192
|
+
readonly sync: Effect.Effect<void, System.SystemError>
|
|
193
|
+
readonly read: (buffer: Uint8Array) => Effect.Effect<Size, System.SystemError>
|
|
209
194
|
readonly readAlloc: (
|
|
210
195
|
size: SizeInput,
|
|
211
|
-
) => Effect.Effect<Option.Option<Uint8Array>,
|
|
212
|
-
readonly truncate: (length?: SizeInput) => Effect.Effect<void,
|
|
213
|
-
readonly write: (buffer: Uint8Array) => Effect.Effect<Size,
|
|
214
|
-
readonly writeAll: (buffer: Uint8Array) => Effect.Effect<void,
|
|
196
|
+
) => Effect.Effect<Option.Option<Uint8Array>, System.SystemError>
|
|
197
|
+
readonly truncate: (length?: SizeInput) => Effect.Effect<void, System.SystemError>
|
|
198
|
+
readonly write: (buffer: Uint8Array) => Effect.Effect<Size, System.SystemError>
|
|
199
|
+
readonly writeAll: (buffer: Uint8Array) => Effect.Effect<void, System.SystemError>
|
|
215
200
|
}
|
|
216
201
|
|
|
217
202
|
export declare namespace File {
|
|
@@ -282,7 +267,7 @@ export class WatchBackend extends Context.Tag("@effect/platform/FileSystem/Watch
|
|
|
282
267
|
path: string,
|
|
283
268
|
stat: File.Info,
|
|
284
269
|
options?: WatchOptions,
|
|
285
|
-
) => Option.Option<Stream.Stream<WatchEvent,
|
|
270
|
+
) => Option.Option<Stream.Stream<WatchEvent, System.SystemError>>
|
|
286
271
|
}
|
|
287
272
|
>() {}
|
|
288
273
|
|
|
@@ -303,7 +288,8 @@ export const make = (
|
|
|
303
288
|
Effect.tryMap(impl.readFile(path), {
|
|
304
289
|
try: (_) => new TextDecoder(encoding).decode(_),
|
|
305
290
|
catch: (cause) =>
|
|
306
|
-
new
|
|
291
|
+
new System.SystemError({
|
|
292
|
+
reason: "BadArgument",
|
|
307
293
|
module: "FileSystem",
|
|
308
294
|
method: "readFileString",
|
|
309
295
|
description: "invalid encoding",
|
|
@@ -330,7 +316,8 @@ export const make = (
|
|
|
330
316
|
Effect.try({
|
|
331
317
|
try: () => new TextEncoder().encode(data),
|
|
332
318
|
catch: (cause) =>
|
|
333
|
-
new
|
|
319
|
+
new System.SystemError({
|
|
320
|
+
reason: "BadArgument",
|
|
334
321
|
module: "FileSystem",
|
|
335
322
|
method: "writeFileString",
|
|
336
323
|
description: "could not encode string",
|
|
@@ -348,14 +335,7 @@ const fileStream = (file: File, options: StreamOptions = {}) => {
|
|
|
348
335
|
|
|
349
336
|
function loop(
|
|
350
337
|
totalBytesRead: bigint,
|
|
351
|
-
): Channel.Channel<
|
|
352
|
-
Chunk.Chunk<Uint8Array>,
|
|
353
|
-
unknown,
|
|
354
|
-
PlatformError.PlatformError,
|
|
355
|
-
unknown,
|
|
356
|
-
void,
|
|
357
|
-
unknown
|
|
358
|
-
> {
|
|
338
|
+
): Channel.Channel<Chunk.Chunk<Uint8Array>, unknown, System.SystemError, unknown, void, unknown> {
|
|
359
339
|
if (bytesToRead !== undefined && bytesToRead <= totalBytesRead) {
|
|
360
340
|
return Channel.void
|
|
361
341
|
}
|
package/src/GlobalLayer.ts
CHANGED
|
@@ -9,7 +9,7 @@ import * as MutableRef from "effect/MutableRef"
|
|
|
9
9
|
import * as Option from "effect/Option"
|
|
10
10
|
import * as Runtime from "effect/Runtime"
|
|
11
11
|
|
|
12
|
-
import * as ChildProcess from "./
|
|
12
|
+
import * as ChildProcess from "./_ChildProcess.ts"
|
|
13
13
|
|
|
14
14
|
interface CacheEntry {
|
|
15
15
|
readonly context: Context.Context<any>
|
|
@@ -67,7 +67,9 @@ export const globalLayer =
|
|
|
67
67
|
)
|
|
68
68
|
yield* Deferred.succeed(deferred, ctx)
|
|
69
69
|
yield* Effect.never
|
|
70
|
-
})
|
|
70
|
+
}).pipe(
|
|
71
|
+
Effect.catchAllCause((cause) => Deferred.failCause(deferred, cause)),
|
|
72
|
+
),
|
|
71
73
|
),
|
|
72
74
|
) as Fiber.RuntimeFiber<void>
|
|
73
75
|
|