create-disposabl-app 0.10.4 → 0.12.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/README.md +3 -1
- package/dist/disposabl.js +218 -133
- package/dist/index.js +212 -47
- package/dist/templates/default/.github/scripts/apple.sh +60 -0
- package/dist/templates/default/.github/scripts/mobile.sh +10 -2
- package/dist/templates/default/.github/scripts/platforms.sh +32 -13
- package/dist/templates/default/.github/scripts/release.sh +2 -1
- package/dist/templates/default/.github/workflows/pipeline.yml +105 -44
- package/dist/templates/default/apps/desktop/README.md +5 -45
- package/dist/templates/default/apps/desktop/package.json +6 -6
- package/dist/templates/default/apps/docs/README.md +2 -4
- package/dist/templates/default/apps/docs/build.ts +10 -0
- package/dist/templates/default/apps/docs/content/backend.mdx +39 -0
- package/dist/templates/default/apps/docs/content/desktop.mdx +10 -0
- package/dist/templates/default/apps/docs/content/getting-started.mdx +26 -0
- package/dist/templates/default/apps/docs/content/index.mdx +27 -5
- package/dist/templates/default/apps/docs/content/mobile.mdx +18 -0
- package/dist/templates/default/apps/docs/content/web.mdx +14 -0
- package/dist/templates/default/apps/docs/dev.ts +40 -0
- package/dist/templates/default/apps/docs/package.json +15 -14
- package/dist/templates/default/apps/docs/press.config.ts +13 -1
- package/dist/templates/default/apps/docs/vite.config.ts +1 -0
- package/dist/templates/default/apps/mobile/.agents/skills/agent-device/SKILL.md +3 -1
- package/dist/templates/default/apps/mobile/.agents/skills/android-emulator/SKILL.md +2 -0
- package/dist/templates/default/apps/mobile/.agents/skills/dogfood/SKILL.md +1 -1
- package/dist/templates/default/apps/mobile/.agents/skills/eas-app-stores/SKILL.md +0 -1
- package/dist/templates/default/apps/mobile/.agents/skills/eas-hosting/SKILL.md +0 -1
- package/dist/templates/default/apps/mobile/.agents/skills/eas-observe/SKILL.md +7 -4
- package/dist/templates/default/apps/mobile/.agents/skills/eas-observe/references/library-integrations.md +116 -0
- package/dist/templates/default/apps/mobile/.agents/skills/eas-observe/references/queries.md +27 -0
- package/dist/templates/default/apps/mobile/.agents/skills/eas-observe/references/setup.md +3 -2
- package/dist/templates/default/apps/mobile/.agents/skills/eas-simulator/SKILL.md +0 -1
- package/dist/templates/default/apps/mobile/.agents/skills/eas-update/SKILL.md +0 -1
- package/dist/templates/default/apps/mobile/.agents/skills/eas-update-insights/SKILL.md +0 -1
- package/dist/templates/default/apps/mobile/.agents/skills/eas-workflows/SKILL.md +0 -1
- package/dist/templates/default/apps/mobile/.agents/skills/expo-animation/SKILL.md +0 -1
- package/dist/templates/default/apps/mobile/.agents/skills/expo-data-fetching/SKILL.md +0 -1
- package/dist/templates/default/apps/mobile/.agents/skills/expo-design-system/SKILL.md +0 -1
- package/dist/templates/default/apps/mobile/.agents/skills/expo-dev-client/SKILL.md +0 -1
- package/dist/templates/default/apps/mobile/.agents/skills/expo-dom/SKILL.md +0 -1
- package/dist/templates/default/apps/mobile/.agents/skills/expo-examples/SKILL.md +0 -1
- package/dist/templates/default/apps/mobile/.agents/skills/expo-migrate-module/SKILL.md +25 -21
- package/dist/templates/default/apps/mobile/.agents/skills/expo-migrate-module/references/compatibility.md +136 -60
- package/dist/templates/default/apps/mobile/.agents/skills/expo-migrate-module/references/example.md +17 -16
- package/dist/templates/default/apps/mobile/.agents/skills/expo-migrate-module/references/migration-map.md +132 -50
- package/dist/templates/default/apps/mobile/.agents/skills/expo-module/SKILL.md +0 -1
- package/dist/templates/default/apps/mobile/.agents/skills/expo-native-ui/SKILL.md +0 -1
- package/dist/templates/default/apps/mobile/.agents/skills/expo-overview/SKILL.md +0 -1
- package/dist/templates/default/apps/mobile/.agents/skills/expo-project-structure/SKILL.md +0 -1
- package/dist/templates/default/apps/mobile/.agents/skills/expo-router/SKILL.md +0 -1
- package/dist/templates/default/apps/mobile/.agents/skills/expo-skill-eval/SKILL.md +0 -1
- package/dist/templates/default/apps/mobile/.agents/skills/expo-ui/SKILL.md +0 -1
- package/dist/templates/default/apps/mobile/.agents/skills/expo-upgrade/SKILL.md +0 -1
- package/dist/templates/default/apps/mobile/.agents/skills/expo-web-to-native/SKILL.md +0 -1
- package/dist/templates/default/apps/mobile/.agents/skills/ios-simulator/SKILL.md +2 -0
- package/dist/templates/default/apps/mobile/.claude/skills/agent-device/SKILL.md +24 -0
- package/dist/templates/default/apps/mobile/.claude/skills/android-emulator/SKILL.md +34 -0
- package/dist/templates/default/apps/mobile/.claude/skills/dogfood/SKILL.md +27 -0
- package/dist/templates/default/apps/mobile/.claude/skills/eas-app-stores/SKILL.md +175 -0
- package/dist/templates/default/apps/mobile/.claude/skills/eas-app-stores/agents/openai.yaml +4 -0
- package/dist/templates/default/apps/mobile/.claude/skills/eas-app-stores/references/app-store-metadata.md +497 -0
- package/dist/templates/default/apps/mobile/.claude/skills/eas-app-stores/references/ios-app-store.md +376 -0
- package/dist/templates/default/apps/mobile/.claude/skills/eas-app-stores/references/native-ios.md +167 -0
- package/dist/templates/default/apps/mobile/.claude/skills/eas-app-stores/references/play-store.md +244 -0
- package/dist/templates/default/apps/mobile/.claude/skills/eas-app-stores/references/testflight.md +62 -0
- package/dist/templates/default/apps/mobile/.claude/skills/eas-app-stores/references/workflows.md +120 -0
- package/dist/templates/default/apps/mobile/.claude/skills/eas-hosting/SKILL.md +430 -0
- package/dist/templates/default/apps/mobile/.claude/skills/eas-hosting/agents/openai.yaml +4 -0
- package/dist/templates/default/apps/mobile/.claude/skills/eas-observe/SKILL.md +49 -0
- package/dist/templates/default/apps/mobile/.claude/skills/eas-observe/agents/openai.yaml +4 -0
- package/dist/templates/default/apps/mobile/.claude/skills/eas-observe/references/library-integrations.md +116 -0
- package/dist/templates/default/apps/mobile/.claude/skills/eas-observe/references/metrics.md +98 -0
- package/dist/templates/default/apps/mobile/.claude/skills/eas-observe/references/queries.md +471 -0
- package/dist/templates/default/apps/mobile/.claude/skills/eas-observe/references/setup.md +530 -0
- package/dist/templates/default/apps/mobile/.claude/skills/eas-observe/references/third-party.md +136 -0
- package/dist/templates/default/apps/mobile/.claude/skills/eas-simulator/SKILL.md +236 -0
- package/dist/templates/default/apps/mobile/.claude/skills/eas-simulator/agents/openai.yaml +4 -0
- package/dist/templates/default/apps/mobile/.claude/skills/eas-simulator/references/controllers.md +139 -0
- package/dist/templates/default/apps/mobile/.claude/skills/eas-simulator/references/logs-and-crashes.md +101 -0
- package/dist/templates/default/apps/mobile/.claude/skills/eas-simulator/references/run-your-app.md +256 -0
- package/dist/templates/default/apps/mobile/.claude/skills/eas-simulator/references/troubleshooting.md +56 -0
- package/dist/templates/default/apps/mobile/.claude/skills/eas-update/SKILL.md +145 -0
- package/dist/templates/default/apps/mobile/.claude/skills/eas-update/agents/openai.yaml +4 -0
- package/dist/templates/default/apps/mobile/.claude/skills/eas-update-insights/SKILL.md +237 -0
- package/dist/templates/default/apps/mobile/.claude/skills/eas-update-insights/agents/openai.yaml +4 -0
- package/dist/templates/default/apps/mobile/.claude/skills/eas-update-insights/references/channel-insights-schema.md +47 -0
- package/dist/templates/default/apps/mobile/.claude/skills/eas-update-insights/references/update-insights-schema.md +69 -0
- package/dist/templates/default/apps/mobile/.claude/skills/eas-workflows/SKILL.md +98 -0
- package/dist/templates/default/apps/mobile/.claude/skills/eas-workflows/agents/openai.yaml +4 -0
- package/dist/templates/default/apps/mobile/.claude/skills/eas-workflows/scripts/fetch.js +109 -0
- package/dist/templates/default/apps/mobile/.claude/skills/eas-workflows/scripts/package.json +6 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-animation/LICENSE +21 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-animation/RECIPES.md +385 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-animation/SKILL.md +273 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-animation/agents/openai.yaml +4 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-app-clip/SKILL.md +290 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-app-clip/agents/openai.yaml +4 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-app-clip/references/native-module.md +96 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-brownfield/SKILL.md +69 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-brownfield/agents/openai.yaml +4 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-brownfield/references/brownfield-integrated.md +551 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-brownfield/references/brownfield-isolated.md +449 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-brownfield/references/comparison.md +63 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-brownfield/references/feature-integration.md +163 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-brownfield/references/troubleshooting.md +88 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-brownfield/references/version-compatibility.md +40 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-data-fetching/SKILL.md +477 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-data-fetching/agents/openai.yaml +4 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-data-fetching/references/expo-router-loaders.md +341 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-data-fetching/references/offline-and-cancellation.md +68 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-design-system/SKILL.md +375 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-design-system/agents/openai.yaml +4 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-design-system/references/audit.md +190 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-design-system/references/native-slop.md +74 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-dev-client/SKILL.md +183 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-dev-client/agents/openai.yaml +4 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-dom/SKILL.md +424 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-dom/agents/openai.yaml +4 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-examples/SKILL.md +105 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-examples/agents/openai.yaml +4 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-examples/references/catalog.md +105 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-migrate-module/SKILL.md +128 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-migrate-module/agents/openai.yaml +4 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-migrate-module/references/compatibility.md +206 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-migrate-module/references/example.md +213 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-migrate-module/references/migration-map.md +539 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-module/SKILL.md +150 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-module/agents/openai.yaml +4 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-module/references/config-plugin.md +90 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-module/references/create-expo-module.md +206 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-module/references/lifecycle.md +127 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-module/references/module-config.md +48 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-module/references/native-module.md +286 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-module/references/native-view.md +171 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-native-ui/SKILL.md +200 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-native-ui/agents/openai.yaml +4 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-native-ui/references/controls.md +231 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-native-ui/references/gradients.md +106 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-native-ui/references/icons.md +232 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-native-ui/references/media.md +193 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-native-ui/references/storage.md +121 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-native-ui/references/visual-effects.md +198 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-native-ui/references/webgpu-three.md +605 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-overview/SKILL.md +119 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-overview/agents/openai.yaml +4 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-overview/references/launch-without-dev-menu.md +24 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-project-structure/SKILL.md +113 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-project-structure/agents/openai.yaml +4 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-router/SKILL.md +239 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-router/agents/openai.yaml +4 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-router/references/form-sheet.md +253 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-router/references/route-structure.md +229 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-router/references/search.md +248 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-router/references/tabs.md +433 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-router/references/toolbar-and-headers.md +284 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-router/references/zoom-transitions.md +158 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-skill-eval/SKILL.md +313 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-skill-eval/agents/visual-grader.md +52 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-skill-eval/references/design-rubric.md +45 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-skill-eval/references/runtime-matrix.md +34 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-skill-eval/scripts/check-static.sh +64 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-skill-eval/scripts/clean-fixture.sh +56 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-skill-eval/scripts/generate_viewer.py +450 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-skill-eval/scripts/latest-sdk.sh +46 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-skill-eval/scripts/make-fixture.sh +95 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-skill-eval/scripts/make-workspace.sh +31 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-skill-eval/scripts/snapshot-android.sh +284 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-skill-eval/scripts/snapshot-ios.sh +132 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-skill-eval/scripts/snapshot-web.sh +61 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-ui/SKILL.md +100 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-ui/agents/openai.yaml +4 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-ui/references/drop-in-replacements.md +27 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-ui/references/jetpack-compose.md +73 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-ui/references/swift-ui.md +73 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-ui/references/universal.md +104 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-ui/scripts/list-components.js +193 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-upgrade/SKILL.md +149 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-upgrade/agents/openai.yaml +4 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-upgrade/references/expo-av-to-audio.md +132 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-upgrade/references/expo-av-to-video.md +160 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-upgrade/references/native-tabs.md +124 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-upgrade/references/new-architecture.md +79 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-upgrade/references/react-19.md +79 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-upgrade/references/react-compiler.md +59 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-upgrade/references/react-navigation-to-expo-router.md +61 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-web-to-native/SKILL.md +90 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-web-to-native/agents/openai.yaml +4 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-web-to-native/references/false-friends.md +119 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-web-to-native/references/native-patterns.md +39 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-web-to-native/references/run-as-goal.md +48 -0
- package/dist/templates/default/apps/mobile/.claude/skills/expo-web-to-native/references/verify-on-device.md +45 -0
- package/dist/templates/default/apps/mobile/.claude/skills/ios-simulator/SKILL.md +34 -0
- package/dist/templates/default/apps/mobile/.claude/skills/react-native-best-practices/POWER.md +172 -0
- package/dist/templates/default/apps/mobile/.claude/skills/react-native-best-practices/SKILL.md +238 -0
- package/dist/templates/default/apps/mobile/.claude/skills/react-native-best-practices/agents/openai.yaml +4 -0
- package/dist/templates/default/apps/mobile/.claude/skills/react-native-best-practices/references/bundle-analyze-app.md +208 -0
- package/dist/templates/default/apps/mobile/.claude/skills/react-native-best-practices/references/bundle-analyze-js.md +264 -0
- package/dist/templates/default/apps/mobile/.claude/skills/react-native-best-practices/references/bundle-barrel-exports.md +250 -0
- package/dist/templates/default/apps/mobile/.claude/skills/react-native-best-practices/references/bundle-code-splitting.md +255 -0
- package/dist/templates/default/apps/mobile/.claude/skills/react-native-best-practices/references/bundle-hermes-mmap.md +167 -0
- package/dist/templates/default/apps/mobile/.claude/skills/react-native-best-practices/references/bundle-library-size.md +164 -0
- package/dist/templates/default/apps/mobile/.claude/skills/react-native-best-practices/references/bundle-native-assets.md +208 -0
- package/dist/templates/default/apps/mobile/.claude/skills/react-native-best-practices/references/bundle-r8-android.md +231 -0
- package/dist/templates/default/apps/mobile/.claude/skills/react-native-best-practices/references/bundle-tree-shaking.md +215 -0
- package/dist/templates/default/apps/mobile/.claude/skills/react-native-best-practices/references/images/bundle-treemap-source-map-explorer.png +0 -0
- package/dist/templates/default/apps/mobile/.claude/skills/react-native-best-practices/references/images/controlled-textinput-pingpong.png +0 -0
- package/dist/templates/default/apps/mobile/.claude/skills/react-native-best-practices/references/images/devtools-flamegraph.png +0 -0
- package/dist/templates/default/apps/mobile/.claude/skills/react-native-best-practices/references/images/emerge-xray-ios.png +0 -0
- package/dist/templates/default/apps/mobile/.claude/skills/react-native-best-practices/references/images/expo-atlas-treemap.png +0 -0
- package/dist/templates/default/apps/mobile/.claude/skills/react-native-best-practices/references/images/flashlight-flatlist-vs-flashlist.png +0 -0
- package/dist/templates/default/apps/mobile/.claude/skills/react-native-best-practices/references/images/fps-drop-graph.png +0 -0
- package/dist/templates/default/apps/mobile/.claude/skills/react-native-best-practices/references/images/memory-heap-snapshot.png +0 -0
- package/dist/templates/default/apps/mobile/.claude/skills/react-native-best-practices/references/images/tti-warm-start-diagram.png +0 -0
- package/dist/templates/default/apps/mobile/.claude/skills/react-native-best-practices/references/images/view-hierarchy-flattening.png +0 -0
- package/dist/templates/default/apps/mobile/.claude/skills/react-native-best-practices/references/images/xcode-instruments-templates.png +0 -0
- package/dist/templates/default/apps/mobile/.claude/skills/react-native-best-practices/references/images/xcode-thread-view.png +0 -0
- package/dist/templates/default/apps/mobile/.claude/skills/react-native-best-practices/references/js-animations-reanimated.md +273 -0
- package/dist/templates/default/apps/mobile/.claude/skills/react-native-best-practices/references/js-atomic-state.md +190 -0
- package/dist/templates/default/apps/mobile/.claude/skills/react-native-best-practices/references/js-bottomsheet.md +339 -0
- package/dist/templates/default/apps/mobile/.claude/skills/react-native-best-practices/references/js-concurrent-react.md +238 -0
- package/dist/templates/default/apps/mobile/.claude/skills/react-native-best-practices/references/js-lists-flatlist-flashlist.md +223 -0
- package/dist/templates/default/apps/mobile/.claude/skills/react-native-best-practices/references/js-measure-fps.md +178 -0
- package/dist/templates/default/apps/mobile/.claude/skills/react-native-best-practices/references/js-memory-leaks.md +168 -0
- package/dist/templates/default/apps/mobile/.claude/skills/react-native-best-practices/references/js-profile-react.md +138 -0
- package/dist/templates/default/apps/mobile/.claude/skills/react-native-best-practices/references/js-react-compiler.md +261 -0
- package/dist/templates/default/apps/mobile/.claude/skills/react-native-best-practices/references/js-uncontrolled-components.md +219 -0
- package/dist/templates/default/apps/mobile/.claude/skills/react-native-best-practices/references/native-android-16kb-alignment.md +114 -0
- package/dist/templates/default/apps/mobile/.claude/skills/react-native-best-practices/references/native-measure-tti.md +221 -0
- package/dist/templates/default/apps/mobile/.claude/skills/react-native-best-practices/references/native-memory-leaks.md +206 -0
- package/dist/templates/default/apps/mobile/.claude/skills/react-native-best-practices/references/native-memory-patterns.md +240 -0
- package/dist/templates/default/apps/mobile/.claude/skills/react-native-best-practices/references/native-platform-setup.md +112 -0
- package/dist/templates/default/apps/mobile/.claude/skills/react-native-best-practices/references/native-profiling.md +140 -0
- package/dist/templates/default/apps/mobile/.claude/skills/react-native-best-practices/references/native-sdks-over-polyfills.md +192 -0
- package/dist/templates/default/apps/mobile/.claude/skills/react-native-best-practices/references/native-threading-model.md +230 -0
- package/dist/templates/default/apps/mobile/.claude/skills/react-native-best-practices/references/native-turbo-modules.md +210 -0
- package/dist/templates/default/apps/mobile/.claude/skills/react-native-best-practices/references/native-view-flattening.md +180 -0
- package/dist/templates/default/apps/mobile/AGENTS.md +35 -8
- package/dist/templates/default/apps/mobile/README.md +31 -7
- package/dist/templates/default/apps/mobile/app.config.js +35 -6
- package/dist/templates/default/apps/mobile/metro.config.js +6 -0
- package/dist/templates/default/apps/mobile/nativewind-env.d.ts +2 -0
- package/dist/templates/default/apps/mobile/package.json +28 -16
- package/dist/templates/default/apps/mobile/postcss.config.mjs +1 -0
- package/dist/templates/default/apps/mobile/skills-lock.json +27 -27
- package/dist/templates/default/apps/mobile/src/app/(auth)/forgot-password.tsx +1 -0
- package/dist/templates/default/apps/mobile/src/app/(authenticated)/change-password.tsx +1 -0
- package/dist/templates/default/apps/mobile/src/app/_layout.tsx +1 -0
- package/dist/templates/default/apps/mobile/tsconfig.json +2 -1
- package/dist/templates/default/apps/web/.claude/skills/frontend-design/SKILL.md +71 -0
- package/dist/templates/default/apps/web/.claude/skills/web-design-guidelines/SKILL.md +39 -0
- package/dist/templates/default/apps/web/package.json +16 -16
- package/dist/templates/default/apps/web/site.json +10 -0
- package/dist/templates/default/apps/web/src/routeTree.gen.ts +282 -0
- package/dist/templates/default/apps/web/src/router/__root.tsx +44 -7
- package/dist/templates/default/apps/web/src/router/_authenticated/dashboard.tsx +2 -4
- package/dist/templates/default/apps/web/src/router/index.tsx +101 -20
- package/dist/templates/default/apps/web/src/router/mobile-login.tsx +84 -0
- package/dist/templates/default/apps/web/vite.config.ts +53 -8
- package/dist/templates/default/bun.lock +5286 -27943
- package/dist/templates/default/bunfig.toml +4 -0
- package/dist/templates/default/disposabl.json +1 -1
- package/dist/templates/default/package.json +10 -6
- package/dist/templates/default/packages/backend/.claude/skills/convex/SKILL.md +69 -0
- package/dist/templates/default/packages/backend/.claude/skills/convex-add/SKILL.md +26 -0
- package/dist/templates/default/packages/backend/.claude/skills/convex-advisor/SKILL.md +32 -0
- package/dist/templates/default/packages/backend/.claude/skills/convex-agent/SKILL.md +25 -0
- package/dist/templates/default/packages/backend/.claude/skills/convex-auth/SKILL.md +29 -0
- package/dist/templates/default/packages/backend/.claude/skills/convex-authz/SKILL.md +36 -0
- package/dist/templates/default/packages/backend/.claude/skills/convex-backup/SKILL.md +33 -0
- package/dist/templates/default/packages/backend/.claude/skills/convex-billing/SKILL.md +69 -0
- package/dist/templates/default/packages/backend/.claude/skills/convex-cost/SKILL.md +29 -0
- package/dist/templates/default/packages/backend/.claude/skills/convex-create-component/SKILL.md +325 -0
- package/dist/templates/default/packages/backend/.claude/skills/convex-create-component/agents/openai.yaml +14 -0
- package/dist/templates/default/packages/backend/.claude/skills/convex-create-component/assets/icon.svg +3 -0
- package/dist/templates/default/packages/backend/.claude/skills/convex-create-component/references/advanced-patterns.md +146 -0
- package/dist/templates/default/packages/backend/.claude/skills/convex-create-component/references/hybrid-components.md +38 -0
- package/dist/templates/default/packages/backend/.claude/skills/convex-create-component/references/local-components.md +39 -0
- package/dist/templates/default/packages/backend/.claude/skills/convex-create-component/references/packaged-components.md +54 -0
- package/dist/templates/default/packages/backend/.claude/skills/convex-crons/SKILL.md +23 -0
- package/dist/templates/default/packages/backend/.claude/skills/convex-deploy-guard/SKILL.md +29 -0
- package/dist/templates/default/packages/backend/.claude/skills/convex-design/SKILL.md +30 -0
- package/dist/templates/default/packages/backend/.claude/skills/convex-docs/SKILL.md +31 -0
- package/dist/templates/default/packages/backend/.claude/skills/convex-domains/SKILL.md +26 -0
- package/dist/templates/default/packages/backend/.claude/skills/convex-env/SKILL.md +24 -0
- package/dist/templates/default/packages/backend/.claude/skills/convex-expert/SKILL.md +38 -0
- package/dist/templates/default/packages/backend/.claude/skills/convex-explain-app/SKILL.md +29 -0
- package/dist/templates/default/packages/backend/.claude/skills/convex-improve-convex-plugin/SKILL.md +24 -0
- package/dist/templates/default/packages/backend/.claude/skills/convex-insights/SKILL.md +32 -0
- package/dist/templates/default/packages/backend/.claude/skills/convex-launch-readiness/SKILL.md +35 -0
- package/dist/templates/default/packages/backend/.claude/skills/convex-migrate/SKILL.md +23 -0
- package/dist/templates/default/packages/backend/.claude/skills/convex-migrate-rehearse/SKILL.md +31 -0
- package/dist/templates/default/packages/backend/.claude/skills/convex-monitor/SKILL.md +22 -0
- package/dist/templates/default/packages/backend/.claude/skills/convex-optimize/SKILL.md +26 -0
- package/dist/templates/default/packages/backend/.claude/skills/convex-quickstart/SKILL.md +29 -0
- package/dist/templates/default/packages/backend/.claude/skills/convex-quickstart/agents/openai.yaml +14 -0
- package/dist/templates/default/packages/backend/.claude/skills/convex-quickstart/assets/icon.svg +4 -0
- package/dist/templates/default/packages/backend/.claude/skills/convex-reviewer/SKILL.md +26 -0
- package/dist/templates/default/packages/backend/.claude/skills/convex-seed/SKILL.md +23 -0
- package/dist/templates/default/packages/backend/.claude/skills/convex-self-heal/SKILL.md +38 -0
- package/dist/templates/default/packages/backend/.claude/skills/convex-sentinel/SKILL.md +25 -0
- package/dist/templates/default/packages/backend/.claude/skills/convex-suggest/SKILL.md +27 -0
- package/dist/templates/default/packages/backend/.claude/skills/convex-test/SKILL.md +23 -0
- package/dist/templates/default/packages/backend/.claude/skills/convex-verify/SKILL.md +34 -0
- package/dist/templates/default/packages/backend/README.md +23 -2
- package/dist/templates/default/packages/backend/convex/_generated/api.d.ts +15 -6
- package/dist/templates/default/packages/backend/convex/_generated/server.d.ts +17 -0
- package/dist/templates/default/packages/backend/convex/auth.ts +90 -3
- package/dist/templates/default/packages/backend/convex/authEmail.ts +45 -0
- package/dist/templates/default/packages/backend/convex/authSetup.ts +12 -0
- package/dist/templates/default/packages/backend/convex/billing.ts +5 -0
- package/dist/templates/default/packages/backend/convex/convex.config.ts +38 -1
- package/dist/templates/default/packages/backend/convex/emails.ts +10 -0
- package/dist/templates/default/packages/backend/convex/files/index.ts +6 -0
- package/dist/templates/default/packages/backend/convex/files/internal.ts +5 -0
- package/dist/templates/default/packages/backend/convex/http.ts +9 -1
- package/dist/templates/default/packages/backend/convex/schema.ts +20 -19
- package/dist/templates/default/packages/backend/convex/telemetry.ts +84 -0
- package/dist/templates/default/packages/backend/convex/users/internal.ts +66 -10
- package/dist/templates/default/packages/backend/convex/users/validator.ts +14 -0
- package/dist/templates/default/packages/backend/generated/pages.json +36 -0
- package/dist/templates/default/packages/backend/package.json +8 -7
- package/dist/templates/default/packages/cli/README.md +3 -1
- package/dist/templates/default/packages/cli/auth.ts +6 -1
- package/dist/templates/default/packages/cli/client.ts +213 -0
- package/dist/templates/default/packages/cli/commands.ts +1 -293
- package/dist/templates/default/packages/cli/package.json +1 -1
- package/dist/templates/default/packages/disposabl-kit/GOOGLE_AUTH.md +37 -0
- package/dist/templates/default/packages/disposabl-kit/PAYMENTS.md +31 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/google-sign-in.tsx +78 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/legal-page.tsx +116 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/password-auth-form.tsx +221 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/password-page.tsx +37 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/log-out.tsx +28 -9
- package/dist/templates/default/packages/disposabl-kit/client/lib/prerender.ts +3 -1
- package/dist/templates/default/packages/disposabl-kit/client/lib/telemetry.ts +32 -0
- package/dist/templates/default/packages/disposabl-kit/client/routes/_auth-pages/forgot-password.tsx +92 -0
- package/dist/templates/default/packages/disposabl-kit/client/routes/_auth-pages/login.tsx +4 -149
- package/dist/templates/default/packages/disposabl-kit/client/routes/_auth-pages/reset-password.tsx +118 -0
- package/dist/templates/default/packages/disposabl-kit/client/routes/_auth-pages/signUp.tsx +4 -159
- package/dist/templates/default/packages/disposabl-kit/client/routes/_auth-pages/verify-email.tsx +49 -0
- package/dist/templates/default/packages/disposabl-kit/client/routes/_authenticated/change-password.tsx +123 -0
- package/dist/templates/default/packages/disposabl-kit/client/routes/legal/delete-account.tsx +7 -0
- package/dist/templates/default/packages/disposabl-kit/client/routes/legal/index.tsx +7 -0
- package/dist/templates/default/packages/disposabl-kit/client/routes/legal/privacy-request.tsx +7 -0
- package/dist/templates/default/packages/disposabl-kit/client/routes/legal/privacy.tsx +7 -0
- package/dist/templates/default/packages/disposabl-kit/client/routes/legal/terms.tsx +7 -0
- package/dist/templates/default/packages/disposabl-kit/client/routes/pricing.tsx +223 -0
- package/dist/templates/default/packages/disposabl-kit/client/routes/route.tsx +66 -14
- package/dist/templates/default/packages/disposabl-kit/client/vite.config.ts +27 -1
- package/dist/templates/default/packages/disposabl-kit/feature-options.ts +44 -0
- package/dist/templates/default/packages/disposabl-kit/features.ts +3 -0
- package/dist/templates/default/packages/disposabl-kit/legal/README.md +7 -0
- package/dist/templates/default/packages/disposabl-kit/legal/config.ts +55 -0
- package/dist/templates/default/packages/disposabl-kit/legal/documents/privacy.ts +69 -0
- package/dist/templates/default/packages/disposabl-kit/legal/documents/terms.ts +66 -0
- package/dist/templates/default/packages/disposabl-kit/legal/index.ts +40 -0
- package/dist/templates/default/packages/disposabl-kit/legal/types.ts +6 -0
- package/dist/templates/default/packages/disposabl-kit/lib/auth-errors.ts +47 -0
- package/dist/templates/default/packages/disposabl-kit/lib/auth-session.ts +15 -0
- package/dist/templates/default/packages/disposabl-kit/lib/google-logo.png +0 -0
- package/dist/templates/default/packages/disposabl-kit/lib/indexing.ts +27 -0
- package/dist/templates/default/packages/disposabl-kit/lib/mobile-auth.ts +44 -0
- package/dist/templates/default/packages/disposabl-kit/lib/starter.ts +57 -0
- package/dist/templates/default/packages/disposabl-kit/lib/telemetry.ts +30 -0
- package/dist/templates/default/packages/disposabl-kit/mobile/billing/account-billing.tsx +216 -0
- package/dist/templates/default/packages/disposabl-kit/mobile/billing/session.ts +73 -0
- package/dist/templates/default/packages/disposabl-kit/mobile/components/account-profile.tsx +128 -0
- package/dist/templates/default/packages/disposabl-kit/mobile/components/appearance-settings.tsx +128 -0
- package/dist/templates/default/packages/disposabl-kit/mobile/components/auth-form.tsx +168 -68
- package/dist/templates/default/packages/disposabl-kit/mobile/components/auth-ui.tsx +52 -8
- package/dist/templates/default/packages/disposabl-kit/mobile/components/email-verification.tsx +77 -0
- package/dist/templates/default/packages/disposabl-kit/mobile/components/google-button.tsx +66 -0
- package/dist/templates/default/packages/disposabl-kit/mobile/components/google-sign-in.tsx +121 -0
- package/dist/templates/default/packages/disposabl-kit/mobile/components/settings-links.tsx +53 -0
- package/dist/templates/default/packages/disposabl-kit/mobile/components/settings-page.tsx +58 -0
- package/dist/templates/default/packages/disposabl-kit/mobile/design/accent.ts +31 -0
- package/dist/templates/default/packages/disposabl-kit/mobile/design/avatar.tsx +38 -0
- package/dist/templates/default/packages/disposabl-kit/mobile/design/brand-mark.tsx +18 -0
- package/dist/templates/default/packages/disposabl-kit/mobile/design/native-button.tsx +20 -0
- package/dist/templates/default/packages/disposabl-kit/mobile/design/preferences.tsx +234 -0
- package/dist/templates/default/packages/disposabl-kit/mobile/design/primitives.tsx +229 -0
- package/dist/templates/default/packages/disposabl-kit/mobile/design/theme-provider.tsx +198 -0
- package/dist/templates/default/packages/disposabl-kit/mobile/design/theme.ts +13 -0
- package/dist/templates/default/packages/disposabl-kit/mobile/design/themed-text.tsx +61 -0
- package/dist/templates/default/packages/disposabl-kit/mobile/design/use-theme.ts +27 -0
- package/dist/templates/default/packages/disposabl-kit/mobile/expo-plugin.cjs +28 -5
- package/dist/templates/default/packages/disposabl-kit/mobile/global.css +165 -0
- package/dist/templates/default/packages/disposabl-kit/mobile/index.ts +3 -0
- package/dist/templates/default/packages/disposabl-kit/mobile/layout.tsx +156 -23
- package/dist/templates/default/packages/disposabl-kit/mobile/lib/auth-return.ts +10 -0
- package/dist/templates/default/packages/disposabl-kit/mobile/lib/logo-dark.png +0 -0
- package/dist/templates/default/packages/disposabl-kit/mobile/lib/logo-light.png +0 -0
- package/dist/templates/default/packages/disposabl-kit/mobile/screens/account.tsx +171 -39
- package/dist/templates/default/packages/disposabl-kit/mobile/screens/change-password.tsx +147 -0
- package/dist/templates/default/packages/disposabl-kit/mobile/screens/forgot-password.tsx +158 -0
- package/dist/templates/default/packages/disposabl-kit/mobile/screens/home.tsx +162 -54
- package/dist/templates/default/packages/disposabl-kit/mobile/updates/current-update.ts +19 -0
- package/dist/templates/default/packages/disposabl-kit/mobile/updates/foreground-check.ts +19 -0
- package/dist/templates/default/packages/disposabl-kit/mobile/updates/update-prompt.tsx +201 -0
- package/dist/templates/default/packages/disposabl-kit/package.json +62 -22
- package/dist/templates/default/packages/disposabl-kit/payments/autumn.config.example +13 -0
- package/dist/templates/default/packages/disposabl-kit/server/billing-functions.ts +93 -0
- package/dist/templates/default/packages/disposabl-kit/server/billing.ts +119 -0
- package/dist/templates/default/packages/disposabl-kit/server/files-functions.ts +196 -0
- package/dist/templates/default/packages/disposabl-kit/server/files.ts +133 -0
- package/dist/templates/default/packages/disposabl-kit/server/google.ts +95 -0
- package/dist/templates/default/packages/disposabl-kit/server/http.ts +68 -18
- package/dist/templates/default/packages/disposabl-kit/server/lib/platform-spec.ts +99 -16
- package/dist/templates/default/packages/disposabl-kit/server/lib/static.ts +43 -5
- package/dist/templates/default/packages/disposabl-kit/server/lib/telemetry.ts +139 -0
- package/dist/templates/default/packages/sdk/package.json +1 -1
- package/dist/templates/default/packages/sdk/src/config.ts +1 -0
- package/dist/templates/default/packages/skill/SKILL.md +10 -2
- package/dist/templates/default/packages/skill/references/agent.md +28 -0
- package/dist/templates/default/packages/skill/references/delivery.md +2 -0
- package/dist/templates/default/packages/skill/references/design.md +2 -0
- package/dist/templates/default/packages/skill/references/iphone-preview.md +114 -0
- package/dist/templates/default/packages/skill/scripts/sign-iphone.py +126 -0
- package/dist/templates/default/packages/tests/README.md +10 -0
- package/dist/templates/default/packages/tests/billing.test.ts +77 -0
- package/dist/templates/default/packages/tests/components/mobile-google.test.mjs +142 -0
- package/dist/templates/default/packages/tests/components/mobile-settings.test.mjs +118 -0
- package/dist/templates/default/packages/tests/components/mobile-theme.test.mjs +122 -0
- package/dist/templates/default/packages/tests/components/mobile-updates.test.mjs +139 -0
- package/dist/templates/default/packages/tests/e2e.config.ts +1 -0
- package/dist/templates/default/packages/tests/files.test.ts +234 -0
- package/dist/templates/default/packages/tests/flows/email-delivery.e2e.ts +93 -0
- package/dist/templates/default/packages/tests/flows/files.e2e.ts +97 -0
- package/dist/templates/default/packages/tests/flows/legal.e2e.ts +38 -0
- package/dist/templates/default/packages/tests/flows/mcp.e2e.ts +120 -0
- package/dist/templates/default/packages/tests/flows/mobile-auth-disabled.e2e.ts +33 -0
- package/dist/templates/default/packages/tests/flows/mobile.e2e.ts +6 -4
- package/dist/templates/default/packages/tests/flows/password-backend.e2e.ts +58 -0
- package/dist/templates/default/packages/tests/flows/passwords.e2e.ts +206 -0
- package/dist/templates/default/packages/tests/flows/seo.e2e.ts +34 -0
- package/dist/templates/default/packages/tests/flows/web.e2e.ts +42 -2
- package/dist/templates/default/packages/tests/helpers/mobile.ts +31 -0
- package/dist/templates/default/packages/tests/ios-ota.test.ts +267 -0
- package/dist/templates/default/packages/tests/mobile-google.test.ts +100 -0
- package/dist/templates/default/packages/tests/mobile-settings.test.ts +21 -0
- package/dist/templates/default/packages/tests/mobile-theme.test.ts +13 -0
- package/dist/templates/default/packages/tests/mobile-updates-component.test.ts +14 -0
- package/dist/templates/default/packages/tests/mobile-updates.test.ts +122 -0
- package/dist/templates/default/packages/tests/native-billing.test.ts +138 -0
- package/dist/templates/default/packages/tests/package.json +11 -6
- package/dist/templates/default/packages/tests/seo-config.test.ts +17 -0
- package/dist/templates/default/packages/tests/telemetry.test.ts +188 -0
- package/dist/templates/default/patches/react-native-css@3.1.0-rc.1.patch +42 -0
- package/dist/templates/default/vendor/README.md +30 -23
- package/dist/templates/default/vendor/convex-auth-437831bd-disposabl.3.tgz +0 -0
- package/package.json +8 -8
- package/dist/templates/default/packages/backend/convex/mcpEnterprise/README.md +0 -42
- package/dist/templates/default/packages/backend/convex/mcpEnterprise/internal.ts +0 -153
- package/dist/templates/default/packages/backend/convex/mcpEnterprise/provision.ts +0 -102
- package/dist/templates/default/packages/backend/convex/mcpEnterprise/validator.ts +0 -35
- package/dist/templates/default/packages/cli/delete.ts +0 -48
- package/dist/templates/default/packages/cli/preview.ts +0 -234
- package/dist/templates/default/packages/disposabl-kit/server/mcp/enterprise.ts +0 -267
- package/dist/templates/default/packages/disposabl-kit/server/mcp/identity.ts +0 -33
- package/dist/templates/default/vendor/convex-auth-6c0ebf3f.tgz +0 -0
- /package/dist/templates/default/apps/mobile/src/app/{(authenticated)/account.tsx → settings.tsx} +0 -0
|
@@ -0,0 +1,539 @@
|
|
|
1
|
+
# 1.0 to 2.0 Migration Map
|
|
2
|
+
|
|
3
|
+
Use this reference while editing. Preserve behavior first; macro adoption is secondary.
|
|
4
|
+
|
|
5
|
+
## Module and naming
|
|
6
|
+
|
|
7
|
+
Convert the module class, carry the name into `@ExpoModule("...")`, and remove `Name(...)`:
|
|
8
|
+
|
|
9
|
+
```swift
|
|
10
|
+
// 1.0
|
|
11
|
+
public final class CameraModule: Module {
|
|
12
|
+
public func definition() -> ModuleDefinition {
|
|
13
|
+
Name("Camera")
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// 2.0
|
|
18
|
+
@ExpoModule("Camera")
|
|
19
|
+
public final class CameraModule: Module {}
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Always carry a custom 1.0 name into `@ExpoModule("...")`. Without an argument, the name defaults to the Swift class name. Core reads the `@ExpoModule` name only when `definition()` has no `Name(...)` entry, so a stale `Name(...)` silently wins in mixed mode. Remove it, then verify that the module still resolves under its expected JS name.
|
|
23
|
+
|
|
24
|
+
Keep the `Module` superclass. `@ExpoModule` also works on a class without one, but removing it is not part of a migration: `sendEvent` and the overridable lifecycle hooks come from it.
|
|
25
|
+
|
|
26
|
+
## Functions
|
|
27
|
+
|
|
28
|
+
Move a DSL closure into a real method and use `@JS("wireName")` when the Swift method name is different:
|
|
29
|
+
|
|
30
|
+
```swift
|
|
31
|
+
// 1.0
|
|
32
|
+
Function("sum") { (a: Double, b: Double) -> Double in
|
|
33
|
+
return a + b
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// 2.0
|
|
37
|
+
@JS("sum")
|
|
38
|
+
func add(a: Double, b: Double) -> Double {
|
|
39
|
+
return a + b
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Preserve:
|
|
44
|
+
|
|
45
|
+
- the JS name
|
|
46
|
+
- positional arity
|
|
47
|
+
- optional arguments and Swift defaults
|
|
48
|
+
- thrown errors and return type
|
|
49
|
+
- whether the result is synchronous or a Promise
|
|
50
|
+
|
|
51
|
+
Keep functions that resolve to the same JS name on the DSL. The plugin has no overload grouping. It reports two `@JS` members with one JS name on one object as a build error, so leave the overloads in `definition()` as they are.
|
|
52
|
+
|
|
53
|
+
Keep in DSL any unsupported signature such as variadics or unresolved generics. `inout` and `isolated` parameters are build errors. A `Promise` parameter is also unsupported; refactor it as described under Async functions.
|
|
54
|
+
|
|
55
|
+
These argument types work in a `@JS` signature on SDK 58:
|
|
56
|
+
|
|
57
|
+
- **Free-form values.** `Any`, `[Any]`, and `[String: Any]`, optional or nested, are accepted as arguments, return values, and properties. A 1.0 `[String: Any]` argument keeps its Swift type.
|
|
58
|
+
- **Closures.** A function-typed parameter receives the JS function. A closure that returns a value must be `throws`, and it blocks the caller until JS returns. A `@JS` function cannot return a closure. See `references/compatibility.md` for the rules.
|
|
59
|
+
- **Tuples.** An unlabeled tuple such as `(Int, String)` converts to a JS array, and a labeled tuple such as `(x: Double, y: Double)` to a JS object. Replacing a 1.0 array or dictionary type with a tuple changes the Swift API, so do it only when the user asks.
|
|
60
|
+
- **`JavaScriptValue`.** Take it as `borrowing JavaScriptValue`. On SDK 58 the DSL no longer accepts `JavaScriptValue` arguments or results, so such a member must migrate.
|
|
61
|
+
|
|
62
|
+
```swift
|
|
63
|
+
// 1.0, no longer compiles on SDK 58
|
|
64
|
+
Function("isFunction") { (value: JavaScriptValue) -> Bool in
|
|
65
|
+
return value.isFunction()
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// 2.0
|
|
69
|
+
@JS
|
|
70
|
+
func isFunction(_ value: borrowing JavaScriptValue) -> Bool {
|
|
71
|
+
return value.isFunction()
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Async functions
|
|
76
|
+
|
|
77
|
+
A `Promise` parameter is not supported in a `@JS` signature; 2.0 drops the trailing-`Promise` argument entirely. A Promise-returning function has three shapes in 2.0. Pick by how the underlying work produces its result.
|
|
78
|
+
|
|
79
|
+
**1. Standard `async` method.** The common case. Swift `async` maps to a JS Promise:
|
|
80
|
+
|
|
81
|
+
```swift
|
|
82
|
+
// 1.0
|
|
83
|
+
AsyncFunction("load") { (url: URL) -> String in
|
|
84
|
+
return try loadSynchronously(url)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// 2.0
|
|
88
|
+
@JS
|
|
89
|
+
func load(url: URL) async throws -> String {
|
|
90
|
+
return try await loadResource(url)
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
**2. Checked continuation.** When the result arrives through a delegate or completion handler that fires once, wrap it with `withCheckedThrowingContinuation` (or `withCheckedContinuation` for non-throwing callbacks, or an `AsyncStream` for repeated values). This is the usual refactor for a 1.0 `AsyncFunction` that took a trailing `Promise` instance:
|
|
95
|
+
|
|
96
|
+
```swift
|
|
97
|
+
// 1.0
|
|
98
|
+
AsyncFunction("start") { (promise: Promise) in
|
|
99
|
+
scanner.start(
|
|
100
|
+
onSuccess: { result in promise.resolve(result) },
|
|
101
|
+
onFailure: { error in promise.reject(error) }
|
|
102
|
+
)
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// 2.0
|
|
106
|
+
@JS
|
|
107
|
+
func start() async throws -> ScanResult {
|
|
108
|
+
return try await withCheckedThrowingContinuation { continuation in
|
|
109
|
+
scanner.start(
|
|
110
|
+
onSuccess: { result in continuation.resume(returning: result) },
|
|
111
|
+
onFailure: { error in continuation.resume(throwing: error) }
|
|
112
|
+
)
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Resume the continuation exactly once on every path. If the callback API cannot guarantee that, or the refactor is otherwise unsafe, keep the function on the DSL instead of forcing it.
|
|
118
|
+
|
|
119
|
+
**3. Synchronous method returning a `Task`.** The `Task` encodes to a promise that settles with its result. Use it when the work is naturally a `Task`, or when a promise is needed as a value nested inside another encoded result rather than as the function's own return:
|
|
120
|
+
|
|
121
|
+
```swift
|
|
122
|
+
// 2.0
|
|
123
|
+
@JS
|
|
124
|
+
func download(url: URL) -> Task<DownloadResult, any Error> {
|
|
125
|
+
return Task {
|
|
126
|
+
try await self.downloader.download(url)
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
This shape requires the `JavaScriptEncodable` conformance for `Task`, which `expo-modules-jsi` provides on SDK 58 (encode-only; a JS promise does not decode back into a `Task`). A `Task { }` created here starts on the JS thread. To run the work off it, see "Returning a `Task`" under Threading.
|
|
132
|
+
|
|
133
|
+
#### Threading: the architectural difference
|
|
134
|
+
|
|
135
|
+
This is the highest-risk part of an async migration, because the code compiles and the JS signature is unchanged while the work moves onto a different thread.
|
|
136
|
+
|
|
137
|
+
The two versions schedule async work from opposite starting points:
|
|
138
|
+
|
|
139
|
+
| | 1.0 `AsyncFunction` | 2.0 `async` `@JS` |
|
|
140
|
+
| --- | --- | --- |
|
|
141
|
+
| Where the body starts | off the JS thread, from the first statement | on the JS thread |
|
|
142
|
+
| When it leaves the JS thread | never runs there | at the first real suspension point |
|
|
143
|
+
| A body with no `await` | still runs off the JS thread | runs entirely on the JS thread |
|
|
144
|
+
|
|
145
|
+
A 2.0 async member is `@JavaScriptActor`-isolated and stays on the JS thread until it actually suspends. So the dangerous case is a function marked `async` whose body never awaits anything, or awaits only after doing substantial work. In 1.0 that body was off the JS thread from the start; migrated verbatim to 2.0, it now blocks the JS thread for its full duration. Nothing in the JS contract reveals this: the function still returns a promise.
|
|
146
|
+
|
|
147
|
+
Audit every `AsyncFunction` you migrate for what the body does before its first `await`:
|
|
148
|
+
|
|
149
|
+
- No `await` at all, or synchronous work ahead of the first `await`: the work is on the JS thread. Treat it as a regression unless the body is trivial.
|
|
150
|
+
- Blocking I/O, file or database access, image or crypto work, or an unbounded loop: never leave this on the JS actor.
|
|
151
|
+
- `.runOnQueue(...)` in 1.0: the queue was the contract. See the continuation pattern below.
|
|
152
|
+
|
|
153
|
+
To restore the 1.0 behavior, use the `@JS` macro's `.concurrent` option:
|
|
154
|
+
|
|
155
|
+
```swift
|
|
156
|
+
// Body runs off the JS thread, like a 1.0 AsyncFunction.
|
|
157
|
+
@JS(.concurrent)
|
|
158
|
+
func process(input: String) async throws -> String {
|
|
159
|
+
return try self.processor.process(input)
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// The option is variadic, so it combines with an explicit JS name.
|
|
163
|
+
@JS("doWork", .concurrent)
|
|
164
|
+
func performWork() async throws {}
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
Only the body moves. Arguments are still decoded on the JS thread and the result is still encoded back on it, so `.concurrent` changes execution, not the JS contract. This makes it the preferred fix for a migrated function that relied on 1.0 background execution: the intent is explicit and the body stays as written.
|
|
168
|
+
|
|
169
|
+
Three constraints:
|
|
170
|
+
|
|
171
|
+
- `.concurrent` is valid only on an `async` function. On anything else it is diagnosed on the `@JS` attribute.
|
|
172
|
+
- You must still write `async` yourself. The macro cannot add it, but the diagnostic for a synchronous function carries a fix-it that inserts it.
|
|
173
|
+
- The call sends the module or shared object off the JS thread, so in Swift 6 language mode the class must be `Sendable`. `Module` and `SharedObject` are not `Sendable`, so `@unchecked Sendable` is the only conformance a subclass can have. Newer `expo-modules-macros` versions add it themselves. Run `npx --no-install expo-modules swift:expand --symbol MyModule ios/MyModule.swift`: when the output has an `extension MyModule: @unchecked Sendable` block, do not declare it. Otherwise declare `@unchecked Sendable` on the class, as `expo-sqlite` does. Either way the compiler no longer checks this state, so check that the off-thread code touches only state that is safe to share, and say in a comment what guards it.
|
|
174
|
+
|
|
175
|
+
#### Returning a `Task`
|
|
176
|
+
|
|
177
|
+
A synchronous `@JS` function that returns a `Task` also gives JS a promise (shape 3), and the task can run the work off the JS thread. That happens only when the task does not inherit `@JavaScriptActor`:
|
|
178
|
+
|
|
179
|
+
```swift
|
|
180
|
+
// The detached task runs on the concurrent thread pool. The function returns right away.
|
|
181
|
+
@JS
|
|
182
|
+
func clearCache() -> Task<Void, any Error> {
|
|
183
|
+
return Task.detached {
|
|
184
|
+
try FileManager.default.removeItem(at: self.cacheDirectory)
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
- The macro isolates a synchronous `@JS` function to `@JavaScriptActor`, and `Task { }` inherits that isolation. The executor of that actor runs each job immediately on the current thread, so the body of a `Task { }` runs on the JS thread before the function even returns. Use `Task.detached { }`, or mark the function `nonisolated` so that its `Task { }` runs on the concurrent thread pool.
|
|
190
|
+
- In Swift 6 language mode the closure sends `self` off the JS thread, so the class needs the `@unchecked Sendable` conformance described under `.concurrent`.
|
|
191
|
+
- Throw inside the task, not from the function. An error that the function throws before it returns the task reaches JS as a synchronous exception, where a 1.0 `AsyncFunction` rejected its promise.
|
|
192
|
+
|
|
193
|
+
For a plain migration, prefer `@JS(.concurrent)`: it keeps the `async` signature and the body as written. Return a `Task` when the work already is one.
|
|
194
|
+
|
|
195
|
+
#### Sync and async pairs
|
|
196
|
+
|
|
197
|
+
1.0 modules often register one body twice: a `Function` for synchronous calls and an `AsyncFunction` that runs the same work off the JS thread. Merge the pair with `.withAsync`, which binds the function under its own JS name and again under the given name as a promise-returning variant that runs on the concurrent thread pool:
|
|
198
|
+
|
|
199
|
+
```swift
|
|
200
|
+
// 1.0
|
|
201
|
+
Function("readSync") { (path: String) throws -> String in
|
|
202
|
+
return try self.readFile(path)
|
|
203
|
+
}
|
|
204
|
+
AsyncFunction("read") { (path: String) throws -> String in
|
|
205
|
+
return try self.readFile(path)
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// 2.0
|
|
209
|
+
@JS("readSync", .withAsync("read"))
|
|
210
|
+
func readSync(path: String) throws -> String {
|
|
211
|
+
return try readFile(path)
|
|
212
|
+
}
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
Constraints:
|
|
216
|
+
|
|
217
|
+
- The function must be synchronous. On an `async` function the macro rejects the option and points to `.concurrent`.
|
|
218
|
+
- The name must be a string literal, and the option can appear only once.
|
|
219
|
+
- The variant is not isolated to the JS thread, so the body must be safe on any thread. A function isolated to a global actor such as `@MainActor` is rejected; mark it `nonisolated` when its isolation comes from elsewhere.
|
|
220
|
+
- In Swift 6 language mode the class needs the `@unchecked Sendable` conformance described under `.concurrent`.
|
|
221
|
+
|
|
222
|
+
#### Queue-pinned functions
|
|
223
|
+
|
|
224
|
+
For `.runOnQueue(.main)`, mark the `async` function `@MainActor`. The macro then does not isolate it to the JS thread, and the body runs on the main actor. `expo-haptics` migrated this way in SDK 58:
|
|
225
|
+
|
|
226
|
+
```swift
|
|
227
|
+
// 1.0
|
|
228
|
+
AsyncFunction("selectionAsync") {
|
|
229
|
+
UISelectionFeedbackGenerator().selectionChanged()
|
|
230
|
+
}
|
|
231
|
+
.runOnQueue(.main)
|
|
232
|
+
|
|
233
|
+
// 2.0
|
|
234
|
+
@JS
|
|
235
|
+
@MainActor
|
|
236
|
+
func selectionAsync() async {
|
|
237
|
+
UISelectionFeedbackGenerator().selectionChanged()
|
|
238
|
+
}
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
For a function pinned to any other queue, prefer restructuring the work onto the Swift Concurrency model (structured concurrency, an actor, or a detached task for blocking work). When that is not feasible because the queue itself is the contract, for example a library that must be called from one serial queue, convert to an `async` method that dispatches to that queue inside a checked continuation:
|
|
242
|
+
|
|
243
|
+
```swift
|
|
244
|
+
// 1.0
|
|
245
|
+
AsyncFunction("process") { (input: String) -> String in
|
|
246
|
+
return try self.processor.process(input)
|
|
247
|
+
}
|
|
248
|
+
.runOnQueue(processingQueue)
|
|
249
|
+
|
|
250
|
+
// 2.0
|
|
251
|
+
@JS
|
|
252
|
+
func process(input: String) async throws -> String {
|
|
253
|
+
return try await withCheckedThrowingContinuation { continuation in
|
|
254
|
+
processingQueue.async {
|
|
255
|
+
do {
|
|
256
|
+
continuation.resume(returning: try self.processor.process(input))
|
|
257
|
+
} catch {
|
|
258
|
+
continuation.resume(throwing: error)
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
## Properties and constants
|
|
266
|
+
|
|
267
|
+
Map a getter to a getter-only `@JS var`; map a getter/setter pair to a settable stored or computed `@JS var`:
|
|
268
|
+
|
|
269
|
+
```swift
|
|
270
|
+
// 1.0
|
|
271
|
+
Property("volume") { self.volume }
|
|
272
|
+
.set { self.volume = $0 }
|
|
273
|
+
|
|
274
|
+
// 2.0
|
|
275
|
+
@JS
|
|
276
|
+
var volume: Double = 1
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
Access control does not define JS mutability. Verify whether the declaration is syntactically settable; a stored `var` normally produces a JS setter.
|
|
280
|
+
|
|
281
|
+
Map a 1.0 `Constant` to a `@JS lazy var`. A 1.0 `Constant` runs its closure at the first read and caches the result. A `lazy` `@JS` property does the same: it is read-only from JS, and its first read stores the value as a data property on the JS object, so later reads do not call native code.
|
|
282
|
+
|
|
283
|
+
```swift
|
|
284
|
+
// 1.0
|
|
285
|
+
Constant("buildInfo") { computeBuildInfo() }
|
|
286
|
+
|
|
287
|
+
// 2.0
|
|
288
|
+
@JS
|
|
289
|
+
lazy var buildInfo = computeBuildInfo()
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
A `@JS let` also produces a read-only JS property, but it initializes with the module instance. Use it only for a cheap value whose evaluation time does not matter, such as a literal:
|
|
293
|
+
|
|
294
|
+
```swift
|
|
295
|
+
@JS
|
|
296
|
+
let apiVersion = 3
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
Do not map a 1.0 `Property` getter to a `lazy var`. A `Property` getter runs on every read, so a `lazy var` would freeze its first value.
|
|
300
|
+
|
|
301
|
+
## Events
|
|
302
|
+
|
|
303
|
+
Replace `Events(...)` plus `sendEvent(...)` with a typed function property:
|
|
304
|
+
|
|
305
|
+
```swift
|
|
306
|
+
@Record
|
|
307
|
+
struct ProgressEvent {
|
|
308
|
+
var percent: Double
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
// Explicit string preserves the old wire name.
|
|
312
|
+
@Event("onProgress")
|
|
313
|
+
var onProgress: (ProgressEvent) -> Void
|
|
314
|
+
|
|
315
|
+
func report(percent: Double) {
|
|
316
|
+
onProgress(ProgressEvent(percent: percent))
|
|
317
|
+
}
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
The default `@Event` wire name strips a leading `on` and decapitalizes the remainder: Swift `onProgress` emits `progress`. 1.0 modules commonly expose `onProgress`. During migration, pass the original wire name explicitly unless an intentional JS breaking change was approved.
|
|
321
|
+
|
|
322
|
+
For payloads, create or reuse a `JavaScriptEncodable` type instead of preserving an untyped dictionary. Migrate `OnStartObserving` and `OnStopObserving` to the `didStartListening(event:)`/`didStopListening(event:)` lifecycle hooks (see Views and lifecycle).
|
|
323
|
+
|
|
324
|
+
A `() -> Void` event sends `undefined` to the listener. A 1.0 `sendEvent("name")` without a body sent `{}`, so a listener that reads a field of its argument throws after a verbatim migration. Check the JS listeners. When any of them reads the argument, keep an object payload with an empty record:
|
|
325
|
+
|
|
326
|
+
```swift
|
|
327
|
+
@Record
|
|
328
|
+
struct ReadyEvent {}
|
|
329
|
+
|
|
330
|
+
@Event("onReady")
|
|
331
|
+
var onReady: (ReadyEvent) -> Void
|
|
332
|
+
|
|
333
|
+
// Sends {} as before.
|
|
334
|
+
onReady(ReadyEvent())
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
Use `() -> Void` only when no listener reads the argument, or when the user approves the change.
|
|
338
|
+
|
|
339
|
+
Default `@Event` dispatch schedules onto the JS thread and is callable from other isolation contexts. Do not use `sync: true`: SDK 58 core has no `emitSync`, so a synchronous event does not build.
|
|
340
|
+
|
|
341
|
+
## Shared objects
|
|
342
|
+
|
|
343
|
+
Move instance behavior from a `Class(...)` block onto the `SharedObject` subclass:
|
|
344
|
+
|
|
345
|
+
```swift
|
|
346
|
+
// 2.0
|
|
347
|
+
@SharedObject
|
|
348
|
+
final class Download: SharedObject {
|
|
349
|
+
@JS
|
|
350
|
+
init(url: URL) {
|
|
351
|
+
self.url = url
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
@JS
|
|
355
|
+
func pause() {}
|
|
356
|
+
|
|
357
|
+
@JS
|
|
358
|
+
var progress: Double { currentProgress }
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
@ExpoModule(classes: [Download.self])
|
|
362
|
+
final class DownloadModule: Module {}
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
Drop the leading owner argument used by instance DSL closures; use `self` in the real instance method. Preserve constructor arity and JS member names.
|
|
366
|
+
|
|
367
|
+
`@SharedObject` accepts any direct or indirect `SharedObject` subclass. That includes a `SharedRef<T>` subclass, such as `final class AudioPlayer: SharedRef<AVPlayer>`. Keep the superclass as it is.
|
|
368
|
+
|
|
369
|
+
The 1.0 DSL has no inheritance between JS classes: each `Class(...)` block exposes only its own entries. A `@SharedObject` class likewise exposes only the `@JS` members that it declares, so put the members of each JS class on that class.
|
|
370
|
+
|
|
371
|
+
SDK 58 core supplies the decoration and construction hooks for instance members, static members, and the `@JS init`. Never create both a 1.0 `Class(...)` entry and a 2.0 registration for the same class without confirming that core intentionally merges them.
|
|
372
|
+
|
|
373
|
+
Static members belong to shared objects, not modules: a module is exported to JS as an instance, so Swift `static` members on a `Module` class are not useful there. Keep module-level values as instance `@JS` members.
|
|
374
|
+
|
|
375
|
+
#### Static members
|
|
376
|
+
|
|
377
|
+
A static member installs on the JS class object itself, so JS reaches it as `Download.supportedSchemes()`, not through an instance. The 1.0 DSL has dedicated components for this: `StaticFunction` and `StaticAsyncFunction`. Unlike `Function`, they do not receive the instance as their first argument. There is no static *property* component in 1.0, so a static value was exposed as a `StaticFunction` returning it.
|
|
378
|
+
|
|
379
|
+
```swift
|
|
380
|
+
// 1.0
|
|
381
|
+
Class(Download.self) {
|
|
382
|
+
Constructor { (url: URL) in Download(url: url) }
|
|
383
|
+
|
|
384
|
+
// Instance function: receives the owner as its first argument.
|
|
385
|
+
Function("pause") { (download: Download) in
|
|
386
|
+
download.pause()
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
// Static: no owner argument, callable as Download.supportedSchemes()
|
|
390
|
+
StaticFunction("supportedSchemes") { () -> [String] in
|
|
391
|
+
Download.supportedSchemes
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
```swift
|
|
397
|
+
// 2.0
|
|
398
|
+
@SharedObject
|
|
399
|
+
final class Download: SharedObject {
|
|
400
|
+
@JS
|
|
401
|
+
init(url: URL) { self.url = url }
|
|
402
|
+
|
|
403
|
+
@JS
|
|
404
|
+
func pause() {}
|
|
405
|
+
|
|
406
|
+
@JS
|
|
407
|
+
static func supportedSchemes() -> [String] {
|
|
408
|
+
return Self.schemes
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
`StaticFunction` and `StaticAsyncFunction` both collapse into a `static` (or `class`) Swift declaration, with `async` carrying the distinction, exactly as `Function`/`AsyncFunction` do for instance members. Because 1.0 had no static property component, a `StaticFunction` that only returns a stored value can become a `@JS static var` in 2.0. That changes the JS contract from a call to a property access, so do it only when the user asks; a syntax migration keeps it a function.
|
|
414
|
+
|
|
415
|
+
Instance members bind onto the class prototype, while `static`/`class` members bind onto the JS class object through a separate hook. Confirm a migrated static member by calling it on the JS class, not on an instance: an instance-side test passes whether or not static binding works.
|
|
416
|
+
|
|
417
|
+
## Records
|
|
418
|
+
|
|
419
|
+
Attach `@Record`, remove field wrappers, and encode requiredness in the declaration:
|
|
420
|
+
|
|
421
|
+
```swift
|
|
422
|
+
@Record
|
|
423
|
+
struct Options {
|
|
424
|
+
var source: URL // required
|
|
425
|
+
var retries: Int = 3 // omittable; default applies
|
|
426
|
+
var label: String? // omittable and nullable
|
|
427
|
+
}
|
|
428
|
+
```
|
|
429
|
+
|
|
430
|
+
Rules:
|
|
431
|
+
|
|
432
|
+
- non-optional with no default: required
|
|
433
|
+
- any property with a default: omittable
|
|
434
|
+
- optional type: omittable and nullable
|
|
435
|
+
|
|
436
|
+
Preserve the 1.0 contract exactly. For example, migrate `@Field var source: URL? = nil` to `var source: URL?`, not to `var source: URL`, unless the user approved a breaking change.
|
|
437
|
+
|
|
438
|
+
Every non-`static`, non-`private`/`fileprivate`, non-`lazy` stored property is part of the 2.0 record surface. If the old type contains stored bookkeeping that was not a 1.0 field, make it `private` with a default value, move it out of the record, or leave the type on 1.0. Verify that each field supports the required `JavaScriptDecodable`/`JavaScriptEncodable` direction. Free-form fields such as `[String: Any]?` are accepted.
|
|
439
|
+
|
|
440
|
+
`@Record` applies to a struct, or to a `final class` with no inheritance clause. A 1.0 record class (`class Options: Record`) must become `final` and drop `: Record`. The macro adds the conformance, and other protocol conformances go in an extension. When the class has a superclass or subclasses, convert it to a struct only if no Swift caller relies on reference semantics; otherwise keep it on 1.0.
|
|
441
|
+
|
|
442
|
+
## Unions
|
|
443
|
+
|
|
444
|
+
`@Union` is the typed, N-case alternative to 1.0's `Either` types. It applies to a non-generic `enum` whose every case carries exactly one associated value:
|
|
445
|
+
|
|
446
|
+
```swift
|
|
447
|
+
// 1.0: JS `string | SourceOptions`, unwrapped by probing each side.
|
|
448
|
+
@JS
|
|
449
|
+
func load(_ source: Either<String, SourceOptions>) throws {
|
|
450
|
+
if let text: String = source.get() {
|
|
451
|
+
load(url: URL(string: text))
|
|
452
|
+
} else if let options: SourceOptions = source.get() {
|
|
453
|
+
load(url: options.url, headers: options.headers)
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
```swift
|
|
459
|
+
// 2.0: the same JS type, as a named enum.
|
|
460
|
+
@Union
|
|
461
|
+
enum Source {
|
|
462
|
+
case text(String)
|
|
463
|
+
case options(SourceOptions) // a @Record
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
@JS
|
|
467
|
+
func load(_ source: Source) throws {
|
|
468
|
+
switch source { // exhaustive; each payload keeps its static type
|
|
469
|
+
case .text(let text):
|
|
470
|
+
load(url: URL(string: text))
|
|
471
|
+
case .options(let options):
|
|
472
|
+
load(url: options.url, headers: options.headers)
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
The JS-visible type is unchanged: case order defines the accepted alternatives, so `Either<String, SourceOptions>` maps to cases in that same order. Decoding tries each case's payload in declaration order and the first match wins, which matters for overlapping types (`Int`/`Double`, `URL`/`String`): keep the 1.0 `Either` order, since reordering silently changes which case a given JS value lands in.
|
|
478
|
+
|
|
479
|
+
Besides `switch`, a value unwraps by payload type without naming the case, which is the closest analogue to 1.0's `get()`:
|
|
480
|
+
|
|
481
|
+
```swift
|
|
482
|
+
let text = try source.as(String.self) // throws on a mismatch
|
|
483
|
+
let options = try? source.as(SourceOptions.self) // SourceOptions?
|
|
484
|
+
```
|
|
485
|
+
|
|
486
|
+
A type the union does not carry is a compile error, not a runtime `nil`. A mismatch on a held value throws, where 1.0's `get()` returned `nil`, so a migrated probe chain must become a `switch` or a `try?`.
|
|
487
|
+
|
|
488
|
+
Constraints, each a compile error: a generic enum, no cases, a case with no payload or more than one, a default value on the payload, and two cases with the identical payload spelling.
|
|
489
|
+
|
|
490
|
+
Treat adopting `@Union` as an API-shape change to raise with the user rather than a mechanical step: it renames nothing in JS, but it does restructure Swift call sites.
|
|
491
|
+
|
|
492
|
+
## Views and lifecycle
|
|
493
|
+
|
|
494
|
+
Views are not covered by 2.0 yet. Keep UIKit `View`, `Prop`, view `Events`, and `OnViewDidUpdateProps` DSL entries on 1.0. Expansion tests alone do not prove the runtime update path exists.
|
|
495
|
+
|
|
496
|
+
The planned shape is a class marked `@ExpoView` whose props and event callbacks are declared once in a typed `@ViewProps` struct, instead of split between the native view and a hand-written JS prop type. The plugin implements both macros, but SDK 58 core does not declare them, so module source cannot use them. A module with views migrates its non-view members and keeps the view on the DSL. That is a normal mixed-mode result, not a failed migration.
|
|
497
|
+
|
|
498
|
+
Module lifecycle is core-owned rather than macro-generated. The DSL components map to hook methods with no-op defaults:
|
|
499
|
+
|
|
500
|
+
| 1.0 | 2.0 |
|
|
501
|
+
| --- | --- |
|
|
502
|
+
| `OnCreate` | `didCreate()` |
|
|
503
|
+
| `OnDestroy` | `willDestroy()` |
|
|
504
|
+
| `OnStartObserving` | `didStartListening(event:)` |
|
|
505
|
+
| `OnStopObserving` | `didStopListening(event:)` |
|
|
506
|
+
|
|
507
|
+
Rules:
|
|
508
|
+
|
|
509
|
+
- Use the `override` keyword when the class inherits `Module`/`BaseModule`; define the hooks directly (no `override`) when the conformance comes only from `@ExpoModule`. Hooks added only in a subclass of a macro module are not called; keep them on the class that declares the conformance.
|
|
510
|
+
- The listening hooks receive the event name. A module-wide 1.0 `OnStartObserving` ignores the argument; a per-event `OnStartObserving("name")` becomes a comparison on it.
|
|
511
|
+
- `didCreate()` runs after the module is registered, slightly later than 1.0 `OnCreate`, which fires before registration; `willDestroy()` runs at holder teardown. Verify nothing depends on the earlier timing before migrating `OnCreate`.
|
|
512
|
+
- DSL lifecycle components can remain during an incremental migration and each fires exactly once, but do not implement a DSL component and its hook for the same behavior, or the work runs twice.
|
|
513
|
+
|
|
514
|
+
`OnAppContextDestroys`, `OnAppEntersForeground`, `OnAppEntersBackground`, and `OnAppBecomesActive` have no 2.0 hook. Keep them in `definition()`.
|
|
515
|
+
|
|
516
|
+
## Mixed mode
|
|
517
|
+
|
|
518
|
+
`@ExpoModule` may coexist with a non-empty `definition()`; core merges the two surfaces. Keep only unsupported entries in the DSL and avoid duplicate names across macro and DSL registrations. `expo-sqlite` in SDK 58 is a shipped example: its module functions, properties, event, and lifecycle hooks use the 2.0 forms, while its shared-object classes stay in `definition()`.
|
|
519
|
+
|
|
520
|
+
Before deleting `definition()`, verify that it contains no:
|
|
521
|
+
|
|
522
|
+
- `Name(...)` entry whose name differs from the `@ExpoModule` name
|
|
523
|
+
- views or view events
|
|
524
|
+
- lifecycle or app-context listeners
|
|
525
|
+
- queue-pinned functions
|
|
526
|
+
|
|
527
|
+
## Contract checklist
|
|
528
|
+
|
|
529
|
+
For every migrated member compare before and after:
|
|
530
|
+
|
|
531
|
+
| Concern | Must remain stable |
|
|
532
|
+
| --- | --- |
|
|
533
|
+
| Module | registration name and `requireNativeModule` key |
|
|
534
|
+
| Function | JS name, accepted arity, omitted/default behavior, sync/Promise result |
|
|
535
|
+
| Property | JS name, read/write behavior, evaluation/caching |
|
|
536
|
+
| Event | listener string, payload shape, timing |
|
|
537
|
+
| Record | field names, requiredness, nullability, defaults |
|
|
538
|
+
| Shared object | constructor shape, prototype vs constructor placement, identity |
|
|
539
|
+
| Execution | JS actor, main actor, background queue, ordering |
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: expo-module
|
|
3
|
+
description: Guide for creating and writing Expo native modules and views using the Expo Modules API (Swift, Kotlin, TypeScript). Covers module definition DSL, native views, shared objects, config plugins, lifecycle hooks, autolinking, and type system. Use when building or modifying native modules for Expo. Not for migrating an existing Swift module from the definition DSL to the Expo Modules API 2.0 macros; use expo-migrate-module (from the expo-experiments plugin) for that.
|
|
4
|
+
license: MIT
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Writing Expo Modules
|
|
8
|
+
|
|
9
|
+
Complete reference for building native modules and views using the Expo Modules API. Covers Swift (iOS), Kotlin (Android), and TypeScript.
|
|
10
|
+
|
|
11
|
+
## When to Use
|
|
12
|
+
|
|
13
|
+
- Creating a new Expo native module or native view
|
|
14
|
+
- Adding native functionality (camera, sensors, system APIs) to an Expo app
|
|
15
|
+
- Wrapping platform SDKs for React Native consumption
|
|
16
|
+
- Building config plugins that modify native project files
|
|
17
|
+
- Adding Android, Apple, or web support to an existing Expo module
|
|
18
|
+
- Editing `expo-module.config.json`, config plugins, or lifecycle hooks
|
|
19
|
+
|
|
20
|
+
To migrate an existing Swift module from the definition DSL to the Expo Modules API 2.0 macros (`@ExpoModule`, `@JS`, `@Event`), use the `expo-migrate-module` skill (from the `expo-experiments` plugin) instead.
|
|
21
|
+
|
|
22
|
+
## References
|
|
23
|
+
|
|
24
|
+
Consult these resources as needed:
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
references/
|
|
28
|
+
create-expo-module.md Scaffolding and add-platform-support workflow, defaults, and quirks
|
|
29
|
+
native-module.md Module definition DSL: Name, Function, AsyncFunction, Property, Constant, Events, type system, shared objects
|
|
30
|
+
native-view.md Native view components: View, Prop, EventDispatcher, view lifecycle, ref-based functions
|
|
31
|
+
lifecycle.md Lifecycle hooks: module, iOS app/AppDelegate, Android activity/application listeners
|
|
32
|
+
config-plugin.md Config plugins: modifying Info.plist, AndroidManifest.xml, reading values in native code
|
|
33
|
+
module-config.md expo-module.config.json fields, file placement, and autolinking behavior
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Quick Start
|
|
37
|
+
|
|
38
|
+
Prefer `create-expo-module` over manually creating native module files and directories. In practice, the best path is usually to create the scaffold first and then build on top of it. The scaffold sets up the expected layout, `expo-module.config.json`, podspec or Gradle files, TypeScript bindings, and the standalone example app flow.
|
|
39
|
+
|
|
40
|
+
If an existing Expo module only needs another platform, use `create-expo-module add-platform-support` instead of manually copying native directories.
|
|
41
|
+
|
|
42
|
+
See [references/create-expo-module.md](references/create-expo-module.md) before scaffolding or extending a module. It covers:
|
|
43
|
+
|
|
44
|
+
- local vs standalone modules
|
|
45
|
+
- `--platform`, `--features`, `--barrel`, `--package-manager`, and non-interactive mode
|
|
46
|
+
- `expo.autolinking.nativeModulesDir`
|
|
47
|
+
- `add-platform-support` behavior and quirks
|
|
48
|
+
|
|
49
|
+
## Recommended Workflow
|
|
50
|
+
|
|
51
|
+
1. Choose the scaffold type first:
|
|
52
|
+
- **Local module** for one app
|
|
53
|
+
- **Standalone module** for reuse, monorepos, or publishing
|
|
54
|
+
2. Determine native `expo-module` features that you will need.
|
|
55
|
+
- Based on the user's instructions determine which feature scaffolding will be useful.
|
|
56
|
+
- Available features: `Constant`, `Function`, `AsyncFunction`, `Event`, `View`, `ViewEvent`, `SharedObject`
|
|
57
|
+
3. Scaffold deliberately:
|
|
58
|
+
- pass an explicit slug or path
|
|
59
|
+
- choose `--platform` intentionally instead of relying on defaults
|
|
60
|
+
- use `--features` to choose code samples which you will modify in the next step to match the real implementation.
|
|
61
|
+
4. Replace generated example code with the real implementation.
|
|
62
|
+
5. If you add a new platform later, prefer `add-platform-support` over manual file copying.
|
|
63
|
+
|
|
64
|
+
## Practical Scaffolding Rules
|
|
65
|
+
|
|
66
|
+
- Feature examples are **opt-in**. A newly scaffolded module may be minimal if no features were selected.
|
|
67
|
+
- `ViewEvent` implies `View`.
|
|
68
|
+
- Local modules do **not** generate an `index.ts` barrel by default. Use `--barrel` only if you want one.
|
|
69
|
+
- In non-interactive local scaffolding, pass the positional slug or path explicitly. `--name` changes the native class name, not the folder name.
|
|
70
|
+
- Local modules live in `expo.autolinking.nativeModulesDir` when configured, otherwise in `modules/`.
|
|
71
|
+
- Standalone modules have their own package metadata, scripts, and usually an example app. Local modules use the host app's tooling instead.
|
|
72
|
+
|
|
73
|
+
## Core File Shapes
|
|
74
|
+
|
|
75
|
+
The Swift and Kotlin DSL share the same structure. Swift is usually the clearest primary example; consult the references for feature-specific details.
|
|
76
|
+
|
|
77
|
+
## Module Structure Reference
|
|
78
|
+
|
|
79
|
+
The Swift and Kotlin DSL share the same structure. Both platforms are shown here for reference — in other reference files, Swift is shown as the primary language unless the Kotlin pattern meaningfully differs.
|
|
80
|
+
|
|
81
|
+
**Swift (iOS):**
|
|
82
|
+
|
|
83
|
+
```swift
|
|
84
|
+
import ExpoModulesCore
|
|
85
|
+
|
|
86
|
+
public class MyModule: Module {
|
|
87
|
+
public func definition() -> ModuleDefinition {
|
|
88
|
+
Name("MyModule")
|
|
89
|
+
|
|
90
|
+
Function("hello") { (name: String) -> String in
|
|
91
|
+
return "Hello \(name)!"
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**Kotlin (Android):**
|
|
98
|
+
|
|
99
|
+
```kotlin
|
|
100
|
+
package expo.modules.mymodule
|
|
101
|
+
|
|
102
|
+
import expo.modules.kotlin.modules.Module
|
|
103
|
+
import expo.modules.kotlin.modules.ModuleDefinition
|
|
104
|
+
|
|
105
|
+
class MyModule : Module() {
|
|
106
|
+
override fun definition() = ModuleDefinition {
|
|
107
|
+
Name("MyModule")
|
|
108
|
+
|
|
109
|
+
Function("hello") { name: String ->
|
|
110
|
+
"Hello $name!"
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
**TypeScript:**
|
|
117
|
+
|
|
118
|
+
```typescript
|
|
119
|
+
import { requireNativeModule } from "expo";
|
|
120
|
+
|
|
121
|
+
const MyModule = requireNativeModule("MyModule");
|
|
122
|
+
|
|
123
|
+
export function hello(name: string): string {
|
|
124
|
+
return MyModule.hello(name);
|
|
125
|
+
}
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### expo-module.config.json
|
|
129
|
+
|
|
130
|
+
```json
|
|
131
|
+
{
|
|
132
|
+
"platforms": ["android", "apple"],
|
|
133
|
+
"apple": {
|
|
134
|
+
"modules": ["MyModule"]
|
|
135
|
+
},
|
|
136
|
+
"android": {
|
|
137
|
+
"modules": ["expo.modules.mymodule.MyModule"]
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Note: iOS uses just the class name; Android uses the fully-qualified class name (package + class). See `references/module-config.md` for all fields.
|
|
143
|
+
|
|
144
|
+
## Submitting Feedback
|
|
145
|
+
If you encounter errors, misleading or outdated information in this skill, report it so Expo can improve:
|
|
146
|
+
```bash
|
|
147
|
+
npx --yes @expo/agent-cli@latest feedback --category skills --subject "expo-module" "<actionable feedback>"
|
|
148
|
+
```
|
|
149
|
+
Only submit when you have something specific and actionable to report. Include as much relevant context as possible.
|
|
150
|
+
If an agent repeatedly fails at an Expo task or the user has to step in, submit a brief report of the task, expected result, and what went wrong using `--category evals` and the relevant Expo package or command as `--subject`.
|