Create a self-modifying single-file HTML application that bundles JavaScript package files (package.json, source files, etc.) into one HTML file. The app should work offline, provide editing capabilities, and be able to load a development environment using WebContainer.io.
- Create the base HTML structure with appropriate sections for: ✅
- Runtime application code (top) ✅
- Source code bundle (bottom, loaded on-demand) ✅
- Implement environment detection to handle: ✅
- file:// protocol (works offline with limitations) ✅
- localhost (for development) ✅
- https:// (for hosted version) ✅
- Create appropriate UI elements based on detected environment ✅
- Implement File System Access API integration ✅
- Select and validate file handle ✅
- Persist file handle in IndexedDB ✅
- Add permissions management ✅
- Create a mechanism to modify and save the HTML file ✅
- Implement fallback download mechanism for browsers without FS Access API ✅
- Create JSON structure to store source files within the HTML ✅
- Build editor interface (using CodeMirror) ✅
- Implement file navigation and editing capabilities ✅
- Add versioning and change tracking system (partial) 🔄
- Add WebContainer.io initialization (lazy-loaded) ✅
- Create virtual filesystem from embedded source files ✅
- Implement pnpm dependency installation ✅
- Use pnpm instead of npm/yarn for better WebContainer compatibility ✅
- Set up caching strategy for efficient package management ✅
- Add terminal/console for command execution ✅
- Create preview system for running the application ✅
- Add ability to export as ZIP package 🔄
- Implement optional Git integration ⏳
- Create bi-directional sync between editor and WebContainer 🔄
- Add build system to update runtime code from source 🔄
- Optimize load performance (lazy-loading, conditional execution) 🔄
- Improve caching strategies for dependencies ⏳
- Add helpful documentation and examples 🔄
- Polish UI/UX for different devices and environments ⏳
- Environment Detector: Full implementation of protocol detection and feature availability
- File System Manager: Complete implementation with IndexedDB persistence and fallback mechanisms
- Source Bundle Manager: Core functionality for storing and managing embedded files
- Editor Manager: Complete integration with CodeMirror for syntax highlighting and editing
- WebContainer Manager: Full implementation of in-browser Node.js environment
- Versioning System: Basic tracking of file changes, needs enhanced diffing and history
- Build Integration: Work-in-progress system to rebuild runtime code from source
- Export Systems: Basic ZIP export capability being implemented
The project follows a modular architecture with clear separation of concerns:
- Each component is implemented as a manager class with well-defined responsibilities
- Data flow is managed through events and callbacks
- Configuration options are centralized for easy customization
- Error handling is implemented across different environments
- Use ESM modules for better code organization
- Use pnpm for package management (better compatibility with WebContainer)
- Implement careful error handling for different environments
- Balance file size and functionality
- Ensure proper sandboxing for security
- Handle browser compatibility challenges
- Complete the bi-directional sync between editor and WebContainer
- Finalize the build system for runtime code updates
- Complete ZIP export functionality
- Enhance documentation with examples and tutorials
- Implement performance optimizations for large projects