@vertz/ui-server 0.2.37 → 0.2.38

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.
@@ -1159,6 +1159,7 @@ function createVertzBunPlugin(options) {
1159
1159
  if (imageQueue.length > 0) {
1160
1160
  await Promise.all(imageQueue.map((opts) => processImage({ ...opts, fit: opts.fit })));
1161
1161
  }
1162
+ let nativeCss;
1162
1163
  const compileResult = nativeCompiler ? (() => {
1163
1164
  if (!nativeManifestWarningLogged && manifests.size > 0) {
1164
1165
  nativeManifestWarningLogged = true;
@@ -1172,6 +1173,9 @@ function createVertzBunPlugin(options) {
1172
1173
  target: options?.target,
1173
1174
  fastRefresh: false
1174
1175
  });
1176
+ if (nativeResult.css) {
1177
+ nativeCss = nativeResult.css;
1178
+ }
1175
1179
  return {
1176
1180
  code: nativeResult.code,
1177
1181
  map: nativeResult.map ? JSON.parse(nativeResult.map) : { version: 3, sources: [], mappings: "", names: [] },
@@ -1197,8 +1201,15 @@ function createVertzBunPlugin(options) {
1197
1201
  mapsToChain.push(routeSplitMap);
1198
1202
  }
1199
1203
  const remapped = remapping(mapsToChain, () => null);
1200
- const extraction = cssExtractor.extract(source, args.path);
1204
+ const extraction = nativeCss ? { css: nativeCss, blockNames: [] } : cssExtractor.extract(source, args.path);
1201
1205
  let cssImportLine = "";
1206
+ let nativeCssInjection = "";
1207
+ if (nativeCss && extraction.css.length > 0) {
1208
+ const escaped = extraction.css.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$");
1209
+ nativeCssInjection = `import { injectCSS as __injectCSS } from '@vertz/ui';
1210
+ __injectCSS(\`${escaped}\`);
1211
+ `;
1212
+ }
1202
1213
  if (extraction.css.length > 0) {
1203
1214
  fileExtractions.set(args.path, extraction);
1204
1215
  if (hmr) {
@@ -1224,6 +1235,9 @@ function createVertzBunPlugin(options) {
1224
1235
  }
1225
1236
  }
1226
1237
  let contents = "";
1238
+ if (nativeCssInjection) {
1239
+ contents += nativeCssInjection;
1240
+ }
1227
1241
  if (cssImportLine) {
1228
1242
  contents += cssImportLine;
1229
1243
  }
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  createSSRHandler,
3
3
  loadAotManifest
4
- } from "./shared/chunk-rwa95knv.js";
4
+ } from "./shared/chunk-595trxsn.js";
5
5
  import {
6
6
  createNodeHandler
7
- } from "./shared/chunk-4qb2xcyb.js";
7
+ } from "./shared/chunk-d1a3ygv6.js";
8
8
  import {
9
9
  collectStreamChunks,
10
10
  compileThemeCached,
@@ -34,7 +34,7 @@ import {
34
34
  ssrRenderToString,
35
35
  streamToString,
36
36
  toPrefetchSession
37
- } from "./shared/chunk-vcpk8fs6.js";
37
+ } from "./shared/chunk-2ymwre0k.js";
38
38
  import {
39
39
  clearGlobalSSRTimeout,
40
40
  createSSRAdapter,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createNodeHandler
3
- } from "./shared/chunk-4qb2xcyb.js";
4
- import"./shared/chunk-vcpk8fs6.js";
3
+ } from "./shared/chunk-d1a3ygv6.js";
4
+ import"./shared/chunk-2ymwre0k.js";
5
5
  import"./shared/chunk-ybftdw1r.js";
6
6
  export {
7
7
  createNodeHandler
@@ -1120,7 +1120,13 @@ async function ssrRenderAot(module, url, options) {
1120
1120
  for (const [key, value] of queryCache) {
1121
1121
  data[key] = value;
1122
1122
  }
1123
- const html = aotEntry.render(data, ctx);
1123
+ let html;
1124
+ try {
1125
+ html = aotEntry.render(data, ctx);
1126
+ } catch (renderErr) {
1127
+ console.error("[SSR] AOT render failed for", match.pattern, "— falling back to single-pass:", renderErr instanceof Error ? renderErr.message : renderErr);
1128
+ return ssrRenderSinglePass(module, normalizedUrl, fallbackOptions);
1129
+ }
1124
1130
  if (options.diagnostics && isAotDebugEnabled()) {
1125
1131
  try {
1126
1132
  const domResult = await ssrRenderSinglePass(module, normalizedUrl, fallbackOptions);
@@ -11,7 +11,7 @@ import {
11
11
  ssrRenderSinglePass,
12
12
  ssrStreamNavQueries,
13
13
  toPrefetchSession
14
- } from "./chunk-vcpk8fs6.js";
14
+ } from "./chunk-2ymwre0k.js";
15
15
 
16
16
  // src/aot-manifest-loader.ts
17
17
  import { existsSync, readFileSync } from "node:fs";
@@ -10,7 +10,7 @@ import {
10
10
  ssrRenderSinglePass,
11
11
  ssrStreamNavQueries,
12
12
  toPrefetchSession
13
- } from "./chunk-vcpk8fs6.js";
13
+ } from "./chunk-2ymwre0k.js";
14
14
 
15
15
  // src/node-handler.ts
16
16
  function createNodeHandler(options) {
package/dist/ssr/index.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  createSSRHandler,
3
3
  loadAotManifest
4
- } from "../shared/chunk-rwa95knv.js";
4
+ } from "../shared/chunk-595trxsn.js";
5
5
  import {
6
6
  injectIntoTemplate,
7
7
  ssrDiscoverQueries,
8
8
  ssrRenderToString
9
- } from "../shared/chunk-vcpk8fs6.js";
9
+ } from "../shared/chunk-2ymwre0k.js";
10
10
  import"../shared/chunk-ybftdw1r.js";
11
11
  // src/prerender.ts
12
12
  async function discoverRoutes(module) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vertz/ui-server",
3
- "version": "0.2.37",
3
+ "version": "0.2.38",
4
4
  "description": "Vertz UI server-side rendering runtime",
5
5
  "license": "MIT",
6
6
  "repository": {