cloudcommerce 0.22.0 → 0.22.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (182) hide show
  1. package/.editorconfig +13 -0
  2. package/.gitmodules +3 -0
  3. package/.vscode/settings.json +2 -1
  4. package/CHANGELOG.md +28 -0
  5. package/ecomplus-stores/barra-doce/.devcontainer/devcontainer.json +30 -0
  6. package/ecomplus-stores/barra-doce/.editorconfig +13 -0
  7. package/ecomplus-stores/barra-doce/.eslintrc.cjs +3 -0
  8. package/ecomplus-stores/barra-doce/.firebaserc +5 -0
  9. package/ecomplus-stores/barra-doce/.github/build-and-deploy +1 -0
  10. package/ecomplus-stores/barra-doce/.github/renovate.json +5 -0
  11. package/ecomplus-stores/barra-doce/.github/workflows/build-and-deploy.yml +36 -0
  12. package/ecomplus-stores/barra-doce/.github/workflows/calibreapp-image-actions.yml +23 -0
  13. package/ecomplus-stores/barra-doce/.gitpod.yml +12 -0
  14. package/ecomplus-stores/barra-doce/.nvmrc +1 -0
  15. package/ecomplus-stores/barra-doce/.vscode/extensions.json +8 -0
  16. package/ecomplus-stores/barra-doce/.vscode/launch.json +11 -0
  17. package/ecomplus-stores/barra-doce/.vscode/settings.json +10 -0
  18. package/ecomplus-stores/barra-doce/LICENSE.md +230 -0
  19. package/ecomplus-stores/barra-doce/README.md +31 -0
  20. package/ecomplus-stores/barra-doce/SETUP.md +117 -0
  21. package/ecomplus-stores/{iluminim/README.pt-BR.md → barra-doce/SETUP.pt-BR.md} +5 -1
  22. package/ecomplus-stores/barra-doce/functions/config.json +3 -0
  23. package/ecomplus-stores/barra-doce/functions/example.env +10 -0
  24. package/ecomplus-stores/barra-doce/functions/many/index.js +14 -0
  25. package/ecomplus-stores/barra-doce/functions/many/package.json +22 -0
  26. package/ecomplus-stores/barra-doce/functions/ssr/.eslintrc.cjs +6 -0
  27. package/ecomplus-stores/barra-doce/functions/ssr/astro.config.mjs +4 -0
  28. package/ecomplus-stores/barra-doce/functions/ssr/content/blog/.gitkeep +0 -0
  29. package/ecomplus-stores/barra-doce/functions/ssr/content/extra-pages/.gitkeep +0 -0
  30. package/ecomplus-stores/barra-doce/functions/ssr/content/layout.json +37 -0
  31. package/ecomplus-stores/barra-doce/functions/ssr/content/pages/home.json +33 -0
  32. package/ecomplus-stores/barra-doce/functions/ssr/content/settings.json +48 -0
  33. package/ecomplus-stores/barra-doce/functions/ssr/index.js +18 -0
  34. package/ecomplus-stores/barra-doce/functions/ssr/package.json +31 -0
  35. package/ecomplus-stores/barra-doce/functions/ssr/public/admin/.gitkeep +2 -0
  36. package/ecomplus-stores/barra-doce/functions/ssr/public/assets/.gitkeep +2 -0
  37. package/ecomplus-stores/barra-doce/functions/ssr/public/img/icon.png +0 -0
  38. package/ecomplus-stores/barra-doce/functions/ssr/public/img/large-icon.png +0 -0
  39. package/ecomplus-stores/barra-doce/functions/ssr/public/img/uploads/banner-forma-decora.jpg +0 -0
  40. package/ecomplus-stores/barra-doce/functions/ssr/public/img/uploads/banner2.webp +0 -0
  41. package/ecomplus-stores/barra-doce/functions/ssr/public/img/uploads/ecom-icon.png +0 -0
  42. package/ecomplus-stores/barra-doce/functions/ssr/public/img/uploads/headphone.webp +0 -0
  43. package/ecomplus-stores/barra-doce/functions/ssr/public/img/uploads/logo-barradoce.webp +0 -0
  44. package/ecomplus-stores/barra-doce/functions/ssr/public/img/uploads/logo.png +0 -0
  45. package/ecomplus-stores/barra-doce/functions/ssr/public/img/uploads/og-image.png +0 -0
  46. package/ecomplus-stores/barra-doce/functions/ssr/public/img/uploads/passion.webp +0 -0
  47. package/ecomplus-stores/barra-doce/functions/ssr/public/img/uploads/rect8589.png +0 -0
  48. package/ecomplus-stores/barra-doce/functions/ssr/public/img/uploads/rect859.png +0 -0
  49. package/ecomplus-stores/barra-doce/functions/ssr/public/img/uploads/rect89.webp +0 -0
  50. package/ecomplus-stores/barra-doce/functions/ssr/public/robots.txt +8 -0
  51. package/ecomplus-stores/barra-doce/functions/ssr/scripts/build.sh +14 -0
  52. package/ecomplus-stores/barra-doce/functions/ssr/src/assets/style.css +65 -0
  53. package/ecomplus-stores/barra-doce/functions/ssr/src/components/AccountMenu.vue +104 -0
  54. package/ecomplus-stores/barra-doce/functions/ssr/src/components/Banner.vue +64 -0
  55. package/ecomplus-stores/barra-doce/functions/ssr/src/components/BannersGrid.astro +25 -0
  56. package/ecomplus-stores/barra-doce/functions/ssr/src/components/CartSidebar.vue +35 -0
  57. package/ecomplus-stores/barra-doce/functions/ssr/src/components/HeroSlider.vue +51 -0
  58. package/ecomplus-stores/barra-doce/functions/ssr/src/components/PitchBar.vue +53 -0
  59. package/ecomplus-stores/barra-doce/functions/ssr/src/components/Prices.vue +96 -0
  60. package/ecomplus-stores/barra-doce/functions/ssr/src/components/ProductCard.vue +117 -0
  61. package/ecomplus-stores/barra-doce/functions/ssr/src/components/ProductShelf.vue +60 -0
  62. package/ecomplus-stores/barra-doce/functions/ssr/src/components/SearchModal.vue +6 -0
  63. package/ecomplus-stores/barra-doce/functions/ssr/src/components/ShopHeader.vue +136 -0
  64. package/ecomplus-stores/barra-doce/functions/ssr/src/components/ShopHeaderMenu.vue +58 -0
  65. package/ecomplus-stores/barra-doce/functions/ssr/src/components/ShopHeaderSubmenu.vue +88 -0
  66. package/ecomplus-stores/barra-doce/functions/ssr/src/components/ShopSidenav.vue +61 -0
  67. package/ecomplus-stores/barra-doce/functions/ssr/src/components/ShopSidenavCategory.vue +80 -0
  68. package/ecomplus-stores/barra-doce/functions/ssr/src/env.d.ts +13 -0
  69. package/ecomplus-stores/barra-doce/functions/ssr/src/layouts/Base.astro +15 -0
  70. package/ecomplus-stores/barra-doce/functions/ssr/src/layouts/Checkout.astro +0 -0
  71. package/ecomplus-stores/barra-doce/functions/ssr/src/layouts/PageHeader.astro +38 -0
  72. package/ecomplus-stores/barra-doce/functions/ssr/src/main/Fallback.astro +10 -0
  73. package/ecomplus-stores/barra-doce/functions/ssr/src/main/Home.astro +29 -0
  74. package/ecomplus-stores/barra-doce/functions/ssr/src/main/Sections.astro +29 -0
  75. package/ecomplus-stores/barra-doce/functions/ssr/src/main/Wildcard.astro +18 -0
  76. package/ecomplus-stores/barra-doce/functions/ssr/src/pages/[...slug].astro +40 -0
  77. package/ecomplus-stores/barra-doce/functions/ssr/src/pages/_vue.ts +3 -0
  78. package/ecomplus-stores/barra-doce/functions/ssr/src/pages/app/account.astro +0 -0
  79. package/ecomplus-stores/barra-doce/functions/ssr/src/pages/app/index.astro +0 -0
  80. package/ecomplus-stores/barra-doce/functions/ssr/src/pages/fallback.astro +25 -0
  81. package/ecomplus-stores/barra-doce/functions/ssr/src/pages/index.astro +35 -0
  82. package/ecomplus-stores/barra-doce/functions/ssr/src/scripts/InlineScripts.astro +10 -0
  83. package/ecomplus-stores/barra-doce/functions/ssr/tailwind.config.cjs +19 -0
  84. package/ecomplus-stores/barra-doce/functions/ssr/tsconfig.json +12 -0
  85. package/ecomplus-stores/barra-doce/functions/ssr/uno.config.cjs +5 -0
  86. package/ecomplus-stores/barra-doce/functions/with-apps/index.js +12 -0
  87. package/ecomplus-stores/barra-doce/functions/with-apps/package.json +22 -0
  88. package/ecomplus-stores/barra-doce/package.json +28 -0
  89. package/ecomplus-stores/barra-doce/scripts/install.sh +14 -0
  90. package/ecomplus-stores/iluminim/.editorconfig +13 -0
  91. package/ecomplus-stores/iluminim/README.md +11 -93
  92. package/ecomplus-stores/iluminim/SETUP.md +117 -0
  93. package/ecomplus-stores/iluminim/SETUP.pt-BR.md +117 -0
  94. package/ecomplus-stores/iluminim/functions/many/package.json +3 -3
  95. package/ecomplus-stores/iluminim/functions/ssr/package.json +6 -6
  96. package/ecomplus-stores/iluminim/functions/ssr/src/components/ShopHeaderSubmenu.vue +1 -1
  97. package/ecomplus-stores/iluminim/functions/ssr/src/components/ShopSidenav.vue +2 -2
  98. package/ecomplus-stores/iluminim/functions/ssr/src/components/ShopSidenavCategory.vue +4 -2
  99. package/ecomplus-stores/iluminim/functions/ssr/src/layouts/PageHeader.astro +6 -1
  100. package/ecomplus-stores/iluminim/functions/with-apps/package.json +3 -3
  101. package/ecomplus-stores/iluminim/package.json +1 -1
  102. package/package.json +6 -6
  103. package/packages/api/package.json +1 -1
  104. package/packages/apps/affilate-program/package.json +1 -1
  105. package/packages/apps/correios/package.json +1 -1
  106. package/packages/apps/custom-payment/package.json +1 -1
  107. package/packages/apps/custom-shipping/package.json +1 -1
  108. package/packages/apps/datafrete/package.json +1 -1
  109. package/packages/apps/discounts/package.json +1 -1
  110. package/packages/apps/emails/package.json +1 -1
  111. package/packages/apps/fb-conversions/package.json +2 -2
  112. package/packages/apps/flash-courier/package.json +1 -1
  113. package/packages/apps/frenet/package.json +1 -1
  114. package/packages/apps/galaxpay/package.json +1 -1
  115. package/packages/apps/google-analytics/package.json +1 -1
  116. package/packages/apps/jadlog/package.json +1 -1
  117. package/packages/apps/loyalty-points/package.json +1 -1
  118. package/packages/apps/melhor-envio/package.json +1 -1
  119. package/packages/apps/mercadopago/package.json +1 -1
  120. package/packages/apps/pagarme/package.json +1 -1
  121. package/packages/apps/paghiper/package.json +1 -1
  122. package/packages/apps/pix/package.json +1 -1
  123. package/packages/apps/tiny-erp/package.json +1 -1
  124. package/packages/apps/webhooks/package.json +1 -1
  125. package/packages/cli/lib/build.js +15 -4
  126. package/packages/cli/lib/cli.js +3 -3
  127. package/packages/cli/package.json +1 -1
  128. package/packages/cli/src/build.ts +17 -4
  129. package/packages/cli/src/cli.ts +3 -3
  130. package/packages/config/package.json +1 -1
  131. package/packages/emails/package.json +1 -1
  132. package/packages/events/package.json +1 -1
  133. package/packages/feeds/package.json +1 -1
  134. package/packages/firebase/package.json +1 -1
  135. package/packages/i18n/lib/dirname.js +3 -1
  136. package/packages/i18n/lib/dirname.js.map +1 -1
  137. package/packages/i18n/package.json +1 -1
  138. package/packages/i18n/scripts/build-txt.mjs +2 -1
  139. package/packages/i18n/src/dirname.ts +3 -1
  140. package/packages/modules/package.json +1 -1
  141. package/packages/passport/package.json +1 -1
  142. package/packages/ssr/package.json +2 -2
  143. package/packages/storefront/astro.config.mjs +2 -1
  144. package/packages/storefront/dist/client/_astro/HeroSlider.cea1f361.js +1 -0
  145. package/packages/storefront/dist/client/_astro/{ProductShelf.9e290480.js → ProductShelf.35614736.js} +1 -1
  146. package/packages/storefront/dist/client/_astro/ShopHeader.dbe9c1f1.js +4 -0
  147. package/packages/storefront/dist/client/_astro/{_...slug_.c85b8978.css → _...slug_.c13e0486.css} +1 -1
  148. package/packages/storefront/dist/client/assets/.gitkeep +2 -0
  149. package/packages/storefront/dist/client/sw.js +1 -1
  150. package/packages/storefront/dist/server/chunks/{_...7e1df40a.mjs → _...fac94758.mjs} +3 -3
  151. package/packages/storefront/dist/server/chunks/{account@_@astro.5f1dba7a.mjs → account@_@astro.460623ee.mjs} +3 -3
  152. package/packages/storefront/dist/server/chunks/{astro.2d3ebf0f.mjs → astro.e0968ba7.mjs} +201 -156
  153. package/packages/storefront/dist/server/chunks/{endpoint@_@js.80de0568.mjs → endpoint@_@js.35380ea5.mjs} +3 -3
  154. package/packages/storefront/dist/server/chunks/{fallback@_@astro.02a45b47.mjs → fallback@_@astro.dbc26d2d.mjs} +3 -3
  155. package/packages/storefront/dist/server/chunks/{index@_@astro.7cb07e52.mjs → index@_@astro.c91e679e.mjs} +3 -3
  156. package/packages/storefront/dist/server/chunks/{index@_@astro.23b50301.mjs → index@_@astro.fec107b9.mjs} +3 -3
  157. package/packages/storefront/dist/server/chunks/pages/{_...slug_.astro.4358f614.mjs → _...slug_.astro.2e2d4770.mjs} +81 -39
  158. package/packages/storefront/dist/server/chunks/pages/{account.astro.afae5a12.mjs → account.astro.0003ca94.mjs} +1 -1
  159. package/packages/storefront/dist/server/chunks/pages/{endpoint.js.60fd21aa.mjs → endpoint.js.6f0f4ede.mjs} +1 -1
  160. package/packages/storefront/dist/server/chunks/pages/{fallback.astro.e5566925.mjs → fallback.astro.fc8bc7e7.mjs} +2 -2
  161. package/packages/storefront/dist/server/chunks/pages/{index.astro.5bc6b9d8.mjs → index.astro.03adcc55.mjs} +6 -6
  162. package/packages/storefront/dist/server/entry.mjs +9 -9
  163. package/packages/storefront/dist/server/renderers.mjs +2 -2
  164. package/packages/storefront/package.json +5 -5
  165. package/packages/storefront/src/lib/$storefront.d.ts +1 -0
  166. package/packages/storefront/src/lib/components/SharedData.astro +13 -0
  167. package/packages/storefront/src/lib/composables/use-prices.ts +1 -1
  168. package/packages/storefront/src/lib/composables/use-shop-header-submenu.ts +10 -1
  169. package/packages/storefront/src/lib/composables/use-shop-header.ts +13 -13
  170. package/packages/storefront/src/lib/layouts/BaseHead.astro +1 -1
  171. package/packages/storefront/src/lib/layouts/use-page-header.ts +14 -2
  172. package/packages/storefront/src/lib/ssr-context.ts +1 -0
  173. package/packages/types/package.json +1 -1
  174. package/pnpm-workspace.yaml +2 -0
  175. package/packages/storefront/dist/client/_astro/HeroSlider.0890631f.js +0 -1
  176. package/packages/storefront/dist/client/_astro/ShopHeader.82ae97a5.js +0 -4
  177. package/packages/storefront/dist/client/assets/cms-preview.css +0 -274
  178. package/packages/storefront/dist/client/assets/cms.css +0 -114
  179. package/packages/storefront/dist/client/assets/cvv.png +0 -0
  180. package/packages/storefront/dist/client/assets/img-placeholder.png +0 -0
  181. package/packages/storefront/dist/client/assets/payments.png +0 -0
  182. package/packages/storefront/dist/client/assets/ssl-safe.png +0 -0
@@ -1145,7 +1145,7 @@ function createComponent(arg1, moduleId, propagation) {
1145
1145
  }
1146
1146
  }
1147
1147
 
1148
- const ASTRO_VERSION = "2.9.0";
1148
+ const ASTRO_VERSION = "2.9.2";
1149
1149
 
1150
1150
  function createAstroGlobFn() {
1151
1151
  const globHandler = (importMetaGlobResult) => {
@@ -1612,16 +1612,84 @@ function* maybeRenderHead() {
1612
1612
  yield { type: "maybe-head" };
1613
1613
  }
1614
1614
 
1615
+ function isAstroComponentFactory(obj) {
1616
+ return obj == null ? false : obj.isAstroComponentFactory === true;
1617
+ }
1618
+ function isAPropagatingComponent(result, factory) {
1619
+ let hint = factory.propagation || "none";
1620
+ if (factory.moduleId && result.componentMetadata.has(factory.moduleId) && hint === "none") {
1621
+ hint = result.componentMetadata.get(factory.moduleId).propagation;
1622
+ }
1623
+ return hint === "in-tree" || hint === "self";
1624
+ }
1625
+
1615
1626
  const headAndContentSym = Symbol.for("astro.headAndContent");
1616
1627
  function isHeadAndContent(obj) {
1617
1628
  return typeof obj === "object" && !!obj[headAndContentSym];
1618
1629
  }
1619
1630
 
1620
1631
  var _a$1;
1632
+ const astroComponentInstanceSym = Symbol.for("astro.componentInstance");
1633
+ class AstroComponentInstance {
1634
+ constructor(result, props, slots, factory) {
1635
+ this[_a$1] = true;
1636
+ this.result = result;
1637
+ this.props = props;
1638
+ this.factory = factory;
1639
+ this.slotValues = {};
1640
+ for (const name in slots) {
1641
+ const value = slots[name](result);
1642
+ this.slotValues[name] = () => value;
1643
+ }
1644
+ }
1645
+ async init(result) {
1646
+ this.returnValue = this.factory(result, this.props, this.slotValues);
1647
+ return this.returnValue;
1648
+ }
1649
+ async *render() {
1650
+ if (this.returnValue === void 0) {
1651
+ await this.init(this.result);
1652
+ }
1653
+ let value = this.returnValue;
1654
+ if (isPromise(value)) {
1655
+ value = await value;
1656
+ }
1657
+ if (isHeadAndContent(value)) {
1658
+ yield* value.content;
1659
+ } else {
1660
+ yield* renderChild(value);
1661
+ }
1662
+ }
1663
+ }
1664
+ _a$1 = astroComponentInstanceSym;
1665
+ function validateComponentProps(props, displayName) {
1666
+ if (props != null) {
1667
+ for (const prop of Object.keys(props)) {
1668
+ if (prop.startsWith("client:")) {
1669
+ console.warn(
1670
+ `You are attempting to render <${displayName} ${prop} />, but ${displayName} is an Astro component. Astro components do not render in the client and should not have a hydration directive. Please use a framework component for client rendering.`
1671
+ );
1672
+ }
1673
+ }
1674
+ }
1675
+ }
1676
+ function createAstroComponentInstance(result, displayName, factory, props, slots = {}) {
1677
+ validateComponentProps(props, displayName);
1678
+ const instance = new AstroComponentInstance(result, props, slots, factory);
1679
+ if (isAPropagatingComponent(result, factory) && !result._metadata.propagators.has(factory)) {
1680
+ result._metadata.propagators.set(factory, instance);
1681
+ }
1682
+ return instance;
1683
+ }
1684
+ function isAstroComponentInstance(obj) {
1685
+ return typeof obj === "object" && !!obj[astroComponentInstanceSym];
1686
+ }
1687
+
1688
+ var _a;
1621
1689
  const renderTemplateResultSym = Symbol.for("astro.renderTemplateResult");
1622
1690
  class RenderTemplateResult {
1623
1691
  constructor(htmlParts, expressions) {
1624
- this[_a$1] = true;
1692
+ this[_a] = true;
1625
1693
  this.htmlParts = htmlParts;
1626
1694
  this.error = void 0;
1627
1695
  this.expressions = expressions.map((expression) => {
@@ -1636,7 +1704,7 @@ class RenderTemplateResult {
1636
1704
  return expression;
1637
1705
  });
1638
1706
  }
1639
- async *[(_a$1 = renderTemplateResultSym, Symbol.asyncIterator)]() {
1707
+ async *[(_a = renderTemplateResultSym, Symbol.asyncIterator)]() {
1640
1708
  const { htmlParts, expressions } = this;
1641
1709
  let iterables = bufferIterators(expressions.map((e) => renderChild(e)));
1642
1710
  for (let i = 0; i < htmlParts.length; i++) {
@@ -1674,85 +1742,116 @@ function renderTemplate(htmlParts, ...expressions) {
1674
1742
  return new RenderTemplateResult(htmlParts, expressions);
1675
1743
  }
1676
1744
 
1677
- function isAstroComponentFactory(obj) {
1678
- return obj == null ? false : obj.isAstroComponentFactory === true;
1679
- }
1680
- async function renderToString(result, componentFactory, props, children) {
1681
- const factoryResult = await componentFactory(result, props, children);
1682
- if (factoryResult instanceof Response) {
1683
- const response = factoryResult;
1684
- throw response;
1685
- }
1686
- let parts = new HTMLParts();
1687
- const templateResult = isHeadAndContent(factoryResult) ? factoryResult.content : factoryResult;
1745
+ async function renderToString(result, componentFactory, props, children, isPage = false, route) {
1746
+ const templateResult = await callComponentAsTemplateResultOrResponse(
1747
+ result,
1748
+ componentFactory,
1749
+ props,
1750
+ children,
1751
+ route
1752
+ );
1753
+ if (templateResult instanceof Response)
1754
+ return templateResult;
1755
+ let str = "";
1756
+ let renderedFirstPageChunk = false;
1757
+ const destination = {
1758
+ write(chunk) {
1759
+ if (isPage && !renderedFirstPageChunk) {
1760
+ renderedFirstPageChunk = true;
1761
+ if (!/<!doctype html/i.test(String(chunk))) {
1762
+ const doctype = result.compressHTML ? "<!DOCTYPE html>" : "<!DOCTYPE html>\n";
1763
+ str += doctype;
1764
+ }
1765
+ }
1766
+ if (chunk instanceof Response)
1767
+ return;
1768
+ str += chunkToString(result, chunk);
1769
+ }
1770
+ };
1688
1771
  for await (const chunk of renderAstroTemplateResult(templateResult)) {
1689
- parts.append(chunk, result);
1772
+ destination.write(chunk);
1690
1773
  }
1691
- return parts.toString();
1774
+ return str;
1692
1775
  }
1693
- function isAPropagatingComponent(result, factory) {
1694
- let hint = factory.propagation || "none";
1695
- if (factory.moduleId && result.componentMetadata.has(factory.moduleId) && hint === "none") {
1696
- hint = result.componentMetadata.get(factory.moduleId).propagation;
1697
- }
1698
- return hint === "in-tree" || hint === "self";
1699
- }
1700
-
1701
- var _a;
1702
- const astroComponentInstanceSym = Symbol.for("astro.componentInstance");
1703
- class AstroComponentInstance {
1704
- constructor(result, props, slots, factory) {
1705
- this[_a] = true;
1706
- this.result = result;
1707
- this.props = props;
1708
- this.factory = factory;
1709
- this.slotValues = {};
1710
- for (const name in slots) {
1711
- const value = slots[name](result);
1712
- this.slotValues[name] = () => value;
1713
- }
1714
- }
1715
- async init(result) {
1716
- this.returnValue = this.factory(result, this.props, this.slotValues);
1717
- return this.returnValue;
1776
+ async function renderToReadableStream(result, componentFactory, props, children, isPage = false, route) {
1777
+ const templateResult = await callComponentAsTemplateResultOrResponse(
1778
+ result,
1779
+ componentFactory,
1780
+ props,
1781
+ children,
1782
+ route
1783
+ );
1784
+ if (templateResult instanceof Response)
1785
+ return templateResult;
1786
+ if (isPage) {
1787
+ await bufferHeadContent(result);
1718
1788
  }
1719
- async *render() {
1720
- if (this.returnValue === void 0) {
1721
- await this.init(this.result);
1722
- }
1723
- let value = this.returnValue;
1724
- if (isPromise(value)) {
1725
- value = await value;
1726
- }
1727
- if (isHeadAndContent(value)) {
1728
- yield* value.content;
1729
- } else {
1730
- yield* renderChild(value);
1789
+ let renderedFirstPageChunk = false;
1790
+ return new ReadableStream({
1791
+ start(controller) {
1792
+ const destination = {
1793
+ write(chunk) {
1794
+ if (isPage && !renderedFirstPageChunk) {
1795
+ renderedFirstPageChunk = true;
1796
+ if (!/<!doctype html/i.test(String(chunk))) {
1797
+ const doctype = result.compressHTML ? "<!DOCTYPE html>" : "<!DOCTYPE html>\n";
1798
+ controller.enqueue(encoder.encode(doctype));
1799
+ }
1800
+ }
1801
+ if (chunk instanceof Response) {
1802
+ throw new AstroError({
1803
+ ...AstroErrorData.ResponseSentError
1804
+ });
1805
+ }
1806
+ const bytes = chunkToByteArray(result, chunk);
1807
+ controller.enqueue(bytes);
1808
+ }
1809
+ };
1810
+ (async () => {
1811
+ try {
1812
+ for await (const chunk of renderAstroTemplateResult(templateResult)) {
1813
+ destination.write(chunk);
1814
+ }
1815
+ controller.close();
1816
+ } catch (e) {
1817
+ if (AstroError.is(e) && !e.loc) {
1818
+ e.setLocation({
1819
+ file: route == null ? void 0 : route.component
1820
+ });
1821
+ }
1822
+ controller.error(e);
1823
+ }
1824
+ })();
1731
1825
  }
1732
- }
1826
+ });
1733
1827
  }
1734
- _a = astroComponentInstanceSym;
1735
- function validateComponentProps(props, displayName) {
1736
- if (props != null) {
1737
- for (const prop of Object.keys(props)) {
1738
- if (prop.startsWith("client:")) {
1739
- console.warn(
1740
- `You are attempting to render <${displayName} ${prop} />, but ${displayName} is an Astro component. Astro components do not render in the client and should not have a hydration directive. Please use a framework component for client rendering.`
1741
- );
1828
+ async function callComponentAsTemplateResultOrResponse(result, componentFactory, props, children, route) {
1829
+ const factoryResult = await componentFactory(result, props, children);
1830
+ if (factoryResult instanceof Response) {
1831
+ return factoryResult;
1832
+ } else if (!isRenderTemplateResult(factoryResult)) {
1833
+ throw new AstroError({
1834
+ ...AstroErrorData.OnlyResponseCanBeReturned,
1835
+ message: AstroErrorData.OnlyResponseCanBeReturned.message(route == null ? void 0 : route.route, typeof factoryResult),
1836
+ location: {
1837
+ file: route == null ? void 0 : route.component
1742
1838
  }
1743
- }
1839
+ });
1744
1840
  }
1841
+ return isHeadAndContent(factoryResult) ? factoryResult.content : factoryResult;
1745
1842
  }
1746
- function createAstroComponentInstance(result, displayName, factory, props, slots = {}) {
1747
- validateComponentProps(props, displayName);
1748
- const instance = new AstroComponentInstance(result, props, slots, factory);
1749
- if (isAPropagatingComponent(result, factory) && !result._metadata.propagators.has(factory)) {
1750
- result._metadata.propagators.set(factory, instance);
1843
+ async function bufferHeadContent(result) {
1844
+ const iterator = result._metadata.propagators.values();
1845
+ while (true) {
1846
+ const { value, done } = iterator.next();
1847
+ if (done) {
1848
+ break;
1849
+ }
1850
+ const returnValue = await value.init(result);
1851
+ if (isHeadAndContent(returnValue)) {
1852
+ result._metadata.extraHead.push(returnValue.head);
1853
+ }
1751
1854
  }
1752
- return instance;
1753
- }
1754
- function isAstroComponentInstance(obj) {
1755
- return typeof obj === "object" && !!obj[astroComponentInstanceSym];
1756
1855
  }
1757
1856
 
1758
1857
  async function* renderChild(child) {
@@ -1915,12 +2014,20 @@ class HTMLParts {
1915
2014
  return encoder.encode(this.parts);
1916
2015
  }
1917
2016
  }
2017
+ function chunkToString(result, chunk) {
2018
+ if (ArrayBuffer.isView(chunk)) {
2019
+ return decoder.decode(chunk);
2020
+ } else {
2021
+ return stringifyChunk(result, chunk);
2022
+ }
2023
+ }
1918
2024
  function chunkToByteArray(result, chunk) {
1919
- if (chunk instanceof Uint8Array) {
2025
+ if (ArrayBuffer.isView(chunk)) {
1920
2026
  return chunk;
2027
+ } else {
2028
+ const stringified = stringifyChunk(result, chunk);
2029
+ return encoder.encode(stringified.toString());
1921
2030
  }
1922
- let stringified = stringifyChunk(result, chunk);
1923
- return encoder.encode(stringified.toString());
1924
2031
  }
1925
2032
 
1926
2033
  const ClientOnlyPlaceholder = "astro-client-only";
@@ -1991,7 +2098,11 @@ Did you forget to import the component or is it possible there is a typo?`);
1991
2098
  props[key] = value;
1992
2099
  }
1993
2100
  }
1994
- const html = markHTMLString(await renderToString(result, vnode.type, props, slots));
2101
+ const str = await renderToString(result, vnode.type, props, slots);
2102
+ if (str instanceof Response) {
2103
+ throw str;
2104
+ }
2105
+ const html = markHTMLString(str);
1995
2106
  return html;
1996
2107
  }
1997
2108
  case (!vnode.type && vnode.type !== 0):
@@ -2806,19 +2917,6 @@ async function iterableToHTMLBytes(result, iterable, onDocTypeInjection) {
2806
2917
  }
2807
2918
  return parts.toArrayBuffer();
2808
2919
  }
2809
- async function bufferHeadContent(result) {
2810
- const iterator = result._metadata.propagators.values();
2811
- while (true) {
2812
- const { value, done } = iterator.next();
2813
- if (done) {
2814
- break;
2815
- }
2816
- const returnValue = await value.init(result);
2817
- if (isHeadAndContent(returnValue)) {
2818
- result._metadata.extraHead.push(returnValue.head);
2819
- }
2820
- }
2821
- }
2822
2920
  async function renderPage$1(result, componentFactory, props, children, streaming, route) {
2823
2921
  var _a, _b;
2824
2922
  if (!isAstroComponentFactory(componentFactory)) {
@@ -2865,75 +2963,22 @@ async function renderPage$1(result, componentFactory, props, children, streaming
2865
2963
  });
2866
2964
  }
2867
2965
  result._metadata.headInTree = ((_b = result.componentMetadata.get(componentFactory.moduleId)) == null ? void 0 : _b.containsHead) ?? false;
2868
- const factoryReturnValue = await componentFactory(result, props, children);
2869
- const factoryIsHeadAndContent = isHeadAndContent(factoryReturnValue);
2870
- if (isRenderTemplateResult(factoryReturnValue) || factoryIsHeadAndContent) {
2871
- await bufferHeadContent(result);
2872
- const templateResult = factoryIsHeadAndContent ? factoryReturnValue.content : factoryReturnValue;
2873
- let iterable = renderAstroTemplateResult(templateResult);
2874
- let init = result.response;
2875
- let headers = new Headers(init.headers);
2876
- let body;
2877
- if (streaming) {
2878
- body = new ReadableStream({
2879
- start(controller) {
2880
- async function read() {
2881
- let i = 0;
2882
- try {
2883
- for await (const chunk of iterable) {
2884
- if (isHTMLString(chunk)) {
2885
- if (i === 0) {
2886
- if (!/<!doctype html/i.test(String(chunk))) {
2887
- controller.enqueue(
2888
- encoder.encode(
2889
- `${result.compressHTML ? "<!DOCTYPE html>" : "<!DOCTYPE html>\n"}`
2890
- )
2891
- );
2892
- }
2893
- }
2894
- }
2895
- if (chunk instanceof Response) {
2896
- throw new AstroError({
2897
- ...AstroErrorData.ResponseSentError
2898
- });
2899
- }
2900
- const bytes = chunkToByteArray(result, chunk);
2901
- controller.enqueue(bytes);
2902
- i++;
2903
- }
2904
- controller.close();
2905
- } catch (e) {
2906
- if (AstroError.is(e) && !e.loc) {
2907
- e.setLocation({
2908
- file: route == null ? void 0 : route.component
2909
- });
2910
- }
2911
- controller.error(e);
2912
- }
2913
- }
2914
- read();
2915
- }
2916
- });
2917
- } else {
2918
- body = await iterableToHTMLBytes(result, iterable);
2919
- headers.set("Content-Length", body.byteLength.toString());
2920
- }
2921
- let response = createResponse(body, { ...init, headers });
2922
- return response;
2966
+ let body;
2967
+ if (streaming) {
2968
+ body = await renderToReadableStream(result, componentFactory, props, children, true, route);
2969
+ } else {
2970
+ body = await renderToString(result, componentFactory, props, children, true, route);
2923
2971
  }
2924
- if (!(factoryReturnValue instanceof Response)) {
2925
- throw new AstroError({
2926
- ...AstroErrorData.OnlyResponseCanBeReturned,
2927
- message: AstroErrorData.OnlyResponseCanBeReturned.message(
2928
- route == null ? void 0 : route.route,
2929
- typeof factoryReturnValue
2930
- ),
2931
- location: {
2932
- file: route == null ? void 0 : route.component
2933
- }
2934
- });
2972
+ if (body instanceof Response)
2973
+ return body;
2974
+ const init = result.response;
2975
+ const headers = new Headers(init.headers);
2976
+ if (!streaming && typeof body === "string") {
2977
+ body = encoder.encode(body);
2978
+ headers.set("Content-Length", body.byteLength.toString());
2935
2979
  }
2936
- return factoryReturnValue;
2980
+ const response = createResponse(body, { ...init, headers });
2981
+ return response;
2937
2982
  }
2938
2983
 
2939
2984
  function spreadAttributes(values = {}, _name, { class: scopedClassName } = {}) {
@@ -1,6 +1,6 @@
1
1
  export { renderers } from '../renderers.mjs';
2
2
  export { onRequest } from '../_empty-middleware.mjs';
3
- import './astro.2d3ebf0f.mjs';
3
+ import './astro.e0968ba7.mjs';
4
4
  import 'path-to-regexp';
5
5
  import 'cookie';
6
6
  import '@astrojs/internal-helpers/path';
@@ -14,7 +14,7 @@ import 'html-escaper';
14
14
  import 'vue';
15
15
  import 'vue/server-renderer';
16
16
  import '@ecomplus/utils';
17
- import './pages/_...slug_.astro.4358f614.mjs';
17
+ import './pages/_...slug_.astro.2e2d4770.mjs';
18
18
  import 'node:fs/promises';
19
19
  import 'node:path';
20
20
  import 'node:url';
@@ -29,6 +29,6 @@ import '@cloudcommerce/config';
29
29
  /* empty css */import '@vueuse/core';
30
30
  import '@headlessui/vue';
31
31
 
32
- const page = () => import('./pages/endpoint.js.60fd21aa.mjs').then(n => n.e);
32
+ const page = () => import('./pages/endpoint.js.6f0f4ede.mjs').then(n => n.e);
33
33
 
34
34
  export { page };
@@ -1,6 +1,6 @@
1
1
  export { renderers } from '../renderers.mjs';
2
2
  export { onRequest } from '../_empty-middleware.mjs';
3
- import './astro.2d3ebf0f.mjs';
3
+ import './astro.e0968ba7.mjs';
4
4
  import 'path-to-regexp';
5
5
  import 'cookie';
6
6
  import '@astrojs/internal-helpers/path';
@@ -14,7 +14,7 @@ import 'html-escaper';
14
14
  import 'vue';
15
15
  import 'vue/server-renderer';
16
16
  import '@ecomplus/utils';
17
- import './pages/_...slug_.astro.4358f614.mjs';
17
+ import './pages/_...slug_.astro.2e2d4770.mjs';
18
18
  import 'node:fs/promises';
19
19
  import 'node:path';
20
20
  import 'node:url';
@@ -29,6 +29,6 @@ import '@cloudcommerce/config';
29
29
  /* empty css */import '@vueuse/core';
30
30
  import '@headlessui/vue';
31
31
 
32
- const page = () => import('./pages/fallback.astro.e5566925.mjs');
32
+ const page = () => import('./pages/fallback.astro.fc8bc7e7.mjs');
33
33
 
34
34
  export { page };
@@ -1,6 +1,6 @@
1
1
  export { renderers } from '../renderers.mjs';
2
2
  export { onRequest } from '../_empty-middleware.mjs';
3
- import './astro.2d3ebf0f.mjs';
3
+ import './astro.e0968ba7.mjs';
4
4
  import 'path-to-regexp';
5
5
  import 'cookie';
6
6
  import '@astrojs/internal-helpers/path';
@@ -14,7 +14,7 @@ import 'html-escaper';
14
14
  import 'vue';
15
15
  import 'vue/server-renderer';
16
16
  import '@ecomplus/utils';
17
- import './pages/_...slug_.astro.4358f614.mjs';
17
+ import './pages/_...slug_.astro.2e2d4770.mjs';
18
18
  import 'node:fs/promises';
19
19
  import 'node:path';
20
20
  import 'node:url';
@@ -29,6 +29,6 @@ import '@cloudcommerce/config';
29
29
  /* empty css */import '@vueuse/core';
30
30
  import '@headlessui/vue';
31
31
 
32
- const page = () => import('./pages/index.astro.5bc6b9d8.mjs').then(n => n.a);
32
+ const page = () => import('./pages/index.astro.03adcc55.mjs').then(n => n.a);
33
33
 
34
34
  export { page };
@@ -1,6 +1,6 @@
1
1
  export { renderers } from '../renderers.mjs';
2
2
  export { onRequest } from '../_empty-middleware.mjs';
3
- import './astro.2d3ebf0f.mjs';
3
+ import './astro.e0968ba7.mjs';
4
4
  import 'path-to-regexp';
5
5
  import 'cookie';
6
6
  import '@astrojs/internal-helpers/path';
@@ -14,7 +14,7 @@ import 'html-escaper';
14
14
  import 'vue';
15
15
  import 'vue/server-renderer';
16
16
  import '@ecomplus/utils';
17
- import './pages/_...slug_.astro.4358f614.mjs';
17
+ import './pages/_...slug_.astro.2e2d4770.mjs';
18
18
  import 'node:fs/promises';
19
19
  import 'node:path';
20
20
  import 'node:url';
@@ -29,6 +29,6 @@ import '@cloudcommerce/config';
29
29
  /* empty css */import '@vueuse/core';
30
30
  import '@headlessui/vue';
31
31
 
32
- const page = () => import('./pages/index.astro.5bc6b9d8.mjs').then(n => n.i);
32
+ const page = () => import('./pages/index.astro.03adcc55.mjs').then(n => n.i);
33
33
 
34
34
  export { page };