@decocms/start 0.19.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/.cursor/skills/deco-api-call-dedup/SKILL.md +443 -0
- package/.cursor/skills/deco-apps-architecture/SKILL.md +255 -0
- package/.cursor/skills/deco-apps-architecture/app-pattern.md +288 -0
- package/.cursor/skills/deco-apps-architecture/commerce-types.md +239 -0
- package/.cursor/skills/deco-apps-architecture/new-app-guide.md +268 -0
- package/.cursor/skills/deco-apps-architecture/scripts-codegen.md +148 -0
- package/.cursor/skills/deco-apps-architecture/shared-utils.md +181 -0
- package/.cursor/skills/deco-apps-architecture/vtex-deep-structure.md +253 -0
- package/.cursor/skills/deco-apps-architecture/website-app.md +169 -0
- package/.cursor/skills/deco-apps-vtex-porting/SKILL.md +189 -0
- package/.cursor/skills/deco-apps-vtex-porting/adaptation-patterns.md +335 -0
- package/.cursor/skills/deco-apps-vtex-porting/commerce-porting.md +155 -0
- package/.cursor/skills/deco-apps-vtex-porting/cookie-auth-patterns.md +148 -0
- package/.cursor/skills/deco-apps-vtex-porting/structure-map.md +234 -0
- package/.cursor/skills/deco-apps-vtex-porting/transform-mapping.md +99 -0
- package/.cursor/skills/deco-apps-vtex-porting/website-porting.md +194 -0
- package/.cursor/skills/deco-apps-vtex-review/SKILL.md +234 -0
- package/.cursor/skills/deco-async-rendering-architecture/SKILL.md +270 -0
- package/.cursor/skills/deco-async-rendering-site-guide/SKILL.md +417 -0
- package/.cursor/skills/deco-cms-layout-caching/SKILL.md +293 -0
- package/.cursor/skills/deco-cms-route-config/SKILL.md +388 -0
- package/.cursor/skills/deco-core-architecture/SKILL.md +185 -0
- package/.cursor/skills/deco-core-architecture/blocks.md +196 -0
- package/.cursor/skills/deco-core-architecture/deco-vs-deco-start.md +191 -0
- package/.cursor/skills/deco-core-architecture/engine.md +220 -0
- package/.cursor/skills/deco-core-architecture/hooks-components.md +157 -0
- package/.cursor/skills/deco-core-architecture/plugins-clients.md +136 -0
- package/.cursor/skills/deco-core-architecture/runtime.md +116 -0
- package/.cursor/skills/deco-core-architecture/site-usage.md +165 -0
- package/.cursor/skills/deco-e2e-testing/SKILL.md +372 -0
- package/.cursor/skills/deco-e2e-testing/discovery.md +337 -0
- package/.cursor/skills/deco-e2e-testing/scripts/scaffold.sh +81 -0
- package/.cursor/skills/deco-e2e-testing/selectors.md +175 -0
- package/.cursor/skills/deco-e2e-testing/templates/package.json +18 -0
- package/.cursor/skills/deco-e2e-testing/templates/playwright.config.ts +65 -0
- package/.cursor/skills/deco-e2e-testing/templates/scripts/baseline.ts +279 -0
- package/.cursor/skills/deco-e2e-testing/templates/scripts/run-e2e.ts +194 -0
- package/.cursor/skills/deco-e2e-testing/templates/specs/ecommerce-flow.spec.ts +612 -0
- package/.cursor/skills/deco-e2e-testing/templates/tsconfig.json +12 -0
- package/.cursor/skills/deco-e2e-testing/templates/utils/metrics-collector.ts +918 -0
- package/.cursor/skills/deco-e2e-testing/troubleshooting.md +602 -0
- package/.cursor/skills/deco-edge-caching/SKILL.md +316 -0
- package/.cursor/skills/deco-full-analysis/SKILL.md +898 -0
- package/.cursor/skills/deco-full-analysis/checklists/asset-optimization.md +251 -0
- package/.cursor/skills/deco-full-analysis/checklists/bug-fix.md +189 -0
- package/.cursor/skills/deco-full-analysis/checklists/cache-strategy.md +144 -0
- package/.cursor/skills/deco-full-analysis/checklists/dependency-update.md +150 -0
- package/.cursor/skills/deco-full-analysis/checklists/hydration-fix.md +191 -0
- package/.cursor/skills/deco-full-analysis/checklists/image-optimization.md +180 -0
- package/.cursor/skills/deco-full-analysis/checklists/loader-optimization.md +165 -0
- package/.cursor/skills/deco-full-analysis/checklists/seo-fix.md +183 -0
- package/.cursor/skills/deco-full-analysis/checklists/site-cleanup.md +281 -0
- package/.cursor/skills/deco-full-analysis/discovery.md +548 -0
- package/.cursor/skills/deco-incident-debugging/SKILL.md +378 -0
- package/.cursor/skills/deco-incident-debugging/headless-mode.md +510 -0
- package/.cursor/skills/deco-incident-debugging/learnings-index.md +227 -0
- package/.cursor/skills/deco-incident-debugging/triage-workflow.md +312 -0
- package/.cursor/skills/deco-islands-migration/SKILL.md +251 -0
- package/.cursor/skills/deco-loader-n-plus-1-detector/SKILL.md +275 -0
- package/.cursor/skills/deco-performance-audit/SKILL.md +530 -0
- package/.cursor/skills/deco-performance-audit/tools-reference.md +428 -0
- package/.cursor/skills/deco-performance-audit/workflow.md +457 -0
- package/.cursor/skills/deco-server-functions-invoke/SKILL.md +92 -0
- package/.cursor/skills/deco-server-functions-invoke/architecture.md +166 -0
- package/.cursor/skills/deco-server-functions-invoke/generator.md +122 -0
- package/.cursor/skills/deco-server-functions-invoke/problem.md +98 -0
- package/.cursor/skills/deco-server-functions-invoke/troubleshooting.md +110 -0
- package/.cursor/skills/deco-site-deployment/SKILL.md +396 -0
- package/.cursor/skills/deco-site-memory-debugging/SKILL.md +121 -0
- package/.cursor/skills/deco-site-memory-debugging/cdp-connection.md +222 -0
- package/.cursor/skills/deco-site-memory-debugging/memory-analysis.md +362 -0
- package/.cursor/skills/deco-site-patterns/SKILL.md +124 -0
- package/.cursor/skills/deco-site-patterns/app-composition.md +337 -0
- package/.cursor/skills/deco-site-patterns/client-patterns.md +341 -0
- package/.cursor/skills/deco-site-patterns/cms-wiring.md +230 -0
- package/.cursor/skills/deco-site-patterns/section-patterns.md +340 -0
- package/.cursor/skills/deco-site-scaling-tuning/SKILL.md +240 -0
- package/.cursor/skills/deco-site-scaling-tuning/analysis-scripts.md +267 -0
- package/.cursor/skills/deco-start-architecture/SKILL.md +218 -0
- package/.cursor/skills/deco-start-architecture/admin-protocol.md +156 -0
- package/.cursor/skills/deco-start-architecture/cms-resolution.md +201 -0
- package/.cursor/skills/deco-start-architecture/code-quality.md +158 -0
- package/.cursor/skills/deco-start-architecture/gap-analysis.md +129 -0
- package/.cursor/skills/deco-start-architecture/sdk-utilities.md +197 -0
- package/.cursor/skills/deco-start-architecture/worker-entry-caching.md +154 -0
- package/.cursor/skills/deco-startup-analysis/SKILL.md +248 -0
- package/.cursor/skills/deco-storefront-test-checklist/SKILL.md +369 -0
- package/.cursor/skills/deco-tanstack-hydration-fixes/SKILL.md +468 -0
- package/.cursor/skills/deco-tanstack-navigation/SKILL.md +681 -0
- package/.cursor/skills/deco-tanstack-search/SKILL.md +411 -0
- package/.cursor/skills/deco-tanstack-storefront-patterns/SKILL.md +1013 -0
- package/.cursor/skills/deco-to-tanstack-migration/SKILL.md +518 -0
- package/.cursor/skills/deco-to-tanstack-migration/references/codemod-commands.md +174 -0
- package/.cursor/skills/deco-to-tanstack-migration/references/commerce/README.md +78 -0
- package/.cursor/skills/deco-to-tanstack-migration/references/deco-framework/README.md +128 -0
- package/.cursor/skills/deco-to-tanstack-migration/references/gotchas.md +719 -0
- package/.cursor/skills/deco-to-tanstack-migration/references/imports/README.md +70 -0
- package/.cursor/skills/deco-to-tanstack-migration/references/platform-hooks/README.md +154 -0
- package/.cursor/skills/deco-to-tanstack-migration/references/signals/README.md +220 -0
- package/.cursor/skills/deco-to-tanstack-migration/references/vite-config/README.md +78 -0
- package/.cursor/skills/deco-to-tanstack-migration/templates/package-json.md +55 -0
- package/.cursor/skills/deco-to-tanstack-migration/templates/root-route.md +110 -0
- package/.cursor/skills/deco-to-tanstack-migration/templates/router.md +96 -0
- package/.cursor/skills/deco-to-tanstack-migration/templates/setup-ts.md +167 -0
- package/.cursor/skills/deco-to-tanstack-migration/templates/vite-config.md +122 -0
- package/.cursor/skills/deco-to-tanstack-migration/templates/worker-entry.md +67 -0
- package/.cursor/skills/deco-typescript-fixes/SKILL.md +178 -0
- package/.cursor/skills/deco-typescript-fixes/common-fixes.md +330 -0
- package/.cursor/skills/deco-typescript-fixes/strategy.md +148 -0
- package/.cursor/skills/deco-variant-selection-perf/SKILL.md +272 -0
- package/.cursor/skills/deco-vtex-fetch-cache/SKILL.md +225 -0
- package/.cursor/skills/find-skills/SKILL.md +133 -0
- package/.cursor/skills/incident-report/SKILL.md +179 -0
- package/.cursor/skills/incident-report/references/5-whys.md +75 -0
- package/.cursor/skills/incident-report/templates/client-report.md +187 -0
- package/.cursor/skills/incident-report/templates/internal-report.md +206 -0
- package/.cursor/skills/template-skill/SKILL.md +38 -0
- package/.github/workflows/release.yml +32 -0
- package/.releaserc.json +25 -0
- package/CLAUDE.md +135 -0
- package/GAP_ANALYSIS.md +224 -0
- package/GAP_ANALYSIS_V2.md +1013 -0
- package/biome.json +39 -0
- package/knip.json +5 -0
- package/package.json +87 -0
- package/scripts/generate-blocks.ts +69 -0
- package/scripts/generate-invoke.ts +378 -0
- package/scripts/generate-schema.ts +657 -0
- package/src/admin/cors.ts +29 -0
- package/src/admin/decofile.ts +72 -0
- package/src/admin/index.ts +24 -0
- package/src/admin/invoke.ts +163 -0
- package/src/admin/liveControls.ts +29 -0
- package/src/admin/meta.ts +70 -0
- package/src/admin/render.ts +205 -0
- package/src/admin/schema.ts +686 -0
- package/src/admin/setup.ts +44 -0
- package/src/cms/index.ts +59 -0
- package/src/cms/loader.ts +180 -0
- package/src/cms/registry.ts +162 -0
- package/src/cms/resolve.ts +1005 -0
- package/src/cms/sectionLoaders.ts +294 -0
- package/src/hooks/DecoPageRenderer.tsx +444 -0
- package/src/hooks/LazySection.tsx +109 -0
- package/src/hooks/LiveControls.tsx +108 -0
- package/src/hooks/SectionErrorFallback.tsx +85 -0
- package/src/hooks/index.ts +8 -0
- package/src/index.ts +5 -0
- package/src/matchers/builtins.ts +184 -0
- package/src/matchers/posthog.ts +154 -0
- package/src/middleware/decoState.ts +55 -0
- package/src/middleware/healthMetrics.ts +131 -0
- package/src/middleware/index.ts +80 -0
- package/src/middleware/liveness.ts +21 -0
- package/src/middleware/observability.ts +205 -0
- package/src/routes/adminRoutes.ts +83 -0
- package/src/routes/cmsRoute.ts +302 -0
- package/src/routes/components.tsx +34 -0
- package/src/routes/index.ts +15 -0
- package/src/sdk/analytics.ts +72 -0
- package/src/sdk/cacheHeaders.ts +268 -0
- package/src/sdk/cachedLoader.ts +206 -0
- package/src/sdk/clx.ts +3 -0
- package/src/sdk/cookie.ts +39 -0
- package/src/sdk/createInvoke.ts +57 -0
- package/src/sdk/csp.ts +59 -0
- package/src/sdk/env.ts +27 -0
- package/src/sdk/index.ts +63 -0
- package/src/sdk/instrumentedFetch.ts +137 -0
- package/src/sdk/invoke.ts +133 -0
- package/src/sdk/mergeCacheControl.ts +150 -0
- package/src/sdk/redirects.ts +217 -0
- package/src/sdk/requestContext.ts +184 -0
- package/src/sdk/serverTimings.ts +68 -0
- package/src/sdk/signal.ts +41 -0
- package/src/sdk/sitemap.ts +143 -0
- package/src/sdk/urlUtils.ts +117 -0
- package/src/sdk/useDevice.ts +82 -0
- package/src/sdk/useId.ts +7 -0
- package/src/sdk/useScript.ts +101 -0
- package/src/sdk/workerEntry.ts +703 -0
- package/src/sdk/wrapCaughtErrors.ts +107 -0
- package/src/types/index.ts +39 -0
- package/src/types/widgets.ts +13 -0
- package/tsconfig.json +13 -0
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
# Worker Entry and Edge Caching
|
|
2
|
+
|
|
3
|
+
## createDecoWorkerEntry (`sdk/workerEntry.ts`)
|
|
4
|
+
|
|
5
|
+
The outermost wrapper for Cloudflare Workers. Handles admin routes, caching, and proxying to TanStack Start.
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
interface DecoWorkerEntryOptions {
|
|
9
|
+
cacheProfile?: (url: URL) => CacheProfile;
|
|
10
|
+
buildSegment?: (request: Request) => SegmentKey;
|
|
11
|
+
bypassPaths?: string[];
|
|
12
|
+
adminHandlers?: AdminHandlers;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function createDecoWorkerEntry(
|
|
16
|
+
serverEntry: { fetch: (req: Request) => Promise<Response> },
|
|
17
|
+
options?: DecoWorkerEntryOptions,
|
|
18
|
+
): ExportedHandler
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Request Flow
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
Request
|
|
25
|
+
|
|
|
26
|
+
|-- 1. tryAdminRoute()
|
|
27
|
+
| /live/_meta -> handleMeta
|
|
28
|
+
| /.decofile -> handleDecofileRead / handleDecofileReload
|
|
29
|
+
| /live/previews/* -> handleRender
|
|
30
|
+
| /deco/invoke -> handleInvoke
|
|
31
|
+
| /deco/_liveness -> handleLiveness
|
|
32
|
+
|
|
|
33
|
+
|-- 2. Cache purge check
|
|
34
|
+
| ?__deco_purge_cache -> purge + return 200
|
|
35
|
+
|
|
|
36
|
+
|-- 3. Static asset bypass
|
|
37
|
+
| /assets/*, favicon.ico, sprites.svg -> direct fetch
|
|
38
|
+
|
|
|
39
|
+
|-- 4. Edge cache lookup
|
|
40
|
+
| Build cache key (URL + segment hash)
|
|
41
|
+
| Check Cloudflare Cache API
|
|
42
|
+
| HIT -> return cached response
|
|
43
|
+
|
|
|
44
|
+
|-- 5. Origin (serverEntry.fetch)
|
|
45
|
+
| TanStack Start processes the request
|
|
46
|
+
| Response stored in cache if cacheable
|
|
47
|
+
|
|
|
48
|
+
|-- Return response
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Edge Caching (`sdk/cacheHeaders.ts`)
|
|
52
|
+
|
|
53
|
+
### Cache Profiles
|
|
54
|
+
|
|
55
|
+
URL patterns are matched to cache profiles with default TTLs:
|
|
56
|
+
|
|
57
|
+
| URL Pattern | Profile | s-maxage | stale-while-revalidate |
|
|
58
|
+
|-------------|---------|----------|----------------------|
|
|
59
|
+
| `/` (homepage) | `static` | 86400 (1 day) | 86400 |
|
|
60
|
+
| `*/p` (product) | `product` | 300 (5 min) | 300 |
|
|
61
|
+
| `/s`, `?q=` (search) | `search` | 60 (1 min) | 60 |
|
|
62
|
+
| `/cart`, `/checkout` | `private` | 0 | 0 |
|
|
63
|
+
| Everything else | `listing` | 120 (2 min) | 120 |
|
|
64
|
+
|
|
65
|
+
### Key Functions
|
|
66
|
+
|
|
67
|
+
```typescript
|
|
68
|
+
detectCacheProfile(url: URL): CacheProfile
|
|
69
|
+
cacheHeaders(profile: CacheProfile): Record<string, string>
|
|
70
|
+
routeCacheDefaults(profile: CacheProfile): { staleTime: number; gcTime: number }
|
|
71
|
+
registerCachePattern(pattern: RegExp, profile: CacheProfile): void
|
|
72
|
+
getCacheProfileConfig(profile: CacheProfile): CacheConfig
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Custom Profiles
|
|
76
|
+
|
|
77
|
+
Sites can register custom patterns:
|
|
78
|
+
|
|
79
|
+
```typescript
|
|
80
|
+
registerCachePattern(/\/brand\/.*/, "listing");
|
|
81
|
+
registerCachePattern(/\/lp\/.*/, "static");
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Segment Keys
|
|
85
|
+
|
|
86
|
+
Differentiate cache entries for personalized content:
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
interface SegmentKey {
|
|
90
|
+
device: "mobile" | "desktop";
|
|
91
|
+
loggedIn: boolean;
|
|
92
|
+
salesChannel?: string;
|
|
93
|
+
flags: string[]; // sorted active flag names
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
The segment hash is appended to the cache key URL:
|
|
98
|
+
|
|
99
|
+
```typescript
|
|
100
|
+
function buildCacheKey(request: Request, segment: SegmentKey): Request {
|
|
101
|
+
const url = new URL(request.url);
|
|
102
|
+
url.searchParams.set("__seg", hashSegment(segment));
|
|
103
|
+
return new Request(url.toString(), { method: "GET" });
|
|
104
|
+
}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Important: Cloudflare Cache API Workaround
|
|
108
|
+
|
|
109
|
+
Cache API ignores `s-maxage`. The worker stores with `max-age` equal to `sMaxAge` as a workaround.
|
|
110
|
+
|
|
111
|
+
## Cached Loader (`sdk/cachedLoader.ts`)
|
|
112
|
+
|
|
113
|
+
In-memory SWR cache for server-side loaders:
|
|
114
|
+
|
|
115
|
+
```typescript
|
|
116
|
+
function createCachedLoader<T>(
|
|
117
|
+
loader: () => Promise<T>,
|
|
118
|
+
options?: { ttl?: number; key?: string },
|
|
119
|
+
): () => Promise<T>
|
|
120
|
+
|
|
121
|
+
function clearLoaderCache(key?: string): void
|
|
122
|
+
function getLoaderCacheStats(): { hits: number; misses: number; size: number }
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Cache-Control Merge (`sdk/mergeCacheControl.ts`)
|
|
126
|
+
|
|
127
|
+
Merges multiple Cache-Control headers (most restrictive wins):
|
|
128
|
+
|
|
129
|
+
```typescript
|
|
130
|
+
function mergeCacheControl(a: string, b: string): string
|
|
131
|
+
function createCacheControlCollector(): CacheControlCollector
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## URL Utils for Caching (`sdk/urlUtils.ts`)
|
|
135
|
+
|
|
136
|
+
Strip tracking parameters for cache key stability:
|
|
137
|
+
|
|
138
|
+
```typescript
|
|
139
|
+
function stripTrackingParams(url: URL): URL
|
|
140
|
+
function cleanPathForCacheKey(url: URL): string
|
|
141
|
+
function hasTrackingParams(url: URL): boolean
|
|
142
|
+
function canonicalUrl(url: URL): string
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Stripped params: `fbclid`, `gclid`, `gclsrc`, `dclid`, `gbraid`, `wbraid`, `utm_source`, `utm_medium`, `utm_campaign`, `utm_content`, `utm_term`, `mc_cid`, `mc_eid`, `_hsenc`, `_hsmi`, `hsCtaTracking`, `__hsfp`, `__hssc`, `__hstc`, `msclkid`, `yclid`, `igshid`, `twclid`, `ttclid`.
|
|
146
|
+
|
|
147
|
+
## CSP for Admin (`sdk/csp.ts`)
|
|
148
|
+
|
|
149
|
+
Allows admin to embed storefront in iframe:
|
|
150
|
+
|
|
151
|
+
```typescript
|
|
152
|
+
function setCSPHeaders(response: Response, adminOrigin?: string): void
|
|
153
|
+
function buildCSPHeaderValue(adminOrigin?: string): string
|
|
154
|
+
```
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: deco-startup-analysis
|
|
3
|
+
description: Analyze startup logs from `deno task start` and homepage request to identify image optimization issues, dependency warnings, type errors, and other runtime problems. Essential step before code analysis.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Deco Startup Analysis
|
|
7
|
+
|
|
8
|
+
Run the Deco site locally, request the homepage, and analyze the console logs to identify common issues that affect performance and correctness.
|
|
9
|
+
|
|
10
|
+
## When to Use This Skill
|
|
11
|
+
|
|
12
|
+
- **First step** when starting work on any Deco site
|
|
13
|
+
- Before running full analysis or making changes
|
|
14
|
+
- When debugging performance or rendering issues
|
|
15
|
+
- As part of CI/CD quality checks
|
|
16
|
+
|
|
17
|
+
## Workflow
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
1. Start the dev server: deno task start
|
|
21
|
+
2. Wait for startup, note any warnings
|
|
22
|
+
3. Request homepage: curl localhost:8000/
|
|
23
|
+
4. Analyze logs for common issues
|
|
24
|
+
5. Document findings
|
|
25
|
+
6. Fix critical issues before proceeding
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Common Issues to Look For
|
|
29
|
+
|
|
30
|
+
### 1. Image Optimization Warnings
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
Missing height. This image will NOT be optimized: https://deco-sites-assets.s3.sa-east-1.amazonaws.com/...
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
**Problem**: Images without explicit `width` and `height` props bypass the Deco image optimization CDN and load directly from S3, causing:
|
|
37
|
+
- Slower load times (no CDN caching)
|
|
38
|
+
- Larger file sizes (no compression/resizing)
|
|
39
|
+
- Layout shifts (no reserved space)
|
|
40
|
+
|
|
41
|
+
**Root Causes**:
|
|
42
|
+
1. Image component has `height={undefined}` conditionally
|
|
43
|
+
2. Using `<img>` instead of Deco's `<Image />` component
|
|
44
|
+
3. Dynamic images without known dimensions
|
|
45
|
+
|
|
46
|
+
**Fix Pattern**:
|
|
47
|
+
```tsx
|
|
48
|
+
// WRONG - height is undefined when isHalf is false
|
|
49
|
+
<Image
|
|
50
|
+
width={imageToDisplay.isHalf ? 32 : 112}
|
|
51
|
+
height={imageToDisplay.isHalf ? 24 : undefined} // ❌
|
|
52
|
+
/>
|
|
53
|
+
|
|
54
|
+
// RIGHT - always provide height
|
|
55
|
+
<Image
|
|
56
|
+
width={imageToDisplay.isHalf ? 32 : 112}
|
|
57
|
+
height={24} // ✅ Always a value
|
|
58
|
+
/>
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
**Finding the culprit**:
|
|
62
|
+
1. Note the image URL from the warning
|
|
63
|
+
2. Search blocks for the URL: `grep -r "filename" .deco/blocks/`
|
|
64
|
+
3. Find which component renders that section
|
|
65
|
+
4. Check all Image components for missing height/width
|
|
66
|
+
|
|
67
|
+
### 2. S3 vs CDN URLs
|
|
68
|
+
|
|
69
|
+
**Problem**: Images using raw S3 URLs bypass optimization:
|
|
70
|
+
```
|
|
71
|
+
❌ https://deco-sites-assets.s3.sa-east-1.amazonaws.com/site/image.png
|
|
72
|
+
✅ https://assets.decocache.com/site/image.png
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
**Fix**: Update block configurations to use CDN URLs, or ensure Image component rewrites URLs.
|
|
76
|
+
|
|
77
|
+
### 3. PostCSS Dependency Warnings
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
Warning: The following peer dependency issues were found:
|
|
81
|
+
└─┬ cssnano@6.0.1
|
|
82
|
+
└─┬ cssnano-preset-default@6.1.2
|
|
83
|
+
├─┬ cssnano-utils@4.0.2
|
|
84
|
+
│ └── peer postcss@^8.4.31: resolved to 8.4.27
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
**Problem**: Mismatched PostCSS versions can cause CSS processing issues.
|
|
88
|
+
|
|
89
|
+
**Fix**: Update postcss in `deno.json` or `package.json`:
|
|
90
|
+
```json
|
|
91
|
+
{
|
|
92
|
+
"imports": {
|
|
93
|
+
"postcss": "npm:postcss@^8.4.31"
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### 4. nodeModulesDir Deprecation
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
Warning: "nodeModulesDir": true is deprecated in Deno 2.0. Use "nodeModulesDir": "auto" instead.
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
**Fix**: Update `deno.json`:
|
|
105
|
+
```json
|
|
106
|
+
{
|
|
107
|
+
"nodeModulesDir": "auto"
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### 5. experimentalDecorators Warning
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
Warning: experimentalDecorators compiler option is deprecated
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
**Fix**: Remove from `deno.json` compilerOptions or migrate decorators.
|
|
118
|
+
|
|
119
|
+
### 6. Manifest Missing Entries
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
TS7053: Element implicitly has an 'any' type because expression of type '"action-name"' can't be used to index type...
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
**Problem**: Code references actions/loaders that aren't in `manifest.gen.ts`.
|
|
126
|
+
|
|
127
|
+
**Causes**:
|
|
128
|
+
- Action/loader file was deleted but code still references it
|
|
129
|
+
- File exists but manifest wasn't regenerated
|
|
130
|
+
- Typo in the action/loader name
|
|
131
|
+
|
|
132
|
+
**Fix**:
|
|
133
|
+
1. Check if the file exists in `actions/` or `loaders/`
|
|
134
|
+
2. If missing, restore from git or remove the reference
|
|
135
|
+
3. Run `deno task start` to regenerate manifest
|
|
136
|
+
|
|
137
|
+
### 7. Type Errors During Check
|
|
138
|
+
|
|
139
|
+
Running `deno check --unstable-tsgo` reveals type issues:
|
|
140
|
+
|
|
141
|
+
| Error Code | Meaning | Common Fix |
|
|
142
|
+
|------------|---------|------------|
|
|
143
|
+
| TS2322 | Type not assignable | Fix type mismatch |
|
|
144
|
+
| TS2339 | Property doesn't exist | Add missing property to interface |
|
|
145
|
+
| TS7006 | Implicit any | Add type annotation |
|
|
146
|
+
| TS18048 | Possibly undefined | Add null check or use optional chaining |
|
|
147
|
+
| TS2353 | Unknown property in object literal | Remove extra property or add to interface |
|
|
148
|
+
|
|
149
|
+
## Analysis Checklist
|
|
150
|
+
|
|
151
|
+
Run through this checklist when analyzing startup logs:
|
|
152
|
+
|
|
153
|
+
```markdown
|
|
154
|
+
## Startup Analysis Results
|
|
155
|
+
|
|
156
|
+
### Image Optimization
|
|
157
|
+
- [ ] No "Missing height" warnings
|
|
158
|
+
- [ ] All images use CDN URLs (assets.decocache.com)
|
|
159
|
+
- [ ] No direct S3 URLs in production
|
|
160
|
+
|
|
161
|
+
### Dependencies
|
|
162
|
+
- [ ] No peer dependency warnings
|
|
163
|
+
- [ ] nodeModulesDir set to "auto"
|
|
164
|
+
- [ ] No deprecated options
|
|
165
|
+
|
|
166
|
+
### Manifest/Types
|
|
167
|
+
- [ ] All actions exist in manifest
|
|
168
|
+
- [ ] All loaders exist in manifest
|
|
169
|
+
- [ ] No TS7053 indexing errors
|
|
170
|
+
|
|
171
|
+
### Type Checking
|
|
172
|
+
- [ ] `deno check --unstable-tsgo` passes
|
|
173
|
+
- [ ] No implicit any errors
|
|
174
|
+
- [ ] No missing property errors
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
## Example Output (add to AGENTS.md)
|
|
178
|
+
|
|
179
|
+
```markdown
|
|
180
|
+
## Startup Analysis
|
|
181
|
+
|
|
182
|
+
**Date:** 2024-01-21
|
|
183
|
+
**Command:** `deno task start` + `curl localhost:8000/`
|
|
184
|
+
|
|
185
|
+
### Issues Found
|
|
186
|
+
|
|
187
|
+
| Category | Count | Severity | Status |
|
|
188
|
+
|----------|-------|----------|--------|
|
|
189
|
+
| Missing image height | 20 | Medium | 🔴 Needs fix |
|
|
190
|
+
| PostCSS peer deps | 30 | Low | 🟡 Can defer |
|
|
191
|
+
| nodeModulesDir deprecation | 1 | Low | 🟡 Easy fix |
|
|
192
|
+
| Missing actions | 2 | High | 🔴 Blocking |
|
|
193
|
+
|
|
194
|
+
### Image Optimization Issues
|
|
195
|
+
|
|
196
|
+
Images missing height (will NOT be optimized):
|
|
197
|
+
- `tag-OFERTA.png` - Used in ProductTags component
|
|
198
|
+
- `tag-frete-gratis.png` - Used in ProductTags component
|
|
199
|
+
|
|
200
|
+
**Fix:** Update `components/tags/ProductTags.tsx` to always pass height.
|
|
201
|
+
|
|
202
|
+
### Missing Actions
|
|
203
|
+
|
|
204
|
+
- `actions/spin.ts` - Referenced in FortuneWheel.tsx
|
|
205
|
+
- `actions/can-spin.ts` - Referenced in FortuneWheel.tsx
|
|
206
|
+
|
|
207
|
+
**Fix:** Restore from git or remove references.
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
## Commands Reference
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
# Start dev server
|
|
214
|
+
deno task start
|
|
215
|
+
|
|
216
|
+
# Request homepage (in another terminal)
|
|
217
|
+
curl -sI localhost:8000/ | head -20
|
|
218
|
+
curl -s localhost:8000/ > /dev/null
|
|
219
|
+
|
|
220
|
+
# Check for type errors
|
|
221
|
+
deno check --unstable-tsgo 2>&1 | head -100
|
|
222
|
+
|
|
223
|
+
# Count errors by type
|
|
224
|
+
deno check --unstable-tsgo 2>&1 | grep -o "TS[0-9]*" | sort | uniq -c | sort -rn
|
|
225
|
+
|
|
226
|
+
# Find images without height
|
|
227
|
+
grep -rn "height={undefined}" components/ sections/
|
|
228
|
+
|
|
229
|
+
# Find S3 image URLs in blocks
|
|
230
|
+
grep -r "s3.sa-east-1.amazonaws.com" .deco/blocks/
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
## Integration with Full Analysis
|
|
234
|
+
|
|
235
|
+
This skill should be run **before** the full analysis skill:
|
|
236
|
+
|
|
237
|
+
1. **deco-startup-analysis** - Fix critical runtime issues
|
|
238
|
+
2. **deco-full-analysis** - Document architecture and find optimizations
|
|
239
|
+
3. **deco-typescript-fixes** - Fix remaining type errors
|
|
240
|
+
4. **deco-performance-audit** - Runtime performance analysis
|
|
241
|
+
|
|
242
|
+
## Related Learnings
|
|
243
|
+
|
|
244
|
+
From site-optimization database:
|
|
245
|
+
- "Prioritize Above-the-Fold PLP Images" - Dynamic fetch priority
|
|
246
|
+
- "Optimize LCP for Banner Carousel" - Explicit LCP prioritization
|
|
247
|
+
- "Smart SVG Image Handling" - Conditional asset proxying
|
|
248
|
+
- "Eager Load First Product Image" - LCP image prioritization
|