diff --git a/app/backend/src/controllers/DynamicController.hpp b/app/backend/src/controllers/DynamicController.hpp index 7525a505..cb6afd89 100644 --- a/app/backend/src/controllers/DynamicController.hpp +++ b/app/backend/src/controllers/DynamicController.hpp @@ -5,18 +5,14 @@ class DynamicController : public drogon::HttpController { public: METHOD_LIST_BEGIN - ADD_METHOD_TO(DynamicController::load, "/room/{1}", drogon::Get); + ADD_METHOD_TO(DynamicController::loadIndex, "/", drogon::Get); METHOD_LIST_END - void load(const drogon::HttpRequestPtr& req, - std::function&& callback, - std::string&& room_name); + void loadIndex(const drogon::HttpRequestPtr& req, + std::function&& callback); }; -void DynamicController::load(const drogon::HttpRequestPtr& req, - std::function&& callback, - std::string&& arg1) +void DynamicController::loadIndex(const drogon::HttpRequestPtr& req, + std::function&& callback) { - - // The 'room' page is dynamically generated locally, so we don't have a specific file to serve. - callback(drogon::HttpResponse::newFileResponse(drogon::app().getDocumentRoot() + "/dynamic.html")); + callback(drogon::HttpResponse::newFileResponse(drogon::app().getDocumentRoot() + "/index.html")); } \ No newline at end of file diff --git a/app/backend/src/main.cpp b/app/backend/src/main.cpp index ff580748..04d58f3f 100644 --- a/app/backend/src/main.cpp +++ b/app/backend/src/main.cpp @@ -18,7 +18,7 @@ int main() spdlog::set_level(spdlog::level::debug); auto config_json_path = boost::dll::program_location().parent_path() / "settings" / "config.json"; drogon::app().loadConfigFile(config_json_path.string()); - + drogon::app().setCustom404Page(drogon::HttpResponse::newFileResponse(drogon::app().getDocumentRoot() + "/404.html")); std::vector> ip_addresses = { {"0.0.0.0", 8848}, {"127.0.0.1", 8848}, diff --git a/app/backend/xmake.lua b/app/backend/xmake.lua index a61bd34f..6a7e0d0f 100644 --- a/app/backend/xmake.lua +++ b/app/backend/xmake.lua @@ -52,7 +52,7 @@ target("backend") os.execv("pnpm", {"--prefix", frontend_dir, "run", "build"}) print("Copying svelte files...") - os.cp(path.join(os.scriptdir(), "..", "frontend", "build"), static) + os.cp(path.join(os.scriptdir(), "..", "frontend", "dist"), static) print("Completed copying svelte files...") end) diff --git a/app/frontend/.gitignore b/app/frontend/.gitignore index 6635cf55..e519517a 100644 --- a/app/frontend/.gitignore +++ b/app/frontend/.gitignore @@ -1,10 +1,26 @@ -.DS_Store +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + node_modules -/build -/.svelte-kit -/package -.env -.env.* -!.env.example -vite.config.js.timestamp-* -vite.config.ts.timestamp-* +dist +dist-ssr +*.local + +# Editor directories and files +.vscode/* +!.vscode/extensions.json +.idea +.DS_Store +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? + +.svelte-kit \ No newline at end of file diff --git a/app/frontend/.npmrc b/app/frontend/.npmrc deleted file mode 100644 index b6f27f13..00000000 --- a/app/frontend/.npmrc +++ /dev/null @@ -1 +0,0 @@ -engine-strict=true diff --git a/app/frontend/.vscode/extensions.json b/app/frontend/.vscode/extensions.json new file mode 100644 index 00000000..bdef8201 --- /dev/null +++ b/app/frontend/.vscode/extensions.json @@ -0,0 +1,3 @@ +{ + "recommendations": ["svelte.svelte-vscode"] +} diff --git a/app/frontend/README.md b/app/frontend/README.md index 5c91169b..656663d2 100644 --- a/app/frontend/README.md +++ b/app/frontend/README.md @@ -1,38 +1,53 @@ -# create-svelte + + + + +
+ + +

Svelte 3 Up and Running

+

Want to learn Svelte 3 and how to build a Single-Page App (SPA) with it (and with this router)? Check out my book Svelte 3 Up and Running on Amazon.

+
-Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/master/packages/create-svelte). +# Svelte app with svelte-spa-router -## Creating a project +This is a project template for [Svelte 4](https://svelte.dev) apps that includes [svelte-spa-router](https://github.com/italypaleale/svelte-spa-router) for client-side routing, TypeScript, and Vite as bundler. -If you're seeing this, you've probably already done this step. Congrats! +## About svelte-spa-router -```bash -# create a new project in the current directory -npm create svelte@latest +svelte-spa-router is a client-side router for Svelte 4 apps that leverages hash-based routing (i.e. stores the current view in the URL after the `#` symbol). -# create a new project in my-app -npm create svelte@latest my-app -``` +You can read more about the router, and the reasons why you might want to use hash-based routing (or not), in the [documentation](https://github.com/italypaleale/svelte-spa-router). -## Developing +## Get started -Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server: +Install the dependencies… ```bash -npm run dev +cd svelte-app +npm install +``` + +…then start a dev server using [Vite](https://vite.dev): -# or start the server and open the app in a new browser tab -npm run dev -- --open +```bash +npm run dev ``` -## Building +Navigate to [http://localhost:5050](http://localhost:5050). You should see your app running. Edit a component file in `src`, save it, and reload the page to see your changes. + +You can add more routes by defining them in the [`src/routes.ts`](./src/routes.ts) file. More information can be found on the [documentation for svelte-spa-router](https://github.com/ItalyPaleAle/svelte-spa-router/blob/main/README.md). + +By default, the server will only respond to requests from localhost. To allow connections from other computers, edit the `vite` commands in package.json to include the option `--host 0.0.0.0`. -To create a production version of your app: +If you're using [Visual Studio Code](https://code.visualstudio.com/) we recommend installing the official extension [Svelte for VS Code](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode). If you are using other editors you may need to install a plugin in order to get syntax highlighting and intellisense. + +## Building and running in production mode + +To create an optimized version of the app: ```bash npm run build ``` -You can preview the production build with `npm run preview`. - -> To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment. +You can run the newly-built app with `npm run preview`. diff --git a/app/frontend/index.html b/app/frontend/index.html new file mode 100644 index 00000000..973cb2af --- /dev/null +++ b/app/frontend/index.html @@ -0,0 +1,13 @@ + + + + + + + Svelte 4 + svelte-spa-router + TypeScript + + +
+ + + diff --git a/app/frontend/package.json b/app/frontend/package.json index e539fa05..59a8553b 100644 --- a/app/frontend/package.json +++ b/app/frontend/package.json @@ -1,26 +1,24 @@ { - "name": "frontend", - "version": "0.0.1", - "private": true, - "scripts": { - "dev": "vite dev", - "build": "vite build", - "preview": "vite preview", - "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", - "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch" - }, - "devDependencies": { - "@sveltejs/adapter-auto": "^2.1.1", - "@sveltejs/adapter-static": "^2.0.3", - "@sveltejs/kit": "^1.27.7", - "@types/node": "^20.10.4", - "@types/ws": "^8.5.10", - "svelte": "^4.2.8", - "svelte-check": "^3.6.2", - "tslib": "^2.6.2", - "typescript": "^5.3.3", - "vite": "^4.5.1", - "ws": "^8.14.2" - }, - "type": "module" + "name": "frontend", + "private": true, + "version": "0.0.0", + "type": "module", + "scripts": { + "dev": "vite --port 5050", + "build": "vite build", + "preview": "vite preview --port 5050", + "check": "svelte-check --tsconfig ./tsconfig.json" + }, + "devDependencies": { + "@sveltejs/vite-plugin-svelte": "^3.0.0", + "@tsconfig/svelte": "^5.0.2", + "svelte": "^4.2.3", + "svelte-check": "^3.6.0", + "tslib": "^2.6.2", + "typescript": "^5.2.2", + "vite": "^5.0.0" + }, + "dependencies": { + "svelte-spa-router": "^4.0.0" + } } diff --git a/app/frontend/pnpm-lock.yaml b/app/frontend/pnpm-lock.yaml index 5acfa8c2..5c1eae75 100644 --- a/app/frontend/pnpm-lock.yaml +++ b/app/frontend/pnpm-lock.yaml @@ -4,40 +4,33 @@ settings: autoInstallPeers: true excludeLinksFromLockfile: false +dependencies: + svelte-spa-router: + specifier: ^4.0.0 + version: 4.0.0 + devDependencies: - '@sveltejs/adapter-auto': - specifier: ^2.1.1 - version: 2.1.1(@sveltejs/kit@1.27.7) - '@sveltejs/adapter-static': - specifier: ^2.0.3 - version: 2.0.3(@sveltejs/kit@1.27.7) - '@sveltejs/kit': - specifier: ^1.27.7 - version: 1.27.7(svelte@4.2.8)(vite@4.5.1) - '@types/node': - specifier: ^20.10.4 - version: 20.10.4 - '@types/ws': - specifier: ^8.5.10 - version: 8.5.10 + '@sveltejs/vite-plugin-svelte': + specifier: ^3.0.0 + version: 3.0.1(svelte@4.2.8)(vite@5.0.8) + '@tsconfig/svelte': + specifier: ^5.0.2 + version: 5.0.2 svelte: - specifier: ^4.2.8 + specifier: ^4.2.3 version: 4.2.8 svelte-check: - specifier: ^3.6.2 + specifier: ^3.6.0 version: 3.6.2(svelte@4.2.8) tslib: specifier: ^2.6.2 version: 2.6.2 typescript: - specifier: ^5.3.3 + specifier: ^5.2.2 version: 5.3.3 vite: - specifier: ^4.5.1 - version: 4.5.1(@types/node@20.10.4) - ws: - specifier: ^8.14.2 - version: 8.14.2 + specifier: ^5.0.0 + version: 5.0.8 packages: @@ -49,8 +42,8 @@ packages: '@jridgewell/trace-mapping': 0.3.20 dev: true - /@esbuild/android-arm64@0.18.20: - resolution: {integrity: sha512-Nz4rJcchGDtENV0eMKUNa6L12zz2zBDXuhj/Vjh18zGqB44Bi7MBMSXjgunJgjRhCmKOjnPuZp4Mb6OKqtMHLQ==} + /@esbuild/android-arm64@0.19.9: + resolution: {integrity: sha512-q4cR+6ZD0938R19MyEW3jEsMzbb/1rulLXiNAJQADD/XYp7pT+rOS5JGxvpRW8dFDEfjW4wLgC/3FXIw4zYglQ==} engines: {node: '>=12'} cpu: [arm64] os: [android] @@ -58,8 +51,8 @@ packages: dev: true optional: true - /@esbuild/android-arm@0.18.20: - resolution: {integrity: sha512-fyi7TDI/ijKKNZTUJAQqiG5T7YjJXgnzkURqmGj13C6dCqckZBLdl4h7bkhHt/t0WP+zO9/zwroDvANaOqO5Sw==} + /@esbuild/android-arm@0.19.9: + resolution: {integrity: sha512-jkYjjq7SdsWuNI6b5quymW0oC83NN5FdRPuCbs9HZ02mfVdAP8B8eeqLSYU3gb6OJEaY5CQabtTFbqBf26H3GA==} engines: {node: '>=12'} cpu: [arm] os: [android] @@ -67,8 +60,8 @@ packages: dev: true optional: true - /@esbuild/android-x64@0.18.20: - resolution: {integrity: sha512-8GDdlePJA8D6zlZYJV/jnrRAi6rOiNaCC/JclcXpB+KIuvfBN4owLtgzY2bsxnx666XjJx2kDPUmnTtR8qKQUg==} + /@esbuild/android-x64@0.19.9: + resolution: {integrity: sha512-KOqoPntWAH6ZxDwx1D6mRntIgZh9KodzgNOy5Ebt9ghzffOk9X2c1sPwtM9P+0eXbefnDhqYfkh5PLP5ULtWFA==} engines: {node: '>=12'} cpu: [x64] os: [android] @@ -76,8 +69,8 @@ packages: dev: true optional: true - /@esbuild/darwin-arm64@0.18.20: - resolution: {integrity: sha512-bxRHW5kHU38zS2lPTPOyuyTm+S+eobPUnTNkdJEfAddYgEcll4xkT8DB9d2008DtTbl7uJag2HuE5NZAZgnNEA==} + /@esbuild/darwin-arm64@0.19.9: + resolution: {integrity: sha512-KBJ9S0AFyLVx2E5D8W0vExqRW01WqRtczUZ8NRu+Pi+87opZn5tL4Y0xT0mA4FtHctd0ZgwNoN639fUUGlNIWw==} engines: {node: '>=12'} cpu: [arm64] os: [darwin] @@ -85,8 +78,8 @@ packages: dev: true optional: true - /@esbuild/darwin-x64@0.18.20: - resolution: {integrity: sha512-pc5gxlMDxzm513qPGbCbDukOdsGtKhfxD1zJKXjCCcU7ju50O7MeAZ8c4krSJcOIJGFR+qx21yMMVYwiQvyTyQ==} + /@esbuild/darwin-x64@0.19.9: + resolution: {integrity: sha512-vE0VotmNTQaTdX0Q9dOHmMTao6ObjyPm58CHZr1UK7qpNleQyxlFlNCaHsHx6Uqv86VgPmR4o2wdNq3dP1qyDQ==} engines: {node: '>=12'} cpu: [x64] os: [darwin] @@ -94,8 +87,8 @@ packages: dev: true optional: true - /@esbuild/freebsd-arm64@0.18.20: - resolution: {integrity: sha512-yqDQHy4QHevpMAaxhhIwYPMv1NECwOvIpGCZkECn8w2WFHXjEwrBn3CeNIYsibZ/iZEUemj++M26W3cNR5h+Tw==} + /@esbuild/freebsd-arm64@0.19.9: + resolution: {integrity: sha512-uFQyd/o1IjiEk3rUHSwUKkqZwqdvuD8GevWF065eqgYfexcVkxh+IJgwTaGZVu59XczZGcN/YMh9uF1fWD8j1g==} engines: {node: '>=12'} cpu: [arm64] os: [freebsd] @@ -103,8 +96,8 @@ packages: dev: true optional: true - /@esbuild/freebsd-x64@0.18.20: - resolution: {integrity: sha512-tgWRPPuQsd3RmBZwarGVHZQvtzfEBOreNuxEMKFcd5DaDn2PbBxfwLcj4+aenoh7ctXcbXmOQIn8HI6mCSw5MQ==} + /@esbuild/freebsd-x64@0.19.9: + resolution: {integrity: sha512-WMLgWAtkdTbTu1AWacY7uoj/YtHthgqrqhf1OaEWnZb7PQgpt8eaA/F3LkV0E6K/Lc0cUr/uaVP/49iE4M4asA==} engines: {node: '>=12'} cpu: [x64] os: [freebsd] @@ -112,8 +105,8 @@ packages: dev: true optional: true - /@esbuild/linux-arm64@0.18.20: - resolution: {integrity: sha512-2YbscF+UL7SQAVIpnWvYwM+3LskyDmPhe31pE7/aoTMFKKzIc9lLbyGUpmmb8a8AixOL61sQ/mFh3jEjHYFvdA==} + /@esbuild/linux-arm64@0.19.9: + resolution: {integrity: sha512-PiPblfe1BjK7WDAKR1Cr9O7VVPqVNpwFcPWgfn4xu0eMemzRp442hXyzF/fSwgrufI66FpHOEJk0yYdPInsmyQ==} engines: {node: '>=12'} cpu: [arm64] os: [linux] @@ -121,8 +114,8 @@ packages: dev: true optional: true - /@esbuild/linux-arm@0.18.20: - resolution: {integrity: sha512-/5bHkMWnq1EgKr1V+Ybz3s1hWXok7mDFUMQ4cG10AfW3wL02PSZi5kFpYKrptDsgb2WAJIvRcDm+qIvXf/apvg==} + /@esbuild/linux-arm@0.19.9: + resolution: {integrity: sha512-C/ChPohUYoyUaqn1h17m/6yt6OB14hbXvT8EgM1ZWaiiTYz7nWZR0SYmMnB5BzQA4GXl3BgBO1l8MYqL/He3qw==} engines: {node: '>=12'} cpu: [arm] os: [linux] @@ -130,8 +123,8 @@ packages: dev: true optional: true - /@esbuild/linux-ia32@0.18.20: - resolution: {integrity: sha512-P4etWwq6IsReT0E1KHU40bOnzMHoH73aXp96Fs8TIT6z9Hu8G6+0SHSw9i2isWrD2nbx2qo5yUqACgdfVGx7TA==} + /@esbuild/linux-ia32@0.19.9: + resolution: {integrity: sha512-f37i/0zE0MjDxijkPSQw1CO/7C27Eojqb+r3BbHVxMLkj8GCa78TrBZzvPyA/FNLUMzP3eyHCVkAopkKVja+6Q==} engines: {node: '>=12'} cpu: [ia32] os: [linux] @@ -139,8 +132,8 @@ packages: dev: true optional: true - /@esbuild/linux-loong64@0.18.20: - resolution: {integrity: sha512-nXW8nqBTrOpDLPgPY9uV+/1DjxoQ7DoB2N8eocyq8I9XuqJ7BiAMDMf9n1xZM9TgW0J8zrquIb/A7s3BJv7rjg==} + /@esbuild/linux-loong64@0.19.9: + resolution: {integrity: sha512-t6mN147pUIf3t6wUt3FeumoOTPfmv9Cc6DQlsVBpB7eCpLOqQDyWBP1ymXn1lDw4fNUSb/gBcKAmvTP49oIkaA==} engines: {node: '>=12'} cpu: [loong64] os: [linux] @@ -148,8 +141,8 @@ packages: dev: true optional: true - /@esbuild/linux-mips64el@0.18.20: - resolution: {integrity: sha512-d5NeaXZcHp8PzYy5VnXV3VSd2D328Zb+9dEq5HE6bw6+N86JVPExrA6O68OPwobntbNJ0pzCpUFZTo3w0GyetQ==} + /@esbuild/linux-mips64el@0.19.9: + resolution: {integrity: sha512-jg9fujJTNTQBuDXdmAg1eeJUL4Jds7BklOTkkH80ZgQIoCTdQrDaHYgbFZyeTq8zbY+axgptncko3v9p5hLZtw==} engines: {node: '>=12'} cpu: [mips64el] os: [linux] @@ -157,8 +150,8 @@ packages: dev: true optional: true - /@esbuild/linux-ppc64@0.18.20: - resolution: {integrity: sha512-WHPyeScRNcmANnLQkq6AfyXRFr5D6N2sKgkFo2FqguP44Nw2eyDlbTdZwd9GYk98DZG9QItIiTlFLHJHjxP3FA==} + /@esbuild/linux-ppc64@0.19.9: + resolution: {integrity: sha512-tkV0xUX0pUUgY4ha7z5BbDS85uI7ABw3V1d0RNTii7E9lbmV8Z37Pup2tsLV46SQWzjOeyDi1Q7Wx2+QM8WaCQ==} engines: {node: '>=12'} cpu: [ppc64] os: [linux] @@ -166,8 +159,8 @@ packages: dev: true optional: true - /@esbuild/linux-riscv64@0.18.20: - resolution: {integrity: sha512-WSxo6h5ecI5XH34KC7w5veNnKkju3zBRLEQNY7mv5mtBmrP/MjNBCAlsM2u5hDBlS3NGcTQpoBvRzqBcRtpq1A==} + /@esbuild/linux-riscv64@0.19.9: + resolution: {integrity: sha512-DfLp8dj91cufgPZDXr9p3FoR++m3ZJ6uIXsXrIvJdOjXVREtXuQCjfMfvmc3LScAVmLjcfloyVtpn43D56JFHg==} engines: {node: '>=12'} cpu: [riscv64] os: [linux] @@ -175,8 +168,8 @@ packages: dev: true optional: true - /@esbuild/linux-s390x@0.18.20: - resolution: {integrity: sha512-+8231GMs3mAEth6Ja1iK0a1sQ3ohfcpzpRLH8uuc5/KVDFneH6jtAJLFGafpzpMRO6DzJ6AvXKze9LfFMrIHVQ==} + /@esbuild/linux-s390x@0.19.9: + resolution: {integrity: sha512-zHbglfEdC88KMgCWpOl/zc6dDYJvWGLiUtmPRsr1OgCViu3z5GncvNVdf+6/56O2Ca8jUU+t1BW261V6kp8qdw==} engines: {node: '>=12'} cpu: [s390x] os: [linux] @@ -184,8 +177,8 @@ packages: dev: true optional: true - /@esbuild/linux-x64@0.18.20: - resolution: {integrity: sha512-UYqiqemphJcNsFEskc73jQ7B9jgwjWrSayxawS6UVFZGWrAAtkzjxSqnoclCXxWtfwLdzU+vTpcNYhpn43uP1w==} + /@esbuild/linux-x64@0.19.9: + resolution: {integrity: sha512-JUjpystGFFmNrEHQnIVG8hKwvA2DN5o7RqiO1CVX8EN/F/gkCjkUMgVn6hzScpwnJtl2mPR6I9XV1oW8k9O+0A==} engines: {node: '>=12'} cpu: [x64] os: [linux] @@ -193,8 +186,8 @@ packages: dev: true optional: true - /@esbuild/netbsd-x64@0.18.20: - resolution: {integrity: sha512-iO1c++VP6xUBUmltHZoMtCUdPlnPGdBom6IrO4gyKPFFVBKioIImVooR5I83nTew5UOYrk3gIJhbZh8X44y06A==} + /@esbuild/netbsd-x64@0.19.9: + resolution: {integrity: sha512-GThgZPAwOBOsheA2RUlW5UeroRfESwMq/guy8uEe3wJlAOjpOXuSevLRd70NZ37ZrpO6RHGHgEHvPg1h3S1Jug==} engines: {node: '>=12'} cpu: [x64] os: [netbsd] @@ -202,8 +195,8 @@ packages: dev: true optional: true - /@esbuild/openbsd-x64@0.18.20: - resolution: {integrity: sha512-e5e4YSsuQfX4cxcygw/UCPIEP6wbIL+se3sxPdCiMbFLBWu0eiZOJ7WoD+ptCLrmjZBK1Wk7I6D/I3NglUGOxg==} + /@esbuild/openbsd-x64@0.19.9: + resolution: {integrity: sha512-Ki6PlzppaFVbLnD8PtlVQfsYw4S9n3eQl87cqgeIw+O3sRr9IghpfSKY62mggdt1yCSZ8QWvTZ9jo9fjDSg9uw==} engines: {node: '>=12'} cpu: [x64] os: [openbsd] @@ -211,8 +204,8 @@ packages: dev: true optional: true - /@esbuild/sunos-x64@0.18.20: - resolution: {integrity: sha512-kDbFRFp0YpTQVVrqUd5FTYmWo45zGaXe0X8E1G/LKFC0v8x0vWrhOWSLITcCn63lmZIxfOMXtCfti/RxN/0wnQ==} + /@esbuild/sunos-x64@0.19.9: + resolution: {integrity: sha512-MLHj7k9hWh4y1ddkBpvRj2b9NCBhfgBt3VpWbHQnXRedVun/hC7sIyTGDGTfsGuXo4ebik2+3ShjcPbhtFwWDw==} engines: {node: '>=12'} cpu: [x64] os: [sunos] @@ -220,8 +213,8 @@ packages: dev: true optional: true - /@esbuild/win32-arm64@0.18.20: - resolution: {integrity: sha512-ddYFR6ItYgoaq4v4JmQQaAI5s7npztfV4Ag6NrhiaW0RrnOXqBkgwZLofVTlq1daVTQNhtI5oieTvkRPfZrePg==} + /@esbuild/win32-arm64@0.19.9: + resolution: {integrity: sha512-GQoa6OrQ8G08guMFgeXPH7yE/8Dt0IfOGWJSfSH4uafwdC7rWwrfE6P9N8AtPGIjUzdo2+7bN8Xo3qC578olhg==} engines: {node: '>=12'} cpu: [arm64] os: [win32] @@ -229,8 +222,8 @@ packages: dev: true optional: true - /@esbuild/win32-ia32@0.18.20: - resolution: {integrity: sha512-Wv7QBi3ID/rROT08SABTS7eV4hX26sVduqDOTe1MvGMjNd3EjOz4b7zeexIR62GTIEKrfJXKL9LFxTYgkyeu7g==} + /@esbuild/win32-ia32@0.19.9: + resolution: {integrity: sha512-UOozV7Ntykvr5tSOlGCrqU3NBr3d8JqPes0QWN2WOXfvkWVGRajC+Ym0/Wj88fUgecUCLDdJPDF0Nna2UK3Qtg==} engines: {node: '>=12'} cpu: [ia32] os: [win32] @@ -238,8 +231,8 @@ packages: dev: true optional: true - /@esbuild/win32-x64@0.18.20: - resolution: {integrity: sha512-kTdfRcSiDfQca/y9QIkng02avJ+NCaQvrMejlsB3RRv5sE9rRoeBPISaZpKxHELzRxZyLvNts1P27W3wV+8geQ==} + /@esbuild/win32-x64@0.19.9: + resolution: {integrity: sha512-oxoQgglOP7RH6iasDrhY+R/3cHrfwIDvRlT4CGChflq6twk8iENeVvMJjmvBb94Ik1Z+93iGO27err7w6l54GQ==} engines: {node: '>=12'} cpu: [x64] os: [win32] @@ -247,11 +240,6 @@ packages: dev: true optional: true - /@fastify/busboy@2.1.0: - resolution: {integrity: sha512-+KpH+QxZU7O4675t3mnkQKcZZg56u+K/Ct2K+N2AZYNVK8kyeo/bI18tI8aPm3tvNNRyTWfj6s5tnGNlcbQRsA==} - engines: {node: '>=14'} - dev: true - /@jridgewell/gen-mapping@0.3.3: resolution: {integrity: sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==} engines: {node: '>=6.0.0'} @@ -303,115 +291,158 @@ packages: fastq: 1.15.0 dev: true - /@polka/url@1.0.0-next.24: - resolution: {integrity: sha512-2LuNTFBIO0m7kKIQvvPHN6UE63VjpmL9rnEEaOOaiSPbZK+zUOYIzBAWcED+3XYzhYsd/0mD57VdxAEqqV52CQ==} + /@rollup/rollup-android-arm-eabi@4.8.0: + resolution: {integrity: sha512-zdTObFRoNENrdPpnTNnhOljYIcOX7aI7+7wyrSpPFFIOf/nRdedE6IYsjaBE7tjukphh1tMTojgJ7p3lKY8x6Q==} + cpu: [arm] + os: [android] + requiresBuild: true dev: true + optional: true - /@sveltejs/adapter-auto@2.1.1(@sveltejs/kit@1.27.7): - resolution: {integrity: sha512-nzi6x/7/3Axh5VKQ8Eed3pYxastxoa06Y/bFhWb7h3Nu+nGRVxKAy3+hBJgmPCwWScy8n0TsstZjSVKfyrIHkg==} - peerDependencies: - '@sveltejs/kit': ^1.0.0 - dependencies: - '@sveltejs/kit': 1.27.7(svelte@4.2.8)(vite@4.5.1) - import-meta-resolve: 4.0.0 + /@rollup/rollup-android-arm64@4.8.0: + resolution: {integrity: sha512-aiItwP48BiGpMFS9Znjo/xCNQVwTQVcRKkFKsO81m8exrGjHkCBDvm9PHay2kpa8RPnZzzKcD1iQ9KaLY4fPQQ==} + cpu: [arm64] + os: [android] + requiresBuild: true dev: true + optional: true - /@sveltejs/adapter-static@2.0.3(@sveltejs/kit@1.27.7): - resolution: {integrity: sha512-VUqTfXsxYGugCpMqQv1U0LIdbR3S5nBkMMDmpjGVJyM6Q2jHVMFtdWJCkeHMySc6mZxJ+0eZK3T7IgmUCDrcUQ==} - peerDependencies: - '@sveltejs/kit': ^1.5.0 - dependencies: - '@sveltejs/kit': 1.27.7(svelte@4.2.8)(vite@4.5.1) + /@rollup/rollup-darwin-arm64@4.8.0: + resolution: {integrity: sha512-zhNIS+L4ZYkYQUjIQUR6Zl0RXhbbA0huvNIWjmPc2SL0cB1h5Djkcy+RZ3/Bwszfb6vgwUvcVJYD6e6Zkpsi8g==} + cpu: [arm64] + os: [darwin] + requiresBuild: true dev: true + optional: true - /@sveltejs/kit@1.27.7(svelte@4.2.8)(vite@4.5.1): - resolution: {integrity: sha512-AzXYDoYt42clCBwLF9GTHsXyg2DFR31Ncyt8yxu8Aw4tgB433V+w+hcr1RTfAN9zKW2J2PY9FMQ8FoX/4Vw8CA==} - engines: {node: ^16.14 || >=18} - hasBin: true + /@rollup/rollup-darwin-x64@4.8.0: + resolution: {integrity: sha512-A/FAHFRNQYrELrb/JHncRWzTTXB2ticiRFztP4ggIUAfa9Up1qfW8aG2w/mN9jNiZ+HB0t0u0jpJgFXG6BfRTA==} + cpu: [x64] + os: [darwin] requiresBuild: true - peerDependencies: - svelte: ^3.54.0 || ^4.0.0-next.0 || ^5.0.0-next.0 - vite: ^4.0.0 - dependencies: - '@sveltejs/vite-plugin-svelte': 2.5.3(svelte@4.2.8)(vite@4.5.1) - '@types/cookie': 0.5.4 - cookie: 0.5.0 - devalue: 4.3.2 - esm-env: 1.0.0 - kleur: 4.1.5 - magic-string: 0.30.5 - mrmime: 1.0.1 - sade: 1.8.1 - set-cookie-parser: 2.6.0 - sirv: 2.0.3 - svelte: 4.2.8 - tiny-glob: 0.2.9 - undici: 5.26.5 - vite: 4.5.1(@types/node@20.10.4) - transitivePeerDependencies: - - supports-color dev: true + optional: true - /@sveltejs/vite-plugin-svelte-inspector@1.0.4(@sveltejs/vite-plugin-svelte@2.5.3)(svelte@4.2.8)(vite@4.5.1): - resolution: {integrity: sha512-zjiuZ3yydBtwpF3bj0kQNV0YXe+iKE545QGZVTaylW3eAzFr+pJ/cwK8lZEaRp4JtaJXhD5DyWAV4AxLh6DgaQ==} - engines: {node: ^14.18.0 || >= 16} + /@rollup/rollup-linux-arm-gnueabihf@4.8.0: + resolution: {integrity: sha512-JsidBnh3p2IJJA4/2xOF2puAYqbaczB3elZDT0qHxn362EIoIkq7hrR43Xa8RisgI6/WPfvb2umbGsuvf7E37A==} + cpu: [arm] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-linux-arm64-gnu@4.8.0: + resolution: {integrity: sha512-hBNCnqw3EVCkaPB0Oqd24bv8SklETptQWcJz06kb9OtiShn9jK1VuTgi7o4zPSt6rNGWQOTDEAccbk0OqJmS+g==} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-linux-arm64-musl@4.8.0: + resolution: {integrity: sha512-Fw9ChYfJPdltvi9ALJ9wzdCdxGw4wtq4t1qY028b2O7GwB5qLNSGtqMsAel1lfWTZvf4b6/+4HKp0GlSYg0ahA==} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-linux-riscv64-gnu@4.8.0: + resolution: {integrity: sha512-BH5xIh7tOzS9yBi8dFrCTG8Z6iNIGWGltd3IpTSKp6+pNWWO6qy8eKoRxOtwFbMrid5NZaidLYN6rHh9aB8bEw==} + cpu: [riscv64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-linux-x64-gnu@4.8.0: + resolution: {integrity: sha512-PmvAj8k6EuWiyLbkNpd6BLv5XeYFpqWuRvRNRl80xVfpGXK/z6KYXmAgbI4ogz7uFiJxCnYcqyvZVD0dgFog7Q==} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-linux-x64-musl@4.8.0: + resolution: {integrity: sha512-mdxnlW2QUzXwY+95TuxZ+CurrhgrPAMveDWI97EQlA9bfhR8tw3Pt7SUlc/eSlCNxlWktpmT//EAA8UfCHOyXg==} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-win32-arm64-msvc@4.8.0: + resolution: {integrity: sha512-ge7saUz38aesM4MA7Cad8CHo0Fyd1+qTaqoIo+Jtk+ipBi4ATSrHWov9/S4u5pbEQmLjgUjB7BJt+MiKG2kzmA==} + cpu: [arm64] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-win32-ia32-msvc@4.8.0: + resolution: {integrity: sha512-p9E3PZlzurhlsN5h9g7zIP1DnqKXJe8ZUkFwAazqSvHuWfihlIISPxG9hCHCoA+dOOspL/c7ty1eeEVFTE0UTw==} + cpu: [ia32] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-win32-x64-msvc@4.8.0: + resolution: {integrity: sha512-kb4/auKXkYKqlUYTE8s40FcJIj5soOyRLHKd4ugR0dCq0G2EfcF54eYcfQiGkHzjidZ40daB4ulsFdtqNKZtBg==} + cpu: [x64] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@sveltejs/vite-plugin-svelte-inspector@2.0.0(@sveltejs/vite-plugin-svelte@3.0.1)(svelte@4.2.8)(vite@5.0.8): + resolution: {integrity: sha512-gjr9ZFg1BSlIpfZ4PRewigrvYmHWbDrq2uvvPB1AmTWKuM+dI1JXQSUu2pIrYLb/QncyiIGkFDFKTwJ0XqQZZg==} + engines: {node: ^18.0.0 || >=20} peerDependencies: - '@sveltejs/vite-plugin-svelte': ^2.2.0 - svelte: ^3.54.0 || ^4.0.0 - vite: ^4.0.0 + '@sveltejs/vite-plugin-svelte': ^3.0.0 + svelte: ^4.0.0 || ^5.0.0-next.0 + vite: ^5.0.0 dependencies: - '@sveltejs/vite-plugin-svelte': 2.5.3(svelte@4.2.8)(vite@4.5.1) + '@sveltejs/vite-plugin-svelte': 3.0.1(svelte@4.2.8)(vite@5.0.8) debug: 4.3.4 svelte: 4.2.8 - vite: 4.5.1(@types/node@20.10.4) + vite: 5.0.8 transitivePeerDependencies: - supports-color dev: true - /@sveltejs/vite-plugin-svelte@2.5.3(svelte@4.2.8)(vite@4.5.1): - resolution: {integrity: sha512-erhNtXxE5/6xGZz/M9eXsmI7Pxa6MS7jyTy06zN3Ck++ldrppOnOlJwHHTsMC7DHDQdgUp4NAc4cDNQ9eGdB/w==} - engines: {node: ^14.18.0 || >= 16} + /@sveltejs/vite-plugin-svelte@3.0.1(svelte@4.2.8)(vite@5.0.8): + resolution: {integrity: sha512-CGURX6Ps+TkOovK6xV+Y2rn8JKa8ZPUHPZ/NKgCxAmgBrXReavzFl8aOSCj3kQ1xqT7yGJj53hjcV/gqwDAaWA==} + engines: {node: ^18.0.0 || >=20} peerDependencies: - svelte: ^3.54.0 || ^4.0.0 || ^5.0.0-next.0 - vite: ^4.0.0 + svelte: ^4.0.0 || ^5.0.0-next.0 + vite: ^5.0.0 dependencies: - '@sveltejs/vite-plugin-svelte-inspector': 1.0.4(@sveltejs/vite-plugin-svelte@2.5.3)(svelte@4.2.8)(vite@4.5.1) + '@sveltejs/vite-plugin-svelte-inspector': 2.0.0(@sveltejs/vite-plugin-svelte@3.0.1)(svelte@4.2.8)(vite@5.0.8) debug: 4.3.4 deepmerge: 4.3.1 kleur: 4.1.5 magic-string: 0.30.5 svelte: 4.2.8 svelte-hmr: 0.15.3(svelte@4.2.8) - vite: 4.5.1(@types/node@20.10.4) - vitefu: 0.2.5(vite@4.5.1) + vite: 5.0.8 + vitefu: 0.2.5(vite@5.0.8) transitivePeerDependencies: - supports-color dev: true - /@types/cookie@0.5.4: - resolution: {integrity: sha512-7z/eR6O859gyWIAjuvBWFzNURmf2oPBmJlfVWkwehU5nzIyjwBsTh7WMmEEV4JFnHuQ3ex4oyTvfKzcyJVDBNA==} + /@tsconfig/svelte@5.0.2: + resolution: {integrity: sha512-BRbo1fOtyVbhfLyuCWw6wAWp+U8UQle+ZXu84MYYWzYSEB28dyfnRBIE99eoG+qdAC0po6L2ScIEivcT07UaMA==} dev: true /@types/estree@1.0.5: resolution: {integrity: sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==} dev: true - /@types/node@20.10.4: - resolution: {integrity: sha512-D08YG6rr8X90YB56tSIuBaddy/UXAA9RKJoFvrsnogAum/0pmjkgi4+2nx96A330FmioegBWmEYQ+syqCFaveg==} - dependencies: - undici-types: 5.26.5 - dev: true - /@types/pug@2.0.10: resolution: {integrity: sha512-Sk/uYFOBAB7mb74XcpizmH0KOR2Pv3D2Hmrh1Dmy5BmK3MpdSa5kqZcg6EKBdklU0bFXX9gCfzvpnyUehrPIuA==} dev: true - /@types/ws@8.5.10: - resolution: {integrity: sha512-vmQSUcfalpIq0R9q7uTo2lXs6eGIpt9wtnLdMv9LVpIjCA/+ufZRozlVoVelIYixx1ugCBKDhn89vnsEGOCx9A==} - dependencies: - '@types/node': 20.10.4 - dev: true - /acorn@8.11.2: resolution: {integrity: sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w==} engines: {node: '>=0.4.0'} @@ -499,11 +530,6 @@ packages: resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} dev: true - /cookie@0.5.0: - resolution: {integrity: sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==} - engines: {node: '>= 0.6'} - dev: true - /css-tree@2.3.1: resolution: {integrity: sha512-6Fv1DV/TYw//QF5IzQdqsNDjx/wc8TrMBZsqjL9eW01tWb7R7k/mq+/VXfJCl7SoD5emsJop9cOByJZfs8hYIw==} engines: {node: ^10 || ^12.20.0 || ^14.13.0 || >=15.0.0} @@ -539,46 +565,38 @@ packages: engines: {node: '>=8'} dev: true - /devalue@4.3.2: - resolution: {integrity: sha512-KqFl6pOgOW+Y6wJgu80rHpo2/3H07vr8ntR9rkkFIRETewbf5GaYYcakYfiKz89K+sLsuPkQIZaXDMjUObZwWg==} - dev: true - /es6-promise@3.3.1: resolution: {integrity: sha512-SOp9Phqvqn7jtEUxPWdWfWoLmyt2VaJ6MpvP9Comy1MceMXqE6bxvaTu4iaxpYYPzhny28Lc+M87/c2cPK6lDg==} dev: true - /esbuild@0.18.20: - resolution: {integrity: sha512-ceqxoedUrcayh7Y7ZX6NdbbDzGROiyVBgC4PriJThBKSVPWnnFHZAkfI1lJT8QFkOwH4qOS2SJkS4wvpGl8BpA==} + /esbuild@0.19.9: + resolution: {integrity: sha512-U9CHtKSy+EpPsEBa+/A2gMs/h3ylBC0H0KSqIg7tpztHerLi6nrrcoUJAkNCEPumx8yJ+Byic4BVwHgRbN0TBg==} engines: {node: '>=12'} hasBin: true requiresBuild: true optionalDependencies: - '@esbuild/android-arm': 0.18.20 - '@esbuild/android-arm64': 0.18.20 - '@esbuild/android-x64': 0.18.20 - '@esbuild/darwin-arm64': 0.18.20 - '@esbuild/darwin-x64': 0.18.20 - '@esbuild/freebsd-arm64': 0.18.20 - '@esbuild/freebsd-x64': 0.18.20 - '@esbuild/linux-arm': 0.18.20 - '@esbuild/linux-arm64': 0.18.20 - '@esbuild/linux-ia32': 0.18.20 - '@esbuild/linux-loong64': 0.18.20 - '@esbuild/linux-mips64el': 0.18.20 - '@esbuild/linux-ppc64': 0.18.20 - '@esbuild/linux-riscv64': 0.18.20 - '@esbuild/linux-s390x': 0.18.20 - '@esbuild/linux-x64': 0.18.20 - '@esbuild/netbsd-x64': 0.18.20 - '@esbuild/openbsd-x64': 0.18.20 - '@esbuild/sunos-x64': 0.18.20 - '@esbuild/win32-arm64': 0.18.20 - '@esbuild/win32-ia32': 0.18.20 - '@esbuild/win32-x64': 0.18.20 - dev: true - - /esm-env@1.0.0: - resolution: {integrity: sha512-Cf6VksWPsTuW01vU9Mk/3vRue91Zevka5SjyNf3nEpokFRuqt/KjUQoGAwq9qMmhpLTHmXzSIrFRw8zxWzmFBA==} + '@esbuild/android-arm': 0.19.9 + '@esbuild/android-arm64': 0.19.9 + '@esbuild/android-x64': 0.19.9 + '@esbuild/darwin-arm64': 0.19.9 + '@esbuild/darwin-x64': 0.19.9 + '@esbuild/freebsd-arm64': 0.19.9 + '@esbuild/freebsd-x64': 0.19.9 + '@esbuild/linux-arm': 0.19.9 + '@esbuild/linux-arm64': 0.19.9 + '@esbuild/linux-ia32': 0.19.9 + '@esbuild/linux-loong64': 0.19.9 + '@esbuild/linux-mips64el': 0.19.9 + '@esbuild/linux-ppc64': 0.19.9 + '@esbuild/linux-riscv64': 0.19.9 + '@esbuild/linux-s390x': 0.19.9 + '@esbuild/linux-x64': 0.19.9 + '@esbuild/netbsd-x64': 0.19.9 + '@esbuild/openbsd-x64': 0.19.9 + '@esbuild/sunos-x64': 0.19.9 + '@esbuild/win32-arm64': 0.19.9 + '@esbuild/win32-ia32': 0.19.9 + '@esbuild/win32-x64': 0.19.9 dev: true /estree-walker@3.0.3: @@ -641,14 +659,6 @@ packages: path-is-absolute: 1.0.1 dev: true - /globalyzer@0.1.0: - resolution: {integrity: sha512-40oNTM9UfG6aBmuKxk/giHn5nQ8RVz/SS4Ir6zgzOv9/qC3kKZ9v4etGTcJbEl/NyVQH7FGU7d+X1egr57Md2Q==} - dev: true - - /globrex@0.1.2: - resolution: {integrity: sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==} - dev: true - /graceful-fs@4.2.11: resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} dev: true @@ -661,10 +671,6 @@ packages: resolve-from: 4.0.0 dev: true - /import-meta-resolve@4.0.0: - resolution: {integrity: sha512-okYUR7ZQPH+efeuMJGlq4f8ubUgO50kByRPyt/Cy1Io4PSRsPjxME+YlVaCOx+NIToW7hCsZNFJyTPFFKepRSA==} - dev: true - /inflight@1.0.6: resolution: {integrity: sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==} dependencies: @@ -773,11 +779,6 @@ packages: engines: {node: '>=4'} dev: true - /mrmime@1.0.1: - resolution: {integrity: sha512-hzzEagAgDyoU1Q6yg5uI+AorQgdvMCur3FcKf7NhMKWsaYg+RnbTyHRa/9IlLF9rf455MOCtcqqrQQ83pPP7Uw==} - engines: {node: '>=10'} - dev: true - /ms@2.1.2: resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==} dev: true @@ -848,6 +849,11 @@ packages: picomatch: 2.3.1 dev: true + /regexparam@2.0.2: + resolution: {integrity: sha512-A1PeDEYMrkLrfyOwv2jwihXbo9qxdGD3atBYQA9JJgreAx8/7rC6IUkWOw2NQlOxLp2wL0ifQbh1HuidDfYA6w==} + engines: {node: '>=8'} + dev: false + /resolve-from@4.0.0: resolution: {integrity: sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==} engines: {node: '>=4'} @@ -865,11 +871,24 @@ packages: glob: 7.2.3 dev: true - /rollup@3.29.4: - resolution: {integrity: sha512-oWzmBZwvYrU0iJHtDmhsm662rC15FRXmcjCk1xD771dFDx5jJ02ufAQQTn0etB2emNk4J9EZg/yWKpsn9BWGRw==} - engines: {node: '>=14.18.0', npm: '>=8.0.0'} + /rollup@4.8.0: + resolution: {integrity: sha512-NpsklK2fach5CdI+PScmlE5R4Ao/FSWtF7LkoIrHDxPACY/xshNasPsbpG0VVHxUTbf74tJbVT4PrP8JsJ6ZDA==} + engines: {node: '>=18.0.0', npm: '>=8.0.0'} hasBin: true optionalDependencies: + '@rollup/rollup-android-arm-eabi': 4.8.0 + '@rollup/rollup-android-arm64': 4.8.0 + '@rollup/rollup-darwin-arm64': 4.8.0 + '@rollup/rollup-darwin-x64': 4.8.0 + '@rollup/rollup-linux-arm-gnueabihf': 4.8.0 + '@rollup/rollup-linux-arm64-gnu': 4.8.0 + '@rollup/rollup-linux-arm64-musl': 4.8.0 + '@rollup/rollup-linux-riscv64-gnu': 4.8.0 + '@rollup/rollup-linux-x64-gnu': 4.8.0 + '@rollup/rollup-linux-x64-musl': 4.8.0 + '@rollup/rollup-win32-arm64-msvc': 4.8.0 + '@rollup/rollup-win32-ia32-msvc': 4.8.0 + '@rollup/rollup-win32-x64-msvc': 4.8.0 fsevents: 2.3.3 dev: true @@ -895,19 +914,6 @@ packages: rimraf: 2.7.1 dev: true - /set-cookie-parser@2.6.0: - resolution: {integrity: sha512-RVnVQxTXuerk653XfuliOxBP81Sf0+qfQE73LIYKcyMYHG94AuH0kgrQpRDuTZnSmjpysHmzxJXKNfa6PjFhyQ==} - dev: true - - /sirv@2.0.3: - resolution: {integrity: sha512-O9jm9BsID1P+0HOi81VpXPoDxYP374pkOLzACAoyUQ/3OUVndNpsz6wMnY2z+yOxzbllCKZrM+9QrWsv4THnyA==} - engines: {node: '>= 10'} - dependencies: - '@polka/url': 1.0.0-next.24 - mrmime: 1.0.1 - totalist: 3.0.1 - dev: true - /sorcery@0.11.0: resolution: {integrity: sha512-J69LQ22xrQB1cIFJhPfgtLuI6BpWRiWu1Y3vSsIwK/eAScqJxd/+CJlUuHQRdX2C9NGFamq+KqNywGgaThwfHw==} hasBin: true @@ -943,7 +949,7 @@ packages: picocolors: 1.0.0 sade: 1.8.1 svelte: 4.2.8 - svelte-preprocess: 5.1.1(svelte@4.2.8)(typescript@5.3.3) + svelte-preprocess: 5.1.2(svelte@4.2.8)(typescript@5.3.3) typescript: 5.3.3 transitivePeerDependencies: - '@babel/core' @@ -966,8 +972,8 @@ packages: svelte: 4.2.8 dev: true - /svelte-preprocess@5.1.1(svelte@4.2.8)(typescript@5.3.3): - resolution: {integrity: sha512-p/Dp4hmrBW5mrCCq29lEMFpIJT2FZsRlouxEc5qpbOmXRbaFs7clLs8oKPwD3xCFyZfv1bIhvOzpQkhMEVQdMw==} + /svelte-preprocess@5.1.2(svelte@4.2.8)(typescript@5.3.3): + resolution: {integrity: sha512-XF0aliMAcYnP4hLETvB6HRAMnaL09ASYT1Z2I1Gwu0nz6xbdg/dSgAEthtFZJA4AKrNhFDFdmUDO+H9d/6xg5g==} engines: {node: '>= 14.10.0'} requiresBuild: true peerDependencies: @@ -975,7 +981,7 @@ packages: coffeescript: ^2.5.1 less: ^3.11.3 || ^4.0.0 postcss: ^7 || ^8 - postcss-load-config: ^2.1.0 || ^3.0.0 || ^4.0.0 + postcss-load-config: ^2.1.0 || ^3.0.0 || ^4.0.0 || ^5.0.0 pug: ^3.0.0 sass: ^1.26.8 stylus: ^0.55.0 @@ -1013,6 +1019,12 @@ packages: typescript: 5.3.3 dev: true + /svelte-spa-router@4.0.0: + resolution: {integrity: sha512-Z9OjOgF6n6N+N30aKZi20DypEfQAYY4USSChQd9UTlV6X7A2BvZ+Dm9uXx4Sw3FqwQUKelyKhEWjlD71yvLdgw==} + dependencies: + regexparam: 2.0.2 + dev: false + /svelte@4.2.8: resolution: {integrity: sha512-hU6dh1MPl8gh6klQZwK/n73GiAHiR95IkFsesLPbMeEZi36ydaXL/ZAb4g9sayT0MXzpxyZjR28yderJHxcmYA==} engines: {node: '>=16'} @@ -1032,13 +1044,6 @@ packages: periscopic: 3.1.0 dev: true - /tiny-glob@0.2.9: - resolution: {integrity: sha512-g/55ssRPUjShh+xkfx9UPDXqhckHEsHr4Vd9zX55oSdGZc/MD0m3sferOkwWtp98bv+kcVfEHtRJgBVJzelrzg==} - dependencies: - globalyzer: 0.1.0 - globrex: 0.1.2 - dev: true - /to-regex-range@5.0.1: resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} engines: {node: '>=8.0'} @@ -1046,11 +1051,6 @@ packages: is-number: 7.0.0 dev: true - /totalist@3.0.1: - resolution: {integrity: sha512-sf4i37nQ2LBx4m3wB74y+ubopq6W/dIzXg0FDGjsYnZHVa1Da8FH853wlL2gtUhg+xJXjfk3kUZS3BRoQeoQBQ==} - engines: {node: '>=6'} - dev: true - /tslib@2.6.2: resolution: {integrity: sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==} dev: true @@ -1061,23 +1061,12 @@ packages: hasBin: true dev: true - /undici-types@5.26.5: - resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==} - dev: true - - /undici@5.26.5: - resolution: {integrity: sha512-cSb4bPFd5qgR7qr2jYAi0hlX9n5YKK2ONKkLFkxl+v/9BvC0sOpZjBHDBSXc5lWAf5ty9oZdRXytBIHzgUcerw==} - engines: {node: '>=14.0'} - dependencies: - '@fastify/busboy': 2.1.0 - dev: true - - /vite@4.5.1(@types/node@20.10.4): - resolution: {integrity: sha512-AXXFaAJ8yebyqzoNB9fu2pHoo/nWX+xZlaRwoeYUxEqBO+Zj4msE5G+BhGBll9lYEKv9Hfks52PAF2X7qDYXQA==} - engines: {node: ^14.18.0 || >=16.0.0} + /vite@5.0.8: + resolution: {integrity: sha512-jYMALd8aeqR3yS9xlHd0OzQJndS9fH5ylVgWdB+pxTwxLKdO1pgC5Dlb398BUxpfaBxa4M9oT7j1g503Gaj5IQ==} + engines: {node: ^18.0.0 || >=20.0.0} hasBin: true peerDependencies: - '@types/node': '>= 14' + '@types/node': ^18.0.0 || >=20.0.0 less: '*' lightningcss: ^1.21.0 sass: '*' @@ -1100,15 +1089,14 @@ packages: terser: optional: true dependencies: - '@types/node': 20.10.4 - esbuild: 0.18.20 + esbuild: 0.19.9 postcss: 8.4.32 - rollup: 3.29.4 + rollup: 4.8.0 optionalDependencies: fsevents: 2.3.3 dev: true - /vitefu@0.2.5(vite@4.5.1): + /vitefu@0.2.5(vite@5.0.8): resolution: {integrity: sha512-SgHtMLoqaeeGnd2evZ849ZbACbnwQCIwRH57t18FxcXoZop0uQu0uzlIhJBlF/eWVzuce0sHeqPcDo+evVcg8Q==} peerDependencies: vite: ^3.0.0 || ^4.0.0 || ^5.0.0 @@ -1116,22 +1104,9 @@ packages: vite: optional: true dependencies: - vite: 4.5.1(@types/node@20.10.4) + vite: 5.0.8 dev: true /wrappy@1.0.2: resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} dev: true - - /ws@8.14.2: - resolution: {integrity: sha512-wEBG1ftX4jcglPxgFCMJmZ2PLtSbJ2Peg6TmpJFTbe9GZYOQCDPdMYu/Tm0/bGZkw8paZnJY45J4K2PZrLYq8g==} - engines: {node: '>=10.0.0'} - peerDependencies: - bufferutil: ^4.0.1 - utf-8-validate: '>=5.0.2' - peerDependenciesMeta: - bufferutil: - optional: true - utf-8-validate: - optional: true - dev: true diff --git a/app/frontend/public/404.html b/app/frontend/public/404.html new file mode 100644 index 00000000..1d2fb258 --- /dev/null +++ b/app/frontend/public/404.html @@ -0,0 +1,20 @@ + + + + + +

Please enable Javascript to be automatically redirected.

+ + \ No newline at end of file diff --git a/app/frontend/public/svelte.svg b/app/frontend/public/svelte.svg new file mode 100644 index 00000000..c5e08481 --- /dev/null +++ b/app/frontend/public/svelte.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/app/frontend/src/App.svelte b/app/frontend/src/App.svelte new file mode 100644 index 00000000..5cc29420 --- /dev/null +++ b/app/frontend/src/App.svelte @@ -0,0 +1,23 @@ + + +
+ +
+ + diff --git a/app/frontend/src/app.d.ts b/app/frontend/src/app.d.ts deleted file mode 100644 index f59b884c..00000000 --- a/app/frontend/src/app.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -// See https://kit.svelte.dev/docs/types#app -// for information about these interfaces -declare global { - namespace App { - // interface Error {} - // interface Locals {} - // interface PageData {} - // interface Platform {} - } -} - -export {}; diff --git a/app/frontend/src/app.html b/app/frontend/src/app.html deleted file mode 100644 index 77a5ff52..00000000 --- a/app/frontend/src/app.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - %sveltekit.head% - - -
%sveltekit.body%
- - diff --git a/app/frontend/src/lib/LidarStream.svelte b/app/frontend/src/lib/LidarStream.svelte index ca1edc1a..97b1a5fb 100644 --- a/app/frontend/src/lib/LidarStream.svelte +++ b/app/frontend/src/lib/LidarStream.svelte @@ -2,7 +2,7 @@ import { onMount } from "svelte"; import { get } from "svelte/store"; - import { websocket_store } from "$lib/WebsocketStore"; + import { websocket_store } from "./WebsocketStore"; class ScanPoint { constructor(angle: number, distance: number) { @@ -60,4 +60,4 @@ }); - + \ No newline at end of file diff --git a/app/frontend/src/lib/WebSocketStore.ts b/app/frontend/src/lib/WebsocketStore.ts similarity index 95% rename from app/frontend/src/lib/WebSocketStore.ts rename to app/frontend/src/lib/WebsocketStore.ts index 87a078c4..59159d06 100644 --- a/app/frontend/src/lib/WebSocketStore.ts +++ b/app/frontend/src/lib/WebsocketStore.ts @@ -1,6 +1,6 @@ import { readable, writable, derived, type Readable, type Writable } from "svelte/store"; -export let websocket_url_store: Writable = writable(undefined); +export let websocket_url_store: Writable = writable(); export const websocket_store: Readable = derived([websocket_url_store], ([$websocket_url]) => { if ($websocket_url === undefined) { diff --git a/app/frontend/src/lib/index.ts b/app/frontend/src/lib/index.ts deleted file mode 100644 index 856f2b6c..00000000 --- a/app/frontend/src/lib/index.ts +++ /dev/null @@ -1 +0,0 @@ -// place files you want to import through the `$lib` alias in this folder. diff --git a/app/frontend/src/main.ts b/app/frontend/src/main.ts new file mode 100644 index 00000000..2c27a257 --- /dev/null +++ b/app/frontend/src/main.ts @@ -0,0 +1,7 @@ +import App from './App.svelte'; + +const app = new App({ + target: document.body +}); + +export default app; diff --git a/app/frontend/src/routes.ts b/app/frontend/src/routes.ts new file mode 100644 index 00000000..a03af2ae --- /dev/null +++ b/app/frontend/src/routes.ts @@ -0,0 +1,12 @@ +import Home from './routes/Home.svelte'; +import Lorem from './routes/Lorem.svelte'; +import Room from './routes/Room.svelte'; +import NotFound from './routes/NotFound.svelte'; + +export default { + '/': Home, + '/lorem/:repeat': Lorem, + '/room/:room_name': Room, + // The catch-all route must always be last + '*': NotFound +}; diff --git a/app/frontend/src/routes/+layout.js b/app/frontend/src/routes/+layout.js deleted file mode 100644 index 8cb5240c..00000000 --- a/app/frontend/src/routes/+layout.js +++ /dev/null @@ -1,2 +0,0 @@ -export const prerender = true -export const ssr = false; diff --git a/app/frontend/src/routes/+page.svelte b/app/frontend/src/routes/+page.svelte deleted file mode 100644 index 006c7451..00000000 --- a/app/frontend/src/routes/+page.svelte +++ /dev/null @@ -1,10 +0,0 @@ - - -

Welcome to SvelteKit

-

- Visit kit.svelte.dev to read the documentation -

diff --git a/app/frontend/src/routes/Home.svelte b/app/frontend/src/routes/Home.svelte new file mode 100644 index 00000000..922e0f55 --- /dev/null +++ b/app/frontend/src/routes/Home.svelte @@ -0,0 +1,18 @@ +

Hello world!

+

Visit the Svelte tutorial to learn how to build Svelte apps.

+

+ This template is pre-configured with svlete-spa-router for routing.
+ Visit the documentation for the router to learn more. +

+

+ Check a route: Lorem ipsum +

+ + diff --git a/app/frontend/src/routes/Lorem.svelte b/app/frontend/src/routes/Lorem.svelte new file mode 100644 index 00000000..ec5b5552 --- /dev/null +++ b/app/frontend/src/routes/Lorem.svelte @@ -0,0 +1,32 @@ + + +

Lorem ipsum

+

Tip: try changing the number in the URL's fragment, e.g. #/lorem/4

+{#each Array(repeat) as _} +

+ Lorem ipsum dolor, sit amet consectetur adipisicing elit. Sed consequatur dicta, explicabo delectus, cupiditate, rem illo repellat aperiam saepe id minus ipsa. Illum libero consectetur fuga neque officia, adipisci commodi.Porro eius harum sed architecto maxime, molestiae cum ad dignissimos eum, nihil eligendi? Non quo, modi officia doloribus distinctio pariatur sed? Veniam facere beatae ipsam reprehenderit suscipit! Sequi, distinctio debitis. +

+{/each} + + + diff --git a/app/frontend/src/routes/NotFound.svelte b/app/frontend/src/routes/NotFound.svelte new file mode 100644 index 00000000..83598a8f --- /dev/null +++ b/app/frontend/src/routes/NotFound.svelte @@ -0,0 +1,11 @@ +

Not Found

+

This route doesn't exist.

+ + diff --git a/app/frontend/src/routes/Room.svelte b/app/frontend/src/routes/Room.svelte new file mode 100644 index 00000000..8f521ef6 --- /dev/null +++ b/app/frontend/src/routes/Room.svelte @@ -0,0 +1,55 @@ + + +

This is the Room page

+

Title: {room_name}

+ + { + if (key_event.key === "Enter") sendMessage(); + }} + bind:value={message} +/> + + +

Hello {room_name}!

+ +{#if $websocket_url_store !== undefined} + +{:else} +

Waiting to retrieve the Websocket Url...

+{/if} \ No newline at end of file diff --git a/app/frontend/src/routes/room/[slug]/+page.js b/app/frontend/src/routes/room/[slug]/+page.js deleted file mode 100644 index 66b891d9..00000000 --- a/app/frontend/src/routes/room/[slug]/+page.js +++ /dev/null @@ -1,3 +0,0 @@ -export const prerender = false; -export const csr = true; -export const ssr = false; \ No newline at end of file diff --git a/app/frontend/src/routes/room/[slug]/+page.svelte b/app/frontend/src/routes/room/[slug]/+page.svelte deleted file mode 100644 index ed8eac8c..00000000 --- a/app/frontend/src/routes/room/[slug]/+page.svelte +++ /dev/null @@ -1,62 +0,0 @@ - - -

This is the Room page

-

Title: {data.room_name}

- - { - if (key_event.key === "Enter") sendMessage(); - }} - bind:value={message} -/> - - -

Hello {data.room_name}!

- -{#if $websocket_url_store !== undefined} - -{:else} -

Waiting to retrieve the Websocket Url...

-{/if} diff --git a/app/frontend/src/vite-env.d.ts b/app/frontend/src/vite-env.d.ts new file mode 100644 index 00000000..4078e747 --- /dev/null +++ b/app/frontend/src/vite-env.d.ts @@ -0,0 +1,2 @@ +/// +/// diff --git a/app/frontend/static/favicon.png b/app/frontend/static/favicon.png deleted file mode 100644 index 825b9e65..00000000 Binary files a/app/frontend/static/favicon.png and /dev/null differ diff --git a/app/frontend/svelte.config.js b/app/frontend/svelte.config.js index c5bbe05c..b0683fd2 100644 --- a/app/frontend/svelte.config.js +++ b/app/frontend/svelte.config.js @@ -1,22 +1,7 @@ -import adapter from '@sveltejs/adapter-static'; -import { vitePreprocess } from '@sveltejs/kit/vite'; +import { vitePreprocess } from '@sveltejs/vite-plugin-svelte' -/** @type {import('@sveltejs/kit').Config} */ -const config = { - preprocess: vitePreprocess(), - - kit: { - adapter: adapter({ - // default options are shown. On some platforms - // these options are set automatically — see below - pages: 'build', - assets: 'build', - fallback: 'dynamic.html', - strict: false, - // precompress: false, - strict: true - }) - } -}; - -export default config; +export default { + // Consult https://svelte.dev/docs#compile-time-svelte-preprocess + // for more information about preprocessors + preprocess: vitePreprocess(), +} diff --git a/app/frontend/tsconfig.json b/app/frontend/tsconfig.json index 82081abc..5fb548f2 100644 --- a/app/frontend/tsconfig.json +++ b/app/frontend/tsconfig.json @@ -1,18 +1,20 @@ { - "extends": "./.svelte-kit/tsconfig.json", - "compilerOptions": { - "allowJs": true, - "checkJs": true, - "esModuleInterop": true, - "forceConsistentCasingInFileNames": true, - "resolveJsonModule": true, - "skipLibCheck": true, - "sourceMap": true, - "strict": true, - "moduleResolution": "bundler" - } - // Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias - // - // If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes - // from the referenced tsconfig.json - TypeScript does not merge them in + "extends": "@tsconfig/svelte/tsconfig.json", + "compilerOptions": { + "target": "ESNext", + "useDefineForClassFields": true, + "module": "ESNext", + "resolveJsonModule": true, + /** + * Typecheck JS in `.svelte` and `.js` files by default. + * Disable checkJs if you'd like to use dynamic types in JS. + * Note that setting allowJs false does not prevent the use + * of JS in `.svelte` files. + */ + "allowJs": true, + "checkJs": true, + "isolatedModules": true + }, + "include": ["src/**/*.ts", "src/**/*.js", "src/**/*.svelte"], + "references": [{ "path": "./tsconfig.node.json" }] } diff --git a/app/frontend/tsconfig.node.json b/app/frontend/tsconfig.node.json new file mode 100644 index 00000000..494bfe08 --- /dev/null +++ b/app/frontend/tsconfig.node.json @@ -0,0 +1,9 @@ +{ + "compilerOptions": { + "composite": true, + "skipLibCheck": true, + "module": "ESNext", + "moduleResolution": "bundler" + }, + "include": ["vite.config.ts"] +} diff --git a/app/frontend/vite.config.ts b/app/frontend/vite.config.ts index bbf8c7da..d7019694 100644 --- a/app/frontend/vite.config.ts +++ b/app/frontend/vite.config.ts @@ -1,6 +1,7 @@ -import { sveltekit } from '@sveltejs/kit/vite'; -import { defineConfig } from 'vite'; +import { defineConfig } from 'vite' +import { svelte } from '@sveltejs/vite-plugin-svelte' +// https://vitejs.dev/config/ export default defineConfig({ - plugins: [sveltekit()] -}); + plugins: [svelte()], +}) diff --git a/app/raspberry_pi/include/rplidar/RPLidar.cpp b/app/raspberry_pi/include/rplidar/RPLidar.cpp index b7387903..22b50137 100644 --- a/app/raspberry_pi/include/rplidar/RPLidar.cpp +++ b/app/raspberry_pi/include/rplidar/RPLidar.cpp @@ -47,7 +47,7 @@ namespace rplidar { { try { - std::unique_ptr serial = std::make_unique(port, baudrate, serial::Timeout(1000U)); + std::unique_ptr serial = std::make_unique(port, baudrate, serial::Timeout(1000U, 60000U, 0U, 1000U, 0U)); std::unique_ptr lidar = std::make_unique(port, baudrate, std::move(serial)); return std::move(lidar); } diff --git a/libraries/RPLidar/include/RPLidar.h b/libraries/RPLidar/include/RPLidar.h index 6ffc0447..c3454bb9 100644 --- a/libraries/RPLidar/include/RPLidar.h +++ b/libraries/RPLidar/include/RPLidar.h @@ -35,7 +35,8 @@ #include -namespace rplidar { +namespace rplidar +{ constexpr uint8_t SYNC_BYTE = 0xA5; constexpr uint8_t SYNC_BYTE2 = 0x5A; @@ -47,7 +48,7 @@ namespace rplidar { enum ScanType { - NORMAL, + NORMAL = 0, FORCE, EXPRESS }; @@ -62,7 +63,7 @@ namespace rplidar { static std::map> SCAN_TYPE = { {ScanType::NORMAL, {{"byte", 0x20}, {"response", 129}, {"size", 5}}}, {ScanType::FORCE, {{"byte", 0x21}, {"response", 129}, {"size", 5}}}, - {ScanType::EXPRESS, {{"byte", 0x82}, {"response", 130}, {"size", 84}}} }; + {ScanType::EXPRESS, {{"byte", 0x82}, {"response", 130}, {"size", 84}}}}; constexpr int DESCRIPTOR_LEN = 7; constexpr int INFO_LEN = 20; @@ -78,7 +79,7 @@ namespace rplidar { static std::map HEALTH_STATUSES = { {0, "Good"}, {1, "Warning"}, - {2, "Error"} }; + {2, "Error"}}; struct DeviceInfo { @@ -168,9 +169,9 @@ namespace rplidar { class RPLidar { public: - static tl::expected, nullptr_t> create(const std::string& port, uint32_t baudrate = 115200U); + static tl::expected, nullptr_t> create(const std::string &port, uint32_t baudrate = 115200U); - RPLidar(const std::string& port, uint32_t baudrate, std::unique_ptr serial); + RPLidar(const std::string &port, uint32_t baudrate, std::unique_ptr serial); ~RPLidar(); @@ -184,15 +185,14 @@ namespace rplidar { void stop_motor(); - void _send_payload_cmd(uint8_t cmd, const std::string& payload); + void _send_payload_cmd(uint8_t cmd, const std::string &payload); void _send_cmd(uint8_t cmd); tl::expected< std::tuple, - std::string - > - _read_descriptor(); + std::string> + _read_descriptor(); std::vector _read_response(int dsize); @@ -213,7 +213,6 @@ namespace rplidar { std::function()> iter_scans(ScanType scanType = NORMAL, int maxBufMeas = 3000, int minLen = 5); private: - std::unique_ptr _serial = nullptr; std::string port; @@ -221,7 +220,7 @@ namespace rplidar { int _motor_speed = DEFAULT_MOTOR_PWM; bool motor_running = false; - ScanInfo scanning = { false, 0, ScanType::NORMAL }; + ScanInfo scanning = ScanInfo{false, 0, ScanType::NORMAL}; int express_trame = 32; std::unique_ptr express_data = nullptr; diff --git a/libraries/RPLidar/src/RPLidar.cpp b/libraries/RPLidar/src/RPLidar.cpp index 24726116..3b354951 100644 --- a/libraries/RPLidar/src/RPLidar.cpp +++ b/libraries/RPLidar/src/RPLidar.cpp @@ -32,30 +32,32 @@ lidar.disconnect(); */ -namespace rplidar { +namespace rplidar +{ /** * @brief Initilize RPLidar object for communicating with the sensor * * @param port Serial port name to which sensor is connected * @param baudrate Baudrate for serial connection (the default is 115200) */ - RPLidar::RPLidar(const std::string& port, uint32_t baudrate, std::unique_ptr serial) : port(port), baudrate(baudrate), _serial(std::move(serial)) + RPLidar::RPLidar(const std::string &port, uint32_t baudrate, std::unique_ptr serial) : port(port), baudrate(baudrate), _serial(std::move(serial)) { } - tl::expected, nullptr_t> RPLidar::create(const std::string& port, uint32_t baudrate) + tl::expected, nullptr_t> RPLidar::create(const std::string &port, uint32_t baudrate) { try { - std::unique_ptr serial = std::make_unique(port, baudrate, serial::Timeout(10U, 10U, 10U, 10U, 10U)); + // Timeout after 60 seconds if nothing read + auto timeout = serial::Timeout(1000U, 60000U, 0, 1000U, 0); + std::unique_ptr serial = std::make_unique(port, baudrate, timeout); std::unique_ptr lidar = std::make_unique(port, baudrate, std::move(serial)); return std::move(lidar); } - catch (std::exception& e) + catch (std::exception &e) { return tl::make_unexpected(nullptr); } - } RPLidar::~RPLidar() @@ -127,7 +129,7 @@ namespace rplidar { * @param cmd * @param payload */ - void RPLidar::_send_payload_cmd(uint8_t cmd, const std::string& payload) + void RPLidar::_send_payload_cmd(uint8_t cmd, const std::string &payload) { // Calculate the size uint8_t size = static_cast(payload.size()); @@ -141,7 +143,7 @@ namespace rplidar { // Calculate the checksum uint8_t checksum = 0; - for (const uint8_t& c : req) + for (const uint8_t &c : req) { checksum ^= static_cast(c); } @@ -333,7 +335,7 @@ namespace rplidar { std::string status = HEALTH_STATUSES[raw[0]]; int errorCode = (static_cast(raw[1]) << 8) + static_cast(raw[2]); - return HealthInfo{ status, errorCode }; + return HealthInfo{status, errorCode}; } /** @@ -380,6 +382,7 @@ namespace rplidar { auto health_info_result = this->get_health(); if (!health_info_result.has_value()) return tl::make_unexpected(health_info_result.error()); + HealthInfo healthInfo = health_info_result.value(); std::string status = healthInfo.status; int errorCode = healthInfo.errorCode; @@ -422,9 +425,11 @@ namespace rplidar { uint8_t dsize; bool isSingle; uint8_t dtype; + auto descriptor_result = this->_read_descriptor(); if (!descriptor_result.has_value()) return tl::make_unexpected(descriptor_result.error()); + std::tie(dsize, isSingle, dtype) = descriptor_result.value(); if (dsize != SCAN_TYPE[scanType]["size"]) @@ -439,8 +444,8 @@ namespace rplidar { { return tl::make_unexpected("Wrong response data type"); } - - scanning = { true, dsize, scanType }; + this->scanning = ScanInfo{true, dsize, scanType}; + return nullptr; } /** @@ -456,7 +461,7 @@ namespace rplidar { this->clean_input(); } - tl::expected _process_scan(const std::vector& raw) + tl::expected _process_scan(const std::vector &raw) { Measure measurementData; @@ -491,7 +496,7 @@ namespace rplidar { return measurementData; } - Measure _process_express_scan(std::unique_ptr& data, float newAngle, int trame) + Measure _process_express_scan(std::unique_ptr &data, float newAngle, int trame) { Measure measurementData; @@ -521,7 +526,8 @@ namespace rplidar { */ std::function()> RPLidar::iter_measures(ScanType scanType, int maxBufMeas) { - if (!this->motor_running) { + if (!this->motor_running) + { this->start_motor(); } @@ -532,61 +538,62 @@ namespace rplidar { // Define a lambda function to generate measures auto generator = [this, scanType, maxBufMeas]() -> tl::expected + { + while (true) { - while (true) - { - int dsize = scanning.dsize; + int dsize = scanning.dsize; - if (maxBufMeas) + if (maxBufMeas) + { + int dataInBuf = this->_serial->available(); + if (dataInBuf > maxBufMeas) { - int dataInBuf = this->_serial->available(); - if (dataInBuf > maxBufMeas) - { - spdlog::warn( - "Too many bytes in the input buffer: {}/{}. \n" - "Cleaning buffer...", - dataInBuf, maxBufMeas); - this->stop(); - this->start(scanning.type); - } + spdlog::warn( + "Too many bytes in the input buffer: {}/{}. \n" + "Cleaning buffer...", + dataInBuf, maxBufMeas); + this->stop(); + this->start(scanning.type); } + } - if (scanType == NORMAL) - { - std::vector raw = this->_read_response(dsize); - auto process_scan_result = _process_scan(raw); - if (!process_scan_result.has_value()) - return tl::make_unexpected(process_scan_result.error()); - Measure measure = process_scan_result.value(); - return measure; - } - else if (scanType == EXPRESS) + if (scanType == NORMAL) + { + std::vector raw = this->_read_response(dsize); + auto process_scan_result = _process_scan(raw); + if (!process_scan_result.has_value()) + return tl::make_unexpected(process_scan_result.error()); + Measure measure = process_scan_result.value(); + return measure; + } + else if (scanType == EXPRESS) + { + if (this->express_trame == 32) { - if (this->express_trame == 32) - { - this->express_trame = 0; - - if (this->express_data == nullptr) - { - spdlog::debug("reading first time bytes"); - this->express_data = std::make_unique(ExpressPacket(this->_read_response(dsize))); - } + this->express_trame = 0; - this->express_old_data = std::move(this->express_data); - spdlog::debug("set old_data with start_angle {}", this->express_old_data->start_angle); + if (this->express_data == nullptr) + { + spdlog::debug("reading first time bytes"); this->express_data = std::make_unique(ExpressPacket(this->_read_response(dsize))); - spdlog::debug("set new_data with start_angle {}", this->express_data->start_angle); } - this->express_trame++; - spdlog::debug("process scan of frame %d with angle : \n" - "%f and angle new : %f", this->express_trame, - this->express_old_data->start_angle, - this->express_data->start_angle); - Measure measure = _process_express_scan(this->express_old_data, this->express_data->start_angle, this->express_trame); - return measure; + + this->express_old_data = std::move(this->express_data); + spdlog::debug("set old_data with start_angle {}", this->express_old_data->start_angle); + this->express_data = std::make_unique(ExpressPacket(this->_read_response(dsize))); + spdlog::debug("set new_data with start_angle {}", this->express_data->start_angle); } + this->express_trame++; + spdlog::debug("process scan of frame %d with angle : \n" + "%f and angle new : %f", + this->express_trame, + this->express_old_data->start_angle, + this->express_data->start_angle); + Measure measure = _process_express_scan(this->express_old_data, this->express_data->start_angle, this->express_trame); + return measure; } - }; + } + }; return generator; } @@ -609,26 +616,26 @@ namespace rplidar { // Define a lambda function to generate scans auto scanGenerator = [this, scanType, maxBufMeas, minLen, measureIterator]() -> std::vector + { + std::vector scanList; + for (;;) { - std::vector scanList; - for (;;) + Measure measure = measureIterator().value(); + bool newScan = measure.newScan; + if (newScan) { - Measure measure = measureIterator().value(); - bool newScan = measure.newScan; - if (newScan) + if (scanList.size() > minLen) { - if (scanList.size() > minLen) - { - return scanList; - } - scanList.clear(); - } - if (measure.distance > 0) - { - scanList.push_back(measure); + return scanList; } + scanList.clear(); } - }; + if (measure.distance > 0) + { + scanList.push_back(measure); + } + } + }; return scanGenerator; } } // namespace rplidar \ No newline at end of file diff --git a/libraries/RPLidar/test/test.cpp b/libraries/RPLidar/test/test.cpp index a8fc726a..926664b2 100644 --- a/libraries/RPLidar/test/test.cpp +++ b/libraries/RPLidar/test/test.cpp @@ -35,20 +35,20 @@ int run_native() auto &health = health_result.value(); std::cout << fmt::format("({}, {})\n", health.status, health.errorCode); - // std::function()> scanGenerator = lidar->iter_scans(); - // for (int i = 0; i < 10; i++) - // { - // std::vector scan = scanGenerator(); - // std::cout << "Got " << scan.size() << " Measures!\n"; - // for (const Measure &measure : scan) - // { - // // Access individual measurements in the scan - // bool newScan = measure.newScan; - // int quality = measure.quality; - // float angle = measure.angle; - // float distance = measure.distance; - // } - // } + std::function()> scanGenerator = lidar->iter_scans(); + for (int i = 0; i < 10; i++) + { + std::vector scan = scanGenerator(); + std::cout << "Got " << scan.size() << " Measures!\n"; + for (const Measure &measure : scan) + { + // Access individual measurements in the scan + bool newScan = measure.newScan; + int quality = measure.quality; + float angle = measure.angle; + float distance = measure.distance; + } + } lidar->stop(); lidar->stop_motor();