@motiadev/workbench 0.8.2-beta.140-424079 → 0.8.2-beta.140-428722
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/dist/motia-plugin/hmr.d.ts +1 -4
- package/dist/motia-plugin/hmr.js +27 -77
- package/dist/motia-plugin/index.d.ts +24 -0
- package/dist/motia-plugin/index.js +16 -50
- package/dist/src/App.js +16 -18
- package/dist/src/lib/plugins.d.ts +1 -2
- package/dist/src/lib/plugins.js +3 -3
- package/dist/src/stores/use-app-tabs-store.d.ts +2 -0
- package/dist/src/stores/use-app-tabs-store.js +6 -0
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/tsconfig.node.tsbuildinfo +1 -1
- package/motia-plugin/hmr.ts +28 -90
- package/motia-plugin/index.ts +20 -59
- package/package.json +4 -4
package/motia-plugin/index.ts
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import path from 'path'
|
|
3
|
-
import type { Plugin, ViteDevServer } from 'vite'
|
|
1
|
+
import type { Plugin } from 'vite'
|
|
4
2
|
import { generateCssImports, generatePluginCode, isValidCode } from './generator'
|
|
5
3
|
import { handlePluginHotUpdate } from './hmr'
|
|
6
|
-
import { createAliasConfig
|
|
4
|
+
import { createAliasConfig } from './resolver'
|
|
7
5
|
import type { WorkbenchPlugin } from './types'
|
|
8
6
|
import { CONSTANTS } from './types'
|
|
9
|
-
import {
|
|
7
|
+
import { normalizePath } from './utils'
|
|
10
8
|
import { validatePlugins } from './validator'
|
|
11
9
|
|
|
12
10
|
/**
|
|
@@ -33,10 +31,8 @@ import { validatePlugins } from './validator'
|
|
|
33
31
|
* })
|
|
34
32
|
* ```
|
|
35
33
|
*/
|
|
36
|
-
const printer = new Printer(process.cwd())
|
|
37
|
-
|
|
38
34
|
export default function motiaPluginsPlugin(plugins: WorkbenchPlugin[]): Plugin {
|
|
39
|
-
let devServer:
|
|
35
|
+
let devServer: any = null
|
|
40
36
|
|
|
41
37
|
try {
|
|
42
38
|
const validationResult = validatePlugins(plugins, {
|
|
@@ -44,33 +40,29 @@ export default function motiaPluginsPlugin(plugins: WorkbenchPlugin[]): Plugin {
|
|
|
44
40
|
})
|
|
45
41
|
|
|
46
42
|
if (!validationResult.valid) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
printer.printPluginError(` ${err}`)
|
|
50
|
-
}
|
|
43
|
+
console.error('[motia-plugins] Plugin configuration validation failed:')
|
|
44
|
+
validationResult.errors.forEach((err) => console.error(`[motia-plugins] ${err}`))
|
|
51
45
|
throw new Error('Invalid plugin configuration. See errors above.')
|
|
52
46
|
}
|
|
53
47
|
|
|
54
48
|
if (validationResult.warnings.length > 0) {
|
|
55
|
-
|
|
56
|
-
printer.printPluginWarn(warning)
|
|
57
|
-
}
|
|
49
|
+
validationResult.warnings.forEach((warning) => console.warn('[motia-plugins]', warning))
|
|
58
50
|
}
|
|
59
51
|
} catch (error) {
|
|
60
|
-
|
|
52
|
+
console.error('[motia-plugins] Failed to validate plugins:', error)
|
|
61
53
|
throw error
|
|
62
54
|
}
|
|
63
55
|
|
|
64
56
|
const alias = createAliasConfig(plugins)
|
|
65
57
|
|
|
66
|
-
|
|
58
|
+
console.log(`[motia-plugins] Initialized with ${plugins.length} plugin(s)`)
|
|
67
59
|
|
|
68
60
|
return {
|
|
69
61
|
name: 'vite-plugin-motia-plugins',
|
|
70
62
|
enforce: 'pre',
|
|
71
63
|
|
|
72
64
|
buildStart() {
|
|
73
|
-
|
|
65
|
+
console.log('[motia-plugins] Build started')
|
|
74
66
|
},
|
|
75
67
|
|
|
76
68
|
config: () => ({
|
|
@@ -81,37 +73,7 @@ export default function motiaPluginsPlugin(plugins: WorkbenchPlugin[]): Plugin {
|
|
|
81
73
|
|
|
82
74
|
configureServer(server) {
|
|
83
75
|
devServer = server
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
const configPaths = [path.join(process.cwd(), 'motia.config.ts'), path.join(process.cwd(), 'motia.config.js')]
|
|
87
|
-
|
|
88
|
-
for (const configPath of configPaths) {
|
|
89
|
-
server.watcher.add(configPath)
|
|
90
|
-
}
|
|
91
|
-
printer.printPluginLog('Watching for config file changes')
|
|
92
|
-
|
|
93
|
-
const localPlugins = plugins.filter((p) => isLocalPlugin(p.packageName))
|
|
94
|
-
if (localPlugins.length > 0) {
|
|
95
|
-
printer.printPluginLog(`Watching ${localPlugins.length} local plugin(s)`)
|
|
96
|
-
|
|
97
|
-
for (const plugin of localPlugins) {
|
|
98
|
-
const resolved = resolvePluginPackage(plugin)
|
|
99
|
-
const watchPath = resolved.resolvedPath
|
|
100
|
-
|
|
101
|
-
server.watcher.add(watchPath)
|
|
102
|
-
printer.printPluginLog(`Watching: ${watchPath}`)
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
server.watcher.on('change', (file) => {
|
|
106
|
-
const normalizedFile = normalizePath(file)
|
|
107
|
-
printer.printPluginLog(`File watcher detected change: ${normalizedFile}`)
|
|
108
|
-
})
|
|
109
|
-
|
|
110
|
-
server.watcher.on('add', (file) => {
|
|
111
|
-
const normalizedFile = normalizePath(file)
|
|
112
|
-
printer.printPluginLog(`File watcher detected new file: ${normalizedFile}`)
|
|
113
|
-
})
|
|
114
|
-
}
|
|
76
|
+
console.log('[motia-plugins] Dev server configured, HMR enabled')
|
|
115
77
|
},
|
|
116
78
|
|
|
117
79
|
resolveId(id) {
|
|
@@ -125,17 +87,17 @@ export default function motiaPluginsPlugin(plugins: WorkbenchPlugin[]): Plugin {
|
|
|
125
87
|
return null
|
|
126
88
|
}
|
|
127
89
|
|
|
128
|
-
|
|
129
|
-
|
|
90
|
+
console.log('[motia-plugins] Loading plugins virtual module')
|
|
91
|
+
console.log('[motia-plugins] Generating plugin code...')
|
|
130
92
|
|
|
131
93
|
const code = generatePluginCode(plugins)
|
|
132
94
|
|
|
133
95
|
if (!isValidCode(code)) {
|
|
134
|
-
|
|
96
|
+
console.error('[motia-plugins] Generated code is invalid or empty')
|
|
135
97
|
return 'export const plugins = []'
|
|
136
98
|
}
|
|
137
99
|
|
|
138
|
-
|
|
100
|
+
console.log('[motia-plugins] Plugin code generated successfully')
|
|
139
101
|
|
|
140
102
|
return code
|
|
141
103
|
},
|
|
@@ -147,7 +109,7 @@ export default function motiaPluginsPlugin(plugins: WorkbenchPlugin[]): Plugin {
|
|
|
147
109
|
return null
|
|
148
110
|
}
|
|
149
111
|
|
|
150
|
-
|
|
112
|
+
console.log('[motia-plugins] Injecting plugin CSS imports')
|
|
151
113
|
|
|
152
114
|
const cssImports = generateCssImports(plugins)
|
|
153
115
|
|
|
@@ -163,20 +125,19 @@ export default function motiaPluginsPlugin(plugins: WorkbenchPlugin[]): Plugin {
|
|
|
163
125
|
|
|
164
126
|
handleHotUpdate(ctx) {
|
|
165
127
|
if (!devServer) {
|
|
166
|
-
printer.printPluginWarn('HMR: Dev server not available')
|
|
167
128
|
return
|
|
168
129
|
}
|
|
169
130
|
|
|
170
|
-
const modulesToUpdate = handlePluginHotUpdate(ctx, plugins
|
|
131
|
+
const modulesToUpdate = handlePluginHotUpdate(ctx, plugins)
|
|
171
132
|
|
|
172
|
-
if (modulesToUpdate
|
|
173
|
-
|
|
133
|
+
if (modulesToUpdate) {
|
|
134
|
+
console.log('[motia-plugins] Hot reloaded plugins')
|
|
174
135
|
return modulesToUpdate
|
|
175
136
|
}
|
|
176
137
|
},
|
|
177
138
|
|
|
178
139
|
buildEnd() {
|
|
179
|
-
|
|
140
|
+
console.log('[motia-plugins] Build ended')
|
|
180
141
|
},
|
|
181
142
|
}
|
|
182
143
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@motiadev/workbench",
|
|
3
3
|
"description": "A web-based interface for building and managing Motia workflows.",
|
|
4
|
-
"version": "0.8.2-beta.140-
|
|
4
|
+
"version": "0.8.2-beta.140-428722",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@monaco-editor/react": "^4.6.1",
|
|
@@ -43,9 +43,9 @@
|
|
|
43
43
|
"vite": "^6.3.5",
|
|
44
44
|
"zod": "^3.24.1",
|
|
45
45
|
"zustand": "^5.0.6",
|
|
46
|
-
"@motiadev/core": "0.8.2-beta.140-
|
|
47
|
-
"@motiadev/
|
|
48
|
-
"@motiadev/
|
|
46
|
+
"@motiadev/core": "0.8.2-beta.140-428722",
|
|
47
|
+
"@motiadev/stream-client-react": "0.8.2-beta.140-428722",
|
|
48
|
+
"@motiadev/ui": "0.8.2-beta.140-428722"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@testing-library/jest-dom": "^6.6.3",
|