ferrovue 0.7.1 → 0.7.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 (2) hide show
  1. package/dist/vite.js +29 -1
  2. package/package.json +6 -6
package/dist/vite.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { readdirSync, readFileSync } from "node:fs";
2
- import { join, resolve, sep } from "node:path";
2
+ import { join, posix, resolve, sep } from "node:path";
3
3
  import { CONFIG_FILE, loadConfig, write } from "./compiler.js";
4
4
  import { formatRefusal, formatWarning, isRefusal } from "./diagnostics.js";
5
5
  import { allPages, fileRoutes, pagesFolder } from "./file-routes.js";
@@ -130,6 +130,28 @@ ${routesTree(root, routes, " ", false)}
130
130
  ];
131
131
  `;
132
132
  }
133
+ function islandsFile({ consumer, build }) {
134
+ const { manifest } = build;
135
+ if (!manifest || consumer !== "client")
136
+ return null;
137
+ const written = typeof manifest === "string" ? manifest : ".vite/manifest.json";
138
+ return posix.join(posix.dirname(written), "ferrovue-islands.json");
139
+ }
140
+ function islandsJson(root, islands, bundle) {
141
+ const names = new Map(Object.entries(islands).map(([name, file]) => [resolve(root, file), name]));
142
+ const files = {};
143
+ for (const chunk of bundle) {
144
+ if (chunk.type !== "chunk")
145
+ continue;
146
+ for (const id of chunk.moduleIds ?? []) {
147
+ const name = names.get(resolve(id));
148
+ if (name !== undefined)
149
+ files[name] = chunk.fileName;
150
+ }
151
+ }
152
+ const sorted = Object.fromEntries(Object.entries(files).toSorted(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0)));
153
+ return `${JSON.stringify(sorted, null, 2)}\n`;
154
+ }
133
155
  /** The Rust renderers regenerated by a Vite build and its dev server, and the `ferrovue/islands`
134
156
  * and `ferrovue/routes` modules. */
135
157
  export default function ferrovue(options = {}) {
@@ -199,6 +221,12 @@ export default function ferrovue(options = {}) {
199
221
  throw e;
200
222
  }
201
223
  },
224
+ generateBundle(_, bundle) {
225
+ const manifest = islandsFile(this.environment.config);
226
+ if (manifest === null || islands === null)
227
+ return;
228
+ this.emitFile({ type: "asset", fileName: manifest, source: islandsJson(root, islands, Object.values(bundle)) });
229
+ },
202
230
  configureServer(server) {
203
231
  if (!inputs) {
204
232
  let config = null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ferrovue",
3
- "version": "0.7.1",
3
+ "version": "0.7.2",
4
4
  "description": "Vue templates compiled to Rust render functions: server-side rendering with no JavaScript at run time",
5
5
  "license": "MIT OR Apache-2.0",
6
6
  "repository": {
@@ -81,7 +81,7 @@
81
81
  "@vue/compiler-sfc": "3.5.43",
82
82
  "@vue/shared": "3.5.43",
83
83
  "generic-names": "^4.0.0",
84
- "postcss": "^8.5.28",
84
+ "postcss": "^8.5.29",
85
85
  "postcss-modules-extract-imports": "^3.1.0",
86
86
  "postcss-modules-local-by-default": "^4.2.0",
87
87
  "postcss-modules-scope": "^3.2.1",
@@ -94,12 +94,12 @@
94
94
  "@vue/language-service": "3.3.12",
95
95
  "@vue/server-renderer": "3.5.43",
96
96
  "pinia": "^4.0.3",
97
- "playwright": "1.63.0",
97
+ "playwright": "1.64.0",
98
98
  "typescript": "^7.0.2",
99
99
  "typescript-js": "npm:typescript@6.0.3",
100
- "vite": "^8.3.0",
101
- "vitest": "^5.0.1",
102
- "vscode-uri": "3.1.0",
100
+ "vite": "^8.3.4",
101
+ "vitest": "^5.0.3",
102
+ "vscode-uri": "3.2.0",
103
103
  "vue": "3.5.43",
104
104
  "vue-i18n": "11.4.13",
105
105
  "vue-router": "^5.3.1"