@dpuse/dpuse-tool-file-previewer 1.0.118 → 1.0.120
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.
|
|
68
|
+
| [@dpuse/dpuse-shared](https://github.com/dpuse/dpuse-shared) | 1.0.134 | MIT | [LICENSE](licenses/downloads/@dpuse/dpuse-shared@1.0.134-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.
|
|
83
|
+
- **[@dpuse/dpuse-shared](https://github.com/dpuse/dpuse-shared)** 1.0.134 — this month: 2026-10-24
|
|
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.
|
|
108
|
+
| **dist/dpuse-tool-file-previewer.es.js** | 1238.8 kB · gzip 718.1 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.
|
|
117
|
+
| src → index.ts | `░░░░░░░░░░░░░░░░░░░░` 0.6% · 6.8 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.
|
|
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
|
|
|
@@ -8938,22 +8938,19 @@ function Mc(e) {
|
|
|
8938
8938
|
return n > t && n < e.length - 1 ? n : void 0;
|
|
8939
8939
|
}
|
|
8940
8940
|
// src/index.ts
|
|
8941
|
-
var Nc = .2, Pc = 4096, Fc = {
|
|
8941
|
+
var Nc = .2, Pc = 4096, Fc = 65536, Ic = {
|
|
8942
8942
|
id: "utf-8",
|
|
8943
8943
|
confidenceLevel: void 0
|
|
8944
|
-
},
|
|
8944
|
+
}, Lc = 256, Rc = /^<\?xml\s[^?]*?\bencoding\s*=\s*(["'])([A-Za-z][\w.:-]*)\1/, zc = [
|
|
8945
8945
|
"false",
|
|
8946
8946
|
"null",
|
|
8947
8947
|
"true"
|
|
8948
|
-
],
|
|
8948
|
+
], Bc = /* @__PURE__ */ new Set([
|
|
8949
8949
|
" ",
|
|
8950
8950
|
" ",
|
|
8951
8951
|
"\n",
|
|
8952
8952
|
"\r"
|
|
8953
|
-
]),
|
|
8954
|
-
markdown: "markdown",
|
|
8955
|
-
md: "markdown"
|
|
8956
|
-
}, Vc = {
|
|
8953
|
+
]), Vc = /* @__PURE__ */ new Set(["markdown", "md"]), Hc = "text/markdown", Uc = "application/octet-stream", Wc = {
|
|
8957
8954
|
arrow: {
|
|
8958
8955
|
label: "Columnar format for tables of data.",
|
|
8959
8956
|
structure: "table",
|
|
@@ -9008,18 +9005,29 @@ var Nc = .2, Pc = 4096, Fc = {
|
|
|
9008
9005
|
isAutoDetectable: !0,
|
|
9009
9006
|
isSupported: !1
|
|
9010
9007
|
}
|
|
9011
|
-
},
|
|
9012
|
-
async previewFile(e, t, n, r = Nc) {
|
|
9013
|
-
let
|
|
9014
|
-
headers: { Range: `bytes=0-${String(
|
|
9008
|
+
}, Gc = class {
|
|
9009
|
+
async previewFile(e, t, n, r, i = Nc) {
|
|
9010
|
+
let a = el(r, jc(new URL(e).pathname)?.toLowerCase()), o = n ?? (a ? Fc : Pc), s = await fetch(encodeURI(e), {
|
|
9011
|
+
headers: { Range: `bytes=0-${String(o - 1)}` },
|
|
9015
9012
|
signal: t
|
|
9016
|
-
})
|
|
9017
|
-
if (
|
|
9018
|
-
|
|
9019
|
-
|
|
9013
|
+
});
|
|
9014
|
+
if (s.status === 416) return {
|
|
9015
|
+
...await qc(/* @__PURE__ */ new Uint8Array(), a, i, !0),
|
|
9016
|
+
isComplete: !0
|
|
9017
|
+
};
|
|
9018
|
+
if (!s.ok) throw await Tc(s, `Failed to fetch '${e}' file.`, "dpuse-tool-file-previewer.previewRemoteFile");
|
|
9019
|
+
let c = new Uint8Array(await s.arrayBuffer()), l = Kc(s, c.length, o);
|
|
9020
|
+
return {
|
|
9021
|
+
...await qc(c, a, i, l),
|
|
9022
|
+
isComplete: l
|
|
9023
|
+
};
|
|
9020
9024
|
}
|
|
9021
9025
|
};
|
|
9022
|
-
|
|
9026
|
+
function Kc(e, t, n) {
|
|
9027
|
+
let r = /\/(\d+)$/.exec(e.headers.get("content-range") ?? "")?.[1];
|
|
9028
|
+
return r == null ? e.status !== 206 || t < n : t >= Number(r);
|
|
9029
|
+
}
|
|
9030
|
+
async function qc(e, t, n, r) {
|
|
9023
9031
|
if (e.length === 0) return {
|
|
9024
9032
|
bytes: e,
|
|
9025
9033
|
dataFormatId: void 0,
|
|
@@ -9029,54 +9037,54 @@ async function Uc(e, t, n) {
|
|
|
9029
9037
|
fileTypeConfig: void 0,
|
|
9030
9038
|
text: void 0
|
|
9031
9039
|
};
|
|
9032
|
-
let
|
|
9033
|
-
if (
|
|
9034
|
-
let
|
|
9040
|
+
let i = await Qs(e);
|
|
9041
|
+
if (i != null) return Jc(e, i, r);
|
|
9042
|
+
let a = Xc(e, n), o = $c(e, a[0] ?? Ic, r);
|
|
9035
9043
|
return {
|
|
9036
9044
|
bytes: e,
|
|
9037
|
-
dataFormatId:
|
|
9038
|
-
encodingId:
|
|
9039
|
-
encodingConfidenceLevel:
|
|
9040
|
-
encodingCandidates:
|
|
9041
|
-
fileTypeConfig:
|
|
9042
|
-
text:
|
|
9045
|
+
dataFormatId: tl(o.text, t),
|
|
9046
|
+
encodingId: o.encoding.id,
|
|
9047
|
+
encodingConfidenceLevel: o.encoding.confidenceLevel,
|
|
9048
|
+
encodingCandidates: a,
|
|
9049
|
+
fileTypeConfig: i,
|
|
9050
|
+
text: o.text
|
|
9043
9051
|
};
|
|
9044
9052
|
}
|
|
9045
|
-
function
|
|
9046
|
-
let
|
|
9053
|
+
function Jc(e, t, n) {
|
|
9054
|
+
let r = Wc[t.ext]?.isSupported === !0 ? t.ext : void 0;
|
|
9047
9055
|
if (t.ext === "xml") {
|
|
9048
|
-
let
|
|
9049
|
-
id:
|
|
9056
|
+
let i = $c(e, {
|
|
9057
|
+
id: Qc(e),
|
|
9050
9058
|
confidenceLevel: 1
|
|
9051
|
-
});
|
|
9059
|
+
}, n);
|
|
9052
9060
|
return {
|
|
9053
9061
|
bytes: e,
|
|
9054
|
-
dataFormatId:
|
|
9055
|
-
encodingId:
|
|
9056
|
-
encodingConfidenceLevel:
|
|
9062
|
+
dataFormatId: r,
|
|
9063
|
+
encodingId: i.encoding.id,
|
|
9064
|
+
encodingConfidenceLevel: i.encoding.confidenceLevel,
|
|
9057
9065
|
encodingCandidates: void 0,
|
|
9058
9066
|
fileTypeConfig: t,
|
|
9059
|
-
text:
|
|
9067
|
+
text: i.text
|
|
9060
9068
|
};
|
|
9061
9069
|
}
|
|
9062
9070
|
return {
|
|
9063
9071
|
bytes: e,
|
|
9064
|
-
dataFormatId:
|
|
9072
|
+
dataFormatId: r,
|
|
9065
9073
|
encodingId: void 0,
|
|
9066
9074
|
encodingConfidenceLevel: void 0,
|
|
9067
9075
|
encodingCandidates: void 0,
|
|
9068
9076
|
fileTypeConfig: t,
|
|
9069
|
-
text:
|
|
9077
|
+
text: Yc(e)
|
|
9070
9078
|
};
|
|
9071
9079
|
}
|
|
9072
|
-
function
|
|
9080
|
+
function Yc(e) {
|
|
9073
9081
|
return Array.from(new TextDecoder("windows-1252").decode(e), (e) => {
|
|
9074
9082
|
let t = e.codePointAt(0) ?? 0;
|
|
9075
9083
|
return t < 32 && e !== " " && e !== "\n" && e !== "\r" || t >= 127 && t <= 159 ? "·" : e;
|
|
9076
9084
|
}).join("");
|
|
9077
9085
|
}
|
|
9078
|
-
function
|
|
9079
|
-
let n =
|
|
9086
|
+
function Xc(e, t) {
|
|
9087
|
+
let n = Zc(e);
|
|
9080
9088
|
if (n != null) return [n];
|
|
9081
9089
|
let r = Oa(e, { minimumThreshold: 0 }), i = [];
|
|
9082
9090
|
for (let { confidence: e, encoding: t } of r) t != null && kc(t) && i.push({
|
|
@@ -9085,7 +9093,7 @@ function Kc(e, t) {
|
|
|
9085
9093
|
});
|
|
9086
9094
|
return i.filter(({ confidenceLevel: e = 0 }, n) => n === 0 || e >= t);
|
|
9087
9095
|
}
|
|
9088
|
-
function
|
|
9096
|
+
function Zc(e) {
|
|
9089
9097
|
return e[0] === 239 && e[1] === 187 && e[2] === 191 ? {
|
|
9090
9098
|
confidenceLevel: 1,
|
|
9091
9099
|
id: "UTF-8-SIG"
|
|
@@ -9097,41 +9105,46 @@ function qc(e) {
|
|
|
9097
9105
|
id: "utf-16-le"
|
|
9098
9106
|
} : void 0;
|
|
9099
9107
|
}
|
|
9100
|
-
function
|
|
9101
|
-
let t = new TextDecoder("ascii").decode(e.subarray(0,
|
|
9102
|
-
return
|
|
9108
|
+
function Qc(e) {
|
|
9109
|
+
let t = new TextDecoder("ascii").decode(e.subarray(0, Lc));
|
|
9110
|
+
return Zc(e)?.id ?? Rc.exec(t)?.[2] ?? "utf-8";
|
|
9103
9111
|
}
|
|
9104
|
-
function
|
|
9112
|
+
function $c(e, t, n) {
|
|
9113
|
+
let r = n ? e : pl(e);
|
|
9105
9114
|
try {
|
|
9106
9115
|
return {
|
|
9107
9116
|
encoding: t,
|
|
9108
|
-
text: new TextDecoder(Ac(t.id)).decode(
|
|
9117
|
+
text: new TextDecoder(Ac(t.id)).decode(r)
|
|
9109
9118
|
};
|
|
9110
9119
|
} catch {
|
|
9111
9120
|
return {
|
|
9112
|
-
encoding:
|
|
9113
|
-
text: new TextDecoder(
|
|
9121
|
+
encoding: Ic,
|
|
9122
|
+
text: new TextDecoder(Ic.id, { fatal: !1 }).decode(r)
|
|
9114
9123
|
};
|
|
9115
9124
|
}
|
|
9116
9125
|
}
|
|
9117
|
-
function
|
|
9118
|
-
|
|
9126
|
+
function el(e, t) {
|
|
9127
|
+
let n = e?.split(";", 1)[0]?.trim().toLowerCase();
|
|
9128
|
+
return n != null && n !== "" && n !== Uc ? n === Hc : t != null && Vc.has(t);
|
|
9119
9129
|
}
|
|
9120
|
-
function
|
|
9130
|
+
function tl(e, t) {
|
|
9131
|
+
return nl(e) ? "json" : rl(e) ? "jsonl" : t ? "markdown" : "dtv";
|
|
9132
|
+
}
|
|
9133
|
+
function nl(e) {
|
|
9121
9134
|
let t = [], n = e.search(/\S/);
|
|
9122
9135
|
if (e[n] !== "{" && e[n] !== "[") return !1;
|
|
9123
9136
|
let r = {
|
|
9124
9137
|
expectation: "value",
|
|
9125
9138
|
index: n
|
|
9126
9139
|
};
|
|
9127
|
-
for (; r != null && r.index < e.length;) r =
|
|
9140
|
+
for (; r != null && r.index < e.length;) r = al(e, r, t);
|
|
9128
9141
|
return r != null;
|
|
9129
9142
|
}
|
|
9130
|
-
function
|
|
9143
|
+
function rl(e) {
|
|
9131
9144
|
let t = e.split(/\r\n|\n|\r/).filter((e) => e.trim() !== "");
|
|
9132
|
-
return t.length > 1 && t.every((e) =>
|
|
9145
|
+
return t.length > 1 && t.every((e) => il(e));
|
|
9133
9146
|
}
|
|
9134
|
-
function
|
|
9147
|
+
function il(e) {
|
|
9135
9148
|
try {
|
|
9136
9149
|
let t = JSON.parse(e);
|
|
9137
9150
|
return typeof t == "object" && !!t;
|
|
@@ -9139,15 +9152,15 @@ function $c(e) {
|
|
|
9139
9152
|
return !1;
|
|
9140
9153
|
}
|
|
9141
9154
|
}
|
|
9142
|
-
function
|
|
9155
|
+
function al(e, { expectation: t, index: n }, r) {
|
|
9143
9156
|
let i = e.charAt(n);
|
|
9144
|
-
if (
|
|
9157
|
+
if (Bc.has(i)) return {
|
|
9145
9158
|
expectation: t,
|
|
9146
9159
|
index: n + 1
|
|
9147
9160
|
};
|
|
9148
9161
|
switch (t) {
|
|
9149
|
-
case "closeOrKey": return i === "}" ?
|
|
9150
|
-
case "closeOrValue": return i === "]" ?
|
|
9162
|
+
case "closeOrKey": return i === "}" ? ol(i, n, r) : sl(e, n);
|
|
9163
|
+
case "closeOrValue": return i === "]" ? ol(i, n, r) : cl(e, n, r);
|
|
9151
9164
|
case "colon": return i === ":" ? {
|
|
9152
9165
|
expectation: "value",
|
|
9153
9166
|
index: n + 1
|
|
@@ -9155,69 +9168,69 @@ function el(e, { expectation: t, index: n }, r) {
|
|
|
9155
9168
|
case "commaOrClose": return i === "," ? {
|
|
9156
9169
|
expectation: r.at(-1) === "{" ? "key" : "value",
|
|
9157
9170
|
index: n + 1
|
|
9158
|
-
} :
|
|
9171
|
+
} : ol(i, n, r);
|
|
9159
9172
|
case "end": return;
|
|
9160
|
-
case "key": return
|
|
9161
|
-
case "value": return
|
|
9173
|
+
case "key": return sl(e, n);
|
|
9174
|
+
case "value": return cl(e, n, r);
|
|
9162
9175
|
}
|
|
9163
9176
|
}
|
|
9164
|
-
function
|
|
9177
|
+
function ol(e, t, n) {
|
|
9165
9178
|
if (e === (n.at(-1) === "{" ? "}" : "]")) return n.pop(), {
|
|
9166
9179
|
expectation: n.length === 0 ? "end" : "commaOrClose",
|
|
9167
9180
|
index: t + 1
|
|
9168
9181
|
};
|
|
9169
9182
|
}
|
|
9170
|
-
function
|
|
9171
|
-
let n = e.charAt(t) === "\"" ?
|
|
9183
|
+
function sl(e, t) {
|
|
9184
|
+
let n = e.charAt(t) === "\"" ? ll(e, t) : void 0;
|
|
9172
9185
|
return n == null ? void 0 : {
|
|
9173
9186
|
expectation: "colon",
|
|
9174
9187
|
index: n
|
|
9175
9188
|
};
|
|
9176
9189
|
}
|
|
9177
|
-
function
|
|
9190
|
+
function cl(e, t, n) {
|
|
9178
9191
|
let r = e.charAt(t);
|
|
9179
9192
|
if (r === "{" || r === "[") return n.push(r), {
|
|
9180
9193
|
expectation: r === "{" ? "closeOrKey" : "closeOrValue",
|
|
9181
9194
|
index: t + 1
|
|
9182
9195
|
};
|
|
9183
|
-
let i = r === "\"" ?
|
|
9196
|
+
let i = r === "\"" ? ll(e, t) : dl(e, t);
|
|
9184
9197
|
return i == null ? void 0 : {
|
|
9185
9198
|
expectation: "commaOrClose",
|
|
9186
9199
|
index: i
|
|
9187
9200
|
};
|
|
9188
9201
|
}
|
|
9189
|
-
function
|
|
9202
|
+
function ll(e, t) {
|
|
9190
9203
|
let n = t + 1;
|
|
9191
9204
|
for (; n < e.length;) {
|
|
9192
9205
|
let t = e.charAt(n);
|
|
9193
9206
|
if (t === "\"") return n + 1;
|
|
9194
9207
|
if (t < " ") return;
|
|
9195
9208
|
if (t === "\\") {
|
|
9196
|
-
let t =
|
|
9209
|
+
let t = ul(e, n);
|
|
9197
9210
|
if (t == null) return;
|
|
9198
9211
|
n = t;
|
|
9199
9212
|
} else n++;
|
|
9200
9213
|
}
|
|
9201
9214
|
return e.length;
|
|
9202
9215
|
}
|
|
9203
|
-
function
|
|
9216
|
+
function ul(e, t) {
|
|
9204
9217
|
let n = e.charAt(t + 1);
|
|
9205
9218
|
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;
|
|
9206
9219
|
}
|
|
9207
|
-
function
|
|
9220
|
+
function dl(e, t) {
|
|
9208
9221
|
let n = /^[\w.+-]+/.exec(e.slice(t))?.[0];
|
|
9209
9222
|
if (n == null) return;
|
|
9210
9223
|
let r = t + n.length;
|
|
9211
|
-
return r === e.length ?
|
|
9224
|
+
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;
|
|
9212
9225
|
}
|
|
9213
|
-
function
|
|
9226
|
+
function fl(e) {
|
|
9214
9227
|
try {
|
|
9215
9228
|
return typeof JSON.parse(e) == "number";
|
|
9216
9229
|
} catch {
|
|
9217
9230
|
return !1;
|
|
9218
9231
|
}
|
|
9219
9232
|
}
|
|
9220
|
-
function
|
|
9233
|
+
function pl(e) {
|
|
9221
9234
|
let t = e, n = t.length;
|
|
9222
9235
|
for (let e = n - 1; e >= 0; e--) {
|
|
9223
9236
|
let n = t[e];
|
|
@@ -9232,4 +9245,4 @@ function cl(e) {
|
|
|
9232
9245
|
}
|
|
9233
9246
|
return t;
|
|
9234
9247
|
}
|
|
9235
|
-
export {
|
|
9248
|
+
export { Gc as Tool };
|