@vuebro/loader-sfc 2.3.16 → 2.3.18

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.
@@ -394,12 +394,16 @@ const vv = /* @__PURE__ */ new Set([408, 409, 425, 429, 500, 502, 503, 504]), Sv
394
394
  }
395
395
  const c = async function(p, d = {}) {
396
396
  const f = { request: p, options: Tv(p, d, t.defaults, n), response: void 0, error: void 0 };
397
- let m;
398
- if (f.options.method && (f.options.method = f.options.method.toUpperCase()), f.options.onRequest && await Mi(f, f.options.onRequest), typeof f.request == "string" && (f.options.baseURL && (f.request = fv(f.request, f.options.baseURL)), f.options.query && (f.request = mv(f.request, f.options.query), delete f.options.query), "query" in f.options && delete f.options.query, "params" in f.options && delete f.options.params), f.options.body && b1(f.options.method) && ((function(x) {
397
+ if (f.options.method && (f.options.method = f.options.method.toUpperCase()), f.options.onRequest && (await Mi(f, f.options.onRequest), f.options.headers instanceof n || (f.options.headers = new n(f.options.headers || {}))), typeof f.request == "string" && (f.options.baseURL && (f.request = fv(f.request, f.options.baseURL)), f.options.query && (f.request = mv(f.request, f.options.query), delete f.options.query), "query" in f.options && delete f.options.query, "params" in f.options && delete f.options.params), f.options.body && b1(f.options.method)) if ((function(x) {
399
398
  if (x === void 0) return !1;
400
399
  const g = typeof x;
401
- return g === "string" || g === "number" || g === "boolean" || g === null || g === "object" && (!!Array.isArray(x) || !x.buffer && (x.constructor && x.constructor.name === "Object" || typeof x.toJSON == "function"));
402
- })(f.options.body) ? (f.options.body = typeof f.options.body == "string" ? f.options.body : JSON.stringify(f.options.body), f.options.headers = new n(f.options.headers || {}), f.options.headers.has("content-type") || f.options.headers.set("content-type", "application/json"), f.options.headers.has("accept") || f.options.headers.set("accept", "application/json")) : ("pipeTo" in f.options.body && typeof f.options.body.pipeTo == "function" || typeof f.options.body.pipe == "function") && ("duplex" in f.options || (f.options.duplex = "half"))), !f.options.signal && f.options.timeout) {
400
+ return g === "string" || g === "number" || g === "boolean" || g === null || g === "object" && (!!Array.isArray(x) || !x.buffer && !(x instanceof FormData || x instanceof URLSearchParams) && (x.constructor && x.constructor.name === "Object" || typeof x.toJSON == "function"));
401
+ })(f.options.body)) {
402
+ const x = f.options.headers.get("content-type");
403
+ typeof f.options.body != "string" && (f.options.body = x === "application/x-www-form-urlencoded" ? new URLSearchParams(f.options.body).toString() : JSON.stringify(f.options.body)), x || f.options.headers.set("content-type", "application/json"), f.options.headers.has("accept") || f.options.headers.set("accept", "application/json");
404
+ } else ("pipeTo" in f.options.body && typeof f.options.body.pipeTo == "function" || typeof f.options.body.pipe == "function") && ("duplex" in f.options || (f.options.duplex = "half"));
405
+ let m;
406
+ if (!f.options.signal && f.options.timeout) {
403
407
  const x = new i();
404
408
  m = setTimeout(() => {
405
409
  const g = new Error("[TimeoutError]: The operation was aborted due to timeout");
@@ -417,7 +421,7 @@ const vv = /* @__PURE__ */ new Set([408, 409, 425, 429, 500, 502, 503, 504]), Sv
417
421
  const x = (f.options.parseResponse ? "json" : f.options.responseType) || (function(g = "") {
418
422
  if (!g) return "json";
419
423
  const y = g.split(";").shift() || "";
420
- return bv.test(y) ? "json" : xv.has(y) || y.startsWith("text/") ? "text" : "blob";
424
+ return bv.test(y) ? "json" : y === "text/event-stream" ? "stream" : xv.has(y) || y.startsWith("text/") ? "text" : "blob";
421
425
  })(f.response.headers.get("content-type") || "");
422
426
  switch (x) {
423
427
  case "json": {
@@ -23683,7 +23687,7 @@ var GP = Object.defineProperty, zg = Object.getOwnPropertySymbols, XP = Object.p
23683
23687
  Gg(Gg({}, Ph), su), lr.parse;
23684
23688
  const Xg = async (e) => {
23685
23689
  try {
23686
- return await kv(e);
23690
+ return await kv(e, { responseType: "text" });
23687
23691
  } catch (t) {
23688
23692
  co.error(t);
23689
23693
  }
@@ -5,11 +5,12 @@ import { transform } from "sucrase";
5
5
  import { compileScript, compileStyleAsync, compileTemplate, parse, } from "vue/compiler-sfc";
6
6
  const fetching = async (input) => {
7
7
  try {
8
- return await ofetch(input);
8
+ return await ofetch(input, { responseType: "text" });
9
9
  }
10
10
  catch (error) {
11
11
  consola.error(error);
12
12
  }
13
+ return;
13
14
  }, inject = async (code) => {
14
15
  const objectURL = URL.createObjectURL(new Blob([code], { type: "application/javascript" }));
15
16
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vuebro/loader-sfc",
3
- "version": "2.3.16",
3
+ "version": "2.3.18",
4
4
  "description": "Vue3 Single File Component (SFC) loader. Load .vue files directly from your browser without any build step.",
5
5
  "keywords": [
6
6
  "vue",
@@ -34,13 +34,18 @@
34
34
  },
35
35
  "prettier": "@vuebro/configs/prettierrc",
36
36
  "dependencies": {
37
+ "consola": "^3.4.2",
37
38
  "hash-sum": "^2.0.0",
38
- "sucrase": "^3.35.0"
39
+ "ofetch": "^1.5.1",
40
+ "sucrase": "^3.35.0",
41
+ "vue": "^3.5.22"
39
42
  },
40
43
  "devDependencies": {
41
44
  "@rollup/plugin-terser": "^0.4.4",
42
45
  "@types/hash-sum": "^1.0.2",
43
- "@types/node": "^24.9.1",
44
- "@vuebro/configs": "^1.1.51"
46
+ "@types/node": "^24.9.2",
47
+ "@vuebro/configs": "^1.1.54",
48
+ "eslint": "^9.39.0",
49
+ "vite": "^7.1.12"
45
50
  }
46
51
  }