@tschk/moonshine-react-router 0.3.7 → 0.4.1
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/package.json +3 -3
- package/src/link.ts +1 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tschk/moonshine-react-router",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "react-router / Remix client API reimplemented on moonshine — drop react-router, keep the imports",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"type": "module",
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
"./aliases": "./src/aliases.ts"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@tschk/moonshine": "^0.
|
|
21
|
-
"@tschk/moonshine-router": "^0.
|
|
20
|
+
"@tschk/moonshine": "^0.4.1",
|
|
21
|
+
"@tschk/moonshine-router": "^0.4.1"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"react": ">=18",
|
package/src/link.ts
CHANGED
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
type MouseEvent,
|
|
18
18
|
type ReactNode,
|
|
19
19
|
} from "react";
|
|
20
|
-
import { navigate } from "@tschk/moonshine/router";
|
|
20
|
+
import { isExternal, navigate } from "@tschk/moonshine/router";
|
|
21
21
|
import { toHref, type To } from "./location";
|
|
22
22
|
import { useLocation } from "./navigation";
|
|
23
23
|
|
|
@@ -36,15 +36,6 @@ export type LinkProps = Omit<
|
|
|
36
36
|
children?: ReactNode;
|
|
37
37
|
};
|
|
38
38
|
|
|
39
|
-
function isExternal(href: string, target?: string): boolean {
|
|
40
|
-
if (target && target !== "_self") return true;
|
|
41
|
-
return (
|
|
42
|
-
/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(href) ||
|
|
43
|
-
href.startsWith("//") ||
|
|
44
|
-
href.startsWith("#")
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
39
|
const prefetched = new Set<string>();
|
|
49
40
|
|
|
50
41
|
function prefetchOnce(url: string): void {
|