@decocms/tanstack 7.79.6 → 7.79.7
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.
- package/package.json +4 -4
- package/src/vite/plugin.js +6 -2
- package/src/vite/plugin.test.js +15 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decocms/tanstack",
|
|
3
|
-
"version": "7.79.
|
|
3
|
+
"version": "7.79.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Deco framework binding for TanStack Start + Cloudflare Workers",
|
|
6
6
|
"repository": {
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
"lint:unused": "knip"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@decocms/blocks": "7.79.
|
|
31
|
-
"@decocms/blocks-admin": "7.79.
|
|
32
|
-
"@decocms/blocks-cli": "7.79.
|
|
30
|
+
"@decocms/blocks": "7.79.7",
|
|
31
|
+
"@decocms/blocks-admin": "7.79.7",
|
|
32
|
+
"@decocms/blocks-cli": "7.79.7",
|
|
33
33
|
"@deco-cx/warp-node": "^0.3.16",
|
|
34
34
|
"fast-json-patch": "^3.1.0",
|
|
35
35
|
"ws": "^8.18.0"
|
package/src/vite/plugin.js
CHANGED
|
@@ -330,8 +330,12 @@ export function decoVitePlugin({ fastDeploy = "auto" } = {}) {
|
|
|
330
330
|
const file = id.slice(META_GEN_PREFIX.length, -META_GEN_SUFFIX.length);
|
|
331
331
|
// Virtual id → Vite won't watch the file on its own.
|
|
332
332
|
this.addWatchFile?.(file);
|
|
333
|
-
|
|
334
|
-
|
|
333
|
+
// Re-serialize compactly: generate-schema writes it indented, and every
|
|
334
|
+
// byte of that whitespace is paid twice in the isolate (module source +
|
|
335
|
+
// the string literal), at two-byte width since the schema has accented
|
|
336
|
+
// text. On a real site: 7.3 MB chunk / +15 MB heap, vs 3.3 MB compact.
|
|
337
|
+
const compact = JSON.stringify(JSON.parse(readFileSync(file, "utf-8")));
|
|
338
|
+
return `export default JSON.parse(${JSON.stringify(compact)});`;
|
|
335
339
|
}
|
|
336
340
|
|
|
337
341
|
// loaders.gen.ts — the site's invoke registry (`export const siteLoaders`).
|
package/src/vite/plugin.test.js
CHANGED
|
@@ -155,6 +155,21 @@ describe("decoVitePlugin meta.gen.json on SSR (regression: vite:json double-pars
|
|
|
155
155
|
expect(watched).toEqual([path.join(dir, ".deco", "meta.gen.json")]);
|
|
156
156
|
});
|
|
157
157
|
|
|
158
|
+
it("embeds an indented meta.gen.json compacted (whitespace costs isolate heap)", () => {
|
|
159
|
+
writeFileSync(
|
|
160
|
+
path.join(dir, ".deco", "meta.gen.json"),
|
|
161
|
+
JSON.stringify({ major: 1, schema: { title: "Coleção" } }, null, 2),
|
|
162
|
+
);
|
|
163
|
+
const p = getPlugin();
|
|
164
|
+
const id = p.resolveId.call({}, "../.deco/meta.gen.json", path.join(dir, "src", "setup.ts"), {
|
|
165
|
+
ssr: true,
|
|
166
|
+
});
|
|
167
|
+
const code = p.load.call({ addWatchFile() {} }, id, { ssr: true });
|
|
168
|
+
expect(code).toBe(
|
|
169
|
+
`export default JSON.parse(${JSON.stringify('{"major":1,"schema":{"title":"Coleção"}}')});`,
|
|
170
|
+
);
|
|
171
|
+
});
|
|
172
|
+
|
|
158
173
|
it("gives each meta.gen.json its own module id (no shared state)", () => {
|
|
159
174
|
const p = getPlugin();
|
|
160
175
|
const other = mkdtempSync(path.join(tmpdir(), "deco-meta-other-"));
|