@devmoods/express-extras 0.72.0 → 0.72.1

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/vite/ssr.js +27 -12
  2. package/package.json +2 -2
package/dist/vite/ssr.js CHANGED
@@ -114,23 +114,38 @@ async function getAssetLinks(manifestPath, input, publicPath = '/') {
114
114
  throw Error('Entry not found in the manifest.json file');
115
115
  }
116
116
  const chunk = manifest[input];
117
- /* v8 ignore next -- @preserve */
118
- const cssHtml = (chunk.css || [])
117
+ // Collect all transitively imported chunk keys so we can gather their CSS too
118
+ const visited = new Set();
119
+ const collectImports = (key) => {
120
+ if (visited.has(key)) {
121
+ return;
122
+ }
123
+ visited.add(key);
124
+ const chunk = manifest[key];
125
+ if (!chunk) {
126
+ return;
127
+ }
128
+ for (const importKey of chunk.imports ?? []) {
129
+ collectImports(importKey);
130
+ }
131
+ };
132
+ collectImports(input);
133
+ const allCss = new Set();
134
+ for (const key of visited) {
135
+ for (const href of manifest[key]?.css ?? []) {
136
+ allCss.add(href);
137
+ }
138
+ }
139
+ const cssHtml = [...allCss]
119
140
  .map((href) => `<link rel="stylesheet" href="${publicPath}${href}" />`)
120
141
  .join(' ');
121
- // Generate HTML for preload links
122
- const preloadList = [input];
123
- /* v8 ignore next -- @preserve */
124
- if (Array.isArray(chunk.imports)) {
125
- preloadList.push(...chunk.imports);
126
- }
127
- const preloadHtml = preloadList
128
- .map((pre) => {
142
+ const preloadHtml = [...visited]
143
+ .map((key) => {
129
144
  /* v8 ignore next -- @preserve */
130
- if (!manifest[pre]?.file) {
145
+ if (!manifest[key]?.file) {
131
146
  return '';
132
147
  }
133
- return `<link rel="modulepreload" href="${publicPath}${manifest[pre].file}" />`;
148
+ return `<link rel="modulepreload" href="${publicPath}${manifest[key].file}" />`;
134
149
  })
135
150
  .join(' ');
136
151
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devmoods/express-extras",
3
- "version": "0.72.0",
3
+ "version": "0.72.1",
4
4
  "description": "Kubernetes-ready utilities for rapid Node.js application development",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -113,5 +113,5 @@
113
113
  "engines": {
114
114
  "node": ">=20 <26"
115
115
  },
116
- "gitHead": "a61f95c83ae0630a977c088522447467c3b7454e"
116
+ "gitHead": "04f69fb0aafc073cc734a0cfc9d278b5850d4ec2"
117
117
  }