From ae20d825cf9413f0f179e4e5bb9cfa8c017c6a2c Mon Sep 17 00:00:00 2001 From: SoonIter Date: Mon, 29 Apr 2024 15:35:24 +0800 Subject: [PATCH 1/7] feat(plugin-auto-nav): support _meta.js --- packages/cli/src/index.ts | 2 + packages/plugin-auto-nav-sidebar/src/walk.ts | 133 +++++++++++-------- packages/shared/src/index.ts | 2 + 3 files changed, 79 insertions(+), 58 deletions(-) diff --git a/packages/cli/src/index.ts b/packages/cli/src/index.ts index f4335789d..3658372f9 100644 --- a/packages/cli/src/index.ts +++ b/packages/cli/src/index.ts @@ -8,10 +8,12 @@ import chalk from 'chalk'; import { loadConfigFile } from './config/loadConfigFile'; import update from './update'; +// for config reload, restart the server const CONFIG_FILES = [ 'rspress.config.ts', 'rspress.config.js', '_meta.json', + '_meta.js', 'i18n.json', ]; diff --git a/packages/plugin-auto-nav-sidebar/src/walk.ts b/packages/plugin-auto-nav-sidebar/src/walk.ts index 9fc9b7de3..3af93464c 100644 --- a/packages/plugin-auto-nav-sidebar/src/walk.ts +++ b/packages/plugin-auto-nav-sidebar/src/walk.ts @@ -14,6 +14,80 @@ import { import { NavMeta, SideMeta } from './type'; import { detectFilePath, extractTitleAndOverviewHeaders } from './utils'; import { logger } from '@rspress/shared/logger'; +import { loadConfig } from '@rspress/shared'; + +// Get the sidebar config from the `_meta.json` file +async function getSideMetaFromMetaFile( + workDir: string, + rootDir: string, +): Promise { + const metaJsFilePath = path.resolve(workDir, '_meta.js'); + if (await fs.exists(metaJsFilePath)) { + const { content: sideMeta } = (await loadConfig({ + path: metaJsFilePath, + })) as any; + return sideMeta; + } + + const metaJsonFilePath = path.resolve(workDir, '_meta.json'); + if (await fs.exists(metaJsonFilePath)) { + const sideMeta = (await fs.readJSON(metaJsonFilePath, 'utf8')) as SideMeta; + return sideMeta; + } + + // If `_meta.js` or `_meta.json` file doesn't exist, we will generate the sidebar config from the directory structure. + let subItems = await fs.readdir(workDir); + // If there exists a file with the same name of the directory folder + // we don't need to generate SideMeta for this single file + subItems = subItems.filter(item => { + const hasExtension = ['.md', '.mdx'].some(ext => item.endsWith(ext)); + const hasSameBaseName = subItems.some(elem => { + const baseName = elem.replace(/\.[^/.]+$/, ''); + return baseName === item.replace(/\.[^/.]+$/, '') && elem !== item; + }); + return !(hasExtension && hasSameBaseName); + }); + const sideMeta = ( + await Promise.all( + subItems.map(async item => { + // Fix https://github.com/web-infra-dev/rspress/issues/346 + if (item === '_meta.json') { + return null; + } + const stat = await fs.stat(path.join(workDir, item)); + // If the item is a directory, we will transform it to a object with `type` and `name` property. + if (stat.isDirectory()) { + // set H1 title to sidebar label when have same name md/mdx file + const mdFilePath = path.join(workDir, `${item}.md`); + const mdxFilePath = path.join(workDir, `${item}.mdx`); + let label = item; + + const setLabelFromFilePath = async (filePath: string) => { + const { title } = await extractTitleAndOverviewHeaders( + filePath, + rootDir, + ); + label = title; + }; + + if (fs.existsSync(mdxFilePath)) { + await setLabelFromFilePath(mdxFilePath); + } else if (fs.existsSync(mdFilePath)) { + await setLabelFromFilePath(mdFilePath); + } + + return { + type: 'dir', + name: item, + label, + }; + } + return item; + }), + ) + ).filter(Boolean) as SideMeta; + return sideMeta; +} export async function scanSideMeta( workDir: string, @@ -32,64 +106,7 @@ export async function scanSideMeta( const metaFile = path.resolve(workDir, '_meta.json'); // Fix the windows path const relativePath = slash(path.relative(rootDir, workDir)); - let sideMeta: SideMeta | undefined; - // Get the sidebar config from the `_meta.json` file - try { - // Don't use require to avoid require cache, which make hmr not work. - sideMeta = (await fs.readJSON(metaFile, 'utf8')) as SideMeta; - } catch (e) { - // If the `_meta.json` file doesn't exist, we will generate the sidebar config from the directory structure. - let subItems = await fs.readdir(workDir); - // If there exists a file with the same name of the directory folder - // we don't need to generate SideMeta for this single file - subItems = subItems.filter(item => { - const hasExtension = ['.md', '.mdx'].some(ext => item.endsWith(ext)); - const hasSameBaseName = subItems.some(elem => { - const baseName = elem.replace(/\.[^/.]+$/, ''); - return baseName === item.replace(/\.[^/.]+$/, '') && elem !== item; - }); - return !(hasExtension && hasSameBaseName); - }); - sideMeta = ( - await Promise.all( - subItems.map(async item => { - // Fix https://github.com/web-infra-dev/rspress/issues/346 - if (item === '_meta.json') { - return null; - } - const stat = await fs.stat(path.join(workDir, item)); - // If the item is a directory, we will transform it to a object with `type` and `name` property. - if (stat.isDirectory()) { - // set H1 title to sidebar label when have same name md/mdx file - const mdFilePath = path.join(workDir, `${item}.md`); - const mdxFilePath = path.join(workDir, `${item}.mdx`); - let label = item; - - const setLabelFromFilePath = async (filePath: string) => { - const { title } = await extractTitleAndOverviewHeaders( - filePath, - rootDir, - ); - label = title; - }; - - if (fs.existsSync(mdxFilePath)) { - await setLabelFromFilePath(mdxFilePath); - } else if (fs.existsSync(mdFilePath)) { - await setLabelFromFilePath(mdFilePath); - } - - return { - type: 'dir', - name: item, - label, - }; - } - return item; - }), - ) - ).filter(Boolean) as SideMeta; - } + const sideMeta: SideMeta = await getSideMetaFromMetaFile(workDir, rootDir); const sidebarFromMeta: ( | SidebarGroup diff --git a/packages/shared/src/index.ts b/packages/shared/src/index.ts index 6f421d5ba..154dcb31c 100644 --- a/packages/shared/src/index.ts +++ b/packages/shared/src/index.ts @@ -1,2 +1,4 @@ export * from './types'; export * from './runtime-utils'; + +export { loadConfig } from '@rsbuild/core'; From 08de2c320797290093331438be776341f05f1eb8 Mon Sep 17 00:00:00 2001 From: SoonIter Date: Mon, 29 Apr 2024 20:29:54 +0800 Subject: [PATCH 2/7] chore --- .../auto-nav-sidebar-js/doc/_meta.json | 10 + .../auto-nav-sidebar-js/doc/api/_meta.json | 19 ++ .../doc/api/client-api/_meta.json | 13 ++ .../doc/api/client-api/api-components.mdx | 5 + .../doc/api/client-api/api-runtime.mdx | 5 + .../doc/api/client-api/index.mdx | 3 + .../auto-nav-sidebar-js/doc/api/commands.mdx | 5 + .../auto-nav-sidebar-js/doc/api/config.mdx | 4 + .../doc/api/config/_meta.js | 14 ++ .../doc/api/config/config-basic.mdx | 5 + .../doc/api/config/config-build.mdx | 9 + .../doc/api/config/config-extname.json.mdx | 1 + .../doc/api/config/config-frontmatter.mdx | 9 + .../doc/api/config/config-theme.mdx | 5 + .../auto-nav-sidebar-js/doc/api/index.mdx | 3 + .../doc/api/single-page.mdx | 11 + .../auto-nav-sidebar-js/doc/guide/_meta.json | 8 + .../doc/guide/advanced/plugin.mdx | 3 + .../auto-nav-sidebar-js/doc/guide/index.mdx | 1 + e2e/fixtures/auto-nav-sidebar-js/doc/index.md | 1 + e2e/fixtures/auto-nav-sidebar-js/package.json | 16 ++ .../auto-nav-sidebar-js/rspress.config.ts | 6 + .../auto-nav-sidebar-js/tsconfig.json | 1 + packages/plugin-api-docgen/package.json | 8 +- packages/plugin-medium-zoom/package.json | 18 +- pnpm-lock.yaml | 221 +++++++++++++++--- 26 files changed, 352 insertions(+), 52 deletions(-) create mode 100644 e2e/fixtures/auto-nav-sidebar-js/doc/_meta.json create mode 100644 e2e/fixtures/auto-nav-sidebar-js/doc/api/_meta.json create mode 100644 e2e/fixtures/auto-nav-sidebar-js/doc/api/client-api/_meta.json create mode 100644 e2e/fixtures/auto-nav-sidebar-js/doc/api/client-api/api-components.mdx create mode 100644 e2e/fixtures/auto-nav-sidebar-js/doc/api/client-api/api-runtime.mdx create mode 100644 e2e/fixtures/auto-nav-sidebar-js/doc/api/client-api/index.mdx create mode 100644 e2e/fixtures/auto-nav-sidebar-js/doc/api/commands.mdx create mode 100644 e2e/fixtures/auto-nav-sidebar-js/doc/api/config.mdx create mode 100644 e2e/fixtures/auto-nav-sidebar-js/doc/api/config/_meta.js create mode 100644 e2e/fixtures/auto-nav-sidebar-js/doc/api/config/config-basic.mdx create mode 100644 e2e/fixtures/auto-nav-sidebar-js/doc/api/config/config-build.mdx create mode 100644 e2e/fixtures/auto-nav-sidebar-js/doc/api/config/config-extname.json.mdx create mode 100644 e2e/fixtures/auto-nav-sidebar-js/doc/api/config/config-frontmatter.mdx create mode 100644 e2e/fixtures/auto-nav-sidebar-js/doc/api/config/config-theme.mdx create mode 100644 e2e/fixtures/auto-nav-sidebar-js/doc/api/index.mdx create mode 100644 e2e/fixtures/auto-nav-sidebar-js/doc/api/single-page.mdx create mode 100644 e2e/fixtures/auto-nav-sidebar-js/doc/guide/_meta.json create mode 100644 e2e/fixtures/auto-nav-sidebar-js/doc/guide/advanced/plugin.mdx create mode 100644 e2e/fixtures/auto-nav-sidebar-js/doc/guide/index.mdx create mode 100644 e2e/fixtures/auto-nav-sidebar-js/doc/index.md create mode 100644 e2e/fixtures/auto-nav-sidebar-js/package.json create mode 100644 e2e/fixtures/auto-nav-sidebar-js/rspress.config.ts create mode 100644 e2e/fixtures/auto-nav-sidebar-js/tsconfig.json diff --git a/e2e/fixtures/auto-nav-sidebar-js/doc/_meta.json b/e2e/fixtures/auto-nav-sidebar-js/doc/_meta.json new file mode 100644 index 000000000..a5dc6179e --- /dev/null +++ b/e2e/fixtures/auto-nav-sidebar-js/doc/_meta.json @@ -0,0 +1,10 @@ +[ + { + "text": "Guide", + "link": "/guide/" + }, + { + "text": "Api", + "link": "/api/" + } +] diff --git a/e2e/fixtures/auto-nav-sidebar-js/doc/api/_meta.json b/e2e/fixtures/auto-nav-sidebar-js/doc/api/_meta.json new file mode 100644 index 000000000..1520f9be0 --- /dev/null +++ b/e2e/fixtures/auto-nav-sidebar-js/doc/api/_meta.json @@ -0,0 +1,19 @@ +[ + { + "type": "file", + "name": "index", + "label": "API Overview" + }, + { + "type": "dir", + "name": "config", + "label": "Config" + }, + { + "type": "dir", + "name": "client-api", + "label": "Client API" + }, + "commands", + "single-page" +] diff --git a/e2e/fixtures/auto-nav-sidebar-js/doc/api/client-api/_meta.json b/e2e/fixtures/auto-nav-sidebar-js/doc/api/client-api/_meta.json new file mode 100644 index 000000000..d6f2228e4 --- /dev/null +++ b/e2e/fixtures/auto-nav-sidebar-js/doc/api/client-api/_meta.json @@ -0,0 +1,13 @@ +[ + { + "type": "file", + "name": "index", + "label": "Client API Overview" + }, + { + "type": "file", + "name": "api-runtime", + "overviewHeaders": [] + }, + "api-components" +] diff --git a/e2e/fixtures/auto-nav-sidebar-js/doc/api/client-api/api-components.mdx b/e2e/fixtures/auto-nav-sidebar-js/doc/api/client-api/api-components.mdx new file mode 100644 index 000000000..761580be0 --- /dev/null +++ b/e2e/fixtures/auto-nav-sidebar-js/doc/api/client-api/api-components.mdx @@ -0,0 +1,5 @@ +# Components + +## Usage + +## Example diff --git a/e2e/fixtures/auto-nav-sidebar-js/doc/api/client-api/api-runtime.mdx b/e2e/fixtures/auto-nav-sidebar-js/doc/api/client-api/api-runtime.mdx new file mode 100644 index 000000000..6a68d3562 --- /dev/null +++ b/e2e/fixtures/auto-nav-sidebar-js/doc/api/client-api/api-runtime.mdx @@ -0,0 +1,5 @@ +# Runtime API + +## usePageData + +## useLang diff --git a/e2e/fixtures/auto-nav-sidebar-js/doc/api/client-api/index.mdx b/e2e/fixtures/auto-nav-sidebar-js/doc/api/client-api/index.mdx new file mode 100644 index 000000000..41fc3a5f6 --- /dev/null +++ b/e2e/fixtures/auto-nav-sidebar-js/doc/api/client-api/index.mdx @@ -0,0 +1,3 @@ +--- +overview: true +--- diff --git a/e2e/fixtures/auto-nav-sidebar-js/doc/api/commands.mdx b/e2e/fixtures/auto-nav-sidebar-js/doc/api/commands.mdx new file mode 100644 index 000000000..7950df784 --- /dev/null +++ b/e2e/fixtures/auto-nav-sidebar-js/doc/api/commands.mdx @@ -0,0 +1,5 @@ +# Commands + +## rspress dev + +## rspress build diff --git a/e2e/fixtures/auto-nav-sidebar-js/doc/api/config.mdx b/e2e/fixtures/auto-nav-sidebar-js/doc/api/config.mdx new file mode 100644 index 000000000..36ed94e7d --- /dev/null +++ b/e2e/fixtures/auto-nav-sidebar-js/doc/api/config.mdx @@ -0,0 +1,4 @@ +--- +overview: true +overviewHeaders: [2] +--- diff --git a/e2e/fixtures/auto-nav-sidebar-js/doc/api/config/_meta.js b/e2e/fixtures/auto-nav-sidebar-js/doc/api/config/_meta.js new file mode 100644 index 000000000..050e90db2 --- /dev/null +++ b/e2e/fixtures/auto-nav-sidebar-js/doc/api/config/_meta.js @@ -0,0 +1,14 @@ +export default [ + 'config-basic', + 'config-theme', + 'config-frontmatter', + { + type: 'file', + name: 'config-build', + overviewHeaders: [2, 3], + }, + { + type: 'file', + name: 'config-extname.json', + }, +]; diff --git a/e2e/fixtures/auto-nav-sidebar-js/doc/api/config/config-basic.mdx b/e2e/fixtures/auto-nav-sidebar-js/doc/api/config/config-basic.mdx new file mode 100644 index 000000000..ac39e2ba1 --- /dev/null +++ b/e2e/fixtures/auto-nav-sidebar-js/doc/api/config/config-basic.mdx @@ -0,0 +1,5 @@ +# Basic Config + +## root + +## logoText diff --git a/e2e/fixtures/auto-nav-sidebar-js/doc/api/config/config-build.mdx b/e2e/fixtures/auto-nav-sidebar-js/doc/api/config/config-build.mdx new file mode 100644 index 000000000..5f6ffa103 --- /dev/null +++ b/e2e/fixtures/auto-nav-sidebar-js/doc/api/config/config-build.mdx @@ -0,0 +1,9 @@ +# Build Config + +## builderConfig + +### Default Config + +## markdown + +### markdown.remarkPlugins diff --git a/e2e/fixtures/auto-nav-sidebar-js/doc/api/config/config-extname.json.mdx b/e2e/fixtures/auto-nav-sidebar-js/doc/api/config/config-extname.json.mdx new file mode 100644 index 000000000..cdb36b2d0 --- /dev/null +++ b/e2e/fixtures/auto-nav-sidebar-js/doc/api/config/config-extname.json.mdx @@ -0,0 +1 @@ +# Extname Config diff --git a/e2e/fixtures/auto-nav-sidebar-js/doc/api/config/config-frontmatter.mdx b/e2e/fixtures/auto-nav-sidebar-js/doc/api/config/config-frontmatter.mdx new file mode 100644 index 000000000..4cac3ed15 --- /dev/null +++ b/e2e/fixtures/auto-nav-sidebar-js/doc/api/config/config-frontmatter.mdx @@ -0,0 +1,9 @@ +--- +overviewHeaders: [] +--- + +# Front Matter Config + +## title + +## description diff --git a/e2e/fixtures/auto-nav-sidebar-js/doc/api/config/config-theme.mdx b/e2e/fixtures/auto-nav-sidebar-js/doc/api/config/config-theme.mdx new file mode 100644 index 000000000..f99473c33 --- /dev/null +++ b/e2e/fixtures/auto-nav-sidebar-js/doc/api/config/config-theme.mdx @@ -0,0 +1,5 @@ +# Theme Config + +## nav + +## sidebar diff --git a/e2e/fixtures/auto-nav-sidebar-js/doc/api/index.mdx b/e2e/fixtures/auto-nav-sidebar-js/doc/api/index.mdx new file mode 100644 index 000000000..41fc3a5f6 --- /dev/null +++ b/e2e/fixtures/auto-nav-sidebar-js/doc/api/index.mdx @@ -0,0 +1,3 @@ +--- +overview: true +--- diff --git a/e2e/fixtures/auto-nav-sidebar-js/doc/api/single-page.mdx b/e2e/fixtures/auto-nav-sidebar-js/doc/api/single-page.mdx new file mode 100644 index 000000000..c38eed3e7 --- /dev/null +++ b/e2e/fixtures/auto-nav-sidebar-js/doc/api/single-page.mdx @@ -0,0 +1,11 @@ +--- +overviewHeaders: [] +--- + +# Single + +## Single-1 + +### Single-11 + +## Single-2 diff --git a/e2e/fixtures/auto-nav-sidebar-js/doc/guide/_meta.json b/e2e/fixtures/auto-nav-sidebar-js/doc/guide/_meta.json new file mode 100644 index 000000000..9aa97c7e5 --- /dev/null +++ b/e2e/fixtures/auto-nav-sidebar-js/doc/guide/_meta.json @@ -0,0 +1,8 @@ +[ + "index", + { + "type": "dir", + "name": "advanced", + "label": "Advanced" + } +] diff --git a/e2e/fixtures/auto-nav-sidebar-js/doc/guide/advanced/plugin.mdx b/e2e/fixtures/auto-nav-sidebar-js/doc/guide/advanced/plugin.mdx new file mode 100644 index 000000000..edd2cbeca --- /dev/null +++ b/e2e/fixtures/auto-nav-sidebar-js/doc/guide/advanced/plugin.mdx @@ -0,0 +1,3 @@ +# Plugin + +This plugin is a simple plugin that allows you to create a custom command that will send a message to a channel of your choice. diff --git a/e2e/fixtures/auto-nav-sidebar-js/doc/guide/index.mdx b/e2e/fixtures/auto-nav-sidebar-js/doc/guide/index.mdx new file mode 100644 index 000000000..8c0d02fad --- /dev/null +++ b/e2e/fixtures/auto-nav-sidebar-js/doc/guide/index.mdx @@ -0,0 +1 @@ +# Guide diff --git a/e2e/fixtures/auto-nav-sidebar-js/doc/index.md b/e2e/fixtures/auto-nav-sidebar-js/doc/index.md new file mode 100644 index 000000000..29658341f --- /dev/null +++ b/e2e/fixtures/auto-nav-sidebar-js/doc/index.md @@ -0,0 +1 @@ +# Hello World diff --git a/e2e/fixtures/auto-nav-sidebar-js/package.json b/e2e/fixtures/auto-nav-sidebar-js/package.json new file mode 100644 index 000000000..9f5d81f53 --- /dev/null +++ b/e2e/fixtures/auto-nav-sidebar-js/package.json @@ -0,0 +1,16 @@ +{ + "name": "@rspress-fixture/rspress-auto-nav-sidebar-js", + "version": "1.0.0", + "private": true, + "scripts": { + "dev": "rspress dev", + "build": "rspress build", + "preview": "rspress preview" + }, + "dependencies": { + "rspress": "workspace:*" + }, + "devDependencies": { + "@types/node": "^14" + } +} diff --git a/e2e/fixtures/auto-nav-sidebar-js/rspress.config.ts b/e2e/fixtures/auto-nav-sidebar-js/rspress.config.ts new file mode 100644 index 000000000..85cca368c --- /dev/null +++ b/e2e/fixtures/auto-nav-sidebar-js/rspress.config.ts @@ -0,0 +1,6 @@ +import * as path from 'path'; +import { defineConfig } from 'rspress/config'; + +export default defineConfig({ + root: path.join(__dirname, 'doc'), +}); diff --git a/e2e/fixtures/auto-nav-sidebar-js/tsconfig.json b/e2e/fixtures/auto-nav-sidebar-js/tsconfig.json new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/e2e/fixtures/auto-nav-sidebar-js/tsconfig.json @@ -0,0 +1 @@ +{} diff --git a/packages/plugin-api-docgen/package.json b/packages/plugin-api-docgen/package.json index 80d398146..43deab398 100644 --- a/packages/plugin-api-docgen/package.json +++ b/packages/plugin-api-docgen/package.json @@ -22,6 +22,7 @@ "node": ">=14.17.6" }, "dependencies": { + "@rspress/shared": "workspace:*", "@modern-js/utils": "2.49.2", "react-markdown": "8.0.7", "react-docgen-typescript": "2.2.2", @@ -29,7 +30,6 @@ "remark-gfm": "3.0.1" }, "devDependencies": { - "@rspress/shared": "workspace:*", "@types/mdast": "^3.0.10", "@types/node": "^18.11.17", "@types/react": "^18", @@ -53,11 +53,7 @@ "optional": true } }, - "files": [ - "dist", - "static", - "mdx-meta-loader.cjs" - ], + "files": ["dist", "static", "mdx-meta-loader.cjs"], "publishConfig": { "access": "public", "provenance": true, diff --git a/packages/plugin-medium-zoom/package.json b/packages/plugin-medium-zoom/package.json index f1945c648..1b552f00c 100644 --- a/packages/plugin-medium-zoom/package.json +++ b/packages/plugin-medium-zoom/package.json @@ -30,28 +30,20 @@ "@types/react-dom": "^18", "typescript": "^5", "vitest": "0.34.1", - "react": "^18.2.0", - "@rspress/shared": "workspace:*" + "react": "^18.2.0" }, "peerDependencies": { "@rspress/runtime": "^1.0.2" }, - "sideEffects": [ - "*.css", - "*.less", - "*.sass", - "*.scss" - ], - "files": [ - "dist", - "src" - ], + "sideEffects": ["*.css", "*.less", "*.sass", "*.scss"], + "files": ["dist", "src"], "publishConfig": { "access": "public", "provenance": true, "registry": "https://registry.npmjs.org/" }, "dependencies": { - "medium-zoom": "1.1.0" + "medium-zoom": "1.1.0", + "@rspress/shared": "workspace:*" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 09ac43458..85fd73841 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -104,6 +104,16 @@ importers: specifier: ^14 version: 14.0.0 + e2e/fixtures/auto-nav-sidebar-js: + dependencies: + rspress: + specifier: workspace:* + version: link:../../../packages/cli + devDependencies: + '@types/node': + specifier: ^14 + version: 14.0.0 + e2e/fixtures/auto-nav-sidebar-no-meta: dependencies: rspress: @@ -746,7 +756,10 @@ importers: version: 2.49.2 '@rspress/core': specifier: ^1.0.2 - version: link:../core + version: 1.19.1(@swc/helpers@0.5.3)(webpack@5.88.2) + '@rspress/shared': + specifier: workspace:* + version: link:../shared documentation: specifier: 14.0.2 version: 14.0.2 @@ -760,9 +773,6 @@ importers: specifier: 3.0.1 version: 3.0.1 devDependencies: - '@rspress/shared': - specifier: workspace:* - version: link:../shared '@types/mdast': specifier: ^3.0.10 version: 3.0.12 @@ -879,7 +889,10 @@ importers: dependencies: '@rspress/runtime': specifier: ^1.0.2 - version: link:../runtime + version: 1.19.1 + '@rspress/shared': + specifier: workspace:* + version: link:../shared medium-zoom: specifier: 1.1.0 version: 1.1.0 @@ -887,9 +900,6 @@ importers: '@modern-js/tsconfig': specifier: 2.49.2 version: 2.49.2 - '@rspress/shared': - specifier: workspace:* - version: link:../shared '@types/node': specifier: ^18.11.17 version: 18.11.17 @@ -922,7 +932,7 @@ importers: version: 0.2.0 '@rspress/core': specifier: ^1.0.2 - version: link:../core + version: 1.19.1(@swc/helpers@0.5.3)(webpack@5.88.2) '@rspress/shared': specifier: workspace:* version: link:../shared @@ -998,7 +1008,7 @@ importers: version: 0.6.7(@babel/core@7.24.4)(@rsbuild/core@0.6.7)(@swc/helpers@0.5.3)(solid-js@1.8.16) '@rspress/core': specifier: ^1.0.2 - version: link:../core + version: 1.19.1(@swc/helpers@0.5.3)(webpack@5.88.2) '@rspress/shared': specifier: workspace:* version: link:../shared @@ -1062,7 +1072,7 @@ importers: version: 4.2.2 rspress: specifier: ^1.17.0 - version: link:../cli + version: 1.19.1(@swc/helpers@0.5.3)(webpack@5.88.2) devDependencies: '@rspress/runtime': specifier: workspace:* @@ -1130,7 +1140,7 @@ importers: version: link:../shared rspress: specifier: ^1.0.2 - version: link:../cli + version: 1.19.1(@swc/helpers@0.5.3)(webpack@5.88.2) typedoc: specifier: 0.24.8 version: 0.24.8(typescript@5.0.4) @@ -3552,12 +3562,10 @@ packages: dependencies: '@nodelib/fs.stat': 2.0.5 run-parallel: 1.2.0 - dev: true /@nodelib/fs.stat@2.0.5: resolution: {integrity: sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==} engines: {node: '>= 8'} - dev: true /@nodelib/fs.walk@1.2.8: resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==} @@ -3565,7 +3573,6 @@ packages: dependencies: '@nodelib/fs.scandir': 2.1.5 fastq: 1.15.0 - dev: true /@nrwl/tao@17.0.2: resolution: {integrity: sha512-H+htIRzQR6Ibael34rhQkpNkpFFFmaSTsIzdqkBqL4j5+FzSpZh67NJnWSY8vsYQGQL8Ncc+MHvpQC+7pyfgGw==} @@ -3955,6 +3962,64 @@ packages: react-refresh: 0.14.0 dev: false + /@rspress/core@1.19.1(@swc/helpers@0.5.3)(webpack@5.88.2): + resolution: {integrity: sha512-FvO5qRLdTfnydvQ4yVlRN58cLf0W2eTpOdhrafyijXb3Oa3zQB+ZE5eiJMtHsI1+3493HOBGeVhZb58BVicz0w==} + engines: {node: '>=14.17.6'} + dependencies: + '@loadable/component': 5.16.4(react@18.2.0) + '@mdx-js/loader': 2.3.0(webpack@5.88.2) + '@mdx-js/mdx': 2.3.0 + '@mdx-js/react': 2.3.0(react@18.2.0) + '@modern-js/utils': 2.49.2 + '@rsbuild/core': 0.6.7 + '@rsbuild/plugin-react': 0.6.7(@rsbuild/core@0.6.7)(@swc/helpers@0.5.3) + '@rspress/mdx-rs': 0.5.4 + '@rspress/plugin-auto-nav-sidebar': 1.19.1 + '@rspress/plugin-container-syntax': 1.19.1 + '@rspress/plugin-last-updated': 1.19.1 + '@rspress/plugin-medium-zoom': 1.19.1(@rspress/runtime@1.19.1) + '@rspress/runtime': 1.19.1 + '@rspress/shared': 1.19.1 + '@rspress/theme-default': 1.19.1 + body-scroll-lock: 4.0.0-beta.0 + copy-to-clipboard: 3.3.3 + enhanced-resolve: 5.16.0 + flexsearch: 0.6.32 + github-slugger: 2.0.0 + hast-util-from-html: 1.0.0 + hast-util-heading-rank: 3.0.0 + html-to-text: 9.0.3 + htmr: 1.0.2(react@18.2.0) + is-html: 3.1.0 + lodash-es: 4.17.21 + mdast-util-mdxjs-esm: 1.3.0 + node-fetch: 3.3.0 + nprogress: 0.2.0 + postcss: 8.4.31 + react: 18.2.0 + react-dom: 18.2.0(react@18.2.0) + react-helmet-async: 1.3.0(react-dom@18.2.0)(react@18.2.0) + react-lazy-with-preload: 2.2.1 + react-syntax-highlighter: 15.5.0(react@18.2.0) + rehype-external-links: 2.1.0 + rehype-stringify: 9.0.3 + remark: 14.0.2 + remark-gfm: 3.0.1 + remark-html: 15.0.1 + remark-parse: 10.0.1 + remark-rehype: 10.1.0 + rspack-plugin-virtual-module: 0.1.12 + source-map: 0.7.4 + unified: 10.1.2 + unist-util-visit: 4.1.1 + unist-util-visit-children: 2.0.1 + yaml-front-matter: 4.1.1 + transitivePeerDependencies: + - '@swc/helpers' + - supports-color + - webpack + dev: false + /@rspress/mdx-rs-darwin-arm64@0.5.4: resolution: {integrity: sha512-IdfxxwRN7XZ0ADTd3112xQcSoZz8wyePzTDgUedSRvn+38Jp8dH2JSNOthyi4POIz/LUk4oajoHFK4W0eIZN0A==} engines: {node: '>=14.12'} @@ -4041,6 +4106,85 @@ packages: '@rspress/mdx-rs-win32-x64-msvc': 0.5.4 dev: false + /@rspress/plugin-auto-nav-sidebar@1.19.1: + resolution: {integrity: sha512-x19jDurmLYCXvbTvEf3xwiJkG3COWYcZj6CwVIV3mLGcx55MnaXBzEcMcnAzO0/PTyybgYbLcqoWf/hhgQJnWw==} + engines: {node: '>=14.17.6'} + dependencies: + '@rspress/shared': 1.19.1 + dev: false + + /@rspress/plugin-container-syntax@1.19.1: + resolution: {integrity: sha512-p2cogHTnEvynxdoeKWc69AT17/0WYhuCWXKgYiT7fGT1B3db5/E1QqZXEc0k1P0zgBU25L5vpdozIweOiNzI8w==} + engines: {node: '>=14.17.6'} + dependencies: + '@rspress/shared': 1.19.1 + dev: false + + /@rspress/plugin-last-updated@1.19.1: + resolution: {integrity: sha512-EQeLAPIOK6YN4AfDu4Q/iEt8I4wGQiyQox+3vlNRDYPQfUjnK4A5auO+p9MuK43JAWnKw5av9q28U2/tS3QFEQ==} + engines: {node: '>=14.17.6'} + dependencies: + '@rspress/shared': 1.19.1 + dev: false + + /@rspress/plugin-medium-zoom@1.19.1(@rspress/runtime@1.19.1): + resolution: {integrity: sha512-yWTFZhaPLTb0qNwpwWOCuBmbj8aPkjYnxcKm7rc7XoqeZxq8QHYwAC5nf4SFOnq4OS1ByvJPLo69jQivdogBEA==} + engines: {node: '>=14.17.6'} + peerDependencies: + '@rspress/runtime': ^1.0.2 + dependencies: + '@rspress/runtime': 1.19.1 + medium-zoom: 1.1.0 + dev: false + + /@rspress/runtime@1.19.1: + resolution: {integrity: sha512-xZxlzT10o4TnzvI0wKMqCXbPPtP3LqJj0vvbDQJLQTND3FqjspS0D764iwpgkPKfVa9dvfgbCpS3vgUsBBfXzw==} + engines: {node: '>=14.17.6'} + dependencies: + '@rspress/shared': 1.19.1 + react: 18.2.0 + react-dom: 18.2.0(react@18.2.0) + react-helmet-async: 1.3.0(react-dom@18.2.0)(react@18.2.0) + react-router-dom: 6.11.1(react-dom@18.2.0)(react@18.2.0) + dev: false + + /@rspress/shared@1.19.1: + resolution: {integrity: sha512-nl3I4DTreNGoDVowHKuQ4X5uLDVg9Ve12gExN56e30Qtt3Cw3LA00lYj9Y0OrAPIbMEzB+6h+qZrkTRhQmdBEg==} + dependencies: + '@rsbuild/core': 0.6.7 + chalk: 4.1.2 + execa: 5.1.1 + fs-extra: 11.2.0 + gray-matter: 4.0.3 + unified: 10.1.2 + dev: false + + /@rspress/theme-default@1.19.1: + resolution: {integrity: sha512-632LlI1WD/sJpg2wsKvAa+Zp3tFZwetLLhXjPofYtuBsmLxyqg6M8g6dsYDTGdcVf6SJR2zzMmWstQK1Iop7nQ==} + engines: {node: '>=14.17.6'} + dependencies: + '@mdx-js/react': 2.3.0(react@18.2.0) + '@rspress/runtime': 1.19.1 + '@rspress/shared': 1.19.1 + body-scroll-lock: 4.0.0-beta.0 + copy-to-clipboard: 3.3.3 + flexsearch: 0.6.32 + github-slugger: 2.0.0 + globby: 11.1.0 + hast-util-from-html: 1.0.0 + html-to-text: 9.0.3 + htmr: 1.0.2(react@18.2.0) + is-html: 3.1.0 + lodash-es: 4.17.21 + nprogress: 0.2.0 + react: 18.2.0 + react-dom: 18.2.0(react@18.2.0) + react-helmet-async: 1.3.0(react-dom@18.2.0)(react@18.2.0) + react-syntax-highlighter: 15.5.0(react@18.2.0) + react-transition-group: 4.4.5(react-dom@18.2.0)(react@18.2.0) + rspack-plugin-virtual-module: 0.1.12 + dev: false + /@selderee/plugin-htmlparser2@0.10.0: resolution: {integrity: sha512-gW69MEamZ4wk1OsOq1nG1jcyhXIQcnrsX5JwixVw/9xaiav8TCyjESAruu1Rz9yyInhgBXxkNwMeygKnN2uxNA==} dependencies: @@ -4742,7 +4886,6 @@ packages: /array-union@2.1.0: resolution: {integrity: sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==} engines: {node: '>=8'} - dev: true /array.prototype.flat@1.3.1: resolution: {integrity: sha512-roTU0KWIOmJ4DRLmwKd19Otg0/mT3qPNt0Qb3GWW8iObuZXxrjB/pzn0R3hqpRSWg4HCwqx+0vwOnWnvlOyeIA==} @@ -5491,7 +5634,6 @@ packages: engines: {node: '>=8'} dependencies: path-type: 4.0.0 - dev: true /dlv@1.1.3: resolution: {integrity: sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==} @@ -6062,7 +6204,6 @@ packages: glob-parent: 5.1.2 merge2: 1.4.1 micromatch: 4.0.5 - dev: true /fast-json-stable-stringify@2.1.0: resolution: {integrity: sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==} @@ -6071,7 +6212,6 @@ packages: resolution: {integrity: sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==} dependencies: reusify: 1.0.4 - dev: true /fault@1.0.4: resolution: {integrity: sha512-CJ0HCB5tL5fYTEA7ToAq5+kTwd++Borf1/bifxd9iT70QcXr4MRrO3Llf8Ifs70q+SJcGHFtnIE/Nw6giCtECA==} @@ -6470,7 +6610,6 @@ packages: ignore: 5.2.4 merge2: 1.4.1 slash: 3.0.0 - dev: true /globby@13.2.2: resolution: {integrity: sha512-Y1zNGV+pzQdh7H39l9zgB4PJqjRNqydvdYCDG4HFXM4XuvSaQQlEc91IU1yALL8gUTDomgBAfz3XJdmUS+oo0w==} @@ -6891,7 +7030,6 @@ packages: /ignore@5.2.4: resolution: {integrity: sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==} engines: {node: '>= 4'} - dev: true /import-fresh@3.3.0: resolution: {integrity: sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==} @@ -7905,7 +8043,6 @@ packages: /merge2@1.4.1: resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==} engines: {node: '>= 8'} - dev: true /micromark-core-commonmark@1.1.0: resolution: {integrity: sha512-BgHO1aRbolh2hcrzL2d1La37V0Aoz73ymF8rAcKnohLy93titmv62E0gP8Hrx9PKcKrqCZ1BbLGbP3bEhoXYlw==} @@ -8226,7 +8363,6 @@ packages: dependencies: braces: 3.0.2 picomatch: 2.3.1 - dev: true /mime-db@1.52.0: resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} @@ -8776,7 +8912,6 @@ packages: /path-type@4.0.0: resolution: {integrity: sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==} engines: {node: '>=8'} - dev: true /pathe@1.1.1: resolution: {integrity: sha512-d+RQGp0MAYTIaDBIMmOfMwz3E+LOZnxx1HZd5R18mmCZY0QBlK0LDZfPc8FW8Ed2DlvsuE6PRjroDY+wg4+j/Q==} @@ -8986,7 +9121,7 @@ packages: dependencies: nanoid: 3.3.7 picocolors: 1.0.0 - source-map-js: 1.0.2 + source-map-js: 1.2.0 /postcss@8.4.38: resolution: {integrity: sha512-Wglpdk03BSfXkHoQa3b/oulrotAkwrlLDRSOb9D0bN86FdRyE9lppSp33aHNPgBa0JKCoB+drFLZkQoRRYae5A==} @@ -9088,7 +9223,6 @@ packages: /queue-microtask@1.2.3: resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} - dev: true /quick-lru@4.0.1: resolution: {integrity: sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g==} @@ -9380,6 +9514,18 @@ packages: unist-util-visit: 4.1.1 dev: false + /rehype-external-links@2.1.0: + resolution: {integrity: sha512-2YMJZVM1hxZnwl9IPkbN5Pjn78kXkAX7lq9VEtlaGA29qIls25vZN+ucNIJdbQUe+9NNFck17BiOhGmsD6oLIg==} + dependencies: + '@types/hast': 2.3.4 + extend: 3.0.2 + hast-util-is-element: 2.1.3 + is-absolute-url: 4.0.1 + space-separated-tokens: 2.0.2 + unified: 10.1.2 + unist-util-visit: 4.1.1 + dev: false + /rehype-stringify@9.0.3: resolution: {integrity: sha512-kWiZ1bgyWlgOxpqD5HnxShKAdXtb2IUljn3hQAhySeak6IOQPPt6DeGnsIh4ixm7yKJWzm8TXFuC/lPfcWHJqw==} dependencies: @@ -9523,7 +9669,6 @@ packages: /reusify@1.0.4: resolution: {integrity: sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==} engines: {iojs: '>=1.0.0', node: '>=0.10.0'} - dev: true /rfdc@1.3.0: resolution: {integrity: sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA==} @@ -9576,6 +9721,22 @@ packages: fs-extra: 11.2.0 dev: false + /rspress@1.19.1(@swc/helpers@0.5.3)(webpack@5.88.2): + resolution: {integrity: sha512-yUKN7wW0qrn68j4xsJVr9Lv2hCEGKWcMydHOte0ipDzF5q5EL3c3+co1IY91LTwhMeJ6n1oPP4XYFPAO03Dbmw==} + hasBin: true + dependencies: + '@rsbuild/core': 0.6.7 + '@rspress/core': 1.19.1(@swc/helpers@0.5.3)(webpack@5.88.2) + '@rspress/shared': 1.19.1 + cac: 6.7.14 + chalk: 5.3.0 + chokidar: 3.6.0 + transitivePeerDependencies: + - '@swc/helpers' + - supports-color + - webpack + dev: false + /run-async@2.4.1: resolution: {integrity: sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==} engines: {node: '>=0.12.0'} @@ -9585,7 +9746,6 @@ packages: resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==} dependencies: queue-microtask: 1.2.3 - dev: true /rxjs@7.8.1: resolution: {integrity: sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==} @@ -9791,7 +9951,6 @@ packages: /slash@3.0.0: resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==} engines: {node: '>=8'} - dev: true /slash@4.0.0: resolution: {integrity: sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==} @@ -9847,10 +10006,6 @@ packages: solid-js: 1.8.16 dev: false - /source-map-js@1.0.2: - resolution: {integrity: sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==} - engines: {node: '>=0.10.0'} - /source-map-js@1.2.0: resolution: {integrity: sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg==} engines: {node: '>=0.10.0'} From c8a5fe3a94947469aeac69439b6bc985e71ca6b6 Mon Sep 17 00:00:00 2001 From: SoonIter Date: Tue, 30 Apr 2024 02:29:53 +0800 Subject: [PATCH 3/7] chore: update --- packages/plugin-auto-nav-sidebar/src/walk.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/plugin-auto-nav-sidebar/src/walk.ts b/packages/plugin-auto-nav-sidebar/src/walk.ts index 3af93464c..ecb796803 100644 --- a/packages/plugin-auto-nav-sidebar/src/walk.ts +++ b/packages/plugin-auto-nav-sidebar/src/walk.ts @@ -54,6 +54,9 @@ async function getSideMetaFromMetaFile( if (item === '_meta.json') { return null; } + if (item === '_meta.js') { + return null; + } const stat = await fs.stat(path.join(workDir, item)); // If the item is a directory, we will transform it to a object with `type` and `name` property. if (stat.isDirectory()) { From c7702ddf41e0fbc69234a20c17f2ff540056f590 Mon Sep 17 00:00:00 2001 From: SoonIter Date: Tue, 30 Apr 2024 03:03:24 +0800 Subject: [PATCH 4/7] chore: update --- packages/plugin-auto-nav-sidebar/src/walk.ts | 2 +- packages/shared/src/index.ts | 2 - packages/shared/src/node-utils.ts | 1 + packages/shared/src/node-utils/loadConfig.ts | 2 + pnpm-lock.yaml | 199 +++---------------- 5 files changed, 31 insertions(+), 175 deletions(-) create mode 100644 packages/shared/src/node-utils/loadConfig.ts diff --git a/packages/plugin-auto-nav-sidebar/src/walk.ts b/packages/plugin-auto-nav-sidebar/src/walk.ts index ecb796803..2c07a867e 100644 --- a/packages/plugin-auto-nav-sidebar/src/walk.ts +++ b/packages/plugin-auto-nav-sidebar/src/walk.ts @@ -14,7 +14,7 @@ import { import { NavMeta, SideMeta } from './type'; import { detectFilePath, extractTitleAndOverviewHeaders } from './utils'; import { logger } from '@rspress/shared/logger'; -import { loadConfig } from '@rspress/shared'; +import { loadConfig } from '@rspress/shared/node-utils'; // Get the sidebar config from the `_meta.json` file async function getSideMetaFromMetaFile( diff --git a/packages/shared/src/index.ts b/packages/shared/src/index.ts index 154dcb31c..6f421d5ba 100644 --- a/packages/shared/src/index.ts +++ b/packages/shared/src/index.ts @@ -1,4 +1,2 @@ export * from './types'; export * from './runtime-utils'; - -export { loadConfig } from '@rsbuild/core'; diff --git a/packages/shared/src/node-utils.ts b/packages/shared/src/node-utils.ts index 4d50255fa..cbc3337d5 100644 --- a/packages/shared/src/node-utils.ts +++ b/packages/shared/src/node-utils.ts @@ -1 +1,2 @@ export * from './node-utils/loadFrontMatter'; +export * from './node-utils/loadConfig'; diff --git a/packages/shared/src/node-utils/loadConfig.ts b/packages/shared/src/node-utils/loadConfig.ts new file mode 100644 index 000000000..d80ee834c --- /dev/null +++ b/packages/shared/src/node-utils/loadConfig.ts @@ -0,0 +1,2 @@ +// TODO: load config file logic of _meta.js +export { loadConfig } from '@rsbuild/core'; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 85fd73841..d2922ce13 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -756,7 +756,7 @@ importers: version: 2.49.2 '@rspress/core': specifier: ^1.0.2 - version: 1.19.1(@swc/helpers@0.5.3)(webpack@5.88.2) + version: link:../core '@rspress/shared': specifier: workspace:* version: link:../shared @@ -889,7 +889,7 @@ importers: dependencies: '@rspress/runtime': specifier: ^1.0.2 - version: 1.19.1 + version: link:../runtime '@rspress/shared': specifier: workspace:* version: link:../shared @@ -932,7 +932,7 @@ importers: version: 0.2.0 '@rspress/core': specifier: ^1.0.2 - version: 1.19.1(@swc/helpers@0.5.3)(webpack@5.88.2) + version: link:../core '@rspress/shared': specifier: workspace:* version: link:../shared @@ -1008,7 +1008,7 @@ importers: version: 0.6.7(@babel/core@7.24.4)(@rsbuild/core@0.6.7)(@swc/helpers@0.5.3)(solid-js@1.8.16) '@rspress/core': specifier: ^1.0.2 - version: 1.19.1(@swc/helpers@0.5.3)(webpack@5.88.2) + version: link:../core '@rspress/shared': specifier: workspace:* version: link:../shared @@ -1072,7 +1072,7 @@ importers: version: 4.2.2 rspress: specifier: ^1.17.0 - version: 1.19.1(@swc/helpers@0.5.3)(webpack@5.88.2) + version: link:../cli devDependencies: '@rspress/runtime': specifier: workspace:* @@ -1140,7 +1140,7 @@ importers: version: link:../shared rspress: specifier: ^1.0.2 - version: 1.19.1(@swc/helpers@0.5.3)(webpack@5.88.2) + version: link:../cli typedoc: specifier: 0.24.8 version: 0.24.8(typescript@5.0.4) @@ -3562,10 +3562,12 @@ packages: dependencies: '@nodelib/fs.stat': 2.0.5 run-parallel: 1.2.0 + dev: true /@nodelib/fs.stat@2.0.5: resolution: {integrity: sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==} engines: {node: '>= 8'} + dev: true /@nodelib/fs.walk@1.2.8: resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==} @@ -3573,6 +3575,7 @@ packages: dependencies: '@nodelib/fs.scandir': 2.1.5 fastq: 1.15.0 + dev: true /@nrwl/tao@17.0.2: resolution: {integrity: sha512-H+htIRzQR6Ibael34rhQkpNkpFFFmaSTsIzdqkBqL4j5+FzSpZh67NJnWSY8vsYQGQL8Ncc+MHvpQC+7pyfgGw==} @@ -3962,64 +3965,6 @@ packages: react-refresh: 0.14.0 dev: false - /@rspress/core@1.19.1(@swc/helpers@0.5.3)(webpack@5.88.2): - resolution: {integrity: sha512-FvO5qRLdTfnydvQ4yVlRN58cLf0W2eTpOdhrafyijXb3Oa3zQB+ZE5eiJMtHsI1+3493HOBGeVhZb58BVicz0w==} - engines: {node: '>=14.17.6'} - dependencies: - '@loadable/component': 5.16.4(react@18.2.0) - '@mdx-js/loader': 2.3.0(webpack@5.88.2) - '@mdx-js/mdx': 2.3.0 - '@mdx-js/react': 2.3.0(react@18.2.0) - '@modern-js/utils': 2.49.2 - '@rsbuild/core': 0.6.7 - '@rsbuild/plugin-react': 0.6.7(@rsbuild/core@0.6.7)(@swc/helpers@0.5.3) - '@rspress/mdx-rs': 0.5.4 - '@rspress/plugin-auto-nav-sidebar': 1.19.1 - '@rspress/plugin-container-syntax': 1.19.1 - '@rspress/plugin-last-updated': 1.19.1 - '@rspress/plugin-medium-zoom': 1.19.1(@rspress/runtime@1.19.1) - '@rspress/runtime': 1.19.1 - '@rspress/shared': 1.19.1 - '@rspress/theme-default': 1.19.1 - body-scroll-lock: 4.0.0-beta.0 - copy-to-clipboard: 3.3.3 - enhanced-resolve: 5.16.0 - flexsearch: 0.6.32 - github-slugger: 2.0.0 - hast-util-from-html: 1.0.0 - hast-util-heading-rank: 3.0.0 - html-to-text: 9.0.3 - htmr: 1.0.2(react@18.2.0) - is-html: 3.1.0 - lodash-es: 4.17.21 - mdast-util-mdxjs-esm: 1.3.0 - node-fetch: 3.3.0 - nprogress: 0.2.0 - postcss: 8.4.31 - react: 18.2.0 - react-dom: 18.2.0(react@18.2.0) - react-helmet-async: 1.3.0(react-dom@18.2.0)(react@18.2.0) - react-lazy-with-preload: 2.2.1 - react-syntax-highlighter: 15.5.0(react@18.2.0) - rehype-external-links: 2.1.0 - rehype-stringify: 9.0.3 - remark: 14.0.2 - remark-gfm: 3.0.1 - remark-html: 15.0.1 - remark-parse: 10.0.1 - remark-rehype: 10.1.0 - rspack-plugin-virtual-module: 0.1.12 - source-map: 0.7.4 - unified: 10.1.2 - unist-util-visit: 4.1.1 - unist-util-visit-children: 2.0.1 - yaml-front-matter: 4.1.1 - transitivePeerDependencies: - - '@swc/helpers' - - supports-color - - webpack - dev: false - /@rspress/mdx-rs-darwin-arm64@0.5.4: resolution: {integrity: sha512-IdfxxwRN7XZ0ADTd3112xQcSoZz8wyePzTDgUedSRvn+38Jp8dH2JSNOthyi4POIz/LUk4oajoHFK4W0eIZN0A==} engines: {node: '>=14.12'} @@ -4106,85 +4051,6 @@ packages: '@rspress/mdx-rs-win32-x64-msvc': 0.5.4 dev: false - /@rspress/plugin-auto-nav-sidebar@1.19.1: - resolution: {integrity: sha512-x19jDurmLYCXvbTvEf3xwiJkG3COWYcZj6CwVIV3mLGcx55MnaXBzEcMcnAzO0/PTyybgYbLcqoWf/hhgQJnWw==} - engines: {node: '>=14.17.6'} - dependencies: - '@rspress/shared': 1.19.1 - dev: false - - /@rspress/plugin-container-syntax@1.19.1: - resolution: {integrity: sha512-p2cogHTnEvynxdoeKWc69AT17/0WYhuCWXKgYiT7fGT1B3db5/E1QqZXEc0k1P0zgBU25L5vpdozIweOiNzI8w==} - engines: {node: '>=14.17.6'} - dependencies: - '@rspress/shared': 1.19.1 - dev: false - - /@rspress/plugin-last-updated@1.19.1: - resolution: {integrity: sha512-EQeLAPIOK6YN4AfDu4Q/iEt8I4wGQiyQox+3vlNRDYPQfUjnK4A5auO+p9MuK43JAWnKw5av9q28U2/tS3QFEQ==} - engines: {node: '>=14.17.6'} - dependencies: - '@rspress/shared': 1.19.1 - dev: false - - /@rspress/plugin-medium-zoom@1.19.1(@rspress/runtime@1.19.1): - resolution: {integrity: sha512-yWTFZhaPLTb0qNwpwWOCuBmbj8aPkjYnxcKm7rc7XoqeZxq8QHYwAC5nf4SFOnq4OS1ByvJPLo69jQivdogBEA==} - engines: {node: '>=14.17.6'} - peerDependencies: - '@rspress/runtime': ^1.0.2 - dependencies: - '@rspress/runtime': 1.19.1 - medium-zoom: 1.1.0 - dev: false - - /@rspress/runtime@1.19.1: - resolution: {integrity: sha512-xZxlzT10o4TnzvI0wKMqCXbPPtP3LqJj0vvbDQJLQTND3FqjspS0D764iwpgkPKfVa9dvfgbCpS3vgUsBBfXzw==} - engines: {node: '>=14.17.6'} - dependencies: - '@rspress/shared': 1.19.1 - react: 18.2.0 - react-dom: 18.2.0(react@18.2.0) - react-helmet-async: 1.3.0(react-dom@18.2.0)(react@18.2.0) - react-router-dom: 6.11.1(react-dom@18.2.0)(react@18.2.0) - dev: false - - /@rspress/shared@1.19.1: - resolution: {integrity: sha512-nl3I4DTreNGoDVowHKuQ4X5uLDVg9Ve12gExN56e30Qtt3Cw3LA00lYj9Y0OrAPIbMEzB+6h+qZrkTRhQmdBEg==} - dependencies: - '@rsbuild/core': 0.6.7 - chalk: 4.1.2 - execa: 5.1.1 - fs-extra: 11.2.0 - gray-matter: 4.0.3 - unified: 10.1.2 - dev: false - - /@rspress/theme-default@1.19.1: - resolution: {integrity: sha512-632LlI1WD/sJpg2wsKvAa+Zp3tFZwetLLhXjPofYtuBsmLxyqg6M8g6dsYDTGdcVf6SJR2zzMmWstQK1Iop7nQ==} - engines: {node: '>=14.17.6'} - dependencies: - '@mdx-js/react': 2.3.0(react@18.2.0) - '@rspress/runtime': 1.19.1 - '@rspress/shared': 1.19.1 - body-scroll-lock: 4.0.0-beta.0 - copy-to-clipboard: 3.3.3 - flexsearch: 0.6.32 - github-slugger: 2.0.0 - globby: 11.1.0 - hast-util-from-html: 1.0.0 - html-to-text: 9.0.3 - htmr: 1.0.2(react@18.2.0) - is-html: 3.1.0 - lodash-es: 4.17.21 - nprogress: 0.2.0 - react: 18.2.0 - react-dom: 18.2.0(react@18.2.0) - react-helmet-async: 1.3.0(react-dom@18.2.0)(react@18.2.0) - react-syntax-highlighter: 15.5.0(react@18.2.0) - react-transition-group: 4.4.5(react-dom@18.2.0)(react@18.2.0) - rspack-plugin-virtual-module: 0.1.12 - dev: false - /@selderee/plugin-htmlparser2@0.10.0: resolution: {integrity: sha512-gW69MEamZ4wk1OsOq1nG1jcyhXIQcnrsX5JwixVw/9xaiav8TCyjESAruu1Rz9yyInhgBXxkNwMeygKnN2uxNA==} dependencies: @@ -4886,6 +4752,7 @@ packages: /array-union@2.1.0: resolution: {integrity: sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==} engines: {node: '>=8'} + dev: true /array.prototype.flat@1.3.1: resolution: {integrity: sha512-roTU0KWIOmJ4DRLmwKd19Otg0/mT3qPNt0Qb3GWW8iObuZXxrjB/pzn0R3hqpRSWg4HCwqx+0vwOnWnvlOyeIA==} @@ -5634,6 +5501,7 @@ packages: engines: {node: '>=8'} dependencies: path-type: 4.0.0 + dev: true /dlv@1.1.3: resolution: {integrity: sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==} @@ -6204,6 +6072,7 @@ packages: glob-parent: 5.1.2 merge2: 1.4.1 micromatch: 4.0.5 + dev: true /fast-json-stable-stringify@2.1.0: resolution: {integrity: sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==} @@ -6212,6 +6081,7 @@ packages: resolution: {integrity: sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==} dependencies: reusify: 1.0.4 + dev: true /fault@1.0.4: resolution: {integrity: sha512-CJ0HCB5tL5fYTEA7ToAq5+kTwd++Borf1/bifxd9iT70QcXr4MRrO3Llf8Ifs70q+SJcGHFtnIE/Nw6giCtECA==} @@ -6610,6 +6480,7 @@ packages: ignore: 5.2.4 merge2: 1.4.1 slash: 3.0.0 + dev: true /globby@13.2.2: resolution: {integrity: sha512-Y1zNGV+pzQdh7H39l9zgB4PJqjRNqydvdYCDG4HFXM4XuvSaQQlEc91IU1yALL8gUTDomgBAfz3XJdmUS+oo0w==} @@ -7030,6 +6901,7 @@ packages: /ignore@5.2.4: resolution: {integrity: sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==} engines: {node: '>= 4'} + dev: true /import-fresh@3.3.0: resolution: {integrity: sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==} @@ -8043,6 +7915,7 @@ packages: /merge2@1.4.1: resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==} engines: {node: '>= 8'} + dev: true /micromark-core-commonmark@1.1.0: resolution: {integrity: sha512-BgHO1aRbolh2hcrzL2d1La37V0Aoz73ymF8rAcKnohLy93titmv62E0gP8Hrx9PKcKrqCZ1BbLGbP3bEhoXYlw==} @@ -8363,6 +8236,7 @@ packages: dependencies: braces: 3.0.2 picomatch: 2.3.1 + dev: true /mime-db@1.52.0: resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} @@ -8912,6 +8786,7 @@ packages: /path-type@4.0.0: resolution: {integrity: sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==} engines: {node: '>=8'} + dev: true /pathe@1.1.1: resolution: {integrity: sha512-d+RQGp0MAYTIaDBIMmOfMwz3E+LOZnxx1HZd5R18mmCZY0QBlK0LDZfPc8FW8Ed2DlvsuE6PRjroDY+wg4+j/Q==} @@ -9121,7 +8996,7 @@ packages: dependencies: nanoid: 3.3.7 picocolors: 1.0.0 - source-map-js: 1.2.0 + source-map-js: 1.0.2 /postcss@8.4.38: resolution: {integrity: sha512-Wglpdk03BSfXkHoQa3b/oulrotAkwrlLDRSOb9D0bN86FdRyE9lppSp33aHNPgBa0JKCoB+drFLZkQoRRYae5A==} @@ -9223,6 +9098,7 @@ packages: /queue-microtask@1.2.3: resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} + dev: true /quick-lru@4.0.1: resolution: {integrity: sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g==} @@ -9514,18 +9390,6 @@ packages: unist-util-visit: 4.1.1 dev: false - /rehype-external-links@2.1.0: - resolution: {integrity: sha512-2YMJZVM1hxZnwl9IPkbN5Pjn78kXkAX7lq9VEtlaGA29qIls25vZN+ucNIJdbQUe+9NNFck17BiOhGmsD6oLIg==} - dependencies: - '@types/hast': 2.3.4 - extend: 3.0.2 - hast-util-is-element: 2.1.3 - is-absolute-url: 4.0.1 - space-separated-tokens: 2.0.2 - unified: 10.1.2 - unist-util-visit: 4.1.1 - dev: false - /rehype-stringify@9.0.3: resolution: {integrity: sha512-kWiZ1bgyWlgOxpqD5HnxShKAdXtb2IUljn3hQAhySeak6IOQPPt6DeGnsIh4ixm7yKJWzm8TXFuC/lPfcWHJqw==} dependencies: @@ -9669,6 +9533,7 @@ packages: /reusify@1.0.4: resolution: {integrity: sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==} engines: {iojs: '>=1.0.0', node: '>=0.10.0'} + dev: true /rfdc@1.3.0: resolution: {integrity: sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA==} @@ -9721,22 +9586,6 @@ packages: fs-extra: 11.2.0 dev: false - /rspress@1.19.1(@swc/helpers@0.5.3)(webpack@5.88.2): - resolution: {integrity: sha512-yUKN7wW0qrn68j4xsJVr9Lv2hCEGKWcMydHOte0ipDzF5q5EL3c3+co1IY91LTwhMeJ6n1oPP4XYFPAO03Dbmw==} - hasBin: true - dependencies: - '@rsbuild/core': 0.6.7 - '@rspress/core': 1.19.1(@swc/helpers@0.5.3)(webpack@5.88.2) - '@rspress/shared': 1.19.1 - cac: 6.7.14 - chalk: 5.3.0 - chokidar: 3.6.0 - transitivePeerDependencies: - - '@swc/helpers' - - supports-color - - webpack - dev: false - /run-async@2.4.1: resolution: {integrity: sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==} engines: {node: '>=0.12.0'} @@ -9746,6 +9595,7 @@ packages: resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==} dependencies: queue-microtask: 1.2.3 + dev: true /rxjs@7.8.1: resolution: {integrity: sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==} @@ -9951,6 +9801,7 @@ packages: /slash@3.0.0: resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==} engines: {node: '>=8'} + dev: true /slash@4.0.0: resolution: {integrity: sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==} @@ -10006,6 +9857,10 @@ packages: solid-js: 1.8.16 dev: false + /source-map-js@1.0.2: + resolution: {integrity: sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==} + engines: {node: '>=0.10.0'} + /source-map-js@1.2.0: resolution: {integrity: sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg==} engines: {node: '>=0.10.0'} From 706290035bf0e229535db5ec56b24b659bdac966 Mon Sep 17 00:00:00 2001 From: SoonIter Date: Tue, 30 Apr 2024 03:06:49 +0800 Subject: [PATCH 5/7] chore: update --- .../doc/api/client-api/_meta.json | 13 ------------- .../auto-nav-sidebar-js/doc/api/client-api/_meta.ts | 13 +++++++++++++ packages/plugin-auto-nav-sidebar/src/walk.ts | 9 +++++---- 3 files changed, 18 insertions(+), 17 deletions(-) delete mode 100644 e2e/fixtures/auto-nav-sidebar-js/doc/api/client-api/_meta.json create mode 100644 e2e/fixtures/auto-nav-sidebar-js/doc/api/client-api/_meta.ts diff --git a/e2e/fixtures/auto-nav-sidebar-js/doc/api/client-api/_meta.json b/e2e/fixtures/auto-nav-sidebar-js/doc/api/client-api/_meta.json deleted file mode 100644 index d6f2228e4..000000000 --- a/e2e/fixtures/auto-nav-sidebar-js/doc/api/client-api/_meta.json +++ /dev/null @@ -1,13 +0,0 @@ -[ - { - "type": "file", - "name": "index", - "label": "Client API Overview" - }, - { - "type": "file", - "name": "api-runtime", - "overviewHeaders": [] - }, - "api-components" -] diff --git a/e2e/fixtures/auto-nav-sidebar-js/doc/api/client-api/_meta.ts b/e2e/fixtures/auto-nav-sidebar-js/doc/api/client-api/_meta.ts new file mode 100644 index 000000000..166e8b304 --- /dev/null +++ b/e2e/fixtures/auto-nav-sidebar-js/doc/api/client-api/_meta.ts @@ -0,0 +1,13 @@ +export default [ + { + type: 'file', + name: 'index', + label: 'Client API Overview', + }, + { + type: 'file', + name: 'api-runtime', + overviewHeaders: [], + }, + 'api-components', +]; diff --git a/packages/plugin-auto-nav-sidebar/src/walk.ts b/packages/plugin-auto-nav-sidebar/src/walk.ts index 2c07a867e..0fbf01620 100644 --- a/packages/plugin-auto-nav-sidebar/src/walk.ts +++ b/packages/plugin-auto-nav-sidebar/src/walk.ts @@ -51,10 +51,11 @@ async function getSideMetaFromMetaFile( await Promise.all( subItems.map(async item => { // Fix https://github.com/web-infra-dev/rspress/issues/346 - if (item === '_meta.json') { - return null; - } - if (item === '_meta.js') { + if ( + item === '_meta.json' || + item === '_meta.js' || + item === '_meta.ts' + ) { return null; } const stat = await fs.stat(path.join(workDir, item)); From 833ab2924bc0ec9e8d4a0792cb8836a3978399fa Mon Sep 17 00:00:00 2001 From: SoonIter Date: Tue, 30 Apr 2024 03:07:33 +0800 Subject: [PATCH 6/7] chore: update --- .changeset/brave-cycles-kick.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/brave-cycles-kick.md diff --git a/.changeset/brave-cycles-kick.md b/.changeset/brave-cycles-kick.md new file mode 100644 index 000000000..cfb936443 --- /dev/null +++ b/.changeset/brave-cycles-kick.md @@ -0,0 +1,5 @@ +--- +"@rspress/plugin-auto-nav-sidebar": minor +--- + +support \_meta.{js,ts} From e12f860d76dc22d3fe5dab4d44faf7f49403f2d2 Mon Sep 17 00:00:00 2001 From: SoonIter Date: Tue, 30 Apr 2024 03:11:50 +0800 Subject: [PATCH 7/7] chore: update --- packages/plugin-api-docgen/package.json | 8 ++++++-- packages/plugin-medium-zoom/package.json | 18 +++++++++++++----- pnpm-lock.yaml | 12 ++++++------ 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/packages/plugin-api-docgen/package.json b/packages/plugin-api-docgen/package.json index 43deab398..80d398146 100644 --- a/packages/plugin-api-docgen/package.json +++ b/packages/plugin-api-docgen/package.json @@ -22,7 +22,6 @@ "node": ">=14.17.6" }, "dependencies": { - "@rspress/shared": "workspace:*", "@modern-js/utils": "2.49.2", "react-markdown": "8.0.7", "react-docgen-typescript": "2.2.2", @@ -30,6 +29,7 @@ "remark-gfm": "3.0.1" }, "devDependencies": { + "@rspress/shared": "workspace:*", "@types/mdast": "^3.0.10", "@types/node": "^18.11.17", "@types/react": "^18", @@ -53,7 +53,11 @@ "optional": true } }, - "files": ["dist", "static", "mdx-meta-loader.cjs"], + "files": [ + "dist", + "static", + "mdx-meta-loader.cjs" + ], "publishConfig": { "access": "public", "provenance": true, diff --git a/packages/plugin-medium-zoom/package.json b/packages/plugin-medium-zoom/package.json index 1b552f00c..f1945c648 100644 --- a/packages/plugin-medium-zoom/package.json +++ b/packages/plugin-medium-zoom/package.json @@ -30,20 +30,28 @@ "@types/react-dom": "^18", "typescript": "^5", "vitest": "0.34.1", - "react": "^18.2.0" + "react": "^18.2.0", + "@rspress/shared": "workspace:*" }, "peerDependencies": { "@rspress/runtime": "^1.0.2" }, - "sideEffects": ["*.css", "*.less", "*.sass", "*.scss"], - "files": ["dist", "src"], + "sideEffects": [ + "*.css", + "*.less", + "*.sass", + "*.scss" + ], + "files": [ + "dist", + "src" + ], "publishConfig": { "access": "public", "provenance": true, "registry": "https://registry.npmjs.org/" }, "dependencies": { - "medium-zoom": "1.1.0", - "@rspress/shared": "workspace:*" + "medium-zoom": "1.1.0" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d2922ce13..a0fe908ac 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -757,9 +757,6 @@ importers: '@rspress/core': specifier: ^1.0.2 version: link:../core - '@rspress/shared': - specifier: workspace:* - version: link:../shared documentation: specifier: 14.0.2 version: 14.0.2 @@ -773,6 +770,9 @@ importers: specifier: 3.0.1 version: 3.0.1 devDependencies: + '@rspress/shared': + specifier: workspace:* + version: link:../shared '@types/mdast': specifier: ^3.0.10 version: 3.0.12 @@ -890,9 +890,6 @@ importers: '@rspress/runtime': specifier: ^1.0.2 version: link:../runtime - '@rspress/shared': - specifier: workspace:* - version: link:../shared medium-zoom: specifier: 1.1.0 version: 1.1.0 @@ -900,6 +897,9 @@ importers: '@modern-js/tsconfig': specifier: 2.49.2 version: 2.49.2 + '@rspress/shared': + specifier: workspace:* + version: link:../shared '@types/node': specifier: ^18.11.17 version: 18.11.17