diff --git a/.prettierrc.yaml b/.prettierrc.yaml index bb6d31e..cbc39a3 100644 --- a/.prettierrc.yaml +++ b/.prettierrc.yaml @@ -1,6 +1,6 @@ tabWidth: 2 overrides: - - files: ['*.md'] + - files: ["*.md"] options: proseWrap: never printWidth: 9999 diff --git a/babel.config.js b/babel.config.js index e00595d..bfd75db 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,3 +1,3 @@ module.exports = { - presets: [require.resolve('@docusaurus/core/lib/babel/preset')], + presets: [require.resolve("@docusaurus/core/lib/babel/preset")], }; diff --git a/docusaurus.config.js b/docusaurus.config.js index e886e9a..6aced4d 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -1,42 +1,43 @@ -const path = require('path'); +const path = require("path"); module.exports = { - title: 'Actix', - tagline: 'Actix Web is a powerful, pragmatic, and extremely fast web framework for Rust', - url: 'https://actix.rs', - baseUrl: '/', - onBrokenLinks: 'throw', - onBrokenMarkdownLinks: 'warn', - favicon: 'img/logo.png', - organizationName: 'actix', // Usually your GitHub org/user name. - projectName: 'actix-web', // Usually your repo name. + title: "Actix", + tagline: + "Actix Web is a powerful, pragmatic, and extremely fast web framework for Rust", + url: "https://actix.rs", + baseUrl: "/", + onBrokenLinks: "throw", + onBrokenMarkdownLinks: "warn", + favicon: "img/logo.png", + organizationName: "actix", // Usually your GitHub org/user name. + projectName: "actix-web", // Usually your repo name. themeConfig: { navbar: { - title: 'Actix', + title: "Actix", logo: { - alt: 'Actix Logo', - src: 'img/logo-icon.png', + alt: "Actix Logo", + src: "img/logo-icon.png", width: 32, height: 32, }, items: [ { - to: 'docs', - activeBasePath: 'docs', - label: 'Documentation', - position: 'left', + to: "docs", + activeBasePath: "docs", + label: "Documentation", + position: "left", }, { - to: 'community', - activeBasePath: 'community', - label: 'Community', - position: 'left', + to: "community", + activeBasePath: "community", + label: "Community", + position: "left", }, { - to: 'code', - activeBasePath: 'code', - label: 'Code', - position: 'left', + to: "code", + activeBasePath: "code", + label: "Code", + position: "left", }, ], }, @@ -45,26 +46,25 @@ module.exports = { }, prism: { // dracula is closest to docs.rs, where keywords are highlighted - theme: require('prism-react-renderer/themes/dracula'), - additionalLanguages: ['rust', 'toml'], - defaultLanguage: 'rust' + theme: require("prism-react-renderer/themes/dracula"), + additionalLanguages: ["rust", "toml"], + defaultLanguage: "rust", }, colorMode: { respectPrefersColorScheme: true, - } + }, }, plugins: ["docusaurus-plugin-sass"], presets: [ [ - '@docusaurus/preset-classic', + "@docusaurus/preset-classic", { docs: { - sidebarPath: require.resolve('./sidebars.js'), - editUrl: - 'https://github.com/actix/actix-website/edit/master/', + sidebarPath: require.resolve("./sidebars.js"), + editUrl: "https://github.com/actix/actix-website/edit/master/", }, theme: { - customCss: require.resolve('./src/css/custom.css'), + customCss: require.resolve("./src/css/custom.css"), }, }, ], diff --git a/examples/powerful-extractors/static/form.html b/examples/powerful-extractors/static/form.html index 768f0af..34292cf 100644 --- a/examples/powerful-extractors/static/form.html +++ b/examples/powerful-extractors/static/form.html @@ -1,7 +1,7 @@ - + - + Forms @@ -14,17 +14,17 @@ let payload = { timestamp: 12345, kind: "this is a kind", - tags: ['tag1', 'tag2', 'tag3'], - } + tags: ["tag1", "tag2", "tag3"], + }; function submitJson() { - fetch('http://localhost:8080/event', { - method: 'POST', + fetch("http://localhost:8080/event", { + method: "POST", headers: { - 'Accept': 'application/json', - 'Content-Type': 'application/json' + Accept: "application/json", + "Content-Type": "application/json", }, - body: JSON.stringify(payload) + body: JSON.stringify(payload), }) .then(function (res) { return res.json(); @@ -32,7 +32,7 @@ .then(function (data) { let expected = { ...payload, - id: 1 + id: 1, }; console.log("expected: ", expected); console.log("received: ", data); diff --git a/sidebars.js b/sidebars.js index c101ab9..c29debb 100644 --- a/sidebars.js +++ b/sidebars.js @@ -1,44 +1,44 @@ module.exports = { docs: { - Introduction: ['welcome', 'whatis'], + Introduction: ["welcome", "whatis"], Basics: [ - 'getting-started', - 'application', - 'server', - 'extractors', - 'handlers', + "getting-started", + "application", + "server", + "extractors", + "handlers", ], Advanced: [ - 'errors', - 'url-dispatch', - 'request', - 'response', - 'testing', - 'middleware', - 'static-files', + "errors", + "url-dispatch", + "request", + "response", + "testing", + "middleware", + "static-files", ], - Protocols: ['websockets', 'http2'], - Patterns: ['autoreload', 'databases', 'shuttle'], - Diagrams: ['http_server_init', 'conn_lifecycle'], + Protocols: ["websockets", "http2"], + Patterns: ["autoreload", "databases", "shuttle"], + Diagrams: ["http_server_init", "conn_lifecycle"], Actix: [ - 'actix/sec-0-quick-start', - 'actix/sec-1-getting-started', - 'actix/sec-2-actor', - 'actix/sec-3-address', - 'actix/sec-4-context', - 'actix/sec-5-arbiter', - 'actix/sec-6-sync-arbiter', + "actix/sec-0-quick-start", + "actix/sec-1-getting-started", + "actix/sec-2-actor", + "actix/sec-3-address", + "actix/sec-4-context", + "actix/sec-5-arbiter", + "actix/sec-6-sync-arbiter", ], - 'API Documentation': [ + "API Documentation": [ { - type: 'link', - label: 'actix', - href: 'https://docs.rs/actix/latest/actix/', + type: "link", + label: "actix", + href: "https://docs.rs/actix/latest/actix/", }, { - type: 'link', - label: 'actix-web', - href: 'https://docs.rs/actix-web/latest/actix_web/', + type: "link", + label: "actix-web", + href: "https://docs.rs/actix-web/latest/actix_web/", }, ], }, diff --git a/src/components/code_block.js b/src/components/code_block.js index 06ff908..6d77ece 100644 --- a/src/components/code_block.js +++ b/src/components/code_block.js @@ -1,21 +1,21 @@ -import React, { useState, useEffect } from 'react'; -import RenderCodeBlock from '@theme/CodeBlock'; +import React, { useState, useEffect } from "react"; +import RenderCodeBlock from "@theme/CodeBlock"; const CodeBlock = ({ example, file, section, language }) => { - const [code, setCode] = useState(''); + const [code, setCode] = useState(""); useEffect(() => { let isMounted = true; const path = - file === 'manifest' ? 'Cargo.toml' : `src/${file ?? 'main.rs'}`; + file === "manifest" ? "Cargo.toml" : `src/${file ?? "main.rs"}`; import(`!!raw-loader!@site/examples/${example}/${path}`) .then((source) => { source = source.default.match( new RegExp( - `(?:\/\/|#) <${section}>\n([\\s\\S]*)(?:\/\/|#) <\/${section}>` - ) + `(?:\/\/|#) <${section}>\n([\\s\\S]*)(?:\/\/|#) <\/${section}>`, + ), )[1]; if (isMounted) setCode(source); @@ -28,7 +28,7 @@ const CodeBlock = ({ example, file, section, language }) => { }, []); return ( - + {code} ); diff --git a/src/css/custom.css b/src/css/custom.css index 55a3303..c8ef8fe 100644 --- a/src/css/custom.css +++ b/src/css/custom.css @@ -20,7 +20,7 @@ --ifm-menu-color-background-active: var(--ifm-color-emphasis-200); } -html[data-theme='dark'] { +html[data-theme="dark"] { --background-color-secondary: #0a191c; --examples-odd-background-color: var(--ifm-hero-background-color); --logo-filter: brightness(0) invert(1); @@ -47,7 +47,6 @@ html[data-theme='dark'] { padding: 0 var(--ifm-pre-padding); } - .navbar__logo { filter: var(--logo-filter); } diff --git a/src/pages/index.js b/src/pages/index.js index 07ba2f7..8dcc38e 100644 --- a/src/pages/index.js +++ b/src/pages/index.js @@ -1,18 +1,18 @@ -import clsx from 'clsx'; -import React from 'react'; -import Link from '@docusaurus/Link'; -import Layout from '@theme/Layout'; -import CodeBlock from '../components/code_block.js'; -import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; -import useBaseUrl from '@docusaurus/useBaseUrl'; -import styles from './styles.module.scss'; -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import clsx from "clsx"; +import React from "react"; +import Link from "@docusaurus/Link"; +import Layout from "@theme/Layout"; +import CodeBlock from "../components/code_block.js"; +import useDocusaurusContext from "@docusaurus/useDocusaurusContext"; +import useBaseUrl from "@docusaurus/useBaseUrl"; +import styles from "./styles.module.scss"; +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faShieldAlt, faBatteryFull, faPuzzlePiece, faTachometerAlt, -} from '@fortawesome/free-solid-svg-icons'; +} from "@fortawesome/free-solid-svg-icons"; const Home = () => { const context = useDocusaurusContext(); @@ -32,7 +32,7 @@ const Home = () => { const highlights = [ { icon: faShieldAlt, - title: 'Type Safe', + title: "Type Safe", description: ( <> Forget about stringly typed objects, from request to response, @@ -42,24 +42,31 @@ const highlights = [ }, { icon: faBatteryFull, - title: 'Feature Rich', + title: "Feature Rich", description: ( <>Actix provides a lot of features out of box. HTTP/2, logging, etc. ), }, { icon: faPuzzlePiece, - title: 'Extensible', + title: "Extensible", description: ( <>Easily create your own libraries that any Actix application can use. ), }, { icon: faTachometerAlt, - title: 'Blazingly Fast', + title: "Blazingly Fast", description: ( <> - Actix is blazingly fast. Don't take our word for it -- see for yourself! + Actix is blazingly fast. Don't take our word for it --{" "} + + see for yourself! + ), }, @@ -70,7 +77,7 @@ const Hero = () => { const { siteConfig } = context; return ( -
+
{ />

{siteConfig.title}

-

+

{siteConfig.tagline}

Get Started @@ -106,7 +113,7 @@ const Highlights = () => {
{highlights.map((highlight, idx) => (
@@ -137,8 +144,9 @@ const Examples = () => {

Hello World!

- Getting started with Actix is easy. An Actix app comes with a URL routing system that lets you match on - URLs and invoke individual handlers. + Getting started with Actix is easy. An Actix app comes with a URL + routing system that lets you match on URLs and invoke individual + handlers.

@@ -169,11 +177,11 @@ const Examples = () => {

Powerful Extractors

- Actix comes with a powerful extractor system that extracts data from - the incoming HTTP request and passes it to your view functions. Not - only does this make for a convenient API but it also means that your - view functions can be synchronous code and still benefit from - asynchronous IO handling. + Actix comes with a powerful extractor system that extracts data + from the incoming HTTP request and passes it to your view + functions. Not only does this make for a convenient API but it + also means that your view functions can be synchronous code and + still benefit from asynchronous IO handling.

diff --git a/src/plugin.js b/src/plugin.js index 0f988e8..232480a 100644 --- a/src/plugin.js +++ b/src/plugin.js @@ -3,9 +3,7 @@ module.exports = function (context, options) { configureWebpack(config, isServer, utils) { return { module: { - rules: [ - { test: /\.rs$/, use: 'raw-loader' }, - ], + rules: [{ test: /\.rs$/, use: "raw-loader" }], }, }; }, diff --git a/vars.js b/vars.js index 6ef5fe4..586aed4 100644 --- a/vars.js +++ b/vars.js @@ -1,5 +1,5 @@ module.exports = { - rustVersion: '1.59', - actixWebMajorVersion: '4', - tokioMajorVersion: '1', + rustVersion: "1.59", + actixWebMajorVersion: "4", + tokioMajorVersion: "1", };