Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/metal-turkeys-pay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@alauda/doom-export": patch
---

chore(deps): lock playwright version
5 changes: 5 additions & 0 deletions .changeset/silly-rabbits-invite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@alauda/doom": patch
---

feat: support check dead links in lint command
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,20 @@
"devDependencies": {
"@changesets/changelog-github": "^0.5.1",
"@changesets/cli": "^2.29.7",
"@eslint/js": "^9.35.0",
"@eslint/js": "^9.36.0",
"@swc-node/register": "^1.11.1",
"@swc/core": "1.13.5",
"@swc/core": "^1.13.20",
"@types/cli-progress": "^3.11.6",
"@types/ejs": "^3.1.5",
"@types/mdast": "^4.0.4",
"@types/node": "^22.18.5",
"@types/node": "^22.18.6",
"@types/picomatch": "^4.0.2",
"@types/pluralize": "^0.0.33",
"@types/react": "^19.1.13",
"@types/react": "^19.1.15",
"@types/react-dom": "^19.1.9",
"@types/swagger2openapi": "^7.0.4",
"@unts/patch-package": "^8.1.1",
"eslint": "^9.35.0",
"eslint": "^9.36.0",
"eslint-import-resolver-typescript": "^4.4.4",
"eslint-plugin-import-x": "^4.16.1",
"eslint-plugin-react-hooks": "^5.2.0",
Expand Down
26 changes: 13 additions & 13 deletions packages/doom/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,25 +45,25 @@
"@eslint-react/eslint-plugin": "^1.53.1",
"@inquirer/prompts": "^7.8.6",
"@openapi-contrib/openapi-schema-to-json-schema": "^5.1.0",
"@playwright/browser-chromium": "^1.55.0",
"@rsbuild/plugin-react": "^1.4.0",
"@playwright/browser-chromium": "^1.55.1",
"@rsbuild/plugin-react": "^1.4.1",
"@rsbuild/plugin-sass": "^1.4.0",
"@rsbuild/plugin-svgr": "^1.2.2",
"@rsbuild/plugin-yaml": "^1.0.3",
"@rspress/core": "2.0.0-beta.32",
"@rspress/plugin-algolia": "2.0.0-beta.32",
"@rspress/plugin-llms": "2.0.0-beta.32",
"@rspress/plugin-sitemap": "2.0.0-beta.32",
"@rspress/shared": "2.0.0-beta.32",
"@shikijs/transformers": "^3.12.2",
"@rspress/core": "2.0.0-beta.34",
"@rspress/plugin-algolia": "2.0.0-beta.34",
"@rspress/plugin-llms": "2.0.0-beta.34",
"@rspress/plugin-sitemap": "2.0.0-beta.34",
"@rspress/shared": "2.0.0-beta.34",
"@shikijs/transformers": "^3.13.0",
"@total-typescript/ts-reset": "^0.6.1",
"ab64": "^0.1.6",
"chokidar": "^4.0.3",
"clsx": "^2.1.1",
"commander": "^13.1.0 || ^14.0.1",
"ejs": "^3.1.10",
"es-toolkit": "^1.39.10",
"eslint": "^9.35.0",
"eslint": "^9.36.0",
"eslint-plugin-mdx": "^3.6.2",
"globals": "^16.4.0",
"html-tag-names": "^2.1.0",
Expand All @@ -74,8 +74,8 @@
"mdast-util-phrasing": "^4.1.0",
"mdast-util-to-markdown": "^2.1.2",
"mdast-util-to-string": "^4.0.0",
"mermaid": "^11.11.0",
"openai": "^5.20.3",
"mermaid": "^11.12.0",
"openai": "^5.23.1",
"openapi-types": "^12.1.3",
"p-ratelimit": "^1.0.1",
"picomatch": "^4.0.3",
Expand All @@ -96,14 +96,14 @@
"remark-mdx": "^3.1.1",
"remark-message-control": "^8.0.0",
"remark-stringify": "^11.0.0",
"shiki": "^3.12.2",
"shiki": "^3.13.0",
"simple-git": "^3.28.0",
"string-width": "^7.2.0",
"swagger2openapi": "^7.0.8",
"tinyglobby": "^0.2.15",
"type-fest": "^4.41.0 || ^5.0.0",
"typescript": "^5.9.2",
"typescript-eslint": "^8.44.0",
"typescript-eslint": "^8.44.1",
"unified": "^11.0.5",
"unified-lint-rule": "^3.0.1",
"unist-util-position": "^5.0.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/doom/src/cli/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { glob } from 'tinyglobby'
import { xfetch } from 'x-fetch'
import { parse } from 'yaml'

import { FALSY_VALUES, TRUTHY_VALUES } from '../shared/index.js'
import type { NormalizedTermItem } from '../terms.js'
import { FALSY_VALUES, TRUTHY_VALUES } from '../shared/index.ts'
import type { NormalizedTermItem } from '../terms.ts'

export const parseBoolean = (value?: string) =>
value === undefined || !FALSY_VALUES.has(value)
Expand Down
27 changes: 21 additions & 6 deletions packages/doom/src/cli/lint.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
import fs from 'node:fs/promises'
import path from 'node:path'

import { logger } from '@rspress/core'
import { Command } from 'commander'
import { ESLint } from 'eslint'
import { cyan } from 'yoctocolors'

import doom from '../eslint.js'
import type { GlobalCliOptions } from '../types.js'
import doom from '../eslint.ts'
import type { GlobalCliOptions } from '../types.ts'
import { OPTIONS_FILE, STORAGE_DIR } from '../utils/index.ts'

import { loadConfig } from './load-config.js'
import { loadConfig } from './load-config.ts'

export interface LintCommandOptions {
cspell?: boolean
glob: string | string[]
debug?: boolean
}

export const lintCommand = new Command('lint')
Expand All @@ -24,10 +27,22 @@ export const lintCommand = new Command('lint')
'**/*.{js,jsx,ts,tsx,md,mdx}',
)
.option('--no-cspell', 'Disable cspell linting')
.option('--debug', 'Show debug logs', false)
.action(async function (root?: string) {
const { cspell, glob, ...globalOptions } = this.optsWithGlobals<
LintCommandOptions & GlobalCliOptions
>()
const {
cspell,
glob,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
debug,
...globalOptions
} = this.optsWithGlobals<LintCommandOptions & GlobalCliOptions>()

await fs.mkdir(STORAGE_DIR, { recursive: true })

await fs.writeFile(
OPTIONS_FILE,
JSON.stringify({ root, globalOptions }, null, 2),
)

const { config } = await loadConfig(root, globalOptions)

Expand Down
16 changes: 8 additions & 8 deletions packages/doom/src/cli/load-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import { difference } from 'es-toolkit'
import { glob } from 'tinyglobby'
import { cyan } from 'yoctocolors'

import { attributesPlugin } from '../plugins/attributes/index.js'
import { attributesPlugin } from '../plugins/attributes/index.ts'
import {
apiPlugin,
autoSidebarPlugin,
Expand All @@ -42,24 +42,24 @@ import {
mermaidPlugin,
permissionPlugin,
replacePlugin,
} from '../plugins/index.js'
} from '../plugins/index.ts'
import {
isExplicitlyUnversioned,
normalizeSlash,
UNVERSIONED,
type DoomSite,
} from '../shared/index.js'
import type { AlgoliaOptions, ExportItem, GlobalCliOptions } from '../types.js'
import { pathExists, pkgResolve, resolveStaticConfig } from '../utils/index.js'
} from '../shared/index.ts'
import type { AlgoliaOptions, ExportItem, GlobalCliOptions } from '../types.ts'
import { pathExists, pkgResolve, resolveStaticConfig } from '../utils/index.ts'

import {
DEFAULT_CONFIG_NAME,
DEFAULT_EXTENSIONS,
I18N_FILE,
SITES_FILE,
YAML_EXTENSIONS,
} from './constants.js'
import { defaultGitHubUrl, isDoc } from './helpers.js'
} from './constants.ts'
import { defaultGitHubUrl, isDoc } from './helpers.ts'

const DEFAULT_LOGO = '/logo.svg'

Expand Down Expand Up @@ -359,7 +359,7 @@ const getCommonConfig = async ({
return mergeConfig(rspackConfig, {
resolve: {
extensionAlias: {
'.js': ['.ts', '.tsx', '.js'],
'.ts': ['.ts', '.tsx', '.ts'],
},
},
plugins: [
Expand Down
6 changes: 3 additions & 3 deletions packages/doom/src/plugins/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import type { RspressPlugin } from '@rspress/core'
import type { OpenAPI, OpenAPIV3_1 } from 'openapi-types'
import { convertObj } from 'swagger2openapi'

import { generateRuntimeModule } from '../../utils/index.js'
import { generateRuntimeModule } from '../../utils/index.ts'

import type { ApiPluginOptions, CustomResourceDefinition } from './types.js'
import type { ApiPluginOptions, CustomResourceDefinition } from './types.ts'

export type * from './types.js'
export type * from './types.ts'

// @internal
declare module 'doom-@api-crdsMap' {
Expand Down
2 changes: 1 addition & 1 deletion packages/doom/src/plugins/attributes/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { RspressPlugin } from '@rspress/core'

import { remarkAttributes } from './remark-attributes/index.js'
import { remarkAttributes } from './remark-attributes/index.ts'

export const attributesPlugin = (): RspressPlugin => {
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import type { Root } from 'mdast'
import type { Extension as FromMarkdownExtension } from 'mdast-util-from-markdown'
import type { Plugin } from 'unified'

import { attributesTransformer } from './attributes-transformer.js'
import { mdastAttributes } from './mdast-attributes.js'
import { micromarkAttributes } from './micromark-attributes.js'
import type { AttributesExtension } from './types.js'
import { attributesTransformer } from './attributes-transformer.ts'
import { mdastAttributes } from './mdast-attributes.ts'
import { micromarkAttributes } from './micromark-attributes.ts'
import type { AttributesExtension } from './types.ts'

export interface AttributesData {
micromarkExtensions?: AttributesExtension[]
Expand Down
10 changes: 5 additions & 5 deletions packages/doom/src/plugins/auto-sidebar/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import path from 'node:path'
import { type RspressPlugin, type UserConfig } from '@rspress/core'
import { addTrailingSlash } from '@rspress/shared'

import { APIS_ROUTES } from '../../shared/index.js'
import { APIS_ROUTES } from '../../shared/index.ts'

import { combineWalkResult } from './utils.js'
import { walk } from './walk.js'
import { combineWalkResult } from './utils.ts'
import { walk } from './walk.ts'

export type * from './walk.js'
export type * from './type.js'
export type * from './walk.ts'
export type * from './type.ts'

// Scan all the directories and files in the work directory(such as `docs`), and then generate the nav and sidebar configuration according to the directory structure.
// We will do as follows:
Expand Down
6 changes: 3 additions & 3 deletions packages/doom/src/plugins/auto-sidebar/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import { logger } from '@rspress/core'
import type { NavItem } from '@rspress/shared'
import { loadFrontMatter } from '@rspress/shared/node-utils'

import { extractTextAndId } from '../../shared/index.js'
import { pathExists } from '../../utils/index.js'
import { extractTextAndId } from '../../shared/index.ts'
import { pathExists } from '../../utils/index.ts'

import type { DoomSidebar } from './walk.js'
import type { DoomSidebar } from './walk.ts'

export async function detectFilePath(rawPath: string, extensions: string[]) {
// The params doesn't have extension name, so we need to try to find the file with the extension name.
Expand Down
6 changes: 3 additions & 3 deletions packages/doom/src/plugins/auto-sidebar/walk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ import {
import { unset } from 'es-toolkit/compat'
import picomatch from 'picomatch'

import { pathExists, readJson } from '../../utils/index.js'
import { pathExists, readJson } from '../../utils/index.ts'

import type { SideMeta } from './type.js'
import { detectFilePath, extractInfoFromFrontmatter } from './utils.js'
import type { SideMeta } from './type.ts'
import { detectFilePath, extractInfoFromFrontmatter } from './utils.ts'

export interface DoomSidebarItem extends SidebarItem {
weight?: number
Expand Down
2 changes: 1 addition & 1 deletion packages/doom/src/plugins/auto-toc/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { RspressPlugin } from '@rspress/core'

import { remarkAutoToc } from './remark-auto-toc.js'
import { remarkAutoToc } from './remark-auto-toc.ts'

export const autoTocPlugin = (): RspressPlugin => {
return {
Expand Down
2 changes: 1 addition & 1 deletion packages/doom/src/plugins/auto-toc/remark-auto-toc.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Root } from 'mdast'
import type { Plugin } from 'unified'

import { getASTNodeImport } from '../shared.js'
import { getASTNodeImport } from '../shared.ts'

export const remarkAutoToc: Plugin<[], Root> = function () {
return (root) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/doom/src/plugins/directives/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { RspressPlugin } from '@rspress/core'
import remarkDirective from 'remark-directive'

import { remarkDirectives } from './remark-directives.js'
import { remarkDirectives } from './remark-directives.ts'

export const directivesPlugin = (): RspressPlugin => {
return {
Expand Down
6 changes: 3 additions & 3 deletions packages/doom/src/plugins/global/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import path from 'node:path'
import type { RspressPlugin } from '@rspress/core'
import { addTrailingSlash } from '@rspress/shared'

import { ACP_BASE, type DoomSite } from '../../shared/index.js'
import type { ExportItem } from '../../types.js'
import { baseResolve, pkgResolve } from '../../utils/index.js'
import { ACP_BASE, type DoomSite } from '../../shared/index.ts'
import type { ExportItem } from '../../types.ts'
import { baseResolve, pkgResolve } from '../../utils/index.ts'

const globalComponentsDir = baseResolve('global')
const componentsDir = baseResolve('runtime/components')
Expand Down
18 changes: 9 additions & 9 deletions packages/doom/src/plugins/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
export * from './api/index.js'
export * from './auto-sidebar/index.js'
export * from './auto-toc/index.js'
export * from './directives/index.js'
export * from './global/index.js'
export * from './mermaid/index.js'
export * from './permission/index.js'
export * from './replace/index.js'
export * from './shiki/index.js'
export * from './api/index.ts'
export * from './auto-sidebar/index.ts'
export * from './auto-toc/index.ts'
export * from './directives/index.ts'
export * from './global/index.ts'
export * from './mermaid/index.ts'
export * from './permission/index.ts'
export * from './replace/index.ts'
export * from './shiki/index.ts'
2 changes: 1 addition & 1 deletion packages/doom/src/plugins/mermaid/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { RspressPlugin } from '@rspress/core'

import { remarkMermaid } from './remark-mermaid.js'
import { remarkMermaid } from './remark-mermaid.ts'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

.ts specifier will break once the plugin is built.

The compiled JS keeps the .ts suffix, so the published module will import ./remark-mermaid.ts, which doesn’t exist in dist. Please keep the .js extension (or introduce an automated rewrite before publish).

-import { remarkMermaid } from './remark-mermaid.ts'
+import { remarkMermaid } from './remark-mermaid.js'
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import { remarkMermaid } from './remark-mermaid.ts'
import { remarkMermaid } from './remark-mermaid.js'
🤖 Prompt for AI Agents
In packages/doom/src/plugins/mermaid/index.ts around line 3, the import uses a
.ts specifier which will remain in the compiled output and break consumers;
change the import to reference the runtime file (e.g. './remark-mermaid.js') or
remove the explicit extension only if your build tool rewrites extensions —
otherwise update the import to './remark-mermaid.js' (or add a build step to
rewrite .ts → .js) so the published package imports a valid file in dist.


export const mermaidPlugin = (): RspressPlugin => {
return {
Expand Down
8 changes: 4 additions & 4 deletions packages/doom/src/plugins/permission/index.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import type { RspressPlugin } from '@rspress/core'

import type { K8sTypeList } from '../../shared/types.js'
import { generateRuntimeModule } from '../../utils/index.js'
import type { K8sTypeList } from '../../shared/types.ts'
import { generateRuntimeModule } from '../../utils/index.ts'

import type {
FunctionResource,
PermissionPluginOptions,
RoleTemplate,
} from './types.js'
} from './types.ts'

export type * from './types.js'
export type * from './types.ts'

// @internal
declare module 'doom-@permission-functionResourcesMap' {
Expand Down
Loading
Loading