@alauda/doom 1.13.0 → 1.13.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/lib/cli/helpers.js +1 -1
  2. package/lib/cli/lint.d.ts +1 -0
  3. package/lib/cli/lint.js +11 -3
  4. package/lib/cli/load-config.d.ts +1 -1
  5. package/lib/cli/load-config.js +6 -6
  6. package/lib/plugins/api/index.d.ts +2 -2
  7. package/lib/plugins/api/index.js +1 -1
  8. package/lib/plugins/attributes/index.js +1 -1
  9. package/lib/plugins/attributes/remark-attributes/index.d.ts +1 -1
  10. package/lib/plugins/attributes/remark-attributes/index.js +3 -3
  11. package/lib/plugins/auto-sidebar/index.d.ts +2 -2
  12. package/lib/plugins/auto-sidebar/index.js +3 -3
  13. package/lib/plugins/auto-sidebar/utils.d.ts +1 -1
  14. package/lib/plugins/auto-sidebar/utils.js +2 -2
  15. package/lib/plugins/auto-sidebar/walk.js +2 -2
  16. package/lib/plugins/auto-toc/index.js +1 -1
  17. package/lib/plugins/auto-toc/remark-auto-toc.js +1 -1
  18. package/lib/plugins/directives/index.js +1 -1
  19. package/lib/plugins/global/index.d.ts +2 -2
  20. package/lib/plugins/global/index.js +2 -2
  21. package/lib/plugins/index.d.ts +9 -9
  22. package/lib/plugins/index.js +9 -9
  23. package/lib/plugins/mermaid/index.js +1 -1
  24. package/lib/plugins/permission/index.d.ts +2 -2
  25. package/lib/plugins/permission/index.js +1 -1
  26. package/lib/plugins/replace/index.d.ts +3 -3
  27. package/lib/plugins/replace/index.js +6 -6
  28. package/lib/plugins/replace/normalize-img-src.d.ts +1 -1
  29. package/lib/plugins/replace/normalize-img-src.js +1 -1
  30. package/lib/plugins/replace/parse-toc.js +1 -1
  31. package/lib/plugins/replace/rehype-normalize-link.js +1 -1
  32. package/lib/plugins/replace/remark-replace.d.ts +1 -1
  33. package/lib/plugins/replace/remark-replace.js +4 -4
  34. package/lib/plugins/replace/resolve-reference.d.ts +1 -1
  35. package/lib/plugins/replace/resolve-reference.js +3 -3
  36. package/lib/plugins/shiki/index.d.ts +1 -1
  37. package/lib/plugins/shiki/index.js +1 -1
  38. package/lib/plugins/shiki/transformers/index.d.ts +1 -1
  39. package/lib/plugins/shiki/transformers/index.js +1 -1
  40. package/lib/remark-lint/check-dead-links.d.ts +2 -0
  41. package/lib/remark-lint/check-dead-links.js +43 -0
  42. package/lib/remark-lint/index.d.ts +1 -0
  43. package/lib/remark-lint/index.js +1 -0
  44. package/lib/remarkrc.js +2 -1
  45. package/lib/runtime/components/index.d.ts +0 -2
  46. package/lib/runtime/components/index.js +0 -2
  47. package/lib/shared/index.d.ts +3 -3
  48. package/lib/shared/index.js +3 -3
  49. package/lib/types.d.ts +2 -2
  50. package/lib/utils/constants.d.ts +2 -0
  51. package/lib/utils/constants.js +2 -0
  52. package/lib/utils/helpers.d.ts +1 -1
  53. package/lib/utils/helpers.js +2 -2
  54. package/lib/utils/index.d.ts +4 -4
  55. package/lib/utils/index.js +4 -4
  56. package/package.json +15 -15
  57. package/lib/runtime/components/Card.d.ts +0 -1
  58. package/lib/runtime/components/Card.js +0 -1
  59. package/lib/runtime/components/LinkCard.d.ts +0 -1
  60. package/lib/runtime/components/LinkCard.js +0 -1
@@ -2,7 +2,7 @@ import fs from 'node:fs/promises';
2
2
  import { glob } from 'tinyglobby';
3
3
  import { xfetch } from 'x-fetch';
4
4
  import { parse } from 'yaml';
5
- import { FALSY_VALUES, TRUTHY_VALUES } from '../shared/index.js';
5
+ import { FALSY_VALUES, TRUTHY_VALUES } from "../shared/index.js";
6
6
  export const parseBoolean = (value) => value === undefined || !FALSY_VALUES.has(value);
7
7
  export const parseBooleanOrString = (value) => value === undefined ||
8
8
  (FALSY_VALUES.has(value) ? false : TRUTHY_VALUES.has(value) || value);
package/lib/cli/lint.d.ts CHANGED
@@ -2,5 +2,6 @@ import { Command } from 'commander';
2
2
  export interface LintCommandOptions {
3
3
  cspell?: boolean;
4
4
  glob: string | string[];
5
+ debug?: boolean;
5
6
  }
6
7
  export declare const lintCommand: Command;
package/lib/cli/lint.js CHANGED
@@ -1,22 +1,30 @@
1
+ import fs from 'node:fs/promises';
1
2
  import path from 'node:path';
2
3
  import { logger } from '@rspress/core';
3
4
  import { Command } from 'commander';
4
5
  import { ESLint } from 'eslint';
5
6
  import { cyan } from 'yoctocolors';
6
- import doom from '../eslint.js';
7
- import { loadConfig } from './load-config.js';
7
+ import doom from "../eslint.js";
8
+ import { OPTIONS_FILE, STORAGE_DIR } from "../utils/index.js";
9
+ import { loadConfig } from "./load-config.js";
8
10
  export const lintCommand = new Command('lint')
9
11
  .description('Lint the documentation')
10
12
  .argument('[root]', 'Root directory of the documentation')
11
13
  .option('-g, --glob <path...>', 'Glob patterns of source dirs/files to lint', '**/*.{js,jsx,ts,tsx,md,mdx}')
12
14
  .option('--no-cspell', 'Disable cspell linting')
15
+ .option('--debug', 'Show debug logs', false)
13
16
  .action(async function (root) {
14
- const { cspell, glob, ...globalOptions } = this.optsWithGlobals();
17
+ const { cspell, glob,
18
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
19
+ debug, ...globalOptions } = this.optsWithGlobals();
20
+ await fs.mkdir(STORAGE_DIR, { recursive: true });
21
+ await fs.writeFile(OPTIONS_FILE, JSON.stringify({ root, globalOptions }, null, 2));
15
22
  const { config } = await loadConfig(root, globalOptions);
16
23
  const docsDir = config.root;
17
24
  const eslint = new ESLint({
18
25
  cwd: docsDir,
19
26
  overrideConfigFile: true,
27
+ ignorePatterns: globalOptions.ignore ? config.internalRoutes : undefined,
20
28
  // @ts-expect-error -- stronger types
21
29
  overrideConfig: await doom(cspell ? config.lint?.cspellOptions : null),
22
30
  });
@@ -1,5 +1,5 @@
1
1
  import { type UserConfig } from '@rspress/core';
2
- import type { GlobalCliOptions } from '../types.js';
2
+ import type { GlobalCliOptions } from '../types.ts';
3
3
  export declare function loadConfig(root?: string | URL, { config: configFile, base, prefix, v: version, download, export: export_, ignore, force, open, lazy, include, exclude, outDir, redirect, editRepo, algolia, siteUrl, }?: GlobalCliOptions): Promise<{
4
4
  config: UserConfig;
5
5
  configFilePath: string;
@@ -15,12 +15,12 @@ import { transformerMetaHighlight, transformerMetaWordHighlight, transformerNota
15
15
  import { difference } from 'es-toolkit';
16
16
  import { glob } from 'tinyglobby';
17
17
  import { cyan } from 'yoctocolors';
18
- import { attributesPlugin } from '../plugins/attributes/index.js';
19
- import { apiPlugin, autoSidebarPlugin, autoTocPlugin, createTransformerCallouts, directivesPlugin, globalPlugin, mermaidPlugin, permissionPlugin, replacePlugin, } from '../plugins/index.js';
20
- import { isExplicitlyUnversioned, normalizeSlash, UNVERSIONED, } from '../shared/index.js';
21
- import { pathExists, pkgResolve, resolveStaticConfig } from '../utils/index.js';
22
- import { DEFAULT_CONFIG_NAME, DEFAULT_EXTENSIONS, I18N_FILE, SITES_FILE, YAML_EXTENSIONS, } from './constants.js';
23
- import { defaultGitHubUrl, isDoc } from './helpers.js';
18
+ import { attributesPlugin } from "../plugins/attributes/index.js";
19
+ import { apiPlugin, autoSidebarPlugin, autoTocPlugin, createTransformerCallouts, directivesPlugin, globalPlugin, mermaidPlugin, permissionPlugin, replacePlugin, } from "../plugins/index.js";
20
+ import { isExplicitlyUnversioned, normalizeSlash, UNVERSIONED, } from "../shared/index.js";
21
+ import { pathExists, pkgResolve, resolveStaticConfig } from "../utils/index.js";
22
+ import { DEFAULT_CONFIG_NAME, DEFAULT_EXTENSIONS, I18N_FILE, SITES_FILE, YAML_EXTENSIONS, } from "./constants.js";
23
+ import { defaultGitHubUrl, isDoc } from "./helpers.js";
24
24
  const DEFAULT_LOGO = '/logo.svg';
25
25
  const KNOWN_LOCALE_CONFIGS = {
26
26
  en: {
@@ -1,4 +1,4 @@
1
1
  import type { RspressPlugin } from '@rspress/core';
2
- import type { ApiPluginOptions } from './types.js';
3
- export type * from './types.js';
2
+ import type { ApiPluginOptions } from './types.ts';
3
+ export type * from './types.ts';
4
4
  export declare const apiPlugin: ({ localBasePath, }: ApiPluginOptions) => RspressPlugin;
@@ -1,6 +1,6 @@
1
1
  import { openapiSchemaToJsonSchema } from '@openapi-contrib/openapi-schema-to-json-schema';
2
2
  import { convertObj } from 'swagger2openapi';
3
- import { generateRuntimeModule } from '../../utils/index.js';
3
+ import { generateRuntimeModule } from "../../utils/index.js";
4
4
  export const apiPlugin = ({ localBasePath, }) => {
5
5
  return {
6
6
  name: 'doom-api',
@@ -1,4 +1,4 @@
1
- import { remarkAttributes } from './remark-attributes/index.js';
1
+ import { remarkAttributes } from "./remark-attributes/index.js";
2
2
  export const attributesPlugin = () => {
3
3
  return {
4
4
  name: 'doom-attributes',
@@ -1,7 +1,7 @@
1
1
  import type { Root } from 'mdast';
2
2
  import type { Extension as FromMarkdownExtension } from 'mdast-util-from-markdown';
3
3
  import type { Plugin } from 'unified';
4
- import type { AttributesExtension } from './types.js';
4
+ import type { AttributesExtension } from './types.ts';
5
5
  export interface AttributesData {
6
6
  micromarkExtensions?: AttributesExtension[];
7
7
  fromMarkdownExtensions?: FromMarkdownExtension[];
@@ -1,6 +1,6 @@
1
- import { attributesTransformer } from './attributes-transformer.js';
2
- import { mdastAttributes } from './mdast-attributes.js';
3
- import { micromarkAttributes } from './micromark-attributes.js';
1
+ import { attributesTransformer } from "./attributes-transformer.js";
2
+ import { mdastAttributes } from "./mdast-attributes.js";
3
+ import { micromarkAttributes } from "./micromark-attributes.js";
4
4
  export const remarkAttributes = function () {
5
5
  const data = this.data();
6
6
  function add(key, value) {
@@ -1,6 +1,6 @@
1
1
  import { type RspressPlugin, type UserConfig } from '@rspress/core';
2
- export type * from './walk.js';
3
- export type * from './type.js';
2
+ export type * from './walk.ts';
3
+ export type * from './type.ts';
4
4
  export interface AutoSidebarPluginOptions {
5
5
  ignore?: boolean;
6
6
  export?: boolean;
@@ -1,9 +1,9 @@
1
1
  import path from 'node:path';
2
2
  import {} from '@rspress/core';
3
3
  import { addTrailingSlash } from '@rspress/shared';
4
- import { APIS_ROUTES } from '../../shared/index.js';
5
- import { combineWalkResult } from './utils.js';
6
- import { walk } from './walk.js';
4
+ import { APIS_ROUTES } from "../../shared/index.js";
5
+ import { combineWalkResult } from "./utils.js";
6
+ import { walk } from "./walk.js";
7
7
  // 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.
8
8
  // We will do as follows:
9
9
  // 1. scan the directory structure, and extract all the `_meta.json` files.
@@ -1,5 +1,5 @@
1
1
  import type { NavItem } from '@rspress/shared';
2
- import type { DoomSidebar } from './walk.js';
2
+ import type { DoomSidebar } from './walk.ts';
3
3
  export declare function detectFilePath(rawPath: string, extensions: string[]): Promise<string | undefined>;
4
4
  export declare function extractInfoFromFrontmatter(filePath: string, rootDir: string, extensions: string[]): Promise<{
5
5
  realPath: string | undefined;
@@ -2,8 +2,8 @@ import fs from 'node:fs/promises';
2
2
  import path from 'node:path';
3
3
  import { logger } from '@rspress/core';
4
4
  import { loadFrontMatter } from '@rspress/shared/node-utils';
5
- import { extractTextAndId } from '../../shared/index.js';
6
- import { pathExists } from '../../utils/index.js';
5
+ import { extractTextAndId } from "../../shared/index.js";
6
+ import { pathExists } from "../../utils/index.js";
7
7
  export async function detectFilePath(rawPath, extensions) {
8
8
  // The params doesn't have extension name, so we need to try to find the file with the extension name.
9
9
  let realPath = rawPath;
@@ -4,8 +4,8 @@ import { logger, removeTrailingSlash, withBase, } from '@rspress/core';
4
4
  import { isExternalUrl, removeLeadingSlash, slash, } from '@rspress/shared';
5
5
  import { unset } from 'es-toolkit/compat';
6
6
  import picomatch from 'picomatch';
7
- import { pathExists, readJson } from '../../utils/index.js';
8
- import { detectFilePath, extractInfoFromFrontmatter } from './utils.js';
7
+ import { pathExists, readJson } from "../../utils/index.js";
8
+ import { detectFilePath, extractInfoFromFrontmatter } from "./utils.js";
9
9
  const sidebarSorter = (a, b) => {
10
10
  const aWeight = 'weight' in a && a.weight != null ? a.weight : 100;
11
11
  const bWeight = 'weight' in b && b.weight != null ? b.weight : 100;
@@ -1,4 +1,4 @@
1
- import { remarkAutoToc } from './remark-auto-toc.js';
1
+ import { remarkAutoToc } from "./remark-auto-toc.js";
2
2
  export const autoTocPlugin = () => {
3
3
  return {
4
4
  name: 'doom-auto-toc',
@@ -1,4 +1,4 @@
1
- import { getASTNodeImport } from '../shared.js';
1
+ import { getASTNodeImport } from "../shared.js";
2
2
  export const remarkAutoToc = function () {
3
3
  return (root) => {
4
4
  let foundIndex = -1;
@@ -1,5 +1,5 @@
1
1
  import remarkDirective from 'remark-directive';
2
- import { remarkDirectives } from './remark-directives.js';
2
+ import { remarkDirectives } from "./remark-directives.js";
3
3
  export const directivesPlugin = () => {
4
4
  return {
5
5
  name: 'doom-directives',
@@ -1,6 +1,6 @@
1
1
  import type { RspressPlugin } from '@rspress/core';
2
- import { type DoomSite } from '../../shared/index.js';
3
- import type { ExportItem } from '../../types.js';
2
+ import { type DoomSite } from '../../shared/index.ts';
3
+ import type { ExportItem } from '../../types.ts';
4
4
  export interface GlobalPluginOptions {
5
5
  version?: string;
6
6
  download?: boolean;
@@ -1,8 +1,8 @@
1
1
  import fs from 'node:fs';
2
2
  import path from 'node:path';
3
3
  import { addTrailingSlash } from '@rspress/shared';
4
- import { ACP_BASE } from '../../shared/index.js';
5
- import { baseResolve, pkgResolve } from '../../utils/index.js';
4
+ import { ACP_BASE } from "../../shared/index.js";
5
+ import { baseResolve, pkgResolve } from "../../utils/index.js";
6
6
  const globalComponentsDir = baseResolve('global');
7
7
  const componentsDir = baseResolve('runtime/components');
8
8
  export const globalPlugin = ({ version, download, }) => {
@@ -1,9 +1,9 @@
1
- export * from './api/index.js';
2
- export * from './auto-sidebar/index.js';
3
- export * from './auto-toc/index.js';
4
- export * from './directives/index.js';
5
- export * from './global/index.js';
6
- export * from './mermaid/index.js';
7
- export * from './permission/index.js';
8
- export * from './replace/index.js';
9
- export * from './shiki/index.js';
1
+ export * from './api/index.ts';
2
+ export * from './auto-sidebar/index.ts';
3
+ export * from './auto-toc/index.ts';
4
+ export * from './directives/index.ts';
5
+ export * from './global/index.ts';
6
+ export * from './mermaid/index.ts';
7
+ export * from './permission/index.ts';
8
+ export * from './replace/index.ts';
9
+ export * from './shiki/index.ts';
@@ -1,9 +1,9 @@
1
- export * from './api/index.js';
2
- export * from './auto-sidebar/index.js';
3
- export * from './auto-toc/index.js';
4
- export * from './directives/index.js';
5
- export * from './global/index.js';
6
- export * from './mermaid/index.js';
7
- export * from './permission/index.js';
8
- export * from './replace/index.js';
9
- export * from './shiki/index.js';
1
+ export * from "./api/index.js";
2
+ export * from "./auto-sidebar/index.js";
3
+ export * from "./auto-toc/index.js";
4
+ export * from "./directives/index.js";
5
+ export * from "./global/index.js";
6
+ export * from "./mermaid/index.js";
7
+ export * from "./permission/index.js";
8
+ export * from "./replace/index.js";
9
+ export * from "./shiki/index.js";
@@ -1,4 +1,4 @@
1
- import { remarkMermaid } from './remark-mermaid.js';
1
+ import { remarkMermaid } from "./remark-mermaid.js";
2
2
  export const mermaidPlugin = () => {
3
3
  return {
4
4
  name: 'doom-mermaid',
@@ -1,4 +1,4 @@
1
1
  import type { RspressPlugin } from '@rspress/core';
2
- import type { PermissionPluginOptions } from './types.js';
3
- export type * from './types.js';
2
+ import type { PermissionPluginOptions } from './types.ts';
3
+ export type * from './types.ts';
4
4
  export declare const permissionPlugin: ({ localBasePath, }: PermissionPluginOptions) => RspressPlugin;
@@ -1,4 +1,4 @@
1
- import { generateRuntimeModule } from '../../utils/index.js';
1
+ import { generateRuntimeModule } from "../../utils/index.js";
2
2
  export const permissionPlugin = ({ localBasePath, }) => {
3
3
  return {
4
4
  name: 'doom-permission',
@@ -1,7 +1,7 @@
1
1
  import type { RspressPlugin } from '@rspress/core';
2
- export * from './normalize-img-src.js';
3
- export type * from './types.js';
4
- export * from './utils.js';
2
+ export * from './normalize-img-src.ts';
3
+ export type * from './types.ts';
4
+ export * from './utils.ts';
5
5
  declare module 'unified' {
6
6
  interface Data {
7
7
  pageMeta: Record<string, unknown>;
@@ -1,11 +1,11 @@
1
1
  import fs from 'node:fs/promises';
2
2
  import { logger } from '@rspress/core';
3
- import { rehypeNormalizeLink } from './rehype-normalize-link.js';
4
- import { remarkExplicitJsx } from './remark-explicit-jsx.js';
5
- import { MD_RELEASE_COMMENT_PATTERN, MDX_RELEASE_COMMENT_PATTERN, remarkReplace, } from './remark-replace.js';
6
- import { mdProcessor, mdxProcessor, normalizeReferenceItems } from './utils.js';
7
- export * from './normalize-img-src.js';
8
- export * from './utils.js';
3
+ import { rehypeNormalizeLink } from "./rehype-normalize-link.js";
4
+ import { remarkExplicitJsx } from "./remark-explicit-jsx.js";
5
+ import { MD_RELEASE_COMMENT_PATTERN, MDX_RELEASE_COMMENT_PATTERN, remarkReplace, } from "./remark-replace.js";
6
+ import { mdProcessor, mdxProcessor, normalizeReferenceItems } from "./utils.js";
7
+ export * from "./normalize-img-src.js";
8
+ export * from "./utils.js";
9
9
  export const replacePlugin = ({ lang, localBasePath, force, }) => {
10
10
  let userConfig;
11
11
  let normalizedItems;
@@ -1,5 +1,5 @@
1
1
  import type { RootContent } from 'mdast';
2
- import type { NormalizedReferenceSource } from './types.js';
2
+ import type { NormalizedReferenceSource } from './types.ts';
3
3
  export interface NormalizeImgSrcOptions {
4
4
  refSource?: NormalizedReferenceSource;
5
5
  localPublicBase: string;
@@ -3,7 +3,7 @@ import path from 'node:path';
3
3
  import { isExternalUrl, removeLeadingSlash } from '@rspress/shared';
4
4
  import { cloneDeep } from 'es-toolkit';
5
5
  import { visit } from 'unist-util-visit';
6
- import { RELATIVE_URL_PATTERN } from './utils.js';
6
+ import { RELATIVE_URL_PATTERN } from "./utils.js";
7
7
  export const normalizeImgSrc = (content, { refSource, localPublicBase, publicBase, sourceBase, targetBase, force, translating, }) => {
8
8
  content = cloneDeep(content);
9
9
  const resolveImgSrc = (src, force) => {
@@ -1,6 +1,6 @@
1
1
  import Slugger from 'github-slugger';
2
2
  import { visitChildren } from 'unist-util-visit-children';
3
- import { extractTextAndId } from '../../shared/index.js';
3
+ import { extractTextAndId } from "../../shared/index.js";
4
4
  export const parseToc = (tree, allDepths) => {
5
5
  let title = '';
6
6
  const toc = [];
@@ -1,6 +1,6 @@
1
1
  import { isExternalUrl } from '@rspress/shared';
2
2
  import { visit } from 'unist-util-visit';
3
- import { getASTNodeImport } from '../shared.js';
3
+ import { getASTNodeImport } from "../shared.js";
4
4
  const getMdxSrcAttribute = (tempVar) => {
5
5
  return {
6
6
  type: 'mdxJsxAttribute',
@@ -1,6 +1,6 @@
1
1
  import type { Root } from 'mdast';
2
2
  import type { Plugin } from 'unified';
3
- import type { NormalizedReferenceSource, ReleaseNotesOptions } from './types.js';
3
+ import type { NormalizedReferenceSource, ReleaseNotesOptions } from './types.ts';
4
4
  export declare const MD_RELEASE_COMMENT_PATTERN: RegExp;
5
5
  export declare const MDX_RELEASE_COMMENT_PATTERN: RegExp;
6
6
  export declare const maybeHaveRef: (filepath: string, content: string) => boolean | undefined;
@@ -5,10 +5,10 @@ import { logger } from '@rspress/core';
5
5
  import { isProduction } from '@rspress/shared';
6
6
  import { parse, stringify } from 'yaml';
7
7
  import { cyan, red } from 'yoctocolors';
8
- import { normalizeImgSrc } from './normalize-img-src.js';
9
- import { resolveReference } from './resolve-reference.js';
10
- import { resolveRelease } from './resolve-release.js';
11
- import { getFrontmatterNode, isCI, mdProcessor, mdxProcessor } from './utils.js';
8
+ import { normalizeImgSrc } from "./normalize-img-src.js";
9
+ import { resolveReference } from "./resolve-reference.js";
10
+ import { resolveRelease } from "./resolve-release.js";
11
+ import { getFrontmatterNode, isCI, mdProcessor, mdxProcessor } from "./utils.js";
12
12
  const MD_REF_START_COMMENT_PATTERN = /<!-{2,} *reference-start#(.+) *-{2,}>/;
13
13
  const MDX_REF_START_COMMENT_PATTERN = /\{\/\*+ *reference-start#(.+) *\*+\/\}/;
14
14
  const MDX_REF_START_PATTERN = /\/\*+ *reference-start#(.+) *\*+\//;
@@ -1,5 +1,5 @@
1
1
  import type { RootContent } from 'mdast';
2
- import type { NormalizedReferenceSource } from './types.js';
2
+ import type { NormalizedReferenceSource } from './types.ts';
3
3
  export interface ResolveReferenceResult {
4
4
  publicBase: string;
5
5
  sourceBase: string;
@@ -4,9 +4,9 @@ import { logger } from '@rspress/core';
4
4
  import { isProduction } from '@rspress/shared';
5
5
  import { render } from 'ejs';
6
6
  import { red } from 'yoctocolors';
7
- import { resolveRepo } from '../../utils/index.js';
8
- import { parseToc } from './parse-toc.js';
9
- import { getFrontmatterNode, mdProcessor, mdxProcessor } from './utils.js';
7
+ import { resolveRepo } from "../../utils/index.js";
8
+ import { parseToc } from "./parse-toc.js";
9
+ import { getFrontmatterNode, mdProcessor, mdxProcessor } from "./utils.js";
10
10
  const refCache = new Map();
11
11
  const resolveReference_ = async (localBasePath, localPublicBase, items, refName, force) => {
12
12
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
@@ -1 +1 @@
1
- export * from './transformers/index.js';
1
+ export * from './transformers/index.ts';
@@ -1 +1 @@
1
- export * from './transformers/index.js';
1
+ export * from "./transformers/index.js";
@@ -1 +1 @@
1
- export * from './callouts.js';
1
+ export * from './callouts.ts';
@@ -1 +1 @@
1
- export * from './callouts.js';
1
+ export * from "./callouts.js";
@@ -0,0 +1,2 @@
1
+ import type { Root } from 'mdast';
2
+ export declare const checkDeadLinks: import("unified-lint-rule").Plugin<Root, unknown>;
@@ -0,0 +1,43 @@
1
+ import fs from 'node:fs/promises';
2
+ import path from 'node:path';
3
+ import { PluginDriver, RouteService, remarkLink, } from '@rspress/core';
4
+ import { isProduction } from '@rspress/shared';
5
+ import { lintRule } from 'unified-lint-rule';
6
+ import { loadConfig } from "../cli/load-config.js";
7
+ import { OPTIONS_FILE } from "../utils/index.js";
8
+ let config;
9
+ let configFilePath;
10
+ export const checkDeadLinks = lintRule('doom-lint:check-dead-links', async (tree, vfile) => {
11
+ if (!config || !configFilePath) {
12
+ let optionsText;
13
+ try {
14
+ optionsText = await fs.readFile(OPTIONS_FILE, 'utf8');
15
+ }
16
+ catch {
17
+ //
18
+ }
19
+ const { root, globalOptions } = (optionsText ? JSON.parse(optionsText) : {});
20
+ ({ config, configFilePath } = await loadConfig(root, globalOptions));
21
+ }
22
+ const relativePath = path.relative(config.root, vfile.path);
23
+ // Ignore files outside the root directory
24
+ if (relativePath.startsWith('..')) {
25
+ return;
26
+ }
27
+ let routeService = RouteService.getInstance();
28
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
29
+ if (!routeService) {
30
+ const pluginDriver = await PluginDriver.create(config, configFilePath, isProduction());
31
+ routeService = await RouteService.create({
32
+ config,
33
+ scanDir: config.root,
34
+ externalPages: await pluginDriver.addPages(),
35
+ });
36
+ }
37
+ remarkLink({
38
+ cleanUrls: false,
39
+ routeService,
40
+ remarkLinkOptions: config.markdown?.link,
41
+ lint: true,
42
+ })(tree, vfile);
43
+ });
@@ -1,5 +1,6 @@
1
1
  import type { Root } from 'mdast';
2
2
  import type { Plugin } from 'unified';
3
+ export * from './check-dead-links.ts';
3
4
  export * from './list-item-punctuation.ts';
4
5
  export * from './list-item-size.ts';
5
6
  export * from './list-table-introduction.ts';
@@ -1,4 +1,5 @@
1
1
  import remarkMessageControl from 'remark-message-control';
2
+ export * from "./check-dead-links.js";
2
3
  export * from "./list-item-punctuation.js";
3
4
  export * from "./list-item-size.js";
4
5
  export * from "./list-table-introduction.js";
package/lib/remarkrc.js CHANGED
@@ -10,7 +10,7 @@ import remarkLintLintMatchPunctuation from 'remark-lint-match-punctuation';
10
10
  import remarkLintNoChinesePunctuationInNumber from 'remark-lint-no-chinese-punctuation-in-number';
11
11
  import remarkLintNoDuplicateHeadingsInSection from 'remark-lint-no-duplicate-headings-in-section';
12
12
  import remarkLintNoHiddenTableCell from 'remark-lint-no-hidden-table-cell';
13
- import doomLint, { noDeepHeading, noDeepList, noParagraphIndent, tableSize, unitCase, } from "./remark-lint/index.js";
13
+ import doomLint, { checkDeadLinks, noDeepHeading, noDeepList, noParagraphIndent, tableSize, unitCase, } from "./remark-lint/index.js";
14
14
  export default {
15
15
  plugins: [
16
16
  remarkDirective,
@@ -23,6 +23,7 @@ export default {
23
23
  remarkLintNoDuplicateHeadingsInSection,
24
24
  remarkLintNoHiddenTableCell,
25
25
  doomLint,
26
+ checkDeadLinks,
26
27
  noDeepHeading,
27
28
  noDeepList,
28
29
  noParagraphIndent,
@@ -1,7 +1,6 @@
1
1
  export * from './AcpApisOverview.js';
2
2
  export * from './Badge.js';
3
3
  export * from './Callouts.js';
4
- export * from './Card.js';
5
4
  export * from './Directive.js';
6
5
  export * from './ExternalApisOverview.js';
7
6
  export * from './ExternalSite.js';
@@ -9,7 +8,6 @@ export * from './ExternalSiteLink.js';
9
8
  export * from './JsonViewer.js';
10
9
  export * from './K8sCrd.js';
11
10
  export * from './K8sPermissionTable.js';
12
- export * from './LinkCard.js';
13
11
  export * from './Markdown.js';
14
12
  export * from './Mermaid.js';
15
13
  export * from './OpenAPIPath.js';
@@ -1,7 +1,6 @@
1
1
  export * from './AcpApisOverview.js';
2
2
  export * from './Badge.js';
3
3
  export * from './Callouts.js';
4
- export * from './Card.js';
5
4
  export * from './Directive.js';
6
5
  export * from './ExternalApisOverview.js';
7
6
  export * from './ExternalSite.js';
@@ -9,7 +8,6 @@ export * from './ExternalSiteLink.js';
9
8
  export * from './JsonViewer.js';
10
9
  export * from './K8sCrd.js';
11
10
  export * from './K8sPermissionTable.js';
12
- export * from './LinkCard.js';
13
11
  export * from './Markdown.js';
14
12
  export * from './Mermaid.js';
15
13
  export * from './OpenAPIPath.js';
@@ -1,3 +1,3 @@
1
- export * from './constants.js';
2
- export * from './helpers.js';
3
- export * from './types.js';
1
+ export * from './constants.ts';
2
+ export * from './helpers.ts';
3
+ export * from './types.ts';
@@ -1,3 +1,3 @@
1
- export * from './constants.js';
2
- export * from './helpers.js';
3
- export * from './types.js';
1
+ export * from "./constants.js";
2
+ export * from "./helpers.js";
3
+ export * from "./types.js";
package/lib/types.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import type { Options } from '@cspell/eslint-plugin';
2
2
  import type { serve } from '@rspress/core';
3
- import type { ApiPluginOptions, AutoSidebarPluginOptions, PermissionPluginOptions, ReferenceItem, ReleaseNotesOptions } from './plugins/index.js';
4
- import type { DoomSite } from './shared/index.js';
3
+ import type { ApiPluginOptions, AutoSidebarPluginOptions, PermissionPluginOptions, ReferenceItem, ReleaseNotesOptions } from './plugins/index.ts';
4
+ import type { DoomSite } from './shared/index.ts';
5
5
  export type BaseServeOptions = Parameters<typeof serve>[0];
6
6
  export type ServeOptions = Omit<BaseServeOptions, 'config'>;
7
7
  export interface GlobalCliOptions {
@@ -1,2 +1,4 @@
1
1
  export declare const BASE_DIR: string;
2
2
  export declare const PKG_DIR: string;
3
+ export declare const STORAGE_DIR: string;
4
+ export declare const OPTIONS_FILE: string;
@@ -2,3 +2,5 @@ import path from 'node:path';
2
2
  import { fileURLToPath } from 'node:url';
3
3
  export const BASE_DIR = path.resolve(fileURLToPath(import.meta.url), '../..');
4
4
  export const PKG_DIR = path.resolve(BASE_DIR, '..');
5
+ export const STORAGE_DIR = path.resolve('node_modules/.doom');
6
+ export const OPTIONS_FILE = path.resolve(STORAGE_DIR, 'options.json');
@@ -1,4 +1,4 @@
1
- import type { StringMapper } from '../shared/types.js';
1
+ import type { StringMapper } from '../shared/types.ts';
2
2
  export declare const baseResolve: (...paths: string[]) => string;
3
3
  export declare const pkgResolve: (...paths: string[]) => string;
4
4
  export declare const resolveStaticConfig: <T = unknown>(filepath: string) => Promise<T>;
@@ -2,8 +2,8 @@ import fs from 'node:fs/promises';
2
2
  import path from 'node:path';
3
3
  import { glob } from 'tinyglobby';
4
4
  import { parse } from 'yaml';
5
- import { JSON_EXTENSION, YAML_EXTENSIONS } from '../cli/constants.js';
6
- import { BASE_DIR, PKG_DIR } from './constants.js';
5
+ import { JSON_EXTENSION, YAML_EXTENSIONS } from "../cli/constants.js";
6
+ import { BASE_DIR, PKG_DIR } from "./constants.js";
7
7
  export const baseResolve = (...paths) => path.resolve(BASE_DIR, ...paths);
8
8
  export const pkgResolve = (...paths) => path.resolve(PKG_DIR, ...paths);
9
9
  export const resolveStaticConfig = async (filepath) => {
@@ -1,4 +1,4 @@
1
- export * from './constants.js';
2
- export * from './fs.js';
3
- export * from './git.js';
4
- export * from './helpers.js';
1
+ export * from './constants.ts';
2
+ export * from './fs.ts';
3
+ export * from './git.ts';
4
+ export * from './helpers.ts';
@@ -1,4 +1,4 @@
1
- export * from './constants.js';
2
- export * from './fs.js';
3
- export * from './git.js';
4
- export * from './helpers.js';
1
+ export * from "./constants.js";
2
+ export * from "./fs.js";
3
+ export * from "./git.js";
4
+ export * from "./helpers.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alauda/doom",
3
- "version": "1.13.0",
3
+ "version": "1.13.2",
4
4
  "type": "module",
5
5
  "description": "Doctor Doom making docs.",
6
6
  "repository": {
@@ -40,22 +40,22 @@
40
40
  "rspress-plugins"
41
41
  ],
42
42
  "dependencies": {
43
- "@alauda/doom-export": "^0.1.0",
43
+ "@alauda/doom-export": "^0.1.1",
44
44
  "@cspell/eslint-plugin": "^8.19.4 || ^9.2.1",
45
45
  "@eslint-react/eslint-plugin": "^1.53.1",
46
46
  "@inquirer/prompts": "^7.8.6",
47
47
  "@openapi-contrib/openapi-schema-to-json-schema": "^5.1.0",
48
- "@playwright/browser-chromium": "^1.55.0",
49
- "@rsbuild/plugin-react": "^1.4.0",
48
+ "@playwright/browser-chromium": "^1.55.1",
49
+ "@rsbuild/plugin-react": "^1.4.1",
50
50
  "@rsbuild/plugin-sass": "^1.4.0",
51
51
  "@rsbuild/plugin-svgr": "^1.2.2",
52
52
  "@rsbuild/plugin-yaml": "^1.0.3",
53
- "@rspress/core": "2.0.0-beta.32",
54
- "@rspress/plugin-algolia": "2.0.0-beta.32",
55
- "@rspress/plugin-llms": "2.0.0-beta.32",
56
- "@rspress/plugin-sitemap": "2.0.0-beta.32",
57
- "@rspress/shared": "2.0.0-beta.32",
58
- "@shikijs/transformers": "^3.12.2",
53
+ "@rspress/core": "2.0.0-beta.34",
54
+ "@rspress/plugin-algolia": "2.0.0-beta.34",
55
+ "@rspress/plugin-llms": "2.0.0-beta.34",
56
+ "@rspress/plugin-sitemap": "2.0.0-beta.34",
57
+ "@rspress/shared": "2.0.0-beta.34",
58
+ "@shikijs/transformers": "^3.13.0",
59
59
  "@total-typescript/ts-reset": "^0.6.1",
60
60
  "ab64": "^0.1.6",
61
61
  "chokidar": "^4.0.3",
@@ -63,7 +63,7 @@
63
63
  "commander": "^13.1.0 || ^14.0.1",
64
64
  "ejs": "^3.1.10",
65
65
  "es-toolkit": "^1.39.10",
66
- "eslint": "^9.35.0",
66
+ "eslint": "^9.36.0",
67
67
  "eslint-plugin-mdx": "^3.6.2",
68
68
  "globals": "^16.4.0",
69
69
  "html-tag-names": "^2.1.0",
@@ -74,8 +74,8 @@
74
74
  "mdast-util-phrasing": "^4.1.0",
75
75
  "mdast-util-to-markdown": "^2.1.2",
76
76
  "mdast-util-to-string": "^4.0.0",
77
- "mermaid": "^11.11.0",
78
- "openai": "^5.20.3",
77
+ "mermaid": "^11.12.0",
78
+ "openai": "^5.23.1",
79
79
  "openapi-types": "^12.1.3",
80
80
  "p-ratelimit": "^1.0.1",
81
81
  "picomatch": "^4.0.3",
@@ -96,14 +96,14 @@
96
96
  "remark-mdx": "^3.1.1",
97
97
  "remark-message-control": "^8.0.0",
98
98
  "remark-stringify": "^11.0.0",
99
- "shiki": "^3.12.2",
99
+ "shiki": "^3.13.0",
100
100
  "simple-git": "^3.28.0",
101
101
  "string-width": "^7.2.0",
102
102
  "swagger2openapi": "^7.0.8",
103
103
  "tinyglobby": "^0.2.15",
104
104
  "type-fest": "^4.41.0 || ^5.0.0",
105
105
  "typescript": "^5.9.2",
106
- "typescript-eslint": "^8.44.0",
106
+ "typescript-eslint": "^8.44.1",
107
107
  "unified": "^11.0.5",
108
108
  "unified-lint-rule": "^3.0.1",
109
109
  "unist-util-position": "^5.0.0",
@@ -1 +0,0 @@
1
- export { Card, Card as default } from '@rspress/core/theme';
@@ -1 +0,0 @@
1
- export { Card, Card as default } from '@rspress/core/theme';
@@ -1 +0,0 @@
1
- export { LinkCard, LinkCard as default } from '@rspress/core/theme';
@@ -1 +0,0 @@
1
- export { LinkCard, LinkCard as default } from '@rspress/core/theme';