@cherrypeak-org/cherryboard-web 1.0.1 → 1.0.2

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/CHANGELOG.md CHANGED
@@ -3,6 +3,15 @@
3
3
  All notable changes to `@cherrypeak-org/cherryboard-web` are documented here.
4
4
  This project adheres to [Semantic Versioning](https://semver.org/).
5
5
 
6
+ ## [1.0.2]
7
+
8
+ First release published by CI rather than from a developer's machine. No
9
+ functional change — the point is that releases now come from a verified build
10
+ of the committed source, which is what would have prevented 1.0.0 shipping a
11
+ stale local build with source maps in it.
12
+
13
+ ---
14
+
6
15
  ## [1.0.1]
7
16
 
8
17
  ### Fixed
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- 'use strict';var v="1.0.1";function d(){return typeof window<"u"&&typeof document<"u"}function p(){return new Date().toISOString()}function a(t,e){return e<=0?"":t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function E(t,e=24e3){let r=new WeakSet;try{let n=JSON.stringify(t,(s,i)=>{if(i instanceof Error)return {name:i.name,message:i.message,stack:i.stack};if(typeof i=="object"&&i!==null){if(r.has(i))return "[Circular]";r.add(i);}if(typeof i=="bigint")return i.toString();if(typeof i!="function")return i});return n===void 0||n.length>e?void 0:n}catch{return}}function k(t,e){return !t||e.length===0?false:e.some(r=>typeof r=="string"?t.includes(r):r.test(t))}function A(t){let e=t.replace(/\/+$/,"");return `${/\/api\/v\d+$/.test(e)?e:`${e}/api/v1`}/errors/batch`}var h=class{constructor(e){this.max=e;this.items=[];this.teardown=[];}add(e){this.items.push({timestamp:e.timestamp??p(),category:e.category,message:a(e.message,500),level:e.level,data:e.data}),this.items.length>this.max&&this.items.shift();}snapshot(){return this.items.slice()}install(){d()&&(this.installHistory(),this.installClicks(),this.installFetch());}installHistory(){try{let e=window.history,r=s=>{let i=e[s];if(typeof i!="function")return ()=>{};let o=(...l)=>{try{let u=l[2];typeof u=="string"&&this.add({category:"navigation",message:`${s} \u2192 ${u}`});}catch{}return i.apply(window.history,l)};return e[s]=o,()=>{e[s]===o&&(e[s]=i);}};this.teardown.push(r("pushState"),r("replaceState"));let n=()=>this.add({category:"navigation",message:`popstate \u2192 ${location.pathname}`});window.addEventListener("popstate",n),this.teardown.push(()=>window.removeEventListener("popstate",n));}catch{}}installClicks(){try{let e=r=>{let n=r.target;if(!n||typeof n.tagName!="string")return;let s=n.id?`#${n.id}`:"",i=typeof n.className=="string"?n.className:"",o=i?`.${i.split(/\s+/).filter(Boolean).slice(0,2).join(".")}`:"";this.add({category:"click",message:`${n.tagName.toLowerCase()}${s}${o}`});};window.addEventListener("click",e,{capture:!0,passive:!0}),this.teardown.push(()=>window.removeEventListener("click",e,{capture:!0}));}catch{}}installFetch(){try{let e=window.fetch;if(typeof e!="function")return;let r=(...n)=>{let[s,i]=n,o=i?.method??(typeof s=="object"&&s&&"method"in s?s.method:"GET"),l=typeof s=="string"?s:s instanceof URL?s.href:s.url;return e.apply(window,n).then(u=>(this.add({category:"fetch",message:`${o} ${l} \u2192 ${u.status}`,level:u.ok?void 0:"Warning"}),u),u=>{throw this.add({category:"fetch",message:`${o} ${l} \u2192 failed`,level:"Warning"}),u})};window.fetch=r,this.teardown.push(()=>{window.fetch===r&&(window.fetch=e);});}catch{}}close(){for(let e of this.teardown.splice(0))try{e();}catch{}}};var m=class{constructor(e=4e3,r=100){this.windowMs=e;this.max=r;this.seen=new Map;}shouldSend(e){let r=Date.now(),n=this.seen.get(e);if(n!==void 0&&r-n<this.windowMs)return false;if(this.seen.set(e,r),this.seen.size>this.max){let s=this.seen.keys().next().value;s!==void 0&&this.seen.delete(s);}return true}};function I(t,e){let r=(e??"").split(`
1
+ 'use strict';var v="1.0.2";function d(){return typeof window<"u"&&typeof document<"u"}function p(){return new Date().toISOString()}function a(t,e){return e<=0?"":t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function E(t,e=24e3){let r=new WeakSet;try{let n=JSON.stringify(t,(s,i)=>{if(i instanceof Error)return {name:i.name,message:i.message,stack:i.stack};if(typeof i=="object"&&i!==null){if(r.has(i))return "[Circular]";r.add(i);}if(typeof i=="bigint")return i.toString();if(typeof i!="function")return i});return n===void 0||n.length>e?void 0:n}catch{return}}function k(t,e){return !t||e.length===0?false:e.some(r=>typeof r=="string"?t.includes(r):r.test(t))}function A(t){let e=t.replace(/\/+$/,"");return `${/\/api\/v\d+$/.test(e)?e:`${e}/api/v1`}/errors/batch`}var h=class{constructor(e){this.max=e;this.items=[];this.teardown=[];}add(e){this.items.push({timestamp:e.timestamp??p(),category:e.category,message:a(e.message,500),level:e.level,data:e.data}),this.items.length>this.max&&this.items.shift();}snapshot(){return this.items.slice()}install(){d()&&(this.installHistory(),this.installClicks(),this.installFetch());}installHistory(){try{let e=window.history,r=s=>{let i=e[s];if(typeof i!="function")return ()=>{};let o=(...l)=>{try{let u=l[2];typeof u=="string"&&this.add({category:"navigation",message:`${s} \u2192 ${u}`});}catch{}return i.apply(window.history,l)};return e[s]=o,()=>{e[s]===o&&(e[s]=i);}};this.teardown.push(r("pushState"),r("replaceState"));let n=()=>this.add({category:"navigation",message:`popstate \u2192 ${location.pathname}`});window.addEventListener("popstate",n),this.teardown.push(()=>window.removeEventListener("popstate",n));}catch{}}installClicks(){try{let e=r=>{let n=r.target;if(!n||typeof n.tagName!="string")return;let s=n.id?`#${n.id}`:"",i=typeof n.className=="string"?n.className:"",o=i?`.${i.split(/\s+/).filter(Boolean).slice(0,2).join(".")}`:"";this.add({category:"click",message:`${n.tagName.toLowerCase()}${s}${o}`});};window.addEventListener("click",e,{capture:!0,passive:!0}),this.teardown.push(()=>window.removeEventListener("click",e,{capture:!0}));}catch{}}installFetch(){try{let e=window.fetch;if(typeof e!="function")return;let r=(...n)=>{let[s,i]=n,o=i?.method??(typeof s=="object"&&s&&"method"in s?s.method:"GET"),l=typeof s=="string"?s:s instanceof URL?s.href:s.url;return e.apply(window,n).then(u=>(this.add({category:"fetch",message:`${o} ${l} \u2192 ${u.status}`,level:u.ok?void 0:"Warning"}),u),u=>{throw this.add({category:"fetch",message:`${o} ${l} \u2192 failed`,level:"Warning"}),u})};window.fetch=r,this.teardown.push(()=>{window.fetch===r&&(window.fetch=e);});}catch{}}close(){for(let e of this.teardown.splice(0))try{e();}catch{}}};var m=class{constructor(e=4e3,r=100){this.windowMs=e;this.max=r;this.seen=new Map;}shouldSend(e){let r=Date.now(),n=this.seen.get(e);if(n!==void 0&&r-n<this.windowMs)return false;if(this.seen.set(e,r),this.seen.size>this.max){let s=this.seen.keys().next().value;s!==void 0&&this.seen.delete(s);}return true}};function I(t,e){let r=(e??"").split(`
2
2
  `).slice(0,4).map(n=>n.replace(/:\d+:\d+/g,"").replace(/\?[^\s)]*/g,"").replace(/https?:\/\/[^/]+/g,"").trim()).join("|");return `${t}::${r}`.slice(0,500)}function M(t){if(!d())return ()=>{};let e=t.config,r=[];if(e.captureUnhandledErrors||e.captureResourceErrors){let n=s=>{try{let i=s.target;if(i instanceof HTMLElement){if(!e.captureResourceErrors)return;let l=i,u=l.src||l.href;if(!u)return;t.captureMessage(`Resource failed to load: ${u}`,"Warning",{context:{resource:i.tagName.toLowerCase(),url:u}});return}if(!e.captureUnhandledErrors)return;let o=s;if(!o.error&&(!o.message||o.message==="Script error."))return;t.captureException(o.error??o.message);}catch{}};window.addEventListener("error",n,true),r.push(()=>window.removeEventListener("error",n,true));}if(e.captureUnhandledRejections){let n=s=>{try{t.captureException(s.reason??"Unhandled promise rejection",{context:{unhandledRejection:!0}});}catch{}};window.addEventListener("unhandledrejection",n),r.push(()=>window.removeEventListener("unhandledrejection",n));}if(e.captureConsole){let n=console;for(let s of ["error","warn"]){let i=n[s];if(typeof i!="function")continue;let o=(...l)=>{try{t.addBreadcrumb({category:"console",level:s==="error"?"Error":"Warning",message:l.map(D).join(" ").slice(0,500)});}catch{}return i.apply(console,l)};n[s]=o,r.push(()=>{n[s]===o&&(n[s]=i);});}}return ()=>{for(let n of r.splice(0))try{n();}catch{}}}function D(t){if(typeof t=="string")return t;if(t instanceof Error)return `${t.name}: ${t.message}`;try{return JSON.stringify(t)??String(t)}catch{return String(t)}}var g=2e3,S=8e3,C=4e3;function _(t){if(t instanceof Error)return {message:a(t.message||t.name||"Error",g),exceptionType:t.name||"Error",stackTrace:t.stack?a(t.stack,S):void 0,innerException:R(t.cause)};if(typeof t=="string")return {message:a(t,g),exceptionType:"Error"};if(t&&typeof t=="object"){let e=t,r=typeof e.message=="string"?e.message:N(e)??Object.prototype.toString.call(t),n=typeof e.name=="string"?e.name:"Error",s=typeof e.stack=="string"?e.stack:void 0;return {message:a(r,g),exceptionType:n,stackTrace:s?a(s,S):void 0,innerException:R(e.cause)}}return {message:a(String(t),g),exceptionType:"Error"}}function j(t){if(t.stackTrace)return t;try{let e=new Error(t.message).stack;if(e){let r=e.split(`
3
3
  `).slice(2).join(`
4
4
  `);return {...t,stackTrace:a(r||e,S)}}}catch{}return t}function R(t){if(t==null)return;if(t instanceof Error){let r=[`${t.name}: ${t.message}`];t.stack&&r.push(t.stack);let n=R(t.cause);return n&&r.push(`Caused by: ${n}`),a(r.join(`
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  /** SDK version — kept in sync with package.json. */
2
- declare const SDK_VERSION = "1.0.1";
2
+ declare const SDK_VERSION = "1.0.2";
3
3
  /** Severity levels — these strings match the backend `ErrorSeverity` enum exactly. */
4
4
  type Severity = 'Debug' | 'Info' | 'Warning' | 'Error' | 'Critical';
5
5
  /** A trail entry giving context that led up to an error. */
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /** SDK version — kept in sync with package.json. */
2
- declare const SDK_VERSION = "1.0.1";
2
+ declare const SDK_VERSION = "1.0.2";
3
3
  /** Severity levels — these strings match the backend `ErrorSeverity` enum exactly. */
4
4
  type Severity = 'Debug' | 'Info' | 'Warning' | 'Error' | 'Critical';
5
5
  /** A trail entry giving context that led up to an error. */
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- var v="1.0.1";function d(){return typeof window<"u"&&typeof document<"u"}function p(){return new Date().toISOString()}function a(t,e){return e<=0?"":t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function E(t,e=24e3){let r=new WeakSet;try{let n=JSON.stringify(t,(s,i)=>{if(i instanceof Error)return {name:i.name,message:i.message,stack:i.stack};if(typeof i=="object"&&i!==null){if(r.has(i))return "[Circular]";r.add(i);}if(typeof i=="bigint")return i.toString();if(typeof i!="function")return i});return n===void 0||n.length>e?void 0:n}catch{return}}function k(t,e){return !t||e.length===0?false:e.some(r=>typeof r=="string"?t.includes(r):r.test(t))}function A(t){let e=t.replace(/\/+$/,"");return `${/\/api\/v\d+$/.test(e)?e:`${e}/api/v1`}/errors/batch`}var h=class{constructor(e){this.max=e;this.items=[];this.teardown=[];}add(e){this.items.push({timestamp:e.timestamp??p(),category:e.category,message:a(e.message,500),level:e.level,data:e.data}),this.items.length>this.max&&this.items.shift();}snapshot(){return this.items.slice()}install(){d()&&(this.installHistory(),this.installClicks(),this.installFetch());}installHistory(){try{let e=window.history,r=s=>{let i=e[s];if(typeof i!="function")return ()=>{};let o=(...l)=>{try{let u=l[2];typeof u=="string"&&this.add({category:"navigation",message:`${s} \u2192 ${u}`});}catch{}return i.apply(window.history,l)};return e[s]=o,()=>{e[s]===o&&(e[s]=i);}};this.teardown.push(r("pushState"),r("replaceState"));let n=()=>this.add({category:"navigation",message:`popstate \u2192 ${location.pathname}`});window.addEventListener("popstate",n),this.teardown.push(()=>window.removeEventListener("popstate",n));}catch{}}installClicks(){try{let e=r=>{let n=r.target;if(!n||typeof n.tagName!="string")return;let s=n.id?`#${n.id}`:"",i=typeof n.className=="string"?n.className:"",o=i?`.${i.split(/\s+/).filter(Boolean).slice(0,2).join(".")}`:"";this.add({category:"click",message:`${n.tagName.toLowerCase()}${s}${o}`});};window.addEventListener("click",e,{capture:!0,passive:!0}),this.teardown.push(()=>window.removeEventListener("click",e,{capture:!0}));}catch{}}installFetch(){try{let e=window.fetch;if(typeof e!="function")return;let r=(...n)=>{let[s,i]=n,o=i?.method??(typeof s=="object"&&s&&"method"in s?s.method:"GET"),l=typeof s=="string"?s:s instanceof URL?s.href:s.url;return e.apply(window,n).then(u=>(this.add({category:"fetch",message:`${o} ${l} \u2192 ${u.status}`,level:u.ok?void 0:"Warning"}),u),u=>{throw this.add({category:"fetch",message:`${o} ${l} \u2192 failed`,level:"Warning"}),u})};window.fetch=r,this.teardown.push(()=>{window.fetch===r&&(window.fetch=e);});}catch{}}close(){for(let e of this.teardown.splice(0))try{e();}catch{}}};var m=class{constructor(e=4e3,r=100){this.windowMs=e;this.max=r;this.seen=new Map;}shouldSend(e){let r=Date.now(),n=this.seen.get(e);if(n!==void 0&&r-n<this.windowMs)return false;if(this.seen.set(e,r),this.seen.size>this.max){let s=this.seen.keys().next().value;s!==void 0&&this.seen.delete(s);}return true}};function I(t,e){let r=(e??"").split(`
1
+ var v="1.0.2";function d(){return typeof window<"u"&&typeof document<"u"}function p(){return new Date().toISOString()}function a(t,e){return e<=0?"":t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function E(t,e=24e3){let r=new WeakSet;try{let n=JSON.stringify(t,(s,i)=>{if(i instanceof Error)return {name:i.name,message:i.message,stack:i.stack};if(typeof i=="object"&&i!==null){if(r.has(i))return "[Circular]";r.add(i);}if(typeof i=="bigint")return i.toString();if(typeof i!="function")return i});return n===void 0||n.length>e?void 0:n}catch{return}}function k(t,e){return !t||e.length===0?false:e.some(r=>typeof r=="string"?t.includes(r):r.test(t))}function A(t){let e=t.replace(/\/+$/,"");return `${/\/api\/v\d+$/.test(e)?e:`${e}/api/v1`}/errors/batch`}var h=class{constructor(e){this.max=e;this.items=[];this.teardown=[];}add(e){this.items.push({timestamp:e.timestamp??p(),category:e.category,message:a(e.message,500),level:e.level,data:e.data}),this.items.length>this.max&&this.items.shift();}snapshot(){return this.items.slice()}install(){d()&&(this.installHistory(),this.installClicks(),this.installFetch());}installHistory(){try{let e=window.history,r=s=>{let i=e[s];if(typeof i!="function")return ()=>{};let o=(...l)=>{try{let u=l[2];typeof u=="string"&&this.add({category:"navigation",message:`${s} \u2192 ${u}`});}catch{}return i.apply(window.history,l)};return e[s]=o,()=>{e[s]===o&&(e[s]=i);}};this.teardown.push(r("pushState"),r("replaceState"));let n=()=>this.add({category:"navigation",message:`popstate \u2192 ${location.pathname}`});window.addEventListener("popstate",n),this.teardown.push(()=>window.removeEventListener("popstate",n));}catch{}}installClicks(){try{let e=r=>{let n=r.target;if(!n||typeof n.tagName!="string")return;let s=n.id?`#${n.id}`:"",i=typeof n.className=="string"?n.className:"",o=i?`.${i.split(/\s+/).filter(Boolean).slice(0,2).join(".")}`:"";this.add({category:"click",message:`${n.tagName.toLowerCase()}${s}${o}`});};window.addEventListener("click",e,{capture:!0,passive:!0}),this.teardown.push(()=>window.removeEventListener("click",e,{capture:!0}));}catch{}}installFetch(){try{let e=window.fetch;if(typeof e!="function")return;let r=(...n)=>{let[s,i]=n,o=i?.method??(typeof s=="object"&&s&&"method"in s?s.method:"GET"),l=typeof s=="string"?s:s instanceof URL?s.href:s.url;return e.apply(window,n).then(u=>(this.add({category:"fetch",message:`${o} ${l} \u2192 ${u.status}`,level:u.ok?void 0:"Warning"}),u),u=>{throw this.add({category:"fetch",message:`${o} ${l} \u2192 failed`,level:"Warning"}),u})};window.fetch=r,this.teardown.push(()=>{window.fetch===r&&(window.fetch=e);});}catch{}}close(){for(let e of this.teardown.splice(0))try{e();}catch{}}};var m=class{constructor(e=4e3,r=100){this.windowMs=e;this.max=r;this.seen=new Map;}shouldSend(e){let r=Date.now(),n=this.seen.get(e);if(n!==void 0&&r-n<this.windowMs)return false;if(this.seen.set(e,r),this.seen.size>this.max){let s=this.seen.keys().next().value;s!==void 0&&this.seen.delete(s);}return true}};function I(t,e){let r=(e??"").split(`
2
2
  `).slice(0,4).map(n=>n.replace(/:\d+:\d+/g,"").replace(/\?[^\s)]*/g,"").replace(/https?:\/\/[^/]+/g,"").trim()).join("|");return `${t}::${r}`.slice(0,500)}function M(t){if(!d())return ()=>{};let e=t.config,r=[];if(e.captureUnhandledErrors||e.captureResourceErrors){let n=s=>{try{let i=s.target;if(i instanceof HTMLElement){if(!e.captureResourceErrors)return;let l=i,u=l.src||l.href;if(!u)return;t.captureMessage(`Resource failed to load: ${u}`,"Warning",{context:{resource:i.tagName.toLowerCase(),url:u}});return}if(!e.captureUnhandledErrors)return;let o=s;if(!o.error&&(!o.message||o.message==="Script error."))return;t.captureException(o.error??o.message);}catch{}};window.addEventListener("error",n,true),r.push(()=>window.removeEventListener("error",n,true));}if(e.captureUnhandledRejections){let n=s=>{try{t.captureException(s.reason??"Unhandled promise rejection",{context:{unhandledRejection:!0}});}catch{}};window.addEventListener("unhandledrejection",n),r.push(()=>window.removeEventListener("unhandledrejection",n));}if(e.captureConsole){let n=console;for(let s of ["error","warn"]){let i=n[s];if(typeof i!="function")continue;let o=(...l)=>{try{t.addBreadcrumb({category:"console",level:s==="error"?"Error":"Warning",message:l.map(D).join(" ").slice(0,500)});}catch{}return i.apply(console,l)};n[s]=o,r.push(()=>{n[s]===o&&(n[s]=i);});}}return ()=>{for(let n of r.splice(0))try{n();}catch{}}}function D(t){if(typeof t=="string")return t;if(t instanceof Error)return `${t.name}: ${t.message}`;try{return JSON.stringify(t)??String(t)}catch{return String(t)}}var g=2e3,S=8e3,C=4e3;function _(t){if(t instanceof Error)return {message:a(t.message||t.name||"Error",g),exceptionType:t.name||"Error",stackTrace:t.stack?a(t.stack,S):void 0,innerException:R(t.cause)};if(typeof t=="string")return {message:a(t,g),exceptionType:"Error"};if(t&&typeof t=="object"){let e=t,r=typeof e.message=="string"?e.message:N(e)??Object.prototype.toString.call(t),n=typeof e.name=="string"?e.name:"Error",s=typeof e.stack=="string"?e.stack:void 0;return {message:a(r,g),exceptionType:n,stackTrace:s?a(s,S):void 0,innerException:R(e.cause)}}return {message:a(String(t),g),exceptionType:"Error"}}function j(t){if(t.stackTrace)return t;try{let e=new Error(t.message).stack;if(e){let r=e.split(`
3
3
  `).slice(2).join(`
4
4
  `);return {...t,stackTrace:a(r||e,S)}}}catch{}return t}function R(t){if(t==null)return;if(t instanceof Error){let r=[`${t.name}: ${t.message}`];t.stack&&r.push(t.stack);let n=R(t.cause);return n&&r.push(`Caused by: ${n}`),a(r.join(`
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- 'use strict';var react=require('react'),jsxRuntime=require('react/jsx-runtime');var h="1.0.1";function d(){return typeof window<"u"&&typeof document<"u"}function m(){return new Date().toISOString()}function a(r,e){return e<=0?"":r.length<=e?r:`${r.slice(0,e-1)}\u2026`}function C(r,e=24e3){let t=new WeakSet;try{let n=JSON.stringify(r,(o,s)=>{if(s instanceof Error)return {name:s.name,message:s.message,stack:s.stack};if(typeof s=="object"&&s!==null){if(t.has(s))return "[Circular]";t.add(s);}if(typeof s=="bigint")return s.toString();if(typeof s!="function")return s});return n===void 0||n.length>e?void 0:n}catch{return}}function B(r,e){return !r||e.length===0?false:e.some(t=>typeof t=="string"?r.includes(t):t.test(r))}function _(r){let e=r.replace(/\/+$/,"");return `${/\/api\/v\d+$/.test(e)?e:`${e}/api/v1`}/errors/batch`}var g=class{constructor(e){this.max=e;this.items=[];this.teardown=[];}add(e){this.items.push({timestamp:e.timestamp??m(),category:e.category,message:a(e.message,500),level:e.level,data:e.data}),this.items.length>this.max&&this.items.shift();}snapshot(){return this.items.slice()}install(){d()&&(this.installHistory(),this.installClicks(),this.installFetch());}installHistory(){try{let e=window.history,t=o=>{let s=e[o];if(typeof s!="function")return ()=>{};let i=(...l)=>{try{let u=l[2];typeof u=="string"&&this.add({category:"navigation",message:`${o} \u2192 ${u}`});}catch{}return s.apply(window.history,l)};return e[o]=i,()=>{e[o]===i&&(e[o]=s);}};this.teardown.push(t("pushState"),t("replaceState"));let n=()=>this.add({category:"navigation",message:`popstate \u2192 ${location.pathname}`});window.addEventListener("popstate",n),this.teardown.push(()=>window.removeEventListener("popstate",n));}catch{}}installClicks(){try{let e=t=>{let n=t.target;if(!n||typeof n.tagName!="string")return;let o=n.id?`#${n.id}`:"",s=typeof n.className=="string"?n.className:"",i=s?`.${s.split(/\s+/).filter(Boolean).slice(0,2).join(".")}`:"";this.add({category:"click",message:`${n.tagName.toLowerCase()}${o}${i}`});};window.addEventListener("click",e,{capture:!0,passive:!0}),this.teardown.push(()=>window.removeEventListener("click",e,{capture:!0}));}catch{}}installFetch(){try{let e=window.fetch;if(typeof e!="function")return;let t=(...n)=>{let[o,s]=n,i=s?.method??(typeof o=="object"&&o&&"method"in o?o.method:"GET"),l=typeof o=="string"?o:o instanceof URL?o.href:o.url;return e.apply(window,n).then(u=>(this.add({category:"fetch",message:`${i} ${l} \u2192 ${u.status}`,level:u.ok?void 0:"Warning"}),u),u=>{throw this.add({category:"fetch",message:`${i} ${l} \u2192 failed`,level:"Warning"}),u})};window.fetch=t,this.teardown.push(()=>{window.fetch===t&&(window.fetch=e);});}catch{}}close(){for(let e of this.teardown.splice(0))try{e();}catch{}}};var y=class{constructor(e=4e3,t=100){this.windowMs=e;this.max=t;this.seen=new Map;}shouldSend(e){let t=Date.now(),n=this.seen.get(e);if(n!==void 0&&t-n<this.windowMs)return false;if(this.seen.set(e,t),this.seen.size>this.max){let o=this.seen.keys().next().value;o!==void 0&&this.seen.delete(o);}return true}};function D(r,e){let t=(e??"").split(`
2
+ 'use strict';var react=require('react'),jsxRuntime=require('react/jsx-runtime');var h="1.0.2";function d(){return typeof window<"u"&&typeof document<"u"}function m(){return new Date().toISOString()}function a(r,e){return e<=0?"":r.length<=e?r:`${r.slice(0,e-1)}\u2026`}function C(r,e=24e3){let t=new WeakSet;try{let n=JSON.stringify(r,(o,s)=>{if(s instanceof Error)return {name:s.name,message:s.message,stack:s.stack};if(typeof s=="object"&&s!==null){if(t.has(s))return "[Circular]";t.add(s);}if(typeof s=="bigint")return s.toString();if(typeof s!="function")return s});return n===void 0||n.length>e?void 0:n}catch{return}}function B(r,e){return !r||e.length===0?false:e.some(t=>typeof t=="string"?r.includes(t):t.test(r))}function _(r){let e=r.replace(/\/+$/,"");return `${/\/api\/v\d+$/.test(e)?e:`${e}/api/v1`}/errors/batch`}var g=class{constructor(e){this.max=e;this.items=[];this.teardown=[];}add(e){this.items.push({timestamp:e.timestamp??m(),category:e.category,message:a(e.message,500),level:e.level,data:e.data}),this.items.length>this.max&&this.items.shift();}snapshot(){return this.items.slice()}install(){d()&&(this.installHistory(),this.installClicks(),this.installFetch());}installHistory(){try{let e=window.history,t=o=>{let s=e[o];if(typeof s!="function")return ()=>{};let i=(...l)=>{try{let u=l[2];typeof u=="string"&&this.add({category:"navigation",message:`${o} \u2192 ${u}`});}catch{}return s.apply(window.history,l)};return e[o]=i,()=>{e[o]===i&&(e[o]=s);}};this.teardown.push(t("pushState"),t("replaceState"));let n=()=>this.add({category:"navigation",message:`popstate \u2192 ${location.pathname}`});window.addEventListener("popstate",n),this.teardown.push(()=>window.removeEventListener("popstate",n));}catch{}}installClicks(){try{let e=t=>{let n=t.target;if(!n||typeof n.tagName!="string")return;let o=n.id?`#${n.id}`:"",s=typeof n.className=="string"?n.className:"",i=s?`.${s.split(/\s+/).filter(Boolean).slice(0,2).join(".")}`:"";this.add({category:"click",message:`${n.tagName.toLowerCase()}${o}${i}`});};window.addEventListener("click",e,{capture:!0,passive:!0}),this.teardown.push(()=>window.removeEventListener("click",e,{capture:!0}));}catch{}}installFetch(){try{let e=window.fetch;if(typeof e!="function")return;let t=(...n)=>{let[o,s]=n,i=s?.method??(typeof o=="object"&&o&&"method"in o?o.method:"GET"),l=typeof o=="string"?o:o instanceof URL?o.href:o.url;return e.apply(window,n).then(u=>(this.add({category:"fetch",message:`${i} ${l} \u2192 ${u.status}`,level:u.ok?void 0:"Warning"}),u),u=>{throw this.add({category:"fetch",message:`${i} ${l} \u2192 failed`,level:"Warning"}),u})};window.fetch=t,this.teardown.push(()=>{window.fetch===t&&(window.fetch=e);});}catch{}}close(){for(let e of this.teardown.splice(0))try{e();}catch{}}};var y=class{constructor(e=4e3,t=100){this.windowMs=e;this.max=t;this.seen=new Map;}shouldSend(e){let t=Date.now(),n=this.seen.get(e);if(n!==void 0&&t-n<this.windowMs)return false;if(this.seen.set(e,t),this.seen.size>this.max){let o=this.seen.keys().next().value;o!==void 0&&this.seen.delete(o);}return true}};function D(r,e){let t=(e??"").split(`
3
3
  `).slice(0,4).map(n=>n.replace(/:\d+:\d+/g,"").replace(/\?[^\s)]*/g,"").replace(/https?:\/\/[^/]+/g,"").trim()).join("|");return `${r}::${t}`.slice(0,500)}function j(r){if(!d())return ()=>{};let e=r.config,t=[];if(e.captureUnhandledErrors||e.captureResourceErrors){let n=o=>{try{let s=o.target;if(s instanceof HTMLElement){if(!e.captureResourceErrors)return;let l=s,u=l.src||l.href;if(!u)return;r.captureMessage(`Resource failed to load: ${u}`,"Warning",{context:{resource:s.tagName.toLowerCase(),url:u}});return}if(!e.captureUnhandledErrors)return;let i=o;if(!i.error&&(!i.message||i.message==="Script error."))return;r.captureException(i.error??i.message);}catch{}};window.addEventListener("error",n,true),t.push(()=>window.removeEventListener("error",n,true));}if(e.captureUnhandledRejections){let n=o=>{try{r.captureException(o.reason??"Unhandled promise rejection",{context:{unhandledRejection:!0}});}catch{}};window.addEventListener("unhandledrejection",n),t.push(()=>window.removeEventListener("unhandledrejection",n));}if(e.captureConsole){let n=console;for(let o of ["error","warn"]){let s=n[o];if(typeof s!="function")continue;let i=(...l)=>{try{r.addBreadcrumb({category:"console",level:o==="error"?"Error":"Warning",message:l.map(q).join(" ").slice(0,500)});}catch{}return s.apply(console,l)};n[o]=i,t.push(()=>{n[o]===i&&(n[o]=s);});}}return ()=>{for(let n of t.splice(0))try{n();}catch{}}}function q(r){if(typeof r=="string")return r;if(r instanceof Error)return `${r.name}: ${r.message}`;try{return JSON.stringify(r)??String(r)}catch{return String(r)}}var b=2e3,S=8e3,R=4e3;function $(r){if(r instanceof Error)return {message:a(r.message||r.name||"Error",b),exceptionType:r.name||"Error",stackTrace:r.stack?a(r.stack,S):void 0,innerException:P(r.cause)};if(typeof r=="string")return {message:a(r,b),exceptionType:"Error"};if(r&&typeof r=="object"){let e=r,t=typeof e.message=="string"?e.message:O(e)??Object.prototype.toString.call(r),n=typeof e.name=="string"?e.name:"Error",o=typeof e.stack=="string"?e.stack:void 0;return {message:a(t,b),exceptionType:n,stackTrace:o?a(o,S):void 0,innerException:P(e.cause)}}return {message:a(String(r),b),exceptionType:"Error"}}function L(r){if(r.stackTrace)return r;try{let e=new Error(r.message).stack;if(e){let t=e.split(`
4
4
  `).slice(2).join(`
5
5
  `);return {...r,stackTrace:a(t||e,S)}}}catch{}return r}function P(r){if(r==null)return;if(r instanceof Error){let t=[`${r.name}: ${r.message}`];r.stack&&t.push(r.stack);let n=P(r.cause);return n&&t.push(`Caused by: ${n}`),a(t.join(`
@@ -32,7 +32,7 @@ declare class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryS
32
32
  }
33
33
 
34
34
  /** SDK version — kept in sync with package.json. */
35
- declare const SDK_VERSION = "1.0.1";
35
+ declare const SDK_VERSION = "1.0.2";
36
36
  /** Severity levels — these strings match the backend `ErrorSeverity` enum exactly. */
37
37
  type Severity = 'Debug' | 'Info' | 'Warning' | 'Error' | 'Critical';
38
38
  /** A trail entry giving context that led up to an error. */
@@ -32,7 +32,7 @@ declare class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryS
32
32
  }
33
33
 
34
34
  /** SDK version — kept in sync with package.json. */
35
- declare const SDK_VERSION = "1.0.1";
35
+ declare const SDK_VERSION = "1.0.2";
36
36
  /** Severity levels — these strings match the backend `ErrorSeverity` enum exactly. */
37
37
  type Severity = 'Debug' | 'Info' | 'Warning' | 'Error' | 'Critical';
38
38
  /** A trail entry giving context that led up to an error. */
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import {Component,useRef,useEffect,useCallback}from'react';import {jsx,Fragment}from'react/jsx-runtime';var h="1.0.1";function d(){return typeof window<"u"&&typeof document<"u"}function m(){return new Date().toISOString()}function a(r,e){return e<=0?"":r.length<=e?r:`${r.slice(0,e-1)}\u2026`}function C(r,e=24e3){let t=new WeakSet;try{let n=JSON.stringify(r,(o,s)=>{if(s instanceof Error)return {name:s.name,message:s.message,stack:s.stack};if(typeof s=="object"&&s!==null){if(t.has(s))return "[Circular]";t.add(s);}if(typeof s=="bigint")return s.toString();if(typeof s!="function")return s});return n===void 0||n.length>e?void 0:n}catch{return}}function B(r,e){return !r||e.length===0?false:e.some(t=>typeof t=="string"?r.includes(t):t.test(r))}function _(r){let e=r.replace(/\/+$/,"");return `${/\/api\/v\d+$/.test(e)?e:`${e}/api/v1`}/errors/batch`}var g=class{constructor(e){this.max=e;this.items=[];this.teardown=[];}add(e){this.items.push({timestamp:e.timestamp??m(),category:e.category,message:a(e.message,500),level:e.level,data:e.data}),this.items.length>this.max&&this.items.shift();}snapshot(){return this.items.slice()}install(){d()&&(this.installHistory(),this.installClicks(),this.installFetch());}installHistory(){try{let e=window.history,t=o=>{let s=e[o];if(typeof s!="function")return ()=>{};let i=(...l)=>{try{let u=l[2];typeof u=="string"&&this.add({category:"navigation",message:`${o} \u2192 ${u}`});}catch{}return s.apply(window.history,l)};return e[o]=i,()=>{e[o]===i&&(e[o]=s);}};this.teardown.push(t("pushState"),t("replaceState"));let n=()=>this.add({category:"navigation",message:`popstate \u2192 ${location.pathname}`});window.addEventListener("popstate",n),this.teardown.push(()=>window.removeEventListener("popstate",n));}catch{}}installClicks(){try{let e=t=>{let n=t.target;if(!n||typeof n.tagName!="string")return;let o=n.id?`#${n.id}`:"",s=typeof n.className=="string"?n.className:"",i=s?`.${s.split(/\s+/).filter(Boolean).slice(0,2).join(".")}`:"";this.add({category:"click",message:`${n.tagName.toLowerCase()}${o}${i}`});};window.addEventListener("click",e,{capture:!0,passive:!0}),this.teardown.push(()=>window.removeEventListener("click",e,{capture:!0}));}catch{}}installFetch(){try{let e=window.fetch;if(typeof e!="function")return;let t=(...n)=>{let[o,s]=n,i=s?.method??(typeof o=="object"&&o&&"method"in o?o.method:"GET"),l=typeof o=="string"?o:o instanceof URL?o.href:o.url;return e.apply(window,n).then(u=>(this.add({category:"fetch",message:`${i} ${l} \u2192 ${u.status}`,level:u.ok?void 0:"Warning"}),u),u=>{throw this.add({category:"fetch",message:`${i} ${l} \u2192 failed`,level:"Warning"}),u})};window.fetch=t,this.teardown.push(()=>{window.fetch===t&&(window.fetch=e);});}catch{}}close(){for(let e of this.teardown.splice(0))try{e();}catch{}}};var y=class{constructor(e=4e3,t=100){this.windowMs=e;this.max=t;this.seen=new Map;}shouldSend(e){let t=Date.now(),n=this.seen.get(e);if(n!==void 0&&t-n<this.windowMs)return false;if(this.seen.set(e,t),this.seen.size>this.max){let o=this.seen.keys().next().value;o!==void 0&&this.seen.delete(o);}return true}};function D(r,e){let t=(e??"").split(`
2
+ import {Component,useRef,useEffect,useCallback}from'react';import {jsx,Fragment}from'react/jsx-runtime';var h="1.0.2";function d(){return typeof window<"u"&&typeof document<"u"}function m(){return new Date().toISOString()}function a(r,e){return e<=0?"":r.length<=e?r:`${r.slice(0,e-1)}\u2026`}function C(r,e=24e3){let t=new WeakSet;try{let n=JSON.stringify(r,(o,s)=>{if(s instanceof Error)return {name:s.name,message:s.message,stack:s.stack};if(typeof s=="object"&&s!==null){if(t.has(s))return "[Circular]";t.add(s);}if(typeof s=="bigint")return s.toString();if(typeof s!="function")return s});return n===void 0||n.length>e?void 0:n}catch{return}}function B(r,e){return !r||e.length===0?false:e.some(t=>typeof t=="string"?r.includes(t):t.test(r))}function _(r){let e=r.replace(/\/+$/,"");return `${/\/api\/v\d+$/.test(e)?e:`${e}/api/v1`}/errors/batch`}var g=class{constructor(e){this.max=e;this.items=[];this.teardown=[];}add(e){this.items.push({timestamp:e.timestamp??m(),category:e.category,message:a(e.message,500),level:e.level,data:e.data}),this.items.length>this.max&&this.items.shift();}snapshot(){return this.items.slice()}install(){d()&&(this.installHistory(),this.installClicks(),this.installFetch());}installHistory(){try{let e=window.history,t=o=>{let s=e[o];if(typeof s!="function")return ()=>{};let i=(...l)=>{try{let u=l[2];typeof u=="string"&&this.add({category:"navigation",message:`${o} \u2192 ${u}`});}catch{}return s.apply(window.history,l)};return e[o]=i,()=>{e[o]===i&&(e[o]=s);}};this.teardown.push(t("pushState"),t("replaceState"));let n=()=>this.add({category:"navigation",message:`popstate \u2192 ${location.pathname}`});window.addEventListener("popstate",n),this.teardown.push(()=>window.removeEventListener("popstate",n));}catch{}}installClicks(){try{let e=t=>{let n=t.target;if(!n||typeof n.tagName!="string")return;let o=n.id?`#${n.id}`:"",s=typeof n.className=="string"?n.className:"",i=s?`.${s.split(/\s+/).filter(Boolean).slice(0,2).join(".")}`:"";this.add({category:"click",message:`${n.tagName.toLowerCase()}${o}${i}`});};window.addEventListener("click",e,{capture:!0,passive:!0}),this.teardown.push(()=>window.removeEventListener("click",e,{capture:!0}));}catch{}}installFetch(){try{let e=window.fetch;if(typeof e!="function")return;let t=(...n)=>{let[o,s]=n,i=s?.method??(typeof o=="object"&&o&&"method"in o?o.method:"GET"),l=typeof o=="string"?o:o instanceof URL?o.href:o.url;return e.apply(window,n).then(u=>(this.add({category:"fetch",message:`${i} ${l} \u2192 ${u.status}`,level:u.ok?void 0:"Warning"}),u),u=>{throw this.add({category:"fetch",message:`${i} ${l} \u2192 failed`,level:"Warning"}),u})};window.fetch=t,this.teardown.push(()=>{window.fetch===t&&(window.fetch=e);});}catch{}}close(){for(let e of this.teardown.splice(0))try{e();}catch{}}};var y=class{constructor(e=4e3,t=100){this.windowMs=e;this.max=t;this.seen=new Map;}shouldSend(e){let t=Date.now(),n=this.seen.get(e);if(n!==void 0&&t-n<this.windowMs)return false;if(this.seen.set(e,t),this.seen.size>this.max){let o=this.seen.keys().next().value;o!==void 0&&this.seen.delete(o);}return true}};function D(r,e){let t=(e??"").split(`
3
3
  `).slice(0,4).map(n=>n.replace(/:\d+:\d+/g,"").replace(/\?[^\s)]*/g,"").replace(/https?:\/\/[^/]+/g,"").trim()).join("|");return `${r}::${t}`.slice(0,500)}function j(r){if(!d())return ()=>{};let e=r.config,t=[];if(e.captureUnhandledErrors||e.captureResourceErrors){let n=o=>{try{let s=o.target;if(s instanceof HTMLElement){if(!e.captureResourceErrors)return;let l=s,u=l.src||l.href;if(!u)return;r.captureMessage(`Resource failed to load: ${u}`,"Warning",{context:{resource:s.tagName.toLowerCase(),url:u}});return}if(!e.captureUnhandledErrors)return;let i=o;if(!i.error&&(!i.message||i.message==="Script error."))return;r.captureException(i.error??i.message);}catch{}};window.addEventListener("error",n,true),t.push(()=>window.removeEventListener("error",n,true));}if(e.captureUnhandledRejections){let n=o=>{try{r.captureException(o.reason??"Unhandled promise rejection",{context:{unhandledRejection:!0}});}catch{}};window.addEventListener("unhandledrejection",n),t.push(()=>window.removeEventListener("unhandledrejection",n));}if(e.captureConsole){let n=console;for(let o of ["error","warn"]){let s=n[o];if(typeof s!="function")continue;let i=(...l)=>{try{r.addBreadcrumb({category:"console",level:o==="error"?"Error":"Warning",message:l.map(q).join(" ").slice(0,500)});}catch{}return s.apply(console,l)};n[o]=i,t.push(()=>{n[o]===i&&(n[o]=s);});}}return ()=>{for(let n of t.splice(0))try{n();}catch{}}}function q(r){if(typeof r=="string")return r;if(r instanceof Error)return `${r.name}: ${r.message}`;try{return JSON.stringify(r)??String(r)}catch{return String(r)}}var b=2e3,S=8e3,R=4e3;function $(r){if(r instanceof Error)return {message:a(r.message||r.name||"Error",b),exceptionType:r.name||"Error",stackTrace:r.stack?a(r.stack,S):void 0,innerException:P(r.cause)};if(typeof r=="string")return {message:a(r,b),exceptionType:"Error"};if(r&&typeof r=="object"){let e=r,t=typeof e.message=="string"?e.message:O(e)??Object.prototype.toString.call(r),n=typeof e.name=="string"?e.name:"Error",o=typeof e.stack=="string"?e.stack:void 0;return {message:a(t,b),exceptionType:n,stackTrace:o?a(o,S):void 0,innerException:P(e.cause)}}return {message:a(String(r),b),exceptionType:"Error"}}function L(r){if(r.stackTrace)return r;try{let e=new Error(r.message).stack;if(e){let t=e.split(`
4
4
  `).slice(2).join(`
5
5
  `);return {...r,stackTrace:a(t||e,S)}}}catch{}return r}function P(r){if(r==null)return;if(r instanceof Error){let t=[`${r.name}: ${r.message}`];r.stack&&t.push(r.stack);let n=P(r.cause);return n&&t.push(`Caused by: ${n}`),a(t.join(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cherrypeak-org/cherryboard-web",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Browser & React error tracking client for the CherryBoard dashboard (CherryPeak).",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -1,138 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Uploads a build's source maps to CherryBoard so production stack traces can be
4
- * resolved to original files, lines and function names.
5
- *
6
- * Run this in CI after building, with the SAME release identifier the SDK is
7
- * configured with — frames are matched by release, so a mismatch silently means
8
- * no symbolication.
9
- *
10
- * cherryboard-upload-sourcemaps \
11
- * --dir .next/static \
12
- * --url-prefix /_next/static \
13
- * --release "$GIT_SHA" \
14
- * --api-url https://api.example.com \
15
- * --api-key "$CHERRYBOARD_UPLOAD_KEY"
16
- *
17
- * Use a General (server) key, never the write-only browser key.
18
- */
19
- import { readFile, readdir, stat } from 'node:fs/promises';
20
- import { join, relative, sep } from 'node:path';
21
- import { parseArgs } from 'node:util';
22
-
23
- const { values } = parseArgs({
24
- options: {
25
- dir: { type: 'string' },
26
- 'url-prefix': { type: 'string', default: '/' },
27
- release: { type: 'string' },
28
- 'api-url': { type: 'string' },
29
- 'api-key': { type: 'string' },
30
- 'dry-run': { type: 'boolean', default: false },
31
- help: { type: 'boolean', default: false },
32
- },
33
- });
34
-
35
- if (values.help) {
36
- console.log(`
37
- Usage: cherryboard-upload-sourcemaps --dir <build-dir> --release <id> --api-url <url> --api-key <key>
38
-
39
- --dir Directory to scan recursively for .map files (e.g. .next/static)
40
- --url-prefix URL path the directory is served under (e.g. /_next/static)
41
- --release Release id; MUST match the SDK's \`release\` option
42
- --api-url CherryBoard API host
43
- --api-key A General (server) API key — not the browser key
44
- --dry-run List what would be uploaded, upload nothing
45
- `);
46
- process.exit(0);
47
- }
48
-
49
- const required = ['dir', 'release'];
50
- if (!values['dry-run']) required.push('api-url', 'api-key');
51
- const missing = required.filter((k) => !values[k]);
52
- if (missing.length) {
53
- console.error(`Missing required option(s): ${missing.map((m) => `--${m}`).join(', ')}`);
54
- process.exit(1);
55
- }
56
-
57
- /** Recursively collect every .map file under a directory. */
58
- async function findMaps(dir) {
59
- const found = [];
60
- let entries;
61
- try {
62
- entries = await readdir(dir, { withFileTypes: true });
63
- } catch (err) {
64
- console.error(`Cannot read directory ${dir}: ${err.message}`);
65
- process.exit(1);
66
- }
67
- for (const entry of entries) {
68
- const full = join(dir, entry.name);
69
- if (entry.isDirectory()) found.push(...(await findMaps(full)));
70
- else if (entry.name.endsWith('.map')) found.push(full);
71
- }
72
- return found;
73
- }
74
-
75
- /**
76
- * ".next/static/chunks/a.js.map" under prefix "/_next/static"
77
- * -> "/_next/static/chunks/a.js" (the path stack frames report)
78
- */
79
- function toUrlPath(mapFile, baseDir, urlPrefix) {
80
- const rel = relative(baseDir, mapFile).split(sep).join('/');
81
- const generated = rel.replace(/\.map$/, '');
82
- const prefix = urlPrefix.endsWith('/') ? urlPrefix.slice(0, -1) : urlPrefix;
83
- return `${prefix}/${generated}`.replace(/\/{2,}/g, '/');
84
- }
85
-
86
- const maps = await findMaps(values.dir);
87
- if (maps.length === 0) {
88
- // Not an error: many builds legitimately produce none (e.g. maps disabled).
89
- console.log(`No .map files found under ${values.dir} — nothing to upload.`);
90
- process.exit(0);
91
- }
92
-
93
- console.log(`Found ${maps.length} source map(s) for release ${values.release}`);
94
-
95
- let uploaded = 0;
96
- let failed = 0;
97
-
98
- for (const mapFile of maps) {
99
- const filePath = toUrlPath(mapFile, values.dir, values['url-prefix']);
100
- const { size } = await stat(mapFile);
101
-
102
- if (values['dry-run']) {
103
- console.log(` [dry-run] ${filePath} (${(size / 1024).toFixed(0)} KB)`);
104
- continue;
105
- }
106
-
107
- try {
108
- const content = await readFile(mapFile, 'utf8');
109
- const res = await fetch(`${values['api-url'].replace(/\/+$/, '')}/api/v1/SourceMaps`, {
110
- method: 'POST',
111
- headers: { 'Content-Type': 'application/json', 'X-API-Key': values['api-key'] },
112
- body: JSON.stringify({ release: values.release, filePath, content }),
113
- });
114
-
115
- if (!res.ok) {
116
- const body = await res.text().catch(() => '');
117
- console.error(` ✗ ${filePath} → HTTP ${res.status} ${body.slice(0, 200)}`);
118
- failed++;
119
- continue;
120
- }
121
-
122
- uploaded++;
123
- console.log(` ✓ ${filePath} (${(size / 1024).toFixed(0)} KB)`);
124
- } catch (err) {
125
- console.error(` ✗ ${filePath} → ${err.message}`);
126
- failed++;
127
- }
128
- }
129
-
130
- if (values['dry-run']) {
131
- console.log(`\nDry run: ${maps.length} map(s) would be uploaded.`);
132
- process.exit(0);
133
- }
134
-
135
- console.log(`\nUploaded ${uploaded}/${maps.length} source map(s)${failed ? `, ${failed} failed` : ''}.`);
136
- // Failing the build on upload errors would block deploys over telemetry, so
137
- // this exits non-zero only if nothing at all got through.
138
- process.exit(uploaded === 0 ? 1 : 0);