Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | 2x 2x 4x 4x 4x 1x 1x 1x 1x | /**
* Coherent.js Universal Runtime
* Complete standalone runtime that works in any JavaScript environment
*/
// Re-export everything from core packages
export * from '@coherent.js/core';
export * from '@coherent.js/client';
export * from '@coherent.js/web-components';
// Universal runtime components
export { BrowserRuntime } from './runtimes/browser.js';
export { EdgeRuntime } from './runtimes/edge.js';
export { StaticRuntime } from './runtimes/static.js';
export { DesktopRuntime } from './runtimes/desktop.js';
// Module loaders
export { UniversalLoader } from './loaders/universal-loader.js';
export { ComponentLoader } from './loaders/component-loader.js';
// Main runtime factory
export { createRuntime, detectRuntime, RuntimeEnvironment } from './runtime-factory.js';
import { createRuntime, detectRuntime } from './runtime-factory.js';
// Utilities
export { RuntimeDetector } from './utils/runtime-detector.js';
export { ModuleResolver } from './utils/module-resolver.js';
export { AssetManager } from './utils/asset-manager.js';
// Main universal entry point
export async function createCoherentApp(options = {}) {
const runtime = await createRuntime(options);
return runtime.createApp(options);
}
// Simple standalone rendering for quick start
export function renderApp(component, props = {}, target = null) {
const runtime = detectRuntime();
// If runtime is an object with renderApp method (mocked in tests), use it
Iif (typeof runtime === 'object' && runtime.renderApp) {
return runtime.renderApp(component, props, target);
}
// Otherwise detectRuntime returns a string, so we'd need to create a runtime
// This is a simplified version for the actual use case
throw new Error('renderApp requires a proper runtime implementation');
}
// Global initialization for script tag usage
Eif (typeof window !== 'undefined') {
window.Coherent = {
// Core functionality
render: async (obj) => {
const { render } = await import('@coherent.js/core');
return render(obj);
},
// Hydration
hydrate: async (element, component, props) => {
const { hydrate } = await import('@coherent.js/client');
return hydrate(element, component, props);
},
// Web Components
defineComponent: async (name, component, options) => {
const { defineComponent } = await import('@coherent.js/web-components');
return defineComponent(name, component, options);
},
// Universal app creation
createApp: createCoherentApp,
renderApp,
// Version info
VERSION: '1.1.1'
};
// Auto-initialize if data-coherent-auto is present
Iif (document.querySelector('[data-coherent-auto]')) {
document.addEventListener('DOMContentLoaded', async () => {
const { autoHydrate } = await import('@coherent.js/client');
autoHydrate(window.componentRegistry || {});
});
}
}
export const VERSION = '1.1.1';
|