effect-start 0.23.1 → 0.26.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 +18 -86
- package/src/Development.ts +3 -1
- package/src/Entity.ts +17 -0
- package/src/Fetch.ts +271 -0
- package/src/SqlIntrospect.ts +64 -70
- package/src/Start.ts +21 -24
- package/src/StartApp.ts +1 -1
- package/src/bun/BunServer.ts +42 -10
- package/src/hyper/HyperHtml.ts +0 -1
- package/src/sql/bun/index.ts +1 -1
- package/src/sql/index.ts +1 -0
- package/src/sql/libsql/index.ts +173 -0
- package/src/sql/libsql/libsql.d.ts +39 -0
- package/src/sql/mssql/index.ts +1 -1
- package/dist/BlobStore.d.ts +0 -80
- package/dist/BlobStore.js +0 -19
- package/dist/ChildProcess.d.ts +0 -60
- package/dist/ChildProcess.js +0 -30
- package/dist/Commander.d.ts +0 -100
- package/dist/Commander.js +0 -326
- package/dist/ContentNegotiation.d.ts +0 -12
- package/dist/ContentNegotiation.js +0 -359
- package/dist/Cookies.d.ts +0 -47
- package/dist/Cookies.js +0 -302
- package/dist/Development.d.ts +0 -39
- package/dist/Development.js +0 -58
- package/dist/Effectify.d.ts +0 -209
- package/dist/Effectify.js +0 -19
- package/dist/Entity.d.ts +0 -47
- package/dist/Entity.js +0 -224
- package/dist/FilePathPattern.d.ts +0 -29
- package/dist/FilePathPattern.js +0 -86
- package/dist/FileRouter.d.ts +0 -56
- package/dist/FileRouter.js +0 -148
- package/dist/FileRouterCodegen.d.ts +0 -18
- package/dist/FileRouterCodegen.js +0 -227
- package/dist/FileRouterPattern.d.ts +0 -9
- package/dist/FileRouterPattern.js +0 -35
- package/dist/FileSystem.d.ts +0 -158
- package/dist/FileSystem.js +0 -70
- package/dist/Http.d.ts +0 -37
- package/dist/Http.js +0 -88
- package/dist/HttpAppExtra.d.ts +0 -7
- package/dist/HttpAppExtra.js +0 -320
- package/dist/HttpUtils.d.ts +0 -3
- package/dist/HttpUtils.js +0 -11
- package/dist/PathPattern.d.ts +0 -134
- package/dist/PathPattern.js +0 -413
- package/dist/PlatformError.d.ts +0 -38
- package/dist/PlatformError.js +0 -25
- package/dist/PlatformRuntime.d.ts +0 -27
- package/dist/PlatformRuntime.js +0 -46
- package/dist/Route.d.ts +0 -97
- package/dist/Route.js +0 -100
- package/dist/RouteBody.d.ts +0 -47
- package/dist/RouteBody.js +0 -67
- package/dist/RouteError.d.ts +0 -98
- package/dist/RouteError.js +0 -55
- package/dist/RouteHook.d.ts +0 -12
- package/dist/RouteHook.js +0 -40
- package/dist/RouteHttp.d.ts +0 -21
- package/dist/RouteHttp.js +0 -258
- package/dist/RouteHttpTracer.d.ts +0 -10
- package/dist/RouteHttpTracer.js +0 -62
- package/dist/RouteMount.d.ts +0 -86
- package/dist/RouteMount.js +0 -63
- package/dist/RouteSchema.d.ts +0 -86
- package/dist/RouteSchema.js +0 -188
- package/dist/RouteSse.d.ts +0 -21
- package/dist/RouteSse.js +0 -79
- package/dist/RouteTree.d.ts +0 -57
- package/dist/RouteTree.js +0 -93
- package/dist/RouteTrie.d.ts +0 -20
- package/dist/RouteTrie.js +0 -152
- package/dist/RouterPattern.d.ts +0 -118
- package/dist/RouterPattern.js +0 -269
- package/dist/SchemaExtra.d.ts +0 -7
- package/dist/SchemaExtra.js +0 -74
- package/dist/Socket.d.ts +0 -27
- package/dist/Socket.js +0 -29
- package/dist/Sql.d.ts +0 -34
- package/dist/Sql.js +0 -5
- package/dist/SqlIntrospect.d.ts +0 -91
- package/dist/SqlIntrospect.js +0 -466
- package/dist/Start.d.ts +0 -44
- package/dist/Start.js +0 -49
- package/dist/StartApp.d.ts +0 -19
- package/dist/StartApp.js +0 -21
- package/dist/StreamExtra.d.ts +0 -28
- package/dist/StreamExtra.js +0 -100
- package/dist/System.d.ts +0 -7
- package/dist/System.js +0 -22
- package/dist/TuplePathPattern.d.ts +0 -9
- package/dist/TuplePathPattern.js +0 -68
- package/dist/Unique.d.ts +0 -50
- package/dist/Unique.js +0 -187
- package/dist/Values.d.ts +0 -27
- package/dist/Values.js +0 -36
- package/dist/bun/BunBlobStoreDisk.d.ts +0 -6
- package/dist/bun/BunBlobStoreDisk.js +0 -116
- package/dist/bun/BunBlobStoreS3.d.ts +0 -11
- package/dist/bun/BunBlobStoreS3.js +0 -89
- package/dist/bun/BunBlobWatcherDisk.d.ts +0 -6
- package/dist/bun/BunBlobWatcherDisk.js +0 -60
- package/dist/bun/BunBlobWatcherQueue.d.ts +0 -6
- package/dist/bun/BunBlobWatcherQueue.js +0 -17
- package/dist/bun/BunBundle.d.ts +0 -11
- package/dist/bun/BunBundle.js +0 -137
- package/dist/bun/BunChildProcessSpawner.d.ts +0 -3
- package/dist/bun/BunChildProcessSpawner.js +0 -103
- package/dist/bun/BunHttpServer.d.ts +0 -44
- package/dist/bun/BunHttpServer.js +0 -186
- package/dist/bun/BunHttpServer_web.d.ts +0 -60
- package/dist/bun/BunHttpServer_web.js +0 -252
- package/dist/bun/BunImportTrackerPlugin.d.ts +0 -13
- package/dist/bun/BunImportTrackerPlugin.js +0 -69
- package/dist/bun/BunPlatformHttpServer.d.ts +0 -10
- package/dist/bun/BunPlatformHttpServer.js +0 -53
- package/dist/bun/BunRoute.d.ts +0 -48
- package/dist/bun/BunRoute.js +0 -121
- package/dist/bun/BunRuntime.d.ts +0 -2
- package/dist/bun/BunRuntime.js +0 -31
- package/dist/bun/BunServer.d.ts +0 -40
- package/dist/bun/BunServer.js +0 -157
- package/dist/bun/BunServerRequest.d.ts +0 -60
- package/dist/bun/BunServerRequest.js +0 -252
- package/dist/bun/BunSql.d.ts +0 -4
- package/dist/bun/BunSql.js +0 -81
- package/dist/bun/BunVirtualFilesPlugin.d.ts +0 -4
- package/dist/bun/BunVirtualFilesPlugin.js +0 -40
- package/dist/bun/_BunEnhancedResolve.d.ts +0 -45
- package/dist/bun/_BunEnhancedResolve.js +0 -102
- package/dist/bun/index.d.ts +0 -5
- package/dist/bun/index.js +0 -5
- package/dist/bundler/Bundle.d.ts +0 -61
- package/dist/bundler/Bundle.js +0 -48
- package/dist/bundler/BundleFiles.d.ts +0 -13
- package/dist/bundler/BundleFiles.js +0 -96
- package/dist/bundler/BundleHttp.d.ts +0 -45
- package/dist/bundler/BundleHttp.js +0 -176
- package/dist/bundler/BundleRoute.d.ts +0 -27
- package/dist/bundler/BundleRoute.js +0 -51
- package/dist/client/Overlay.d.ts +0 -2
- package/dist/client/Overlay.js +0 -32
- package/dist/client/ScrollState.d.ts +0 -6
- package/dist/client/ScrollState.js +0 -94
- package/dist/client/index.d.ts +0 -6
- package/dist/client/index.js +0 -79
- package/dist/console/Console.d.ts +0 -6
- package/dist/console/Console.js +0 -26
- package/dist/console/ConsoleErrors.d.ts +0 -3
- package/dist/console/ConsoleErrors.js +0 -200
- package/dist/console/ConsoleLogger.d.ts +0 -3
- package/dist/console/ConsoleLogger.js +0 -47
- package/dist/console/ConsoleMetrics.d.ts +0 -3
- package/dist/console/ConsoleMetrics.js +0 -61
- package/dist/console/ConsoleProcess.d.ts +0 -3
- package/dist/console/ConsoleProcess.js +0 -49
- package/dist/console/ConsoleStore.d.ts +0 -144
- package/dist/console/ConsoleStore.js +0 -61
- package/dist/console/ConsoleTracer.d.ts +0 -3
- package/dist/console/ConsoleTracer.js +0 -94
- package/dist/console/Simulation.d.ts +0 -2
- package/dist/console/Simulation.js +0 -633
- package/dist/console/index.d.ts +0 -3
- package/dist/console/index.js +0 -3
- package/dist/console/routes/errors/route.d.ts +0 -10
- package/dist/console/routes/errors/route.js +0 -47
- package/dist/console/routes/fiberDetail.d.ts +0 -16
- package/dist/console/routes/fiberDetail.js +0 -38
- package/dist/console/routes/fibers/route.d.ts +0 -10
- package/dist/console/routes/fibers/route.js +0 -19
- package/dist/console/routes/git/route.d.ts +0 -11
- package/dist/console/routes/git/route.js +0 -33
- package/dist/console/routes/layout.d.ts +0 -9
- package/dist/console/routes/layout.js +0 -3
- package/dist/console/routes/logs/route.d.ts +0 -10
- package/dist/console/routes/logs/route.js +0 -32
- package/dist/console/routes/metrics/route.d.ts +0 -10
- package/dist/console/routes/metrics/route.js +0 -17
- package/dist/console/routes/route.d.ts +0 -6
- package/dist/console/routes/route.js +0 -5
- package/dist/console/routes/routes/route.d.ts +0 -6
- package/dist/console/routes/routes/route.js +0 -20
- package/dist/console/routes/services/route.d.ts +0 -6
- package/dist/console/routes/services/route.js +0 -12
- package/dist/console/routes/system/route.d.ts +0 -10
- package/dist/console/routes/system/route.js +0 -18
- package/dist/console/routes/traceDetail.d.ts +0 -16
- package/dist/console/routes/traceDetail.js +0 -14
- package/dist/console/routes/traces/route.d.ts +0 -10
- package/dist/console/routes/traces/route.js +0 -39
- package/dist/console/routes/tree.d.ts +0 -153
- package/dist/console/routes/tree.js +0 -29
- package/dist/console/ui/Errors.d.ts +0 -4
- package/dist/console/ui/Errors.js +0 -15
- package/dist/console/ui/Fibers.d.ts +0 -24
- package/dist/console/ui/Fibers.js +0 -121
- package/dist/console/ui/Git.d.ts +0 -20
- package/dist/console/ui/Git.js +0 -95
- package/dist/console/ui/Logs.d.ts +0 -4
- package/dist/console/ui/Logs.js +0 -25
- package/dist/console/ui/Metrics.d.ts +0 -4
- package/dist/console/ui/Metrics.js +0 -26
- package/dist/console/ui/Routes.d.ts +0 -8
- package/dist/console/ui/Routes.js +0 -70
- package/dist/console/ui/Services.d.ts +0 -10
- package/dist/console/ui/Services.js +0 -246
- package/dist/console/ui/Shell.d.ts +0 -10
- package/dist/console/ui/Shell.js +0 -7
- package/dist/console/ui/System.d.ts +0 -4
- package/dist/console/ui/System.js +0 -35
- package/dist/console/ui/Traces.d.ts +0 -12
- package/dist/console/ui/Traces.js +0 -179
- package/dist/datastar/actions/fetch.d.ts +0 -30
- package/dist/datastar/actions/fetch.js +0 -403
- package/dist/datastar/actions/peek.d.ts +0 -1
- package/dist/datastar/actions/peek.js +0 -13
- package/dist/datastar/actions/setAll.d.ts +0 -1
- package/dist/datastar/actions/setAll.js +0 -12
- package/dist/datastar/actions/toggleAll.d.ts +0 -1
- package/dist/datastar/actions/toggleAll.js +0 -12
- package/dist/datastar/attributes/attr.d.ts +0 -1
- package/dist/datastar/attributes/attr.js +0 -48
- package/dist/datastar/attributes/bind.d.ts +0 -1
- package/dist/datastar/attributes/bind.js +0 -175
- package/dist/datastar/attributes/class.d.ts +0 -1
- package/dist/datastar/attributes/class.js +0 -47
- package/dist/datastar/attributes/computed.d.ts +0 -1
- package/dist/datastar/attributes/computed.js +0 -26
- package/dist/datastar/attributes/effect.d.ts +0 -1
- package/dist/datastar/attributes/effect.js +0 -9
- package/dist/datastar/attributes/indicator.d.ts +0 -1
- package/dist/datastar/attributes/indicator.js +0 -30
- package/dist/datastar/attributes/init.d.ts +0 -1
- package/dist/datastar/attributes/init.js +0 -26
- package/dist/datastar/attributes/jsonSignals.d.ts +0 -1
- package/dist/datastar/attributes/jsonSignals.js +0 -30
- package/dist/datastar/attributes/on.d.ts +0 -1
- package/dist/datastar/attributes/on.js +0 -78
- package/dist/datastar/attributes/onIntersect.d.ts +0 -1
- package/dist/datastar/attributes/onIntersect.js +0 -53
- package/dist/datastar/attributes/onInterval.d.ts +0 -1
- package/dist/datastar/attributes/onInterval.js +0 -30
- package/dist/datastar/attributes/onSignalPatch.d.ts +0 -1
- package/dist/datastar/attributes/onSignalPatch.js +0 -42
- package/dist/datastar/attributes/ref.d.ts +0 -1
- package/dist/datastar/attributes/ref.js +0 -10
- package/dist/datastar/attributes/show.d.ts +0 -1
- package/dist/datastar/attributes/show.js +0 -31
- package/dist/datastar/attributes/signals.d.ts +0 -1
- package/dist/datastar/attributes/signals.js +0 -17
- package/dist/datastar/attributes/style.d.ts +0 -1
- package/dist/datastar/attributes/style.js +0 -50
- package/dist/datastar/attributes/text.d.ts +0 -1
- package/dist/datastar/attributes/text.js +0 -26
- package/dist/datastar/engine.d.ts +0 -162
- package/dist/datastar/engine.js +0 -999
- package/dist/datastar/happydom.d.ts +0 -1
- package/dist/datastar/happydom.js +0 -8
- package/dist/datastar/index.d.ts +0 -24
- package/dist/datastar/index.js +0 -24
- package/dist/datastar/load.d.ts +0 -24
- package/dist/datastar/load.js +0 -24
- package/dist/datastar/utils.d.ts +0 -51
- package/dist/datastar/utils.js +0 -202
- package/dist/datastar/watchers/patchElements.d.ts +0 -1
- package/dist/datastar/watchers/patchElements.js +0 -399
- package/dist/datastar/watchers/patchSignals.d.ts +0 -1
- package/dist/datastar/watchers/patchSignals.js +0 -14
- package/dist/experimental/EncryptedCookies.d.ts +0 -48
- package/dist/experimental/EncryptedCookies.js +0 -212
- package/dist/experimental/SseHttpResponse.d.ts +0 -7
- package/dist/experimental/SseHttpResponse.js +0 -28
- package/dist/experimental/index.d.ts +0 -1
- package/dist/experimental/index.js +0 -1
- package/dist/hyper/Hyper.d.ts +0 -25
- package/dist/hyper/Hyper.js +0 -23
- package/dist/hyper/HyperHtml.d.ts +0 -23
- package/dist/hyper/HyperHtml.js +0 -150
- package/dist/hyper/HyperHtml.test.d.ts +0 -1
- package/dist/hyper/HyperHtml.test.js +0 -197
- package/dist/hyper/HyperNode.d.ts +0 -14
- package/dist/hyper/HyperNode.js +0 -11
- package/dist/hyper/HyperRoute.d.ts +0 -8
- package/dist/hyper/HyperRoute.js +0 -32
- package/dist/hyper/HyperRoute.test.d.ts +0 -1
- package/dist/hyper/HyperRoute.test.js +0 -83
- package/dist/hyper/html.d.ts +0 -11
- package/dist/hyper/html.js +0 -30
- package/dist/hyper/index.d.ts +0 -6
- package/dist/hyper/index.js +0 -5
- package/dist/hyper/jsx-runtime.d.ts +0 -7
- package/dist/hyper/jsx-runtime.js +0 -8
- package/dist/index.d.ts +0 -8
- package/dist/index.js +0 -8
- package/dist/inference_check.d.ts +0 -1
- package/dist/inference_check.js +0 -15
- package/dist/lint/plugin.d.ts +0 -86
- package/dist/lint/plugin.js +0 -341
- package/dist/middlewares/BasicAuthMiddleware.d.ts +0 -8
- package/dist/middlewares/BasicAuthMiddleware.js +0 -22
- package/dist/middlewares/index.d.ts +0 -1
- package/dist/middlewares/index.js +0 -1
- package/dist/node/Effectify.d.ts +0 -209
- package/dist/node/Effectify.js +0 -19
- package/dist/node/FileSystem.d.ts +0 -7
- package/dist/node/FileSystem.js +0 -420
- package/dist/node/NodeFileSystem.d.ts +0 -7
- package/dist/node/NodeFileSystem.js +0 -410
- package/dist/node/NodeUtils.d.ts +0 -2
- package/dist/node/NodeUtils.js +0 -20
- package/dist/node/PlatformError.d.ts +0 -46
- package/dist/node/PlatformError.js +0 -43
- package/dist/node/Utils.d.ts +0 -1
- package/dist/node/Utils.js +0 -19
- package/dist/repro_fail.d.ts +0 -1
- package/dist/repro_fail.js +0 -14
- package/dist/sql/bun/index.d.ts +0 -3
- package/dist/sql/bun/index.js +0 -75
- package/dist/sql/mssql/docker.d.ts +0 -2
- package/dist/sql/mssql/docker.js +0 -67
- package/dist/sql/mssql/index.d.ts +0 -21
- package/dist/sql/mssql/index.js +0 -113
- package/dist/testing/TestHttpClient.d.ts +0 -13
- package/dist/testing/TestHttpClient.js +0 -68
- package/dist/testing/TestLogger.d.ts +0 -13
- package/dist/testing/TestLogger.js +0 -32
- package/dist/testing/index.d.ts +0 -2
- package/dist/testing/index.js +0 -2
- package/dist/testing/utils.d.ts +0 -9
- package/dist/testing/utils.js +0 -39
- package/dist/x/cloudflare/CloudflareTunnel.d.ts +0 -10
- package/dist/x/cloudflare/CloudflareTunnel.js +0 -30
- package/dist/x/cloudflare/index.d.ts +0 -1
- package/dist/x/cloudflare/index.js +0 -1
- package/dist/x/datastar/Datastar.d.ts +0 -6
- package/dist/x/datastar/Datastar.js +0 -47
- package/dist/x/datastar/index.d.ts +0 -1
- package/dist/x/datastar/index.js +0 -1
- package/dist/x/tailscale/TailscaleTunnel.d.ts +0 -15
- package/dist/x/tailscale/TailscaleTunnel.js +0 -68
- package/dist/x/tailscale/index.d.ts +0 -1
- package/dist/x/tailscale/index.js +0 -1
- package/dist/x/tailwind/TailwindPlugin.d.ts +0 -23
- package/dist/x/tailwind/TailwindPlugin.js +0 -219
- package/dist/x/tailwind/compile.d.ts +0 -19
- package/dist/x/tailwind/compile.js +0 -154
- package/dist/x/tailwind/plugin.d.ts +0 -2
- package/dist/x/tailwind/plugin.js +0 -15
- /package/src/{Sql.ts → sql/Sql.ts} +0 -0
package/dist/HttpUtils.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export function makeUrlFromRequest(request) {
|
|
2
|
-
const origin = request.headers.origin
|
|
3
|
-
?? request.headers.host
|
|
4
|
-
?? "http://localhost";
|
|
5
|
-
const protocol = request.headers["x-forwarded-proto"] ?? "http";
|
|
6
|
-
const host = request.headers.host ?? "localhost";
|
|
7
|
-
const base = origin.startsWith("http")
|
|
8
|
-
? origin
|
|
9
|
-
: `${protocol}://${host}`;
|
|
10
|
-
return new URL(request.url, base);
|
|
11
|
-
}
|
package/dist/PathPattern.d.ts
DELETED
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
export type PathPattern = `/${string}`;
|
|
2
|
-
export type Segments<Path extends string> = Path extends `/${infer Rest}` ? Segments<Rest> : Path extends `${infer Head}/${infer Tail}` ? [Head, ...Segments<Tail>] : Path extends "" ? [] : [Path];
|
|
3
|
-
export type Params<T extends string> = string extends T ? Record<string, string> : T extends `${infer _Start}:${infer Param}?/${infer Rest}` ? {
|
|
4
|
-
[K in Param]?: string;
|
|
5
|
-
} & Params<`/${Rest}`> : T extends `${infer _Start}:${infer Param}/${infer Rest}` ? {
|
|
6
|
-
[K in Param]: string;
|
|
7
|
-
} & Params<`/${Rest}`> : T extends `${infer _Start}:${infer Param}+` ? {
|
|
8
|
-
[K in Param]: string;
|
|
9
|
-
} : T extends `${infer _Start}:${infer Param}*` ? {
|
|
10
|
-
[K in Param]?: string;
|
|
11
|
-
} : T extends `${infer _Start}:${infer Param}?` ? {
|
|
12
|
-
[K in Param]?: string;
|
|
13
|
-
} : T extends `${infer _Start}:${infer Param}` ? {
|
|
14
|
-
[K in Param]: string;
|
|
15
|
-
} : {};
|
|
16
|
-
export type ValidateResult = {
|
|
17
|
-
ok: true;
|
|
18
|
-
segments: Array<string>;
|
|
19
|
-
} | {
|
|
20
|
-
ok: false;
|
|
21
|
-
error: string;
|
|
22
|
-
};
|
|
23
|
-
export declare function validate(path: string): ValidateResult;
|
|
24
|
-
export declare function match(pattern: string, path: string): Record<string, string> | null;
|
|
25
|
-
export declare function toRegex(path: string): RegExp;
|
|
26
|
-
/**
|
|
27
|
-
* Converts to Express path pattern.
|
|
28
|
-
*
|
|
29
|
-
* @see https://expressjs.com/en/guide/routing.html
|
|
30
|
-
*
|
|
31
|
-
* - `:param` → `:param`
|
|
32
|
-
* - `:param?` → `{/:param}`
|
|
33
|
-
* - `:param+` → `/*param`
|
|
34
|
-
* - `:param*` → `/`, `/*param`
|
|
35
|
-
*/
|
|
36
|
-
export declare function toExpress(path: string): Array<string>;
|
|
37
|
-
/**
|
|
38
|
-
* Converts to URLPattern path pattern.
|
|
39
|
-
*
|
|
40
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/URL_Pattern_API
|
|
41
|
-
*
|
|
42
|
-
* - `:param` → `:param`
|
|
43
|
-
* - `:param?` → `:param?`
|
|
44
|
-
* - `:param+` → `:param+`
|
|
45
|
-
* - `:param*` → `:param*`
|
|
46
|
-
*/
|
|
47
|
-
export declare function toURLPattern(path: string): Array<string>;
|
|
48
|
-
/**
|
|
49
|
-
* Converts to React Router path pattern.
|
|
50
|
-
*
|
|
51
|
-
* @see https://reactrouter.com/start/framework/routing
|
|
52
|
-
*
|
|
53
|
-
* - `:param` → `:param`
|
|
54
|
-
* - `:param?` → `:param?`
|
|
55
|
-
* - `:param+` → `*` (splat, required)
|
|
56
|
-
* - `:param*` → `/`, `/*` (splat, optional - two routes)
|
|
57
|
-
*/
|
|
58
|
-
export declare function toReactRouter(path: string): Array<string>;
|
|
59
|
-
/**
|
|
60
|
-
* Alias for toReactRouter.
|
|
61
|
-
*
|
|
62
|
-
* @see https://reactrouter.com/start/framework/routing
|
|
63
|
-
*/
|
|
64
|
-
export declare const toRemix: typeof toReactRouter;
|
|
65
|
-
/**
|
|
66
|
-
* Converts to Remix file-based route naming convention.
|
|
67
|
-
*
|
|
68
|
-
* Returns a file path segment (without extension) for Remix's
|
|
69
|
-
* flat file routing convention.
|
|
70
|
-
*
|
|
71
|
-
* @see https://remix.run/docs/file-conventions/routes
|
|
72
|
-
*
|
|
73
|
-
* - `:param` → `$param`
|
|
74
|
-
* - `:param?` → `($param)`
|
|
75
|
-
* - `:param+` → `$` (splat)
|
|
76
|
-
* - `:param*` → `($)` (optional splat) - Note: not officially supported
|
|
77
|
-
*/
|
|
78
|
-
export declare function toRemixFile(path: string): string;
|
|
79
|
-
/**
|
|
80
|
-
* Converts to TanStack Router path/file pattern.
|
|
81
|
-
*
|
|
82
|
-
* TanStack uses the same `$param` syntax for both route paths and file names.
|
|
83
|
-
* Returns a dot-separated file name (without extension).
|
|
84
|
-
*
|
|
85
|
-
* @see https://tanstack.com/router/v1/docs/framework/react/guide/path-params
|
|
86
|
-
* @see https://tanstack.com/router/v1/docs/framework/react/routing/file-naming-conventions
|
|
87
|
-
*
|
|
88
|
-
* - `:param` → `$param`
|
|
89
|
-
* - `:param?` → `{-$param}` (optional segment)
|
|
90
|
-
* - `:param+` → `$` (splat)
|
|
91
|
-
* - `:param*` → `$` (splat, optional not supported - treated as required)
|
|
92
|
-
*/
|
|
93
|
-
export declare function toTanStack(path: string): string;
|
|
94
|
-
/**
|
|
95
|
-
* Converts to Hono path pattern.
|
|
96
|
-
*
|
|
97
|
-
* Hono uses unnamed wildcards - they are NOT accessible via c.req.param().
|
|
98
|
-
* Use c.req.path to access the matched path for wildcard routes.
|
|
99
|
-
*
|
|
100
|
-
* @see https://hono.dev/docs/api/routing
|
|
101
|
-
*
|
|
102
|
-
* - `:param` → `:param`
|
|
103
|
-
* - `:param?` → `:param?`
|
|
104
|
-
* - `:param+` → `*` (unnamed, required)
|
|
105
|
-
* - `:param*` → `/`, `/*` (unnamed, optional - two routes)
|
|
106
|
-
*/
|
|
107
|
-
export declare function toHono(path: string): Array<string>;
|
|
108
|
-
/**
|
|
109
|
-
* Converts to Effect HttpRouter / find-my-way path pattern.
|
|
110
|
-
*
|
|
111
|
-
* Effect uses colon-style params with unnamed wildcards.
|
|
112
|
-
*
|
|
113
|
-
* @see https://effect.website/docs/platform/http-router
|
|
114
|
-
*
|
|
115
|
-
* - `:param` → `:param`
|
|
116
|
-
* - `:param?` → `:param?`
|
|
117
|
-
* - `:param+` → `*` (unnamed)
|
|
118
|
-
* - `:param*` → `/`, `/*` (two routes)
|
|
119
|
-
*/
|
|
120
|
-
export declare function toEffect(path: string): Array<string>;
|
|
121
|
-
/**
|
|
122
|
-
* Converts to Bun.serve path pattern.
|
|
123
|
-
*
|
|
124
|
-
* Since Bun doesn't support optional params (`:param?`), optional segments
|
|
125
|
-
* are expanded into multiple routes.
|
|
126
|
-
*
|
|
127
|
-
* @see https://bun.sh/docs/api/http#routing
|
|
128
|
-
*
|
|
129
|
-
* - `:param` → `:param`
|
|
130
|
-
* - `:param?` → `/`, `/:param` (two routes)
|
|
131
|
-
* - `:param+` → `/*`
|
|
132
|
-
* - `:param*` → `/`, `/*` (two routes)
|
|
133
|
-
*/
|
|
134
|
-
export declare function toBun(path: string): Array<PathPattern>;
|
package/dist/PathPattern.js
DELETED
|
@@ -1,413 +0,0 @@
|
|
|
1
|
-
function isValidSegment(segment) {
|
|
2
|
-
if (segment.startsWith(":")) {
|
|
3
|
-
const rest = segment.slice(1);
|
|
4
|
-
if (rest.endsWith("*") || rest.endsWith("+") || rest.endsWith("?")) {
|
|
5
|
-
const name = rest.slice(0, -1);
|
|
6
|
-
return name !== "" && /^[a-zA-Z_][a-zA-Z0-9_]*$/.test(name);
|
|
7
|
-
}
|
|
8
|
-
return rest !== "" && /^[a-zA-Z_][a-zA-Z0-9_]*$/.test(rest);
|
|
9
|
-
}
|
|
10
|
-
return /^[\p{L}\p{N}._~-]+$/u.test(segment);
|
|
11
|
-
}
|
|
12
|
-
export function validate(path) {
|
|
13
|
-
const segments = path.split("/").filter(Boolean);
|
|
14
|
-
for (const segment of segments) {
|
|
15
|
-
if (!isValidSegment(segment)) {
|
|
16
|
-
return {
|
|
17
|
-
ok: false,
|
|
18
|
-
error: `Invalid segment "${segment}" in "${path}"`,
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
return { ok: true, segments };
|
|
23
|
-
}
|
|
24
|
-
export function match(pattern, path) {
|
|
25
|
-
const patternSegments = pattern.split("/").filter(Boolean);
|
|
26
|
-
const pathSegments = path.split("/").filter(Boolean);
|
|
27
|
-
const params = {};
|
|
28
|
-
let patternIndex = 0;
|
|
29
|
-
let pathIndex = 0;
|
|
30
|
-
while (patternIndex < patternSegments.length) {
|
|
31
|
-
const seg = patternSegments[patternIndex];
|
|
32
|
-
if (seg.startsWith(":")) {
|
|
33
|
-
const rest = seg.slice(1);
|
|
34
|
-
if (rest.endsWith("+")) {
|
|
35
|
-
const name = rest.slice(0, -1);
|
|
36
|
-
const remaining = pathSegments.slice(pathIndex);
|
|
37
|
-
if (remaining.length === 0) {
|
|
38
|
-
return null;
|
|
39
|
-
}
|
|
40
|
-
params[name] = remaining.join("/");
|
|
41
|
-
return params;
|
|
42
|
-
}
|
|
43
|
-
if (rest.endsWith("*")) {
|
|
44
|
-
const name = rest.slice(0, -1);
|
|
45
|
-
const remaining = pathSegments.slice(pathIndex);
|
|
46
|
-
if (remaining.length > 0) {
|
|
47
|
-
params[name] = remaining.join("/");
|
|
48
|
-
}
|
|
49
|
-
return params;
|
|
50
|
-
}
|
|
51
|
-
if (rest.endsWith("?")) {
|
|
52
|
-
const name = rest.slice(0, -1);
|
|
53
|
-
if (pathIndex < pathSegments.length) {
|
|
54
|
-
params[name] = pathSegments[pathIndex];
|
|
55
|
-
pathIndex++;
|
|
56
|
-
}
|
|
57
|
-
patternIndex++;
|
|
58
|
-
continue;
|
|
59
|
-
}
|
|
60
|
-
if (pathIndex >= pathSegments.length) {
|
|
61
|
-
return null;
|
|
62
|
-
}
|
|
63
|
-
params[rest] = pathSegments[pathIndex];
|
|
64
|
-
pathIndex++;
|
|
65
|
-
patternIndex++;
|
|
66
|
-
continue;
|
|
67
|
-
}
|
|
68
|
-
if (pathIndex >= pathSegments.length) {
|
|
69
|
-
return null;
|
|
70
|
-
}
|
|
71
|
-
if (seg !== pathSegments[pathIndex]) {
|
|
72
|
-
return null;
|
|
73
|
-
}
|
|
74
|
-
pathIndex++;
|
|
75
|
-
patternIndex++;
|
|
76
|
-
}
|
|
77
|
-
if (pathIndex !== pathSegments.length) {
|
|
78
|
-
return null;
|
|
79
|
-
}
|
|
80
|
-
return params;
|
|
81
|
-
}
|
|
82
|
-
export function toRegex(path) {
|
|
83
|
-
const result = path
|
|
84
|
-
.replace(/\/+(\/|$)/g, "$1")
|
|
85
|
-
.replace(/\./g, "\\.")
|
|
86
|
-
.replace(/(\/?):(\w+)\+/g, "($1(?<$2>*))")
|
|
87
|
-
.replace(/(\/?):(\w+)\*/g, "(?:\\/(?<$2>.*))?")
|
|
88
|
-
.replace(/(\/?):(\w+)/g, "($1(?<$2>[^$1/]+?))")
|
|
89
|
-
.replace(/(\/?)\*/g, "($1.*)?");
|
|
90
|
-
return new RegExp(`^${result}/*$`);
|
|
91
|
-
}
|
|
92
|
-
function getModifier(seg) {
|
|
93
|
-
const last = seg[seg.length - 1];
|
|
94
|
-
if (last === "?" || last === "*" || last === "+")
|
|
95
|
-
return last;
|
|
96
|
-
return "";
|
|
97
|
-
}
|
|
98
|
-
function getParamName(seg) {
|
|
99
|
-
const modifier = getModifier(seg);
|
|
100
|
-
return modifier ? seg.slice(1, -1) : seg.slice(1);
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Converts to Express path pattern.
|
|
104
|
-
*
|
|
105
|
-
* @see https://expressjs.com/en/guide/routing.html
|
|
106
|
-
*
|
|
107
|
-
* - `:param` → `:param`
|
|
108
|
-
* - `:param?` → `{/:param}`
|
|
109
|
-
* - `:param+` → `/*param`
|
|
110
|
-
* - `:param*` → `/`, `/*param`
|
|
111
|
-
*/
|
|
112
|
-
export function toExpress(path) {
|
|
113
|
-
const segments = path.split("/").filter(Boolean);
|
|
114
|
-
const optionalWildcardIndex = segments.findIndex((s) => s.startsWith(":") && s.endsWith("*"));
|
|
115
|
-
if (optionalWildcardIndex !== -1) {
|
|
116
|
-
const before = segments.slice(0, optionalWildcardIndex);
|
|
117
|
-
const rest = segments[optionalWildcardIndex];
|
|
118
|
-
const name = getParamName(rest);
|
|
119
|
-
const beforeJoined = before
|
|
120
|
-
.map((s) => (s.startsWith(":") ? `:${getParamName(s)}` : s))
|
|
121
|
-
.join("/");
|
|
122
|
-
const basePath = beforeJoined ? "/" + beforeJoined : "/";
|
|
123
|
-
const withWildcard = basePath === "/" ? `/*${name}` : basePath + `/*${name}`;
|
|
124
|
-
return [basePath, withWildcard];
|
|
125
|
-
}
|
|
126
|
-
let result = "";
|
|
127
|
-
for (const seg of segments) {
|
|
128
|
-
if (!seg.startsWith(":")) {
|
|
129
|
-
result += "/" + seg;
|
|
130
|
-
}
|
|
131
|
-
else {
|
|
132
|
-
const name = getParamName(seg);
|
|
133
|
-
const modifier = getModifier(seg);
|
|
134
|
-
switch (modifier) {
|
|
135
|
-
case "":
|
|
136
|
-
result += `/:${name}`;
|
|
137
|
-
break;
|
|
138
|
-
case "?":
|
|
139
|
-
result += `{/:${name}}`;
|
|
140
|
-
break;
|
|
141
|
-
case "+":
|
|
142
|
-
result += `/*${name}`;
|
|
143
|
-
break;
|
|
144
|
-
case "*":
|
|
145
|
-
result += `/*${name}`;
|
|
146
|
-
break;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
return [result || "/"];
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* Converts to URLPattern path pattern.
|
|
154
|
-
*
|
|
155
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/URL_Pattern_API
|
|
156
|
-
*
|
|
157
|
-
* - `:param` → `:param`
|
|
158
|
-
* - `:param?` → `:param?`
|
|
159
|
-
* - `:param+` → `:param+`
|
|
160
|
-
* - `:param*` → `:param*`
|
|
161
|
-
*/
|
|
162
|
-
export function toURLPattern(path) {
|
|
163
|
-
const segments = path.split("/").filter(Boolean);
|
|
164
|
-
const joined = segments
|
|
165
|
-
.map((seg) => {
|
|
166
|
-
if (!seg.startsWith(":"))
|
|
167
|
-
return seg;
|
|
168
|
-
const name = getParamName(seg);
|
|
169
|
-
const modifier = getModifier(seg);
|
|
170
|
-
return `:${name}${modifier}`;
|
|
171
|
-
})
|
|
172
|
-
.join("/");
|
|
173
|
-
return [joined ? "/" + joined : "/"];
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* Converts to React Router path pattern.
|
|
177
|
-
*
|
|
178
|
-
* @see https://reactrouter.com/start/framework/routing
|
|
179
|
-
*
|
|
180
|
-
* - `:param` → `:param`
|
|
181
|
-
* - `:param?` → `:param?`
|
|
182
|
-
* - `:param+` → `*` (splat, required)
|
|
183
|
-
* - `:param*` → `/`, `/*` (splat, optional - two routes)
|
|
184
|
-
*/
|
|
185
|
-
export function toReactRouter(path) {
|
|
186
|
-
const segments = path.split("/").filter(Boolean);
|
|
187
|
-
const optionalWildcardIndex = segments.findIndex((s) => s.startsWith(":") && s.endsWith("*"));
|
|
188
|
-
if (optionalWildcardIndex !== -1) {
|
|
189
|
-
const before = segments.slice(0, optionalWildcardIndex);
|
|
190
|
-
const beforeJoined = before
|
|
191
|
-
.map((s) => {
|
|
192
|
-
if (!s.startsWith(":"))
|
|
193
|
-
return s;
|
|
194
|
-
const name = getParamName(s);
|
|
195
|
-
const modifier = getModifier(s);
|
|
196
|
-
return modifier === "?" ? `:${name}?` : `:${name}`;
|
|
197
|
-
})
|
|
198
|
-
.join("/");
|
|
199
|
-
const basePath = beforeJoined ? "/" + beforeJoined : "/";
|
|
200
|
-
const withWildcard = basePath === "/" ? "/*" : basePath + "/*";
|
|
201
|
-
return [basePath, withWildcard];
|
|
202
|
-
}
|
|
203
|
-
const joined = segments
|
|
204
|
-
.map((s) => {
|
|
205
|
-
if (!s.startsWith(":"))
|
|
206
|
-
return s;
|
|
207
|
-
const name = getParamName(s);
|
|
208
|
-
const modifier = getModifier(s);
|
|
209
|
-
switch (modifier) {
|
|
210
|
-
case "":
|
|
211
|
-
return `:${name}`;
|
|
212
|
-
case "?":
|
|
213
|
-
return `:${name}?`;
|
|
214
|
-
case "+":
|
|
215
|
-
case "*":
|
|
216
|
-
return "*";
|
|
217
|
-
}
|
|
218
|
-
})
|
|
219
|
-
.join("/");
|
|
220
|
-
return [joined ? "/" + joined : "/"];
|
|
221
|
-
}
|
|
222
|
-
/**
|
|
223
|
-
* Alias for toReactRouter.
|
|
224
|
-
*
|
|
225
|
-
* @see https://reactrouter.com/start/framework/routing
|
|
226
|
-
*/
|
|
227
|
-
export const toRemix = toReactRouter;
|
|
228
|
-
/**
|
|
229
|
-
* Converts to Remix file-based route naming convention.
|
|
230
|
-
*
|
|
231
|
-
* Returns a file path segment (without extension) for Remix's
|
|
232
|
-
* flat file routing convention.
|
|
233
|
-
*
|
|
234
|
-
* @see https://remix.run/docs/file-conventions/routes
|
|
235
|
-
*
|
|
236
|
-
* - `:param` → `$param`
|
|
237
|
-
* - `:param?` → `($param)`
|
|
238
|
-
* - `:param+` → `$` (splat)
|
|
239
|
-
* - `:param*` → `($)` (optional splat) - Note: not officially supported
|
|
240
|
-
*/
|
|
241
|
-
export function toRemixFile(path) {
|
|
242
|
-
const segments = path.split("/").filter(Boolean);
|
|
243
|
-
const mapped = segments.map((seg) => {
|
|
244
|
-
if (!seg.startsWith(":"))
|
|
245
|
-
return seg;
|
|
246
|
-
const name = getParamName(seg);
|
|
247
|
-
const modifier = getModifier(seg);
|
|
248
|
-
switch (modifier) {
|
|
249
|
-
case "":
|
|
250
|
-
return `$${name}`;
|
|
251
|
-
case "?":
|
|
252
|
-
return `($${name})`;
|
|
253
|
-
case "+":
|
|
254
|
-
return "$";
|
|
255
|
-
case "*":
|
|
256
|
-
return "($)";
|
|
257
|
-
}
|
|
258
|
-
});
|
|
259
|
-
return mapped.join(".");
|
|
260
|
-
}
|
|
261
|
-
/**
|
|
262
|
-
* Converts to TanStack Router path/file pattern.
|
|
263
|
-
*
|
|
264
|
-
* TanStack uses the same `$param` syntax for both route paths and file names.
|
|
265
|
-
* Returns a dot-separated file name (without extension).
|
|
266
|
-
*
|
|
267
|
-
* @see https://tanstack.com/router/v1/docs/framework/react/guide/path-params
|
|
268
|
-
* @see https://tanstack.com/router/v1/docs/framework/react/routing/file-naming-conventions
|
|
269
|
-
*
|
|
270
|
-
* - `:param` → `$param`
|
|
271
|
-
* - `:param?` → `{-$param}` (optional segment)
|
|
272
|
-
* - `:param+` → `$` (splat)
|
|
273
|
-
* - `:param*` → `$` (splat, optional not supported - treated as required)
|
|
274
|
-
*/
|
|
275
|
-
export function toTanStack(path) {
|
|
276
|
-
const segments = path.split("/").filter(Boolean);
|
|
277
|
-
const mapped = segments.map((seg) => {
|
|
278
|
-
if (!seg.startsWith(":"))
|
|
279
|
-
return seg;
|
|
280
|
-
const name = getParamName(seg);
|
|
281
|
-
const modifier = getModifier(seg);
|
|
282
|
-
switch (modifier) {
|
|
283
|
-
case "":
|
|
284
|
-
return `$${name}`;
|
|
285
|
-
case "?":
|
|
286
|
-
return `{-$${name}}`;
|
|
287
|
-
case "+":
|
|
288
|
-
return "$";
|
|
289
|
-
case "*":
|
|
290
|
-
return "$";
|
|
291
|
-
}
|
|
292
|
-
});
|
|
293
|
-
return mapped.join(".");
|
|
294
|
-
}
|
|
295
|
-
/**
|
|
296
|
-
* Converts to Hono path pattern.
|
|
297
|
-
*
|
|
298
|
-
* Hono uses unnamed wildcards - they are NOT accessible via c.req.param().
|
|
299
|
-
* Use c.req.path to access the matched path for wildcard routes.
|
|
300
|
-
*
|
|
301
|
-
* @see https://hono.dev/docs/api/routing
|
|
302
|
-
*
|
|
303
|
-
* - `:param` → `:param`
|
|
304
|
-
* - `:param?` → `:param?`
|
|
305
|
-
* - `:param+` → `*` (unnamed, required)
|
|
306
|
-
* - `:param*` → `/`, `/*` (unnamed, optional - two routes)
|
|
307
|
-
*/
|
|
308
|
-
export function toHono(path) {
|
|
309
|
-
const segments = path.split("/").filter(Boolean);
|
|
310
|
-
const optionalWildcardIndex = segments.findIndex((s) => s.startsWith(":") && s.endsWith("*"));
|
|
311
|
-
if (optionalWildcardIndex !== -1) {
|
|
312
|
-
const before = segments.slice(0, optionalWildcardIndex);
|
|
313
|
-
const beforeJoined = before
|
|
314
|
-
.map((s) => {
|
|
315
|
-
if (!s.startsWith(":"))
|
|
316
|
-
return s;
|
|
317
|
-
const name = getParamName(s);
|
|
318
|
-
const modifier = getModifier(s);
|
|
319
|
-
return modifier === "?" ? `:${name}?` : `:${name}`;
|
|
320
|
-
})
|
|
321
|
-
.join("/");
|
|
322
|
-
const basePath = beforeJoined ? "/" + beforeJoined : "/";
|
|
323
|
-
const withWildcard = basePath === "/" ? "/*" : basePath + "/*";
|
|
324
|
-
return [basePath, withWildcard];
|
|
325
|
-
}
|
|
326
|
-
const joined = segments
|
|
327
|
-
.map((s) => {
|
|
328
|
-
if (!s.startsWith(":"))
|
|
329
|
-
return s;
|
|
330
|
-
const name = getParamName(s);
|
|
331
|
-
const modifier = getModifier(s);
|
|
332
|
-
switch (modifier) {
|
|
333
|
-
case "":
|
|
334
|
-
return `:${name}`;
|
|
335
|
-
case "?":
|
|
336
|
-
return `:${name}?`;
|
|
337
|
-
case "+":
|
|
338
|
-
case "*":
|
|
339
|
-
return "*";
|
|
340
|
-
}
|
|
341
|
-
})
|
|
342
|
-
.join("/");
|
|
343
|
-
return [joined ? "/" + joined : "/"];
|
|
344
|
-
}
|
|
345
|
-
/**
|
|
346
|
-
* Converts to Effect HttpRouter / find-my-way path pattern.
|
|
347
|
-
*
|
|
348
|
-
* Effect uses colon-style params with unnamed wildcards.
|
|
349
|
-
*
|
|
350
|
-
* @see https://effect.website/docs/platform/http-router
|
|
351
|
-
*
|
|
352
|
-
* - `:param` → `:param`
|
|
353
|
-
* - `:param?` → `:param?`
|
|
354
|
-
* - `:param+` → `*` (unnamed)
|
|
355
|
-
* - `:param*` → `/`, `/*` (two routes)
|
|
356
|
-
*/
|
|
357
|
-
export function toEffect(path) {
|
|
358
|
-
return toHono(path);
|
|
359
|
-
}
|
|
360
|
-
/**
|
|
361
|
-
* Converts to Bun.serve path pattern.
|
|
362
|
-
*
|
|
363
|
-
* Since Bun doesn't support optional params (`:param?`), optional segments
|
|
364
|
-
* are expanded into multiple routes.
|
|
365
|
-
*
|
|
366
|
-
* @see https://bun.sh/docs/api/http#routing
|
|
367
|
-
*
|
|
368
|
-
* - `:param` → `:param`
|
|
369
|
-
* - `:param?` → `/`, `/:param` (two routes)
|
|
370
|
-
* - `:param+` → `/*`
|
|
371
|
-
* - `:param*` → `/`, `/*` (two routes)
|
|
372
|
-
*/
|
|
373
|
-
export function toBun(path) {
|
|
374
|
-
const segments = path.split("/").filter(Boolean);
|
|
375
|
-
const optionalIndex = segments.findIndex((s) => s.startsWith(":") && (s.endsWith("?") || s.endsWith("*")));
|
|
376
|
-
if (optionalIndex === -1) {
|
|
377
|
-
const joined = segments
|
|
378
|
-
.map((s) => {
|
|
379
|
-
if (!s.startsWith(":"))
|
|
380
|
-
return s;
|
|
381
|
-
const modifier = getModifier(s);
|
|
382
|
-
const name = getParamName(s);
|
|
383
|
-
return modifier === "+" || modifier === "*" ? "*" : `:${name}`;
|
|
384
|
-
})
|
|
385
|
-
.join("/");
|
|
386
|
-
return [joined ? `/${joined}` : "/"];
|
|
387
|
-
}
|
|
388
|
-
const before = segments.slice(0, optionalIndex);
|
|
389
|
-
const optional = segments[optionalIndex];
|
|
390
|
-
const after = segments.slice(optionalIndex + 1);
|
|
391
|
-
const formatSegment = (s) => {
|
|
392
|
-
if (!s.startsWith(":"))
|
|
393
|
-
return s;
|
|
394
|
-
const modifier = getModifier(s);
|
|
395
|
-
const name = getParamName(s);
|
|
396
|
-
switch (modifier) {
|
|
397
|
-
case "":
|
|
398
|
-
case "?":
|
|
399
|
-
return `:${name}`;
|
|
400
|
-
case "+":
|
|
401
|
-
case "*":
|
|
402
|
-
return "*";
|
|
403
|
-
}
|
|
404
|
-
};
|
|
405
|
-
const beforePath = before.map(formatSegment).join("/");
|
|
406
|
-
const basePath = beforePath ? `/${beforePath}` : "/";
|
|
407
|
-
const optionalModifier = getModifier(optional);
|
|
408
|
-
const optionalName = getParamName(optional);
|
|
409
|
-
const requiredOptional = optionalModifier === "*" ? `:${optionalName}+` : `:${optionalName}`;
|
|
410
|
-
const withOptionalSegments = [...before, requiredOptional, ...after];
|
|
411
|
-
const withOptionalPath = `/${withOptionalSegments.map(formatSegment).join("/")}`;
|
|
412
|
-
return [...toBun(basePath), ...toBun(withOptionalPath)];
|
|
413
|
-
}
|
package/dist/PlatformError.d.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import type * as Cause from "effect/Cause";
|
|
2
|
-
import type * as Types from "effect/Types";
|
|
3
|
-
export declare const TypeId: unique symbol;
|
|
4
|
-
export type TypeId = typeof TypeId;
|
|
5
|
-
export declare const isPlatformError: (u: unknown) => u is PlatformError;
|
|
6
|
-
export declare const TypeIdError: <const TypeId extends symbol, const Tag extends string>(typeId: TypeId, tag: Tag) => (new <A extends Record<string, any>>(args: Types.Simplify<A>) => Cause.YieldableError & Record<TypeId, TypeId> & {
|
|
7
|
-
readonly _tag: Tag;
|
|
8
|
-
} & Readonly<A>);
|
|
9
|
-
export type SystemErrorReason = "AlreadyExists" | "BadResource" | "Busy" | "InvalidData" | "NotFound" | "PermissionDenied" | "TimedOut" | "UnexpectedEof" | "Unknown" | "WouldBlock" | "WriteZero";
|
|
10
|
-
declare const BadArgument_base: new <A extends Record<string, any> = {}>(args: Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => Cause.YieldableError & {
|
|
11
|
-
readonly _tag: "BadArgument";
|
|
12
|
-
} & Readonly<A>;
|
|
13
|
-
export declare class BadArgument extends BadArgument_base<{
|
|
14
|
-
module: string;
|
|
15
|
-
method: string;
|
|
16
|
-
description?: string | undefined;
|
|
17
|
-
cause?: unknown;
|
|
18
|
-
}> {
|
|
19
|
-
readonly [TypeId]: typeof TypeId;
|
|
20
|
-
get message(): string;
|
|
21
|
-
}
|
|
22
|
-
declare const SystemError_base: new <A extends Record<string, any> = {}>(args: Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => Cause.YieldableError & {
|
|
23
|
-
readonly _tag: "SystemError";
|
|
24
|
-
} & Readonly<A>;
|
|
25
|
-
export declare class SystemError extends SystemError_base<{
|
|
26
|
-
reason: SystemErrorReason;
|
|
27
|
-
module: string;
|
|
28
|
-
method: string;
|
|
29
|
-
description?: string | undefined;
|
|
30
|
-
syscall?: string | undefined;
|
|
31
|
-
pathOrDescriptor?: string | number | undefined;
|
|
32
|
-
cause?: unknown;
|
|
33
|
-
}> {
|
|
34
|
-
readonly [TypeId]: typeof TypeId;
|
|
35
|
-
get message(): string;
|
|
36
|
-
}
|
|
37
|
-
export type PlatformError = BadArgument | SystemError;
|
|
38
|
-
export {};
|
package/dist/PlatformError.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import * as Data from "effect/Data";
|
|
2
|
-
import * as Predicate from "effect/Predicate";
|
|
3
|
-
export const TypeId = Symbol.for("@effect/platform/Error/PlatformError");
|
|
4
|
-
export const isPlatformError = (u) => Predicate.hasProperty(u, TypeId);
|
|
5
|
-
export const TypeIdError = (typeId, tag) => {
|
|
6
|
-
class Base extends Data.Error {
|
|
7
|
-
_tag = tag;
|
|
8
|
-
}
|
|
9
|
-
;
|
|
10
|
-
Base.prototype[typeId] = typeId;
|
|
11
|
-
Base.prototype.name = tag;
|
|
12
|
-
return Base;
|
|
13
|
-
};
|
|
14
|
-
export class BadArgument extends Data.TaggedError("BadArgument") {
|
|
15
|
-
[TypeId] = TypeId;
|
|
16
|
-
get message() {
|
|
17
|
-
return `${this.module}.${this.method}${this.description ? `: ${this.description}` : ""}`;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
export class SystemError extends Data.TaggedError("SystemError") {
|
|
21
|
-
[TypeId] = TypeId;
|
|
22
|
-
get message() {
|
|
23
|
-
return `${this.reason}: ${this.module}.${this.method}${this.pathOrDescriptor !== undefined ? ` (${this.pathOrDescriptor})` : ""}${this.description ? `: ${this.description}` : ""}`;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import * as Effect from "effect/Effect";
|
|
2
|
-
import * as Exit from "effect/Exit";
|
|
3
|
-
import type * as Fiber from "effect/Fiber";
|
|
4
|
-
export interface Teardown {
|
|
5
|
-
<E, A>(exit: Exit.Exit<E, A>, onExit: (code: number) => void): void;
|
|
6
|
-
}
|
|
7
|
-
export declare const defaultTeardown: Teardown;
|
|
8
|
-
export interface RunMain {
|
|
9
|
-
(options?: {
|
|
10
|
-
readonly disableErrorReporting?: boolean | undefined;
|
|
11
|
-
readonly disablePrettyLogger?: boolean | undefined;
|
|
12
|
-
readonly teardown?: Teardown | undefined;
|
|
13
|
-
}): <E, A>(effect: Effect.Effect<A, E>) => void;
|
|
14
|
-
<E, A>(effect: Effect.Effect<A, E>, options?: {
|
|
15
|
-
readonly disableErrorReporting?: boolean | undefined;
|
|
16
|
-
readonly disablePrettyLogger?: boolean | undefined;
|
|
17
|
-
readonly teardown?: Teardown | undefined;
|
|
18
|
-
}): void;
|
|
19
|
-
}
|
|
20
|
-
export declare const makeRunMain: (f: <E, A>(options: {
|
|
21
|
-
readonly fiber: Fiber.RuntimeFiber<A, E>;
|
|
22
|
-
readonly teardown: Teardown;
|
|
23
|
-
}) => void) => RunMain;
|
|
24
|
-
/**
|
|
25
|
-
* Are we running within an agent harness, like Claude Code?
|
|
26
|
-
*/
|
|
27
|
-
export declare function isAgentHarness(): string | false | undefined;
|