module-develop-kit 1.1.0 → 1.2.1
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/dist/commonjs-virtual-dir/browser.js +5 -2
- package/dist/commonjs-virtual-dir/browser2.js +4 -0
- package/dist/commonjs-virtual-dir/index2.js +5 -3
- package/dist/commonjs-virtual-dir/index3.js +3 -5
- package/dist/commonjs-virtual-dir/index4.js +2 -4
- package/dist/commonjs-virtual-dir/index5.js +2 -2
- package/dist/commonjs-virtual-dir/index6.js +2 -2
- package/dist/commonjs-virtual-dir/index7.js +4 -0
- package/dist/commonjs-virtual-dir/index8.js +4 -0
- package/dist/main.d.ts +140 -29
- package/dist/main.js +34 -22
- package/dist/src/outside-call/utils.js +1 -1
- package/dist/src/shield/crypto/sm4.js +1 -1
- package/dist/src/shield/file-detection.js +143 -0
- package/dist/vendor/@borewit/text-codec/lib/index.js +181 -0
- package/dist/vendor/@tokenizer/inflate/lib/GzipHandler.js +21 -0
- package/dist/vendor/@tokenizer/inflate/lib/ZipHandler.js +156 -0
- package/dist/vendor/@tokenizer/inflate/lib/ZipToken.js +71 -0
- package/dist/vendor/base64-js/index.js +1 -1
- package/dist/vendor/debug/src/browser.js +1 -1
- package/dist/vendor/file-type/source/detectors/asf.js +74 -0
- package/dist/vendor/file-type/source/detectors/ebml.js +61 -0
- package/dist/vendor/file-type/source/detectors/png.js +64 -0
- package/dist/vendor/file-type/source/detectors/zip.js +344 -0
- package/dist/vendor/file-type/source/index.js +1135 -0
- package/dist/vendor/file-type/source/parser.js +49 -0
- package/dist/vendor/file-type/source/supported.js +372 -0
- package/dist/vendor/file-type/source/tokens.js +40 -0
- package/dist/vendor/ieee754/index.js +30 -0
- package/dist/vendor/jsbn/index.js +1 -1
- package/dist/vendor/sdp-transform/lib/index.js +1 -1
- package/dist/vendor/strtok3/lib/AbstractTokenizer.js +92 -0
- package/dist/vendor/strtok3/lib/BlobTokenizer.js +48 -0
- package/dist/vendor/strtok3/lib/BufferTokenizer.js +47 -0
- package/dist/vendor/strtok3/lib/ReadStreamTokenizer.js +91 -0
- package/dist/vendor/strtok3/lib/core.js +22 -0
- package/dist/vendor/strtok3/lib/stream/AbstractStreamReader.js +51 -0
- package/dist/vendor/strtok3/lib/stream/Errors.js +16 -0
- package/dist/vendor/strtok3/lib/stream/WebStreamByobReader.js +18 -0
- package/dist/vendor/strtok3/lib/stream/WebStreamDefaultReader.js +45 -0
- package/dist/vendor/strtok3/lib/stream/WebStreamReader.js +15 -0
- package/dist/vendor/strtok3/lib/stream/WebStreamReaderFactory.js +15 -0
- package/dist/vendor/token-types/lib/index.js +81 -0
- package/dist/vendor/uint8array-extras/index.js +45 -0
- package/package.json +2 -1
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
const u = 16777216;
|
|
2
|
+
class c extends Error {
|
|
3
|
+
}
|
|
4
|
+
function s(e, n, t) {
|
|
5
|
+
if (!Number.isFinite(e) || e < 0 || e > n)
|
|
6
|
+
throw new c(`${t} has invalid size ${e} (maximum ${n} bytes)`);
|
|
7
|
+
return e;
|
|
8
|
+
}
|
|
9
|
+
async function d(e, n, { maximumLength: t = 16777216, reason: r = "skip" } = {}) {
|
|
10
|
+
const i = s(n, t, r);
|
|
11
|
+
await e.ignore(i);
|
|
12
|
+
}
|
|
13
|
+
async function h(e, n, t, { maximumLength: r = n.length, reason: i = "read" } = {}) {
|
|
14
|
+
const f = n.length, a = s(f, r, i);
|
|
15
|
+
return e.readBuffer(n, {
|
|
16
|
+
...t,
|
|
17
|
+
length: a
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
function m(e, n, t) {
|
|
21
|
+
t = {
|
|
22
|
+
offset: 0,
|
|
23
|
+
...t
|
|
24
|
+
};
|
|
25
|
+
for (const [r, i] of n.entries())
|
|
26
|
+
if (t.mask) {
|
|
27
|
+
if (i !== (t.mask[r] & e[r + t.offset]))
|
|
28
|
+
return !1;
|
|
29
|
+
} else if (i !== e[r + t.offset])
|
|
30
|
+
return !1;
|
|
31
|
+
return !0;
|
|
32
|
+
}
|
|
33
|
+
function o(e) {
|
|
34
|
+
const n = e.fileInfo.size;
|
|
35
|
+
return !Number.isFinite(n) || n === Number.MAX_SAFE_INTEGER;
|
|
36
|
+
}
|
|
37
|
+
function g(e, n, t) {
|
|
38
|
+
return o(e) && e.position - n > t;
|
|
39
|
+
}
|
|
40
|
+
export {
|
|
41
|
+
c as ParserHardLimitError,
|
|
42
|
+
m as checkBytes,
|
|
43
|
+
s as getSafeBound,
|
|
44
|
+
g as hasExceededUnknownSizeScanBudget,
|
|
45
|
+
o as hasUnknownFileSize,
|
|
46
|
+
u as maximumUntrustedSkipSizeInBytes,
|
|
47
|
+
d as safeIgnore,
|
|
48
|
+
h as safeReadBuffer
|
|
49
|
+
};
|
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
const a = [
|
|
2
|
+
"jpg",
|
|
3
|
+
"png",
|
|
4
|
+
"apng",
|
|
5
|
+
"gif",
|
|
6
|
+
"webp",
|
|
7
|
+
"flif",
|
|
8
|
+
"xcf",
|
|
9
|
+
"cr2",
|
|
10
|
+
"cr3",
|
|
11
|
+
"orf",
|
|
12
|
+
"arw",
|
|
13
|
+
"dng",
|
|
14
|
+
"nef",
|
|
15
|
+
"rw2",
|
|
16
|
+
"raf",
|
|
17
|
+
"tif",
|
|
18
|
+
"bmp",
|
|
19
|
+
"icns",
|
|
20
|
+
"jxr",
|
|
21
|
+
"psd",
|
|
22
|
+
"indd",
|
|
23
|
+
"zip",
|
|
24
|
+
"tar",
|
|
25
|
+
"rar",
|
|
26
|
+
"gz",
|
|
27
|
+
"bz2",
|
|
28
|
+
"7z",
|
|
29
|
+
"dmg",
|
|
30
|
+
"mp4",
|
|
31
|
+
"mid",
|
|
32
|
+
"mkv",
|
|
33
|
+
"webm",
|
|
34
|
+
"mov",
|
|
35
|
+
"avi",
|
|
36
|
+
"mpg",
|
|
37
|
+
"mp2",
|
|
38
|
+
"mp3",
|
|
39
|
+
"m4a",
|
|
40
|
+
"oga",
|
|
41
|
+
"ogg",
|
|
42
|
+
"ogv",
|
|
43
|
+
"opus",
|
|
44
|
+
"flac",
|
|
45
|
+
"wav",
|
|
46
|
+
"spx",
|
|
47
|
+
"amr",
|
|
48
|
+
"pdf",
|
|
49
|
+
"epub",
|
|
50
|
+
"elf",
|
|
51
|
+
"macho",
|
|
52
|
+
"exe",
|
|
53
|
+
"swf",
|
|
54
|
+
"rtf",
|
|
55
|
+
"wasm",
|
|
56
|
+
"woff",
|
|
57
|
+
"woff2",
|
|
58
|
+
"eot",
|
|
59
|
+
"ttf",
|
|
60
|
+
"otf",
|
|
61
|
+
"ttc",
|
|
62
|
+
"ico",
|
|
63
|
+
"flv",
|
|
64
|
+
"ps",
|
|
65
|
+
"xz",
|
|
66
|
+
"sqlite",
|
|
67
|
+
"nes",
|
|
68
|
+
"crx",
|
|
69
|
+
"xpi",
|
|
70
|
+
"cab",
|
|
71
|
+
"deb",
|
|
72
|
+
"ar",
|
|
73
|
+
"rpm",
|
|
74
|
+
"Z",
|
|
75
|
+
"lz",
|
|
76
|
+
"cfb",
|
|
77
|
+
"mxf",
|
|
78
|
+
"mts",
|
|
79
|
+
"blend",
|
|
80
|
+
"bpg",
|
|
81
|
+
"docx",
|
|
82
|
+
"pptx",
|
|
83
|
+
"xlsx",
|
|
84
|
+
"3gp",
|
|
85
|
+
"3g2",
|
|
86
|
+
"j2c",
|
|
87
|
+
"jp2",
|
|
88
|
+
"jpm",
|
|
89
|
+
"jpx",
|
|
90
|
+
"mj2",
|
|
91
|
+
"aif",
|
|
92
|
+
"qcp",
|
|
93
|
+
"odt",
|
|
94
|
+
"ods",
|
|
95
|
+
"odp",
|
|
96
|
+
"xml",
|
|
97
|
+
"mobi",
|
|
98
|
+
"heic",
|
|
99
|
+
"cur",
|
|
100
|
+
"ktx",
|
|
101
|
+
"ape",
|
|
102
|
+
"wv",
|
|
103
|
+
"dcm",
|
|
104
|
+
"ics",
|
|
105
|
+
"glb",
|
|
106
|
+
"pcap",
|
|
107
|
+
"dsf",
|
|
108
|
+
"lnk",
|
|
109
|
+
"alias",
|
|
110
|
+
"voc",
|
|
111
|
+
"ac3",
|
|
112
|
+
"m4v",
|
|
113
|
+
"m4p",
|
|
114
|
+
"m4b",
|
|
115
|
+
"f4v",
|
|
116
|
+
"f4p",
|
|
117
|
+
"f4b",
|
|
118
|
+
"f4a",
|
|
119
|
+
"mie",
|
|
120
|
+
"asf",
|
|
121
|
+
"ogm",
|
|
122
|
+
"ogx",
|
|
123
|
+
"mpc",
|
|
124
|
+
"arrow",
|
|
125
|
+
"shp",
|
|
126
|
+
"aac",
|
|
127
|
+
"mp1",
|
|
128
|
+
"it",
|
|
129
|
+
"s3m",
|
|
130
|
+
"xm",
|
|
131
|
+
"skp",
|
|
132
|
+
"avif",
|
|
133
|
+
"eps",
|
|
134
|
+
"lzh",
|
|
135
|
+
"pgp",
|
|
136
|
+
"asar",
|
|
137
|
+
"stl",
|
|
138
|
+
"chm",
|
|
139
|
+
"3mf",
|
|
140
|
+
"zst",
|
|
141
|
+
"jxl",
|
|
142
|
+
"vcf",
|
|
143
|
+
"jls",
|
|
144
|
+
"pst",
|
|
145
|
+
"dwg",
|
|
146
|
+
"parquet",
|
|
147
|
+
"class",
|
|
148
|
+
"arj",
|
|
149
|
+
"cpio",
|
|
150
|
+
"ace",
|
|
151
|
+
"avro",
|
|
152
|
+
"icc",
|
|
153
|
+
"fbx",
|
|
154
|
+
"vsdx",
|
|
155
|
+
"vtt",
|
|
156
|
+
"apk",
|
|
157
|
+
"drc",
|
|
158
|
+
"lz4",
|
|
159
|
+
"potx",
|
|
160
|
+
"xltx",
|
|
161
|
+
"dotx",
|
|
162
|
+
"xltm",
|
|
163
|
+
"ott",
|
|
164
|
+
"ots",
|
|
165
|
+
"otp",
|
|
166
|
+
"odg",
|
|
167
|
+
"otg",
|
|
168
|
+
"xlsm",
|
|
169
|
+
"docm",
|
|
170
|
+
"dotm",
|
|
171
|
+
"potm",
|
|
172
|
+
"pptm",
|
|
173
|
+
"jar",
|
|
174
|
+
"jmp",
|
|
175
|
+
"rm",
|
|
176
|
+
"sav",
|
|
177
|
+
"ppsm",
|
|
178
|
+
"ppsx",
|
|
179
|
+
"tar.gz",
|
|
180
|
+
"reg",
|
|
181
|
+
"dat",
|
|
182
|
+
"key",
|
|
183
|
+
"numbers",
|
|
184
|
+
"pages"
|
|
185
|
+
], i = [
|
|
186
|
+
"image/jpeg",
|
|
187
|
+
"image/png",
|
|
188
|
+
"image/gif",
|
|
189
|
+
"image/webp",
|
|
190
|
+
"image/flif",
|
|
191
|
+
"image/x-xcf",
|
|
192
|
+
"image/x-canon-cr2",
|
|
193
|
+
"image/x-canon-cr3",
|
|
194
|
+
"image/tiff",
|
|
195
|
+
"image/bmp",
|
|
196
|
+
"image/vnd.ms-photo",
|
|
197
|
+
"image/vnd.adobe.photoshop",
|
|
198
|
+
"application/x-indesign",
|
|
199
|
+
"application/epub+zip",
|
|
200
|
+
"application/x-xpinstall",
|
|
201
|
+
"application/vnd.ms-powerpoint.slideshow.macroenabled.12",
|
|
202
|
+
"application/vnd.oasis.opendocument.text",
|
|
203
|
+
"application/vnd.oasis.opendocument.spreadsheet",
|
|
204
|
+
"application/vnd.oasis.opendocument.presentation",
|
|
205
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
206
|
+
"application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
|
207
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
208
|
+
"application/vnd.openxmlformats-officedocument.presentationml.slideshow",
|
|
209
|
+
"application/zip",
|
|
210
|
+
"application/x-tar",
|
|
211
|
+
"application/x-rar-compressed",
|
|
212
|
+
"application/gzip",
|
|
213
|
+
"application/x-bzip2",
|
|
214
|
+
"application/x-7z-compressed",
|
|
215
|
+
"application/x-apple-diskimage",
|
|
216
|
+
"application/vnd.apache.arrow.file",
|
|
217
|
+
"video/mp4",
|
|
218
|
+
"audio/midi",
|
|
219
|
+
"video/matroska",
|
|
220
|
+
"video/webm",
|
|
221
|
+
"video/quicktime",
|
|
222
|
+
"video/vnd.avi",
|
|
223
|
+
"audio/wav",
|
|
224
|
+
"audio/qcelp",
|
|
225
|
+
"audio/x-ms-asf",
|
|
226
|
+
"video/x-ms-asf",
|
|
227
|
+
"application/vnd.ms-asf",
|
|
228
|
+
"video/mpeg",
|
|
229
|
+
"video/3gpp",
|
|
230
|
+
"audio/mpeg",
|
|
231
|
+
"audio/mp4",
|
|
232
|
+
// RFC 4337
|
|
233
|
+
"video/ogg",
|
|
234
|
+
"audio/ogg",
|
|
235
|
+
"audio/ogg; codecs=opus",
|
|
236
|
+
"application/ogg",
|
|
237
|
+
"audio/flac",
|
|
238
|
+
"audio/ape",
|
|
239
|
+
"audio/wavpack",
|
|
240
|
+
"audio/amr",
|
|
241
|
+
"application/pdf",
|
|
242
|
+
"application/x-elf",
|
|
243
|
+
"application/x-mach-binary",
|
|
244
|
+
"application/x-msdownload",
|
|
245
|
+
"application/x-shockwave-flash",
|
|
246
|
+
"application/rtf",
|
|
247
|
+
"application/wasm",
|
|
248
|
+
"font/woff",
|
|
249
|
+
"font/woff2",
|
|
250
|
+
"application/vnd.ms-fontobject",
|
|
251
|
+
"font/ttf",
|
|
252
|
+
"font/otf",
|
|
253
|
+
"font/collection",
|
|
254
|
+
"image/x-icon",
|
|
255
|
+
"video/x-flv",
|
|
256
|
+
"application/postscript",
|
|
257
|
+
"application/eps",
|
|
258
|
+
"application/x-xz",
|
|
259
|
+
"application/x-sqlite3",
|
|
260
|
+
"application/x-nintendo-nes-rom",
|
|
261
|
+
"application/x-google-chrome-extension",
|
|
262
|
+
"application/vnd.ms-cab-compressed",
|
|
263
|
+
"application/x-deb",
|
|
264
|
+
"application/x-unix-archive",
|
|
265
|
+
"application/x-rpm",
|
|
266
|
+
"application/x-compress",
|
|
267
|
+
"application/lzip",
|
|
268
|
+
"application/x-cfb",
|
|
269
|
+
"application/x-mie",
|
|
270
|
+
"application/mxf",
|
|
271
|
+
"video/mp2t",
|
|
272
|
+
"application/x-blender",
|
|
273
|
+
"image/bpg",
|
|
274
|
+
"image/j2c",
|
|
275
|
+
"image/jp2",
|
|
276
|
+
"image/jpx",
|
|
277
|
+
"image/jpm",
|
|
278
|
+
"image/mj2",
|
|
279
|
+
"audio/aiff",
|
|
280
|
+
"application/xml",
|
|
281
|
+
"application/x-mobipocket-ebook",
|
|
282
|
+
"image/heif",
|
|
283
|
+
"image/heif-sequence",
|
|
284
|
+
"image/heic",
|
|
285
|
+
"image/heic-sequence",
|
|
286
|
+
"image/icns",
|
|
287
|
+
"image/ktx",
|
|
288
|
+
"application/dicom",
|
|
289
|
+
"audio/x-musepack",
|
|
290
|
+
"text/calendar",
|
|
291
|
+
"text/vcard",
|
|
292
|
+
"text/vtt",
|
|
293
|
+
"model/gltf-binary",
|
|
294
|
+
"application/vnd.tcpdump.pcap",
|
|
295
|
+
"audio/x-dsf",
|
|
296
|
+
// Non-standard
|
|
297
|
+
"application/x-ms-shortcut",
|
|
298
|
+
// Informal, used by freedesktop.org shared-mime-info
|
|
299
|
+
"application/x-ft-apple.alias",
|
|
300
|
+
"audio/x-voc",
|
|
301
|
+
"audio/vnd.dolby.dd-raw",
|
|
302
|
+
"audio/x-m4a",
|
|
303
|
+
"image/apng",
|
|
304
|
+
"image/x-olympus-orf",
|
|
305
|
+
"image/x-sony-arw",
|
|
306
|
+
"image/x-adobe-dng",
|
|
307
|
+
"image/x-nikon-nef",
|
|
308
|
+
"image/x-panasonic-rw2",
|
|
309
|
+
"image/x-fujifilm-raf",
|
|
310
|
+
"video/x-m4v",
|
|
311
|
+
"video/3gpp2",
|
|
312
|
+
"application/x-esri-shape",
|
|
313
|
+
"audio/aac",
|
|
314
|
+
"audio/x-it",
|
|
315
|
+
"audio/x-s3m",
|
|
316
|
+
"audio/x-xm",
|
|
317
|
+
"video/MP1S",
|
|
318
|
+
"video/MP2P",
|
|
319
|
+
"application/vnd.sketchup.skp",
|
|
320
|
+
"image/avif",
|
|
321
|
+
"application/x-lzh-compressed",
|
|
322
|
+
"application/pgp-encrypted",
|
|
323
|
+
"application/x-asar",
|
|
324
|
+
"model/stl",
|
|
325
|
+
"application/vnd.ms-htmlhelp",
|
|
326
|
+
"model/3mf",
|
|
327
|
+
"image/jxl",
|
|
328
|
+
"application/zstd",
|
|
329
|
+
"image/jls",
|
|
330
|
+
"application/vnd.ms-outlook",
|
|
331
|
+
"image/vnd.dwg",
|
|
332
|
+
"application/vnd.apache.parquet",
|
|
333
|
+
"application/java-vm",
|
|
334
|
+
"application/x-arj",
|
|
335
|
+
"application/x-cpio",
|
|
336
|
+
"application/x-ace-compressed",
|
|
337
|
+
"application/avro",
|
|
338
|
+
"application/vnd.iccprofile",
|
|
339
|
+
"application/x-ft-fbx",
|
|
340
|
+
"application/vnd.visio",
|
|
341
|
+
"application/vnd.android.package-archive",
|
|
342
|
+
"application/x-ft-draco",
|
|
343
|
+
"application/x-lz4",
|
|
344
|
+
// Informal, used by freedesktop.org shared-mime-info
|
|
345
|
+
"application/vnd.openxmlformats-officedocument.presentationml.template",
|
|
346
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.template",
|
|
347
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.template",
|
|
348
|
+
"application/vnd.ms-excel.template.macroenabled.12",
|
|
349
|
+
"application/vnd.oasis.opendocument.text-template",
|
|
350
|
+
"application/vnd.oasis.opendocument.spreadsheet-template",
|
|
351
|
+
"application/vnd.oasis.opendocument.presentation-template",
|
|
352
|
+
"application/vnd.oasis.opendocument.graphics",
|
|
353
|
+
"application/vnd.oasis.opendocument.graphics-template",
|
|
354
|
+
"application/vnd.ms-excel.sheet.macroenabled.12",
|
|
355
|
+
"application/vnd.ms-word.document.macroenabled.12",
|
|
356
|
+
"application/vnd.ms-word.template.macroenabled.12",
|
|
357
|
+
"application/vnd.ms-powerpoint.template.macroenabled.12",
|
|
358
|
+
"application/vnd.ms-powerpoint.presentation.macroenabled.12",
|
|
359
|
+
"application/java-archive",
|
|
360
|
+
"application/vnd.rn-realmedia",
|
|
361
|
+
"application/x-spss-sav",
|
|
362
|
+
"application/x-ms-regedit",
|
|
363
|
+
"application/x-ft-windows-registry-hive",
|
|
364
|
+
"application/x-jmp-data",
|
|
365
|
+
"application/vnd.apple.keynote",
|
|
366
|
+
"application/vnd.apple.numbers",
|
|
367
|
+
"application/vnd.apple.pages"
|
|
368
|
+
];
|
|
369
|
+
export {
|
|
370
|
+
a as extensions,
|
|
371
|
+
i as mimeTypes
|
|
372
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { StringType as o } from "../../token-types/lib/index.js";
|
|
2
|
+
function u(e, n) {
|
|
3
|
+
if (n === "utf-16le") {
|
|
4
|
+
const c = [];
|
|
5
|
+
for (let r = 0; r < e.length; r++) {
|
|
6
|
+
const t = e.charCodeAt(r);
|
|
7
|
+
c.push(t & 255, t >> 8 & 255);
|
|
8
|
+
}
|
|
9
|
+
return c;
|
|
10
|
+
}
|
|
11
|
+
if (n === "utf-16be") {
|
|
12
|
+
const c = [];
|
|
13
|
+
for (let r = 0; r < e.length; r++) {
|
|
14
|
+
const t = e.charCodeAt(r);
|
|
15
|
+
c.push(t >> 8 & 255, t & 255);
|
|
16
|
+
}
|
|
17
|
+
return c;
|
|
18
|
+
}
|
|
19
|
+
return [...e].map((c) => c.charCodeAt(0));
|
|
20
|
+
}
|
|
21
|
+
function F(e, n = 0) {
|
|
22
|
+
const c = Number.parseInt(new o(6).get(e, 148).replace(new RegExp("\\0.*$", "v"), "").trim(), 8);
|
|
23
|
+
if (Number.isNaN(c))
|
|
24
|
+
return !1;
|
|
25
|
+
let r = 8 * 32;
|
|
26
|
+
for (let t = n; t < n + 148; t++)
|
|
27
|
+
r += e[t];
|
|
28
|
+
for (let t = n + 156; t < n + 512; t++)
|
|
29
|
+
r += e[t];
|
|
30
|
+
return c === r;
|
|
31
|
+
}
|
|
32
|
+
const l = {
|
|
33
|
+
get: (e, n) => e[n + 3] & 127 | (e[n + 2] & 127) << 7 | (e[n + 1] & 127) << 14 | (e[n] & 127) << 21,
|
|
34
|
+
len: 4
|
|
35
|
+
};
|
|
36
|
+
export {
|
|
37
|
+
u as stringToBytes,
|
|
38
|
+
F as tarHeaderChecksumMatches,
|
|
39
|
+
l as uint32SyncSafeToken
|
|
40
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { __exports as n } from "../../commonjs-virtual-dir/index7.js";
|
|
2
|
+
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
3
|
+
var d;
|
|
4
|
+
function q() {
|
|
5
|
+
return d ? n : (d = 1, n.read = function(s, a, N, w, M) {
|
|
6
|
+
var t, r, h = M * 8 - w - 1, e = (1 << h) - 1, f = e >> 1, i = -7, o = N ? M - 1 : 0, x = N ? -1 : 1, p = s[a + o];
|
|
7
|
+
for (o += x, t = p & (1 << -i) - 1, p >>= -i, i += h; i > 0; t = t * 256 + s[a + o], o += x, i -= 8)
|
|
8
|
+
;
|
|
9
|
+
for (r = t & (1 << -i) - 1, t >>= -i, i += w; i > 0; r = r * 256 + s[a + o], o += x, i -= 8)
|
|
10
|
+
;
|
|
11
|
+
if (t === 0)
|
|
12
|
+
t = 1 - f;
|
|
13
|
+
else {
|
|
14
|
+
if (t === e)
|
|
15
|
+
return r ? NaN : (p ? -1 : 1) * (1 / 0);
|
|
16
|
+
r = r + Math.pow(2, w), t = t - f;
|
|
17
|
+
}
|
|
18
|
+
return (p ? -1 : 1) * r * Math.pow(2, t - w);
|
|
19
|
+
}, n.write = function(s, a, N, w, M, t) {
|
|
20
|
+
var r, h, e, f = t * 8 - M - 1, i = (1 << f) - 1, o = i >> 1, x = M === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, p = w ? 0 : t - 1, c = w ? 1 : -1, I = a < 0 || a === 0 && 1 / a < 0 ? 1 : 0;
|
|
21
|
+
for (a = Math.abs(a), isNaN(a) || a === 1 / 0 ? (h = isNaN(a) ? 1 : 0, r = i) : (r = Math.floor(Math.log(a) / Math.LN2), a * (e = Math.pow(2, -r)) < 1 && (r--, e *= 2), r + o >= 1 ? a += x / e : a += x * Math.pow(2, 1 - o), a * e >= 2 && (r++, e /= 2), r + o >= i ? (h = 0, r = i) : r + o >= 1 ? (h = (a * e - 1) * Math.pow(2, M), r = r + o) : (h = a * Math.pow(2, o - 1) * Math.pow(2, M), r = 0)); M >= 8; s[N + p] = h & 255, p += c, h /= 256, M -= 8)
|
|
22
|
+
;
|
|
23
|
+
for (r = r << M | h, f += M; f > 0; s[N + p] = r & 255, p += c, r /= 256, f -= 8)
|
|
24
|
+
;
|
|
25
|
+
s[N + p - c] |= I * 128;
|
|
26
|
+
}, n);
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
q as __require
|
|
30
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __exports as r } from "../../../commonjs-virtual-dir/
|
|
1
|
+
import { __exports as r } from "../../../commonjs-virtual-dir/index5.js";
|
|
2
2
|
import { __require as t } from "./parser.js";
|
|
3
3
|
import { __require as m } from "./writer.js";
|
|
4
4
|
import { __require as p } from "./grammar.js";
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { EndOfStreamError as i } from "./stream/Errors.js";
|
|
2
|
+
class a {
|
|
3
|
+
/**
|
|
4
|
+
* Constructor
|
|
5
|
+
* @param options Tokenizer options
|
|
6
|
+
* @protected
|
|
7
|
+
*/
|
|
8
|
+
constructor(e) {
|
|
9
|
+
this.numBuffer = new Uint8Array(8), this.position = 0, this.onClose = e?.onClose, e?.abortSignal && e.abortSignal.addEventListener("abort", () => {
|
|
10
|
+
this.abort();
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Read a token from the tokenizer-stream
|
|
15
|
+
* @param token - The token to read
|
|
16
|
+
* @param position - If provided, the desired position in the tokenizer-stream
|
|
17
|
+
* @returns Promise with token data
|
|
18
|
+
*/
|
|
19
|
+
async readToken(e, t = this.position) {
|
|
20
|
+
const n = new Uint8Array(e.len);
|
|
21
|
+
if (await this.readBuffer(n, { position: t }) < e.len)
|
|
22
|
+
throw new i();
|
|
23
|
+
return e.get(n, 0);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Peek a token from the tokenizer-stream.
|
|
27
|
+
* @param token - Token to peek from the tokenizer-stream.
|
|
28
|
+
* @param position - Offset where to begin reading within the file. If position is null, data will be read from the current file position.
|
|
29
|
+
* @returns Promise with token data
|
|
30
|
+
*/
|
|
31
|
+
async peekToken(e, t = this.position) {
|
|
32
|
+
const n = new Uint8Array(e.len);
|
|
33
|
+
if (await this.peekBuffer(n, { position: t }) < e.len)
|
|
34
|
+
throw new i();
|
|
35
|
+
return e.get(n, 0);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Read a numeric token from the stream
|
|
39
|
+
* @param token - Numeric token
|
|
40
|
+
* @returns Promise with number
|
|
41
|
+
*/
|
|
42
|
+
async readNumber(e) {
|
|
43
|
+
if (await this.readBuffer(this.numBuffer, { length: e.len }) < e.len)
|
|
44
|
+
throw new i();
|
|
45
|
+
return e.get(this.numBuffer, 0);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Read a numeric token from the stream
|
|
49
|
+
* @param token - Numeric token
|
|
50
|
+
* @returns Promise with number
|
|
51
|
+
*/
|
|
52
|
+
async peekNumber(e) {
|
|
53
|
+
if (await this.peekBuffer(this.numBuffer, { length: e.len }) < e.len)
|
|
54
|
+
throw new i();
|
|
55
|
+
return e.get(this.numBuffer, 0);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Ignore number of bytes, advances the pointer in under tokenizer-stream.
|
|
59
|
+
* @param length - Number of bytes to ignore. Must be ≥ 0.
|
|
60
|
+
* @return resolves the number of bytes ignored, equals length if this available, otherwise the number of bytes available
|
|
61
|
+
*/
|
|
62
|
+
async ignore(e) {
|
|
63
|
+
if (e < 0)
|
|
64
|
+
throw new RangeError("ignore length must be ≥ 0 bytes");
|
|
65
|
+
if (this.fileInfo.size !== void 0) {
|
|
66
|
+
const t = this.fileInfo.size - this.position;
|
|
67
|
+
if (e > t)
|
|
68
|
+
return this.position += t, t;
|
|
69
|
+
}
|
|
70
|
+
return this.position += e, e;
|
|
71
|
+
}
|
|
72
|
+
async close() {
|
|
73
|
+
await this.abort(), await this.onClose?.();
|
|
74
|
+
}
|
|
75
|
+
normalizeOptions(e, t) {
|
|
76
|
+
if (!this.supportsRandomAccess() && t && t.position !== void 0 && t.position < this.position)
|
|
77
|
+
throw new Error("`options.position` must be equal or greater than `tokenizer.position`");
|
|
78
|
+
return {
|
|
79
|
+
mayBeLess: !1,
|
|
80
|
+
offset: 0,
|
|
81
|
+
length: e.length,
|
|
82
|
+
position: this.position,
|
|
83
|
+
...t
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
abort() {
|
|
87
|
+
return Promise.resolve();
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
export {
|
|
91
|
+
a as AbstractTokenizer
|
|
92
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { EndOfStreamError as o } from "./stream/Errors.js";
|
|
2
|
+
import { AbstractTokenizer as n } from "./AbstractTokenizer.js";
|
|
3
|
+
class c extends n {
|
|
4
|
+
/**
|
|
5
|
+
* Construct BufferTokenizer
|
|
6
|
+
* @param blob - Uint8Array to tokenize
|
|
7
|
+
* @param options Tokenizer options
|
|
8
|
+
*/
|
|
9
|
+
constructor(e, s) {
|
|
10
|
+
super(s), this.blob = e, this.fileInfo = { ...s?.fileInfo ?? {}, size: e.size, mimeType: e.type };
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Read buffer from tokenizer
|
|
14
|
+
* @param uint8Array - Uint8Array to tokenize
|
|
15
|
+
* @param options - Read behaviour options
|
|
16
|
+
* @returns {Promise<number>}
|
|
17
|
+
*/
|
|
18
|
+
async readBuffer(e, s) {
|
|
19
|
+
s?.position && (this.position = s.position);
|
|
20
|
+
const t = await this.peekBuffer(e, s);
|
|
21
|
+
return this.position += t, t;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Peek (read ahead) buffer from tokenizer
|
|
25
|
+
* @param buffer
|
|
26
|
+
* @param options - Read behaviour options
|
|
27
|
+
* @returns {Promise<number>}
|
|
28
|
+
*/
|
|
29
|
+
async peekBuffer(e, s) {
|
|
30
|
+
const t = this.normalizeOptions(e, s), i = Math.min(this.blob.size - t.position, t.length);
|
|
31
|
+
if (!t.mayBeLess && i < t.length)
|
|
32
|
+
throw new o();
|
|
33
|
+
const r = await this.blob.slice(t.position, t.position + i).arrayBuffer();
|
|
34
|
+
return e.set(new Uint8Array(r)), i;
|
|
35
|
+
}
|
|
36
|
+
close() {
|
|
37
|
+
return super.close();
|
|
38
|
+
}
|
|
39
|
+
supportsRandomAccess() {
|
|
40
|
+
return !0;
|
|
41
|
+
}
|
|
42
|
+
setPosition(e) {
|
|
43
|
+
this.position = e;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
export {
|
|
47
|
+
c as BlobTokenizer
|
|
48
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { EndOfStreamError as r } from "./stream/Errors.js";
|
|
2
|
+
import { AbstractTokenizer as o } from "./AbstractTokenizer.js";
|
|
3
|
+
class p extends o {
|
|
4
|
+
/**
|
|
5
|
+
* Construct BufferTokenizer
|
|
6
|
+
* @param uint8Array - Uint8Array to tokenize
|
|
7
|
+
* @param options Tokenizer options
|
|
8
|
+
*/
|
|
9
|
+
constructor(t, s) {
|
|
10
|
+
super(s), this.uint8Array = t, this.fileInfo = { ...s?.fileInfo ?? {}, size: t.length };
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Read buffer from tokenizer
|
|
14
|
+
* @param uint8Array - Uint8Array to tokenize
|
|
15
|
+
* @param options - Read behaviour options
|
|
16
|
+
* @returns {Promise<number>}
|
|
17
|
+
*/
|
|
18
|
+
async readBuffer(t, s) {
|
|
19
|
+
s?.position && (this.position = s.position);
|
|
20
|
+
const e = await this.peekBuffer(t, s);
|
|
21
|
+
return this.position += e, e;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Peek (read ahead) buffer from tokenizer
|
|
25
|
+
* @param uint8Array
|
|
26
|
+
* @param options - Read behaviour options
|
|
27
|
+
* @returns {Promise<number>}
|
|
28
|
+
*/
|
|
29
|
+
async peekBuffer(t, s) {
|
|
30
|
+
const e = this.normalizeOptions(t, s), i = Math.min(this.uint8Array.length - e.position, e.length);
|
|
31
|
+
if (!e.mayBeLess && i < e.length)
|
|
32
|
+
throw new r();
|
|
33
|
+
return t.set(this.uint8Array.subarray(e.position, e.position + i)), i;
|
|
34
|
+
}
|
|
35
|
+
close() {
|
|
36
|
+
return super.close();
|
|
37
|
+
}
|
|
38
|
+
supportsRandomAccess() {
|
|
39
|
+
return !0;
|
|
40
|
+
}
|
|
41
|
+
setPosition(t) {
|
|
42
|
+
this.position = t;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
export {
|
|
46
|
+
p as BufferTokenizer
|
|
47
|
+
};
|