MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / defaultRouteFromFile

Function defaultRouteFromFile

docs/scripts/rewrite-doc-links.mjs:67–74  ·  view source on GitHub ↗
(namespaceRoot, fullPath)

Source from the content-addressed store, hash-verified

65}
66
67function defaultRouteFromFile(namespaceRoot, fullPath) {
68 const rel = path.posix.normalize(path.relative(namespaceRoot, fullPath)).replace(/\\/g, '/');
69 const parsed = path.posix.parse(rel);
70 const parts = parsed.dir === '.' ? [] : parsed.dir.split('/').map(stripOrderingPrefix);
71 const base = stripOrderingPrefix(parsed.name);
72 if (base !== 'index') parts.push(base);
73 return normalizeRoute(parts.join('/'));
74}
75
76function splitPathSuffix(target) {
77 const m = target.match(/^([^?#]*)([?#].*)?$/);

Callers 1

mainFunction · 0.85

Calls 9

stripOrderingPrefixFunction · 0.85
normalizeRouteFunction · 0.85
replaceMethod · 0.80
normalizeMethod · 0.80
splitMethod · 0.80
joinMethod · 0.80
parseMethod · 0.45
mapMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…