Documentation
¶
Overview ¶
Package dev provides development session management for Flutter and React Native hot reload.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnsureCustomDevice ¶
EnsureCustomDevice ensures Flutter custom_devices.json has mobai-ios configured.
Types ¶
type FlutterHandler ¶ added in v0.2.0
type FlutterHandler struct {
// contains filtered or unexported fields
}
FlutterHandler implements FrameworkHandler for Flutter projects.
func NewFlutterHandler ¶ added in v0.2.0
func NewFlutterHandler(mobaiURL string, noAttach bool) *FlutterHandler
NewFlutterHandler creates a new Flutter handler.
func (*FlutterHandler) Attach ¶ added in v0.2.0
func (h *FlutterHandler) Attach(ctx context.Context, deviceID string, debugOutput <-chan mobai.DebugOutput) error
Attach finds the VM Service URL and runs flutter attach.
func (*FlutterHandler) DebugConfig ¶ added in v0.2.0
func (h *FlutterHandler) DebugConfig() *mobai.DebugConfig
DebugConfig returns nil for Flutter (no special environment needed).
func (*FlutterHandler) Setup ¶ added in v0.2.0
func (h *FlutterHandler) Setup(ctx context.Context) error
Setup configures Flutter custom device for MobAI.
func (*FlutterHandler) Stop ¶ added in v0.2.0
func (h *FlutterHandler) Stop()
type FrameworkHandler ¶ added in v0.2.0
type FrameworkHandler interface {
// Setup runs before app install (e.g., Flutter custom device, Metro start)
Setup(ctx context.Context) error
// DebugConfig returns environment variables and arguments for app launch
DebugConfig() *mobai.DebugConfig
// Attach runs after app launch to enable hot reload
Attach(ctx context.Context, deviceID string, debugOutput <-chan mobai.DebugOutput) error
// Stop cleans up resources
Stop()
}
FrameworkHandler handles framework-specific dev workflow.
type ReactNativeHandler ¶ added in v0.2.0
type ReactNativeHandler struct {
// contains filtered or unexported fields
}
ReactNativeHandler implements FrameworkHandler for React Native projects.
func NewReactNativeHandler ¶ added in v0.2.0
func NewReactNativeHandler(metroPort int, showLogs bool, mobaiURL string) *ReactNativeHandler
NewReactNativeHandler creates a new React Native handler.
func (*ReactNativeHandler) Attach ¶ added in v0.2.0
func (h *ReactNativeHandler) Attach(ctx context.Context, deviceID string, debugOutput <-chan mobai.DebugOutput) error
Attach monitors app output for React Native development.
func (*ReactNativeHandler) DebugConfig ¶ added in v0.2.0
func (h *ReactNativeHandler) DebugConfig() *mobai.DebugConfig
DebugConfig returns launch arguments to configure Metro connection. React Native reads RCT_jsLocation from NSUserDefaults, which can be set via launch arguments.
func (*ReactNativeHandler) Setup ¶ added in v0.2.0
func (h *ReactNativeHandler) Setup(ctx context.Context) error
Setup checks if Metro is running and starts it if not.
func (*ReactNativeHandler) Stop ¶ added in v0.2.0
func (h *ReactNativeHandler) Stop()
Stop cleans up Metro if we started it.
type RuntimeError ¶
type RuntimeError struct {
Err error
}
RuntimeError wraps runtime errors to distinguish from CLI errors
func (*RuntimeError) Error ¶
func (e *RuntimeError) Error() string
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Session manages a development session with MobAI.
func NewSession ¶
func NewSession(mobaiURL, deviceID, ipaPath string, h FrameworkHandler) *Session
NewSession creates a new development session.
func (*Session) SetSkipInstall ¶
SetSkipInstall configures the session to skip installation.