diff --git a/.prettierrc b/.prettierrc
deleted file mode 100644
index aeee65193..000000000
--- a/.prettierrc
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "useTabs": true,
- "singleQuote": true,
- "trailingComma": "none",
- "printWidth": 100,
- "pluginSearchDirs": ["."],
- "plugins": ["prettier-plugin-svelte"],
- "overrides": [
- { "files": "*.svelte", "options": { "parser": "svelte" } },
- { "files": "*.svx", "options": { "parser": "mdx" } }
- ]
-}
diff --git a/package.json b/package.json
index fc8385760..66d62632b 100644
--- a/package.json
+++ b/package.json
@@ -32,8 +32,8 @@
"lint-staged": "^13.2.3",
"mdsvex": "^0.11.0",
"package-name-regex": "^3.0.0",
- "prettier": "^2.8.8",
- "prettier-plugin-svelte": "^2.10.1",
+ "prettier": "^3.1.0",
+ "prettier-plugin-svelte": "^3.1.2",
"rehype-slug": "^5.1.0",
"svelte": "^4.0.5",
"svelte-check": "^3.4.5",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index bc8f0aa47..297be272f 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -57,11 +57,11 @@ devDependencies:
specifier: ^3.0.0
version: 3.0.0
prettier:
- specifier: ^2.8.8
- version: 2.8.8
+ specifier: ^3.1.0
+ version: 3.1.0
prettier-plugin-svelte:
- specifier: ^2.10.1
- version: 2.10.1(prettier@2.8.8)(svelte@4.0.5)
+ specifier: ^3.1.2
+ version: 3.1.2(prettier@3.1.0)(svelte@4.0.5)
rehype-slug:
specifier: ^5.1.0
version: 5.1.0
@@ -2234,19 +2234,19 @@ packages:
engines: {node: '>= 0.8.0'}
dev: true
- /prettier-plugin-svelte@2.10.1(prettier@2.8.8)(svelte@4.0.5):
- resolution: {integrity: sha512-Wlq7Z5v2ueCubWo0TZzKc9XHcm7TDxqcuzRuGd0gcENfzfT4JZ9yDlCbEgxWgiPmLHkBjfOtpAWkcT28MCDpUQ==}
+ /prettier-plugin-svelte@3.1.2(prettier@3.1.0)(svelte@4.0.5):
+ resolution: {integrity: sha512-7xfMZtwgAWHMT0iZc8jN4o65zgbAQ3+O32V6W7pXrqNvKnHnkoyQCGCbKeUyXKZLbYE0YhFRnamfxfkEGxm8qA==}
peerDependencies:
- prettier: ^1.16.4 || ^2.0.0
- svelte: ^3.2.0 || ^4.0.0-next.0
+ prettier: ^3.0.0
+ svelte: ^3.2.0 || ^4.0.0-next.0 || ^5.0.0-next.0
dependencies:
- prettier: 2.8.8
+ prettier: 3.1.0
svelte: 4.0.5
dev: true
- /prettier@2.8.8:
- resolution: {integrity: sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==}
- engines: {node: '>=10.13.0'}
+ /prettier@3.1.0:
+ resolution: {integrity: sha512-TQLvXjq5IAibjh8EpBIkNKxO749UEWABoiIZehEPiY4GNpVdhaFKqSTu+QrlU6D2dPAfubRmtJTi4K4YkQ5eXw==}
+ engines: {node: '>=14'}
hasBin: true
dev: true
diff --git a/prettier.config.js b/prettier.config.js
new file mode 100644
index 000000000..66b56a87e
--- /dev/null
+++ b/prettier.config.js
@@ -0,0 +1,16 @@
+// @ts-check
+
+/** @type {import('prettier').Config} */
+const config = {
+ useTabs: true,
+ singleQuote: true,
+ trailingComma: 'none',
+ printWidth: 100,
+ plugins: ['prettier-plugin-svelte'],
+ overrides: [
+ { files: '*.svelte', options: { parser: 'svelte' } },
+ { files: '*.svx', options: { parser: 'mdx' } }
+ ]
+};
+
+export default config;
diff --git a/src/app.html b/src/app.html
index d08fb54fa..09cbd58c1 100644
--- a/src/app.html
+++ b/src/app.html
@@ -1,4 +1,4 @@
-
+
diff --git a/src/lib/Mdsvx.d.ts b/src/lib/Mdsvx.d.ts
new file mode 100644
index 000000000..5a7b62398
--- /dev/null
+++ b/src/lib/Mdsvx.d.ts
@@ -0,0 +1,7 @@
+export type RecipeMetadata = {
+ title: string;
+ layout: string;
+ date: string;
+ children?: Array;
+};
+export type EventMetadata = { title: string; layout: string; date: string };
diff --git a/src/routes/cheatsheet/_CheatSheetCard.svelte b/src/routes/cheatsheet/_CheatSheetCard.svelte
index f641a8c51..d0c3e2b80 100644
--- a/src/routes/cheatsheet/_CheatSheetCard.svelte
+++ b/src/routes/cheatsheet/_CheatSheetCard.svelte
@@ -66,7 +66,9 @@
height: var(--s-5);
border-radius: 50%;
background-color: var(--primary);
- box-shadow: 25px 0 0 0 var(--caution), 50px 0 0 0 var(--success);
+ box-shadow:
+ 25px 0 0 0 var(--caution),
+ 50px 0 0 0 var(--success);
margin-right: 50px;
margin-left: 20px;
}
diff --git a/src/routes/events/+page.ts b/src/routes/events/+page.ts
index e9126e5a6..b014e4e0e 100644
--- a/src/routes/events/+page.ts
+++ b/src/routes/events/+page.ts
@@ -1,8 +1,12 @@
import { error } from '@sveltejs/kit';
import { getPages } from '../pageList';
+import type { SvxMetadata } from '../pageList';
+import type { EventMetadata } from '$lib/Mdsvx';
export async function load() {
- const events = await getPages(import.meta.glob('./**/*.svx'));
+ const events = await getPages(
+ import.meta.glob>('./**/*.svx')
+ );
if (events) {
events.sort((a, b) => Date.parse(b.date) - Date.parse(a.date));
diff --git a/src/routes/pageList.ts b/src/routes/pageList.ts
index f832a593e..6b38e892e 100644
--- a/src/routes/pageList.ts
+++ b/src/routes/pageList.ts
@@ -1,6 +1,8 @@
-export async function getPages(
- metaGlob: Array
-): Promise> {
+export type SvxMetadata = { metadata: T };
+
+export async function getPages(
+ metaGlob: Record Promise>> // Should be `ReturnType` but the ast function overload is pick, which is the wrong one
+): Promise> {
const pages = await Promise.all(
Object.entries(metaGlob).map(async ([fullPath, page]) => {
const { metadata } = await page();
diff --git a/src/routes/recipes/+layout.ts b/src/routes/recipes/+layout.ts
index 495d14de0..cf293e947 100644
--- a/src/routes/recipes/+layout.ts
+++ b/src/routes/recipes/+layout.ts
@@ -1,9 +1,13 @@
import { error } from '@sveltejs/kit';
import '$styles/highlight.css';
import { getPages } from '../pageList';
+import type { SvxMetadata } from '../pageList';
+import type { RecipeMetadata } from '$lib/Mdsvx';
export async function load() {
- const pages = (await getPages(import.meta.glob('./**/*.svx'))).map((element) => ({
+ const pages = (
+ await getPages(import.meta.glob>('./**/*.svx'))
+ ).map((element) => ({
...element,
path: '/recipes' + element.path.substring(1)
}));
diff --git a/src/routes/tools/tools.json b/src/routes/tools/tools.json
index cfa417422..9a96784a2 100644
--- a/src/routes/tools/tools.json
+++ b/src/routes/tools/tools.json
@@ -1,6 +1,7 @@
[
{
"title": "rollup-plugin-svelte",
+ "npm": "rollup-plugin-svelte",
"category": "Bundler Plugins",
"description": "Compile Svelte components with Rollup",
"repository": "https://github.com/sveltejs/rollup-plugin-svelte",
@@ -8,6 +9,7 @@
},
{
"title": "svelte-loader",
+ "npm": "svelte-loader",
"category": "Bundler Plugins",
"description": "Webpack loader for svelte components",
"repository": "https://github.com/sveltejs/svelte-loader",
@@ -15,6 +17,7 @@
},
{
"title": "vite-plugin-svelte",
+ "npm": "@sveltejs/vite-plugin-svelte",
"category": "Bundler Plugins",
"description": "This is the official svelte plugin for vite",
"repository": "https://github.com/sveltejs/vite-plugin-svelte",
@@ -22,6 +25,7 @@
},
{
"title": "esbuild-svelte",
+ "npm": "esbuild-svelte",
"category": "Bundler Plugins",
"description": "An esbuild plugin to compile Svelte components",
"repository": "https://github.com/EMH333/esbuild-svelte",
@@ -29,6 +33,7 @@
},
{
"title": "rollup-plugin-svelte-hot",
+ "npm": "rollup-plugin-svelte-hot",
"category": "Bundler Plugins",
"description": "Fork of official rollup-plugin-svelte with added HMR support (for both Nollup or Rollup)",
"repository": "https://github.com/rixo/rollup-plugin-svelte-hot",
@@ -36,6 +41,7 @@
},
{
"title": "parcel-transformer-svelte3-plus",
+ "npm": "parcel-transformer-svelte3-plus",
"category": "Bundler Plugins",
"description": "Transformer plugin for Parcel v2; works with Svelte 3 & Svelte 4",
"repository": "https://github.com/HellButcher/parcel-transformer-svelte3-plus",
@@ -43,6 +49,7 @@
},
{
"title": "parcel-plugin-svelte",
+ "npm": "parcel-plugin-svelte",
"category": "Bundler Plugins",
"description": "A Parcel v1 plugin that enables Svelte support",
"repository": "https://github.com/DeMoorJasper/parcel-plugin-svelte",
@@ -50,6 +57,7 @@
},
{
"title": "sveltify",
+ "npm": "sveltify",
"category": "Bundler Plugins",
"description": "Browserify transform for Svelte",
"repository": "https://github.com/tehshrike/sveltify",
@@ -57,6 +65,7 @@
},
{
"title": "gulp-svelte",
+ "npm": "gulp-svelte",
"category": "Bundler Plugins",
"description": "A gulp 4 plugin to compile Svelte template to vanilla JavaScript",
"repository": "https://github.com/shinnn/gulp-svelte",
@@ -71,6 +80,7 @@
},
{
"title": "sveltejs-brunch",
+ "npm": "sveltejs-brunch",
"category": "Bundler Plugins",
"description": "Compile Svelte components inside Brunch projects",
"repository": "https://github.com/StarpTech/sveltejs-brunch",
@@ -92,6 +102,7 @@
},
{
"title": "svelte-preprocess",
+ "npm": "svelte-preprocess",
"category": "Preprocessors",
"description": "A ✨ magical ✨ Svelte preprocessor with sensible defaults and support for: PostCSS, SCSS, Less, Stylus, Coffeescript, TypeScript, Pug and much more",
"repository": "https://github.com/sveltejs/svelte-preprocess",
@@ -119,6 +130,7 @@
},
{
"title": "svelte-preprocess-less",
+ "npm": "svelte-preprocess-less",
"category": "Preprocessors",
"description": "Svelte preprocessor for less",
"repository": "https://github.com/ls-age/svelte-preprocess-less",
@@ -133,6 +145,7 @@
},
{
"title": "modular-css",
+ "npm": "@modular-css/svelte",
"category": "Preprocessors",
"description": "Svelte preprocessor support for modular-css",
"repository": "https://github.com/tivac/modular-css/tree/main/packages/svelte",
@@ -140,6 +153,7 @@
},
{
"title": "svelte-preprocess-sass",
+ "npm": "svelte-preprocess-sass",
"category": "Preprocessors",
"description": "Svelte preprocessor for sass",
"repository": "https://github.com/ls-age/svelte-preprocess-sass",
@@ -147,6 +161,7 @@
},
{
"title": "svelte-preprocess-css-hash",
+ "npm": "svelte-preprocess-css-hash",
"category": "Preprocessors",
"description": "Passing hashed css class name to child component. It is used to avoid class name conflicts.",
"repository": "https://github.com/jiangfengming/svelte-preprocess-css-hash",
@@ -154,6 +169,7 @@
},
{
"title": "svelte-preprocess-html-asset",
+ "npm": "svelte-preprocess-html-asset",
"category": "Preprocessors",
"description": "Transform html asset relative path. Works with snowpack & webpack 5.",
"repository": "https://github.com/jiangfengming/svelte-preprocess-html-asset",
@@ -161,6 +177,7 @@
},
{
"title": "svelte-preprocessor-fetch",
+ "npm": "svelte-preprocessor-fetch",
"category": "Preprocessors",
"description": "A preprocessor for Svelte can be used to fetch data before the component is compiled.",
"repository": "https://github.com/kevmodrome/svelte-preprocessor-fetch",
@@ -168,6 +185,7 @@
},
{
"title": "prettier-plugin-svelte",
+ "npm": "prettier-plugin-svelte",
"category": "Linting and Formatting",
"description": "Format your svelte components using prettier.",
"repository": "https://github.com/sveltejs/prettier-plugin-svelte",
@@ -175,6 +193,7 @@
},
{
"title": "svelte-check",
+ "npm": "svelte-check",
"category": "Linting and Formatting",
"description": "Detects unused css. Adds Svelte A11y hints. Provides JavaScript/TypeScript diagnostics.",
"repository": "https://github.com/sveltejs/language-tools/tree/master/packages/svelte-check",