@emdash-cms/cloudflare 0.0.3 → 0.1.0

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.
@@ -71,7 +71,9 @@ function normalizeCacheKey(url) {
71
71
  */
72
72
  function resolveEnvValue(explicit, envVarName) {
73
73
  if (explicit) return explicit;
74
- return env[envVarName];
74
+ if (!(envVarName in env)) return void 0;
75
+ const value = Reflect.get(env, envVarName);
76
+ return typeof value === "string" ? value : void 0;
75
77
  }
76
78
  /**
77
79
  * Strip internal tracking headers from a response before returning to client.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@emdash-cms/cloudflare",
3
- "version": "0.0.3",
3
+ "version": "0.1.0",
4
4
  "description": "Cloudflare adapters for EmDash - D1, R2, Access, and Worker Loader sandbox",
5
5
  "type": "module",
6
6
  "main": "dist/index.mjs",
@@ -66,7 +66,7 @@
66
66
  "jose": "^6.1.3",
67
67
  "kysely-d1": "^0.4.0",
68
68
  "ulidx": "^2.4.1",
69
- "emdash": "0.0.3"
69
+ "emdash": "0.1.0"
70
70
  },
71
71
  "peerDependencies": {
72
72
  "@cloudflare/workers-types": ">=4.0.0",
@@ -134,7 +134,9 @@ function normalizeCacheKey(url: URL): string {
134
134
  */
135
135
  function resolveEnvValue(explicit: string | undefined, envVarName: string): string | undefined {
136
136
  if (explicit) return explicit;
137
- return (env as Record<string, unknown>)[envVarName] as string | undefined;
137
+ if (!(envVarName in env)) return undefined;
138
+ const value: unknown = Reflect.get(env, envVarName);
139
+ return typeof value === "string" ? value : undefined;
138
140
  }
139
141
 
140
142
  /**
@@ -11,12 +11,12 @@
11
11
  */
12
12
 
13
13
  export interface PlaygroundToolbarConfig {
14
- /** When the playground was created (ISO string) */
15
- createdAt: string;
16
- /** TTL in seconds */
17
- ttl: number;
18
- /** Whether edit mode is currently active */
19
- editMode: boolean;
14
+ /** When the playground was created (ISO string) */
15
+ createdAt: string;
16
+ /** TTL in seconds */
17
+ ttl: number;
18
+ /** Whether edit mode is currently active */
19
+ editMode: boolean;
20
20
  }
21
21
 
22
22
  const RE_AMP = /&/g;
@@ -25,9 +25,9 @@ const RE_LT = /</g;
25
25
  const RE_GT = />/g;
26
26
 
27
27
  export function renderPlaygroundToolbar(config: PlaygroundToolbarConfig): string {
28
- const { createdAt, ttl, editMode } = config;
28
+ const { createdAt, ttl, editMode } = config;
29
29
 
30
- return `
30
+ return `
31
31
  <!-- EmDash Playground Toolbar -->
32
32
  <div id="emdash-playground-toolbar" data-created-at="${escapeAttr(createdAt)}" data-ttl="${ttl}" data-edit-mode="${editMode}">
33
33
  <div class="ec-pg-inner">
@@ -333,9 +333,9 @@ export function renderPlaygroundToolbar(config: PlaygroundToolbarConfig): string
333
333
  }
334
334
 
335
335
  function escapeAttr(str: string): string {
336
- return str
337
- .replace(RE_AMP, "&amp;")
338
- .replace(RE_QUOT, "&quot;")
339
- .replace(RE_LT, "&lt;")
340
- .replace(RE_GT, "&gt;");
336
+ return str
337
+ .replace(RE_AMP, "&amp;")
338
+ .replace(RE_QUOT, "&quot;")
339
+ .replace(RE_LT, "&lt;")
340
+ .replace(RE_GT, "&gt;");
341
341
  }