diff --git a/blocks/account.ts b/blocks/account.ts index 8f69bbfca..a725fe17f 100644 --- a/blocks/account.ts +++ b/blocks/account.ts @@ -1,5 +1,5 @@ // deno-lint-ignore-file no-explicit-any -import JsonViewer from "../components/JsonViewer.tsx"; +import JsonViewer from "../components/JsonViewer.ts"; import type { Block, BlockModule, InstanceOf } from "../engine/block.ts"; // deno-lint-ignore no-empty-interface diff --git a/blocks/action.ts b/blocks/action.ts index beb03db2d..afe770d28 100644 --- a/blocks/action.ts +++ b/blocks/action.ts @@ -1,7 +1,7 @@ // deno-lint-ignore-file no-explicit-any -import { applyProps, type FnProps } from "../blocks/utils.tsx"; -import JsonViewer from "../components/JsonViewer.tsx"; +import JsonViewer from "../components/JsonViewer.ts"; import type { Block, BlockModule, InstanceOf } from "../engine/block.ts"; +import { applyProps, type FnProps } from "./utils.ts"; export type Action = InstanceOf; diff --git a/blocks/app.ts b/blocks/app.ts index 6a3e7f7fd..e6deb74d6 100644 --- a/blocks/app.ts +++ b/blocks/app.ts @@ -2,11 +2,6 @@ import blocks from "../blocks/index.ts"; import { propsLoader } from "../blocks/propsLoader.ts"; import type { SectionModule } from "../blocks/section.ts"; -import { - type AppHttpContext, - buildImportMap, - type FnProps, -} from "../blocks/utils.tsx"; import type { Block, BlockModule, InstanceOf } from "../engine/block.ts"; import type { BaseContext, @@ -23,7 +18,12 @@ import type { import type { DecoManifest, FnContext } from "../types.ts"; import { resolversFrom } from "./appsUtil.ts"; import { isInvokeCtx } from "./loader.ts"; -import { fnContextFromHttpContext } from "./utils.tsx"; +import { + type AppHttpContext, + buildImportMap, + fnContextFromHttpContext, + type FnProps, +} from "./utils.ts"; export type Apps = InstanceOf; export type AppManifest = Omit; diff --git a/blocks/appsUtil.ts b/blocks/appsUtil.ts index db73d103f..44c2ab004 100644 --- a/blocks/appsUtil.ts +++ b/blocks/appsUtil.ts @@ -13,7 +13,7 @@ import { import type { DanglingRecover } from "../engine/manifest/manifest.ts"; import { compose, type ResolverMiddleware } from "../engine/middleware.ts"; import type { AppManifest } from "../types.ts"; -import { usePreviewFunc } from "./utils.tsx"; +import { usePreviewFunc } from "./utils.ts"; const resolverIsBlock = (blk: Block) => (resolver: string) => { const splitted = resolver.split("/"); diff --git a/blocks/flag.ts b/blocks/flag.ts index 17d02915a..3b2d3f92c 100644 --- a/blocks/flag.ts +++ b/blocks/flag.ts @@ -1,6 +1,6 @@ import type { HttpContext } from "../blocks/handler.ts"; import type { Matcher } from "../blocks/matcher.ts"; -import JsonViewer from "../components/JsonViewer.tsx"; +import JsonViewer from "../components/JsonViewer.ts"; import type { TsType, TsTypeReference } from "../deps.ts"; import type { Block, BlockModule, InstanceOf } from "../engine/block.ts"; import { isDeferred } from "../engine/core/resolver.ts"; diff --git a/blocks/function.ts b/blocks/function.ts index 888845f2f..ad9cf1b5c 100644 --- a/blocks/function.ts +++ b/blocks/function.ts @@ -4,8 +4,8 @@ import { wrapCaughtErrors } from "../blocks/loader.ts"; import { newSingleFlightGroup, type SingleFlightKeyFunc, -} from "../blocks/utils.tsx"; -import JsonViewer from "../components/JsonViewer.tsx"; +} from "../blocks/utils.ts"; +import JsonViewer from "../components/JsonViewer.ts"; import type { Block, BlockModule } from "../engine/block.ts"; import type { HandlerContext } from "../engine/manifest/manifest.ts"; import type { DecoState, LoaderFunction } from "../types.ts"; diff --git a/blocks/handler.ts b/blocks/handler.ts index c34625037..27f521951 100644 --- a/blocks/handler.ts +++ b/blocks/handler.ts @@ -8,7 +8,7 @@ import { type FnContext, fnContextFromHttpContext, type RequestState, -} from "./utils.tsx"; +} from "./utils.ts"; export interface HttpContext< // deno-lint-ignore ban-types diff --git a/blocks/index.ts b/blocks/index.ts index 0476350c5..b60573c58 100644 --- a/blocks/index.ts +++ b/blocks/index.ts @@ -9,7 +9,7 @@ import matcherBlock from "../blocks/matcher.ts"; import sectionBlock from "../blocks/section.ts"; import workflowBlock from "../blocks/workflow.ts"; import type { Block } from "../engine/block.ts"; -import pageBlock from "./page.tsx"; +import pageBlock from "./page.ts"; const userDefinedBlocks: Block[] = []; diff --git a/blocks/loader.ts b/blocks/loader.ts index 1fb2272c1..5b887ec49 100644 --- a/blocks/loader.ts +++ b/blocks/loader.ts @@ -1,5 +1,5 @@ // deno-lint-ignore-file no-explicit-any -import JsonViewer from "../components/JsonViewer.tsx"; +import JsonViewer from "../components/JsonViewer.ts"; import { RequestContext } from "../deco.ts"; import { ValueType, weakcache } from "../deps.ts"; import type { Block, BlockModule, InstanceOf } from "../engine/block.ts"; @@ -18,7 +18,7 @@ import { type FnProps, type RequestState, type SingleFlightKeyFunc, -} from "./utils.tsx"; +} from "./utils.ts"; export type Loader = InstanceOf; diff --git a/blocks/matcher.ts b/blocks/matcher.ts index 315dc1e52..b8148ad1c 100644 --- a/blocks/matcher.ts +++ b/blocks/matcher.ts @@ -2,7 +2,7 @@ import type { HttpContext } from "../blocks/handler.ts"; import { getCookies, Murmurhash3, setCookie } from "../deps.ts"; import type { Block, BlockModule, InstanceOf } from "../engine/block.ts"; import type { Device } from "../utils/userAgent.ts"; -import type { RequestState } from "./utils.tsx"; +import type { RequestState } from "./utils.ts"; export type Matcher = InstanceOf; diff --git a/blocks/mod.ts b/blocks/mod.ts index 58149a577..b30e2846a 100644 --- a/blocks/mod.ts +++ b/blocks/mod.ts @@ -1,8 +1,7 @@ export type { WorkflowGen } from "@deco/durable"; export { - type SectionContext, - SectionContext as SectionCtx, -} from "../components/section.tsx"; + SectionContext as SectionCtx, type SectionContext +} from "../components/section.ts"; export type { ComponentFunc, ComponentMetadata } from "../engine/block.ts"; export type { Resolvable } from "../engine/core/resolver.ts"; export type { Accounts } from "./account.ts"; @@ -12,21 +11,22 @@ export type { AppMiddlewareContext, Apps, ImportMap, - ManifestOf, + ManifestOf } from "./app.ts"; export type { Flag, FlagObj, MultivariateFlag, Variant } from "./flag.ts"; export type { Handler } from "./handler.ts"; export { default as blocks, defineBlock } from "./index.ts"; export type { Loader } from "./loader.ts"; export type { MatchContext, Matcher } from "./matcher.ts"; -export type { Page } from "./page.tsx"; +export type { Page } from "./page.ts"; export { isSection, type Section } from "./section.ts"; export { applyProps, buildImportMap, buildImportMapWith, - createBagKey, -} from "./utils.tsx"; -export type { FnProps } from "./utils.tsx"; + createBagKey +} from "./utils.ts"; +export type { FnProps } from "./utils.ts"; export { WorkflowContext } from "./workflow.ts"; export type { Workflow, WorkflowFn } from "./workflow.ts"; + diff --git a/blocks/page.tsx b/blocks/page.ts similarity index 89% rename from blocks/page.tsx rename to blocks/page.ts index 41c33d009..b674ea4ea 100644 --- a/blocks/page.tsx +++ b/blocks/page.ts @@ -1,7 +1,5 @@ // deno-lint-ignore-file no-explicit-any -/** @jsxRuntime automatic */ -/** @jsxImportSource preact */ - +import { jsx as _jsx } from "preact/jsx-runtime"; import type { Block, InstanceOf, ResolverLike } from "../engine/block.ts"; import { createSectionBlock, type SectionModule } from "./section.ts"; @@ -27,7 +25,10 @@ const page: Block< any > = createSectionBlock( (component, ComponentFunc) => (props, { resolveChain }) => ({ - Component: (p) => , + Component: (p) => + /*#__PURE__*/ _jsx(ComponentFunc, { + ...p, + }), props, metadata: { resolveChain, component }, }), diff --git a/blocks/propsLoader.ts b/blocks/propsLoader.ts index e98105712..4fe528c52 100644 --- a/blocks/propsLoader.ts +++ b/blocks/propsLoader.ts @@ -1,5 +1,5 @@ // deno-lint-ignore-file no-explicit-any -import type { FnProps } from "../blocks/utils.tsx"; +import type { FnProps } from "../blocks/utils.ts"; import type { Diff, Intersection, diff --git a/blocks/section.ts b/blocks/section.ts index 7f655e78c..b1b264679 100644 --- a/blocks/section.ts +++ b/blocks/section.ts @@ -3,12 +3,8 @@ import type { ComponentType, JSX } from "preact"; import type { AppManifest } from "../blocks/app.ts"; import type { HttpContext } from "../blocks/handler.ts"; import { type PropsLoader, propsLoader } from "../blocks/propsLoader.ts"; -import { - fnContextFromHttpContext, - type RequestState, -} from "../blocks/utils.tsx"; -import StubSection, { Empty } from "../components/StubSection.tsx"; -import { alwaysThrow, withSection } from "../components/section.tsx"; +import StubSection, { Empty } from "../components/StubSection.ts"; +import { alwaysThrow, withSection } from "../components/section.ts"; import { Context } from "../deco.ts"; import type { DeepPartial } from "../deps.ts"; import type { @@ -20,6 +16,7 @@ import type { } from "../engine/block.ts"; import type { Resolver } from "../engine/core/resolver.ts"; import { HttpError } from "../engine/errors.ts"; +import { fnContextFromHttpContext, type RequestState } from "./utils.ts"; /** * @widget none diff --git a/blocks/utils.tsx b/blocks/utils.ts similarity index 96% rename from blocks/utils.tsx rename to blocks/utils.ts index 89e8c2ade..26ff08e80 100644 --- a/blocks/utils.tsx +++ b/blocks/utils.ts @@ -1,13 +1,8 @@ -/** @jsxRuntime automatic */ -/** @jsxImportSource preact */ - // deno-lint-ignore-file no-explicit-any import type { StatusCode as Status } from "@std/http/status"; import type { JSX } from "preact"; -import type { AppManifest, ImportMap } from "../blocks/app.ts"; -import { isInvokeCtx } from "../blocks/loader.ts"; import type { InvocationFunc } from "../clients/withManifest.ts"; -import { withSection } from "../components/section.tsx"; +import { withSection } from "../components/section.ts"; import type { Block, BlockModule, @@ -25,8 +20,10 @@ import type { Flag } from "../types.ts"; import { buildInvokeFunc } from "../utils/invoke.server.ts"; import type { InvocationProxy } from "../utils/invoke.types.ts"; import { type Device, deviceOf, isBot as isUABot } from "../utils/userAgent.ts"; -import type { HttpContext } from "./handler.ts"; import type { Vary } from "../utils/vary.ts"; +import type { AppManifest, ImportMap } from "./app.ts"; +import type { HttpContext } from "./handler.ts"; +import { isInvokeCtx } from "./loader.ts"; export type SingleFlightKeyFunc = ( args: TConfig, diff --git a/blocks/workflow.ts b/blocks/workflow.ts index c8d3f36b6..d5db3ff0c 100644 --- a/blocks/workflow.ts +++ b/blocks/workflow.ts @@ -1,13 +1,14 @@ // deno-lint-ignore-file no-explicit-any import { type Arg, - type LocalActivityCommand, - type Metadata, type Workflow as DurableWorkflow, WorkflowContext as DurableWorkflowContext, + type LocalActivityCommand, + type Metadata, type WorkflowExecution, } from "../deps.ts"; import type { Block, BlockModule, InstanceOf } from "../engine/block.ts"; +import type { AppManifest, DecoSiteState, DecoState } from "../types.ts"; import type { AvailableActions, AvailableFunctions, @@ -18,14 +19,13 @@ import type { ManifestFunction, ManifestLoader, } from "../utils/invoke.types.ts"; -import type { AppManifest, DecoSiteState, DecoState } from "../types.ts"; import type { DotNestedKeys } from "../utils/object.ts"; import type { HttpContext } from "./handler.ts"; import { type FnContext, fnContextFromHttpContext, type RequestState, -} from "./utils.tsx"; +} from "./utils.ts"; export interface WorkflowMetadata extends Metadata { defaultInvokeHeaders?: Record; diff --git a/components/JsonViewer.tsx b/components/JsonViewer.ts similarity index 69% rename from components/JsonViewer.tsx rename to components/JsonViewer.ts index 557cd328e..3ffc6d570 100644 --- a/components/JsonViewer.tsx +++ b/components/JsonViewer.ts @@ -1,8 +1,10 @@ -/** @jsxRuntime automatic */ -/** @jsxImportSource preact */ - -import { useFramework } from "../runtime/handler.tsx"; import type { JSX } from "preact"; +import { + Fragment as _Fragment, + jsx as _jsx, + jsxs as _jsxs, +} from "preact/jsx-runtime"; +import { useFramework } from "../runtime/handler.ts"; export interface Props { body: string; @@ -52,16 +54,21 @@ const snippet = (json: string) => { */ export default function JsonViewer(p: Props): JSX.Element { const { Head } = useFramework(); - return ( - <> - {/** @ts-ignore: could not type it well */} - - -); + }, +}); let hmrUniqueId = crypto.randomUUID(); const sockets = new Map(); @@ -101,7 +102,11 @@ export const HTMX = < }), ); hono.use(staticFiles(opts?.staticRoot)); - const Layout = opts?.Layout ?? (({ children }) => <>{children}); + const Layout = opts?.Layout ?? + (({ children }) => + /*#__PURE__*/ _jsx(_Fragment, { + children: children, + })); return { server: hono, framework, @@ -113,12 +118,17 @@ export const HTMX = < page: { metadata: page.metadata, Component: () => { - return ( - - {!active.isDeploy ? DEV_SERVER_SCRIPT : null} - - - ); + // @ts-expect-error: i dont know why this is happening + return /*#__PURE__*/ _jsxs(Layout, { + hmrUniqueId: hmrUniqueId, + revision: revision, + children: [ + !active.isDeploy ? DEV_SERVER_SCRIPT : null, + /*#__PURE__*/ _jsx(page.Component, { + ...page.props, + }), + ], + }); }, props: {}, }, diff --git a/runtime/htmx/mod.ts b/runtime/htmx/mod.ts index 01bbae9d5..93f33a62e 100644 --- a/runtime/htmx/mod.ts +++ b/runtime/htmx/mod.ts @@ -1,4 +1,5 @@ -export { default as framework } from "./Bindings.tsx"; -export { HTMX as bindings } from "./mod.tsx"; -export { Head } from "./Renderer.tsx"; +export { default as framework } from "./Bindings.ts"; +export { HTMX as bindings } from "./framework.ts"; +export { Head } from "./Renderer.ts"; export { asset } from "./serveStatic.ts"; + diff --git a/runtime/mod.ts b/runtime/mod.ts index 163928998..63aefdfdb 100644 --- a/runtime/mod.ts +++ b/runtime/mod.ts @@ -1,7 +1,6 @@ // deno-lint-ignore-file no-explicit-any import { join, toFileUrl } from "@std/path"; -import type { RequestState } from "../blocks/utils.tsx"; -import { vary } from "../utils/vary.ts"; +import type { RequestState } from "../blocks/utils.ts"; import type { DecoContext } from "../deco.ts"; import { Context } from "../deco.ts"; import { context as otelContext } from "../deps.ts"; @@ -23,6 +22,7 @@ import type { AppManifest, DecoSiteState, DecoState } from "../types.ts"; import { defaultHeaders, forceHttps } from "../utils/http.ts"; import { buildInvokeFunc } from "../utils/invoke.server.ts"; import { createServerTimings } from "../utils/timings.ts"; +import { vary } from "../utils/vary.ts"; import type { ContextRenderer } from "./deps.ts"; import { batchInvoke, invoke } from "./features/invoke.ts"; import { @@ -30,14 +30,14 @@ import { meta, type VersionedMetaInfo, } from "./features/meta.ts"; -import { preview } from "./features/preview.tsx"; +import { preview } from "./features/preview.ts"; import { type Options, render, type RenderResponse, -} from "./features/render.tsx"; +} from "./features/render.ts"; import { styles } from "./features/styles.css.ts"; -import { type Bindings, handlerFor } from "./handler.tsx"; +import { type Bindings, handlerFor } from "./handler.ts"; export interface PageParams { data: TData; @@ -265,4 +265,5 @@ export class Deco { export type { PageData } from "./deps.ts"; export { DECO_SEGMENT } from "./middleware.ts"; -export { usePageContext, useRouterContext } from "./routes/entrypoint.tsx"; +export { usePageContext, useRouterContext } from "./routes/entrypoint.ts"; + diff --git a/runtime/routes/blockPreview.tsx b/runtime/routes/blockPreview.ts similarity index 90% rename from runtime/routes/blockPreview.tsx rename to runtime/routes/blockPreview.ts index eb6187b29..a352e790c 100644 --- a/runtime/routes/blockPreview.tsx +++ b/runtime/routes/blockPreview.ts @@ -1,11 +1,9 @@ -/** @jsxRuntime automatic */ -/** @jsxImportSource preact */ - -import type { Page } from "../../blocks/page.tsx"; +import { Fragment as _Fragment, jsx as _jsx } from "preact/jsx-runtime"; +import type { Page } from "../../blocks/page.ts"; import { bodyFromUrl } from "../../utils/http.ts"; import { createHandler, type DecoMiddlewareContext } from "../middleware.ts"; import type { PageParams } from "../mod.ts"; -import Render from "./entrypoint.tsx"; +import Render from "./entrypoint.ts"; const decoder = new TextDecoder(); export default function Preview( @@ -18,11 +16,11 @@ export default function Preview( }, }; - return ( - <> - - - ); + return /*#__PURE__*/ _jsx(_Fragment, { + children: /*#__PURE__*/ _jsx(Render, { + ...renderProps, + }), + }); } const getPropsFromRequest = async (req: Request) => { diff --git a/runtime/routes/entrypoint.tsx b/runtime/routes/entrypoint.ts similarity index 87% rename from runtime/routes/entrypoint.tsx rename to runtime/routes/entrypoint.ts index b2ecee92e..781be7cdb 100644 --- a/runtime/routes/entrypoint.tsx +++ b/runtime/routes/entrypoint.ts @@ -1,10 +1,8 @@ -/** @jsxRuntime automatic */ -/** @jsxImportSource preact */ - import { createContext } from "preact"; import { useContext } from "preact/hooks"; +import { jsx as _jsx } from "preact/jsx-runtime"; import type { Handler } from "../../blocks/handler.ts"; -import type { Page } from "../../blocks/page.tsx"; +import type { Page } from "../../blocks/page.ts"; import type { PageContext } from "../../engine/block.ts"; import type { Flag } from "../../types.ts"; import { forceHttps, setCSPHeaders } from "../../utils/http.ts"; @@ -69,13 +67,19 @@ export default function Render({ return null; } const { Component, props, metadata } = page; - return ( - - - - - - ); + return /*#__PURE__*/ _jsx(routerCtx.Provider, { + value: routerInfo, + children: /*#__PURE__*/ _jsx(ctx.Provider, { + value: { + metadata, + params, + url, + }, + children: /*#__PURE__*/ _jsx(Component, { + ...props, + }), + }), + }); } export const handler = createHandler(async ( diff --git a/runtime/routes/previews.tsx b/runtime/routes/previews.ts similarity index 71% rename from runtime/routes/previews.tsx rename to runtime/routes/previews.ts index 10981fd98..114770ab1 100644 --- a/runtime/routes/previews.tsx +++ b/runtime/routes/previews.ts @@ -1,8 +1,6 @@ -/** @jsxRuntime automatic */ -/** @jsxImportSource preact */ - -import type { Page } from "../../blocks/page.tsx"; -import LiveControls from "../../components/LiveControls.tsx"; +import { Fragment as _Fragment, jsx as _jsx } from "preact/jsx-runtime"; +import type { Page } from "../../blocks/page.ts"; +import LiveControls from "../../components/LiveControls.ts"; import { Context } from "../../deco.ts"; import type { ComponentMetadata } from "../../engine/block.ts"; import { createHandler } from "../middleware.ts"; @@ -33,14 +31,17 @@ function Preview(props: PageParams) { const pageId = pageIdFromMetadata(data?.metadata); const context = Context.active(); - return ( - <> - - - ); + return /*#__PURE__*/ _jsx(_Fragment, { + children: /*#__PURE__*/ _jsx(LiveControls, { + site: { + id: context.siteId, + name: context.site, + }, + page: { + id: pageId, + }, + }), + }); } export const handler = createHandler((ctx) => { diff --git a/runtime/routes/render.tsx b/runtime/routes/render.ts similarity index 96% rename from runtime/routes/render.tsx rename to runtime/routes/render.ts index 5eed59809..5d98d18c7 100644 --- a/runtime/routes/render.tsx +++ b/runtime/routes/render.ts @@ -1,11 +1,8 @@ -/** @jsxRuntime automatic */ -/** @jsxImportSource preact */ - import { FieldResolver } from "../../engine/core/resolver.ts"; import { badRequest } from "../../engine/errors.ts"; import { createHandler } from "../middleware.ts"; import type { PageParams } from "../mod.ts"; -import Render, { type PageData } from "./entrypoint.tsx"; +import Render, { type PageData } from "./entrypoint.ts"; interface Options { resolveChain?: FieldResolver[]; diff --git a/runtime/utils.ts b/runtime/utils.ts index fb23f01d6..5e748ddd7 100644 --- a/runtime/utils.ts +++ b/runtime/utils.ts @@ -1,7 +1,7 @@ -import type { RequestState } from "../blocks/utils.tsx"; -import { vary } from "../utils/vary.ts"; +import type { RequestState } from "../blocks/utils.ts"; import { Context } from "../deco.ts"; import { defaultHeaders } from "../utils/http.ts"; +import { vary } from "../utils/vary.ts"; export const sha1 = async (text: string) => { const buffer = await crypto.subtle diff --git a/transpile.ts b/transpile.ts new file mode 100644 index 000000000..3f2d8f1ae --- /dev/null +++ b/transpile.ts @@ -0,0 +1,62 @@ +import { ensureDir } from "https://deno.land/std@0.224.0/fs/ensure_dir.ts"; +import { walk } from "https://deno.land/std@0.224.0/fs/walk.ts"; +import { extname, join } from "https://deno.land/std@0.224.0/path/mod.ts"; +import { transpile } from "jsr:@deno/emit"; + +const transpileEntry = async (entry: { path: string }, outputDir: string) => { + const sourceFilePath = entry.path; + const relativePath = sourceFilePath.replace(inputDir, "."); + const outputFilePath = join( + outputDir, + relativePath.replace(`${extname(sourceFilePath)}`, ".js"), + ); + + console.log( + `Transpiling ${sourceFilePath} to ${outputFilePath} `, + ); + + // Ensure the output directory exists + console.log( + "dist", + join(outputDir, relativePath.split("/").slice(0, -1).join("/")), + ); + await ensureDir( + join( + outputDir, + relativePath.split("/").slice(0, -1).join("/"), + ), + ); + + const url = new URL(sourceFilePath, import.meta.url); + console.log(`file://${join(Deno.cwd(), "deno.json")}`); + + const result = await transpile(url, { + allowRemote: true, + compilerOptions: { + "jsx": "react-jsx", + "jsxImportSource": "preact", + }, + importMap: join(Deno.cwd(), "deno.json"), + }); + + const code = result.get(url.href); + + console.log(code); +}; +// Function to transpile TSX to JS using esbuild +async function transpileTSXToJS(inputDir: string, outputDir: string) { + for await ( + const entry of walk(inputDir, { exts: [".tsx"], includeDirs: false }) + ) { + transpileEntry(entry, outputDir); + } +} + +// Set the input and output directories +const inputDir = "."; // Directory containing .tsx files + +// Transpile all TSX files +// await transpileTSXToJS(inputDir, Deno.cwd()); + +await transpileEntry({ path: Deno.args[0]! }, Deno.cwd()); +console.log("Transpilation complete."); diff --git a/types.ts b/types.ts index 225dd6db7..7875bbc03 100644 --- a/types.ts +++ b/types.ts @@ -14,9 +14,9 @@ import type handlerBlock from "./blocks/handler.ts"; import type { Handler } from "./blocks/handler.ts"; import type loaderBlock from "./blocks/loader.ts"; import type matcherBlock from "./blocks/matcher.ts"; -import type pageBlock from "./blocks/page.tsx"; +import type pageBlock from "./blocks/page.ts"; import type sectionBlock from "./blocks/section.ts"; -import type { FnContext } from "./blocks/utils.tsx"; +import type { FnContext } from "./blocks/utils.ts"; import type workflowBlock from "./blocks/workflow.ts"; import type { InvocationFunc } from "./clients/withManifest.ts"; import type { JSONSchema7, JSONSchema7Definition } from "./deps.ts"; @@ -35,7 +35,7 @@ import type { createServerTimings } from "./utils/timings.ts"; export type { App } from "./blocks/app.ts"; export type { ErrorBoundaryComponent, - ErrorBoundaryParams, + ErrorBoundaryParams } from "./blocks/section.ts"; export type { AppContext, AppManifest, AppModule, AppRuntime }; export type JSONSchema = JSONSchema7; @@ -134,7 +134,7 @@ export type DecoState< export type { JSONSchema7 } from "npm:@types/json-schema@7.0.11/index.d.ts"; export type { PropsLoader } from "./blocks/propsLoader.ts"; export type { LoadingFallbackProps, SectionProps } from "./blocks/section.ts"; -export type { FnContext } from "./blocks/utils.tsx"; +export type { FnContext } from "./blocks/utils.ts"; export type { ResolveOptions } from "./engine/core/mod.ts"; export type { ResolveFunc } from "./engine/core/resolver.ts"; export type { RouteContext } from "./engine/manifest/manifest.ts"; diff --git a/utils/metabase.tsx b/utils/metabase.ts similarity index 54% rename from utils/metabase.tsx rename to utils/metabase.ts index 49b3ebac1..9023d1e8d 100644 --- a/utils/metabase.tsx +++ b/utils/metabase.ts @@ -1,6 +1,4 @@ -/** @jsxRuntime automatic */ -/** @jsxImportSource preact */ - +import { jsx as _jsx } from "preact/jsx-runtime"; import type { PreactComponent } from "../engine/block.ts"; export type MetabaseProps = { @@ -8,12 +6,11 @@ export type MetabaseProps = { }; export const metabasePreview = (iframeSrc: string): PreactComponent => ({ - Component: () => ( -