cadet-agent 0.20.0 → 0.20.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/package.json +1 -1
- package/src/install.mjs +15 -11
package/package.json
CHANGED
package/src/install.mjs
CHANGED
|
@@ -59,7 +59,7 @@ function* centralDirectoryEntries(buf, cdOffset, cdSize) {
|
|
|
59
59
|
const extraLen = read16(buf, off + 30);
|
|
60
60
|
const commentLen = read16(buf, off + 32);
|
|
61
61
|
const localHeaderOff = read32(buf, off + 42);
|
|
62
|
-
const filename = buf.toString('utf-8', off + 46, off + 46 + filenameLen);
|
|
62
|
+
const filename = buf.toString('utf-8', off + 46, off + 46 + filenameLen).replace(/\\/g, '/');
|
|
63
63
|
|
|
64
64
|
// Skip directory entries (trailing / in filename, or uncompressedSize == 0 with no method)
|
|
65
65
|
if (!filename.endsWith('/')) {
|
|
@@ -109,7 +109,7 @@ function extractFile(buf, entry, targetDir) {
|
|
|
109
109
|
});
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
async function extractZip(buf, targetDir) {
|
|
112
|
+
export async function extractZip(buf, targetDir) {
|
|
113
113
|
const eocdOff = findEocd(buf);
|
|
114
114
|
const cdSize = read32(buf, eocdOff + 12);
|
|
115
115
|
const cdOff = read32(buf, eocdOff + 16);
|
|
@@ -276,15 +276,19 @@ function matchesManagedPath(filename, managedPaths) {
|
|
|
276
276
|
}
|
|
277
277
|
|
|
278
278
|
function walkDir(dir, fn) {
|
|
279
|
-
const
|
|
280
|
-
|
|
281
|
-
const
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
279
|
+
const root = dir;
|
|
280
|
+
const walk = (current) => {
|
|
281
|
+
for (const entry of readdirSync(current, { withFileTypes: true })) {
|
|
282
|
+
const fullPath = join(current, entry.name);
|
|
283
|
+
if (entry.isDirectory()) {
|
|
284
|
+
walk(fullPath);
|
|
285
|
+
} else {
|
|
286
|
+
// rel must be relative to the walked root, not the current subdirectory
|
|
287
|
+
fn(fullPath, relative(root, fullPath));
|
|
288
|
+
}
|
|
286
289
|
}
|
|
287
|
-
}
|
|
290
|
+
};
|
|
291
|
+
walk(root);
|
|
288
292
|
}
|
|
289
293
|
|
|
290
294
|
function deleteObsoleteManagedFiles(targetDir, managedPaths, zipFilenames) {
|
|
@@ -320,7 +324,7 @@ function deleteObsoleteManagedFiles(targetDir, managedPaths, zipFilenames) {
|
|
|
320
324
|
return deleted;
|
|
321
325
|
}
|
|
322
326
|
|
|
323
|
-
async function extractZipWithManifest(buf, targetDir, { preserved, managed }) {
|
|
327
|
+
export async function extractZipWithManifest(buf, targetDir, { preserved, managed }) {
|
|
324
328
|
const eocdOff = findEocd(buf);
|
|
325
329
|
const cdSize = read32(buf, eocdOff + 12);
|
|
326
330
|
const cdOff = read32(buf, eocdOff + 16);
|