@cloudflare/vite-plugin 0.0.0-a225f8a28 → 0.0.0-a2f695b96

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,7 +1,7 @@
1
1
  // ../workers-shared/dist/router-worker.mjs
2
- var Pn = Object.defineProperty;
3
- var Cn = (t, e, n) => e in t ? Pn(t, e, { enumerable: true, configurable: true, writable: true, value: n }) : t[e] = n;
4
- var fe = (t, e, n) => (Cn(t, typeof e != "symbol" ? e + "" : e, n), n);
2
+ var Cn = Object.defineProperty;
3
+ var Pn = (t, e, n) => e in t ? Cn(t, e, { enumerable: true, configurable: true, writable: true, value: n }) : t[e] = n;
4
+ var fe = (t, e, n) => (Pn(t, typeof e != "symbol" ? e + "" : e, n), n);
5
5
  var bt = (t, e, n) => {
6
6
  if (!e.has(t)) throw TypeError("Cannot " + n);
7
7
  };
@@ -67,7 +67,7 @@ function O(t, e) {
67
67
  function qe(t) {
68
68
  return !!(typeof t == "object" && t !== null && (t.__isVue || t._isVue));
69
69
  }
70
- function w(t, e = 0) {
70
+ function v(t, e = 0) {
71
71
  return typeof t != "string" || e === 0 || t.length <= e ? t : `${t.slice(0, e)}...`;
72
72
  }
73
73
  function me(t) {
@@ -148,7 +148,7 @@ var Bn = /^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;
148
148
  function Ln(t) {
149
149
  return t === "http" || t === "https";
150
150
  }
151
- function P(t, e = false) {
151
+ function C(t, e = false) {
152
152
  let { host: n, path: r, pass: s, port: i, projectId: o, protocol: a, publicKey: c } = t;
153
153
  return `${a}://${c}${e && s ? `:${s}` : ""}@${n}${i ? `:${i}` : ""}/${r && `${r}/`}${o}`;
154
154
  }
@@ -185,7 +185,7 @@ var y = class extends Error {
185
185
  function x(t, e, n) {
186
186
  if (!(e in t)) return;
187
187
  let r = t[e], s = n(r);
188
- typeof s == "function" && wt(s, r), t[e] = s;
188
+ typeof s == "function" && vt(s, r), t[e] = s;
189
189
  }
190
190
  function q(t, e, n) {
191
191
  try {
@@ -194,7 +194,7 @@ function q(t, e, n) {
194
194
  (typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && p.log(`Failed to add non-enumerable property "${e}" to object`, t);
195
195
  }
196
196
  }
197
- function wt(t, e) {
197
+ function vt(t, e) {
198
198
  try {
199
199
  let n = e.prototype || {};
200
200
  t.prototype = e.prototype = n, q(t, "__sentry_original__", e);
@@ -205,9 +205,9 @@ function We(t) {
205
205
  return Object.keys(t).map((e) => `${encodeURIComponent(e)}=${encodeURIComponent(t[e])}`).join("&");
206
206
  }
207
207
  function ge(t) {
208
- if (U(t)) return { message: t.message, name: t.name, stack: t.stack, ...vt(t) };
208
+ if (U(t)) return { message: t.message, name: t.name, stack: t.stack, ...wt(t) };
209
209
  if ($e(t)) {
210
- let e = { type: t.type, target: At(t.target), currentTarget: At(t.currentTarget), ...vt(t) };
210
+ let e = { type: t.type, target: At(t.target), currentTarget: At(t.currentTarget), ...wt(t) };
211
211
  return typeof CustomEvent < "u" && O(t, CustomEvent) && (e.detail = t.detail), e;
212
212
  } else return t;
213
213
  }
@@ -218,7 +218,7 @@ function At(t) {
218
218
  return "<unknown>";
219
219
  }
220
220
  }
221
- function vt(t) {
221
+ function wt(t) {
222
222
  if (typeof t == "object" && t !== null) {
223
223
  let e = {};
224
224
  for (let n in t) Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n]);
@@ -228,10 +228,10 @@ function vt(t) {
228
228
  function te(t, e = 40) {
229
229
  let n = Object.keys(ge(t));
230
230
  if (n.sort(), !n.length) return "[object has no keys]";
231
- if (n[0].length >= e) return w(n[0], e);
231
+ if (n[0].length >= e) return v(n[0], e);
232
232
  for (let r = n.length; r > 0; r--) {
233
233
  let s = n.slice(0, r).join(", ");
234
- if (!(s.length > e)) return r === n.length ? s : w(s, e);
234
+ if (!(s.length > e)) return r === n.length ? s : v(s, e);
235
235
  }
236
236
  return "";
237
237
  }
@@ -260,7 +260,7 @@ function ze(t, e) {
260
260
  function $n(t, e = false) {
261
261
  return !(e || t && !t.startsWith("/") && !t.includes(":\\") && !t.startsWith(".") && !t.match(/^[a-zA-Z]([a-zA-Z0-9.\-+])*:\/\//)) && t !== void 0 && !t.includes("node_modules/");
262
262
  }
263
- function Pt(t) {
263
+ function Ct(t) {
264
264
  let e = /^\s*[-]{4,}$/, n = /at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/;
265
265
  return (r) => {
266
266
  let s = r.match(n);
@@ -284,7 +284,7 @@ function Pt(t) {
284
284
  };
285
285
  }
286
286
  var Ut = 50;
287
- var Ct = /\(error: (.*)\)/;
287
+ var Pt = /\(error: (.*)\)/;
288
288
  var Mt = /captureMessage|captureException/;
289
289
  function Ee(...t) {
290
290
  let e = t.sort((n, r) => n[0] - r[0]).map((n) => n[1]);
@@ -294,7 +294,7 @@ function Ee(...t) {
294
294
  for (let o = r; o < i.length; o++) {
295
295
  let a = i[o];
296
296
  if (a.length > 1024) continue;
297
- let c = Ct.test(a) ? a.replace(Ct, "$1") : a;
297
+ let c = Pt.test(a) ? a.replace(Pt, "$1") : a;
298
298
  if (!c.match(/\S*Error: /)) {
299
299
  for (let u of e) {
300
300
  let f = u(c);
@@ -309,7 +309,7 @@ function Ee(...t) {
309
309
  return Gt(s);
310
310
  };
311
311
  }
312
- function Ve(t) {
312
+ function Ke(t) {
313
313
  return Array.isArray(t) ? Ee(...t) : t;
314
314
  }
315
315
  function Gt(t) {
@@ -317,16 +317,16 @@ function Gt(t) {
317
317
  let e = Array.from(t);
318
318
  return /sentryWrapped/.test(e[e.length - 1].function || "") && e.pop(), e.reverse(), Mt.test(e[e.length - 1].function || "") && (e.pop(), Mt.test(e[e.length - 1].function || "") && e.pop()), e.slice(0, Ut).map((n) => ({ ...n, filename: n.filename || e[e.length - 1].filename, function: n.function || "?" }));
319
319
  }
320
- var Ke = "<anonymous>";
320
+ var Ve = "<anonymous>";
321
321
  function ne(t) {
322
322
  try {
323
- return !t || typeof t != "function" ? Ke : t.name || Ke;
323
+ return !t || typeof t != "function" ? Ve : t.name || Ve;
324
324
  } catch {
325
- return Ke;
325
+ return Ve;
326
326
  }
327
327
  }
328
328
  function Je(t) {
329
- return [90, Pt(t)];
329
+ return [90, Ct(t)];
330
330
  }
331
331
  var Xe = I();
332
332
  function jn() {
@@ -496,10 +496,10 @@ function Wn() {
496
496
  }
497
497
  x(E.history, "pushState", e), x(E.history, "replaceState", e);
498
498
  }
499
- var Kn = 1e3;
499
+ var Vn = 1e3;
500
500
  var jt;
501
501
  var Te;
502
- function Vn(t, e) {
502
+ function Kn(t, e) {
503
503
  if (t.type !== e.type) return false;
504
504
  try {
505
505
  if (t.target !== e.target) return false;
@@ -522,9 +522,9 @@ function Ht(t, e = false) {
522
522
  if (!n || n._sentryCaptured || Jn(n)) return;
523
523
  q(n, "_sentryCaptured", true);
524
524
  let r = n.type === "keypress" ? "input" : n.type;
525
- (Te === void 0 || !Vn(Te, n)) && (t({ event: n, name: r, global: e }), Te = n), clearTimeout(jt), jt = E.setTimeout(() => {
525
+ (Te === void 0 || !Kn(Te, n)) && (t({ event: n, name: r, global: e }), Te = n), clearTimeout(jt), jt = E.setTimeout(() => {
526
526
  Te = void 0;
527
- }, Kn);
527
+ }, Vn);
528
528
  };
529
529
  }
530
530
  function Wt() {
@@ -569,11 +569,11 @@ function Zn() {
569
569
  return D("unhandledrejection", t), Re && !Re.__SENTRY_LOADER__ ? Re.apply(this, arguments) : true;
570
570
  }, E.onunhandledrejection.__SENTRY_INSTRUMENTED__ = true;
571
571
  }
572
- function Kt() {
572
+ function Vt() {
573
573
  return typeof __SENTRY_BROWSER_BUNDLE__ < "u" && !!__SENTRY_BROWSER_BUNDLE__;
574
574
  }
575
- function Vt() {
576
- return !Kt() && Object.prototype.toString.call(typeof process < "u" ? process : 0) === "[object process]";
575
+ function Kt() {
576
+ return !Vt() && Object.prototype.toString.call(typeof process < "u" ? process : 0) === "[object process]";
577
577
  }
578
578
  function Jt(t, e) {
579
579
  return t.require(e);
@@ -847,7 +847,7 @@ function ar() {
847
847
  return;
848
848
  }
849
849
  }
850
- var tt = Vt() ? ar() : or();
850
+ var tt = Kt() ? ar() : or();
851
851
  var Zt = tt === void 0 ? nt : { nowSeconds: () => (tt.timeOrigin + tt.now()) / 1e3 };
852
852
  var B = nt.nowSeconds.bind(nt);
853
853
  var L = Zt.nowSeconds.bind(Zt);
@@ -866,7 +866,7 @@ function rt(t = h(), e = h().substring(16), n) {
866
866
  let r = "";
867
867
  return n !== void 0 && (r = n ? "-1" : "-0"), `${t}-${e}${r}`;
868
868
  }
869
- function C(t, e = []) {
869
+ function P(t, e = []) {
870
870
  return [t, e];
871
871
  }
872
872
  function it(t, e) {
@@ -926,7 +926,7 @@ function Oe(t) {
926
926
  }
927
927
  function ct(t, e, n, r) {
928
928
  let s = t.sdkProcessingMetadata && t.sdkProcessingMetadata.dynamicSamplingContext;
929
- return { event_id: t.event_id, sent_at: (/* @__PURE__ */ new Date()).toISOString(), ...e && { sdk: e }, ...!!n && r && { dsn: P(r) }, ...s && { trace: g({ ...s }) } };
929
+ return { event_id: t.event_id, sent_at: (/* @__PURE__ */ new Date()).toISOString(), ...e && { sdk: e }, ...!!n && r && { dsn: C(r) }, ...s && { trace: g({ ...s }) } };
930
930
  }
931
931
  function en(t, e = Date.now()) {
932
932
  let n = parseInt(`${t}`, 10);
@@ -994,21 +994,21 @@ function ue() {
994
994
  function rn(t) {
995
995
  ue().push(t);
996
996
  }
997
- function K(t, e, n, r = 0) {
997
+ function V(t, e, n, r = 0) {
998
998
  return new S((s, i) => {
999
999
  let o = t[r];
1000
1000
  if (e === null || typeof o != "function") s(e);
1001
1001
  else {
1002
1002
  let a = o({ ...e }, n);
1003
- (typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && o.id && a === null && p.log(`Event processor "${o.id}" dropped event`), G(a) ? a.then((c) => K(t, c, n, r + 1).then(s)).then(null, i) : K(t, a, n, r + 1).then(s).then(null, i);
1003
+ (typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && o.id && a === null && p.log(`Event processor "${o.id}" dropped event`), G(a) ? a.then((c) => V(t, c, n, r + 1).then(s)).then(null, i) : V(t, a, n, r + 1).then(s).then(null, i);
1004
1004
  }
1005
1005
  });
1006
1006
  }
1007
1007
  function sn(t) {
1008
1008
  let e = L(), n = { sid: h(), init: true, timestamp: e, started: e, duration: 0, status: "ok", errors: 0, ignoreDuration: false, toJSON: () => lr(n) };
1009
- return t && v(n, t), n;
1009
+ return t && w(n, t), n;
1010
1010
  }
1011
- function v(t, e = {}) {
1011
+ function w(t, e = {}) {
1012
1012
  if (e.user && (!t.ipAddress && e.user.ip_address && (t.ipAddress = e.user.ip_address), !t.did && !e.did && (t.did = e.user.id || e.user.email || e.user.username)), t.timestamp = e.timestamp || L(), e.abnormal_mechanism && (t.abnormal_mechanism = e.abnormal_mechanism), e.ignoreDuration && (t.ignoreDuration = e.ignoreDuration), e.sid && (t.sid = e.sid.length === 32 ? e.sid : h()), e.init !== void 0 && (t.init = e.init), !t.did && e.did && (t.did = `${e.did}`), typeof e.started == "number" && (t.started = e.started), t.ignoreDuration) t.duration = void 0;
1013
1013
  else if (typeof e.duration == "number") t.duration = e.duration;
1014
1014
  else {
@@ -1019,7 +1019,7 @@ function v(t, e = {}) {
1019
1019
  }
1020
1020
  function on(t, e) {
1021
1021
  let n = {};
1022
- e ? n = { status: e } : t.status === "ok" && (n = { status: "exited" }), v(t, n);
1022
+ e ? n = { status: e } : t.status === "ok" && (n = { status: "exited" }), w(t, n);
1023
1023
  }
1024
1024
  function lr(t) {
1025
1025
  return g({ sid: `${t.sid}`, init: t.init, started: new Date(t.started * 1e3).toISOString(), timestamp: new Date(t.timestamp * 1e3).toISOString(), status: t.status, errors: t.errors, did: typeof t.did == "number" || typeof t.did == "string" ? `${t.did}` : void 0, duration: t.duration, abnormal_mechanism: t.abnormal_mechanism, attrs: { release: t.release, environment: t.environment, ip_address: t.ipAddress, user_agent: t.userAgent } });
@@ -1040,7 +1040,7 @@ var k = class {
1040
1040
  return this._eventProcessors.push(e), this;
1041
1041
  }
1042
1042
  setUser(e) {
1043
- return this._user = e || {}, this._session && v(this._session, { user: e }), this._notifyScopeListeners(), this;
1043
+ return this._user = e || {}, this._session && w(this._session, { user: e }), this._notifyScopeListeners(), this;
1044
1044
  }
1045
1045
  getUser() {
1046
1046
  return this._user;
@@ -1135,7 +1135,7 @@ var k = class {
1135
1135
  }
1136
1136
  this._applyFingerprint(e);
1137
1137
  let s = this._getBreadcrumbs(), i = [...e.breadcrumbs || [], ...s];
1138
- return e.breadcrumbs = i.length > 0 ? i : void 0, e.sdkProcessingMetadata = { ...e.sdkProcessingMetadata, ...this._sdkProcessingMetadata, propagationContext: this._propagationContext }, K([...r || [], ...ue(), ...this._eventProcessors], e, n);
1138
+ return e.breadcrumbs = i.length > 0 ? i : void 0, e.sdkProcessingMetadata = { ...e.sdkProcessingMetadata, ...this._sdkProcessingMetadata, propagationContext: this._propagationContext }, V([...r || [], ...ue(), ...this._eventProcessors], e, n);
1139
1139
  }
1140
1140
  setSDKProcessingMetadata(e) {
1141
1141
  return this._sdkProcessingMetadata = { ...this._sdkProcessingMetadata, ...e }, this;
@@ -1293,7 +1293,7 @@ Sentry.init({...});
1293
1293
  }
1294
1294
  startSession(e) {
1295
1295
  let { scope: n, client: r } = this.getStackTop(), { release: s, environment: i = W } = r && r.getOptions() || {}, { userAgent: o } = m.navigator || {}, a = sn({ release: s, environment: i, user: n.getUser(), ...o && { userAgent: o }, ...e }), c = n.getSession && n.getSession();
1296
- return c && c.status === "ok" && v(c, { status: "exited" }), this.endSession(), n.setSession(a), a;
1296
+ return c && c.status === "ok" && w(c, { status: "exited" }), this.endSession(), n.setSession(a), a;
1297
1297
  }
1298
1298
  shouldSendDefaultPii() {
1299
1299
  let e = this.getClient(), n = e && e.getOptions();
@@ -1357,7 +1357,7 @@ function ht() {
1357
1357
  }
1358
1358
  }
1359
1359
  ht.tag = "sentry_tracingErrorCallback";
1360
- var ve = class {
1360
+ var we = class {
1361
1361
  constructor(e = 1e3) {
1362
1362
  this._maxlen = e, this.spans = [];
1363
1363
  }
@@ -1365,7 +1365,7 @@ var ve = class {
1365
1365
  this.spans.length > this._maxlen ? e.spanRecorder = void 0 : this.spans.push(e);
1366
1366
  }
1367
1367
  };
1368
- var V = class {
1368
+ var K = class {
1369
1369
  constructor(e = {}) {
1370
1370
  this.traceId = e.traceId || h(), this.spanId = e.spanId || h().substring(16), this.startTimestamp = e.startTimestamp || L(), this.tags = e.tags || {}, this.data = e.data || {}, this.instrumenter = e.instrumenter || "sentry", this.origin = e.origin || "manual", e.parentSpanId && (this.parentSpanId = e.parentSpanId), "sampled" in e && (this.sampled = e.sampled), e.op && (this.op = e.op), e.description && (this.description = e.description), e.name && (this.description = e.name), e.status && (this.status = e.status), e.endTimestamp && (this.endTimestamp = e.endTimestamp);
1371
1371
  }
@@ -1376,7 +1376,7 @@ var V = class {
1376
1376
  this.setName(e);
1377
1377
  }
1378
1378
  startChild(e) {
1379
- let n = new V({ ...e, parentSpanId: this.spanId, sampled: this.sampled, traceId: this.traceId });
1379
+ let n = new K({ ...e, parentSpanId: this.spanId, sampled: this.sampled, traceId: this.traceId });
1380
1380
  if (n.spanRecorder = this.spanRecorder, n.spanRecorder && n.spanRecorder.add(n), n.transaction = this.transaction, (typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && n.transaction) {
1381
1381
  let r = e && e.op || "< unknown op >", s = n.transaction.name || "< unknown name >", i = n.transaction.spanId, o = `[Tracing] Starting '${r}' span on transaction '${s}' (${i}).`;
1382
1382
  n.transaction.metadata.spanMetadata[n.spanId] = { logMessage: o }, p.log(o);
@@ -1460,7 +1460,7 @@ function J(t, e, n) {
1460
1460
  let r = e.getOptions(), { publicKey: s } = e.getDsn() || {}, { segment: i } = n && n.getUser() || {}, o = g({ environment: r.environment || W, release: r.release, user_segment: i, public_key: s, trace_id: t });
1461
1461
  return e.emit && e.emit("createDsc", o), o;
1462
1462
  }
1463
- var we = class extends V {
1463
+ var ve = class extends K {
1464
1464
  constructor(e, n) {
1465
1465
  super(e), delete this.description, this._measurements = {}, this._contexts = {}, this._hub = n || b(), this._name = e.name || "", this.metadata = { source: "custom", ...e.metadata, spanMetadata: {} }, this._trimEnd = e.trimEnd, this.transaction = this;
1466
1466
  let r = this.metadata.dynamicSamplingContext;
@@ -1476,7 +1476,7 @@ var we = class extends V {
1476
1476
  this._name = e, this.metadata.source = n;
1477
1477
  }
1478
1478
  initSpanRecorder(e = 1e3) {
1479
- this.spanRecorder || (this.spanRecorder = new ve(e)), this.spanRecorder.add(this);
1479
+ this.spanRecorder || (this.spanRecorder = new we(e)), this.spanRecorder.add(this);
1480
1480
  }
1481
1481
  setContext(e, n) {
1482
1482
  n === null ? delete this._contexts[e] : this._contexts[e] = n;
@@ -1546,14 +1546,14 @@ function Tr(t, e) {
1546
1546
  let n = this.getClient(), r = n && n.getOptions() || {}, s = r.instrumenter || "sentry", i = t.instrumenter || "sentry";
1547
1547
  s !== i && ((typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && p.error(`A transaction was started with instrumenter=\`${i}\`, but the SDK is configured with the \`${s}\` instrumenter.
1548
1548
  The transaction will not be sampled. Please use the ${s} instrumentation to start transactions.`), t.sampled = false);
1549
- let o = new we(t, this);
1549
+ let o = new ve(t, this);
1550
1550
  return o = ln(o, r, { parentSampled: t.parentSampled, transactionContext: t, ...e }), o.sampled && o.initSpanRecorder(r._experiments && r._experiments.maxSpans), n && n.emit && n.emit("startTransaction", o), o;
1551
1551
  }
1552
1552
  function mn() {
1553
1553
  let t = $();
1554
1554
  t.__SENTRY__ && (t.__SENTRY__.extensions = t.__SENTRY__.extensions || {}, t.__SENTRY__.extensions.startTransaction || (t.__SENTRY__.extensions.startTransaction = Tr), t.__SENTRY__.extensions.traceHeaders || (t.__SENTRY__.extensions.traceHeaders = yr), fn());
1555
1555
  }
1556
- var Pe = class {
1556
+ var Ce = class {
1557
1557
  constructor(e, n) {
1558
1558
  this._client = e, this.flushTimeout = 60, this._pendingAggregates = {}, this._isEnabled = true, this._intervalId = setInterval(() => this.flush(), this.flushTimeout * 1e3), this._sessionAttrs = n;
1559
1559
  }
@@ -1606,14 +1606,14 @@ function Dr(t, e) {
1606
1606
  return e && (t.sdk = t.sdk || {}, t.sdk.name = t.sdk.name || e.name, t.sdk.version = t.sdk.version || e.version, t.sdk.integrations = [...t.sdk.integrations || [], ...e.integrations || []], t.sdk.packages = [...t.sdk.packages || [], ...e.packages || []]), t;
1607
1607
  }
1608
1608
  function hn(t, e, n, r) {
1609
- let s = Oe(n), i = { sent_at: (/* @__PURE__ */ new Date()).toISOString(), ...s && { sdk: s }, ...!!r && e && { dsn: P(e) } }, o = "aggregates" in t ? [{ type: "sessions" }, t] : [{ type: "session" }, t.toJSON()];
1610
- return C(i, [o]);
1609
+ let s = Oe(n), i = { sent_at: (/* @__PURE__ */ new Date()).toISOString(), ...s && { sdk: s }, ...!!r && e && { dsn: C(e) } }, o = "aggregates" in t ? [{ type: "sessions" }, t] : [{ type: "session" }, t.toJSON()];
1610
+ return P(i, [o]);
1611
1611
  }
1612
1612
  function gn(t, e, n, r) {
1613
1613
  let s = Oe(n), i = t.type && t.type !== "replay_event" ? t.type : "event";
1614
1614
  Dr(t, n && n.sdk);
1615
1615
  let o = ct(t, s, r, e);
1616
- return delete t.sdkProcessingMetadata, C(o, [[{ type: i }, t]]);
1616
+ return delete t.sdkProcessingMetadata, P(o, [[{ type: i }, t]]);
1617
1617
  }
1618
1618
  var En = [];
1619
1619
  function Nr(t) {
@@ -1660,7 +1660,7 @@ function kr(t, e) {
1660
1660
  }
1661
1661
  function Tn(t, e, n, r, s) {
1662
1662
  let { normalizeDepth: i = 3, normalizeMaxBreadth: o = 1e3 } = t, a = { ...e, event_id: e.event_id || n.event_id || h(), timestamp: e.timestamp || B() }, c = n.integrations || t.integrations.map((l) => l.name);
1663
- Or(a, t), wr(a, c), e.type === void 0 && Ar(a, t.stackParser);
1663
+ Or(a, t), vr(a, c), e.type === void 0 && Ar(a, t.stackParser);
1664
1664
  let u = r;
1665
1665
  n.captureContext && (u = k.clone(u).update(n.captureContext));
1666
1666
  let f = T(a), d = s && s.getEventProcessors ? s.getEventProcessors() : [];
@@ -1670,16 +1670,16 @@ function Tn(t, e, n, r, s) {
1670
1670
  l.length && (n.attachments = l);
1671
1671
  }
1672
1672
  f = u.applyToEvent(a, n, d);
1673
- } else f = K([...d, ...ue()], a, n);
1674
- return f.then((l) => (l && vr(l), typeof i == "number" && i > 0 ? Pr(l, i, o) : l));
1673
+ } else f = V([...d, ...ue()], a, n);
1674
+ return f.then((l) => (l && wr(l), typeof i == "number" && i > 0 ? Cr(l, i, o) : l));
1675
1675
  }
1676
1676
  function Or(t, e) {
1677
1677
  let { environment: n, release: r, dist: s, maxValueLength: i = 250 } = e;
1678
- "environment" in t || (t.environment = "environment" in e ? n : W), t.release === void 0 && r !== void 0 && (t.release = r), t.dist === void 0 && s !== void 0 && (t.dist = s), t.message && (t.message = w(t.message, i));
1678
+ "environment" in t || (t.environment = "environment" in e ? n : W), t.release === void 0 && r !== void 0 && (t.release = r), t.dist === void 0 && s !== void 0 && (t.dist = s), t.message && (t.message = v(t.message, i));
1679
1679
  let o = t.exception && t.exception.values && t.exception.values[0];
1680
- o && o.value && (o.value = w(o.value, i));
1680
+ o && o.value && (o.value = v(o.value, i));
1681
1681
  let a = t.request;
1682
- a && a.url && (a.url = w(a.url, i));
1682
+ a && a.url && (a.url = v(a.url, i));
1683
1683
  }
1684
1684
  var yn = /* @__PURE__ */ new WeakMap();
1685
1685
  function Ar(t, e) {
@@ -1708,7 +1708,7 @@ function Ar(t, e) {
1708
1708
  } catch {
1709
1709
  }
1710
1710
  }
1711
- function vr(t) {
1711
+ function wr(t) {
1712
1712
  let e = {};
1713
1713
  try {
1714
1714
  t.exception.values.forEach((r) => {
@@ -1725,16 +1725,16 @@ function vr(t) {
1725
1725
  n.push({ type: "sourcemap", code_file: r, debug_id: e[r] });
1726
1726
  });
1727
1727
  }
1728
- function wr(t, e) {
1728
+ function vr(t, e) {
1729
1729
  e.length > 0 && (t.sdk = t.sdk || {}, t.sdk.integrations = [...t.sdk.integrations || [], ...e]);
1730
1730
  }
1731
- function Pr(t, e, n) {
1731
+ function Cr(t, e, n) {
1732
1732
  if (!t) return null;
1733
1733
  let r = { ...t, ...t.breadcrumbs && { breadcrumbs: t.breadcrumbs.map((s) => ({ ...s, ...s.data && { data: N(s.data, e, n) } })) }, ...t.user && { user: N(t.user, e, n) }, ...t.contexts && { contexts: N(t.contexts, e, n) }, ...t.extra && { extra: N(t.extra, e, n) } };
1734
1734
  return t.contexts && t.contexts.trace && r.contexts && (r.contexts.trace = t.contexts.trace, t.contexts.trace.data && (r.contexts.trace.data = N(t.contexts.trace.data, e, n))), t.spans && (r.spans = t.spans.map((s) => (s.data && (s.data = N(s.data, e, n)), s))), r;
1735
1735
  }
1736
1736
  var bn = "Not capturing exception because it's already been captured.";
1737
- var Ce = class {
1737
+ var Pe = class {
1738
1738
  constructor(e) {
1739
1739
  if (this._options = e, this._integrations = {}, this._integrationsInitialized = false, this._numProcessing = 0, this._outcomes = {}, this._hooks = {}, this._eventProcessors = [], e.dsn ? this._dsn = he(e.dsn) : (typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && p.warn("No DSN provided, client will not send events."), this._dsn) {
1740
1740
  let n = _n(this._dsn, e);
@@ -1768,7 +1768,7 @@ var Ce = class {
1768
1768
  })), s;
1769
1769
  }
1770
1770
  captureSession(e) {
1771
- typeof e.release != "string" ? (typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && p.warn("Discarded session because of missing or non-string release") : (this.sendSession(e), v(e, { init: false }));
1771
+ typeof e.release != "string" ? (typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && p.warn("Discarded session because of missing or non-string release") : (this.sendSession(e), w(e, { init: false }));
1772
1772
  }
1773
1773
  getDsn() {
1774
1774
  return this._dsn;
@@ -1847,7 +1847,7 @@ var Ce = class {
1847
1847
  }
1848
1848
  }
1849
1849
  let o = e.status === "ok";
1850
- (o && e.errors === 0 || o && r) && (v(e, { ...r && { status: "crashed" }, errors: e.errors || Number(s || r) }), this.captureSession(e));
1850
+ (o && e.errors === 0 || o && r) && (w(e, { ...r && { status: "crashed" }, errors: e.errors || Number(s || r) }), this.captureSession(e));
1851
1851
  }
1852
1852
  _isClientDoneProcessing(e) {
1853
1853
  return new S((n) => {
@@ -1889,7 +1889,7 @@ var Ce = class {
1889
1889
  if (d === null) throw this.recordDroppedEvent("event_processor", f, e), new y("An event processor returned `null`, will not send event.", "log");
1890
1890
  if (n.data && n.data.__sentry__ === true) return d;
1891
1891
  let _ = Mr(s, d, n);
1892
- return Cr(_, u);
1892
+ return Pr(_, u);
1893
1893
  }).then((d) => {
1894
1894
  if (d === null) throw this.recordDroppedEvent("before_send", f, e), new y(`${u} returned \`null\`, will not send event.`, "log");
1895
1895
  let l = r && r.getSession();
@@ -1922,7 +1922,7 @@ Reason: ${d}`));
1922
1922
  });
1923
1923
  }
1924
1924
  };
1925
- function Cr(t, e) {
1925
+ function Pr(t, e) {
1926
1926
  let n = `${e} must return \`null\` or a valid event.`;
1927
1927
  if (G(t)) return t.then((r) => {
1928
1928
  if (!R(r) && r !== null) throw new y(n);
@@ -1945,14 +1945,14 @@ function xn(t) {
1945
1945
  }
1946
1946
  function In(t, e, n, r, s) {
1947
1947
  let i = { sent_at: (/* @__PURE__ */ new Date()).toISOString() };
1948
- n && n.sdk && (i.sdk = { name: n.sdk.name, version: n.sdk.version }), r && s && (i.dsn = P(s)), e && (i.trace = g(e));
1948
+ n && n.sdk && (i.sdk = { name: n.sdk.name, version: n.sdk.version }), r && s && (i.dsn = C(s)), e && (i.trace = g(e));
1949
1949
  let o = Ur(t);
1950
- return C(i, [o]);
1950
+ return P(i, [o]);
1951
1951
  }
1952
1952
  function Ur(t) {
1953
1953
  return [{ type: "check_in" }, t];
1954
1954
  }
1955
- var de = class extends Ce {
1955
+ var de = class extends Pe {
1956
1956
  constructor(e) {
1957
1957
  mn(), super(e);
1958
1958
  }
@@ -1981,7 +1981,7 @@ var de = class extends Ce {
1981
1981
  }
1982
1982
  initSessionFlusher() {
1983
1983
  let { release: e, environment: n } = this._options;
1984
- e ? this._sessionFlusher = new Pe(this, { release: e, environment: n }) : (typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && p.warn("Cannot initialise an instance of SessionFlusher if no release is provided!");
1984
+ e ? this._sessionFlusher = new Ce(this, { release: e, environment: n }) : (typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && p.warn("Cannot initialise an instance of SessionFlusher if no release is provided!");
1985
1985
  }
1986
1986
  captureCheckIn(e, n, r) {
1987
1987
  let s = e.status !== "in_progress" && e.checkInId ? e.checkInId : h();
@@ -2019,7 +2019,7 @@ function St(t, e, n = et(t.bufferSize || Gr)) {
2019
2019
  t.recordDroppedEvent("ratelimit_backoff", _, M);
2020
2020
  } else a.push(d);
2021
2021
  }), a.length === 0) return T();
2022
- let c = C(o[0], a), u = (d) => {
2022
+ let c = P(o[0], a), u = (d) => {
2023
2023
  Ne(c, (l, _) => {
2024
2024
  let M = Dn(l, _);
2025
2025
  t.recordDroppedEvent(d, ke(_), M);
@@ -2105,13 +2105,13 @@ var Me = Fe;
2105
2105
  fe(Me, "id", "LinkedErrors");
2106
2106
  function qr(t, e, n, r) {
2107
2107
  if (!n.exception || !n.exception.values || !r || !O(r.originalException, Error)) return n;
2108
- let s = vn(t, e, r.originalException);
2108
+ let s = wn(t, e, r.originalException);
2109
2109
  return n.exception.values = [...s, ...n.exception.values], n;
2110
2110
  }
2111
- function vn(t, e, n, r = []) {
2111
+ function wn(t, e, n, r = []) {
2112
2112
  if (!O(n.cause, Error) || r.length + 1 >= e) return r;
2113
2113
  let s = An(t, n.cause);
2114
- return vn(t, e, n.cause, [s, ...r]);
2114
+ return wn(t, e, n.cause, [s, ...r]);
2115
2115
  }
2116
2116
  var zr = { allowedHeaders: ["CF-RAY", "CF-Worker"] };
2117
2117
  var X;
@@ -2124,7 +2124,7 @@ var Be = class {
2124
2124
  setupOnce(e, n) {
2125
2125
  n().getClient() && e((s) => {
2126
2126
  let { sdkProcessingMetadata: i } = s;
2127
- return !n().getIntegration(Be) || !i || ("request" in i && i.request instanceof Request && (s.request = Kr(i.request, Ye(this, X)), s.user = Wr(s.user ?? {}, i.request, Ye(this, X))), "requestData" in i && (s.request ? s.request.data = i.requestData : s.request = { data: i.requestData })), s;
2127
+ return !n().getIntegration(Be) || !i || ("request" in i && i.request instanceof Request && (s.request = Vr(i.request, Ye(this, X)), s.user = Wr(s.user ?? {}, i.request, Ye(this, X))), "requestData" in i && (s.request ? s.request.data = i.requestData : s.request = { data: i.requestData })), s;
2128
2128
  });
2129
2129
  }
2130
2130
  };
@@ -2132,9 +2132,9 @@ var Ue = Be;
2132
2132
  X = /* @__PURE__ */ new WeakMap(), fe(Ue, "id", "RequestData");
2133
2133
  function Wr(t, e, n) {
2134
2134
  let r = e.headers.get("CF-Connecting-IP"), { allowedIps: s } = n, i = { ...t };
2135
- return !("ip_address" in t) && r && s !== void 0 && Vr(r, s) && (i.ip_address = r), Object.keys(i).length > 0 ? i : void 0;
2135
+ return !("ip_address" in t) && r && s !== void 0 && Kr(r, s) && (i.ip_address = r), Object.keys(i).length > 0 ? i : void 0;
2136
2136
  }
2137
- function Kr(t, e) {
2137
+ function Vr(t, e) {
2138
2138
  let n = t.headers.get("cookie"), r;
2139
2139
  if (n) try {
2140
2140
  r = Jr(n);
@@ -2159,7 +2159,7 @@ function Kr(t, e) {
2159
2159
  } else delete i.query_string;
2160
2160
  return i;
2161
2161
  }
2162
- function Vr(t, e) {
2162
+ function Kr(t, e) {
2163
2163
  return typeof e == "boolean" ? e : e instanceof RegExp ? e.test(t) : Array.isArray(e) ? e.map((r) => r.toLowerCase()).includes(t) : false;
2164
2164
  }
2165
2165
  function yt(t, e) {
@@ -2250,7 +2250,7 @@ var Ge = class extends Y {
2250
2250
  let r = Lr();
2251
2251
  r !== void 0 && (e.release = r);
2252
2252
  }
2253
- let n = new Tt({ ...e, transport: ts, integrations: gt(e), stackParser: Ve(e.stackParser || es), transportOptions: { ...e.transportOptions, context: e.context } });
2253
+ let n = new Tt({ ...e, transport: ts, integrations: gt(e), stackParser: Ke(e.stackParser || es), transportOptions: { ...e.transportOptions, context: e.context } });
2254
2254
  super(n), n.setSdk(this), n.setupIntegrations();
2255
2255
  }
2256
2256
  setRequestBody(e) {
@@ -2263,12 +2263,10 @@ var Ge = class extends Y {
2263
2263
  return e.status === "in_progress" && this.setContext("monitor", { slug: e.monitorSlug }), this.getClient().captureCheckIn(e, n, r);
2264
2264
  }
2265
2265
  };
2266
- function wn(t, e, n, r, s) {
2266
+ function vn(t, e, n, r, s, i, o, a) {
2267
2267
  if (!(n && r && s)) return;
2268
- let i = new Ge({ dsn: n, request: t, context: e, sampleRate: 1, requestDataOptions: { allowedHeaders: ["user-agent", "cf-challenge", "accept-encoding", "accept-language", "cf-ray", "content-length", "content-type", "host"], allowedSearchParams: /(.*)/ }, transportOptions: { headers: { "CF-Access-Client-ID": r, "CF-Access-Client-Secret": s } } }), o = t.cf?.colo ?? "UNKNOWN";
2269
- i.setTag("colo", o);
2270
- let a = t.headers.get("user-agent") ?? "UA UNKNOWN";
2271
- return i.setUser({ userAgent: a, colo: o }), i;
2268
+ let c = new Ge({ dsn: n, request: t, context: e, sampleRate: 1, requestDataOptions: { allowedHeaders: ["user-agent", "cf-challenge", "accept-encoding", "accept-language", "cf-ray", "content-length", "content-type", "host"], allowedSearchParams: /(.*)/ }, transportOptions: { headers: { "CF-Access-Client-ID": r, "CF-Access-Client-Secret": s } } });
2269
+ return i && (c.setTag("colo", i.coloId), c.setTag("metal", i.metalId)), o && a && (c.setTag("accountId", o), c.setTag("scriptId", a)), c.setUser({ id: o?.toString() }), c;
2272
2270
  }
2273
2271
  var Le = class {
2274
2272
  constructor(e) {
@@ -2282,15 +2280,15 @@ var Le = class {
2282
2280
  return this.data[e];
2283
2281
  }
2284
2282
  write() {
2285
- this.readyAnalytics && this.readyAnalytics.logEvent({ version: 1, accountId: 0, indexId: this.data.hostname?.substring(0, 96), doubles: [this.data.requestTime ?? -1, this.data.coloId ?? -1, this.data.metalId ?? -1, this.data.coloTier ?? -1, this.data.userWorkerAhead === void 0 ? -1 : Number(this.data.userWorkerAhead)], blobs: [this.data.hostname?.substring(0, 256), this.data.dispatchtype, this.data.error?.substring(0, 256), this.data.version, this.data.coloRegion] });
2283
+ this.readyAnalytics && this.readyAnalytics.logEvent({ version: 1, accountId: this.data.accountId, indexId: this.data.scriptId?.toString(), doubles: [this.data.requestTime ?? -1, this.data.coloId ?? -1, this.data.metalId ?? -1, this.data.coloTier ?? -1, this.data.userWorkerAhead === void 0 ? -1 : Number(this.data.userWorkerAhead)], blobs: [this.data.hostname?.substring(0, 256), this.data.dispatchtype, this.data.error?.substring(0, 256), this.data.version, this.data.coloRegion] });
2286
2284
  }
2287
2285
  };
2288
2286
  var Za = { async fetch(t, e, n) {
2289
2287
  let r, s = new Le(e.ANALYTICS), i = new pe(e.UNSAFE_PERFORMANCE), o = i.now();
2290
2288
  try {
2291
- r = wn(t, n, e.SENTRY_DSN, e.SENTRY_ACCESS_CLIENT_ID, e.SENTRY_ACCESS_CLIENT_SECRET);
2289
+ r = vn(t, n, e.SENTRY_DSN, e.SENTRY_ACCESS_CLIENT_ID, e.SENTRY_ACCESS_CLIENT_SECRET, e.COLO_METADATA, e.CONFIG?.account_id, e.CONFIG?.script_id);
2292
2290
  let a = new URL(t.url);
2293
- r && (r.setUser({ username: a.hostname }), r.setTag("colo", e.COLO_METADATA.coloId), r.setTag("metal", e.COLO_METADATA.metalId)), e.COLO_METADATA && e.VERSION_METADATA && e.CONFIG && s.setData({ coloId: e.COLO_METADATA.coloId, metalId: e.COLO_METADATA.metalId, coloTier: e.COLO_METADATA.coloTier, coloRegion: e.COLO_METADATA.coloRegion, hostname: a.hostname, version: e.VERSION_METADATA.id, userWorkerAhead: e.CONFIG.invoke_user_worker_ahead_of_assets });
2291
+ e.COLO_METADATA && e.VERSION_METADATA && e.CONFIG && s.setData({ accountId: e.CONFIG.account_id, scriptId: e.CONFIG.script_id, coloId: e.COLO_METADATA.coloId, metalId: e.COLO_METADATA.metalId, coloTier: e.COLO_METADATA.coloTier, coloRegion: e.COLO_METADATA.coloRegion, hostname: a.hostname, version: e.VERSION_METADATA.id, userWorkerAhead: e.CONFIG.invoke_user_worker_ahead_of_assets });
2294
2292
  let c = t.clone();
2295
2293
  if (e.CONFIG.invoke_user_worker_ahead_of_assets) {
2296
2294
  if (!e.CONFIG.has_user_worker) throw new Error("Fetch for user worker without having a user worker binding");
package/dist/index.d.ts CHANGED
@@ -19,6 +19,13 @@ interface PluginConfig extends EntryWorkerConfig {
19
19
  persistState?: PersistState;
20
20
  }
21
21
 
22
+ /**
23
+ * Vite plugin that enables a full-featured integration between Vite and the Cloudflare Workers runtime.
24
+ *
25
+ * See the [README](https://github.com/cloudflare/workers-sdk/tree/main/packages/vite-plugin-cloudflare#readme) for more details.
26
+ *
27
+ * @param pluginConfig An optional {@link PluginConfig} object.
28
+ */
22
29
  declare function cloudflare(pluginConfig?: PluginConfig): vite.Plugin;
23
30
 
24
31
  export { cloudflare };
package/dist/index.js CHANGED
@@ -1268,7 +1268,10 @@ var CloudflareDevEnvironment = class extends vite2.DevEnvironment {
1268
1268
  }
1269
1269
  }
1270
1270
  );
1271
- assert(response.ok, "Failed to initialize module runner");
1271
+ assert(
1272
+ response.ok,
1273
+ `Failed to initialize module runner, error: ${await response.text()}`
1274
+ );
1272
1275
  const webSocket = response.webSocket;
1273
1276
  assert(webSocket, "Failed to establish WebSocket");
1274
1277
  webSocket.accept();
@@ -1531,7 +1531,14 @@ function createWorkerEntrypointWrapper(entrypoint) {
1531
1531
  const url = new URL(request.url);
1532
1532
  if (url.pathname === INIT_PATH) {
1533
1533
  const { 0: client, 1: server } = new WebSocketPair();
1534
- createModuleRunner(this.env, server);
1534
+ try {
1535
+ await createModuleRunner(this.env, server);
1536
+ } catch (e) {
1537
+ return new Response(
1538
+ e instanceof Error ? e.message : JSON.stringify(e),
1539
+ { status: 500 }
1540
+ );
1541
+ }
1535
1542
  return new Response(null, { status: 101, webSocket: client });
1536
1543
  }
1537
1544
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudflare/vite-plugin",
3
- "version": "0.0.0-a225f8a28",
3
+ "version": "0.0.0-a2f695b96",
4
4
  "description": "Cloudflare plugin for Vite",
5
5
  "keywords": [
6
6
  "cloudflare",
@@ -36,23 +36,23 @@
36
36
  "@hattip/adapter-node": "^0.0.49",
37
37
  "unenv": "npm:unenv-nightly@2.0.0-20241218-183400-5d6aec3",
38
38
  "ws": "^8.18.0",
39
- "miniflare": "0.0.0-a225f8a28"
39
+ "miniflare": "0.0.0-a2f695b96"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@cloudflare/workers-types": "^4.20241230.0",
43
43
  "@types/node": "^22.10.1",
44
44
  "@types/ws": "^8.5.13",
45
45
  "magic-string": "^0.30.12",
46
- "tsup": "^8.3.0",
46
+ "tsup": "8.3.0",
47
47
  "typescript": "^5.7.2",
48
48
  "vite": "^6.0.7",
49
- "@cloudflare/workers-shared": "0.0.0-a225f8a28",
50
- "wrangler": "0.0.0-a225f8a28",
51
- "@cloudflare/workers-tsconfig": "0.0.0"
49
+ "@cloudflare/workers-shared": "0.0.0-a2f695b96",
50
+ "@cloudflare/workers-tsconfig": "0.0.0",
51
+ "wrangler": "0.0.0-a2f695b96"
52
52
  },
53
53
  "peerDependencies": {
54
54
  "vite": "^6.0.7",
55
- "wrangler": "^0.0.0-a225f8a28"
55
+ "wrangler": "^3.101.0"
56
56
  },
57
57
  "publishConfig": {
58
58
  "access": "public"
@@ -63,8 +63,8 @@
63
63
  "scripts": {
64
64
  "build": "tsup",
65
65
  "check:type": "tsc --build",
66
+ "dev": "tsup --watch",
66
67
  "test": "vitest",
67
- "test:ci": "vitest run",
68
- "watch": "tsup --watch"
68
+ "test:ci": "vitest run"
69
69
  }
70
70
  }