@rayburst/cli 0.1.0

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.
@@ -0,0 +1,122 @@
1
+ import { i as init_1, r as rayburstCli__mf_v__runtimeInit__mf_v__ } from './rayburstCli__mf_v__runtimeInit__mf_v__-C_SVfzik.js';
2
+ import exposesMap from './virtualExposes-DwA08f_D.js';
3
+ import { _ as __vitePreload } from './preload-helper-Dea3Szod.js';
4
+
5
+ const importMap = {
6
+
7
+ "react": async () => {
8
+ let pkg = await __vitePreload(() => import('./index-9R1akZrm.js').then(n => n.i),true ?[]:void 0);
9
+ return pkg;
10
+ }
11
+ ,
12
+ "react-dom": async () => {
13
+ let pkg = await __vitePreload(() => import('./index-BW-RulSg.js').then(n => n.i),true ?[]:void 0);
14
+ return pkg;
15
+ }
16
+
17
+ };
18
+ const usedShared = {
19
+
20
+ "react": {
21
+ name: "react",
22
+ version: "19.2.0",
23
+ scope: ["default"],
24
+ loaded: false,
25
+ from: "rayburstCli",
26
+ async get () {
27
+ usedShared["react"].loaded = true;
28
+ const {"react": pkgDynamicImport} = importMap;
29
+ const res = await pkgDynamicImport();
30
+ const exportModule = {...res};
31
+ // All npm packages pre-built by vite will be converted to esm
32
+ Object.defineProperty(exportModule, "__esModule", {
33
+ value: true,
34
+ enumerable: false
35
+ });
36
+ return function () {
37
+ return exportModule
38
+ }
39
+ },
40
+ shareConfig: {
41
+ singleton: true,
42
+ requiredVersion: "^19.0.0",
43
+
44
+ }
45
+ }
46
+ ,
47
+ "react-dom": {
48
+ name: "react-dom",
49
+ version: "19.2.0",
50
+ scope: ["default"],
51
+ loaded: false,
52
+ from: "rayburstCli",
53
+ async get () {
54
+ usedShared["react-dom"].loaded = true;
55
+ const {"react-dom": pkgDynamicImport} = importMap;
56
+ const res = await pkgDynamicImport();
57
+ const exportModule = {...res};
58
+ // All npm packages pre-built by vite will be converted to esm
59
+ Object.defineProperty(exportModule, "__esModule", {
60
+ value: true,
61
+ enumerable: false
62
+ });
63
+ return function () {
64
+ return exportModule
65
+ }
66
+ },
67
+ shareConfig: {
68
+ singleton: true,
69
+ requiredVersion: "^19.0.0",
70
+
71
+ }
72
+ }
73
+
74
+ };
75
+ const usedRemotes = [
76
+ {
77
+ entryGlobalName: "rayburstApp",
78
+ name: "rayburstApp",
79
+ type: "module",
80
+ entry: "https://www.rayburst.app/remoteEntry.js",
81
+ shareScope: "default",
82
+ }
83
+
84
+ ];
85
+
86
+ const initTokens = {};
87
+ const shareScopeName = "default";
88
+ const mfName = "rayburstCli";
89
+ async function init(shared = {}, initScope = []) {
90
+ const initRes = init_1({
91
+ name: mfName,
92
+ remotes: usedRemotes,
93
+ shared: usedShared,
94
+ plugins: [],
95
+ shareStrategy: 'version-first'
96
+ });
97
+ // handling circular init calls
98
+ var initToken = initTokens[shareScopeName];
99
+ if (!initToken)
100
+ initToken = initTokens[shareScopeName] = { from: mfName };
101
+ if (initScope.indexOf(initToken) >= 0) return;
102
+ initScope.push(initToken);
103
+ initRes.initShareScopeMap('default', shared);
104
+ try {
105
+ await Promise.all(await initRes.initializeSharing('default', {
106
+ strategy: 'version-first',
107
+ from: "build",
108
+ initScope
109
+ }));
110
+ } catch (e) {
111
+ console.error(e);
112
+ }
113
+ rayburstCli__mf_v__runtimeInit__mf_v__.initResolve(initRes);
114
+ return initRes
115
+ }
116
+
117
+ function getExposes(moduleName) {
118
+ if (!(moduleName in exposesMap)) throw new Error(`Module ${moduleName} does not exist in container.`)
119
+ return (exposesMap[moduleName])().then(res => () => res)
120
+ }
121
+
122
+ export { getExposes as get, init };
@@ -0,0 +1,5 @@
1
+ const exposesMap = {
2
+
3
+ };
4
+
5
+ export { exposesMap as default };
@@ -0,0 +1,64 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en" class="h-full">
3
+ <head>
4
+ <script type="module" src="/assets/hostInit-CYZeRSfr.js"></script>
5
+
6
+ <meta charset="UTF-8" />
7
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
8
+ <link rel="icon" href="http://localhost:3000/rayburst-letter.png" />
9
+ <title>Rayburst</title>
10
+ <style>
11
+ /* Ensure full height for HTML and body */
12
+ html, body, #app {
13
+ height: 100%;
14
+ margin: 0;
15
+ padding: 0;
16
+ }
17
+
18
+ /* Scoped styles for loading screen only - do not interfere with remote app styles */
19
+ .loading-container {
20
+ display: flex;
21
+ flex-direction: column;
22
+ align-items: center;
23
+ justify-content: center;
24
+ height: 100vh;
25
+ width: 100%;
26
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
27
+ color: white;
28
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
29
+ 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
30
+ sans-serif;
31
+ -webkit-font-smoothing: antialiased;
32
+ -moz-osx-font-smoothing: grayscale;
33
+ }
34
+
35
+ .spinner {
36
+ width: 50px;
37
+ height: 50px;
38
+ border: 4px solid rgba(255, 255, 255, 0.3);
39
+ border-top-color: white;
40
+ border-radius: 50%;
41
+ animation: spin 1s linear infinite;
42
+ margin-bottom: 20px;
43
+ }
44
+
45
+ @keyframes spin {
46
+ to { transform: rotate(360deg); }
47
+ }
48
+
49
+ .loading-text {
50
+ font-size: 18px;
51
+ font-weight: 500;
52
+ }
53
+ </style>
54
+ <script type="module" crossorigin src="/assets/index-Cap7gsMp.js"></script>
55
+ </head>
56
+ <body class="h-full">
57
+ <div id="app" class="h-full">
58
+ <div class="loading-container">
59
+ <div class="spinner"></div>
60
+ <div class="loading-text">Loading Rayburst...</div>
61
+ </div>
62
+ </div>
63
+ </body>
64
+ </html>
package/index.html ADDED
@@ -0,0 +1,62 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en" class="h-full">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <link rel="icon" href="http://localhost:3000/rayburst-letter.png" />
7
+ <title>Rayburst</title>
8
+ <style>
9
+ /* Ensure full height for HTML and body */
10
+ html, body, #app {
11
+ height: 100%;
12
+ margin: 0;
13
+ padding: 0;
14
+ }
15
+
16
+ /* Scoped styles for loading screen only - do not interfere with remote app styles */
17
+ .loading-container {
18
+ display: flex;
19
+ flex-direction: column;
20
+ align-items: center;
21
+ justify-content: center;
22
+ height: 100vh;
23
+ width: 100%;
24
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
25
+ color: white;
26
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
27
+ 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
28
+ sans-serif;
29
+ -webkit-font-smoothing: antialiased;
30
+ -moz-osx-font-smoothing: grayscale;
31
+ }
32
+
33
+ .spinner {
34
+ width: 50px;
35
+ height: 50px;
36
+ border: 4px solid rgba(255, 255, 255, 0.3);
37
+ border-top-color: white;
38
+ border-radius: 50%;
39
+ animation: spin 1s linear infinite;
40
+ margin-bottom: 20px;
41
+ }
42
+
43
+ @keyframes spin {
44
+ to { transform: rotate(360deg); }
45
+ }
46
+
47
+ .loading-text {
48
+ font-size: 18px;
49
+ font-weight: 500;
50
+ }
51
+ </style>
52
+ </head>
53
+ <body class="h-full">
54
+ <div id="app" class="h-full">
55
+ <div class="loading-container">
56
+ <div class="spinner"></div>
57
+ <div class="loading-text">Loading Rayburst...</div>
58
+ </div>
59
+ </div>
60
+ <script type="module" src="/src/main.tsx"></script>
61
+ </body>
62
+ </html>
package/package.json ADDED
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "@rayburst/cli",
3
+ "version": "0.1.0",
4
+ "description": "Rayburst CLI - A module federation host for Rayburst app",
5
+ "type": "module",
6
+ "bin": {
7
+ "rayburst": "./bin/rayburst.js"
8
+ },
9
+ "main": "./server.js",
10
+ "scripts": {
11
+ "dev": "vite",
12
+ "build": "vite build",
13
+ "start": "node server.js",
14
+ "prepublishOnly": "npm run build"
15
+ },
16
+ "keywords": [
17
+ "rayburst",
18
+ "cli",
19
+ "module-federation",
20
+ "vite",
21
+ "react"
22
+ ],
23
+ "author": "Rayburst Team",
24
+ "license": "MIT",
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "https://github.com/rayburst/rayburst-cli.git"
28
+ },
29
+ "homepage": "https://rayburst.app",
30
+ "bugs": {
31
+ "url": "https://github.com/rayburst/rayburst-cli/issues"
32
+ },
33
+ "publishConfig": {
34
+ "access": "public"
35
+ },
36
+ "files": [
37
+ "dist",
38
+ "bin",
39
+ "server.js",
40
+ "index.html",
41
+ "README.md"
42
+ ],
43
+ "dependencies": {
44
+ "chalk": "^5.3.0",
45
+ "commander": "^11.1.0",
46
+ "express": "^4.18.2"
47
+ },
48
+ "devDependencies": {
49
+ "@module-federation/vite": "^1.9.0",
50
+ "@vitejs/plugin-react": "^4.2.1",
51
+ "react": "^19.0.0",
52
+ "react-dom": "^19.0.0",
53
+ "vite": "^7.1.7"
54
+ },
55
+ "peerDependencies": {
56
+ "react": "^19.0.0",
57
+ "react-dom": "^19.0.0"
58
+ }
59
+ }
package/server.js ADDED
@@ -0,0 +1,70 @@
1
+ import express from 'express';
2
+ import { fileURLToPath } from 'url';
3
+ import { dirname, join } from 'path';
4
+ import { existsSync } from 'fs';
5
+
6
+ const __filename = fileURLToPath(import.meta.url);
7
+ const __dirname = dirname(__filename);
8
+
9
+ const app = express();
10
+ const PORT = process.env.PORT || 3105;
11
+ const NODE_ENV = process.env.NODE_ENV || 'development';
12
+
13
+ // Determine which directory to serve
14
+ const distPath = join(__dirname, 'dist');
15
+ const hasBuilt = existsSync(distPath);
16
+
17
+ // Environment-specific remote URLs
18
+ function getRemoteUrl(env) {
19
+ switch (env) {
20
+ case 'production':
21
+ return 'https://www.rayburst.app';
22
+ case 'staging':
23
+ return 'https://dev.rayburst.app';
24
+ case 'development':
25
+ default:
26
+ return 'http://localhost:3000';
27
+ }
28
+ }
29
+
30
+ const remoteUrl = getRemoteUrl(NODE_ENV);
31
+
32
+ // Log startup information
33
+ console.log('');
34
+ console.log('🚀 Rayburst CLI Server');
35
+ console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
36
+ console.log(` Environment: ${NODE_ENV}`);
37
+ console.log(` Port: ${PORT}`);
38
+ console.log(` Remote URL: ${remoteUrl}`);
39
+ console.log(` Built: ${hasBuilt ? 'Yes' : 'No (using Vite dev)'}`);
40
+ console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
41
+ console.log('');
42
+
43
+ if (!hasBuilt) {
44
+ // Development mode: Use Vite dev server
45
+ console.log('⚠️ No built files found. Please run:');
46
+ console.log(' cd cli && npm run build');
47
+ console.log('');
48
+ console.log(' Or use Vite dev server:');
49
+ console.log(' cd cli && npx vite --port 3105');
50
+ console.log('');
51
+ process.exit(1);
52
+ } else {
53
+ // Production mode: Serve built files
54
+ app.use(express.static(distPath));
55
+
56
+ // SPA fallback - serve index.html for all routes
57
+ app.get('*', (req, res) => {
58
+ res.sendFile(join(distPath, 'index.html'));
59
+ });
60
+
61
+ app.listen(PORT, '0.0.0.0', () => {
62
+ console.log(`✅ Server running at:`);
63
+ console.log(` http://localhost:${PORT}`);
64
+ console.log('');
65
+ console.log(`📡 Loading Rayburst app from: ${remoteUrl}`);
66
+ console.log('');
67
+ console.log('Press Ctrl+C to stop');
68
+ console.log('');
69
+ });
70
+ }