@ubean/client 0.3.3 → 0.3.5

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 (2) hide show
  1. package/dist/ssr.js +13 -4
  2. package/package.json +7 -7
package/dist/ssr.js CHANGED
@@ -1,9 +1,9 @@
1
- import { r as createUbeanI18n } from "./i18n-t0G3VyBs.js";
1
+ import { n as configureI18nRuntime, r as createUbeanI18n } from "./i18n-t0G3VyBs.js";
2
2
  import { applyAppConfig } from "./define-app.js";
3
3
  import { createSSRApp, defineComponent, h, provide, reactive } from "vue";
4
4
  import { SSR_CONTENT_MARKER, STATE_DATA_ID, STATE_MARKER, __clearDataPayload, __clearDeferred, __resolveDataPayload, __resolveDeferred, __serializeDataPayload, __serializeDeferred, safeJsonStringify } from "@ubean/pages";
5
5
  import { buildLocaleHead } from "@ubean/i18n/browser";
6
- import { createHead, renderSSRHead, transformHtmlTemplate } from "@unhead/vue/server";
6
+ import { createHead, transformHtmlTemplate } from "@unhead/vue/server";
7
7
  import { renderToNodeStream, renderToString, renderToString as renderToString$1 } from "@vue/server-renderer";
8
8
  import { getIslandsBootstrapScript } from "@ubean/islands";
9
9
  //#region src/ssr.ts
@@ -91,6 +91,15 @@ async function prepareRender(options, pageObj, renderContext) {
91
91
  } });
92
92
  }
93
93
  if (pageObj.head) pushPageHead(head, pageObj.head);
94
+ const _routing = renderContext?.routing;
95
+ if (renderContext && _routing) configureI18nRuntime({ config: {
96
+ defaultLocale: _routing.defaultLocale,
97
+ locales: _routing.locales,
98
+ strategy: _routing.strategy,
99
+ fallbackLocale: renderContext.fallbackLocale || _routing.defaultLocale,
100
+ cookieName: renderContext.cookieName || "ubean_locale",
101
+ baseUrl: renderContext.baseUrl || ""
102
+ } });
94
103
  const i18n = renderContext?.locale ? createUbeanI18n({
95
104
  locale: renderContext.locale,
96
105
  fallbackLocale: renderContext.fallbackLocale || renderContext.locale,
@@ -155,7 +164,7 @@ async function resolveState(app, appConfig) {
155
164
  * (title, og:tags, etc.) without waiting for client hydration.
156
165
  */
157
166
  function collectDynamicHeadTags(head, staticHeadTags) {
158
- const fullTags = renderSSRHead(head).headTags || "";
167
+ const fullTags = head.render().headTags || "";
159
168
  if (!fullTags || fullTags === staticHeadTags) return "";
160
169
  const staticLines = new Set(staticHeadTags.split("\n").map((l) => l.trim()).filter(Boolean));
161
170
  const dynamicLines = fullTags.split("\n").map((l) => l.trim()).filter((l) => Boolean(l) && !staticLines.has(l));
@@ -240,7 +249,7 @@ function createVueRenderer(options) {
240
249
  const stateScriptRegex = new RegExp(`<script id="${STATE_DATA_ID}" type="application/json">${STATE_MARKER}<\/script>`);
241
250
  headPart = headPart.replace(stateScriptRegex, "");
242
251
  headPart = transformHtmlTemplate(head, headPart);
243
- const staticHeadTags = renderSSRHead(head).headTags || "";
252
+ const staticHeadTags = head.render().headTags || "";
244
253
  controller.enqueue(encoder.encode(headPart));
245
254
  await pumpVueStream(renderToNodeStream(app), controller);
246
255
  const dynamicHeadTags = collectDynamicHeadTags(head, staticHeadTags);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ubean/client",
3
- "version": "0.3.3",
3
+ "version": "0.3.5",
4
4
  "description": "Framework client runtime for ubean — layered over the lean @ubean/vue kernel, adding app factories, unhead, i18n, data layer, islands hydration and SSR state helpers",
5
5
  "files": [
6
6
  "dist"
@@ -32,11 +32,11 @@
32
32
  }
33
33
  },
34
34
  "dependencies": {
35
- "@ubean/i18n": "0.3.3",
36
- "@ubean/islands": "0.3.3",
37
- "@ubean/pages": "0.3.3",
38
- "@ubean/shared": "0.3.3",
39
- "@ubean/vue": "0.3.3",
35
+ "@ubean/i18n": "0.3.5",
36
+ "@ubean/islands": "0.3.5",
37
+ "@ubean/pages": "0.3.5",
38
+ "@ubean/shared": "0.3.5",
39
+ "@ubean/vue": "0.3.5",
40
40
  "@unhead/vue": "^3.4.0",
41
41
  "@vue/server-renderer": "^3.5.42",
42
42
  "vue": "^3.5.42",
@@ -49,7 +49,7 @@
49
49
  "vite-plus": "0.3.0"
50
50
  },
51
51
  "peerDependencies": {
52
- "@ubean/seo": "0.3.3"
52
+ "@ubean/seo": "0.3.5"
53
53
  },
54
54
  "peerDependenciesMeta": {
55
55
  "@ubean/seo": {