@alauda/doom 0.2.4 → 0.2.5

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.
@@ -1,6 +1,6 @@
1
- import { type UserConfig } from '@rspress/core';
1
+ import { DoomConfig } from '../utils/types.js';
2
2
  export declare function loadConfig(root?: string, configFile?: string): Promise<{
3
- config: UserConfig;
3
+ config: DoomConfig;
4
4
  filepath?: string;
5
5
  }>;
6
6
  export declare function resolveDocRoot(cwd: string, cliRoot?: string, configRoot?: string): string;
@@ -2,15 +2,16 @@ import { nodeTypes } from '@mdx-js/mdx';
2
2
  import { addLeadingSlash, addTrailingSlash, removeLeadingSlash, } from '@rspress/core';
3
3
  import { pluginPreview } from '@rspress/plugin-preview';
4
4
  import { logger } from '@rspress/shared/logger';
5
+ import getPort from 'get-port';
5
6
  import fs from 'node:fs';
6
7
  import path from 'node:path';
7
8
  import rehypeRaw from 'rehype-raw';
8
9
  import { parse } from 'yaml';
9
- import { autoSidebarPlugin, globalPlugin, apiPlugin } from '../plugins/index.js';
10
+ import { apiPlugin, autoSidebarPlugin, globalPlugin } from '../plugins/index.js';
10
11
  import { pkgResolve } from '../utils/helpers.js';
11
12
  import { CWD, DEFAULT_CONFIG_NAME, DEFAULT_EXTENSIONS, I18N_FILE, YAML_EXTENSIONS, } from './constants.js';
12
13
  const DEFAULT_LOGO = '/logo.svg';
13
- const getCommonConfig = (config) => {
14
+ const getCommonConfig = async (config) => {
14
15
  return {
15
16
  lang: 'en',
16
17
  route: {
@@ -49,7 +50,7 @@ const getCommonConfig = (config) => {
49
50
  plugins: [
50
51
  pluginPreview({
51
52
  iframeOptions: {
52
- devPort: 7891,
53
+ devPort: await getPort({ port: 7891 }),
53
54
  },
54
55
  defaultRenderMode: 'pure',
55
56
  }),
@@ -116,7 +117,7 @@ export async function loadConfig(root, configFile) {
116
117
  }
117
118
  }
118
119
  config ??= {};
119
- const mergedConfig = mergeRsbuildConfig(getCommonConfig(config), config);
120
+ const mergedConfig = mergeRsbuildConfig(await getCommonConfig(config), config);
120
121
  const base = addLeadingSlash(mergedConfig.base || '/');
121
122
  mergedConfig.base = base;
122
123
  mergedConfig.root = resolveDocRoot(CWD, root, mergedConfig.root);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alauda/doom",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
4
4
  "type": "module",
5
5
  "description": "Doctor Doom making docs.",
6
6
  "repository": {
@@ -44,6 +44,7 @@
44
44
  "clsx": "^2.1.1",
45
45
  "commander": "^12.1.0",
46
46
  "es-toolkit": "^1.29.0",
47
+ "get-port": "^7.1.0",
47
48
  "react-markdown": "^8.0.7",
48
49
  "rehype-raw": "^6.1.1",
49
50
  "remark-gfm": "^3.0.1",