@alauda/doom 0.22.1 → 0.22.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.
package/lib/cli/index.js CHANGED
@@ -28,7 +28,7 @@ program
28
28
  showGlobalOptions: true,
29
29
  })
30
30
  .option('-c, --config <config>', 'Specify the path to the config file')
31
- .option('-v <version>', `Specify the version of the documentation, can also be 'unversioned' or 'unversioned-x.y'`)
31
+ .option('-v <version>', 'Specify the version of the documentation, can also be `unversioned` or `unversioned-x.y`')
32
32
  .option('-b, --base <base>', 'Override the base of the documentation')
33
33
  .option('-p, --prefix <prefix>', 'Specify the prefix of the documentation base')
34
34
  .option('-f, --force [boolean]', `Force to
@@ -40,6 +40,7 @@ program
40
40
  .option('-I, --include <language...>', 'Include **only** the specific language(s), `en ru` for example')
41
41
  .option('-E, --exclude <language...>', 'Include all languages except the specific language(s), `ru` for example')
42
42
  .option('-o, --out-dir <path>', 'Override the `outDir` defined in the config file or the default `dist/{base}/{version}`, the resulting path will be `dist/{outDir}/{version}`')
43
+ .option('-r, --redirect <enum>', 'Whether to redirect to the locale closest to `navigator.language` when the user visits the site, could be `auto` or `never`', 'auto')
43
44
  .option('-n, --no-open [boolean]', 'Do not open the browser after starting the server')
44
45
  .command('dev', { isDefault: true })
45
46
  .description('Start the development server')
@@ -1,6 +1,6 @@
1
1
  import { type UserConfig } from '@rspress/core';
2
2
  import type { GlobalCliOptions } from '../types.js';
3
- export declare function loadConfig(root?: string, { config: configFile, base, prefix, v: version, download, export: export_, ignore, force, open, lazy, include, exclude, outDir, }?: GlobalCliOptions): Promise<{
3
+ export declare function loadConfig(root?: string, { config: configFile, base, prefix, v: version, download, export: export_, ignore, force, open, lazy, include, exclude, outDir, redirect, }?: GlobalCliOptions): Promise<{
4
4
  config: UserConfig;
5
5
  filepath?: string;
6
6
  }>;
@@ -36,7 +36,7 @@ const KNOWN_LOCALE_CONFIGS = {
36
36
  nextPageText: 'Следующая страница',
37
37
  },
38
38
  };
39
- const getCommonConfig = async ({ config, root, configFilePath, base, version, download, export: export_, ignore, force, open, lazy, include, exclude, }) => {
39
+ const getCommonConfig = async ({ config, root, configFilePath, base, version, download, export: export_, ignore, force, open, lazy, include, exclude, redirect, }) => {
40
40
  const fallbackToZh = 'lang' in config && !config.lang;
41
41
  root = resolveDocRoot(CWD, root, config.root);
42
42
  const localBasePath = configFilePath ? path.dirname(configFilePath) : root;
@@ -102,6 +102,7 @@ const getCommonConfig = async ({ config, root, configFilePath, base, version, do
102
102
  enableScrollToTop: true,
103
103
  // https://github.com/web-infra-dev/rspress/issues/2011
104
104
  outline: true,
105
+ localeRedirect: redirect,
105
106
  ...(fallbackToZh ? KNOWN_LOCALE_CONFIGS.zh : { locales }),
106
107
  },
107
108
  plugins: [
@@ -178,7 +179,7 @@ const findConfig = async (basePath) => {
178
179
  }
179
180
  }
180
181
  };
181
- export async function loadConfig(root, { config: configFile, base, prefix, v: version, download, export: export_, ignore, force, open, lazy, include, exclude, outDir, } = {}) {
182
+ export async function loadConfig(root, { config: configFile, base, prefix, v: version, download, export: export_, ignore, force, open, lazy, include, exclude, outDir, redirect, } = {}) {
182
183
  let configFilePath;
183
184
  if (configFile) {
184
185
  configFilePath = path.resolve(configFile);
@@ -242,6 +243,7 @@ export async function loadConfig(root, { config: configFile, base, prefix, v: ve
242
243
  lazy,
243
244
  include,
244
245
  exclude,
246
+ redirect,
245
247
  });
246
248
  base = commonConfig.base;
247
249
  const mergedConfig = mergeRsbuildConfig(commonConfig, config, {
package/lib/types.d.ts CHANGED
@@ -17,6 +17,7 @@ export interface GlobalCliOptions {
17
17
  include?: string[];
18
18
  exclude?: string[];
19
19
  outDir?: string;
20
+ redirect?: 'auto' | 'never';
20
21
  }
21
22
  export interface TranslateOptions {
22
23
  systemPrompt?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alauda/doom",
3
- "version": "0.22.1",
3
+ "version": "0.22.2",
4
4
  "type": "module",
5
5
  "description": "Doctor Doom making docs.",
6
6
  "repository": "https://gitlab-ce.alauda.cn/idp/Doom.git",