@decocms/tanstack 7.48.2 → 7.48.3
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 +23 -2
- package/src/vite/plugin.test.js +17 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decocms/tanstack",
|
|
3
|
-
"version": "7.48.
|
|
3
|
+
"version": "7.48.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Deco framework binding for TanStack Start + Cloudflare Workers",
|
|
6
6
|
"repository": {
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
"lint:unused": "knip"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@decocms/blocks": "7.48.
|
|
28
|
-
"@decocms/blocks-admin": "7.48.
|
|
29
|
-
"@decocms/blocks-cli": "7.48.
|
|
27
|
+
"@decocms/blocks": "7.48.3",
|
|
28
|
+
"@decocms/blocks-admin": "7.48.3",
|
|
29
|
+
"@decocms/blocks-cli": "7.48.3",
|
|
30
30
|
"@deco-cx/warp-node": "^0.3.16",
|
|
31
31
|
"fast-json-patch": "^3.1.0",
|
|
32
32
|
"ws": "^8.18.0"
|
package/src/vite/plugin.js
CHANGED
|
@@ -154,6 +154,25 @@ const STUB_SOURCE = {
|
|
|
154
154
|
"\0stub:bare-fs": "export const promises = {}; export default { promises };",
|
|
155
155
|
};
|
|
156
156
|
|
|
157
|
+
/**
|
|
158
|
+
* Argv (after the generate-schema.ts script path) for a meta.gen.json run.
|
|
159
|
+
*
|
|
160
|
+
* `--compose` is MANDATORY. Without it generate-schema emits an UNCOMPOSED
|
|
161
|
+
* manifest missing every framework `website/*` block (Page, matchers,
|
|
162
|
+
* __SECTION_REF__, Resolvable). meta.gen.json is committed and Studio reads it
|
|
163
|
+
* as-is (no composeMeta at read time), so an uncomposed rewrite silently breaks
|
|
164
|
+
* the admin editors — e.g. the date matcher powering variant rules disappears
|
|
165
|
+
* (casaevideo-tanstack #633). Mirrors `npm run generate`'s schema step
|
|
166
|
+
* (`blocks-cli generate --compose`). Both invocation sites in configureServer
|
|
167
|
+
* derive their args here so the flag can never drift off one of them.
|
|
168
|
+
*
|
|
169
|
+
* @param {string} siteName
|
|
170
|
+
* @returns {string[]}
|
|
171
|
+
*/
|
|
172
|
+
export function generateSchemaArgs(siteName) {
|
|
173
|
+
return ["--site", siteName, "--compose"];
|
|
174
|
+
}
|
|
175
|
+
|
|
157
176
|
/** @returns {import("vite").PluginOption} */
|
|
158
177
|
export function decoVitePlugin() {
|
|
159
178
|
/** @type {import("vite").Plugin} */
|
|
@@ -454,6 +473,8 @@ export function decoVitePlugin() {
|
|
|
454
473
|
// re-run generate-schema.ts so meta.gen.json stays in sync during dev.
|
|
455
474
|
// No --out is passed to the generator below, so it writes to its own
|
|
456
475
|
// default (.deco/meta.gen.json) — this constant must track that default.
|
|
476
|
+
// Both invocations get their args from generateSchemaArgs(), which pins
|
|
477
|
+
// the mandatory --compose flag (see its doc comment).
|
|
457
478
|
const schemaWatchDirs = ["src"];
|
|
458
479
|
const schemaOutFile = path.resolve(cwd, ".deco/meta.gen.json");
|
|
459
480
|
|
|
@@ -477,7 +498,7 @@ export function decoVitePlugin() {
|
|
|
477
498
|
cwd,
|
|
478
499
|
"node_modules/@decocms/blocks-cli/scripts/generate-schema.ts",
|
|
479
500
|
);
|
|
480
|
-
const cmd = `npx tsx ${JSON.stringify(scriptPath)}
|
|
501
|
+
const cmd = `npx tsx ${JSON.stringify(scriptPath)} ${generateSchemaArgs(schemaSiteName).join(" ")}`;
|
|
481
502
|
exec(cmd, { cwd }, (err) => {
|
|
482
503
|
schemaInFlight = false;
|
|
483
504
|
if (err) {
|
|
@@ -526,7 +547,7 @@ export function decoVitePlugin() {
|
|
|
526
547
|
cwd,
|
|
527
548
|
"node_modules/@decocms/blocks-cli/scripts/generate-schema.ts",
|
|
528
549
|
);
|
|
529
|
-
execFileSync("npx", ["tsx", scriptPath,
|
|
550
|
+
execFileSync("npx", ["tsx", scriptPath, ...generateSchemaArgs(schemaSiteName)], {
|
|
530
551
|
cwd,
|
|
531
552
|
stdio: "inherit",
|
|
532
553
|
});
|
package/src/vite/plugin.test.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
2
|
-
import { decoVitePlugin } from "./plugin.js";
|
|
2
|
+
import { decoVitePlugin, generateSchemaArgs } from "./plugin.js";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* The Vite plugin's `resolveId` / `load` hooks are pure functions over their
|
|
@@ -53,6 +53,22 @@ describe("decoVitePlugin client stubs (regression guard)", () => {
|
|
|
53
53
|
});
|
|
54
54
|
});
|
|
55
55
|
|
|
56
|
+
describe("generateSchemaArgs (regression: meta.gen.json must be composed)", () => {
|
|
57
|
+
// Both generate-schema.ts invocations in configureServer (watch regen + cold
|
|
58
|
+
// start) derive their args from this helper. --compose is mandatory: without
|
|
59
|
+
// it the manifest is written UNCOMPOSED — missing every framework website/*
|
|
60
|
+
// block (matchers/Page/Resolvable) — and Studio, which reads meta.gen.json
|
|
61
|
+
// as-is, silently loses editors (e.g. the variant date matcher). See
|
|
62
|
+
// casaevideo-tanstack #633.
|
|
63
|
+
it("always includes --compose", () => {
|
|
64
|
+
expect(generateSchemaArgs("casaevideo")).toContain("--compose");
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it("targets the given site", () => {
|
|
68
|
+
expect(generateSchemaArgs("my-site")).toEqual(["--site", "my-site", "--compose"]);
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
|
|
56
72
|
describe("decoVitePlugin __DECO_BUILD_HASH__ injection", () => {
|
|
57
73
|
let originalEnv;
|
|
58
74
|
|