update docs to Svelte 5

This commit is contained in:
Paweł Malinowski 2024-11-10 13:06:07 +01:00 committed by Eric Liu
commit 44fc55d8fd
4 changed files with 602 additions and 289 deletions

868
docs/package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -11,7 +11,7 @@
},
"devDependencies": {
"@sveltech/routify": "^1.9.10",
"@sveltejs/vite-plugin-svelte": "^3.1.2",
"@sveltejs/vite-plugin-svelte": "^4.0.0",
"carbon-components-svelte": "file:..",
"carbon-icons-svelte": "^12.13.0",
"clipboard-copy": "^4.0.1",
@ -19,12 +19,13 @@
"mdsvex": "^0.12.3",
"minisearch": "^7.1.0",
"npm-run-all": "^4.1.5",
"prettier": "^2.8.8",
"prettier-plugin-svelte": "^2.10.1",
"prettier": "^3.3.3",
"@prettier/sync": "0.5.2",
"prettier-plugin-svelte": "^3.2.7",
"prism-svelte": "^0.5.0",
"prismjs": "^1.29.0",
"remark-slug": "^6.1.0",
"svelte": "^4.2.19",
"svelte": "^5.1.13",
"vite": "^5.4.9"
},
"routify": {

View file

@ -1,7 +1,8 @@
import App from "./App.svelte";
import { mount } from "svelte";
import "../../css/all.css";
import "./global.css";
const app = new App({ target: document.body });
const app = mount(App, { target: document.body });
export default app;

View file

@ -1,9 +1,10 @@
import path from "path";
import { mdsvex } from "mdsvex";
import { parse, walk } from "svelte/compiler";
import { parse } from "svelte/compiler";
import { walk } from 'estree-walker'
import slug from "remark-slug";
import visit from "unist-util-visit";
import { format } from "prettier";
import synchronizedPrettier from "@prettier/sync";
import pkg from "../package.json" assert { type: "json" };
import component_api from "./src/COMPONENT_API.json" assert { type: "json" };
import fs from "fs";
@ -81,8 +82,9 @@ function plugin() {
!node.value.match(/svx-ignore/g)
) {
const scriptBlock = createImports(node.value);
const formattedCode = format(scriptBlock + node.value, {
const formattedCode = synchronizedPrettier.format(scriptBlock + node.value, {
parser: "svelte",
plugins: ["prettier-plugin-svelte"],
svelteSortOrder: "scripts-markup-styles-options",
});
const highlightedCode = Prism.highlight(
@ -113,8 +115,9 @@ function plugin() {
path.join("src/pages", `${src}.svelte`),
"utf-8",
);
const formattedCode = format(sourceCode, {
const formattedCode = synchronizedPrettier.format(sourceCode, {
parser: "svelte",
plugins: ["prettier-plugin-svelte"],
});
const highlightedCode = Prism.highlight(
formattedCode,