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

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.142 | MIT | [LICENSE](licenses/downloads/@dpuse/dpuse-shared@1.0.142-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.142 — 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.3 kB · gzip 718.3 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,14 +114,14 @@ _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% · 7.1 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 |
121
121
  |     ms → index.js | `░░░░░░░░░░░░░░░░░░░░` 0.1% · 1.6 kB |
122
122
  |     uint8array-extras → index.js | `░░░░░░░░░░░░░░░░░░░░` 0.1% · 1.2 kB |
123
123
  |     token-types → lib/index.js | `░░░░░░░░░░░░░░░░░░░░` 0.1% · 1018 B |
124
- |     (bundler output, whitespace & JSON) | `░░░░░░░░░░░░░░░░░░░░` 1.5% · 19.2 kB |
124
+ |     (bundler output, whitespace & JSON) | `░░░░░░░░░░░░░░░░░░░░` 1.6% · 19.2 kB |
125
125
 
126
126
  Bars show each row's share of its output file. ↳ rows are part of the row above.
127
127
 
@@ -8399,7 +8399,7 @@ var bc = {
8399
8399
  status: /* @__PURE__ */ Z(vc),
8400
8400
  statusId: /* @__PURE__ */ Z(_c)
8401
8401
  };
8402
- ({ ...bc }), Y({ en: "Apache Arrow" }), Y({ en: "Apache Avro" }), Y({ en: "Data Positioning Events" }), Y({ en: "Delimited Text" }), Y({ en: "JSON" }), Y({ en: "JSON Lines" }), Y({ en: "Markdown" }), Y({ en: "OpenDocument Spreadsheet" }), Y({ en: "Apache Parquet" }), Y({ en: "SPSS" }), Y({ en: "SQLite" }), Y({ en: "Plain Text" }), Y({ en: "XLSM" }), Y({ en: "XLSX" }), Y({ en: "XML" }), Y({ en: "Newline" }), Y({ en: "Carriage Return" }), Y({ en: "Carriage Return/Newline" }), Y({ en: "Colon" }), Y({ en: "Comma" }), Y({ en: "Exclamation Mark" }), Y({ en: "Record Separator" }), Y({ en: "Semicolon" }), Y({ en: "Space" }), Y({ en: "Tab" }), Y({ en: "Underscore" }), Y({ en: "Unit Separator" }), Y({ en: "Vertical Bar" }), $([
8402
+ ({ ...bc }), Y({ en: "Arrow" }), Y({ en: "Avro" }), Y({ en: "Delimited text (CSV, TAB, TSV…)" }), Y({ en: "JSON" }), Y({ en: "JSON Lines (JSONL)" }), Y({ en: "Markdown (MD)" }), Y({ en: "OpenDocument spreadsheet (ODS)" }), Y({ en: "Parquet" }), Y({ en: "SPSS (SAV)" }), Y({ en: "SQLite" }), Y({ en: "Excel (XLSX, XLSM)" }), Y({ en: "XML" }), Y({ en: "Newline" }), Y({ en: "Carriage Return" }), Y({ en: "Carriage Return/Newline" }), Y({ en: "Colon" }), Y({ en: "Comma" }), Y({ en: "Exclamation Mark" }), Y({ en: "Record Separator" }), Y({ en: "Semicolon" }), Y({ en: "Space" }), Y({ en: "Tab" }), Y({ en: "Underscore" }), Y({ en: "Unit Separator" }), Y({ en: "Vertical Bar" }), $([
8403
8403
  "app",
8404
8404
  "engine",
8405
8405
  "connector",
@@ -8952,65 +8952,74 @@ var Nc = .2, Pc = 4096, Fc = 65536, Ic = {
8952
8952
  "\r"
8953
8953
  ]), Vc = /* @__PURE__ */ new Set(["markdown", "md"]), Hc = "text/markdown", Uc = "application/octet-stream", Wc = {
8954
8954
  arrow: {
8955
+ dataFormatId: "arrow",
8955
8956
  label: "Columnar format for tables of data.",
8956
8957
  structure: "table",
8957
8958
  isAutoDetectable: !0
8958
8959
  },
8959
8960
  avro: {
8961
+ dataFormatId: "avro",
8960
8962
  label: "Object container file developed by Apache Avro.",
8961
8963
  structure: "records",
8962
8964
  isAutoDetectable: !0
8963
8965
  },
8964
8966
  ods: {
8967
+ dataFormatId: "ods",
8965
8968
  label: "OpenDocument for spreadsheets.",
8966
8969
  structure: "workbook",
8967
8970
  isAutoDetectable: !0
8968
8971
  },
8969
8972
  parquet: {
8973
+ dataFormatId: "parquet",
8970
8974
  label: "Apache Parquet.",
8971
8975
  structure: "table",
8972
8976
  isAutoDetectable: !0
8973
8977
  },
8974
8978
  sav: {
8979
+ dataFormatId: "sav",
8975
8980
  label: "SPSS statistical data file.",
8976
8981
  structure: "table",
8977
8982
  isAutoDetectable: !0
8978
8983
  },
8979
8984
  sqlite: {
8985
+ dataFormatId: "sqlite",
8980
8986
  label: "SQLite file.",
8981
8987
  structure: "database",
8982
8988
  isAutoDetectable: !0
8983
8989
  },
8984
8990
  xlsx: {
8991
+ dataFormatId: "xlsx",
8985
8992
  label: "Microsoft Excel document.",
8986
8993
  structure: "workbook",
8987
8994
  isAutoDetectable: !0
8988
8995
  },
8989
8996
  xlsm: {
8997
+ dataFormatId: "xlsx",
8990
8998
  label: "Microsoft Excel macro-enabled document.",
8991
8999
  structure: "workbook",
8992
9000
  isAutoDetectable: !0
8993
9001
  },
8994
9002
  xml: {
9003
+ dataFormatId: "xml",
8995
9004
  label: "eXtensible markup language.",
8996
9005
  structure: "tree",
8997
9006
  isAutoDetectable: !0
8998
9007
  }
8999
9008
  }, 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)}` },
9009
+ async previewFile(e, t, n, r, i = Nc, a) {
9010
+ let o = a?.dataFormatId, s = o == null ? tl(r, jc(new URL(e).pathname)?.toLowerCase()) : o === "markdown", c = n ?? (s ? Fc : Pc), l = await fetch(encodeURI(e), {
9011
+ headers: { Range: `bytes=0-${String(c - 1)}` },
9003
9012
  signal: t
9004
9013
  });
9005
- if (s.status === 416) return {
9006
- ...await qc(/* @__PURE__ */ new Uint8Array(), a, i, !0),
9014
+ if (l.status === 416) return {
9015
+ ...await qc(/* @__PURE__ */ new Uint8Array(), s, i, !0),
9007
9016
  isComplete: !0
9008
9017
  };
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);
9018
+ if (!l.ok) throw await Tc(l, `Failed to fetch '${e}' file.`, "dpuse-tool-file-previewer.previewRemoteFile");
9019
+ let u = new Uint8Array(await l.arrayBuffer()), d = Kc(l, u.length, c);
9011
9020
  return {
9012
- ...await qc(c, a, i, l),
9013
- isComplete: l
9021
+ ...await qc(u, s, i, d, a),
9022
+ isComplete: d
9014
9023
  };
9015
9024
  }
9016
9025
  };
@@ -9018,7 +9027,7 @@ function Kc(e, t, n) {
9018
9027
  let r = /\/(\d+)$/.exec(e.headers.get("content-range") ?? "")?.[1];
9019
9028
  return r == null ? e.status !== 206 || t < n : t >= Number(r);
9020
9029
  }
9021
- async function qc(e, t, n, r) {
9030
+ async function qc(e, t, n, r, i) {
9022
9031
  if (e.length === 0) return {
9023
9032
  bytes: e,
9024
9033
  dataFormatId: void 0,
@@ -9028,29 +9037,29 @@ async function qc(e, t, n, r) {
9028
9037
  fileTypeConfig: void 0,
9029
9038
  text: void 0
9030
9039
  };
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);
9040
+ let a = await Qs(e);
9041
+ if (a != null) return Jc(e, a, r, i);
9042
+ let o = Xc(e, n), s = el(e, $c(i) ?? o[0] ?? Ic, r);
9034
9043
  return {
9035
9044
  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
9045
+ dataFormatId: i?.dataFormatId ?? nl(s.text, t),
9046
+ encodingId: s.encoding.id,
9047
+ encodingConfidenceLevel: s.encoding.confidenceLevel,
9048
+ encodingCandidates: o,
9049
+ fileTypeConfig: a,
9050
+ text: s.text
9042
9051
  };
9043
9052
  }
9044
- function Jc(e, t, n) {
9045
- let r = Object.hasOwn(Wc, t.ext) ? t.ext : void 0;
9053
+ function Jc(e, t, n, r) {
9054
+ let i = Object.hasOwn(Wc, t.ext) ? Wc[t.ext]?.dataFormatId : void 0, a = r?.dataFormatId ?? i;
9046
9055
  if (t.ext === "xml") {
9047
- let i = $c(e, {
9056
+ let i = el(e, $c(r) ?? {
9048
9057
  id: Qc(e),
9049
9058
  confidenceLevel: 1
9050
9059
  }, n);
9051
9060
  return {
9052
9061
  bytes: e,
9053
- dataFormatId: r,
9062
+ dataFormatId: a,
9054
9063
  encodingId: i.encoding.id,
9055
9064
  encodingConfidenceLevel: i.encoding.confidenceLevel,
9056
9065
  encodingCandidates: void 0,
@@ -9060,7 +9069,7 @@ function Jc(e, t, n) {
9060
9069
  }
9061
9070
  return {
9062
9071
  bytes: e,
9063
- dataFormatId: r,
9072
+ dataFormatId: a,
9064
9073
  encodingId: void 0,
9065
9074
  encodingConfidenceLevel: void 0,
9066
9075
  encodingCandidates: void 0,
@@ -9100,8 +9109,14 @@ function Qc(e) {
9100
9109
  let t = new TextDecoder("ascii").decode(e.subarray(0, Lc));
9101
9110
  return Zc(e)?.id ?? Rc.exec(t)?.[2] ?? "utf-8";
9102
9111
  }
9103
- function $c(e, t, n) {
9104
- let r = n ? e : pl(e);
9112
+ function $c(e) {
9113
+ return e?.encodingId == null ? void 0 : {
9114
+ id: e.encodingId,
9115
+ confidenceLevel: 1
9116
+ };
9117
+ }
9118
+ function el(e, t, n) {
9119
+ let r = n ? e : ml(e);
9105
9120
  try {
9106
9121
  return {
9107
9122
  encoding: t,
@@ -9114,28 +9129,28 @@ function $c(e, t, n) {
9114
9129
  };
9115
9130
  }
9116
9131
  }
9117
- function el(e, t) {
9132
+ function tl(e, t) {
9118
9133
  let n = e?.split(";", 1)[0]?.trim().toLowerCase();
9119
9134
  return n != null && n !== "" && n !== Uc ? n === Hc : t != null && Vc.has(t);
9120
9135
  }
9121
- function tl(e, t) {
9122
- return nl(e) ? "json" : rl(e) ? "jsonl" : t ? "markdown" : "dtv";
9136
+ function nl(e, t) {
9137
+ return rl(e) ? "json" : il(e) ? "jsonl" : t ? "markdown" : "dtv";
9123
9138
  }
9124
- function nl(e) {
9139
+ function rl(e) {
9125
9140
  let t = [], n = e.search(/\S/);
9126
9141
  if (e[n] !== "{" && e[n] !== "[") return !1;
9127
9142
  let r = {
9128
9143
  expectation: "value",
9129
9144
  index: n
9130
9145
  };
9131
- for (; r != null && r.index < e.length;) r = al(e, r, t);
9146
+ for (; r != null && r.index < e.length;) r = ol(e, r, t);
9132
9147
  return r != null;
9133
9148
  }
9134
- function rl(e) {
9149
+ function il(e) {
9135
9150
  let t = e.split(/\r\n|\n|\r/).filter((e) => e.trim() !== "");
9136
- return t.length > 1 && t.every((e) => il(e));
9151
+ return t.length > 1 && t.every((e) => al(e));
9137
9152
  }
9138
- function il(e) {
9153
+ function al(e) {
9139
9154
  try {
9140
9155
  let t = JSON.parse(e);
9141
9156
  return typeof t == "object" && !!t;
@@ -9143,15 +9158,15 @@ function il(e) {
9143
9158
  return !1;
9144
9159
  }
9145
9160
  }
9146
- function al(e, { expectation: t, index: n }, r) {
9161
+ function ol(e, { expectation: t, index: n }, r) {
9147
9162
  let i = e.charAt(n);
9148
9163
  if (Bc.has(i)) return {
9149
9164
  expectation: t,
9150
9165
  index: n + 1
9151
9166
  };
9152
9167
  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);
9168
+ case "closeOrKey": return i === "}" ? sl(i, n, r) : cl(e, n);
9169
+ case "closeOrValue": return i === "]" ? sl(i, n, r) : ll(e, n, r);
9155
9170
  case "colon": return i === ":" ? {
9156
9171
  expectation: "value",
9157
9172
  index: n + 1
@@ -9159,69 +9174,69 @@ function al(e, { expectation: t, index: n }, r) {
9159
9174
  case "commaOrClose": return i === "," ? {
9160
9175
  expectation: r.at(-1) === "{" ? "key" : "value",
9161
9176
  index: n + 1
9162
- } : ol(i, n, r);
9177
+ } : sl(i, n, r);
9163
9178
  case "end": return;
9164
- case "key": return sl(e, n);
9165
- case "value": return cl(e, n, r);
9179
+ case "key": return cl(e, n);
9180
+ case "value": return ll(e, n, r);
9166
9181
  }
9167
9182
  }
9168
- function ol(e, t, n) {
9183
+ function sl(e, t, n) {
9169
9184
  if (e === (n.at(-1) === "{" ? "}" : "]")) return n.pop(), {
9170
9185
  expectation: n.length === 0 ? "end" : "commaOrClose",
9171
9186
  index: t + 1
9172
9187
  };
9173
9188
  }
9174
- function sl(e, t) {
9175
- let n = e.charAt(t) === "\"" ? ll(e, t) : void 0;
9189
+ function cl(e, t) {
9190
+ let n = e.charAt(t) === "\"" ? ul(e, t) : void 0;
9176
9191
  return n == null ? void 0 : {
9177
9192
  expectation: "colon",
9178
9193
  index: n
9179
9194
  };
9180
9195
  }
9181
- function cl(e, t, n) {
9196
+ function ll(e, t, n) {
9182
9197
  let r = e.charAt(t);
9183
9198
  if (r === "{" || r === "[") return n.push(r), {
9184
9199
  expectation: r === "{" ? "closeOrKey" : "closeOrValue",
9185
9200
  index: t + 1
9186
9201
  };
9187
- let i = r === "\"" ? ll(e, t) : dl(e, t);
9202
+ let i = r === "\"" ? ul(e, t) : fl(e, t);
9188
9203
  return i == null ? void 0 : {
9189
9204
  expectation: "commaOrClose",
9190
9205
  index: i
9191
9206
  };
9192
9207
  }
9193
- function ll(e, t) {
9208
+ function ul(e, t) {
9194
9209
  let n = t + 1;
9195
9210
  for (; n < e.length;) {
9196
9211
  let t = e.charAt(n);
9197
9212
  if (t === "\"") return n + 1;
9198
9213
  if (t < " ") return;
9199
9214
  if (t === "\\") {
9200
- let t = ul(e, n);
9215
+ let t = dl(e, n);
9201
9216
  if (t == null) return;
9202
9217
  n = t;
9203
9218
  } else n++;
9204
9219
  }
9205
9220
  return e.length;
9206
9221
  }
9207
- function ul(e, t) {
9222
+ function dl(e, t) {
9208
9223
  let n = e.charAt(t + 1);
9209
9224
  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
9225
  }
9211
- function dl(e, t) {
9226
+ function fl(e, t) {
9212
9227
  let n = /^[\w.+-]+/.exec(e.slice(t))?.[0];
9213
9228
  if (n == null) return;
9214
9229
  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;
9230
+ 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
9231
  }
9217
- function fl(e) {
9232
+ function pl(e) {
9218
9233
  try {
9219
9234
  return typeof JSON.parse(e) == "number";
9220
9235
  } catch {
9221
9236
  return !1;
9222
9237
  }
9223
9238
  }
9224
- function pl(e) {
9239
+ function ml(e) {
9225
9240
  let t = e, n = t.length;
9226
9241
  for (let e = n - 1; e >= 0; e--) {
9227
9242
  let n = t[e];