@dpuse/dpuse-tool-file-previewer 1.0.121 → 1.0.122

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 CHANGED
@@ -65,7 +65,7 @@ License data is updated each time `npm run document` is run, using [license-chec
65
65
  | Dependency | Version | License(s) | Document |
66
66
  | :--------------------------------------------------------------------- | :-----: | :--------- | :-------------------------------------------------------------------- |
67
67
  | [@borewit/text-codec](https://github.com/Borewit/text-codec) | 0.2.2 | MIT | [LICENSE](licenses/downloads/@borewit/text-codec@0.2.2-LICENSE.txt) |
68
- | [@dpuse/dpuse-shared](https://github.com/dpuse/dpuse-shared) | 1.0.135 | MIT | [LICENSE](licenses/downloads/@dpuse/dpuse-shared@1.0.135-LICENSE.txt) |
68
+ | [@dpuse/dpuse-shared](https://github.com/dpuse/dpuse-shared) | 1.0.136 | MIT | [LICENSE](licenses/downloads/@dpuse/dpuse-shared@1.0.136-LICENSE.txt) |
69
69
  | [@tokenizer/inflate](https://github.com/Borewit/tokenizer-inflate) | 0.5.1 | MIT | [LICENSE](licenses/downloads/@tokenizer/inflate@0.5.1-LICENSE.txt) |
70
70
  | [debug](https://github.com/debug-js/debug) | 4.4.3 | MIT | [LICENSE](licenses/downloads/debug@4.4.3-LICENSE.txt) |
71
71
  | [file-type](https://github.com/sindresorhus/file-type) | 22.2.0 | MIT | [LICENSE](licenses/downloads/file-type@22.2.0-LICENSE.txt) |
@@ -80,7 +80,7 @@ License data is updated each time `npm run document` is run, using [license-chec
80
80
 
81
81
  The dependency tree below shows how each package in the table above is reached — direct and transitive — along with its installed version, release date, and update status. A package that does not ship itself, such as one whose parts are bundled separately, is left out and what ships beneath it is shown in its place. Packages flagged ❗ have a newer version available; ⚠️ indicates a package that hasn't been updated in the last 6 months or longer. Neither flag necessarily indicates a problem: we let new releases stabilise before upgrading, and some packages are mature and stable (have limited or no dependencies), so they require no active development.
82
82
 
83
- - **[@dpuse/dpuse-shared](https://github.com/dpuse/dpuse-shared)** 1.0.135 — this month: 2026-10-25
83
+ - **[@dpuse/dpuse-shared](https://github.com/dpuse/dpuse-shared)** 1.0.136 — this month: 2026-10-25
84
84
  - **[file-type](https://github.com/sindresorhus/file-type)** 22.2.0 — this month: 2026-10-14
85
85
  - **[valibot](https://github.com/open-circle/valibot)** 1.5.0 — 1 mth ago: 2026-09-09
86
86
  - **[file-type](https://github.com/sindresorhus/file-type)** 22.2.0 — this month: 2026-10-14
@@ -105,7 +105,7 @@ _Note: Sonda's Vite reports currently exclude CSS files, since Vite does not gen
105
105
 
106
106
  | Chunk/Module/File | Composition |
107
107
  | :---------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------ |
108
- | **dist/dpuse-tool-file-previewer.es.js** | 1238.8 kB · gzip 718.1 kB · 100.0% of the build |
108
+ | **dist/dpuse-tool-file-previewer.es.js** | 1239.0 kB · gzip 718.2 kB · 100.0% of the build |
109
109
  |     jschardet → dist/jschardet.esm.min.js | `██████████████████░░` 90.6% · 1122.3 kB |
110
110
  |     file-type → source/index.js + 7 more | `█░░░░░░░░░░░░░░░░░░░` 3.7% · 45.3 kB |
111
111
  |         ↳ 8 smaller files | `▒░░░░░░░░░░░░░░░░░░░` 3.7% · 45.3 kB |
@@ -114,7 +114,7 @@ _Note: Sonda's Vite reports currently exclude CSS files, since Vite does not gen
114
114
  |         ↳ 13 smaller files | `░░░░░░░░░░░░░░░░░░░░` 0.8% · 9.4 kB |
115
115
  |     @tokenizer/inflate → lib/ZipHandler.js + 3 more | `░░░░░░░░░░░░░░░░░░░░` 0.7% · 8.4 kB |
116
116
  |         ↳ 4 smaller files | `░░░░░░░░░░░░░░░░░░░░` 0.7% · 8.4 kB |
117
- |     src → index.ts | `░░░░░░░░░░░░░░░░░░░░` 0.5% · 6.7 kB |
117
+ |     src → index.ts | `░░░░░░░░░░░░░░░░░░░░` 0.6% · 6.9 kB |
118
118
  |     debug → src/browser.js + 1 more | `░░░░░░░░░░░░░░░░░░░░` 0.4% · 5.1 kB |
119
119
  |         ↳ 2 smaller files | `░░░░░░░░░░░░░░░░░░░░` 0.4% · 5.1 kB |
120
120
  |     @borewit/text-codec → lib/index.js | `░░░░░░░░░░░░░░░░░░░░` 0.3% · 3.3 kB |
@@ -8997,20 +8997,20 @@ var Nc = .2, Pc = 4096, Fc = 65536, Ic = {
8997
8997
  isAutoDetectable: !0
8998
8998
  }
8999
8999
  }, Gc = class {
9000
- async previewFile(e, t, n, r, i = Nc) {
9001
- let a = el(r, jc(new URL(e).pathname)?.toLowerCase()), o = n ?? (a ? Fc : Pc), s = await fetch(encodeURI(e), {
9002
- headers: { Range: `bytes=0-${String(o - 1)}` },
9000
+ async previewFile(e, t, n, r, i = Nc, a) {
9001
+ let o = tl(r, jc(new URL(e).pathname)?.toLowerCase()), s = n ?? (o ? Fc : Pc), c = await fetch(encodeURI(e), {
9002
+ headers: { Range: `bytes=0-${String(s - 1)}` },
9003
9003
  signal: t
9004
9004
  });
9005
- if (s.status === 416) return {
9006
- ...await qc(/* @__PURE__ */ new Uint8Array(), a, i, !0),
9005
+ if (c.status === 416) return {
9006
+ ...await qc(/* @__PURE__ */ new Uint8Array(), o, i, !0),
9007
9007
  isComplete: !0
9008
9008
  };
9009
- if (!s.ok) throw await Tc(s, `Failed to fetch '${e}' file.`, "dpuse-tool-file-previewer.previewRemoteFile");
9010
- let c = new Uint8Array(await s.arrayBuffer()), l = Kc(s, c.length, o);
9009
+ if (!c.ok) throw await Tc(c, `Failed to fetch '${e}' file.`, "dpuse-tool-file-previewer.previewRemoteFile");
9010
+ let l = new Uint8Array(await c.arrayBuffer()), u = Kc(c, l.length, s);
9011
9011
  return {
9012
- ...await qc(c, a, i, l),
9013
- isComplete: l
9012
+ ...await qc(l, o, i, u, a),
9013
+ isComplete: u
9014
9014
  };
9015
9015
  }
9016
9016
  };
@@ -9018,7 +9018,7 @@ function Kc(e, t, n) {
9018
9018
  let r = /\/(\d+)$/.exec(e.headers.get("content-range") ?? "")?.[1];
9019
9019
  return r == null ? e.status !== 206 || t < n : t >= Number(r);
9020
9020
  }
9021
- async function qc(e, t, n, r) {
9021
+ async function qc(e, t, n, r, i) {
9022
9022
  if (e.length === 0) return {
9023
9023
  bytes: e,
9024
9024
  dataFormatId: void 0,
@@ -9028,29 +9028,29 @@ async function qc(e, t, n, r) {
9028
9028
  fileTypeConfig: void 0,
9029
9029
  text: void 0
9030
9030
  };
9031
- let i = await Qs(e);
9032
- if (i != null) return Jc(e, i, r);
9033
- let a = Xc(e, n), o = $c(e, a[0] ?? Ic, r);
9031
+ let a = await Qs(e);
9032
+ if (a != null) return Jc(e, a, r, i);
9033
+ let o = Xc(e, n), s = el(e, $c(i) ?? o[0] ?? Ic, r);
9034
9034
  return {
9035
9035
  bytes: e,
9036
- dataFormatId: tl(o.text, t),
9037
- encodingId: o.encoding.id,
9038
- encodingConfidenceLevel: o.encoding.confidenceLevel,
9039
- encodingCandidates: a,
9040
- fileTypeConfig: i,
9041
- text: o.text
9036
+ dataFormatId: i?.dataFormatId ?? nl(s.text, t),
9037
+ encodingId: s.encoding.id,
9038
+ encodingConfidenceLevel: s.encoding.confidenceLevel,
9039
+ encodingCandidates: o,
9040
+ fileTypeConfig: a,
9041
+ text: s.text
9042
9042
  };
9043
9043
  }
9044
- function Jc(e, t, n) {
9045
- let r = Object.hasOwn(Wc, t.ext) ? t.ext : void 0;
9044
+ function Jc(e, t, n, r) {
9045
+ let i = Object.hasOwn(Wc, t.ext) ? t.ext : void 0, a = r?.dataFormatId ?? i;
9046
9046
  if (t.ext === "xml") {
9047
- let i = $c(e, {
9047
+ let i = el(e, $c(r) ?? {
9048
9048
  id: Qc(e),
9049
9049
  confidenceLevel: 1
9050
9050
  }, n);
9051
9051
  return {
9052
9052
  bytes: e,
9053
- dataFormatId: r,
9053
+ dataFormatId: a,
9054
9054
  encodingId: i.encoding.id,
9055
9055
  encodingConfidenceLevel: i.encoding.confidenceLevel,
9056
9056
  encodingCandidates: void 0,
@@ -9060,7 +9060,7 @@ function Jc(e, t, n) {
9060
9060
  }
9061
9061
  return {
9062
9062
  bytes: e,
9063
- dataFormatId: r,
9063
+ dataFormatId: a,
9064
9064
  encodingId: void 0,
9065
9065
  encodingConfidenceLevel: void 0,
9066
9066
  encodingCandidates: void 0,
@@ -9100,8 +9100,14 @@ function Qc(e) {
9100
9100
  let t = new TextDecoder("ascii").decode(e.subarray(0, Lc));
9101
9101
  return Zc(e)?.id ?? Rc.exec(t)?.[2] ?? "utf-8";
9102
9102
  }
9103
- function $c(e, t, n) {
9104
- let r = n ? e : pl(e);
9103
+ function $c(e) {
9104
+ return e?.encodingId == null ? void 0 : {
9105
+ id: e.encodingId,
9106
+ confidenceLevel: 1
9107
+ };
9108
+ }
9109
+ function el(e, t, n) {
9110
+ let r = n ? e : ml(e);
9105
9111
  try {
9106
9112
  return {
9107
9113
  encoding: t,
@@ -9114,28 +9120,28 @@ function $c(e, t, n) {
9114
9120
  };
9115
9121
  }
9116
9122
  }
9117
- function el(e, t) {
9123
+ function tl(e, t) {
9118
9124
  let n = e?.split(";", 1)[0]?.trim().toLowerCase();
9119
9125
  return n != null && n !== "" && n !== Uc ? n === Hc : t != null && Vc.has(t);
9120
9126
  }
9121
- function tl(e, t) {
9122
- return nl(e) ? "json" : rl(e) ? "jsonl" : t ? "markdown" : "dtv";
9127
+ function nl(e, t) {
9128
+ return rl(e) ? "json" : il(e) ? "jsonl" : t ? "markdown" : "dtv";
9123
9129
  }
9124
- function nl(e) {
9130
+ function rl(e) {
9125
9131
  let t = [], n = e.search(/\S/);
9126
9132
  if (e[n] !== "{" && e[n] !== "[") return !1;
9127
9133
  let r = {
9128
9134
  expectation: "value",
9129
9135
  index: n
9130
9136
  };
9131
- for (; r != null && r.index < e.length;) r = al(e, r, t);
9137
+ for (; r != null && r.index < e.length;) r = ol(e, r, t);
9132
9138
  return r != null;
9133
9139
  }
9134
- function rl(e) {
9140
+ function il(e) {
9135
9141
  let t = e.split(/\r\n|\n|\r/).filter((e) => e.trim() !== "");
9136
- return t.length > 1 && t.every((e) => il(e));
9142
+ return t.length > 1 && t.every((e) => al(e));
9137
9143
  }
9138
- function il(e) {
9144
+ function al(e) {
9139
9145
  try {
9140
9146
  let t = JSON.parse(e);
9141
9147
  return typeof t == "object" && !!t;
@@ -9143,15 +9149,15 @@ function il(e) {
9143
9149
  return !1;
9144
9150
  }
9145
9151
  }
9146
- function al(e, { expectation: t, index: n }, r) {
9152
+ function ol(e, { expectation: t, index: n }, r) {
9147
9153
  let i = e.charAt(n);
9148
9154
  if (Bc.has(i)) return {
9149
9155
  expectation: t,
9150
9156
  index: n + 1
9151
9157
  };
9152
9158
  switch (t) {
9153
- case "closeOrKey": return i === "}" ? ol(i, n, r) : sl(e, n);
9154
- case "closeOrValue": return i === "]" ? ol(i, n, r) : cl(e, n, r);
9159
+ case "closeOrKey": return i === "}" ? sl(i, n, r) : cl(e, n);
9160
+ case "closeOrValue": return i === "]" ? sl(i, n, r) : ll(e, n, r);
9155
9161
  case "colon": return i === ":" ? {
9156
9162
  expectation: "value",
9157
9163
  index: n + 1
@@ -9159,69 +9165,69 @@ function al(e, { expectation: t, index: n }, r) {
9159
9165
  case "commaOrClose": return i === "," ? {
9160
9166
  expectation: r.at(-1) === "{" ? "key" : "value",
9161
9167
  index: n + 1
9162
- } : ol(i, n, r);
9168
+ } : sl(i, n, r);
9163
9169
  case "end": return;
9164
- case "key": return sl(e, n);
9165
- case "value": return cl(e, n, r);
9170
+ case "key": return cl(e, n);
9171
+ case "value": return ll(e, n, r);
9166
9172
  }
9167
9173
  }
9168
- function ol(e, t, n) {
9174
+ function sl(e, t, n) {
9169
9175
  if (e === (n.at(-1) === "{" ? "}" : "]")) return n.pop(), {
9170
9176
  expectation: n.length === 0 ? "end" : "commaOrClose",
9171
9177
  index: t + 1
9172
9178
  };
9173
9179
  }
9174
- function sl(e, t) {
9175
- let n = e.charAt(t) === "\"" ? ll(e, t) : void 0;
9180
+ function cl(e, t) {
9181
+ let n = e.charAt(t) === "\"" ? ul(e, t) : void 0;
9176
9182
  return n == null ? void 0 : {
9177
9183
  expectation: "colon",
9178
9184
  index: n
9179
9185
  };
9180
9186
  }
9181
- function cl(e, t, n) {
9187
+ function ll(e, t, n) {
9182
9188
  let r = e.charAt(t);
9183
9189
  if (r === "{" || r === "[") return n.push(r), {
9184
9190
  expectation: r === "{" ? "closeOrKey" : "closeOrValue",
9185
9191
  index: t + 1
9186
9192
  };
9187
- let i = r === "\"" ? ll(e, t) : dl(e, t);
9193
+ let i = r === "\"" ? ul(e, t) : fl(e, t);
9188
9194
  return i == null ? void 0 : {
9189
9195
  expectation: "commaOrClose",
9190
9196
  index: i
9191
9197
  };
9192
9198
  }
9193
- function ll(e, t) {
9199
+ function ul(e, t) {
9194
9200
  let n = t + 1;
9195
9201
  for (; n < e.length;) {
9196
9202
  let t = e.charAt(n);
9197
9203
  if (t === "\"") return n + 1;
9198
9204
  if (t < " ") return;
9199
9205
  if (t === "\\") {
9200
- let t = ul(e, n);
9206
+ let t = dl(e, n);
9201
9207
  if (t == null) return;
9202
9208
  n = t;
9203
9209
  } else n++;
9204
9210
  }
9205
9211
  return e.length;
9206
9212
  }
9207
- function ul(e, t) {
9213
+ function dl(e, t) {
9208
9214
  let n = e.charAt(t + 1);
9209
9215
  return n === "u" ? /^[\da-f]*$/i.test(e.slice(t + 2, t + 6)) ? t + 6 : void 0 : n === "" || String.raw`"\/bfnrt`.includes(n) ? t + 2 : void 0;
9210
9216
  }
9211
- function dl(e, t) {
9217
+ function fl(e, t) {
9212
9218
  let n = /^[\w.+-]+/.exec(e.slice(t))?.[0];
9213
9219
  if (n == null) return;
9214
9220
  let r = t + n.length;
9215
- return r === e.length ? zc.some((e) => e.startsWith(n)) || /^[\d.e+-]*$/i.test(n) ? r : void 0 : zc.includes(n) || fl(n) ? r : void 0;
9221
+ return r === e.length ? zc.some((e) => e.startsWith(n)) || /^[\d.e+-]*$/i.test(n) ? r : void 0 : zc.includes(n) || pl(n) ? r : void 0;
9216
9222
  }
9217
- function fl(e) {
9223
+ function pl(e) {
9218
9224
  try {
9219
9225
  return typeof JSON.parse(e) == "number";
9220
9226
  } catch {
9221
9227
  return !1;
9222
9228
  }
9223
9229
  }
9224
- function pl(e) {
9230
+ function ml(e) {
9225
9231
  let t = e, n = t.length;
9226
9232
  for (let e = n - 1; e >= 0; e--) {
9227
9233
  let n = t[e];