Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion analytics/components/DecoAnalytics.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Head } from "$fresh/runtime.ts";
import { Head } from "fresh/runtime";
import { useScriptAsDataURI } from "@deco/deco/hooks";
export interface Props {
/**
Expand Down
17 changes: 9 additions & 8 deletions deno.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"imports": {
"$fresh/": "https://cdn.jsdelivr.net/gh/denoland/fresh@1.6.8/",
"preact": "npm:preact@10.23.1",
"preact-render-to-string": "npm:preact-render-to-string@6.4.2",
"@preact/signals": "https://esm.sh/*@preact/signals@1.1.3",
"@preact/signals-core": "https://esm.sh/@preact/signals-core@1.3.0",
"fresh": "jsr:@fresh/core@^2.2.0",
"fresh/": "jsr:@fresh/core@^2.2.0/",
"$fresh/": "jsr:@fresh/core@^2.2.0/",
"preact": "npm:preact@^10.27.0",
"preact-render-to-string": "npm:preact-render-to-string@^6.5.11",
"@preact/signals": "npm:@preact/signals@^2.2.1",
"std/": "https://deno.land/std@0.204.0/",
"partytown/": "https://deno.land/x/partytown@0.4.8/",
"deco-sites/std/": "https://cdn.jsdelivr.net/gh/deco-sites/std@1.26.8/",
Expand Down Expand Up @@ -33,8 +34,8 @@
"@zaubrik/djwt": "jsr:@zaubrik/djwt@^3.0.2",
"fast-json-patch": "npm:fast-json-patch@^3.1.1",
"simple-git": "npm:simple-git@^3.25.0",
"https://esm.sh/*preact-render-to-string@6.3.1": "npm:preact-render-to-string@6.4.2",
"@deco/deco": "jsr:@deco/deco@^1.127.0"
"https://esm.sh/*preact-render-to-string@6.3.1": "npm:preact-render-to-string@^6.5.11",
"@deco/deco": "https://denopkg.com/deco-cx/deco@fresh2/mod.ts"
},
"lock": false,
"tasks": {
Expand Down Expand Up @@ -69,5 +70,5 @@
]
}
},
"version": "0.133.27"
"version": "1.0.0"
}
2 changes: 1 addition & 1 deletion htmx/sections/htmx.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Head } from "$fresh/runtime.ts";
import { Head } from "fresh/runtime";
import { AppContext, Extension } from "../mod.ts";
import { type SectionProps } from "@deco/deco";
import { useScript } from "@deco/deco/hooks";
Expand Down
2 changes: 1 addition & 1 deletion linx-impulse/sections/Script/LinxImpulseScript.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Head } from "$fresh/runtime.ts";
import { Head } from "fresh/runtime";
import { AppContext } from "../../mod.ts";
import { type SectionProps } from "@deco/deco";
export const loader = (_props: unknown, _req: Request, ctx: AppContext) => ({
Expand Down
2 changes: 1 addition & 1 deletion linx/hooks/context.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IS_BROWSER } from "$fresh/runtime.ts";
import { IS_BROWSER } from "fresh/runtime";
import { signal } from "@preact/signals";
import { invoke } from "../runtime.ts";
import type { CartResponse } from "../utils/types/basketJSON.ts";
Expand Down
2 changes: 1 addition & 1 deletion nuvemshop/hooks/context.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IS_BROWSER } from "$fresh/runtime.ts";
import { IS_BROWSER } from "fresh/runtime";
import { signal } from "@preact/signals";
import { invoke } from "../runtime.ts";
import { Cart } from "../utils/types.ts";
Expand Down
2 changes: 1 addition & 1 deletion posthog/components/PostHog.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Head } from "$fresh/runtime.ts";
import { Head } from "fresh/runtime";
import { AppContext } from "../mod.ts";
import { useScriptAsDataURI } from "@deco/deco/hooks";
export interface Props {
Expand Down
2 changes: 1 addition & 1 deletion shopify/hooks/context.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IS_BROWSER } from "$fresh/runtime.ts";
import { IS_BROWSER } from "fresh/runtime";
import { signal } from "@preact/signals";
import { Person } from "../../commerce/types.ts";
import { invoke } from "../runtime.ts";
Expand Down
2 changes: 1 addition & 1 deletion sourei/sections/Analytics/Sourei.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// deno-lint-ignore-file no-explicit-any
import { Head } from "$fresh/runtime.ts";
import { Head } from "fresh/runtime";
import { useScriptAsDataURI } from "@deco/deco/hooks";
interface Props {
/**
Expand Down
2 changes: 1 addition & 1 deletion utils/defaultErrorPage.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Head } from "$fresh/runtime.ts";
import { Head } from "fresh/runtime";

type Props = {
error?: string;
Expand Down
2 changes: 1 addition & 1 deletion vnda/hooks/context.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IS_BROWSER } from "$fresh/runtime.ts";
import { IS_BROWSER } from "fresh/runtime";
import { signal } from "@preact/signals";
import { invoke } from "../runtime.ts";
import type { Cart } from "../loaders/cart.ts";
Expand Down
2 changes: 1 addition & 1 deletion vtex/hooks/context.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IS_BROWSER } from "$fresh/runtime.ts";
import { IS_BROWSER } from "fresh/runtime";
import { signal } from "@preact/signals";
import { Person } from "../../commerce/types.ts";
import { invoke } from "../runtime.ts";
Expand Down
2 changes: 1 addition & 1 deletion wake/hooks/context.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IS_BROWSER } from "$fresh/runtime.ts";
import { IS_BROWSER } from "fresh/runtime";
import { signal } from "@preact/signals";
import { invoke } from "../runtime.ts";
import type {
Expand Down
2 changes: 1 addition & 1 deletion wap/hooks/context.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IS_BROWSER } from "$fresh/runtime.ts";
import { IS_BROWSER } from "fresh/runtime";
import { signal } from "@preact/signals";
import { Person } from "../../commerce/types.ts";
import { invoke } from "../runtime.ts";
Expand Down
2 changes: 1 addition & 1 deletion website/components/Analytics.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Head } from "$fresh/runtime.ts";
import { Head } from "fresh/runtime";
import { useScriptAsDataURI } from "@deco/deco/hooks";
import { context } from "@deco/deco";
declare global {
Expand Down
2 changes: 1 addition & 1 deletion website/components/Clickhouse.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Head } from "$fresh/runtime.ts";
import { Head } from "fresh/runtime";
import { encryptToHex } from "../utils/crypto.ts";
import { useScriptAsDataURI } from "@deco/deco/hooks";
declare global {
Expand Down
2 changes: 1 addition & 1 deletion website/components/Events.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Head } from "$fresh/runtime.ts";
import { Head } from "fresh/runtime";
import { type AnalyticsEvent, type Deco } from "../../commerce/types.ts";
import { useScriptAsDataURI } from "@deco/deco/hooks";
import { DECO_SEGMENT, type Flag } from "@deco/deco";
Expand Down
2 changes: 1 addition & 1 deletion website/components/Image.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Head, IS_BROWSER } from "$fresh/runtime.ts";
import { Head, IS_BROWSER } from "fresh/runtime";
import type { JSX } from "preact";
import { forwardRef } from "preact/compat";
import { Manifest } from "../manifest.gen.ts";
Expand Down
2 changes: 1 addition & 1 deletion website/components/OneDollarStats.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Head } from "$fresh/runtime.ts";
import { Head } from "fresh/runtime";
import { useScriptAsDataURI } from "@deco/deco/hooks";
import { DEFAULT_ANALYTICS_SCRIPT_URL } from "../loaders/analyticsScript.ts";

Expand Down
2 changes: 1 addition & 1 deletion website/components/Picture.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useContext, useMemo } from "preact/hooks";
import { forwardRef } from "preact/compat";
import { ComponentChildren, createContext, JSX } from "preact";
import { Head, IS_BROWSER } from "$fresh/runtime.ts";
import { Head, IS_BROWSER } from "fresh/runtime";

import {
FACTORS,
Expand Down
2 changes: 1 addition & 1 deletion website/components/Seo.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Head } from "$fresh/runtime.ts";
import { Head } from "fresh/runtime";
import type { ImageWidget } from "../../admin/widgets.ts";
import { stripHTML } from "../utils/html.ts";
import { JSX } from "preact";
Expand Down
2 changes: 1 addition & 1 deletion website/components/Theme.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Head } from "$fresh/runtime.ts";
import { Head } from "fresh/runtime";
import { useId } from "preact/hooks";

export interface Variable {
Expand Down
2 changes: 1 addition & 1 deletion website/components/_Controls.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Head } from "$fresh/runtime.ts";
import { Head } from "fresh/runtime";
import { Page } from "../../commerce/types.ts";
import { useScriptAsDataURI } from "@deco/deco/hooks";
import { type Flag, type Site } from "@deco/deco";
Expand Down
2 changes: 1 addition & 1 deletion website/components/_seo/Preview.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Head } from "$fresh/runtime.ts";
import { Head } from "fresh/runtime";
import type { ComponentChildren, ComponentProps } from "preact";
import { useMemo } from "preact/hooks";
import { ImageWidget } from "../../../admin/widgets.ts";
Expand Down
14 changes: 10 additions & 4 deletions website/handlers/fresh.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { HandlerContext } from "$fresh/server.ts";
import { getSetCookies } from "std/http/cookie.ts";
import { __DECO_FBT } from "../../utils/deferred.ts";
import { errorIfFrameworkMismatch } from "../../utils/framework.tsx";
Expand All @@ -15,16 +14,23 @@ import {
import type { Exception } from "npm:@opentelemetry/api@1.9.0";

type ConnInfo = Deno.ServeHandlerInfo;

/** Fresh context with render function */
interface FreshContext<Data = unknown, State = unknown> {
render: (data?: Data) => Response | Promise<Response>;
state: State;
}

/**
* @title Fresh Config
*/
export interface FreshConfig {
page: Page;
}
export const isFreshCtx = <TState>(
ctx: ConnInfo | HandlerContext<unknown, TState>,
): ctx is HandlerContext<unknown, TState> => {
return typeof (ctx as HandlerContext).render === "function";
ctx: ConnInfo | FreshContext<unknown, TState>,
): ctx is FreshContext<unknown, TState> => {
return typeof (ctx as FreshContext).render === "function";
};
function abortHandler(
ctrl: AbortController,
Expand Down
2 changes: 1 addition & 1 deletion website/pages/Page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Head } from "$fresh/runtime.ts";
import { Head } from "fresh/runtime";
import {
Context,
HttpError,
Expand Down
10 changes: 7 additions & 3 deletions workflows/handlers/workflowRunner.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
import { HandlerContext } from "$fresh/server.ts";
import { type Handler, Workflow, WorkflowContext } from "@deco/deco/blocks";
import { workflowHTTPHandler } from "@deco/durable";
import {
type AppManifest,
type DecoSiteState,
type DecoState,
} from "@deco/deco";

/** Context with state for workflow handlers */
interface ContextWithState<State = unknown> {
state: State;
}

export interface Config {
workflow: Workflow;
}
export default function WorkflowHandler({ workflow }: Config): Handler {
return (req: Request, conn: Deno.ServeHandlerInfo) => {
const ctx = conn as unknown as HandlerContext<
unknown,
const ctx = conn as unknown as ContextWithState<
DecoState<unknown, DecoSiteState, AppManifest>
>;
if (ctx?.state) {
Expand Down
Loading