modern-tar 0.5.4 → 0.5.5
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/fs/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createTarPacker, createTarUnpacker, normalizeBody, transformHeader } from "../unpacker-
|
|
1
|
+
import { createTarPacker, createTarUnpacker, normalizeBody, transformHeader } from "../unpacker-BKKRRs7i.js";
|
|
2
2
|
import * as fs from "node:fs/promises";
|
|
3
3
|
import { cpus } from "node:os";
|
|
4
4
|
import * as path from "node:path";
|
|
@@ -336,10 +336,6 @@ function createFSHandler(directoryPath, options) {
|
|
|
336
336
|
await ensureDirectoryExists(path.dirname(dirPath));
|
|
337
337
|
if (signal.aborted) throw signal.reason;
|
|
338
338
|
try {
|
|
339
|
-
await fs.mkdir(dirPath, { mode: dmode });
|
|
340
|
-
return "directory";
|
|
341
|
-
} catch (err) {
|
|
342
|
-
if (err.code !== "EEXIST") throw err;
|
|
343
339
|
const stat = await fs.lstat(dirPath);
|
|
344
340
|
if (stat.isDirectory()) return "directory";
|
|
345
341
|
if (stat.isSymbolicLink()) {
|
|
@@ -348,6 +344,12 @@ function createFSHandler(directoryPath, options) {
|
|
|
348
344
|
if ((await fs.stat(realPath)).isDirectory()) return "directory";
|
|
349
345
|
}
|
|
350
346
|
throw new Error(`"${dirPath}" is not a valid directory component.`);
|
|
347
|
+
} catch (err) {
|
|
348
|
+
if (err.code === "ENOENT") {
|
|
349
|
+
await fs.mkdir(dirPath, { mode: dmode });
|
|
350
|
+
return "directory";
|
|
351
|
+
}
|
|
352
|
+
throw err;
|
|
351
353
|
}
|
|
352
354
|
})();
|
|
353
355
|
pathPromises.set(dirPath, promise);
|
|
@@ -451,7 +451,9 @@ function transformHeader(header, options) {
|
|
|
451
451
|
}
|
|
452
452
|
}
|
|
453
453
|
if (filter?.(h) === false) return null;
|
|
454
|
-
|
|
454
|
+
const result = map ? map(h) : h;
|
|
455
|
+
if (result && (!result.name || !result.name.trim() || result.name === "." || result.name === "/")) return null;
|
|
456
|
+
return result;
|
|
455
457
|
}
|
|
456
458
|
|
|
457
459
|
//#endregion
|
package/dist/web/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createTarPacker as createTarPacker$1, createTarUnpacker, normalizeBody, streamToBuffer, transformHeader } from "../unpacker-
|
|
1
|
+
import { createTarPacker as createTarPacker$1, createTarUnpacker, normalizeBody, streamToBuffer, transformHeader } from "../unpacker-BKKRRs7i.js";
|
|
2
2
|
|
|
3
3
|
//#region src/web/compression.ts
|
|
4
4
|
function createGzipEncoder() {
|