@motiadev/workbench 0.14.0-beta.165-285707 → 0.15.0-beta.165

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.
Files changed (236) hide show
  1. package/dist/index.d.ts +189 -10
  2. package/dist/index.html +1 -1
  3. package/dist/index.js +1065 -7
  4. package/dist/middleware.d.ts +66 -8
  5. package/dist/middleware.js +694 -86
  6. package/dist/motia-plugin/__tests__/generator.test.ts +129 -0
  7. package/dist/motia-plugin/__tests__/resolver.test.ts +82 -0
  8. package/dist/motia-plugin/__tests__/validator.test.ts +71 -0
  9. package/dist/motia-plugin/{generator.js → generator.ts} +37 -35
  10. package/dist/motia-plugin/hmr.ts +123 -0
  11. package/dist/motia-plugin/index.ts +183 -0
  12. package/dist/motia-plugin/{resolver.d.ts → resolver.ts} +38 -5
  13. package/dist/motia-plugin/types.ts +198 -0
  14. package/dist/motia-plugin/{utils.d.ts → utils.ts} +17 -4
  15. package/dist/motia-plugin/validator.ts +197 -0
  16. package/dist/src/App.tsx +41 -0
  17. package/dist/src/components/NotFoundPage.tsx +11 -0
  18. package/dist/src/components/bottom-panel.tsx +39 -0
  19. package/dist/src/components/flow/base-edge.tsx +61 -0
  20. package/dist/src/components/flow/flow-loader.tsx +3 -0
  21. package/dist/src/components/flow/flow-page.tsx +75 -0
  22. package/dist/src/components/flow/flow-tab-menu-item.tsx +52 -0
  23. package/dist/src/components/flow/flow-view.tsx +66 -0
  24. package/dist/src/components/flow/hooks/use-get-flow-state.tsx +171 -0
  25. package/dist/src/components/flow/hooks/use-save-workflow-config.ts +25 -0
  26. package/dist/src/components/flow/node-organizer.tsx +103 -0
  27. package/dist/src/components/flow/nodes/api-flow-node.tsx +6 -0
  28. package/dist/src/components/flow/nodes/cron-flow-node.tsx +6 -0
  29. package/dist/src/components/flow/nodes/event-flow-node.tsx +6 -0
  30. package/dist/src/components/flow/nodes/noop-flow-node.tsx +6 -0
  31. package/dist/src/components/header/deploy-button.tsx +110 -0
  32. package/dist/src/components/header/header.tsx +39 -0
  33. package/dist/src/components/root-motia.tsx +10 -0
  34. package/dist/src/components/top-panel.tsx +40 -0
  35. package/dist/src/components/tutorial/engine/tutorial-engine.ts +26 -0
  36. package/dist/src/components/tutorial/engine/tutorial-types.ts +26 -0
  37. package/dist/src/components/tutorial/engine/workbench-xpath.ts +53 -0
  38. package/dist/src/components/tutorial/hooks/tutorial-utils.ts +26 -0
  39. package/dist/src/components/tutorial/hooks/use-tutorial-engine.ts +213 -0
  40. package/dist/src/components/tutorial/hooks/use-tutorial.ts +14 -0
  41. package/dist/src/components/tutorial/tutorial-button.tsx +46 -0
  42. package/dist/src/components/tutorial/tutorial-step.tsx +82 -0
  43. package/dist/src/components/tutorial/tutorial.tsx +59 -0
  44. package/dist/src/components/ui/json-editor.tsx +68 -0
  45. package/dist/src/components/ui/table.tsx +75 -0
  46. package/dist/src/components/ui/theme-toggle.tsx +54 -0
  47. package/dist/src/components/ui/tooltip.tsx +26 -0
  48. package/dist/src/hooks/use-debounced.ts +22 -0
  49. package/dist/src/hooks/use-fetch-flows.ts +33 -0
  50. package/dist/src/hooks/use-mobile.ts +19 -0
  51. package/dist/src/hooks/use-update-handle-positions.ts +42 -0
  52. package/dist/src/index.css +5 -5
  53. package/dist/src/lib/__tests__/utils.test.ts +110 -0
  54. package/dist/src/lib/motia-analytics.ts +140 -0
  55. package/dist/src/lib/plugins.tsx +132 -0
  56. package/dist/src/lib/utils.ts +37 -0
  57. package/dist/src/main.tsx +30 -0
  58. package/dist/src/project-view-mode.tsx +32 -0
  59. package/dist/src/publicComponents/api-node.tsx +26 -0
  60. package/dist/src/publicComponents/base-node/base-handle.tsx +50 -0
  61. package/dist/src/publicComponents/base-node/base-node.tsx +114 -0
  62. package/dist/src/publicComponents/base-node/code-display.tsx +119 -0
  63. package/dist/src/publicComponents/base-node/emits.tsx +17 -0
  64. package/dist/src/publicComponents/base-node/feature-card.tsx +32 -0
  65. package/dist/src/publicComponents/base-node/language-indicator.tsx +131 -0
  66. package/dist/src/publicComponents/base-node/node-header.tsx +49 -0
  67. package/dist/src/publicComponents/base-node/node-sidebar.tsx +41 -0
  68. package/dist/src/publicComponents/base-node/subscribe.tsx +13 -0
  69. package/dist/src/publicComponents/cron-node.tsx +24 -0
  70. package/dist/src/publicComponents/event-node.tsx +20 -0
  71. package/dist/src/publicComponents/node-props.tsx +15 -0
  72. package/dist/src/publicComponents/noop-node.tsx +19 -0
  73. package/dist/src/setupTests.ts +1 -0
  74. package/dist/src/stores/use-app-tabs-store.ts +49 -0
  75. package/dist/src/stores/use-flow-store.ts +31 -0
  76. package/dist/src/stores/use-global-store.ts +24 -0
  77. package/dist/src/stores/use-motia-config-store.ts +36 -0
  78. package/dist/src/stores/use-tabs-store.ts +34 -0
  79. package/dist/src/system-view-mode.tsx +28 -0
  80. package/dist/src/types/endpoint.ts +12 -0
  81. package/dist/src/types/file.ts +7 -0
  82. package/dist/src/types/flow.ts +103 -0
  83. package/eslint.config.cjs +22 -0
  84. package/jest.config.cjs +68 -0
  85. package/package.json +53 -51
  86. package/dist/motia-plugin/__tests__/generator.test.d.ts +0 -1
  87. package/dist/motia-plugin/__tests__/generator.test.js +0 -97
  88. package/dist/motia-plugin/__tests__/resolver.test.d.ts +0 -1
  89. package/dist/motia-plugin/__tests__/resolver.test.js +0 -64
  90. package/dist/motia-plugin/__tests__/validator.test.d.ts +0 -1
  91. package/dist/motia-plugin/__tests__/validator.test.js +0 -59
  92. package/dist/motia-plugin/generator.d.ts +0 -78
  93. package/dist/motia-plugin/hmr.d.ts +0 -22
  94. package/dist/motia-plugin/hmr.js +0 -100
  95. package/dist/motia-plugin/index.d.ts +0 -3
  96. package/dist/motia-plugin/index.js +0 -153
  97. package/dist/motia-plugin/resolver.js +0 -92
  98. package/dist/motia-plugin/types.d.ts +0 -169
  99. package/dist/motia-plugin/types.js +0 -36
  100. package/dist/motia-plugin/utils.js +0 -75
  101. package/dist/motia-plugin/validator.d.ts +0 -19
  102. package/dist/motia-plugin/validator.js +0 -163
  103. package/dist/src/App.d.ts +0 -2
  104. package/dist/src/App.js +0 -35
  105. package/dist/src/components/NotFoundPage.d.ts +0 -1
  106. package/dist/src/components/NotFoundPage.js +0 -3
  107. package/dist/src/components/bottom-panel.d.ts +0 -1
  108. package/dist/src/components/bottom-panel.js +0 -15
  109. package/dist/src/components/flow/base-edge.d.ts +0 -3
  110. package/dist/src/components/flow/base-edge.js +0 -39
  111. package/dist/src/components/flow/flow-loader.d.ts +0 -1
  112. package/dist/src/components/flow/flow-loader.js +0 -4
  113. package/dist/src/components/flow/flow-page.d.ts +0 -1
  114. package/dist/src/components/flow/flow-page.js +0 -25
  115. package/dist/src/components/flow/flow-tab-menu-item.d.ts +0 -1
  116. package/dist/src/components/flow/flow-tab-menu-item.js +0 -18
  117. package/dist/src/components/flow/flow-view.d.ts +0 -12
  118. package/dist/src/components/flow/flow-view.js +0 -22
  119. package/dist/src/components/flow/hooks/use-get-flow-state.d.ts +0 -10
  120. package/dist/src/components/flow/hooks/use-get-flow-state.js +0 -133
  121. package/dist/src/components/flow/hooks/use-save-workflow-config.d.ts +0 -2
  122. package/dist/src/components/flow/hooks/use-save-workflow-config.js +0 -22
  123. package/dist/src/components/flow/node-organizer.d.ts +0 -10
  124. package/dist/src/components/flow/node-organizer.js +0 -82
  125. package/dist/src/components/flow/nodes/api-flow-node.d.ts +0 -2
  126. package/dist/src/components/flow/nodes/api-flow-node.js +0 -5
  127. package/dist/src/components/flow/nodes/cron-flow-node.d.ts +0 -2
  128. package/dist/src/components/flow/nodes/cron-flow-node.js +0 -5
  129. package/dist/src/components/flow/nodes/event-flow-node.d.ts +0 -2
  130. package/dist/src/components/flow/nodes/event-flow-node.js +0 -5
  131. package/dist/src/components/flow/nodes/noop-flow-node.d.ts +0 -2
  132. package/dist/src/components/flow/nodes/noop-flow-node.js +0 -5
  133. package/dist/src/components/header/deploy-button.d.ts +0 -1
  134. package/dist/src/components/header/deploy-button.js +0 -28
  135. package/dist/src/components/header/header.d.ts +0 -2
  136. package/dist/src/components/header/header.js +0 -23
  137. package/dist/src/components/root-motia.d.ts +0 -2
  138. package/dist/src/components/root-motia.js +0 -7
  139. package/dist/src/components/top-panel.d.ts +0 -1
  140. package/dist/src/components/top-panel.js +0 -15
  141. package/dist/src/components/tutorial/engine/tutorial-engine.d.ts +0 -12
  142. package/dist/src/components/tutorial/engine/tutorial-engine.js +0 -36
  143. package/dist/src/components/tutorial/engine/tutorial-types.d.ts +0 -22
  144. package/dist/src/components/tutorial/engine/tutorial-types.js +0 -1
  145. package/dist/src/components/tutorial/engine/workbench-xpath.d.ts +0 -45
  146. package/dist/src/components/tutorial/engine/workbench-xpath.js +0 -45
  147. package/dist/src/components/tutorial/hooks/tutorial-utils.d.ts +0 -1
  148. package/dist/src/components/tutorial/hooks/tutorial-utils.js +0 -17
  149. package/dist/src/components/tutorial/hooks/use-tutorial-engine.d.ts +0 -15
  150. package/dist/src/components/tutorial/hooks/use-tutorial-engine.js +0 -183
  151. package/dist/src/components/tutorial/hooks/use-tutorial.d.ts +0 -5
  152. package/dist/src/components/tutorial/hooks/use-tutorial.js +0 -10
  153. package/dist/src/components/tutorial/tutorial-button.d.ts +0 -2
  154. package/dist/src/components/tutorial/tutorial-button.js +0 -21
  155. package/dist/src/components/tutorial/tutorial-step.d.ts +0 -14
  156. package/dist/src/components/tutorial/tutorial-step.js +0 -19
  157. package/dist/src/components/tutorial/tutorial.d.ts +0 -2
  158. package/dist/src/components/tutorial/tutorial.js +0 -32
  159. package/dist/src/components/ui/json-editor.d.ts +0 -12
  160. package/dist/src/components/ui/json-editor.js +0 -35
  161. package/dist/src/components/ui/table.d.ts +0 -10
  162. package/dist/src/components/ui/table.js +0 -20
  163. package/dist/src/components/ui/theme-toggle.d.ts +0 -2
  164. package/dist/src/components/ui/theme-toggle.js +0 -19
  165. package/dist/src/components/ui/tooltip.d.ts +0 -6
  166. package/dist/src/components/ui/tooltip.js +0 -3
  167. package/dist/src/hooks/use-debounced.d.ts +0 -1
  168. package/dist/src/hooks/use-debounced.js +0 -18
  169. package/dist/src/hooks/use-fetch-flows.d.ts +0 -1
  170. package/dist/src/hooks/use-fetch-flows.js +0 -26
  171. package/dist/src/hooks/use-mobile.d.ts +0 -1
  172. package/dist/src/hooks/use-mobile.js +0 -15
  173. package/dist/src/hooks/use-update-handle-positions.d.ts +0 -10
  174. package/dist/src/hooks/use-update-handle-positions.js +0 -35
  175. package/dist/src/lib/__tests__/utils.test.d.ts +0 -1
  176. package/dist/src/lib/__tests__/utils.test.js +0 -94
  177. package/dist/src/lib/motia-analytics.d.ts +0 -38
  178. package/dist/src/lib/motia-analytics.js +0 -132
  179. package/dist/src/lib/plugins.d.ts +0 -2
  180. package/dist/src/lib/plugins.js +0 -105
  181. package/dist/src/lib/utils.d.ts +0 -7
  182. package/dist/src/lib/utils.js +0 -34
  183. package/dist/src/main.d.ts +0 -2
  184. package/dist/src/main.js +0 -17
  185. package/dist/src/project-view-mode.d.ts +0 -1
  186. package/dist/src/project-view-mode.js +0 -20
  187. package/dist/src/publicComponents/api-node.d.ts +0 -5
  188. package/dist/src/publicComponents/api-node.js +0 -5
  189. package/dist/src/publicComponents/base-node/base-handle.d.ts +0 -9
  190. package/dist/src/publicComponents/base-node/base-handle.js +0 -8
  191. package/dist/src/publicComponents/base-node/base-node.d.ts +0 -15
  192. package/dist/src/publicComponents/base-node/base-node.js +0 -30
  193. package/dist/src/publicComponents/base-node/code-display.d.ts +0 -9
  194. package/dist/src/publicComponents/base-node/code-display.js +0 -64
  195. package/dist/src/publicComponents/base-node/emits.d.ts +0 -5
  196. package/dist/src/publicComponents/base-node/emits.js +0 -5
  197. package/dist/src/publicComponents/base-node/feature-card.d.ts +0 -10
  198. package/dist/src/publicComponents/base-node/feature-card.js +0 -5
  199. package/dist/src/publicComponents/base-node/language-indicator.d.ts +0 -10
  200. package/dist/src/publicComponents/base-node/language-indicator.js +0 -29
  201. package/dist/src/publicComponents/base-node/node-header.d.ts +0 -13
  202. package/dist/src/publicComponents/base-node/node-header.js +0 -30
  203. package/dist/src/publicComponents/base-node/node-sidebar.d.ts +0 -14
  204. package/dist/src/publicComponents/base-node/node-sidebar.js +0 -9
  205. package/dist/src/publicComponents/base-node/subscribe.d.ts +0 -4
  206. package/dist/src/publicComponents/base-node/subscribe.js +0 -4
  207. package/dist/src/publicComponents/cron-node.d.ts +0 -4
  208. package/dist/src/publicComponents/cron-node.js +0 -6
  209. package/dist/src/publicComponents/event-node.d.ts +0 -4
  210. package/dist/src/publicComponents/event-node.js +0 -5
  211. package/dist/src/publicComponents/node-props.d.ts +0 -21
  212. package/dist/src/publicComponents/node-props.js +0 -1
  213. package/dist/src/publicComponents/noop-node.d.ts +0 -4
  214. package/dist/src/publicComponents/noop-node.js +0 -5
  215. package/dist/src/setupTests.d.ts +0 -1
  216. package/dist/src/setupTests.js +0 -1
  217. package/dist/src/stores/use-app-tabs-store.d.ts +0 -16
  218. package/dist/src/stores/use-app-tabs-store.js +0 -31
  219. package/dist/src/stores/use-flow-store.d.ts +0 -21
  220. package/dist/src/stores/use-flow-store.js +0 -16
  221. package/dist/src/stores/use-global-store.d.ts +0 -18
  222. package/dist/src/stores/use-global-store.js +0 -12
  223. package/dist/src/stores/use-motia-config-store.d.ts +0 -12
  224. package/dist/src/stores/use-motia-config-store.js +0 -24
  225. package/dist/src/stores/use-tabs-store.d.ts +0 -19
  226. package/dist/src/stores/use-tabs-store.js +0 -22
  227. package/dist/src/system-view-mode.d.ts +0 -1
  228. package/dist/src/system-view-mode.js +0 -10
  229. package/dist/src/types/endpoint.d.ts +0 -14
  230. package/dist/src/types/endpoint.js +0 -1
  231. package/dist/src/types/file.d.ts +0 -7
  232. package/dist/src/types/file.js +0 -1
  233. package/dist/src/types/flow.d.ts +0 -115
  234. package/dist/src/types/flow.js +0 -1
  235. package/dist/tsconfig.app.tsbuildinfo +0 -1
  236. package/dist/tsconfig.node.tsbuildinfo +0 -1
@@ -0,0 +1,103 @@
1
+ import type { JSONSchema7 } from 'json-schema'
2
+
3
+ export type EventNodeData = {
4
+ type: string
5
+ name: string
6
+ description?: string
7
+ subscribes: string[]
8
+ emits: Array<string | { topic: string; label?: string }>
9
+ virtualEmits?: Array<string | { topic: string; label?: string }>
10
+ virtualSubscribes?: string[]
11
+ language?: string
12
+ }
13
+
14
+ export type NoopNodeData = {
15
+ type: string
16
+ name: string
17
+ description?: string
18
+ virtualEmits: string[]
19
+ subscribes: string[]
20
+ }
21
+
22
+ export type ApiNodeData = {
23
+ type: string
24
+ name: string
25
+ language?: string
26
+ description?: string
27
+ emits: Array<string | { topic: string; label?: string }>
28
+ subscribes?: string[]
29
+ virtualEmits?: Array<string | { topic: string; label?: string }>
30
+ virtualSubscribes?: string[]
31
+ webhookUrl?: string
32
+ bodySchema?: JSONSchema7
33
+ }
34
+
35
+ export type CronNodeData = {
36
+ type: string
37
+ name: string
38
+ description?: string
39
+ emits: Array<string | { topic: string; label?: string }>
40
+ virtualEmits?: Array<string | { topic: string; label?: string }>
41
+ virtualSubscribes?: string[]
42
+ cronExpression: string
43
+ language?: string
44
+ }
45
+ export type NodeData = (EventNodeData | ApiNodeData | NoopNodeData | CronNodeData) & {
46
+ position?: { x: number; y: number }
47
+ filePath?: string
48
+ nodeConfig?: {
49
+ sourceHandlePosition?: 'bottom' | 'right'
50
+ targetHandlePosition?: 'top' | 'left'
51
+ }
52
+ }
53
+
54
+ // ducplicate of packages/core/src/flows-endpoint.ts
55
+ export type EdgeData = {
56
+ variant: 'event' | 'virtual'
57
+ label?: string
58
+ labelVariant?: 'default' | 'conditional'
59
+ }
60
+
61
+ export type Emit = string | { topic: string; label?: string }
62
+
63
+ export type FlowStep = {
64
+ id: string
65
+ name: string
66
+ type: 'event' | 'api' | 'noop' | 'cron'
67
+ description?: string
68
+ subscribes?: string[]
69
+ emits: Emit[]
70
+ virtualEmits?: Emit[]
71
+ action?: 'webhook'
72
+ webhookUrl?: string
73
+ language?: string
74
+ nodeComponentPath?: string
75
+ filePath?: string
76
+ }
77
+
78
+ export type FlowResponse = {
79
+ id: string
80
+ name: string
81
+ steps: FlowStep[]
82
+ edges: FlowEdge[]
83
+ error?: string
84
+ }
85
+
86
+ export type FlowConfigResponse = {
87
+ id: string
88
+ config: Record<string, NodeConfig>
89
+ }
90
+
91
+ export type FlowEdge = {
92
+ id: string
93
+ source: string
94
+ target: string
95
+ data: EdgeData
96
+ }
97
+
98
+ export type NodeConfig = {
99
+ x: number
100
+ y: number
101
+ sourceHandlePosition?: 'bottom' | 'right'
102
+ targetHandlePosition?: 'top' | 'left'
103
+ }
@@ -0,0 +1,22 @@
1
+ const config = require('../../eslint.config.js')
2
+
3
+ module.exports = [
4
+ // ignore src files
5
+ { ignores: ['**/src/**/*'] },
6
+ ...config.map((cfg) => {
7
+ if (!cfg.files) {
8
+ return cfg
9
+ }
10
+
11
+ return {
12
+ ...cfg,
13
+ languageOptions: {
14
+ ...cfg.languageOptions,
15
+ parserOptions: {
16
+ project: null,
17
+ },
18
+ },
19
+ files: ['middleware.ts', 'tailwind.config.ts', 'vite.config.ts'],
20
+ }
21
+ }),
22
+ ]
@@ -0,0 +1,68 @@
1
+ module.exports = {
2
+ preset: 'ts-jest',
3
+ testEnvironment: 'jsdom',
4
+ setupFilesAfterEnv: ['<rootDir>/src/setupTests.ts'],
5
+ moduleNameMapper: {
6
+ '^@/(.*)$': '<rootDir>/src/$1',
7
+ },
8
+ testMatch: [
9
+ '<rootDir>/src/**/__tests__/**/*.(ts|tsx|js)',
10
+ '<rootDir>/src/**/*.(test|spec).(ts|tsx|js)',
11
+ '<rootDir>/motia-plugin/**/__tests__/**/*.(ts|tsx|js)',
12
+ '<rootDir>/motia-plugin/**/*.(test|spec).(ts|tsx|js)',
13
+ '<rootDir>/__tests__/**/*.(ts|tsx|js)',
14
+ ],
15
+ collectCoverageFrom: [
16
+ 'src/**/*.(ts|tsx)',
17
+ '!src/**/*.d.ts',
18
+ '!src/index.tsx',
19
+ 'motia-plugin/**/*.(ts|tsx)',
20
+ '!motia-plugin/**/*.d.ts',
21
+ ],
22
+ transform: {
23
+ '^.+\\.(ts|tsx)$': [
24
+ 'ts-jest',
25
+ {
26
+ tsconfig: {
27
+ jsx: 'react-jsx',
28
+ esModuleInterop: true,
29
+ allowSyntheticDefaultImports: true,
30
+ types: ['jest', '@testing-library/jest-dom', 'node'],
31
+ module: 'commonjs',
32
+ target: 'es2020',
33
+ lib: ['es2020', 'dom', 'dom.iterable'],
34
+ moduleResolution: 'node',
35
+ strict: true,
36
+ skipLibCheck: true,
37
+ isolatedModules: true,
38
+ },
39
+ isolatedModules: true,
40
+ useESM: false,
41
+ },
42
+ ],
43
+ '^.+\\.(js|jsx)$': [
44
+ 'ts-jest',
45
+ {
46
+ tsconfig: {
47
+ allowJs: true,
48
+ jsx: 'react-jsx',
49
+ esModuleInterop: true,
50
+ allowSyntheticDefaultImports: true,
51
+ module: 'commonjs',
52
+ target: 'es2020',
53
+ },
54
+ isolatedModules: true,
55
+ useESM: false,
56
+ },
57
+ ],
58
+ },
59
+ transformIgnorePatterns: ['node_modules/(?!(@motiadev/stream-client-react|@motiadev/stream-client-browser)/)'],
60
+ moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
61
+ testEnvironmentOptions: {
62
+ url: 'http://localhost',
63
+ },
64
+ clearMocks: true,
65
+ resetMocks: true,
66
+ restoreMocks: true,
67
+ }
68
+
package/package.json CHANGED
@@ -1,75 +1,77 @@
1
1
  {
2
2
  "name": "@motiadev/workbench",
3
3
  "description": "A web-based interface for building and managing Motia workflows.",
4
- "version": "0.14.0-beta.165-285707",
5
- "main": "dist/index.js",
4
+ "version": "0.15.0-beta.165",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": "./dist/index.js",
11
+ "./middleware": "./dist/middleware.js",
12
+ "./package.json": "./package.json"
13
+ },
6
14
  "dependencies": {
7
- "@monaco-editor/react": "^4.6.1",
8
- "@radix-ui/react-collapsible": "^1.1.10",
9
- "@radix-ui/react-dialog": "^1.1.13",
10
- "@radix-ui/react-dropdown-menu": "^2.1.15",
11
- "@radix-ui/react-label": "^2.1.6",
12
- "@radix-ui/react-navigation-menu": "^1.2.13",
13
- "@radix-ui/react-scroll-area": "^1.2.9",
14
- "@radix-ui/react-select": "^2.2.4",
15
- "@radix-ui/react-separator": "^1.1.6",
16
- "@radix-ui/react-slot": "^1.2.2",
17
- "@radix-ui/react-switch": "^1.2.4",
18
- "@radix-ui/react-tabs": "^1.1.12",
19
- "@radix-ui/react-tooltip": "^1.2.6",
20
- "@tailwindcss/postcss": "^4.1.7",
21
- "@vitejs/plugin-react": "^4.4.1",
22
- "@xyflow/react": "^12.6.4",
23
- "autoprefixer": "^10.4.21",
15
+ "@monaco-editor/react": "^4.7.0",
16
+ "@radix-ui/react-tooltip": "^1.2.8",
17
+ "@tailwindcss/postcss": "^4.1.17",
18
+ "@vitejs/plugin-react": "^5.1.1",
19
+ "@xyflow/react": "^12.9.3",
20
+ "autoprefixer": "^10.4.22",
24
21
  "class-variance-authority": "^0.7.1",
25
22
  "clsx": "^2.1.1",
26
23
  "dagre": "^0.8.5",
27
- "date-fns": "^4.1.0",
28
24
  "fast-deep-equal": "^3.1.3",
29
25
  "json-schema": "^0.4.0",
30
- "lucide-react": "^0.510.0",
31
- "postcss": "^8.5.3",
32
- "react": "^19.1.0",
33
- "react-dom": "^19.1.0",
34
- "react-router-dom": "^7.9.4",
35
- "react-syntax-highlighter": "^15.6.1",
36
- "react-use-resizable": "^0.2.0",
26
+ "lucide-react": "^0.554.0",
27
+ "postcss": "^8.5.6",
28
+ "react": "^19.2.0",
29
+ "react-dom": "^19.2.0",
30
+ "react-router-dom": "^7.9.6",
31
+ "react-syntax-highlighter": "^16.1.0",
37
32
  "react18-json-view": "^0.2.9",
38
- "tailwind-merge": "^3.3.0",
39
- "tailwindcss": "^4.1.7",
40
- "tw-animate-css": "^1.2.9",
41
- "typescript": "~5.8.3",
42
- "typescript-eslint": "^8.32.1",
43
- "vite": "^6.3.5",
44
- "zod": "^4.1.12",
45
- "zustand": "^5.0.6",
46
- "@motiadev/core": "0.14.0-beta.165-285707",
47
- "@motiadev/stream-client-react": "0.14.0-beta.165-285707",
48
- "@motiadev/ui": "0.14.0-beta.165-285707"
33
+ "tailwind-merge": "^3.4.0",
34
+ "tailwindcss": "^4.1.17",
35
+ "tw-animate-css": "^1.4.0",
36
+ "typescript": "~5.9.3",
37
+ "typescript-eslint": "^8.47.0",
38
+ "babel-plugin-react-compiler": "^1.0.0",
39
+ "vite": "^7.2.4",
40
+ "zod": "^4.1.13",
41
+ "zustand": "^5.0.8",
42
+ "@motiadev/core": "0.15.0-beta.165",
43
+ "@motiadev/ui": "0.15.0-beta.165",
44
+ "@motiadev/stream-client-react": "0.15.0-beta.165"
49
45
  },
50
46
  "devDependencies": {
51
- "@testing-library/jest-dom": "^6.6.3",
52
- "@testing-library/react": "^16.1.0",
53
- "@testing-library/user-event": "^14.5.2",
54
- "@types/dagre": "^0.7.52",
55
- "@types/express": "^5.0.1",
56
- "@types/jest": "^29.5.14",
47
+ "@rollup/plugin-babel": "^6.1.0",
48
+ "@rollup/plugin-url": "^8.0.2",
49
+ "@testing-library/jest-dom": "^6.9.1",
50
+ "@testing-library/react": "^16.3.0",
51
+ "@testing-library/user-event": "^14.6.1",
52
+ "@types/dagre": "^0.7.53",
53
+ "@types/express": "^5.0.5",
54
+ "@types/jest": "^30.0.0",
57
55
  "@types/json-schema": "^7.0.15",
58
- "@types/node": "^22.15.18",
59
- "@types/react": "^19.1.4",
60
- "@types/react-dom": "^19.1.5",
56
+ "@types/node": "^24.10.1",
57
+ "@types/react": "^19.2.7",
58
+ "@types/react-dom": "^19.2.3",
61
59
  "@types/react-router-dom": "^5.3.3",
62
60
  "@types/react-syntax-highlighter": "^15.5.13",
63
- "jest": "^29.7.0",
64
- "jest-environment-jsdom": "^29.7.0",
65
- "ts-jest": "^29.3.4"
61
+ "jest": "^30.2.0",
62
+ "jest-environment-jsdom": "^30.2.0",
63
+ "publint": "^0.3.15",
64
+ "ts-jest": "^29.4.5",
65
+ "tsdown": "^0.16.8"
66
66
  },
67
67
  "scripts": {
68
68
  "lint": "biome check .",
69
69
  "lint:plugins": "pnpm run lint:plugins:ts && pnpm run lint:plugins:tsx",
70
70
  "lint:plugins:ts": "eslint",
71
71
  "lint:plugins:tsx": "eslint --config ../../eslint.config.tsx.js",
72
- "build": "rm -rf dist && tsc --build && sh post-build.sh",
72
+ "build": "tsdown",
73
+ "dev": "tsdown --watch",
74
+ "clean": "rm -rf dist",
73
75
  "test": "jest",
74
76
  "test:watch": "jest --watch"
75
77
  }
@@ -1 +0,0 @@
1
- export {};
@@ -1,97 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const generator_1 = require("../generator");
4
- describe('Generator', () => {
5
- describe('generateImports', () => {
6
- it('should generate import statements', () => {
7
- const packages = ['@test/plugin-1', '@test/plugin-2'];
8
- const imports = (0, generator_1.generateImports)(packages);
9
- expect(imports).toContain("import * as plugin_0 from '@test/plugin-1'");
10
- expect(imports).toContain("import * as plugin_1 from '@test/plugin-2'");
11
- });
12
- it('should handle empty package array', () => {
13
- const imports = (0, generator_1.generateImports)([]);
14
- expect(imports).toBe('');
15
- });
16
- });
17
- describe('generatePackageMap', () => {
18
- it('should generate package map', () => {
19
- const packages = ['@test/plugin-1', '@test/plugin-2'];
20
- const map = (0, generator_1.generatePackageMap)(packages);
21
- expect(map).toContain('const packageMap');
22
- expect(map).toContain("'@test/plugin-1': plugin_0");
23
- expect(map).toContain("'@test/plugin-2': plugin_1");
24
- });
25
- });
26
- describe('generatePluginLogic', () => {
27
- it('should generate plugin processing logic', () => {
28
- const plugins = [{ packageName: '@test/plugin', label: 'Test' }];
29
- const logic = (0, generator_1.generatePluginLogic)(plugins);
30
- expect(logic).toContain('const motiaPlugins');
31
- expect(logic).toContain('export const plugins');
32
- expect(logic).toContain('packageMap[plugin.packageName]');
33
- });
34
- });
35
- describe('generatePluginCode', () => {
36
- it('should generate complete module code', () => {
37
- const plugins = [{ packageName: '@test/plugin', label: 'Test' }];
38
- const code = (0, generator_1.generatePluginCode)(plugins);
39
- expect(code).toContain('import * as plugin_0');
40
- expect(code).toContain('const packageMap');
41
- expect(code).toContain('export const plugins');
42
- });
43
- it('should handle empty plugins array', () => {
44
- const code = (0, generator_1.generatePluginCode)([]);
45
- expect(code).toBe('export const plugins = []');
46
- });
47
- it('should handle multiple plugins', () => {
48
- const plugins = [{ packageName: '@test/plugin-1' }, { packageName: '@test/plugin-2' }];
49
- const code = (0, generator_1.generatePluginCode)(plugins);
50
- expect(code).toContain("'@test/plugin-1'");
51
- expect(code).toContain("'@test/plugin-2'");
52
- });
53
- });
54
- describe('generateCssImports', () => {
55
- it('should generate CSS import statements', () => {
56
- const plugins = [{ packageName: '@test/plugin', cssImports: ['styles.css', 'theme.css'] }];
57
- const css = (0, generator_1.generateCssImports)(plugins);
58
- expect(css).toContain("@import 'styles.css';");
59
- expect(css).toContain("@import 'theme.css';");
60
- });
61
- it('should filter empty CSS imports', () => {
62
- const plugins = [{ packageName: '@test/plugin', cssImports: ['styles.css', '', ' '] }];
63
- const css = (0, generator_1.generateCssImports)(plugins);
64
- expect(css).toContain("@import 'styles.css';");
65
- expect(css).not.toContain("@import '';");
66
- });
67
- it('should return empty string for plugins without CSS imports', () => {
68
- const plugins = [{ packageName: '@test/plugin' }];
69
- const css = (0, generator_1.generateCssImports)(plugins);
70
- expect(css).toBe('');
71
- });
72
- it('should flatten CSS imports from multiple plugins', () => {
73
- const plugins = [
74
- { packageName: '@test/plugin-1', cssImports: ['a.css'] },
75
- { packageName: '@test/plugin-2', cssImports: ['b.css'] },
76
- ];
77
- const css = (0, generator_1.generateCssImports)(plugins);
78
- expect(css).toContain("@import 'a.css';");
79
- expect(css).toContain("@import 'b.css';");
80
- });
81
- });
82
- describe('isValidCode', () => {
83
- it('should return true for valid code', () => {
84
- expect((0, generator_1.isValidCode)('export const plugins = []')).toBe(true);
85
- });
86
- it('should return false for empty string', () => {
87
- expect((0, generator_1.isValidCode)('')).toBe(false);
88
- });
89
- it('should return false for whitespace only', () => {
90
- expect((0, generator_1.isValidCode)(' \n\t ')).toBe(false);
91
- });
92
- it('should return false for non-string', () => {
93
- expect((0, generator_1.isValidCode)(null)).toBe(false);
94
- expect((0, generator_1.isValidCode)(undefined)).toBe(false);
95
- });
96
- });
97
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,64 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const resolver_1 = require("../resolver");
4
- describe('Resolver', () => {
5
- describe('resolvePluginPackage', () => {
6
- it('should resolve local plugin', () => {
7
- const plugin = { packageName: '~/plugins/local' };
8
- const resolved = (0, resolver_1.resolvePluginPackage)(plugin);
9
- expect(resolved.packageName).toBe('~/plugins/local');
10
- expect(resolved.isLocal).toBe(true);
11
- expect(resolved.resolvedPath).toContain('plugins/local');
12
- expect(resolved.alias).toBe('~/plugins/local');
13
- });
14
- it('should resolve npm package', () => {
15
- const plugin = { packageName: '@test/plugin' };
16
- const resolved = (0, resolver_1.resolvePluginPackage)(plugin);
17
- expect(resolved.packageName).toBe('@test/plugin');
18
- expect(resolved.isLocal).toBe(false);
19
- expect(resolved.resolvedPath).toContain('node_modules');
20
- expect(resolved.resolvedPath).toContain('@test/plugin');
21
- expect(resolved.alias).toBe('@test/plugin');
22
- });
23
- it('should normalize paths', () => {
24
- const plugin = { packageName: 'simple-plugin' };
25
- const resolved = (0, resolver_1.resolvePluginPackage)(plugin);
26
- expect(resolved.resolvedPath).not.toContain('\\');
27
- });
28
- });
29
- describe('createAliasConfig', () => {
30
- it('should create aliases for all plugins', () => {
31
- const plugins = [{ packageName: '~/plugins/local' }, { packageName: '@test/npm' }];
32
- const aliases = (0, resolver_1.createAliasConfig)(plugins);
33
- expect(aliases['~/plugins/local']).toBeDefined();
34
- expect(aliases['@test/npm']).toBeDefined();
35
- });
36
- it('should handle duplicate package names', () => {
37
- const plugins = [{ packageName: '@test/plugin' }, { packageName: '@test/plugin' }];
38
- const aliases = (0, resolver_1.createAliasConfig)(plugins);
39
- expect(Object.keys(aliases)).toHaveLength(1);
40
- expect(aliases['@test/plugin']).toBeDefined();
41
- });
42
- it('should return empty object for empty plugins array', () => {
43
- const aliases = (0, resolver_1.createAliasConfig)([]);
44
- expect(aliases).toEqual({});
45
- });
46
- });
47
- describe('getUniquePackageNames', () => {
48
- it('should return unique package names', () => {
49
- const plugins = [
50
- { packageName: '@test/a' },
51
- { packageName: '@test/b' },
52
- { packageName: '@test/a' },
53
- ];
54
- const unique = (0, resolver_1.getUniquePackageNames)(plugins);
55
- expect(unique).toHaveLength(2);
56
- expect(unique).toContain('@test/a');
57
- expect(unique).toContain('@test/b');
58
- });
59
- it('should return empty array for no plugins', () => {
60
- const unique = (0, resolver_1.getUniquePackageNames)([]);
61
- expect(unique).toEqual([]);
62
- });
63
- });
64
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,59 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const validator_1 = require("../validator");
4
- describe('Validator', () => {
5
- describe('validatePlugins', () => {
6
- it('should validate array of valid plugins', () => {
7
- const plugins = [
8
- { packageName: '@test/plugin-1', label: 'Plugin 1' },
9
- { packageName: '@test/plugin-2', label: 'Plugin 2' },
10
- ];
11
- const result = (0, validator_1.validatePlugins)(plugins);
12
- expect(result.valid).toBe(true);
13
- expect(result.errors).toHaveLength(0);
14
- });
15
- it('should reject non-array input', () => {
16
- const result = (0, validator_1.validatePlugins)('not-an-array');
17
- expect(result.valid).toBe(false);
18
- expect(result.errors.some((err) => err.includes('array'))).toBe(true);
19
- });
20
- it('should handle empty array', () => {
21
- const result = (0, validator_1.validatePlugins)([]);
22
- expect(result.valid).toBe(true);
23
- expect(result.warnings.some((w) => w.includes('No plugins'))).toBe(true);
24
- });
25
- it('should collect all errors from multiple plugins', () => {
26
- const plugins = [{ packageName: '' }, { packageName: '' }, { packageName: 'valid' }];
27
- const result = (0, validator_1.validatePlugins)(plugins);
28
- expect(result.valid).toBe(false);
29
- expect(result.errors.length).toBeGreaterThanOrEqual(2);
30
- });
31
- it('should warn about duplicate package names', () => {
32
- const plugins = [
33
- { packageName: '@test/plugin', label: 'Plugin 1' },
34
- { packageName: '@test/plugin', label: 'Plugin 2' },
35
- ];
36
- const result = (0, validator_1.validatePlugins)(plugins);
37
- expect(result.valid).toBe(true);
38
- expect(result.warnings.some((w) => w.includes('Duplicate'))).toBe(true);
39
- });
40
- it('should support failFast option', () => {
41
- const plugins = [{ packageName: '' }, { packageName: '' }];
42
- const result = (0, validator_1.validatePlugins)(plugins, { failFast: true });
43
- expect(result.valid).toBe(false);
44
- // With failFast, should stop after first plugin validation fails
45
- // Each plugin with empty packageName generates 2 errors (min length + invalid format)
46
- // So failFast should result in only the first plugin's errors
47
- expect(result.errors.length).toBeLessThanOrEqual(2);
48
- // Verify it didn't process second plugin by checking error messages don't mention index 1
49
- const hasIndex1Error = result.errors.some((err) => err.includes('index 1'));
50
- expect(hasIndex1Error).toBe(false);
51
- });
52
- it('should handle mixed valid and invalid plugins', () => {
53
- const plugins = [{ packageName: '@test/valid' }, { packageName: '' }, { packageName: '@test/another-valid' }];
54
- const result = (0, validator_1.validatePlugins)(plugins);
55
- expect(result.valid).toBe(false);
56
- expect(result.errors.length).toBeGreaterThan(0);
57
- });
58
- });
59
- });
@@ -1,78 +0,0 @@
1
- import type { WorkbenchPlugin } from './types';
2
- /**
3
- * Generates import statements for all unique plugin packages.
4
- *
5
- * @param packages - Array of unique package names
6
- * @returns JavaScript code string with import statements
7
- *
8
- * @example
9
- * ```ts
10
- * generateImports(['@org/plugin-1', '~/plugins/local'])
11
- * // Returns:
12
- * // import * as plugin_0 from '@org/plugin-1'
13
- * // import * as plugin_1 from '~/plugins/local'
14
- * ```
15
- */
16
- export declare function generateImports(packages: string[]): string;
17
- /**
18
- * Generates the package map that links package names to their imported modules.
19
- *
20
- * @param packages - Array of unique package names
21
- * @returns JavaScript code string defining the package map
22
- *
23
- * @example
24
- * ```ts
25
- * generatePackageMap(['@org/plugin-1', '~/plugins/local'])
26
- * // Returns: const packageMap = {'@org/plugin-1': plugin_0,'~/plugins/local': plugin_1}
27
- * ```
28
- */
29
- export declare function generatePackageMap(packages: string[]): string;
30
- /**
31
- * Generates the plugin transformation logic that processes plugin configurations.
32
- *
33
- * @param plugins - Array of plugin configurations
34
- * @returns JavaScript code string with plugin processing logic
35
- */
36
- export declare function generatePluginLogic(plugins: WorkbenchPlugin[]): string;
37
- /**
38
- * Generates the complete virtual module code for all plugins.
39
- * This is the main code generation function that combines all parts.
40
- *
41
- * @param plugins - Array of plugin configurations
42
- * @returns Complete JavaScript code string for the virtual module
43
- *
44
- * @example
45
- * ```ts
46
- * const plugins = [
47
- * { packageName: '@test/plugin', label: 'Test' }
48
- * ]
49
- * const code = generatePluginCode(plugins)
50
- * // Returns complete module code with imports, map, and logic
51
- * ```
52
- */
53
- export declare function generatePluginCode(plugins: WorkbenchPlugin[]): string;
54
- /**
55
- * Generates CSS imports for plugins that specify cssImports.
56
- *
57
- * @param plugins - Array of plugin configurations
58
- * @returns CSS import statements as a string
59
- *
60
- * @example
61
- * ```ts
62
- * const plugins = [
63
- * { packageName: '@test/plugin', cssImports: ['styles.css', 'theme.css'] }
64
- * ]
65
- * generateCssImports(plugins)
66
- * // Returns:
67
- * // @import 'styles.css';
68
- * // @import 'theme.css';
69
- * ```
70
- */
71
- export declare function generateCssImports(plugins: WorkbenchPlugin[]): string;
72
- /**
73
- * Checks if the generated code is valid (non-empty and has content).
74
- *
75
- * @param code - The generated code to check
76
- * @returns True if code is valid
77
- */
78
- export declare function isValidCode(code: string): boolean;
@@ -1,22 +0,0 @@
1
- import type { Printer } from '@motiadev/core';
2
- import type { HmrContext, ModuleNode } from 'vite';
3
- import type { WorkbenchPlugin } from './types';
4
- export declare function isConfigFile(file: string): boolean;
5
- /**
6
- * Checks if a file change should trigger HMR for plugins.
7
- *
8
- * @param file - The file path that changed
9
- * @param plugins - Current plugin configurations
10
- * @returns True if the change affects plugins
11
- */
12
- export declare function shouldInvalidatePlugins(file: string, plugins: WorkbenchPlugin[]): boolean;
13
- /**
14
- * Handles hot updates for the plugin system.
15
- * This function is called by Vite's handleHotUpdate hook.
16
- *
17
- * @param ctx - Vite's HMR context
18
- * @param plugins - Current plugin configurations
19
- * @param printer - Printer instance for logging
20
- * @returns Array of modules to update, or undefined to continue with default behavior
21
- */
22
- export declare function handlePluginHotUpdate(ctx: HmrContext, plugins: WorkbenchPlugin[], printer: Printer): ModuleNode[] | undefined;