@tschk/moonshine-next 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.
Files changed (2) hide show
  1. package/package.json +4 -4
  2. package/src/link.ts +1 -11
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tschk/moonshine-next",
3
- "version": "0.3.7",
3
+ "version": "0.4.1",
4
4
  "description": "Next.js API surface reimplemented on moonshine — drop Next, keep the imports",
5
5
  "license": "ISC",
6
6
  "type": "module",
@@ -21,9 +21,9 @@
21
21
  "./shaders": "./src/shaders.ts"
22
22
  },
23
23
  "dependencies": {
24
- "@tschk/moonshine": "^0.3.6",
25
- "@tschk/moonshine-router": "^0.3.6",
26
- "@tschk/moonshine-shaders": "^0.3.6"
24
+ "@tschk/moonshine": "^0.4.1",
25
+ "@tschk/moonshine-router": "^0.4.1",
26
+ "@tschk/moonshine-shaders": "^0.4.1"
27
27
  },
28
28
  "peerDependencies": {
29
29
  "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
 
22
22
  export type LinkProps = Omit<
23
23
  AnchorHTMLAttributes<HTMLAnchorElement>,
@@ -42,16 +42,6 @@ function hrefToString(href: LinkProps["href"]): string {
42
42
  return `${pathname}?${new URLSearchParams(entries).toString()}`;
43
43
  }
44
44
 
45
- /** External and non-navigational targets must keep the browser's own handling. */
46
- function isExternal(href: string, target?: string): boolean {
47
- if (target && target !== "_self") return true;
48
- return (
49
- /^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(href) ||
50
- href.startsWith("//") ||
51
- href.startsWith("#")
52
- );
53
- }
54
-
55
45
  const prefetched = new Set<string>();
56
46
 
57
47
  /** Warms the browser cache for `url` once, the way Waku prefetches a route. */