@aklinker1/aframe 0.4.5 → 0.4.6
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/README.md +1 -1
- package/package.json +1 -1
- package/src/client/server.ts +5 -5
- package/src/env.d.ts +1 -0
package/README.md
CHANGED
|
@@ -83,7 +83,7 @@ bun add -D puppeteer vite
|
|
|
83
83
|
"aframe": "bun node_modules/@aklinker1/aframe/bin/aframe.ts",
|
|
84
84
|
"dev": "bun --silent aframe",
|
|
85
85
|
"build": "bun --silent aframe build",
|
|
86
|
-
"preview": "bun
|
|
86
|
+
"preview": "bun .output/server-entry.js",
|
|
87
87
|
},
|
|
88
88
|
"dependencies": {
|
|
89
89
|
"@aklinker1/aframe": "latest",
|
package/package.json
CHANGED
package/src/client/server.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { BunFile } from "bun";
|
|
2
|
+
import { resolve } from "node:path";
|
|
2
3
|
|
|
3
4
|
const headers = {
|
|
4
5
|
"Cache-Control": "max-age=31536000",
|
|
@@ -8,6 +9,8 @@ export interface AframeServer {
|
|
|
8
9
|
listen(port: number): void | never;
|
|
9
10
|
}
|
|
10
11
|
|
|
12
|
+
const publicDir = resolve(import.meta.dir, import.meta.publicDir);
|
|
13
|
+
|
|
11
14
|
/**
|
|
12
15
|
* Fetches a file from the `public` directory.
|
|
13
16
|
*/
|
|
@@ -21,14 +24,11 @@ export function fetchStatic(options?: {
|
|
|
21
24
|
return async (request) => {
|
|
22
25
|
const path = new URL(request.url).pathname.replace(/\/+$/, "");
|
|
23
26
|
|
|
24
|
-
const paths = [
|
|
25
|
-
`${import.meta.publicDir}${path}`,
|
|
26
|
-
`${import.meta.publicDir}${path}/index.html`,
|
|
27
|
-
];
|
|
27
|
+
const paths = [`${publicDir}${path}`, `${publicDir}${path}/index.html`];
|
|
28
28
|
|
|
29
29
|
// Only fallback on the root HTML file when building application
|
|
30
30
|
if (import.meta.command === "build") {
|
|
31
|
-
paths.push(`${
|
|
31
|
+
paths.push(`${publicDir}/index.html`);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
for (const path of paths) {
|