@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 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 --cwd .output --env-file ../.env server-entry.js",
86
+ "preview": "bun .output/server-entry.js",
87
87
  },
88
88
  "dependencies": {
89
89
  "@aklinker1/aframe": "latest",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aklinker1/aframe",
3
- "version": "0.4.5",
3
+ "version": "0.4.6",
4
4
  "packageManager": "bun@1.2.5",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -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(`${import.meta.publicDir}/index.html`);
31
+ paths.push(`${publicDir}/index.html`);
32
32
  }
33
33
 
34
34
  for (const path of paths) {
package/src/env.d.ts CHANGED
@@ -2,6 +2,7 @@ import "vite/client";
2
2
 
3
3
  declare global {
4
4
  interface ImportMeta {
5
+ /** Absolute path or relative path (relative to main server file, not CWD). */
5
6
  publicDir: string;
6
7
  command: string;
7
8
  }