From d8866561085d16a92a7aef9842d48b6d0c036213 Mon Sep 17 00:00:00 2001 From: guitavano Date: Tue, 10 Sep 2024 11:16:46 -0300 Subject: [PATCH] Tavano/revert (#844) * Revert "Migrate to use deco from JSR (#770)" This reverts commit 6aa83a0504f33205657084368b27b2b92affbd54. * fmt --- admin/types.ts | 48 +++++++++++++++ ai-assistants/actions/awsUploadImage.ts | 8 ++- ai-assistants/actions/chat.ts | 2 +- ai-assistants/actions/describeImage.ts | 8 ++- ai-assistants/actions/transcribeAudio.ts | 8 ++- ai-assistants/chat/messages.ts | 8 +-- ai-assistants/mod.ts | 19 +++--- ai-assistants/runtime.ts | 2 +- ai-assistants/schema.ts | 2 +- ai-assistants/utils/blobConversion.ts | 2 +- algolia/mod.ts | 2 +- algolia/sections/Analytics/Algolia.tsx | 4 +- algolia/workflows/index/product.ts | 3 +- analytics/components/DecoAnalytics.tsx | 2 +- analytics/loaders/DecoAnalyticsScript.ts | 4 +- analytics/mod.ts | 2 +- anthropic/actions/code.ts | 4 +- anthropic/actions/stream.ts | 7 ++- anthropic/mod.ts | 2 +- blog/loaders/Author.ts | 2 +- blog/loaders/BlogPostItem.ts | 4 +- blog/loaders/BlogPostPage.ts | 4 +- blog/loaders/Blogpost.ts | 2 +- blog/loaders/BlogpostList.ts | 6 +- blog/loaders/BlogpostListing.ts | 8 +-- blog/loaders/Category.ts | 2 +- blog/loaders/GetCategories.ts | 6 +- blog/mod.ts | 4 +- blog/sections/Seo/SeoBlogPost.tsx | 6 +- blog/sections/Seo/SeoBlogPostListing.tsx | 6 +- blog/sections/Template.tsx | 2 +- blog/types.ts | 4 +- blog/utils/handlePosts.ts | 2 +- blog/utils/records.ts | 4 +- brand-assistant/loaders/assistant.ts | 8 +-- brand-assistant/mod.ts | 2 +- commerce/mod.ts | 4 +- commerce/types.ts | 2 +- compat/$live/handlers/devPage.ts | 6 +- compat/$live/handlers/router.ts | 4 +- compat/$live/loaders/state.ts | 18 +++--- compat/$live/mod.ts | 4 +- compat/$live/sections/PageInclude.tsx | 4 +- compat/$live/sections/Slot.tsx | 2 +- .../functions/vtexLegacyProductDetailsPage.ts | 2 +- compat/std/functions/vtexLegacyProductList.ts | 2 +- .../functions/vtexLegacyProductListingPage.ts | 2 +- .../vtexLegacyRelatedProductsLoader.ts | 2 +- compat/std/functions/vtexNavbar.ts | 4 +- .../std/functions/vtexProductDetailsPage.ts | 2 +- compat/std/functions/vtexProductList.ts | 2 +- .../std/functions/vtexProductListingPage.ts | 2 +- compat/std/functions/vtexSuggestions.ts | 2 +- compat/std/functions/vtexWishlist.ts | 2 +- compat/std/mod.ts | 5 +- compat/std/runtime.ts | 2 +- compat/std/sections/Analytics.tsx | 2 +- crux/mod.ts | 2 +- crux/preview/Preview.tsx | 3 +- decohub/apps/vtex.ts | 2 +- decohub/mod.ts | 7 ++- deno.json | 58 +++++++++---------- emailjs/mod.ts | 2 +- files/loaders/app.ts | 8 +-- files/mod.ts | 2 +- htmx/mod.ts | 4 +- htmx/sections/Deferred.tsx | 8 +-- htmx/sections/htmx.tsx | 6 +- implementation/mod.ts | 2 +- konfidency/loaders/productDetailsPage.ts | 2 +- konfidency/mod.ts | 2 +- linx-impulse/middleware.ts | 4 +- linx-impulse/mod.ts | 2 +- linx-impulse/runtime.ts | 2 +- .../Analytics/LinxImpulsePageView.tsx | 6 +- .../sections/Script/LinxImpulseScript.tsx | 2 +- linx/loaders/page.ts | 4 +- linx/loaders/pages.ts | 4 +- linx/loaders/path.ts | 2 +- linx/mod.ts | 2 +- linx/runtime.ts | 2 +- mailchimp/actions/subscribe.ts | 2 +- mailchimp/loaders/options/lists.ts | 2 +- mailchimp/mod.ts | 2 +- mailchimp/utils/transform.ts | 2 +- nuvemshop/mod.ts | 8 +-- nuvemshop/runtime.ts | 2 +- nuvemshop/utils/cart.ts | 2 +- nuvemshop/utils/types.ts | 2 +- openai/mod.ts | 2 +- power-reviews/mod.ts | 2 +- ra-trustvox/mod.ts | 2 +- ra-trustvox/sections/TrustvoxCertificate.tsx | 2 +- .../sections/TrustvoxProductReviews.tsx | 2 +- ra-trustvox/sections/TrustvoxRateConfig.tsx | 2 +- .../sections/TrustvoxStoreReviewsCarousel.tsx | 2 +- records/deps.ts | 2 +- records/mod.ts | 4 +- records/scripts/checkDbCredential.ts | 2 +- records/scripts/pullProd.ts | 2 +- records/utils.ts | 6 +- resend/README.md | 2 +- resend/mod.ts | 3 +- scripts/new.ts | 4 +- scripts/start.ts | 15 ++--- scripts/update.ts | 0 shopify/mod.ts | 10 ++-- shopify/runtime.ts | 2 +- shopify/utils/cart.ts | 2 +- smarthint/hooks/useAutocomplete.ts | 2 +- smarthint/loaders/productListingPage.ts | 4 +- smarthint/mod.ts | 2 +- smarthint/runtime.ts | 2 +- .../sections/Analytics/SmarthintTracking.tsx | 6 +- smarthint/utils/getSession.ts | 2 +- sourei/mod.ts | 4 +- sourei/sections/Analytics/Sourei.tsx | 2 +- typesense/mod.ts | 2 +- typesense/utils/once.ts | 8 ++- typesense/utils/product.ts | 4 +- typesense/workflows/index/product.ts | 3 +- utils/cookie.ts | 7 ++- utils/fetch.ts | 8 ++- utils/framework.tsx | 7 ++- utils/http.ts | 2 +- utils/pool.ts | 12 ++-- utils/weakcache.ts | 1 - utils/worker.ts | 10 ++-- verified-reviews/mod.ts | 2 +- verified-reviews/utils/client.ts | 6 +- vnda/actions/cart/simulation.ts | 2 +- vnda/hooks/context.ts | 2 +- vnda/middleware.ts | 2 +- vnda/mod.ts | 2 +- vnda/runtime.ts | 2 +- vnda/utils/cart.ts | 2 +- vnda/utils/segment.ts | 2 +- vtex/actions/analytics/sendEvent.ts | 2 +- vtex/actions/cart/addItems.ts | 4 +- vtex/actions/cart/addOfferings.ts | 4 +- vtex/actions/cart/clearOrderformMessages.ts | 2 +- vtex/actions/cart/getInstallment.ts | 2 +- vtex/actions/cart/removeItemAttachment.ts | 2 +- vtex/actions/cart/removeItems.ts | 2 +- vtex/actions/cart/removeOffering.ts | 4 +- vtex/actions/cart/simulation.ts | 2 +- vtex/actions/cart/updateAttachment.ts | 2 +- vtex/actions/cart/updateCoupons.ts | 2 +- vtex/actions/cart/updateGifts.ts | 2 +- vtex/actions/cart/updateItemAttachment.ts | 2 +- vtex/actions/cart/updateItemPrice.ts | 2 +- vtex/actions/cart/updateItems.ts | 2 +- vtex/actions/cart/updateProfile.ts | 2 +- vtex/actions/cart/updateUser.ts | 2 +- vtex/actions/masterdata/createDocument.ts | 2 +- vtex/actions/newsletter/subscribe.ts | 2 +- vtex/actions/notifyme.ts | 2 +- vtex/actions/review/submit.ts | 2 +- vtex/actions/trigger.ts | 2 +- vtex/actions/wishlist/addItem.ts | 2 +- vtex/actions/wishlist/removeItem.ts | 2 +- .../VTEXPortalDataLayerCompatibility.tsx | 6 +- vtex/handlers/sitemap.ts | 2 +- vtex/hooks/context.ts | 5 +- vtex/hooks/useAutocomplete.ts | 2 +- vtex/hooks/useCart.ts | 4 +- vtex/hooks/useWishlist.ts | 4 +- vtex/loaders/cart.ts | 2 +- vtex/loaders/categories/tree.ts | 4 +- vtex/loaders/collections/list.ts | 6 +- vtex/loaders/config.ts | 14 ++--- .../intelligentSearch/productDetailsPage.ts | 8 +-- vtex/loaders/intelligentSearch/productList.ts | 4 +- .../intelligentSearch/productListingPage.ts | 4 +- .../productSearchValidator.ts | 4 +- vtex/loaders/intelligentSearch/suggestions.ts | 4 +- vtex/loaders/intelligentSearch/topsearches.ts | 4 +- vtex/loaders/legacy/brands.ts | 4 +- vtex/loaders/legacy/pageType.ts | 2 +- vtex/loaders/legacy/productDetailsPage.ts | 2 +- vtex/loaders/legacy/productList.ts | 2 +- vtex/loaders/legacy/productListingPage.ts | 4 +- vtex/loaders/legacy/relatedProductsLoader.ts | 4 +- vtex/loaders/legacy/suggestions.ts | 4 +- vtex/loaders/masterdata/searchDocuments.ts | 2 +- vtex/loaders/navbar.ts | 2 +- vtex/loaders/options/productIdByTerm.ts | 4 +- vtex/loaders/orders/list.ts | 4 +- vtex/loaders/paths/PDPDefaultPath.ts | 4 +- vtex/loaders/paths/PLPDefaultPath.ts | 6 +- vtex/loaders/product/extend.ts | 4 +- .../loaders/product/extensions/detailsPage.ts | 8 +-- vtex/loaders/product/extensions/list.ts | 8 +-- .../loaders/product/extensions/listingPage.ts | 8 +-- .../loaders/product/extensions/suggestions.ts | 8 +-- vtex/loaders/product/wishlist.ts | 4 +- vtex/loaders/proxy.ts | 6 +- vtex/loaders/user.ts | 4 +- vtex/loaders/wishlist.ts | 2 +- vtex/loaders/workflow/product.ts | 2 +- vtex/loaders/workflow/products.ts | 2 +- vtex/middleware.ts | 4 +- vtex/mod.ts | 18 +++--- vtex/preview/Preview.tsx | 6 +- vtex/runtime.ts | 4 +- vtex/sections/Analytics/Vtex.tsx | 10 ++-- vtex/utils/cacheBySegment.ts | 2 +- vtex/utils/client.ts | 4 +- vtex/utils/cookies.ts | 2 +- vtex/utils/extensions/simulation.ts | 6 +- vtex/utils/intelligentSearch.ts | 4 +- vtex/utils/legacy.ts | 4 +- vtex/utils/orderForm.ts | 4 +- vtex/utils/segment.ts | 6 +- vtex/utils/similars.ts | 2 +- vtex/utils/vtexId.ts | 4 +- vtex/workflows/events.ts | 6 +- vtex/workflows/product/index.ts | 12 ++-- wake/hooks/context.ts | 4 +- wake/mod.ts | 2 +- wake/runtime.ts | 2 +- wake/utils/cart.ts | 2 +- wake/utils/user.ts | 2 +- wap/mod.ts | 6 +- wap/runtime.ts | 2 +- wap/utils/cart.ts | 2 +- weather/mod.ts | 2 +- website/Preview.tsx | 2 +- website/actions/secrets/encrypt.ts | 3 +- website/components/Analytics.tsx | 4 +- website/components/Clickhouse.tsx | 2 +- website/components/Events.tsx | 7 ++- website/components/Image.tsx | 2 +- website/components/Picture.tsx | 6 +- website/components/Seo.tsx | 2 +- website/components/_Controls.tsx | 11 ++-- website/components/_seo/Facebook.tsx | 2 +- website/components/_seo/Google.tsx | 2 +- website/components/_seo/LinkedIn.tsx | 2 +- website/components/_seo/Preview.tsx | 16 ++--- website/components/_seo/Slack.tsx | 4 +- website/components/_seo/Telegram.tsx | 4 +- website/components/_seo/Twitter.tsx | 6 +- website/components/_seo/WhatsApp.tsx | 2 +- website/flags/audience.ts | 9 ++- website/flags/everyone.ts | 6 +- website/flags/flag.ts | 2 +- website/flags/multivariate/image.ts | 8 +-- website/flags/multivariate/message.ts | 6 +- website/flags/multivariate/page.ts | 7 +-- website/flags/multivariate/section.ts | 7 +-- website/functions/requestToParam.ts | 2 +- website/handlers/fresh.ts | 41 +++++++------ website/handlers/proxy.ts | 9 +-- website/handlers/redirect.ts | 4 +- website/handlers/router.ts | 24 ++++---- website/handlers/sitemap.ts | 8 +-- website/loaders/asset.ts | 2 +- website/loaders/extension.ts | 2 +- website/loaders/fonts/googleFonts.ts | 2 +- website/loaders/fonts/local.ts | 2 +- website/loaders/image.ts | 2 +- website/loaders/options/routes.ts | 4 +- website/loaders/options/urlParams.ts | 4 +- website/loaders/pages.ts | 11 ++-- website/loaders/redirect.ts | 2 +- website/loaders/redirects.ts | 11 ++-- website/loaders/redirectsFromCsv.ts | 5 +- website/loaders/secret.ts | 4 +- website/loaders/secretString.ts | 2 +- website/matchers/cookie.ts | 4 +- website/matchers/cron.ts | 2 +- website/matchers/device.ts | 2 +- website/matchers/host.ts | 2 +- website/matchers/location.ts | 4 +- website/matchers/multi.ts | 2 +- website/matchers/negate.ts | 2 +- website/matchers/pathname.ts | 2 +- website/matchers/queryString.ts | 2 +- website/matchers/site.ts | 2 +- website/matchers/userAgent.ts | 2 +- website/mod.ts | 16 ++--- website/pages/Page.tsx | 24 ++++---- website/sections/Analytics/Analytics.tsx | 2 +- website/sections/Rendering/Deferred.tsx | 10 ++-- website/sections/Rendering/Lazy.tsx | 9 +-- website/sections/Seo/Seo.tsx | 2 +- website/sections/Seo/SeoV2.tsx | 9 +-- website/utils/crypto.ts | 10 ++-- website/utils/image/engines/wasm/engine.ts | 2 +- website/utils/multivariate.ts | 6 +- workflows/actions/start.ts | 16 ++--- workflows/deps.ts | 2 +- workflows/handlers/workflowRunner.ts | 17 ++++-- workflows/initializer.ts | 2 +- workflows/loaders/events.ts | 4 +- workflows/loaders/get.ts | 2 +- workflows/mod.ts | 2 +- workflows/utils/awaiters.ts | 4 +- 299 files changed, 730 insertions(+), 673 deletions(-) create mode 100644 admin/types.ts delete mode 100644 scripts/update.ts delete mode 100644 utils/weakcache.ts diff --git a/admin/types.ts b/admin/types.ts new file mode 100644 index 000000000..75ad8e5df --- /dev/null +++ b/admin/types.ts @@ -0,0 +1,48 @@ +import { type Resolvable } from "deco/engine/core/resolver.ts"; +import { type fjp } from "./deps.ts"; + +export interface Pagination { + data: T[]; + page: number; + pageSize: number; + total: number; +} + +export interface PatchState { + type: "patch-state"; + payload: fjp.Operation[]; + revision: string; +} + +export interface FetchState { + type: "fetch-state"; +} + +export interface StatePatched { + type: "state-patched"; + payload: fjp.Operation[]; + revision: string; + // Maybe add data and user info in here + metadata?: unknown; +} + +export interface StateFetched { + type: "state-fetched"; + payload: State; +} + +export interface OperationFailed { + type: "operation-failed"; + code: "UNAUTHORIZED" | "INTERNAL_SERVER_ERROR"; + reason: string; +} + +export type Acked = T & { ack: string }; + +export interface State { + decofile: Record; + revision: string; +} + +export type Commands = PatchState | FetchState; +export type Events = StatePatched | StateFetched | OperationFailed; diff --git a/ai-assistants/actions/awsUploadImage.ts b/ai-assistants/actions/awsUploadImage.ts index 68d5997d9..a5904a065 100644 --- a/ai-assistants/actions/awsUploadImage.ts +++ b/ai-assistants/actions/awsUploadImage.ts @@ -1,7 +1,9 @@ -import { logger, meter, ValueType } from "@deco/deco/o11y"; -import { AppContext } from "../mod.ts"; -import { AssistantIds } from "../types.ts"; +import { logger } from "deco/observability/otel/config.ts"; +import { meter } from "deco/observability/otel/metrics.ts"; import base64ToBlob from "../utils/blobConversion.ts"; +import { AssistantIds } from "../types.ts"; +import { ValueType } from "deco/deps.ts"; +import { AppContext } from "../mod.ts"; const stats = { awsUploadImageError: meter.createCounter("assistant_aws_upload_error", { diff --git a/ai-assistants/actions/chat.ts b/ai-assistants/actions/chat.ts index d30d62b03..00aac7ec5 100644 --- a/ai-assistants/actions/chat.ts +++ b/ai-assistants/actions/chat.ts @@ -1,6 +1,6 @@ import { AppContext } from "../mod.ts"; -import { badRequest, notFound } from "@deco/deco"; +import { badRequest, notFound } from "deco/mod.ts"; import { messageProcessorFor } from "../chat/messages.ts"; import { Notify, Queue } from "../deps.ts"; diff --git a/ai-assistants/actions/describeImage.ts b/ai-assistants/actions/describeImage.ts index 904357038..edaa5d76d 100644 --- a/ai-assistants/actions/describeImage.ts +++ b/ai-assistants/actions/describeImage.ts @@ -1,7 +1,9 @@ -import { shortcircuit } from "@deco/deco"; -import { logger, meter, ValueType } from "@deco/deco/o11y"; -import { AppContext } from "../mod.ts"; +import { logger } from "deco/observability/otel/config.ts"; +import { meter } from "deco/observability/otel/metrics.ts"; import { AssistantIds } from "../types.ts"; +import { ValueType } from "deco/deps.ts"; +import { AppContext } from "../mod.ts"; +import { shortcircuit } from "deco/engine/errors.ts"; const stats = { promptTokens: meter.createHistogram("assistant_image_prompt_tokens", { diff --git a/ai-assistants/actions/transcribeAudio.ts b/ai-assistants/actions/transcribeAudio.ts index 172aaca8c..f2489a311 100644 --- a/ai-assistants/actions/transcribeAudio.ts +++ b/ai-assistants/actions/transcribeAudio.ts @@ -1,7 +1,9 @@ -import { logger, meter, ValueType } from "@deco/deco/o11y"; -import { AppContext } from "../mod.ts"; -import { AssistantIds } from "../types.ts"; +import { logger } from "deco/observability/otel/config.ts"; import base64ToBlob from "../utils/blobConversion.ts"; +import { meter } from "deco/observability/otel/metrics.ts"; +import { AssistantIds } from "../types.ts"; +import { ValueType } from "deco/deps.ts"; +import { AppContext } from "../mod.ts"; const stats = { audioSize: meter.createHistogram("assistant_transcribe_audio_size", { diff --git a/ai-assistants/chat/messages.ts b/ai-assistants/chat/messages.ts index 5133de672..0dc3a5327 100644 --- a/ai-assistants/chat/messages.ts +++ b/ai-assistants/chat/messages.ts @@ -1,13 +1,13 @@ -import { weakcache } from "../../utils/weakcache.ts"; import { AssistantCreateParams, RequiredActionFunctionToolCall, Thread, } from "../deps.ts"; import { threadMessageToReply, Tokens } from "../loaders/messages.ts"; - -import { Context, JSONSchema7, lazySchemaFor } from "@deco/deco"; -import { meter, ValueType } from "@deco/deco/o11y"; +import { JSONSchema7, ValueType, weakcache } from "deco/deps.ts"; +import { lazySchemaFor } from "deco/engine/schema/lazy.ts"; +import { Context } from "deco/live.ts"; +import { meter } from "deco/observability/otel/metrics.ts"; import { ChatMessage, FunctionCallReply, diff --git a/ai-assistants/mod.ts b/ai-assistants/mod.ts index 5047ec28a..8ff8e0fbe 100644 --- a/ai-assistants/mod.ts +++ b/ai-assistants/mod.ts @@ -1,20 +1,17 @@ -import type { App, AppContext as AC } from "@deco/deco"; -import { - AppManifest, - asResolved, - AvailableActions, - AvailableLoaders, - isDeferred, -} from "@deco/deco"; -import { isAwaitable } from "@deco/deco/utils"; import AWS from "https://esm.sh/aws-sdk@2.1585.0"; +import { asResolved, isDeferred } from "deco/engine/core/resolver.ts"; +import { isAwaitable } from "deco/engine/core/utils.ts"; +import type { App, AppContext as AC } from "deco/mod.ts"; +import { AvailableActions, AvailableLoaders } from "deco/utils/invoke.types.ts"; +import { AppManifest } from "deco/types.ts"; +import { deferred } from "std/async/deferred.ts"; import openai, { Props as OpenAIProps, State as OpenAIState, } from "../openai/mod.ts"; -import { Secret } from "../website/loaders/secret.ts"; import { Assistant } from "./deps.ts"; import manifest, { Manifest } from "./manifest.gen.ts"; +import { Secret } from "../website/loaders/secret.ts"; import { PreviewContainer } from "../utils/preview.tsx"; export type GPTModel = @@ -160,7 +157,7 @@ export default function App( ...openAIApp.state, assistants: (state.assistants ?? []).filter(Boolean).reduce( (acc, assistant) => { - const assistantDeferred = Promise.withResolvers(); + const assistantDeferred = deferred(); if (isDeferred(assistant)) { const aiAssistant = assistant(); if (isAwaitable(aiAssistant)) { diff --git a/ai-assistants/runtime.ts b/ai-assistants/runtime.ts index 925809704..41d65a98d 100644 --- a/ai-assistants/runtime.ts +++ b/ai-assistants/runtime.ts @@ -1,4 +1,4 @@ -import { proxy } from "@deco/deco/web"; +import { proxy } from "deco/clients/withManifest.ts"; import { Manifest } from "./manifest.gen.ts"; export const invoke = proxy(); diff --git a/ai-assistants/schema.ts b/ai-assistants/schema.ts index 8bb5a6eaa..674d776db 100644 --- a/ai-assistants/schema.ts +++ b/ai-assistants/schema.ts @@ -1,4 +1,4 @@ -import { JSONSchema7 } from "@deco/deco"; +import { JSONSchema7 } from "deco/deps.ts"; const isJSONSchema = ( v: unknown | JSONSchema7, diff --git a/ai-assistants/utils/blobConversion.ts b/ai-assistants/utils/blobConversion.ts index ba8a991d5..2b08f6d4f 100644 --- a/ai-assistants/utils/blobConversion.ts +++ b/ai-assistants/utils/blobConversion.ts @@ -1,4 +1,4 @@ -import { logger } from "@deco/deco/o11y"; +import { logger } from "deco/observability/otel/config.ts"; import { AssistantIds } from "../types.ts"; export default function base64ToBlob( diff --git a/algolia/mod.ts b/algolia/mod.ts index 1608b3341..7724656f2 100644 --- a/algolia/mod.ts +++ b/algolia/mod.ts @@ -1,4 +1,4 @@ -import type { App, AppContext as AC } from "@deco/deco"; +import type { App, AppContext as AC } from "deco/mod.ts"; import algolia from "https://esm.sh/algoliasearch@4.20.0"; import { createFetchRequester } from "npm:@algolia/requester-fetch@4.20.0"; import { Markdown } from "../decohub/components/Markdown.tsx"; diff --git a/algolia/sections/Analytics/Algolia.tsx b/algolia/sections/Analytics/Algolia.tsx index ee2ab8db6..26d5a218b 100644 --- a/algolia/sections/Analytics/Algolia.tsx +++ b/algolia/sections/Analytics/Algolia.tsx @@ -1,5 +1,5 @@ -import { SectionProps } from "@deco/deco"; -import { useScriptAsDataURI } from "@deco/deco/hooks"; +import { SectionProps } from "deco/blocks/section.ts"; +import { useScriptAsDataURI } from "deco/hooks/useScript.ts"; import insights from "npm:search-insights@2.9.0"; import { AddToCartEvent, diff --git a/algolia/workflows/index/product.ts b/algolia/workflows/index/product.ts index c48a1cb6d..50bd8ca06 100644 --- a/algolia/workflows/index/product.ts +++ b/algolia/workflows/index/product.ts @@ -1,5 +1,4 @@ -import { WorkflowGen } from "@deco/deco"; -import { WorkflowContext } from "@deco/deco/blocks"; +import { WorkflowContext, WorkflowGen } from "deco/mod.ts"; import { Product } from "../../../commerce/types.ts"; import type { Manifest } from "../../manifest.gen.ts"; diff --git a/analytics/components/DecoAnalytics.tsx b/analytics/components/DecoAnalytics.tsx index e8941262b..38a72e997 100644 --- a/analytics/components/DecoAnalytics.tsx +++ b/analytics/components/DecoAnalytics.tsx @@ -1,5 +1,5 @@ import { Head } from "$fresh/runtime.ts"; -import { useScriptAsDataURI } from "@deco/deco/hooks"; +import { useScriptAsDataURI } from "deco/hooks/useScript.ts"; export interface Props { /** diff --git a/analytics/loaders/DecoAnalyticsScript.ts b/analytics/loaders/DecoAnalyticsScript.ts index c0518032a..2803ad847 100644 --- a/analytics/loaders/DecoAnalyticsScript.ts +++ b/analytics/loaders/DecoAnalyticsScript.ts @@ -1,5 +1,5 @@ -import { Flag } from "@deco/deco"; -import { useScriptAsDataURI } from "@deco/deco/hooks"; +import { useScriptAsDataURI } from "deco/hooks/useScript.ts"; +import { Flag } from "deco/types.ts"; import { Script } from "../../website/types.ts"; import { AppContext } from "../mod.ts"; diff --git a/analytics/mod.ts b/analytics/mod.ts index a8d9ff431..c2c2de86d 100644 --- a/analytics/mod.ts +++ b/analytics/mod.ts @@ -1,4 +1,4 @@ -import type { App, AppContext as AC } from "@deco/deco"; +import type { App, AppContext as AC } from "deco/mod.ts"; import manifest, { Manifest } from "./manifest.gen.ts"; import { PreviewContainer } from "../utils/preview.tsx"; diff --git a/anthropic/actions/code.ts b/anthropic/actions/code.ts index 978798878..80e312c78 100644 --- a/anthropic/actions/code.ts +++ b/anthropic/actions/code.ts @@ -1,6 +1,6 @@ -import { shortcircuit } from "@deco/deco"; -import { Anthropic } from "../deps.ts"; +import { shortcircuit } from "deco/engine/errors.ts"; import { AppContext } from "../mod.ts"; +import { Anthropic } from "../deps.ts"; export interface Props { /** * @description The system prompt to be used for the AI Assistant. diff --git a/anthropic/actions/stream.ts b/anthropic/actions/stream.ts index 8a560731b..da45087f6 100644 --- a/anthropic/actions/stream.ts +++ b/anthropic/actions/stream.ts @@ -1,5 +1,8 @@ -import { Context, JSONSchema7, lazySchemaFor, shortcircuit } from "@deco/deco"; -import { readFromStream } from "@deco/deco/utils"; +import { JSONSchema7 } from "deco/deps.ts"; +import { shortcircuit } from "deco/engine/errors.ts"; +import { lazySchemaFor } from "deco/engine/schema/lazy.ts"; +import { Context } from "deco/live.ts"; +import { readFromStream } from "deco/utils/http.ts"; import { dereferenceJsonSchema } from "../../ai-assistants/schema.ts"; import { Anthropic } from "../deps.ts"; import { AppContext } from "../mod.ts"; diff --git a/anthropic/mod.ts b/anthropic/mod.ts index 80a7cbdd2..c338c4453 100644 --- a/anthropic/mod.ts +++ b/anthropic/mod.ts @@ -1,4 +1,4 @@ -import type { App, AppContext as AC } from "@deco/deco"; +import type { App, AppContext as AC } from "deco/mod.ts"; import { Secret } from "../website/loaders/secret.ts"; import { Anthropic } from "./deps.ts"; import manifest, { Manifest } from "./manifest.gen.ts"; diff --git a/blog/loaders/Author.ts b/blog/loaders/Author.ts index c07effdf2..3926c74cb 100644 --- a/blog/loaders/Author.ts +++ b/blog/loaders/Author.ts @@ -1,4 +1,4 @@ -import type { Author } from "../types.ts"; +import { Author } from "../types.ts"; /** * @title Author diff --git a/blog/loaders/BlogPostItem.ts b/blog/loaders/BlogPostItem.ts index 598bf1ec2..1e2680174 100644 --- a/blog/loaders/BlogPostItem.ts +++ b/blog/loaders/BlogPostItem.ts @@ -1,5 +1,5 @@ -import type { AppContext } from "../mod.ts"; -import type { BlogPost } from "../types.ts"; +import { AppContext } from "../mod.ts"; +import { BlogPost } from "../types.ts"; import { getRecordsByPath } from "../utils/records.ts"; import type { RequestURLParam } from "../../website/functions/requestToParam.ts"; diff --git a/blog/loaders/BlogPostPage.ts b/blog/loaders/BlogPostPage.ts index 2a170e060..b4b206ab3 100644 --- a/blog/loaders/BlogPostPage.ts +++ b/blog/loaders/BlogPostPage.ts @@ -1,5 +1,5 @@ -import type { AppContext } from "../mod.ts"; -import type { BlogPost, BlogPostPage } from "../types.ts"; +import { AppContext } from "../mod.ts"; +import { BlogPost, BlogPostPage } from "../types.ts"; import { getRecordsByPath } from "../utils/records.ts"; import type { RequestURLParam } from "../../website/functions/requestToParam.ts"; diff --git a/blog/loaders/Blogpost.ts b/blog/loaders/Blogpost.ts index 1a05a47b1..fde253ff5 100644 --- a/blog/loaders/Blogpost.ts +++ b/blog/loaders/Blogpost.ts @@ -1,4 +1,4 @@ -import type { BlogPost } from "../types.ts"; +import { BlogPost } from "../types.ts"; /** * @title Blogpost diff --git a/blog/loaders/BlogpostList.ts b/blog/loaders/BlogpostList.ts index c3c971fd1..aca007475 100644 --- a/blog/loaders/BlogpostList.ts +++ b/blog/loaders/BlogpostList.ts @@ -6,9 +6,9 @@ * @param ctx - The application context. * @returns A promise that resolves to an array of blog posts. */ -import type { AppContext } from "../mod.ts"; -import type { RequestURLParam } from "../../website/functions/requestToParam.ts"; -import type { BlogPost, SortBy } from "../types.ts"; +import { RequestURLParam } from "../../website/functions/requestToParam.ts"; +import { AppContext } from "../mod.ts"; +import { BlogPost, SortBy } from "../types.ts"; import handlePosts, { slicePosts } from "../utils/handlePosts.ts"; import { getRecordsByPath } from "../utils/records.ts"; diff --git a/blog/loaders/BlogpostListing.ts b/blog/loaders/BlogpostListing.ts index ba1411dad..926469463 100644 --- a/blog/loaders/BlogpostListing.ts +++ b/blog/loaders/BlogpostListing.ts @@ -6,10 +6,10 @@ * @param ctx - The application context. * @returns A promise that resolves to an array of blog posts. */ -import type { PageInfo } from "../../commerce/types.ts"; -import type { RequestURLParam } from "../../website/functions/requestToParam.ts"; -import type { AppContext } from "../mod.ts"; -import type { BlogPost, BlogPostListingPage, SortBy } from "../types.ts"; +import { PageInfo } from "../../commerce/types.ts"; +import { RequestURLParam } from "../../website/functions/requestToParam.ts"; +import { AppContext } from "../mod.ts"; +import { BlogPost, BlogPostListingPage, SortBy } from "../types.ts"; import handlePosts, { slicePosts } from "../utils/handlePosts.ts"; import { getRecordsByPath } from "../utils/records.ts"; diff --git a/blog/loaders/Category.ts b/blog/loaders/Category.ts index eac571c48..7a54da7a0 100644 --- a/blog/loaders/Category.ts +++ b/blog/loaders/Category.ts @@ -1,4 +1,4 @@ -import type { Category } from "../types.ts"; +import { Category } from "../types.ts"; /** * @title Category diff --git a/blog/loaders/GetCategories.ts b/blog/loaders/GetCategories.ts index 50aa0505e..c2a2080b7 100644 --- a/blog/loaders/GetCategories.ts +++ b/blog/loaders/GetCategories.ts @@ -6,9 +6,9 @@ * @param ctx - The application context. * @returns A promise that resolves to an array of blog posts. */ -import type { RequestURLParam } from "../../website/functions/requestToParam.ts"; -import type { AppContext } from "../mod.ts"; -import type { Category } from "../types.ts"; +import { RequestURLParam } from "../../website/functions/requestToParam.ts"; +import { AppContext } from "../mod.ts"; +import { Category } from "../types.ts"; import { getRecordsByPath } from "../utils/records.ts"; const COLLECTION_PATH = "collections/blog/categories"; diff --git a/blog/mod.ts b/blog/mod.ts index 5ab9bbbf0..14c082add 100644 --- a/blog/mod.ts +++ b/blog/mod.ts @@ -1,5 +1,5 @@ -import type { App, FnContext } from "@deco/deco"; -import manifest, { type Manifest } from "./manifest.gen.ts"; +import type { App, FnContext } from "deco/mod.ts"; +import manifest, { Manifest } from "./manifest.gen.ts"; import { PreviewContainer } from "../utils/preview.tsx"; // deno-lint-ignore no-explicit-any diff --git a/blog/sections/Seo/SeoBlogPost.tsx b/blog/sections/Seo/SeoBlogPost.tsx index e1f52030d..92b950e55 100644 --- a/blog/sections/Seo/SeoBlogPost.tsx +++ b/blog/sections/Seo/SeoBlogPost.tsx @@ -1,10 +1,10 @@ import Seo from "../../../website/components/Seo.tsx"; import { renderTemplateString, - type SEOSection, + SEOSection, } from "../../../website/components/Seo.tsx"; -import type { BlogPostPage } from "../../types.ts"; -import type { AppContext } from "../../mod.ts"; +import { BlogPostPage } from "../../types.ts"; +import { AppContext } from "../../mod.ts"; export interface Props { /** @title Data Source */ diff --git a/blog/sections/Seo/SeoBlogPostListing.tsx b/blog/sections/Seo/SeoBlogPostListing.tsx index b1de21f9c..885da1cdd 100644 --- a/blog/sections/Seo/SeoBlogPostListing.tsx +++ b/blog/sections/Seo/SeoBlogPostListing.tsx @@ -1,10 +1,10 @@ import Seo from "../../../website/components/Seo.tsx"; import { renderTemplateString, - type SEOSection, + SEOSection, } from "../../../website/components/Seo.tsx"; -import type { BlogPostListingPage } from "../../types.ts"; -import type { AppContext } from "../../mod.ts"; +import { BlogPostListingPage } from "../../types.ts"; +import { AppContext } from "../../mod.ts"; export interface Props { /** @title Data Source */ diff --git a/blog/sections/Template.tsx b/blog/sections/Template.tsx index 47a409754..d1aab8f58 100644 --- a/blog/sections/Template.tsx +++ b/blog/sections/Template.tsx @@ -1,4 +1,4 @@ -import type { BlogPost } from "../types.ts"; +import { BlogPost } from "../types.ts"; import { CSS } from "../static/css.ts"; export interface Props { diff --git a/blog/types.ts b/blog/types.ts index c9d7a32c7..22e1ceb31 100644 --- a/blog/types.ts +++ b/blog/types.ts @@ -1,5 +1,5 @@ -import type { ImageWidget } from "../admin/widgets.ts"; -import type { PageInfo } from "../commerce/types.ts"; +import { ImageWidget } from "../admin/widgets.ts"; +import { PageInfo } from "../commerce/types.ts"; /** * @titleBy name diff --git a/blog/utils/handlePosts.ts b/blog/utils/handlePosts.ts index 0a82a6a24..405fa325b 100644 --- a/blog/utils/handlePosts.ts +++ b/blog/utils/handlePosts.ts @@ -1,4 +1,4 @@ -import type { BlogPost, SortBy } from "../types.ts"; +import { BlogPost, SortBy } from "../types.ts"; import { VALID_SORT_ORDERS } from "./constants.ts"; /** diff --git a/blog/utils/records.ts b/blog/utils/records.ts index 0083a06ed..02744803c 100644 --- a/blog/utils/records.ts +++ b/blog/utils/records.ts @@ -1,5 +1,5 @@ -import type { Resolvable } from "@deco/deco"; -import type { AppContext } from "../mod.ts"; +import { AppContext } from "../mod.ts"; +import { Resolvable } from "deco/engine/core/resolver.ts"; export async function getRecordsByPath( ctx: AppContext, diff --git a/brand-assistant/loaders/assistant.ts b/brand-assistant/loaders/assistant.ts index eb7167c45..ea0295bd9 100644 --- a/brand-assistant/loaders/assistant.ts +++ b/brand-assistant/loaders/assistant.ts @@ -1,12 +1,12 @@ // deno-lint-ignore-file ban-unused-ignore no-explicit-any -import type { ManifestOf } from "@deco/deco/blocks"; -import { logger } from "@deco/deco/o11y"; -import { Tokens } from "../../ai-assistants/loaders/messages.ts"; +import type { ManifestOf } from "deco/mod.ts"; +import { logger } from "deco/observability/otel/config.ts"; import type { AIAssistant, Log, Prompt } from "../../ai-assistants/mod.ts"; -import type { AssistantPersonalization } from "../../ai-assistants/types.ts"; import type { Category, Product, Suggestion } from "../../commerce/types.ts"; import type { Manifest as OpenAIManifest } from "../../openai/manifest.gen.ts"; import type vtex from "../../vtex/mod.ts"; +import { Tokens } from "../../ai-assistants/loaders/messages.ts"; +import type { AssistantPersonalization } from "../../ai-assistants/types.ts"; export interface Props { name: string; productsSample?: Product[] | null; diff --git a/brand-assistant/mod.ts b/brand-assistant/mod.ts index d130e7712..f2c387253 100644 --- a/brand-assistant/mod.ts +++ b/brand-assistant/mod.ts @@ -1,4 +1,4 @@ -import type { App, AppContext as AC } from "@deco/deco"; +import type { App, AppContext as AC } from "deco/mod.ts"; import manifest, { Manifest } from "./manifest.gen.ts"; import { PreviewContainer } from "../utils/preview.tsx"; diff --git a/commerce/mod.ts b/commerce/mod.ts index 84e341298..d9ecc00b0 100644 --- a/commerce/mod.ts +++ b/commerce/mod.ts @@ -1,11 +1,11 @@ -import { App, FnContext } from "@deco/deco"; -import { bgYellow } from "@std/fmt/colors"; +import { App, FnContext } from "deco/mod.ts"; import shopify, { Props as ShopifyProps } from "../shopify/mod.ts"; import vnda, { Props as VNDAProps } from "../vnda/mod.ts"; import vtex, { Props as VTEXProps } from "../vtex/mod.ts"; import wake, { Props as WakeProps } from "../wake/mod.ts"; import website, { Props as WebsiteProps } from "../website/mod.ts"; import manifest, { Manifest } from "./manifest.gen.ts"; +import { bgYellow } from "std/fmt/colors.ts"; export type AppContext = FnContext; diff --git a/commerce/types.ts b/commerce/types.ts index 5a76e9267..c489adfed 100644 --- a/commerce/types.ts +++ b/commerce/types.ts @@ -1,4 +1,4 @@ -import type { Flag } from "@deco/deco"; +import { type Flag } from "deco/types.ts"; /** Used at the top-level node to indicate the context for the JSON-LD objects used. The context provided in this type is compatible with the keys and URLs in the rest of this generated file. */ export declare type WithContext = T & { diff --git a/compat/$live/handlers/devPage.ts b/compat/$live/handlers/devPage.ts index 1f9e507a1..4ee13a6b8 100644 --- a/compat/$live/handlers/devPage.ts +++ b/compat/$live/handlers/devPage.ts @@ -1,6 +1,6 @@ -import { context } from "@deco/deco"; -import { Page } from "@deco/deco/blocks"; -import { adminUrlFor, isAdmin } from "@deco/deco/utils"; +import { Page } from "deco/blocks/page.tsx"; +import { context } from "deco/live.ts"; +import { adminUrlFor, isAdmin } from "deco/utils/admin.ts"; import Fresh from "../../../website/handlers/fresh.ts"; import { pageIdFromMetadata } from "../../../website/pages/Page.tsx"; import { AppContext } from "../mod.ts"; diff --git a/compat/$live/handlers/router.ts b/compat/$live/handlers/router.ts index 01020c1b2..08a5b9671 100644 --- a/compat/$live/handlers/router.ts +++ b/compat/$live/handlers/router.ts @@ -1,5 +1,5 @@ -import { FnContext } from "@deco/deco"; -import { Handler } from "@deco/deco/blocks"; +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"; diff --git a/compat/$live/loaders/state.ts b/compat/$live/loaders/state.ts index 3091ba88e..be6bce1a5 100644 --- a/compat/$live/loaders/state.ts +++ b/compat/$live/loaders/state.ts @@ -1,13 +1,11 @@ -import { LoaderContext } from "@deco/deco"; -import { - Accounts, - Apps, - Flag, - Loader, - Page, - Resolvable, - Section, -} from "@deco/deco/blocks"; +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.tsx"; +import { Section } from "deco/blocks/section.ts"; +import { Resolvable } from "deco/engine/core/resolver.ts"; +import { LoaderContext } from "deco/mod.ts"; +import { Apps } from "deco/blocks/app.ts"; /** * @titleBy key diff --git a/compat/$live/mod.ts b/compat/$live/mod.ts index e25cb8d86..82ab8da5d 100644 --- a/compat/$live/mod.ts +++ b/compat/$live/mod.ts @@ -1,8 +1,8 @@ -import type { App } from "@deco/deco"; +import type { App } from "deco/mod.ts"; import webSite, { Props } from "../../website/mod.ts"; -import { AppContext as AC } from "@deco/deco"; +import { AppContext as AC } from "deco/blocks/app.ts"; import workflows from "../../workflows/mod.ts"; import manifest, { Manifest } from "./manifest.gen.ts"; diff --git a/compat/$live/sections/PageInclude.tsx b/compat/$live/sections/PageInclude.tsx index 1492398a7..b1410bea1 100644 --- a/compat/$live/sections/PageInclude.tsx +++ b/compat/$live/sections/PageInclude.tsx @@ -1,6 +1,6 @@ /** TODO: Deprecate this file */ -import { Page } from "@deco/deco/blocks"; -import { notUndefined } from "@deco/deco/utils"; +import { Page } from "deco/blocks/page.tsx"; +import { notUndefined } from "deco/engine/core/utils.ts"; import { Props as LivePageProps, diff --git a/compat/$live/sections/Slot.tsx b/compat/$live/sections/Slot.tsx index 315d22ef1..227ecbacf 100644 --- a/compat/$live/sections/Slot.tsx +++ b/compat/$live/sections/Slot.tsx @@ -1,4 +1,4 @@ -import { isSection, Section } from "@deco/deco/blocks"; +import { isSection, Section } from "deco/blocks/section.ts"; export type WellKnownSlots = | "content" diff --git a/compat/std/functions/vtexLegacyProductDetailsPage.ts b/compat/std/functions/vtexLegacyProductDetailsPage.ts index a60229a82..7239fe5a5 100644 --- a/compat/std/functions/vtexLegacyProductDetailsPage.ts +++ b/compat/std/functions/vtexLegacyProductDetailsPage.ts @@ -1,4 +1,4 @@ -import type { LoaderFunction } from "@deco/deco"; +import type { LoaderFunction } from "deco/types.ts"; import type { ProductDetailsPage } from "../../../commerce/types.ts"; import type { AppContext } from "../mod.ts"; diff --git a/compat/std/functions/vtexLegacyProductList.ts b/compat/std/functions/vtexLegacyProductList.ts index 42510fefb..d3b445240 100644 --- a/compat/std/functions/vtexLegacyProductList.ts +++ b/compat/std/functions/vtexLegacyProductList.ts @@ -1,4 +1,4 @@ -import type { LoaderFunction } from "@deco/deco"; +import type { LoaderFunction } from "deco/types.ts"; import type { Product } from "../../../commerce/types.ts"; import type { AppContext } from "../mod.ts"; diff --git a/compat/std/functions/vtexLegacyProductListingPage.ts b/compat/std/functions/vtexLegacyProductListingPage.ts index 0b4854d8b..89bfbb10e 100644 --- a/compat/std/functions/vtexLegacyProductListingPage.ts +++ b/compat/std/functions/vtexLegacyProductListingPage.ts @@ -1,4 +1,4 @@ -import type { LoaderFunction } from "@deco/deco"; +import type { LoaderFunction } from "deco/types.ts"; import type { ProductListingPage } from "../../../commerce/types.ts"; import type { Props } from "../../../vtex/loaders/legacy/productListingPage.ts"; import type { AppContext } from "../mod.ts"; diff --git a/compat/std/functions/vtexLegacyRelatedProductsLoader.ts b/compat/std/functions/vtexLegacyRelatedProductsLoader.ts index 28594b663..0d9d25a8e 100644 --- a/compat/std/functions/vtexLegacyRelatedProductsLoader.ts +++ b/compat/std/functions/vtexLegacyRelatedProductsLoader.ts @@ -1,4 +1,4 @@ -import type { LoaderFunction } from "@deco/deco"; +import type { LoaderFunction } from "deco/types.ts"; import type { Product } from "../../../commerce/types.ts"; import type { CrossSellingType } from "../../../vtex/utils/types.ts"; import type { AppContext } from "../mod.ts"; diff --git a/compat/std/functions/vtexNavbar.ts b/compat/std/functions/vtexNavbar.ts index 2d26dcd87..4766dc47d 100644 --- a/compat/std/functions/vtexNavbar.ts +++ b/compat/std/functions/vtexNavbar.ts @@ -1,7 +1,7 @@ -import type { LoaderFunction } from "@deco/deco"; +import type { LoaderFunction } from "deco/types.ts"; import type { Navbar } from "../../../commerce/types.ts"; -import type { Props } from "../../../vtex/loaders/navbar.ts"; import type { AppContext } from "../mod.ts"; +import type { Props } from "../../../vtex/loaders/navbar.ts"; /** * @title Navigation Bar diff --git a/compat/std/functions/vtexProductDetailsPage.ts b/compat/std/functions/vtexProductDetailsPage.ts index 0c0c3ecee..373104671 100644 --- a/compat/std/functions/vtexProductDetailsPage.ts +++ b/compat/std/functions/vtexProductDetailsPage.ts @@ -1,4 +1,4 @@ -import type { LoaderFunction } from "@deco/deco"; +import type { LoaderFunction } from "deco/types.ts"; import type { ProductDetailsPage } from "../../../commerce/types.ts"; import type { AppContext } from "../mod.ts"; diff --git a/compat/std/functions/vtexProductList.ts b/compat/std/functions/vtexProductList.ts index ef664eeec..faa6739be 100644 --- a/compat/std/functions/vtexProductList.ts +++ b/compat/std/functions/vtexProductList.ts @@ -1,4 +1,4 @@ -import type { LoaderFunction } from "@deco/deco"; +import type { LoaderFunction } from "deco/types.ts"; import type { Product } from "../../../commerce/types.ts"; import type { AppContext } from "../mod.ts"; diff --git a/compat/std/functions/vtexProductListingPage.ts b/compat/std/functions/vtexProductListingPage.ts index 142d3115d..6e383c84f 100644 --- a/compat/std/functions/vtexProductListingPage.ts +++ b/compat/std/functions/vtexProductListingPage.ts @@ -1,4 +1,4 @@ -import type { LoaderFunction } from "@deco/deco"; +import type { LoaderFunction } from "deco/types.ts"; import type { ProductListingPage } from "../../../commerce/types.ts"; import type { Props, diff --git a/compat/std/functions/vtexSuggestions.ts b/compat/std/functions/vtexSuggestions.ts index 4f8a7f348..01c89d924 100644 --- a/compat/std/functions/vtexSuggestions.ts +++ b/compat/std/functions/vtexSuggestions.ts @@ -1,4 +1,4 @@ -import type { LoaderFunction } from "@deco/deco"; +import type { LoaderFunction } from "deco/types.ts"; import type { Suggestion } from "../../../commerce/types.ts"; import type { Props } from "../../../vtex/loaders/intelligentSearch/suggestions.ts"; import type { AppContext } from "../mod.ts"; diff --git a/compat/std/functions/vtexWishlist.ts b/compat/std/functions/vtexWishlist.ts index a2f333649..9799f659c 100644 --- a/compat/std/functions/vtexWishlist.ts +++ b/compat/std/functions/vtexWishlist.ts @@ -1,4 +1,4 @@ -import type { LoaderFunction } from "@deco/deco"; +import type { LoaderFunction } from "deco/types.ts"; import type { ProductListingPage } from "../../../commerce/types.ts"; import type { Props } from "../../../vtex/loaders/wishlist.ts"; import { Product } from "../../../vtex/utils/types.ts"; diff --git a/compat/std/mod.ts b/compat/std/mod.ts index 6ba69801e..5546b3de3 100644 --- a/compat/std/mod.ts +++ b/compat/std/mod.ts @@ -1,7 +1,8 @@ // deno-lint-ignore-file no-explicit-any export { onBeforeResolveProps } from "../../website/mod.ts"; -import type { App, AppContext as AC, AppManifest } from "@deco/deco"; -import { buildImportMap, ImportMap } from "@deco/deco/blocks"; +import { ImportMap } from "deco/blocks/app.ts"; +import { buildImportMap } from "deco/blocks/utils.tsx"; +import type { App, AppContext as AC, AppManifest } from "deco/mod.ts"; import type { PickByValue } from "https://esm.sh/utility-types@3.10.0"; import $live, { Props as LiveProps } from "../$live/mod.ts"; import commerce, { Props as CommerceProps } from "../../commerce/mod.ts"; diff --git a/compat/std/runtime.ts b/compat/std/runtime.ts index 2d6bed66d..8a9b18486 100644 --- a/compat/std/runtime.ts +++ b/compat/std/runtime.ts @@ -1,4 +1,4 @@ -import { forApp } from "@deco/deco/web"; +import { forApp } from "deco/clients/withManifest.ts"; import app from "./mod.ts"; export const Runtime = forApp>(); diff --git a/compat/std/sections/Analytics.tsx b/compat/std/sections/Analytics.tsx index 0f4629ef4..14faf632e 100644 --- a/compat/std/sections/Analytics.tsx +++ b/compat/std/sections/Analytics.tsx @@ -1,4 +1,4 @@ -import { context } from "@deco/deco"; +import { context } from "deco/live.ts"; import { AnalyticsEvent } from "../../../commerce/types.ts"; import { getGTMIdFromSrc, diff --git a/crux/mod.ts b/crux/mod.ts index ae835a643..f6e068c4c 100644 --- a/crux/mod.ts +++ b/crux/mod.ts @@ -1,6 +1,6 @@ -import type { App as A } from "@deco/deco"; import manifest, { Manifest } from "./manifest.gen.ts"; import PreviewCrux from "./preview/Preview.tsx"; +import type { App as A } from "deco/mod.ts"; export type App = ReturnType; diff --git a/crux/preview/Preview.tsx b/crux/preview/Preview.tsx index fcc0f46f5..49e89b264 100644 --- a/crux/preview/Preview.tsx +++ b/crux/preview/Preview.tsx @@ -1,4 +1,5 @@ -import { AppRuntime, BaseContext } from "@deco/deco"; +import { BaseContext } from "deco/engine/core/resolver.ts"; +import { AppRuntime } from "deco/types.ts"; import { App } from "../mod.ts"; // this base URL was found at this documentation: https://developer.chrome.com/docs/crux/dashboard?hl=pt-br diff --git a/decohub/apps/vtex.ts b/decohub/apps/vtex.ts index 8af440d06..d709eb624 100644 --- a/decohub/apps/vtex.ts +++ b/decohub/apps/vtex.ts @@ -1,6 +1,6 @@ export { default } from "../../vtex/mod.ts"; -import { AppRuntime } from "@deco/deco"; +import { AppRuntime } from "deco/types.ts"; import { PreviewVtex } from "../../vtex/preview/Preview.tsx"; import { Markdown } from "../components/Markdown.tsx"; diff --git a/decohub/mod.ts b/decohub/mod.ts index b7b36798b..fedb45095 100644 --- a/decohub/mod.ts +++ b/decohub/mod.ts @@ -1,6 +1,7 @@ -import { type App, AppModule, type FnContext } from "@deco/deco"; -import { buildImportMap, ImportMap } from "@deco/deco/blocks"; -import { notUndefined } from "@deco/deco/utils"; +import { ImportMap } from "deco/blocks/app.ts"; +import { buildImportMap } from "deco/blocks/utils.tsx"; +import { notUndefined } from "deco/engine/core/utils.ts"; +import { type App, AppModule, type FnContext } from "deco/mod.ts"; import { Markdown } from "./components/Markdown.tsx"; import manifest, { Manifest } from "./manifest.gen.ts"; diff --git a/deno.json b/deno.json index 741a4311f..3c8e197fb 100644 --- a/deno.json +++ b/deno.json @@ -1,48 +1,51 @@ { "imports": { "$fresh/": "https://denopkg.com/denoland/fresh@1.6.8/", - "@cliffy/prompt": "jsr:@cliffy/prompt@^1.0.0-rc.5", - "@core/asyncutil": "jsr:@core/asyncutil@^1.0.0", - "@deco/deco": "jsr:@deco/deco@1.97.0", - "@deco/durable": "jsr:@deco/durable@^0.5.3", - "@deco/inspect-vscode": "jsr:@deco/inspect-vscode@^0.2.1", - "@deco/warp": "jsr:@deco/warp@0.3.6", - "@deno/gfm": "jsr:@deno/gfm@^0.8.2", + "preact": "npm:preact@10.23.1", + "preact-render-to-string": "https://esm.sh/*preact-render-to-string@6.2.0", "@preact/signals": "https://esm.sh/*@preact/signals@1.1.3", "@preact/signals-core": "https://esm.sh/@preact/signals-core@1.3.0", + "std/": "https://deno.land/std@0.204.0/", + "partytown/": "https://deno.land/x/partytown@0.4.8/", + "deco-sites/std/": "https://denopkg.com/deco-sites/std@1.26.8/", + "deco/": "https://denopkg.com/deco-cx/deco@1.95.2/", "@std/assert": "jsr:@std/assert@^1.0.2", - "@std/async": "jsr:@std/async@^1.0.3", - "@std/crypto": "jsr:@std/crypto@^1.0.2", + "@std/async": "jsr:@std/async@^0.224.1", + "@std/crypto": "jsr:@std/crypto@1.0.0-rc.1", "@std/datetime": "jsr:@std/datetime@^0.224.0", - "@std/encoding": "jsr:@std/encoding@^1.0.1", + "@std/encoding": "jsr:@std/encoding@^1.0.0-rc.1", "@std/flags": "jsr:@std/flags@^0.224.0", - "@std/fmt": "jsr:@std/fmt@^1.0.0", - "@std/fs": "jsr:@std/fs@^1.0.1", - "@std/http": "jsr:@std/http@^1.0.2", + "@std/fmt": "jsr:@std/fmt@^0.225.3", + "@std/fs": "jsr:@std/fs@^0.229.1", + "@std/http": "jsr:@std/http@^1.0.0", "@std/io": "jsr:@std/io@^0.224.4", "@std/log": "jsr:@std/log@^0.224.5", - "@std/media-types": "jsr:@std/media-types@^1.0.2", - "@std/path": "jsr:@std/path@^1.0.2", + "@std/media-types": "jsr:@std/media-types@^1.0.0-rc.1", + "@std/path": "jsr:@std/path@^0.225.2", "@std/semver": "jsr:@std/semver@^0.224.3", "@std/streams": "jsr:@std/streams@^1.0.0", "@std/testing": "jsr:@std/testing@^1.0.0", - "@zaubrik/djwt": "jsr:@zaubrik/djwt@^3.0.2", - "partytown/": "https://deno.land/x/partytown@0.4.8/", - "preact": "npm:preact@10.23.1", - "preact-render-to-string": "npm:preact-render-to-string@6.4.0", - "std/": "https://deno.land/std@0.203.0/", + "@cliffy/prompt": "jsr:@cliffy/prompt@^1.0.0-rc.5", + "@core/asyncutil": "jsr:@core/asyncutil@^1.0.2", + "@deco/durable": "jsr:@deco/durable@^0.5.3", + "@deco/warp": "jsr:@deco/warp@0.3.6", "@hono/hono": "jsr:@hono/hono@^4.5.4", "@std/cli": "jsr:@std/cli@^1.0.3", + "@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" }, "lock": false, "tasks": { "check": "deno fmt && deno lint && deno check **/mod.ts", - "release": "deno run -A jsr:@deco/scripts/release", - "bundle": "deno run -A jsr:@deco/deco/scripts/bundle", - "update": "deno run -A https://deco.cx/update", + "release": "deno eval 'import \"deco/scripts/release.ts\"'", "start": "deno run -A ./scripts/start.ts", + "bundle": "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": { @@ -57,12 +60,5 @@ "jsx": "react-jsx", "jsxImportSource": "preact" }, - "lint": { - "rules": { - "exclude": [ - "no-slow-types" - ] - } - }, - "version": "0.57.0" + "version": "0.56.23" } diff --git a/emailjs/mod.ts b/emailjs/mod.ts index d30dad26d..12153ac33 100644 --- a/emailjs/mod.ts +++ b/emailjs/mod.ts @@ -1,4 +1,4 @@ -import type { App, AppContext as AC } from "@deco/deco"; +import type { App, AppContext as AC } from "deco/mod.ts"; import { Markdown } from "../decohub/components/Markdown.tsx"; import { fetchSafe } from "../utils/fetch.ts"; import { createHttpClient } from "../utils/http.ts"; diff --git a/files/loaders/app.ts b/files/loaders/app.ts index b46ec5c30..f6f44ba0e 100644 --- a/files/loaders/app.ts +++ b/files/loaders/app.ts @@ -1,12 +1,12 @@ -import { ImportMap } from "@deco/deco/blocks"; -import { decoManifestBuilder } from "@deco/deco/utils"; -import { dirname, join } from "@std/path"; +import { ImportMap } from "deco/blocks/app.ts"; +import { decoManifestBuilder } from "deco/engine/manifest/manifestGen.ts"; import { createCache } from "https://deno.land/x/deno_cache@0.6.3/mod.ts"; import { build, initialize } from "https://deno.land/x/esbuild@v0.20.2/wasm.js"; import { resolveImportMap, resolveModuleSpecifier, } from "https://deno.land/x/importmap@0.2.1/mod.ts"; +import { dirname, join } from "std/path/mod.ts"; import { DynamicApp } from "../../decohub/mod.ts"; import { AppContext } from "../mod.ts"; import { create, FileSystemNode, isDir, nodesToMap, walk } from "../sdk.ts"; @@ -202,7 +202,7 @@ const loader = async ( \n import manifest, { Manifest } from "./manifest.gen.ts"; import website, { Props as WebSiteProps } from "apps/website/mod.ts"; -import { App, AppContext as AC } from "@deco/deco"; +import { App, AppContext as AC } from "deco/mod.ts"; export default function App(props: WebSiteProps): App]> { return { diff --git a/files/mod.ts b/files/mod.ts index d7b2445b1..ac506a3d2 100644 --- a/files/mod.ts +++ b/files/mod.ts @@ -1,4 +1,4 @@ -import type { App, AppContext as AC } from "@deco/deco"; +import type { App, AppContext as AC } from "deco/mod.ts"; import manifest, { Manifest } from "./manifest.gen.ts"; import { FileSystemNode } from "./sdk.ts"; diff --git a/htmx/mod.ts b/htmx/mod.ts index 154a324fd..0ffe1c6f1 100644 --- a/htmx/mod.ts +++ b/htmx/mod.ts @@ -1,7 +1,7 @@ -import type { App, FnContext } from "@deco/deco"; +import { App, FnContext } from "deco/mod.ts"; import { Markdown } from "../decohub/components/Markdown.tsx"; import { PreviewContainer } from "../utils/preview.tsx"; -import manifest, { type Manifest } from "./manifest.gen.ts"; +import manifest, { Manifest } from "./manifest.gen.ts"; export type AppContext = FnContext; diff --git a/htmx/sections/Deferred.tsx b/htmx/sections/Deferred.tsx index 6d1f06ece..1ff504fbb 100644 --- a/htmx/sections/Deferred.tsx +++ b/htmx/sections/Deferred.tsx @@ -1,8 +1,8 @@ -import { asResolved, isDeferred } from "@deco/deco"; -import type { Section } from "@deco/deco/blocks"; -import { useSection } from "@deco/deco/hooks"; +import type { Section } from "deco/blocks/section.ts"; +import { useSection } from "deco/hooks/useSection.ts"; +import { asResolved, isDeferred } from "deco/mod.ts"; import { shouldForceRender } from "../../utils/deferred.ts"; -import type { AppContext } from "../mod.ts"; +import { AppContext } from "../mod.ts"; /** * @titleBy type diff --git a/htmx/sections/htmx.tsx b/htmx/sections/htmx.tsx index 17af4c4fb..629810c39 100644 --- a/htmx/sections/htmx.tsx +++ b/htmx/sections/htmx.tsx @@ -1,7 +1,7 @@ import { Head } from "$fresh/runtime.ts"; -import type { SectionProps } from "@deco/deco"; -import { useScript } from "@deco/deco/hooks"; -import type { AppContext, Extension } from "../mod.ts"; +import { SectionProps } from "deco/mod.ts"; +import { useScript } from "deco/hooks/useScript.ts"; +import { AppContext, Extension } from "../mod.ts"; const script = (extensions: Extension[]) => { if (extensions.length > 0) { diff --git a/implementation/mod.ts b/implementation/mod.ts index ea31873e0..f55c26089 100644 --- a/implementation/mod.ts +++ b/implementation/mod.ts @@ -1,4 +1,4 @@ -import type { App, AppContext as AC } from "@deco/deco"; +import type { App, AppContext as AC } from "deco/mod.ts"; import { Markdown } from "../decohub/components/Markdown.tsx"; import { PreviewContainer } from "../utils/preview.tsx"; import manifest, { Manifest } from "./manifest.gen.ts"; diff --git a/konfidency/loaders/productDetailsPage.ts b/konfidency/loaders/productDetailsPage.ts index 55a5e8206..0806b256e 100644 --- a/konfidency/loaders/productDetailsPage.ts +++ b/konfidency/loaders/productDetailsPage.ts @@ -1,4 +1,4 @@ -import { logger } from "@deco/deco/o11y"; +import { logger } from "deco/observability/mod.ts"; import { ProductDetailsPage } from "../../commerce/types.ts"; import { ExtensionOf } from "../../website/loaders/extension.ts"; import { AppContext } from "../mod.ts"; diff --git a/konfidency/mod.ts b/konfidency/mod.ts index 5c62649d2..057ecd381 100644 --- a/konfidency/mod.ts +++ b/konfidency/mod.ts @@ -1,4 +1,4 @@ -import type { App, AppContext as AC } from "@deco/deco"; +import type { App, AppContext as AC } from "deco/mod.ts"; import { Markdown } from "../decohub/components/Markdown.tsx"; import { createHttpClient } from "../utils/http.ts"; import { PreviewContainer } from "../utils/preview.tsx"; diff --git a/linx-impulse/middleware.ts b/linx-impulse/middleware.ts index b794bff41..eb9cf81b8 100644 --- a/linx-impulse/middleware.ts +++ b/linx-impulse/middleware.ts @@ -1,10 +1,10 @@ -import { getCookies, setCookie } from "@std/http/cookie"; +import { getCookies, setCookie } from "std/http/cookie.ts"; import { AppMiddlewareContext } from "./mod.ts"; +import { getDeviceIdFromBag, setDeviceIdInBag } from "./utils/deviceId.ts"; import { DEVICE_ID_COOKIE_NAME, NAVIGATION_ID_COOKIE_NAME, } from "./utils/constants.ts"; -import { getDeviceIdFromBag, setDeviceIdInBag } from "./utils/deviceId.ts"; export const middleware = ( _props: unknown, diff --git a/linx-impulse/mod.ts b/linx-impulse/mod.ts index c9a557af4..e09e95839 100644 --- a/linx-impulse/mod.ts +++ b/linx-impulse/mod.ts @@ -2,7 +2,7 @@ import type { App as A, AppContext as AC, AppMiddlewareContext as AMC, -} from "@deco/deco"; +} from "deco/mod.ts"; import { createHttpClient } from "../utils/http.ts"; import type { Secret } from "../website/loaders/secret.ts"; import manifest, { Manifest } from "./manifest.gen.ts"; diff --git a/linx-impulse/runtime.ts b/linx-impulse/runtime.ts index 925809704..41d65a98d 100644 --- a/linx-impulse/runtime.ts +++ b/linx-impulse/runtime.ts @@ -1,4 +1,4 @@ -import { proxy } from "@deco/deco/web"; +import { proxy } from "deco/clients/withManifest.ts"; import { Manifest } from "./manifest.gen.ts"; export const invoke = proxy(); diff --git a/linx-impulse/sections/Analytics/LinxImpulsePageView.tsx b/linx-impulse/sections/Analytics/LinxImpulsePageView.tsx index 2d9a7f157..0f69f8460 100644 --- a/linx-impulse/sections/Analytics/LinxImpulsePageView.tsx +++ b/linx-impulse/sections/Analytics/LinxImpulsePageView.tsx @@ -1,15 +1,15 @@ -import { SectionProps } from "@deco/deco"; -import { useScriptAsDataURI } from "@deco/deco/hooks"; +import { SectionProps } from "deco/types.ts"; import { PageInfo, Person, ProductDetailsPage, ProductListingPage, } from "../../../commerce/types.ts"; +import { useScriptAsDataURI } from "deco/hooks/useScript.ts"; import { AppContext } from "../../mod.ts"; -import { getDeviceIdFromBag } from "../../utils/deviceId.ts"; import getSource from "../../utils/source.ts"; import type { LinxUser } from "../../utils/types/analytics.ts"; +import { getDeviceIdFromBag } from "../../utils/deviceId.ts"; type Page = | "home" diff --git a/linx-impulse/sections/Script/LinxImpulseScript.tsx b/linx-impulse/sections/Script/LinxImpulseScript.tsx index e05c1b56c..c03980019 100644 --- a/linx-impulse/sections/Script/LinxImpulseScript.tsx +++ b/linx-impulse/sections/Script/LinxImpulseScript.tsx @@ -1,5 +1,5 @@ import { Head } from "$fresh/runtime.ts"; -import { SectionProps } from "@deco/deco"; +import { SectionProps } from "deco/mod.ts"; import { AppContext } from "../../mod.ts"; export const loader = (_props: unknown, _req: Request, ctx: AppContext) => ({ diff --git a/linx/loaders/page.ts b/linx/loaders/page.ts index 6a2c4cfd2..5871e7725 100644 --- a/linx/loaders/page.ts +++ b/linx/loaders/page.ts @@ -1,5 +1,5 @@ -import { asResolved, isDeferred } from "@deco/deco"; -import type { Page } from "@deco/deco/blocks"; +import type { Page } from "deco/blocks/page.tsx"; +import { asResolved, isDeferred } from "deco/mod.ts"; import type { AppContext } from "../mod.ts"; import { LinxPage } from "./pages.ts"; diff --git a/linx/loaders/pages.ts b/linx/loaders/pages.ts index f52391d07..7486a183d 100644 --- a/linx/loaders/pages.ts +++ b/linx/loaders/pages.ts @@ -1,5 +1,5 @@ -import { asResolved } from "@deco/deco"; -import type { Page } from "@deco/deco/blocks"; +import type { Page } from "deco/blocks/page.tsx"; +import { asResolved } from "deco/mod.ts"; import type { Route } from "../../website/flags/audience.ts"; import type { AppContext } from "../mod.ts"; diff --git a/linx/loaders/path.ts b/linx/loaders/path.ts index 588567333..996979d80 100644 --- a/linx/loaders/path.ts +++ b/linx/loaders/path.ts @@ -1,4 +1,4 @@ -import { redirect } from "@deco/deco"; +import { redirect } from "deco/mod.ts"; import { STALE } from "../../utils/fetch.ts"; import type { AppContext } from "../mod.ts"; import type { API } from "../utils/client.ts"; diff --git a/linx/mod.ts b/linx/mod.ts index e3b7bca2f..0ac024b22 100644 --- a/linx/mod.ts +++ b/linx/mod.ts @@ -1,4 +1,4 @@ -import type { App, AppContext as AC } from "@deco/deco"; +import type { App, AppContext as AC } from "deco/mod.ts"; import { createHttpClient } from "../utils/http.ts"; import manifest, { Manifest } from "./manifest.gen.ts"; import { API } from "./utils/client.ts"; diff --git a/linx/runtime.ts b/linx/runtime.ts index 925809704..41d65a98d 100644 --- a/linx/runtime.ts +++ b/linx/runtime.ts @@ -1,4 +1,4 @@ -import { proxy } from "@deco/deco/web"; +import { proxy } from "deco/clients/withManifest.ts"; import { Manifest } from "./manifest.gen.ts"; export const invoke = proxy(); diff --git a/mailchimp/actions/subscribe.ts b/mailchimp/actions/subscribe.ts index 7430823c8..5b7b98c0b 100644 --- a/mailchimp/actions/subscribe.ts +++ b/mailchimp/actions/subscribe.ts @@ -1,4 +1,4 @@ -import { setCookie } from "@std/http/cookie"; +import { setCookie } from "deco/deps.ts"; import { AppContext } from "../mod.ts"; import { toMd5 } from "../utils/transform.ts"; diff --git a/mailchimp/loaders/options/lists.ts b/mailchimp/loaders/options/lists.ts index 3dfc3bce5..09893b71b 100644 --- a/mailchimp/loaders/options/lists.ts +++ b/mailchimp/loaders/options/lists.ts @@ -1,4 +1,4 @@ -import { allowCorsFor } from "@deco/deco"; +import { allowCorsFor } from "deco/mod.ts"; import { AppContext } from "../../mod.ts"; export default async function loader( diff --git a/mailchimp/mod.ts b/mailchimp/mod.ts index 4bd468ded..badd17ea4 100644 --- a/mailchimp/mod.ts +++ b/mailchimp/mod.ts @@ -1,4 +1,4 @@ -import type { App as A, AppContext as AC, ManifestOf } from "@deco/deco"; +import type { App as A, AppContext as AC, ManifestOf } from "deco/mod.ts"; import { Markdown } from "../decohub/components/Markdown.tsx"; import { createHttpClient } from "../utils/http.ts"; import { PreviewContainer } from "../utils/preview.tsx"; diff --git a/mailchimp/utils/transform.ts b/mailchimp/utils/transform.ts index 7cb7ae33f..1188a909a 100644 --- a/mailchimp/utils/transform.ts +++ b/mailchimp/utils/transform.ts @@ -1,4 +1,4 @@ -import { crypto } from "@std/crypto"; +import { crypto } from "std/crypto/crypto.ts"; /** * @description Gets the MD5 hash of an email address, which is used to identify a subscriber in Mailchimp. diff --git a/nuvemshop/mod.ts b/nuvemshop/mod.ts index 37c44a5a1..3e95eda2c 100644 --- a/nuvemshop/mod.ts +++ b/nuvemshop/mod.ts @@ -3,13 +3,13 @@ import type { AppContext as AC, AppMiddlewareContext as AMC, ManifestOf, -} from "@deco/deco"; -import { fetchSafe } from "../utils/fetch.ts"; +} from "deco/mod.ts"; import { createHttpClient } from "../utils/http.ts"; -import type { Secret } from "../website/loaders/secret.ts"; import workflow from "../workflows/mod.ts"; -import manifest, { Manifest } from "./manifest.gen.ts"; import { NuvemShopAPI } from "./utils/client.ts"; +import { fetchSafe } from "../utils/fetch.ts"; +import manifest, { Manifest } from "./manifest.gen.ts"; +import type { Secret } from "../website/loaders/secret.ts"; import { ClientOf } from "../utils/http.ts"; import PreviewNuvemshop from "./preview/index.tsx"; diff --git a/nuvemshop/runtime.ts b/nuvemshop/runtime.ts index 925809704..41d65a98d 100644 --- a/nuvemshop/runtime.ts +++ b/nuvemshop/runtime.ts @@ -1,4 +1,4 @@ -import { proxy } from "@deco/deco/web"; +import { proxy } from "deco/clients/withManifest.ts"; import { Manifest } from "./manifest.gen.ts"; export const invoke = proxy(); diff --git a/nuvemshop/utils/cart.ts b/nuvemshop/utils/cart.ts index 92aefe635..539ee4a19 100644 --- a/nuvemshop/utils/cart.ts +++ b/nuvemshop/utils/cart.ts @@ -1,4 +1,4 @@ -import { getCookies, setCookie } from "@std/http/cookie"; +import { getCookies, setCookie } from "std/http/cookie.ts"; const CART_COOKIE = "nuvemshop_cart_id"; export const DESIRED_COOKIES = [ diff --git a/nuvemshop/utils/types.ts b/nuvemshop/utils/types.ts index b80a94469..0b40cd637 100644 --- a/nuvemshop/utils/types.ts +++ b/nuvemshop/utils/types.ts @@ -1,4 +1,4 @@ -import type { FnContext } from "@deco/deco"; +import type { FnContext } from "deco/types.ts"; export interface Account { /** diff --git a/openai/mod.ts b/openai/mod.ts index 28979e85a..80ccd275c 100644 --- a/openai/mod.ts +++ b/openai/mod.ts @@ -1,4 +1,4 @@ -import type { App, AppContext as AC } from "@deco/deco"; +import type { App, AppContext as AC } from "deco/mod.ts"; import { Secret } from "../website/loaders/secret.ts"; import { OpenAI } from "./deps.ts"; import manifest, { Manifest } from "./manifest.gen.ts"; diff --git a/power-reviews/mod.ts b/power-reviews/mod.ts index 0feba0d2d..cd29af018 100644 --- a/power-reviews/mod.ts +++ b/power-reviews/mod.ts @@ -1,4 +1,4 @@ -import type { App, FnContext } from "@deco/deco"; +import type { App, FnContext } from "deco/mod.ts"; import { fetchSafe } from "../utils/fetch.ts"; import { createHttpClient } from "../utils/http.ts"; diff --git a/ra-trustvox/mod.ts b/ra-trustvox/mod.ts index 1220efd4c..e53c3a2c4 100644 --- a/ra-trustvox/mod.ts +++ b/ra-trustvox/mod.ts @@ -1,4 +1,4 @@ -import type { App, AppContext as AC } from "@deco/deco"; +import type { App, AppContext as AC } from "deco/mod.ts"; import { PreviewContainer } from "../utils/preview.tsx"; import manifest, { Manifest } from "./manifest.gen.ts"; diff --git a/ra-trustvox/sections/TrustvoxCertificate.tsx b/ra-trustvox/sections/TrustvoxCertificate.tsx index 90eaf8cba..52b69c940 100644 --- a/ra-trustvox/sections/TrustvoxCertificate.tsx +++ b/ra-trustvox/sections/TrustvoxCertificate.tsx @@ -1,4 +1,4 @@ -import { SectionProps } from "@deco/deco"; +import { SectionProps } from "deco/blocks/section.ts"; import { AppContext } from "../mod.ts"; export default function TrustvoxCertificate( diff --git a/ra-trustvox/sections/TrustvoxProductReviews.tsx b/ra-trustvox/sections/TrustvoxProductReviews.tsx index f1667ff56..d253ff8c0 100644 --- a/ra-trustvox/sections/TrustvoxProductReviews.tsx +++ b/ra-trustvox/sections/TrustvoxProductReviews.tsx @@ -1,4 +1,4 @@ -import { SectionProps } from "@deco/deco"; +import { SectionProps } from "deco/blocks/section.ts"; import { ProductDetailsPage } from "../../commerce/types.ts"; import { scriptAsDataURI } from "../../utils/dataURI.ts"; import { AppContext } from "../mod.ts"; diff --git a/ra-trustvox/sections/TrustvoxRateConfig.tsx b/ra-trustvox/sections/TrustvoxRateConfig.tsx index a8191541c..d99cd0d03 100644 --- a/ra-trustvox/sections/TrustvoxRateConfig.tsx +++ b/ra-trustvox/sections/TrustvoxRateConfig.tsx @@ -1,4 +1,4 @@ -import { SectionProps } from "@deco/deco"; +import { SectionProps } from "deco/blocks/section.ts"; import { scriptAsDataURI } from "../../utils/dataURI.ts"; import { AppContext } from "../mod.ts"; diff --git a/ra-trustvox/sections/TrustvoxStoreReviewsCarousel.tsx b/ra-trustvox/sections/TrustvoxStoreReviewsCarousel.tsx index f20d6d5ad..e59a62073 100644 --- a/ra-trustvox/sections/TrustvoxStoreReviewsCarousel.tsx +++ b/ra-trustvox/sections/TrustvoxStoreReviewsCarousel.tsx @@ -1,4 +1,4 @@ -import { SectionProps } from "@deco/deco"; +import { SectionProps } from "deco/blocks/section.ts"; import { scriptAsDataURI } from "../../utils/dataURI.ts"; import { AppContext } from "../mod.ts"; diff --git a/records/deps.ts b/records/deps.ts index c0dfeb4eb..b614c79b1 100644 --- a/records/deps.ts +++ b/records/deps.ts @@ -1,4 +1,4 @@ -import { context } from "@deco/deco"; +import { context } from "deco/deco.ts"; export * from "https://esm.sh/drizzle-orm@0.30.10/libsql"; export * from "npm:@libsql/client@0.7.0"; diff --git a/records/mod.ts b/records/mod.ts index 559c51fe3..aeca5addb 100644 --- a/records/mod.ts +++ b/records/mod.ts @@ -1,10 +1,10 @@ -import type { App, AppContext as AC } from "@deco/deco"; +import type { App, AppContext as AC } from "deco/mod.ts"; +import manifest, { Manifest } from "./manifest.gen.ts"; import { createClient as createSQLClient, createLocalClient, drizzle, } from "./deps.ts"; -import manifest, { Manifest } from "./manifest.gen.ts"; import { getSQLClientConfig, StorageConfig } from "./utils.ts"; import { PreviewContainer } from "../utils/preview.tsx"; diff --git a/records/scripts/checkDbCredential.ts b/records/scripts/checkDbCredential.ts index 95682fee6..7a4e2ebf4 100644 --- a/records/scripts/checkDbCredential.ts +++ b/records/scripts/checkDbCredential.ts @@ -1,5 +1,5 @@ -import { brightGreen } from "@std/fmt/colors"; import { decode } from "https://deno.land/x/djwt@v3.0.2/mod.ts"; +import { brightGreen } from "std/fmt/colors.ts"; const error = "Could not pull production database"; diff --git a/records/scripts/pullProd.ts b/records/scripts/pullProd.ts index 4a648e6d8..0e37b44b0 100644 --- a/records/scripts/pullProd.ts +++ b/records/scripts/pullProd.ts @@ -1,7 +1,7 @@ -import { brightGreen, brightYellow } from "@std/fmt/colors"; import { existsSync } from "https://deno.land/std@0.201.0/fs/exists.ts"; import { createClient as createSQLClient } from "../deps.ts"; import { getLocalDbFilename, getLocalSQLClientConfig } from "../utils.ts"; +import { brightGreen, brightYellow } from "std/fmt/colors.ts"; import { getDbCredentials } from "./checkDbCredential.ts"; const PRAGMA = "PRAGMA foreign_keys=OFF"; diff --git a/records/utils.ts b/records/utils.ts index b69a978e9..b9dbfa158 100644 --- a/records/utils.ts +++ b/records/utils.ts @@ -1,7 +1,7 @@ -import { context } from "@deco/deco"; -import { brightGreen, brightRed } from "@std/fmt/colors"; -import { join } from "@std/path"; +import { context } from "deco/live.ts"; import { Secret } from "../website/loaders/secret.ts"; +import { brightGreen, brightRed } from "std/fmt/colors.ts"; +import { join } from "https://deno.land/std@0.204.0/path/join.ts"; export interface StorageConfig { /** diff --git a/resend/README.md b/resend/README.md index df2c07a47..f34bf884f 100644 --- a/resend/README.md +++ b/resend/README.md @@ -14,7 +14,7 @@ Resend is an email platform that helps developers build and send transactional a ```typescript // runtime.ts - import { proxy } from "@deco/deco/web"; + import { proxy } from "deco/clients/withManifest.ts"; import type { Manifest } from "./manifest.gen.ts"; import type { Manifest as ManifestVNDA } from "apps/vnda/manifest.gen.ts"; import type { Manifest as ManifestVTEX } from "apps/vtex/manifest.gen.ts"; diff --git a/resend/mod.ts b/resend/mod.ts index 880316608..fb03f1c50 100644 --- a/resend/mod.ts +++ b/resend/mod.ts @@ -1,9 +1,8 @@ -import type { App, AppContext as AC } from "@deco/deco"; +import type { App, AppContext as AC } from "deco/mod.ts"; import { Markdown } from "../decohub/components/Markdown.tsx"; import { fetchSafe } from "../utils/fetch.ts"; import { createHttpClient } from "../utils/http.ts"; import { PreviewContainer } from "../utils/preview.tsx"; - import type { Secret } from "../website/loaders/secret.ts"; import manifest, { Manifest } from "./manifest.gen.ts"; import { ResendApi } from "./utils/client.ts"; diff --git a/scripts/new.ts b/scripts/new.ts index 0b2ac94bb..43cd8c865 100644 --- a/scripts/new.ts +++ b/scripts/new.ts @@ -1,4 +1,4 @@ -import { join } from "@std/path"; +import { join } from "std/path/mod.ts"; const appName = Deno.args[0]; const decoTsPath = join(Deno.cwd(), "deco.ts"); @@ -13,7 +13,7 @@ await Deno.writeTextFile( await Deno.writeTextFile( join(Deno.cwd(), appName, "mod.ts"), ` -import type { App, AppContext as AC } from "@deco/deco"; +import type { App, AppContext as AC } from "deco/mod.ts"; import manifest, { Manifest } from "./manifest.gen.ts"; export interface State { diff --git a/scripts/start.ts b/scripts/start.ts index bf70dde63..e0b3ae2ae 100644 --- a/scripts/start.ts +++ b/scripts/start.ts @@ -1,16 +1,17 @@ // deno-lint-ignore-file no-explicit-any -import "npm:@graphql-codegen/add"; -import "npm:@graphql-codegen/schema-ast"; import "npm:@graphql-codegen/typescript"; import "npm:@graphql-codegen/typescript-operations"; +import "npm:@graphql-codegen/add"; +import "npm:@graphql-codegen/schema-ast"; -import { walk } from "@std/fs"; -import { basename, dirname, join } from "@std/path"; -import { setupGithooks } from "https://deno.land/x/githooks@0.0.4/githooks.ts"; import { CodegenConfig, generate } from "npm:@graphql-codegen/cli"; -import camel from "npm:camelcase"; import { compile } from "npm:json-schema-to-typescript"; import { OpenAPIV3 } from "npm:openapi-types"; +import camel from "npm:camelcase"; +import { walk } from "std/fs/mod.ts"; +import { dirname, join } from "std/path/mod.ts"; +import { basename } from "std/path/win32.ts"; +import { setupGithooks } from "https://deno.land/x/githooks@0.0.4/githooks.ts"; await setupGithooks(); @@ -256,7 +257,7 @@ const generateGraphQL = async () => { } }; -const generateDeco = () => import("@deco/deco/scripts/bundle"); +const generateDeco = () => import("deco/scripts/apps/bundle.ts"); await generateOpenAPI(); await generateGraphQL(); diff --git a/scripts/update.ts b/scripts/update.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/shopify/mod.ts b/shopify/mod.ts index 9a5d7563e..add53caf9 100644 --- a/shopify/mod.ts +++ b/shopify/mod.ts @@ -1,11 +1,11 @@ -import type { App, FnContext } from "@deco/deco"; -import getStateFromZip from "../commerce/utils/stateByZip.ts"; -import { Markdown } from "../decohub/components/Markdown.tsx"; +import type { App, FnContext } from "deco/mod.ts"; import { fetchSafe } from "../utils/fetch.ts"; import { createGraphqlClient } from "../utils/graphql.ts"; -import { PreviewContainer } from "../utils/preview.tsx"; -import type { Secret } from "../website/loaders/secret.ts"; import manifest, { Manifest } from "./manifest.gen.ts"; +import getStateFromZip from "../commerce/utils/stateByZip.ts"; +import type { Secret } from "../website/loaders/secret.ts"; +import { PreviewContainer } from "../utils/preview.tsx"; +import { Markdown } from "../decohub/components/Markdown.tsx"; export type AppContext = FnContext; diff --git a/shopify/runtime.ts b/shopify/runtime.ts index 925809704..41d65a98d 100644 --- a/shopify/runtime.ts +++ b/shopify/runtime.ts @@ -1,4 +1,4 @@ -import { proxy } from "@deco/deco/web"; +import { proxy } from "deco/clients/withManifest.ts"; import { Manifest } from "./manifest.gen.ts"; export const invoke = proxy(); diff --git a/shopify/utils/cart.ts b/shopify/utils/cart.ts index bdbbcc64e..eb7b50ba2 100644 --- a/shopify/utils/cart.ts +++ b/shopify/utils/cart.ts @@ -1,4 +1,4 @@ -import { getCookies, setCookie } from "@std/http/cookie"; +import { getCookies, setCookie } from "std/http/cookie.ts"; const CART_COOKIE = "cart"; const SHOPIFY_PREFIX = "gid://shopify/Cart/"; diff --git a/smarthint/hooks/useAutocomplete.ts b/smarthint/hooks/useAutocomplete.ts index 116542ef1..2711c295f 100644 --- a/smarthint/hooks/useAutocomplete.ts +++ b/smarthint/hooks/useAutocomplete.ts @@ -1,5 +1,5 @@ import { signal } from "@preact/signals"; -import { debounce } from "@std/async/debounce"; +import { debounce } from "std/async/debounce.ts"; import type { Suggestion } from "../../commerce/types.ts"; import { invoke } from "../runtime.ts"; diff --git a/smarthint/loaders/productListingPage.ts b/smarthint/loaders/productListingPage.ts index 1dcad302e..a21f3d627 100644 --- a/smarthint/loaders/productListingPage.ts +++ b/smarthint/loaders/productListingPage.ts @@ -1,7 +1,5 @@ -import { redirect } from "@deco/deco"; import { ProductListingPage } from "../../commerce/types.ts"; import { AppContext } from "../mod.ts"; -import { getSessionCookie } from "../utils/getSession.ts"; import { getFilterParam, getPaginationInfo, @@ -11,6 +9,8 @@ import { toProduct, toSortOption, } from "../utils/transform.ts"; +import { redirect } from "deco/mod.ts"; +import { getSessionCookie } from "../utils/getSession.ts"; import { FilterProp, SearchSort, SHProduct } from "../utils/typings.ts"; import { RuleType } from "./PLPBanners.ts"; import { getCategoriesParam } from "./recommendations.ts"; diff --git a/smarthint/mod.ts b/smarthint/mod.ts index 35b09e7b1..276590e58 100644 --- a/smarthint/mod.ts +++ b/smarthint/mod.ts @@ -1,4 +1,4 @@ -import type { App, AppContext as AC } from "@deco/deco"; +import type { App, AppContext as AC } from "deco/mod.ts"; import { Category } from "../commerce/types.ts"; import { Markdown } from "../decohub/components/Markdown.tsx"; import { fetchSafe } from "../utils/fetch.ts"; diff --git a/smarthint/runtime.ts b/smarthint/runtime.ts index 925809704..41d65a98d 100644 --- a/smarthint/runtime.ts +++ b/smarthint/runtime.ts @@ -1,4 +1,4 @@ -import { proxy } from "@deco/deco/web"; +import { proxy } from "deco/clients/withManifest.ts"; import { Manifest } from "./manifest.gen.ts"; export const invoke = proxy(); diff --git a/smarthint/sections/Analytics/SmarthintTracking.tsx b/smarthint/sections/Analytics/SmarthintTracking.tsx index af51d8903..8a6dc5941 100644 --- a/smarthint/sections/Analytics/SmarthintTracking.tsx +++ b/smarthint/sections/Analytics/SmarthintTracking.tsx @@ -1,9 +1,9 @@ -import { useScriptAsDataURI } from "@deco/deco/hooks"; -import { Props as ClickProps } from "../../actions/click.ts"; import { AppContext } from "../../mod.ts"; +import { Props as ClickProps } from "../../actions/click.ts"; +import { PageType } from "../../utils/typings.ts"; import { ANONYMOUS_COOKIE, SESSION_COOKIE } from "../../utils/getSession.ts"; +import { useScriptAsDataURI } from "deco/hooks/useScript.ts"; import { sortPagesPattern } from "../../utils/sortPagesPattern.ts"; -import { PageType } from "../../utils/typings.ts"; declare global { interface Window { diff --git a/smarthint/utils/getSession.ts b/smarthint/utils/getSession.ts index 0d84cba3f..e26196d83 100644 --- a/smarthint/utils/getSession.ts +++ b/smarthint/utils/getSession.ts @@ -1,4 +1,4 @@ -import { getCookies } from "@std/http/cookie"; +import { getCookies } from "std/http/cookie.ts"; export const SESSION_COOKIE = "SmartHint-Session"; export const ANONYMOUS_COOKIE = "SmartHint-AnonymousConsumer"; diff --git a/sourei/mod.ts b/sourei/mod.ts index 5733297d1..87f956b6c 100644 --- a/sourei/mod.ts +++ b/sourei/mod.ts @@ -1,6 +1,6 @@ -import type { App } from "@deco/deco"; -import { PreviewContainer } from "../utils/preview.tsx"; +import type { App } from "deco/mod.ts"; import manifest, { Manifest } from "./manifest.gen.ts"; +import { PreviewContainer } from "../utils/preview.tsx"; /** * @title Sourei diff --git a/sourei/sections/Analytics/Sourei.tsx b/sourei/sections/Analytics/Sourei.tsx index 7fd61ddf8..c0a37e17b 100644 --- a/sourei/sections/Analytics/Sourei.tsx +++ b/sourei/sections/Analytics/Sourei.tsx @@ -1,6 +1,6 @@ // deno-lint-ignore-file no-explicit-any import { Head } from "$fresh/runtime.ts"; -import { useScriptAsDataURI } from "@deco/deco/hooks"; +import { useScriptAsDataURI } from "deco/hooks/useScript.ts"; interface Props { /** diff --git a/typesense/mod.ts b/typesense/mod.ts index 6841e4144..b8b6b043e 100644 --- a/typesense/mod.ts +++ b/typesense/mod.ts @@ -1,4 +1,4 @@ -import type { App, AppContext as AC } from "@deco/deco"; +import type { App, AppContext as AC } from "deco/mod.ts"; import Typesense from "npm:typesense@1.7.1"; import { Markdown } from "../decohub/components/Markdown.tsx"; import { PreviewContainer } from "../utils/preview.tsx"; diff --git a/typesense/utils/once.ts b/typesense/utils/once.ts index eca6cfd51..79d76ea5b 100644 --- a/typesense/utils/once.ts +++ b/typesense/utils/once.ts @@ -1,9 +1,11 @@ +import { deferred } from "std/async/deferred.ts"; + export const once = (cb: () => Promise) => { - let promise = Promise.withResolvers(); + let promise = deferred(); let run = true; const reset = () => { - promise = Promise.withResolvers(); + promise = deferred(); run = true; }; @@ -21,6 +23,6 @@ export const once = (cb: () => Promise) => { } } - return promise.promise; + return promise; }; }; diff --git a/typesense/utils/product.ts b/typesense/utils/product.ts index 7c767b460..54ae13bc2 100644 --- a/typesense/utils/product.ts +++ b/typesense/utils/product.ts @@ -4,9 +4,11 @@ import { Product, ProductLeaf, PropertyValue } from "../../commerce/types.ts"; import { replaceHighlight } from "./highlight.ts"; import { once } from "./once.ts"; +type PromiseOf = T extends Promise ? K : never; + export type ProductsCollectionName = "products"; export type IndexedProduct = ReturnType; -export type ProductsCollection = Awaited< +export type ProductsCollection = PromiseOf< ReturnType> >; diff --git a/typesense/workflows/index/product.ts b/typesense/workflows/index/product.ts index 5f6810508..ba668afb2 100644 --- a/typesense/workflows/index/product.ts +++ b/typesense/workflows/index/product.ts @@ -1,5 +1,4 @@ -import { WorkflowGen } from "@deco/deco"; -import { WorkflowContext } from "@deco/deco/blocks"; +import { WorkflowContext, WorkflowGen } from "deco/mod.ts"; import { Product } from "../../../commerce/types.ts"; import type { Manifest } from "../../manifest.gen.ts"; diff --git a/utils/cookie.ts b/utils/cookie.ts index 309bd5aa5..94b2561e9 100644 --- a/utils/cookie.ts +++ b/utils/cookie.ts @@ -1,6 +1,7 @@ -import { DECO_SEGMENT, Flag } from "@deco/deco"; -import { tryOrDefault } from "@deco/deco/utils"; -import { getCookies, getSetCookies, setCookie } from "@std/http/cookie"; +import { DECO_SEGMENT } from "deco/mod.ts"; +import { Flag } from "deco/types.ts"; +import { tryOrDefault } from "deco/utils/object.ts"; +import { getCookies, getSetCookies, setCookie } from "std/http/cookie.ts"; export const getFlagsFromRequest = (req: Request) => { const cookies = getCookies(req.headers); diff --git a/utils/fetch.ts b/utils/fetch.ts index 67b73c3aa..eb6aba199 100644 --- a/utils/fetch.ts +++ b/utils/fetch.ts @@ -1,8 +1,12 @@ import "../website/utils/unhandledRejection.ts"; -import { fetch } from "@deco/deco"; -import { ExponentialBackoff, handleWhen, retry } from "npm:cockatiel@3.1.1"; +import { + ExponentialBackoff, + handleWhen, + retry, +} from "https://esm.sh/cockatiel@3.1.1?target=es2019"; import { HttpError } from "./http.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 diff --git a/utils/framework.tsx b/utils/framework.tsx index 5dfc0d177..7eb1876bb 100644 --- a/utils/framework.tsx +++ b/utils/framework.tsx @@ -1,5 +1,6 @@ -import { PreactComponent, useFramework } from "@deco/deco"; -import { green } from "@std/fmt/colors"; +import { PreactComponent } from "deco/engine/block.ts"; +import { useFramework } from "deco/runtime/handler.tsx"; +import { green } from "std/fmt/colors.ts"; export const errorIfFrameworkMismatch = ( flavor: string, page: PreactComponent, @@ -8,7 +9,7 @@ export const errorIfFrameworkMismatch = ( ...page, Component: (props: typeof page["props"]) => { const framework = useFramework(); - if (flavor === "htmx" && flavor !== framework?.name) { + if (flavor === "htmx" && flavor !== framework.name) { throw new Error( `hello 👋 we've found a framework mismatch. looks like your website is configured with a deprecated htmx configuration, please go to your fresh.config.ts and set htmx: true // fresh.config.ts diff --git a/utils/http.ts b/utils/http.ts index ec4397364..bef629dc8 100644 --- a/utils/http.ts +++ b/utils/http.ts @@ -1,4 +1,4 @@ -import { RequestInit } from "@deco/deco"; +import { RequestInit } from "deco/runtime/fetch/mod.ts"; import { fetchSafe } from "./fetch.ts"; const HTTP_VERBS = new Set( diff --git a/utils/pool.ts b/utils/pool.ts index 1c764fc33..bfd4f8417 100644 --- a/utils/pool.ts +++ b/utils/pool.ts @@ -1,19 +1,15 @@ +import { Deferred, deferred } from "std/async/deferred.ts"; + export const createPool = (resources: T[]) => { const taken = new Set(); const free = new Set(resources.map((_, i) => i)); - const waiting: Array< - { - resolve: (v: T) => void; - reject: (e: unknown) => void; - promise: Promise; - } - > = []; + const waiting: Deferred[] = []; return { acquire: () => { if (free.size === 0) { - const p = Promise.withResolvers(); + const p = deferred(); waiting.push(p); return p; diff --git a/utils/weakcache.ts b/utils/weakcache.ts deleted file mode 100644 index 59ba9e877..000000000 --- a/utils/weakcache.ts +++ /dev/null @@ -1 +0,0 @@ -export * as weakcache from "npm:weak-lru-cache@1.0.0"; diff --git a/utils/worker.ts b/utils/worker.ts index 1f27d68d0..7b467182a 100644 --- a/utils/worker.ts +++ b/utils/worker.ts @@ -1,4 +1,6 @@ // deno-lint-ignore-file no-explicit-any +import { Deferred, deferred } from "std/async/deferred.ts"; + /** * Deco labs: 🐁🐁🐁 * @@ -50,9 +52,9 @@ export const createWorker = ( url: URL, options?: WorkerOptions | undefined, ): Promise => { - const setup = Promise.withResolvers(); + const setup = deferred(); const worker = new Worker(new URL(import.meta.url), options); - const invokes = new Map([]); + const invokes = new Map>([]); worker.postMessage({ type: "setup", payload: url.href }); @@ -63,7 +65,7 @@ export const createWorker = ( case "setup:fulfill": { const mod = payload.reduce((acc, curr) => { acc[curr] = (...args: any[]) => { - const run = Promise.withResolvers(); + const run = deferred(); const id = crypto.randomUUID(); invokes.set(id, run); @@ -114,7 +116,7 @@ export const createWorker = ( } }); - return setup.promise; + return setup; }; if (IS_WORKER) { diff --git a/verified-reviews/mod.ts b/verified-reviews/mod.ts index 8914bcbad..5250675f4 100644 --- a/verified-reviews/mod.ts +++ b/verified-reviews/mod.ts @@ -1,4 +1,4 @@ -import type { App, AppContext as AC } from "@deco/deco"; +import type { App, AppContext as AC } from "deco/mod.ts"; import type { Secret } from "../website/loaders/secret.ts"; import manifest, { Manifest } from "./manifest.gen.ts"; import { PreviewContainer } from "../utils/preview.tsx"; diff --git a/verified-reviews/utils/client.ts b/verified-reviews/utils/client.ts index 6270956c1..c08dbfa32 100644 --- a/verified-reviews/utils/client.ts +++ b/verified-reviews/utils/client.ts @@ -1,8 +1,8 @@ -import { context } from "@deco/deco"; -import { Product } from "../../commerce/types.ts"; import { fetchAPI } from "../../utils/fetch.ts"; -import { ConfigVerifiedReviews } from "../mod.ts"; import { Ratings, Reviews, VerifiedReviewsFullReview } from "./types.ts"; +import { Product } from "../../commerce/types.ts"; +import { ConfigVerifiedReviews } from "../mod.ts"; +import { context } from "deco/live.ts"; export type ClientVerifiedReviews = ReturnType; diff --git a/vnda/actions/cart/simulation.ts b/vnda/actions/cart/simulation.ts index c7549446b..22f0f65f4 100644 --- a/vnda/actions/cart/simulation.ts +++ b/vnda/actions/cart/simulation.ts @@ -1,6 +1,6 @@ -import { badRequest } from "@deco/deco"; import { AppContext } from "../../mod.ts"; import type { ShippingMethod } from "../../utils/client/types.ts"; +import { badRequest } from "deco/mod.ts"; export interface Props { skuId: string; diff --git a/vnda/hooks/context.ts b/vnda/hooks/context.ts index 8b22f2052..6e0ac94d0 100644 --- a/vnda/hooks/context.ts +++ b/vnda/hooks/context.ts @@ -1,7 +1,7 @@ import { IS_BROWSER } from "$fresh/runtime.ts"; import { signal } from "@preact/signals"; -import type { Cart } from "../loaders/cart.ts"; import { invoke } from "../runtime.ts"; +import type { Cart } from "../loaders/cart.ts"; export interface Context { cart: Cart; diff --git a/vnda/middleware.ts b/vnda/middleware.ts index f551c3459..7d6f72b19 100644 --- a/vnda/middleware.ts +++ b/vnda/middleware.ts @@ -1,5 +1,5 @@ -import { equal } from "@std/assert"; import { AppMiddlewareContext } from "./mod.ts"; +import { equal } from "std/testing/asserts.ts"; import { buildSegmentCookie, getSegmentFromBag, diff --git a/vnda/mod.ts b/vnda/mod.ts index 897cde791..4b07d5658 100644 --- a/vnda/mod.ts +++ b/vnda/mod.ts @@ -1,4 +1,4 @@ -import type { App, AppMiddlewareContext as AMC, FnContext } from "@deco/deco"; +import type { App, AppMiddlewareContext as AMC, FnContext } from "deco/mod.ts"; import { Markdown } from "../decohub/components/Markdown.tsx"; import { createHttpClient } from "../utils/http.ts"; import { PreviewContainer } from "../utils/preview.tsx"; diff --git a/vnda/runtime.ts b/vnda/runtime.ts index 925809704..41d65a98d 100644 --- a/vnda/runtime.ts +++ b/vnda/runtime.ts @@ -1,4 +1,4 @@ -import { proxy } from "@deco/deco/web"; +import { proxy } from "deco/clients/withManifest.ts"; import { Manifest } from "./manifest.gen.ts"; export const invoke = proxy(); diff --git a/vnda/utils/cart.ts b/vnda/utils/cart.ts index f603f59a6..3364e552d 100644 --- a/vnda/utils/cart.ts +++ b/vnda/utils/cart.ts @@ -1,4 +1,4 @@ -import { getCookies, setCookie } from "@std/http/cookie"; +import { getCookies, setCookie } from "std/http/cookie.ts"; import { SEGMENT_COOKIE_NAME } from "./segment.ts"; const CART_COOKIE = "vnda_cart_id"; diff --git a/vnda/utils/segment.ts b/vnda/utils/segment.ts index ccc5c35f2..9a6b7d4b0 100644 --- a/vnda/utils/segment.ts +++ b/vnda/utils/segment.ts @@ -1,4 +1,4 @@ -import { getCookies, setCookie } from "@std/http/cookie"; +import { getCookies, setCookie } from "std/http/mod.ts"; import { AppContext } from "../mod.ts"; interface Segment { diff --git a/vtex/actions/analytics/sendEvent.ts b/vtex/actions/analytics/sendEvent.ts index 327f10880..061cb3488 100644 --- a/vtex/actions/analytics/sendEvent.ts +++ b/vtex/actions/analytics/sendEvent.ts @@ -1,5 +1,5 @@ // Intelligent Search analytics integration -import type { AppContext } from "../../mod.ts"; +import { AppContext } from "../../mod.ts"; import { getISCookiesFromBag } from "../../utils/intelligentSearch.ts"; export type Props = diff --git a/vtex/actions/cart/addItems.ts b/vtex/actions/cart/addItems.ts index 9d56078a2..e538cd05c 100644 --- a/vtex/actions/cart/addItems.ts +++ b/vtex/actions/cart/addItems.ts @@ -1,9 +1,9 @@ -import type { AppContext } from "../../mod.ts"; +import { AppContext } from "../../mod.ts"; import { proxySetCookie } from "../../utils/cookies.ts"; import { parseCookie } from "../../utils/orderForm.ts"; import { getSegmentFromBag } from "../../utils/segment.ts"; -import { forceHttpsOnAssets } from "../../utils/transform.ts"; import type { OrderForm } from "../../utils/types.ts"; +import { forceHttpsOnAssets } from "../../utils/transform.ts"; export interface Item { quantity: number; diff --git a/vtex/actions/cart/addOfferings.ts b/vtex/actions/cart/addOfferings.ts index 693cf0a37..07fe50b88 100644 --- a/vtex/actions/cart/addOfferings.ts +++ b/vtex/actions/cart/addOfferings.ts @@ -1,8 +1,8 @@ -import type { AppContext } from "../../mod.ts"; +import { AppContext } from "../../mod.ts"; import { proxySetCookie } from "../../utils/cookies.ts"; import { parseCookie } from "../../utils/orderForm.ts"; import { forceHttpsOnAssets } from "../../utils/transform.ts"; -import type { OrderForm } from "../../utils/types.ts"; +import { OrderForm } from "../../utils/types.ts"; import { DEFAULT_EXPECTED_SECTIONS } from "./updateItemAttachment.ts"; export interface Props { diff --git a/vtex/actions/cart/clearOrderformMessages.ts b/vtex/actions/cart/clearOrderformMessages.ts index f27e101e8..c93c4c307 100644 --- a/vtex/actions/cart/clearOrderformMessages.ts +++ b/vtex/actions/cart/clearOrderformMessages.ts @@ -1,4 +1,4 @@ -import type { AppContext } from "../../mod.ts"; +import { AppContext } from "../../mod.ts"; import { proxySetCookie } from "../../utils/cookies.ts"; import { parseCookie } from "../../utils/orderForm.ts"; import type { OrderForm } from "../../utils/types.ts"; diff --git a/vtex/actions/cart/getInstallment.ts b/vtex/actions/cart/getInstallment.ts index 9f4920322..bd22655d8 100644 --- a/vtex/actions/cart/getInstallment.ts +++ b/vtex/actions/cart/getInstallment.ts @@ -1,4 +1,4 @@ -import type { AppContext } from "../../mod.ts"; +import { AppContext } from "../../mod.ts"; import { proxySetCookie } from "../../utils/cookies.ts"; import { parseCookie } from "../../utils/orderForm.ts"; import type { InstallmentOption } from "../../utils/types.ts"; diff --git a/vtex/actions/cart/removeItemAttachment.ts b/vtex/actions/cart/removeItemAttachment.ts index f658da6fc..f0e5f14bd 100644 --- a/vtex/actions/cart/removeItemAttachment.ts +++ b/vtex/actions/cart/removeItemAttachment.ts @@ -1,4 +1,4 @@ -import type { AppContext } from "../../mod.ts"; +import { AppContext } from "../../mod.ts"; import { proxySetCookie } from "../../utils/cookies.ts"; import { parseCookie } from "../../utils/orderForm.ts"; import type { OrderForm } from "../../utils/types.ts"; diff --git a/vtex/actions/cart/removeItems.ts b/vtex/actions/cart/removeItems.ts index 548e943b1..d2e9c2d82 100644 --- a/vtex/actions/cart/removeItems.ts +++ b/vtex/actions/cart/removeItems.ts @@ -1,4 +1,4 @@ -import type { AppContext } from "../../mod.ts"; +import { AppContext } from "../../mod.ts"; import { proxySetCookie } from "../../utils/cookies.ts"; import { parseCookie } from "../../utils/orderForm.ts"; import type { OrderForm } from "../../utils/types.ts"; diff --git a/vtex/actions/cart/removeOffering.ts b/vtex/actions/cart/removeOffering.ts index 4fb3a9666..393cb84d8 100644 --- a/vtex/actions/cart/removeOffering.ts +++ b/vtex/actions/cart/removeOffering.ts @@ -1,8 +1,8 @@ -import type { AppContext } from "../../mod.ts"; +import { AppContext } from "../../mod.ts"; import { proxySetCookie } from "../../utils/cookies.ts"; import { parseCookie } from "../../utils/orderForm.ts"; import { forceHttpsOnAssets } from "../../utils/transform.ts"; -import type { OrderForm } from "../../utils/types.ts"; +import { OrderForm } from "../../utils/types.ts"; import { DEFAULT_EXPECTED_SECTIONS } from "./updateItemAttachment.ts"; export interface Props { diff --git a/vtex/actions/cart/simulation.ts b/vtex/actions/cart/simulation.ts index c18642296..046d91280 100644 --- a/vtex/actions/cart/simulation.ts +++ b/vtex/actions/cart/simulation.ts @@ -1,4 +1,4 @@ -import type { AppContext } from "../../mod.ts"; +import { AppContext } from "../../mod.ts"; import type { SimulationOrderForm } from "../../utils/types.ts"; import { getSegmentFromBag } from "../../utils/segment.ts"; diff --git a/vtex/actions/cart/updateAttachment.ts b/vtex/actions/cart/updateAttachment.ts index 7ab900b14..4b5e7c014 100644 --- a/vtex/actions/cart/updateAttachment.ts +++ b/vtex/actions/cart/updateAttachment.ts @@ -1,4 +1,4 @@ -import type { AppContext } from "../../mod.ts"; +import { AppContext } from "../../mod.ts"; import { proxySetCookie } from "../../utils/cookies.ts"; import { parseCookie } from "../../utils/orderForm.ts"; import type { OrderForm } from "../../utils/types.ts"; diff --git a/vtex/actions/cart/updateCoupons.ts b/vtex/actions/cart/updateCoupons.ts index 874fb9dec..79ebce2a5 100644 --- a/vtex/actions/cart/updateCoupons.ts +++ b/vtex/actions/cart/updateCoupons.ts @@ -1,4 +1,4 @@ -import type { AppContext } from "../../mod.ts"; +import { AppContext } from "../../mod.ts"; import { proxySetCookie } from "../../utils/cookies.ts"; import { parseCookie } from "../../utils/orderForm.ts"; import type { OrderForm } from "../../utils/types.ts"; diff --git a/vtex/actions/cart/updateGifts.ts b/vtex/actions/cart/updateGifts.ts index 9b1ca7014..a5b4c8e99 100644 --- a/vtex/actions/cart/updateGifts.ts +++ b/vtex/actions/cart/updateGifts.ts @@ -1,4 +1,4 @@ -import type { AppContext } from "../../mod.ts"; +import { AppContext } from "../../mod.ts"; import { proxySetCookie } from "../../utils/cookies.ts"; import { parseCookie } from "../../utils/orderForm.ts"; import type { OrderForm, SelectableGifts } from "../../utils/types.ts"; diff --git a/vtex/actions/cart/updateItemAttachment.ts b/vtex/actions/cart/updateItemAttachment.ts index c94434fa9..534c5487b 100644 --- a/vtex/actions/cart/updateItemAttachment.ts +++ b/vtex/actions/cart/updateItemAttachment.ts @@ -1,4 +1,4 @@ -import type { AppContext } from "../../mod.ts"; +import { AppContext } from "../../mod.ts"; import { proxySetCookie } from "../../utils/cookies.ts"; import { parseCookie } from "../../utils/orderForm.ts"; import type { OrderForm } from "../../utils/types.ts"; diff --git a/vtex/actions/cart/updateItemPrice.ts b/vtex/actions/cart/updateItemPrice.ts index 0f24c2990..32108d754 100644 --- a/vtex/actions/cart/updateItemPrice.ts +++ b/vtex/actions/cart/updateItemPrice.ts @@ -1,4 +1,4 @@ -import type { AppContext } from "../../mod.ts"; +import { AppContext } from "../../mod.ts"; import { proxySetCookie } from "../../utils/cookies.ts"; import { parseCookie } from "../../utils/orderForm.ts"; import type { OrderForm } from "../../utils/types.ts"; diff --git a/vtex/actions/cart/updateItems.ts b/vtex/actions/cart/updateItems.ts index 9b5d46fb2..6bcc59613 100644 --- a/vtex/actions/cart/updateItems.ts +++ b/vtex/actions/cart/updateItems.ts @@ -1,4 +1,4 @@ -import type { AppContext } from "../../mod.ts"; +import { AppContext } from "../../mod.ts"; import { proxySetCookie } from "../../utils/cookies.ts"; import { parseCookie } from "../../utils/orderForm.ts"; import { getSegmentFromBag } from "../../utils/segment.ts"; diff --git a/vtex/actions/cart/updateProfile.ts b/vtex/actions/cart/updateProfile.ts index d70310f29..ae54aeefe 100644 --- a/vtex/actions/cart/updateProfile.ts +++ b/vtex/actions/cart/updateProfile.ts @@ -1,4 +1,4 @@ -import type { AppContext } from "../../mod.ts"; +import { AppContext } from "../../mod.ts"; import { proxySetCookie } from "../../utils/cookies.ts"; import { parseCookie } from "../../utils/orderForm.ts"; import type { OrderForm } from "../../utils/types.ts"; diff --git a/vtex/actions/cart/updateUser.ts b/vtex/actions/cart/updateUser.ts index bd237ad94..267088306 100644 --- a/vtex/actions/cart/updateUser.ts +++ b/vtex/actions/cart/updateUser.ts @@ -1,4 +1,4 @@ -import type { AppContext } from "../../mod.ts"; +import { AppContext } from "../../mod.ts"; import { proxySetCookie } from "../../utils/cookies.ts"; import { parseCookie } from "../../utils/orderForm.ts"; import type { OrderForm } from "../../utils/types.ts"; diff --git a/vtex/actions/masterdata/createDocument.ts b/vtex/actions/masterdata/createDocument.ts index af60c3b85..46619a3fd 100644 --- a/vtex/actions/masterdata/createDocument.ts +++ b/vtex/actions/masterdata/createDocument.ts @@ -1,4 +1,4 @@ -import type { AppContext } from "../../mod.ts"; +import { AppContext } from "../../mod.ts"; import { parseCookie } from "../../utils/vtexId.ts"; import type { CreateNewDocument } from "../../utils/types.ts"; diff --git a/vtex/actions/newsletter/subscribe.ts b/vtex/actions/newsletter/subscribe.ts index e8ab9daf4..7195bbbba 100644 --- a/vtex/actions/newsletter/subscribe.ts +++ b/vtex/actions/newsletter/subscribe.ts @@ -1,4 +1,4 @@ -import type { AppContext } from "../../mod.ts"; +import { AppContext } from "../../mod.ts"; export interface Props { email: string; diff --git a/vtex/actions/notifyme.ts b/vtex/actions/notifyme.ts index d5200e953..07d626bd5 100644 --- a/vtex/actions/notifyme.ts +++ b/vtex/actions/notifyme.ts @@ -1,4 +1,4 @@ -import type { AppContext } from "../mod.ts"; +import { AppContext } from "../mod.ts"; export interface Props { email: string; diff --git a/vtex/actions/review/submit.ts b/vtex/actions/review/submit.ts index 79684a63d..a42f0b617 100644 --- a/vtex/actions/review/submit.ts +++ b/vtex/actions/review/submit.ts @@ -1,5 +1,5 @@ import { getCookies } from "std/http/cookie.ts"; -import type { AppContext } from "../../../vtex/mod.ts"; +import { AppContext } from "../../../vtex/mod.ts"; import { VTEX_ID_CLIENT_COOKIE } from "../../utils/vtexId.ts"; export interface Props { diff --git a/vtex/actions/trigger.ts b/vtex/actions/trigger.ts index 97da2a2dc..a69b78828 100644 --- a/vtex/actions/trigger.ts +++ b/vtex/actions/trigger.ts @@ -1,4 +1,4 @@ -import type { AppContext } from "../mod.ts"; +import { AppContext } from "../mod.ts"; export interface VTEXNotificationPayload { /** @description SKU ID in VTEX **/ diff --git a/vtex/actions/wishlist/addItem.ts b/vtex/actions/wishlist/addItem.ts index b019e545b..66de71dfd 100644 --- a/vtex/actions/wishlist/addItem.ts +++ b/vtex/actions/wishlist/addItem.ts @@ -1,5 +1,5 @@ import wishlistLoader from "../../loaders/wishlist.ts"; -import type { AppContext } from "../../mod.ts"; +import { AppContext } from "../../mod.ts"; import type { WishlistItem } from "../../utils/types.ts"; import { parseCookie } from "../../utils/vtexId.ts"; diff --git a/vtex/actions/wishlist/removeItem.ts b/vtex/actions/wishlist/removeItem.ts index 8831b867f..ecdb51987 100644 --- a/vtex/actions/wishlist/removeItem.ts +++ b/vtex/actions/wishlist/removeItem.ts @@ -1,5 +1,5 @@ import wishlistLoader from "../../loaders/wishlist.ts"; -import type { AppContext } from "../../mod.ts"; +import { AppContext } from "../../mod.ts"; import type { WishlistItem } from "../../utils/types.ts"; import { parseCookie } from "../../utils/vtexId.ts"; diff --git a/vtex/components/VTEXPortalDataLayerCompatibility.tsx b/vtex/components/VTEXPortalDataLayerCompatibility.tsx index 0c11d6d1e..d0b962ac6 100644 --- a/vtex/components/VTEXPortalDataLayerCompatibility.tsx +++ b/vtex/components/VTEXPortalDataLayerCompatibility.tsx @@ -1,6 +1,6 @@ -import { useScriptAsDataURI } from "@deco/deco/hooks"; -import type { JSX } from "preact"; -import type { Product } from "../../commerce/types.ts"; +import { useScriptAsDataURI } from "deco/hooks/useScript.ts"; +import { type JSX } from "preact"; +import { Product } from "../../commerce/types.ts"; declare global { interface Window { diff --git a/vtex/handlers/sitemap.ts b/vtex/handlers/sitemap.ts index 3015c9d0d..b760995bf 100644 --- a/vtex/handlers/sitemap.ts +++ b/vtex/handlers/sitemap.ts @@ -1,5 +1,5 @@ import Proxy from "../../website/handlers/proxy.ts"; -import type { AppContext } from "../mod.ts"; +import { AppContext } from "../mod.ts"; type ConnInfo = Deno.ServeHandlerInfo; const xmlHeader = diff --git a/vtex/hooks/context.ts b/vtex/hooks/context.ts index 470d66cd4..16defe607 100644 --- a/vtex/hooks/context.ts +++ b/vtex/hooks/context.ts @@ -1,8 +1,9 @@ import { IS_BROWSER } from "$fresh/runtime.ts"; import { signal } from "@preact/signals"; -import type { Person } from "../../commerce/types.ts"; +import { Person } from "../../commerce/types.ts"; import { invoke } from "../runtime.ts"; -import type { OrderForm, WishlistItem } from "../utils/types.ts"; +import type { OrderForm } from "../utils/types.ts"; +import { WishlistItem } from "../utils/types.ts"; export interface Context { cart: OrderForm | null; diff --git a/vtex/hooks/useAutocomplete.ts b/vtex/hooks/useAutocomplete.ts index 806257b96..cc226a700 100644 --- a/vtex/hooks/useAutocomplete.ts +++ b/vtex/hooks/useAutocomplete.ts @@ -1,5 +1,5 @@ import { signal } from "@preact/signals"; -import { debounce } from "@std/async/debounce"; +import { debounce } from "std/async/debounce.ts"; import type { Suggestion } from "../../commerce/types.ts"; import { invoke } from "../runtime.ts"; diff --git a/vtex/hooks/useCart.ts b/vtex/hooks/useCart.ts index 962c3b105..0d35d45bc 100644 --- a/vtex/hooks/useCart.ts +++ b/vtex/hooks/useCart.ts @@ -1,10 +1,10 @@ // deno-lint-ignore-file no-explicit-any import type { AnalyticsItem } from "../../commerce/types.ts"; import { mapCategoriesToAnalyticsCategories } from "../../commerce/utils/productToAnalyticsItem.ts"; -import type { Manifest } from "../manifest.gen.ts"; +import { Manifest } from "../manifest.gen.ts"; import { invoke } from "../runtime.ts"; import type { OrderForm, OrderFormItem } from "../utils/types.ts"; -import { type Context, state as storeState } from "./context.ts"; +import { Context, state as storeState } from "./context.ts"; const { cart, loading } = storeState; diff --git a/vtex/hooks/useWishlist.ts b/vtex/hooks/useWishlist.ts index e81a5ca48..4df933a1e 100644 --- a/vtex/hooks/useWishlist.ts +++ b/vtex/hooks/useWishlist.ts @@ -1,7 +1,7 @@ // deno-lint-ignore-file no-explicit-any -import type { Manifest } from "../manifest.gen.ts"; +import { Manifest } from "../manifest.gen.ts"; import { invoke } from "../runtime.ts"; -import type { WishlistItem } from "../utils/types.ts"; +import { WishlistItem } from "../utils/types.ts"; import { state as storeState } from "./context.ts"; const { wishlist, loading } = storeState; diff --git a/vtex/loaders/cart.ts b/vtex/loaders/cart.ts index ea1c1b543..db944b8b0 100644 --- a/vtex/loaders/cart.ts +++ b/vtex/loaders/cart.ts @@ -1,4 +1,4 @@ -import type { AppContext } from "../mod.ts"; +import { AppContext } from "../mod.ts"; import { proxySetCookie } from "../utils/cookies.ts"; import { hasDifferentMarketingData, parseCookie } from "../utils/orderForm.ts"; import { getSegmentFromBag } from "../utils/segment.ts"; diff --git a/vtex/loaders/categories/tree.ts b/vtex/loaders/categories/tree.ts index e08023f93..a29454506 100644 --- a/vtex/loaders/categories/tree.ts +++ b/vtex/loaders/categories/tree.ts @@ -1,7 +1,7 @@ -import type { AppContext } from "../../mod.ts"; +import { AppContext } from "../../mod.ts"; import { getSegmentFromBag, withSegmentCookie } from "../../utils/segment.ts"; import { STALE } from "../../../utils/fetch.ts"; -import type { Category } from "../../../commerce/types.ts"; +import { Category } from "../../../commerce/types.ts"; export interface Props { /** diff --git a/vtex/loaders/collections/list.ts b/vtex/loaders/collections/list.ts index 046011416..84709fc8b 100644 --- a/vtex/loaders/collections/list.ts +++ b/vtex/loaders/collections/list.ts @@ -1,6 +1,6 @@ -import { allowCorsFor } from "@deco/deco"; -import type { AppContext } from "../../mod.ts"; -import type { CollectionList } from "../../utils/types.ts"; +import { allowCorsFor } from "deco/mod.ts"; +import { AppContext } from "../../mod.ts"; +import { CollectionList } from "../../utils/types.ts"; export interface Props { term?: string; diff --git a/vtex/loaders/config.ts b/vtex/loaders/config.ts index 03c9893ae..eb1083fba 100644 --- a/vtex/loaders/config.ts +++ b/vtex/loaders/config.ts @@ -1,10 +1,10 @@ -import type { createGraphqlClient } from "../../utils/graphql.ts"; -import type { createHttpClient } from "../../utils/http.ts"; -import type { AppContext } from "../mod.ts"; -import type { SP } from "../utils/client.ts"; -import type { OpenAPI as API } from "../utils/openapi/api.openapi.gen.ts"; -import type { OpenAPI as VCS } from "../utils/openapi/vcs.openapi.gen.ts"; -import type { OpenAPI as MY } from "../utils/openapi/my.openapi.gen.ts"; +import { type createGraphqlClient } from "../../utils/graphql.ts"; +import { type createHttpClient } from "../../utils/http.ts"; +import { type AppContext } from "../mod.ts"; +import { type SP } from "../utils/client.ts"; +import { type OpenAPI as API } from "../utils/openapi/api.openapi.gen.ts"; +import { type OpenAPI as VCS } from "../utils/openapi/vcs.openapi.gen.ts"; +import { type OpenAPI as MY } from "../utils/openapi/my.openapi.gen.ts"; export type Config = { sp: ReturnType>; diff --git a/vtex/loaders/intelligentSearch/productDetailsPage.ts b/vtex/loaders/intelligentSearch/productDetailsPage.ts index 39ef205ce..8ba429ebc 100644 --- a/vtex/loaders/intelligentSearch/productDetailsPage.ts +++ b/vtex/loaders/intelligentSearch/productDetailsPage.ts @@ -1,7 +1,7 @@ import type { ProductDetailsPage } from "../../../commerce/types.ts"; import { STALE } from "../../../utils/fetch.ts"; import type { RequestURLParam } from "../../../website/functions/requestToParam.ts"; -import type { AppContext } from "../../mod.ts"; +import { AppContext } from "../../mod.ts"; import { toPath, withDefaultFacets, @@ -150,11 +150,7 @@ const loader = async ( export const cache = "stale-while-revalidate"; -export const cacheKey = ( - props: Props, - req: Request, - ctx: AppContext, -): string | null => { +export const cacheKey = (props: Props, req: Request, ctx: AppContext) => { const segment = getSegmentFromBag(ctx)?.token; const url = new URL(req.url); const skuId = url.searchParams.get("skuId") ?? ""; diff --git a/vtex/loaders/intelligentSearch/productList.ts b/vtex/loaders/intelligentSearch/productList.ts index 5f4f73380..ac97d5e25 100644 --- a/vtex/loaders/intelligentSearch/productList.ts +++ b/vtex/loaders/intelligentSearch/productList.ts @@ -1,6 +1,6 @@ import type { Product } from "../../../commerce/types.ts"; import { STALE } from "../../../utils/fetch.ts"; -import type { AppContext } from "../../mod.ts"; +import { AppContext } from "../../mod.ts"; import { isFilterParam, toPath, @@ -12,7 +12,7 @@ import { withIsSimilarTo } from "../../utils/similars.ts"; import { toProduct } from "../../utils/transform.ts"; import type { Item, ProductID, Sort } from "../../utils/types.ts"; import { - type LabelledFuzzy, + LabelledFuzzy, mapLabelledFuzzyToFuzzy, } from "./productListingPage.ts"; import { sortProducts } from "../../utils/transform.ts"; diff --git a/vtex/loaders/intelligentSearch/productListingPage.ts b/vtex/loaders/intelligentSearch/productListingPage.ts index 35409d710..400008ee3 100644 --- a/vtex/loaders/intelligentSearch/productListingPage.ts +++ b/vtex/loaders/intelligentSearch/productListingPage.ts @@ -1,9 +1,8 @@ -import { redirect } from "@deco/deco"; import type { ProductListingPage } from "../../../commerce/types.ts"; import { parseRange } from "../../../commerce/utils/filters.ts"; import { STALE } from "../../../utils/fetch.ts"; import sendEvent from "../../actions/analytics/sendEvent.ts"; -import type { AppContext } from "../../mod.ts"; +import { AppContext } from "../../mod.ts"; import { isFilterParam, toPath, @@ -36,6 +35,7 @@ import type { } from "../../utils/types.ts"; import { getFirstItemAvailable } from "../legacy/productListingPage.ts"; import PLPDefaultPath from "../paths/PLPDefaultPath.ts"; +import { redirect } from "deco/mod.ts"; /** this type is more friendly user to fuzzy type that is 0, 1 or auto. */ export type LabelledFuzzy = "automatic" | "disabled" | "enabled"; diff --git a/vtex/loaders/intelligentSearch/productSearchValidator.ts b/vtex/loaders/intelligentSearch/productSearchValidator.ts index a108f3de7..22cc439e5 100644 --- a/vtex/loaders/intelligentSearch/productSearchValidator.ts +++ b/vtex/loaders/intelligentSearch/productSearchValidator.ts @@ -1,5 +1,5 @@ -import type { AppContext } from "../../mod.ts"; -import type { FacetsProps, Props } from "./productList.ts"; +import { AppContext } from "../../mod.ts"; +import { FacetsProps, Props } from "./productList.ts"; import type { Product } from "../../../commerce/types.ts"; /** diff --git a/vtex/loaders/intelligentSearch/suggestions.ts b/vtex/loaders/intelligentSearch/suggestions.ts index fb5f45ee0..1aca14d80 100644 --- a/vtex/loaders/intelligentSearch/suggestions.ts +++ b/vtex/loaders/intelligentSearch/suggestions.ts @@ -1,6 +1,6 @@ -import type { Suggestion } from "../../../commerce/types.ts"; +import { Suggestion } from "../../../commerce/types.ts"; import { STALE } from "../../../utils/fetch.ts"; -import type { AppContext } from "../../mod.ts"; +import { AppContext } from "../../mod.ts"; import { toPath, withDefaultFacets, diff --git a/vtex/loaders/intelligentSearch/topsearches.ts b/vtex/loaders/intelligentSearch/topsearches.ts index 0c5f9f564..1914874c8 100644 --- a/vtex/loaders/intelligentSearch/topsearches.ts +++ b/vtex/loaders/intelligentSearch/topsearches.ts @@ -1,7 +1,7 @@ -import type { AppContext } from "../../mod.ts"; +import { AppContext } from "../../mod.ts"; import { getSegmentFromBag, withSegmentCookie } from "../../utils/segment.ts"; import { STALE } from "../../../utils/fetch.ts"; -import type { Suggestion } from "../../../commerce/types.ts"; +import { Suggestion } from "../../../commerce/types.ts"; export default async function ( _props: unknown, diff --git a/vtex/loaders/legacy/brands.ts b/vtex/loaders/legacy/brands.ts index b2983f5f2..54b0d7727 100644 --- a/vtex/loaders/legacy/brands.ts +++ b/vtex/loaders/legacy/brands.ts @@ -1,5 +1,5 @@ -import type { Brand } from "../../../commerce/types.ts"; -import type { AppContext } from "../../mod.ts"; +import { Brand } from "../../../commerce/types.ts"; +import { AppContext } from "../../mod.ts"; import { toBrand } from "../../utils/transform.ts"; interface Props { diff --git a/vtex/loaders/legacy/pageType.ts b/vtex/loaders/legacy/pageType.ts index 06dc0c5fd..b21cd1d27 100644 --- a/vtex/loaders/legacy/pageType.ts +++ b/vtex/loaders/legacy/pageType.ts @@ -1,5 +1,5 @@ import { STALE } from "../../../utils/fetch.ts"; -import type { AppContext } from "../../mod.ts"; +import { AppContext } from "../../mod.ts"; interface Props { term?: string; diff --git a/vtex/loaders/legacy/productDetailsPage.ts b/vtex/loaders/legacy/productDetailsPage.ts index 5a2df73e8..b2eed191f 100644 --- a/vtex/loaders/legacy/productDetailsPage.ts +++ b/vtex/loaders/legacy/productDetailsPage.ts @@ -1,7 +1,7 @@ import type { ProductDetailsPage } from "../../../commerce/types.ts"; import { STALE } from "../../../utils/fetch.ts"; import type { RequestURLParam } from "../../../website/functions/requestToParam.ts"; -import type { AppContext } from "../../mod.ts"; +import { AppContext } from "../../mod.ts"; import { toSegmentParams } from "../../utils/legacy.ts"; import { getSegmentFromBag, withSegmentCookie } from "../../utils/segment.ts"; import { withIsSimilarTo } from "../../utils/similars.ts"; diff --git a/vtex/loaders/legacy/productList.ts b/vtex/loaders/legacy/productList.ts index b727ec972..9e0ec4488 100644 --- a/vtex/loaders/legacy/productList.ts +++ b/vtex/loaders/legacy/productList.ts @@ -1,6 +1,6 @@ import type { Product } from "../../../commerce/types.ts"; import { STALE } from "../../../utils/fetch.ts"; -import type { AppContext } from "../../mod.ts"; +import { AppContext } from "../../mod.ts"; import { isFilterParam, toSegmentParams } from "../../utils/legacy.ts"; import { getSegmentFromBag, withSegmentCookie } from "../../utils/segment.ts"; import { withIsSimilarTo } from "../../utils/similars.ts"; diff --git a/vtex/loaders/legacy/productListingPage.ts b/vtex/loaders/legacy/productListingPage.ts index f1e7e7b15..88c258ac4 100644 --- a/vtex/loaders/legacy/productListingPage.ts +++ b/vtex/loaders/legacy/productListingPage.ts @@ -1,7 +1,7 @@ -import type { LegacyItem } from "../../utils/types.ts"; +import { LegacyItem } from "../../utils/types.ts"; import type { Filter, ProductListingPage } from "../../../commerce/types.ts"; import { STALE } from "../../../utils/fetch.ts"; -import type { AppContext } from "../../mod.ts"; +import { AppContext } from "../../mod.ts"; import { getMapAndTerm, getValidTypesFromPageTypes, diff --git a/vtex/loaders/legacy/relatedProductsLoader.ts b/vtex/loaders/legacy/relatedProductsLoader.ts index 6d8df5864..67919d5b1 100644 --- a/vtex/loaders/legacy/relatedProductsLoader.ts +++ b/vtex/loaders/legacy/relatedProductsLoader.ts @@ -1,7 +1,7 @@ import type { Product } from "../../../commerce/types.ts"; import { STALE } from "../../../utils/fetch.ts"; -import type { RequestURLParam } from "../../../website/functions/requestToParam.ts"; -import type { AppContext } from "../../mod.ts"; +import { RequestURLParam } from "../../../website/functions/requestToParam.ts"; +import { AppContext } from "../../mod.ts"; import { batch } from "../../utils/batch.ts"; import { isFilterParam, toSegmentParams } from "../../utils/legacy.ts"; import { getSegmentFromBag, withSegmentCookie } from "../../utils/segment.ts"; diff --git a/vtex/loaders/legacy/suggestions.ts b/vtex/loaders/legacy/suggestions.ts index 9128d1c26..7189581e6 100644 --- a/vtex/loaders/legacy/suggestions.ts +++ b/vtex/loaders/legacy/suggestions.ts @@ -1,5 +1,5 @@ -import type { Product, Suggestion } from "../../../commerce/types.ts"; -import type { AppContext } from "../../mod.ts"; +import { Product, Suggestion } from "../../../commerce/types.ts"; +import { AppContext } from "../../mod.ts"; import { getSegmentFromBag, withSegmentCookie } from "../../utils/segment.ts"; export interface Props { diff --git a/vtex/loaders/masterdata/searchDocuments.ts b/vtex/loaders/masterdata/searchDocuments.ts index 8da1d6133..f21770c8c 100644 --- a/vtex/loaders/masterdata/searchDocuments.ts +++ b/vtex/loaders/masterdata/searchDocuments.ts @@ -1,4 +1,4 @@ -import type { AppContext } from "../../mod.ts"; +import { AppContext } from "../../mod.ts"; import { resourceRange } from "../../utils/resourceRange.ts"; import type { Document } from "../../utils/types.ts"; import { parseCookie } from "../../utils/vtexId.ts"; diff --git a/vtex/loaders/navbar.ts b/vtex/loaders/navbar.ts index ffe60e484..6ba103425 100644 --- a/vtex/loaders/navbar.ts +++ b/vtex/loaders/navbar.ts @@ -1,6 +1,6 @@ import type { SiteNavigationElement } from "../../commerce/types.ts"; import { STALE } from "../../utils/fetch.ts"; -import type { AppContext } from "../mod.ts"; +import { AppContext } from "../mod.ts"; import { categoryTreeToNavbar } from "../utils/transform.ts"; export interface Props { diff --git a/vtex/loaders/options/productIdByTerm.ts b/vtex/loaders/options/productIdByTerm.ts index 74bb570d6..376df372d 100644 --- a/vtex/loaders/options/productIdByTerm.ts +++ b/vtex/loaders/options/productIdByTerm.ts @@ -1,5 +1,5 @@ -import { allowCorsFor } from "@deco/deco"; -import type { AppContext } from "../../mod.ts"; +import { allowCorsFor } from "deco/mod.ts"; +import { AppContext } from "../../mod.ts"; interface Props { term?: string; diff --git a/vtex/loaders/orders/list.ts b/vtex/loaders/orders/list.ts index d554044f1..2921e0bcb 100644 --- a/vtex/loaders/orders/list.ts +++ b/vtex/loaders/orders/list.ts @@ -1,5 +1,5 @@ -import type { AppContext } from "../../mod.ts"; -import type { Userorderslist } from "../../utils/openapi/vcs.openapi.gen.ts"; +import { AppContext } from "../../mod.ts"; +import { Userorderslist } from "../../utils/openapi/vcs.openapi.gen.ts"; import { parseCookie } from "../../utils/vtexId.ts"; export interface Props { diff --git a/vtex/loaders/paths/PDPDefaultPath.ts b/vtex/loaders/paths/PDPDefaultPath.ts index 09a0fadab..5d816463c 100644 --- a/vtex/loaders/paths/PDPDefaultPath.ts +++ b/vtex/loaders/paths/PDPDefaultPath.ts @@ -1,5 +1,5 @@ -import type { DefaultPathProps } from "../../../website/pages/Page.tsx"; -import type { AppContext } from "../../mod.ts"; +import { DefaultPathProps } from "../../../website/pages/Page.tsx"; +import { AppContext } from "../../mod.ts"; import productList from "../legacy/productList.ts"; export interface Props { diff --git a/vtex/loaders/paths/PLPDefaultPath.ts b/vtex/loaders/paths/PLPDefaultPath.ts index 643e4a341..6747a400d 100644 --- a/vtex/loaders/paths/PLPDefaultPath.ts +++ b/vtex/loaders/paths/PLPDefaultPath.ts @@ -1,7 +1,7 @@ -import type { DefaultPathProps } from "../../../website/pages/Page.tsx"; -import type { AppContext } from "../../mod.ts"; +import { DefaultPathProps } from "../../../website/pages/Page.tsx"; +import { AppContext } from "../../mod.ts"; import categoryTree from "../categories/tree.ts"; -import type { Category } from "../../../commerce/types.ts"; +import { Category } from "../../../commerce/types.ts"; export interface Props { level: number; diff --git a/vtex/loaders/product/extend.ts b/vtex/loaders/product/extend.ts index 08ff6e40c..fd0bbfa8f 100644 --- a/vtex/loaders/product/extend.ts +++ b/vtex/loaders/product/extend.ts @@ -1,5 +1,5 @@ -import type { Product, ProductLeaf } from "../../../commerce/types.ts"; -import type { AppContext } from "../../mod.ts"; +import { Product, ProductLeaf } from "../../../commerce/types.ts"; +import { AppContext } from "../../mod.ts"; import { batch } from "../../utils/batch.ts"; import { extension as simulateExt } from "../../utils/extensions/simulation.ts"; import { withIsSimilarTo } from "../../utils/similars.ts"; diff --git a/vtex/loaders/product/extensions/detailsPage.ts b/vtex/loaders/product/extensions/detailsPage.ts index c0952831b..90754620c 100644 --- a/vtex/loaders/product/extensions/detailsPage.ts +++ b/vtex/loaders/product/extensions/detailsPage.ts @@ -1,7 +1,7 @@ -import type { ProductDetailsPage } from "../../../../commerce/types.ts"; -import type { ExtensionOf } from "../../../../website/loaders/extension.ts"; -import type { AppContext } from "../../../mod.ts"; -import type { Props } from "../extend.ts"; +import { ProductDetailsPage } from "../../../../commerce/types.ts"; +import { ExtensionOf } from "../../../../website/loaders/extension.ts"; +import { AppContext } from "../../../mod.ts"; +import { Props } from "../extend.ts"; /** * @title VTEX Integration - Extra Info diff --git a/vtex/loaders/product/extensions/list.ts b/vtex/loaders/product/extensions/list.ts index 174481855..153e8b6c2 100644 --- a/vtex/loaders/product/extensions/list.ts +++ b/vtex/loaders/product/extensions/list.ts @@ -1,7 +1,7 @@ -import type { Product } from "../../../../commerce/types.ts"; -import type { ExtensionOf } from "../../../../website/loaders/extension.ts"; -import type { AppContext } from "../../../mod.ts"; -import type { Props } from "../extend.ts"; +import { Product } from "../../../../commerce/types.ts"; +import { ExtensionOf } from "../../../../website/loaders/extension.ts"; +import { AppContext } from "../../../mod.ts"; +import { Props } from "../extend.ts"; /** * @title VTEX Integration - Extra Info diff --git a/vtex/loaders/product/extensions/listingPage.ts b/vtex/loaders/product/extensions/listingPage.ts index e61473e1c..09eec97cf 100644 --- a/vtex/loaders/product/extensions/listingPage.ts +++ b/vtex/loaders/product/extensions/listingPage.ts @@ -1,7 +1,7 @@ -import type { ProductListingPage } from "../../../../commerce/types.ts"; -import type { ExtensionOf } from "../../../../website/loaders/extension.ts"; -import type { AppContext } from "../../../mod.ts"; -import type { Props } from "../extend.ts"; +import { ProductListingPage } from "../../../../commerce/types.ts"; +import { ExtensionOf } from "../../../../website/loaders/extension.ts"; +import { AppContext } from "../../../mod.ts"; +import { Props } from "../extend.ts"; /** * @title VTEX Integration - Extra Info diff --git a/vtex/loaders/product/extensions/suggestions.ts b/vtex/loaders/product/extensions/suggestions.ts index 605400d36..f7f5bd99f 100644 --- a/vtex/loaders/product/extensions/suggestions.ts +++ b/vtex/loaders/product/extensions/suggestions.ts @@ -1,7 +1,7 @@ -import type { Suggestion } from "../../../../commerce/types.ts"; -import type { ExtensionOf } from "../../../../website/loaders/extension.ts"; -import type { AppContext } from "../../../mod.ts"; -import type { Props } from "../extend.ts"; +import { Suggestion } from "../../../../commerce/types.ts"; +import { ExtensionOf } from "../../../../website/loaders/extension.ts"; +import { AppContext } from "../../../mod.ts"; +import { Props } from "../extend.ts"; /** * @title VTEX Integration - Extra Info diff --git a/vtex/loaders/product/wishlist.ts b/vtex/loaders/product/wishlist.ts index f9012ad86..92f728d68 100644 --- a/vtex/loaders/product/wishlist.ts +++ b/vtex/loaders/product/wishlist.ts @@ -1,5 +1,5 @@ -import type { Product, ProductListingPage } from "../../../commerce/types.ts"; -import type { AppContext } from "../../mod.ts"; +import { Product, ProductListingPage } from "../../../commerce/types.ts"; +import { AppContext } from "../../mod.ts"; import wishlistLoader from "../wishlist.ts"; export interface Props { diff --git a/vtex/loaders/proxy.ts b/vtex/loaders/proxy.ts index dbad007c7..213a4b59a 100644 --- a/vtex/loaders/proxy.ts +++ b/vtex/loaders/proxy.ts @@ -1,6 +1,6 @@ -import type { Route } from "../../website/flags/audience.ts"; -import type { AppContext } from "../mod.ts"; -import type { Script } from "../../website/types.ts"; +import { Route } from "../../website/flags/audience.ts"; +import { AppContext } from "../mod.ts"; +import { Script } from "../../website/types.ts"; const PATHS_TO_PROXY = [ "/account", diff --git a/vtex/loaders/user.ts b/vtex/loaders/user.ts index 42255b655..174398e71 100644 --- a/vtex/loaders/user.ts +++ b/vtex/loaders/user.ts @@ -1,5 +1,5 @@ -import type { Person } from "../../commerce/types.ts"; -import type { AppContext } from "../mod.ts"; +import { Person } from "../../commerce/types.ts"; +import { AppContext } from "../mod.ts"; import { parseCookie } from "../utils/vtexId.ts"; interface User { diff --git a/vtex/loaders/wishlist.ts b/vtex/loaders/wishlist.ts index be818a4a1..6ae9a88c1 100644 --- a/vtex/loaders/wishlist.ts +++ b/vtex/loaders/wishlist.ts @@ -1,4 +1,4 @@ -import type { AppContext } from "../mod.ts"; +import { AppContext } from "../mod.ts"; import type { WishlistItem } from "../utils/types.ts"; import { parseCookie } from "../utils/vtexId.ts"; diff --git a/vtex/loaders/workflow/product.ts b/vtex/loaders/workflow/product.ts index ea4b8c0c3..8c45d1465 100644 --- a/vtex/loaders/workflow/product.ts +++ b/vtex/loaders/workflow/product.ts @@ -4,7 +4,7 @@ import type { PropertyValue, UnitPriceSpecification, } from "../../../commerce/types.ts"; -import type { AppContext } from "../../mod.ts"; +import { AppContext } from "../../mod.ts"; import { aggregateOffers, toAdditionalPropertyCategory, diff --git a/vtex/loaders/workflow/products.ts b/vtex/loaders/workflow/products.ts index b17369f6d..cb91b9033 100644 --- a/vtex/loaders/workflow/products.ts +++ b/vtex/loaders/workflow/products.ts @@ -1,5 +1,5 @@ import type { Product } from "../../../commerce/types.ts"; -import type { AppContext } from "../../mod.ts"; +import { AppContext } from "../../mod.ts"; export type Props = { page: number; diff --git a/vtex/middleware.ts b/vtex/middleware.ts index 0e30ee14b..f4e33f34b 100644 --- a/vtex/middleware.ts +++ b/vtex/middleware.ts @@ -1,5 +1,5 @@ -import { getCookies } from "@std/http/cookie"; -import type { AppMiddlewareContext } from "./mod.ts"; +import { getCookies } from "std/http/cookie.ts"; +import { AppMiddlewareContext } from "./mod.ts"; import { getISCookiesFromBag, setISCookiesBag, diff --git a/vtex/mod.ts b/vtex/mod.ts index 19b198c38..de20287b8 100644 --- a/vtex/mod.ts +++ b/vtex/mod.ts @@ -4,20 +4,20 @@ import type { AppMiddlewareContext as AMC, AppRuntime, ManifestOf, -} from "@deco/deco"; +} from "deco/mod.ts"; import { createGraphqlClient } from "../utils/graphql.ts"; import { createHttpClient } from "../utils/http.ts"; -import { removeDirtyCookies } from "../utils/normalize.ts"; -import type { Secret } from "../website/loaders/secret.ts"; import workflow from "../workflows/mod.ts"; -import manifest, { type Manifest } from "./manifest.gen.ts"; +import manifest, { Manifest } from "./manifest.gen.ts"; import { middleware } from "./middleware.ts"; -import type { SP, VTEXCommerceStable } from "./utils/client.ts"; +import { SP, VTEXCommerceStable } from "./utils/client.ts"; import { fetchSafe } from "./utils/fetchVTEX.ts"; -import type { OpenAPI as API } from "./utils/openapi/api.openapi.gen.ts"; -import type { OpenAPI as MY } from "./utils/openapi/my.openapi.gen.ts"; -import type { OpenAPI as VCS } from "./utils/openapi/vcs.openapi.gen.ts"; -import type { Segment } from "./utils/types.ts"; +import { OpenAPI as VCS } from "./utils/openapi/vcs.openapi.gen.ts"; +import { OpenAPI as API } from "./utils/openapi/api.openapi.gen.ts"; +import { OpenAPI as MY } from "./utils/openapi/my.openapi.gen.ts"; +import { Segment } from "./utils/types.ts"; +import type { Secret } from "../website/loaders/secret.ts"; +import { removeDirtyCookies } from "../utils/normalize.ts"; import { Markdown } from "../decohub/components/Markdown.tsx"; import { PreviewVtex } from "./preview/Preview.tsx"; diff --git a/vtex/preview/Preview.tsx b/vtex/preview/Preview.tsx index b7954e6c6..33ebfc926 100644 --- a/vtex/preview/Preview.tsx +++ b/vtex/preview/Preview.tsx @@ -1,4 +1,6 @@ -import { type AppRuntime, type BaseContext, Context } from "@deco/deco"; +import { BaseContext } from "deco/engine/core/resolver.ts"; +import { Context } from "deco/live.ts"; +import { AppRuntime } from "deco/types.ts"; import type { JSX } from "preact"; import { PreviewContainer } from "../../utils/preview.tsx"; import { App } from "../mod.ts"; @@ -11,7 +13,7 @@ export const PreviewVtex = ( app: AppRuntime & { markdownContent: () => JSX.Element; }, -): JSX.Element => { +) => { const context = Context.active(); const decoSite = context.site; const publicUrl = app.state?.publicUrl || ""; diff --git a/vtex/runtime.ts b/vtex/runtime.ts index b7503f69f..41d65a98d 100644 --- a/vtex/runtime.ts +++ b/vtex/runtime.ts @@ -1,4 +1,4 @@ -import { proxy } from "@deco/deco/web"; -import type { Manifest } from "./manifest.gen.ts"; +import { proxy } from "deco/clients/withManifest.ts"; +import { Manifest } from "./manifest.gen.ts"; export const invoke = proxy(); diff --git a/vtex/sections/Analytics/Vtex.tsx b/vtex/sections/Analytics/Vtex.tsx index 4f34aa98b..bd7f7a81d 100644 --- a/vtex/sections/Analytics/Vtex.tsx +++ b/vtex/sections/Analytics/Vtex.tsx @@ -1,13 +1,13 @@ -import type { SectionProps } from "@deco/deco"; -import { useScriptAsDataURI } from "@deco/deco/hooks"; -import type { +import { SectionProps } from "deco/blocks/section.ts"; +import { useScriptAsDataURI } from "deco/hooks/useScript.ts"; +import { AddToCartEvent, AnalyticsItem, SelectItemEvent, } from "../../../commerce/types.ts"; -import type { AppContext } from "../../mod.ts"; +import { AppContext } from "../../mod.ts"; import { getISCookiesFromBag } from "../../utils/intelligentSearch.ts"; -import type { SPEvent } from "../../utils/types.ts"; +import { SPEvent } from "../../utils/types.ts"; interface ISCookies { // deno-lint-ignore no-explicit-any diff --git a/vtex/utils/cacheBySegment.ts b/vtex/utils/cacheBySegment.ts index 83e0400b7..050a56a81 100644 --- a/vtex/utils/cacheBySegment.ts +++ b/vtex/utils/cacheBySegment.ts @@ -1,4 +1,4 @@ -import type { AppContext } from "../mod.ts"; +import { AppContext } from "../mod.ts"; import { getSegmentFromBag, isAnonymous } from "./segment.ts"; export const cache = "stale-while-revalidate"; diff --git a/vtex/utils/client.ts b/vtex/utils/client.ts index eed229a0d..46be6e682 100644 --- a/vtex/utils/client.ts +++ b/vtex/utils/client.ts @@ -1,5 +1,5 @@ -import type { Userorderslist } from "./openapi/vcs.openapi.gen.ts"; -import type { +import { Userorderslist } from "./openapi/vcs.openapi.gen.ts"; +import { Brand, Category, CreateNewDocument, diff --git a/vtex/utils/cookies.ts b/vtex/utils/cookies.ts index d502ab1c4..d6dbe1595 100644 --- a/vtex/utils/cookies.ts +++ b/vtex/utils/cookies.ts @@ -1,4 +1,4 @@ -import { getSetCookies, setCookie } from "@std/http/cookie"; +import { getSetCookies, setCookie } from "std/http/cookie.ts"; export const stringify = (cookies: Record) => Object.entries(cookies) diff --git a/vtex/utils/extensions/simulation.ts b/vtex/utils/extensions/simulation.ts index d6de7862f..3c9a77473 100644 --- a/vtex/utils/extensions/simulation.ts +++ b/vtex/utils/extensions/simulation.ts @@ -1,7 +1,7 @@ -import type { Product, ProductLeaf } from "../../../commerce/types.ts"; -import type { AppContext } from "../../mod.ts"; +import { Product, ProductLeaf } from "../../../commerce/types.ts"; +import { AppContext } from "../../mod.ts"; import { batch } from "../batch.ts"; -import type { OpenAPI } from "../openapi/vcs.openapi.gen.ts"; +import { OpenAPI } from "../openapi/vcs.openapi.gen.ts"; import { getSegmentFromBag, isAnonymous } from "../segment.ts"; import { aggregateOffers } from "../transform.ts"; diff --git a/vtex/utils/intelligentSearch.ts b/vtex/utils/intelligentSearch.ts index a4381a21a..5da3dd5c6 100644 --- a/vtex/utils/intelligentSearch.ts +++ b/vtex/utils/intelligentSearch.ts @@ -1,5 +1,5 @@ -import { setCookie } from "@std/http/cookie"; -import type { AppContext } from "../mod.ts"; +import { setCookie } from "std/http/mod.ts"; +import { AppContext } from "../mod.ts"; import { STALE } from "../../utils/fetch.ts"; import type { SelectedFacet, Sort } from "../utils/types.ts"; diff --git a/vtex/utils/legacy.ts b/vtex/utils/legacy.ts index 814ebf4a3..0f3bf52a6 100644 --- a/vtex/utils/legacy.ts +++ b/vtex/utils/legacy.ts @@ -1,10 +1,10 @@ import type { Seo } from "../../commerce/types.ts"; import { capitalize } from "../../utils/capitalize.ts"; import { STALE } from "../../utils/fetch.ts"; -import type { AppContext } from "../mod.ts"; +import { AppContext } from "../mod.ts"; import { slugify } from "../utils/slugify.ts"; import type { PageType } from "../utils/types.ts"; -import type { WrappedSegment } from "./segment.ts"; +import { WrappedSegment } from "./segment.ts"; export const toSegmentParams = ( { payload: segment }: WrappedSegment, diff --git a/vtex/utils/orderForm.ts b/vtex/utils/orderForm.ts index 6d7bc80a0..0953250d5 100644 --- a/vtex/utils/orderForm.ts +++ b/vtex/utils/orderForm.ts @@ -1,6 +1,6 @@ -import { type Cookie, getCookies } from "@std/http/cookie"; +import { Cookie, getCookies } from "std/http/mod.ts"; import { stringify } from "./cookies.ts"; -import type { MarketingData } from "./types.ts"; +import { MarketingData } from "./types.ts"; const VTEX_CHECKOUT_COOKIE = "checkout.vtex.com"; diff --git a/vtex/utils/segment.ts b/vtex/utils/segment.ts index d8970aa35..36eb9cfce 100644 --- a/vtex/utils/segment.ts +++ b/vtex/utils/segment.ts @@ -1,7 +1,7 @@ -import { setCookie } from "@std/http/cookie"; -import { removeNonLatin1Chars } from "../../utils/normalize.ts"; -import type { AppContext } from "../mod.ts"; +import { setCookie } from "std/http/mod.ts"; +import { AppContext } from "../mod.ts"; import type { Segment } from "./types.ts"; +import { removeNonLatin1Chars } from "../../utils/normalize.ts"; const SEGMENT_COOKIE_NAME = "vtex_segment"; const SEGMENT = Symbol("segment"); diff --git a/vtex/utils/similars.ts b/vtex/utils/similars.ts index 39b3be1a7..1ba304260 100644 --- a/vtex/utils/similars.ts +++ b/vtex/utils/similars.ts @@ -1,6 +1,6 @@ import type { Product } from "../../commerce/types.ts"; import relatedProductsLoader from "../loaders/legacy/relatedProductsLoader.ts"; -import type { AppContext } from "../mod.ts"; +import { AppContext } from "../mod.ts"; export const withIsSimilarTo = async ( req: Request, diff --git a/vtex/utils/vtexId.ts b/vtex/utils/vtexId.ts index d35cd80e6..51f367a94 100644 --- a/vtex/utils/vtexId.ts +++ b/vtex/utils/vtexId.ts @@ -1,5 +1,5 @@ -import { getCookies } from "@std/http/cookie"; -import { decode } from "@zaubrik/djwt"; +import { getCookies } from "std/http/mod.ts"; +import { decode } from "https://deno.land/x/djwt@v2.8/mod.ts"; import { stringify } from "./cookies.ts"; export const VTEX_ID_CLIENT_COOKIE = "VtexIdclientAutCookie"; diff --git a/vtex/workflows/events.ts b/vtex/workflows/events.ts index dec48aafb..5ab7ea2d9 100644 --- a/vtex/workflows/events.ts +++ b/vtex/workflows/events.ts @@ -1,7 +1,5 @@ -import type { WorkflowGen } from "@deco/deco"; -import type { WorkflowContext } from "@deco/deco/blocks"; - -import type { Workflow } from "@deco/deco/blocks"; +import type { Workflow } from "deco/blocks/workflow.ts"; +import type { WorkflowContext, WorkflowGen } from "deco/mod.ts"; import type { Product } from "../../commerce/types.ts"; import { waitForWorkflowCompletion } from "../../workflows/utils/awaiters.ts"; import type { VTEXNotificationPayload } from "../actions/trigger.ts"; diff --git a/vtex/workflows/product/index.ts b/vtex/workflows/product/index.ts index f1702da0f..524d1180e 100644 --- a/vtex/workflows/product/index.ts +++ b/vtex/workflows/product/index.ts @@ -1,10 +1,8 @@ -import type { WorkflowGen } from "@deco/deco"; -import type { WorkflowContext } from "@deco/deco/blocks"; - -import type { Product } from "../../../commerce/types.ts"; +import { type WorkflowContext, WorkflowGen } from "deco/mod.ts"; +import { type VTEXNotificationPayload } from "../../actions/trigger.ts"; +import { type AppManifest } from "../../mod.ts"; +import { type Product } from "../../../commerce/types.ts"; import { waitForWorkflowCompletion } from "../../../workflows/utils/awaiters.ts"; -import type { VTEXNotificationPayload } from "../../actions/trigger.ts"; -import type { AppManifest } from "../../mod.ts"; const PAGE_SIZE = 50; @@ -34,7 +32,7 @@ export default function Index() { const executions = []; for (const product of products) { const exec = yield ctx.invoke("workflows/actions/start.ts", { - // @ts-ignore: TODO: fix this + // @ts-expect-error vtex trigger is on generated type key: "vtex-trigger", args: [{ IdSku: product.productID }] as VTEXNotificationPayload[], }); diff --git a/wake/hooks/context.ts b/wake/hooks/context.ts index 873a8b6ae..4d3f6b1c4 100644 --- a/wake/hooks/context.ts +++ b/wake/hooks/context.ts @@ -1,12 +1,12 @@ import { IS_BROWSER } from "$fresh/runtime.ts"; import { signal } from "@preact/signals"; -import { Person } from "../../commerce/types.ts"; import { invoke } from "../runtime.ts"; -import { setClientCookie } from "../utils/cart.ts"; import type { CheckoutFragment, WishlistReducedProductFragment, } from "../utils/graphql/storefront.graphql.gen.ts"; +import { Person } from "../../commerce/types.ts"; +import { setClientCookie } from "../utils/cart.ts"; import { ShopQuery } from "../utils/graphql/storefront.graphql.gen.ts"; export interface Context { diff --git a/wake/mod.ts b/wake/mod.ts index 703e0dc97..08737ca65 100644 --- a/wake/mod.ts +++ b/wake/mod.ts @@ -1,4 +1,4 @@ -import type { App, FnContext } from "@deco/deco"; +import type { App, FnContext } from "deco/mod.ts"; import { Markdown } from "../decohub/components/Markdown.tsx"; import { fetchSafe } from "../utils/fetch.ts"; import { createGraphqlClient } from "../utils/graphql.ts"; diff --git a/wake/runtime.ts b/wake/runtime.ts index 925809704..41d65a98d 100644 --- a/wake/runtime.ts +++ b/wake/runtime.ts @@ -1,4 +1,4 @@ -import { proxy } from "@deco/deco/web"; +import { proxy } from "deco/clients/withManifest.ts"; import { Manifest } from "./manifest.gen.ts"; export const invoke = proxy(); diff --git a/wake/utils/cart.ts b/wake/utils/cart.ts index 973e9af98..812220e9b 100644 --- a/wake/utils/cart.ts +++ b/wake/utils/cart.ts @@ -1,4 +1,4 @@ -import { getCookies, setCookie } from "@std/http/cookie"; +import { getCookies, setCookie } from "std/http/cookie.ts"; const CART_COOKIE = "carrinho-id"; diff --git a/wake/utils/user.ts b/wake/utils/user.ts index 5cddd2782..d42420974 100644 --- a/wake/utils/user.ts +++ b/wake/utils/user.ts @@ -1,4 +1,4 @@ -import { getCookies } from "@std/http/cookie"; +import { getCookies } from "std/http/cookie.ts"; const LOGIN_COOKIE = "fbits-login"; diff --git a/wap/mod.ts b/wap/mod.ts index c5d6eaa5e..55b1a05e1 100644 --- a/wap/mod.ts +++ b/wap/mod.ts @@ -1,8 +1,8 @@ -import type { App, FnContext } from "@deco/deco"; -import { fetchSafe } from "../utils/fetch.ts"; -import { createHttpClient } from "../utils/http.ts"; +import type { App, FnContext } from "deco/mod.ts"; import manifest, { Manifest } from "./manifest.gen.ts"; +import { createHttpClient } from "../utils/http.ts"; import { OpenAPI } from "./utils/openapi/api.openapi.gen.ts"; +import { fetchSafe } from "../utils/fetch.ts"; import { PreviewContainer } from "../utils/preview.tsx"; export const color = 0xfe5000; diff --git a/wap/runtime.ts b/wap/runtime.ts index 925809704..41d65a98d 100644 --- a/wap/runtime.ts +++ b/wap/runtime.ts @@ -1,4 +1,4 @@ -import { proxy } from "@deco/deco/web"; +import { proxy } from "deco/clients/withManifest.ts"; import { Manifest } from "./manifest.gen.ts"; export const invoke = proxy(); diff --git a/wap/utils/cart.ts b/wap/utils/cart.ts index 22bff17e8..ea6f804ce 100644 --- a/wap/utils/cart.ts +++ b/wap/utils/cart.ts @@ -1,4 +1,4 @@ -import { getCookies } from "@std/http/cookie"; +import { getCookies } from "std/http/cookie.ts"; const CART_COOKIE = "PHPSESSID"; diff --git a/weather/mod.ts b/weather/mod.ts index 47f902c96..a9a724524 100644 --- a/weather/mod.ts +++ b/weather/mod.ts @@ -1,4 +1,4 @@ -import type { App, AppContext as AC } from "@deco/deco"; +import type { App, AppContext as AC } from "deco/mod.ts"; import manifest, { Manifest } from "./manifest.gen.ts"; import { PreviewContainer } from "../utils/preview.tsx"; diff --git a/website/Preview.tsx b/website/Preview.tsx index f0a49aba4..dc6b68039 100644 --- a/website/Preview.tsx +++ b/website/Preview.tsx @@ -1,6 +1,6 @@ import { renderTemplateString } from "./components/Seo.tsx"; import { default as SEOPreview } from "./components/_seo/Preview.tsx"; -import type { Props as WebsiteAppProps } from "./mod.ts"; +import { Props as WebsiteAppProps } from "./mod.ts"; interface Props { state: WebsiteAppProps; diff --git a/website/actions/secrets/encrypt.ts b/website/actions/secrets/encrypt.ts index d834798d3..0309184d1 100644 --- a/website/actions/secrets/encrypt.ts +++ b/website/actions/secrets/encrypt.ts @@ -1,4 +1,5 @@ -import { type ActionContext, allowCorsFor } from "@deco/deco"; +import { ActionContext } from "deco/types.ts"; +import { allowCorsFor } from "deco/utils/http.ts"; import { encryptToHex } from "../../utils/crypto.ts"; export interface Props { diff --git a/website/components/Analytics.tsx b/website/components/Analytics.tsx index 5da3a3818..bf48608a4 100644 --- a/website/components/Analytics.tsx +++ b/website/components/Analytics.tsx @@ -1,6 +1,6 @@ import { Head } from "$fresh/runtime.ts"; -import { context } from "@deco/deco"; -import { useScriptAsDataURI } from "@deco/deco/hooks"; +import { useScriptAsDataURI } from "deco/hooks/useScript.ts"; +import { context } from "deco/live.ts"; declare global { interface Window { diff --git a/website/components/Clickhouse.tsx b/website/components/Clickhouse.tsx index 27f58bde9..c1f3bed99 100644 --- a/website/components/Clickhouse.tsx +++ b/website/components/Clickhouse.tsx @@ -1,5 +1,5 @@ import { Head } from "$fresh/runtime.ts"; -import { useScriptAsDataURI } from "@deco/deco/hooks"; +import { useScriptAsDataURI } from "deco/hooks/useScript.ts"; import { encryptToHex } from "../utils/crypto.ts"; declare global { diff --git a/website/components/Events.tsx b/website/components/Events.tsx index ec6c3d55e..79eed1370 100644 --- a/website/components/Events.tsx +++ b/website/components/Events.tsx @@ -1,7 +1,8 @@ import { Head } from "$fresh/runtime.ts"; -import { DECO_SEGMENT, type Flag } from "@deco/deco"; -import { useScriptAsDataURI } from "@deco/deco/hooks"; -import type { AnalyticsEvent, Deco } from "../../commerce/types.ts"; +import { useScriptAsDataURI } from "deco/hooks/useScript.ts"; +import { DECO_SEGMENT } from "deco/mod.ts"; +import { Flag } from "deco/types.ts"; +import { type AnalyticsEvent, type Deco } from "../../commerce/types.ts"; type EventHandler = (event?: AnalyticsEvent) => void | Promise; diff --git a/website/components/Image.tsx b/website/components/Image.tsx index 9170ded58..ed3e63b61 100644 --- a/website/components/Image.tsx +++ b/website/components/Image.tsx @@ -1,7 +1,7 @@ import { Head, IS_BROWSER } from "$fresh/runtime.ts"; import type { JSX } from "preact"; import { forwardRef } from "preact/compat"; -import type { Manifest } from "../manifest.gen.ts"; +import { Manifest } from "../manifest.gen.ts"; export const PATH: `/live/invoke/${keyof Manifest["loaders"]}` = "/live/invoke/website/loaders/image.ts"; diff --git a/website/components/Picture.tsx b/website/components/Picture.tsx index 99a8a7e64..85d042305 100644 --- a/website/components/Picture.tsx +++ b/website/components/Picture.tsx @@ -1,7 +1,7 @@ -import { Head } from "$fresh/runtime.ts"; -import { type ComponentChildren, createContext, type JSX } from "preact"; -import { forwardRef } from "preact/compat"; import { useContext, useMemo } from "preact/hooks"; +import { forwardRef } from "preact/compat"; +import { ComponentChildren, createContext, JSX } from "preact"; +import { Head } from "$fresh/runtime.ts"; import { getSrcSet } from "./Image.tsx"; diff --git a/website/components/Seo.tsx b/website/components/Seo.tsx index ccf6f14b5..ad875a050 100644 --- a/website/components/Seo.tsx +++ b/website/components/Seo.tsx @@ -1,7 +1,7 @@ import { Head } from "$fresh/runtime.ts"; -import type { JSX } from "preact"; import type { ImageWidget } from "../../admin/widgets.ts"; import { stripHTML } from "../utils/html.ts"; +import { JSX } from "preact"; export const renderTemplateString = (template: string, value: string) => template.replace("%s", value); diff --git a/website/components/_Controls.tsx b/website/components/_Controls.tsx index 5a181912b..25c2a3f8d 100644 --- a/website/components/_Controls.tsx +++ b/website/components/_Controls.tsx @@ -1,9 +1,10 @@ import { Head } from "$fresh/runtime.ts"; -import type { Flag, Site } from "@deco/deco"; -import { context } from "@deco/deco"; -import { useScriptAsDataURI } from "@deco/deco/hooks"; -import { DomInspector, DomInspectorActivators } from "@deco/inspect-vscode"; -import type { Page } from "../../commerce/types.ts"; +import { useScriptAsDataURI } from "deco/hooks/useScript.ts"; +import { context } from "deco/live.ts"; +import type { Flag, Site } from "deco/types.ts"; +import { DomInspectorActivators } from "https://deno.land/x/inspect_vscode@0.2.1/inspector.ts"; +import { DomInspector } from "https://deno.land/x/inspect_vscode@0.2.1/mod.ts"; +import { Page } from "../../commerce/types.ts"; const IS_LOCALHOST = context.deploymentId === undefined; diff --git a/website/components/_seo/Facebook.tsx b/website/components/_seo/Facebook.tsx index ccd662df4..a560576ec 100644 --- a/website/components/_seo/Facebook.tsx +++ b/website/components/_seo/Facebook.tsx @@ -1,6 +1,6 @@ import Image from "../../components/Image.tsx"; import { Avatar, GlobeIcon, VerifiedIcon } from "./Icons.tsx"; -import type { PreviewItem, SeoProps } from "./Preview.tsx"; +import { PreviewItem, SeoProps } from "./Preview.tsx"; import { textShortner } from "./helpers/textShortner.tsx"; function FacebookBigOpenGraph(props: PreviewItem & SeoProps) { diff --git a/website/components/_seo/Google.tsx b/website/components/_seo/Google.tsx index 5fe9c68d8..3b0976470 100644 --- a/website/components/_seo/Google.tsx +++ b/website/components/_seo/Google.tsx @@ -1,4 +1,4 @@ -import type { SeoProps } from "./Preview.tsx"; +import { SeoProps } from "./Preview.tsx"; import { textShortner } from "./helpers/textShortner.tsx"; const MAX_DESCRIPTION_LENGTH = 130; diff --git a/website/components/_seo/LinkedIn.tsx b/website/components/_seo/LinkedIn.tsx index 1066521d6..d6895b8c0 100644 --- a/website/components/_seo/LinkedIn.tsx +++ b/website/components/_seo/LinkedIn.tsx @@ -1,5 +1,5 @@ import Image from "../../components/Image.tsx"; -import type { SeoProps } from "./Preview.tsx"; +import { SeoProps } from "./Preview.tsx"; import { Avatar, GlobeIcon } from "./Icons.tsx"; export default function LinkedIn(props: SeoProps) { diff --git a/website/components/_seo/Preview.tsx b/website/components/_seo/Preview.tsx index 7fe68c850..5b86dddaf 100644 --- a/website/components/_seo/Preview.tsx +++ b/website/components/_seo/Preview.tsx @@ -1,12 +1,18 @@ import { Head } from "$fresh/runtime.ts"; import type { ComponentChildren, ComponentProps } from "preact"; import { useMemo } from "preact/hooks"; -import type { ImageWidget } from "../../../admin/widgets.ts"; +import { ImageWidget } from "../../../admin/widgets.ts"; import type Seo from "../Seo.tsx"; -import type { OGType } from "../Seo.tsx"; +import { OGType } from "../Seo.tsx"; import Discord from "./Discord.tsx"; import Facebook from "./Facebook.tsx"; import Google from "./Google.tsx"; +import LinkedIn from "./LinkedIn.tsx"; +import Slack from "./Slack.tsx"; +import Telegram from "./Telegram.tsx"; +import Twitter from "./Twitter.tsx"; +import WhatsApp from "./WhatsApp.tsx"; +import instructions from "./instructions.json" with { type: "json" }; import { DiscordIcon, FacebookIcon, @@ -17,12 +23,6 @@ import { WhatsAppIcon, XIcon, } from "./Icons.tsx"; -import LinkedIn from "./LinkedIn.tsx"; -import Slack from "./Slack.tsx"; -import Telegram from "./Telegram.tsx"; -import Twitter from "./Twitter.tsx"; -import WhatsApp from "./WhatsApp.tsx"; -import instructions from "./instructions.json" with { type: "json" }; export type SeoProps = ComponentProps; diff --git a/website/components/_seo/Slack.tsx b/website/components/_seo/Slack.tsx index 1f0e08d18..00babbc2c 100644 --- a/website/components/_seo/Slack.tsx +++ b/website/components/_seo/Slack.tsx @@ -1,6 +1,6 @@ import Image from "../../components/Image.tsx"; -import type { SeoProps } from "./Preview.tsx"; -import type { PreviewItem } from "./Preview.tsx"; +import { SeoProps } from "./Preview.tsx"; +import { PreviewItem } from "./Preview.tsx"; import { textShortner } from "./helpers/textShortner.tsx"; function SlackArticle(props: PreviewItem & SeoProps) { diff --git a/website/components/_seo/Telegram.tsx b/website/components/_seo/Telegram.tsx index e7fa20801..90cf71e95 100644 --- a/website/components/_seo/Telegram.tsx +++ b/website/components/_seo/Telegram.tsx @@ -1,6 +1,6 @@ import Image from "../../components/Image.tsx"; -import type { SeoProps } from "./Preview.tsx"; -import type { PreviewItem } from "./Preview.tsx"; +import { SeoProps } from "./Preview.tsx"; +import { PreviewItem } from "./Preview.tsx"; import { textShortner } from "./helpers/textShortner.tsx"; const BACKGROUND_BASE64 = diff --git a/website/components/_seo/Twitter.tsx b/website/components/_seo/Twitter.tsx index cd41398f5..93e82d5ee 100644 --- a/website/components/_seo/Twitter.tsx +++ b/website/components/_seo/Twitter.tsx @@ -1,9 +1,9 @@ -import type { ComponentChildren } from "preact"; +import { ComponentChildren } from "preact"; import Image from "../../components/Image.tsx"; import { VerifiedIcon } from "./Icons.tsx"; import { Avatar } from "./Icons.tsx"; -import type { SeoProps } from "./Preview.tsx"; -import type { PreviewItem } from "./Preview.tsx"; +import { SeoProps } from "./Preview.tsx"; +import { PreviewItem } from "./Preview.tsx"; import { textShortner } from "./helpers/textShortner.tsx"; function CardWrapper(props: SeoProps & { children: ComponentChildren }) { diff --git a/website/components/_seo/WhatsApp.tsx b/website/components/_seo/WhatsApp.tsx index 3ac53c88a..19476c4e6 100644 --- a/website/components/_seo/WhatsApp.tsx +++ b/website/components/_seo/WhatsApp.tsx @@ -1,5 +1,5 @@ import Image from "../../components/Image.tsx"; -import type { PreviewItem, SeoProps } from "./Preview.tsx"; +import { PreviewItem, SeoProps } from "./Preview.tsx"; import { textShortner } from "./helpers/textShortner.tsx"; const BACKGROUND_BASE64 = diff --git a/website/flags/audience.ts b/website/flags/audience.ts index 11a63aa77..27f665a77 100644 --- a/website/flags/audience.ts +++ b/website/flags/audience.ts @@ -1,6 +1,9 @@ -import type { Resolvable } from "@deco/deco"; -import type { FlagObj, Handler, Matcher } from "@deco/deco/blocks"; -import { JsonViewer, metabasePreview } from "@deco/deco/utils"; +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"; /** diff --git a/website/flags/everyone.ts b/website/flags/everyone.ts index af63e4cba..72aec582a 100644 --- a/website/flags/everyone.ts +++ b/website/flags/everyone.ts @@ -1,7 +1,7 @@ -import { asResolved } from "@deco/deco"; -import type { FlagObj } from "@deco/deco/blocks"; +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 "../matchers/always.ts"; -import Audience, { type Route, type Routes } from "./audience.ts"; export interface EveryoneConfig { routes?: Routes; diff --git a/website/flags/flag.ts b/website/flags/flag.ts index 5fccff67c..0d026cc8e 100644 --- a/website/flags/flag.ts +++ b/website/flags/flag.ts @@ -1,4 +1,4 @@ -import type { FlagObj } from "@deco/deco/blocks"; +import { FlagObj } from "deco/blocks/flag.ts"; export { onBeforeResolveProps } from "./everyone.ts"; export type Props = FlagObj; diff --git a/website/flags/multivariate/image.ts b/website/flags/multivariate/image.ts index a3dbcdea8..f5d095790 100644 --- a/website/flags/multivariate/image.ts +++ b/website/flags/multivariate/image.ts @@ -1,9 +1,7 @@ export { onBeforeResolveProps } from "../../utils/multivariate.ts"; -import type { MultivariateFlag } from "@deco/deco/blocks"; -import type { ImageWidget } from "../../../admin/widgets.ts"; -import multivariate, { - type MultivariateProps, -} from "../../utils/multivariate.ts"; +import { MultivariateFlag } from "deco/blocks/flag.ts"; +import multivariate, { MultivariateProps } from "../../utils/multivariate.ts"; +import { ImageWidget } from "../../../admin/widgets.ts"; /** * @title Image Variants diff --git a/website/flags/multivariate/message.ts b/website/flags/multivariate/message.ts index 3b299a0dc..1a1bd5bc2 100644 --- a/website/flags/multivariate/message.ts +++ b/website/flags/multivariate/message.ts @@ -1,8 +1,6 @@ export { onBeforeResolveProps } from "../../utils/multivariate.ts"; -import type { MultivariateFlag } from "@deco/deco/blocks"; -import multivariate, { - type MultivariateProps, -} from "../../utils/multivariate.ts"; +import { MultivariateFlag } from "deco/blocks/flag.ts"; +import multivariate, { MultivariateProps } from "../../utils/multivariate.ts"; export type Message = string; diff --git a/website/flags/multivariate/page.ts b/website/flags/multivariate/page.ts index dd3dd9e96..c323c34ba 100644 --- a/website/flags/multivariate/page.ts +++ b/website/flags/multivariate/page.ts @@ -1,8 +1,7 @@ export { onBeforeResolveProps } from "../../utils/multivariate.ts"; -import type { MultivariateFlag, Section } from "@deco/deco/blocks"; -import multivariate, { - type MultivariateProps, -} from "../../utils/multivariate.ts"; +import { MultivariateFlag } from "deco/blocks/flag.ts"; +import { Section } from "deco/blocks/section.ts"; +import multivariate, { MultivariateProps } from "../../utils/multivariate.ts"; /** * @title Page Variants diff --git a/website/flags/multivariate/section.ts b/website/flags/multivariate/section.ts index 746bf07f8..2fc6e9924 100644 --- a/website/flags/multivariate/section.ts +++ b/website/flags/multivariate/section.ts @@ -1,8 +1,7 @@ export { onBeforeResolveProps } from "../../utils/multivariate.ts"; -import type { MultivariateFlag, Section } from "@deco/deco/blocks"; -import multivariate, { - type MultivariateProps, -} from "../../utils/multivariate.ts"; +import { MultivariateFlag } from "deco/blocks/flag.ts"; +import { Section } from "deco/blocks/section.ts"; +import multivariate, { MultivariateProps } from "../../utils/multivariate.ts"; /** * @title Section Variants diff --git a/website/functions/requestToParam.ts b/website/functions/requestToParam.ts index b2767e28b..f92c4af70 100644 --- a/website/functions/requestToParam.ts +++ b/website/functions/requestToParam.ts @@ -1,4 +1,4 @@ -import type { FunctionContext, LoaderFunction } from "@deco/deco"; +import type { FunctionContext, LoaderFunction } from "deco/types.ts"; /** @title Force param */ export type RequestURLParam = string; diff --git a/website/handlers/fresh.ts b/website/handlers/fresh.ts index c32c803e6..8a77109b7 100644 --- a/website/handlers/fresh.ts +++ b/website/handlers/fresh.ts @@ -1,17 +1,17 @@ +import { HandlerContext } from "$fresh/server.ts"; +import { Page } from "deco/blocks/page.tsx"; +import { RequestContext } from "deco/deco.ts"; import { - allowCorsFor, asResolved, - type BaseContext, - type DecoSiteState, - type DecoState, + BaseContext, isDeferred, - RequestContext, -} from "@deco/deco"; -import type { Page } from "@deco/deco/blocks"; -import { getSetCookies } from "@std/http/cookie"; +} from "deco/engine/core/resolver.ts"; +import { DecoState } from "deco/types.ts"; +import { allowCorsFor } from "deco/utils/http.ts"; +import { getSetCookies } from "std/http/cookie.ts"; import { __DECO_FBT } from "../../utils/deferred.ts"; import { errorIfFrameworkMismatch } from "../../utils/framework.tsx"; -import type { AppContext } from "../mod.ts"; +import { AppContext } from "../mod.ts"; type ConnInfo = Deno.ServeHandlerInfo; /** @@ -21,16 +21,10 @@ export interface FreshConfig { page: Page; } -export interface RenderCtx { - render: (data: unknown) => Promise; -} -export const isHandlerContext = ( - ctx: ConnInfo | RenderCtx, -): ctx is RenderCtx & { - state: TState; - params: Record; -} => { - return typeof (ctx as RenderCtx).render === "function"; +export const isFreshCtx = ( + ctx: ConnInfo | HandlerContext, +): ctx is HandlerContext => { + return typeof (ctx as HandlerContext).render === "function"; }; function abortHandler(ctrl: AbortController, signal: AbortSignal) { @@ -155,7 +149,7 @@ export default function Fresh( if (asJson !== null) { return Response.json(page, { headers: allowCorsFor(req) }); } - if (isHandlerContext(ctx)) { + if (isFreshCtx(ctx)) { const timing = appContext?.monitoring?.timings?.start?.( "render-to-string", ); @@ -172,7 +166,12 @@ export default function Fresh( const response = await renderToString({ page: appContext.flavor && page ? errorIfFrameworkMismatch(appContext.flavor?.framework, page) - : page!, + : page, + routerInfo: { + // deno-lint-ignore no-explicit-any + flags: (ctx.state as any).flags, + pagePath: ctx.state.pathTemplate, + }, }); const setCookies = getSetCookies(appContext.response.headers); if (appContext?.caching?.enabled && setCookies.length === 0) { diff --git a/website/handlers/proxy.ts b/website/handlers/proxy.ts index 739190055..c036a28d3 100644 --- a/website/handlers/proxy.ts +++ b/website/handlers/proxy.ts @@ -1,7 +1,8 @@ +import { DecoSiteState } from "deco/mod.ts"; import { proxySetCookie } from "../../utils/cookie.ts"; import { removeDirtyCookies as removeDirtyCookiesFn } from "../../utils/normalize.ts"; -import type { Script } from "../types.ts"; -import { isHandlerContext } from "./fresh.ts"; +import { Script } from "../types.ts"; +import { isFreshCtx } from "./fresh.ts"; type Handler = Deno.ServeHandler; const HOP_BY_HOP = [ @@ -122,7 +123,7 @@ export default function Proxy({ const headers = new Headers(req.headers); HOP_BY_HOP.forEach((h) => headers.delete(h)); - if (isHandlerContext(_ctx)) { + if (isFreshCtx(_ctx)) { _ctx?.state?.monitoring?.logger?.log?.("proxy received headers", headers); } removeCFHeaders(headers); // cf-headers are not ASCII-compliant @@ -130,7 +131,7 @@ export default function Proxy({ removeDirtyCookiesFn(headers); } - if (isHandlerContext(_ctx)) { + if (isFreshCtx(_ctx)) { _ctx?.state?.monitoring?.logger?.log?.("proxy sent headers", headers); } diff --git a/website/handlers/redirect.ts b/website/handlers/redirect.ts index 8d31b27f2..21ed52136 100644 --- a/website/handlers/redirect.ts +++ b/website/handlers/redirect.ts @@ -1,4 +1,4 @@ -import { isHandlerContext } from "./fresh.ts"; +import { isFreshCtx } from "./fresh.ts"; type ConnInfo = Deno.ServeHandlerInfo; export interface RedirectConfig { @@ -24,7 +24,7 @@ export default function Redirect( }; return (req: Request, conn: ConnInfo) => { - const params = isHandlerContext(conn) ? conn.params ?? {} : {}; + const params = isFreshCtx(conn) ? conn.params ?? {} : {}; /** * This allows redirects to have dynamic parameters. * diff --git a/website/handlers/router.ts b/website/handlers/router.ts index 04aa8e833..6ab3481d1 100644 --- a/website/handlers/router.ts +++ b/website/handlers/router.ts @@ -1,16 +1,16 @@ +import { weakcache } from "deco/deps.ts"; +import { ResolveOptions } from "deco/engine/core/mod.ts"; import { - type DecoState, isDeferred, - type Resolvable, - type ResolveFunc, - type ResolveOptions, - type RouteContext, -} from "@deco/deco"; -import { isAwaitable } from "@deco/deco/utils"; -import { weakcache } from "../../utils/weakcache.ts"; -import type { Route, Routes } from "../flags/audience.ts"; -import { isHandlerContext } from "../handlers/fresh.ts"; -import type { AppContext } from "../mod.ts"; + Resolvable, + ResolveFunc, +} from "deco/engine/core/resolver.ts"; +import { isAwaitable } from "deco/engine/core/utils.ts"; +import { RouteContext } from "deco/engine/manifest/manifest.ts"; +import { DecoSiteState, DecoState } from "deco/types.ts"; +import { Route, Routes } from "../flags/audience.ts"; +import { isFreshCtx } from "../handlers/fresh.ts"; +import { AppContext } from "../mod.ts"; export type ConnInfo = Deno.ServeHandlerInfo; export type Handler = Deno.ServeHandler; @@ -203,7 +203,7 @@ export default function RoutesSelection( status: 404, }); } - const monitoring = isHandlerContext(connInfo) + const monitoring = isFreshCtx(connInfo) ? connInfo.state.monitoring : undefined; diff --git a/website/handlers/sitemap.ts b/website/handlers/sitemap.ts index e0c012665..a03dd0d3d 100644 --- a/website/handlers/sitemap.ts +++ b/website/handlers/sitemap.ts @@ -1,7 +1,7 @@ -import type { Resolvable } from "@deco/deco"; -import { isResolvable } from "@deco/deco"; -import type { Handler } from "@deco/deco/blocks"; -import type { Route } from "../flags/audience.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 { Route } from "../flags/audience.ts"; const isPage = (handler: Resolvable) => isResolvable(handler) && diff --git a/website/loaders/asset.ts b/website/loaders/asset.ts index 0ab57f6e2..5a59d7bab 100644 --- a/website/loaders/asset.ts +++ b/website/loaders/asset.ts @@ -1,4 +1,4 @@ -import { shortcircuit } from "@deco/deco"; +import { shortcircuit } from "deco/engine/errors.ts"; import { fetchSafe, STALE } from "../../utils/fetch.ts"; interface Props { diff --git a/website/loaders/extension.ts b/website/loaders/extension.ts index d2a5a960f..1cdd803f4 100644 --- a/website/loaders/extension.ts +++ b/website/loaders/extension.ts @@ -1,4 +1,4 @@ -import type { PromiseOrValue } from "@deco/deco/utils"; +import { PromiseOrValue } from "deco/engine/core/utils.ts"; /** * @title The type extension. diff --git a/website/loaders/fonts/googleFonts.ts b/website/loaders/fonts/googleFonts.ts index 718df83b9..6c1593334 100644 --- a/website/loaders/fonts/googleFonts.ts +++ b/website/loaders/fonts/googleFonts.ts @@ -1,5 +1,5 @@ import { fetchSafe } from "../../../utils/fetch.ts"; -import type { Font } from "../../components/Theme.tsx"; +import { Font } from "../../components/Theme.tsx"; import type { Manifest } from "../../manifest.gen.ts"; import { hashStringSync } from "../../../utils/shortHash.ts"; diff --git a/website/loaders/fonts/local.ts b/website/loaders/fonts/local.ts index e4145c0e5..4c3c5a4b4 100644 --- a/website/loaders/fonts/local.ts +++ b/website/loaders/fonts/local.ts @@ -1,4 +1,4 @@ -import type { Font } from "../../components/Theme.tsx"; +import { Font } from "../../components/Theme.tsx"; const loader = (): Promise => { throw new Error("Not implemented"); diff --git a/website/loaders/image.ts b/website/loaders/image.ts index 1917b0ebc..748aa51ee 100644 --- a/website/loaders/image.ts +++ b/website/loaders/image.ts @@ -1,6 +1,6 @@ import { HttpError } from "../../utils/http.ts"; import { PATH } from "../components/Image.tsx"; -import type { Params as Props } from "../utils/image/engine.ts"; +import { Params as Props } from "../utils/image/engine.ts"; import { engine as cloudflare } from "../utils/image/engines/cloudflare/engine.ts"; import { engine as deco } from "../utils/image/engines/deco/engine.ts"; import { engine as passThrough } from "../utils/image/engines/passThrough/engine.ts"; diff --git a/website/loaders/options/routes.ts b/website/loaders/options/routes.ts index e5f1569bd..52620d995 100644 --- a/website/loaders/options/routes.ts +++ b/website/loaders/options/routes.ts @@ -1,5 +1,5 @@ -import { allowCorsFor } from "@deco/deco"; -import type { AppContext } from "../../mod.ts"; +import { allowCorsFor } from "deco/mod.ts"; +import { AppContext } from "../../mod.ts"; type Resolvable< T extends Record = Record, diff --git a/website/loaders/options/urlParams.ts b/website/loaders/options/urlParams.ts index 945eef591..c607c2987 100644 --- a/website/loaders/options/urlParams.ts +++ b/website/loaders/options/urlParams.ts @@ -1,5 +1,5 @@ -import { allowCorsFor } from "@deco/deco"; -import type { AppContext } from "../../mod.ts"; +import { allowCorsFor } from "deco/mod.ts"; +import { AppContext } from "../../mod.ts"; export interface Props { path: string; diff --git a/website/loaders/pages.ts b/website/loaders/pages.ts index 05ba6ccc1..44540cd8d 100644 --- a/website/loaders/pages.ts +++ b/website/loaders/pages.ts @@ -1,13 +1,14 @@ -import type { Route } from "../flags/audience.ts"; -import type { AppContext } from "../mod.ts"; -import type Page from "../pages/Page.tsx"; +import defaults from "deco/engine/manifest/defaults.ts"; +import { Route } from "../flags/audience.ts"; +import { AppContext } from "../mod.ts"; +import Page from "../pages/Page.tsx"; async function getAllPages(ctx: AppContext): Promise { const allPages = await ctx.get< Record[0]> >({ type: "pages", - __resolveType: "blockSelector", + __resolveType: defaults["blockSelector"].name, }); const routes: Route[] = []; @@ -45,7 +46,7 @@ export default async function Pages( Route[] >({ func: () => getAllPages(ctx), - __resolveType: "once", + __resolveType: defaults["once"].name, }); return allPages; diff --git a/website/loaders/redirect.ts b/website/loaders/redirect.ts index 5db937884..08b4d2172 100644 --- a/website/loaders/redirect.ts +++ b/website/loaders/redirect.ts @@ -1,4 +1,4 @@ -import type { Redirect } from "../../compat/std/loaders/x/redirects.ts"; +import { Redirect } from "../../compat/std/loaders/x/redirects.ts"; export interface Props { redirect: Redirect; diff --git a/website/loaders/redirects.ts b/website/loaders/redirects.ts index e903079f9..c18e16f97 100644 --- a/website/loaders/redirects.ts +++ b/website/loaders/redirects.ts @@ -1,6 +1,7 @@ -import type { Route } from "../flags/audience.ts"; -import type { AppContext } from "../mod.ts"; -import type { Props as RedirectProps } from "./redirect.ts"; +import defaults from "deco/engine/manifest/defaults.ts"; +import { Route } from "../flags/audience.ts"; +import { AppContext } from "../mod.ts"; +import { type Props as RedirectProps } from "./redirect.ts"; const isHref = (from: string) => from.startsWith("http") || (!from?.includes("*") && !from?.includes("/:")); @@ -8,7 +9,7 @@ const isHref = (from: string) => async function getAllRedirects(ctx: AppContext): Promise { const allRedirects = await ctx.get({ resolveType: "website/loaders/redirect.ts", - __resolveType: "resolveTypeSelector", + __resolveType: defaults["resolveTypeSelector"].name, }); const routes: Route[] = allRedirects.map(({ redirect }) => ({ @@ -37,7 +38,7 @@ export default async function Redirects( const allRedirects = await ctx.get({ key: "getAllRedirects", func: () => getAllRedirects(ctx), - __resolveType: "once", + __resolveType: defaults["once"].name, }); return allRedirects; diff --git a/website/loaders/redirectsFromCsv.ts b/website/loaders/redirectsFromCsv.ts index 88c9f7057..fe6d09028 100644 --- a/website/loaders/redirectsFromCsv.ts +++ b/website/loaders/redirectsFromCsv.ts @@ -1,5 +1,5 @@ -import { join } from "@std/path"; -import type { Route } from "../flags/audience.ts"; +import { join } from "std/path/mod.ts"; +import { Route } from "../flags/audience.ts"; const REDIRECT_TYPE_ENUM = ["temporary", "permanent"]; const CONCATENATE_PARAMS_VALUES = ["true", "false"]; @@ -11,6 +11,7 @@ export interface Redirect { type?: "temporary" | "permanent"; discardQueryParameters?: boolean; } + export interface Redirects { /** * @title The file url or path diff --git a/website/loaders/secret.ts b/website/loaders/secret.ts index cff7cf703..c0bceed1a 100644 --- a/website/loaders/secret.ts +++ b/website/loaders/secret.ts @@ -1,5 +1,5 @@ -import { Context } from "@deco/deco"; -import * as colors from "@std/fmt/colors"; +import { Context } from "deco/deco.ts"; +import * as colors from "std/fmt/colors.ts"; import { once } from "../../typesense/utils/once.ts"; import { decryptFromHex, hasLocalCryptoKey } from "../utils/crypto.ts"; /** diff --git a/website/loaders/secretString.ts b/website/loaders/secretString.ts index 2db2dca8e..c254ab30f 100644 --- a/website/loaders/secretString.ts +++ b/website/loaders/secretString.ts @@ -1,4 +1,4 @@ -import type { Secret } from "./secret.ts"; +import { Secret } from "./secret.ts"; export interface Props { secret: Secret; diff --git a/website/matchers/cookie.ts b/website/matchers/cookie.ts index 13513d4c2..f41a44db8 100644 --- a/website/matchers/cookie.ts +++ b/website/matchers/cookie.ts @@ -1,5 +1,5 @@ -import type { MatchContext } from "@deco/deco/blocks"; -import { getCookies } from "@std/http/cookie"; +import { MatchContext } from "deco/blocks/matcher.ts"; +import { getCookies } from "std/http/cookie.ts"; /** * @title Cookie diff --git a/website/matchers/cron.ts b/website/matchers/cron.ts index b2a1f7f1a..7ba2fc870 100644 --- a/website/matchers/cron.ts +++ b/website/matchers/cron.ts @@ -1,4 +1,4 @@ -import Cron from "npm:croner@6.0.3"; +import Cron from "https://deno.land/x/croner@6.0.3/dist/croner.js"; /** * @titleBy cron diff --git a/website/matchers/device.ts b/website/matchers/device.ts index 196708e67..b2d5ab0a2 100644 --- a/website/matchers/device.ts +++ b/website/matchers/device.ts @@ -1,4 +1,4 @@ -import type { MatchContext } from "@deco/deco/blocks"; +import { MatchContext } from "deco/blocks/matcher.ts"; /** * @title {{{.}}} diff --git a/website/matchers/host.ts b/website/matchers/host.ts index 4e7f45af6..7b89f73fd 100644 --- a/website/matchers/host.ts +++ b/website/matchers/host.ts @@ -1,4 +1,4 @@ -import type { MatchContext } from "@deco/deco/blocks"; +import { MatchContext } from "deco/blocks/matcher.ts"; /** * @title {{{includes}}} {{{match}}} diff --git a/website/matchers/location.ts b/website/matchers/location.ts index 5ac73f84d..66e9f25d7 100644 --- a/website/matchers/location.ts +++ b/website/matchers/location.ts @@ -1,5 +1,5 @@ -import type { MatchContext } from "@deco/deco/blocks"; -import type { MapWidget } from "../../admin/widgets.ts"; +import { MatchContext } from "deco/blocks/matcher.ts"; +import { MapWidget } from "../../admin/widgets.ts"; import { haversine } from "../utils/location.ts"; export interface Coordinate { diff --git a/website/matchers/multi.ts b/website/matchers/multi.ts index 0d9b64271..664aa0b82 100644 --- a/website/matchers/multi.ts +++ b/website/matchers/multi.ts @@ -1,4 +1,4 @@ -import type { MatchContext, Matcher } from "@deco/deco/blocks"; +import { MatchContext, Matcher } from "deco/blocks/matcher.ts"; /** * @title Combined options with {{{op}}} diff --git a/website/matchers/negate.ts b/website/matchers/negate.ts index e6114fc48..60f130185 100644 --- a/website/matchers/negate.ts +++ b/website/matchers/negate.ts @@ -1,4 +1,4 @@ -import type { MatchContext, Matcher } from "@deco/deco/blocks"; +import { MatchContext, Matcher } from "deco/blocks/matcher.ts"; export interface Props { /** diff --git a/website/matchers/pathname.ts b/website/matchers/pathname.ts index 2fbb31d9c..e2f9269f0 100644 --- a/website/matchers/pathname.ts +++ b/website/matchers/pathname.ts @@ -1,4 +1,4 @@ -import type { MatchContext } from "@deco/deco/blocks"; +import { MatchContext } from "deco/blocks/matcher.ts"; interface BaseCase { /** diff --git a/website/matchers/queryString.ts b/website/matchers/queryString.ts index f252c0566..3331ca013 100644 --- a/website/matchers/queryString.ts +++ b/website/matchers/queryString.ts @@ -1,4 +1,4 @@ -import type { MatchContext } from "@deco/deco/blocks"; +import { MatchContext } from "deco/blocks/matcher.ts"; interface BaseCase { value: string; diff --git a/website/matchers/site.ts b/website/matchers/site.ts index bee8a0b9e..7cace5f99 100644 --- a/website/matchers/site.ts +++ b/website/matchers/site.ts @@ -1,4 +1,4 @@ -import type { MatchContext } from "@deco/deco/blocks"; +import { MatchContext } from "deco/blocks/matcher.ts"; /** * @title {{{siteId}}} diff --git a/website/matchers/userAgent.ts b/website/matchers/userAgent.ts index ddc9fbdea..fdbece6c4 100644 --- a/website/matchers/userAgent.ts +++ b/website/matchers/userAgent.ts @@ -1,4 +1,4 @@ -import type { MatchContext } from "@deco/deco/blocks"; +import { MatchContext } from "deco/blocks/matcher.ts"; /** * @title {{{includes}}} {{{match}}} diff --git a/website/mod.ts b/website/mod.ts index 2e38c0a6e..8c7492d5d 100644 --- a/website/mod.ts +++ b/website/mod.ts @@ -1,13 +1,15 @@ import "./utils/unhandledRejection.ts"; -import type { App, Flag, FnContext, Site } from "@deco/deco"; -import { asResolved } from "@deco/deco"; -import type { Matcher, Page, Section } from "@deco/deco/blocks"; +import { Matcher } from "deco/blocks/matcher.ts"; +import { Page } from "deco/blocks/page.tsx"; +import { Section } from "deco/blocks/section.ts"; +import type { App, Flag, FnContext, Site } from "deco/mod.ts"; +import { asResolved } from "deco/mod.ts"; import type { Props as Seo } from "./components/Seo.tsx"; -import type { Routes } from "./flags/audience.ts"; -import type { TextReplace } from "./handlers/proxy.ts"; -import manifest, { type Manifest } from "./manifest.gen.ts"; -import type { Script } from "./types.ts"; +import { Routes } from "./flags/audience.ts"; +import { TextReplace } from "./handlers/proxy.ts"; +import manifest, { Manifest } from "./manifest.gen.ts"; +import { Script } from "./types.ts"; declare global { interface Window { diff --git a/website/pages/Page.tsx b/website/pages/Page.tsx index e5dad880b..e57c42c46 100644 --- a/website/pages/Page.tsx +++ b/website/pages/Page.tsx @@ -1,29 +1,25 @@ import { Head } from "$fresh/runtime.ts"; +import type { Page } from "deco/blocks/page.tsx"; +import { Section, SectionProps } from "deco/blocks/section.ts"; +import { ComponentFunc, ComponentMetadata } from "deco/engine/block.ts"; +import { HttpError } from "deco/engine/errors.ts"; +import { Context } from "deco/live.ts"; import { - Context, - HttpError, isDeferred, - type SectionProps, usePageContext as useDecoPageContext, useRouterContext, -} from "@deco/deco"; -import type { - ComponentFunc, - ComponentMetadata, - Page, - Section, -} from "@deco/deco/blocks"; -import { logger } from "@deco/deco/o11y"; -import { Component, type JSX } from "preact"; +} from "deco/mod.ts"; +import { logger } from "deco/observability/otel/config.ts"; +import { Component, JSX } from "preact"; import ErrorPageComponent from "../../utils/defaultErrorPage.tsx"; import Clickhouse, { generateSessionId, generateUserId, } from "../components/Clickhouse.tsx"; import Events from "../components/Events.tsx"; -import type { SEOSection } from "../components/Seo.tsx"; +import { SEOSection } from "../components/Seo.tsx"; import LiveControls from "../components/_Controls.tsx"; -import type { AppContext } from "../mod.ts"; +import { AppContext } from "../mod.ts"; const noIndexedDomains = ["decocdn.com", "deco.site", "deno.dev"]; diff --git a/website/sections/Analytics/Analytics.tsx b/website/sections/Analytics/Analytics.tsx index 6998d6fbd..a29ed329f 100644 --- a/website/sections/Analytics/Analytics.tsx +++ b/website/sections/Analytics/Analytics.tsx @@ -1,4 +1,4 @@ -import Analytics, { type Props } from "../../components/Analytics.tsx"; +import Analytics, { Props } from "../../components/Analytics.tsx"; function Section(props: Props) { return ; diff --git a/website/sections/Rendering/Deferred.tsx b/website/sections/Rendering/Deferred.tsx index ad81dd877..fb55b2d9f 100644 --- a/website/sections/Rendering/Deferred.tsx +++ b/website/sections/Rendering/Deferred.tsx @@ -1,9 +1,11 @@ -import { asResolved, isDeferred } from "@deco/deco"; -import type { Section } from "@deco/deco/blocks"; -import { usePartialSection, useScriptAsDataURI } from "@deco/deco/hooks"; +import type { Section } from "deco/blocks/section.ts"; +import { usePartialSection } from "deco/hooks/usePartialSection.ts"; +import { useScriptAsDataURI } from "deco/hooks/useScript.ts"; +import { asResolved, isDeferred } from "deco/mod.ts"; import { useId } from "preact/hooks"; +import { AppContext } from "../../mod.ts"; import { shouldForceRender } from "../../../utils/deferred.ts"; -import type { AppContext } from "../../mod.ts"; + /** @titleBy type */ export interface Scroll { type: "scroll"; diff --git a/website/sections/Rendering/Lazy.tsx b/website/sections/Rendering/Lazy.tsx index 8f779a869..ba1bbea37 100644 --- a/website/sections/Rendering/Lazy.tsx +++ b/website/sections/Rendering/Lazy.tsx @@ -1,9 +1,10 @@ -import { asResolved, context, isDeferred, RequestContext } from "@deco/deco"; +import type { Section } from "deco/blocks/section.ts"; import { - type Section, type SectionContext, - SectionCtx, -} from "@deco/deco/blocks"; + SectionContext as SectionCtx, +} from "deco/components/section.tsx"; +import { RequestContext } from "deco/deco.ts"; +import { asResolved, context, isDeferred } from "deco/mod.ts"; import { useContext } from "preact/hooks"; import { shouldForceRender } from "../../../utils/deferred.ts"; import type { AppContext } from "../../mod.ts"; diff --git a/website/sections/Seo/Seo.tsx b/website/sections/Seo/Seo.tsx index c7a442990..445c8f729 100644 --- a/website/sections/Seo/Seo.tsx +++ b/website/sections/Seo/Seo.tsx @@ -1,4 +1,4 @@ -import Seo, { type Props as SeoProps } from "../../components/Seo.tsx"; +import Seo, { Props as SeoProps } from "../../components/Seo.tsx"; type Props = Omit; diff --git a/website/sections/Seo/SeoV2.tsx b/website/sections/Seo/SeoV2.tsx index 1eb4df42f..189dae708 100644 --- a/website/sections/Seo/SeoV2.tsx +++ b/website/sections/Seo/SeoV2.tsx @@ -1,9 +1,6 @@ -import Seo, { type Props as SeoProps } from "../../components/Seo.tsx"; -import { - renderTemplateString, - type SEOSection, -} from "../../components/Seo.tsx"; -import type { AppContext } from "../../mod.ts"; +import Seo, { Props as SeoProps } from "../../components/Seo.tsx"; +import { renderTemplateString, SEOSection } from "../../components/Seo.tsx"; +import { AppContext } from "../../mod.ts"; type Props = Pick< SeoProps, diff --git a/website/utils/crypto.ts b/website/utils/crypto.ts index 02be9650a..9ec6b970d 100644 --- a/website/utils/crypto.ts +++ b/website/utils/crypto.ts @@ -1,5 +1,7 @@ -import { crypto } from "@std/crypto"; -import { encodeHex } from "@std/encoding"; +/// + +import { crypto } from "std/crypto/mod.ts"; +import { decode as decodeHex, encode as encodeHex } from "std/encoding/hex.ts"; const generateKey = async (): Promise => { return await crypto.subtle.generateKey( @@ -138,7 +140,7 @@ export const encryptToHex = async (value: string): Promise => { textEncode(value), ); const encryptedBytes = new Uint8Array(encrypted); - return encodeHex(encryptedBytes); + return textDecode(encodeHex(encryptedBytes)); }; export const decryptFromHex = async (encrypted: string) => { @@ -146,7 +148,7 @@ export const decryptFromHex = async (encrypted: string) => { const decrypted = await crypto.subtle.decrypt( { name: "AES-CBC", iv }, key, - textEncode(encrypted), + decodeHex(textEncode(encrypted)), ); const decryptedBytes = new Uint8Array(decrypted); return { decrypted: textDecode(decryptedBytes) }; diff --git a/website/utils/image/engines/wasm/engine.ts b/website/utils/image/engines/wasm/engine.ts index fa0cfa54c..dee7ac221 100644 --- a/website/utils/image/engines/wasm/engine.ts +++ b/website/utils/image/engines/wasm/engine.ts @@ -1,4 +1,4 @@ -import { parseMediaType } from "@std/media-types"; +import { parseMediaType } from "std/media_types/parse_media_type.ts"; import { HttpError } from "../../../../../utils/http.ts"; import { createPool } from "../../../../../utils/pool.ts"; import { createWorker } from "../../../../../utils/worker.ts"; diff --git a/website/utils/multivariate.ts b/website/utils/multivariate.ts index 5320f36c6..9f083de98 100644 --- a/website/utils/multivariate.ts +++ b/website/utils/multivariate.ts @@ -1,5 +1,7 @@ -import { asResolved, type HintNode } from "@deco/deco"; -import type { MultivariateFlag, Variant } from "@deco/deco/blocks"; +import { Variant } from "deco/blocks/flag.ts"; +import type { MultivariateFlag } from "deco/blocks/flag.ts"; +import { asResolved } from "deco/engine/core/resolver.ts"; +import { HintNode } from "deco/engine/core/hints.ts"; /** * @title Multivariate diff --git a/workflows/actions/start.ts b/workflows/actions/start.ts index 359a67a68..24c91e8e2 100644 --- a/workflows/actions/start.ts +++ b/workflows/actions/start.ts @@ -1,14 +1,10 @@ // deno-lint-ignore-file no-explicit-any -import { - AppManifest, - BlockFromKey, - BlockFunc, - BlockKeys, - Context, - Resolvable, -} from "@deco/deco"; -import { Workflow, WorkflowFn } from "@deco/deco/blocks"; -import { Arg, RuntimeParameters, WorkflowExecutionBase } from "@deco/durable"; +import { Workflow, WorkflowFn } from "deco/blocks/workflow.ts"; +import { Arg, RuntimeParameters, WorkflowExecutionBase } from "deco/deps.ts"; +import { BlockFromKey, BlockFunc, BlockKeys } from "deco/engine/block.ts"; +import { Resolvable } from "deco/engine/core/resolver.ts"; +import { Context } from "deco/live.ts"; +import { AppManifest } from "deco/mod.ts"; import { start } from "../initializer.ts"; // side-effect initialize import { toExecution, WorkflowExecution, WorkflowMetadata } from "../types.ts"; diff --git a/workflows/deps.ts b/workflows/deps.ts index b59b7d985..3831c1840 100644 --- a/workflows/deps.ts +++ b/workflows/deps.ts @@ -1 +1 @@ -export * from "@deco/durable"; +export * from "https://denopkg.com/deco-cx/durable@0.5.3/sdk/deno/mod.ts"; diff --git a/workflows/handlers/workflowRunner.ts b/workflows/handlers/workflowRunner.ts index 0b7b9ac27..c642980c8 100644 --- a/workflows/handlers/workflowRunner.ts +++ b/workflows/handlers/workflowRunner.ts @@ -1,17 +1,22 @@ -import { Handler, Workflow, WorkflowContext } from "@deco/deco/blocks"; -import { workflowHTTPHandler } from "@deco/durable"; - +import { HandlerContext } from "$fresh/server.ts"; +import { Handler } from "deco/blocks/handler.ts"; +import { Workflow, WorkflowContext } from "deco/blocks/workflow.ts"; +import { workflowHTTPHandler } from "deco/deps.ts"; +import { AppManifest, DecoSiteState, DecoState } from "deco/mod.ts"; export interface Config { workflow: Workflow; } export default function WorkflowHandler({ workflow }: Config): Handler { return (req: Request, conn: Deno.ServeHandlerInfo) => { - if ("state" in conn) { + const ctx = conn as unknown as HandlerContext< + unknown, + DecoState + >; + if (ctx?.state) { const handler = workflowHTTPHandler( workflow, - // deno-lint-ignore no-explicit-any - (exec) => new WorkflowContext(conn.state as any, exec), + (exec) => new WorkflowContext(ctx.state, exec), ); return handler(req, conn); } diff --git a/workflows/initializer.ts b/workflows/initializer.ts index 26a9cd945..8502f4279 100644 --- a/workflows/initializer.ts +++ b/workflows/initializer.ts @@ -1,4 +1,4 @@ -import { Context } from "@deco/deco"; +import { Context } from "deco/live.ts"; import { cancel as durableCancel, get as durableGet, diff --git a/workflows/loaders/events.ts b/workflows/loaders/events.ts index 371afadbc..f0a10bf0d 100644 --- a/workflows/loaders/events.ts +++ b/workflows/loaders/events.ts @@ -1,5 +1,5 @@ -import { StreamProps } from "@deco/deco"; -import type { HistoryEvent, Pagination } from "@deco/durable"; +import type { HistoryEvent, Pagination } from "deco/deps.ts"; +import { StreamProps } from "deco/utils/invoke.ts"; import { history } from "../initializer.ts"; // side-effect initialize export interface Props extends StreamProps { diff --git a/workflows/loaders/get.ts b/workflows/loaders/get.ts index 85b2d8029..f0ebc3069 100644 --- a/workflows/loaders/get.ts +++ b/workflows/loaders/get.ts @@ -1,4 +1,4 @@ -import { Arg } from "@deco/durable"; +import { Arg } from "deco/deps.ts"; import { get } from "../initializer.ts"; // side-effect initialize import { toExecution, WorkflowExecution, WorkflowMetadata } from "../types.ts"; export interface Props { diff --git a/workflows/mod.ts b/workflows/mod.ts index 310614331..93e665555 100644 --- a/workflows/mod.ts +++ b/workflows/mod.ts @@ -1,4 +1,4 @@ -import type { App, FnContext } from "@deco/deco"; +import type { App, FnContext } from "deco/mod.ts"; import manifest, { Manifest } from "./manifest.gen.ts"; import { PreviewContainer } from "../utils/preview.tsx"; diff --git a/workflows/utils/awaiters.ts b/workflows/utils/awaiters.ts index 10e9fcd5c..db37fbc8f 100644 --- a/workflows/utils/awaiters.ts +++ b/workflows/utils/awaiters.ts @@ -1,5 +1,5 @@ -import { WorkflowContext } from "@deco/deco/blocks"; -import { isEventStreamResponse } from "@deco/deco/web"; +import { type WorkflowContext } from "deco/mod.ts"; +import { isEventStreamResponse } from "deco/utils/invoke.ts"; import { type AppManifest } from "../mod.ts"; export const waitForWorkflowCompletion = (