@alauda/doom 1.12.2 → 1.12.4

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,3 +1,4 @@
1
+ import fs_ from 'node:fs';
1
2
  import fs from 'node:fs/promises';
2
3
  import path from 'node:path';
3
4
  import { fileURLToPath } from 'node:url';
@@ -126,6 +127,7 @@ const getCommonConfig = async ({ config, root, configFilePath, base, version, do
126
127
  ? ALAUDA_ALGOLIA_OPTIONS
127
128
  : algolia === 'alauda-ru' && ALAUDA_RU_ALGOLIA_OPTIONS)) ||
128
129
  null;
130
+ const publicPath = path.resolve(root, 'public');
129
131
  return {
130
132
  userBase,
131
133
  root,
@@ -147,6 +149,17 @@ const getCommonConfig = async ({ config, root, configFilePath, base, version, do
147
149
  },
148
150
  markdown: {
149
151
  defaultWrapCode: export_,
152
+ link: {
153
+ checkDeadLinks: {
154
+ excludes(url) {
155
+ if (!url.startsWith('/')) {
156
+ return false;
157
+ }
158
+ const { pathname } = new URL(url, 'https://example.com');
159
+ return fs_.existsSync(path.resolve(publicPath, pathname.slice(1)));
160
+ },
161
+ },
162
+ },
150
163
  shiki: {
151
164
  transformers: [
152
165
  // builtin transformers
@@ -351,7 +364,7 @@ export async function loadConfig(root, { config: configFile, base, prefix, v: ve
351
364
  ensureDefaultLogo = true;
352
365
  }
353
366
  if (ensureDefaultLogo) {
354
- const publicPath = path.resolve(mergedConfig.root, `public`);
367
+ const publicPath = path.resolve(mergedConfig.root, 'public');
355
368
  await fs.mkdir(publicPath, { recursive: true });
356
369
  const logoPath = path.resolve(publicPath, removeLeadingSlash(DEFAULT_LOGO));
357
370
  if (!(await pathExists(logoPath))) {
@@ -5,7 +5,7 @@ import virtual from 'doom-@global-virtual';
5
5
  import { noop } from 'es-toolkit';
6
6
  import { useEffect, useMemo, useState } from 'react';
7
7
  import { createPortal } from 'react-dom';
8
- import { base } from 'virtual-runtime-config';
8
+ import siteData from 'virtual-site-data';
9
9
  import { parse } from 'yaml';
10
10
  import { ACP_BASE, getPdfName, getUnversionedVersion, isExplicitlyUnversioned, } from '../../shared/index.js';
11
11
  import { NavMenuGroup } from './NavMenuGroup.js';
@@ -45,7 +45,7 @@ const VersionsNav_ = () => {
45
45
  return [
46
46
  isExplicitlyUnversioned(virtual.version)
47
47
  ? undefined
48
- : base.slice(0, -unversionedVersion.length - 1),
48
+ : siteData.base.slice(0, -unversionedVersion.length - 1),
49
49
  unversionedVersion,
50
50
  ];
51
51
  }, []);
@@ -59,7 +59,7 @@ const VersionsNav_ = () => {
59
59
  }
60
60
  }
61
61
  else {
62
- const res = await fetch(`${isProduction() ? versionsBase : base}/versions.yaml`);
62
+ const res = await fetch(`${isProduction() ? versionsBase : siteData.base}/versions.yaml`);
63
63
  if (!res.ok) {
64
64
  return;
65
65
  }
@@ -112,7 +112,7 @@ const VersionsNav_ = () => {
112
112
  !(finalNavMenu = getNavMenu())) {
113
113
  return;
114
114
  }
115
- return createPortal(_jsxs(_Fragment, { children: [downloadLink && (_jsx(NavMenuSingleItem, { text: t('download_pdf'), link: downloadLink, download: true })), !navItems.length || (_jsx(NavMenuGroup, { text: version, base: versionsBase, items: navItems, pathname: base }))] }), finalNavMenu);
115
+ return createPortal(_jsxs(_Fragment, { children: [downloadLink && (_jsx(NavMenuSingleItem, { text: t('download_pdf'), link: downloadLink, download: true })), !navItems.length || (_jsx(NavMenuGroup, { text: version, base: versionsBase, items: navItems, pathname: siteData.base }))] }), finalNavMenu);
116
116
  };
117
117
  export const VersionsNav = () => (_jsx(NoSSR, { children: _jsx(VersionsNav_, {}) }));
118
118
  export default VersionsNav;
@@ -1,8 +1,8 @@
1
1
  import { logger } from '@rspress/core';
2
+ import { isProduction } from '@rspress/shared';
2
3
  import { render } from 'ejs';
3
4
  import { ResponseError, xfetch } from 'x-fetch';
4
5
  import { cyan, red } from 'yoctocolors';
5
- import { isCI } from './utils.js';
6
6
  const releaseCache = new Map();
7
7
  const FIELD_MAPPER = {
8
8
  zh: 'customfield_13800',
@@ -69,7 +69,7 @@ const resolveRelease_ = async (releaseTemplates, releaseQuery, isMdx) => {
69
69
  }
70
70
  warned = true;
71
71
  const message = `\`${cyan('JIRA_USERNAME')}\` and \`${cyan('JIRA_PASSWORD')}\` environments must be set for fetching Jira issues`;
72
- if (isCI) {
72
+ if (isProduction()) {
73
73
  throw new Error(message);
74
74
  }
75
75
  logger.warn(message);
@@ -83,7 +83,7 @@ const resolveRelease_ = async (releaseTemplates, releaseQuery, isMdx) => {
83
83
  data[key] = value;
84
84
  }
85
85
  const jql = await render(template, data, { async: true });
86
- logger.info(`Fetching release notes for query \`${cyan(releaseQuery)}\``);
86
+ logger.info(`Fetching release notes for query \`${cyan(releaseQuery)}\`, JQL: \`${cyan(jql)}\``);
87
87
  let issues;
88
88
  try {
89
89
  ;
@@ -94,6 +94,9 @@ const resolveRelease_ = async (releaseTemplates, releaseQuery, isMdx) => {
94
94
  const error = err;
95
95
  logger.error(`Failed to fetch release notes for query \`${red(releaseQuery)}\` with status \`${error.response.status}\` and ${error.data ? `data ${JSON.stringify(error.data, null, 2)}` : `message \`${error.message}\``}`);
96
96
  }
97
+ if (isProduction()) {
98
+ throw err;
99
+ }
97
100
  return;
98
101
  }
99
102
  return ['en', 'zh'].reduce((acc, lang) => Object.assign(acc, {
package/lib/theme.js CHANGED
@@ -68,7 +68,7 @@ export const Layout = () => {
68
68
  if (!virtual.download || !virtual.export?.length) {
69
69
  return;
70
70
  }
71
- if (themeConfig.locales?.length) {
71
+ if (themeConfig.locales.length) {
72
72
  let found;
73
73
  for (const { lang, sidebar } of themeConfig.locales) {
74
74
  const sidebarItems = sidebar[siteLang === lang ? '/' : `/${lang}`];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alauda/doom",
3
- "version": "1.12.2",
3
+ "version": "1.12.4",
4
4
  "type": "module",
5
5
  "description": "Doctor Doom making docs.",
6
6
  "repository": {
@@ -42,20 +42,20 @@
42
42
  "dependencies": {
43
43
  "@alauda/doom-export": "^0.1.0",
44
44
  "@cspell/eslint-plugin": "^8.19.4 || ^9.2.0",
45
- "@eslint-react/eslint-plugin": "^1.52.6",
45
+ "@eslint-react/eslint-plugin": "^1.52.9",
46
46
  "@inquirer/prompts": "^7.8.4",
47
47
  "@openapi-contrib/openapi-schema-to-json-schema": "^5.1.0",
48
48
  "@playwright/browser-chromium": "^1.55.0",
49
- "@rsbuild/plugin-react": "^1.3.5",
49
+ "@rsbuild/plugin-react": "^1.4.0",
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.28",
54
- "@rspress/plugin-algolia": "2.0.0-beta.28",
55
- "@rspress/plugin-llms": "2.0.0-beta.28",
56
- "@rspress/plugin-sitemap": "2.0.0-beta.28",
57
- "@rspress/shared": "2.0.0-beta.28",
58
- "@shikijs/transformers": "^3.12.0",
53
+ "@rspress/core": "2.0.0-beta.29",
54
+ "@rspress/plugin-algolia": "2.0.0-beta.29",
55
+ "@rspress/plugin-llms": "2.0.0-beta.29",
56
+ "@rspress/plugin-sitemap": "2.0.0-beta.29",
57
+ "@rspress/shared": "2.0.0-beta.29",
58
+ "@shikijs/transformers": "^3.12.1",
59
59
  "@total-typescript/ts-reset": "^0.6.1",
60
60
  "ab64": "^0.1.6",
61
61
  "chokidar": "^4.0.3",
@@ -93,10 +93,10 @@
93
93
  "remark-lint-no-chinese-punctuation-in-number": "^0.1.2",
94
94
  "remark-lint-no-duplicate-headings-in-section": "^4.0.1",
95
95
  "remark-lint-no-hidden-table-cell": "^1.0.1",
96
- "remark-mdx": "^3.1.0",
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.0",
99
+ "shiki": "^3.12.1",
100
100
  "simple-git": "^3.28.0",
101
101
  "string-width": "^7.2.0",
102
102
  "swagger2openapi": "^7.0.8",