MCPcopy Create free account
hub / github.com/adobe/react-spectrum / getRSCUrl

Function getRSCUrl

packages/dev/s2-docs/src/pageUtils.ts:27–41  ·  view source on GitHub ↗
(pathname: string)

Source from the content-addressed store, hash-verified

25}
26
27export function getRSCUrl(pathname: string) {
28 let url = new URL(pathname, location.href);
29 url.pathname = url.pathname.replace('.html', '');
30 if (!process.env.PARCEL_V3 || process.env.NODE_ENV === 'production') {
31 if (url.pathname.endsWith('/')) {
32 url.pathname += 'index.rsc';
33 } else {
34 url.pathname += '.rsc';
35 }
36 }
37
38 url.search = '';
39 url.hash = '';
40 return url.href;
41}
42
43export function isClientLink(link: HTMLAnchorElement) {
44 let baseUrl = process.env.LIBRARY

Callers 2

prefetchRouteFunction · 0.90
navigateFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected