@motiadev/workbench 0.8.2-beta.140-799293 → 0.8.2-beta.140-628177

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.
@@ -9,6 +9,14 @@ const fs_1 = __importDefault(require("fs"));
9
9
  const path_1 = __importDefault(require("path"));
10
10
  const vite_1 = require("vite");
11
11
  const vite_plugin_motia_plugins_1 = __importDefault(require("./vite-plugin-motia-plugins"));
12
+ const workbenchBasePlugin = (workbenchBase) => {
13
+ return {
14
+ name: 'html-transform',
15
+ transformIndexHtml: (html) => {
16
+ return html.replace('</head>', `<script>const workbenchBase = ${JSON.stringify(workbenchBase)};</script></head>`);
17
+ },
18
+ };
19
+ };
12
20
  const processCwdPlugin = () => {
13
21
  return {
14
22
  name: 'html-transform',
@@ -62,7 +70,13 @@ const applyMiddleware = async ({ app, port, workbenchBase, plugins }) => {
62
70
  // antd: path.join(process.cwd(), './node_modules/antd'),
63
71
  },
64
72
  },
65
- plugins: [(0, plugin_react_1.default)(), processCwdPlugin(), reoPlugin(), (0, vite_plugin_motia_plugins_1.default)(plugins)],
73
+ plugins: [
74
+ (0, plugin_react_1.default)(),
75
+ processCwdPlugin(),
76
+ reoPlugin(),
77
+ (0, vite_plugin_motia_plugins_1.default)(plugins),
78
+ workbenchBasePlugin(workbenchBase),
79
+ ],
66
80
  assetsInclude: ['**/*.png', '**/*.jpg', '**/*.jpeg', '**/*.gif', '**/*.svg', '**/*.ico', '**/*.webp', '**/*.avif'],
67
81
  });
68
82
  app.use(workbenchBase, vite.middlewares);
@@ -0,0 +1 @@
1
+ export declare const NotFoundPage: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Header } from './header/header';
3
+ export const NotFoundPage = () => (_jsxs("div", { className: "grid grid-rows-[auto_1fr] h-screen bg-background text-foreground", children: [_jsx(Header, {}), _jsxs("div", { className: "flex flex-col items-center justify-center", children: [_jsx("h1", { className: "text-4xl font-bold mb-4", children: "404 \u2013 Page Not Found" }), _jsx("p", { className: "text-lg opacity-80 mb-6", children: "This route doesn\u2019t exist." })] })] }));
package/dist/src/main.js CHANGED
@@ -1,14 +1,18 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { MotiaStreamProvider } from '@motiadev/stream-client-react';
3
3
  import { StrictMode } from 'react';
4
4
  import { createRoot } from 'react-dom/client';
5
+ import { BrowserRouter, Routes, Route } from 'react-router-dom';
5
6
  import { RootMotia } from './components/root-motia';
7
+ import { App } from './App';
8
+ import { NotFoundPage } from './components/NotFoundPage';
6
9
  import '@motiadev/ui/globals.css';
7
10
  import './index.css';
8
- import { App } from './App';
9
11
  const rootElement = document.getElementById('root');
10
12
  if (!rootElement.innerHTML) {
13
+ // eslint-disable-next-line no-undef
14
+ const basePath = workbenchBase;
11
15
  const root = createRoot(rootElement);
12
16
  const address = window.location.origin.replace('http', 'ws');
13
- root.render(_jsx(StrictMode, { children: _jsx(MotiaStreamProvider, { address: address, children: _jsx(RootMotia, { children: _jsx(App, {}) }) }) }));
17
+ root.render(_jsx(StrictMode, { children: _jsx(MotiaStreamProvider, { address: address, children: _jsx(RootMotia, { children: _jsx(BrowserRouter, { children: _jsxs(Routes, { children: [_jsx(Route, { path: basePath, element: _jsx(App, {}) }), _jsx(Route, { path: "*", element: _jsx(NotFoundPage, {}) })] }) }) }) }) }));
14
18
  }