@cloudflare/vite-plugin 0.0.0-cd319710a → 0.0.0-ce165ff11
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/README.md +34 -53
- package/dist/asset-workers/asset-worker.js +86 -94
- package/dist/index.d.ts +0 -7
- package/dist/index.js +1 -4
- package/dist/runner-worker/index.js +1 -8
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# `@cloudflare/vite-plugin`
|
|
2
2
|
|
|
3
|
-
[Intro](#intro) | [Quick start](#quick-start) | [Tutorial](#tutorial) | [API](#api) | [Cloudflare environments](#
|
|
3
|
+
[Intro](#intro) | [Quick start](#quick-start) | [Tutorial](#tutorial) | [API](#api) | [Cloudflare environments](#worker-environments) | [Migrating from `wrangler dev`](#migrating-from-wrangler-dev)
|
|
4
4
|
|
|
5
5
|
## Intro
|
|
6
6
|
|
|
@@ -16,42 +16,23 @@ Your Worker code runs inside [workerd](https://github.com/cloudflare/workerd), m
|
|
|
16
16
|
|
|
17
17
|
## Quick start
|
|
18
18
|
|
|
19
|
-
### Start with a basic `package.json`
|
|
20
|
-
|
|
21
|
-
```json
|
|
22
|
-
{
|
|
23
|
-
"name": "cloudflare-vite-quick-start",
|
|
24
|
-
"private": true,
|
|
25
|
-
"version": "0.0.0",
|
|
26
|
-
"type": "module",
|
|
27
|
-
"scripts": {
|
|
28
|
-
"dev": "vite",
|
|
29
|
-
"build": "vite build",
|
|
30
|
-
"preview": "vite preview"
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
> [!NOTE]
|
|
36
|
-
> Ensure that you include `"type": "module"` in order to use ES modules by default.
|
|
37
|
-
|
|
38
19
|
### Install the dependencies
|
|
39
20
|
|
|
40
21
|
```sh
|
|
41
|
-
npm install
|
|
22
|
+
npm install @cloudflare/vite-plugin wrangler --save-dev
|
|
42
23
|
```
|
|
43
24
|
|
|
44
|
-
###
|
|
25
|
+
### Add the plugin to your Vite config
|
|
45
26
|
|
|
46
27
|
```ts
|
|
47
28
|
// vite.config.ts
|
|
48
29
|
|
|
49
|
-
import { defineConfig } from
|
|
50
|
-
import { cloudflare } from
|
|
30
|
+
import { defineConfig } from 'vite'
|
|
31
|
+
import { cloudflare } from '@cloudflare/vite-plugin'
|
|
51
32
|
|
|
52
33
|
export default defineConfig({
|
|
53
34
|
plugins: [cloudflare()],
|
|
54
|
-
})
|
|
35
|
+
})
|
|
55
36
|
```
|
|
56
37
|
|
|
57
38
|
### Create your Worker config file
|
|
@@ -59,7 +40,7 @@ export default defineConfig({
|
|
|
59
40
|
```toml
|
|
60
41
|
# wrangler.toml
|
|
61
42
|
|
|
62
|
-
name = "
|
|
43
|
+
name = "my-worker"
|
|
63
44
|
compatibility_date = "2024-12-30"
|
|
64
45
|
main = "./src/index.ts"
|
|
65
46
|
```
|
|
@@ -71,12 +52,12 @@ main = "./src/index.ts"
|
|
|
71
52
|
|
|
72
53
|
export default {
|
|
73
54
|
fetch() {
|
|
74
|
-
return new Response(`Running in ${navigator.userAgent}!`)
|
|
55
|
+
return new Response(`Running in ${navigator.userAgent}!`)
|
|
75
56
|
},
|
|
76
|
-
}
|
|
57
|
+
}
|
|
77
58
|
```
|
|
78
59
|
|
|
79
|
-
You can now develop (`
|
|
60
|
+
You can now develop (`vite dev`), build (`vite build`), preview (`vite preview`), and deploy (`wrangler deploy`) your application.
|
|
80
61
|
|
|
81
62
|
## Tutorial
|
|
82
63
|
|
|
@@ -107,13 +88,13 @@ npm install @cloudflare/vite-plugin wrangler --save-dev
|
|
|
107
88
|
```ts
|
|
108
89
|
// vite.config.ts
|
|
109
90
|
|
|
110
|
-
import { defineConfig } from
|
|
111
|
-
import react from
|
|
112
|
-
import { cloudflare } from
|
|
91
|
+
import { defineConfig } from 'vite'
|
|
92
|
+
import react from '@vitejs/plugin-react'
|
|
93
|
+
import { cloudflare } from '@cloudflare/vite-plugin'
|
|
113
94
|
|
|
114
95
|
export default defineConfig({
|
|
115
96
|
plugins: [react(), cloudflare()],
|
|
116
|
-
})
|
|
97
|
+
})
|
|
117
98
|
```
|
|
118
99
|
|
|
119
100
|
#### Create your Worker config file
|
|
@@ -200,22 +181,22 @@ The assets `binding` defined here will allow you to access the assets functional
|
|
|
200
181
|
// api/index.ts
|
|
201
182
|
|
|
202
183
|
interface Env {
|
|
203
|
-
ASSETS: Fetcher
|
|
184
|
+
ASSETS: Fetcher
|
|
204
185
|
}
|
|
205
186
|
|
|
206
187
|
export default {
|
|
207
188
|
fetch(request, env) {
|
|
208
|
-
const url = new URL(request.url)
|
|
189
|
+
const url = new URL(request.url)
|
|
209
190
|
|
|
210
|
-
if (url.pathname.startsWith(
|
|
191
|
+
if (url.pathname.startsWith('/api/')) {
|
|
211
192
|
return Response.json({
|
|
212
|
-
name:
|
|
213
|
-
})
|
|
193
|
+
name: 'Cloudflare',
|
|
194
|
+
})
|
|
214
195
|
}
|
|
215
196
|
|
|
216
|
-
return env.ASSETS.fetch(request)
|
|
197
|
+
return env.ASSETS.fetch(request)
|
|
217
198
|
},
|
|
218
|
-
} satisfies ExportedHandler<Env
|
|
199
|
+
} satisfies ExportedHandler<Env>
|
|
219
200
|
```
|
|
220
201
|
|
|
221
202
|
The Worker above will be invoked for any request not matching a static asset.
|
|
@@ -230,14 +211,14 @@ Replace the file contents with the following code:
|
|
|
230
211
|
```tsx
|
|
231
212
|
// src/App.tsx
|
|
232
213
|
|
|
233
|
-
import { useState } from
|
|
234
|
-
import reactLogo from
|
|
235
|
-
import viteLogo from
|
|
236
|
-
import
|
|
214
|
+
import { useState } from 'react'
|
|
215
|
+
import reactLogo from './assets/react.svg'
|
|
216
|
+
import viteLogo from '/vite.svg'
|
|
217
|
+
import './App.css'
|
|
237
218
|
|
|
238
219
|
function App() {
|
|
239
|
-
const [count, setCount] = useState(0)
|
|
240
|
-
const [name, setName] = useState(
|
|
220
|
+
const [count, setCount] = useState(0)
|
|
221
|
+
const [name, setName] = useState('unknown')
|
|
241
222
|
|
|
242
223
|
return (
|
|
243
224
|
<>
|
|
@@ -264,9 +245,9 @@ function App() {
|
|
|
264
245
|
<div className="card">
|
|
265
246
|
<button
|
|
266
247
|
onClick={() => {
|
|
267
|
-
fetch(
|
|
248
|
+
fetch('/api/')
|
|
268
249
|
.then((res) => res.json() as Promise<{ name: string }>)
|
|
269
|
-
.then((data) => setName(data.name))
|
|
250
|
+
.then((data) => setName(data.name))
|
|
270
251
|
}}
|
|
271
252
|
aria-label="get name"
|
|
272
253
|
>
|
|
@@ -280,10 +261,10 @@ function App() {
|
|
|
280
261
|
Click on the Vite and React logos to learn more
|
|
281
262
|
</p>
|
|
282
263
|
</>
|
|
283
|
-
)
|
|
264
|
+
)
|
|
284
265
|
}
|
|
285
266
|
|
|
286
|
-
export default App
|
|
267
|
+
export default App
|
|
287
268
|
```
|
|
288
269
|
|
|
289
270
|
Now, if you click the button, it will display 'Name from API is: Cloudflare'.
|
|
@@ -329,12 +310,12 @@ The `cloudflare` plugin should be included in the Vite `plugins` array:
|
|
|
329
310
|
```ts
|
|
330
311
|
// vite.config.ts
|
|
331
312
|
|
|
332
|
-
import { defineConfig } from
|
|
333
|
-
import { cloudflare } from
|
|
313
|
+
import { defineConfig } from 'vite'
|
|
314
|
+
import { cloudflare } from '@cloudflare/vite-plugin'
|
|
334
315
|
|
|
335
316
|
export default defineConfig({
|
|
336
317
|
plugins: [cloudflare()],
|
|
337
|
-
})
|
|
318
|
+
})
|
|
338
319
|
```
|
|
339
320
|
|
|
340
321
|
It accepts an optional `PluginConfig` parameter.
|
|
@@ -34,13 +34,13 @@ function L(t) {
|
|
|
34
34
|
function Ht(t, e) {
|
|
35
35
|
return Gt.call(t) === `[object ${e}]`;
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function j(t) {
|
|
38
38
|
return Ht(t, "String");
|
|
39
39
|
}
|
|
40
40
|
function ge(t) {
|
|
41
41
|
return t === null || typeof t != "object" && typeof t != "function";
|
|
42
42
|
}
|
|
43
|
-
function
|
|
43
|
+
function R(t) {
|
|
44
44
|
return Ht(t, "Object");
|
|
45
45
|
}
|
|
46
46
|
function et(t) {
|
|
@@ -53,7 +53,7 @@ function B(t) {
|
|
|
53
53
|
return !!(t && t.then && typeof t.then == "function");
|
|
54
54
|
}
|
|
55
55
|
function nt(t) {
|
|
56
|
-
return
|
|
56
|
+
return R(t) && "nativeEvent" in t && "preventDefault" in t && "stopPropagation" in t;
|
|
57
57
|
}
|
|
58
58
|
function ee(t) {
|
|
59
59
|
return typeof t == "number" && t !== t;
|
|
@@ -104,19 +104,19 @@ function ar(t, e) {
|
|
|
104
104
|
if (u && u.length) u.forEach((d) => {
|
|
105
105
|
r.push(`[${d[0]}="${d[1]}"]`);
|
|
106
106
|
});
|
|
107
|
-
else if (n.id && r.push(`#${n.id}`), s = n.className, s &&
|
|
107
|
+
else if (n.id && r.push(`#${n.id}`), s = n.className, s && j(s)) for (i = s.split(/\s+/), c = 0; c < i.length; c++) r.push(`.${i[c]}`);
|
|
108
108
|
let l = ["aria-label", "type", "name", "title", "alt"];
|
|
109
109
|
for (c = 0; c < l.length; c++) o = l[c], a = n.getAttribute(o), a && r.push(`[${o}="${a}"]`);
|
|
110
110
|
return r.join("");
|
|
111
111
|
}
|
|
112
112
|
var cr = "Sentry Logger ";
|
|
113
113
|
var ne = ["debug", "info", "warn", "error", "log", "assert", "trace"];
|
|
114
|
-
var
|
|
114
|
+
var q = {};
|
|
115
115
|
function ye(t) {
|
|
116
116
|
if (!("console" in h)) return t();
|
|
117
|
-
let e = h.console, n = {}, r = Object.keys(
|
|
117
|
+
let e = h.console, n = {}, r = Object.keys(q);
|
|
118
118
|
r.forEach((s) => {
|
|
119
|
-
let i =
|
|
119
|
+
let i = q[s];
|
|
120
120
|
n[s] = e[s], e[s] = i;
|
|
121
121
|
});
|
|
122
122
|
try {
|
|
@@ -188,7 +188,7 @@ function I(t, e, n) {
|
|
|
188
188
|
let r = t[e], s = n(r);
|
|
189
189
|
typeof s == "function" && Vt(s, r), t[e] = s;
|
|
190
190
|
}
|
|
191
|
-
function
|
|
191
|
+
function W(t, e, n) {
|
|
192
192
|
try {
|
|
193
193
|
Object.defineProperty(t, e, { value: n, writable: true, configurable: true });
|
|
194
194
|
} catch {
|
|
@@ -198,7 +198,7 @@ function z(t, e, n) {
|
|
|
198
198
|
function Vt(t, e) {
|
|
199
199
|
try {
|
|
200
200
|
let n = e.prototype || {};
|
|
201
|
-
t.prototype = e.prototype = n,
|
|
201
|
+
t.prototype = e.prototype = n, W(t, "__sentry_original__", e);
|
|
202
202
|
} catch {
|
|
203
203
|
}
|
|
204
204
|
}
|
|
@@ -240,7 +240,7 @@ function E(t) {
|
|
|
240
240
|
return st(t, /* @__PURE__ */ new Map());
|
|
241
241
|
}
|
|
242
242
|
function st(t, e) {
|
|
243
|
-
if (
|
|
243
|
+
if (R(t)) {
|
|
244
244
|
let n = e.get(t);
|
|
245
245
|
if (n !== void 0) return n;
|
|
246
246
|
let r = {};
|
|
@@ -353,9 +353,9 @@ function tn() {
|
|
|
353
353
|
}
|
|
354
354
|
return t;
|
|
355
355
|
}
|
|
356
|
-
var
|
|
356
|
+
var xe = N();
|
|
357
357
|
function nn() {
|
|
358
|
-
let t =
|
|
358
|
+
let t = xe.chrome, e = t && t.app && t.app.runtime, n = "history" in xe && !!xe.history.pushState && !!xe.history.replaceState;
|
|
359
359
|
return !e && n;
|
|
360
360
|
}
|
|
361
361
|
var y = N();
|
|
@@ -383,7 +383,7 @@ function hr(t) {
|
|
|
383
383
|
br();
|
|
384
384
|
break;
|
|
385
385
|
case "unhandledrejection":
|
|
386
|
-
|
|
386
|
+
xr();
|
|
387
387
|
break;
|
|
388
388
|
default:
|
|
389
389
|
(typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && f.warn("unknown instrumentation type:", t);
|
|
@@ -406,9 +406,9 @@ Error:`, r);
|
|
|
406
406
|
function _r() {
|
|
407
407
|
"console" in h && ne.forEach(function(t) {
|
|
408
408
|
t in h.console && I(h.console, t, function(e) {
|
|
409
|
-
return
|
|
409
|
+
return q[t] = e, function(...n) {
|
|
410
410
|
A("console", { args: n, level: t });
|
|
411
|
-
let r =
|
|
411
|
+
let r = q[t];
|
|
412
412
|
r && r.apply(h.console, n);
|
|
413
413
|
};
|
|
414
414
|
});
|
|
@@ -444,8 +444,8 @@ function un() {
|
|
|
444
444
|
let t = XMLHttpRequest.prototype;
|
|
445
445
|
I(t, "open", function(e) {
|
|
446
446
|
return function(...n) {
|
|
447
|
-
let r = Date.now(), s = n[1], i = this[ie] = { method:
|
|
448
|
-
|
|
447
|
+
let r = Date.now(), s = n[1], i = this[ie] = { method: j(n[0]) ? n[0].toUpperCase() : n[0], url: n[1], request_headers: {} };
|
|
448
|
+
j(s) && i.method === "POST" && s.match(/sentry_key/) && (this.__sentry_own_request__ = true);
|
|
449
449
|
let o = () => {
|
|
450
450
|
let a = this[ie];
|
|
451
451
|
if (a && this.readyState === 4) {
|
|
@@ -474,13 +474,13 @@ function un() {
|
|
|
474
474
|
};
|
|
475
475
|
});
|
|
476
476
|
}
|
|
477
|
-
var
|
|
477
|
+
var Re;
|
|
478
478
|
function Er() {
|
|
479
479
|
if (!nn()) return;
|
|
480
480
|
let t = y.onpopstate;
|
|
481
481
|
y.onpopstate = function(...n) {
|
|
482
|
-
let r = y.location.href, s =
|
|
483
|
-
if (
|
|
482
|
+
let r = y.location.href, s = Re;
|
|
483
|
+
if (Re = r, A("history", { from: s, to: r }), t) try {
|
|
484
484
|
return t.apply(this, n);
|
|
485
485
|
} catch {
|
|
486
486
|
}
|
|
@@ -489,8 +489,8 @@ function Er() {
|
|
|
489
489
|
return function(...r) {
|
|
490
490
|
let s = r.length > 2 ? r[2] : void 0;
|
|
491
491
|
if (s) {
|
|
492
|
-
let i =
|
|
493
|
-
|
|
492
|
+
let i = Re, o = String(s);
|
|
493
|
+
Re = o, A("history", { from: i, to: o });
|
|
494
494
|
}
|
|
495
495
|
return n.apply(this, r);
|
|
496
496
|
};
|
|
@@ -521,7 +521,7 @@ function Tr(t) {
|
|
|
521
521
|
function an(t, e = false) {
|
|
522
522
|
return (n) => {
|
|
523
523
|
if (!n || n._sentryCaptured || Tr(n)) return;
|
|
524
|
-
|
|
524
|
+
W(n, "_sentryCaptured", true);
|
|
525
525
|
let r = n.type === "keypress" ? "input" : n.type;
|
|
526
526
|
(Ie === void 0 || !Sr(Ie, n)) && (t({ event: n, name: r, global: e }), Ie = n), clearTimeout(on), on = y.setTimeout(() => {
|
|
527
527
|
Ie = void 0;
|
|
@@ -565,7 +565,7 @@ function br() {
|
|
|
565
565
|
}, y.onerror.__SENTRY_INSTRUMENTED__ = true;
|
|
566
566
|
}
|
|
567
567
|
var Ae = null;
|
|
568
|
-
function
|
|
568
|
+
function xr() {
|
|
569
569
|
Ae = y.onunhandledrejection, y.onunhandledrejection = function(t) {
|
|
570
570
|
return A("unhandledrejection", t), Ae && !Ae.__SENTRY_LOADER__ ? Ae.apply(this, arguments) : true;
|
|
571
571
|
}, y.onunhandledrejection.__SENTRY_INSTRUMENTED__ = true;
|
|
@@ -604,7 +604,7 @@ function g() {
|
|
|
604
604
|
}
|
|
605
605
|
return ("10000000100040008000" + 1e11).replace(/[018]/g, (r) => (r ^ (n() & 15) >> r / 4).toString(16));
|
|
606
606
|
}
|
|
607
|
-
function
|
|
607
|
+
function Rr(t) {
|
|
608
608
|
return t.exception && t.exception.values ? t.exception.values[0] : void 0;
|
|
609
609
|
}
|
|
610
610
|
function ae(t, e, n) {
|
|
@@ -612,7 +612,7 @@ function ae(t, e, n) {
|
|
|
612
612
|
i.value || (i.value = e || ""), i.type || (i.type = n || "Error");
|
|
613
613
|
}
|
|
614
614
|
function ce(t, e) {
|
|
615
|
-
let n =
|
|
615
|
+
let n = Rr(t);
|
|
616
616
|
if (!n) return;
|
|
617
617
|
let r = { type: "generic", handled: true }, s = n.mechanism;
|
|
618
618
|
if (n.mechanism = { ...r, ...s, ...e }, e && "data" in e) {
|
|
@@ -623,7 +623,7 @@ function ce(t, e) {
|
|
|
623
623
|
function we(t) {
|
|
624
624
|
if (t && t.__sentry_captured__) return true;
|
|
625
625
|
try {
|
|
626
|
-
|
|
626
|
+
W(t, "__sentry_captured__", true);
|
|
627
627
|
} catch {
|
|
628
628
|
}
|
|
629
629
|
return false;
|
|
@@ -638,9 +638,9 @@ function D(t, e = 100, n = 1 / 0) {
|
|
|
638
638
|
return { ERROR: `**non-serializable** (${r})` };
|
|
639
639
|
}
|
|
640
640
|
}
|
|
641
|
-
function
|
|
641
|
+
function z(t, e = 3, n = 100 * 1024) {
|
|
642
642
|
let r = D(t, e);
|
|
643
|
-
return Dr(r) > n ?
|
|
643
|
+
return Dr(r) > n ? z(t, e - 1, n) : r;
|
|
644
644
|
}
|
|
645
645
|
function Oe(t, e, n = 1 / 0, r = 1 / 0, s = mn()) {
|
|
646
646
|
let [i, o] = s;
|
|
@@ -951,11 +951,11 @@ function bt(t, { statusCode: e, headers: n }, r = Date.now()) {
|
|
|
951
951
|
else o ? s.all = r + gn(o, r) : e === 429 && (s.all = r + 60 * 1e3);
|
|
952
952
|
return s;
|
|
953
953
|
}
|
|
954
|
-
function
|
|
954
|
+
function xt(t, e) {
|
|
955
955
|
return t(e.stack || "", 1);
|
|
956
956
|
}
|
|
957
957
|
function yn(t, e) {
|
|
958
|
-
let n = { type: e.name || e.constructor.name, value: e.message }, r =
|
|
958
|
+
let n = { type: e.name || e.constructor.name, value: e.message }, r = xt(t, e);
|
|
959
959
|
return r.length && (n.stacktrace = { frames: r }), n;
|
|
960
960
|
}
|
|
961
961
|
function Lr(t) {
|
|
@@ -964,13 +964,13 @@ function Lr(t) {
|
|
|
964
964
|
return "message" in t && typeof t.message == "string" && (e += ` with message '${t.message}'`), e;
|
|
965
965
|
} else return "message" in t && typeof t.message == "string" ? t.message : `Object captured as exception with keys: ${re(t)}`;
|
|
966
966
|
}
|
|
967
|
-
function
|
|
967
|
+
function Rt(t, e, n, r) {
|
|
968
968
|
let s = n, o = r && r.data && r.data.mechanism || { handled: true, type: "generic" };
|
|
969
969
|
if (!L(n)) {
|
|
970
|
-
if (
|
|
970
|
+
if (R(n)) {
|
|
971
971
|
let c = t(), u = c.getClient(), l = u && u.getOptions().normalizeDepth;
|
|
972
972
|
c.configureScope((p) => {
|
|
973
|
-
p.setExtra("__serialized__",
|
|
973
|
+
p.setExtra("__serialized__", z(n, l));
|
|
974
974
|
});
|
|
975
975
|
let d = Lr(n);
|
|
976
976
|
s = r && r.syntheticException || new Error(d), s.message = d;
|
|
@@ -983,25 +983,25 @@ function xt(t, e, n, r) {
|
|
|
983
983
|
function It(t, e, n = "info", r, s) {
|
|
984
984
|
let i = { event_id: r && r.event_id, level: n, message: e };
|
|
985
985
|
if (s && r && r.syntheticException) {
|
|
986
|
-
let o =
|
|
986
|
+
let o = xt(t, r.syntheticException);
|
|
987
987
|
o.length && (i.exception = { values: [{ value: e, stacktrace: { frames: o } }] });
|
|
988
988
|
}
|
|
989
989
|
return i;
|
|
990
990
|
}
|
|
991
|
-
var
|
|
991
|
+
var V = "production";
|
|
992
992
|
function le() {
|
|
993
993
|
return te("globalEventProcessors", () => []);
|
|
994
994
|
}
|
|
995
995
|
function Sn(t) {
|
|
996
996
|
le().push(t);
|
|
997
997
|
}
|
|
998
|
-
function
|
|
998
|
+
function J(t, e, n, r = 0) {
|
|
999
999
|
return new S((s, i) => {
|
|
1000
1000
|
let o = t[r];
|
|
1001
1001
|
if (e === null || typeof o != "function") s(e);
|
|
1002
1002
|
else {
|
|
1003
1003
|
let a = o({ ...e }, n);
|
|
1004
|
-
(typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && o.id && a === null && f.log(`Event processor "${o.id}" dropped event`), B(a) ? a.then((c) =>
|
|
1004
|
+
(typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && o.id && a === null && f.log(`Event processor "${o.id}" dropped event`), B(a) ? a.then((c) => J(t, c, n, r + 1).then(s)).then(null, i) : J(t, a, n, r + 1).then(s).then(null, i);
|
|
1005
1005
|
}
|
|
1006
1006
|
});
|
|
1007
1007
|
}
|
|
@@ -1028,7 +1028,7 @@ function Br(t) {
|
|
|
1028
1028
|
var Fr = 100;
|
|
1029
1029
|
var w = class {
|
|
1030
1030
|
constructor() {
|
|
1031
|
-
this._notifyingListeners = false, this._scopeListeners = [], this._eventProcessors = [], this._breadcrumbs = [], this._attachments = [], this._user = {}, this._tags = {}, this._extra = {}, this._contexts = {}, this._sdkProcessingMetadata = {}, this._propagationContext =
|
|
1031
|
+
this._notifyingListeners = false, this._scopeListeners = [], this._eventProcessors = [], this._breadcrumbs = [], this._attachments = [], this._user = {}, this._tags = {}, this._extra = {}, this._contexts = {}, this._sdkProcessingMetadata = {}, this._propagationContext = xn();
|
|
1032
1032
|
}
|
|
1033
1033
|
static clone(e) {
|
|
1034
1034
|
let n = new w();
|
|
@@ -1098,10 +1098,10 @@ var w = class {
|
|
|
1098
1098
|
let n = e(this);
|
|
1099
1099
|
return n instanceof w ? n : this;
|
|
1100
1100
|
}
|
|
1101
|
-
return e instanceof w ? (this._tags = { ...this._tags, ...e._tags }, this._extra = { ...this._extra, ...e._extra }, this._contexts = { ...this._contexts, ...e._contexts }, e._user && Object.keys(e._user).length && (this._user = e._user), e._level && (this._level = e._level), e._fingerprint && (this._fingerprint = e._fingerprint), e._requestSession && (this._requestSession = e._requestSession), e._propagationContext && (this._propagationContext = e._propagationContext)) :
|
|
1101
|
+
return e instanceof w ? (this._tags = { ...this._tags, ...e._tags }, this._extra = { ...this._extra, ...e._extra }, this._contexts = { ...this._contexts, ...e._contexts }, e._user && Object.keys(e._user).length && (this._user = e._user), e._level && (this._level = e._level), e._fingerprint && (this._fingerprint = e._fingerprint), e._requestSession && (this._requestSession = e._requestSession), e._propagationContext && (this._propagationContext = e._propagationContext)) : R(e) && (e = e, this._tags = { ...this._tags, ...e.tags }, this._extra = { ...this._extra, ...e.extra }, this._contexts = { ...this._contexts, ...e.contexts }, e.user && (this._user = e.user), e.level && (this._level = e.level), e.fingerprint && (this._fingerprint = e.fingerprint), e.requestSession && (this._requestSession = e.requestSession), e.propagationContext && (this._propagationContext = e.propagationContext)), this;
|
|
1102
1102
|
}
|
|
1103
1103
|
clear() {
|
|
1104
|
-
return this._breadcrumbs = [], this._tags = {}, this._extra = {}, this._user = {}, this._contexts = {}, this._level = void 0, this._transactionName = void 0, this._fingerprint = void 0, this._requestSession = void 0, this._span = void 0, this._session = void 0, this._notifyScopeListeners(), this._attachments = [], this._propagationContext =
|
|
1104
|
+
return this._breadcrumbs = [], this._tags = {}, this._extra = {}, this._user = {}, this._contexts = {}, this._level = void 0, this._transactionName = void 0, this._fingerprint = void 0, this._requestSession = void 0, this._span = void 0, this._session = void 0, this._notifyScopeListeners(), this._attachments = [], this._propagationContext = xn(), this;
|
|
1105
1105
|
}
|
|
1106
1106
|
addBreadcrumb(e, n) {
|
|
1107
1107
|
let r = typeof n == "number" ? n : Fr;
|
|
@@ -1136,7 +1136,7 @@ var w = class {
|
|
|
1136
1136
|
}
|
|
1137
1137
|
this._applyFingerprint(e);
|
|
1138
1138
|
let s = this._getBreadcrumbs(), i = [...e.breadcrumbs || [], ...s];
|
|
1139
|
-
return e.breadcrumbs = i.length > 0 ? i : void 0, e.sdkProcessingMetadata = { ...e.sdkProcessingMetadata, ...this._sdkProcessingMetadata, propagationContext: this._propagationContext },
|
|
1139
|
+
return e.breadcrumbs = i.length > 0 ? i : void 0, e.sdkProcessingMetadata = { ...e.sdkProcessingMetadata, ...this._sdkProcessingMetadata, propagationContext: this._propagationContext }, J([...r || [], ...le(), ...this._eventProcessors], e, n);
|
|
1140
1140
|
}
|
|
1141
1141
|
setSDKProcessingMetadata(e) {
|
|
1142
1142
|
return this._sdkProcessingMetadata = { ...this._sdkProcessingMetadata, ...e }, this;
|
|
@@ -1159,13 +1159,13 @@ var w = class {
|
|
|
1159
1159
|
e.fingerprint = e.fingerprint ? ue(e.fingerprint) : [], this._fingerprint && (e.fingerprint = e.fingerprint.concat(this._fingerprint)), e.fingerprint && !e.fingerprint.length && delete e.fingerprint;
|
|
1160
1160
|
}
|
|
1161
1161
|
};
|
|
1162
|
-
function
|
|
1162
|
+
function xn() {
|
|
1163
1163
|
return { traceId: g(), spanId: g().substring(16) };
|
|
1164
1164
|
}
|
|
1165
|
-
var
|
|
1165
|
+
var Rn = 4;
|
|
1166
1166
|
var $r = 100;
|
|
1167
1167
|
var H = class {
|
|
1168
|
-
constructor(e, n = new w(), r =
|
|
1168
|
+
constructor(e, n = new w(), r = Rn) {
|
|
1169
1169
|
this._version = r, this._stack = [{ scope: n }], e && this.bindClient(e);
|
|
1170
1170
|
}
|
|
1171
1171
|
isOlderThan(e) {
|
|
@@ -1293,7 +1293,7 @@ Sentry.init({...});
|
|
|
1293
1293
|
r && bn(r), this._sendSessionUpdate(), n.setSession();
|
|
1294
1294
|
}
|
|
1295
1295
|
startSession(e) {
|
|
1296
|
-
let { scope: n, client: r } = this.getStackTop(), { release: s, environment: i =
|
|
1296
|
+
let { scope: n, client: r } = this.getStackTop(), { release: s, environment: i = V } = r && r.getOptions() || {}, { userAgent: o } = h.navigator || {}, a = Tn({ release: s, environment: i, user: n.getUser(), ...o && { userAgent: o }, ...e }), c = n.getSession && n.getSession();
|
|
1297
1297
|
return c && c.status === "ok" && C(c, { status: "exited" }), this.endSession(), n.setSession(a), a;
|
|
1298
1298
|
}
|
|
1299
1299
|
shouldSendDefaultPii() {
|
|
@@ -1321,7 +1321,7 @@ function Nt(t) {
|
|
|
1321
1321
|
let e = Y(), n = Pe(e);
|
|
1322
1322
|
return At(e, t), n;
|
|
1323
1323
|
}
|
|
1324
|
-
function
|
|
1324
|
+
function x() {
|
|
1325
1325
|
let t = Y();
|
|
1326
1326
|
if (t.__SENTRY__ && t.__SENTRY__.acs) {
|
|
1327
1327
|
let e = t.__SENTRY__.acs.getCurrentHub();
|
|
@@ -1330,7 +1330,7 @@ function R() {
|
|
|
1330
1330
|
return Gr(t);
|
|
1331
1331
|
}
|
|
1332
1332
|
function Gr(t = Y()) {
|
|
1333
|
-
return (!Hr(t) || Pe(t).isOlderThan(
|
|
1333
|
+
return (!Hr(t) || Pe(t).isOlderThan(Rn)) && At(t, new H()), Pe(t);
|
|
1334
1334
|
}
|
|
1335
1335
|
function Hr(t) {
|
|
1336
1336
|
return !!(t && t.__SENTRY__ && t.__SENTRY__.hub);
|
|
@@ -1344,7 +1344,7 @@ function At(t, e) {
|
|
|
1344
1344
|
return n.hub = e, true;
|
|
1345
1345
|
}
|
|
1346
1346
|
function In(t) {
|
|
1347
|
-
return (t ||
|
|
1347
|
+
return (t || x()).getScope().getTransaction();
|
|
1348
1348
|
}
|
|
1349
1349
|
var Nn = false;
|
|
1350
1350
|
function An() {
|
|
@@ -1366,7 +1366,7 @@ var Me = class {
|
|
|
1366
1366
|
this.spans.length > this._maxlen ? e.spanRecorder = void 0 : this.spans.push(e);
|
|
1367
1367
|
}
|
|
1368
1368
|
};
|
|
1369
|
-
var
|
|
1369
|
+
var K = class {
|
|
1370
1370
|
constructor(e = {}) {
|
|
1371
1371
|
this.traceId = e.traceId || g(), this.spanId = e.spanId || g().substring(16), this.startTimestamp = e.startTimestamp || G(), 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);
|
|
1372
1372
|
}
|
|
@@ -1377,7 +1377,7 @@ var X = class {
|
|
|
1377
1377
|
this.setName(e);
|
|
1378
1378
|
}
|
|
1379
1379
|
startChild(e) {
|
|
1380
|
-
let n = new
|
|
1380
|
+
let n = new K({ ...e, parentSpanId: this.spanId, sampled: this.sampled, traceId: this.traceId });
|
|
1381
1381
|
if (n.spanRecorder = this.spanRecorder, n.spanRecorder && n.spanRecorder.add(n), n.transaction = this.transaction, (typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && n.transaction) {
|
|
1382
1382
|
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}).`;
|
|
1383
1383
|
n.transaction.metadata.spanMetadata[n.spanId] = { logMessage: o }, f.log(o);
|
|
@@ -1457,13 +1457,13 @@ function Yr(t) {
|
|
|
1457
1457
|
}
|
|
1458
1458
|
return "unknown_error";
|
|
1459
1459
|
}
|
|
1460
|
-
function
|
|
1461
|
-
let r = e.getOptions(), { publicKey: s } = e.getDsn() || {}, { segment: i } = n && n.getUser() || {}, o = E({ environment: r.environment ||
|
|
1460
|
+
function X(t, e, n) {
|
|
1461
|
+
let r = e.getOptions(), { publicKey: s } = e.getDsn() || {}, { segment: i } = n && n.getUser() || {}, o = E({ environment: r.environment || V, release: r.release, user_segment: i, public_key: s, trace_id: t });
|
|
1462
1462
|
return e.emit && e.emit("createDsc", o), o;
|
|
1463
1463
|
}
|
|
1464
|
-
var Ue = class extends
|
|
1464
|
+
var Ue = class extends K {
|
|
1465
1465
|
constructor(e, n) {
|
|
1466
|
-
super(e), delete this.description, this._measurements = {}, this._contexts = {}, this._hub = n ||
|
|
1466
|
+
super(e), delete this.description, this._measurements = {}, this._contexts = {}, this._hub = n || x(), this._name = e.name || "", this.metadata = { source: "custom", ...e.metadata, spanMetadata: {} }, this._trimEnd = e.trimEnd, this.transaction = this;
|
|
1467
1467
|
let r = this.metadata.dynamicSamplingContext;
|
|
1468
1468
|
r && (this._frozenDynamicSamplingContext = { ...r });
|
|
1469
1469
|
}
|
|
@@ -1501,9 +1501,9 @@ var Ue = class extends X {
|
|
|
1501
1501
|
}
|
|
1502
1502
|
getDynamicSamplingContext() {
|
|
1503
1503
|
if (this._frozenDynamicSamplingContext) return this._frozenDynamicSamplingContext;
|
|
1504
|
-
let e = this._hub ||
|
|
1504
|
+
let e = this._hub || x(), n = e.getClient();
|
|
1505
1505
|
if (!n) return {};
|
|
1506
|
-
let r = e.getScope(), s =
|
|
1506
|
+
let r = e.getScope(), s = X(this.traceId, n, r), i = this.metadata.sampleRate;
|
|
1507
1507
|
i !== void 0 && (s.sample_rate = `${i}`);
|
|
1508
1508
|
let o = this.metadata.source;
|
|
1509
1509
|
return o && o !== "url" && (s.transaction = this.name), this.sampled !== void 0 && (s.sampled = String(this.sampled)), s;
|
|
@@ -1527,7 +1527,7 @@ var Ue = class extends X {
|
|
|
1527
1527
|
};
|
|
1528
1528
|
function Dn(t) {
|
|
1529
1529
|
if (typeof __SENTRY_TRACING__ == "boolean" && !__SENTRY_TRACING__) return false;
|
|
1530
|
-
let e =
|
|
1530
|
+
let e = x().getClient(), n = t || e && e.getOptions();
|
|
1531
1531
|
return !!n && (n.enableTracing || "tracesSampleRate" in n || "tracesSampler" in n);
|
|
1532
1532
|
}
|
|
1533
1533
|
function wn(t, e, n) {
|
|
@@ -1571,7 +1571,7 @@ var Le = class {
|
|
|
1571
1571
|
}
|
|
1572
1572
|
incrementSessionStatusCount() {
|
|
1573
1573
|
if (!this._isEnabled) return;
|
|
1574
|
-
let e =
|
|
1574
|
+
let e = x().getScope(), n = e.getRequestSession();
|
|
1575
1575
|
n && n.status && (this._incrementSessionStatusCount(n.status, /* @__PURE__ */ new Date()), e.setRequestSession(void 0));
|
|
1576
1576
|
}
|
|
1577
1577
|
_incrementSessionStatusCount(e, n) {
|
|
@@ -1645,7 +1645,7 @@ function Mn(t, e) {
|
|
|
1645
1645
|
}), n;
|
|
1646
1646
|
}
|
|
1647
1647
|
function Ot(t, e, n) {
|
|
1648
|
-
if (n[e.name] = e, Pn.indexOf(e.name) === -1 && (e.setupOnce(Sn,
|
|
1648
|
+
if (n[e.name] = e, Pn.indexOf(e.name) === -1 && (e.setupOnce(Sn, x), Pn.push(e.name)), t.on && typeof e.preprocessEvent == "function") {
|
|
1649
1649
|
let r = e.preprocessEvent.bind(e);
|
|
1650
1650
|
t.on("preprocessEvent", (s, i) => r(s, i, t));
|
|
1651
1651
|
}
|
|
@@ -1671,12 +1671,12 @@ function Ln(t, e, n, r, s) {
|
|
|
1671
1671
|
p.length && (n.attachments = p);
|
|
1672
1672
|
}
|
|
1673
1673
|
l = u.applyToEvent(a, n, d);
|
|
1674
|
-
} else l =
|
|
1674
|
+
} else l = J([...d, ...le()], a, n);
|
|
1675
1675
|
return l.then((p) => (p && ns(p), typeof i == "number" && i > 0 ? ss(p, i, o) : p));
|
|
1676
1676
|
}
|
|
1677
1677
|
function es(t, e) {
|
|
1678
1678
|
let { environment: n, release: r, dist: s, maxValueLength: i = 250 } = e;
|
|
1679
|
-
"environment" in t || (t.environment = "environment" in e ? n :
|
|
1679
|
+
"environment" in t || (t.environment = "environment" in e ? n : V), t.release === void 0 && r !== void 0 && (t.release = r), t.dist === void 0 && s !== void 0 && (t.dist = s), t.message && (t.message = P(t.message, i));
|
|
1680
1680
|
let o = t.exception && t.exception.values && t.exception.values[0];
|
|
1681
1681
|
o && o.value && (o.value = P(o.value, i));
|
|
1682
1682
|
let a = t.request;
|
|
@@ -1868,7 +1868,7 @@ var Be = class {
|
|
|
1868
1868
|
if (!(o.contexts && o.contexts.trace) && a) {
|
|
1869
1869
|
let { traceId: u, spanId: l, parentSpanId: d, dsc: p } = a;
|
|
1870
1870
|
o.contexts = { trace: { trace_id: u, span_id: l, parent_span_id: d }, ...o.contexts };
|
|
1871
|
-
let m = p ||
|
|
1871
|
+
let m = p || X(u, this, r);
|
|
1872
1872
|
o.sdkProcessingMetadata = { dynamicSamplingContext: m, ...o.sdkProcessingMetadata };
|
|
1873
1873
|
}
|
|
1874
1874
|
return o;
|
|
@@ -1926,12 +1926,12 @@ Reason: ${d}`));
|
|
|
1926
1926
|
function is(t, e) {
|
|
1927
1927
|
let n = `${e} must return \`null\` or a valid event.`;
|
|
1928
1928
|
if (B(t)) return t.then((r) => {
|
|
1929
|
-
if (!
|
|
1929
|
+
if (!R(r) && r !== null) throw new T(n);
|
|
1930
1930
|
return r;
|
|
1931
1931
|
}, (r) => {
|
|
1932
1932
|
throw new T(`${e} rejected with ${r}`);
|
|
1933
1933
|
});
|
|
1934
|
-
if (!
|
|
1934
|
+
if (!R(t) && t !== null) throw new T(n);
|
|
1935
1935
|
return t;
|
|
1936
1936
|
}
|
|
1937
1937
|
function os(t, e, n) {
|
|
@@ -1958,7 +1958,7 @@ var fe = class extends Be {
|
|
|
1958
1958
|
On(), super(e);
|
|
1959
1959
|
}
|
|
1960
1960
|
eventFromException(e, n) {
|
|
1961
|
-
return b(
|
|
1961
|
+
return b(Rt(x, this._options.stackParser, e, n));
|
|
1962
1962
|
}
|
|
1963
1963
|
eventFromMessage(e, n = "info", r) {
|
|
1964
1964
|
return b(It(this._options.stackParser, e, n, r, this._options.attachStacktrace));
|
|
@@ -2005,7 +2005,7 @@ var fe = class extends Be {
|
|
|
2005
2005
|
let n = e.getSpan();
|
|
2006
2006
|
if (n) return [n.transaction ? n.transaction.getDynamicSamplingContext() : void 0, n.getTraceContext()];
|
|
2007
2007
|
let { traceId: r, spanId: s, parentSpanId: i, dsc: o } = e.getPropagationContext(), a = { trace_id: r, span_id: s, parent_span_id: i };
|
|
2008
|
-
return o ? [o, a] : [
|
|
2008
|
+
return o ? [o, a] : [X(r, this, e), a];
|
|
2009
2009
|
}
|
|
2010
2010
|
};
|
|
2011
2011
|
var cs = 30;
|
|
@@ -2068,10 +2068,10 @@ function ps(t, e, n, r) {
|
|
|
2068
2068
|
let s, o = (r && r.data && ds(r.data) ? r.data.mechanism : void 0) ?? { handled: true, type: "generic" };
|
|
2069
2069
|
if (L(n)) s = n;
|
|
2070
2070
|
else {
|
|
2071
|
-
if (
|
|
2071
|
+
if (R(n)) {
|
|
2072
2072
|
let c = `Non-Error exception captured with keys: ${re(n)}`, u = t?.getClient(), l = u && u.getOptions().normalizeDepth;
|
|
2073
2073
|
t?.configureScope((d) => {
|
|
2074
|
-
d.setExtra("__serialized__",
|
|
2074
|
+
d.setExtra("__serialized__", z(n, l));
|
|
2075
2075
|
}), s = r && r.syntheticException || new Error(c), s.message = c;
|
|
2076
2076
|
} else s = r && r.syntheticException || new Error(n), s.message = n;
|
|
2077
2077
|
o.synthetic = true;
|
|
@@ -2115,22 +2115,22 @@ function zn(t, e, n, r = []) {
|
|
|
2115
2115
|
return zn(t, e, n.cause, [s, ...r]);
|
|
2116
2116
|
}
|
|
2117
2117
|
var gs = { allowedHeaders: ["CF-RAY", "CF-Worker"] };
|
|
2118
|
-
var
|
|
2118
|
+
var Z;
|
|
2119
2119
|
var Ye = class {
|
|
2120
2120
|
constructor(e = {}) {
|
|
2121
2121
|
he(this, "name", Ye.id);
|
|
2122
|
-
Ft(this,
|
|
2123
|
-
$t(this,
|
|
2122
|
+
Ft(this, Z, void 0);
|
|
2123
|
+
$t(this, Z, { ...gs, ...e });
|
|
2124
2124
|
}
|
|
2125
2125
|
setupOnce(e, n) {
|
|
2126
2126
|
n().getClient() && e((s) => {
|
|
2127
2127
|
let { sdkProcessingMetadata: i } = s;
|
|
2128
|
-
return !n().getIntegration(Ye) || !i || ("request" in i && i.request instanceof Request && (s.request = ys(i.request, Qe(this,
|
|
2128
|
+
return !n().getIntegration(Ye) || !i || ("request" in i && i.request instanceof Request && (s.request = ys(i.request, Qe(this, Z)), s.user = Es(s.user ?? {}, i.request, Qe(this, Z))), "requestData" in i && (s.request ? s.request.data = i.requestData : s.request = { data: i.requestData })), s;
|
|
2129
2129
|
});
|
|
2130
2130
|
}
|
|
2131
2131
|
};
|
|
2132
2132
|
var $e = Ye;
|
|
2133
|
-
|
|
2133
|
+
Z = /* @__PURE__ */ new WeakMap(), he($e, "id", "RequestData");
|
|
2134
2134
|
function Es(t, e, n) {
|
|
2135
2135
|
let r = e.headers.get("CF-Connecting-IP"), { allowedIps: s } = n, i = { ...t };
|
|
2136
2136
|
return !("ip_address" in t) && r && s !== void 0 && Ss(r, s) && (i.ip_address = r), Object.keys(i).length > 0 ? i : void 0;
|
|
@@ -2219,7 +2219,7 @@ var Ct = class extends fe {
|
|
|
2219
2219
|
this.getOptions().enabled = e;
|
|
2220
2220
|
}
|
|
2221
2221
|
};
|
|
2222
|
-
function
|
|
2222
|
+
function xs(t) {
|
|
2223
2223
|
let [e, n] = ct(t);
|
|
2224
2224
|
return [e, (s) => {
|
|
2225
2225
|
let i = n(s);
|
|
@@ -2230,10 +2230,10 @@ function Rs(t) {
|
|
|
2230
2230
|
return i;
|
|
2231
2231
|
}];
|
|
2232
2232
|
}
|
|
2233
|
-
function
|
|
2233
|
+
function Rs(t) {
|
|
2234
2234
|
if (t) return lt(t, ".js");
|
|
2235
2235
|
}
|
|
2236
|
-
var Is = be(Rs
|
|
2236
|
+
var Is = be(xs(Rs));
|
|
2237
2237
|
function Ns(t) {
|
|
2238
2238
|
function e({ body: n }) {
|
|
2239
2239
|
try {
|
|
@@ -2338,7 +2338,7 @@ var Ve = class extends Response {
|
|
|
2338
2338
|
super(e, { ...n, status: 405, statusText: "Method Not Allowed" });
|
|
2339
2339
|
}
|
|
2340
2340
|
};
|
|
2341
|
-
var
|
|
2341
|
+
var Q = class extends Response {
|
|
2342
2342
|
constructor(e, n) {
|
|
2343
2343
|
super(null, { ...n, status: 500 });
|
|
2344
2344
|
}
|
|
@@ -2370,7 +2370,7 @@ var Xn = async (t, e, n, r, s) => {
|
|
|
2370
2370
|
if (!["GET", "HEAD"].includes(u)) return new Ve();
|
|
2371
2371
|
let l = c.redirect ?? a, d = Ls(l);
|
|
2372
2372
|
if (d !== i && c.asset || c.redirect) return new Ke(d + o);
|
|
2373
|
-
if (!c.asset) return new
|
|
2373
|
+
if (!c.asset) return new Q(new Error("Unknown action"));
|
|
2374
2374
|
let p = await e.JAEGER.enterSpan("getByETag", async (rr) => (rr.setTags({ pathname: i, eTag: c.asset.eTag, status: c.asset.status }), await s(c.asset.eTag))), m = Kn(c.asset.eTag, p.contentType, t), O = `"${c.asset.eTag}"`, tr = `W/${O}`, nr = t.headers.get("If-None-Match") || "";
|
|
2375
2375
|
if ([tr, O].includes(nr)) return new Je(null, { headers: m });
|
|
2376
2376
|
let Lt = u === "HEAD" ? null : p.readableStream;
|
|
@@ -2539,25 +2539,17 @@ var er = class extends Fs {
|
|
|
2539
2539
|
e.setTag("colo", this.env.COLO_METADATA.coloId), e.setTag("metal", this.env.COLO_METADATA.metalId), e.setUser({ userAgent: o, colo: c });
|
|
2540
2540
|
}
|
|
2541
2541
|
let a = new URL(t.url);
|
|
2542
|
-
return this.env.COLO_METADATA && this.env.VERSION_METADATA && n.setData({ coloId: this.env.COLO_METADATA.coloId, metalId: this.env.COLO_METADATA.metalId, coloTier: this.env.COLO_METADATA.coloTier, coloRegion: this.env.COLO_METADATA.coloRegion, version: this.env.VERSION_METADATA.id, hostname: a.hostname, htmlHandling: i.html_handling, notFoundHandling: i.not_found_handling, userAgent: o }), this.env.JAEGER.enterSpan("handleRequest", async (c) => (c.setTags({ hostname: a.hostname, eyeballPath: a.pathname, env: this.env.ENVIRONMENT
|
|
2542
|
+
return this.env.COLO_METADATA && this.env.VERSION_METADATA && n.setData({ coloId: this.env.COLO_METADATA.coloId, metalId: this.env.COLO_METADATA.metalId, coloTier: this.env.COLO_METADATA.coloTier, coloRegion: this.env.COLO_METADATA.coloRegion, version: this.env.VERSION_METADATA.id, hostname: a.hostname, htmlHandling: i.html_handling, notFoundHandling: i.not_found_handling, userAgent: o }), this.env.JAEGER.enterSpan("handleRequest", async (c) => (c.setTags({ hostname: a.hostname, eyeballPath: a.pathname, env: this.env.ENVIRONMENT }), Xn(t, this.env, i, this.unstable_exists.bind(this), this.unstable_getByETag.bind(this)))).catch((c) => this.handleError(e, n, r, s, c));
|
|
2543
2543
|
} catch (i) {
|
|
2544
|
-
|
|
2545
|
-
return this.submitMetrics(n, r, s), o;
|
|
2546
|
-
}
|
|
2547
|
-
}
|
|
2548
|
-
handleError(t, e, n) {
|
|
2549
|
-
try {
|
|
2550
|
-
let r = new j(n);
|
|
2551
|
-
return t && t.captureException(n), n instanceof Error && e.setData({ error: n.message }), r;
|
|
2552
|
-
} catch (r) {
|
|
2553
|
-
return console.error("Error handling error", r), new j(r);
|
|
2544
|
+
return this.handleError(e, n, r, s, i);
|
|
2554
2545
|
}
|
|
2555
2546
|
}
|
|
2556
|
-
|
|
2547
|
+
handleError(t, e, n, r, s) {
|
|
2557
2548
|
try {
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2549
|
+
let i = new Q(s);
|
|
2550
|
+
return t && t.captureException(s), s instanceof Error && e.setData({ error: s.message }), i;
|
|
2551
|
+
} finally {
|
|
2552
|
+
e.setData({ requestTime: n.now() - r }), e.write();
|
|
2561
2553
|
}
|
|
2562
2554
|
}
|
|
2563
2555
|
async unstable_canFetch(t) {
|
package/dist/index.d.ts
CHANGED
|
@@ -19,13 +19,6 @@ 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
|
-
*/
|
|
29
22
|
declare function cloudflare(pluginConfig?: PluginConfig): vite.Plugin;
|
|
30
23
|
|
|
31
24
|
export { cloudflare };
|
package/dist/index.js
CHANGED
|
@@ -1268,10 +1268,7 @@ var CloudflareDevEnvironment = class extends vite2.DevEnvironment {
|
|
|
1268
1268
|
}
|
|
1269
1269
|
}
|
|
1270
1270
|
);
|
|
1271
|
-
assert(
|
|
1272
|
-
response.ok,
|
|
1273
|
-
`Failed to initialize module runner, error: ${await response.text()}`
|
|
1274
|
-
);
|
|
1271
|
+
assert(response.ok, "Failed to initialize module runner");
|
|
1275
1272
|
const webSocket = response.webSocket;
|
|
1276
1273
|
assert(webSocket, "Failed to establish WebSocket");
|
|
1277
1274
|
webSocket.accept();
|
|
@@ -1531,14 +1531,7 @@ 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
|
-
|
|
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
|
-
}
|
|
1534
|
+
createModuleRunner(this.env, server);
|
|
1542
1535
|
return new Response(null, { status: 101, webSocket: client });
|
|
1543
1536
|
}
|
|
1544
1537
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudflare/vite-plugin",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-ce165ff11",
|
|
4
4
|
"description": "Cloudflare plugin for Vite",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -36,7 +36,7 @@
|
|
|
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-
|
|
39
|
+
"miniflare": "0.0.0-ce165ff11"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@cloudflare/workers-types": "^4.20241230.0",
|
|
@@ -47,12 +47,12 @@
|
|
|
47
47
|
"typescript": "^5.7.2",
|
|
48
48
|
"vite": "^6.0.7",
|
|
49
49
|
"@cloudflare/workers-tsconfig": "0.0.0",
|
|
50
|
-
"
|
|
51
|
-
"
|
|
50
|
+
"wrangler": "0.0.0-ce165ff11",
|
|
51
|
+
"@cloudflare/workers-shared": "0.0.0-ce165ff11"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
54
|
"vite": "^6.0.7",
|
|
55
|
-
"wrangler": "^
|
|
55
|
+
"wrangler": "^0.0.0-ce165ff11"
|
|
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",
|
|
67
66
|
"test": "vitest",
|
|
68
|
-
"test:ci": "vitest run"
|
|
67
|
+
"test:ci": "vitest run",
|
|
68
|
+
"watch": "tsup --watch"
|
|
69
69
|
}
|
|
70
70
|
}
|