diff --git a/.changeset/sweet-bikes-reflect.md b/.changeset/sweet-bikes-reflect.md
new file mode 100644
index 0000000000..22604e3cfc
--- /dev/null
+++ b/.changeset/sweet-bikes-reflect.md
@@ -0,0 +1,7 @@
+---
+'nextra': patch
+'nextra-theme-blog': patch
+'nextra-theme-docs': patch
+---
+
+refresh build system with tsup and fix nextra type
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 937b3c0748..1b11ea130b 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -31,3 +31,9 @@ jobs:
- name: Test
run: pnpm test
+
+ - name: clean
+ run: pnpm clean
+
+ - name: Build
+ run: pnpm build
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index d931e76fff..3d2ed7c9ff 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -27,7 +27,10 @@ jobs:
- name: Install Dependencies
run: pnpm i
-
+
+ - name: Clean
+ run: pnpm clean
+
- name: Build
run: pnpm build
diff --git a/examples/blog/next-env.d.ts b/examples/blog/next-env.d.ts
new file mode 100644
index 0000000000..4f11a03dc6
--- /dev/null
+++ b/examples/blog/next-env.d.ts
@@ -0,0 +1,5 @@
+///
+///
+
+// NOTE: This file should not be edited
+// see https://nextjs.org/docs/basic-features/typescript for more information.
diff --git a/examples/blog/package.json b/examples/blog/package.json
index ac7fca3226..098a4150d5 100644
--- a/examples/blog/package.json
+++ b/examples/blog/package.json
@@ -8,7 +8,8 @@
"build": "next build",
"start": "next start",
"debug": "NODE_OPTIONS='--inspect' next dev",
- "vercel-build": "yarn workspace nextra run build && yarn workspace nextra-theme-docs run build && yarn build"
+ "vercel-build": "yarn workspace nextra run build && yarn workspace nextra-theme-docs run build && yarn build",
+ "clean": "rimraf .next .turbo"
},
"dependencies": {
"gray-matter": "^4.0.2",
diff --git a/examples/docs/package.json b/examples/docs/package.json
index 177029a591..c755af9836 100644
--- a/examples/docs/package.json
+++ b/examples/docs/package.json
@@ -8,7 +8,8 @@
"build": "next build",
"start": "next start",
"debug": "NODE_OPTIONS='--inspect' next dev",
- "vercel-build": "yarn workspace nextra run build && yarn workspace nextra-theme-docs run build && yarn build"
+ "vercel-build": "yarn workspace nextra run build && yarn workspace nextra-theme-docs run build && yarn build",
+ "clean": "rimraf .next .turbo"
},
"dependencies": {
"prism-react-renderer": "^1.1.1",
diff --git a/examples/docs/src/pages/themes/docs/configuration.mdx b/examples/docs/src/pages/themes/docs/configuration.mdx
index 101e8299ac..dc55b80617 100644
--- a/examples/docs/src/pages/themes/docs/configuration.mdx
+++ b/examples/docs/src/pages/themes/docs/configuration.mdx
@@ -238,25 +238,6 @@ export default {
}
```
-
-
## `footer`
Specifies if the footer should be shown.
diff --git a/examples/docs/src/pages/themes/docs/index.mdx b/examples/docs/src/pages/themes/docs/index.mdx
index c874120fa1..a2457e2718 100644
--- a/examples/docs/src/pages/themes/docs/index.mdx
+++ b/examples/docs/src/pages/themes/docs/index.mdx
@@ -9,17 +9,41 @@ you can install the blog theme with the following commands:
1. Install Next.js, Nextra and React
- ```bash npm i react react-dom next nextra ```
- ```bash yarn add react react-dom next nextra ```
- ```bash pnpm i react react-dom next nextra ```
+
+ ```bash
+ npm i react react-dom next nextra
+ ```
+
+
+ ```bash
+ yarn add react react-dom next nextra
+ ```
+
+
+ ```bash
+ pnpm i react react-dom next nextra
+ ```
+
2. Install the docs theme
- ```bash npm i nextra-theme-docs ```
- ```bash yarn add nextra-theme-docs ```
- ```bash pnpm i nextra-theme-docs ```
+
+ ```bash
+ npm i nextra-theme-docs
+ ```
+
+
+ ```bash
+ yarn add nextra-theme-docs
+ ```
+
+
+ ```bash
+ pnpm i nextra-theme-docs
+ ```
+
3. Create the following Next.js config and theme config under the root directory:
diff --git a/examples/swr-site/package.json b/examples/swr-site/package.json
index e265025c60..6078594c4e 100644
--- a/examples/swr-site/package.json
+++ b/examples/swr-site/package.json
@@ -6,7 +6,8 @@
"dev": "next",
"start": "next start",
"build": "next build",
- "debug": "NODE_OPTIONS='--inspect' next dev"
+ "debug": "NODE_OPTIONS='--inspect' next dev",
+ "clean": "rimraf .next .turbo"
},
"author": "Shu Ding",
"license": "Apache-2.0",
diff --git a/package.json b/package.json
index e4e42b8989..b7090d21b6 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
"private": true,
"scripts": {
"dev": "turbo run dev",
- "build": "turbo run build types --filter=\"nextra*\"",
+ "build": "turbo run build:tailwind build --filter=\"nextra*\"",
"types": "turbo run types",
"dev:core": "turbo run dev --filter=\"nextra\"",
"dev:theme-blog": "turbo run dev --filter=\"blog\" --include-dependencies",
@@ -10,9 +10,12 @@
"build:core": "pnpm run build --filter=\"nextra\"",
"build:theme-blog": "pnpm run build --filter=\"nextra-theme-blog\"",
"build:theme-docs": "pnpm run build --filter=\"nextra-theme-docs\"",
+ "build:all": "turbo run build:tailwind build",
"version": "changeset version",
"release": "changeset publish",
- "test": "turbo run test"
+ "test": "turbo run test",
+ "clean": "turbo run clean",
+ "format": "prettier --write ./**/*.{ts,tsx}"
},
"devDependencies": {
"@changesets/cli": "^2.23.2",
@@ -24,7 +27,6 @@
"autoprefixer": "^10.4.7",
"concurrently": "^7.0.0",
"cssnano": "^4.1.11",
- "esbuild": "^0.14.10",
"next": "^12.2.2",
"postcss": "^8.4.14",
"postcss-cli": "^8.3.1",
@@ -32,10 +34,11 @@
"prettier-plugin-tailwindcss": "^0.1.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
+ "rimraf": "^3.0.2",
"tailwindcss": "^3.1.5",
- "vitest": "^0.18.1",
"turbo": "^1.3.4",
- "typescript": "^4.7.4"
+ "typescript": "^4.7.4",
+ "vitest": "^0.18.1"
},
"prettier": {
"semi": false,
diff --git a/packages/nextra-theme-blog/package.json b/packages/nextra-theme-blog/package.json
index 0eb211dfe8..0162761e51 100644
--- a/packages/nextra-theme-blog/package.json
+++ b/packages/nextra-theme-blog/package.json
@@ -2,7 +2,6 @@
"name": "nextra-theme-blog",
"version": "2.0.0-beta.9",
"description": "A Nextra theme for blogs.",
- "main": "index.js",
"repository": "https://github.com/shuding/nextra",
"author": "Shu Ding ",
"license": "MIT",
@@ -11,22 +10,24 @@
"index.js",
"style.css"
],
- "types": "./dist/types.d.ts",
+ "types": "./dist/index.d.ts",
"exports": {
"./style.css": "./style.css",
".": {
- "import": "./dist/index.js"
+ "import": "./dist/index.mjs",
+ "module": "./dist/index.mjs",
+ "types": "./dist/index.d.ts"
}
},
"scripts": {
- "build": "pnpm build:layout & pnpm build:tailwind",
- "build:layout": "node scripts/build.js",
+ "build": "tsup",
"build:tailwind": "cross-env NODE_ENV=production pnpm postcss src/styles.css -o style.css --verbose",
- "types": "tsc -p tsconfig.types.json",
+ "types": "tsup --dts-only",
"dev": "concurrently \"pnpm dev:layout\" \"pnpm dev:tailwind\"",
- "dev:layout": "node scripts/dev.js",
+ "dev:layout": "tsup --watch",
"dev:tailwind": "cross-env TAILWIND_MODE=watch pnpm postcss src/styles.css -o style.css --watch",
- "prepublishOnly": "rm -rf dist && pnpm build && pnpm types"
+ "prepublishOnly": "pnpm build",
+ "clean": "rimraf ./dist ./style.css"
},
"dependencies": {
"@mdx-js/react": "^2.1.2",
@@ -41,6 +42,7 @@
"devDependencies": {
"cross-env": "^7.0.2",
"nextra": "workspace:*",
- "@types/react": "^17.0.39"
+ "@types/react": "^17.0.39",
+ "tsup": "^6.1.3"
}
-}
+}
\ No newline at end of file
diff --git a/packages/nextra-theme-blog/scripts/build.js b/packages/nextra-theme-blog/scripts/build.js
deleted file mode 100644
index 2aff355c5a..0000000000
--- a/packages/nextra-theme-blog/scripts/build.js
+++ /dev/null
@@ -1,19 +0,0 @@
-const esbuild = require('esbuild')
-const package = require('../package.json')
-
-esbuild.buildSync({
- entryPoints: ['src/index.tsx'],
- format: 'esm',
- bundle: true,
- loader: {
- '.js': 'jsx'
- },
- platform: 'node',
- outdir: 'dist',
- color: true,
- target: 'es2016',
- external: [
- ...Object.keys(package.dependencies),
- ...Object.keys(package.peerDependencies || {})
- ]
-})
diff --git a/packages/nextra-theme-blog/scripts/dev.js b/packages/nextra-theme-blog/scripts/dev.js
deleted file mode 100644
index 090bcb5ed3..0000000000
--- a/packages/nextra-theme-blog/scripts/dev.js
+++ /dev/null
@@ -1,27 +0,0 @@
-const esbuild = require('esbuild')
-const package = require('../package.json')
-
-console.log('Watching...')
-
-esbuild.build({
- entryPoints: ['src/index.tsx'],
- format: 'esm',
- bundle: true,
- loader: {
- '.js': 'jsx'
- },
- platform: 'node',
- outdir: 'dist',
- color: true,
- target: 'es2016',
- watch: {
- onRebuild(error) {
- if (error) console.error('Watch build failed:', error)
- else console.log('Watch build succeeded.')
- }
- },
- external: [
- ...Object.keys(package.dependencies),
- ...Object.keys(package.peerDependencies || {})
- ]
-})
diff --git a/packages/nextra-theme-blog/src/index.tsx b/packages/nextra-theme-blog/src/index.tsx
index 5ba0cd5e8a..295131d90a 100644
--- a/packages/nextra-theme-blog/src/index.tsx
+++ b/packages/nextra-theme-blog/src/index.tsx
@@ -8,7 +8,6 @@ import { ReactCusdis } from 'react-cusdis'
import Meta from './meta'
import Nav from './nav'
import MDXTheme, { HeadingContext } from './mdx-theme'
-
import traverse from './utils/traverse'
import getTags from './utils/get-tags'
import sortDate from './utils/sort-date'
@@ -162,6 +161,7 @@ const BlogLayout = ({
{pageTitle && {pageTitle}
}
{type === 'post' ? (
+ // @ts-expect-error
) : (
@@ -200,5 +200,5 @@ const createLayout = (opts: PageOpt, _config: NextraBlogTheme) => {
Page.getLayout = Layout
return Page
}
-
+export * from './types'
export default createLayout
diff --git a/packages/nextra-theme-blog/src/meta.tsx b/packages/nextra-theme-blog/src/meta.tsx
index 2f5db2093c..e79e63b224 100644
--- a/packages/nextra-theme-blog/src/meta.tsx
+++ b/packages/nextra-theme-blog/src/meta.tsx
@@ -4,11 +4,11 @@ import ThemeSwitch from './theme-switch'
import type { NextraBlogTheme } from './types'
import { split } from './utils/get-tags'
-interface MeatProps {
+interface MetaProps {
author: string
date: string
tag: string | string[]
- back: string
+ back?: string | null
config: NextraBlogTheme
}
@@ -18,7 +18,7 @@ export default function Meta({
tag,
back,
config
-}: MeatProps): ReactElement {
+}: MetaProps): ReactElement {
const tags = tag ? split(tag) : []
return (
diff --git a/packages/nextra-theme-blog/src/theme-switch.tsx b/packages/nextra-theme-blog/src/theme-switch.tsx
index e06ff8d100..1c6d3a1a12 100644
--- a/packages/nextra-theme-blog/src/theme-switch.tsx
+++ b/packages/nextra-theme-blog/src/theme-switch.tsx
@@ -1,6 +1,6 @@
import React, { useState, useEffect } from 'react'
import { useTheme } from 'next-themes'
-import { MoonIcon, SunIcon } from '../../nextra-theme-docs/src/icons'
+import { MoonIcon, SunIcon } from 'nextra/icons'
export default function ThemeSwitch() {
const { theme, setTheme, resolvedTheme } = useTheme()
diff --git a/packages/nextra-theme-blog/tsconfig.json b/packages/nextra-theme-blog/tsconfig.json
index 9741d5eee8..b92805f99f 100644
--- a/packages/nextra-theme-blog/tsconfig.json
+++ b/packages/nextra-theme-blog/tsconfig.json
@@ -2,7 +2,7 @@
"compilerOptions": {
"target": "es2016",
"module": "ESNext",
- "declaration": true,
+ "declaration": false,
"noEmit": true,
"esModuleInterop": true,
"strict": true,
diff --git a/packages/nextra-theme-blog/tsconfig.types.json b/packages/nextra-theme-blog/tsconfig.types.json
deleted file mode 100644
index a47421d9a3..0000000000
--- a/packages/nextra-theme-blog/tsconfig.types.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "compilerOptions": {
- "target": "es2016",
- "module": "ESNext",
- "declaration": true,
- "emitDeclarationOnly": true,
- "esModuleInterop": true,
- "strict": true,
- "skipLibCheck": true,
- "moduleResolution": "node",
- "jsx": "react",
- "outDir": "dist"
- },
- "files": ["src/types.ts"]
-}
diff --git a/packages/nextra-theme-blog/tsup.config.ts b/packages/nextra-theme-blog/tsup.config.ts
new file mode 100644
index 0000000000..61708434e4
--- /dev/null
+++ b/packages/nextra-theme-blog/tsup.config.ts
@@ -0,0 +1,7 @@
+import { defineConfig } from 'tsup'
+export default defineConfig({
+ entry: ['src/index.tsx'],
+ format: 'esm',
+ dts: true,
+ name: 'nextra-theme-blog'
+})
diff --git a/packages/nextra-theme-docs/package.json b/packages/nextra-theme-docs/package.json
index 31990b82af..53c74c83e1 100644
--- a/packages/nextra-theme-docs/package.json
+++ b/packages/nextra-theme-docs/package.json
@@ -2,8 +2,6 @@
"name": "nextra-theme-docs",
"version": "2.0.0-beta.9",
"description": "A Nextra theme for documentation sites.",
- "main": "index.js",
- "module": "index.js",
"repository": "https://github.com/shuding/nextra",
"author": "Shu Ding ",
"license": "MIT",
@@ -11,36 +9,59 @@
"dist",
"style.css"
],
- "types": "./dist/types.d.ts",
+ "typesVersions": {
+ "*": {
+ ".": [
+ "./dist/index.d.ts"
+ ],
+ "callout": [
+ "./dist/callout.d.ts"
+ ],
+ "bleed": [
+ "./dist/bleed.d.ts"
+ ],
+ "tabs": [
+ "./dist/tabs.d.ts"
+ ],
+ "collapse": [
+ "./dist/collapse.d.ts"
+ ]
+ }
+ },
+ "types": "./dist/index.d.ts",
"exports": {
"./style.css": "./style.css",
".": {
"import": "./dist/index.js",
- "types": "./dist/types.d.ts"
+ "types": "./dist/index.d.ts"
},
"./callout": {
- "import": "./dist/callout.js"
+ "import": "./dist/callout.js",
+ "types": "./dist/callout.d.ts"
},
"./bleed": {
- "import": "./dist/bleed.js"
+ "import": "./dist/bleed.js",
+ "types": "./dist/bleed.d.ts"
},
"./tabs": {
- "import": "./dist/components/tabs.js"
+ "import": "./dist/tabs.js",
+ "types": "./dist/tabs.d.ts"
},
"./collapse": {
- "import": "./dist/components/collapse.js"
+ "import": "./dist/collapse.js",
+ "types": "./dist/collapse.d.ts"
}
},
"scripts": {
"dev": "concurrently \"pnpm dev:layout\" \"pnpm dev:tailwind\"",
- "build": "pnpm build:tailwind && pnpm build:layout",
- "build:layout": "node scripts/build.js",
+ "build": "tsup",
"build:tailwind": "cross-env NODE_ENV=production pnpm postcss src/styles.css -o style.css --verbose",
- "types": "tsc -p tsconfig.types.json",
- "dev:layout": "node scripts/dev.js",
+ "types": "tsup --dts-only",
+ "dev:layout": "tsup --watch",
"dev:tailwind": "cross-env TAILWIND_MODE=watch pnpm postcss src/styles.css -o style.css --watch",
- "prepublishOnly": "rm -rf dist && pnpm build && pnpm types",
- "test": "vitest --run"
+ "prepublishOnly": "pnpm build",
+ "test": "vitest --run",
+ "clean": "rimraf ./dist ./style.css"
},
"dependencies": {
"@headlessui/react": "^1.6.5",
@@ -67,6 +88,7 @@
"@types/react": "^17.0.39",
"autoprefixer": "^10.2.6",
"cross-env": "^7.0.2",
- "nextra": "workspace:*"
+ "nextra": "workspace:*",
+ "tsup": "^6.1.3"
}
-}
+}
\ No newline at end of file
diff --git a/packages/nextra-theme-docs/scripts/build.js b/packages/nextra-theme-docs/scripts/build.js
deleted file mode 100644
index 955a34c984..0000000000
--- a/packages/nextra-theme-docs/scripts/build.js
+++ /dev/null
@@ -1,19 +0,0 @@
-const esbuild = require('esbuild')
-const package = require('../package.json')
-const entry = require('./entry')
-esbuild.buildSync({
- entryPoints: entry,
- format: 'esm',
- bundle: true,
- loader: {
- '.js': 'jsx'
- },
- platform: 'node',
- outdir: 'dist',
- color: true,
- target: 'es2016',
- external: [
- ...Object.keys(package.dependencies),
- ...Object.keys(package.peerDependencies || {})
- ]
-})
diff --git a/packages/nextra-theme-docs/scripts/dev.js b/packages/nextra-theme-docs/scripts/dev.js
deleted file mode 100644
index 66ef677b2a..0000000000
--- a/packages/nextra-theme-docs/scripts/dev.js
+++ /dev/null
@@ -1,27 +0,0 @@
-const esbuild = require('esbuild')
-const package = require('../package.json')
-const entry = require('./entry')
-console.log('Watching...')
-
-esbuild.build({
- entryPoints: entry,
- format: 'esm',
- bundle: true,
- loader: {
- '.js': 'jsx'
- },
- platform: 'node',
- outdir: 'dist',
- color: true,
- target: 'es2016',
- watch: {
- onRebuild(error) {
- if (error) console.error('Watch build failed:', error)
- else console.log('Watch build succeeded.')
- }
- },
- external: [
- ...Object.keys(package.dependencies),
- ...Object.keys(package.peerDependencies || {})
- ]
-})
diff --git a/packages/nextra-theme-docs/scripts/entry.js b/packages/nextra-theme-docs/scripts/entry.js
deleted file mode 100644
index edb1b604fe..0000000000
--- a/packages/nextra-theme-docs/scripts/entry.js
+++ /dev/null
@@ -1,7 +0,0 @@
-module.exports = [
- 'src/index.tsx',
- 'src/bleed.tsx',
- 'src/callout.tsx',
- 'src/components/tabs.tsx',
- 'src/components/collapse.tsx'
-]
diff --git a/packages/nextra-theme-docs/src/breadcrumb.tsx b/packages/nextra-theme-docs/src/breadcrumb.tsx
index 4dc991ec4c..f9bc7f0a5c 100644
--- a/packages/nextra-theme-docs/src/breadcrumb.tsx
+++ b/packages/nextra-theme-docs/src/breadcrumb.tsx
@@ -2,7 +2,7 @@ import React from 'react'
import Link from 'next/link'
import cn from 'classnames'
-import { ArrowRightIcon } from './icons'
+import { ArrowRightIcon } from 'nextra/icons'
import { Item } from './utils/normalize-pages'
diff --git a/packages/nextra-theme-docs/src/components/collapse.tsx b/packages/nextra-theme-docs/src/components/collapse.tsx
index 8bb1b76821..a1acc0a85e 100644
--- a/packages/nextra-theme-docs/src/components/collapse.tsx
+++ b/packages/nextra-theme-docs/src/components/collapse.tsx
@@ -9,7 +9,7 @@ export default function Collapse({
}) {
const containerRef = useRef(null)
const innerRef = useRef(null)
- const animationRef = useRef()
+ const animationRef = useRef()
const initialRender = useRef(true)
const initialState = useRef(open)
diff --git a/packages/nextra-theme-docs/src/flexsearch.js b/packages/nextra-theme-docs/src/flexsearch.jsx
similarity index 99%
rename from packages/nextra-theme-docs/src/flexsearch.js
rename to packages/nextra-theme-docs/src/flexsearch.jsx
index 93581738e5..28a5bbaf1b 100644
--- a/packages/nextra-theme-docs/src/flexsearch.js
+++ b/packages/nextra-theme-docs/src/flexsearch.jsx
@@ -15,7 +15,7 @@ import { Transition } from '@headlessui/react'
import { useConfig } from './config'
import renderComponent from './utils/render-component'
import useMenuContext from './utils/menu-context'
-import { SpinnerIcon } from './icons'
+import { SpinnerIcon } from 'nextra/icons'
const Item = ({
page,
diff --git a/packages/nextra-theme-docs/src/footer.tsx b/packages/nextra-theme-docs/src/footer.tsx
index 56cb097aac..b67bbdf408 100644
--- a/packages/nextra-theme-docs/src/footer.tsx
+++ b/packages/nextra-theme-docs/src/footer.tsx
@@ -3,7 +3,7 @@ import cn from 'classnames'
import Link from 'next/link'
import { useRouter } from 'next/router'
-import { ArrowRightIcon } from './icons'
+import { ArrowRightIcon } from 'nextra/icons'
import renderComponent from './utils/render-component'
import { useConfig } from './config'
import { Item } from './utils/normalize-pages'
diff --git a/packages/nextra-theme-docs/src/head.tsx b/packages/nextra-theme-docs/src/head.tsx
index f4510b4706..57e1b4dbce 100644
--- a/packages/nextra-theme-docs/src/head.tsx
+++ b/packages/nextra-theme-docs/src/head.tsx
@@ -4,11 +4,12 @@ import { useTheme } from 'next-themes'
import renderComponent from './utils/render-component'
import { useConfig } from './config'
+import { Meta } from './types'
interface HeadProps {
title: string
- locale?: string
- meta: Record
+ locale: string
+ meta: Meta
}
export default function Head({ title, locale, meta }: HeadProps) {
diff --git a/packages/nextra-theme-docs/src/index.tsx b/packages/nextra-theme-docs/src/index.tsx
index 67481b1eba..51f81278eb 100644
--- a/packages/nextra-theme-docs/src/index.tsx
+++ b/packages/nextra-theme-docs/src/index.tsx
@@ -29,7 +29,7 @@ function useDirectoryInfo(pageMap: PageMapItem[]) {
const fsPath = getFSRoute(asPath, locale)
return normalizePages({
list: pageMap,
- locale,
+ locale: locale ? locale : 'en-US',
defaultLocale,
route: fsPath
})
@@ -140,7 +140,7 @@ const Content: React.FC = ({
timestamp,
children
}) => {
- const { route, locale } = useRouter()
+ const { route, locale = 'en-US' } = useRouter()
const config = useConfig()
const {
@@ -273,5 +273,5 @@ const createLayout = (opts: DocsLayoutProps, config: DocsThemeConfig) => {
return Page
}
-
+export * from './types'
export default createLayout
diff --git a/packages/nextra-theme-docs/src/locale-switch.tsx b/packages/nextra-theme-docs/src/locale-switch.tsx
index b83ccb6e51..51235ebae8 100644
--- a/packages/nextra-theme-docs/src/locale-switch.tsx
+++ b/packages/nextra-theme-docs/src/locale-switch.tsx
@@ -3,7 +3,7 @@ import { useRouter } from 'next/router'
import Menu from './select'
import { DocsThemeConfig } from './types'
-import { GlobeIcon } from './icons'
+import { GlobeIcon } from 'nextra/icons'
interface LocaleSwitchProps {
options: NonNullable
diff --git a/packages/nextra-theme-docs/src/misc/default.config.tsx b/packages/nextra-theme-docs/src/misc/default.config.tsx
index 2ae6808e8c..b79d71a5cd 100644
--- a/packages/nextra-theme-docs/src/misc/default.config.tsx
+++ b/packages/nextra-theme-docs/src/misc/default.config.tsx
@@ -40,7 +40,7 @@ const defaultTheme: DocsThemeConfig = {
>
),
- searchPlaceholder({ locale }: { locale?: string }) {
+ searchPlaceholder: ({ locale }: { locale: string }) => {
if (locale === 'zh-CN') return '搜索文档...'
return 'Search documentation...'
},
diff --git a/packages/nextra-theme-docs/src/navbar.tsx b/packages/nextra-theme-docs/src/navbar.tsx
index b2c254283c..1f06b2be1e 100644
--- a/packages/nextra-theme-docs/src/navbar.tsx
+++ b/packages/nextra-theme-docs/src/navbar.tsx
@@ -10,7 +10,7 @@ import useMenuContext from './utils/menu-context'
import { useConfig } from './config'
import Search from './search'
import Flexsearch from './flexsearch'
-import { GitHubIcon, DiscordIcon, XIcon, MenuIcon } from './icons'
+import { GitHubIcon, DiscordIcon, XIcon, MenuIcon } from 'nextra/icons'
import { Item, PageItem } from './utils/normalize-pages'
interface NavBarProps {
diff --git a/packages/nextra-theme-docs/src/sidebar.tsx b/packages/nextra-theme-docs/src/sidebar.tsx
index bc395b7dbc..beb3297241 100644
--- a/packages/nextra-theme-docs/src/sidebar.tsx
+++ b/packages/nextra-theme-docs/src/sidebar.tsx
@@ -16,7 +16,7 @@ import getHeadingText from './utils/get-heading-text'
import { Item, PageItem } from './utils/normalize-pages'
import LocaleSwitch from './locale-switch'
import ThemeSwitch from './theme-switch'
-import { ArrowRightIcon } from './icons'
+import { ArrowRightIcon } from 'nextra/icons'
import Collapse from './components/collapse'
import renderComponent from './utils/render-component'
diff --git a/packages/nextra-theme-docs/src/theme-switch.tsx b/packages/nextra-theme-docs/src/theme-switch.tsx
index 5132401dcf..4c4925715b 100644
--- a/packages/nextra-theme-docs/src/theme-switch.tsx
+++ b/packages/nextra-theme-docs/src/theme-switch.tsx
@@ -2,7 +2,7 @@ import React, { memo } from 'react'
import { useTheme } from 'next-themes'
import Menu from './select'
-import { SunIcon, MoonIcon } from './icons'
+import { SunIcon, MoonIcon } from 'nextra/icons'
function ThemeSwitch({ lite = true }) {
const { theme, setTheme, systemTheme } = useTheme()
diff --git a/packages/nextra-theme-docs/src/toc.tsx b/packages/nextra-theme-docs/src/toc.tsx
index 322c0b07cd..0f5794af60 100644
--- a/packages/nextra-theme-docs/src/toc.tsx
+++ b/packages/nextra-theme-docs/src/toc.tsx
@@ -68,7 +68,7 @@ const EditPageLink = ({
text:
| React.ReactNode
| React.FC<{
- locale?: string
+ locale: string
}>
filepath: string
}) => {
@@ -97,7 +97,7 @@ const FeedbackLink = ({
labels
}: {
repository?: string
- feedbackLink: ReactNode | React.FC<{ locale?: string }>
+ feedbackLink: ReactNode | React.FC<{ locale: string }>
filepath: string
labels?: string
}) => {
diff --git a/packages/nextra-theme-docs/src/types.ts b/packages/nextra-theme-docs/src/types.ts
index c850348a51..92ac35ef02 100644
--- a/packages/nextra-theme-docs/src/types.ts
+++ b/packages/nextra-theme-docs/src/types.ts
@@ -4,7 +4,7 @@ import { ThemeProviderProps } from 'next-themes/dist/types'
export interface DocsThemeConfig {
projectLink?: string
github?: string
- projectLinkIcon?: React.ReactNode | React.FC<{ locale?: string }>
+ projectLinkIcon?: React.ReactNode | React.FC<{ locale: string }>
docsRepositoryBase?: string
titleSuffix?:
| React.ReactNode
@@ -28,17 +28,17 @@ export interface DocsThemeConfig {
footerText?:
| React.ReactNode
| React.FC<{
- locale?: string
+ locale: string
}>
footerEditLink?:
| React.ReactNode
| React.FC<{
- locale?: string
+ locale: string
}>
logo?:
| React.ReactNode
| React.FC<{
- locale?: string
+ locale: string
}>
head?:
| React.ReactNode
@@ -55,22 +55,22 @@ export interface DocsThemeConfig {
feedbackLink?:
| React.ReactNode
| React.FC<{
- locale?: string
+ locale: string
}>
feedbackLabels?: string
customSearch?: React.ReactNode | false
- searchPlaceholder?: string | ((props: { locale?: string }) => string)
+ searchPlaceholder?: string | ((props: { locale: string }) => string)
projectChatLink?: string
- projectChatLinkIcon?: React.FC<{ locale?: string }>
+ projectChatLinkIcon?: React.FC<{ locale: string }>
sidebarSubtitle?: React.FC<{ title: string }>
- banner?: React.FC<{ locale?: string }>
+ banner?: React.FC<{ locale: string }>
bannerKey?: string
- gitTimestamp?: string | React.FC<{ locale?: string; timestamp: Date }>
- tocExtraContent?: React.FC<{ locale?: string }>
+ gitTimestamp?: string | React.FC<{ locale: string; timestamp: Date }>
+ tocExtraContent?: React.FC<{ locale: string }>
unstable_searchResultEmpty?:
| React.ReactNode
| React.FC<{
- locale?: string
+ locale: string
}>
}
diff --git a/packages/nextra-theme-docs/src/utils/normalize-pages.tsx b/packages/nextra-theme-docs/src/utils/normalize-pages.tsx
index ce2ae4f894..d821357fad 100644
--- a/packages/nextra-theme-docs/src/utils/normalize-pages.tsx
+++ b/packages/nextra-theme-docs/src/utils/normalize-pages.tsx
@@ -59,7 +59,7 @@ export default function normalizePages({
pageThemeContext = defaultThemeContext
}: {
list: PageMapItem[]
- locale?: string
+ locale: string
defaultLocale?: string
route: string
docsRoot?: string
diff --git a/packages/nextra-theme-docs/tsconfig.json b/packages/nextra-theme-docs/tsconfig.json
index 9741d5eee8..b92805f99f 100644
--- a/packages/nextra-theme-docs/tsconfig.json
+++ b/packages/nextra-theme-docs/tsconfig.json
@@ -2,7 +2,7 @@
"compilerOptions": {
"target": "es2016",
"module": "ESNext",
- "declaration": true,
+ "declaration": false,
"noEmit": true,
"esModuleInterop": true,
"strict": true,
diff --git a/packages/nextra-theme-docs/tsconfig.types.json b/packages/nextra-theme-docs/tsconfig.types.json
deleted file mode 100644
index 2613ed3cbf..0000000000
--- a/packages/nextra-theme-docs/tsconfig.types.json
+++ /dev/null
@@ -1,20 +0,0 @@
-{
- "compilerOptions": {
- "target": "es2016",
- "module": "ESNext",
- "declaration": true,
- "emitDeclarationOnly": true,
- "esModuleInterop": true,
- "strict": true,
- "skipLibCheck": true,
- "moduleResolution": "node",
- "jsx": "react",
- "outDir": "dist"
- },
- "files": [
- "src/bleed.tsx",
- "src/callout.tsx",
- "src/types.ts",
- "src/components/tabs.tsx"
- ]
-}
diff --git a/packages/nextra-theme-docs/tsup.config.ts b/packages/nextra-theme-docs/tsup.config.ts
new file mode 100644
index 0000000000..ebf067dbc8
--- /dev/null
+++ b/packages/nextra-theme-docs/tsup.config.ts
@@ -0,0 +1,37 @@
+import { defineConfig } from 'tsup'
+
+function outExtension() {
+ return {
+ js: `.js`
+ }
+}
+export default defineConfig([
+ {
+ entry: ['src/bleed.tsx', 'src/callout.tsx'],
+ format: 'esm',
+ outExtension,
+ dts: true,
+ name: 'nextra-theme-docs/components'
+ },
+ {
+ entry: ['src/index.tsx'],
+ format: 'esm',
+ outExtension,
+ dts: true,
+ name: 'nextra-theme-docs'
+ },
+ {
+ entry: ['src/components/tabs.tsx'],
+ format: 'esm',
+ outExtension,
+ dts: true,
+ name: 'nextra-theme-docs/tabs'
+ },
+ {
+ entry: ['src/components/collapse.tsx'],
+ format: 'esm',
+ outExtension,
+ dts: true,
+ name: 'nextra-theme-docs/collapse'
+ }
+])
diff --git a/packages/nextra/package.json b/packages/nextra/package.json
index 369eef8d98..4c41880c9f 100644
--- a/packages/nextra/package.json
+++ b/packages/nextra/package.json
@@ -2,29 +2,74 @@
"name": "nextra",
"version": "2.0.0-beta.9",
"description": "Next.js and MDX based site generator.",
- "main": "index.js",
"files": [
"dist/*",
+ "icons/*",
"loader.js"
],
+ "types": "./dist/types.d.ts",
+ "main": "./dist/index.js",
+ "typesVersions": {
+ "*": {
+ ".": ["./dist/types.d.ts"],
+ "compile": [
+ "./dist/compile.d.ts"
+ ],
+ "context": [
+ "./dist/context.d.ts"
+ ],
+ "data": [
+ "./dist/ssg.d.ts"
+ ],
+ "ssg": [
+ "./dist/ssg.d.ts"
+ ],
+ "locales": [
+ "./dist/locales.d.ts"
+ ],
+ "icons": [
+ "./dist/icons.d.ts"
+ ]
+ }
+ },
"exports": {
+ "./package.json": "./package.json",
".": "./dist/index.js",
- "./compile": "./dist/compile.mjs",
- "./context": "./dist/context.js",
- "./data": "./dist/ssg.js",
+ "./compile": {
+ "import": "./dist/compile.mjs",
+ "types": "./dist/compile.d.ts"
+ },
+ "./context": {
+ "import": "./dist/context.js",
+ "types": "./dist/context.d.ts"
+ },
+ "./data": {
+ "import": "./dist/ssg.js",
+ "types": "./dist/ssg.d.ts"
+ },
+ "./ssg": {
+ "import": "./dist/ssg.js",
+ "types": "./dist/ssg.d.ts"
+ },
"./loader": "./loader.js",
- "./locales": "./dist/locales.js",
- "./ssg": "./dist/ssg.js"
+ "./locales": {
+ "import": "./dist/locales.js",
+ "types": "./dist/locales.d.ts"
+ },
+ "./icons": {
+ "import": "./dist/icons.mjs",
+ "types": "./dist/icons.d.ts"
+ }
},
- "types": "./dist/types.d.ts",
"repository": "https://github.com/shuding/nextra",
"license": "MIT",
"scripts": {
- "build": "node scripts/build.js",
- "dev": "node scripts/dev.js",
- "types": "tsc --project tsconfig.type.json",
+ "build": "tsup",
+ "dev": "tsup --watch",
+ "types": "tsup --dts-only",
"test": "vitest run",
- "prepublishOnly": "rm -rf dist && pnpm build && pnpm types"
+ "prepublishOnly": "pnpm build",
+ "clean": "rimraf ./dist ./style.css"
},
"dependencies": {
"@mdx-js/mdx": "^2.1.2",
@@ -44,6 +89,7 @@
"devDependencies": {
"@types/graceful-fs": "^4.1.5",
"@types/mdast": "^3.0.10",
- "@types/webpack": "^5.28.0"
+ "@types/webpack": "^5.28.0",
+ "tsup": "^6.1.3"
}
-}
+}
\ No newline at end of file
diff --git a/packages/nextra/scripts/build.js b/packages/nextra/scripts/build.js
deleted file mode 100644
index 8c5a11010d..0000000000
--- a/packages/nextra/scripts/build.js
+++ /dev/null
@@ -1,46 +0,0 @@
-const esbuild = require('esbuild')
-const packageJson = require('../package.json')
-
-const BUILD_OPTIONS = {
- platform: 'node',
- bundle: true,
- color: true,
- target: 'es2016'
-}
-
-const externalDeps = [
- ...Object.keys(packageJson.dependencies),
- ...Object.keys(packageJson.peerDependencies || {})
-]
-
-// Build CJS entrypoints
-esbuild.buildSync({
- ...BUILD_OPTIONS,
- entryPoints: [
- 'src/index.ts',
- 'src/ssg.ts',
- 'src/locales.ts',
- 'src/context.ts'
- ],
- format: 'cjs',
- outdir: 'dist',
- external: ['next/server', ...externalDeps]
-})
-
-// Build the loader as ESM
-esbuild.buildSync({
- ...BUILD_OPTIONS,
- entryPoints: ['src/loader.ts'],
- format: 'esm',
- outfile: 'dist/loader.mjs',
- external: externalDeps.filter(d => d !== 'shiki')
-})
-
-// Build compile as ESM
-esbuild.buildSync({
- ...BUILD_OPTIONS,
- entryPoints: ['src/compile.ts'],
- format: 'esm',
- outfile: 'dist/compile.mjs',
- external: externalDeps
-})
diff --git a/packages/nextra/scripts/dev.js b/packages/nextra/scripts/dev.js
deleted file mode 100644
index 1c0a00d480..0000000000
--- a/packages/nextra/scripts/dev.js
+++ /dev/null
@@ -1,57 +0,0 @@
-const esbuild = require('esbuild')
-const packageJson = require('../package.json')
-
-console.log('[nextra] Watching...')
-
-const BUILD_OPTIONS = {
- platform: 'node',
- bundle: true,
- color: true,
- target: 'es2016',
- watch: {
- onRebuild(error) {
- if (error) {
- console.error('[nextra] Watch build failed:', error)
- } else {
- console.log('[nextra] Watch build succeeded.')
- }
- }
- }
-}
-
-const externalDeps = [
- ...Object.keys(packageJson.dependencies),
- ...Object.keys(packageJson.peerDependencies || {})
-]
-
-// Build CJS entrypoints
-esbuild.build({
- ...BUILD_OPTIONS,
- entryPoints: [
- 'src/index.ts',
- 'src/ssg.ts',
- 'src/locales.ts',
- 'src/context.ts'
- ],
- format: 'cjs',
- outdir: 'dist',
- external: ['next/server', ...externalDeps]
-})
-
-// Build the loader as ESM
-esbuild.build({
- ...BUILD_OPTIONS,
- entryPoints: ['src/loader.ts'],
- format: 'esm',
- outfile: 'dist/loader.mjs',
- external: externalDeps.filter(d => d !== 'shiki')
-})
-
-// Build compile as ESM
-esbuild.build({
- ...BUILD_OPTIONS,
- entryPoints: ['src/compile.ts'],
- format: 'esm',
- outfile: 'dist/compile.mjs',
- external: externalDeps
-})
diff --git a/packages/nextra/src/env.d.ts b/packages/nextra/src/env.d.ts
index 1917323379..3c6da8a1fa 100644
--- a/packages/nextra/src/env.d.ts
+++ b/packages/nextra/src/env.d.ts
@@ -4,6 +4,7 @@ declare module 'github-slugger' {
}
}
+
declare module globalThis {
import { PageMapItem } from './types'
var __nextra_internal__: {
diff --git a/packages/nextra/src/icons.ts b/packages/nextra/src/icons.ts
new file mode 100644
index 0000000000..996395a8d4
--- /dev/null
+++ b/packages/nextra/src/icons.ts
@@ -0,0 +1 @@
+export * from './icons/index'
\ No newline at end of file
diff --git a/packages/nextra/src/icons/arrow-right.tsx b/packages/nextra/src/icons/arrow-right.tsx
new file mode 100644
index 0000000000..9699025971
--- /dev/null
+++ b/packages/nextra/src/icons/arrow-right.tsx
@@ -0,0 +1,14 @@
+import React, { ComponentProps } from 'react'
+
+export function ArrowRightIcon(props: ComponentProps<'svg'>) {
+ return (
+
+ )
+}
diff --git a/packages/nextra/src/icons/check.tsx b/packages/nextra/src/icons/check.tsx
new file mode 100644
index 0000000000..8c49d47d8b
--- /dev/null
+++ b/packages/nextra/src/icons/check.tsx
@@ -0,0 +1,13 @@
+import React from 'react'
+
+export function CheckIcon() {
+ return (
+
+ )
+}
diff --git a/packages/nextra/src/icons/discord.tsx b/packages/nextra/src/icons/discord.tsx
new file mode 100644
index 0000000000..fec4b76697
--- /dev/null
+++ b/packages/nextra/src/icons/discord.tsx
@@ -0,0 +1,17 @@
+import React, { ReactElement } from 'react'
+
+export function DiscordIcon(): ReactElement {
+ return (
+
+ )
+}
diff --git a/packages/nextra/src/icons/github.tsx b/packages/nextra/src/icons/github.tsx
new file mode 100644
index 0000000000..76630e03df
--- /dev/null
+++ b/packages/nextra/src/icons/github.tsx
@@ -0,0 +1,16 @@
+import React, { ReactElement } from 'react'
+
+export function GitHubIcon(): ReactElement {
+ return (
+
+ )
+}
diff --git a/packages/nextra/src/icons/globe.tsx b/packages/nextra/src/icons/globe.tsx
new file mode 100644
index 0000000000..9d05c2c106
--- /dev/null
+++ b/packages/nextra/src/icons/globe.tsx
@@ -0,0 +1,13 @@
+import React, { ReactElement } from 'react'
+
+export function GlobeIcon(): ReactElement {
+ return (
+
+ )
+}
diff --git a/packages/nextra/src/icons/index.ts b/packages/nextra/src/icons/index.ts
new file mode 100644
index 0000000000..93171d51f8
--- /dev/null
+++ b/packages/nextra/src/icons/index.ts
@@ -0,0 +1,10 @@
+export * from './arrow-right'
+export * from './check'
+export * from './discord'
+export * from './github'
+export * from './globe'
+export * from './menu'
+export * from './moon'
+export * from './spinner'
+export * from './sun'
+export * from './x'
diff --git a/packages/nextra/src/icons/menu.tsx b/packages/nextra/src/icons/menu.tsx
new file mode 100644
index 0000000000..d13ebacfbc
--- /dev/null
+++ b/packages/nextra/src/icons/menu.tsx
@@ -0,0 +1,37 @@
+import React, { ReactElement } from 'react'
+
+export function MenuIcon({ className }: { className?: string }): ReactElement {
+ return (
+
+ )
+}
diff --git a/packages/nextra/src/icons/moon.tsx b/packages/nextra/src/icons/moon.tsx
new file mode 100644
index 0000000000..96eae6edb7
--- /dev/null
+++ b/packages/nextra/src/icons/moon.tsx
@@ -0,0 +1,21 @@
+import React, { ReactElement } from 'react'
+
+export function MoonIcon({ className }: { className?: string }): ReactElement {
+ return (
+
+ )
+}
diff --git a/packages/nextra/src/icons/spinner.tsx b/packages/nextra/src/icons/spinner.tsx
new file mode 100644
index 0000000000..9517dfe1ed
--- /dev/null
+++ b/packages/nextra/src/icons/spinner.tsx
@@ -0,0 +1,32 @@
+import React, { ReactElement } from 'react'
+
+export function SpinnerIcon({
+ className
+}: {
+ className?: string
+}): ReactElement {
+ return (
+
+ )
+}
diff --git a/packages/nextra/src/icons/sun.tsx b/packages/nextra/src/icons/sun.tsx
new file mode 100644
index 0000000000..24805cc979
--- /dev/null
+++ b/packages/nextra/src/icons/sun.tsx
@@ -0,0 +1,21 @@
+import React, { ReactElement } from 'react'
+
+export function SunIcon({ className }: { className?: string }): ReactElement {
+ return (
+
+ )
+}
diff --git a/packages/nextra/src/icons/x.tsx b/packages/nextra/src/icons/x.tsx
new file mode 100644
index 0000000000..0159d45438
--- /dev/null
+++ b/packages/nextra/src/icons/x.tsx
@@ -0,0 +1,20 @@
+import React, { ReactElement } from 'react'
+
+export function XIcon({ className }: { className?: string }): ReactElement {
+ return (
+
+ )
+}
diff --git a/packages/nextra/src/index.ts b/packages/nextra/src/index.js
similarity index 86%
rename from packages/nextra/src/index.ts
rename to packages/nextra/src/index.js
index 2558ad9939..b1655126db 100644
--- a/packages/nextra/src/index.ts
+++ b/packages/nextra/src/index.js
@@ -1,17 +1,16 @@
import { NextraPlugin, pageMapCache } from './plugin'
import { DEFAULT_LOCALE, MARKDOWN_EXTENSION_REGEX } from './constants'
-import { LoaderOptions, Nextra } from './types'
-const DEFAULT_EXTENSIONS = ['js', 'jsx', 'ts', 'tsx'] as const
-const MARKDOWN_EXTENSIONS = ['md', 'mdx'] as const
+const DEFAULT_EXTENSIONS = ['js', 'jsx', 'ts', 'tsx']
+const MARKDOWN_EXTENSIONS = ['md', 'mdx']
-const nextra: Nextra = (...args) =>
+const nextra = (...args) =>
function withNextra(nextConfig = {}) {
const nextraConfig =
typeof args[0] === 'string'
? {
theme: args[0],
- themeConfig: args[1] as string
+ themeConfig: args[1]
}
: args[0]
@@ -47,7 +46,7 @@ const nextra: Nextra = (...args) =>
options.defaultLoaders.babel,
{
loader: 'nextra/loader',
- options: {
+ options: {
...nextraConfig,
locales: nextConfig.i18n?.locales,
defaultLocale: nextConfig.i18n?.defaultLocale,
@@ -64,6 +63,5 @@ const nextra: Nextra = (...args) =>
return config
}
}
- }
-
+}
module.exports = nextra
diff --git a/packages/nextra/src/plugin.ts b/packages/nextra/src/plugin.ts
index 21cdb935b7..1ecee5076f 100644
--- a/packages/nextra/src/plugin.ts
+++ b/packages/nextra/src/plugin.ts
@@ -1,4 +1,4 @@
-import { NextraConfig, PageMapItem } from './types'
+import { NextraConfig, PageMapItem, NextraPluginCache } from './types'
import fs from 'graceful-fs'
import { promisify } from 'util'
import { parseFileName, parseJsonFile } from './utils'
@@ -75,7 +75,7 @@ export async function collectFiles(
}
}
-export class PageMapCache {
+class PageMapCache implements NextraPluginCache {
public cache: { items: PageMapItem[]; fileMap: Record } | null
constructor() {
diff --git a/packages/nextra/src/ssg.ts b/packages/nextra/src/ssg.ts
index 226630a967..5b087fee05 100644
--- a/packages/nextra/src/ssg.ts
+++ b/packages/nextra/src/ssg.ts
@@ -1,10 +1,10 @@
-import React, {
- ComponentClass,
+import {
createContext,
+ useContext,
+ ComponentClass,
FunctionComponent,
- useContext
+ createElement
} from 'react'
-
export const SSGContext = createContext(false)
export const useSSG = (key = 'ssg') => useContext(SSGContext)?.[key]
@@ -12,10 +12,10 @@ export const withSSG = (
Page: FunctionComponent | ComponentClass
) => {
function WithSSG(props: T) {
- return React.createElement(
+ return createElement(
SSGContext.Provider,
{ value: props },
- React.createElement(Page, props)
+ createElement(Page, props)
)
}
WithSSG.getLayout = (Page as any).getLayout
diff --git a/packages/nextra/src/types.ts b/packages/nextra/src/types.ts
index 53dbd21055..84a841fff2 100644
--- a/packages/nextra/src/types.ts
+++ b/packages/nextra/src/types.ts
@@ -2,12 +2,32 @@ import { NextConfig } from 'next'
import { Heading as MDASTHeading } from 'mdast'
import { ProcessorOptions } from '@mdx-js/mdx'
import { Options as RehypePrettyCodeOptions } from 'rehype-pretty-code'
-import { PageMapCache } from './plugin'
+
+export abstract class NextraPluginCache {
+ public cache: { items: PageMapItem[]; fileMap: Record } | null
+
+ constructor() {
+ this.cache = { items: [], fileMap: {} }
+ }
+
+ set(data: { items: PageMapItem[]; fileMap: Record }) {
+ this.cache!.items = data.items
+ this.cache!.fileMap = data.fileMap
+ }
+
+ clear() {
+ this.cache = null
+ }
+
+ get() {
+ return this.cache
+ }
+}
export interface LoaderOptions extends NextraConfig {
locales: string[]
defaultLocale: string
- pageMapCache: PageMapCache
+ pageMapCache: NextraPluginCache
}
export interface PageMapItem {
@@ -49,7 +69,7 @@ type Theme = string
export type NextraConfig = {
theme: Theme
- themeConfig: string
+ themeConfig?: string
unstable_flexsearch?: boolean | { codeblocks: boolean }
unstable_staticImage?: boolean
mdxOptions?: Pick & {
@@ -60,3 +80,7 @@ export type NextraConfig = {
export type Nextra = (
...args: [NextraConfig] | [theme: Theme, themeConfig: string]
) => (nextConfig: NextConfig) => NextConfig
+
+const nextra: Nextra = (...args) => (nextConfig) => ({})
+
+export default nextra
\ No newline at end of file
diff --git a/packages/nextra/tsconfig.type.json b/packages/nextra/tsconfig.type.json
deleted file mode 100644
index 8f20a59b36..0000000000
--- a/packages/nextra/tsconfig.type.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "compilerOptions": {
- "target": "es2016",
- "module": "ESNext",
- "declaration": true,
- "emitDeclarationOnly": true,
- "esModuleInterop": true,
- "strict": true,
- "skipLibCheck": true,
- "moduleResolution": "node",
- "outDir": "dist",
- "resolveJsonModule": true
- },
- "files": ["src/types.ts"]
-}
diff --git a/packages/nextra/tsup.config.ts b/packages/nextra/tsup.config.ts
new file mode 100644
index 0000000000..9259f633ca
--- /dev/null
+++ b/packages/nextra/tsup.config.ts
@@ -0,0 +1,41 @@
+import { defineConfig } from 'tsup'
+export default defineConfig([
+ {
+ entry: ['src/index.js'],
+ format: 'cjs',
+ name: 'nextra',
+ dts: false
+ },
+ {
+ entry: ['src/ssg.ts', 'src/locales.ts', 'src/context.ts'],
+ format: 'cjs',
+ name: 'nextra-utils',
+ external: ['next/server'],
+ dts: true
+ },
+ {
+ entry: ['src/loader.ts'],
+ format: 'esm',
+ name: 'nextra-loader',
+ dts: true
+ },
+ {
+ entry: ['src/compile.ts'],
+ format: 'esm',
+ name: 'nextra-mdx-compiler',
+ dts: true
+ },
+ {
+ entry: ['src/icons.ts'],
+ name: 'nextra-icons',
+ format: 'esm',
+ dts: true
+ },
+ {
+ entry: ['src/types.ts'],
+ name: 'nextra-types',
+ dts: {
+ only: true
+ }
+ }
+])
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 5cf077cb99..96c09a8bfa 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -13,7 +13,6 @@ importers:
autoprefixer: ^10.4.7
concurrently: ^7.0.0
cssnano: ^4.1.11
- esbuild: ^0.14.10
next: ^12.2.2
postcss: ^8.4.14
postcss-cli: ^8.3.1
@@ -21,6 +20,7 @@ importers:
prettier-plugin-tailwindcss: ^0.1.1
react: ^17.0.2
react-dom: ^17.0.2
+ rimraf: ^3.0.2
tailwindcss: ^3.1.5
turbo: ^1.3.4
typescript: ^4.7.4
@@ -35,7 +35,6 @@ importers:
autoprefixer: 10.4.7_postcss@8.4.14
concurrently: 7.2.2
cssnano: 4.1.11
- esbuild: 0.14.49
next: 12.2.2_sfoxds7t5ydpegc3knd667wn6m
postcss: 8.4.14
postcss-cli: 8.3.1_postcss@8.4.14
@@ -43,6 +42,7 @@ importers:
prettier-plugin-tailwindcss: 0.1.12_prettier@2.7.1
react: 17.0.2
react-dom: 17.0.2_react@17.0.2
+ rimraf: 3.0.2
tailwindcss: 3.1.6
turbo: 1.3.4
typescript: 4.7.4
@@ -112,6 +112,7 @@ importers:
remark-gfm: ^3.0.1
shiki: 0.10.1
slash: ^3.0.0
+ tsup: ^6.1.3
dependencies:
'@mdx-js/mdx': 2.1.2
'@napi-rs/simple-git': 0.1.8
@@ -127,6 +128,7 @@ importers:
'@types/graceful-fs': 4.1.5
'@types/mdast': 3.0.10
'@types/webpack': 5.28.0
+ tsup: 6.1.3
packages/nextra-theme-blog:
specifiers:
@@ -136,6 +138,7 @@ importers:
next-themes: ^0.2.0
nextra: workspace:*
react-cusdis: ^2.1.3
+ tsup: ^6.1.3
dependencies:
'@mdx-js/react': 2.1.2
next-themes: 0.2.0
@@ -144,6 +147,7 @@ importers:
'@types/react': 17.0.47
cross-env: 7.0.3
nextra: link:../nextra
+ tsup: 6.1.3
packages/nextra-theme-docs:
specifiers:
@@ -165,6 +169,7 @@ importers:
parse-git-url: ^1.0.1
scroll-into-view-if-needed: ^2.2.29
title: ^3.4.2
+ tsup: ^6.1.3
dependencies:
'@headlessui/react': 1.6.6
'@mdx-js/react': 2.1.2
@@ -185,6 +190,7 @@ importers:
autoprefixer: 10.4.7
cross-env: 7.0.3
nextra: link:../nextra
+ tsup: 6.1.3
packages:
@@ -1164,6 +1170,10 @@ packages:
color-convert: 2.0.1
dev: true
+ /any-promise/1.3.0:
+ resolution: {integrity: sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==}
+ dev: true
+
/anymatch/3.1.2:
resolution: {integrity: sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==}
engines: {node: '>= 8'}
@@ -1269,6 +1279,10 @@ packages:
resolution: {integrity: sha512-0xO6mYd7JB2YesxDKplafRpsiOzPt9V02ddPCLbY1xYGPOX24NTyN50qnUxgCPcSoYMhKpAuBTjQoRZCAkUDRw==}
dev: false
+ /balanced-match/1.0.2:
+ resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==}
+ dev: true
+
/better-path-resolve/1.0.0:
resolution: {integrity: sha512-pbnl5XzGBdrFU/wT4jqmJVPn2B6UHPBOhzMQkY/SPUPB6QtUXtmBHBIwCbXJol93mOpGMnQyP/+BB19q04xj7g==}
engines: {node: '>=4'}
@@ -1285,6 +1299,13 @@ packages:
resolution: {integrity: sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==}
dev: true
+ /brace-expansion/1.1.11:
+ resolution: {integrity: sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==}
+ dependencies:
+ balanced-match: 1.0.2
+ concat-map: 0.0.1
+ dev: true
+
/braces/3.0.2:
resolution: {integrity: sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==}
engines: {node: '>=8'}
@@ -1313,6 +1334,21 @@ packages:
resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==}
dev: true
+ /bundle-require/3.0.4_esbuild@0.14.49:
+ resolution: {integrity: sha512-VXG6epB1yrLAvWVQpl92qF347/UXmncQj7J3U8kZEbdVZ1ZkQyr4hYeL/9RvcE8vVVdp53dY78Fd/3pqfRqI1A==}
+ engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0}
+ peerDependencies:
+ esbuild: '>=0.13'
+ dependencies:
+ esbuild: 0.14.49
+ load-tsconfig: 0.2.3
+ dev: true
+
+ /cac/6.7.12:
+ resolution: {integrity: sha512-rM7E2ygtMkJqD9c7WnFU6fruFcN3xe4FM5yUmgxhZzIKJk4uHl9U/fhwdajGFQbQuv43FAUo1Fe8gX/oIKDeSA==}
+ engines: {node: '>=8'}
+ dev: true
+
/call-bind/1.0.2:
resolution: {integrity: sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==}
dependencies:
@@ -1544,10 +1580,19 @@ packages:
resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==}
dev: true
+ /commander/4.1.1:
+ resolution: {integrity: sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==}
+ engines: {node: '>= 6'}
+ dev: true
+
/compute-scroll-into-view/1.0.17:
resolution: {integrity: sha512-j4dx+Fb0URmzbwwMUrhqWM2BEWHdFGx+qZ9qqASHRPqvTYdqvWnHg0H1hIbcyLnvgnoNAVMlwkepyqM3DaIFUg==}
dev: false
+ /concat-map/0.0.1:
+ resolution: {integrity: sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=}
+ dev: true
+
/concurrently/7.2.2:
resolution: {integrity: sha512-DcQkI0ruil5BA/g7Xy3EWySGrFJovF5RYAYxwGvv9Jf9q9B1v3jPFP2tl6axExNf1qgF30kjoNYrangZ0ey4Aw==}
engines: {node: ^12.20.0 || ^14.13.0 || >=16.0.0}
@@ -2272,6 +2317,21 @@ packages:
strip-eof: 1.0.0
dev: false
+ /execa/5.1.1:
+ resolution: {integrity: sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==}
+ engines: {node: '>=10'}
+ dependencies:
+ cross-spawn: 7.0.3
+ get-stream: 6.0.1
+ human-signals: 2.1.0
+ is-stream: 2.0.1
+ merge-stream: 2.0.0
+ npm-run-path: 4.0.1
+ onetime: 5.1.2
+ signal-exit: 3.0.7
+ strip-final-newline: 2.0.0
+ dev: true
+
/extend-shallow/2.0.1:
resolution: {integrity: sha512-zCnTtlxNoAiDc3gqY2aYAWFx7XWWiasuF2K8Me5WbN8otHKTUKBwjPtNpRs/rbUZm7KxWAaNj7P1a/p52GbVug==}
engines: {node: '>=0.10.0'}
@@ -2391,6 +2451,10 @@ packages:
universalify: 2.0.0
dev: true
+ /fs.realpath/1.0.0:
+ resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==}
+ dev: true
+
/fsevents/2.3.2:
resolution: {integrity: sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==}
engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0}
@@ -2444,6 +2508,11 @@ packages:
engines: {node: '>=4'}
dev: false
+ /get-stream/6.0.1:
+ resolution: {integrity: sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==}
+ engines: {node: '>=10'}
+ dev: true
+
/get-symbol-description/1.0.0:
resolution: {integrity: sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==}
engines: {node: '>= 0.4'}
@@ -2474,6 +2543,17 @@ packages:
resolution: {integrity: sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==}
dev: true
+ /glob/7.1.6:
+ resolution: {integrity: sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==}
+ dependencies:
+ fs.realpath: 1.0.0
+ inflight: 1.0.6
+ inherits: 2.0.4
+ minimatch: 3.1.2
+ once: 1.4.0
+ path-is-absolute: 1.0.1
+ dev: true
+
/globby/11.1.0:
resolution: {integrity: sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==}
engines: {node: '>=10'}
@@ -2601,6 +2681,11 @@ packages:
resolution: {integrity: sha512-UNopramDEhHJD+VR+ehk8rOslwSfByxPIZyJRfV739NDhN5LF1fa1MqnzKm2lGTQRjNrjK19Q5fhkgIfjlVUKw==}
dev: true
+ /human-signals/2.1.0:
+ resolution: {integrity: sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==}
+ engines: {node: '>=10.17.0'}
+ dev: true
+
/iconv-lite/0.4.24:
resolution: {integrity: sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==}
engines: {node: '>=0.10.0'}
@@ -2630,6 +2715,17 @@ packages:
resolution: {integrity: sha512-bup+4tap3Hympa+JBJUG7XuOsdNQ6fxt0MHyXMKuLBKn0OqsTfvUxkUrroEX1+B2VsSHvCjiIcZVxRtYa4nllA==}
dev: true
+ /inflight/1.0.6:
+ resolution: {integrity: sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==}
+ dependencies:
+ once: 1.4.0
+ wrappy: 1.0.2
+ dev: true
+
+ /inherits/2.0.4:
+ resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==}
+ dev: true
+
/inline-style-parser/0.1.1:
resolution: {integrity: sha512-7NXolsK4CAS5+xvdj5OMMbI962hU/wvwoxk+LWR9Ek9bVtyuuYScDN6eS0rUm6TxApFpw7CX1o4uJzcd4AyD3Q==}
dev: false
@@ -2833,6 +2929,11 @@ packages:
engines: {node: '>=0.10.0'}
dev: false
+ /is-stream/2.0.1:
+ resolution: {integrity: sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==}
+ engines: {node: '>=8'}
+ dev: true
+
/is-string/1.0.7:
resolution: {integrity: sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==}
engines: {node: '>= 0.4'}
@@ -2877,6 +2978,11 @@ packages:
supports-color: 8.1.1
dev: true
+ /joycon/3.1.1:
+ resolution: {integrity: sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw==}
+ engines: {node: '>=10'}
+ dev: true
+
/js-tokens/4.0.0:
resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==}
@@ -2934,6 +3040,11 @@ packages:
resolution: {integrity: sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==}
dev: true
+ /load-tsconfig/0.2.3:
+ resolution: {integrity: sha512-iyT2MXws+dc2Wi6o3grCFtGXpeMvHmJqS27sMPGtV2eUu4PeFnG+33I8BlFK1t1NWMjOpcx9bridn5yxLDX2gQ==}
+ engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0}
+ dev: true
+
/load-yaml-file/0.2.0:
resolution: {integrity: sha512-OfCBkGEw4nN6JLtgRidPX6QxjBQGQf72q3si2uvqyFEMbycSFFHwAZeXx6cJgFM9wmLrf9zBwCP3Ivqa+LLZPw==}
engines: {node: '>=6'}
@@ -2984,6 +3095,10 @@ packages:
resolution: {integrity: sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==}
dev: true
+ /lodash.sortby/4.7.0:
+ resolution: {integrity: sha512-HDWXG8isMntAyRF5vZ7xKuEvOhT4AhlRt/3czTSjvGUxjYCBVRQY48ViDHyfYz9VIoBkW4TMGQNapx+l3RUwdA==}
+ dev: true
+
/lodash.startcase/4.4.0:
resolution: {integrity: sha512-+WKqsK294HMSc2jEbNgpHpd0JfIBhp7rEV4aqXWqFr6AlXov+SlcgB1Fv01y2kGe3Gc8nMW7VA0SrGuSkRfIEg==}
dev: true
@@ -3615,11 +3730,22 @@ packages:
mime-db: 1.52.0
dev: true
+ /mimic-fn/2.1.0:
+ resolution: {integrity: sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==}
+ engines: {node: '>=6'}
+ dev: true
+
/min-indent/1.0.1:
resolution: {integrity: sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==}
engines: {node: '>=4'}
dev: true
+ /minimatch/3.1.2:
+ resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==}
+ dependencies:
+ brace-expansion: 1.1.11
+ dev: true
+
/minimist-options/4.1.0:
resolution: {integrity: sha512-Q4r8ghd80yhO/0j1O3B2BjweX3fiHg9cdOwjJd2J76Q135c+NDxGCqdYKQ1SKBuFfgWbAUzBfvYjPUEeNgqN1A==}
engines: {node: '>= 6'}
@@ -3653,6 +3779,14 @@ packages:
/ms/2.1.2:
resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==}
+ /mz/2.7.0:
+ resolution: {integrity: sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==}
+ dependencies:
+ any-promise: 1.3.0
+ object-assign: 4.1.1
+ thenify-all: 1.6.0
+ dev: true
+
/nanoid/3.3.4:
resolution: {integrity: sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==}
engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}
@@ -3793,6 +3927,13 @@ packages:
path-key: 2.0.1
dev: false
+ /npm-run-path/4.0.1:
+ resolution: {integrity: sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==}
+ engines: {node: '>=8'}
+ dependencies:
+ path-key: 3.1.1
+ dev: true
+
/nth-check/1.0.2:
resolution: {integrity: sha512-WeBOdju8SnzPN5vTUJYxYUxLeXpCaVP5i5e0LF8fg7WORF2Wd7wFX/pk0tYZk7s8T+J7VLy0Da6J1+wCT0AtHg==}
dependencies:
@@ -3846,6 +3987,19 @@ packages:
es-abstract: 1.20.1
dev: true
+ /once/1.4.0:
+ resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==}
+ dependencies:
+ wrappy: 1.0.2
+ dev: true
+
+ /onetime/5.1.2:
+ resolution: {integrity: sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==}
+ engines: {node: '>=6'}
+ dependencies:
+ mimic-fn: 2.1.0
+ dev: true
+
/os-tmpdir/1.0.2:
resolution: {integrity: sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==}
engines: {node: '>=0.10.0'}
@@ -3949,6 +4103,11 @@ packages:
engines: {node: '>=8'}
dev: true
+ /path-is-absolute/1.0.1:
+ resolution: {integrity: sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==}
+ engines: {node: '>=0.10.0'}
+ dev: true
+
/path-key/2.0.1:
resolution: {integrity: sha512-fEHGKCSmUSDPv4uoj8AlD+joPlq3peND+HRYyxFz4KPw4z926S/b8rIuFs2FYJg3BwsxJf6A9/3eIdLaYC+9Dw==}
engines: {node: '>=4'}
@@ -4001,6 +4160,11 @@ packages:
engines: {node: '>=6'}
dev: true
+ /pirates/4.0.5:
+ resolution: {integrity: sha512-8V9+HQPupnaXMA23c5hvl69zXvTwTzyAYasnkb0Tts4XvO4CliqONMOnvlq26rkhLC3nWDFBJf73LU1e1VZLaQ==}
+ engines: {node: '>= 6'}
+ dev: true
+
/pkg-dir/4.2.0:
resolution: {integrity: sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==}
engines: {node: '>=8'}
@@ -4109,6 +4273,22 @@ packages:
postcss: 8.4.14
dev: true
+ /postcss-load-config/3.1.4:
+ resolution: {integrity: sha512-6DiM4E7v4coTE4uzA8U//WhtPwyhiim3eyjEMFCnUpzbrkK9wJHgKDT2mR+HbtSrd/NubVaYTOpSpjUl8NQeRg==}
+ engines: {node: '>= 10'}
+ peerDependencies:
+ postcss: '>=8.0.9'
+ ts-node: '>=9.0.0'
+ peerDependenciesMeta:
+ postcss:
+ optional: true
+ ts-node:
+ optional: true
+ dependencies:
+ lilconfig: 2.0.6
+ yaml: 1.10.2
+ dev: true
+
/postcss-load-config/3.1.4_postcss@8.4.14:
resolution: {integrity: sha512-6DiM4E7v4coTE4uzA8U//WhtPwyhiim3eyjEMFCnUpzbrkK9wJHgKDT2mR+HbtSrd/NubVaYTOpSpjUl8NQeRg==}
engines: {node: '>= 10'}
@@ -4680,6 +4860,13 @@ packages:
resolution: {integrity: sha512-zgn5OjNQXLUTdq8m17KdaicF6w89TZs8ZU8y0AYENIU6wG8GG6LLm0yLSiPY8DmaYmHdgRW8rnApjoT0fQRfMg==}
dev: true
+ /rimraf/3.0.2:
+ resolution: {integrity: sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==}
+ hasBin: true
+ dependencies:
+ glob: 7.1.6
+ dev: true
+
/rollup/2.77.0:
resolution: {integrity: sha512-vL8xjY4yOQEw79DvyXLijhnhh+R/O9zpF/LEgkCebZFtb6ELeN9H3/2T0r8+mp+fFTBHZ5qGpOpW2ela2zRt3g==}
engines: {node: '>=10.0.0'}
@@ -4848,6 +5035,13 @@ packages:
engines: {node: '>=0.10.0'}
dev: true
+ /source-map/0.8.0-beta.0:
+ resolution: {integrity: sha512-2ymg6oRBpebeZi9UUNsgQ89bhx01TcTkmNTGnNO88imTmbSgy4nfujrgVEFKWpMTEGA11EDkTt7mqObTPdigIA==}
+ engines: {node: '>= 8'}
+ dependencies:
+ whatwg-url: 7.1.0
+ dev: true
+
/space-separated-tokens/2.0.1:
resolution: {integrity: sha512-ekwEbFp5aqSPKaqeY1PGrlGQxPNaq+Cnx4+bE2D8sciBQrHpbwoBbawqTN2+6jPs9IdWxxiUcN0K2pkczD3zmw==}
dev: false
@@ -4953,6 +5147,11 @@ packages:
engines: {node: '>=0.10.0'}
dev: false
+ /strip-final-newline/2.0.0:
+ resolution: {integrity: sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==}
+ engines: {node: '>=6'}
+ dev: true
+
/strip-indent/3.0.0:
resolution: {integrity: sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ==}
engines: {node: '>=8'}
@@ -5005,6 +5204,19 @@ packages:
postcss-selector-parser: 3.1.2
dev: true
+ /sucrase/3.24.0:
+ resolution: {integrity: sha512-SevqflhW356TKEyWjFHg2e5f3eH+5rzmsMJxrVMDvZIEHh/goYrpzDGA6APEj4ME9MdGm8oNgIzi1eF3c3dDQA==}
+ engines: {node: '>=8'}
+ hasBin: true
+ dependencies:
+ commander: 4.1.1
+ glob: 7.1.6
+ lines-and-columns: 1.2.4
+ mz: 2.7.0
+ pirates: 4.0.5
+ ts-interface-checker: 0.1.13
+ dev: true
+
/supports-color/4.5.0:
resolution: {integrity: sha512-ycQR/UbvI9xIlEdQT1TQqwoXtEldExbCEAJgRo5YXlmSKjv6ThHnP9/vwGa1gr19Gfw+LkFd7KqYMhzrRC5JYw==}
engines: {node: '>=4'}
@@ -5139,6 +5351,19 @@ packages:
resolution: {integrity: sha512-89Gi5raiWA3QZ4b2ePcEwswC3me9JIg+ToSgtE0JWeCynLnLxNr/f9G+xfo9K+Oj4AFdom8YNJjibIARTJmapQ==}
dev: true
+ /thenify-all/1.6.0:
+ resolution: {integrity: sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==}
+ engines: {node: '>=0.8'}
+ dependencies:
+ thenify: 3.3.1
+ dev: true
+
+ /thenify/3.3.1:
+ resolution: {integrity: sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==}
+ dependencies:
+ any-promise: 1.3.0
+ dev: true
+
/timsort/0.3.0:
resolution: {integrity: sha512-qsdtZH+vMoCARQtyod4imc2nIJwg9Cc7lPRrw9CzF8ZKR0khdr8+2nX80PBhET3tcyTtJDxAffGh2rXH4tyU8A==}
dev: true
@@ -5186,6 +5411,12 @@ packages:
is-number: 7.0.0
dev: true
+ /tr46/1.0.1:
+ resolution: {integrity: sha512-dTpowEjclQ7Kgx5SdBkqRzVhERQXov8/l9Ft9dVM9fmg0W0KQSVaXX9T4i6twCPNtYiZM53lpSSUAwJbFPOHxA==}
+ dependencies:
+ punycode: 2.1.1
+ dev: true
+
/tree-kill/1.2.2:
resolution: {integrity: sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==}
hasBin: true
@@ -5204,9 +5435,48 @@ packages:
resolution: {integrity: sha512-AqTiAOLcj85xS7vQ8QkAV41hPDIJ71XJB4RCUrzo/1GM2CQwhkJGaf9Hgr7BOugMRpgGUrqRg/DrBDl4H40+8g==}
dev: false
+ /ts-interface-checker/0.1.13:
+ resolution: {integrity: sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==}
+ dev: true
+
/tslib/2.4.0:
resolution: {integrity: sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==}
+ /tsup/6.1.3:
+ resolution: {integrity: sha512-eRpBnbfpDFng+EJNTQ90N7QAf4HAGGC7O3buHIjroKWK7D1ibk9/YnR/3cS8HsMU5T+6Oi+cnF+yU5WmCnB//Q==}
+ engines: {node: '>=14'}
+ hasBin: true
+ peerDependencies:
+ '@swc/core': ^1
+ postcss: ^8.4.12
+ typescript: ^4.1.0
+ peerDependenciesMeta:
+ '@swc/core':
+ optional: true
+ postcss:
+ optional: true
+ typescript:
+ optional: true
+ dependencies:
+ bundle-require: 3.0.4_esbuild@0.14.49
+ cac: 6.7.12
+ chokidar: 3.5.3
+ debug: 4.3.4
+ esbuild: 0.14.49
+ execa: 5.1.1
+ globby: 11.1.0
+ joycon: 3.1.1
+ postcss-load-config: 3.1.4
+ resolve-from: 5.0.0
+ rollup: 2.77.0
+ source-map: 0.8.0-beta.0
+ sucrase: 3.24.0
+ tree-kill: 1.2.2
+ transitivePeerDependencies:
+ - supports-color
+ - ts-node
+ dev: true
+
/tty-table/4.1.6:
resolution: {integrity: sha512-kRj5CBzOrakV4VRRY5kUWbNYvo/FpOsz65DzI5op9P+cHov3+IqPbo1JE1ZnQGkHdZgNFDsrEjrfqqy/Ply9fw==}
engines: {node: '>=8.0.0'}
@@ -5669,6 +5939,10 @@ packages:
defaults: 1.0.3
dev: true
+ /webidl-conversions/4.0.2:
+ resolution: {integrity: sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==}
+ dev: true
+
/webpack-sources/3.2.3:
resolution: {integrity: sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==}
engines: {node: '>=10.13.0'}
@@ -5714,6 +5988,14 @@ packages:
- uglify-js
dev: true
+ /whatwg-url/7.1.0:
+ resolution: {integrity: sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg==}
+ dependencies:
+ lodash.sortby: 4.7.0
+ tr46: 1.0.1
+ webidl-conversions: 4.0.2
+ dev: true
+
/which-boxed-primitive/1.0.2:
resolution: {integrity: sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==}
dependencies:
@@ -5768,6 +6050,10 @@ packages:
strip-ansi: 6.0.1
dev: true
+ /wrappy/1.0.2:
+ resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==}
+ dev: true
+
/xtend/4.0.2:
resolution: {integrity: sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==}
engines: {node: '>=0.4'}
diff --git a/turbo.json b/turbo.json
index 4b50d93236..77e11fc01f 100644
--- a/turbo.json
+++ b/turbo.json
@@ -3,23 +3,39 @@
"npmClient": "pnpm",
"pipeline": {
"build": {
- "dependsOn": ["types", "^build"],
+ "dependsOn": [
+ "^build"
+ ],
"outputs": [
+ "dist/**/*.mjs",
"dist/**/*.js",
"dist/**/*.css",
".next/**",
- "style.css",
"index.js",
"ssg.js",
"loader.js"
]
},
+ "build:tailwind": {
+ "dependsOn": [],
+ "outputs": [
+ "style.css"
+ ]
+ },
"test": {},
"types": {
- "outputs": ["dist/**/*.d.ts"]
+ "dependsOn": [
+ "^types"
+ ],
+ "outputs": [
+ "dist/**/*.d.ts"
+ ]
+ },
+ "clean": {
+ "cache": false
},
"dev": {
"cache": false
}
}
-}
+}
\ No newline at end of file