effect-start 0.21.0 → 0.22.1
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 -4
- package/dist/Cookies.js +392 -0
- package/dist/FileSystem.js +131 -0
- package/dist/Socket.js +37 -0
- package/package.json +34 -36
- package/src/Commander.ts +73 -130
- package/src/ContentNegotiation.ts +64 -95
- package/src/Cookies.ts +36 -57
- package/src/Development.ts +47 -62
- package/src/Effectify.ts +222 -206
- package/src/Entity.ts +59 -86
- package/src/FilePathPattern.ts +5 -5
- package/src/FileRouter.ts +37 -62
- package/src/FileRouterCodegen.ts +63 -55
- package/src/FileSystem.ts +46 -59
- package/src/Http.ts +17 -50
- package/src/PathPattern.ts +33 -41
- package/src/PlatformError.ts +29 -50
- package/src/PlatformRuntime.ts +39 -47
- package/src/Route.ts +68 -187
- package/src/RouteBody.ts +45 -161
- package/src/RouteHook.ts +22 -45
- package/src/RouteHttp.ts +88 -142
- package/src/RouteHttpTracer.ts +25 -26
- package/src/RouteMount.ts +100 -238
- package/src/RouteSchema.ts +67 -201
- package/src/RouteSse.ts +28 -82
- package/src/RouteTree.ts +31 -79
- package/src/RouteTrie.ts +13 -32
- package/src/SchemaExtra.ts +3 -5
- package/src/Socket.ts +5 -2
- package/src/Start.ts +20 -21
- package/src/StreamExtra.ts +93 -96
- package/src/TuplePathPattern.ts +54 -43
- package/src/Unique.ts +9 -15
- package/src/Values.ts +26 -30
- package/src/bun/BunBundle.ts +27 -73
- package/src/bun/BunImportTrackerPlugin.ts +67 -65
- package/src/bun/BunRoute.ts +12 -31
- package/src/bun/BunRuntime.ts +3 -10
- package/src/bun/BunServer.ts +55 -91
- package/src/bun/BunVirtualFilesPlugin.ts +1 -4
- package/src/bun/_BunEnhancedResolve.ts +17 -42
- package/src/bun/_empty.html +0 -1
- package/src/bundler/Bundle.ts +20 -36
- package/src/bundler/BundleFiles.ts +35 -55
- package/src/client/Overlay.ts +1 -2
- package/src/client/ScrollState.ts +5 -9
- package/src/client/index.ts +10 -13
- package/src/datastar/actions/fetch.ts +29 -48
- package/src/datastar/actions/peek.ts +1 -5
- package/src/datastar/actions/setAll.ts +2 -2
- package/src/datastar/actions/toggleAll.ts +2 -2
- package/src/datastar/attributes/attr.ts +17 -18
- package/src/datastar/attributes/bind.ts +41 -61
- package/src/datastar/attributes/class.ts +2 -5
- package/src/datastar/attributes/computed.ts +2 -10
- package/src/datastar/attributes/effect.ts +1 -2
- package/src/datastar/attributes/indicator.ts +2 -8
- package/src/datastar/attributes/init.ts +2 -10
- package/src/datastar/attributes/jsonSignals.ts +1 -6
- package/src/datastar/attributes/on.ts +4 -13
- package/src/datastar/attributes/onIntersect.ts +10 -22
- package/src/datastar/attributes/onInterval.ts +2 -10
- package/src/datastar/attributes/onSignalPatch.ts +18 -28
- package/src/datastar/attributes/ref.ts +1 -2
- package/src/datastar/attributes/show.ts +1 -2
- package/src/datastar/attributes/signals.ts +1 -5
- package/src/datastar/attributes/style.ts +6 -12
- package/src/datastar/attributes/text.ts +1 -2
- package/src/datastar/engine.ts +102 -158
- package/src/datastar/index.ts +2 -2
- package/src/datastar/utils.ts +16 -51
- package/src/datastar/watchers/patchElements.ts +35 -93
- package/src/datastar/watchers/patchSignals.ts +1 -2
- package/src/experimental/EncryptedCookies.ts +79 -142
- package/src/hyper/Hyper.ts +14 -33
- package/src/hyper/HyperHtml.ts +9 -10
- package/src/hyper/HyperNode.ts +2 -7
- package/src/hyper/HyperRoute.ts +2 -5
- package/src/hyper/jsx-runtime.ts +2 -10
- package/src/hyper/jsx.d.ts +171 -440
- package/src/lint/plugin.js +276 -0
- package/src/node/NodeFileSystem.ts +138 -186
- package/src/node/NodeUtils.ts +1 -3
- package/src/testing/TestLogger.ts +9 -22
- package/src/testing/utils.ts +30 -31
- package/src/x/cloudflare/CloudflareTunnel.ts +37 -54
- package/src/x/datastar/Datastar.ts +3 -10
- package/src/x/datastar/index.ts +1 -3
- package/src/x/datastar/jsx-datastar.d.ts +1 -4
- package/src/x/tailwind/TailwindPlugin.ts +119 -112
- package/src/x/tailwind/compile.ts +10 -33
- package/src/x/tailwind/plugin.ts +2 -2
package/src/hyper/Hyper.ts
CHANGED
|
@@ -2,26 +2,23 @@ import * as Context from "effect/Context"
|
|
|
2
2
|
import * as Fiber from "effect/Fiber"
|
|
3
3
|
import * as Layer from "effect/Layer"
|
|
4
4
|
import * as Option from "effect/Option"
|
|
5
|
-
import { HyperHooks } from "../x/datastar/index.ts"
|
|
5
|
+
import type { HyperHooks } from "../x/datastar/index.ts"
|
|
6
6
|
import type { JSX } from "./jsx.d.ts"
|
|
7
7
|
|
|
8
8
|
type Elements = JSX.IntrinsicElements
|
|
9
9
|
|
|
10
10
|
type Children = JSX.Children
|
|
11
11
|
|
|
12
|
-
export type {
|
|
13
|
-
Children,
|
|
14
|
-
Elements,
|
|
15
|
-
JSX,
|
|
16
|
-
}
|
|
12
|
+
export type { Children, Elements, JSX }
|
|
17
13
|
|
|
18
|
-
export class Hyper extends Context.Tag("Hyper")<
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
export class Hyper extends Context.Tag("Hyper")<
|
|
15
|
+
Hyper,
|
|
16
|
+
{
|
|
17
|
+
hooks: typeof HyperHooks | undefined
|
|
18
|
+
}
|
|
19
|
+
>() {}
|
|
21
20
|
|
|
22
|
-
export function layer(opts: {
|
|
23
|
-
hooks: typeof HyperHooks
|
|
24
|
-
}) {
|
|
21
|
+
export function layer(opts: { hooks: typeof HyperHooks }) {
|
|
25
22
|
return Layer.sync(Hyper, () => {
|
|
26
23
|
return {
|
|
27
24
|
hooks: opts.hooks,
|
|
@@ -36,28 +33,17 @@ type Primitive = string | number | boolean | null | undefined
|
|
|
36
33
|
export type HyperType = string | HyperComponent
|
|
37
34
|
|
|
38
35
|
export type HyperProps = {
|
|
39
|
-
[key: string]:
|
|
40
|
-
| Primitive
|
|
41
|
-
| ReadonlyArray<Primitive>
|
|
42
|
-
| HyperNode
|
|
43
|
-
| HyperNode[]
|
|
44
|
-
| null
|
|
45
|
-
| undefined
|
|
36
|
+
[key: string]: Primitive | ReadonlyArray<Primitive> | HyperNode | HyperNode[] | null | undefined
|
|
46
37
|
}
|
|
47
38
|
|
|
48
|
-
export type HyperComponent = (
|
|
49
|
-
props: HyperProps,
|
|
50
|
-
) => HyperNode | Primitive
|
|
39
|
+
export type HyperComponent = (props: HyperProps) => HyperNode | Primitive
|
|
51
40
|
|
|
52
41
|
export interface HyperNode {
|
|
53
42
|
type: HyperType
|
|
54
43
|
props: HyperProps
|
|
55
44
|
}
|
|
56
45
|
|
|
57
|
-
export function h(
|
|
58
|
-
type: HyperType,
|
|
59
|
-
props: HyperProps,
|
|
60
|
-
): HyperNode {
|
|
46
|
+
export function h(type: HyperType, props: HyperProps): HyperNode {
|
|
61
47
|
return {
|
|
62
48
|
type,
|
|
63
49
|
props: {
|
|
@@ -68,9 +54,7 @@ export function h(
|
|
|
68
54
|
}
|
|
69
55
|
|
|
70
56
|
export function unsafeUse<Value>(tag: Context.Tag<any, Value>) {
|
|
71
|
-
const currentFiber = Option.getOrThrow(
|
|
72
|
-
Fiber.getCurrentFiber(),
|
|
73
|
-
)
|
|
57
|
+
const currentFiber = Option.getOrThrow(Fiber.getCurrentFiber())
|
|
74
58
|
const context = currentFiber.currentContext
|
|
75
59
|
|
|
76
60
|
return Context.unsafeGet(context, tag)
|
|
@@ -82,8 +66,5 @@ export type GenericJsxObject = {
|
|
|
82
66
|
}
|
|
83
67
|
|
|
84
68
|
export function isGenericJsxObject(value: unknown): value is GenericJsxObject {
|
|
85
|
-
return typeof value === "object"
|
|
86
|
-
&& value !== null
|
|
87
|
-
&& "type" in value
|
|
88
|
-
&& "props" in value
|
|
69
|
+
return typeof value === "object" && value !== null && "type" in value && "props" in value
|
|
89
70
|
}
|
package/src/hyper/HyperHtml.ts
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
20
|
import type * as Hyper from "./Hyper.ts"
|
|
21
|
-
import * as HyperNode from "./HyperNode.ts"
|
|
21
|
+
import type * as HyperNode from "./HyperNode.ts"
|
|
22
22
|
import type * as JsxRuntime from "./jsx-runtime.ts"
|
|
23
23
|
import type { JSX } from "./jsx.d.ts"
|
|
24
24
|
|
|
@@ -47,7 +47,7 @@ let map = {
|
|
|
47
47
|
"&": "amp",
|
|
48
48
|
"<": "lt",
|
|
49
49
|
">": "gt",
|
|
50
|
-
"
|
|
50
|
+
'"': "quot",
|
|
51
51
|
"'": "apos",
|
|
52
52
|
}
|
|
53
53
|
|
|
@@ -57,7 +57,7 @@ export function renderToString(
|
|
|
57
57
|
node: JSX.Children,
|
|
58
58
|
hooks?: { onNode?: (node: HyperNode.HyperNode) => void },
|
|
59
59
|
): string {
|
|
60
|
-
const stack: any
|
|
60
|
+
const stack: Array<any> = [node]
|
|
61
61
|
let result = ""
|
|
62
62
|
|
|
63
63
|
while (stack.length > 0) {
|
|
@@ -112,11 +112,11 @@ export function renderToString(
|
|
|
112
112
|
|
|
113
113
|
for (const key in props) {
|
|
114
114
|
if (
|
|
115
|
-
key !== "children"
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
115
|
+
key !== "children" &&
|
|
116
|
+
key !== "innerHTML" && // Solid-specific
|
|
117
|
+
key !== "dangerouslySetInnerHTML" && // React-specific
|
|
118
|
+
props[key] !== false &&
|
|
119
|
+
props[key] != null
|
|
120
120
|
) {
|
|
121
121
|
if (props[key] === true) {
|
|
122
122
|
result += ` ${esc(key)}`
|
|
@@ -139,8 +139,7 @@ export function renderToString(
|
|
|
139
139
|
stack.push(`</${type}>`)
|
|
140
140
|
|
|
141
141
|
// React-specific
|
|
142
|
-
const html = props.dangerouslySetInnerHTML?.__html
|
|
143
|
-
?? props.innerHTML
|
|
142
|
+
const html = props.dangerouslySetInnerHTML?.__html ?? props.innerHTML
|
|
144
143
|
|
|
145
144
|
if (html) {
|
|
146
145
|
result += html
|
package/src/hyper/HyperNode.ts
CHANGED
|
@@ -16,19 +16,14 @@ export type Props = {
|
|
|
16
16
|
| ((window: Window) => void)
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
export type HyperComponent = (
|
|
20
|
-
props: Props,
|
|
21
|
-
) => HyperNode | Primitive
|
|
19
|
+
export type HyperComponent = (props: Props) => HyperNode | Primitive
|
|
22
20
|
|
|
23
21
|
export interface HyperNode {
|
|
24
22
|
type: Type
|
|
25
23
|
props: Props
|
|
26
24
|
}
|
|
27
25
|
|
|
28
|
-
export function make(
|
|
29
|
-
type: Type,
|
|
30
|
-
props: Props,
|
|
31
|
-
): HyperNode {
|
|
26
|
+
export function make(type: Type, props: Props): HyperNode {
|
|
32
27
|
return {
|
|
33
28
|
type,
|
|
34
29
|
props: {
|
package/src/hyper/HyperRoute.ts
CHANGED
|
@@ -31,7 +31,7 @@ function normalizeToEffect<B, A, E, R>(
|
|
|
31
31
|
if (Effect.isEffect(result)) {
|
|
32
32
|
return result as Effect.Effect<A | Entity.Entity<A>, E, R>
|
|
33
33
|
}
|
|
34
|
-
return Effect.gen(function*() {
|
|
34
|
+
return Effect.gen(function* () {
|
|
35
35
|
return yield* result
|
|
36
36
|
}) as Effect.Effect<A | Entity.Entity<A>, E, R>
|
|
37
37
|
}
|
|
@@ -53,9 +53,6 @@ export function html<
|
|
|
53
53
|
>,
|
|
54
54
|
) {
|
|
55
55
|
return Route.html<D, B, I, string, E, R>((context, next) =>
|
|
56
|
-
Effect.map(
|
|
57
|
-
normalizeToEffect(handler, context, next as never),
|
|
58
|
-
renderValue,
|
|
59
|
-
)
|
|
56
|
+
Effect.map(normalizeToEffect(handler, context, next as never), renderValue),
|
|
60
57
|
)
|
|
61
58
|
}
|
package/src/hyper/jsx-runtime.ts
CHANGED
|
@@ -7,17 +7,9 @@ function Fragment(props: { children: JSX.Element }) {
|
|
|
7
7
|
|
|
8
8
|
function jsx<T extends HyperNode.Type>(
|
|
9
9
|
type: T,
|
|
10
|
-
props: T extends string ? HyperNode.Props
|
|
11
|
-
: T extends (props: infer P) => any ? P
|
|
12
|
-
: never,
|
|
10
|
+
props: T extends string ? HyperNode.Props : T extends (props: infer P) => any ? P : never,
|
|
13
11
|
): HyperNode.HyperNode {
|
|
14
12
|
return HyperNode.make(type, props)
|
|
15
13
|
}
|
|
16
14
|
|
|
17
|
-
export {
|
|
18
|
-
Fragment,
|
|
19
|
-
type JSX,
|
|
20
|
-
jsx,
|
|
21
|
-
jsx as jsxDEV,
|
|
22
|
-
jsx as jsxs,
|
|
23
|
-
}
|
|
15
|
+
export { Fragment, type JSX, jsx, jsx as jsxDEV, jsx as jsxs }
|