@xyd-js/host 0.0.0-build-294eaf4-20250911201553 → 0.0.0-build-6d83665-20250917173505

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/CHANGELOG.md CHANGED
@@ -1,24 +1,24 @@
1
1
  # @xyd-js/host
2
2
 
3
- ## 0.0.0-build-294eaf4-20250911201553
3
+ ## 0.0.0-build-6d83665-20250917173505
4
4
 
5
5
  ### Patch Changes
6
6
 
7
7
  - update all packages
8
8
  - Updated dependencies
9
- - @xyd-js/analytics@0.0.0-build-294eaf4-20250911201553
10
- - @xyd-js/atlas@0.0.0-build-294eaf4-20250911201553
11
- - @xyd-js/components@0.0.0-build-294eaf4-20250911201553
12
- - @xyd-js/composer@0.0.0-build-294eaf4-20250911201553
13
- - @xyd-js/content@0.0.0-build-294eaf4-20250911201553
14
- - @xyd-js/core@0.0.0-build-294eaf4-20250911201553
15
- - @xyd-js/framework@0.0.0-build-294eaf4-20250911201553
16
- - @xyd-js/plugin-algolia@0.0.0-build-294eaf4-20250911201553
17
- - @xyd-js/plugin-orama@0.0.0-build-294eaf4-20250911201553
18
- - @xyd-js/theme-cosmo@0.0.0-build-294eaf4-20250911201553
19
- - @xyd-js/theme-gusto@0.0.0-build-294eaf4-20250911201553
20
- - @xyd-js/theme-opener@0.0.0-build-294eaf4-20250911201553
21
- - @xyd-js/theme-picasso@0.0.0-build-294eaf4-20250911201553
22
- - @xyd-js/theme-poetry@0.0.0-build-294eaf4-20250911201553
23
- - @xyd-js/theme-solar@0.0.0-build-294eaf4-20250911201553
24
- - @xyd-js/themes@0.0.0-build-294eaf4-20250911201553
9
+ - @xyd-js/analytics@0.0.0-build-6d83665-20250917173505
10
+ - @xyd-js/atlas@0.0.0-build-6d83665-20250917173505
11
+ - @xyd-js/components@0.0.0-build-6d83665-20250917173505
12
+ - @xyd-js/composer@0.0.0-build-6d83665-20250917173505
13
+ - @xyd-js/content@0.0.0-build-6d83665-20250917173505
14
+ - @xyd-js/core@0.0.0-build-6d83665-20250917173505
15
+ - @xyd-js/framework@0.0.0-build-6d83665-20250917173505
16
+ - @xyd-js/plugin-algolia@0.0.0-build-6d83665-20250917173505
17
+ - @xyd-js/plugin-orama@0.0.0-build-6d83665-20250917173505
18
+ - @xyd-js/theme-cosmo@0.0.0-build-6d83665-20250917173505
19
+ - @xyd-js/theme-gusto@0.0.0-build-6d83665-20250917173505
20
+ - @xyd-js/theme-opener@0.0.0-build-6d83665-20250917173505
21
+ - @xyd-js/theme-picasso@0.0.0-build-6d83665-20250917173505
22
+ - @xyd-js/theme-poetry@0.0.0-build-6d83665-20250917173505
23
+ - @xyd-js/theme-solar@0.0.0-build-6d83665-20250917173505
24
+ - @xyd-js/themes@0.0.0-build-6d83665-20250917173505
package/app/public.ts CHANGED
@@ -4,40 +4,54 @@ import fs from "node:fs/promises";
4
4
  import { redirect } from "react-router";
5
5
 
6
6
  const MIME_TYPES: Record<string, string> = {
7
- '.html': 'text/html',
8
- '.css': 'text/css',
9
- '.js': 'text/javascript',
10
- '.json': 'application/json',
11
- '.png': 'image/png',
12
- '.jpg': 'image/jpeg',
13
- '.jpeg': 'image/jpeg',
14
- '.webp': 'image/webp',
15
- '.gif': 'image/gif',
16
- '.svg': 'image/svg+xml',
17
- '.ico': 'image/x-icon',
18
- '.txt': 'text/plain',
7
+ ".html": "text/html",
8
+ ".css": "text/css",
9
+ ".js": "text/javascript",
10
+ ".json": "application/json",
11
+ ".png": "image/png",
12
+ ".jpg": "image/jpeg",
13
+ ".jpeg": "image/jpeg",
14
+ ".webp": "image/webp",
15
+ ".gif": "image/gif",
16
+ ".svg": "image/svg+xml",
17
+ ".ico": "image/x-icon",
18
+ ".txt": "text/plain",
19
19
  };
20
20
 
21
- const BINARY_FILE_EXTENSIONS = ['.png', '.jpg', '.jpeg', '.gif', '.ico', '.webp'];
21
+ const BINARY_FILE_EXTENSIONS = [
22
+ ".png",
23
+ ".jpg",
24
+ ".jpeg",
25
+ ".gif",
26
+ ".ico",
27
+ ".webp",
28
+ ];
22
29
 
23
30
  export async function loader({ params }: any) {
24
- const filePath = path.join(process.cwd(), "public", params["*"])
25
-
26
- try {
27
- await fs.access(filePath)
28
- } catch (e) {
29
- return redirect("/404")
30
- }
31
+ const filePath = path.join(
32
+ process.cwd(),
33
+ "public",
34
+ params["*"]
35
+ );
31
36
 
32
- const ext = path.extname(filePath).toLowerCase();
33
- const isBinaryFile = BINARY_FILE_EXTENSIONS.includes(ext);
34
- const fileContent = await fs.readFile(filePath, isBinaryFile ? null : 'utf-8');
35
- const contentType = MIME_TYPES[ext] || 'application/octet-stream';
37
+ try {
38
+ await fs.access(filePath);
39
+ } catch (e) {
40
+ return redirect("/404");
41
+ }
36
42
 
37
- return new Response(fileContent, {
38
- status: 200,
39
- headers: {
40
- 'Content-Type': contentType,
41
- },
42
- });
43
- }
43
+ const ext = path.extname(filePath).toLowerCase();
44
+ const isBinaryFile = BINARY_FILE_EXTENSIONS.includes(ext);
45
+ const fileContent = await fs.readFile(
46
+ filePath,
47
+ isBinaryFile ? null : "utf-8"
48
+ );
49
+ const contentType = MIME_TYPES[ext] || "application/octet-stream";
50
+
51
+ return new Response(fileContent, {
52
+ status: 200,
53
+ headers: {
54
+ "Content-Type": contentType,
55
+ },
56
+ });
57
+ }
package/app/root.tsx CHANGED
@@ -32,7 +32,7 @@ export function loader({ request }: { request: any }) {
32
32
  return
33
33
  }
34
34
 
35
- const slug = getPathname(request.url || "index") || "index"
35
+ const slug = getPathname(request.url || "index", settings?.advanced?.basename) || "index"
36
36
 
37
37
  if (settings?.redirects) {
38
38
  const shouldRedirect = settings.redirects.find((redirect: any) => redirect.source === slug)
@@ -130,9 +130,21 @@ export default function App() {
130
130
  return <Outlet />;
131
131
  }
132
132
 
133
- function getPathname(url: string) {
133
+ function getPathname(url: string, basename?: string) {
134
134
  const parsedUrl = new URL(url);
135
- return parsedUrl.pathname.replace(/^\//, '');
135
+ let pathname = parsedUrl.pathname;
136
+
137
+ // Trim basename from the pathname if it exists
138
+ if (basename && basename !== "/" && pathname.startsWith(basename)) {
139
+ pathname = pathname.slice(basename.length);
140
+ }
141
+
142
+ // Ensure we have a leading slash and then remove it to get the slug
143
+ if (!pathname.startsWith("/")) {
144
+ pathname = "/" + pathname;
145
+ }
146
+
147
+ return pathname.replace(/^\//, '');
136
148
  }
137
149
 
138
150
  function DefaultMetas() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xyd-js/host",
3
- "version": "0.0.0-build-294eaf4-20250911201553",
3
+ "version": "0.0.0-build-6d83665-20250917173505",
4
4
  "type": "module",
5
5
  "dependencies": {
6
6
  "katex": "^0.16.22",
@@ -13,22 +13,22 @@
13
13
  "@react-router/serve": "^7.7.1",
14
14
  "openux-js": "0.0.0-pre.1",
15
15
  "pluganalytics": "0.0.0-pre.3",
16
- "@xyd-js/analytics": "0.0.0-build-294eaf4-20250911201553",
17
- "@xyd-js/core": "0.0.0-build-294eaf4-20250911201553",
18
- "@xyd-js/components": "0.0.0-build-294eaf4-20250911201553",
19
- "@xyd-js/content": "0.0.0-build-294eaf4-20250911201553",
20
- "@xyd-js/framework": "0.0.0-build-294eaf4-20250911201553",
21
- "@xyd-js/composer": "0.0.0-build-294eaf4-20250911201553",
22
- "@xyd-js/themes": "0.0.0-build-294eaf4-20250911201553",
23
- "@xyd-js/atlas": "0.0.0-build-294eaf4-20250911201553",
24
- "@xyd-js/theme-poetry": "0.0.0-build-294eaf4-20250911201553",
25
- "@xyd-js/theme-cosmo": "0.0.0-build-294eaf4-20250911201553",
26
- "@xyd-js/theme-opener": "0.0.0-build-294eaf4-20250911201553",
27
- "@xyd-js/theme-picasso": "0.0.0-build-294eaf4-20250911201553",
28
- "@xyd-js/theme-gusto": "0.0.0-build-294eaf4-20250911201553",
29
- "@xyd-js/theme-solar": "0.0.0-build-294eaf4-20250911201553",
30
- "@xyd-js/plugin-orama": "0.0.0-build-294eaf4-20250911201553",
31
- "@xyd-js/plugin-algolia": "0.0.0-build-294eaf4-20250911201553"
16
+ "@xyd-js/analytics": "0.0.0-build-6d83665-20250917173505",
17
+ "@xyd-js/core": "0.0.0-build-6d83665-20250917173505",
18
+ "@xyd-js/components": "0.0.0-build-6d83665-20250917173505",
19
+ "@xyd-js/content": "0.0.0-build-6d83665-20250917173505",
20
+ "@xyd-js/framework": "0.0.0-build-6d83665-20250917173505",
21
+ "@xyd-js/composer": "0.0.0-build-6d83665-20250917173505",
22
+ "@xyd-js/themes": "0.0.0-build-6d83665-20250917173505",
23
+ "@xyd-js/atlas": "0.0.0-build-6d83665-20250917173505",
24
+ "@xyd-js/theme-poetry": "0.0.0-build-6d83665-20250917173505",
25
+ "@xyd-js/theme-cosmo": "0.0.0-build-6d83665-20250917173505",
26
+ "@xyd-js/theme-opener": "0.0.0-build-6d83665-20250917173505",
27
+ "@xyd-js/theme-picasso": "0.0.0-build-6d83665-20250917173505",
28
+ "@xyd-js/theme-gusto": "0.0.0-build-6d83665-20250917173505",
29
+ "@xyd-js/theme-solar": "0.0.0-build-6d83665-20250917173505",
30
+ "@xyd-js/plugin-orama": "0.0.0-build-6d83665-20250917173505",
31
+ "@xyd-js/plugin-algolia": "0.0.0-build-6d83665-20250917173505"
32
32
  },
33
33
  "devDependencies": {
34
34
  "autoprefixer": "^10.4.20",
@@ -90,5 +90,6 @@ export default {
90
90
  ssr: false,
91
91
  prerender: prerenderPaths,
92
92
  buildDirectory: path.join(cwd, ".xyd/build"),
93
+ basename: __xydSettings?.advanced?.basename || "/",
93
94
  // return a list of URLs to prerender at build time
94
95
  } satisfies Config;