@dpuse/dpuse-tool-file-previewer 1.0.134 → 1.0.135

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
@@ -62,7 +62,7 @@ License data is updated each time `npm run document` is run, using [license-chec
62
62
  | Dependency | Version | License(s) | Document |
63
63
  | :--------------------------------------------------------------------- | :-----: | :--------- | :-------------------------------------------------------------------- |
64
64
  | [@borewit/text-codec](https://github.com/Borewit/text-codec) | 0.2.3 | MIT | [LICENSE](licenses/downloads/@borewit/text-codec@0.2.3-LICENSE.txt) |
65
- | [@dpuse/dpuse-shared](https://github.com/dpuse/dpuse-shared) | 1.0.209 | MIT | [LICENSE](licenses/downloads/@dpuse/dpuse-shared@1.0.209-LICENSE.txt) |
65
+ | [@dpuse/dpuse-shared](https://github.com/dpuse/dpuse-shared) | 1.0.210 | MIT | [LICENSE](licenses/downloads/@dpuse/dpuse-shared@1.0.210-LICENSE.txt) |
66
66
  | [@tokenizer/inflate](https://github.com/Borewit/tokenizer-inflate) | 0.6.0 | MIT | [LICENSE](licenses/downloads/@tokenizer/inflate@0.6.0-LICENSE.txt) |
67
67
  | [debug](https://github.com/debug-js/debug) | 4.4.3 | MIT | [LICENSE](licenses/downloads/debug@4.4.3-LICENSE.txt) |
68
68
  | [file-type](https://github.com/sindresorhus/file-type) | 22.3.0 | MIT | [LICENSE](licenses/downloads/file-type@22.3.0-LICENSE.txt) |
@@ -77,7 +77,7 @@ License data is updated each time `npm run document` is run, using [license-chec
77
77
 
78
78
  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.
79
79
 
80
- - **[@dpuse/dpuse-shared](https://github.com/dpuse/dpuse-shared)** 1.0.209 — this month: 2026-11-11
80
+ - **[@dpuse/dpuse-shared](https://github.com/dpuse/dpuse-shared)** 1.0.210 — this month: 2026-11-11
81
81
  - **[file-type](https://github.com/sindresorhus/file-type)** 22.3.0 — this month: 2026-10-29
82
82
  - **[valibot](https://github.com/open-circle/valibot)** 1.5.0 — 2 mths ago: 2026-09-09
83
83
  - **[file-type](https://github.com/sindresorhus/file-type)** 22.3.0 — this month: 2026-10-29
@@ -103,7 +103,7 @@ _Note: Sonda's Vite reports currently exclude CSS files, since Vite does not gen
103
103
 
104
104
  | Chunk/Module/File | Composition |
105
105
  | :---------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------ |
106
- | **dist/dpuse-tool-file-previewer.es.js** | 1263.9 kB · gzip 724.5 kB · 100.0% of the build |
106
+ | **dist/dpuse-tool-file-previewer.es.js** | 1263.6 kB · gzip 724.5 kB · 100.0% of the build |
107
107
  |     jschardet → dist/jschardet.esm.min.js | `██████████████████░░` 89.6% · 1132.0 kB |
108
108
  |     file-type → source/index.js + 7 more | `█░░░░░░░░░░░░░░░░░░░` 3.4% · 42.9 kB |
109
109
  |         ↳ 8 smaller files | `▒░░░░░░░░░░░░░░░░░░░` 3.4% · 42.9 kB |
@@ -112,8 +112,8 @@ _Note: Sonda's Vite reports currently exclude CSS files, since Vite does not gen
112
112
  |         ↳ 16 smaller files | `░░░░░░░░░░░░░░░░░░░░` 1.1% · 13.8 kB |
113
113
  |     @tokenizer/inflate → lib/ZipHandler.js + 3 more | `░░░░░░░░░░░░░░░░░░░░` 0.8% · 10.2 kB |
114
114
  |         ↳ 4 smaller files | `░░░░░░░░░░░░░░░░░░░░` 0.8% · 10.2 kB |
115
- |     src → index.ts + 2 more | `░░░░░░░░░░░░░░░░░░░░` 0.6% · 8.0 kB |
116
- |         ↳ 3 smaller files | `░░░░░░░░░░░░░░░░░░░░` 0.6% · 8.0 kB |
115
+ |     src → index.ts + 2 more | `░░░░░░░░░░░░░░░░░░░░` 0.6% · 7.7 kB |
116
+ |         ↳ 3 smaller files | `░░░░░░░░░░░░░░░░░░░░` 0.6% · 7.7 kB |
117
117
  |     debug → src/browser.js + 1 more | `░░░░░░░░░░░░░░░░░░░░` 0.4% · 5.1 kB |
118
118
  |         ↳ 2 smaller files | `░░░░░░░░░░░░░░░░░░░░` 0.4% · 5.1 kB |
119
119
  |     @borewit/text-codec → lib/index.js | `░░░░░░░░░░░░░░░░░░░░` 0.4% · 4.9 kB |
@@ -9747,12 +9747,11 @@ function ml(e) {
9747
9747
  };
9748
9748
  }
9749
9749
  function hl(e, t, n) {
9750
- let r = !bl(t.id), i = r ? dl : t, a = new TextDecoder(Hn(i.id)).decode(e, { stream: !n }), o = n ? a : xl(a);
9750
+ let r = bl(t.id) ? t : dl, i = new TextDecoder(Hn(r.id)).decode(e, { stream: !n }), a = n ? i : xl(i);
9751
9751
  return {
9752
- encoding: i,
9753
- isFallback: r,
9754
- replacementCharacterCount: Sl(o),
9755
- text: o
9752
+ encoding: r,
9753
+ replacementCharacterCount: Sl(a),
9754
+ text: a
9756
9755
  };
9757
9756
  }
9758
9757
  function gl(e) {
@@ -9926,20 +9925,14 @@ var Il = 65536, Ll = {
9926
9925
  xml: "xml"
9927
9926
  }, Rl = /* @__PURE__ */ new Set(["markdown", "md"]), zl = class {
9928
9927
  async previewFile(e, t, n, r, i) {
9929
- let a = ql(r, Yn(new URL(e).pathname)?.toLowerCase()), o = n ?? Il, s = await fetch(encodeURI(e), {
9928
+ let a = Kl(r, Yn(new URL(e).pathname)?.toLowerCase()), o = n ?? Il, s = await fetch(encodeURI(e), {
9930
9929
  headers: { Range: `bytes=0-${String(o - 1)}` },
9931
9930
  signal: t
9932
9931
  });
9933
- if (s.status === 416) return {
9934
- ...await Hl(/* @__PURE__ */ new Uint8Array(), a, !0),
9935
- isComplete: !0
9936
- };
9932
+ if (s.status === 416) return Hl(/* @__PURE__ */ new Uint8Array(), a, !0);
9937
9933
  if (!s.ok) throw await Kn(s, `Failed to fetch '${e}' file.`, "dpuse-tool-file-previewer.Tool.previewFile");
9938
- let { fileBytes: c, isCutShort: l } = await Bl(s, o), u = !l && Vl(s, c.length, o);
9939
- return {
9940
- ...await Hl(c, a, u, i),
9941
- isComplete: u
9942
- };
9934
+ let { fileBytes: c, isCutShort: l } = await Bl(s, o);
9935
+ return Hl(c, a, !l && Vl(s, c.length, o), i);
9943
9936
  }
9944
9937
  };
9945
9938
  async function Bl(e, t) {
@@ -9967,80 +9960,80 @@ async function Hl(e, t, n, r) {
9967
9960
  bytes: e,
9968
9961
  dataFormatId: void 0,
9969
9962
  dataFormatSourceId: void 0,
9963
+ decodedEncodingId: void 0,
9970
9964
  encodingId: void 0,
9971
9965
  encodingConfidenceLevel: void 0,
9972
9966
  encodingSourceId: void 0,
9973
9967
  encodingCandidates: void 0,
9974
9968
  replacementCharacterCount: void 0,
9975
9969
  fileTypeConfig: void 0,
9970
+ isComplete: n,
9976
9971
  text: void 0
9977
9972
  };
9978
9973
  let i = await _n(e);
9979
9974
  if (i != null) return Ul(e, i, n, r);
9980
- let a = pl(e, n), o = Wl(r), s = hl(e, o ?? a.encoding, n);
9975
+ let a = pl(e, n), o = hl(e, Wl(r) ?? a.encoding, n);
9981
9976
  return {
9982
9977
  bytes: e,
9983
- ...Kl(r, Jl(s.text, t)),
9984
- encodingId: s.encoding.id,
9985
- encodingConfidenceLevel: s.encoding.confidenceLevel,
9986
- encodingSourceId: Gl(s, o, a.sourceId),
9978
+ ...ql(o.text, t),
9979
+ ...Gl(a, o),
9987
9980
  encodingCandidates: a.candidates,
9988
- replacementCharacterCount: s.replacementCharacterCount,
9989
9981
  fileTypeConfig: i,
9990
- text: s.text
9982
+ isComplete: n,
9983
+ text: o.text
9991
9984
  };
9992
9985
  }
9993
9986
  function Ul(e, t, n, r) {
9994
- let i = Object.hasOwn(Ll, t.ext) ? Ll[t.ext] : void 0, a = Kl(r, {
9987
+ let i = Object.hasOwn(Ll, t.ext) ? Ll[t.ext] : void 0, a = {
9995
9988
  dataFormatId: i,
9996
9989
  dataFormatSourceId: i == null ? void 0 : "fileContent"
9997
- });
9990
+ };
9998
9991
  if (t.ext === "xml") {
9999
- let i = ml(e), o = Wl(r), s = hl(e, o ?? i.encoding, n);
9992
+ let i = ml(e), o = hl(e, Wl(r) ?? i.encoding, n);
10000
9993
  return {
10001
9994
  bytes: e,
10002
9995
  ...a,
10003
- encodingId: s.encoding.id,
10004
- encodingConfidenceLevel: s.encoding.confidenceLevel,
10005
- encodingSourceId: Gl(s, o, i.sourceId),
9996
+ ...Gl(i, o),
10006
9997
  encodingCandidates: void 0,
10007
- replacementCharacterCount: s.replacementCharacterCount,
10008
9998
  fileTypeConfig: t,
10009
- text: s.text
9999
+ isComplete: n,
10000
+ text: o.text
10010
10001
  };
10011
10002
  }
10012
10003
  return {
10013
10004
  bytes: e,
10014
10005
  ...a,
10006
+ decodedEncodingId: void 0,
10015
10007
  encodingId: void 0,
10016
10008
  encodingConfidenceLevel: void 0,
10017
10009
  encodingSourceId: void 0,
10018
10010
  encodingCandidates: void 0,
10019
10011
  replacementCharacterCount: void 0,
10020
10012
  fileTypeConfig: t,
10013
+ isComplete: n,
10021
10014
  text: gl(e)
10022
10015
  };
10023
10016
  }
10024
10017
  function Wl(e) {
10025
- return e?.encodingId == null ? void 0 : {
10026
- id: e.encodingId,
10018
+ return e == null ? void 0 : {
10019
+ id: e,
10027
10020
  confidenceLevel: 1
10028
10021
  };
10029
10022
  }
10030
- function Gl(e, t, n) {
10031
- return e.isFallback ? "fallback" : t == null ? n : "choice";
10032
- }
10033
- function Kl(e, t) {
10034
- return e?.dataFormatId == null ? t : {
10035
- dataFormatId: e.dataFormatId,
10036
- dataFormatSourceId: "choice"
10023
+ function Gl(e, t) {
10024
+ return {
10025
+ decodedEncodingId: t.encoding.id,
10026
+ encodingId: e.encoding.id,
10027
+ encodingConfidenceLevel: e.encoding.confidenceLevel,
10028
+ encodingSourceId: e.sourceId,
10029
+ replacementCharacterCount: t.replacementCharacterCount
10037
10030
  };
10038
10031
  }
10039
- function ql(e, t) {
10032
+ function Kl(e, t) {
10040
10033
  let n = e?.split(";", 1)[0]?.trim().toLowerCase();
10041
10034
  return n != null && n !== "" && n !== "application/octet-stream" ? n === "text/markdown" ? "mimeType" : void 0 : t != null && Rl.has(t) ? "extension" : void 0;
10042
10035
  }
10043
- function Jl(e, t) {
10036
+ function ql(e, t) {
10044
10037
  return Tl(e) ? {
10045
10038
  dataFormatId: "json",
10046
10039
  dataFormatSourceId: "jsonSyntax"