novahiz 0.2.2 → 0.2.5
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/NOTICE.md +25 -15
- package/README.md +353 -355
- package/adapters/README.md +1 -1
- package/adapters/opencode/agent/novahiz.md +1 -2
- package/adapters/opencode/commands/novahiz-init.md +10 -0
- package/adapters/opencode/instructions.md +1 -1
- package/adapters/opencode/novahiz.ts +182 -4
- package/bin/novahiz.cmd +2 -2
- package/catalog/categories.json +1085 -1093
- package/catalog/overrides.json +12 -13
- package/catalog/providers.json +18 -34
- package/catalog/rules.json +15 -22
- package/docs/ARCHITECTURE.md +2 -2
- package/docs/CATALOG.md +7 -6
- package/docs/CONFIGURATION.md +5 -5
- package/docs/CONSTITUTION.md +4 -4
- package/docs/GATE.md +7 -11
- package/docs/HARNESSES.md +11 -0
- package/docs/INSTALL.md +7 -5
- package/docs/PLUGIN.md +24 -6
- package/docs/PROVIDERS.md +12 -10
- package/docs/ROADMAPS.md +4 -3
- package/docs/RULES.md +11 -10
- package/install/bootstrap.mjs +9 -19
- package/install/install.mjs +23 -41
- package/mcp/novahiz-tools/index.mjs +35 -6
- package/novahiz.config.example.json +1 -5
- package/package.json +6 -7
- package/skills/apple-ui-audit/SKILL.md +95 -0
- package/skills/apple-ui-audit/references/screen-walkthrough.md +29 -0
- package/skills/browser-session/SKILL.md +61 -0
- package/skills/browser-session/references/session-run-sheet.md +30 -0
- package/skills/browser-session/scripts/browser_session_preflight.mjs +74 -0
- package/skills/browser-session/scripts/sample-run.json +5 -0
- package/skills/code-standards/SKILL.md +85 -0
- package/skills/code-standards/references/pr-review-worksheet.md +35 -0
- package/skills/design-token-pipeline/SKILL.md +85 -0
- package/skills/design-token-pipeline/references/dtcg-sample.json +37 -0
- package/skills/llm-threat-review/SKILL.md +99 -0
- package/skills/llm-threat-review/references/review-worksheet.md +34 -0
- package/skills/llm-threat-review/scripts/llm_risk_lint.mjs +105 -0
- package/skills/novahiz-audit/SKILL.md +1 -1
- package/skills/novahiz-gate/SKILL.md +7 -6
- package/skills/novahiz-humanizer/SKILL.md +1 -1
- package/skills/novahiz-implement/SKILL.md +1 -1
- package/skills/novahiz-init/SKILL.md +112 -0
- package/skills/novahiz-planner/SKILL.md +1 -2
- package/skills/openapi-mcp-server/SKILL.md +76 -0
- package/skills/openapi-mcp-server/references/mcp-ship-checklist.md +30 -0
- package/skills/openapi-mcp-server/references/tool-worksheet.md +30 -0
- package/skills/openapi-mcp-server/scripts/openapi_mcp_lint.mjs +133 -0
- package/skills/package-risk-audit/SKILL.md +83 -0
- package/skills/package-risk-audit/references/intake-worksheet.md +19 -0
- package/skills/package-risk-audit/scripts/dep_risk_lint.mjs +131 -0
- package/skills/secrets-hygiene/SKILL.md +62 -0
- package/skills/secrets-hygiene/references/rotation-playbook.md +27 -0
- package/skills/secrets-hygiene/scripts/secret_scan.mjs +120 -0
- package/skills/skill-authoring/SKILL.md +93 -0
- package/skills/skill-authoring/references/skill-template.md +59 -0
- package/skills/skill-authoring/scripts/skill_frontmatter_lint.mjs +65 -0
- package/skills/skill-eval-loop/SKILL.md +103 -0
- package/skills/skill-eval-loop/references/negative-patterns.md +12 -0
- package/skills/skill-eval-loop/references/run-sheet.md +40 -0
- package/skills/skill-eval-loop/scripts/skill_structure_check.mjs +100 -0
- package/skills/ui-craft-rules/SKILL.md +96 -0
- package/skills/ui-slop-remover/SKILL.md +110 -0
- package/skills/ui-slop-remover/references/tell-catalogue.md +58 -0
- package/skills/ui-slop-remover/scripts/slop_lint.mjs +119 -0
- package/src/autodocs.ts +192 -0
- package/src/cli.ts +8 -1
- package/src/commands/autodocs.ts +250 -0
- package/src/commands/doctor.ts +226 -217
- package/src/commands/gate.ts +16 -5
- package/src/commands/init.ts +356 -0
- package/src/commands/task.ts +20 -7
- package/src/gate.ts +401 -401
- package/src/ledger.ts +39 -0
- package/src/targets.ts +43 -7
- package/bundled-skills/ab-testing/SKILL.md +0 -353
- package/bundled-skills/ab-testing/evals/evals.json +0 -105
- package/bundled-skills/ab-testing/references/sample-size-guide.md +0 -263
- package/bundled-skills/ab-testing/references/test-templates.md +0 -277
- package/bundled-skills/ad-creative/SKILL.md +0 -425
- package/bundled-skills/ad-creative/assets/creative-review-template.html +0 -400
- package/bundled-skills/ad-creative/evals/evals.json +0 -217
- package/bundled-skills/ad-creative/references/creative-review-page.md +0 -106
- package/bundled-skills/ad-creative/references/creative-roadmap.md +0 -118
- package/bundled-skills/ad-creative/references/generative-tools.md +0 -637
- package/bundled-skills/ad-creative/references/hook-system.md +0 -115
- package/bundled-skills/ad-creative/references/imessage-video-ads.md +0 -201
- package/bundled-skills/ad-creative/references/meta-creative-formats.md +0 -114
- package/bundled-skills/ad-creative/references/motion-video-ads.md +0 -126
- package/bundled-skills/ad-creative/references/platform-specs.md +0 -213
- package/bundled-skills/ad-creative/references/short-form-video-specs.md +0 -213
- package/bundled-skills/ad-creative/references/static-ad-templates.md +0 -308
- package/bundled-skills/ads/SKILL.md +0 -499
- package/bundled-skills/ads/evals/evals.json +0 -157
- package/bundled-skills/ads/references/abm-playbook.md +0 -93
- package/bundled-skills/ads/references/ad-copy-templates.md +0 -207
- package/bundled-skills/ads/references/audience-targeting.md +0 -243
- package/bundled-skills/ads/references/audit-guardrails.md +0 -83
- package/bundled-skills/ads/references/b2b-paid-playbook.md +0 -115
- package/bundled-skills/ads/references/conversion-tracking.md +0 -361
- package/bundled-skills/ads/references/creative-research-automation.md +0 -103
- package/bundled-skills/ads/references/google-ads-audit-checklist.md +0 -84
- package/bundled-skills/ads/references/google-search-playbook.md +0 -120
- package/bundled-skills/ads/references/linkedin-b2b-playbook.md +0 -107
- package/bundled-skills/ads/references/meta-decision-system.md +0 -176
- package/bundled-skills/ads/references/payback-period.md +0 -69
- package/bundled-skills/ads/references/platform-setup-checklists.md +0 -277
- package/bundled-skills/ads/references/rsa-output-spec.md +0 -88
- package/bundled-skills/agent-device/SKILL.md +0 -20
- package/bundled-skills/ai-seo/SKILL.md +0 -488
- package/bundled-skills/ai-seo/evals/evals.json +0 -135
- package/bundled-skills/ai-seo/references/agent-readiness.md +0 -57
- package/bundled-skills/ai-seo/references/citations-vs-recommendations.md +0 -85
- package/bundled-skills/ai-seo/references/content-patterns.md +0 -287
- package/bundled-skills/ai-seo/references/content-types.md +0 -71
- package/bundled-skills/ai-seo/references/format-volatility.md +0 -98
- package/bundled-skills/ai-seo/references/okf.md +0 -104
- package/bundled-skills/ai-seo/references/platform-ranking-factors.md +0 -154
- package/bundled-skills/ai-seo/references/youtube-ai-citations.md +0 -60
- package/bundled-skills/analytics/SKILL.md +0 -310
- package/bundled-skills/analytics/evals/evals.json +0 -90
- package/bundled-skills/analytics/references/event-library.md +0 -260
- package/bundled-skills/analytics/references/ga4-implementation.md +0 -300
- package/bundled-skills/analytics/references/gtm-implementation.md +0 -390
- package/bundled-skills/android-emulator/SKILL.md +0 -32
- package/bundled-skills/android-reverse-engineering/LICENSE +0 -190
- package/bundled-skills/android-reverse-engineering/SKILL.md +0 -313
- package/bundled-skills/android-reverse-engineering/references/api-extraction-patterns.md +0 -197
- package/bundled-skills/android-reverse-engineering/references/call-flow-analysis.md +0 -210
- package/bundled-skills/android-reverse-engineering/references/fernflower-usage.md +0 -115
- package/bundled-skills/android-reverse-engineering/references/jadx-usage.md +0 -116
- package/bundled-skills/android-reverse-engineering/references/kotlin-name-recovery.md +0 -108
- package/bundled-skills/android-reverse-engineering/references/setup-guide.md +0 -221
- package/bundled-skills/android-reverse-engineering/references/third_party_hosts.txt +0 -122
- package/bundled-skills/android-reverse-engineering/scripts/check-deps.ps1 +0 -165
- package/bundled-skills/android-reverse-engineering/scripts/check-deps.sh +0 -129
- package/bundled-skills/android-reverse-engineering/scripts/decompile.ps1 +0 -400
- package/bundled-skills/android-reverse-engineering/scripts/decompile.sh +0 -578
- package/bundled-skills/android-reverse-engineering/scripts/find-api-calls.ps1 +0 -121
- package/bundled-skills/android-reverse-engineering/scripts/find-api-calls.sh +0 -339
- package/bundled-skills/android-reverse-engineering/scripts/fingerprint.sh +0 -241
- package/bundled-skills/android-reverse-engineering/scripts/install-dep.ps1 +0 -345
- package/bundled-skills/android-reverse-engineering/scripts/install-dep.sh +0 -448
- package/bundled-skills/android-reverse-engineering/scripts/lookup-name.sh +0 -85
- package/bundled-skills/android-reverse-engineering/scripts/recover-kotlin-names.sh +0 -140
- package/bundled-skills/build-graph/SKILL.md +0 -38
- package/bundled-skills/claude-history-ingest/SKILL.md +0 -463
- package/bundled-skills/claude-history-ingest/references/claude-data-format.md +0 -118
- package/bundled-skills/codex-history-ingest/SKILL.md +0 -248
- package/bundled-skills/codex-history-ingest/references/codex-data-format.md +0 -82
- package/bundled-skills/cold-email/SKILL.md +0 -159
- package/bundled-skills/cold-email/evals/evals.json +0 -94
- package/bundled-skills/cold-email/references/benchmarks.md +0 -83
- package/bundled-skills/cold-email/references/follow-up-sequences.md +0 -81
- package/bundled-skills/cold-email/references/frameworks.md +0 -90
- package/bundled-skills/cold-email/references/personalization.md +0 -79
- package/bundled-skills/cold-email/references/subject-lines.md +0 -53
- package/bundled-skills/competitor-profiling/SKILL.md +0 -415
- package/bundled-skills/competitor-profiling/evals/evals.json +0 -85
- package/bundled-skills/competitor-profiling/references/templates.md +0 -167
- package/bundled-skills/competitor-profiling/references/tool-reference.md +0 -179
- package/bundled-skills/computer-use/SKILL.md +0 -41
- package/bundled-skills/content-strategy/SKILL.md +0 -439
- package/bundled-skills/content-strategy/evals/evals.json +0 -116
- package/bundled-skills/content-strategy/references/content-distribution.md +0 -83
- package/bundled-skills/content-strategy/references/headless-cms.md +0 -194
- package/bundled-skills/copilot-history-ingest/SKILL.md +0 -376
- package/bundled-skills/copilot-history-ingest/references/copilot-data-format.md +0 -321
- package/bundled-skills/copy-editing/SKILL.md +0 -457
- package/bundled-skills/copy-editing/evals/evals.json +0 -89
- package/bundled-skills/copy-editing/references/checklist.md +0 -66
- package/bundled-skills/copy-editing/references/content-refresh.md +0 -38
- package/bundled-skills/copy-editing/references/plain-english-alternatives.md +0 -394
- package/bundled-skills/copywriting/SKILL.md +0 -256
- package/bundled-skills/copywriting/evals/evals.json +0 -126
- package/bundled-skills/copywriting/references/copy-frameworks.md +0 -433
- package/bundled-skills/copywriting/references/natural-transitions.md +0 -272
- package/bundled-skills/cro/SKILL.md +0 -187
- package/bundled-skills/cro/evals/evals.json +0 -111
- package/bundled-skills/cro/references/experiments.md +0 -248
- package/bundled-skills/cro/references/form.md +0 -422
- package/bundled-skills/cross-linker/SKILL.md +0 -309
- package/bundled-skills/customer-research/SKILL.md +0 -305
- package/bundled-skills/customer-research/evals/evals.json +0 -176
- package/bundled-skills/customer-research/references/interviews-and-surveys.md +0 -155
- package/bundled-skills/customer-research/references/source-guides.md +0 -401
- package/bundled-skills/daily-update/SKILL.md +0 -223
- package/bundled-skills/dart-add-unit-test/SKILL.md +0 -122
- package/bundled-skills/dart-build-cli-app/SKILL.md +0 -185
- package/bundled-skills/dart-collect-coverage/SKILL.md +0 -141
- package/bundled-skills/dart-fix-runtime-errors/SKILL.md +0 -166
- package/bundled-skills/dart-generate-test-mocks/SKILL.md +0 -155
- package/bundled-skills/dart-migrate-to-checks-package/SKILL.md +0 -528
- package/bundled-skills/dart-resolve-package-conflicts/SKILL.md +0 -116
- package/bundled-skills/dart-run-static-analysis/SKILL.md +0 -104
- package/bundled-skills/dart-setup-ffi-assets/SKILL.md +0 -419
- package/bundled-skills/dart-use-doc-examples/SKILL.md +0 -96
- package/bundled-skills/dart-use-ffigen/SKILL.md +0 -218
- package/bundled-skills/dart-use-pattern-matching/SKILL.md +0 -146
- package/bundled-skills/dart-use-primary-constructors/SKILL.md +0 -262
- package/bundled-skills/dart-write-documentation/SKILL.md +0 -136
- package/bundled-skills/debug-issue/SKILL.md +0 -28
- package/bundled-skills/dogfood/SKILL.md +0 -27
- package/bundled-skills/eas-app-stores/SKILL.md +0 -176
- package/bundled-skills/eas-app-stores/agents/openai.yaml +0 -4
- package/bundled-skills/eas-app-stores/references/app-store-metadata.md +0 -497
- package/bundled-skills/eas-app-stores/references/ios-app-store.md +0 -376
- package/bundled-skills/eas-app-stores/references/native-ios.md +0 -167
- package/bundled-skills/eas-app-stores/references/play-store.md +0 -244
- package/bundled-skills/eas-app-stores/references/testflight.md +0 -62
- package/bundled-skills/eas-app-stores/references/workflows.md +0 -120
- package/bundled-skills/eas-hosting/SKILL.md +0 -431
- package/bundled-skills/eas-hosting/agents/openai.yaml +0 -4
- package/bundled-skills/eas-observe/SKILL.md +0 -54
- package/bundled-skills/eas-observe/agents/openai.yaml +0 -4
- package/bundled-skills/eas-observe/references/metrics.md +0 -98
- package/bundled-skills/eas-observe/references/queries.md +0 -403
- package/bundled-skills/eas-observe/references/setup.md +0 -476
- package/bundled-skills/eas-observe/references/third-party.md +0 -136
- package/bundled-skills/eas-simulator/SKILL.md +0 -208
- package/bundled-skills/eas-simulator/agents/openai.yaml +0 -4
- package/bundled-skills/eas-simulator/references/controllers.md +0 -106
- package/bundled-skills/eas-simulator/references/run-your-app.md +0 -224
- package/bundled-skills/eas-simulator/references/troubleshooting.md +0 -44
- package/bundled-skills/eas-update/SKILL.md +0 -146
- package/bundled-skills/eas-update/agents/openai.yaml +0 -4
- package/bundled-skills/eas-update-insights/SKILL.md +0 -238
- package/bundled-skills/eas-update-insights/agents/openai.yaml +0 -4
- package/bundled-skills/eas-update-insights/references/channel-insights-schema.md +0 -47
- package/bundled-skills/eas-update-insights/references/update-insights-schema.md +0 -69
- package/bundled-skills/eas-workflows/SKILL.md +0 -99
- package/bundled-skills/eas-workflows/agents/openai.yaml +0 -4
- package/bundled-skills/eas-workflows/scripts/fetch.js +0 -109
- package/bundled-skills/eas-workflows/scripts/package.json +0 -6
- package/bundled-skills/emails/SKILL.md +0 -311
- package/bundled-skills/emails/evals/evals.json +0 -93
- package/bundled-skills/emails/references/copy-guidelines.md +0 -113
- package/bundled-skills/emails/references/email-types.md +0 -515
- package/bundled-skills/emails/references/sequence-templates.md +0 -168
- package/bundled-skills/explore-codebase/SKILL.md +0 -29
- package/bundled-skills/expo-animation/LICENSE +0 -21
- package/bundled-skills/expo-animation/RECIPES.md +0 -385
- package/bundled-skills/expo-animation/SKILL.md +0 -267
- package/bundled-skills/expo-animation/agents/openai.yaml +0 -4
- package/bundled-skills/expo-app-clip/SKILL.md +0 -290
- package/bundled-skills/expo-app-clip/agents/openai.yaml +0 -4
- package/bundled-skills/expo-app-clip/references/native-module.md +0 -96
- package/bundled-skills/expo-brownfield/SKILL.md +0 -62
- package/bundled-skills/expo-brownfield/agents/openai.yaml +0 -4
- package/bundled-skills/expo-brownfield/references/brownfield-integrated.md +0 -526
- package/bundled-skills/expo-brownfield/references/brownfield-isolated.md +0 -451
- package/bundled-skills/expo-brownfield/references/comparison.md +0 -63
- package/bundled-skills/expo-brownfield/references/troubleshooting.md +0 -88
- package/bundled-skills/expo-data-fetching/SKILL.md +0 -478
- package/bundled-skills/expo-data-fetching/agents/openai.yaml +0 -4
- package/bundled-skills/expo-data-fetching/references/expo-router-loaders.md +0 -341
- package/bundled-skills/expo-data-fetching/references/offline-and-cancellation.md +0 -68
- package/bundled-skills/expo-design-system/SKILL.md +0 -376
- package/bundled-skills/expo-design-system/agents/openai.yaml +0 -4
- package/bundled-skills/expo-design-system/references/audit.md +0 -190
- package/bundled-skills/expo-design-system/references/native-slop.md +0 -74
- package/bundled-skills/expo-dev-client/SKILL.md +0 -182
- package/bundled-skills/expo-dev-client/agents/openai.yaml +0 -4
- package/bundled-skills/expo-dom/SKILL.md +0 -425
- package/bundled-skills/expo-dom/agents/openai.yaml +0 -4
- package/bundled-skills/expo-examples/SKILL.md +0 -106
- package/bundled-skills/expo-examples/agents/openai.yaml +0 -4
- package/bundled-skills/expo-examples/references/catalog.md +0 -105
- package/bundled-skills/expo-migrate-module/SKILL.md +0 -113
- package/bundled-skills/expo-migrate-module/agents/openai.yaml +0 -4
- package/bundled-skills/expo-migrate-module/references/compatibility.md +0 -73
- package/bundled-skills/expo-migrate-module/references/example.md +0 -212
- package/bundled-skills/expo-migrate-module/references/migration-map.md +0 -306
- package/bundled-skills/expo-module/SKILL.md +0 -151
- package/bundled-skills/expo-module/agents/openai.yaml +0 -4
- package/bundled-skills/expo-module/references/config-plugin.md +0 -90
- package/bundled-skills/expo-module/references/create-expo-module.md +0 -206
- package/bundled-skills/expo-module/references/lifecycle.md +0 -127
- package/bundled-skills/expo-module/references/module-config.md +0 -48
- package/bundled-skills/expo-module/references/native-module.md +0 -286
- package/bundled-skills/expo-module/references/native-view.md +0 -171
- package/bundled-skills/expo-native-ui/SKILL.md +0 -201
- package/bundled-skills/expo-native-ui/agents/openai.yaml +0 -4
- package/bundled-skills/expo-native-ui/references/controls.md +0 -231
- package/bundled-skills/expo-native-ui/references/gradients.md +0 -106
- package/bundled-skills/expo-native-ui/references/icons.md +0 -232
- package/bundled-skills/expo-native-ui/references/media.md +0 -193
- package/bundled-skills/expo-native-ui/references/storage.md +0 -121
- package/bundled-skills/expo-native-ui/references/visual-effects.md +0 -198
- package/bundled-skills/expo-native-ui/references/webgpu-three.md +0 -605
- package/bundled-skills/expo-overview/SKILL.md +0 -115
- package/bundled-skills/expo-overview/agents/openai.yaml +0 -4
- package/bundled-skills/expo-project-structure/SKILL.md +0 -114
- package/bundled-skills/expo-project-structure/agents/openai.yaml +0 -4
- package/bundled-skills/expo-router/SKILL.md +0 -240
- package/bundled-skills/expo-router/agents/openai.yaml +0 -4
- package/bundled-skills/expo-router/references/form-sheet.md +0 -253
- package/bundled-skills/expo-router/references/route-structure.md +0 -229
- package/bundled-skills/expo-router/references/search.md +0 -248
- package/bundled-skills/expo-router/references/tabs.md +0 -433
- package/bundled-skills/expo-router/references/toolbar-and-headers.md +0 -284
- package/bundled-skills/expo-router/references/zoom-transitions.md +0 -158
- package/bundled-skills/expo-skill-eval/SKILL.md +0 -314
- package/bundled-skills/expo-skill-eval/agents/visual-grader.md +0 -52
- package/bundled-skills/expo-skill-eval/references/design-rubric.md +0 -45
- package/bundled-skills/expo-skill-eval/references/runtime-matrix.md +0 -34
- package/bundled-skills/expo-skill-eval/scripts/check-static.sh +0 -64
- package/bundled-skills/expo-skill-eval/scripts/clean-fixture.sh +0 -56
- package/bundled-skills/expo-skill-eval/scripts/generate_viewer.py +0 -450
- package/bundled-skills/expo-skill-eval/scripts/latest-sdk.sh +0 -46
- package/bundled-skills/expo-skill-eval/scripts/make-fixture.sh +0 -95
- package/bundled-skills/expo-skill-eval/scripts/make-workspace.sh +0 -31
- package/bundled-skills/expo-skill-eval/scripts/snapshot-android.sh +0 -284
- package/bundled-skills/expo-skill-eval/scripts/snapshot-ios.sh +0 -132
- package/bundled-skills/expo-skill-eval/scripts/snapshot-web.sh +0 -61
- package/bundled-skills/expo-skill-feedback/SKILL.md +0 -87
- package/bundled-skills/expo-skill-feedback/agents/openai.yaml +0 -4
- package/bundled-skills/expo-skill-feedback/scripts/skill-event.cjs +0 -180
- package/bundled-skills/expo-skill-feedback/scripts/telemetry.cjs +0 -65
- package/bundled-skills/expo-skill-feedback/scripts/telemetry_common.cjs +0 -171
- package/bundled-skills/expo-ui/SKILL.md +0 -101
- package/bundled-skills/expo-ui/agents/openai.yaml +0 -4
- package/bundled-skills/expo-ui/references/drop-in-replacements.md +0 -27
- package/bundled-skills/expo-ui/references/jetpack-compose.md +0 -73
- package/bundled-skills/expo-ui/references/swift-ui.md +0 -73
- package/bundled-skills/expo-ui/references/universal.md +0 -104
- package/bundled-skills/expo-ui/scripts/list-components.js +0 -193
- package/bundled-skills/expo-upgrade/SKILL.md +0 -150
- package/bundled-skills/expo-upgrade/agents/openai.yaml +0 -4
- package/bundled-skills/expo-upgrade/references/expo-av-to-audio.md +0 -132
- package/bundled-skills/expo-upgrade/references/expo-av-to-video.md +0 -160
- package/bundled-skills/expo-upgrade/references/native-tabs.md +0 -124
- package/bundled-skills/expo-upgrade/references/new-architecture.md +0 -79
- package/bundled-skills/expo-upgrade/references/react-19.md +0 -79
- package/bundled-skills/expo-upgrade/references/react-compiler.md +0 -59
- package/bundled-skills/expo-upgrade/references/react-navigation-to-expo-router.md +0 -61
- package/bundled-skills/expo-web-to-native/SKILL.md +0 -91
- package/bundled-skills/expo-web-to-native/agents/openai.yaml +0 -4
- package/bundled-skills/expo-web-to-native/references/false-friends.md +0 -119
- package/bundled-skills/expo-web-to-native/references/native-patterns.md +0 -39
- package/bundled-skills/expo-web-to-native/references/run-as-goal.md +0 -48
- package/bundled-skills/expo-web-to-native/references/verify-on-device.md +0 -45
- package/bundled-skills/find-skills/SKILL.md +0 -141
- package/bundled-skills/flutter-add-integration-test/SKILL.md +0 -163
- package/bundled-skills/flutter-add-widget-preview/SKILL.md +0 -145
- package/bundled-skills/flutter-add-widget-test/SKILL.md +0 -154
- package/bundled-skills/flutter-apply-architecture-best-practices/SKILL.md +0 -162
- package/bundled-skills/flutter-build-responsive-layout/SKILL.md +0 -139
- package/bundled-skills/flutter-fix-layout-issues/SKILL.md +0 -130
- package/bundled-skills/flutter-implement-json-serialization/SKILL.md +0 -153
- package/bundled-skills/flutter-setup-declarative-routing/SKILL.md +0 -255
- package/bundled-skills/flutter-setup-localization/SKILL.md +0 -210
- package/bundled-skills/flutter-use-http-package/SKILL.md +0 -174
- package/bundled-skills/graph-colorize/SKILL.md +0 -180
- package/bundled-skills/hermes-history-ingest/SKILL.md +0 -239
- package/bundled-skills/hermes-history-ingest/references/hermes-data-format.md +0 -131
- package/bundled-skills/impl-validator/SKILL.md +0 -118
- package/bundled-skills/ios-simulator/SKILL.md +0 -32
- package/bundled-skills/json-canvas/SKILL.md +0 -244
- package/bundled-skills/json-canvas/references/EXAMPLES.md +0 -329
- package/bundled-skills/launch/SKILL.md +0 -381
- package/bundled-skills/launch/evals/evals.json +0 -106
- package/bundled-skills/llm-wiki/SKILL.md +0 -661
- package/bundled-skills/llm-wiki/references/WRITING.md +0 -28
- package/bundled-skills/llm-wiki/references/karpathy-pattern.md +0 -45
- package/bundled-skills/marketing-plan/SKILL.md +0 -300
- package/bundled-skills/marketing-plan/evals/evals.json +0 -112
- package/bundled-skills/marketing-plan/references/aarrr-framework.md +0 -180
- package/bundled-skills/marketing-plan/references/budget-planning.md +0 -168
- package/bundled-skills/marketing-plan/references/client-types.md +0 -373
- package/bundled-skills/marketing-plan/references/current-state-rubric.md +0 -255
- package/bundled-skills/marketing-plan/references/example-quietude.md +0 -972
- package/bundled-skills/marketing-plan/references/funding-stage-unlocks.md +0 -230
- package/bundled-skills/marketing-plan/references/growth-patterns.md +0 -190
- package/bundled-skills/marketing-plan/references/idea-cross-reference.md +0 -265
- package/bundled-skills/marketing-plan/references/measurement-framework.md +0 -213
- package/bundled-skills/marketing-plan/references/methodology.md +0 -363
- package/bundled-skills/marketing-plan/references/ops-stack-mapping.md +0 -197
- package/bundled-skills/marketing-plan/references/plan-template.md +0 -494
- package/bundled-skills/marketing-plan/references/team-and-agency-model.md +0 -278
- package/bundled-skills/marketing-psychology/SKILL.md +0 -455
- package/bundled-skills/marketing-psychology/evals/evals.json +0 -88
- package/bundled-skills/memory-bridge/SKILL.md +0 -163
- package/bundled-skills/memory-save/SKILL.md +0 -88
- package/bundled-skills/obsidian-bases/SKILL.md +0 -499
- package/bundled-skills/obsidian-bases/references/FUNCTIONS_REFERENCE.md +0 -173
- package/bundled-skills/obsidian-cli/SKILL.md +0 -106
- package/bundled-skills/obsidian-layout-adjustment/SKILL.md +0 -226
- package/bundled-skills/obsidian-layout-adjustment/evals/evals.json +0 -53
- package/bundled-skills/obsidian-layout-adjustment/references/workflow-reference.md +0 -212
- package/bundled-skills/obsidian-markdown/SKILL.md +0 -196
- package/bundled-skills/obsidian-markdown/references/CALLOUTS.md +0 -58
- package/bundled-skills/obsidian-markdown/references/EMBEDS.md +0 -70
- package/bundled-skills/obsidian-markdown/references/PROPERTIES.md +0 -61
- package/bundled-skills/offers/SKILL.md +0 -155
- package/bundled-skills/offers/evals/evals.json +0 -21
- package/bundled-skills/offers/references/bonus-stacking.md +0 -150
- package/bundled-skills/offers/references/examples.md +0 -215
- package/bundled-skills/offers/references/guarantee-design.md +0 -172
- package/bundled-skills/offers/references/offer-anatomy.md +0 -203
- package/bundled-skills/offers/references/offer-formats.md +0 -240
- package/bundled-skills/offers/references/saas-offers.md +0 -116
- package/bundled-skills/offers/references/scarcity-urgency.md +0 -175
- package/bundled-skills/offers/references/value-equation.md +0 -134
- package/bundled-skills/onboarding/SKILL.md +0 -261
- package/bundled-skills/onboarding/evals/evals.json +0 -108
- package/bundled-skills/onboarding/references/activation-models.md +0 -57
- package/bundled-skills/onboarding/references/experiments.md +0 -258
- package/bundled-skills/onboarding/references/minimum-path-to-value.md +0 -49
- package/bundled-skills/openclaw-history-ingest/SKILL.md +0 -257
- package/bundled-skills/openclaw-history-ingest/references/openclaw-data-format.md +0 -154
- package/bundled-skills/orchestration/SKILL.md +0 -69
- package/bundled-skills/pi-history-ingest/SKILL.md +0 -312
- package/bundled-skills/pricing/SKILL.md +0 -295
- package/bundled-skills/pricing/evals/evals.json +0 -119
- package/bundled-skills/pricing/references/pricing-models.md +0 -66
- package/bundled-skills/pricing/references/pricing-page-teardown.md +0 -85
- package/bundled-skills/pricing/references/research-methods.md +0 -152
- package/bundled-skills/pricing/references/tier-structure.md +0 -232
- package/bundled-skills/product-marketing/SKILL.md +0 -255
- package/bundled-skills/product-marketing/evals/evals.json +0 -98
- package/bundled-skills/prospecting/SKILL.md +0 -262
- package/bundled-skills/prospecting/evals/evals.json +0 -122
- package/bundled-skills/prospecting/references/b2b-prospecting.md +0 -106
- package/bundled-skills/prospecting/references/compliance.md +0 -123
- package/bundled-skills/prospecting/references/data-sources.md +0 -287
- package/bundled-skills/prospecting/references/demand-signals.md +0 -129
- package/bundled-skills/prospecting/references/local-prospecting.md +0 -165
- package/bundled-skills/prospecting/references/saas-prospecting.md +0 -123
- package/bundled-skills/refactor-safely/SKILL.md +0 -29
- package/bundled-skills/review-delta/SKILL.md +0 -46
- package/bundled-skills/review-pr/SKILL.md +0 -66
- package/bundled-skills/sales-enablement/SKILL.md +0 -359
- package/bundled-skills/sales-enablement/evals/evals.json +0 -91
- package/bundled-skills/sales-enablement/references/deck-frameworks.md +0 -263
- package/bundled-skills/sales-enablement/references/demo-scripts.md +0 -355
- package/bundled-skills/sales-enablement/references/objection-library.md +0 -270
- package/bundled-skills/sales-enablement/references/one-pager-templates.md +0 -208
- package/bundled-skills/seo-audit/SKILL.md +0 -499
- package/bundled-skills/seo-audit/evals/evals.json +0 -136
- package/bundled-skills/seo-audit/references/ai-writing-detection.md +0 -200
- package/bundled-skills/seo-audit/references/international-seo.md +0 -230
- package/bundled-skills/session-brain/SKILL.md +0 -101
- package/bundled-skills/session-search/SKILL.md +0 -97
- package/bundled-skills/social/SKILL.md +0 -413
- package/bundled-skills/social/evals/evals.json +0 -107
- package/bundled-skills/social/references/carousel-frameworks.md +0 -141
- package/bundled-skills/social/references/listening-sources-template.md +0 -123
- package/bundled-skills/social/references/listening.md +0 -283
- package/bundled-skills/social/references/platform-limits.md +0 -110
- package/bundled-skills/social/references/platforms.md +0 -170
- package/bundled-skills/social/references/post-templates.md +0 -179
- package/bundled-skills/social/references/reverse-engineering.md +0 -195
- package/bundled-skills/social/references/short-form-video.md +0 -237
- package/bundled-skills/tag-taxonomy/SKILL.md +0 -218
- package/bundled-skills/vault-skill-factory/SKILL.md +0 -143
- package/bundled-skills/video/SKILL.md +0 -346
- package/bundled-skills/video/evals/evals.json +0 -103
- package/bundled-skills/video/references/ai-video-prompting.md +0 -175
- package/bundled-skills/video/references/edit-anatomy.md +0 -84
- package/bundled-skills/wiki-agent/SKILL.md +0 -322
- package/bundled-skills/wiki-capture/SKILL.md +0 -337
- package/bundled-skills/wiki-capture/references/RAW-FORMAT.md +0 -115
- package/bundled-skills/wiki-context-pack/SKILL.md +0 -89
- package/bundled-skills/wiki-dashboard/SKILL.md +0 -472
- package/bundled-skills/wiki-dedup/SKILL.md +0 -320
- package/bundled-skills/wiki-digest/SKILL.md +0 -243
- package/bundled-skills/wiki-export/SKILL.md +0 -445
- package/bundled-skills/wiki-history-ingest/SKILL.md +0 -61
- package/bundled-skills/wiki-import/SKILL.md +0 -276
- package/bundled-skills/wiki-ingest/SKILL.md +0 -563
- package/bundled-skills/wiki-ingest/references/ingest-prompts.md +0 -54
- package/bundled-skills/wiki-ingest/references/pageindex.md +0 -72
- package/bundled-skills/wiki-ingest/references/url-sources.md +0 -295
- package/bundled-skills/wiki-lint/SKILL.md +0 -643
- package/bundled-skills/wiki-narrate/SKILL.md +0 -120
- package/bundled-skills/wiki-narrate/references/voices.md +0 -29
- package/bundled-skills/wiki-query/SKILL.md +0 -307
- package/bundled-skills/wiki-rebuild/SKILL.md +0 -212
- package/bundled-skills/wiki-research/SKILL.md +0 -319
- package/bundled-skills/wiki-setup/SKILL.md +0 -359
- package/bundled-skills/wiki-stage-commit/SKILL.md +0 -164
- package/bundled-skills/wiki-status/SKILL.md +0 -556
- package/bundled-skills/wiki-switch/SKILL.md +0 -115
- package/bundled-skills/wiki-synthesize/SKILL.md +0 -212
- package/bundled-skills/wiki-update/SKILL.md +0 -271
- package/skills/ai-security/SKILL.md +0 -132
- package/skills/ai-security/references/atlas-coverage.md +0 -60
- package/skills/ai-security/scripts/ai_threat_scanner.py +0 -373
- package/skills/anti-AI-design/SKILL.md +0 -72
- package/skills/apple-hig-audit/SKILL.md +0 -64
- package/skills/apple-hig-audit/references/accessibility.md +0 -78
- package/skills/apple-hig-audit/references/platform-specifics.md +0 -57
- package/skills/apple-hig-audit/references/visual-design.md +0 -68
- package/skills/apple-hig-audit/scripts/hig_checker.py +0 -115
- package/skills/apple-hig-audit/templates/hig-audit-template.md +0 -114
- package/skills/dependency-auditor/README.md +0 -98
- package/skills/dependency-auditor/SKILL.md +0 -114
- package/skills/dependency-auditor/assets/sample_go.mod +0 -53
- package/skills/dependency-auditor/assets/sample_package.json +0 -72
- package/skills/dependency-auditor/assets/sample_requirements.txt +0 -71
- package/skills/dependency-auditor/expected_outputs/sample_license_report.txt +0 -37
- package/skills/dependency-auditor/expected_outputs/sample_upgrade_plan.txt +0 -59
- package/skills/dependency-auditor/expected_outputs/sample_vulnerability_report.json +0 -71
- package/skills/dependency-auditor/references/dependency_management_best_practices.md +0 -46
- package/skills/dependency-auditor/references/license_compatibility_matrix.md +0 -57
- package/skills/dependency-auditor/references/vulnerability_assessment_guide.md +0 -62
- package/skills/dependency-auditor/scripts/dep_scanner.py +0 -595
- package/skills/dependency-auditor/scripts/license_checker.py +0 -442
- package/skills/dependency-auditor/scripts/upgrade_planner.py +0 -490
- package/skills/dependency-auditor/test-inventory.json +0 -421
- package/skills/dependency-auditor/test-project/package.json +0 -72
- package/skills/design-system-tokens/SKILL.md +0 -90
- package/skills/design-system-tokens/assets/design_system_doc_template.md +0 -129
- package/skills/design-system-tokens/references/component-architecture.md +0 -88
- package/skills/design-system-tokens/references/developer-handoff.md +0 -61
- package/skills/design-system-tokens/references/responsive-calculations.md +0 -72
- package/skills/design-system-tokens/references/token-generation.md +0 -62
- package/skills/design-system-tokens/scripts/design_token_generator.py +0 -315
- package/skills/engineering-code-standards/SKILL.md +0 -174
- package/skills/env-secrets-manager/SKILL.md +0 -102
- package/skills/env-secrets-manager/references/secret-patterns.md +0 -56
- package/skills/env-secrets-manager/references/validation-detection-rotation.md +0 -76
- package/skills/env-secrets-manager/scripts/env_auditor.py +0 -340
- package/skills/frontend-design-taste/SKILL.md +0 -62
- package/skills/mcp-server-builder/README.md +0 -42
- package/skills/mcp-server-builder/SKILL.md +0 -144
- package/skills/mcp-server-builder/references/openapi-extraction-guide.md +0 -34
- package/skills/mcp-server-builder/references/production-hardening-guide.md +0 -80
- package/skills/mcp-server-builder/references/python-server-template.md +0 -22
- package/skills/mcp-server-builder/references/spec-compatibility.md +0 -129
- package/skills/mcp-server-builder/references/typescript-server-template.md +0 -19
- package/skills/mcp-server-builder/references/validation-checklist.md +0 -30
- package/skills/mcp-server-builder/scripts/mcp_validator.py +0 -180
- package/skills/mcp-server-builder/scripts/openapi_to_mcp.py +0 -279
- package/skills/playwright-agent/SKILL.md +0 -147
- package/skills/skill-creator/LICENSE.txt +0 -14
- package/skills/skill-creator/SKILL.md +0 -471
- package/skills/skill-creator/agents/analyzer.md +0 -274
- package/skills/skill-creator/agents/comparator.md +0 -202
- package/skills/skill-creator/agents/grader.md +0 -223
- package/skills/skill-creator/assets/eval_review.html +0 -143
- package/skills/skill-creator/eval-viewer/generate_review.py +0 -471
- package/skills/skill-creator/eval-viewer/viewer.html +0 -1321
- package/skills/skill-creator/references/schemas.md +0 -430
- package/skills/skill-creator/scripts/__init__.py +0 -0
- package/skills/skill-creator/scripts/aggregate_benchmark.py +0 -401
- package/skills/skill-creator/scripts/generate_report.py +0 -322
- package/skills/skill-creator/scripts/improve_description.py +0 -247
- package/skills/skill-creator/scripts/package_skill.py +0 -136
- package/skills/skill-creator/scripts/quick_validate.py +0 -103
- package/skills/skill-creator/scripts/run_eval.py +0 -310
- package/skills/skill-creator/scripts/run_loop.py +0 -328
- package/skills/skill-creator/scripts/utils.py +0 -47
- package/skills/write-a-skill/SKILL.md +0 -111
- package/skills/write-a-skill/references/companion_tooling.md +0 -61
- package/skills/write-a-skill/references/description_design_patterns.md +0 -136
- package/skills/write-a-skill/references/progressive_disclosure_principles.md +0 -87
- package/skills/write-a-skill/references/quality_gates_for_skills.md +0 -158
- package/skills/write-a-skill/scripts/skill_description_validator.py +0 -241
- package/skills/write-a-skill/scripts/skill_review_checklist_runner.py +0 -257
- package/skills/write-a-skill/scripts/skill_structure_validator.py +0 -265
|
@@ -1,341 +0,0 @@
|
|
|
1
|
-
# Expo Router Data Loaders
|
|
2
|
-
|
|
3
|
-
Route-level data loading for web apps using Expo SDK 55+. Loaders are async functions exported from route files that load data before the route renders, following the Remix/React Router loader model.
|
|
4
|
-
|
|
5
|
-
**Dual execution model:**
|
|
6
|
-
|
|
7
|
-
- **Initial page load (SSR):** The loader runs server-side. Its return value is serialized as JSON and embedded in the HTML response.
|
|
8
|
-
- **Client-side navigation:** The browser fetches the loader data from the server via HTTP. The route renders once the data arrives.
|
|
9
|
-
|
|
10
|
-
You write one function and the framework manages when and how it executes.
|
|
11
|
-
|
|
12
|
-
## Configuration
|
|
13
|
-
|
|
14
|
-
**Requirements:** Expo SDK 55+, web output mode (`npx expo serve` or `npx expo export --platform web`) set in `app.json` or `app.config.js`.
|
|
15
|
-
|
|
16
|
-
**Server rendering:**
|
|
17
|
-
|
|
18
|
-
```json
|
|
19
|
-
{
|
|
20
|
-
"expo": {
|
|
21
|
-
"web": {
|
|
22
|
-
"output": "server"
|
|
23
|
-
},
|
|
24
|
-
"plugins": [
|
|
25
|
-
["expo-router", {
|
|
26
|
-
"unstable_useServerDataLoaders": true,
|
|
27
|
-
"unstable_useServerRendering": true
|
|
28
|
-
}]
|
|
29
|
-
]
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
**Static/SSG:**
|
|
35
|
-
|
|
36
|
-
```json
|
|
37
|
-
{
|
|
38
|
-
"expo": {
|
|
39
|
-
"web": {
|
|
40
|
-
"output": "static"
|
|
41
|
-
},
|
|
42
|
-
"plugins": [
|
|
43
|
-
["expo-router", {
|
|
44
|
-
"unstable_useServerDataLoaders": true
|
|
45
|
-
}]
|
|
46
|
-
]
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
| | `"server"` | `"static"` |
|
|
52
|
-
|---|-----------|------------|
|
|
53
|
-
| `unstable_useServerDataLoaders` | Required | Required |
|
|
54
|
-
| `unstable_useServerRendering` | Required | Not required |
|
|
55
|
-
| Loader runs on | Live server (every request) | Build time (static generation) |
|
|
56
|
-
| `request` object | Full access (headers, cookies) | Not available |
|
|
57
|
-
| Hosting | Node.js server (EAS Hosting) | Any static host (Netlify, Vercel, S3) |
|
|
58
|
-
|
|
59
|
-
## Imports
|
|
60
|
-
|
|
61
|
-
Loaders use two packages:
|
|
62
|
-
|
|
63
|
-
- **`expo-router`** — `useLoaderData` hook
|
|
64
|
-
- **`expo-server`** — `LoaderFunction` type, `StatusError`, `setResponseHeaders`. Always available (dependency of `expo-router`), no install needed.
|
|
65
|
-
|
|
66
|
-
## Basic Loader
|
|
67
|
-
|
|
68
|
-
For loaders without params, a plain async function works:
|
|
69
|
-
|
|
70
|
-
```tsx
|
|
71
|
-
// app/posts/index.tsx
|
|
72
|
-
import { Suspense } from "react";
|
|
73
|
-
import { useLoaderData } from "expo-router";
|
|
74
|
-
import { ActivityIndicator, View, Text } from "react-native";
|
|
75
|
-
|
|
76
|
-
export async function loader() {
|
|
77
|
-
const response = await fetch("https://api.example.com/posts");
|
|
78
|
-
const posts = await response.json();
|
|
79
|
-
return { posts };
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
function PostList() {
|
|
83
|
-
const { posts } = useLoaderData<typeof loader>();
|
|
84
|
-
|
|
85
|
-
return (
|
|
86
|
-
<View>
|
|
87
|
-
{posts.map((post) => (
|
|
88
|
-
<Text key={post.id}>{post.title}</Text>
|
|
89
|
-
))}
|
|
90
|
-
</View>
|
|
91
|
-
);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
export default function Posts() {
|
|
95
|
-
return (
|
|
96
|
-
<Suspense fallback={<ActivityIndicator size="large" />}>
|
|
97
|
-
<PostList />
|
|
98
|
-
</Suspense>
|
|
99
|
-
);
|
|
100
|
-
}
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
`useLoaderData` is typed via `typeof loader` — the generic parameter infers the return type.
|
|
104
|
-
|
|
105
|
-
## Dynamic Routes
|
|
106
|
-
|
|
107
|
-
For loaders with params, use the `LoaderFunction<T>` type from `expo-server`. The first argument is the request (an immutable `Request`-like object, or `undefined` in static mode). The second is `params` (`Record<string, string | string[]>`), which contains **path parameters only**. Access individual params with a cast like `params.id as string`. For query parameters, use `new URL(request.url).searchParams`:
|
|
108
|
-
|
|
109
|
-
```tsx
|
|
110
|
-
// app/posts/[id].tsx
|
|
111
|
-
import { Suspense } from "react";
|
|
112
|
-
import { useLoaderData } from "expo-router";
|
|
113
|
-
import { StatusError, type LoaderFunction } from "expo-server";
|
|
114
|
-
import { ActivityIndicator, View, Text } from "react-native";
|
|
115
|
-
|
|
116
|
-
type Post = {
|
|
117
|
-
id: number;
|
|
118
|
-
title: string;
|
|
119
|
-
body: string;
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
export const loader: LoaderFunction<{ post: Post }> = async (
|
|
123
|
-
request,
|
|
124
|
-
params,
|
|
125
|
-
) => {
|
|
126
|
-
const id = params.id as string;
|
|
127
|
-
const response = await fetch(`https://api.example.com/posts/${id}`);
|
|
128
|
-
|
|
129
|
-
if (!response.ok) {
|
|
130
|
-
throw new StatusError(404, `Post ${id} not found`);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
const post: Post = await response.json();
|
|
134
|
-
return { post };
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
function PostContent() {
|
|
138
|
-
const { post } = useLoaderData<typeof loader>();
|
|
139
|
-
|
|
140
|
-
return (
|
|
141
|
-
<View>
|
|
142
|
-
<Text>{post.title}</Text>
|
|
143
|
-
<Text>{post.body}</Text>
|
|
144
|
-
</View>
|
|
145
|
-
);
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
export default function PostDetail() {
|
|
149
|
-
return (
|
|
150
|
-
<Suspense fallback={<ActivityIndicator size="large" />}>
|
|
151
|
-
<PostContent />
|
|
152
|
-
</Suspense>
|
|
153
|
-
);
|
|
154
|
-
}
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
Catch-all routes access `params.slug` the same way:
|
|
158
|
-
|
|
159
|
-
```tsx
|
|
160
|
-
// app/docs/[...slug].tsx
|
|
161
|
-
import { type LoaderFunction } from "expo-server";
|
|
162
|
-
|
|
163
|
-
type Doc = { title: string; content: string };
|
|
164
|
-
|
|
165
|
-
export const loader: LoaderFunction<{ doc: Doc }> = async (request, params) => {
|
|
166
|
-
const slug = params.slug as string[];
|
|
167
|
-
const path = slug.join("/");
|
|
168
|
-
const doc = await fetchDoc(path);
|
|
169
|
-
return { doc };
|
|
170
|
-
};
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
Query parameters are available via the `request` object (server output mode only):
|
|
174
|
-
|
|
175
|
-
```tsx
|
|
176
|
-
// app/search.tsx
|
|
177
|
-
import { type LoaderFunction } from "expo-server";
|
|
178
|
-
|
|
179
|
-
export const loader: LoaderFunction<{ results: any[]; query: string }> = async (request) => {
|
|
180
|
-
// Assuming request.url is `/search?q=expo&page=2`
|
|
181
|
-
const url = new URL(request!.url);
|
|
182
|
-
const query = url.searchParams.get("q") ?? "";
|
|
183
|
-
const page = Number(url.searchParams.get("page") ?? "1");
|
|
184
|
-
|
|
185
|
-
const results = await fetchSearchResults(query, page);
|
|
186
|
-
return { results, query };
|
|
187
|
-
};
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
## Server-Side Secrets & Request Access
|
|
191
|
-
|
|
192
|
-
Loaders run on the server, so you can access secrets and server-only resources directly:
|
|
193
|
-
|
|
194
|
-
```tsx
|
|
195
|
-
// app/dashboard.tsx
|
|
196
|
-
import { type LoaderFunction } from "expo-server";
|
|
197
|
-
|
|
198
|
-
export const loader: LoaderFunction<{ balance: any; isAuthenticated: boolean }> = async (
|
|
199
|
-
request,
|
|
200
|
-
params,
|
|
201
|
-
) => {
|
|
202
|
-
const data = await fetch("https://api.stripe.com/v1/balance", {
|
|
203
|
-
headers: {
|
|
204
|
-
Authorization: `Bearer ${process.env.STRIPE_SECRET_KEY}`,
|
|
205
|
-
},
|
|
206
|
-
});
|
|
207
|
-
|
|
208
|
-
const sessionToken = request?.headers.get("cookie")?.match(/session=([^;]+)/)?.[1];
|
|
209
|
-
|
|
210
|
-
const balance = await data.json();
|
|
211
|
-
return { balance, isAuthenticated: !!sessionToken };
|
|
212
|
-
};
|
|
213
|
-
```
|
|
214
|
-
|
|
215
|
-
The `request` object is available in server output mode. In static output mode, `request` is always `undefined`.
|
|
216
|
-
|
|
217
|
-
## Response Utilities
|
|
218
|
-
|
|
219
|
-
### Setting Response Headers
|
|
220
|
-
|
|
221
|
-
```tsx
|
|
222
|
-
// app/products.tsx
|
|
223
|
-
import { setResponseHeaders } from "expo-server";
|
|
224
|
-
|
|
225
|
-
export async function loader() {
|
|
226
|
-
setResponseHeaders({
|
|
227
|
-
"Cache-Control": "public, max-age=300",
|
|
228
|
-
});
|
|
229
|
-
|
|
230
|
-
const products = await fetchProducts();
|
|
231
|
-
return { products };
|
|
232
|
-
}
|
|
233
|
-
```
|
|
234
|
-
|
|
235
|
-
### Throwing HTTP Errors
|
|
236
|
-
|
|
237
|
-
```tsx
|
|
238
|
-
// app/products/[id].tsx
|
|
239
|
-
import { StatusError, type LoaderFunction } from "expo-server";
|
|
240
|
-
|
|
241
|
-
export const loader: LoaderFunction<{ product: Product }> = async (request, params) => {
|
|
242
|
-
const id = params.id as string;
|
|
243
|
-
const product = await fetchProduct(id);
|
|
244
|
-
|
|
245
|
-
if (!product) {
|
|
246
|
-
throw new StatusError(404, "Product not found");
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
return { product };
|
|
250
|
-
};
|
|
251
|
-
```
|
|
252
|
-
|
|
253
|
-
## Suspense & Error Boundaries
|
|
254
|
-
|
|
255
|
-
### Loading States with Suspense
|
|
256
|
-
|
|
257
|
-
`useLoaderData()` suspends during client-side navigation. Push it into a child component and wrap with `<Suspense>`:
|
|
258
|
-
|
|
259
|
-
```tsx
|
|
260
|
-
// app/posts/index.tsx
|
|
261
|
-
import { Suspense } from "react";
|
|
262
|
-
import { useLoaderData } from "expo-router";
|
|
263
|
-
import { ActivityIndicator, View, Text } from "react-native";
|
|
264
|
-
|
|
265
|
-
export async function loader() {
|
|
266
|
-
const response = await fetch("https://api.example.com/posts");
|
|
267
|
-
return { posts: await response.json() };
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
function PostList() {
|
|
271
|
-
const { posts } = useLoaderData<typeof loader>();
|
|
272
|
-
|
|
273
|
-
return (
|
|
274
|
-
<View>
|
|
275
|
-
{posts.map((post) => (
|
|
276
|
-
<Text key={post.id}>{post.title}</Text>
|
|
277
|
-
))}
|
|
278
|
-
</View>
|
|
279
|
-
);
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
export default function Posts() {
|
|
283
|
-
return (
|
|
284
|
-
<Suspense
|
|
285
|
-
fallback={
|
|
286
|
-
<View style={{ flex: 1, justifyContent: "center", alignItems: "center" }}>
|
|
287
|
-
<ActivityIndicator size="large" />
|
|
288
|
-
</View>
|
|
289
|
-
}
|
|
290
|
-
>
|
|
291
|
-
<PostList />
|
|
292
|
-
</Suspense>
|
|
293
|
-
);
|
|
294
|
-
}
|
|
295
|
-
```
|
|
296
|
-
|
|
297
|
-
The `<Suspense>` boundary must be above the component calling `useLoaderData()`. On initial page load the data is already in the HTML, suspension only occurs during client-side navigation.
|
|
298
|
-
|
|
299
|
-
### Error Boundaries
|
|
300
|
-
|
|
301
|
-
```tsx
|
|
302
|
-
// app/posts/[id].tsx
|
|
303
|
-
export function ErrorBoundary({ error }: { error: Error }) {
|
|
304
|
-
return (
|
|
305
|
-
<View style={{ flex: 1, justifyContent: "center", alignItems: "center" }}>
|
|
306
|
-
<Text>Error: {error.message}</Text>
|
|
307
|
-
</View>
|
|
308
|
-
);
|
|
309
|
-
}
|
|
310
|
-
```
|
|
311
|
-
|
|
312
|
-
When a loader throws (including `StatusError`), the nearest `ErrorBoundary` catches it.
|
|
313
|
-
|
|
314
|
-
## Static vs Server Rendering
|
|
315
|
-
|
|
316
|
-
| | Server (`"server"`) | Static (`"static"`) |
|
|
317
|
-
|---|---|---|
|
|
318
|
-
| **When loader runs** | Every request (live) | At build time (`npx expo export`) |
|
|
319
|
-
| **Data freshness** | Fresh on initial server request | Stale until next build |
|
|
320
|
-
| **`request` object** | Full access | Not available |
|
|
321
|
-
| **Hosting** | Node.js server (EAS Hosting) | Any static host |
|
|
322
|
-
| **Use case** | Personalized/dynamic content | Marketing pages, blogs, docs |
|
|
323
|
-
|
|
324
|
-
**Choose server** when data changes frequently or content is personalized (cookies, auth, headers).
|
|
325
|
-
|
|
326
|
-
**Choose static** when content is the same for all users and changes infrequently.
|
|
327
|
-
|
|
328
|
-
## Best Practices
|
|
329
|
-
|
|
330
|
-
- Loaders are web-only; use client-side fetching (React Query, fetch) for native
|
|
331
|
-
- Loaders cannot be used in `_layout` files — only in route files
|
|
332
|
-
- Use `LoaderFunction<T>` from `expo-server` to type loaders that use params
|
|
333
|
-
- The request object is immutable — use optional chaining (`request?.headers`) as it may be `undefined` in static mode
|
|
334
|
-
- Return only JSON-serializable values (no `Date`, `Map`, `Set`, class instances, functions)
|
|
335
|
-
- Use non-prefixed `process.env` vars for secrets in loaders, not `EXPO_PUBLIC_` (which is embedded in the client bundle)
|
|
336
|
-
- Use `StatusError` from `expo-server` for HTTP error responses
|
|
337
|
-
- Use `setResponseHeaders` from `expo-server` to set headers
|
|
338
|
-
- Export `ErrorBoundary` from route files to handle loader failures gracefully
|
|
339
|
-
- Validate and sanitize user input (params, query strings) before using in database queries or API calls
|
|
340
|
-
- Handle errors gracefully with try/catch; log server-side for debugging
|
|
341
|
-
- Loader data is currently cached for the session. This is a known limitation that will be lifted in a future release
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
# Offline Support & Request Cancellation
|
|
2
|
-
|
|
3
|
-
Companion reference for `expo-data-fetching`.
|
|
4
|
-
|
|
5
|
-
## Offline Support
|
|
6
|
-
|
|
7
|
-
**Check network status**:
|
|
8
|
-
|
|
9
|
-
```tsx
|
|
10
|
-
import NetInfo from "@react-native-community/netinfo";
|
|
11
|
-
|
|
12
|
-
// Hook for network status
|
|
13
|
-
function useNetworkStatus() {
|
|
14
|
-
const [isOnline, setIsOnline] = useState(true);
|
|
15
|
-
|
|
16
|
-
useEffect(() => {
|
|
17
|
-
return NetInfo.addEventListener((state) => {
|
|
18
|
-
setIsOnline(state.isConnected ?? true);
|
|
19
|
-
});
|
|
20
|
-
}, []);
|
|
21
|
-
|
|
22
|
-
return isOnline;
|
|
23
|
-
}
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
**Offline-first with React Query**:
|
|
27
|
-
|
|
28
|
-
```tsx
|
|
29
|
-
import { onlineManager } from "@tanstack/react-query";
|
|
30
|
-
import NetInfo from "@react-native-community/netinfo";
|
|
31
|
-
|
|
32
|
-
// Sync React Query with network status
|
|
33
|
-
onlineManager.setEventListener((setOnline) => {
|
|
34
|
-
return NetInfo.addEventListener((state) => {
|
|
35
|
-
setOnline(state.isConnected ?? true);
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
// Queries will pause when offline and resume when online
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
## Request Cancellation
|
|
43
|
-
|
|
44
|
-
**Cancel on unmount**:
|
|
45
|
-
|
|
46
|
-
```tsx
|
|
47
|
-
useEffect(() => {
|
|
48
|
-
const controller = new AbortController();
|
|
49
|
-
|
|
50
|
-
fetch(url, { signal: controller.signal })
|
|
51
|
-
.then((response) => response.json())
|
|
52
|
-
.then(setData)
|
|
53
|
-
.catch((error) => {
|
|
54
|
-
if (error.name !== "AbortError") {
|
|
55
|
-
setError(error);
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
return () => controller.abort();
|
|
60
|
-
}, [url]);
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
**With React Query** (automatic):
|
|
64
|
-
|
|
65
|
-
```tsx
|
|
66
|
-
// React Query automatically cancels requests when queries are invalidated
|
|
67
|
-
// or components unmount
|
|
68
|
-
```
|