Skip to content

Conversation

@Gaubee
Copy link
Contributor

@Gaubee Gaubee commented Jan 21, 2026

Summary

  • Add WujieRuntimeConfig interface for declarative wujie configuration
  • Implement URL rewriting via fetch interception and htmlLoader plugin (using DOMParser)
  • Support wujieConfig in both local and remote miniapp configurations
  • Rename rewriteBase to injectBaseTag for clarity

Key Changes

New Type

interface WujieRuntimeConfig {
  rewriteAbsolutePaths?: boolean;  // Rewrite /xxx paths via fetch + htmlLoader
  alive?: boolean;
  fiber?: boolean;
  sync?: boolean;
}

Configuration Example

// vite.config.ts
{
  metadataUrl: '...',
  dirName: 'rwa-hub',
  server: { runtime: 'wujie', wujieConfig: { rewriteAbsolutePaths: true } },
  build: { runtime: 'wujie', wujieConfig: { rewriteAbsolutePaths: true } },
}

Implementation Details

  • rewriteHtmlAbsolutePaths: Uses DOMParser to rewrite /xxx paths in HTML
  • createAbsolutePathRewriter: Intercepts fetch requests and rewrites URLs to remote origin

…compliance

- Create ContainerManager interface with ContainerHandle
- Implement IframeContainerManager (extracted from iframe-manager)
- Implement WujieContainerManager (using wujie library)
- Create container factory for runtime type switching
- Refactor launchApp to use container factory based on manifest.runtime
- Update activateApp/deactivateApp to use containerHandle methods
- Update finalizeCloseApp to properly destroy containers
- Add containerType and containerHandle to MiniappInstance
- Deprecate iframeRef in favor of containerHandle.element

BREAKING CHANGE: MiniappInstance now uses containerHandle instead of iframeRef
- Add wujie package (required by wujie-container)
- Add container unit tests (10 tests for IframeContainerManager)
- Fix iframe.sandbox compatibility for jsdom test environment
- Support headless mode in dev.ts for non-TTY environments (CI)
- Add sendKeyAppContext() to broadcast keyapp:context-update after container attach
- Calculate capsule safe area dynamically (top margin + capsule height + padding)
- Enable miniapps to receive context via window message listener
- Update rwa-hub to listen for context and apply --f7-safe-area-top CSS variable
- Update white-book docs with CSS guidelines and container architecture
- Add WujieRuntimeConfig interface with rewriteAbsolutePaths option
- Implement DOMParser-based htmlLoader for robust HTML path rewriting
- Use Request object for unified fetch interception with hash support
- Support wujieConfig in both local and remote miniapp plugins
- Remove broken regex-based htmlLoader that was losing paths

Breaking: rewriteBase replaced with wujieConfig.rewriteAbsolutePaths
@Gaubee Gaubee merged commit 1dadd9a into main Jan 21, 2026
5 checks passed
@Gaubee Gaubee deleted the feat/wujie-container-refactor branch January 21, 2026 08:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants