effect-start 0.22.0 → 0.23.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/dist/BlobStore.d.ts +80 -0
- package/dist/BlobStore.js +19 -0
- package/dist/ChildProcess.d.ts +60 -0
- package/dist/ChildProcess.js +30 -0
- package/dist/Commander.d.ts +3 -6
- package/dist/Commander.js +6 -13
- package/dist/ContentNegotiation.d.ts +8 -9
- package/dist/ContentNegotiation.js +32 -37
- package/dist/Cookies.d.ts +47 -0
- package/dist/Cookies.js +273 -363
- package/dist/Development.d.ts +2 -2
- package/dist/Development.js +3 -4
- package/dist/Effectify.d.ts +1 -4
- package/dist/FilePathPattern.d.ts +3 -3
- package/dist/FileRouter.d.ts +5 -8
- package/dist/FileRouter.js +9 -10
- package/dist/FileRouterCodegen.d.ts +1 -1
- package/dist/FileRouterCodegen.js +33 -13
- package/dist/FileSystem.d.ts +158 -0
- package/dist/FileSystem.js +64 -125
- package/dist/Http.js +2 -6
- package/dist/PathPattern.d.ts +7 -7
- package/dist/PathPattern.js +1 -3
- package/dist/PlatformError.d.ts +24 -32
- package/dist/PlatformError.js +3 -21
- package/dist/PlatformRuntime.js +5 -10
- package/dist/Route.d.ts +14 -19
- package/dist/Route.js +8 -11
- package/dist/RouteBody.d.ts +6 -12
- package/dist/RouteBody.js +2 -2
- package/dist/RouteError.d.ts +98 -0
- package/dist/RouteError.js +55 -0
- package/dist/RouteHook.js +6 -11
- package/dist/RouteHttp.d.ts +3 -3
- package/dist/RouteHttp.js +27 -22
- package/dist/RouteMount.d.ts +16 -50
- package/dist/RouteMount.js +6 -20
- package/dist/RouteSchema.d.ts +22 -1
- package/dist/RouteSchema.js +33 -0
- package/dist/RouteSse.js +4 -10
- package/dist/RouteTree.d.ts +2 -1
- package/dist/RouteTree.js +17 -15
- package/dist/RouteTrie.d.ts +2 -2
- package/dist/RouteTrie.js +4 -9
- package/dist/SchemaExtra.d.ts +1 -1
- package/dist/Socket.d.ts +27 -0
- package/dist/Socket.js +20 -28
- package/dist/Sql.d.ts +34 -0
- package/dist/Sql.js +5 -0
- package/dist/SqlIntrospect.d.ts +91 -0
- package/dist/SqlIntrospect.js +466 -0
- package/dist/Start.d.ts +4 -6
- package/dist/Start.js +10 -2
- package/dist/StreamExtra.d.ts +1 -1
- package/dist/StreamExtra.js +9 -9
- package/dist/System.d.ts +7 -0
- package/dist/System.js +22 -0
- package/dist/TuplePathPattern.js +55 -50
- package/dist/Unique.js +7 -7
- package/dist/Values.d.ts +2 -1
- package/dist/Values.js +19 -13
- package/dist/bun/BunBlobStoreDisk.d.ts +6 -0
- package/dist/bun/BunBlobStoreDisk.js +116 -0
- package/dist/bun/BunBlobStoreS3.d.ts +11 -0
- package/dist/bun/BunBlobStoreS3.js +89 -0
- package/dist/bun/BunBlobWatcherDisk.d.ts +6 -0
- package/dist/bun/BunBlobWatcherDisk.js +60 -0
- package/dist/bun/BunBlobWatcherQueue.d.ts +6 -0
- package/dist/bun/BunBlobWatcherQueue.js +17 -0
- package/dist/bun/BunBundle.d.ts +5 -6
- package/dist/bun/BunBundle.js +7 -15
- package/dist/bun/BunChildProcessSpawner.d.ts +3 -0
- package/dist/bun/BunChildProcessSpawner.js +103 -0
- package/dist/bun/BunImportTrackerPlugin.d.ts +1 -1
- package/dist/bun/BunImportTrackerPlugin.js +3 -5
- package/dist/bun/BunRoute.d.ts +3 -2
- package/dist/bun/BunRoute.js +5 -7
- package/dist/bun/BunRuntime.js +1 -1
- package/dist/bun/BunServer.d.ts +11 -4
- package/dist/bun/BunServer.js +35 -11
- package/dist/bun/BunSql.d.ts +4 -0
- package/dist/bun/BunSql.js +81 -0
- package/dist/bun/_BunEnhancedResolve.d.ts +3 -3
- package/dist/bun/_BunEnhancedResolve.js +2 -4
- package/dist/bun/index.d.ts +1 -0
- package/dist/bun/index.js +1 -0
- package/dist/bundler/Bundle.d.ts +2 -1
- package/dist/bundler/Bundle.js +1 -1
- package/dist/bundler/BundleFiles.d.ts +5 -5
- package/dist/bundler/BundleFiles.js +10 -8
- package/dist/bundler/BundleRoute.d.ts +27 -0
- package/dist/bundler/BundleRoute.js +51 -0
- package/dist/client/ScrollState.js +2 -6
- package/dist/client/index.js +6 -8
- package/dist/console/Console.d.ts +6 -0
- package/dist/console/Console.js +26 -0
- package/dist/console/ConsoleErrors.d.ts +3 -0
- package/dist/console/ConsoleErrors.js +200 -0
- package/dist/console/ConsoleLogger.d.ts +3 -0
- package/dist/console/ConsoleLogger.js +47 -0
- package/dist/console/ConsoleMetrics.d.ts +3 -0
- package/dist/console/ConsoleMetrics.js +61 -0
- package/dist/console/ConsoleProcess.d.ts +3 -0
- package/dist/console/ConsoleProcess.js +49 -0
- package/dist/console/ConsoleStore.d.ts +144 -0
- package/dist/console/ConsoleStore.js +61 -0
- package/dist/console/ConsoleTracer.d.ts +3 -0
- package/dist/console/ConsoleTracer.js +94 -0
- package/dist/console/Simulation.d.ts +2 -0
- package/dist/console/Simulation.js +633 -0
- package/dist/console/index.d.ts +3 -0
- package/dist/console/index.js +3 -0
- package/dist/console/routes/errors/route.d.ts +10 -0
- package/dist/console/routes/errors/route.js +47 -0
- package/dist/console/routes/fiberDetail.d.ts +16 -0
- package/dist/console/routes/fiberDetail.js +38 -0
- package/dist/console/routes/fibers/route.d.ts +10 -0
- package/dist/console/routes/fibers/route.js +19 -0
- package/dist/console/routes/git/route.d.ts +11 -0
- package/dist/console/routes/git/route.js +33 -0
- package/dist/console/routes/layout.d.ts +9 -0
- package/dist/console/routes/layout.js +3 -0
- package/dist/console/routes/logs/route.d.ts +10 -0
- package/dist/console/routes/logs/route.js +32 -0
- package/dist/console/routes/metrics/route.d.ts +10 -0
- package/dist/console/routes/metrics/route.js +17 -0
- package/dist/console/routes/route.d.ts +6 -0
- package/dist/console/routes/route.js +5 -0
- package/dist/console/routes/routes/route.d.ts +6 -0
- package/dist/console/routes/routes/route.js +20 -0
- package/dist/console/routes/services/route.d.ts +6 -0
- package/dist/console/routes/services/route.js +12 -0
- package/dist/console/routes/system/route.d.ts +10 -0
- package/dist/console/routes/system/route.js +18 -0
- package/dist/console/routes/traceDetail.d.ts +16 -0
- package/dist/console/routes/traceDetail.js +14 -0
- package/dist/console/routes/traces/route.d.ts +10 -0
- package/dist/console/routes/traces/route.js +39 -0
- package/dist/console/routes/tree.d.ts +153 -0
- package/dist/console/routes/tree.js +29 -0
- package/dist/console/ui/Errors.d.ts +4 -0
- package/dist/console/ui/Errors.js +15 -0
- package/dist/console/ui/Fibers.d.ts +24 -0
- package/dist/console/ui/Fibers.js +121 -0
- package/dist/console/ui/Git.d.ts +20 -0
- package/dist/console/ui/Git.js +95 -0
- package/dist/console/ui/Logs.d.ts +4 -0
- package/dist/console/ui/Logs.js +25 -0
- package/dist/console/ui/Metrics.d.ts +4 -0
- package/dist/console/ui/Metrics.js +26 -0
- package/dist/console/ui/Routes.d.ts +8 -0
- package/dist/console/ui/Routes.js +70 -0
- package/dist/console/ui/Services.d.ts +10 -0
- package/dist/console/ui/Services.js +246 -0
- package/dist/console/ui/Shell.d.ts +10 -0
- package/dist/console/ui/Shell.js +7 -0
- package/dist/console/ui/System.d.ts +4 -0
- package/dist/console/ui/System.js +35 -0
- package/dist/console/ui/Traces.d.ts +12 -0
- package/dist/console/ui/Traces.js +179 -0
- package/dist/datastar/actions/fetch.d.ts +1 -1
- package/dist/datastar/actions/fetch.js +10 -18
- package/dist/datastar/actions/peek.js +1 -2
- package/dist/datastar/actions/setAll.js +1 -2
- package/dist/datastar/actions/toggleAll.js +1 -2
- package/dist/datastar/attributes/attr.js +1 -2
- package/dist/datastar/attributes/bind.js +10 -18
- package/dist/datastar/attributes/class.js +2 -5
- package/dist/datastar/attributes/computed.js +2 -3
- package/dist/datastar/attributes/effect.js +1 -2
- package/dist/datastar/attributes/indicator.js +2 -4
- package/dist/datastar/attributes/init.js +2 -3
- package/dist/datastar/attributes/jsonSignals.js +1 -2
- package/dist/datastar/attributes/on.js +41 -22
- package/dist/datastar/attributes/onIntersect.js +2 -3
- package/dist/datastar/attributes/onInterval.js +2 -3
- package/dist/datastar/attributes/onSignalPatch.js +2 -4
- package/dist/datastar/attributes/ref.js +1 -2
- package/dist/datastar/attributes/show.js +1 -2
- package/dist/datastar/attributes/signals.js +1 -2
- package/dist/datastar/attributes/style.js +6 -12
- package/dist/datastar/attributes/text.js +1 -2
- package/dist/datastar/engine.d.ts +13 -7
- package/dist/datastar/engine.js +76 -48
- package/dist/datastar/happydom.d.ts +1 -0
- package/dist/datastar/happydom.js +8 -0
- package/dist/datastar/index.d.ts +1 -1
- package/dist/datastar/index.js +1 -1
- package/dist/datastar/utils.js +4 -7
- package/dist/datastar/watchers/patchElements.js +24 -45
- package/dist/datastar/watchers/patchSignals.js +1 -2
- package/dist/experimental/EncryptedCookies.d.ts +2 -5
- package/dist/experimental/EncryptedCookies.js +17 -48
- package/dist/experimental/index.d.ts +0 -1
- package/dist/experimental/index.js +0 -1
- package/dist/hyper/Hyper.d.ts +2 -9
- package/dist/hyper/Hyper.js +1 -12
- package/dist/hyper/HyperHtml.d.ts +1 -1
- package/dist/hyper/HyperHtml.js +18 -12
- package/dist/hyper/HyperHtml.test.d.ts +1 -0
- package/dist/hyper/HyperHtml.test.js +197 -0
- package/dist/hyper/HyperRoute.test.js +14 -3
- package/dist/hyper/html.d.ts +11 -0
- package/dist/hyper/html.js +30 -0
- package/dist/hyper/index.d.ts +2 -0
- package/dist/hyper/index.js +1 -0
- package/dist/hyper/jsx-runtime.d.ts +1 -1
- package/dist/hyper/jsx-runtime.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/lint/plugin.d.ts +86 -0
- package/dist/lint/plugin.js +341 -0
- package/dist/node/NodeFileSystem.d.ts +2 -2
- package/dist/node/NodeFileSystem.js +4 -14
- package/dist/sql/bun/index.d.ts +3 -0
- package/dist/sql/bun/index.js +75 -0
- package/dist/sql/mssql/docker.d.ts +2 -0
- package/dist/sql/mssql/docker.js +67 -0
- package/dist/sql/mssql/index.d.ts +21 -0
- package/dist/sql/mssql/index.js +113 -0
- package/dist/testing/TestLogger.js +4 -1
- package/dist/testing/index.d.ts +0 -1
- package/dist/testing/index.js +0 -1
- package/dist/testing/utils.d.ts +3 -3
- package/dist/testing/utils.js +4 -4
- package/dist/x/cloudflare/CloudflareTunnel.d.ts +2 -5
- package/dist/x/cloudflare/CloudflareTunnel.js +14 -27
- package/dist/x/datastar/Datastar.d.ts +1 -1
- package/dist/x/datastar/Datastar.js +13 -12
- package/dist/x/datastar/index.d.ts +1 -2
- package/dist/x/datastar/index.js +1 -2
- package/dist/x/tailscale/TailscaleTunnel.d.ts +15 -0
- package/dist/x/tailscale/TailscaleTunnel.js +68 -0
- package/dist/x/tailscale/index.d.ts +1 -0
- package/dist/x/tailscale/index.js +1 -0
- package/dist/x/tailwind/TailwindPlugin.js +19 -19
- package/dist/x/tailwind/compile.d.ts +2 -2
- package/dist/x/tailwind/compile.js +2 -4
- package/package.json +22 -10
- package/src/ChildProcess.ts +145 -0
- package/src/PlatformError.ts +27 -50
- package/src/Route.ts +2 -2
- package/src/RouteError.ts +76 -0
- package/src/RouteHttp.ts +13 -5
- package/src/RouteSchema.ts +96 -1
- package/src/RouteTree.ts +12 -0
- package/src/Sql.ts +51 -0
- package/src/SqlIntrospect.ts +620 -0
- package/src/Start.ts +15 -3
- package/src/System.ts +43 -0
- package/src/Values.ts +7 -0
- package/src/bun/BunChildProcessSpawner.ts +143 -0
- package/src/bun/BunRoute.ts +5 -2
- package/src/bun/BunServer.ts +22 -1
- package/src/bun/index.ts +1 -0
- package/src/bundler/BundleRoute.ts +66 -0
- package/src/console/Console.ts +42 -0
- package/src/console/ConsoleErrors.ts +213 -0
- package/src/console/ConsoleLogger.ts +56 -0
- package/src/console/ConsoleMetrics.ts +72 -0
- package/src/console/ConsoleProcess.ts +59 -0
- package/src/console/ConsoleStore.ts +187 -0
- package/src/console/ConsoleTracer.ts +107 -0
- package/src/console/Simulation.ts +814 -0
- package/src/console/console.html +340 -0
- package/src/console/index.ts +3 -0
- package/src/console/routes/errors/route.tsx +97 -0
- package/src/console/routes/fiberDetail.tsx +54 -0
- package/src/console/routes/fibers/route.tsx +45 -0
- package/src/console/routes/git/route.tsx +64 -0
- package/src/console/routes/layout.tsx +4 -0
- package/src/console/routes/logs/route.tsx +77 -0
- package/src/console/routes/metrics/route.tsx +36 -0
- package/src/console/routes/route.tsx +8 -0
- package/src/console/routes/routes/route.tsx +30 -0
- package/src/console/routes/services/route.tsx +21 -0
- package/src/console/routes/system/route.tsx +43 -0
- package/src/console/routes/traceDetail.tsx +22 -0
- package/src/console/routes/traces/route.tsx +81 -0
- package/src/console/routes/tree.ts +30 -0
- package/src/console/ui/Errors.tsx +76 -0
- package/src/console/ui/Fibers.tsx +321 -0
- package/src/console/ui/Git.tsx +182 -0
- package/src/console/ui/Logs.tsx +46 -0
- package/src/console/ui/Metrics.tsx +78 -0
- package/src/console/ui/Routes.tsx +125 -0
- package/src/console/ui/Services.tsx +273 -0
- package/src/console/ui/Shell.tsx +62 -0
- package/src/console/ui/System.tsx +131 -0
- package/src/console/ui/Traces.tsx +426 -0
- package/src/datastar/README.md +6 -1
- package/src/datastar/actions/fetch.ts +0 -1
- package/src/datastar/attributes/on.ts +40 -20
- package/src/datastar/engine.ts +51 -0
- package/src/datastar/jsx.d.ts +79 -0
- package/src/hyper/Hyper.ts +1 -16
- package/src/hyper/HyperHtml.ts +6 -4
- package/src/hyper/HyperRoute.ts +2 -1
- package/src/hyper/html.ts +47 -0
- package/src/hyper/index.ts +2 -0
- package/src/hyper/jsx.d.ts +5 -3
- package/src/index.ts +1 -0
- package/src/lint/plugin.js +129 -0
- package/src/sql/bun/index.ts +147 -0
- package/src/sql/mssql/docker.ts +117 -0
- package/src/sql/mssql/index.ts +223 -0
- package/src/sql/mssql/mssql.d.ts +41 -0
- package/src/x/cloudflare/CloudflareTunnel.ts +8 -36
- package/src/x/tailscale/TailscaleTunnel.ts +113 -0
- package/src/x/tailscale/index.ts +1 -0
- package/src/x/datastar/Datastar.ts +0 -61
- package/src/x/datastar/index.ts +0 -2
- package/src/x/datastar/jsx-datastar.d.ts +0 -60
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { GlobalRegistrator } from "@happy-dom/global-registrator";
|
|
2
|
+
GlobalRegistrator.register();
|
|
3
|
+
// happy-dom doesn't define MathMLElement
|
|
4
|
+
if (typeof globalThis.MathMLElement === "undefined") {
|
|
5
|
+
;
|
|
6
|
+
globalThis.MathMLElement = class MathMLElement extends HTMLElement {
|
|
7
|
+
};
|
|
8
|
+
}
|
package/dist/datastar/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export * from "./engine.ts";
|
|
2
1
|
import "./actions/peek.ts";
|
|
3
2
|
import "./actions/setAll.ts";
|
|
4
3
|
import "./actions/toggleAll.ts";
|
|
@@ -22,3 +21,4 @@ import "./attributes/style.ts";
|
|
|
22
21
|
import "./attributes/text.ts";
|
|
23
22
|
import "./watchers/patchElements.ts";
|
|
24
23
|
import "./watchers/patchSignals.ts";
|
|
24
|
+
export * from "./engine.ts";
|
package/dist/datastar/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export * from "./engine.js";
|
|
2
1
|
import "./actions/peek.js";
|
|
3
2
|
import "./actions/setAll.js";
|
|
4
3
|
import "./actions/toggleAll.js";
|
|
@@ -22,3 +21,4 @@ import "./attributes/style.js";
|
|
|
22
21
|
import "./attributes/text.js";
|
|
23
22
|
import "./watchers/patchElements.js";
|
|
24
23
|
import "./watchers/patchSignals.js";
|
|
24
|
+
export * from "./engine.js";
|
package/dist/datastar/utils.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
/*********
|
|
2
2
|
* dom.ts
|
|
3
3
|
*********/
|
|
4
|
-
export const isHTMLOrSVG = (el) => el instanceof HTMLElement
|
|
5
|
-
|| el instanceof SVGElement
|
|
6
|
-
|| el instanceof MathMLElement;
|
|
4
|
+
export const isHTMLOrSVG = (el) => el instanceof HTMLElement || el instanceof SVGElement || el instanceof MathMLElement;
|
|
7
5
|
/*********
|
|
8
6
|
* math.ts
|
|
9
7
|
*********/
|
|
@@ -102,10 +100,9 @@ Object.hasOwn ?? Object.prototype.hasOwnProperty.call;
|
|
|
102
100
|
/*********
|
|
103
101
|
* paths.ts
|
|
104
102
|
*********/
|
|
105
|
-
export const isPojo = (obj) => obj !== null
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|| Object.getPrototypeOf(obj) === null);
|
|
103
|
+
export const isPojo = (obj) => obj !== null &&
|
|
104
|
+
typeof obj === "object" &&
|
|
105
|
+
(Object.getPrototypeOf(obj) === Object.prototype || Object.getPrototypeOf(obj) === null);
|
|
109
106
|
export const isEmpty = (obj) => {
|
|
110
107
|
for (const prop in obj) {
|
|
111
108
|
if (hasOwn(obj, prop)) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { watcher } from "../engine.js";
|
|
2
|
-
import { aliasify, isHTMLOrSVG, supportsViewTransitions
|
|
2
|
+
import { aliasify, isHTMLOrSVG, supportsViewTransitions } from "../utils.js";
|
|
3
3
|
const isValidType = (arr, value) => arr.includes(value);
|
|
4
4
|
const PATCH_MODES = [
|
|
5
5
|
"remove",
|
|
@@ -14,7 +14,7 @@ const PATCH_MODES = [
|
|
|
14
14
|
const NAMESPACES = ["html", "svg", "mathml"];
|
|
15
15
|
watcher({
|
|
16
16
|
name: "datastar-patch-elements",
|
|
17
|
-
apply(ctx, { selector = "", mode = "outer", namespace = "html", useViewTransition = "", elements = ""
|
|
17
|
+
apply(ctx, { selector = "", mode = "outer", namespace = "html", useViewTransition = "", elements = "" }) {
|
|
18
18
|
if (!isValidType(PATCH_MODES, mode)) {
|
|
19
19
|
throw ctx.error("PatchElementsInvalidMode", { mode });
|
|
20
20
|
}
|
|
@@ -44,17 +44,9 @@ const onPatchElements = ({ error }, { selector, mode, namespace, elements }) =>
|
|
|
44
44
|
const hasHtml = /<\/html>/.test(elementsWithSvgsRemoved);
|
|
45
45
|
const hasHead = /<\/head>/.test(elementsWithSvgsRemoved);
|
|
46
46
|
const hasBody = /<\/body>/.test(elementsWithSvgsRemoved);
|
|
47
|
-
const wrapperTag = namespace === "svg"
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
? "math"
|
|
51
|
-
: "";
|
|
52
|
-
const wrappedEls = wrapperTag
|
|
53
|
-
? `<${wrapperTag}>${elements}</${wrapperTag}>`
|
|
54
|
-
: elements;
|
|
55
|
-
const newDocument = new DOMParser().parseFromString(hasHtml || hasHead || hasBody
|
|
56
|
-
? elements
|
|
57
|
-
: `<body><template>${wrappedEls}</template></body>`, "text/html");
|
|
47
|
+
const wrapperTag = namespace === "svg" ? "svg" : namespace === "mathml" ? "math" : "";
|
|
48
|
+
const wrappedEls = wrapperTag ? `<${wrapperTag}>${elements}</${wrapperTag}>` : elements;
|
|
49
|
+
const newDocument = new DOMParser().parseFromString(hasHtml || hasHead || hasBody ? elements : `<body><template>${wrappedEls}</template></body>`, "text/html");
|
|
58
50
|
let newContent = document.createDocumentFragment();
|
|
59
51
|
if (hasHtml) {
|
|
60
52
|
newContent.appendChild(newDocument.documentElement);
|
|
@@ -70,10 +62,7 @@ const onPatchElements = ({ error }, { selector, mode, namespace, elements }) =>
|
|
|
70
62
|
newContent.appendChild(newDocument.body);
|
|
71
63
|
}
|
|
72
64
|
else if (wrapperTag) {
|
|
73
|
-
const wrapperEl = newDocument
|
|
74
|
-
.querySelector("template")
|
|
75
|
-
.content
|
|
76
|
-
.querySelector(wrapperTag);
|
|
65
|
+
const wrapperEl = newDocument.querySelector("template").content.querySelector(wrapperTag);
|
|
77
66
|
for (const child of wrapperEl.childNodes) {
|
|
78
67
|
newContent.appendChild(child);
|
|
79
68
|
}
|
|
@@ -119,9 +108,7 @@ for (const script of document.querySelectorAll("script")) {
|
|
|
119
108
|
scripts.add(script);
|
|
120
109
|
}
|
|
121
110
|
const execute = (target) => {
|
|
122
|
-
const elScripts = target instanceof HTMLScriptElement
|
|
123
|
-
? [target]
|
|
124
|
-
: target.querySelectorAll("script");
|
|
111
|
+
const elScripts = target instanceof HTMLScriptElement ? [target] : target.querySelectorAll("script");
|
|
125
112
|
for (const old of elScripts) {
|
|
126
113
|
if (!scripts.has(old)) {
|
|
127
114
|
const script = document.createElement("script");
|
|
@@ -175,11 +162,11 @@ ctxPantry.hidden = true;
|
|
|
175
162
|
const aliasedIgnoreMorph = aliasify("ignore-morph");
|
|
176
163
|
const aliasedIgnoreMorphAttr = `[${aliasedIgnoreMorph}]`;
|
|
177
164
|
const morph = (oldElt, newContent, mode = "outer") => {
|
|
178
|
-
if ((isHTMLOrSVG(oldElt)
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
165
|
+
if ((isHTMLOrSVG(oldElt) &&
|
|
166
|
+
isHTMLOrSVG(newContent) &&
|
|
167
|
+
oldElt.hasAttribute(aliasedIgnoreMorph) &&
|
|
168
|
+
newContent.hasAttribute(aliasedIgnoreMorph)) ||
|
|
169
|
+
oldElt.parentElement?.closest(aliasedIgnoreMorphAttr)) {
|
|
183
170
|
return;
|
|
184
171
|
}
|
|
185
172
|
const normalizedElt = document.createElement("div");
|
|
@@ -225,8 +212,7 @@ const morph = (oldElt, newContent, mode = "outer") => {
|
|
|
225
212
|
ctxPantry.remove();
|
|
226
213
|
};
|
|
227
214
|
const morphChildren = (oldParent, newParent, insertionPoint = null, endPoint = null) => {
|
|
228
|
-
if (oldParent instanceof HTMLTemplateElement
|
|
229
|
-
&& newParent instanceof HTMLTemplateElement) {
|
|
215
|
+
if (oldParent instanceof HTMLTemplateElement && newParent instanceof HTMLTemplateElement) {
|
|
230
216
|
oldParent = oldParent.content;
|
|
231
217
|
newParent = newParent.content;
|
|
232
218
|
}
|
|
@@ -332,14 +318,11 @@ const findBestMatch = (node, startPoint, endPoint) => {
|
|
|
332
318
|
}
|
|
333
319
|
return bestMatch || null;
|
|
334
320
|
};
|
|
335
|
-
const isSoftMatch = (oldNode, newNode) => oldNode.nodeType === newNode.nodeType
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|| oldNode.id === newNode.id);
|
|
321
|
+
const isSoftMatch = (oldNode, newNode) => oldNode.nodeType === newNode.nodeType &&
|
|
322
|
+
oldNode.tagName === newNode.tagName &&
|
|
323
|
+
(!oldNode.id || oldNode.id === newNode.id);
|
|
339
324
|
const removeNode = (node) => {
|
|
340
|
-
ctxIdMap.has(node)
|
|
341
|
-
? moveBefore(ctxPantry, node, null)
|
|
342
|
-
: node.parentNode?.removeChild(node);
|
|
325
|
+
ctxIdMap.has(node) ? moveBefore(ctxPantry, node, null) : node.parentNode?.removeChild(node);
|
|
343
326
|
};
|
|
344
327
|
const moveBefore =
|
|
345
328
|
// @ts-expect-error
|
|
@@ -351,19 +334,17 @@ const morphNode = (oldNode, newNode) => {
|
|
|
351
334
|
const oldElt = oldNode;
|
|
352
335
|
const newElt = newNode;
|
|
353
336
|
const shouldScopeChildren = oldElt.hasAttribute("data-scope-children");
|
|
354
|
-
if (oldElt.hasAttribute(aliasedIgnoreMorph)
|
|
355
|
-
&& newElt.hasAttribute(aliasedIgnoreMorph)) {
|
|
337
|
+
if (oldElt.hasAttribute(aliasedIgnoreMorph) && newElt.hasAttribute(aliasedIgnoreMorph)) {
|
|
356
338
|
return oldNode;
|
|
357
339
|
}
|
|
358
|
-
if (oldElt instanceof HTMLInputElement
|
|
359
|
-
|
|
360
|
-
|
|
340
|
+
if (oldElt instanceof HTMLInputElement &&
|
|
341
|
+
newElt instanceof HTMLInputElement &&
|
|
342
|
+
newElt.type !== "file") {
|
|
361
343
|
if (newElt.getAttribute("value") !== oldElt.getAttribute("value")) {
|
|
362
344
|
oldElt.value = newElt.getAttribute("value") ?? "";
|
|
363
345
|
}
|
|
364
346
|
}
|
|
365
|
-
else if (oldElt instanceof HTMLTextAreaElement
|
|
366
|
-
&& newElt instanceof HTMLTextAreaElement) {
|
|
347
|
+
else if (oldElt instanceof HTMLTextAreaElement && newElt instanceof HTMLTextAreaElement) {
|
|
367
348
|
if (newElt.value !== oldElt.value) {
|
|
368
349
|
oldElt.value = newElt.value;
|
|
369
350
|
}
|
|
@@ -371,11 +352,9 @@ const morphNode = (oldNode, newNode) => {
|
|
|
371
352
|
oldElt.firstChild.nodeValue = newElt.value;
|
|
372
353
|
}
|
|
373
354
|
}
|
|
374
|
-
const preserveAttrs = (newNode.getAttribute(aliasedPreserveAttr) ?? "")
|
|
375
|
-
.split(" ");
|
|
355
|
+
const preserveAttrs = (newNode.getAttribute(aliasedPreserveAttr) ?? "").split(" ");
|
|
376
356
|
for (const { name, value } of newElt.attributes) {
|
|
377
|
-
if (oldElt.getAttribute(name) !== value
|
|
378
|
-
&& !preserveAttrs.includes(name)) {
|
|
357
|
+
if (oldElt.getAttribute(name) !== value && !preserveAttrs.includes(name)) {
|
|
379
358
|
oldElt.setAttribute(name, value);
|
|
380
359
|
}
|
|
381
360
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Effect } from "effect";
|
|
1
|
+
import * as Cookies from "../Cookies.ts";
|
|
3
2
|
import * as Context from "effect/Context";
|
|
3
|
+
import * as Effect from "effect/Effect";
|
|
4
4
|
import * as Layer from "effect/Layer";
|
|
5
5
|
type CookieValue = string | number | boolean | null | undefined | {
|
|
6
6
|
[key: string]: CookieValue | unknown;
|
|
@@ -45,7 +45,4 @@ export declare function decrypt(encryptedValue: string, options: {
|
|
|
45
45
|
} | {
|
|
46
46
|
secret: string;
|
|
47
47
|
}): Effect.Effect<CookieValue, EncryptedCookiesError>;
|
|
48
|
-
export declare function handleError<E>(app: HttpApp.Default<E | EncryptedCookiesError>): Effect.Effect<HttpServerResponse.HttpServerResponse, Exclude<E, {
|
|
49
|
-
_tag: "EncryptedCookiesError";
|
|
50
|
-
}>, import("@effect/platform/HttpServerRequest").HttpServerRequest>;
|
|
51
48
|
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Effect, pipe, } from "effect";
|
|
1
|
+
import * as Cookies from "../Cookies.js";
|
|
3
2
|
import * as Config from "effect/Config";
|
|
4
3
|
import * as Context from "effect/Context";
|
|
5
4
|
import * as Data from "effect/Data";
|
|
5
|
+
import * as Effect from "effect/Effect";
|
|
6
6
|
import * as Layer from "effect/Layer";
|
|
7
7
|
export class EncryptedCookiesError extends Data.TaggedError("EncryptedCookiesError") {
|
|
8
8
|
}
|
|
@@ -23,33 +23,21 @@ export function layer(options) {
|
|
|
23
23
|
}));
|
|
24
24
|
}
|
|
25
25
|
export function layerConfig(name = "SECRET_KEY_BASE") {
|
|
26
|
-
return Effect
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
return (value.length < 40)
|
|
30
|
-
? Effect.fail(new Error("ba"))
|
|
31
|
-
: Effect.succeed(value);
|
|
26
|
+
return Effect.gen(function* () {
|
|
27
|
+
const secret = yield* Config.nonEmptyString(name).pipe(Effect.flatMap((value) => {
|
|
28
|
+
return value.length < 40 ? Effect.fail(new Error("ba")) : Effect.succeed(value);
|
|
32
29
|
}), Effect.catchAll((err) => {
|
|
33
30
|
return Effect.dieMessage("SECRET_KEY_BASE must be at least 40 characters");
|
|
34
31
|
}));
|
|
35
32
|
return layer({ secret });
|
|
36
|
-
})
|
|
37
|
-
.pipe(Layer.unwrapEffect);
|
|
33
|
+
}).pipe(Layer.unwrapEffect);
|
|
38
34
|
}
|
|
39
35
|
function encodeToBase64Segments(ciphertext, iv, authTag) {
|
|
40
|
-
return [
|
|
41
|
-
base64urlEncode(ciphertext),
|
|
42
|
-
base64urlEncode(iv),
|
|
43
|
-
base64urlEncode(authTag),
|
|
44
|
-
]
|
|
45
|
-
.join(".");
|
|
36
|
+
return [base64urlEncode(ciphertext), base64urlEncode(iv), base64urlEncode(authTag)].join(".");
|
|
46
37
|
}
|
|
47
38
|
function base64urlEncode(data) {
|
|
48
39
|
const base64 = btoa(String.fromCharCode(...data));
|
|
49
|
-
return base64
|
|
50
|
-
.replace(/\+/g, "-")
|
|
51
|
-
.replace(/\//g, "_")
|
|
52
|
-
.replace(/=/g, "");
|
|
40
|
+
return base64.replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
53
41
|
}
|
|
54
42
|
function decodeFromBase64Segments(segments) {
|
|
55
43
|
return Effect.gen(function* () {
|
|
@@ -71,14 +59,12 @@ function decodeFromBase64Segments(segments) {
|
|
|
71
59
|
}
|
|
72
60
|
function base64urlDecode(data) {
|
|
73
61
|
// Convert base64url back to standard base64
|
|
74
|
-
let base64 = data
|
|
75
|
-
.replace(/-/g, "+")
|
|
76
|
-
.replace(/_/g, "/");
|
|
62
|
+
let base64 = data.replace(/-/g, "+").replace(/_/g, "/");
|
|
77
63
|
// Add padding if needed
|
|
78
64
|
while (base64.length % 4) {
|
|
79
65
|
base64 += "=";
|
|
80
66
|
}
|
|
81
|
-
return Uint8Array.from(atob(base64), c => c.charCodeAt(0));
|
|
67
|
+
return Uint8Array.from(atob(base64), (c) => c.charCodeAt(0));
|
|
82
68
|
}
|
|
83
69
|
/**
|
|
84
70
|
* Encrypts cookie value using the SECRET_KEY_BASE.
|
|
@@ -143,8 +129,7 @@ function decryptWithDerivedKey(encryptedValue, derivedKey) {
|
|
|
143
129
|
}
|
|
144
130
|
function encryptCookieWithDerivedKey(cookie, derivedKey) {
|
|
145
131
|
return Effect.gen(function* () {
|
|
146
|
-
const encryptedValue = yield* encryptWithDerivedKey(cookie.value, derivedKey)
|
|
147
|
-
.pipe(Effect.mapError(error => new EncryptedCookiesError({
|
|
132
|
+
const encryptedValue = yield* encryptWithDerivedKey(cookie.value, derivedKey).pipe(Effect.mapError((error) => new EncryptedCookiesError({
|
|
148
133
|
cause: error.cause,
|
|
149
134
|
cookie,
|
|
150
135
|
})));
|
|
@@ -153,8 +138,7 @@ function encryptCookieWithDerivedKey(cookie, derivedKey) {
|
|
|
153
138
|
}
|
|
154
139
|
function decryptCookieWithDerivedKey(cookie, derivedKey) {
|
|
155
140
|
return Effect.gen(function* () {
|
|
156
|
-
const decryptedValue = yield* decryptWithDerivedKey(cookie.value, derivedKey)
|
|
157
|
-
.pipe(Effect.mapError(error => new EncryptedCookiesError({
|
|
141
|
+
const decryptedValue = yield* decryptWithDerivedKey(cookie.value, derivedKey).pipe(Effect.mapError((error) => new EncryptedCookiesError({
|
|
158
142
|
cause: error.cause,
|
|
159
143
|
cookie,
|
|
160
144
|
})));
|
|
@@ -168,8 +152,7 @@ export function encryptCookie(cookie, options) {
|
|
|
168
152
|
}
|
|
169
153
|
const encryptedValue = yield* encrypt(cookie.value, {
|
|
170
154
|
secret: options.secret,
|
|
171
|
-
})
|
|
172
|
-
.pipe(Effect.mapError(error => new EncryptedCookiesError({
|
|
155
|
+
}).pipe(Effect.mapError((error) => new EncryptedCookiesError({
|
|
173
156
|
cause: error.cause,
|
|
174
157
|
cookie,
|
|
175
158
|
})));
|
|
@@ -183,8 +166,7 @@ export function decryptCookie(cookie, options) {
|
|
|
183
166
|
}
|
|
184
167
|
const decryptedValue = yield* decrypt(cookie.value, {
|
|
185
168
|
secret: options.secret,
|
|
186
|
-
})
|
|
187
|
-
.pipe(Effect.mapError(error => new EncryptedCookiesError({
|
|
169
|
+
}).pipe(Effect.mapError((error) => new EncryptedCookiesError({
|
|
188
170
|
cause: error.cause,
|
|
189
171
|
cookie,
|
|
190
172
|
})));
|
|
@@ -205,7 +187,9 @@ function deriveKeyMaterial(secret) {
|
|
|
205
187
|
return Effect.gen(function* () {
|
|
206
188
|
const encoder = new TextEncoder();
|
|
207
189
|
const keyMaterial = yield* Effect.tryPromise({
|
|
208
|
-
try: () => crypto.subtle.importKey("raw", encoder.encode(secret), { name: "HKDF" }, false, [
|
|
190
|
+
try: () => crypto.subtle.importKey("raw", encoder.encode(secret), { name: "HKDF" }, false, [
|
|
191
|
+
"deriveKey",
|
|
192
|
+
]),
|
|
209
193
|
catch: (error) => new EncryptedCookiesError({ cause: error }),
|
|
210
194
|
});
|
|
211
195
|
return keyMaterial;
|
|
@@ -226,18 +210,3 @@ function deriveKey(keyMaterial, usage) {
|
|
|
226
210
|
return key;
|
|
227
211
|
});
|
|
228
212
|
}
|
|
229
|
-
// TODO something si wrong with return type
|
|
230
|
-
export function handleError(app) {
|
|
231
|
-
return Effect.gen(function* () {
|
|
232
|
-
const res = yield* app.pipe(Effect.catchTag("EncryptedCookiesError", (error) => {
|
|
233
|
-
return HttpServerResponse.empty();
|
|
234
|
-
}));
|
|
235
|
-
return res;
|
|
236
|
-
});
|
|
237
|
-
}
|
|
238
|
-
function generateFriendlyKey(bits = 128) {
|
|
239
|
-
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
240
|
-
const length = Math.ceil(bits / Math.log2(chars.length));
|
|
241
|
-
const bytes = crypto.getRandomValues(new Uint8Array(length));
|
|
242
|
-
return Array.from(bytes, b => chars[b % chars.length]).join("");
|
|
243
|
-
}
|
package/dist/hyper/Hyper.d.ts
CHANGED
|
@@ -1,18 +1,11 @@
|
|
|
1
1
|
import * as Context from "effect/Context";
|
|
2
|
-
import * as Layer from "effect/Layer";
|
|
3
|
-
import { HyperHooks } from "../x/datastar/index.ts";
|
|
4
2
|
import type { JSX } from "./jsx.d.ts";
|
|
5
3
|
type Elements = JSX.IntrinsicElements;
|
|
6
4
|
type Children = JSX.Children;
|
|
7
|
-
export type { Children, Elements, JSX
|
|
8
|
-
declare const Hyper_base: Context.TagClass<Hyper, "Hyper", {
|
|
9
|
-
hooks: typeof HyperHooks | undefined;
|
|
10
|
-
}>;
|
|
5
|
+
export type { Children, Elements, JSX };
|
|
6
|
+
declare const Hyper_base: Context.TagClass<Hyper, "Hyper", {}>;
|
|
11
7
|
export declare class Hyper extends Hyper_base {
|
|
12
8
|
}
|
|
13
|
-
export declare function layer(opts: {
|
|
14
|
-
hooks: typeof HyperHooks;
|
|
15
|
-
}): Layer.Layer<Hyper, never, never>;
|
|
16
9
|
type Primitive = string | number | boolean | null | undefined;
|
|
17
10
|
export type HyperType = string | HyperComponent;
|
|
18
11
|
export type HyperProps = {
|
package/dist/hyper/Hyper.js
CHANGED
|
@@ -1,16 +1,8 @@
|
|
|
1
1
|
import * as Context from "effect/Context";
|
|
2
2
|
import * as Fiber from "effect/Fiber";
|
|
3
|
-
import * as Layer from "effect/Layer";
|
|
4
3
|
import * as Option from "effect/Option";
|
|
5
4
|
export class Hyper extends Context.Tag("Hyper")() {
|
|
6
5
|
}
|
|
7
|
-
export function layer(opts) {
|
|
8
|
-
return Layer.sync(Hyper, () => {
|
|
9
|
-
return {
|
|
10
|
-
hooks: opts.hooks,
|
|
11
|
-
};
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
6
|
const NoChildren = Object.freeze([]);
|
|
15
7
|
export function h(type, props) {
|
|
16
8
|
return {
|
|
@@ -27,8 +19,5 @@ export function unsafeUse(tag) {
|
|
|
27
19
|
return Context.unsafeGet(context, tag);
|
|
28
20
|
}
|
|
29
21
|
export function isGenericJsxObject(value) {
|
|
30
|
-
return typeof value === "object"
|
|
31
|
-
&& value !== null
|
|
32
|
-
&& "type" in value
|
|
33
|
-
&& "props" in value;
|
|
22
|
+
return typeof value === "object" && value !== null && "type" in value && "props" in value;
|
|
34
23
|
}
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* }
|
|
17
17
|
* }
|
|
18
18
|
*/
|
|
19
|
-
import * as HyperNode from "./HyperNode.ts";
|
|
19
|
+
import type * as HyperNode from "./HyperNode.ts";
|
|
20
20
|
import type { JSX } from "./jsx.d.ts";
|
|
21
21
|
export declare function renderToString(node: JSX.Children, hooks?: {
|
|
22
22
|
onNode?: (node: HyperNode.HyperNode) => void;
|
package/dist/hyper/HyperHtml.js
CHANGED
|
@@ -34,15 +34,16 @@ const EMPTY_TAGS = [
|
|
|
34
34
|
"track",
|
|
35
35
|
"wbr",
|
|
36
36
|
];
|
|
37
|
-
// escape an attribute
|
|
38
37
|
let esc = (str) => String(str).replace(/[&<>"']/g, (s) => `&${map[s]};`);
|
|
38
|
+
let escSQ = (str) => String(str).replace(/[&<>']/g, (s) => `&${map[s]};`);
|
|
39
39
|
let map = {
|
|
40
40
|
"&": "amp",
|
|
41
41
|
"<": "lt",
|
|
42
42
|
">": "gt",
|
|
43
|
-
"
|
|
44
|
-
"'": "
|
|
43
|
+
'"': "quot",
|
|
44
|
+
"'": "#39",
|
|
45
45
|
};
|
|
46
|
+
const RAW_TEXT_TAGS = ["script", "style"];
|
|
46
47
|
export function renderToString(node, hooks) {
|
|
47
48
|
const stack = [node];
|
|
48
49
|
let result = "";
|
|
@@ -89,19 +90,22 @@ export function renderToString(node, hooks) {
|
|
|
89
90
|
const { type, props } = current;
|
|
90
91
|
result += `<${type}`;
|
|
91
92
|
for (const key in props) {
|
|
92
|
-
if (key !== "children"
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
93
|
+
if (key !== "children" &&
|
|
94
|
+
key !== "innerHTML" && // Solid-specific
|
|
95
|
+
key !== "dangerouslySetInnerHTML" && // React-specific
|
|
96
|
+
props[key] !== false &&
|
|
97
|
+
props[key] != null) {
|
|
97
98
|
if (props[key] === true) {
|
|
98
99
|
result += ` ${esc(key)}`;
|
|
99
100
|
}
|
|
100
101
|
else {
|
|
101
102
|
const resolvedKey = key === "className" ? "class" : key;
|
|
102
103
|
const value = props[key];
|
|
103
|
-
if (key.startsWith("data-") && typeof value === "
|
|
104
|
-
result += ` ${esc(resolvedKey)}="${esc(
|
|
104
|
+
if (key.startsWith("data-") && typeof value === "function") {
|
|
105
|
+
result += ` ${esc(resolvedKey)}="${esc(value.toString())}"`;
|
|
106
|
+
}
|
|
107
|
+
else if (key.startsWith("data-") && typeof value === "object") {
|
|
108
|
+
result += ` ${esc(resolvedKey)}='${escSQ(JSON.stringify(value))}'`;
|
|
105
109
|
}
|
|
106
110
|
else {
|
|
107
111
|
result += ` ${esc(resolvedKey)}="${esc(value)}"`;
|
|
@@ -113,8 +117,7 @@ export function renderToString(node, hooks) {
|
|
|
113
117
|
if (!EMPTY_TAGS.includes(type)) {
|
|
114
118
|
stack.push(`</${type}>`);
|
|
115
119
|
// React-specific
|
|
116
|
-
const html = props.dangerouslySetInnerHTML?.__html
|
|
117
|
-
?? props.innerHTML;
|
|
120
|
+
const html = props.dangerouslySetInnerHTML?.__html ?? props.innerHTML;
|
|
118
121
|
if (html) {
|
|
119
122
|
result += html;
|
|
120
123
|
}
|
|
@@ -123,6 +126,9 @@ export function renderToString(node, hooks) {
|
|
|
123
126
|
if (type === "script" && typeof children === "function") {
|
|
124
127
|
result += `(${children.toString()})(window)`;
|
|
125
128
|
}
|
|
129
|
+
else if (RAW_TEXT_TAGS.includes(type) && children != null) {
|
|
130
|
+
result += Array.isArray(children) ? children.join("") : children;
|
|
131
|
+
}
|
|
126
132
|
else if (Array.isArray(children)) {
|
|
127
133
|
for (let i = children.length - 1; i >= 0; i--) {
|
|
128
134
|
stack.push(children[i]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|