@kudzujs/core 0.8.22 → 0.8.23

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.
@@ -0,0 +1,18 @@
1
+ import { dirname, relative } from "node:path"
2
+
3
+ export function relativeModulePath(from, to) {
4
+ const path = relative(dirname(from), to).replaceAll("\\", "/")
5
+ return path.startsWith(".") ? path : `./${path}`
6
+ }
7
+
8
+ export function browserPath(path) {
9
+ return path ? new URL(path, "http://kudzu.local").pathname : ""
10
+ }
11
+
12
+ export function assetPath(base, path) {
13
+ return `${base}/${path}`
14
+ }
15
+
16
+ export function withBase(base, path) {
17
+ return base ? `${base}${path}` : path
18
+ }