diff --git a/examples/quickstart/client/.eslintrc.cjs b/examples/quickstart/client/.eslintrc.cjs new file mode 100644 index 0000000..d6c9537 --- /dev/null +++ b/examples/quickstart/client/.eslintrc.cjs @@ -0,0 +1,18 @@ +module.exports = { + root: true, + env: { browser: true, es2020: true }, + extends: [ + 'eslint:recommended', + 'plugin:@typescript-eslint/recommended', + 'plugin:react-hooks/recommended', + ], + ignorePatterns: ['dist', '.eslintrc.cjs'], + parser: '@typescript-eslint/parser', + plugins: ['react-refresh'], + rules: { + 'react-refresh/only-export-components': [ + 'warn', + { allowConstantExport: true }, + ], + }, +} diff --git a/examples/quickstart/client/.gitignore b/examples/quickstart/client/.gitignore index 4d29575..b0628e1 100644 --- a/examples/quickstart/client/.gitignore +++ b/examples/quickstart/client/.gitignore @@ -1,23 +1,27 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# dependencies -/node_modules -/.pnp -.pnp.js - -# testing -/coverage +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* -# production -/build +node_modules +dist +dist-ssr +*.local -# misc +# Editor directories and files +.vscode/* +!.vscode/extensions.json +.idea .DS_Store -.env.local -.env.development.local -.env.test.local -.env.production.local +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? -npm-debug.log* -yarn-debug.log* -yarn-error.log* +server +module_bindings \ No newline at end of file diff --git a/examples/quickstart/client/README.md b/examples/quickstart/client/README.md index b87cb00..544eeee 100644 --- a/examples/quickstart/client/README.md +++ b/examples/quickstart/client/README.md @@ -1,46 +1,8 @@ -# Getting Started with Create React App +# React + TypeScript + Vite -This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). +This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. -## Available Scripts +Currently, two official plugins are available: -In the project directory, you can run: - -### `npm start` - -Runs the app in the development mode.\ -Open [http://localhost:3000](http://localhost:3000) to view it in the browser. - -The page will reload if you make edits.\ -You will also see any lint errors in the console. - -### `npm test` - -Launches the test runner in the interactive watch mode.\ -See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. - -### `npm run build` - -Builds the app for production to the `build` folder.\ -It correctly bundles React in production mode and optimizes the build for the best performance. - -The build is minified and the filenames include the hashes.\ -Your app is ready to be deployed! - -See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. - -### `npm run eject` - -**Note: this is a one-way operation. Once you `eject`, you can’t go back!** - -If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. - -Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. - -You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. - -## Learn More - -You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). - -To learn React, check out the [React documentation](https://reactjs.org/). +- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh +- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh diff --git a/examples/quickstart/client/index.html b/examples/quickstart/client/index.html new file mode 100644 index 0000000..e4b78ea --- /dev/null +++ b/examples/quickstart/client/index.html @@ -0,0 +1,13 @@ + + + + + + + Vite + React + TS + + +
+ + + diff --git a/examples/quickstart/client/package.json b/examples/quickstart/client/package.json index 6e4095a..42f1ae7 100644 --- a/examples/quickstart/client/package.json +++ b/examples/quickstart/client/package.json @@ -1,43 +1,27 @@ { - "name": "quickstart", - "version": "0.1.0", + "name": "client-vite", "private": true, - "dependencies": { - "@clockworklabs/spacetimedb-sdk": "workspace:*", - "@testing-library/jest-dom": "^5.17.0", - "@testing-library/react": "^13.4.0", - "@testing-library/user-event": "^13.5.0", - "@types/jest": "^27.5.2", - "@types/node": "^16.18.38", - "@types/react": "^18.2.15", - "@types/react-dom": "^18.2.7", - "react": "^18.2.0", - "react-dom": "^18.2.0", - "react-scripts": "5.0.1", - "typescript": "^4.9.5", - "web-vitals": "^2.1.4" - }, + "version": "0.0.0", + "type": "module", "scripts": { - "start": "react-scripts start", - "build": "react-scripts build", - "eject": "react-scripts eject" + "dev": "vite", + "build": "tsc -b && vite build", + "preview": "vite preview", + "spacetime:generate-bindings": "spacetime generate --lang typescript --out-dir src/module_bindings --project-path ../server", + "spacetime:start": "spacetime start server", + "spacetime:publish:local": "spacetime publish chat --project-path ../server --server local", + "spacetime:publish": "spacetime publish chat --project-path ../server --server testnet" }, - "eslintConfig": { - "extends": [ - "react-app", - "react-app/jest" - ] + "dependencies": { + "react": "^18.3.1", + "react-dom": "^18.3.1", + "@clockworklabs/spacetimedb-sdk": "workspace:*" }, - "browserslist": { - "production": [ - ">0.2%", - "not dead", - "not op_mini all" - ], - "development": [ - "last 1 chrome version", - "last 1 firefox version", - "last 1 safari version" - ] + "devDependencies": { + "@types/react": "^18.3.3", + "@types/react-dom": "^18.3.0", + "@vitejs/plugin-react": "^4.3.1", + "typescript": "^5.2.2", + "vite": "^5.3.4" } } diff --git a/examples/quickstart/client/public/favicon.ico b/examples/quickstart/client/public/favicon.ico deleted file mode 100644 index a11777c..0000000 Binary files a/examples/quickstart/client/public/favicon.ico and /dev/null differ diff --git a/examples/quickstart/client/public/index.html b/examples/quickstart/client/public/index.html deleted file mode 100644 index aa069f2..0000000 --- a/examples/quickstart/client/public/index.html +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - React App - - - -
- - - diff --git a/examples/quickstart/client/public/logo192.png b/examples/quickstart/client/public/logo192.png deleted file mode 100644 index fc44b0a..0000000 Binary files a/examples/quickstart/client/public/logo192.png and /dev/null differ diff --git a/examples/quickstart/client/public/logo512.png b/examples/quickstart/client/public/logo512.png deleted file mode 100644 index a4e47a6..0000000 Binary files a/examples/quickstart/client/public/logo512.png and /dev/null differ diff --git a/examples/quickstart/client/public/manifest.json b/examples/quickstart/client/public/manifest.json deleted file mode 100644 index 080d6c7..0000000 --- a/examples/quickstart/client/public/manifest.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "short_name": "React App", - "name": "Create React App Sample", - "icons": [ - { - "src": "favicon.ico", - "sizes": "64x64 32x32 24x24 16x16", - "type": "image/x-icon" - }, - { - "src": "logo192.png", - "type": "image/png", - "sizes": "192x192" - }, - { - "src": "logo512.png", - "type": "image/png", - "sizes": "512x512" - } - ], - "start_url": ".", - "display": "standalone", - "theme_color": "#000000", - "background_color": "#ffffff" -} diff --git a/examples/quickstart/client/public/robots.txt b/examples/quickstart/client/public/robots.txt deleted file mode 100644 index e9e57dc..0000000 --- a/examples/quickstart/client/public/robots.txt +++ /dev/null @@ -1,3 +0,0 @@ -# https://www.robotstxt.org/robotstxt.html -User-agent: * -Disallow: diff --git a/examples/quickstart/client/src/App.css b/examples/quickstart/client/src/App.css index 0b7f2cf..7495737 100644 --- a/examples/quickstart/client/src/App.css +++ b/examples/quickstart/client/src/App.css @@ -1,39 +1,93 @@ .App { - text-align: center; - padding: 2rem; + display: grid; + grid-template-rows: auto 1fr; + gap: 2rem; + + height: 100%; } -.App-logo { - height: 40vmin; - pointer-events: none; +.profile { + display: flex; + align-items: center; + flex-direction: row; + gap: 1rem; + justify-content: center; + width: 100%; + margin-top: 20px; + padding: 1rem 0; + border-bottom: 1px solid var(--theme-color); } -@media (prefers-reduced-motion: no-preference) { - .App-logo { - animation: App-logo-spin infinite 20s linear; - } +h2 { + flex: 1 1 auto; + margin-bottom: 1em; +} + +form { + display: contents; +} + +.chatbox { + display: grid; + grid-template-rows: 1fr auto; + + padding: 1rem 0; +} + +.system { + position: fixed; + top: 5%; + right: 2%; + + font-family: monospace; } -.App-header { - background-color: #282c34; - min-height: 100vh; +.new-message { + position: relative; + display: flex; - flex-direction: column; - align-items: center; - justify-content: center; - font-size: calc(10px + 2vmin); - color: white; + gap: 1rem; + + width: 100%; } -.App-link { - color: #61dafb; +.new-message input { + --shadow: 0px 2.9px 10px rgba(0, 0, 0, 0.095), + 0px 23px 80px rgba(0, 0, 0, 0.19); + min-width: 0; + flex: 1 1 auto; + + padding: 1.7rem; + padding-right: 5rem; + + border: none; + border-radius: 3rem; + background-color: var(--textbox-color); + caret-color: var(--theme-color); + font-family: monospace; + font-weight: 400; + font-size: 1rem; + resize: none; + box-shadow: var(--shadow); } -@keyframes App-logo-spin { - from { - transform: rotate(0deg); - } - to { - transform: rotate(360deg); +.new-message input:focus { + outline: none; + box-shadow: var(--shadow), 0 0 0 2px var(--theme-color); +} + +@media (prefers-color-scheme: dark) { + .new-message input { + --shadow: 0 0 0 1px #17492b; } } + +.new-message button { + position: absolute; + right: 0.75rem; + top: 50%; + + border-radius: 2rem; + + translate: 0 -50%; +} diff --git a/examples/quickstart/client/src/App.tsx b/examples/quickstart/client/src/App.tsx index dbfd14d..fd14b46 100644 --- a/examples/quickstart/client/src/App.tsx +++ b/examples/quickstart/client/src/App.tsx @@ -1,77 +1,144 @@ -import React, { useEffect, useState, useRef } from "react"; -import logo from "./logo.svg"; import "./App.css"; -import { SpacetimeDBClient, Identity } from "@clockworklabs/spacetimedb-sdk"; - +// Bindings import Message from "./module_bindings/message"; -import User from "./module_bindings/user"; import SendMessageReducer from "./module_bindings/send_message_reducer"; import SetNameReducer from "./module_bindings/set_name_reducer"; +import User from "./module_bindings/user"; -SpacetimeDBClient.registerTables(Message, User); -SpacetimeDBClient.registerReducers(SendMessageReducer, SetNameReducer); +import { Identity, SpacetimeDBClient } from "@clockworklabs/spacetimedb-sdk"; +import React, { useEffect, useRef, useState } from "react"; export type MessageType = { name: string; message: string; }; -let token = localStorage.getItem("auth_token") || undefined; -var spacetimeDBClient = new SpacetimeDBClient( - "ws://localhost:3000", - "chat", - token -); +// Register the tables and reducers before creating the SpacetimeDBClient +SpacetimeDBClient.registerTables(Message, User); +SpacetimeDBClient.registerReducers(SendMessageReducer, SetNameReducer); + +const token = localStorage.getItem("auth_token") || undefined; +const client = new SpacetimeDBClient("ws://localhost:3000", "chat", token); function App() { const [newName, setNewName] = useState(""); const [settingName, setSettingName] = useState(false); const [name, setName] = useState(""); - const [systemMessage, setSystemMessage] = useState(""); + + // Store all system messages as a Set, to avoid duplication + const [systemMessages, setSystemMessages] = useState( + () => new Set([]) + ); const [messages, setMessages] = useState([]); const [newMessage, setNewMessage] = useState(""); - let local_identity = useRef(undefined); - let initialized = useRef(false); + const local_identity = useRef(undefined); + const initialized = useRef(false); + + useEffect(() => { + if (!initialized.current) { + client.connect(); + initialized.current = true; + } + }, []); + + // All the event listeners are set up in the useEffect hook + useEffect(() => { + client.on("disconnected", () => { + console.log("disconnected"); + }); + + client.on("client_error", () => { + console.log("client_error"); + }); + + client.onConnect((token: string, identity: Identity) => { + console.log("Connected to SpacetimeDB"); + + local_identity.current = identity; + + localStorage.setItem("auth_token", token); - const client = useRef(spacetimeDBClient); - client.current.on("disconnected", () => { - console.log("disconnected"); - }); - client.current.on("client_error", () => { - console.log("client_error"); - }); + client.subscribe(["SELECT * FROM User", "SELECT * FROM Message"]); + }); - client.current.onConnect((token: string, identity: Identity) => { - console.log("Connected to SpacetimeDB"); + client.on("initialStateSync", () => { + setAllMessagesInOrder(); + const user = User.findByIdentity(local_identity?.current!); + setName(userNameOrIdentity(user!)); + }); - local_identity.current = identity; + User.onInsert((user) => { + if (user.online) { + appendToSystemMessage(`${userNameOrIdentity(user)} has connected.`); + } + }); - localStorage.setItem("auth_token", token); + User.onUpdate((oldUser, user) => { + if (oldUser.online === false && user.online === true) { + appendToSystemMessage(`${userNameOrIdentity(user)} has connected.`); + } else if (oldUser.online === true && user.online === false) { + appendToSystemMessage(`${userNameOrIdentity(user)} has disconnected.`); + } + + if (user.name !== oldUser.name) { + appendToSystemMessage( + `User ${userNameOrIdentity(oldUser)} renamed to ${userNameOrIdentity( + user + )}.` + ); + } + }); + + Message.onInsert(() => { + setAllMessagesInOrder(); + }); + + SendMessageReducer.on((reducerEvent) => { + if ( + local_identity.current && + reducerEvent.callerIdentity.isEqual(local_identity.current) + ) { + if (reducerEvent.status === "failed") { + appendToSystemMessage( + `Error sending message: ${reducerEvent.message} ` + ); + } + } + }); - client.current.subscribe(["SELECT * FROM User", "SELECT * FROM Message"]); - }); + SetNameReducer.on((reducerEvent, reducerArgs) => { + if ( + local_identity.current && + reducerEvent.callerIdentity.isEqual(local_identity.current) + ) { + if (reducerEvent.status === "failed") { + appendToSystemMessage(`Error setting name: ${reducerEvent.message} `); + } else if (reducerEvent.status === "committed") { + setName(reducerArgs[0]); + } + } + }); + }, []); function userNameOrIdentity(user: User): string { console.log(`Name: ${user.name} `); - if (user.name !== null) { - return user.name || ""; - } else { - var identityStr = user.identity.toHexString(); - console.log(`Name: ${identityStr} `); - return user.identity.toHexString().substring(0, 8); - } + if (user.name !== null) return user.name || ""; + + const identityStr = user.identity.toHexString(); + console.log(`Name: ${identityStr} `); + return user.identity.toHexString().substring(0, 8); } function setAllMessagesInOrder() { - let messages = Array.from(Message.all()); + const messages = Array.from(Message.all()); messages.sort((a, b) => (a.sent > b.sent ? 1 : a.sent < b.sent ? -1 : 0)); - let messagesType: MessageType[] = messages.map((message) => { - let sender = User.findByIdentity(message.sender); - let name = sender ? userNameOrIdentity(sender) : "unknown"; + const messagesType: MessageType[] = messages.map((message) => { + const sender = User.findByIdentity(message.sender); + const name = sender ? userNameOrIdentity(sender) : "unknown"; return { name: name, // convert sender Uint8Array to name string using helper function @@ -82,69 +149,11 @@ function App() { setMessages(messagesType); } - client.current.on("initialStateSync", () => { - setAllMessagesInOrder(); - var user = User.findByIdentity(local_identity?.current!); - setName(userNameOrIdentity(user!)); - }); - // Helper function to append a line to the systemMessage state - function appendToSystemMessage(line: String) { - setSystemMessage((prevMessage) => prevMessage + "\n" + line); + function appendToSystemMessage(line: string) { + setSystemMessages((systemMessages) => systemMessages.add(line)); } - User.onInsert((user, reducerEvent) => { - if (user.online) { - appendToSystemMessage(`${userNameOrIdentity(user)} has connected.`); - } - }); - - User.onUpdate((oldUser, user, reducerEvent) => { - if (oldUser.online === false && user.online === true) { - appendToSystemMessage(`${userNameOrIdentity(user)} has connected.`); - } else if (oldUser.online === true && user.online === false) { - appendToSystemMessage(`${userNameOrIdentity(user)} has disconnected.`); - } - - if (user.name !== oldUser.name) { - appendToSystemMessage( - `User ${userNameOrIdentity(oldUser)} renamed to ${userNameOrIdentity( - user - )}.` - ); - } - }); - - Message.onInsert((message, reducerEvent) => { - setAllMessagesInOrder(); - }); - - SendMessageReducer.on((reducerEvent, reducerArgs) => { - if ( - local_identity.current && - reducerEvent.callerIdentity.isEqual(local_identity.current) - ) { - if (reducerEvent.status === "failed") { - appendToSystemMessage( - `Error sending message: ${reducerEvent.message} ` - ); - } - } - }); - - SetNameReducer.on((reducerEvent, reducerArgs) => { - if ( - local_identity.current && - reducerEvent.callerIdentity.isEqual(local_identity.current) - ) { - if (reducerEvent.status === "failed") { - appendToSystemMessage(`Error setting name: ${reducerEvent.message} `); - } else if (reducerEvent.status === "committed") { - setName(reducerArgs[0]); - } - } - }); - const onSubmitNewName = (e: React.FormEvent) => { e.preventDefault(); SetNameReducer.call(newName); @@ -158,27 +167,21 @@ function App() { setNewMessage(""); }; - useEffect(() => { - if (!initialized.current) { - client.current.connect(); - initialized.current = true; - } - }, []); - return (
-

Profile

+

Profile

{!settingName ? ( <>

{name}

) : ( @@ -189,47 +192,48 @@ function App() { value={newName} onChange={(e) => setNewName(e.target.value)} /> - + )}
-
-

Messages

- {messages.length < 1 &&

No messages

} -
- {messages.map((message, key) => ( -
-

- {message.name}: {message.message} -

-
- ))} + +
+
+

Messages

+ {messages.length < 1 &&

No messages

} +
+ {messages.map(({ message, name }) => ( +
+

+ {name}: {message} +

+
+ ))} +
-
+ +
+
+ setNewMessage(e.target.value)} + placeholder="Send a message..." + autoFocus + type="text" + /> + +
+
+ +
-

System

+

System

-

{systemMessage}

+ {Array.from(systemMessages).map((message) => ( +

{message}

+ ))}
-
-
-

New Message

- - -
-
); } diff --git a/examples/quickstart/client/src/index.css b/examples/quickstart/client/src/index.css index 4a1df4d..fffcbbe 100644 --- a/examples/quickstart/client/src/index.css +++ b/examples/quickstart/client/src/index.css @@ -1,3 +1,31 @@ +*, +*::before, +*::after { + box-sizing: border-box; + margin: 0; + padding: 0; +} + +:root { + --theme-color: #3dc373; + --theme-color-contrast: #08180e; + --textbox-color: #edfef4; + color-scheme: light dark; + + display: flex; + justify-content: center; + + height: 100%; +} + +@media (prefers-color-scheme: dark) { + :root { + --theme-color: #4cf490; + --theme-color-contrast: #132219; + --textbox-color: #0f311d; + } +} + body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", @@ -5,9 +33,42 @@ body { sans-serif; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; + width: clamp(300px, 100%, 600px); } code { font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", monospace; } + +#root { + height: 100%; +} + +button { + padding: 0.5rem 0.75rem; + border: none; + border-radius: 0.375rem; + background-color: var(--theme-color); + color: var(--theme-color-contrast); + cursor: pointer; + font-weight: 600; + letter-spacing: 0.1px; + font-family: monospace; +} + +input { + height: 31.5px; + margin-bottom: 0 !important; + padding: 0.5rem 0.75rem; + border: none; + border-radius: 0.375rem; + caret-color: var(--theme-color); + font-weight: 600; + letter-spacing: 0.1px; +} + +input:focus { + outline: none; + box-shadow: 0 0 0 2px var(--theme-color); +} diff --git a/examples/quickstart/client/src/index.tsx b/examples/quickstart/client/src/index.tsx deleted file mode 100644 index ccbac81..0000000 --- a/examples/quickstart/client/src/index.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import React from "react"; -import ReactDOM from "react-dom/client"; -import "./index.css"; -import App from "./App"; -import reportWebVitals from "./reportWebVitals"; - -const root = ReactDOM.createRoot( - document.getElementById("root") as HTMLElement -); -root.render( - - - -); - -// If you want to start measuring performance in your app, pass a function -// to log results (for example: reportWebVitals(console.log)) -// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals -reportWebVitals(); diff --git a/examples/quickstart/client/src/logo.svg b/examples/quickstart/client/src/logo.svg deleted file mode 100644 index 9dfc1c0..0000000 --- a/examples/quickstart/client/src/logo.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/examples/quickstart/client/src/main.tsx b/examples/quickstart/client/src/main.tsx new file mode 100644 index 0000000..3d7150d --- /dev/null +++ b/examples/quickstart/client/src/main.tsx @@ -0,0 +1,10 @@ +import React from 'react' +import ReactDOM from 'react-dom/client' +import App from './App.tsx' +import './index.css' + +ReactDOM.createRoot(document.getElementById('root')!).render( + + + , +) diff --git a/examples/quickstart/client/src/module_bindings/message.ts b/examples/quickstart/client/src/module_bindings/message.ts index 6ed4f5b..e811c7c 100644 --- a/examples/quickstart/client/src/module_bindings/message.ts +++ b/examples/quickstart/client/src/module_bindings/message.ts @@ -2,98 +2,80 @@ // WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD. // @ts-ignore -import { - __SPACETIMEDB__, - AlgebraicType, - ProductType, - BuiltinType, - ProductTypeElement, - SumType, - SumTypeVariant, - DatabaseTable, - AlgebraicValue, - ReducerEvent, - Identity, - Address, - ClientDB, - SpacetimeDBClient, -} from "@clockworklabs/spacetimedb-sdk"; +import { __SPACETIMEDB__, AlgebraicType, ProductType, BuiltinType, ProductTypeElement, SumType, SumTypeVariant, DatabaseTable, AlgebraicValue, ReducerEvent, Identity, Address, ClientDB, SpacetimeDBClient } from "@clockworklabs/spacetimedb-sdk"; -export class Message extends DatabaseTable { - public static db: ClientDB = __SPACETIMEDB__.clientDB; - public static tableName = "Message"; - public sender: Identity; - public sent: BigInt; - public text: string; +export class Message extends DatabaseTable +{ + public static db: ClientDB = __SPACETIMEDB__.clientDB; + public static tableName = "Message"; + public sender: Identity; + public sent: BigInt; + public text: string; - constructor(sender: Identity, sent: BigInt, text: string) { - super(); - this.sender = sender; - this.sent = sent; - this.text = text; - } + constructor(sender: Identity, sent: BigInt, text: string) { + super(); + this.sender = sender; + this.sent = sent; + this.text = text; + } - public static serialize(value: Message): object { - return [Array.from(value.sender.toUint8Array()), value.sent, value.text]; - } + public static serialize(value: Message): object { + return [ + Array.from(value.sender.toUint8Array()), value.sent, value.text + ]; + } - public static getAlgebraicType(): AlgebraicType { - return AlgebraicType.createProductType([ - new ProductTypeElement( - "sender", - AlgebraicType.createProductType([ - new ProductTypeElement( - "__identity_bytes", - AlgebraicType.createArrayType( - AlgebraicType.createPrimitiveType(BuiltinType.Type.U8) - ) - ), - ]) - ), - new ProductTypeElement( - "sent", - AlgebraicType.createPrimitiveType(BuiltinType.Type.U64) - ), - new ProductTypeElement( - "text", - AlgebraicType.createPrimitiveType(BuiltinType.Type.String) - ), - ]); - } + public static getAlgebraicType(): AlgebraicType + { + return AlgebraicType.createProductType([ + new ProductTypeElement("sender", AlgebraicType.createProductType([ + new ProductTypeElement("__identity_bytes", AlgebraicType.createArrayType(AlgebraicType.createPrimitiveType(BuiltinType.Type.U8))), + ])), + new ProductTypeElement("sent", AlgebraicType.createPrimitiveType(BuiltinType.Type.U64)), + new ProductTypeElement("text", AlgebraicType.createPrimitiveType(BuiltinType.Type.String)), + ]); + } - public static fromValue(value: AlgebraicValue): Message { - let productValue = value.asProductValue(); - let __sender = new Identity( - productValue.elements[0].asProductValue().elements[0].asBytes() - ); - let __sent = productValue.elements[1].asBigInt(); - let __text = productValue.elements[2].asString(); - return new this(__sender, __sent, __text); - } + public static fromValue(value: AlgebraicValue): Message + { + let productValue = value.asProductValue(); + let __sender = new Identity(productValue.elements[0].asProductValue().elements[0].asBytes()); + let __sent = productValue.elements[1].asBigInt(); + let __text = productValue.elements[2].asString(); + return new this(__sender, __sent, __text); + } - public static *filterBySender(value: Identity): IterableIterator { - for (let instance of this.db.getTable("Message").getInstances()) { - if (instance.sender.isEqual(value)) { - yield instance; - } - } - } + public static *filterBySender(value: Identity): IterableIterator + { + for (let instance of this.db.getTable("Message").getInstances()) + { + if (instance.sender.isEqual(value)) { + yield instance; + } + } + } + + public static *filterBySent(value: BigInt): IterableIterator + { + for (let instance of this.db.getTable("Message").getInstances()) + { + if (instance.sent === value) { + yield instance; + } + } + } + + public static *filterByText(value: string): IterableIterator + { + for (let instance of this.db.getTable("Message").getInstances()) + { + if (instance.text === value) { + yield instance; + } + } + } - public static *filterBySent(value: BigInt): IterableIterator { - for (let instance of this.db.getTable("Message").getInstances()) { - if (instance.sent === value) { - yield instance; - } - } - } - public static *filterByText(value: string): IterableIterator { - for (let instance of this.db.getTable("Message").getInstances()) { - if (instance.text === value) { - yield instance; - } - } - } } export default Message; diff --git a/examples/quickstart/client/src/module_bindings/send_message_reducer.ts b/examples/quickstart/client/src/module_bindings/send_message_reducer.ts index 3e4ca1d..dc3c224 100644 --- a/examples/quickstart/client/src/module_bindings/send_message_reducer.ts +++ b/examples/quickstart/client/src/module_bindings/send_message_reducer.ts @@ -2,52 +2,37 @@ // WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD. // @ts-ignore -import { - __SPACETIMEDB__, - AlgebraicType, - ProductType, - BuiltinType, - ProductTypeElement, - DatabaseTable, - AlgebraicValue, - ReducerArgsAdapter, - SumTypeVariant, - Serializer, - Identity, - Address, - ReducerEvent, - Reducer, - SpacetimeDBClient, -} from "@clockworklabs/spacetimedb-sdk"; +import { __SPACETIMEDB__, AlgebraicType, ProductType, BuiltinType, ProductTypeElement, DatabaseTable, AlgebraicValue, ReducerArgsAdapter, SumTypeVariant, Serializer, Identity, Address, ReducerEvent, Reducer, SpacetimeDBClient } from "@clockworklabs/spacetimedb-sdk"; -export class SendMessageReducer extends Reducer { - public static reducerName: string = "SendMessage"; - public static call(_text: string) { - this.getReducer().call(_text); - } +export class SendMessageReducer extends Reducer +{ + public static reducerName: string = "SendMessage"; + public static call(_text: string) { + this.getReducer().call(_text); + } - public call(_text: string) { - const serializer = this.client.getSerializer(); - let _textType = AlgebraicType.createPrimitiveType(BuiltinType.Type.String); - serializer.write(_textType, _text); - this.client.call("send_message", serializer); - } + public call(_text: string) { + const serializer = this.client.getSerializer(); + let _textType = AlgebraicType.createPrimitiveType(BuiltinType.Type.String); + serializer.write(_textType, _text); + this.client.call("send_message", serializer); + } - public static deserializeArgs(adapter: ReducerArgsAdapter): any[] { - let textType = AlgebraicType.createPrimitiveType(BuiltinType.Type.String); - let textValue = AlgebraicValue.deserialize(textType, adapter.next()); - let text = textValue.asString(); - return [text]; - } + public static deserializeArgs(adapter: ReducerArgsAdapter): any[] { + let textType = AlgebraicType.createPrimitiveType(BuiltinType.Type.String); + let textValue = AlgebraicValue.deserialize(textType, adapter.next()) + let text = textValue.asString(); + return [text]; + } - public static on( - callback: (reducerEvent: ReducerEvent, _text: string) => void - ) { - this.getReducer().on(callback); - } - public on(callback: (reducerEvent: ReducerEvent, _text: string) => void) { - this.client.on("reducer:SendMessage", callback); - } + public static on(callback: (reducerEvent: ReducerEvent, _text: string) => void) { + this.getReducer().on(callback); + } + public on(callback: (reducerEvent: ReducerEvent, _text: string) => void) + { + this.client.on("reducer:SendMessage", callback); + } } -export default SendMessageReducer; + +export default SendMessageReducer diff --git a/examples/quickstart/client/src/module_bindings/set_name_reducer.ts b/examples/quickstart/client/src/module_bindings/set_name_reducer.ts index b1eb683..d962289 100644 --- a/examples/quickstart/client/src/module_bindings/set_name_reducer.ts +++ b/examples/quickstart/client/src/module_bindings/set_name_reducer.ts @@ -2,52 +2,37 @@ // WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD. // @ts-ignore -import { - __SPACETIMEDB__, - AlgebraicType, - ProductType, - BuiltinType, - ProductTypeElement, - DatabaseTable, - AlgebraicValue, - ReducerArgsAdapter, - SumTypeVariant, - Serializer, - Identity, - Address, - ReducerEvent, - Reducer, - SpacetimeDBClient, -} from "@clockworklabs/spacetimedb-sdk"; +import { __SPACETIMEDB__, AlgebraicType, ProductType, BuiltinType, ProductTypeElement, DatabaseTable, AlgebraicValue, ReducerArgsAdapter, SumTypeVariant, Serializer, Identity, Address, ReducerEvent, Reducer, SpacetimeDBClient } from "@clockworklabs/spacetimedb-sdk"; -export class SetNameReducer extends Reducer { - public static reducerName: string = "SetName"; - public static call(_name: string) { - this.getReducer().call(_name); - } +export class SetNameReducer extends Reducer +{ + public static reducerName: string = "SetName"; + public static call(_name: string) { + this.getReducer().call(_name); + } - public call(_name: string) { - const serializer = this.client.getSerializer(); - let _nameType = AlgebraicType.createPrimitiveType(BuiltinType.Type.String); - serializer.write(_nameType, _name); - this.client.call("set_name", serializer); - } + public call(_name: string) { + const serializer = this.client.getSerializer(); + let _nameType = AlgebraicType.createPrimitiveType(BuiltinType.Type.String); + serializer.write(_nameType, _name); + this.client.call("set_name", serializer); + } - public static deserializeArgs(adapter: ReducerArgsAdapter): any[] { - let nameType = AlgebraicType.createPrimitiveType(BuiltinType.Type.String); - let nameValue = AlgebraicValue.deserialize(nameType, adapter.next()); - let name = nameValue.asString(); - return [name]; - } + public static deserializeArgs(adapter: ReducerArgsAdapter): any[] { + let nameType = AlgebraicType.createPrimitiveType(BuiltinType.Type.String); + let nameValue = AlgebraicValue.deserialize(nameType, adapter.next()) + let name = nameValue.asString(); + return [name]; + } - public static on( - callback: (reducerEvent: ReducerEvent, _name: string) => void - ) { - this.getReducer().on(callback); - } - public on(callback: (reducerEvent: ReducerEvent, _name: string) => void) { - this.client.on("reducer:SetName", callback); - } + public static on(callback: (reducerEvent: ReducerEvent, _name: string) => void) { + this.getReducer().on(callback); + } + public on(callback: (reducerEvent: ReducerEvent, _name: string) => void) + { + this.client.on("reducer:SetName", callback); + } } -export default SetNameReducer; + +export default SetNameReducer diff --git a/examples/quickstart/client/src/module_bindings/user.ts b/examples/quickstart/client/src/module_bindings/user.ts index 2e076dd..8489cff 100644 --- a/examples/quickstart/client/src/module_bindings/user.ts +++ b/examples/quickstart/client/src/module_bindings/user.ts @@ -2,109 +2,81 @@ // WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD. // @ts-ignore -import { - __SPACETIMEDB__, - AlgebraicType, - ProductType, - BuiltinType, - ProductTypeElement, - SumType, - SumTypeVariant, - DatabaseTable, - AlgebraicValue, - ReducerEvent, - Identity, - Address, - ClientDB, - SpacetimeDBClient, -} from "@clockworklabs/spacetimedb-sdk"; +import { __SPACETIMEDB__, AlgebraicType, ProductType, BuiltinType, ProductTypeElement, SumType, SumTypeVariant, DatabaseTable, AlgebraicValue, ReducerEvent, Identity, Address, ClientDB, SpacetimeDBClient } from "@clockworklabs/spacetimedb-sdk"; -export class User extends DatabaseTable { - public static db: ClientDB = __SPACETIMEDB__.clientDB; - public static tableName = "User"; - public identity: Identity; - public name: string | null; - public online: boolean; +export class User extends DatabaseTable +{ + public static db: ClientDB = __SPACETIMEDB__.clientDB; + public static tableName = "User"; + public identity: Identity; + public name: string | null; + public online: boolean; - public static primaryKey: string | undefined = "identity"; + public static primaryKey: string | undefined = "identity"; - constructor(identity: Identity, name: string | null, online: boolean) { - super(); - this.identity = identity; - this.name = name; - this.online = online; - } + constructor(identity: Identity, name: string | null, online: boolean) { + super(); + this.identity = identity; + this.name = name; + this.online = online; + } - public static serialize(value: User): object { - return [ - Array.from(value.identity.toUint8Array()), - value.name ? { some: value.name } : { none: [] }, - value.online, - ]; - } + public static serialize(value: User): object { + return [ + Array.from(value.identity.toUint8Array()), value.name ? { "some": value.name } : { "none": [] }, value.online + ]; + } - public static getAlgebraicType(): AlgebraicType { - return AlgebraicType.createProductType([ - new ProductTypeElement( - "identity", - AlgebraicType.createProductType([ - new ProductTypeElement( - "__identity_bytes", - AlgebraicType.createArrayType( - AlgebraicType.createPrimitiveType(BuiltinType.Type.U8) - ) - ), - ]) - ), - new ProductTypeElement( - "name", - AlgebraicType.createSumType([ - new SumTypeVariant( - "some", - AlgebraicType.createPrimitiveType(BuiltinType.Type.String) - ), - new SumTypeVariant("none", AlgebraicType.createProductType([])), - ]) - ), - new ProductTypeElement( - "online", - AlgebraicType.createPrimitiveType(BuiltinType.Type.Bool) - ), - ]); - } + public static getAlgebraicType(): AlgebraicType + { + return AlgebraicType.createProductType([ + new ProductTypeElement("identity", AlgebraicType.createProductType([ + new ProductTypeElement("__identity_bytes", AlgebraicType.createArrayType(AlgebraicType.createPrimitiveType(BuiltinType.Type.U8))), + ])), + new ProductTypeElement("name", AlgebraicType.createSumType([ + new SumTypeVariant("some", AlgebraicType.createPrimitiveType(BuiltinType.Type.String)), + new SumTypeVariant("none", AlgebraicType.createProductType([ + ])), + ])), + new ProductTypeElement("online", AlgebraicType.createPrimitiveType(BuiltinType.Type.Bool)), + ]); + } - public static fromValue(value: AlgebraicValue): User { - let productValue = value.asProductValue(); - let __identity = new Identity( - productValue.elements[0].asProductValue().elements[0].asBytes() - ); - let __name = - productValue.elements[1].asSumValue().tag == 1 - ? null - : productValue.elements[1].asSumValue().value.asString(); - let __online = productValue.elements[2].asBoolean(); - return new this(__identity, __name, __online); - } + public static fromValue(value: AlgebraicValue): User + { + let productValue = value.asProductValue(); + let __identity = new Identity(productValue.elements[0].asProductValue().elements[0].asBytes()); + let __name = productValue.elements[1].asSumValue().tag == 1 ? null : productValue.elements[1].asSumValue().value.asString(); + let __online = productValue.elements[2].asBoolean(); + return new this(__identity, __name, __online); + } - public static *filterByIdentity(value: Identity): IterableIterator { - for (let instance of this.db.getTable("User").getInstances()) { - if (instance.identity.isEqual(value)) { - yield instance; - } - } - } + public static *filterByIdentity(value: Identity): IterableIterator + { + for (let instance of this.db.getTable("User").getInstances()) + { + if (instance.identity.isEqual(value)) { + yield instance; + } + } + } + + public static findByIdentity(value: Identity): User | undefined + { + return this.filterByIdentity(value).next().value; + } + + public static *filterByOnline(value: boolean): IterableIterator + { + for (let instance of this.db.getTable("User").getInstances()) + { + if (instance.online === value) { + yield instance; + } + } + } - public static findByIdentity(value: Identity): User | undefined { - return this.filterByIdentity(value).next().value; - } - public static *filterByOnline(value: boolean): IterableIterator { - for (let instance of this.db.getTable("User").getInstances()) { - if (instance.online === value) { - yield instance; - } - } - } } export default User; diff --git a/examples/quickstart/client/src/react-app-env.d.ts b/examples/quickstart/client/src/react-app-env.d.ts deleted file mode 100644 index 6431bc5..0000000 --- a/examples/quickstart/client/src/react-app-env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/examples/quickstart/client/src/reportWebVitals.ts b/examples/quickstart/client/src/reportWebVitals.ts deleted file mode 100644 index 5fa3583..0000000 --- a/examples/quickstart/client/src/reportWebVitals.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { ReportHandler } from "web-vitals"; - -const reportWebVitals = (onPerfEntry?: ReportHandler) => { - if (onPerfEntry && onPerfEntry instanceof Function) { - import("web-vitals").then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { - getCLS(onPerfEntry); - getFID(onPerfEntry); - getFCP(onPerfEntry); - getLCP(onPerfEntry); - getTTFB(onPerfEntry); - }); - } -}; - -export default reportWebVitals; diff --git a/examples/quickstart/client/src/setupTests.ts b/examples/quickstart/client/src/setupTests.ts deleted file mode 100644 index 1dd407a..0000000 --- a/examples/quickstart/client/src/setupTests.ts +++ /dev/null @@ -1,5 +0,0 @@ -// jest-dom adds custom jest matchers for asserting on DOM nodes. -// allows you to do things like: -// expect(element).toHaveTextContent(/react/i) -// learn more: https://github.com/testing-library/jest-dom -import "@testing-library/jest-dom"; diff --git a/examples/quickstart/client/src/vite-env.d.ts b/examples/quickstart/client/src/vite-env.d.ts new file mode 100644 index 0000000..11f02fe --- /dev/null +++ b/examples/quickstart/client/src/vite-env.d.ts @@ -0,0 +1 @@ +/// diff --git a/examples/quickstart/client/tsconfig.json b/examples/quickstart/client/tsconfig.json index 2d519b5..3bcc64f 100644 --- a/examples/quickstart/client/tsconfig.json +++ b/examples/quickstart/client/tsconfig.json @@ -1,20 +1,26 @@ { "compilerOptions": { - "target": "es2015", - "lib": ["dom", "dom.iterable", "esnext"], - "allowJs": true, + "composite": true, + "target": "ES2020", + "useDefineForClassFields": true, + "lib": ["ES2020", "DOM", "DOM.Iterable"], + "module": "ESNext", "skipLibCheck": true, - "esModuleInterop": true, - "allowSyntheticDefaultImports": true, - "strict": true, - "forceConsistentCasingInFileNames": true, - "noFallthroughCasesInSwitch": true, - "module": "esnext", - "moduleResolution": "node", + + /* Bundler mode */ + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, "resolveJsonModule": true, "isolatedModules": true, + "moduleDetection": "force", "noEmit": true, - "jsx": "react-jsx" + "jsx": "react-jsx", + + /* Linting */ + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noFallthroughCasesInSwitch": true }, "include": ["src"] } diff --git a/examples/quickstart/client/vite.config.ts b/examples/quickstart/client/vite.config.ts new file mode 100644 index 0000000..5a33944 --- /dev/null +++ b/examples/quickstart/client/vite.config.ts @@ -0,0 +1,7 @@ +import { defineConfig } from 'vite' +import react from '@vitejs/plugin-react' + +// https://vitejs.dev/config/ +export default defineConfig({ + plugins: [react()], +}) diff --git a/examples/quickstart/server/Cargo.lock b/examples/quickstart/server/Cargo.lock index 08c1666..4f19843 100644 --- a/examples/quickstart/server/Cargo.lock +++ b/examples/quickstart/server/Cargo.lock @@ -62,12 +62,6 @@ dependencies = [ "generic-array", ] -[[package]] -name = "bytes" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" - [[package]] name = "cfg-if" version = "1.0.0" @@ -430,7 +424,6 @@ version = "0.10.0" dependencies = [ "arrayvec", "bitflags", - "bytes", "decorum", "derive_more", "enum-as-inner", diff --git a/packages/sdk/src/websocket_decompress_adapter.ts b/packages/sdk/src/websocket_decompress_adapter.ts index f67d5ce..54dc2d7 100644 --- a/packages/sdk/src/websocket_decompress_adapter.ts +++ b/packages/sdk/src/websocket_decompress_adapter.ts @@ -76,6 +76,7 @@ export class WebsocketDecompressAdapter { if (typeof window === "undefined" || !params.auth_token) { // NodeJS environment const ws = new WebSocket(url, protocol, { + // @ts-ignore maxReceivedFrameSize: 100000000, maxReceivedMessageSize: 100000000, headers, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5641392..27f429d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -66,6 +66,34 @@ importers: specifier: ^2.1.4 version: 2.1.4 + examples/quickstart/client-vite: + dependencies: + '@clockworklabs/spacetimedb-sdk': + specifier: workspace:* + version: link:../../../packages/sdk + react: + specifier: ^18.3.1 + version: 18.3.1 + react-dom: + specifier: ^18.3.1 + version: 18.3.1(react@18.3.1) + devDependencies: + '@types/react': + specifier: ^18.3.3 + version: 18.3.3 + '@types/react-dom': + specifier: ^18.3.0 + version: 18.3.0 + '@vitejs/plugin-react': + specifier: ^4.3.1 + version: 4.3.1(vite@5.3.4(terser@5.31.2)) + typescript: + specifier: ^5.2.2 + version: 5.5.3 + vite: + specifier: ^5.3.4 + version: 5.3.4(terser@5.31.2) + packages/sdk: dependencies: brotli: @@ -704,6 +732,18 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 + '@babel/plugin-transform-react-jsx-self@7.24.7': + resolution: {integrity: sha512-fOPQYbGSgH0HUp4UJO4sMBFjY6DuWq+2i8rixyUMb3CdGixs/gccURvYOAhajBdKDoGajFr3mUq5rH3phtkGzw==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-react-jsx-source@7.24.7': + resolution: {integrity: sha512-J2z+MWzZHVOemyLweMqngXrgGC42jQ//R0KdxqkIz/OrbVIIlhFI3WigZ5fO+nwFvBlncr4MGapd8vTyc7RPNQ==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + '@babel/plugin-transform-react-jsx@7.24.7': resolution: {integrity: sha512-+Dj06GDZEFRYvclU6k4bme55GKBEWUmByM/eoKuqg4zTNQHiApWRhQph5fxQB2wAEFvRzL1tOEj1RJ19wJrhoA==} engines: {node: '>=6.9.0'} @@ -1683,6 +1723,12 @@ packages: '@ungap/structured-clone@1.2.0': resolution: {integrity: sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==} + '@vitejs/plugin-react@4.3.1': + resolution: {integrity: sha512-m/V2syj5CuVnaxcUJOQRel/Wr31FFXRFlnOoq1TVtkCxsY5veGMTEmpWHndrhB2U8ScHtCQB1e+4hWYExQc6Lg==} + engines: {node: ^14.18.0 || >=16.0.0} + peerDependencies: + vite: ^4.2.0 || ^5.0.0 + '@vitest/expect@2.0.3': resolution: {integrity: sha512-X6AepoOYePM0lDNUPsGXTxgXZAl3EXd0GYe/MZyVE4HzkUqyUVC6S3PrY5mClDJ6/7/7vALLMV3+xD/Ko60Hqg==} @@ -4919,6 +4965,10 @@ packages: resolution: {integrity: sha512-F27qZr8uUqwhWZboondsPx8tnC3Ct3SxZA3V5WyEvujRyyNv0VYPhoBg1gZ8/MV5tubQp76Trw8lTv9hzRBa+A==} engines: {node: '>=0.10.0'} + react-refresh@0.14.2: + resolution: {integrity: sha512-jCvmsr+1IUSMUyzOkRcvnVbX3ZYC6g9TDrDbFuFmRDq7PD4yaGbLKNQL6k2jnArV8hjYxh7hVhAZB6s9HDGpZA==} + engines: {node: '>=0.10.0'} + react-scripts@5.0.1: resolution: {integrity: sha512-8VAmEm/ZAwQzJ+GOMLbBsTdDKOpuZh7RPs0UymvBR2vRk4iZWCskjbFnxqjrzoIvlNNRZ3QJFx6/qDSi6zSnaQ==} engines: {node: '>=14.0.0'} @@ -6780,6 +6830,16 @@ snapshots: transitivePeerDependencies: - supports-color + '@babel/plugin-transform-react-jsx-self@7.24.7(@babel/core@7.24.9)': + dependencies: + '@babel/core': 7.24.9 + '@babel/helper-plugin-utils': 7.24.8 + + '@babel/plugin-transform-react-jsx-source@7.24.7(@babel/core@7.24.9)': + dependencies: + '@babel/core': 7.24.9 + '@babel/helper-plugin-utils': 7.24.8 + '@babel/plugin-transform-react-jsx@7.24.7(@babel/core@7.24.9)': dependencies: '@babel/core': 7.24.9 @@ -7959,6 +8019,17 @@ snapshots: '@ungap/structured-clone@1.2.0': {} + '@vitejs/plugin-react@4.3.1(vite@5.3.4(terser@5.31.2))': + dependencies: + '@babel/core': 7.24.9 + '@babel/plugin-transform-react-jsx-self': 7.24.7(@babel/core@7.24.9) + '@babel/plugin-transform-react-jsx-source': 7.24.7(@babel/core@7.24.9) + '@types/babel__core': 7.20.5 + react-refresh: 0.14.2 + vite: 5.3.4(terser@5.31.2) + transitivePeerDependencies: + - supports-color + '@vitest/expect@2.0.3': dependencies: '@vitest/spy': 2.0.3 @@ -11760,6 +11831,8 @@ snapshots: react-refresh@0.11.0: {} + react-refresh@0.14.2: {} + react-scripts@5.0.1(@babel/plugin-syntax-flow@7.24.7(@babel/core@7.24.9))(@babel/plugin-transform-react-jsx@7.24.7(@babel/core@7.24.9))(@types/babel__core@7.20.5)(bufferutil@4.0.8)(esbuild@0.21.5)(eslint@8.57.0)(react@18.3.1)(type-fest@0.21.3)(typescript@4.9.5)(utf-8-validate@5.0.10): dependencies: '@babel/core': 7.24.9