downgraded

This commit is contained in:
tonyrewin 2022-10-04 14:38:57 +03:00
parent fc26e25cf0
commit 673b4bf26b
5 changed files with 20 additions and 34 deletions

View File

@ -9,6 +9,7 @@ import { markdownOptions as markdown } from './mdx.config'
import type { CSSOptions } from 'vite' import type { CSSOptions } from 'vite'
import defaultGenerateScopedName from 'postcss-modules/build/generateScopedName' import defaultGenerateScopedName from 'postcss-modules/build/generateScopedName'
import { isDev } from './src/utils/config' import { isDev } from './src/utils/config'
import { fileURLToPath, URL } from 'url'
const PATH_PREFIX = '/src/' const PATH_PREFIX = '/src/'
@ -62,7 +63,8 @@ const astroConfig: AstroUserConfig = {
}, },
resolve: { resolve: {
alias: { alias: {
'@': './src' './runtimeConfig': './runtimeConfig.browser',
'@': fileURLToPath(new URL('src', import.meta.url))
} }
}, },
css css

View File

@ -1,26 +1,34 @@
import type { AstroUserConfig } from 'astro' import type { AstroUserConfig } from 'astro'
import type { RehypePlugin } from '@astrojs/markdown-remark'
import { selectAll } from 'hast-util-select' import { selectAll } from 'hast-util-select'
import rehypeToc from '@jsdevtools/rehype-toc'
import rehypeAutolinkHeadings from 'rehype-autolink-headings'
import rehypeSlug from 'rehype-slug'
import remarkCodeTitles from 'remark-code-titles'
const write = const write =
(cl) => (cl) =>
({ properties }) => { ({ properties }) => {
properties.className = properties.className ? properties.className + ' ' + cl : cl properties.className = properties.className ? properties.className + ' ' + cl : cl
} }
const adder = ([selector, className]) => { const adder = ([selector, className]) => {
const writer = write(className) const writer = write(className)
return (node) => selectAll(selector, node).forEach((el) => writer(el as any)) return (node) => selectAll(selector, node).forEach((el) => writer(el as any))
} }
const addClasses = (additions) => { const addClasses = (additions) => {
const adders = Object.entries(additions).map((entry) => adder(entry)) const adders = Object.entries(additions).map((entry) => adder(entry))
return (node) => adders.forEach((a) => a(node)) return (node) => adders.forEach((a) => a(node))
} }
export const markdownOptions: AstroUserConfig['markdown'] = { export const markdownOptions: AstroUserConfig['markdown'] = {
// remarkPlugins: ['remark-code-titles'], remarkPlugins: [remarkCodeTitles],
rehypePlugins: [ rehypePlugins: [
// 'rehype-slug', rehypeSlug,
// ['rehype-autolink-headings', { behavior: 'prepend' }], [rehypeToc as RehypePlugin<any[]>, { headings: ['h1', 'h2', 'h3'] }],
// ['rehype-toc', { headings: ['h2', 'h3'] }], [rehypeAutolinkHeadings, { behavior: 'prepend' }],
[addClasses, { 'h1,h2,h3': 'title' }] [addClasses, { 'h1,h2,h3': 'title' }]
] ],
extendDefaultPlugins: true
} }

View File

@ -29,6 +29,7 @@
}, },
"dependencies": { "dependencies": {
"@aws-sdk/client-s3": "^3.178.0", "@aws-sdk/client-s3": "^3.178.0",
"@jsdevtools/rehype-toc": "^3.0.2",
"@nanostores/persistent": "^0.7.0", "@nanostores/persistent": "^0.7.0",
"@nanostores/router": "^0.7.0", "@nanostores/router": "^0.7.0",
"@nanostores/solid": "^0.3.0", "@nanostores/solid": "^0.3.0",
@ -40,7 +41,6 @@
"postcss-modules": "^5.0.0", "postcss-modules": "^5.0.0",
"rehype-autolink-headings": "^6.1.1", "rehype-autolink-headings": "^6.1.1",
"rehype-slug": "^5.0.1", "rehype-slug": "^5.0.1",
"rehype-toc": "^3.0.2",
"remark-code-titles": "^0.1.2" "remark-code-titles": "^0.1.2"
}, },
"devDependencies": { "devDependencies": {

View File

@ -1,24 +1,7 @@
{ {
"extends": "astro/tsconfigs/strict",
"compilerOptions": { "compilerOptions": {
"allowSyntheticDefaultImports": true,
"importsNotUsedAsValues": "error",
// Solid specific settings
"jsx": "preserve", "jsx": "preserve",
"jsxImportSource": "solid-js", "jsxImportSource": "solid-js"
// Enable top-level await and other modern ESM features.
"target": "ESNext",
"module": "ESNext",
// Enable node-style module resolution, for things like npm package imports.
"moduleResolution": "node",
// Enable JSON imports.
"resolveJsonModule": true,
// Enable stricter transpilation for better output.
"isolatedModules": true,
// Astro will directly run your TypeScript code, no transpilation needed.
"noEmit": true,
"skipLibCheck": true
},
"paths": {
"@": ["./src"]
} }
} }

View File

@ -2353,7 +2353,7 @@
"@jridgewell/resolve-uri" "^3.0.3" "@jridgewell/resolve-uri" "^3.0.3"
"@jridgewell/sourcemap-codec" "^1.4.10" "@jridgewell/sourcemap-codec" "^1.4.10"
"@jsdevtools/rehype-toc@3.0.2": "@jsdevtools/rehype-toc@^3.0.2":
version "3.0.2" version "3.0.2"
resolved "https://registry.yarnpkg.com/@jsdevtools/rehype-toc/-/rehype-toc-3.0.2.tgz#29c32e6b40cd4b5dafd96cb90d5057ac5dab4a51" resolved "https://registry.yarnpkg.com/@jsdevtools/rehype-toc/-/rehype-toc-3.0.2.tgz#29c32e6b40cd4b5dafd96cb90d5057ac5dab4a51"
integrity sha512-n5JEf16Wr4mdkRMZ8wMP/wN9/sHmTjRPbouXjJH371mZ2LEGDl72t8tEsMRNFerQN/QJtivOxqK1frdGa4QK5Q== integrity sha512-n5JEf16Wr4mdkRMZ8wMP/wN9/sHmTjRPbouXjJH371mZ2LEGDl72t8tEsMRNFerQN/QJtivOxqK1frdGa4QK5Q==
@ -9818,13 +9818,6 @@ rehype-stringify@^9.0.0, rehype-stringify@^9.0.3:
hast-util-to-html "^8.0.0" hast-util-to-html "^8.0.0"
unified "^10.0.0" unified "^10.0.0"
rehype-toc@^3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/rehype-toc/-/rehype-toc-3.0.2.tgz#0373e2abafddeb0606ee38229ff6714da6d86d68"
integrity sha512-DMt376+4i1KJGgHJL7Ezd65qKkJ7Eqp6JSB47BJ90ReBrohI9ufrornArM6f4oJjP2E2DVZZHufWucv/9t7GUQ==
dependencies:
"@jsdevtools/rehype-toc" "3.0.2"
rehype@^12.0.1: rehype@^12.0.1:
version "12.0.1" version "12.0.1"
resolved "https://registry.yarnpkg.com/rehype/-/rehype-12.0.1.tgz#68a317662576dcaa2565a3952e149d6900096bf6" resolved "https://registry.yarnpkg.com/rehype/-/rehype-12.0.1.tgz#68a317662576dcaa2565a3952e149d6900096bf6"