@leadertechie/personal-site-kit 0.1.0-alpha.26 → 0.1.0-alpha.28

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.
@@ -1 +1 @@
1
- {"version":3,"file":"about-me.d.ts","sourceRoot":"","sources":["../../../src/api/handlers/about-me.ts"],"names":[],"mappings":"AAmDA,wBAAgB,iBAAiB,SAEhC;AAED,wBAAsB,aAAa,CAAC,GAAG,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC,CA4DhE"}
1
+ {"version":3,"file":"about-me.d.ts","sourceRoot":"","sources":["../../../src/api/handlers/about-me.ts"],"names":[],"mappings":"AAoDA,wBAAgB,iBAAiB,SAEhC;AAED,wBAAsB,aAAa,CAAC,GAAG,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC,CA6DhE"}
@@ -1 +1 @@
1
- {"version":3,"file":"auth-handler.d.ts","sourceRoot":"","sources":["../../../src/api/handlers/auth-handler.ts"],"names":[],"mappings":"AAyBA,wBAAsB,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAgC/F"}
1
+ {"version":3,"file":"auth-handler.d.ts","sourceRoot":"","sources":["../../../src/api/handlers/auth-handler.ts"],"names":[],"mappings":"AA0BA,wBAAsB,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAgC/F"}
@@ -1 +1 @@
1
- {"version":3,"file":"content-api.d.ts","sourceRoot":"","sources":["../../../src/api/handlers/content-api.ts"],"names":[],"mappings":"AAWA,wBAAsB,WAAW,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAmB9F;AAED,wBAAsB,aAAa,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAmBhG;AAED,wBAAsB,YAAY,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAkB/E"}
1
+ {"version":3,"file":"content-api.d.ts","sourceRoot":"","sources":["../../../src/api/handlers/content-api.ts"],"names":[],"mappings":"AAYA,wBAAsB,WAAW,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAmB9F;AAED,wBAAsB,aAAa,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAmBhG;AAED,wBAAsB,YAAY,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAkB/E"}
@@ -1 +1 @@
1
- {"version":3,"file":"home.d.ts","sourceRoot":"","sources":["../../../src/api/handlers/home.ts"],"names":[],"mappings":"AAwCA,wBAAgB,iBAAiB,SAEhC;AAED,wBAAsB,UAAU,CAAC,GAAG,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC,CAwC7D"}
1
+ {"version":3,"file":"home.d.ts","sourceRoot":"","sources":["../../../src/api/handlers/home.ts"],"names":[],"mappings":"AAyCA,wBAAgB,iBAAiB,SAEhC;AAED,wBAAsB,UAAU,CAAC,GAAG,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC,CAyC7D"}
@@ -1 +1 @@
1
- {"version":3,"file":"logo.d.ts","sourceRoot":"","sources":["../../../src/api/handlers/logo.ts"],"names":[],"mappings":"AAsBA,wBAAsB,UAAU,CAAC,GAAG,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC,CAgC7D"}
1
+ {"version":3,"file":"logo.d.ts","sourceRoot":"","sources":["../../../src/api/handlers/logo.ts"],"names":[],"mappings":"AAwBA,wBAAsB,UAAU,CAAC,GAAG,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC,CAiC7D"}
@@ -1 +1 @@
1
- {"version":3,"file":"static-details.d.ts","sourceRoot":"","sources":["../../../src/api/handlers/static-details.ts"],"names":[],"mappings":"AAQA,wBAAsB,mBAAmB,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC,CAuCpG"}
1
+ {"version":3,"file":"static-details.d.ts","sourceRoot":"","sources":["../../../src/api/handlers/static-details.ts"],"names":[],"mappings":"AAUA,wBAAsB,mBAAmB,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC,CAwCpG"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,CAAC;AACtB,YAAY,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,cAAc,iBAAiB,CAAC;AAChC,cAAc,yBAAyB,CAAC;AAGxC,QAAA,MAAM,UAAU,YAAmB,CAAC;AACpC,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,CAAC;AACtB,YAAY,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,cAAc,iBAAiB,CAAC;AAChC,cAAc,yBAAyB,CAAC;AAGxC,QAAA,MAAM,UAAU,YAAmB,CAAC;AACpC,eAAe,UAAU,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"website-api.d.ts","sourceRoot":"","sources":["../../src/api/website-api.ts"],"names":[],"mappings":"AAUA,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;AAE3E,qBAAa,UAAU;IACrB,OAAO,CAAC,cAAc,CAAiC;IAEhD,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU;IAIzD,OAAO,CAAC,cAAc;IAStB,OAAO,CAAC,mBAAmB;IAmB3B,OAAO,CAAC,UAAU;IAqBL,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC;CAkGlE"}
1
+ {"version":3,"file":"website-api.d.ts","sourceRoot":"","sources":["../../src/api/website-api.ts"],"names":[],"mappings":"AAWA,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;AAE3E,qBAAa,UAAU;IACrB,OAAO,CAAC,cAAc,CAAiC;IAEhD,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU;IAIzD,OAAO,CAAC,cAAc;IAStB,OAAO,CAAC,mBAAmB;IAmB3B,OAAO,CAAC,UAAU;IAqBL,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC;CAmGlE"}
package/dist/api.js CHANGED
@@ -1,5 +1,5 @@
1
- import { W as WebsiteAPI } from "./chunks/website-api-CFRUPu0X.js";
2
- import { A, B, M, R, c, a, g, b, d, h, e, r, s, v } from "./chunks/website-api-CFRUPu0X.js";
1
+ import { W as WebsiteAPI } from "./chunks/website-api-D4iagul_.js";
2
+ import { A, B, M, R, c, a, g, b, d, h, e, r, s, v } from "./chunks/website-api-D4iagul_.js";
3
3
  const defaultAPI = new WebsiteAPI();
4
4
  export {
5
5
  A as AUTH_KV,
@@ -0,0 +1,34 @@
1
+ import { r2Adapter, LoggerProvider, consoleAdapter, LogLevel } from "@leadertechie/telemetry";
2
+ let _sharedProvider = null;
3
+ function getSharedProvider() {
4
+ if (!_sharedProvider) {
5
+ _sharedProvider = new LoggerProvider({ serviceName: "personal-site-kit" });
6
+ _sharedProvider.addAdapter(consoleAdapter({ level: LogLevel.WARN }));
7
+ }
8
+ return _sharedProvider;
9
+ }
10
+ const defaultLoggers = /* @__PURE__ */ new Map();
11
+ function getDefaultLogger(serviceName) {
12
+ let log = defaultLoggers.get(serviceName);
13
+ if (!log) {
14
+ log = getSharedProvider().getLogger(serviceName);
15
+ defaultLoggers.set(serviceName, log);
16
+ }
17
+ return log;
18
+ }
19
+ function configureR2Logging(env) {
20
+ if (!env?.LOGS_BUCKET) return;
21
+ const provider = getSharedProvider();
22
+ provider.addAdapter(
23
+ r2Adapter({
24
+ binding: env.LOGS_BUCKET,
25
+ prefix: "logs/personal-site-kit",
26
+ maxFileSize: 256e3
27
+ // 256 KB per file — rotate frequently
28
+ })
29
+ );
30
+ }
31
+ export {
32
+ configureR2Logging as c,
33
+ getDefaultLogger as g
34
+ };
@@ -1,3 +1,4 @@
1
+ import { g as getDefaultLogger, c as configureR2Logging } from "./telemetry-init-CbIyRWu5.js";
1
2
  import { R2ContentLoader, ContentCacheV2, parseFrontmatter as parseFrontmatter$1 } from "@leadertechie/r2tohtml";
2
3
  function createJSONResponse(data, status = 200) {
3
4
  return new Response(JSON.stringify(data), {
@@ -46,8 +47,9 @@ function clearContentCache$2() {
46
47
  loader$1?.clearCache();
47
48
  }
48
49
  async function handleAboutMe(env) {
50
+ const log = getDefaultLogger("personal-site-kit:about-me");
49
51
  try {
50
- console.log("handleAboutMe: env?.CONTENT_BUCKET =", !!env?.CONTENT_BUCKET);
52
+ log.info("env?.CONTENT_BUCKET =", { hasBucket: !!env?.CONTENT_BUCKET });
51
53
  if (!env?.CONTENT_BUCKET) {
52
54
  return new Response(JSON.stringify({ error: "Content bucket not configured", env: !!env }), {
53
55
  status: 500,
@@ -61,7 +63,7 @@ async function handleAboutMe(env) {
61
63
  headers: { "Content-Type": "application/json" }
62
64
  });
63
65
  }
64
- console.log("handleAboutMe: r2 created, fetching data");
66
+ log.info("r2 created, fetching data");
65
67
  const [profileObj, rendered] = await Promise.all([
66
68
  r2.getObject("profile.json"),
67
69
  r2.getRendered("about-me.md")
@@ -81,7 +83,7 @@ async function handleAboutMe(env) {
81
83
  if (profileObj) {
82
84
  profile = await profileObj.json();
83
85
  }
84
- console.log("handleAboutMe: profile loaded:", profile.name);
86
+ log.info("profile loaded", { name: profile.name });
85
87
  const responseData = {
86
88
  profile,
87
89
  contentNodes: [],
@@ -91,7 +93,7 @@ async function handleAboutMe(env) {
91
93
  headers: { "Content-Type": "application/json" }
92
94
  });
93
95
  } catch (error) {
94
- console.error("Error serving aboutme content:", error);
96
+ log.error("Error serving aboutme content", { error: String(error) });
95
97
  return new Response(JSON.stringify({ error: "Content not available", message: String(error) }), {
96
98
  status: 500,
97
99
  headers: { "Content-Type": "application/json" }
@@ -133,6 +135,7 @@ function clearContentCache$1() {
133
135
  loader?.clearCache();
134
136
  }
135
137
  async function handleHome(env) {
138
+ const log = getDefaultLogger("personal-site-kit:home");
136
139
  try {
137
140
  if (!env?.CONTENT_BUCKET) {
138
141
  return new Response(JSON.stringify({ error: "Content bucket not configured" }), {
@@ -161,7 +164,7 @@ async function handleHome(env) {
161
164
  headers: { "Content-Type": "application/json" }
162
165
  });
163
166
  } catch (error) {
164
- console.error("Error serving home content:", error);
167
+ log.error("Error serving home content", { error: String(error) });
165
168
  return new Response(JSON.stringify({ error: "Content not available" }), {
166
169
  status: 500,
167
170
  headers: { "Content-Type": "application/json" }
@@ -548,36 +551,37 @@ async function handleAuth(request, env, subpath) {
548
551
  }
549
552
  }
550
553
  async function handleSetup(request, env, clientIP, origin) {
551
- console.log("handleSetup: starting setup, env.KV exists:", !!env.KV);
554
+ const log = getDefaultLogger("personal-site-kit:auth");
555
+ log.info(" starting setup, env.KV exists:", !!env.KV);
552
556
  if (request.method !== "POST") {
553
557
  return createErrorResponse("Method not allowed", 405);
554
558
  }
555
559
  try {
556
560
  const existing = await getAuthStore(env);
557
- console.log("handleSetup: existing store check:", !!existing);
561
+ log.info(" existing store check:", !!existing);
558
562
  if (existing) {
559
563
  return createErrorResponse("Admin already configured. Use /auth/login to login.", 400);
560
564
  }
561
565
  const body = await request.json();
562
566
  const { username, password } = body;
563
- console.log("handleSetup: body parsed, username:", username);
567
+ log.info(" body parsed, username:", username);
564
568
  if (!username || !password) {
565
569
  return createErrorResponse("Username and password required", 400);
566
570
  }
567
571
  if (username.length < 3 || password.length < 8) {
568
572
  return createErrorResponse("Username must be 3+ chars, password must be 8+ chars", 400);
569
573
  }
570
- console.log("handleSetup: calling setupAuth");
574
+ log.info(" calling setupAuth");
571
575
  await setupAuth(env, username, password);
572
- console.log("handleSetup: setupAuth successful");
576
+ log.info(" setupAuth successful");
573
577
  await clearRateLimit(env, clientIP);
574
578
  const token = crypto.randomUUID();
575
- console.log("handleSetup: session token generated");
579
+ log.info(" session token generated");
576
580
  await env.KV.put(`session:${token}`, JSON.stringify({
577
581
  createdAt: Date.now(),
578
582
  expiresAt: Date.now() + 7 * 24 * 60 * 60 * 1e3
579
583
  }), { expirationTtl: 7 * 24 * 60 * 60 });
580
- console.log("handleSetup: session stored in KV");
584
+ log.info(" session stored in KV");
581
585
  const headers = {
582
586
  "Content-Type": "application/json",
583
587
  "Set-Cookie": createSessionCookie(token, origin),
@@ -591,7 +595,7 @@ async function handleSetup(request, env, clientIP, origin) {
591
595
  headers
592
596
  });
593
597
  } catch (e) {
594
- console.error("handleSetup: error occurred:", e);
598
+ log.error(" error occurred:", e);
595
599
  return createErrorResponse("Internal server error: " + e.message, 500);
596
600
  }
597
601
  }
@@ -678,7 +682,7 @@ async function handleBlogs(env, slug, latest) {
678
682
  });
679
683
  return createJSONResponse(result);
680
684
  } catch (error) {
681
- console.error("Error serving blogs:", error);
685
+ getDefaultLogger("personal-site-kit:content").error("Error serving blogs", { error: String(error) });
682
686
  return createErrorResponse("Blog not found", 404);
683
687
  }
684
688
  }
@@ -695,7 +699,7 @@ async function handleStories(env, slug, latest) {
695
699
  });
696
700
  return createJSONResponse(result);
697
701
  } catch (error) {
698
- console.error("Error serving stories:", error);
702
+ getDefaultLogger("personal-site-kit:content").error("Error serving stories", { error: String(error) });
699
703
  return createErrorResponse("Story not found", 404);
700
704
  }
701
705
  }
@@ -711,7 +715,7 @@ async function handleSearch(env, query) {
711
715
  });
712
716
  return createJSONResponse(searchResults);
713
717
  } catch (error) {
714
- console.error("Error serving search:", error);
718
+ getDefaultLogger("personal-site-kit:content").error("Error serving search", { error: String(error) });
715
719
  return createErrorResponse("Search failed", 500);
716
720
  }
717
721
  }
@@ -737,6 +741,7 @@ const PLACEHOLDER_LOGO = `<svg width="600" height="320" viewBox="0 0 600 320" xm
737
741
  <text x="300" y="290" class="text-main">YOUR LOGO</text>
738
742
  </svg>`;
739
743
  async function handleLogo(env) {
744
+ const log = getDefaultLogger("personal-site-kit:logo");
740
745
  try {
741
746
  if (env?.CONTENT_BUCKET) {
742
747
  const logo = await env.CONTENT_BUCKET.get("logo.svg");
@@ -757,7 +762,7 @@ async function handleLogo(env) {
757
762
  }
758
763
  });
759
764
  } catch (error) {
760
- console.error("Error serving logo:", error);
765
+ log.error("Error serving logo", { error: String(error) });
761
766
  return new Response(PLACEHOLDER_LOGO, {
762
767
  headers: {
763
768
  "Content-Type": "image/svg+xml",
@@ -774,6 +779,7 @@ const DEFAULT_STATIC_DETAILS = {
774
779
  email: "yourname@domain.com"
775
780
  };
776
781
  async function handleStaticDetails(env, method, _body) {
782
+ const log = getDefaultLogger("personal-site-kit:static");
777
783
  try {
778
784
  if (!env?.CONTENT_BUCKET) {
779
785
  return new Response(JSON.stringify(DEFAULT_STATIC_DETAILS), {
@@ -803,7 +809,7 @@ async function handleStaticDetails(env, method, _body) {
803
809
  headers: { "Content-Type": "application/json" }
804
810
  });
805
811
  } catch (error) {
806
- console.error("Error serving static details:", error);
812
+ log.error("Error serving static details", { error: String(error) });
807
813
  return new Response(JSON.stringify(DEFAULT_STATIC_DETAILS), {
808
814
  headers: { "Content-Type": "application/json" }
809
815
  });
@@ -855,6 +861,7 @@ class WebsiteAPI {
855
861
  });
856
862
  }
857
863
  async fetch(request, env) {
864
+ configureR2Logging(env);
858
865
  const url = new URL(request.url);
859
866
  const origin = request.headers.get("Origin") || url.origin;
860
867
  if (request.method === "OPTIONS") {
@@ -934,7 +941,7 @@ class WebsiteAPI {
934
941
  return this.addAdminCORSHeaders(createErrorResponse("Route not found", 404), origin);
935
942
  }
936
943
  } catch (error) {
937
- console.error("API Error:", error);
944
+ getDefaultLogger("personal-site-kit:api").error("API Error", { error: String(error) });
938
945
  return this.addCORSHeaders(createErrorResponse("Internal server error", 500));
939
946
  }
940
947
  }
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { A, B, M, R, W, c, a, g, b, d, h, e, r, s, v } from "./chunks/website-api-CFRUPu0X.js";
2
- import { WebsitePrerender } from "./prerender.js";
1
+ import { A, B, M, R, W, c, a, g, b, d, h, e, r, s, v } from "./chunks/website-api-D4iagul_.js";
2
+ import { WebsitePrerender, initLogging } from "./prerender.js";
3
3
  import { A as A2, a as a2, b as b2, c as c2, d as d2, e as e2, f, g as g2, h as h2, i, B as B2, F, M as M2, j, S, k } from "./chunks/index-oSPOElVQ.js";
4
4
  import { S as S2, g as g3, i as i2, r as r2 } from "./chunks/site-store-CGV9c2DI.js";
5
5
  import { R as R2, T, W as W2, b as b3, c as c3, g as g4, r as r3 } from "./chunks/template-BW1oVN93.js";
@@ -41,6 +41,7 @@ export {
41
41
  g3 as getConfig,
42
42
  h as handleAuth,
43
43
  e as hashPassword,
44
+ initLogging,
44
45
  i2 as initializeConfig,
45
46
  r as recordFailedAttempt,
46
47
  r2 as refreshConfig,
@@ -2,5 +2,6 @@ import { WebsitePrerender } from './website-prerender';
2
2
  export { WebsitePrerender };
3
3
  export type { PrerenderOptions } from './website-prerender';
4
4
  declare const defaultPrerender: WebsitePrerender;
5
+ export declare function initLogging(env?: any): void;
5
6
  export default defaultPrerender;
6
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/prerender/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAC5B,YAAY,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAG5D,QAAA,MAAM,gBAAgB,kBAAyB,CAAC;AAChD,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/prerender/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAC5B,YAAY,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAG5D,QAAA,MAAM,gBAAgB,kBAAyB,CAAC;AAEhD,wBAAgB,WAAW,CAAC,GAAG,CAAC,EAAE,GAAG,QAA8B;AACnE,eAAe,gBAAgB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"website-prerender.d.ts","sourceRoot":"","sources":["../../src/prerender/website-prerender.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,aAAa,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,EAAuB,MAAM,gBAAgB,CAAC;AAE1E,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,kBAAkB,CAAC,EAAE,WAAW,EAAE,CAAC;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;IACtE,UAAU,CAAC,EAAE;QAAE,KAAK,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,KAAK,OAAO,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAA;KAAE,CAAC;CAChG;AAED,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,MAAM,CAAW;IACzB,OAAO,CAAC,kBAAkB,CAAgB;IAC1C,OAAO,CAAC,WAAW,CAAgB;IACnC,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,gBAAgB,CAAqD;IAC7E,OAAO,CAAC,UAAU,CAAC,CAAoF;IACvG,OAAO,CAAC,YAAY,CAA4C;gBAEpD,OAAO,GAAE,gBAAqB;YAmB5B,cAAc;YAuCd,kBAAkB;YAgClB,gBAAgB;IAajB,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC;CAiI5E"}
1
+ {"version":3,"file":"website-prerender.d.ts","sourceRoot":"","sources":["../../src/prerender/website-prerender.ts"],"names":[],"mappings":"AACA,OAAO,EAAsB,aAAa,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,EAAuB,MAAM,gBAAgB,CAAC;AAE1E,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,kBAAkB,CAAC,EAAE,WAAW,EAAE,CAAC;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;IACtE,UAAU,CAAC,EAAE;QAAE,KAAK,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,KAAK,OAAO,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAA;KAAE,CAAC;CAChG;AAED,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,MAAM,CAAW;IACzB,OAAO,CAAC,kBAAkB,CAAgB;IAC1C,OAAO,CAAC,WAAW,CAAgB;IACnC,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,gBAAgB,CAAqD;IAC7E,OAAO,CAAC,UAAU,CAAC,CAAoF;IACvG,OAAO,CAAC,YAAY,CAA4C;gBAEpD,OAAO,GAAE,gBAAqB;YAmB5B,cAAc;YAuCd,kBAAkB;YAgClB,gBAAgB;IAajB,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC;CAkI5E"}
package/dist/prerender.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { g as getDefaultLogger$1, c as configureR2Logging } from "./chunks/telemetry-init-CbIyRWu5.js";
1
2
  import { R2ContentLoader } from "@leadertechie/r2tohtml";
2
3
  let cachedAssets = null;
3
4
  let isDiscovering = false;
@@ -34,7 +35,7 @@ async function getAssetPaths(baseSiteUrl) {
34
35
  }
35
36
  }
36
37
  } catch (e) {
37
- console.warn("Asset discovery failed:", e);
38
+ getDefaultLogger("personal-site-kit:template").warn("Asset discovery failed", { error: String(e) });
38
39
  } finally {
39
40
  isDiscovering = false;
40
41
  }
@@ -364,7 +365,7 @@ class WebsitePrerender {
364
365
  }
365
366
  }
366
367
  } catch (e) {
367
- console.warn("Asset discovery failed:", e);
368
+ getDefaultLogger$1("personal-site-kit:prerender").warn("Asset discovery failed", { error: String(e) });
368
369
  }
369
370
  return { js: "/assets/index.js", css: "/assets/index.css" };
370
371
  }
@@ -410,6 +411,7 @@ class WebsitePrerender {
410
411
  return null;
411
412
  }
412
413
  async fetch(request, env, ctx) {
414
+ configureR2Logging(env);
413
415
  const url = new URL(request.url);
414
416
  const apiUrl = env?.API_URL || `${url.origin}/api`;
415
417
  const baseSiteUrl = env?.BASE_SITE_URL || url.origin;
@@ -524,7 +526,11 @@ class WebsitePrerender {
524
526
  }
525
527
  }
526
528
  const defaultPrerender = new WebsitePrerender();
529
+ function initLogging(env) {
530
+ configureR2Logging(env);
531
+ }
527
532
  export {
528
533
  WebsitePrerender,
529
- defaultPrerender as default
534
+ defaultPrerender as default,
535
+ initLogging
530
536
  };
@@ -0,0 +1,14 @@
1
+ import { LoggerInterface, R2Bucket } from '@leadertechie/telemetry';
2
+ export declare function getDefaultLogger(serviceName: string): LoggerInterface;
3
+ /**
4
+ * Configure R2 log shipping. Call once at worker startup with the env
5
+ * containing the R2 bucket binding. Logs are written to `logs/` prefix
6
+ * with daily rotation via timestamped keys.
7
+ *
8
+ * @param env - The CF Worker env object with an optional LOGS_BUCKET binding
9
+ */
10
+ export declare function configureR2Logging(env?: {
11
+ LOGS_BUCKET?: R2Bucket;
12
+ }): void;
13
+ export type { LoggerInterface } from '@leadertechie/telemetry';
14
+ //# sourceMappingURL=telemetry-init.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"telemetry-init.d.ts","sourceRoot":"","sources":["../src/telemetry-init.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAKL,eAAe,EAChB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAcxD,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,eAAe,CAOrE;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,CAAC,EAAE;IAAE,WAAW,CAAC,EAAE,QAAQ,CAAA;CAAE,GAAG,IAAI,CAUzE;AAED,YAAY,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leadertechie/personal-site-kit",
3
- "version": "0.1.0-alpha.26",
3
+ "version": "0.1.0-alpha.28",
4
4
  "type": "module",
5
5
  "description": "A high-performance personal website engine for Cloudflare Workers and R2",
6
6
  "repository": {
@@ -45,10 +45,11 @@
45
45
  "lint:fix": "eslint \"src/**/*.ts\" --fix"
46
46
  },
47
47
  "dependencies": {
48
- "@leadertechie/md2html": "^0.1.0-alpha.20",
49
- "@leadertechie/md2interact": "^0.1.0-alpha.4",
50
- "@leadertechie/r2tohtml": "^0.1.0-alpha.17",
51
- "lit": "^3.2.1"
48
+ "@leadertechie/md2html": "^0.1.0-alpha.24",
49
+ "@leadertechie/md2interact": "^0.1.0-alpha.5",
50
+ "@leadertechie/r2tohtml": "^0.1.0-alpha.20",
51
+ "lit": "^3.2.1",
52
+ "@leadertechie/telemetry": "^0.1.0-alpha.2"
52
53
  },
53
54
  "devDependencies": {
54
55
  "@eslint/js": "^9.39.4",