@decocms/blocks-cli 7.41.0 → 7.42.0
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decocms/blocks-cli",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.42.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Deco codegen (generate-blocks, generate-schema, generate-invoke) and Fresh-to-TanStack migration tooling",
|
|
6
6
|
"repository": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"lint:unused": "knip"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@decocms/blocks": "7.
|
|
34
|
+
"@decocms/blocks": "7.42.0",
|
|
35
35
|
"ts-morph": "^27.0.0",
|
|
36
36
|
"tsx": "^4.22.5"
|
|
37
37
|
},
|
|
@@ -49,3 +49,22 @@ describe("VTEX invoke scaffold wires vtex.loaders + wishlist actions (#368)", ()
|
|
|
49
49
|
expect(invokeSrc).toContain("parseVtexAuthJwt");
|
|
50
50
|
});
|
|
51
51
|
});
|
|
52
|
+
|
|
53
|
+
describe("scaffolds ?renderJson / ?asJson OFF by default (opt-in)", () => {
|
|
54
|
+
const workerKey = "src/worker-entry.ts";
|
|
55
|
+
|
|
56
|
+
it("VTEX worker-entry disables both page-as-JSON endpoints", () => {
|
|
57
|
+
const worker = generateServerEntry(makeVtexCtx())[workerKey];
|
|
58
|
+
expect(worker).toContain("renderJson: false");
|
|
59
|
+
expect(worker).toContain("asJson: false");
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it("non-VTEX worker-entry disables both too", () => {
|
|
63
|
+
const ctx = createContext("/tmp/custom-scaffold-fixture-site");
|
|
64
|
+
ctx.siteName = "acme-custom";
|
|
65
|
+
ctx.platform = "custom";
|
|
66
|
+
const worker = generateServerEntry(ctx)[workerKey];
|
|
67
|
+
expect(worker).toContain("renderJson: false");
|
|
68
|
+
expect(worker).toContain("asJson: false");
|
|
69
|
+
});
|
|
70
|
+
});
|
|
@@ -86,6 +86,11 @@ ${isCommerce ? `
|
|
|
86
86
|
const serverEntry = createServerEntry({ fetch: handler.fetch });
|
|
87
87
|
|
|
88
88
|
const decoWorker = createDecoWorkerEntry(serverEntry, {
|
|
89
|
+
// Page-as-JSON endpoints are OFF by default — opt in when you build a mobile
|
|
90
|
+
// app that consumes the storefront (see the renderJson docs). ?asJson is the
|
|
91
|
+
// legacy raw path; ?renderJson is the lean per-section one.
|
|
92
|
+
renderJson: false,
|
|
93
|
+
asJson: false,
|
|
89
94
|
admin: {
|
|
90
95
|
handleMeta,
|
|
91
96
|
handleDecofileRead,
|
|
@@ -161,6 +166,11 @@ const serverEntry = createServerEntry({ fetch: handler.fetch });
|
|
|
161
166
|
const MOBILE_RE = /mobile|android|iphone/i;
|
|
162
167
|
|
|
163
168
|
const decoWorker = createDecoWorkerEntry(serverEntry, {
|
|
169
|
+
// Page-as-JSON endpoints are OFF by default — opt in when you build a mobile
|
|
170
|
+
// app that consumes the storefront (see the renderJson docs). ?asJson is the
|
|
171
|
+
// legacy raw path; ?renderJson is the lean per-section one.
|
|
172
|
+
renderJson: false,
|
|
173
|
+
asJson: false,
|
|
164
174
|
csp: CSP_DIRECTIVES,
|
|
165
175
|
buildSegment: (request) => {
|
|
166
176
|
const vtx = extractVtexContext(request);
|