@innovatorved/code-lab 0.7.1 → 0.7.2
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/ARCHITECTURE.md +2 -2
- package/CHANGELOG.md +10 -0
- package/README.md +5 -5
- package/dist/code-lab-sql.esm.js +2 -2
- package/dist/code-lab-sql.umd.js +3 -3
- package/dist/code-lab.css +1 -1
- package/dist/code-lab.d.ts +47 -38
- package/dist/code-lab.esm.js +918 -884
- package/dist/code-lab.js +917 -881
- package/dist/extensions/cpp.esm.js +33 -33
- package/dist/extensions/cpp.js +33 -33
- package/dist/extensions/python.esm.js +79 -49
- package/dist/extensions/python.js +79 -49
- package/dist/index.d.ts +1 -1
- package/dist/logger.d.ts +4 -20
- package/dist/modular-kernel.d.ts +0 -1
- package/dist/packages/core/src/errors.d.ts +5 -1
- package/dist/packages/fs/src/backends.d.ts +0 -27
- package/dist/packages/fs/src/index.d.ts +1 -1
- package/dist/packages/ui/src/html.d.ts +1 -0
- package/dist/packages/ui/src/index.d.ts +1 -0
- package/dist/{apps/web/src/index.d.ts → packages/ui/src/kernel.d.ts} +3 -2
- package/dist/packages/ui/src/observability.d.ts +1 -1
- package/dist/packages/ui/src/settings-dialog.d.ts +0 -1
- package/dist/preview-sw.js +1 -1
- package/dist/runtime.d.ts +3 -0
- package/dist/runtime.esm.js +2 -2
- package/dist/runtime.js +2 -2
- package/dist/schemas.d.ts +1 -1
- package/dist/shell.esm.js +277 -285
- package/dist/shell.js +277 -285
- package/dist/terminal.esm.js +2 -2
- package/dist/terminal.js +2 -2
- package/dist/workbench/editor.d.ts +0 -4
- package/dist/workbench/index.d.ts +0 -2
- package/dist/workbench/intellisense.d.ts +0 -1
- package/dist/workbench/xterm-adapter.d.ts +0 -1
- package/package.json +2 -4
- package/src/code-lab.css +0 -8086
- package/src/csp.ts +0 -590
- package/src/diagnostics.ts +0 -287
- package/src/extensions/cpp.ts +0 -2371
- package/src/extensions/guided-lab.ts +0 -68
- package/src/extensions/javascript.ts +0 -54
- package/src/extensions/python.ts +0 -1743
- package/src/extensions/typescript.ts +0 -85
- package/src/extensions/umbrella.ts +0 -5
- package/src/html.ts +0 -88
- package/src/index.ts +0 -129
- package/src/logger.ts +0 -139
- package/src/modular-kernel.ts +0 -7
- package/src/preview-sw.js +0 -296
- package/src/runtime/test-harness.ts +0 -57
- package/src/runtime.ts +0 -10565
- package/src/sample.html +0 -304
- package/src/schemas.ts +0 -366
- package/src/scm.ts +0 -2453
- package/src/search.ts +0 -433
- package/src/shell.ts +0 -10990
- package/src/storage.ts +0 -773
- package/src/terminal.ts +0 -1402
- package/src/workbench/command-palette.ts +0 -101
- package/src/workbench/diff-editor.ts +0 -472
- package/src/workbench/editor.ts +0 -49
- package/src/workbench/icons.ts +0 -255
- package/src/workbench/index.ts +0 -29
- package/src/workbench/intellisense.ts +0 -1884
- package/src/workbench/share.ts +0 -128
- package/src/workbench/xterm-adapter.ts +0 -1571
- package/src/workbench.ts +0 -21825
- package/src/zip.ts +0 -348
package/src/zip.ts
DELETED
|
@@ -1,348 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @innovatorved/code-lab — Zero-Dependency PKZip v2.0 Archive Engine
|
|
3
|
-
* ============================================================================
|
|
4
|
-
* Pure TypeScript implementation of PKZip 2.0 (Store method 0 + UTF-8 flag
|
|
5
|
-
* bit 11 + IEEE 802.3 CRC32) for browser and Node/Bun project export & import.
|
|
6
|
-
*
|
|
7
|
-
* Includes built-in Zip-Slip path traversal sanitization and header integrity
|
|
8
|
-
* verification.
|
|
9
|
-
*
|
|
10
|
-
* Strict leaf module: fully typed, zero explicit any, zero empty catches.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
const LOCAL_FILE_HEADER_SIG = 0x04034b50;
|
|
14
|
-
const CENTRAL_DIR_HEADER_SIG = 0x02014b50;
|
|
15
|
-
const END_OF_CENTRAL_DIR_SIG = 0x06054b50;
|
|
16
|
-
const UTF8_FLAG = 0x0800;
|
|
17
|
-
|
|
18
|
-
/** Precomputed IEEE 802.3 CRC32 lookup table. */
|
|
19
|
-
const CRC32_TABLE = new Uint32Array(256);
|
|
20
|
-
for (let i = 0; i < 256; i++) {
|
|
21
|
-
let c = i;
|
|
22
|
-
for (let k = 0; k < 8; k++) {
|
|
23
|
-
c = (c & 1) !== 0 ? (0xedb88320 ^ (c >>> 1)) : (c >>> 1);
|
|
24
|
-
}
|
|
25
|
-
CRC32_TABLE[i] = c >>> 0;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const textEncoder = new TextEncoder();
|
|
29
|
-
const textDecoder = new TextDecoder('utf-8');
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Converts a string or byte buffer into a `Uint8Array`.
|
|
33
|
-
*/
|
|
34
|
-
export function toUint8Array(input: string | Uint8Array | ArrayBuffer): Uint8Array {
|
|
35
|
-
if (typeof input === 'string') {
|
|
36
|
-
return textEncoder.encode(input);
|
|
37
|
-
}
|
|
38
|
-
if (input instanceof Uint8Array) {
|
|
39
|
-
return input;
|
|
40
|
-
}
|
|
41
|
-
if (input instanceof ArrayBuffer) {
|
|
42
|
-
return new Uint8Array(input);
|
|
43
|
-
}
|
|
44
|
-
return new Uint8Array(0);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Computes the standard IEEE 802.3 CRC32 checksum of a string or byte array.
|
|
49
|
-
*/
|
|
50
|
-
export function computeCrc32(data: string | Uint8Array | ArrayBuffer): number {
|
|
51
|
-
const bytes = toUint8Array(data);
|
|
52
|
-
let crc = 0xffffffff;
|
|
53
|
-
for (let i = 0; i < bytes.length; i++) {
|
|
54
|
-
const index = (crc ^ bytes[i]) & 0xff;
|
|
55
|
-
crc = (crc >>> 8) ^ CRC32_TABLE[index];
|
|
56
|
-
}
|
|
57
|
-
return (crc ^ 0xffffffff) >>> 0;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
const DANGEROUS_PATH_SEGMENTS: ReadonlySet<string> = new Set([
|
|
61
|
-
'__proto__',
|
|
62
|
-
'constructor',
|
|
63
|
-
'prototype'
|
|
64
|
-
]);
|
|
65
|
-
|
|
66
|
-
const MAX_ZIP_ENTRIES = 10000;
|
|
67
|
-
const MAX_ZIP_UNCOMPRESSED_BYTES = 100 * 1024 * 1024; // 100 MB
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Sanitizes an archive entry path to prevent Zip-Slip directory traversal attacks
|
|
71
|
-
* and prototype-pollution key injection.
|
|
72
|
-
* Normalizes backslashes, strips drive prefixes and leading slashes, and collapses
|
|
73
|
-
* or removes `..` and `.` segments so the resulting path is strictly relative.
|
|
74
|
-
*/
|
|
75
|
-
export function sanitizeZipPath(rawPath: string): string {
|
|
76
|
-
const normalized = String(rawPath || '')
|
|
77
|
-
.replace(/\\/g, '/')
|
|
78
|
-
.replace(/^[A-Za-z]:/, '');
|
|
79
|
-
const parts = normalized.split('/');
|
|
80
|
-
const safeParts: string[] = [];
|
|
81
|
-
for (const part of parts) {
|
|
82
|
-
const trimmed = part.trim();
|
|
83
|
-
if (!trimmed || trimmed === '.') continue;
|
|
84
|
-
if (DANGEROUS_PATH_SEGMENTS.has(trimmed)) {
|
|
85
|
-
return '';
|
|
86
|
-
}
|
|
87
|
-
if (trimmed === '..') {
|
|
88
|
-
if (safeParts.length > 0) {
|
|
89
|
-
safeParts.pop();
|
|
90
|
-
}
|
|
91
|
-
continue;
|
|
92
|
-
}
|
|
93
|
-
safeParts.push(trimmed);
|
|
94
|
-
}
|
|
95
|
-
return safeParts.join('/');
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
function writeUInt16LE(buf: Uint8Array, offset: number, value: number): void {
|
|
99
|
-
buf[offset] = value & 0xff;
|
|
100
|
-
buf[offset + 1] = (value >>> 8) & 0xff;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
function writeUInt32LE(buf: Uint8Array, offset: number, value: number): void {
|
|
104
|
-
buf[offset] = value & 0xff;
|
|
105
|
-
buf[offset + 1] = (value >>> 8) & 0xff;
|
|
106
|
-
buf[offset + 2] = (value >>> 16) & 0xff;
|
|
107
|
-
buf[offset + 3] = (value >>> 24) & 0xff;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
function readUInt16LE(buf: Uint8Array, offset: number): number {
|
|
111
|
-
return (buf[offset] | (buf[offset + 1] << 8)) >>> 0;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
function readUInt32LE(buf: Uint8Array, offset: number): number {
|
|
115
|
-
return (
|
|
116
|
-
(buf[offset] |
|
|
117
|
-
(buf[offset + 1] << 8) |
|
|
118
|
-
(buf[offset + 2] << 16) |
|
|
119
|
-
(buf[offset + 3] << 24)) >>> 0
|
|
120
|
-
);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
interface ZipEntryInternal {
|
|
124
|
-
nameBytes: Uint8Array;
|
|
125
|
-
dataBytes: Uint8Array;
|
|
126
|
-
crc32: number;
|
|
127
|
-
offset: number;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Creates a standard PKZip v2.0 archive from a map of file paths to contents.
|
|
132
|
-
*/
|
|
133
|
-
export function createZip(
|
|
134
|
-
files: Record<string, string | Uint8Array>
|
|
135
|
-
): Uint8Array {
|
|
136
|
-
const entries: ZipEntryInternal[] = [];
|
|
137
|
-
let localSectionSize = 0;
|
|
138
|
-
let centralDirSize = 0;
|
|
139
|
-
|
|
140
|
-
const rawKeys = Object.keys(files || {});
|
|
141
|
-
for (const rawKey of rawKeys) {
|
|
142
|
-
const safePath = sanitizeZipPath(rawKey);
|
|
143
|
-
if (!safePath) continue;
|
|
144
|
-
|
|
145
|
-
const rawContent = files[rawKey];
|
|
146
|
-
const dataBytes = toUint8Array(rawContent);
|
|
147
|
-
const nameBytes = textEncoder.encode(safePath);
|
|
148
|
-
const crc = computeCrc32(dataBytes);
|
|
149
|
-
|
|
150
|
-
entries.push({
|
|
151
|
-
nameBytes,
|
|
152
|
-
dataBytes,
|
|
153
|
-
crc32: crc,
|
|
154
|
-
offset: localSectionSize
|
|
155
|
-
});
|
|
156
|
-
|
|
157
|
-
localSectionSize += 30 + nameBytes.length + dataBytes.length;
|
|
158
|
-
centralDirSize += 46 + nameBytes.length;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
const totalSize = localSectionSize + centralDirSize + 22;
|
|
162
|
-
const out = new Uint8Array(totalSize);
|
|
163
|
-
let cursor = 0;
|
|
164
|
-
|
|
165
|
-
// 1. Write Local File Headers + File Data
|
|
166
|
-
for (const entry of entries) {
|
|
167
|
-
writeUInt32LE(out, cursor, LOCAL_FILE_HEADER_SIG);
|
|
168
|
-
writeUInt16LE(out, cursor + 4, 20); // Version needed to extract (2.0)
|
|
169
|
-
writeUInt16LE(out, cursor + 6, UTF8_FLAG); // General purpose bit flag (UTF-8)
|
|
170
|
-
writeUInt16LE(out, cursor + 8, 0); // Compression method: 0 (Store)
|
|
171
|
-
writeUInt16LE(out, cursor + 10, 0); // Last mod file time
|
|
172
|
-
writeUInt16LE(out, cursor + 12, 0x2100); // Last mod file date (1980-01-01)
|
|
173
|
-
writeUInt32LE(out, cursor + 14, entry.crc32);
|
|
174
|
-
writeUInt32LE(out, cursor + 18, entry.dataBytes.length); // Compressed size
|
|
175
|
-
writeUInt32LE(out, cursor + 22, entry.dataBytes.length); // Uncompressed size
|
|
176
|
-
writeUInt16LE(out, cursor + 26, entry.nameBytes.length); // File name length
|
|
177
|
-
writeUInt16LE(out, cursor + 28, 0); // Extra field length
|
|
178
|
-
cursor += 30;
|
|
179
|
-
|
|
180
|
-
out.set(entry.nameBytes, cursor);
|
|
181
|
-
cursor += entry.nameBytes.length;
|
|
182
|
-
|
|
183
|
-
out.set(entry.dataBytes, cursor);
|
|
184
|
-
cursor += entry.dataBytes.length;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
const centralDirOffset = cursor;
|
|
188
|
-
|
|
189
|
-
// 2. Write Central Directory File Headers
|
|
190
|
-
for (const entry of entries) {
|
|
191
|
-
writeUInt32LE(out, cursor, CENTRAL_DIR_HEADER_SIG);
|
|
192
|
-
writeUInt16LE(out, cursor + 4, 20); // Version made by
|
|
193
|
-
writeUInt16LE(out, cursor + 6, 20); // Version needed to extract
|
|
194
|
-
writeUInt16LE(out, cursor + 8, UTF8_FLAG); // General purpose bit flag
|
|
195
|
-
writeUInt16LE(out, cursor + 10, 0); // Compression method: Store
|
|
196
|
-
writeUInt16LE(out, cursor + 12, 0); // Last mod file time
|
|
197
|
-
writeUInt16LE(out, cursor + 14, 0x2100); // Last mod file date
|
|
198
|
-
writeUInt32LE(out, cursor + 16, entry.crc32);
|
|
199
|
-
writeUInt32LE(out, cursor + 20, entry.dataBytes.length); // Compressed size
|
|
200
|
-
writeUInt32LE(out, cursor + 24, entry.dataBytes.length); // Uncompressed size
|
|
201
|
-
writeUInt16LE(out, cursor + 28, entry.nameBytes.length); // File name length
|
|
202
|
-
writeUInt16LE(out, cursor + 30, 0); // Extra field length
|
|
203
|
-
writeUInt16LE(out, cursor + 32, 0); // File comment length
|
|
204
|
-
writeUInt16LE(out, cursor + 34, 0); // Disk number start
|
|
205
|
-
writeUInt16LE(out, cursor + 36, 0); // Internal file attributes
|
|
206
|
-
writeUInt32LE(out, cursor + 38, 0); // External file attributes
|
|
207
|
-
writeUInt32LE(out, cursor + 42, entry.offset); // Relative offset of local header
|
|
208
|
-
cursor += 46;
|
|
209
|
-
|
|
210
|
-
out.set(entry.nameBytes, cursor);
|
|
211
|
-
cursor += entry.nameBytes.length;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
// 3. Write End of Central Directory Record (EOCD)
|
|
215
|
-
writeUInt32LE(out, cursor, END_OF_CENTRAL_DIR_SIG);
|
|
216
|
-
writeUInt16LE(out, cursor + 4, 0); // Number of this disk
|
|
217
|
-
writeUInt16LE(out, cursor + 6, 0); // Disk where central directory starts
|
|
218
|
-
writeUInt16LE(out, cursor + 8, entries.length); // Number of central dir records on this disk
|
|
219
|
-
writeUInt16LE(out, cursor + 10, entries.length); // Total number of central dir records
|
|
220
|
-
writeUInt32LE(out, cursor + 12, centralDirSize); // Size of central directory
|
|
221
|
-
writeUInt32LE(out, cursor + 16, centralDirOffset); // Offset of start of central directory
|
|
222
|
-
writeUInt16LE(out, cursor + 20, 0); // Comment length
|
|
223
|
-
|
|
224
|
-
return out;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
/**
|
|
228
|
-
* Extracts a PKZip v2.0 archive into a UTF-8 file dictionary (`Record<string, string>`).
|
|
229
|
-
* Validates magic headers, checks boundaries, and sanitizes paths against Zip-Slip.
|
|
230
|
-
*/
|
|
231
|
-
export function extractZip(
|
|
232
|
-
data: Uint8Array | ArrayBuffer
|
|
233
|
-
): Record<string, string> {
|
|
234
|
-
const bytes = toUint8Array(data);
|
|
235
|
-
if (bytes.length < 22) {
|
|
236
|
-
throw new Error('Invalid or truncated ZIP archive: buffer shorter than minimum 22-byte EOCD record');
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
// Locate End of Central Directory (EOCD) signature scanning backwards from end
|
|
240
|
-
let eocdOffset = -1;
|
|
241
|
-
const minSearchOffset = Math.max(0, bytes.length - 65557);
|
|
242
|
-
for (let i = bytes.length - 22; i >= minSearchOffset; i--) {
|
|
243
|
-
if (readUInt32LE(bytes, i) === END_OF_CENTRAL_DIR_SIG) {
|
|
244
|
-
eocdOffset = i;
|
|
245
|
-
break;
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
if (eocdOffset === -1) {
|
|
250
|
-
throw new Error('Invalid ZIP archive: End of Central Directory (PK\\x05\\x06) signature not found');
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
const totalEntries = readUInt16LE(bytes, eocdOffset + 10);
|
|
254
|
-
if (totalEntries > MAX_ZIP_ENTRIES) {
|
|
255
|
-
throw new Error(`ZIP archive exceeds maximum allowed entry count (${MAX_ZIP_ENTRIES})`);
|
|
256
|
-
}
|
|
257
|
-
const centralDirSize = readUInt32LE(bytes, eocdOffset + 12);
|
|
258
|
-
const centralDirOffset = readUInt32LE(bytes, eocdOffset + 16);
|
|
259
|
-
|
|
260
|
-
if (centralDirOffset + centralDirSize > bytes.length) {
|
|
261
|
-
throw new Error('Corrupted ZIP archive: Central Directory extends past end of buffer');
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
const result: Record<string, string> = Object.create(null) as Record<string, string>;
|
|
265
|
-
let cdCursor = centralDirOffset;
|
|
266
|
-
let totalExtractedBytes = 0;
|
|
267
|
-
|
|
268
|
-
for (let i = 0; i < totalEntries; i++) {
|
|
269
|
-
if (cdCursor + 46 > bytes.length) {
|
|
270
|
-
throw new Error('Corrupted ZIP archive: truncated Central Directory header');
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
const sig = readUInt32LE(bytes, cdCursor);
|
|
274
|
-
if (sig !== CENTRAL_DIR_HEADER_SIG) {
|
|
275
|
-
throw new Error(`Corrupted ZIP archive: invalid Central Directory signature 0x${sig.toString(16)}`);
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
const compressionMethod = readUInt16LE(bytes, cdCursor + 10);
|
|
279
|
-
const expectedCrc = readUInt32LE(bytes, cdCursor + 16);
|
|
280
|
-
const compressedSize = readUInt32LE(bytes, cdCursor + 20);
|
|
281
|
-
const fileNameLen = readUInt16LE(bytes, cdCursor + 28);
|
|
282
|
-
const extraLen = readUInt16LE(bytes, cdCursor + 30);
|
|
283
|
-
const commentLen = readUInt16LE(bytes, cdCursor + 32);
|
|
284
|
-
const localHeaderOffset = readUInt32LE(bytes, cdCursor + 42);
|
|
285
|
-
|
|
286
|
-
const nameStart = cdCursor + 46;
|
|
287
|
-
const nameEnd = nameStart + fileNameLen;
|
|
288
|
-
if (nameEnd > bytes.length) {
|
|
289
|
-
throw new Error('Corrupted ZIP archive: file name exceeds buffer');
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
const rawName = textDecoder.decode(bytes.subarray(nameStart, nameEnd));
|
|
293
|
-
cdCursor = nameEnd + extraLen + commentLen;
|
|
294
|
-
|
|
295
|
-
// Skip explicit directory entries
|
|
296
|
-
if (rawName.endsWith('/')) continue;
|
|
297
|
-
|
|
298
|
-
const safeName = sanitizeZipPath(rawName);
|
|
299
|
-
if (!safeName) continue;
|
|
300
|
-
|
|
301
|
-
if (localHeaderOffset + 30 > bytes.length) {
|
|
302
|
-
throw new Error(`Corrupted ZIP archive: local header offset out of bounds for ${safeName}`);
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
const localSig = readUInt32LE(bytes, localHeaderOffset);
|
|
306
|
-
if (localSig !== LOCAL_FILE_HEADER_SIG) {
|
|
307
|
-
throw new Error(`Corrupted ZIP archive: invalid Local File Header signature for ${safeName}`);
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
const localNameLen = readUInt16LE(bytes, localHeaderOffset + 26);
|
|
311
|
-
const localExtraLen = readUInt16LE(bytes, localHeaderOffset + 28);
|
|
312
|
-
const dataStart = localHeaderOffset + 30 + localNameLen + localExtraLen;
|
|
313
|
-
const dataEnd = dataStart + compressedSize;
|
|
314
|
-
|
|
315
|
-
if (dataEnd > bytes.length) {
|
|
316
|
-
throw new Error(`Corrupted ZIP archive: file data truncated for ${safeName}`);
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
totalExtractedBytes += compressedSize;
|
|
320
|
-
if (totalExtractedBytes > MAX_ZIP_UNCOMPRESSED_BYTES) {
|
|
321
|
-
throw new Error(`ZIP archive exceeds maximum uncompressed size limit (${MAX_ZIP_UNCOMPRESSED_BYTES} bytes)`);
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
const rawFileBytes = bytes.subarray(dataStart, dataEnd);
|
|
325
|
-
if (compressionMethod !== 0) {
|
|
326
|
-
throw new Error(`Unsupported ZIP compression method ${compressionMethod} for ${safeName} (only Store=0 is supported)`);
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
const actualCrc = computeCrc32(rawFileBytes);
|
|
330
|
-
if (actualCrc !== expectedCrc) {
|
|
331
|
-
throw new Error(
|
|
332
|
-
`CRC32 integrity mismatch for ${safeName}: expected 0x${expectedCrc.toString(16)}, got 0x${actualCrc.toString(16)}`
|
|
333
|
-
);
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
result[safeName] = textDecoder.decode(rawFileBytes);
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
return { ...result };
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
export default {
|
|
343
|
-
createZip,
|
|
344
|
-
extractZip,
|
|
345
|
-
computeCrc32,
|
|
346
|
-
sanitizeZipPath,
|
|
347
|
-
toUint8Array
|
|
348
|
-
};
|