@rspress/plugin-client-redirects 1.43.0-canary-20240224 → 1.43.0-canary-202503021457

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/dist/index.js CHANGED
@@ -1,10 +1,13 @@
1
+ import { fileURLToPath as __webpack_fileURLToPath__ } from "node:url";
2
+ import { dirname as __webpack_dirname__ } from "node:path";
1
3
  import * as __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__ from "node:path";
4
+ var src_dirname = __webpack_dirname__(__webpack_fileURLToPath__(import.meta.url));
2
5
  function pluginClientRedirects(options = {}) {
3
6
  return {
4
7
  name: '@rspress/plugin-client-redirects',
5
8
  globalUIComponents: [
6
9
  [
7
- __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(__dirname, '../src/components/Redirect.tsx'),
10
+ __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(src_dirname, '../static/Redirect.tsx'),
8
11
  options
9
12
  ]
10
13
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspress/plugin-client-redirects",
3
- "version": "1.43.0-canary-20240224",
3
+ "version": "1.43.0-canary-202503021457",
4
4
  "description": "A plugin for rspress to client redirect in docs.",
5
5
  "bugs": "https://github.com/web-infra-dev/rspress/issues",
6
6
  "repository": {
@@ -21,23 +21,23 @@
21
21
  "types": "./dist/index.d.ts",
22
22
  "files": [
23
23
  "dist",
24
- "src"
24
+ "static"
25
25
  ],
26
26
  "dependencies": {
27
- "@rspress/shared": "1.43.0-canary-20240224"
27
+ "@rspress/shared": "1.43.0-canary-202503021457"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@microsoft/api-extractor": "^7.49.2",
31
- "@modern-js/tsconfig": "2.64.0",
32
- "@rslib/core": "0.4.1",
31
+ "@rslib/core": "0.5.2",
33
32
  "@types/node": "^18.11.17",
34
33
  "@types/react": "^18.3.18",
35
34
  "@types/react-dom": "^18.3.5",
36
35
  "react": "^18.3.1",
37
- "typescript": "^5.5.3"
36
+ "typescript": "^5.5.3",
37
+ "@rspress/config": "1.0.0"
38
38
  },
39
39
  "peerDependencies": {
40
- "@rspress/runtime": "^1.42.0"
40
+ "@rspress/runtime": "^1.43.0-canary-202503021457"
41
41
  },
42
42
  "engines": {
43
43
  "node": ">=14.17.6"
@@ -47,7 +47,6 @@
47
47
  "provenance": true,
48
48
  "registry": "https://registry.npmjs.org/"
49
49
  },
50
- "jsnext:source": "./src/index.ts",
51
50
  "scripts": {
52
51
  "build": "rslib build",
53
52
  "dev": "rslib build -w",
@@ -1,7 +1,16 @@
1
1
  import { useLocation } from '@rspress/runtime';
2
2
  import { isExternalUrl } from '@rspress/shared';
3
3
  import { useEffect } from 'react';
4
- import type { RedirectsOptions } from '../types';
4
+
5
+ // these are types copied from src/types.ts
6
+ type RedirectRule = {
7
+ to: string;
8
+ from: string | string[];
9
+ };
10
+
11
+ type RedirectsOptions = {
12
+ redirects?: RedirectRule[];
13
+ };
5
14
 
6
15
  export default function Redirect(props: RedirectsOptions = {}) {
7
16
  const { pathname } = useLocation();
package/src/env.d.ts DELETED
@@ -1 +0,0 @@
1
- /// <reference types='@rslib/core/types' />
package/src/index.ts DELETED
@@ -1,17 +0,0 @@
1
- import path from 'node:path';
2
- import type { RspressPlugin } from '@rspress/shared';
3
- import type { RedirectsOptions } from './types';
4
-
5
- /**
6
- * The plugin is used to add client redirect feature to the doc site.
7
- */
8
- export function pluginClientRedirects(
9
- options: RedirectsOptions = {},
10
- ): RspressPlugin {
11
- return {
12
- name: '@rspress/plugin-client-redirects',
13
- globalUIComponents: [
14
- [path.join(__dirname, '../src/components/Redirect.tsx'), options],
15
- ],
16
- };
17
- }
package/src/types.ts DELETED
@@ -1,8 +0,0 @@
1
- export type RedirectRule = {
2
- to: string;
3
- from: string | string[];
4
- };
5
-
6
- export type RedirectsOptions = {
7
- redirects?: RedirectRule[];
8
- };