Skip to content

Commit

Permalink
Import from deco instead of live
Browse files Browse the repository at this point in the history
Signed-off-by: Marcos Candeia <marrcooos@gmail.com>
  • Loading branch information
mcandeia committed Sep 3, 2023
1 parent c577b4d commit ef19421
Show file tree
Hide file tree
Showing 53 changed files with 119 additions and 119 deletions.
6 changes: 3 additions & 3 deletions compat/$live/handlers/devPage.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Page } from "$live/blocks/page.ts";
import { context } from "$live/live.ts";
import { adminUrlFor, isAdmin } from "$live/utils/admin.ts";
import { Page } from "deco/blocks/page.ts";
import { context } from "deco/live.ts";
import { adminUrlFor, isAdmin } from "deco/utils/admin.ts";
import { ConnInfo } from "std/http/server.ts";
import Fresh from "../../../website/handlers/fresh.ts";
import { pageIdFromMetadata } from "../../../website/pages/Page.tsx";
Expand Down
4 changes: 2 additions & 2 deletions compat/$live/handlers/router.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Handler } from "$live/blocks/handler.ts";
import { FnContext } from "$live/types.ts";
import { Handler } from "deco/blocks/handler.ts";
import { FnContext } from "deco/types.ts";
import { Routes } from "../../../website/flags/audience.ts";
import { router } from "../../../website/handlers/router.ts";

Expand Down
16 changes: 8 additions & 8 deletions compat/$live/loaders/state.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Accounts } from "$live/blocks/account.ts";
import { Flag } from "$live/blocks/flag.ts";
import { Loader } from "$live/blocks/loader.ts";
import { Page } from "$live/blocks/page.ts";
import { Section } from "$live/blocks/section.ts";
import { Resolvable } from "$live/engine/core/resolver.ts";
import { Apps, LoaderContext } from "$live/mod.ts";
import { MiddlewareConfig } from "$live/routes/_middleware.ts";
import { Accounts } from "deco/blocks/account.ts";
import { Flag } from "deco/blocks/flag.ts";
import { Loader } from "deco/blocks/loader.ts";
import { Page } from "deco/blocks/page.ts";
import { Section } from "deco/blocks/section.ts";
import { Resolvable } from "deco/engine/core/resolver.ts";
import { Apps, LoaderContext } from "deco/mod.ts";
import { MiddlewareConfig } from "deco/routes/_middleware.ts";

/**
* @titleBy key
Expand Down
8 changes: 4 additions & 4 deletions compat/$live/mod.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// deno-lint-ignore-file no-explicit-any
import type { App } from "$live/mod.ts";
import type { App } from "deco/mod.ts";
// this should not be changed to $live because newly created versions might not include live.gen.ts.
import { buildSourceMap } from "$live/blocks/utils.tsx";
import type { Manifest as LiveManifest } from "$live/live.gen.ts";
import { buildSourceMap } from "deco/blocks/utils.tsx";
import type { Manifest as LiveManifest } from "deco/live.gen.ts";

import type { Manifest as WebSiteManifest } from "../../website/manifest.gen.ts";
import webSite, { Props } from "../../website/mod.ts";
import type { Manifest as WorkflowsManifest } from "../../workflows/manifest.gen.ts";

import { SourceMap } from "$live/blocks/app.ts";
import { SourceMap } from "deco/blocks/app.ts";
import workflows from "../../workflows/mod.ts";
import manifest, { Manifest as _Manifest } from "./manifest.gen.ts";

Expand Down
4 changes: 2 additions & 2 deletions compat/$live/sections/Conditional_Beta.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Section } from "$live/blocks/section.ts";
import { Section } from "deco/blocks/section.ts";
import { renderSection } from "../../../website/pages/Page.tsx";
import withConditions, {
Props as ConditionalProps,
} from "$live/utils/conditionals.ts";
} from "deco/utils/conditionals.ts";

export interface Props {
sections: Section[];
Expand Down
4 changes: 2 additions & 2 deletions compat/$live/sections/PageInclude.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Page } from "$live/blocks/page.ts";
import { notUndefined } from "$live/engine/core/utils.ts";
import { Page } from "deco/blocks/page.ts";
import { notUndefined } from "deco/engine/core/utils.ts";

import {
Props as LivePageProps,
Expand Down
2 changes: 1 addition & 1 deletion compat/$live/sections/Slot.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isSection, Section } from "$live/blocks/section.ts";
import { isSection, Section } from "deco/blocks/section.ts";

export type WellKnownSlots =
| "content"
Expand Down
4 changes: 2 additions & 2 deletions compat/$live/sections/UseSlot.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Section } from "$live/blocks/section.ts";
import { notUndefined } from "$live/engine/core/utils.ts";
import { Section } from "deco/blocks/section.ts";
import { notUndefined } from "deco/engine/core/utils.ts";
import { useLivePageContext } from "../../../website/pages/Page.tsx";
import { WellKnownSlots } from "../sections/Slot.tsx";

Expand Down
6 changes: 3 additions & 3 deletions compat/std/mod.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// deno-lint-ignore-file no-explicit-any
export { onBeforeResolveProps } from "../../website/mod.ts";
import { SourceMap } from "$live/blocks/app.ts";
import { buildSourceMap } from "$live/blocks/utils.tsx";
import type { App, AppManifest } from "$live/mod.ts";
import { SourceMap } from "deco/blocks/app.ts";
import { buildSourceMap } from "deco/blocks/utils.tsx";
import type { App, AppManifest } from "deco/mod.ts";
import type { PickByValue } from "https://esm.sh/utility-types@3.10.0";
import $live from "../$live/mod.ts";
import type { Manifest as ShopifyManifest } from "../../shopify/manifest.gen.ts";
Expand Down
2 changes: 1 addition & 1 deletion compat/std/runtime.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { forApp } from "$live/clients/withManifest.ts";
import { forApp } from "deco/clients/withManifest.ts";
import app from "./mod.ts";

export const Runtime = forApp<ReturnType<typeof app>>();
2 changes: 1 addition & 1 deletion decohub/mod.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { App, FnContext } from "$live/mod.ts";
import type { App, FnContext } from "deco/mod.ts";
import manifest, { Manifest } from "./manifest.gen.ts";

// deno-lint-ignore ban-types
Expand Down
14 changes: 7 additions & 7 deletions deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
"lock": false,
"tasks": {
"check": "deno fmt && deno lint",
"release": "deno eval 'import \"$live/scripts/release.ts\"'",
"start": "deno eval 'import \"$live/scripts/apps/bundle.ts\"'",
"link": "deno eval 'import \"$live/scripts/apps/link.ts\"'",
"unlink": "deno eval 'import \"$live/scripts/apps/unlink.ts\"'",
"serve": "deno eval 'import \"$live/scripts/apps/serve.ts\"'",
"watcher": "deno eval 'import \"$live/scripts/apps/watcher.ts\"'",
"update": "deno eval 'import \"$live/scripts/update.ts\"'",
"release": "deno eval 'import \"deco/scripts/release.ts\"'",
"start": "deno eval 'import \"deco/scripts/apps/bundle.ts\"'",
"link": "deno eval 'import \"deco/scripts/apps/link.ts\"'",
"unlink": "deno eval 'import \"deco/scripts/apps/unlink.ts\"'",
"serve": "deno eval 'import \"deco/scripts/apps/serve.ts\"'",
"watcher": "deno eval 'import \"deco/scripts/apps/watcher.ts\"'",
"update": "deno eval 'import \"deco/scripts/update.ts\"'",
"new": "deno run -A ./scripts/new.ts"
},
"githooks": {
Expand Down
2 changes: 1 addition & 1 deletion handlebars/mod.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { App, AppContext as AC } from "$live/mod.ts";
import type { App, AppContext as AC } from "deco/mod.ts";
import { SourceMap } from "deco/blocks/app.ts";
import { SectionModule } from "deco/blocks/section.ts";
import { JSONSchema7 } from "deco/deps.ts";
Expand Down
4 changes: 2 additions & 2 deletions import_map.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"imports": {
"$live/": "https://denopkg.com/deco-cx/deco@1.34.3/",
"$fresh/": "https://denopkg.com/denoland/fresh@1.4.2/",
"preact": "https://esm.sh/preact@10.15.1",
"preact/": "https://esm.sh/preact@10.15.1/",
Expand All @@ -10,6 +9,7 @@
"std/": "https://deno.land/std@0.190.0/",
"partytown/": "https://deno.land/x/partytown@0.3.4/",
"deco-sites/std/": "https://denopkg.com/deco-sites/std@1.21.7/",
"deco/": "https://denopkg.com/deco-cx/deco@1.34.3/"
"deco/": "https://deno.land/x/deco@1.34.5/",
"$live/": "https://deno.land/x/deco@1.34.5/"
}
}
2 changes: 1 addition & 1 deletion scripts/new.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ await Deno.writeTextFile(
await Deno.writeTextFile(
join(Deno.cwd(), appName, "mod.ts"),
`
import type { App, AppContext as AC } from "$live/mod.ts";
import type { App, AppContext as AC } from "deco/mod.ts";
import manifest, { Manifest } from "./manifest.gen.ts";
// deno-lint-ignore ban-types
Expand Down
2 changes: 1 addition & 1 deletion shopify/mod.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { App, FnContext } from "$live/mod.ts";
import type { App, FnContext } from "deco/mod.ts";
import { fetchSafe } from "../utils/fetch.ts";
import { createGraphqlClient } from "../utils/graphql.ts";
import manifest, { Manifest } from "./manifest.gen.ts";
Expand Down
2 changes: 1 addition & 1 deletion shopify/runtime.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { proxy } from "$live/clients/withManifest.ts";
import { proxy } from "deco/clients/withManifest.ts";
import { Manifest } from "./manifest.gen.ts";

export const invoke = proxy<Manifest>();
2 changes: 1 addition & 1 deletion utils/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
retry,
} from "https://esm.sh/cockatiel@3.1.1?target=es2019";
import { HttpError } from "./http.ts";
import { fetch } from "$live/runtime/fetch/mod.ts";
import { fetch } from "deco/runtime/fetch/mod.ts";

// this error is thrown by deno deploy when the connection is closed by the server.
// check the discussion at discord: https://discord.com/channels/985687648595243068/1107104244517048320/1107111259813466192
Expand Down
2 changes: 1 addition & 1 deletion utils/http.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RequestInit } from "$live/runtime/fetch/mod.ts";
import { RequestInit } from "deco/runtime/fetch/mod.ts";
import { fetchSafe } from "./fetch.ts";

const HTTP_VERBS = new Set(
Expand Down
2 changes: 1 addition & 1 deletion vnda/mod.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { App, FnContext } from "$live/mod.ts";
import type { App, FnContext } from "deco/mod.ts";
import { createHttpClient } from "../utils/http.ts";
import manifest, { Manifest } from "./manifest.gen.ts";
import { API } from "./utils/client/client.ts";
Expand Down
2 changes: 1 addition & 1 deletion vnda/runtime.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { proxy } from "$live/clients/withManifest.ts";
import { proxy } from "deco/clients/withManifest.ts";
import { Manifest } from "./manifest.gen.ts";

export const invoke = proxy<Manifest>();
2 changes: 1 addition & 1 deletion vtex/handlers/sitemap.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Proxy from "$live/handlers/proxy.ts";
import Proxy from "deco/handlers/proxy.ts";
import { ConnInfo } from "std/http/server.ts";
import { AppContext } from "../mod.ts";

Expand Down
2 changes: 1 addition & 1 deletion vtex/mod.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { App, FnContext } from "$live/mod.ts";
import type { App, FnContext } from "deco/mod.ts";
import { fetchSafe } from "./utils/fetchVTEX.ts";
import { createHttpClient } from "../utils/http.ts";
import manifest, { Manifest } from "./manifest.gen.ts";
Expand Down
2 changes: 1 addition & 1 deletion vtex/runtime.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { proxy } from "$live/clients/withManifest.ts";
import { proxy } from "deco/clients/withManifest.ts";
import { Manifest } from "./manifest.gen.ts";

export const invoke = proxy<Manifest>();
8 changes: 4 additions & 4 deletions website/actions/secrets/encrypt.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { badRequest } from "$live/engine/errors.ts";
import { context } from "$live/live.ts";
import { ActionContext } from "$live/types.ts";
import { allowCorsFor } from "$live/utils/http.ts";
import { badRequest } from "deco/engine/errors.ts";
import { context } from "deco/live.ts";
import { ActionContext } from "deco/types.ts";
import { allowCorsFor } from "deco/utils/http.ts";
import { encryptToHex } from "../../utils/crypto.ts";

export interface Props {
Expand Down
4 changes: 2 additions & 2 deletions website/components/_Analytics.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { context } from "$live/live.ts";
import { context } from "deco/live.ts";
import Script from "partytown/Script.tsx";
import Jitsu from "partytown/integrations/Jitsu.tsx";
import { Flag } from "$live/types.ts";
import { Flag } from "deco/types.ts";

const main = (
userData: {
Expand Down
2 changes: 1 addition & 1 deletion website/components/_Controls.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Head } from "$fresh/runtime.ts";
import type { Flag, Site } from "$live/types.ts";
import type { Flag, Site } from "deco/types.ts";

interface Page {
id: string | number;
Expand Down
12 changes: 6 additions & 6 deletions website/flags/audience.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { FlagObj } from "$live/blocks/flag.ts";
import { Handler } from "$live/blocks/handler.ts";
import { Matcher } from "$live/blocks/matcher.ts";
import JsonViewer from "$live/components/JsonViewer.tsx";
import { Resolvable } from "$live/engine/core/resolver.ts";
import { metabasePreview } from "$live/utils/metabase.tsx";
import { FlagObj } from "deco/blocks/flag.ts";
import { Handler } from "deco/blocks/handler.ts";
import { Matcher } from "deco/blocks/matcher.ts";
import JsonViewer from "deco/components/JsonViewer.tsx";
import { Resolvable } from "deco/engine/core/resolver.ts";
import { metabasePreview } from "deco/utils/metabase.tsx";
import Flag from "./flag.ts";
export { onBeforeResolveProps } from "./everyone.ts";
/**
Expand Down
6 changes: 3 additions & 3 deletions website/flags/everyone.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { FlagObj } from "$live/blocks/flag.ts";
import { asResolved } from "$live/engine/core/resolver.ts";
import { FlagObj } from "deco/blocks/flag.ts";
import { asResolved } from "deco/engine/core/resolver.ts";
import Audience, { Route, Routes } from "./audience.ts";
import MatchAlways from "$live/matchers/MatchAlways.ts";
import MatchAlways from "deco/matchers/MatchAlways.ts";

export interface EveryoneConfig {
routes?: Routes;
Expand Down
2 changes: 1 addition & 1 deletion website/flags/flag.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FlagObj } from "$live/blocks/flag.ts";
import { FlagObj } from "deco/blocks/flag.ts";
export { onBeforeResolveProps } from "./everyone.ts";

export type Props<T> = FlagObj<T>;
Expand Down
6 changes: 3 additions & 3 deletions website/flags/multivariate.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { MultivariateFlag, Variant } from "$live/blocks/flag.ts";
import { Section } from "$live/blocks/section.ts";
import { asResolved } from "$live/engine/core/resolver.ts";
import { MultivariateFlag, Variant } from "deco/blocks/flag.ts";
import { Section } from "deco/blocks/section.ts";
import { asResolved } from "deco/engine/core/resolver.ts";

/**
* @title Multivariate
Expand Down
2 changes: 1 addition & 1 deletion website/functions/requestToParam.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { FunctionContext, LoaderFunction } from "$live/types.ts";
import type { FunctionContext, LoaderFunction } from "deco/types.ts";

export type RequestURLParam = string;

Expand Down
6 changes: 3 additions & 3 deletions website/handlers/fresh.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { HandlerContext } from "$fresh/server.ts";
import { Page } from "$live/blocks/page.ts";
import { RouterContext } from "$live/types.ts";
import { allowCorsFor } from "$live/utils/http.ts";
import { Page } from "deco/blocks/page.ts";
import { RouterContext } from "deco/types.ts";
import { allowCorsFor } from "deco/utils/http.ts";
import { ConnInfo } from "std/http/server.ts";

export interface FreshConfig {
Expand Down
2 changes: 1 addition & 1 deletion website/handlers/proxy.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getSetCookies, Handler, setCookie } from "std/http/mod.ts";
import { isFreshCtx } from "$live/handlers/fresh.ts";
import { isFreshCtx } from "deco/handlers/fresh.ts";

const HOP_BY_HOP = [
"Keep-Alive",
Expand Down
12 changes: 6 additions & 6 deletions website/handlers/router.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { ResolveOptions } from "$live/engine/core/mod.ts";
import { ResolveOptions } from "deco/engine/core/mod.ts";
import {
isDeferred,
Resolvable,
ResolveFunc,
} from "$live/engine/core/resolver.ts";
import { isAwaitable } from "$live/engine/core/utils.ts";
import { FreshContext } from "$live/engine/manifest/manifest.ts";
import { isFreshCtx } from "$live/handlers/fresh.ts";
import { Flag, LiveState, RouterContext } from "$live/types.ts";
} from "deco/engine/core/resolver.ts";
import { isAwaitable } from "deco/engine/core/utils.ts";
import { FreshContext } from "deco/engine/manifest/manifest.ts";
import { isFreshCtx } from "deco/handlers/fresh.ts";
import { Flag, LiveState, RouterContext } from "deco/types.ts";
import { ConnInfo, Handler } from "std/http/server.ts";
import { Route, Routes } from "../flags/audience.ts";
import { AppContext } from "../mod.ts";
Expand Down
6 changes: 3 additions & 3 deletions website/handlers/sitemap.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Handler } from "$live/blocks/handler.ts";
import type { Resolvable } from "$live/engine/core/resolver.ts";
import { isResolvable } from "$live/engine/core/resolver.ts";
import type { Handler } from "deco/blocks/handler.ts";
import type { Resolvable } from "deco/engine/core/resolver.ts";
import { isResolvable } from "deco/engine/core/resolver.ts";
import { ConnInfo } from "std/http/server.ts";
import { Route } from "../flags/audience.ts";

Expand Down
2 changes: 1 addition & 1 deletion website/loaders/extension.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PromiseOrValue } from "$live/engine/core/utils.ts";
import { PromiseOrValue } from "deco/engine/core/utils.ts";

/**
* @title The type extension.
Expand Down
2 changes: 1 addition & 1 deletion website/loaders/pages.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import defaults from "$live/engine/manifest/defaults.ts";
import defaults from "deco/engine/manifest/defaults.ts";
import { Route } from "../flags/audience.ts";
import { AppContext } from "../mod.ts";
import LivePage from "../pages/Page.tsx";
Expand Down
2 changes: 1 addition & 1 deletion website/loaders/secret.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { context } from "$live/live.ts";
import { context } from "deco/live.ts";
import { decryptFromHex } from "../utils/crypto.ts";

/**
Expand Down
2 changes: 1 addition & 1 deletion website/matchers/device.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MatchContext } from "$live/blocks/matcher.ts";
import { MatchContext } from "deco/blocks/matcher.ts";
import { UAParser } from "https://esm.sh/ua-parser-js@1.0.35";

/**
Expand Down
2 changes: 1 addition & 1 deletion website/matchers/host.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MatchContext } from "$live/blocks/matcher.ts";
import { MatchContext } from "deco/blocks/matcher.ts";

/**
* @title {{{includes}}} {{{match}}}
Expand Down
2 changes: 1 addition & 1 deletion website/matchers/location.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MatchContext } from "$live/blocks/matcher.ts";
import { MatchContext } from "deco/blocks/matcher.ts";

/**
* @title {{{city}}} {{{regionCode}}} {{{country}}}
Expand Down
2 changes: 1 addition & 1 deletion website/matchers/multi.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MatchContext, Matcher } from "$live/blocks/matcher.ts";
import { MatchContext, Matcher } from "deco/blocks/matcher.ts";

/**
* @title Combined options with {{{op}}}
Expand Down
2 changes: 1 addition & 1 deletion website/matchers/site.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MatchContext } from "$live/blocks/matcher.ts";
import { MatchContext } from "deco/blocks/matcher.ts";

/**
* @title {{{siteId}}}
Expand Down
Loading

0 comments on commit ef19421

Please sign in to comment.