@coherent.js/runtime 1.0.0-beta.2

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/package.json ADDED
@@ -0,0 +1,92 @@
1
+ {
2
+ "name": "@coherent.js/runtime",
3
+ "version": "1.0.0-beta.2",
4
+ "description": "Runtime for Coherent.js - works in browsers, edge workers, and any JavaScript environment",
5
+ "type": "module",
6
+ "main": "dist/coherent-universal.js",
7
+ "module": "dist/coherent-universal.js",
8
+ "types": "./types/index.d.ts",
9
+ "browser": "dist/coherent-universal.js",
10
+ "unpkg": "dist/coherent-universal.min.js",
11
+ "jsdelivr": "dist/coherent-universal.min.js",
12
+ "exports": {
13
+ ".": {
14
+ "browser": "./dist/coherent-universal.js",
15
+ "import": "./dist/coherent-universal.js",
16
+ "types": "./types/index.d.ts"
17
+ },
18
+ "./browser": {
19
+ "import": "./dist/coherent-browser.js",
20
+ "types": "./types/browser.d.ts"
21
+ },
22
+ "./edge": {
23
+ "import": "./dist/coherent-edge.js",
24
+ "types": "./types/edge.d.ts"
25
+ },
26
+ "./static": {
27
+ "import": "./dist/coherent-static.js",
28
+ "types": "./types/static.d.ts"
29
+ },
30
+ "./desktop": {
31
+ "import": "./dist/coherent-desktop.js",
32
+ "types": "./types/desktop.d.ts"
33
+ }
34
+ },
35
+ "dependencies": {
36
+ "@coherent.js/client": "1.0.0-beta.2",
37
+ "@coherent.js/core": "1.0.0-beta.2",
38
+ "@coherent.js/web-components": "1.0.0-beta.2"
39
+ },
40
+ "devDependencies": {
41
+ "esbuild": "^0.25.9",
42
+ "vitest": "^3.2.4",
43
+ "@playwright/test": "^1.40.0",
44
+ "jsdom": "^25.0.0",
45
+ "vite": "^6.4.1"
46
+ },
47
+ "keywords": [
48
+ "coherentjs",
49
+ "universal",
50
+ "runtime",
51
+ "browser",
52
+ "edge-workers",
53
+ "cloudflare",
54
+ "deno",
55
+ "bun",
56
+ "static-site",
57
+ "desktop",
58
+ "electron",
59
+ "standalone",
60
+ "spa"
61
+ ],
62
+ "author": "Thomas Drouvin <thomas.drouvin@example.com>",
63
+ "license": "MIT",
64
+ "repository": {
65
+ "type": "git",
66
+ "url": "git+https://github.com/Tomdrouv1/coherent.js.git",
67
+ "directory": "packages/runtime"
68
+ },
69
+ "engines": {
70
+ "node": ">=18.0.0"
71
+ },
72
+ "browserslist": [
73
+ "defaults",
74
+ "not IE 11"
75
+ ],
76
+ "files": [
77
+ "dist/",
78
+ "types/",
79
+ "README.md",
80
+ "LICENSE"
81
+ ],
82
+ "scripts": {
83
+ "build": "node build.mjs",
84
+ "test": "vitest run",
85
+ "test:watch": "vitest",
86
+ "test:browser": "playwright test",
87
+ "clean": "rm -rf dist/ types/",
88
+ "dev": "node src/dev-server.js",
89
+ "serve": "python -m http.server 8080",
90
+ "preview": "vite preview"
91
+ }
92
+ }
@@ -0,0 +1,2 @@
1
+ export * from './index';
2
+ export { BrowserRuntime } from './index';
@@ -0,0 +1,2 @@
1
+ export * from './index';
2
+ export { EdgeRuntime } from './index';
@@ -0,0 +1,118 @@
1
+
2
+ /**
3
+ * Type definitions for @coherent.js/runtime
4
+ */
5
+
6
+ export * from '@coherent.js/core';
7
+ export * from '@coherent.js/client';
8
+ export * from '@coherent.js/web-components';
9
+
10
+ // Runtime environments
11
+ export enum RuntimeEnvironment {
12
+ BROWSER = 'browser',
13
+ NODE = 'node',
14
+ EDGE = 'edge',
15
+ CLOUDFLARE = 'cloudflare',
16
+ DENO = 'deno',
17
+ BUN = 'bun',
18
+ ELECTRON = 'electron',
19
+ TAURI = 'tauri',
20
+ STATIC = 'static'
21
+ }
22
+
23
+ // Runtime capabilities
24
+ export interface RuntimeCapabilities {
25
+ dom: boolean;
26
+ ssr: boolean;
27
+ filesystem: boolean;
28
+ fetch: boolean;
29
+ websockets: boolean;
30
+ workers: boolean;
31
+ storage: boolean;
32
+ crypto: boolean;
33
+ streams: boolean;
34
+ }
35
+
36
+ // Runtime info
37
+ export interface RuntimeInfo {
38
+ environment: RuntimeEnvironment;
39
+ capabilities: RuntimeCapabilities;
40
+ version: string | null;
41
+ features: string[];
42
+ userAgent: string | null;
43
+ platform: any;
44
+ }
45
+
46
+ // App creation
47
+ export interface AppOptions {
48
+ environment?: RuntimeEnvironment;
49
+ autoHydrate?: boolean;
50
+ enableWebComponents?: boolean;
51
+ enablePerformanceMonitoring?: boolean;
52
+ routingMode?: 'hash' | 'history' | 'memory' | 'none';
53
+ [key: string]: any;
54
+ }
55
+
56
+ export interface CoherentApp {
57
+ component(name: string, component: Function, options?: any): Function;
58
+ route?(path: string, handler: Function): void;
59
+ navigate?(path: string): void;
60
+ render(component: Function | string, props?: any, target?: string | Element): Promise<any>;
61
+ mount(component: Function | string, target?: string | Element): Promise<any>;
62
+ unmount(target?: string | Element): void;
63
+ getRuntime(): any;
64
+ }
65
+
66
+ // Main factory functions
67
+ export function createCoherentApp(options?: AppOptions): Promise<CoherentApp>;
68
+ export function renderApp(component: Function | string, props?: any, target?: string | Element): any;
69
+ export function detectRuntime(): RuntimeEnvironment;
70
+ export function createRuntime(options?: AppOptions): Promise<any>;
71
+ export function getRuntimeCapabilities(environment?: RuntimeEnvironment): RuntimeCapabilities;
72
+ export function getRuntimeInfo(): RuntimeInfo;
73
+
74
+ // Runtime classes
75
+ export class BrowserRuntime {
76
+ constructor(options?: any);
77
+ initialize(): Promise<void>;
78
+ registerComponent(name: string, component: Function, options?: any): Function;
79
+ createApp(options?: any): Promise<CoherentApp>;
80
+ static createQuickApp(components?: Record<string, Function>, options?: any): Promise<CoherentApp>;
81
+ }
82
+
83
+ export class EdgeRuntime {
84
+ constructor(options?: any);
85
+ createApp(options?: any): any;
86
+ handleRequest(request: Request): Promise<Response>;
87
+ static createApp(options?: any): any;
88
+ }
89
+
90
+ export class StaticRuntime {
91
+ constructor(options?: any);
92
+ createApp(options?: any): any;
93
+ build(): Promise<any>;
94
+ static buildSite(pages?: any, components?: Record<string, Function>, options?: any): Promise<any>;
95
+ }
96
+
97
+ // Utility functions
98
+ export class RuntimeDetector {
99
+ static detect(): RuntimeEnvironment;
100
+ static getCapabilities(environment?: RuntimeEnvironment): RuntimeCapabilities;
101
+ }
102
+
103
+ // Global window interface (for script tag usage)
104
+ declare global {
105
+ interface Window {
106
+ Coherent?: {
107
+ render(obj: any): Promise<string>;
108
+ hydrate(element: Element, component: Function, props?: any): Promise<any>;
109
+ defineComponent(name: string, component: Function, options?: any): Promise<any>;
110
+ createApp(options?: AppOptions): Promise<CoherentApp>;
111
+ renderApp(component: Function | string, props?: any, target?: string | Element): any;
112
+ VERSION: string;
113
+ };
114
+ componentRegistry?: Record<string, Function>;
115
+ }
116
+ }
117
+
118
+ export const VERSION: string;
@@ -0,0 +1,2 @@
1
+ export * from './index';
2
+ export { StaticRuntime } from './index';