diff --git a/packages/cli/src/update.ts b/packages/cli/src/update.ts index fb85b50a9..d7854ae56 100644 --- a/packages/cli/src/update.ts +++ b/packages/cli/src/update.ts @@ -1,9 +1,17 @@ import { spawn } from 'node:child_process'; import fs from 'node:fs/promises'; import path from 'node:path'; -import fse from '@rspress/shared/fs-extra'; import { logger } from '@rspress/shared/logger'; +async function pathExists(path: string): Promise { + try { + await fs.access(path); + return true; + } catch { + return false; + } +} + type PackageManager = 'npm' | 'yarn' | 'pnpm' | 'bun'; const lockfileMap: Record = { @@ -16,7 +24,7 @@ const lockfileMap: Record = { async function getPackageManager(rootPath: string) { let packageManager: PackageManager = 'npm'; for (const file of Object.keys(lockfileMap)) { - if (await fse.pathExists(path.join(rootPath, file))) { + if (await pathExists(path.join(rootPath, file))) { packageManager = lockfileMap[file]; break; } diff --git a/packages/core/src/node/build.ts b/packages/core/src/node/build.ts index af1c332ee..04da2835a 100644 --- a/packages/core/src/node/build.ts +++ b/packages/core/src/node/build.ts @@ -1,3 +1,4 @@ +import fs from 'node:fs/promises'; import { dirname, join } from 'node:path'; import { pathToFileURL } from 'node:url'; import type { Route } from '@/node/route/RouteService'; @@ -11,7 +12,6 @@ import { withBase, } from '@rspress/shared'; import chalk from '@rspress/shared/chalk'; -import fs from '@rspress/shared/fs-extra'; import { logger } from '@rspress/shared/logger'; import type { HelmetData } from 'react-helmet-async'; import { PluginDriver } from './PluginDriver'; @@ -50,6 +50,7 @@ export async function bundle( pluginDriver, enableSSG, ); + await rsbuild.build(); } finally { await writeSearchIndex(config); @@ -57,6 +58,10 @@ export async function bundle( } } +function emptyDir(path: string): Promise { + return fs.rm(path, { force: true, recursive: true }); +} + export interface SSRBundleExports { render: ( url: string, @@ -77,7 +82,6 @@ export async function renderPages( const ssrBundlePath = join(outputPath, 'ssr', 'main.cjs'); try { - const { default: fs } = await import('@rspress/shared/fs-extra'); const { version } = await import('../../package.json'); // There are two cases where we will fallback to CSR: // 1. ssr bundle load failed @@ -204,15 +208,17 @@ export async function renderPages( return `${path}.html`.replace(normalizedBase, ''); }; const fileName = normalizeHtmlFilePath(routePath); - await fs.ensureDir(join(outputPath, dirname(fileName))); + await fs.mkdir(join(outputPath, dirname(fileName)), { + recursive: true, + }); await fs.writeFile(join(outputPath, fileName), html); }), ); // Remove ssr bundle if (!isDebugMode()) { - await fs.remove(join(outputPath, 'ssr')); + await emptyDir(join(outputPath, 'ssr')); } - await fs.remove(join(outputPath, 'html')); + await emptyDir(join(outputPath, 'html')); const totalTime = Date.now() - startTime; logger.success(`Pages rendered in ${chalk.yellow(totalTime)} ms.`); @@ -227,13 +233,15 @@ export async function build(options: BuildOptions) { const pluginDriver = new PluginDriver(config, true); await pluginDriver.init(); const modifiedConfig = await pluginDriver.modifyConfig(); + await pluginDriver.beforeBuild(); const ssgConfig = modifiedConfig.ssg ?? true; // empty temp dir before build - await fs.emptyDir(TEMP_DIR); + await emptyDir(TEMP_DIR); await bundle(docDirectory, modifiedConfig, pluginDriver, Boolean(ssgConfig)); + await renderPages(appDirectory, modifiedConfig, pluginDriver, ssgConfig); await pluginDriver.afterBuild(); } diff --git a/packages/core/src/node/dev.ts b/packages/core/src/node/dev.ts index 23514a2f1..8db2f2e6c 100644 --- a/packages/core/src/node/dev.ts +++ b/packages/core/src/node/dev.ts @@ -27,7 +27,6 @@ export async function dev(options: DevOptions): Promise { await pluginDriver.beforeBuild(); // empty temp dir before build - // await fs.emptyDir( TEMP_DIR); const builder = await initRsbuild( docDirectory, modifiedConfig, diff --git a/packages/core/src/node/initRsbuild.ts b/packages/core/src/node/initRsbuild.ts index 13422a17d..70db6889f 100644 --- a/packages/core/src/node/initRsbuild.ts +++ b/packages/core/src/node/initRsbuild.ts @@ -1,3 +1,4 @@ +import fs from 'node:fs/promises'; import path from 'node:path'; import type { RsbuildConfig, @@ -15,7 +16,6 @@ import { removeLeadingSlash, removeTrailingSlash, } from '@rspress/shared'; -import fs from '@rspress/shared/fs-extra'; import type { PluginDriver } from './PluginDriver'; import { CLIENT_ENTRY, @@ -321,7 +321,7 @@ export async function initRsbuild( // and we should empty temp dir before build const runtimeTempDir = path.join(RSPRESS_TEMP_DIR, 'runtime'); const runtimeAbsTempDir = path.join(cwd, 'node_modules', runtimeTempDir); - await fs.ensureDir(runtimeAbsTempDir); + await fs.mkdir(runtimeAbsTempDir, { recursive: true }); const routeService = await initRouteService({ config, diff --git a/packages/core/src/node/mdx/loader.ts b/packages/core/src/node/mdx/loader.ts index f1164fb29..6502dc524 100644 --- a/packages/core/src/node/mdx/loader.ts +++ b/packages/core/src/node/mdx/loader.ts @@ -1,8 +1,8 @@ +import fs from 'node:fs/promises'; import path from 'node:path'; import { pathToFileURL } from 'node:url'; import { createProcessor } from '@mdx-js/mdx'; import { isProduction } from '@rspress/shared'; -import fs from '@rspress/shared/fs-extra'; import { logger } from '@rspress/shared/logger'; import { loadFrontMatter } from '@rspress/shared/node-utils'; import type { PluginDriver } from '../PluginDriver'; diff --git a/packages/core/src/node/route/RouteService.ts b/packages/core/src/node/route/RouteService.ts index c45e2864e..4a4a40e8e 100644 --- a/packages/core/src/node/route/RouteService.ts +++ b/packages/core/src/node/route/RouteService.ts @@ -1,3 +1,4 @@ +import fs from 'node:fs/promises'; import path from 'node:path'; import { type PageModule, @@ -7,7 +8,6 @@ import { addTrailingSlash, withBase, } from '@rspress/shared'; -import fs from '@rspress/shared/fs-extra'; import type { ComponentType } from 'react'; import { glob } from 'tinyglobby'; import type { PluginDriver } from '../PluginDriver'; diff --git a/packages/core/src/node/runtimeModule/globalStyles.ts b/packages/core/src/node/runtimeModule/globalStyles.ts index 4e6bde62d..c4c665ae4 100644 --- a/packages/core/src/node/runtimeModule/globalStyles.ts +++ b/packages/core/src/node/runtimeModule/globalStyles.ts @@ -1,4 +1,4 @@ -import fs from '@rspress/shared/fs-extra'; +import fs from 'node:fs/promises'; import { type FactoryContext, RuntimeModuleID } from '.'; export async function globalStylesVMPlugin(context: FactoryContext) { diff --git a/packages/core/src/node/runtimeModule/siteData/extractPageData.ts b/packages/core/src/node/runtimeModule/siteData/extractPageData.ts index ffd53c0b7..8cfb52ef3 100644 --- a/packages/core/src/node/runtimeModule/siteData/extractPageData.ts +++ b/packages/core/src/node/runtimeModule/siteData/extractPageData.ts @@ -1,3 +1,4 @@ +import fs from 'node:fs/promises'; import path from 'node:path'; import { importStatementRegex } from '@/node/constants'; import type { RouteService } from '@/node/route/RouteService'; @@ -10,7 +11,6 @@ import { type PageIndexInfo, type ReplaceRule, } from '@rspress/shared'; -import fs from '@rspress/shared/fs-extra'; import { loadFrontMatter } from '@rspress/shared/node-utils'; import { htmlToText } from 'html-to-text'; diff --git a/packages/core/src/node/runtimeModule/siteData/index.ts b/packages/core/src/node/runtimeModule/siteData/index.ts index 661e83d44..6bafaba5e 100644 --- a/packages/core/src/node/runtimeModule/siteData/index.ts +++ b/packages/core/src/node/runtimeModule/siteData/index.ts @@ -1,8 +1,8 @@ +import fs from 'node:fs/promises'; import path from 'node:path'; import { TEMP_DIR, isProduction } from '@/node/constants'; import { createHash } from '@/node/utils'; import { SEARCH_INDEX_NAME, type SiteData } from '@rspress/shared'; -import fs from '@rspress/shared/fs-extra'; import { groupBy } from 'lodash-es'; import { type FactoryContext, RuntimeModuleID } from '..'; import { extractPageData } from './extractPageData'; @@ -97,7 +97,7 @@ export async function siteDataVMPlugin(context: FactoryContext) { const indexVersion = version ? `.${version.replace('.', '_')}` : ''; const indexLang = lang ? `.${lang}` : ''; - await fs.ensureDir(TEMP_DIR); + await fs.mkdir(TEMP_DIR, { recursive: true }); await fs.writeFile( path.join( TEMP_DIR, diff --git a/packages/core/src/node/searchIndex.ts b/packages/core/src/node/searchIndex.ts index b1296459e..425d898de 100644 --- a/packages/core/src/node/searchIndex.ts +++ b/packages/core/src/node/searchIndex.ts @@ -1,8 +1,9 @@ +import { createReadStream } from 'node:fs'; +import fs from 'node:fs/promises'; import type { IncomingMessage, ServerResponse } from 'node:http'; import path, { join } from 'node:path'; import { SEARCH_INDEX_NAME, type UserConfig, isSCM } from '@rspress/shared'; import chalk from '@rspress/shared/chalk'; -import fs from '@rspress/shared/fs-extra'; import { logger } from '@rspress/shared/logger'; import { OUTPUT_DIR, TEMP_DIR, isProduction } from './constants'; @@ -15,9 +16,14 @@ export async function writeSearchIndex(config: UserConfig) { const searchIndexFiles = await fs.readdir(TEMP_DIR); const outDir = config?.outDir ?? join(cwd, OUTPUT_DIR); + // Make sure the targetDir exists + const targetDir = join(outDir, 'static'); + await fs.mkdir(targetDir, { recursive: true }); + // For performance, we only stitch the string of search index data instead of big JavaScript object in memory let searchIndexData = '[]'; let scanning = false; + // TODO: use Promise for perf for (const searchIndexFile of searchIndexFiles) { if ( !searchIndexFile.includes(SEARCH_INDEX_NAME) || @@ -26,7 +32,7 @@ export async function writeSearchIndex(config: UserConfig) { continue; } const source = join(TEMP_DIR, searchIndexFile); - const target = join(outDir, 'static', searchIndexFile); + const target = join(targetDir, searchIndexFile); const searchIndex = await fs.readFile( join(TEMP_DIR, searchIndexFile), 'utf-8', @@ -34,7 +40,7 @@ export async function writeSearchIndex(config: UserConfig) { searchIndexData = `${searchIndexData.slice(0, -1)}${ scanning ? ',' : '' }${searchIndex.slice(1)}`; - await fs.move(source, target, { overwrite: true }); + await fs.rename(source, target); scanning = true; } @@ -75,7 +81,7 @@ export function serveSearchIndexMiddleware(config: UserConfig): RequestHandler { res.setHeader('Content-Type', 'application/json'); // Get search index name from request url const searchIndexFile = req.url?.split('/').pop(); - fs.createReadStream( + createReadStream( path.join( process.cwd(), config?.outDir || OUTPUT_DIR, diff --git a/packages/core/src/node/utils/detectReactVersion.ts b/packages/core/src/node/utils/detectReactVersion.ts index 01a7f4850..eec599d87 100644 --- a/packages/core/src/node/utils/detectReactVersion.ts +++ b/packages/core/src/node/utils/detectReactVersion.ts @@ -1,9 +1,11 @@ +import fs from 'node:fs'; import path from 'node:path'; -import fs from '@rspress/shared/fs-extra'; import { logger } from '@rspress/shared/logger'; import enhancedResolve from 'enhanced-resolve'; import { PACKAGE_ROOT } from '../constants'; +import { pathExists, readJson } from './fs'; +// TODO: replace enhanced-resolve with this.getResolver const { CachedInputFileSystem, ResolverFactory } = enhancedResolve; const DEFAULT_REACT_VERSION = 18; @@ -14,9 +16,11 @@ export async function detectReactVersion(): Promise { // if not found, return 18 const cwd = process.cwd(); const reactPath = path.join(cwd, 'node_modules', 'react'); - if (await fs.pathExists(reactPath)) { - const reactPkg = await fs.readJson(path.join(reactPath, 'package.json')); - const version = Number(reactPkg.version.split('.')[0]); + if (await pathExists(reactPath)) { + const reactPkg: { version?: string } = await readJson( + path.join(reactPath, 'package.json'), + ); + const version = Number(reactPkg.version?.split('.')[0]); return version; } diff --git a/packages/core/src/node/utils/flattenMdxContent.ts b/packages/core/src/node/utils/flattenMdxContent.ts index 30bc26edc..5998f3438 100644 --- a/packages/core/src/node/utils/flattenMdxContent.ts +++ b/packages/core/src/node/utils/flattenMdxContent.ts @@ -1,7 +1,7 @@ +import fs from 'node:fs'; import path from 'node:path'; import { createProcessor } from '@mdx-js/mdx'; import { MDX_REGEXP } from '@rspress/shared'; -import fs from '@rspress/shared/fs-extra'; import enhancedResolve from 'enhanced-resolve'; import { importStatementRegex } from '../constants'; diff --git a/packages/core/src/node/utils/fs.ts b/packages/core/src/node/utils/fs.ts new file mode 100644 index 000000000..9701e49ee --- /dev/null +++ b/packages/core/src/node/utils/fs.ts @@ -0,0 +1,15 @@ +import fs from 'node:fs/promises'; + +export async function pathExists(path: string): Promise { + try { + await fs.access(path); + return true; + } catch { + return false; + } +} + +export async function readJson(path: string): Promise { + const raw = await fs.readFile(path, 'utf8'); + return JSON.parse(raw); +} diff --git a/packages/core/src/node/utils/index.ts b/packages/core/src/node/utils/index.ts index e38a4bb62..b4854de87 100644 --- a/packages/core/src/node/utils/index.ts +++ b/packages/core/src/node/utils/index.ts @@ -7,3 +7,4 @@ export * from './flattenMdxContent'; export * from './applyReplaceRules'; export * from './extractTextAndId'; export * from './escapeHeadingIds'; +export * from './fs'; diff --git a/packages/core/src/node/utils/renderHead.ts b/packages/core/src/node/utils/renderHead.ts index dba058b9a..4d7d49890 100644 --- a/packages/core/src/node/utils/renderHead.ts +++ b/packages/core/src/node/utils/renderHead.ts @@ -1,10 +1,10 @@ +import fs from 'node:fs/promises'; import type { FrontMatterMeta, RouteMeta, UserConfig } from '@rspress/shared'; -import fsExtra from '@rspress/shared/fs-extra'; import { loadFrontMatter } from '@rspress/shared/node-utils'; export async function renderFrontmatterHead(route: any): Promise { if (!isRouteMeta(route)) return ''; - const content = await fsExtra.readFile(route.absolutePath, { + const content = await fs.readFile(route.absolutePath, { encoding: 'utf-8', }); const { diff --git a/packages/modern-plugin-rspress/src/launchDoc.ts b/packages/modern-plugin-rspress/src/launchDoc.ts index e0957e3cc..6cd700f03 100644 --- a/packages/modern-plugin-rspress/src/launchDoc.ts +++ b/packages/modern-plugin-rspress/src/launchDoc.ts @@ -1,4 +1,4 @@ -import fs from 'node:fs'; +import fs from 'node:fs/promises'; import { join, relative, resolve } from 'node:path'; import type { Sidebar, SidebarGroup, UserConfig } from '@rspress/core'; import { pluginApiDocgen } from '@rspress/plugin-api-docgen'; @@ -34,7 +34,7 @@ export async function launchDoc({ previewMode = 'iframe'; } const json = JSON.parse( - fs.readFileSync(resolve(appDir, './package.json'), 'utf8'), + await fs.readFile(resolve(appDir, './package.json'), 'utf8'), ); const root = resolve(appDir, doc.root ?? 'docs'); const { dev, build } = await import('@rspress/core'); diff --git a/packages/plugin-auto-nav-sidebar/src/utils.ts b/packages/plugin-auto-nav-sidebar/src/utils.ts index f7c75beb6..6e3aed95c 100644 --- a/packages/plugin-auto-nav-sidebar/src/utils.ts +++ b/packages/plugin-auto-nav-sidebar/src/utils.ts @@ -1,9 +1,23 @@ +import fs from 'node:fs/promises'; import path from 'node:path'; import type { NavItem, Sidebar } from '@rspress/shared'; -import fs from '@rspress/shared/fs-extra'; import { logger } from '@rspress/shared/logger'; import { loadFrontMatter } from '@rspress/shared/node-utils'; +export async function pathExists(path: string): Promise { + try { + await fs.access(path); + return true; + } catch { + return false; + } +} + +export async function readJson(path: string): Promise { + const raw = await fs.readFile(path, 'utf8'); + return JSON.parse(raw); +} + /** * @param rawPathWithExtension /usr/rspress-demo/docs/api.md * @returns /usr/rspress-demo/docs/api.md or undefined @@ -11,7 +25,7 @@ import { loadFrontMatter } from '@rspress/shared/node-utils'; export async function detectFilePathWithExtension( rawPathWithExtension: string, ): Promise { - const exist = await fs.pathExists(rawPathWithExtension); + const exist = await pathExists(rawPathWithExtension); if (!exist) { return undefined; } diff --git a/packages/plugin-auto-nav-sidebar/src/walk.ts b/packages/plugin-auto-nav-sidebar/src/walk.ts index e8b795eac..9820aa770 100644 --- a/packages/plugin-auto-nav-sidebar/src/walk.ts +++ b/packages/plugin-auto-nav-sidebar/src/walk.ts @@ -1,3 +1,4 @@ +import fs from 'node:fs/promises'; import path, { join } from 'node:path'; import { type NavItem, @@ -10,13 +11,14 @@ import { slash, withBase, } from '@rspress/shared'; -import fs from '@rspress/shared/fs-extra'; import { logger } from '@rspress/shared/logger'; import type { NavMeta, SideMeta } from './type'; import { detectFilePath, extractInfoFromFrontmatter, extractInfoFromFrontmatterWithRealPath, + pathExists, + readJson, } from './utils'; function getHmrFileKey(realPath: string | undefined, docsDir: string) { @@ -35,7 +37,7 @@ export async function scanSideMeta( ): Promise< (SidebarGroup | SidebarItem | SidebarDivider | SidebarSectionHeader)[] > { - if (!(await fs.exists(workDir))) { + if (!(await pathExists(workDir))) { logger.error( '[plugin-auto-nav-sidebar]', `Generate sidebar meta error: ${workDir} not exists`, @@ -50,7 +52,7 @@ export async function scanSideMeta( // 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; + sideMeta = (await readJson(metaFile)) 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); @@ -187,7 +189,9 @@ export async function scanSideMeta( const isIndexFileInMetaItems = indexItemIndex !== -1; if (isIndexFileInMetaItems) { - const isMetaJsonExist = await fs.exists(join(subDir, '_meta.json')); + const isMetaJsonExist = await pathExists( + join(subDir, '_meta.json'), + ); if (isMetaJsonExist) { link = ''; _fileKey = getHmrFileKey(indexFileRealPath, docsDir); @@ -282,7 +286,7 @@ export async function walk( let navConfig: NavMeta | undefined; // Get the nav config from the `_meta.json` file try { - navConfig = (await fs.readJSON(rootMetaFile, 'utf8')) as NavItem[]; + navConfig = (await readJson(rootMetaFile)) as NavItem[]; } catch (e) { navConfig = []; } @@ -300,10 +304,20 @@ export async function walk( } }); // find the `_meta.json` file in the subdirectory - const subDirs = (await fs.readdir(workDir)).filter( - v => - fs.statSync(path.join(workDir, v)).isDirectory() && v !== 'node_modules', - ); + const subDirs: string[] = ( + await Promise.all( + ( + await fs.readdir(workDir) + ).map(v => { + return fs.stat(path.join(workDir, v)).then(s => { + if (s.isDirectory()) { + return v; + } + return false; + }); + }), + ) + ).filter(Boolean) as string[]; // Every sub dir will represent a group of sidebar const sidebarConfig: Sidebar = {}; for (const subDir of subDirs) { diff --git a/packages/plugin-playground/src/cli/index.ts b/packages/plugin-playground/src/cli/index.ts index fec924af4..f345cb951 100644 --- a/packages/plugin-playground/src/cli/index.ts +++ b/packages/plugin-playground/src/cli/index.ts @@ -1,3 +1,4 @@ +import fs from 'node:fs'; import path, { join } from 'node:path'; import { DEFAULT_BABEL_URL, DEFAULT_MONACO_URL } from '@/web/constant'; import { normalizeUrl } from '@/web/utils'; @@ -74,8 +75,6 @@ export function pluginPlayground( return config; }, async routeGenerated(routes: RouteMeta[]) { - const { default: fs } = await import('@rspress/shared/fs-extra'); - // init routeMeta routeMeta = routes; @@ -98,7 +97,7 @@ export function pluginPlayground( format: path.extname(filepath).slice(1) as 'mdx' | 'md', remarkPlugins: [remarkGFM], }); - const source = await fs.readFile(filepath, 'utf-8'); + const source = await fs.promises.readFile(filepath, 'utf-8'); const ast = processor.parse(source); visit(ast, 'mdxJsxFlowElement', (node: any) => { diff --git a/packages/plugin-playground/src/cli/remarkPlugin.ts b/packages/plugin-playground/src/cli/remarkPlugin.ts index aef7e6a9a..35ffcd1c2 100644 --- a/packages/plugin-playground/src/cli/remarkPlugin.ts +++ b/packages/plugin-playground/src/cli/remarkPlugin.ts @@ -1,6 +1,6 @@ +import fs from 'node:fs'; import { dirname, join, resolve } from 'node:path'; import type { RouteMeta } from '@rspress/shared'; -import fs from '@rspress/shared/fs-extra'; import type { Root } from 'mdast'; import type { Plugin } from 'unified'; import { visit } from 'unist-util-visit'; diff --git a/packages/plugin-preview/src/remarkPlugin.ts b/packages/plugin-preview/src/remarkPlugin.ts index ef7615025..b218c7411 100644 --- a/packages/plugin-preview/src/remarkPlugin.ts +++ b/packages/plugin-preview/src/remarkPlugin.ts @@ -1,6 +1,6 @@ +import fs from 'node:fs'; import { dirname, join, resolve } from 'node:path'; import { normalizePosixPath } from '@rspress/shared'; -import fs from '@rspress/shared/fs-extra'; import type { Root } from 'mdast'; import type { MdxjsEsm } from 'mdast-util-mdxjs-esm'; import type { Plugin } from 'unified'; @@ -24,7 +24,7 @@ export const remarkCodeToDemo: Plugin<[RemarkPluginOptions], Root> = function ({ previewCodeTransform, }) { const routeMeta = getRouteMeta(); - fs.ensureDirSync(virtualDir); + fs.mkdirSync(virtualDir, { recursive: true }); const data = this.data() as { pageMeta: Record; }; diff --git a/packages/plugin-typedoc/src/patch.ts b/packages/plugin-typedoc/src/patch.ts index e519e2697..70bed01b6 100644 --- a/packages/plugin-typedoc/src/patch.ts +++ b/packages/plugin-typedoc/src/patch.ts @@ -1,5 +1,5 @@ +import fs from 'node:fs/promises'; import path from 'node:path'; -import fs from '@rspress/shared/fs-extra'; async function patchLinks(outputDir: string) { // Patch links in markdown files diff --git a/packages/shared/modern.config.ts b/packages/shared/modern.config.ts index b49e088dc..1a20ab4d4 100644 --- a/packages/shared/modern.config.ts +++ b/packages/shared/modern.config.ts @@ -7,7 +7,6 @@ const config: ReturnType = defineConfig({ input: [ 'src/index.ts', 'src/logger.ts', - 'src/fs-extra.ts', 'src/chalk.ts', 'src/node-utils.ts', ], @@ -21,7 +20,6 @@ const config: ReturnType = defineConfig({ input: [ 'src/index.ts', 'src/logger.ts', - 'src/fs-extra.ts', 'src/chalk.ts', 'src/node-utils.ts', ], diff --git a/packages/shared/package.json b/packages/shared/package.json index 89bb86e96..c40f27e94 100644 --- a/packages/shared/package.json +++ b/packages/shared/package.json @@ -18,11 +18,6 @@ "import": "./dist/chalk.mjs", "require": "./dist/chalk.js" }, - "./fs-extra": { - "types": "./dist/fs-extra.d.ts", - "import": "./dist/fs-extra.mjs", - "require": "./dist/fs-extra.js" - }, "./logger": { "types": "./dist/logger.d.ts", "import": "./dist/logger.mjs", @@ -52,13 +47,11 @@ "dependencies": { "@rsbuild/core": "1.2.3", "chalk": "5.4.1", - "fs-extra": "11.3.0", "gray-matter": "4.0.3", "lodash-es": "^4.17.21", "unified": "^10.1.2" }, "devDependencies": { - "@types/fs-extra": "11.0.4", "@types/jest": "~29.5.14", "@types/lodash-es": "^4.17.12", "@types/node": "^18.11.17", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 308cfdfa8..09b8ec957 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1524,9 +1524,6 @@ importers: chalk: specifier: 5.4.1 version: 5.4.1 - fs-extra: - specifier: 11.3.0 - version: 11.3.0 gray-matter: specifier: 4.0.3 version: 4.0.3 @@ -1537,9 +1534,6 @@ importers: specifier: ^10.1.2 version: 10.1.2 devDependencies: - '@types/fs-extra': - specifier: 11.0.4 - version: 11.0.4 '@types/jest': specifier: ~29.5.14 version: 29.5.14