@decocms/blocks-cli 7.32.1 → 7.33.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.33.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.33.0",
|
|
35
35
|
"ts-morph": "^27.0.0",
|
|
36
36
|
"tsx": "^4.22.5"
|
|
37
37
|
},
|
|
@@ -146,6 +146,37 @@ export function transform(ctx: MigrationContext): void {
|
|
|
146
146
|
});
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
+
// Flag usePartialSection (Fresh load-more / "Ver mais" pattern) with an
|
|
150
|
+
// actionable useLoadMore recipe instead of a generic HTMX warning.
|
|
151
|
+
if (/usePartialSection/.test(result.content)) {
|
|
152
|
+
const hasAppend = /mode\s*:\s*["']append["']/.test(result.content);
|
|
153
|
+
ctx.manualReviewItems.push({
|
|
154
|
+
file: targetPath,
|
|
155
|
+
reason:
|
|
156
|
+
`usePartialSection${hasAppend ? " (mode:append)" : ""} detected — ` +
|
|
157
|
+
"this is the Fresh load-more / \"Ver mais\" pagination pattern. " +
|
|
158
|
+
"In TanStack it is a no-op stub; the button navigates replacing all products instead of appending. " +
|
|
159
|
+
"Convert to useLoadMore from @decocms/blocks/hooks:\n\n" +
|
|
160
|
+
' import { useLoadMore } from "@decocms/blocks/hooks"\n\n' +
|
|
161
|
+
' // At the top of your component (must be "use client"):\n' +
|
|
162
|
+
" const { pages, loadMore, loading, hasMore } = useLoadMore(\n" +
|
|
163
|
+
" props.page ?? { products: [], pageInfo: {} },\n" +
|
|
164
|
+
' "LOADER_KEY" // replace with your loader path, e.g.\n' +
|
|
165
|
+
' // "apps/vtex.ts/loaders/intelligentSearch/productListingPage.ts"\n' +
|
|
166
|
+
" )\n" +
|
|
167
|
+
" const allProducts = pages.flatMap(p => p.products ?? [])\n\n" +
|
|
168
|
+
" // Replace the usePartialSection anchor/button with:\n" +
|
|
169
|
+
" {hasMore && (\n" +
|
|
170
|
+
' <button onClick={loadMore} disabled={loading}>\n' +
|
|
171
|
+
' {loading ? "Carregando..." : "Ver mais"}\n' +
|
|
172
|
+
" </button>\n" +
|
|
173
|
+
" )}\n\n" +
|
|
174
|
+
"Add \"use client\" to the top of the file. " +
|
|
175
|
+
"See deco-to-tanstack-migration skill, 'Ver mais / Load More' section.",
|
|
176
|
+
severity: "warning",
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
|
|
149
180
|
// Flag files with hx-on:click that use useScript (simpler pattern)
|
|
150
181
|
if (/hx-on:click=\{useScript/.test(result.content)) {
|
|
151
182
|
ctx.manualReviewItems.push({
|