@flyo/nitro-astro 2.3.1 → 2.3.3

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.
@@ -5,9 +5,31 @@ const integration = useFlyoIntegration();
5
5
  const config = await useConfig(Astro);
6
6
 
7
7
  // Get environment variables
8
- const mode = import.meta.env.MODE;
9
- const vercelDeploymentId = import.meta.env.VERCEL_DEPLOYMENT_ID || '-';
10
- const vercelGitCommitSha = import.meta.env.VERCEL_GIT_COMMIT_SHA || '-';
8
+ // helper: build (import.meta.env) first, then runtime (process.env)
9
+ const env = import.meta.env; // Astro/Vite env access
10
+ const readEnv = (key, fallback = "") => {
11
+ const fromBuild = env?.[key];
12
+ if (fromBuild !== undefined && fromBuild !== "") {
13
+ return String(fromBuild);
14
+ }
15
+
16
+ const fromRuntime = typeof process !== "undefined" && process.env ? process.env[key] : undefined;
17
+ if (fromRuntime !== undefined && fromRuntime !== "") {
18
+ return String(fromRuntime);
19
+ }
20
+
21
+ return fallback;
22
+ };
23
+
24
+ // Get environment variables
25
+ const mode = readEnv("MODE", "-");
26
+ const vercelDeploymentId = readEnv("VERCEL_DEPLOYMENT_ID", "-");
27
+
28
+ // prefer your own sha, otherwise Vercel's
29
+ const gitSha = readEnv("VERCEL_GIT_COMMIT_SHA", "-");
30
+
31
+ // prefer your own release/version, otherwise empty
32
+ const version = readEnv("VERSION", "");
11
33
 
12
34
  // Get token and determine type
13
35
  const token = integration.options.accessToken || '';
@@ -28,15 +50,21 @@ const apiLastUpdate = config.nitro?.updated_at
28
50
  })
29
51
  : '-';
30
52
 
31
- const debugInfo = [
53
+ const debugInfoParts = [
32
54
  `liveedit:${debug}`,
33
- `mode:${mode}`,
34
- `apiversion:${apiVersion}`,
35
- `apiversiondate:${apiLastUpdate}`,
55
+ `env:${mode}`,
56
+ `version:${apiVersion}`,
57
+ `versiondate:${apiLastUpdate}`,
36
58
  `tokentype:${tokenType}`,
37
59
  `did:${vercelDeploymentId}`,
38
60
  `csha:${vercelGitCommitSha}`
39
- ].join(' | ');
61
+ ];
62
+
63
+ if (version) {
64
+ debugInfoParts.push(`release:${version}`);
65
+ }
66
+
67
+ const debugInfo = debugInfoParts.join(' | ');
40
68
 
41
69
  ---
42
70
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flyo/nitro-astro",
3
- "version": "2.3.1",
3
+ "version": "2.3.3",
4
4
  "description": "Connecting Flyo Headless Content Hub into your Astro project.",
5
5
  "homepage": "https://dev.flyo.cloud/nitro",
6
6
  "keywords": [