ronce-racine 0.5.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/AGENTS.md +90 -0
- package/LICENSE +21 -0
- package/README.md +281 -0
- package/agents/code-reviewer.md +33 -0
- package/agents/qa-tester.md +28 -0
- package/dist/hooks/README.md +182 -0
- package/dist/hooks/bash-npm-silent.mjs +81 -0
- package/dist/hooks/session-inject.mjs +53 -0
- package/dist/hooks/session-precompact.mjs +36 -0
- package/dist/hooks/session-writer.mjs +142 -0
- package/dist/hooks/skill-reminder.mjs +89 -0
- package/dist/hooks/truncate-bash-output.mjs +46 -0
- package/dist/hooks/truncate-output.mjs +88 -0
- package/dist/hooks/worktree-env-setup.mjs +123 -0
- package/dist/install.js +962 -0
- package/docs/adopting-a-repo.md +80 -0
- package/docs/architecture.md +76 -0
- package/docs/decisions.md +72 -0
- package/docs/developing.md +143 -0
- package/docs/evaluating-skills.md +41 -0
- package/docs/git-worktrees.md +62 -0
- package/docs/rules/clean-architecture-deps.md +66 -0
- package/docs/rules/commits.md +59 -0
- package/docs/rules/detection-gap-protocol.md +55 -0
- package/docs/rules/error-handling-discipline.md +62 -0
- package/docs/rules/minimal-code.md +58 -0
- package/docs/rules/no-raw-sql-interpolation.md +57 -0
- package/docs/rules/pre-commit-secret-detection.md +54 -0
- package/docs/rules/secure-logging.md +53 -0
- package/docs/rules/sql-migrations-discipline.md +58 -0
- package/docs/rules/subscription-cleanup.md +63 -0
- package/docs/rules/test-discipline.md +66 -0
- package/docs/rules/ui-states-complete.md +52 -0
- package/docs/templates/SKILL.template.md +66 -0
- package/docs/templates/rule.template.md +16 -0
- package/docs/writing-a-rule.md +43 -0
- package/docs/writing-a-skill.md +118 -0
- package/package.json +45 -0
- package/rules/clean-architecture-deps.md +20 -0
- package/rules/commits.md +16 -0
- package/rules/detection-gap-protocol.md +35 -0
- package/rules/error-handling-discipline.md +23 -0
- package/rules/minimal-code.md +32 -0
- package/rules/no-raw-sql-interpolation.md +20 -0
- package/rules/pre-commit-secret-detection.md +14 -0
- package/rules/secure-logging.md +16 -0
- package/rules/sql-migrations-discipline.md +18 -0
- package/rules/subscription-cleanup.md +22 -0
- package/rules/test-discipline.md +20 -0
- package/rules/ui-states-complete.md +23 -0
- package/scripts/subscription-leak-scan.ts +53 -0
- package/skills/adversarial-feature-challenge/README.md +65 -0
- package/skills/adversarial-feature-challenge/SKILL.md +96 -0
- package/skills/adversarial-feature-challenge/assets/fuzz-payloads.txt +60 -0
- package/skills/adversarial-feature-challenge/templates/challenge-report.md +42 -0
- package/skills/api-contract-versioning/README.md +62 -0
- package/skills/api-contract-versioning/SKILL.md +76 -0
- package/skills/api-contract-versioning/templates/consumer-inventory.md +29 -0
- package/skills/audit-architecture/README.md +56 -0
- package/skills/audit-architecture/SKILL.md +97 -0
- package/skills/audit-architecture/reference/ar-architecture.md +275 -0
- package/skills/audit-architecture/reference/di-disponibilite.md +252 -0
- package/skills/audit-architecture/reference/im-incidents.md +217 -0
- package/skills/audit-architecture/reference/pa-pannes.md +362 -0
- package/skills/audit-architecture/reference/re-recuperation.md +300 -0
- package/skills/audit-architecture/reference/sc-scalabilite.md +173 -0
- package/skills/audit-architecture/reference/su-support.md +180 -0
- package/skills/audit-ci-cd/README.md +54 -0
- package/skills/audit-ci-cd/SKILL.md +124 -0
- package/skills/audit-ci-cd/reference/artefacts.md +39 -0
- package/skills/audit-ci-cd/reference/deploiement.md +100 -0
- package/skills/audit-ci-cd/reference/dora.md +94 -0
- package/skills/audit-ci-cd/reference/iac.md +40 -0
- package/skills/audit-ci-cd/reference/pipeline-ci.md +36 -0
- package/skills/audit-ci-cd/reference/supply-chain.md +44 -0
- package/skills/audit-compliance/README.md +69 -0
- package/skills/audit-compliance/SKILL.md +176 -0
- package/skills/audit-compliance/reference/conformite-rgpd.md +295 -0
- package/skills/audit-compliance/reference/finops.md +318 -0
- package/skills/audit-compliance/reference/gouvernance-donnees.md +238 -0
- package/skills/audit-industrialisation/README.md +53 -0
- package/skills/audit-industrialisation/SKILL.md +251 -0
- package/skills/audit-observability/README.md +64 -0
- package/skills/audit-observability/SKILL.md +134 -0
- package/skills/audit-observability/reference/alerting.md +214 -0
- package/skills/audit-observability/reference/logging.md +114 -0
- package/skills/audit-observability/reference/metriques.md +166 -0
- package/skills/audit-observability/reference/traces-dashboards.md +90 -0
- package/skills/audit-performance-frontend/README.md +91 -0
- package/skills/audit-performance-frontend/SKILL.md +194 -0
- package/skills/audit-performance-frontend/reference/assets-cache-network.md +129 -0
- package/skills/audit-performance-frontend/reference/css-rendering-pipeline.md +154 -0
- package/skills/audit-performance-frontend/reference/html-critical-path.md +128 -0
- package/skills/audit-performance-frontend/reference/js-engine-runtime.md +280 -0
- package/skills/audit-performance-frontend/reference/memory-gc.md +126 -0
- package/skills/audit-performance-frontend/reference/profiling-tooling.md +98 -0
- package/skills/audit-quality/README.md +85 -0
- package/skills/audit-quality/SKILL.md +126 -0
- package/skills/audit-quality/reference/qa-devops.md +539 -0
- package/skills/audit-quality/reference/qu-qualite-donnees.md +402 -0
- package/skills/audit-report/README.md +72 -0
- package/skills/audit-report/SKILL.md +241 -0
- package/skills/audit-report/reference/scoring-model.md +45 -0
- package/skills/audit-security/README.md +72 -0
- package/skills/audit-security/SKILL.md +140 -0
- package/skills/audit-security/reference/auth-identite.md +98 -0
- package/skills/audit-security/reference/autorisation.md +66 -0
- package/skills/audit-security/reference/chiffrement-tls.md +97 -0
- package/skills/audit-security/reference/detection-patching.md +67 -0
- package/skills/audit-security/reference/incident-response.md +98 -0
- package/skills/audit-security/reference/reseau-conteneurs.md +72 -0
- package/skills/audit-security/reference/secrets.md +36 -0
- package/skills/audit-testing/README.md +82 -0
- package/skills/audit-testing/SKILL.md +131 -0
- package/skills/audit-testing/reference/golden-dataset.md +65 -0
- package/skills/audit-testing/reference/resilience-chaos.md +93 -0
- package/skills/audit-testing/reference/tests-contractuels.md +65 -0
- package/skills/audit-testing/reference/tests-e2e-flaky.md +67 -0
- package/skills/audit-testing/reference/tests-unit-integ-ci.md +125 -0
- package/skills/bug-ticket-root-cause/README.md +67 -0
- package/skills/bug-ticket-root-cause/SKILL.md +86 -0
- package/skills/bug-ticket-root-cause/templates/bug-ticket.md +43 -0
- package/skills/bug-triage-structured/README.md +63 -0
- package/skills/bug-triage-structured/SKILL.md +104 -0
- package/skills/bug-triage-structured/templates/bug-triage.md +38 -0
- package/skills/ci-pipeline-orchestration/README.md +55 -0
- package/skills/ci-pipeline-orchestration/SKILL.md +110 -0
- package/skills/commit-readiness-review/README.md +66 -0
- package/skills/commit-readiness-review/SKILL.md +82 -0
- package/skills/commit-readiness-review/scripts/precommit-scan.ts +81 -0
- package/skills/comprehensive-test-strategy/README.md +64 -0
- package/skills/comprehensive-test-strategy/SKILL.md +108 -0
- package/skills/comprehensive-test-strategy/reference/testing-advanced.md +85 -0
- package/skills/daily-workflow-optimization/README.md +56 -0
- package/skills/daily-workflow-optimization/SKILL.md +80 -0
- package/skills/database-schema-evolution/README.md +54 -0
- package/skills/database-schema-evolution/SKILL.md +107 -0
- package/skills/ddd-backend-implementation/README.md +63 -0
- package/skills/ddd-backend-implementation/SKILL.md +95 -0
- package/skills/design-system-component-lifecycle/README.md +56 -0
- package/skills/design-system-component-lifecycle/SKILL.md +97 -0
- package/skills/design-system-component-lifecycle/templates/component-contract.md +43 -0
- package/skills/detection-sweep/README.md +58 -0
- package/skills/detection-sweep/SKILL.md +93 -0
- package/skills/detection-sweep/scripts/sweep.ts +80 -0
- package/skills/domain-modeling-design/README.md +57 -0
- package/skills/domain-modeling-design/SKILL.md +83 -0
- package/skills/frontend-fullstack-implementation/README.md +60 -0
- package/skills/frontend-fullstack-implementation/SKILL.md +133 -0
- package/skills/frontend-spec-call-site-audit/README.md +66 -0
- package/skills/frontend-spec-call-site-audit/SKILL.md +82 -0
- package/skills/frontend-spec-call-site-audit/scripts/audit-entry-points.ts +79 -0
- package/skills/frontend-spec-call-site-audit/templates/ticket-frontend.md +32 -0
- package/skills/merge-request-review/README.md +60 -0
- package/skills/merge-request-review/SKILL.md +77 -0
- package/skills/merge-request-review/templates/mr-review-report.md +29 -0
- package/skills/production-incident-diagnostic/README.md +63 -0
- package/skills/production-incident-diagnostic/SKILL.md +103 -0
- package/skills/production-incident-diagnostic/templates/incident-report.md +33 -0
- package/skills/qa-session-intake/README.md +56 -0
- package/skills/qa-session-intake/SKILL.md +78 -0
- package/skills/recording-decisions/README.md +91 -0
- package/skills/recording-decisions/SKILL.md +84 -0
- package/skills/recurring-bug-root-cause/README.md +64 -0
- package/skills/recurring-bug-root-cause/SKILL.md +93 -0
- package/skills/recurring-bug-root-cause/scripts/detect-recurring-fixes.ts +46 -0
- package/skills/recurring-bug-root-cause/templates/postmortem-recidive.md +37 -0
- package/skills/refactoring-shared-component-api/README.md +50 -0
- package/skills/refactoring-shared-component-api/SKILL.md +84 -0
- package/skills/refactoring-shared-component-api/scripts/sweep-call-sites.ts +85 -0
- package/skills/refactoring-shared-component-api/templates/migration-checklist.md +19 -0
- package/skills/validating-features-end-to-end/README.md +50 -0
- package/skills/validating-features-end-to-end/SKILL.md +90 -0
- package/skills/visual-regression-check/README.md +51 -0
- package/skills/visual-regression-check/SKILL.md +89 -0
- package/skills/writing-robust-tests/README.md +53 -0
- package/skills/writing-robust-tests/SKILL.md +88 -0
- package/templates/.adopted.example +8 -0
- package/templates/anti-drift.gitlab-ci.yml +23 -0
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# Grid - Assets, Cache & Network
|
|
2
|
+
|
|
3
|
+
Category 5 · 4 questions (PF-23 to PF-26).
|
|
4
|
+
|
|
5
|
+
## Table of contents
|
|
6
|
+
|
|
7
|
+
- [PF-23 - Critical rendering path and network budget](#pf-23--critical-rendering-path-and-network-budget--criticality-must)
|
|
8
|
+
- [PF-24 - Asset compression and encoding](#pf-24--asset-compression-and-encoding--criticality-should)
|
|
9
|
+
- [PF-25 - Multi-layer cache strategy](#pf-25--multi-layer-cache-strategy--criticality-should)
|
|
10
|
+
- [PF-26 - Optimized font loading](#pf-26--optimized-font-loading--criticality-should)
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
### PF-23 - Critical rendering path and network budget · Criticality: **MUST**
|
|
15
|
+
|
|
16
|
+
**Analyze:** Critical-path size, number of RTTs, Early Hints, server push
|
|
17
|
+
|
|
18
|
+
**Verification commands:**
|
|
19
|
+
```bash
|
|
20
|
+
# Main bundle size
|
|
21
|
+
ls -lh dist/*.js dist/*.css public/*.js public/*.css 2>/dev/null | head -10
|
|
22
|
+
# Build analysis
|
|
23
|
+
grep -ri "rollup-plugin-visualizer\|webpack-bundle-analyzer\|source-map-explorer" package.json 2>/dev/null
|
|
24
|
+
# Early Hints / server push
|
|
25
|
+
grep -ri "103\|early.hints\|server.push\|link.*preload" . --include="*.ts" --include="*.rs" --include="*.conf" --include="*.yml" 2>/dev/null | head -5
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
**Check:**
|
|
29
|
+
- Critical path < 14KB (1 initial TCP RTT congestion window)
|
|
30
|
+
- Critical CSS inlined in the HTML
|
|
31
|
+
- 103 Early Hints or server push for critical resources
|
|
32
|
+
- TTFB < 30ms local / < 50ms production
|
|
33
|
+
|
|
34
|
+
**Levels:**
|
|
35
|
+
| Level | Criteria |
|
|
36
|
+
|--------|----------|
|
|
37
|
+
| 0 | Critical path > 100KB, no network strategy. |
|
|
38
|
+
| 1 | Critical resources identified and listed. |
|
|
39
|
+
| 2 | Critical path < 14KB (1 RTT), critical CSS inlined. |
|
|
40
|
+
| 3 | 103 Early Hints or server push, TTFB < 30ms local. |
|
|
41
|
+
| 4 | Sub-100ms guaranteed, CI checks the 14KB budget. |
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
### PF-24 - Asset compression and encoding · Criticality: **SHOULD**
|
|
46
|
+
|
|
47
|
+
**Analyze:** Brotli/gzip, image format, srcset, SVG sprites
|
|
48
|
+
|
|
49
|
+
**Verification commands:**
|
|
50
|
+
```bash
|
|
51
|
+
# Compression
|
|
52
|
+
grep -ri "brotli\|br\|gzip\|compress" . --include="*.conf" --include="*.yml" --include="*.ts" --include="*.rs" 2>/dev/null | head -5
|
|
53
|
+
# Modern image formats
|
|
54
|
+
find . -name "*.avif" -o -name "*.webp" 2>/dev/null | grep -v node_modules | head -5
|
|
55
|
+
# srcset
|
|
56
|
+
grep -rn "srcset\|picture" . --include="*.html" --include="*.vue" --include="*.tsx" 2>/dev/null | grep -v node_modules | head -5
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**Check:**
|
|
60
|
+
- Brotli level 11 for pre-compressed static assets
|
|
61
|
+
- AVIF > WebP > JPEG for images
|
|
62
|
+
- `<img srcset>` with resolution descriptors
|
|
63
|
+
- SVG sprites with `<symbol>` and `<use href>`
|
|
64
|
+
|
|
65
|
+
**Levels:**
|
|
66
|
+
| Level | Criteria |
|
|
67
|
+
|--------|----------|
|
|
68
|
+
| 0 | No compression or basic gzip, images not optimized. |
|
|
69
|
+
| 1 | Gzip enabled, images resized. |
|
|
70
|
+
| 2 | Brotli 11 for static, AVIF/WebP, srcset. |
|
|
71
|
+
| 3 | SVG sprites, calibrated dynamic compression. |
|
|
72
|
+
| 4 | Per-asset size budget in CI, compression ratio monitored. |
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
### PF-25 - Multi-layer cache strategy · Criticality: **SHOULD**
|
|
77
|
+
|
|
78
|
+
**Analyze:** Cache-Control headers, contenthash, Service Worker, PageCache, stale-while-revalidate
|
|
79
|
+
|
|
80
|
+
**Verification commands:**
|
|
81
|
+
```bash
|
|
82
|
+
# Cache headers
|
|
83
|
+
grep -ri "cache.control\|max-age\|immutable\|stale.while.revalidate\|no-cache\|no-store" . --include="*.ts" --include="*.rs" --include="*.conf" --include="*.yml" 2>/dev/null | head -10
|
|
84
|
+
# Service Worker
|
|
85
|
+
find . -name "sw.*" -o -name "service-worker*" -o -name "workbox*" 2>/dev/null | grep -v node_modules | head -5
|
|
86
|
+
# Contenthash
|
|
87
|
+
grep -ri "contenthash\|chunkhash\|hash" vite.config.* webpack.config.* rollup.config.* 2>/dev/null | head -5
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**Check:**
|
|
91
|
+
- Immutable assets with contenthash: `Cache-Control: public, max-age=31536000, immutable`
|
|
92
|
+
- HTML: `Cache-Control: no-cache` (always revalidated)
|
|
93
|
+
- `stale-while-revalidate` to serve the cache immediately + revalidate in the background
|
|
94
|
+
- All 5 cache layers used (MemoryCache, PageCache, Disk, SW, HTTP 304)
|
|
95
|
+
|
|
96
|
+
**Levels:**
|
|
97
|
+
| Level | Criteria |
|
|
98
|
+
|--------|----------|
|
|
99
|
+
| 0 | No cache strategy, default headers. |
|
|
100
|
+
| 1 | Basic Cache-Control on static assets. |
|
|
101
|
+
| 2 | Contenthash + immutable, no-cache on HTML. |
|
|
102
|
+
| 3 | All 5 cache layers used, PageCache validated. |
|
|
103
|
+
| 4 | Cache hit rate monitored, CI checks headers. |
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
### PF-26 - Optimized font loading · Criticality: **SHOULD**
|
|
108
|
+
|
|
109
|
+
**Analyze:** Subsetting, unicode-range, font-display: optional, preload, adjusted fallback
|
|
110
|
+
|
|
111
|
+
**Verification commands:**
|
|
112
|
+
```bash
|
|
113
|
+
grep -rn "font-display\|unicode-range\|preload.*font\|font.*preload" . --include="*.css" --include="*.html" --include="*.vue" 2>/dev/null | grep -v node_modules | head -10
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
**Check:**
|
|
117
|
+
- WOFF2 + `font-display: optional` + preload (zero layout shift if cached)
|
|
118
|
+
- Subsetting with `unicode-range` (Latin ~20KB vs ~100KB+ full)
|
|
119
|
+
- Fallback adjusted with `size-adjust`, `ascent-override`, `descent-override`
|
|
120
|
+
- Font-related CLS = 0
|
|
121
|
+
|
|
122
|
+
**Levels:**
|
|
123
|
+
| Level | Criteria |
|
|
124
|
+
|--------|----------|
|
|
125
|
+
| 0 | Full fonts with no strategy, FOUT/FOIT. |
|
|
126
|
+
| 1 | WOFF2 + font-display configured. |
|
|
127
|
+
| 2 | Subsetting + unicode-range, adjusted fallback. |
|
|
128
|
+
| 3 | Zero font CLS, font-display: optional. |
|
|
129
|
+
| 4 | Glyphs audited automatically, font budget in CI. |
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
# Grid - CSS & Rendering Pipeline
|
|
2
|
+
|
|
3
|
+
Category 2 · 5 questions (PF-05 to PF-09).
|
|
4
|
+
|
|
5
|
+
## Table of contents
|
|
6
|
+
|
|
7
|
+
- [PF-05 - CSS selectors and WebKit style resolution](#pf-05--css-selectors-and-webkit-style-resolution--criticality-should)
|
|
8
|
+
- [PF-06 - Layout triggers and CSS property cost](#pf-06--layout-triggers-and-css-property-cost--criticality-must)
|
|
9
|
+
- [PF-07 - Paint, compositing and WebKit GPU](#pf-07--paint-compositing-and-webkit-gpu--criticality-should)
|
|
10
|
+
- [PF-08 - CSS custom properties and recalc cost](#pf-08--css-custom-properties-and-recalc-cost--criticality-could)
|
|
11
|
+
- [PF-09 - Font rendering and text layout](#pf-09--font-rendering-and-text-layout--criticality-should)
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
### PF-05 - CSS selectors and WebKit style resolution · Criticality: **SHOULD**
|
|
16
|
+
|
|
17
|
+
**Analyze:** CSS selector complexity, key selector, style recalculation time
|
|
18
|
+
|
|
19
|
+
**Verification commands:**
|
|
20
|
+
```bash
|
|
21
|
+
# Universal or deep selectors
|
|
22
|
+
grep -rn "\*\s*{" . --include="*.css" --include="*.scss" --include="*.vue" 2>/dev/null | grep -v node_modules | head -10
|
|
23
|
+
# Deep selectors with descendant combinator
|
|
24
|
+
grep -rn ">>>\|/deep/\|::v-deep" . --include="*.vue" --include="*.css" 2>/dev/null | grep -v node_modules | head -10
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
**Check:**
|
|
28
|
+
- No universal selectors (`*`) in key position
|
|
29
|
+
- Right-to-left evaluation: the key selector (rightmost) is the primary filter
|
|
30
|
+
- Style recalculation < 5ms (ideally < 1ms)
|
|
31
|
+
- Parallel style resolution active (no `:nth-child`/`:first-child` on critical lists)
|
|
32
|
+
|
|
33
|
+
**Levels:**
|
|
34
|
+
| Level | Criteria |
|
|
35
|
+
|--------|----------|
|
|
36
|
+
| 0 | Deep, universal, or attribute selectors in key position. |
|
|
37
|
+
| 1 | No universal selectors (*) in key position. |
|
|
38
|
+
| 2 | Style recalculation time < 5ms. |
|
|
39
|
+
| 3 | Parallel style resolution active (no :nth-child/:first-child on critical lists). |
|
|
40
|
+
| 4 | Style recalculation < 1ms + CI alert on expensive selectors. |
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
### PF-06 - Layout triggers and CSS property cost · Criticality: **MUST**
|
|
45
|
+
|
|
46
|
+
**Analyze:** Animated CSS properties, containment, animation cost
|
|
47
|
+
|
|
48
|
+
**Verification commands:**
|
|
49
|
+
```bash
|
|
50
|
+
# Animations on layout properties
|
|
51
|
+
grep -rn "animation\|transition" . --include="*.css" --include="*.scss" --include="*.vue" 2>/dev/null | grep -v node_modules | grep -iv "transform\|opacity\|filter" | head -10
|
|
52
|
+
# Containment
|
|
53
|
+
grep -rn "contain:" . --include="*.css" --include="*.scss" --include="*.vue" 2>/dev/null | grep -v node_modules | head -5
|
|
54
|
+
# content-visibility
|
|
55
|
+
grep -rn "content-visibility" . --include="*.css" --include="*.scss" --include="*.vue" 2>/dev/null | grep -v node_modules | head -5
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
**Check:**
|
|
59
|
+
- Animations only on `transform`, `opacity`, `filter` (Tier 1 - composite only)
|
|
60
|
+
- `contain: layout` or `contain: strict` on self-contained subtrees
|
|
61
|
+
- `content-visibility: auto` for deferred off-viewport rendering
|
|
62
|
+
- No Tier 3/4 properties (width, height, font-size) animated
|
|
63
|
+
|
|
64
|
+
**Levels:**
|
|
65
|
+
| Level | Criteria |
|
|
66
|
+
|--------|----------|
|
|
67
|
+
| 0 | Animations on layout properties (width, height, margin). |
|
|
68
|
+
| 1 | All animations use only transform, opacity, or filter. |
|
|
69
|
+
| 2 | `contain: layout` or `contain: strict` on self-contained subtrees. |
|
|
70
|
+
| 3 | Zero tier 3/4 property animated. |
|
|
71
|
+
| 4 | Layout time per frame < 2ms. |
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
### PF-07 - Paint, compositing and WebKit GPU · Criticality: **SHOULD**
|
|
76
|
+
|
|
77
|
+
**Analyze:** Composite layer count, VRAM, will-change, implicit layer promotion
|
|
78
|
+
|
|
79
|
+
**Verification commands:**
|
|
80
|
+
```bash
|
|
81
|
+
# will-change in static CSS (anti-pattern)
|
|
82
|
+
grep -rn "will-change" . --include="*.css" --include="*.scss" --include="*.vue" 2>/dev/null | grep -v node_modules | head -10
|
|
83
|
+
# translateZ hack
|
|
84
|
+
grep -rn "translateZ(0)\|translate3d(0" . --include="*.css" --include="*.scss" --include="*.vue" 2>/dev/null | grep -v node_modules | head -5
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
**Check:**
|
|
88
|
+
- `will-change` applied dynamically (via JS before the animation, removed after), not in static CSS
|
|
89
|
+
- Composite layer count < 20
|
|
90
|
+
- VRAM < 64MB (1920×1080 @2×DPR = ~8MB per layer)
|
|
91
|
+
- No unwanted implicit layer promotion
|
|
92
|
+
|
|
93
|
+
**Levels:**
|
|
94
|
+
| Level | Criteria |
|
|
95
|
+
|--------|----------|
|
|
96
|
+
| 0 | No awareness of layers, `will-change` in static CSS. |
|
|
97
|
+
| 1 | Composite layer count known, `will-change` applied dynamically. |
|
|
98
|
+
| 2 | < 20 layers, VRAM < 64MB. |
|
|
99
|
+
| 3 | Layers audited in CI, implicit promotion eliminated. |
|
|
100
|
+
| 4 | Continuous VRAM monitoring, zero paint storm. |
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
### PF-08 - CSS custom properties and recalc cost · Criticality: **COULD**
|
|
105
|
+
|
|
106
|
+
**Analyze:** Use of `--var`, mutations on `:root`, `@property`, animating custom properties
|
|
107
|
+
|
|
108
|
+
**Verification commands:**
|
|
109
|
+
```bash
|
|
110
|
+
grep -rn "@property\|--.*:" . --include="*.css" --include="*.scss" --include="*.vue" 2>/dev/null | grep -v node_modules | head -10
|
|
111
|
+
grep -rn "setProperty\|style\.set\|:root" . --include="*.ts" --include="*.js" --include="*.vue" 2>/dev/null | grep -v node_modules | head -10
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
**Check:**
|
|
115
|
+
- Custom properties scoped as close as possible to the consumer (not global on `:root` if mutated)
|
|
116
|
+
- `@property` with `inherits: false` for frequently mutated variables
|
|
117
|
+
- Typed `syntax` (`<length>`, `<color>`) to enable GPU animation
|
|
118
|
+
|
|
119
|
+
**Levels:**
|
|
120
|
+
| Level | Criteria |
|
|
121
|
+
|--------|----------|
|
|
122
|
+
| 0 | Global custom properties mutated frequently, no use of @property. |
|
|
123
|
+
| 1 | Custom properties scoped as close as possible to the consumer. |
|
|
124
|
+
| 2 | @property with `inherits: false` for mutated variables. |
|
|
125
|
+
| 3 | Zero full style invalidation in profiling. |
|
|
126
|
+
| 4 | Custom-property budget documented, CI detects global mutations. |
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
### PF-09 - Font rendering and text layout · Criticality: **SHOULD**
|
|
131
|
+
|
|
132
|
+
**Analyze:** `font-display`, subsetting, WOFF2, fallback metrics, font CLS
|
|
133
|
+
|
|
134
|
+
**Verification commands:**
|
|
135
|
+
```bash
|
|
136
|
+
grep -rn "font-display\|font-face\|woff2\|unicode-range\|size-adjust\|ascent-override" . --include="*.css" --include="*.scss" --include="*.vue" 2>/dev/null | grep -v node_modules | head -10
|
|
137
|
+
# Font sizes
|
|
138
|
+
find . -name "*.woff2" -o -name "*.woff" -o -name "*.ttf" 2>/dev/null | grep -v node_modules | xargs ls -lh 2>/dev/null | head -10
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
**Check:**
|
|
142
|
+
- `font-display` explicitly configured (`optional` ideal for zero CLS)
|
|
143
|
+
- WOFF2 used (best compression)
|
|
144
|
+
- Subsetting with `unicode-range` (Latin ~20KB vs ~100KB+ full)
|
|
145
|
+
- Fallback adjusted with `size-adjust`, `ascent-override`, `descent-override`
|
|
146
|
+
|
|
147
|
+
**Levels:**
|
|
148
|
+
| Level | Criteria |
|
|
149
|
+
|--------|----------|
|
|
150
|
+
| 0 | Fonts loaded with no strategy, visible FOUT/FOIT, no subsetting. |
|
|
151
|
+
| 1 | `font-display` explicitly configured, WOFF2 used. |
|
|
152
|
+
| 2 | Subsetting in place, `size-adjust` for the fallback. |
|
|
153
|
+
| 3 | Font-related CLS = 0. |
|
|
154
|
+
| 4 | Font loading < 50ms, glyphs audited automatically. |
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# Grid - HTML & Critical Path
|
|
2
|
+
|
|
3
|
+
Category 1 · 4 questions (PF-01 to PF-04).
|
|
4
|
+
|
|
5
|
+
## Table of contents
|
|
6
|
+
|
|
7
|
+
- [PF-01 - DOM structure and WebKit parsing](#pf-01--dom-structure-and-webkit-parsing--criticality-must)
|
|
8
|
+
- [PF-02 - Eliminating render-blocking](#pf-02--eliminating-render-blocking--criticality-must)
|
|
9
|
+
- [PF-03 - DOM batching and layout thrashing](#pf-03--dom-batching-and-layout-thrashing--criticality-must)
|
|
10
|
+
- [PF-04 - Loading attributes and network priority](#pf-04--loading-attributes-and-network-priority--criticality-should)
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
### PF-01 - DOM structure and WebKit parsing · Criticality: **MUST**
|
|
15
|
+
|
|
16
|
+
**Analyze:** DOM depth, node count, use of `document.write()`, `<head>` ordering
|
|
17
|
+
|
|
18
|
+
**Verification commands:**
|
|
19
|
+
```bash
|
|
20
|
+
# Look for document.write
|
|
21
|
+
grep -ri "document\.write" . --include="*.ts" --include="*.js" --include="*.vue" --include="*.jsx" --include="*.tsx" 2>/dev/null | grep -v node_modules | head -10
|
|
22
|
+
# Estimate DOM depth (component nesting)
|
|
23
|
+
grep -rn "<template>" . --include="*.vue" 2>/dev/null | grep -v node_modules | head -10
|
|
24
|
+
# Look for DOM audits
|
|
25
|
+
grep -ri "dom.*depth\|dom.*size\|dom.*node" . --include="*.ts" --include="*.js" --include="*.yml" 2>/dev/null | head -5
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
**Check:**
|
|
29
|
+
- DOM depth < 32 levels (WebKit fast-path)
|
|
30
|
+
- Node count < 1500 for critical views
|
|
31
|
+
- No `document.write()` (disables the preload scanner)
|
|
32
|
+
- Optimal `<head>` ordering (meta charset, viewport, critical CSS, preconnect)
|
|
33
|
+
- Parsing in ~4KB chunks
|
|
34
|
+
|
|
35
|
+
**Levels:**
|
|
36
|
+
| Level | Criteria |
|
|
37
|
+
|--------|----------|
|
|
38
|
+
| 0 | No measurement of DOM depth or size. |
|
|
39
|
+
| 1 | No `document.write()` anywhere in the codebase. |
|
|
40
|
+
| 2 | Maximum DOM depth on critical views < 32 levels. |
|
|
41
|
+
| 3 | Automated DOM depth/size audit integrated in CI. |
|
|
42
|
+
| 4 | Continuous monitoring of DOM complexity in production (RUM or synthetic). |
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
### PF-02 - Eliminating render-blocking · Criticality: **MUST**
|
|
47
|
+
|
|
48
|
+
**Analyze:** Blocking scripts and CSS, inlined critical CSS, critical-path size
|
|
49
|
+
|
|
50
|
+
**Verification commands:**
|
|
51
|
+
```bash
|
|
52
|
+
# Scripts without defer/async
|
|
53
|
+
grep -rn "<script " . --include="*.html" --include="*.vue" 2>/dev/null | grep -v "defer\|async\|type=\"module\"" | grep -v node_modules | head -10
|
|
54
|
+
# Inlined CSS
|
|
55
|
+
grep -rn "<style>" . --include="*.html" 2>/dev/null | grep -v node_modules | head -5
|
|
56
|
+
# Critical CSS size
|
|
57
|
+
grep -ri "critical.*css\|critters\|penthouse" package.json 2>/dev/null
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
**Check:**
|
|
61
|
+
- Every script uses `defer`, `async`, or `type="module"`
|
|
62
|
+
- Critical CSS inlined in the `<head>` (< 14KB to fit in 1 RTT)
|
|
63
|
+
- `<link rel="modulepreload">` for ES modules (avoids the discovery cascade)
|
|
64
|
+
- Total critical-path size < 14.6KB (initial TCP congestion window)
|
|
65
|
+
|
|
66
|
+
**Levels:**
|
|
67
|
+
| Level | Criteria |
|
|
68
|
+
|--------|----------|
|
|
69
|
+
| 0 | Blocking CSS and JS in the `<head>` with no strategy. |
|
|
70
|
+
| 1 | Every script uses `defer` or `async`. |
|
|
71
|
+
| 2 | Inlined critical CSS size < 14KB. |
|
|
72
|
+
| 3 | Total critical-path size < 14.6KB. |
|
|
73
|
+
| 4 | Automatic critical-CSS extraction and inlining in the build pipeline. |
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
### PF-03 - DOM batching and layout thrashing · Criticality: **MUST**
|
|
78
|
+
|
|
79
|
+
**Analyze:** Interleaved DOM read/write patterns, forced synchronous layouts
|
|
80
|
+
|
|
81
|
+
**Verification commands:**
|
|
82
|
+
```bash
|
|
83
|
+
# Layout thrashing patterns (geometric read after DOM write)
|
|
84
|
+
grep -rn "offsetTop\|offsetLeft\|offsetWidth\|offsetHeight\|clientWidth\|clientHeight\|getBoundingClientRect\|getComputedStyle\|scrollTop\|scrollLeft" . --include="*.ts" --include="*.js" --include="*.vue" 2>/dev/null | grep -v node_modules | head -15
|
|
85
|
+
# Custom ESLint rules
|
|
86
|
+
grep -ri "layout.thrashing\|forced.reflow" . --include="*.js" --include="*.ts" --include="*.yml" 2>/dev/null | head -5
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
**Check:**
|
|
90
|
+
- read-batch → write-batch pattern applied consistently
|
|
91
|
+
- No geometric property read inside a loop that mutates the DOM
|
|
92
|
+
- Use of `requestAnimationFrame` to group mutations
|
|
93
|
+
- ESLint/linter rule to detect layout thrashing patterns
|
|
94
|
+
|
|
95
|
+
**Levels:**
|
|
96
|
+
| Level | Criteria |
|
|
97
|
+
|--------|----------|
|
|
98
|
+
| 0 | DOM mutations and geometric reads interleaved. |
|
|
99
|
+
| 1 | No geometric property read inside a loop that mutates the DOM. |
|
|
100
|
+
| 2 | read-batch → write-batch pattern applied consistently. |
|
|
101
|
+
| 3 | ESLint rule or custom linter detecting layout thrashing patterns. |
|
|
102
|
+
| 4 | Number of forced synchronous layouts per page load in production = 0. |
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
### PF-04 - Loading attributes and network priority · Criticality: **SHOULD**
|
|
107
|
+
|
|
108
|
+
**Analyze:** `fetchpriority`, `loading`, `decoding` attributes, resource hints
|
|
109
|
+
|
|
110
|
+
**Verification commands:**
|
|
111
|
+
```bash
|
|
112
|
+
grep -rn "fetchpriority\|loading=\|decoding=\|preconnect\|dns-prefetch\|modulepreload" . --include="*.html" --include="*.vue" --include="*.tsx" --include="*.jsx" 2>/dev/null | grep -v node_modules | head -10
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
**Check:**
|
|
116
|
+
- `fetchpriority="high"` on the LCP element
|
|
117
|
+
- `loading="lazy"` on below-the-fold images (not on first-viewport images)
|
|
118
|
+
- `decoding="sync"` on LCP images
|
|
119
|
+
- `<link rel="preconnect">` for critical third-party domains
|
|
120
|
+
|
|
121
|
+
**Levels:**
|
|
122
|
+
| Level | Criteria |
|
|
123
|
+
|--------|----------|
|
|
124
|
+
| 0 | No priority attributes. |
|
|
125
|
+
| 1 | `loading="lazy"` on all below-the-fold images. |
|
|
126
|
+
| 2 | `fetchpriority="high"` on the LCP element. |
|
|
127
|
+
| 3 | Documented priority strategy with optimized preload ordering. |
|
|
128
|
+
| 4 | Automated LCP analysis in CI deriving priorities. |
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
# Grid - JavaScript Engine & Runtime JSC
|
|
2
|
+
|
|
3
|
+
Category 3 · 9 questions (PF-10 to PF-18).
|
|
4
|
+
|
|
5
|
+
## Table of contents
|
|
6
|
+
|
|
7
|
+
- [PF-10 - Monomorphism, JSC Structures and inline caches](#pf-10--monomorphism-jsc-structures-and-inline-caches--criticality-must)
|
|
8
|
+
- [PF-11 - NaN-boxing and JSC value representation](#pf-11--nan-boxing-and-jsc-value-representation--criticality-should)
|
|
9
|
+
- [PF-12 - JSC compilation tiers (LLInt → Baseline → DFG → FTL)](#pf-12--jsc-compilation-tiers-llint--baseline--dfg--ftl--criticality-should)
|
|
10
|
+
- [PF-13 - Deoptimization and JSC bailouts](#pf-13--deoptimization-and-jsc-bailouts--criticality-must)
|
|
11
|
+
- [PF-14 - Functions, closures and call cost](#pf-14--functions-closures-and-call-cost--criticality-should)
|
|
12
|
+
- [PF-15 - Arrays and JSC internal representation](#pf-15--arrays-and-jsc-internal-representation--criticality-should)
|
|
13
|
+
- [PF-16 - Strings, RegExp and AtomStringTable](#pf-16--strings-regexp-and-atomstringtable--criticality-could)
|
|
14
|
+
- [PF-17 - Event loop, microtasks and scheduling](#pf-17--event-loop-microtasks-and-scheduling--criticality-must)
|
|
15
|
+
- [PF-18 - Weak references and memory cache management](#pf-18--weak-references-and-memory-cache-management--criticality-could)
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
### PF-10 - Monomorphism, JSC Structures and inline caches · Criticality: **MUST**
|
|
20
|
+
|
|
21
|
+
**Analyze:** Object shape consistency, call-site polymorphism, use of `delete`
|
|
22
|
+
|
|
23
|
+
**Verification commands:**
|
|
24
|
+
```bash
|
|
25
|
+
# Use of delete (breaks JSC Structures)
|
|
26
|
+
grep -rn "\bdelete\b " . --include="*.ts" --include="*.js" --include="*.vue" 2>/dev/null | grep -v node_modules | grep -v test | head -10
|
|
27
|
+
# Objects with variable shapes
|
|
28
|
+
grep -rn "Object\.assign\|{\.\.\.obj}" . --include="*.ts" --include="*.js" 2>/dev/null | grep -v node_modules | grep -v test | head -10
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
**Check:**
|
|
32
|
+
- Consistent constructors (same properties, same order)
|
|
33
|
+
- No `delete` on hot paths (use `obj.prop = undefined`)
|
|
34
|
+
- Monomorphic call sites (always the same type passed)
|
|
35
|
+
- ≤ 3 inline properties for critical objects (beyond that → butterfly allocation)
|
|
36
|
+
|
|
37
|
+
**Levels:**
|
|
38
|
+
| Level | Criteria |
|
|
39
|
+
|--------|----------|
|
|
40
|
+
| 0 | Objects created with different shapes, `delete` used. |
|
|
41
|
+
| 1 | Consistent constructors, no `delete` on hot paths. |
|
|
42
|
+
| 2 | Monomorphism verified, ≤ 3 inline properties for critical objects. |
|
|
43
|
+
| 3 | Zero megamorphism in profiling, stable Structure watchpoints. |
|
|
44
|
+
| 4 | IC hit rate > 99%, butterfly allocations minimized. |
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
### PF-11 - NaN-boxing and JSC value representation · Criticality: **SHOULD**
|
|
49
|
+
|
|
50
|
+
**Analyze:** Numeric type consistency, int32 overflow, boxing/unboxing
|
|
51
|
+
|
|
52
|
+
**Verification commands:**
|
|
53
|
+
```bash
|
|
54
|
+
# Mixed numeric types
|
|
55
|
+
grep -rn "Math\.imul\|Math\.fround\|>>>.*0\|\\|0" . --include="*.ts" --include="*.js" 2>/dev/null | grep -v node_modules | head -5
|
|
56
|
+
# parseInt / parseFloat patterns
|
|
57
|
+
grep -rn "parseInt\|parseFloat\|Number(" . --include="*.ts" --include="*.js" 2>/dev/null | grep -v node_modules | grep -v test | head -10
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
**Check:**
|
|
61
|
+
- Consistent numeric types on the hot path (all int32 or all double)
|
|
62
|
+
- No uncontrolled int32 overflow (→ double conversion → deopt)
|
|
63
|
+
- `Math.imul()` for critical int32 multiplications
|
|
64
|
+
- No unnecessary boxing/unboxing
|
|
65
|
+
|
|
66
|
+
**Levels:**
|
|
67
|
+
| Level | Criteria |
|
|
68
|
+
|--------|----------|
|
|
69
|
+
| 0 | No awareness of boxing, mixed numeric types. |
|
|
70
|
+
| 1 | Consistent numeric types (all int or all float). |
|
|
71
|
+
| 2 | Hot path verified int32, no uncontrolled overflow. |
|
|
72
|
+
| 3 | `Math.imul()` used for critical int32 multiplications. |
|
|
73
|
+
| 4 | Zero unnecessary boxing/unboxing in JIT profiling. |
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
### PF-12 - JSC compilation tiers (LLInt → Baseline → DFG → FTL) · Criticality: **SHOULD**
|
|
78
|
+
|
|
79
|
+
**Analyze:** Warm-up of critical functions, hot function size, inlining
|
|
80
|
+
|
|
81
|
+
**Verification commands:**
|
|
82
|
+
```bash
|
|
83
|
+
# Long functions (risk of non-inlining if > 100 bytecodes)
|
|
84
|
+
grep -rn "function\|=>" . --include="*.ts" --include="*.js" 2>/dev/null | grep -v node_modules | grep -v test | head -10
|
|
85
|
+
# Warm-up patterns
|
|
86
|
+
grep -ri "warm.up\|preheat\|prefetch\|pre.compile" . --include="*.ts" --include="*.js" 2>/dev/null | grep -v node_modules | head -5
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
**Check:**
|
|
90
|
+
- Hot-path functions identified and < 100 bytecodes (DFG inlining threshold)
|
|
91
|
+
- Warm-up of critical functions during loading (before the first paint)
|
|
92
|
+
- Awareness of compilation tiers (LLInt → Baseline → DFG → FTL)
|
|
93
|
+
- FTL reached on the critical path before the first render
|
|
94
|
+
|
|
95
|
+
**Levels:**
|
|
96
|
+
| Level | Criteria |
|
|
97
|
+
|--------|----------|
|
|
98
|
+
| 0 | No knowledge of the JIT, no warm-up. |
|
|
99
|
+
| 1 | Awareness of tiers, hot-path functions identified. |
|
|
100
|
+
| 2 | Warm-up of critical functions during loading, hot functions < 100 bytecodes. |
|
|
101
|
+
| 3 | FTL reached on critical path before first paint. |
|
|
102
|
+
| 4 | Systematic JIT profiling, zero hot function in Baseline at render time. |
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
### PF-13 - Deoptimization and JSC bailouts · Criticality: **MUST**
|
|
107
|
+
|
|
108
|
+
**Analyze:** Type stability, OSR exits, bailouts, branch prediction
|
|
109
|
+
|
|
110
|
+
**Verification commands:**
|
|
111
|
+
```bash
|
|
112
|
+
# Unstable types (polymorphic functions)
|
|
113
|
+
grep -rn "typeof\|instanceof" . --include="*.ts" --include="*.js" 2>/dev/null | grep -v node_modules | grep -v test | head -10
|
|
114
|
+
# Patterns that break type guards
|
|
115
|
+
grep -rn "arguments\b\|eval(" . --include="*.ts" --include="*.js" 2>/dev/null | grep -v node_modules | grep -v test | head -5
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
**Check:**
|
|
119
|
+
- Stable types on the hot path (no dynamic type switching)
|
|
120
|
+
- No `delete`, no array holes, no `arguments` object
|
|
121
|
+
- Zero bailout on the critical path
|
|
122
|
+
- Guaranteed monomorphism for perfect CPU branch prediction
|
|
123
|
+
|
|
124
|
+
**Levels:**
|
|
125
|
+
| Level | Criteria |
|
|
126
|
+
|--------|----------|
|
|
127
|
+
| 0 | Unstable types, frequent undetected bailouts. |
|
|
128
|
+
| 1 | Stable types on the hot path, no `delete`, no holes. |
|
|
129
|
+
| 2 | Zero bailout on the critical path. |
|
|
130
|
+
| 3 | Guaranteed monomorphism across the whole hot path. |
|
|
131
|
+
| 4 | JIT profiling in CI, deopt budget = 0 on the critical render path. |
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
### PF-14 - Functions, closures and call cost · Criticality: **SHOULD**
|
|
136
|
+
|
|
137
|
+
**Analyze:** Arrow functions in loops, closures capturing variables, `.bind()`, `.call()`, `.apply()`
|
|
138
|
+
|
|
139
|
+
**Verification commands:**
|
|
140
|
+
```bash
|
|
141
|
+
# Arrow functions in forEach/map (allocation per iteration)
|
|
142
|
+
grep -rn "\.forEach(\|\.map(\|\.filter(" . --include="*.ts" --include="*.js" 2>/dev/null | grep "=>" | grep -v node_modules | grep -v test | head -10
|
|
143
|
+
# eval and Function constructor
|
|
144
|
+
grep -rn "\beval(\|new Function(" . --include="*.ts" --include="*.js" 2>/dev/null | grep -v node_modules | head -5
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
**Check:**
|
|
148
|
+
- Named function reference passed to iterators (no inline arrow)
|
|
149
|
+
- Closures audited, `.bind()` once only (not inside a render loop)
|
|
150
|
+
- No `eval()` or `new Function()` (prevents inlining)
|
|
151
|
+
- Inlining verified on critical call sites
|
|
152
|
+
|
|
153
|
+
**Levels:**
|
|
154
|
+
| Level | Criteria |
|
|
155
|
+
|--------|----------|
|
|
156
|
+
| 0 | Arrow functions in loops, `eval()` present. |
|
|
157
|
+
| 1 | Named function reference passed to iterators. |
|
|
158
|
+
| 2 | Closures audited, bind once only. |
|
|
159
|
+
| 3 | Inlining verified on critical call sites. |
|
|
160
|
+
| 4 | Zero closure allocation on the hot path. |
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
### PF-15 - Arrays and JSC internal representation · Criticality: **SHOULD**
|
|
165
|
+
|
|
166
|
+
**Analyze:** Array homogeneity, sparse arrays, indexing type, TypedArrays
|
|
167
|
+
|
|
168
|
+
**Verification commands:**
|
|
169
|
+
```bash
|
|
170
|
+
# delete on an array index (→ ArrayStorage)
|
|
171
|
+
grep -rn "delete.*\[" . --include="*.ts" --include="*.js" 2>/dev/null | grep -v node_modules | grep -v test | head -5
|
|
172
|
+
# TypedArrays
|
|
173
|
+
grep -rn "Float32Array\|Int32Array\|Uint8Array\|ArrayBuffer" . --include="*.ts" --include="*.js" 2>/dev/null | grep -v node_modules | head -10
|
|
174
|
+
# Array preallocation
|
|
175
|
+
grep -rn "new Array(" . --include="*.ts" --include="*.js" 2>/dev/null | grep -v node_modules | head -5
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
**Check:**
|
|
179
|
+
- Homogeneous arrays (no mix of int/string/object)
|
|
180
|
+
- No holes, no `delete` on indices
|
|
181
|
+
- Pre-allocation for known sizes (`new Array(n)`)
|
|
182
|
+
- TypedArrays for intensive numeric data
|
|
183
|
+
|
|
184
|
+
**Levels:**
|
|
185
|
+
| Level | Criteria |
|
|
186
|
+
|--------|----------|
|
|
187
|
+
| 0 | Sparse arrays, mixed types, `delete` on indices. |
|
|
188
|
+
| 1 | Homogeneous arrays, no holes, no `delete`. |
|
|
189
|
+
| 2 | Indexing type verified Int32 or Double, pre-allocation for known sizes. |
|
|
190
|
+
| 3 | Zero array in ArrayStorage, `Array.prototype` unmodified. |
|
|
191
|
+
| 4 | Indexing-type transitions audited in CI, TypedArray across the whole hot path. |
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
### PF-16 - Strings, RegExp and AtomStringTable · Criticality: **COULD**
|
|
196
|
+
|
|
197
|
+
**Analyze:** Concatenation in loops, dangerous RegExp, JSON.parse vs literals
|
|
198
|
+
|
|
199
|
+
**Verification commands:**
|
|
200
|
+
```bash
|
|
201
|
+
# String concatenation in loops
|
|
202
|
+
grep -rn "+=" . --include="*.ts" --include="*.js" 2>/dev/null | grep -v node_modules | grep -v test | head -10
|
|
203
|
+
# RegExp with nested quantifiers (backtracking risk)
|
|
204
|
+
grep -rn "new RegExp\|/.*+.*+\|/.*\*.*\*" . --include="*.ts" --include="*.js" 2>/dev/null | grep -v node_modules | head -5
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
**Check:**
|
|
208
|
+
- `array.join()` instead of concatenation in a loop
|
|
209
|
+
- No nested quantifiers in RegExp (`(a+)+`)
|
|
210
|
+
- `JSON.parse()` for large static objects (faster than literals)
|
|
211
|
+
- Static (atomized) object keys rather than dynamic ones
|
|
212
|
+
|
|
213
|
+
**Levels:**
|
|
214
|
+
| Level | Criteria |
|
|
215
|
+
|--------|----------|
|
|
216
|
+
| 0 | Concatenation in loops, RegExp not audited. |
|
|
217
|
+
| 1 | `array.join` used, no nested quantifiers. |
|
|
218
|
+
| 2 | String representation understood, JSON.parse for large objects, RegExp compiled. |
|
|
219
|
+
| 3 | Zero unresolved rope on the hot path. |
|
|
220
|
+
| 4 | String allocation budget measured, RegExp profiled. |
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
### PF-17 - Event loop, microtasks and scheduling · Criticality: **MUST**
|
|
225
|
+
|
|
226
|
+
**Analyze:** Use of `requestAnimationFrame`, microtask starvation, frame budget, long tasks
|
|
227
|
+
|
|
228
|
+
**Verification commands:**
|
|
229
|
+
```bash
|
|
230
|
+
# setTimeout as a scheduler (anti-pattern)
|
|
231
|
+
grep -rn "setTimeout.*0\|setTimeout.*,\s*0" . --include="*.ts" --include="*.js" --include="*.vue" 2>/dev/null | grep -v node_modules | grep -v test | head -10
|
|
232
|
+
# requestAnimationFrame
|
|
233
|
+
grep -rn "requestAnimationFrame\|requestIdleCallback" . --include="*.ts" --include="*.js" 2>/dev/null | grep -v node_modules | head -5
|
|
234
|
+
# MessageChannel scheduler
|
|
235
|
+
grep -rn "MessageChannel\|scheduler\.postTask\|queueMicrotask" . --include="*.ts" --include="*.js" 2>/dev/null | grep -v node_modules | head -5
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
**Check:**
|
|
239
|
+
- `requestAnimationFrame` for DOM mutations
|
|
240
|
+
- `MessageChannel` as a scheduler (not `setTimeout(0)` → clamped to 4ms)
|
|
241
|
+
- JS frame budget < 6ms (16.67ms total @60fps)
|
|
242
|
+
- No microtask starvation (Promise cascade blocking the paint)
|
|
243
|
+
- Zero long task > 50ms
|
|
244
|
+
|
|
245
|
+
**Levels:**
|
|
246
|
+
| Level | Criteria |
|
|
247
|
+
|--------|----------|
|
|
248
|
+
| 0 | Microtask starvation, `setTimeout` as a scheduler. |
|
|
249
|
+
| 1 | `requestAnimationFrame` used for DOM mutations. |
|
|
250
|
+
| 2 | JS frame budget < 6ms, `MessageChannel` for scheduling. |
|
|
251
|
+
| 3 | `scheduler.postTask()` where available, zero microtask starvation. |
|
|
252
|
+
| 4 | Total frame budget < 10ms, zero long task > 50ms. |
|
|
253
|
+
|
|
254
|
+
---
|
|
255
|
+
|
|
256
|
+
### PF-18 - Weak references and memory cache management · Criticality: **COULD**
|
|
257
|
+
|
|
258
|
+
**Analyze:** Use of `WeakMap`/`WeakSet`/`WeakRef`/`FinalizationRegistry`, caches without eviction
|
|
259
|
+
|
|
260
|
+
**Verification commands:**
|
|
261
|
+
```bash
|
|
262
|
+
grep -rn "WeakMap\|WeakSet\|WeakRef\|FinalizationRegistry" . --include="*.ts" --include="*.js" 2>/dev/null | grep -v node_modules | head -10
|
|
263
|
+
# Map/Set as a cache without eviction (potential leak)
|
|
264
|
+
grep -rn "new Map()\|new Set()" . --include="*.ts" --include="*.js" 2>/dev/null | grep -v node_modules | grep -v test | head -10
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
**Check:**
|
|
268
|
+
- `WeakMap` for object-keyed caches
|
|
269
|
+
- `WeakRef` for heavy-data caches with a fallback
|
|
270
|
+
- `FinalizationRegistry` for native resources (WebGL textures)
|
|
271
|
+
- No `Map`/`Set` used as a cache without an eviction policy
|
|
272
|
+
|
|
273
|
+
**Levels:**
|
|
274
|
+
| Level | Criteria |
|
|
275
|
+
|--------|----------|
|
|
276
|
+
| 0 | Map/Set as a cache without eviction, no cleanup. |
|
|
277
|
+
| 1 | WeakMap used for object-keyed caches. |
|
|
278
|
+
| 2 | WeakRef for heavy-data caches with a fallback. |
|
|
279
|
+
| 3 | FinalizationRegistry for native resources. |
|
|
280
|
+
| 4 | Zero cache-related memory leak, cache hit rate monitored. |
|