upgrade nextjs, preact, mdx-bundler, esbuild

This commit is contained in:
Timothy Lin 2021-12-04 16:56:54 +08:00
parent 4b30668f74
commit 1789efadc9
6 changed files with 2490 additions and 2049 deletions

View file

@ -6,24 +6,10 @@ module.exports = {
node: true, node: true,
es6: true, es6: true,
}, },
extends: [ extends: ['eslint:recommended', 'plugin:prettier/recommended', 'next', 'next/core-web-vitals'],
'eslint:recommended',
'plugin:jsx-a11y/recommended',
'plugin:prettier/recommended',
'next',
'next/core-web-vitals',
],
rules: { rules: {
'prettier/prettier': 'error', 'prettier/prettier': 'error',
'react/react-in-jsx-scope': 'off', 'react/react-in-jsx-scope': 'off',
'jsx-a11y/anchor-is-valid': [
'error',
{
components: ['Link'],
specialLink: ['hrefLeft', 'hrefRight'],
aspects: ['invalidHref', 'preferButton'],
},
],
'react/prop-types': 0, 'react/prop-types': 0,
'no-unused-vars': 0, 'no-unused-vars': 0,
'react/no-unescaped-entities': 0, 'react/no-unescaped-entities': 0,

View file

@ -153,6 +153,18 @@ function fancyAlert(arg) {
} }
``` ```
## Footnotes
```
Here is a simple footnote[^1]. With some additional text after it.
[^1]: My reference.
```
Here is a simple footnote[^1]. With some additional text after it.
[^1]: My reference.
## Task Lists ## Task Lists
``` ```

View file

@ -56,7 +56,8 @@ export async function getFileBySlug(type, slug) {
// Parsing frontmatter here to pass it in as options to rehype plugin // Parsing frontmatter here to pass it in as options to rehype plugin
const { data: frontmatter } = matter(source) const { data: frontmatter } = matter(source)
const { code } = await bundleMDX(source, { const { code } = await bundleMDX({
source,
// mdx imports can be automatically source from the components directory // mdx imports can be automatically source from the components directory
cwd: path.join(root, 'components'), cwd: path.join(root, 'components'),
xdmOptions(options) { xdmOptions(options) {

View file

@ -30,6 +30,7 @@ module.exports = withBundleAnalyzer({
if (!dev && !isServer) { if (!dev && !isServer) {
// Replace React with Preact only in client production build // Replace React with Preact only in client production build
Object.assign(config.resolve.alias, { Object.assign(config.resolve.alias, {
'react/jsx-runtime.js': 'preact/compat/jsx-runtime',
react: 'preact/compat', react: 'preact/compat',
'react-dom/test-utils': 'preact/test-utils', 'react-dom/test-utils': 'preact/test-utils',
'react-dom': 'preact/compat', 'react-dom': 'preact/compat',

4484
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -16,40 +16,39 @@
"@tailwindcss/forms": "^0.3.2", "@tailwindcss/forms": "^0.3.2",
"@tailwindcss/typography": "^0.4.0", "@tailwindcss/typography": "^0.4.0",
"autoprefixer": "^10.2.5", "autoprefixer": "^10.2.5",
"esbuild": "^0.12.15", "esbuild": "^0.13.13",
"github-slugger": "^1.3.0", "github-slugger": "^1.3.0",
"gray-matter": "^4.0.2", "gray-matter": "^4.0.2",
"image-size": "1.0.0", "image-size": "1.0.0",
"mdx-bundler": "^6.0.1", "mdx-bundler": "^8.0.0",
"next": "12.0.3", "next": "12.0.5",
"next-themes": "^0.0.14", "next-themes": "^0.0.14",
"postcss": "^8.3.5", "postcss": "^8.3.5",
"preact": "10.5.15", "preact": "^10.6.2",
"react": "17.0.2", "react": "17.0.2",
"react-dom": "17.0.2", "react-dom": "17.0.2",
"reading-time": "1.3.0", "reading-time": "1.3.0",
"rehype-autolink-headings": "^6.0.0", "rehype-autolink-headings": "^6.1.0",
"rehype-citation": "^0.1.1", "rehype-citation": "^0.1.1",
"rehype-katex": "^6.0.0", "rehype-katex": "^6.0.2",
"rehype-prism-plus": "^1.1.3", "rehype-prism-plus": "^1.1.3",
"rehype-slug": "^5.0.0", "rehype-slug": "^5.0.0",
"remark-footnotes": "^4.0.0", "remark-footnotes": "^4.0.1",
"remark-gfm": "^2.0.0", "remark-gfm": "^3.0.1",
"remark-math": "^5.0.0", "remark-math": "^5.1.1",
"sharp": "^0.28.3", "sharp": "^0.28.3",
"smoothscroll-polyfill": "^0.4.4", "smoothscroll-polyfill": "^0.4.4",
"tailwindcss": "^2.2.2", "tailwindcss": "^2.2.2",
"unist-util-visit": "^4.0.0" "unist-util-visit": "^4.0.0"
}, },
"devDependencies": { "devDependencies": {
"@next/bundle-analyzer": "12.0.3", "@next/bundle-analyzer": "12.0.5",
"@svgr/webpack": "^5.5.0", "@svgr/webpack": "^5.5.0",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
"dedent": "^0.7.0", "dedent": "^0.7.0",
"eslint": "^7.29.0", "eslint": "^7.29.0",
"eslint-config-next": "12.0.3", "eslint-config-next": "12.0.5",
"eslint-config-prettier": "^8.3.0", "eslint-config-prettier": "^8.3.0",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-prettier": "^3.3.1", "eslint-plugin-prettier": "^3.3.1",
"file-loader": "^6.0.0", "file-loader": "^6.0.0",
"globby": "11.0.3", "globby": "11.0.3",