create-fluxstack 1.15.0 → 1.17.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.
- package/CHANGELOG.md +80 -0
- package/LLMD/INDEX.md +4 -3
- package/LLMD/resources/live-binary-delta.md +507 -0
- package/LLMD/resources/live-components.md +1 -0
- package/LLMD/resources/live-rooms.md +731 -333
- package/app/client/src/App.tsx +23 -14
- package/app/client/src/components/AppLayout.tsx +4 -4
- package/app/client/src/live/AuthDemo.tsx +4 -4
- package/app/client/src/live/PingPongDemo.tsx +199 -0
- package/app/client/src/live/RoomChatDemo.tsx +187 -22
- package/app/client/src/live/SharedCounterDemo.tsx +142 -0
- package/app/server/live/LivePingPong.ts +61 -0
- package/app/server/live/LiveRoomChat.ts +106 -38
- package/app/server/live/LiveSharedCounter.ts +73 -0
- package/app/server/live/rooms/ChatRoom.ts +68 -0
- package/app/server/live/rooms/CounterRoom.ts +51 -0
- package/app/server/live/rooms/DirectoryRoom.ts +42 -0
- package/app/server/live/rooms/PingRoom.ts +40 -0
- package/core/build/bundler.ts +40 -26
- package/core/build/flux-plugins-generator.ts +325 -325
- package/core/build/index.ts +92 -21
- package/core/cli/command-registry.ts +44 -46
- package/core/cli/commands/build.ts +11 -6
- package/core/cli/commands/create.ts +7 -5
- package/core/cli/commands/dev.ts +6 -5
- package/core/cli/commands/help.ts +3 -2
- package/core/cli/commands/make-plugin.ts +8 -7
- package/core/cli/commands/plugin-add.ts +60 -43
- package/core/cli/commands/plugin-deps.ts +73 -57
- package/core/cli/commands/plugin-list.ts +44 -41
- package/core/cli/commands/plugin-remove.ts +33 -22
- package/core/cli/generators/component.ts +770 -769
- package/core/cli/generators/controller.ts +9 -8
- package/core/cli/generators/index.ts +148 -146
- package/core/cli/generators/interactive.ts +228 -227
- package/core/cli/generators/plugin.ts +11 -10
- package/core/cli/generators/prompts.ts +83 -82
- package/core/cli/generators/route.ts +7 -6
- package/core/cli/generators/service.ts +10 -9
- package/core/cli/generators/template-engine.ts +2 -1
- package/core/cli/generators/types.ts +7 -7
- package/core/cli/generators/utils.ts +191 -191
- package/core/cli/index.ts +9 -8
- package/core/cli/plugin-discovery.ts +2 -2
- package/core/client/hooks/useAuth.ts +48 -48
- package/core/client/index.ts +0 -16
- package/core/client/standalone.ts +18 -17
- package/core/client/state/createStore.ts +192 -192
- package/core/client/state/index.ts +14 -14
- package/core/config/index.ts +1 -0
- package/core/framework/client.ts +131 -131
- package/core/framework/index.ts +7 -7
- package/core/framework/server.ts +72 -112
- package/core/framework/types.ts +2 -2
- package/core/plugins/built-in/live-components/commands/create-live-component.ts +6 -3
- package/core/plugins/built-in/monitoring/index.ts +110 -68
- package/core/plugins/built-in/static/index.ts +2 -2
- package/core/plugins/built-in/swagger/index.ts +9 -9
- package/core/plugins/built-in/vite/index.ts +3 -3
- package/core/plugins/built-in/vite/vite-dev.ts +3 -3
- package/core/plugins/config.ts +50 -47
- package/core/plugins/discovery.ts +10 -4
- package/core/plugins/executor.ts +2 -2
- package/core/plugins/index.ts +206 -203
- package/core/plugins/manager.ts +21 -20
- package/core/plugins/registry.ts +76 -12
- package/core/plugins/types.ts +14 -14
- package/core/server/framework.ts +3 -189
- package/core/server/live/auto-generated-components.ts +11 -35
- package/core/server/live/index.ts +41 -36
- package/core/server/live/websocket-plugin.ts +48 -3
- package/core/server/middleware/elysia-helpers.ts +16 -15
- package/core/server/middleware/errorHandling.ts +14 -14
- package/core/server/middleware/index.ts +31 -31
- package/core/server/plugins/database.ts +181 -180
- package/core/server/plugins/static-files-plugin.ts +4 -3
- package/core/server/plugins/swagger.ts +11 -8
- package/core/server/rooms/RoomBroadcaster.ts +11 -10
- package/core/server/rooms/RoomSystem.ts +14 -11
- package/core/server/services/BaseService.ts +7 -7
- package/core/server/services/ServiceContainer.ts +5 -5
- package/core/server/services/index.ts +8 -8
- package/core/templates/create-project.ts +28 -27
- package/core/testing/index.ts +9 -9
- package/core/testing/setup.ts +73 -73
- package/core/types/api.ts +168 -168
- package/core/types/config.ts +5 -5
- package/core/types/index.ts +1 -1
- package/core/types/plugin.ts +2 -2
- package/core/types/types.ts +3 -3
- package/core/utils/build-logger.ts +324 -324
- package/core/utils/config-schema.ts +480 -480
- package/core/utils/env.ts +10 -8
- package/core/utils/errors/codes.ts +114 -114
- package/core/utils/errors/handlers.ts +30 -20
- package/core/utils/errors/index.ts +54 -46
- package/core/utils/errors/middleware.ts +113 -113
- package/core/utils/helpers.ts +19 -16
- package/core/utils/logger/colors.ts +114 -114
- package/core/utils/logger/config.ts +2 -2
- package/core/utils/logger/formatter.ts +82 -82
- package/core/utils/logger/group-logger.ts +101 -101
- package/core/utils/logger/index.ts +13 -3
- package/core/utils/logger/startup-banner.ts +2 -2
- package/core/utils/logger/winston-logger.ts +152 -152
- package/core/utils/monitoring/index.ts +211 -211
- package/core/utils/sync-version.ts +67 -66
- package/core/utils/version.ts +1 -1
- package/package.json +11 -6
- package/playwright-report/index.html +85 -0
- package/playwright.config.ts +31 -0
- package/plugins/crypto-auth/client/CryptoAuthClient.ts +302 -302
- package/plugins/crypto-auth/client/components/index.ts +11 -11
- package/plugins/crypto-auth/client/index.ts +11 -11
- package/plugins/crypto-auth/package.json +65 -65
- package/plugins/crypto-auth/server/CryptoAuthService.ts +185 -185
- package/plugins/crypto-auth/server/middlewares/cryptoAuthAdmin.ts +6 -5
- package/plugins/crypto-auth/server/middlewares/cryptoAuthPermissions.ts +6 -5
- package/plugins/crypto-auth/server/middlewares/cryptoAuthRequired.ts +3 -3
- package/plugins/crypto-auth/server/middlewares/index.ts +22 -22
- package/plugins/crypto-auth/server/middlewares.ts +19 -19
- package/tsconfig.json +4 -1
- package/vite.config.ts +13 -0
- package/app/client/.live-stubs/LiveAdminPanel.js +0 -5
- package/app/client/.live-stubs/LiveChat.js +0 -7
- package/app/client/.live-stubs/LiveCounter.js +0 -9
- package/app/client/.live-stubs/LiveForm.js +0 -11
- package/app/client/.live-stubs/LiveLocalCounter.js +0 -8
- package/app/client/.live-stubs/LiveRoomChat.js +0 -10
- package/app/client/.live-stubs/LiveTodoList.js +0 -9
- package/app/client/.live-stubs/LiveUpload.js +0 -15
- package/app/client/src/live/ChatDemo.tsx +0 -107
- package/app/client/src/live/LiveDebuggerPanel.tsx +0 -779
- package/app/client/src/live/TodoListDemo.tsx +0 -158
- package/app/server/live/LiveChat.ts +0 -78
- package/app/server/live/LiveTodoList.ts +0 -110
- package/app/server/live/register-components.ts +0 -19
- package/core/build/live-components-generator.ts +0 -312
- package/core/client/components/LiveDebugger.tsx +0 -1324
- package/core/live/ComponentRegistry.ts +0 -403
- package/core/live/types.ts +0 -241
- package/workspace.json +0 -6
package/tsconfig.json
CHANGED
|
@@ -28,7 +28,10 @@
|
|
|
28
28
|
"@config/*": ["./config/*"],
|
|
29
29
|
"@app/*": ["./app/*"],
|
|
30
30
|
"@shared/*": ["./app/shared/*"],
|
|
31
|
-
"@plugins/*": ["./plugins/*"]
|
|
31
|
+
"@plugins/*": ["./plugins/*"],
|
|
32
|
+
"@fluxstack/live": ["../fluxstack-live/packages/core/src/index.ts"],
|
|
33
|
+
"@fluxstack/live-client": ["../fluxstack-live/packages/client/src/index.ts"],
|
|
34
|
+
"@fluxstack/live-react": ["../fluxstack-live/packages/react/src/index.ts"]
|
|
32
35
|
},
|
|
33
36
|
|
|
34
37
|
// Best practices
|
package/vite.config.ts
CHANGED
|
@@ -69,6 +69,19 @@ export default defineConfig({
|
|
|
69
69
|
host: clientConfig.vite.host,
|
|
70
70
|
port: clientConfig.vite.port,
|
|
71
71
|
clientPort: clientConfig.vite.port
|
|
72
|
+
},
|
|
73
|
+
|
|
74
|
+
proxy: {
|
|
75
|
+
'/api/': {
|
|
76
|
+
target: 'http://localhost:3000',
|
|
77
|
+
changeOrigin: true,
|
|
78
|
+
// WebSocket goes directly to port 3000 (configured in App.tsx)
|
|
79
|
+
// to avoid Vite proxy overhead and HMR contention
|
|
80
|
+
},
|
|
81
|
+
'/swagger': {
|
|
82
|
+
target: 'http://localhost:3000',
|
|
83
|
+
changeOrigin: true,
|
|
84
|
+
},
|
|
72
85
|
}
|
|
73
86
|
},
|
|
74
87
|
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export class LiveRoomChat {
|
|
2
|
-
static componentName = 'LiveRoomChat'
|
|
3
|
-
static defaultState = {
|
|
4
|
-
username: '',
|
|
5
|
-
activeRoom: null,
|
|
6
|
-
rooms: [],
|
|
7
|
-
messages: {}
|
|
8
|
-
}
|
|
9
|
-
static publicActions = ['joinRoom', 'leaveRoom', 'switchRoom', 'sendMessage', 'setUsername']
|
|
10
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export class LiveUpload {
|
|
2
|
-
static componentName = 'LiveUpload'
|
|
3
|
-
static defaultState = {
|
|
4
|
-
status: 'idle',
|
|
5
|
-
progress: 0,
|
|
6
|
-
fileName: '',
|
|
7
|
-
fileSize: 0,
|
|
8
|
-
fileType: '',
|
|
9
|
-
fileUrl: '',
|
|
10
|
-
bytesUploaded: 0,
|
|
11
|
-
totalBytes: 0,
|
|
12
|
-
error: null
|
|
13
|
-
}
|
|
14
|
-
static publicActions = ['startUpload', 'updateProgress', 'completeUpload', 'failUpload', 'reset']
|
|
15
|
-
}
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { useEffect, useMemo, useRef, useState } from 'react'
|
|
2
|
-
import { Live } from '@/core/client'
|
|
3
|
-
import { LiveChat } from '@server/live/LiveChat'
|
|
4
|
-
|
|
5
|
-
export function ChatDemo() {
|
|
6
|
-
const [text, setText] = useState('')
|
|
7
|
-
const [user, setUser] = useState('')
|
|
8
|
-
const containerRef = useRef<HTMLDivElement | null>(null)
|
|
9
|
-
const wasNearBottomRef = useRef(true)
|
|
10
|
-
const defaultUser = useMemo(() => {
|
|
11
|
-
if (typeof crypto !== 'undefined' && 'randomUUID' in crypto) {
|
|
12
|
-
return `user-${crypto.randomUUID().slice(0, 6)}`
|
|
13
|
-
}
|
|
14
|
-
return `user-${Math.random().toString(36).slice(2, 8)}`
|
|
15
|
-
}, [])
|
|
16
|
-
|
|
17
|
-
const chat = Live.use(LiveChat, {
|
|
18
|
-
room: 'global-chat',
|
|
19
|
-
initialState: LiveChat.defaultState,
|
|
20
|
-
persistState: false
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
const handleSend = async () => {
|
|
24
|
-
if (!text.trim()) return
|
|
25
|
-
const finalUser = user.trim() || defaultUser
|
|
26
|
-
await chat.sendMessage({ user: finalUser, text })
|
|
27
|
-
setText('')
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
useEffect(() => {
|
|
31
|
-
const el = containerRef.current
|
|
32
|
-
if (!el) return
|
|
33
|
-
|
|
34
|
-
if (wasNearBottomRef.current) {
|
|
35
|
-
el.scrollTop = el.scrollHeight
|
|
36
|
-
}
|
|
37
|
-
}, [chat.$state.messages.length])
|
|
38
|
-
|
|
39
|
-
const handleScroll = () => {
|
|
40
|
-
const el = containerRef.current
|
|
41
|
-
if (!el) return
|
|
42
|
-
const distance = el.scrollHeight - (el.scrollTop + el.clientHeight)
|
|
43
|
-
wasNearBottomRef.current = distance < 80
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return (
|
|
47
|
-
<div className="bg-white/5 backdrop-blur-sm border border-white/10 rounded-2xl p-4 sm:p-6 md:p-8 w-full max-w-2xl mx-auto">
|
|
48
|
-
<h2 className="text-2xl font-bold text-white mb-2 text-center">Chat Compartilhado</h2>
|
|
49
|
-
<p className="text-gray-400 text-sm text-center mb-4">
|
|
50
|
-
Sala global em tempo real. Abra em várias abas para testar.
|
|
51
|
-
</p>
|
|
52
|
-
|
|
53
|
-
<div className="flex flex-wrap items-center gap-2 mb-4 text-xs">
|
|
54
|
-
<span className={`px-3 py-1 rounded-full ${chat.$connected ? 'bg-emerald-500/20 text-emerald-300' : 'bg-red-500/20 text-red-300'}`}>
|
|
55
|
-
{chat.$connected ? 'Conectado' : 'Desconectado'}
|
|
56
|
-
</span>
|
|
57
|
-
<span className="text-gray-400">Você: {user.trim() || defaultUser}</span>
|
|
58
|
-
</div>
|
|
59
|
-
|
|
60
|
-
<div className="mb-4">
|
|
61
|
-
<label className="block text-xs text-gray-400 mb-2">Seu nome</label>
|
|
62
|
-
<input
|
|
63
|
-
value={user}
|
|
64
|
-
onChange={(e) => setUser(e.target.value)}
|
|
65
|
-
placeholder={`Ex: ${defaultUser}`}
|
|
66
|
-
className="w-full px-4 py-2 rounded-lg bg-white/10 border border-white/20 text-white placeholder-gray-500 focus:outline-none focus:ring-2 focus:ring-purple-500/50"
|
|
67
|
-
/>
|
|
68
|
-
</div>
|
|
69
|
-
|
|
70
|
-
<div
|
|
71
|
-
ref={containerRef}
|
|
72
|
-
onScroll={handleScroll}
|
|
73
|
-
className="bg-black/40 border border-white/10 rounded-xl p-3 sm:p-5 h-72 sm:h-96 md:h-[28rem] overflow-auto space-y-3"
|
|
74
|
-
>
|
|
75
|
-
{chat.$state.messages.length === 0 && (
|
|
76
|
-
<div className="text-gray-500 text-sm text-center">Nenhuma mensagem ainda</div>
|
|
77
|
-
)}
|
|
78
|
-
{chat.$state.messages.map((m) => (
|
|
79
|
-
<div key={m.id} className="text-sm">
|
|
80
|
-
<span className="text-purple-300 font-semibold">{m.user}</span>
|
|
81
|
-
<span className="text-gray-500 text-xs ml-2">{new Date(m.timestamp).toLocaleTimeString()}</span>
|
|
82
|
-
<div className="text-gray-200">{m.text}</div>
|
|
83
|
-
</div>
|
|
84
|
-
))}
|
|
85
|
-
</div>
|
|
86
|
-
|
|
87
|
-
<div className="mt-4 flex gap-2">
|
|
88
|
-
<input
|
|
89
|
-
value={text}
|
|
90
|
-
onChange={(e) => setText(e.target.value)}
|
|
91
|
-
onKeyDown={(e) => {
|
|
92
|
-
if (e.key === 'Enter') void handleSend()
|
|
93
|
-
}}
|
|
94
|
-
placeholder="Digite uma mensagem..."
|
|
95
|
-
className="flex-1 px-4 py-2 rounded-lg bg-white/10 border border-white/20 text-white placeholder-gray-500 focus:outline-none focus:ring-2 focus:ring-purple-500/50"
|
|
96
|
-
/>
|
|
97
|
-
<button
|
|
98
|
-
onClick={handleSend}
|
|
99
|
-
disabled={!chat.$connected}
|
|
100
|
-
className="px-4 py-2 rounded-lg bg-purple-500/20 border border-purple-500/30 text-purple-200 hover:bg-purple-500/30 transition-all disabled:opacity-50"
|
|
101
|
-
>
|
|
102
|
-
Enviar
|
|
103
|
-
</button>
|
|
104
|
-
</div>
|
|
105
|
-
</div>
|
|
106
|
-
)
|
|
107
|
-
}
|