@aklinker1/aframe 0.4.4 → 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 +3 -5
- package/package.json +2 -2
- package/src/client/server.ts +5 -5
- package/src/env.d.ts +1 -0
- package/src/prerenderer.ts +2 -2
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",
|
|
@@ -122,9 +122,7 @@ import welcomeEmailTemplate from "./assets/email-templates/welcome.html" with {
|
|
|
122
122
|
|
|
123
123
|
## Detecting Prerender
|
|
124
124
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
Aframe provides a helper for checking this, `isPrerendering`:
|
|
125
|
+
Aframe provides a helper for checking if the app is being prerendered, `isPrerendering()`:
|
|
128
126
|
|
|
129
127
|
```vue
|
|
130
128
|
<!-- ClientOnly.vue -->
|
|
@@ -143,5 +141,5 @@ const visible = !isPrerendering();
|
|
|
143
141
|
## Publish Update to NPM
|
|
144
142
|
|
|
145
143
|
```sh
|
|
146
|
-
bun run
|
|
144
|
+
bun run release
|
|
147
145
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aklinker1/aframe",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.6",
|
|
4
4
|
"packageManager": "bun@1.2.5",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"dev": "bun aframe demo",
|
|
24
24
|
"build": "bun aframe build demo",
|
|
25
25
|
"preview": "bun --cwd demo/.output --env-file ../.env server-entry.js",
|
|
26
|
-
"
|
|
26
|
+
"release": "bun run scripts/release.ts"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {},
|
|
29
29
|
"devDependencies": {
|
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) {
|
package/src/env.d.ts
CHANGED
package/src/prerenderer.ts
CHANGED
|
@@ -24,8 +24,8 @@ export async function prerenderPages(
|
|
|
24
24
|
} = config.prerenderer ?? {};
|
|
25
25
|
|
|
26
26
|
const server = Bun.spawn({
|
|
27
|
-
cmd: ["bun",
|
|
28
|
-
cwd: config.
|
|
27
|
+
cmd: ["bun", join(config.serverOutDir, "server-entry.js")],
|
|
28
|
+
cwd: config.rootDir,
|
|
29
29
|
stdio: ["inherit", "inherit", "inherit"],
|
|
30
30
|
});
|
|
31
31
|
|