extract-base-iterator 2.4.7 → 2.4.10
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/cjs/FileEntry.js +17 -0
- package/dist/cjs/FileEntry.js.map +1 -1
- package/dist/cjs/SymbolicLinkEntry.js +2 -2
- package/dist/cjs/SymbolicLinkEntry.js.map +1 -1
- package/dist/cjs/fs/lutimes.d.cts +3 -0
- package/dist/cjs/fs/lutimes.d.ts +3 -0
- package/dist/cjs/fs/lutimes.js +33 -0
- package/dist/cjs/fs/lutimes.js.map +1 -0
- package/dist/esm/FileEntry.js +17 -0
- package/dist/esm/FileEntry.js.map +1 -1
- package/dist/esm/SymbolicLinkEntry.js +2 -2
- package/dist/esm/SymbolicLinkEntry.js.map +1 -1
- package/dist/esm/fs/lutimes.d.ts +3 -0
- package/dist/esm/fs/lutimes.js +17 -0
- package/dist/esm/fs/lutimes.js.map +1 -0
- package/package.json +19 -19
package/dist/cjs/FileEntry.js
CHANGED
|
@@ -8,6 +8,7 @@ Object.defineProperty(exports, "default", {
|
|
|
8
8
|
return FileEntry;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
+
var _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
|
|
11
12
|
var _fsremovecompat = require("fs-remove-compat");
|
|
12
13
|
var _mkdirpclassic = /*#__PURE__*/ _interop_require_default(require("mkdirp-classic"));
|
|
13
14
|
var _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
@@ -62,6 +63,22 @@ var FileEntry = /*#__PURE__*/ function() {
|
|
|
62
63
|
err && err.code !== 'ENOENT' ? callback(err) : callback();
|
|
63
64
|
});
|
|
64
65
|
});
|
|
66
|
+
} else {
|
|
67
|
+
// Check if file exists - throw EEXIST if it does
|
|
68
|
+
queue.defer(function(callback) {
|
|
69
|
+
_fs.default.stat(fullPath, function(err) {
|
|
70
|
+
if (!err) {
|
|
71
|
+
var existsErr = new Error("EEXIST: file already exists, open '".concat(fullPath, "'"));
|
|
72
|
+
existsErr.code = 'EEXIST';
|
|
73
|
+
existsErr.path = fullPath;
|
|
74
|
+
return callback(existsErr);
|
|
75
|
+
}
|
|
76
|
+
// ENOENT means file doesn't exist - that's what we want
|
|
77
|
+
if (err.code === 'ENOENT') return callback();
|
|
78
|
+
// Other errors should be reported
|
|
79
|
+
callback(err);
|
|
80
|
+
});
|
|
81
|
+
});
|
|
65
82
|
}
|
|
66
83
|
queue.defer(_mkdirpclassic.default.bind(null, _path.default.dirname(fullPath)));
|
|
67
84
|
queue.defer(this._writeFile.bind(this, fullPath, options));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/FileEntry.ts"],"sourcesContent":["import { rm } from 'fs-remove-compat';\nimport mkdirp from 'mkdirp-classic';\nimport path from 'path';\nimport Queue from 'queue-cb';\nimport chmod from './fs/chmod.ts';\nimport chown from './fs/chown.ts';\nimport utimes from './fs/utimes.ts';\nimport { objectAssign } from './shared/index.ts';\nimport stripPath from './stripPath.ts';\nimport validateAttributes from './validateAttributes.ts';\n\nconst MANDATORY_ATTRIBUTES = ['mode', 'mtime', 'path'];\n\nimport type { Mode } from 'fs';\nimport type { ExtractOptions, FileAttributes, NoParamCallback, WriteFileFn } from './types.ts';\n\ninterface AbstractFileEntry {\n _writeFile: WriteFileFn;\n}\n\nexport default class FileEntry {\n mode: Mode;\n mtime: number;\n path: string;\n basename: string;\n type: string;\n\n constructor(attributes: FileAttributes) {\n validateAttributes(attributes, MANDATORY_ATTRIBUTES);\n objectAssign(this, attributes);\n if (this.basename === undefined) this.basename = path.basename(this.path);\n if (this.type === undefined) this.type = 'file';\n if ((this as unknown as AbstractFileEntry)._writeFile === undefined) throw new Error('File this missing _writeFile. Please implement this method in your subclass');\n }\n\n create(dest: string, options: ExtractOptions | NoParamCallback, callback?: NoParamCallback): undefined | Promise<boolean> {\n if (typeof options === 'function') {\n callback = options;\n options = null;\n }\n\n if (typeof callback === 'function') {\n options = options || {};\n try {\n const normalizedPath = path.normalize(this.path);\n const fullPath = path.join(dest, stripPath(normalizedPath, options as ExtractOptions));\n\n const queue = new Queue(1);\n if ((options as ExtractOptions).force) {\n queue.defer((callback) => {\n rm(fullPath, (err) => {\n err && err.code !== 'ENOENT' ? callback(err) : callback();\n });\n });\n }\n queue.defer(mkdirp.bind(null, path.dirname(fullPath)));\n queue.defer((this as unknown as AbstractFileEntry)._writeFile.bind(this, fullPath, options));\n queue.defer(chmod.bind(null, fullPath, this, options));\n queue.defer(chown.bind(null, fullPath, this, options));\n queue.defer(utimes.bind(null, fullPath, this, options));\n queue.await(callback);\n return;\n } catch (err) {\n callback(err);\n return;\n }\n }\n\n return new Promise((resolve, reject) => {\n this.create(dest, options, (err?: Error, done?: boolean) => (err ? reject(err) : resolve(done)));\n });\n }\n\n destroy() {}\n}\n"],"names":["FileEntry","MANDATORY_ATTRIBUTES","attributes","validateAttributes","objectAssign","basename","undefined","path","type","_writeFile","Error","create","dest","options","callback","normalizedPath","normalize","fullPath","join","stripPath","queue","Queue","force","defer","rm","err","code","mkdirp","bind","dirname","chmod","chown","utimes","await","Promise","resolve","reject","done","destroy"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/FileEntry.ts"],"sourcesContent":["import fs from 'fs';\nimport { rm } from 'fs-remove-compat';\nimport mkdirp from 'mkdirp-classic';\nimport path from 'path';\nimport Queue from 'queue-cb';\nimport chmod from './fs/chmod.ts';\nimport chown from './fs/chown.ts';\nimport utimes from './fs/utimes.ts';\nimport { objectAssign } from './shared/index.ts';\nimport stripPath from './stripPath.ts';\nimport validateAttributes from './validateAttributes.ts';\n\nconst MANDATORY_ATTRIBUTES = ['mode', 'mtime', 'path'];\n\nimport type { Mode } from 'fs';\nimport type { ExtractOptions, FileAttributes, NoParamCallback, WriteFileFn } from './types.ts';\n\ninterface AbstractFileEntry {\n _writeFile: WriteFileFn;\n}\n\nexport default class FileEntry {\n mode: Mode;\n mtime: number;\n path: string;\n basename: string;\n type: string;\n\n constructor(attributes: FileAttributes) {\n validateAttributes(attributes, MANDATORY_ATTRIBUTES);\n objectAssign(this, attributes);\n if (this.basename === undefined) this.basename = path.basename(this.path);\n if (this.type === undefined) this.type = 'file';\n if ((this as unknown as AbstractFileEntry)._writeFile === undefined) throw new Error('File this missing _writeFile. Please implement this method in your subclass');\n }\n\n create(dest: string, options: ExtractOptions | NoParamCallback, callback?: NoParamCallback): undefined | Promise<boolean> {\n if (typeof options === 'function') {\n callback = options;\n options = null;\n }\n\n if (typeof callback === 'function') {\n options = options || {};\n try {\n const normalizedPath = path.normalize(this.path);\n const fullPath = path.join(dest, stripPath(normalizedPath, options as ExtractOptions));\n\n const queue = new Queue(1);\n if ((options as ExtractOptions).force) {\n queue.defer((callback) => {\n rm(fullPath, (err) => {\n err && err.code !== 'ENOENT' ? callback(err) : callback();\n });\n });\n } else {\n // Check if file exists - throw EEXIST if it does\n queue.defer((callback) => {\n fs.stat(fullPath, (err) => {\n if (!err) {\n const existsErr = new Error(`EEXIST: file already exists, open '${fullPath}'`) as NodeJS.ErrnoException;\n existsErr.code = 'EEXIST';\n existsErr.path = fullPath;\n return callback(existsErr);\n }\n // ENOENT means file doesn't exist - that's what we want\n if (err.code === 'ENOENT') return callback();\n // Other errors should be reported\n callback(err);\n });\n });\n }\n queue.defer(mkdirp.bind(null, path.dirname(fullPath)));\n queue.defer((this as unknown as AbstractFileEntry)._writeFile.bind(this, fullPath, options));\n queue.defer(chmod.bind(null, fullPath, this, options));\n queue.defer(chown.bind(null, fullPath, this, options));\n queue.defer(utimes.bind(null, fullPath, this, options));\n queue.await(callback);\n return;\n } catch (err) {\n callback(err);\n return;\n }\n }\n\n return new Promise((resolve, reject) => {\n this.create(dest, options, (err?: Error, done?: boolean) => (err ? reject(err) : resolve(done)));\n });\n }\n\n destroy() {}\n}\n"],"names":["FileEntry","MANDATORY_ATTRIBUTES","attributes","validateAttributes","objectAssign","basename","undefined","path","type","_writeFile","Error","create","dest","options","callback","normalizedPath","normalize","fullPath","join","stripPath","queue","Queue","force","defer","rm","err","code","fs","stat","existsErr","mkdirp","bind","dirname","chmod","chown","utimes","await","Promise","resolve","reject","done","destroy"],"mappings":";;;;;;;eAqBqBA;;;yDArBN;8BACI;oEACA;2DACF;8DACC;8DACA;8DACA;+DACC;uBACU;kEACP;2EACS;;;;;;;;;;;AAE/B,IAAMC,uBAAuB;IAAC;IAAQ;IAAS;CAAO;AASvC,IAAA,AAAMD,0BAAN;;aAAMA,UAOPE,UAA0B;gCAPnBF;QAQjBG,IAAAA,6BAAkB,EAACD,YAAYD;QAC/BG,IAAAA,qBAAY,EAAC,IAAI,EAAEF;QACnB,IAAI,IAAI,CAACG,QAAQ,KAAKC,WAAW,IAAI,CAACD,QAAQ,GAAGE,aAAI,CAACF,QAAQ,CAAC,IAAI,CAACE,IAAI;QACxE,IAAI,IAAI,CAACC,IAAI,KAAKF,WAAW,IAAI,CAACE,IAAI,GAAG;QACzC,IAAI,AAAC,IAAI,CAAkCC,UAAU,KAAKH,WAAW,MAAM,IAAII,MAAM;;iBAZpEV;IAenBW,OAAAA,MAoDC,GApDDA,SAAAA,OAAOC,IAAY,EAAEC,OAAyC,EAAEC,QAA0B;;QACxF,IAAI,OAAOD,YAAY,YAAY;YACjCC,WAAWD;YACXA,UAAU;QACZ;QAEA,IAAI,OAAOC,aAAa,YAAY;YAClCD,UAAUA,WAAW,CAAC;YACtB,IAAI;gBACF,IAAME,iBAAiBR,aAAI,CAACS,SAAS,CAAC,IAAI,CAACT,IAAI;gBAC/C,IAAMU,WAAWV,aAAI,CAACW,IAAI,CAACN,MAAMO,IAAAA,oBAAS,EAACJ,gBAAgBF;gBAE3D,IAAMO,QAAQ,IAAIC,gBAAK,CAAC;gBACxB,IAAI,AAACR,QAA2BS,KAAK,EAAE;oBACrCF,MAAMG,KAAK,CAAC,SAACT;wBACXU,IAAAA,kBAAE,EA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_require_default(require("path"));
|
|
|
16
16
|
var _queuecb = /*#__PURE__*/ _interop_require_default(require("queue-cb"));
|
|
17
17
|
var _chmodts = /*#__PURE__*/ _interop_require_default(require("./fs/chmod.js"));
|
|
18
18
|
var _chownts = /*#__PURE__*/ _interop_require_default(require("./fs/chown.js"));
|
|
19
|
+
var _lutimests = /*#__PURE__*/ _interop_require_default(require("./fs/lutimes.js"));
|
|
19
20
|
var _symlinkWin32ts = /*#__PURE__*/ _interop_require_default(require("./fs/symlinkWin32.js"));
|
|
20
|
-
var _utimests = /*#__PURE__*/ _interop_require_default(require("./fs/utimes.js"));
|
|
21
21
|
var _indexts = require("./shared/index.js");
|
|
22
22
|
var _stripPathts = /*#__PURE__*/ _interop_require_default(require("./stripPath.js"));
|
|
23
23
|
var _validateAttributests = /*#__PURE__*/ _interop_require_default(require("./validateAttributes.js"));
|
|
@@ -79,7 +79,7 @@ var SymbolicLinkEntry = /*#__PURE__*/ function() {
|
|
|
79
79
|
else queue.defer(_gracefulfs.default.symlink.bind(_gracefulfs.default, normalizedLinkpath, fullPath));
|
|
80
80
|
queue.defer(_chmodts.default.bind(null, fullPath, this, options));
|
|
81
81
|
queue.defer(_chownts.default.bind(null, fullPath, this, options));
|
|
82
|
-
queue.defer(
|
|
82
|
+
queue.defer(_lutimests.default.bind(null, fullPath, this, options));
|
|
83
83
|
queue.await(callback);
|
|
84
84
|
return;
|
|
85
85
|
} catch (err) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/SymbolicLinkEntry.ts"],"sourcesContent":["import { rm } from 'fs-remove-compat';\nimport fs from 'graceful-fs';\nimport isAbsolute from 'is-absolute';\nimport mkdirp from 'mkdirp-classic';\nimport path from 'path';\nimport Queue from 'queue-cb';\nimport chmod from './fs/chmod.ts';\nimport chown from './fs/chown.ts';\nimport
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/SymbolicLinkEntry.ts"],"sourcesContent":["import { rm } from 'fs-remove-compat';\nimport fs from 'graceful-fs';\nimport isAbsolute from 'is-absolute';\nimport mkdirp from 'mkdirp-classic';\nimport path from 'path';\nimport Queue from 'queue-cb';\nimport chmod from './fs/chmod.ts';\nimport chown from './fs/chown.ts';\nimport lutimes from './fs/lutimes.ts';\nimport symlinkWin32 from './fs/symlinkWin32.ts';\nimport { objectAssign } from './shared/index.ts';\nimport stripPath from './stripPath.ts';\nimport validateAttributes from './validateAttributes.ts';\n\nconst isWindows = process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE);\n\nconst MANDATORY_ATTRIBUTES = ['mode', 'mtime', 'path', 'linkpath'];\n\nimport type { Mode } from 'fs';\nimport type { ExtractOptions, LinkAttributes, NoParamCallback } from './types.ts';\n\nexport default class SymbolicLinkEntry {\n mode: Mode;\n mtime: number;\n path: string;\n linkpath: string;\n basename: string;\n type: string;\n\n constructor(attributes: LinkAttributes) {\n validateAttributes(attributes, MANDATORY_ATTRIBUTES);\n objectAssign(this, attributes);\n if (this.basename === undefined) this.basename = path.basename(this.path);\n if (this.type === undefined) this.type = 'symlink';\n }\n\n create(dest: string, options: ExtractOptions | NoParamCallback, callback?: NoParamCallback): undefined | Promise<boolean> {\n if (typeof options === 'function') {\n callback = options;\n options = null;\n }\n\n if (typeof callback === 'function') {\n options = options || {};\n try {\n const normalizedPath = path.normalize(this.path);\n const fullPath = path.join(dest, stripPath(normalizedPath, options as ExtractOptions));\n let normalizedLinkpath = path.normalize(this.linkpath);\n let linkFullPath = path.join(dest, stripPath(normalizedLinkpath, options as ExtractOptions));\n if (!isAbsolute(normalizedLinkpath)) {\n const linkRelativePath = path.join(path.dirname(normalizedPath), this.linkpath);\n linkFullPath = path.join(dest, stripPath(linkRelativePath, options as ExtractOptions));\n normalizedLinkpath = path.relative(path.dirname(fullPath), linkFullPath);\n }\n\n const queue = new Queue(1);\n if ((options as ExtractOptions).force) {\n queue.defer((callback) => {\n rm(fullPath, (err) => {\n err && err.code !== 'ENOENT' ? callback(err) : callback();\n });\n });\n }\n queue.defer(mkdirp.bind(null, path.dirname(fullPath)));\n if (isWindows) queue.defer(symlinkWin32.bind(null, linkFullPath, normalizedLinkpath, fullPath));\n else queue.defer(fs.symlink.bind(fs, normalizedLinkpath, fullPath));\n queue.defer(chmod.bind(null, fullPath, this, options));\n queue.defer(chown.bind(null, fullPath, this, options));\n queue.defer(lutimes.bind(null, fullPath, this, options));\n queue.await(callback);\n return;\n } catch (err) {\n callback(err);\n return;\n }\n }\n\n return new Promise((resolve, reject) => {\n this.create(dest, options, (err?: Error, done?: boolean) => (err ? reject(err) : resolve(done)));\n });\n }\n\n destroy() {}\n}\n"],"names":["SymbolicLinkEntry","isWindows","process","platform","test","env","OSTYPE","MANDATORY_ATTRIBUTES","attributes","validateAttributes","objectAssign","basename","undefined","path","type","create","dest","options","callback","normalizedPath","normalize","fullPath","join","stripPath","normalizedLinkpath","linkpath","linkFullPath","isAbsolute","linkRelativePath","dirname","relative","queue","Queue","force","defer","rm","err","code","mkdirp","bind","symlinkWin32","fs","symlink","chmod","chown","lutimes","await","Promise","resolve","reject","done","destroy"],"mappings":";;;;;;;eAqBqBA;;;8BArBF;iEACJ;iEACQ;oEACJ;2DACF;8DACC;8DACA;8DACA;gEACE;qEACK;uBACI;kEACP;2EACS;;;;;;;;;;;AAE/B,IAAMC,YAAYC,QAAQC,QAAQ,KAAK,WAAW,kBAAkBC,IAAI,CAACF,QAAQG,GAAG,CAACC,MAAM;AAE3F,IAAMC,uBAAuB;IAAC;IAAQ;IAAS;IAAQ;CAAW;AAKnD,IAAA,AAAMP,kCAAN;;aAAMA,kBAQPQ,UAA0B;gCARnBR;QASjBS,IAAAA,6BAAkB,EAACD,YAAYD;QAC/BG,IAAAA,qBAAY,EAAC,IAAI,EAAEF;QACnB,IAAI,IAAI,CAACG,QAAQ,KAAKC,WAAW,IAAI,CAACD,QAAQ,GAAGE,aAAI,CAACF,QAAQ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aAAI,CAACgB,OAAO,CAACR;gBAC3C,IAAIpB,WAAW8B,MAAMG,KAAK,CAACM,uBAAY,CAACD,IAAI,CAAC,MAAMb,cAAcF,oBAAoBH;qBAChFU,MAAMG,KAAK,CAACO,mBAAE,CAACC,OAAO,CAACH,IAAI,CAACE,mBAAE,EAAEjB,oBAAoBH;gBACzDU,MAAMG,KAAK,CAACS,gBAAK,CAACJ,IAAI,CAAC,MAAMlB,UAAU,IAAI,EAAEJ;gBAC7Cc,MAAMG,KAAK,CAACU,gBAAK,CAACL,IAAI,CAAC,MAAMlB,UAAU,IAAI,EAAEJ;gBAC7Cc,MAAMG,KAAK,CAACW,kBAAO,CAACN,IAAI,CAAC,MAAMlB,UAAU,IAAI,EAAEJ;gBAC/Cc,MAAMe,KAAK,CAAC5B;gBACZ;YACF,EAAE,OAAOkB,KAAK;gBACZlB,SAASkB;gBACT;YACF;QACF;QAEA,OAAO,IAAIW,QAAQ,SAACC,SAASC;YAC3B,MAAKlC,MAAM,CAACC,MAAMC,SAAS,SAACmB,KAAac;uBAAoBd,MAAMa,OAAOb,OAAOY,QAAQE;;QAC3F;IACF;IAEAC,OAAAA,OAAY,GAAZA,SAAAA,WAAW;WA7DQnD"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// lutimes - set times on symlinks without following them
|
|
2
|
+
// fs.lutimes was added in Node.js 14.5.0
|
|
3
|
+
// For older versions, we skip setting times on symlinks (no good alternative)
|
|
4
|
+
"use strict";
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
Object.defineProperty(exports, "default", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function() {
|
|
11
|
+
return lutimes;
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
var _gracefulfs = /*#__PURE__*/ _interop_require_default(require("graceful-fs"));
|
|
15
|
+
function _interop_require_default(obj) {
|
|
16
|
+
return obj && obj.__esModule ? obj : {
|
|
17
|
+
default: obj
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
// biome-ignore lint/suspicious/noExplicitAny: fs.lutimes not in older @types/node
|
|
21
|
+
var HAS_LUTIMES = typeof _gracefulfs.default.lutimes === 'function';
|
|
22
|
+
function lutimes(fullPath, entry, options, callback) {
|
|
23
|
+
if (HAS_LUTIMES) {
|
|
24
|
+
var now = options.now || new Date();
|
|
25
|
+
// biome-ignore lint/suspicious/noExplicitAny: fs.lutimes not in older @types/node
|
|
26
|
+
_gracefulfs.default.lutimes(fullPath, now, new Date(entry.mtime), callback);
|
|
27
|
+
} else {
|
|
28
|
+
// On older Node versions, skip setting times on symlinks
|
|
29
|
+
// fs.utimes follows symlinks and will fail with ENOENT if target doesn't exist
|
|
30
|
+
callback(null);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/* CJS INTEROP */ if (exports.__esModule && exports.default) { try { Object.defineProperty(exports.default, '__esModule', { value: true }); for (var key in exports) { exports.default[key] = exports[key]; } } catch (_) {}; module.exports = exports.default; }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/fs/lutimes.ts"],"sourcesContent":["// lutimes - set times on symlinks without following them\n// fs.lutimes was added in Node.js 14.5.0\n// For older versions, we skip setting times on symlinks (no good alternative)\n\nimport type { NoParamCallback } from 'fs';\nimport fs from 'graceful-fs';\nimport type { AbstractEntry, ExtractOptions } from '../types.ts';\n\n// biome-ignore lint/suspicious/noExplicitAny: fs.lutimes not in older @types/node\nconst HAS_LUTIMES = typeof (fs as any).lutimes === 'function';\n\nexport default function lutimes(fullPath: string, entry: AbstractEntry, options: ExtractOptions, callback: NoParamCallback): undefined {\n if (HAS_LUTIMES) {\n const now = options.now || new Date();\n // biome-ignore lint/suspicious/noExplicitAny: fs.lutimes not in older @types/node\n (fs as any).lutimes(fullPath, now, new Date(entry.mtime), callback);\n } else {\n // On older Node versions, skip setting times on symlinks\n // fs.utimes follows symlinks and will fail with ENOENT if target doesn't exist\n callback(null);\n }\n}\n"],"names":["lutimes","HAS_LUTIMES","fs","fullPath","entry","options","callback","now","Date","mtime"],"mappings":"AAAA,yDAAyD;AACzD,yCAAyC;AACzC,8EAA8E;;;;;+BAS9E;;;eAAwBA;;;iEANT;;;;;;AAGf,kFAAkF;AAClF,IAAMC,cAAc,OAAO,AAACC,mBAAE,CAASF,OAAO,KAAK;AAEpC,SAASA,QAAQG,QAAgB,EAAEC,KAAoB,EAAEC,OAAuB,EAAEC,QAAyB;IACxH,IAAIL,aAAa;QACf,IAAMM,MAAMF,QAAQE,GAAG,IAAI,IAAIC;QAC/B,kFAAkF;QACjFN,mBAAE,CAASF,OAAO,CAACG,UAAUI,KAAK,IAAIC,KAAKJ,MAAMK,KAAK,GAAGH;IAC5D,OAAO;QACL,yDAAyD;QACzD,+EAA+E;QAC/EA,SAAS;IACX;AACF"}
|
package/dist/esm/FileEntry.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
1
2
|
import { rm } from 'fs-remove-compat';
|
|
2
3
|
import mkdirp from 'mkdirp-classic';
|
|
3
4
|
import path from 'path';
|
|
@@ -31,6 +32,22 @@ let FileEntry = class FileEntry {
|
|
|
31
32
|
err && err.code !== 'ENOENT' ? callback(err) : callback();
|
|
32
33
|
});
|
|
33
34
|
});
|
|
35
|
+
} else {
|
|
36
|
+
// Check if file exists - throw EEXIST if it does
|
|
37
|
+
queue.defer((callback)=>{
|
|
38
|
+
fs.stat(fullPath, (err)=>{
|
|
39
|
+
if (!err) {
|
|
40
|
+
const existsErr = new Error(`EEXIST: file already exists, open '${fullPath}'`);
|
|
41
|
+
existsErr.code = 'EEXIST';
|
|
42
|
+
existsErr.path = fullPath;
|
|
43
|
+
return callback(existsErr);
|
|
44
|
+
}
|
|
45
|
+
// ENOENT means file doesn't exist - that's what we want
|
|
46
|
+
if (err.code === 'ENOENT') return callback();
|
|
47
|
+
// Other errors should be reported
|
|
48
|
+
callback(err);
|
|
49
|
+
});
|
|
50
|
+
});
|
|
34
51
|
}
|
|
35
52
|
queue.defer(mkdirp.bind(null, path.dirname(fullPath)));
|
|
36
53
|
queue.defer(this._writeFile.bind(this, fullPath, options));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/FileEntry.ts"],"sourcesContent":["import { rm } from 'fs-remove-compat';\nimport mkdirp from 'mkdirp-classic';\nimport path from 'path';\nimport Queue from 'queue-cb';\nimport chmod from './fs/chmod.ts';\nimport chown from './fs/chown.ts';\nimport utimes from './fs/utimes.ts';\nimport { objectAssign } from './shared/index.ts';\nimport stripPath from './stripPath.ts';\nimport validateAttributes from './validateAttributes.ts';\n\nconst MANDATORY_ATTRIBUTES = ['mode', 'mtime', 'path'];\n\nimport type { Mode } from 'fs';\nimport type { ExtractOptions, FileAttributes, NoParamCallback, WriteFileFn } from './types.ts';\n\ninterface AbstractFileEntry {\n _writeFile: WriteFileFn;\n}\n\nexport default class FileEntry {\n mode: Mode;\n mtime: number;\n path: string;\n basename: string;\n type: string;\n\n constructor(attributes: FileAttributes) {\n validateAttributes(attributes, MANDATORY_ATTRIBUTES);\n objectAssign(this, attributes);\n if (this.basename === undefined) this.basename = path.basename(this.path);\n if (this.type === undefined) this.type = 'file';\n if ((this as unknown as AbstractFileEntry)._writeFile === undefined) throw new Error('File this missing _writeFile. Please implement this method in your subclass');\n }\n\n create(dest: string, options: ExtractOptions | NoParamCallback, callback?: NoParamCallback): undefined | Promise<boolean> {\n if (typeof options === 'function') {\n callback = options;\n options = null;\n }\n\n if (typeof callback === 'function') {\n options = options || {};\n try {\n const normalizedPath = path.normalize(this.path);\n const fullPath = path.join(dest, stripPath(normalizedPath, options as ExtractOptions));\n\n const queue = new Queue(1);\n if ((options as ExtractOptions).force) {\n queue.defer((callback) => {\n rm(fullPath, (err) => {\n err && err.code !== 'ENOENT' ? callback(err) : callback();\n });\n });\n }\n queue.defer(mkdirp.bind(null, path.dirname(fullPath)));\n queue.defer((this as unknown as AbstractFileEntry)._writeFile.bind(this, fullPath, options));\n queue.defer(chmod.bind(null, fullPath, this, options));\n queue.defer(chown.bind(null, fullPath, this, options));\n queue.defer(utimes.bind(null, fullPath, this, options));\n queue.await(callback);\n return;\n } catch (err) {\n callback(err);\n return;\n }\n }\n\n return new Promise((resolve, reject) => {\n this.create(dest, options, (err?: Error, done?: boolean) => (err ? reject(err) : resolve(done)));\n });\n }\n\n destroy() {}\n}\n"],"names":["rm","mkdirp","path","Queue","chmod","chown","utimes","objectAssign","stripPath","validateAttributes","MANDATORY_ATTRIBUTES","FileEntry","create","dest","options","callback","normalizedPath","normalize","fullPath","join","queue","force","defer","err","code","bind","dirname","_writeFile","await","Promise","resolve","reject","done","destroy","attributes","basename","undefined","type"
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/FileEntry.ts"],"sourcesContent":["import fs from 'fs';\nimport { rm } from 'fs-remove-compat';\nimport mkdirp from 'mkdirp-classic';\nimport path from 'path';\nimport Queue from 'queue-cb';\nimport chmod from './fs/chmod.ts';\nimport chown from './fs/chown.ts';\nimport utimes from './fs/utimes.ts';\nimport { objectAssign } from './shared/index.ts';\nimport stripPath from './stripPath.ts';\nimport validateAttributes from './validateAttributes.ts';\n\nconst MANDATORY_ATTRIBUTES = ['mode', 'mtime', 'path'];\n\nimport type { Mode } from 'fs';\nimport type { ExtractOptions, FileAttributes, NoParamCallback, WriteFileFn } from './types.ts';\n\ninterface AbstractFileEntry {\n _writeFile: WriteFileFn;\n}\n\nexport default class FileEntry {\n mode: Mode;\n mtime: number;\n path: string;\n basename: string;\n type: string;\n\n constructor(attributes: FileAttributes) {\n validateAttributes(attributes, MANDATORY_ATTRIBUTES);\n objectAssign(this, attributes);\n if (this.basename === undefined) this.basename = path.basename(this.path);\n if (this.type === undefined) this.type = 'file';\n if ((this as unknown as AbstractFileEntry)._writeFile === undefined) throw new Error('File this missing _writeFile. Please implement this method in your subclass');\n }\n\n create(dest: string, options: ExtractOptions | NoParamCallback, callback?: NoParamCallback): undefined | Promise<boolean> {\n if (typeof options === 'function') {\n callback = options;\n options = null;\n }\n\n if (typeof callback === 'function') {\n options = options || {};\n try {\n const normalizedPath = path.normalize(this.path);\n const fullPath = path.join(dest, stripPath(normalizedPath, options as ExtractOptions));\n\n const queue = new Queue(1);\n if ((options as ExtractOptions).force) {\n queue.defer((callback) => {\n rm(fullPath, (err) => {\n err && err.code !== 'ENOENT' ? callback(err) : callback();\n });\n });\n } else {\n // Check if file exists - throw EEXIST if it does\n queue.defer((callback) => {\n fs.stat(fullPath, (err) => {\n if (!err) {\n const existsErr = new Error(`EEXIST: file already exists, open '${fullPath}'`) as NodeJS.ErrnoException;\n existsErr.code = 'EEXIST';\n existsErr.path = fullPath;\n return callback(existsErr);\n }\n // ENOENT means file doesn't exist - that's what we want\n if (err.code === 'ENOENT') return callback();\n // Other errors should be reported\n callback(err);\n });\n });\n }\n queue.defer(mkdirp.bind(null, path.dirname(fullPath)));\n queue.defer((this as unknown as AbstractFileEntry)._writeFile.bind(this, fullPath, options));\n queue.defer(chmod.bind(null, fullPath, this, options));\n queue.defer(chown.bind(null, fullPath, this, options));\n queue.defer(utimes.bind(null, fullPath, this, options));\n queue.await(callback);\n return;\n } catch (err) {\n callback(err);\n return;\n }\n }\n\n return new Promise((resolve, reject) => {\n this.create(dest, options, (err?: Error, done?: boolean) => (err ? reject(err) : resolve(done)));\n });\n }\n\n destroy() {}\n}\n"],"names":["fs","rm","mkdirp","path","Queue","chmod","chown","utimes","objectAssign","stripPath","validateAttributes","MANDATORY_ATTRIBUTES","FileEntry","create","dest","options","callback","normalizedPath","normalize","fullPath","join","queue","force","defer","err","code","stat","existsErr","Error","bind","dirname","_writeFile","await","Promise","resolve","reject","done","destroy","attributes","basename","undefined","type"],"mappings":"AAAA,OAAOA,QAAQ,KAAK;AACpB,SAASC,EAAE,QAA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;4BAClCA,SAASQ;wBACX;oBACF;gBACF;gBACAH,MAAME,KAAK,CAACrB,OAAO2B,IAAI,CAAC,MAAM1B,KAAK2B,OAAO,CAACX;gBAC3CE,MAAME,KAAK,CAAC,AAAC,IAAI,CAAkCQ,UAAU,CAACF,IAAI,CAAC,IAAI,EAAEV,UAAUJ;gBACnFM,MAAME,KAAK,CAAClB,MAAMwB,IAAI,CAAC,MAAMV,UAAU,IAAI,EAAEJ;gBAC7CM,MAAME,KAAK,CAACjB,MAAMuB,IAAI,CAAC,MAAMV,UAAU,IAAI,EAAEJ;gBAC7CM,MAAME,KAAK,CAAChB,OAAOsB,IAAI,CAAC,MAAMV,UAAU,IAAI,EAAEJ;gBAC9CM,MAAMW,KAAK,CAAChB;gBACZ;YACF,EAAE,OAAOQ,KAAK;gBACZR,SAASQ;gBACT;YACF;QACF;QAEA,OAAO,IAAIS,QAAQ,CAACC,SAASC;YAC3B,IAAI,CAACtB,MAAM,CAACC,MAAMC,SAAS,CAACS,KAAaY,OAAoBZ,MAAMW,OAAOX,OAAOU,QAAQE;QAC3F;IACF;IAEAC,UAAU,CAAC;IA9DX,YAAYC,UAA0B,CAAE;QACtC5B,mBAAmB4B,YAAY3B;QAC/BH,aAAa,IAAI,EAAE8B;QACnB,IAAI,IAAI,CAACC,QAAQ,KAAKC,WAAW,IAAI,CAACD,QAAQ,GAAGpC,KAAKoC,QAAQ,CAAC,IAAI,CAACpC,IAAI;QACxE,IAAI,IAAI,CAACsC,IAAI,KAAKD,WAAW,IAAI,CAACC,IAAI,GAAG;QACzC,IAAI,AAAC,IAAI,CAAkCV,UAAU,KAAKS,WAAW,MAAM,IAAIZ,MAAM;IACvF;AAyDF;AAtEA,SAAqBhB,uBAsEpB"}
|
|
@@ -6,8 +6,8 @@ import path from 'path';
|
|
|
6
6
|
import Queue from 'queue-cb';
|
|
7
7
|
import chmod from './fs/chmod.js';
|
|
8
8
|
import chown from './fs/chown.js';
|
|
9
|
+
import lutimes from './fs/lutimes.js';
|
|
9
10
|
import symlinkWin32 from './fs/symlinkWin32.js';
|
|
10
|
-
import utimes from './fs/utimes.js';
|
|
11
11
|
import { objectAssign } from './shared/index.js';
|
|
12
12
|
import stripPath from './stripPath.js';
|
|
13
13
|
import validateAttributes from './validateAttributes.js';
|
|
@@ -49,7 +49,7 @@ let SymbolicLinkEntry = class SymbolicLinkEntry {
|
|
|
49
49
|
else queue.defer(fs.symlink.bind(fs, normalizedLinkpath, fullPath));
|
|
50
50
|
queue.defer(chmod.bind(null, fullPath, this, options));
|
|
51
51
|
queue.defer(chown.bind(null, fullPath, this, options));
|
|
52
|
-
queue.defer(
|
|
52
|
+
queue.defer(lutimes.bind(null, fullPath, this, options));
|
|
53
53
|
queue.await(callback);
|
|
54
54
|
return;
|
|
55
55
|
} catch (err) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/SymbolicLinkEntry.ts"],"sourcesContent":["import { rm } from 'fs-remove-compat';\nimport fs from 'graceful-fs';\nimport isAbsolute from 'is-absolute';\nimport mkdirp from 'mkdirp-classic';\nimport path from 'path';\nimport Queue from 'queue-cb';\nimport chmod from './fs/chmod.ts';\nimport chown from './fs/chown.ts';\nimport
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/SymbolicLinkEntry.ts"],"sourcesContent":["import { rm } from 'fs-remove-compat';\nimport fs from 'graceful-fs';\nimport isAbsolute from 'is-absolute';\nimport mkdirp from 'mkdirp-classic';\nimport path from 'path';\nimport Queue from 'queue-cb';\nimport chmod from './fs/chmod.ts';\nimport chown from './fs/chown.ts';\nimport lutimes from './fs/lutimes.ts';\nimport symlinkWin32 from './fs/symlinkWin32.ts';\nimport { objectAssign } from './shared/index.ts';\nimport stripPath from './stripPath.ts';\nimport validateAttributes from './validateAttributes.ts';\n\nconst isWindows = process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE);\n\nconst MANDATORY_ATTRIBUTES = ['mode', 'mtime', 'path', 'linkpath'];\n\nimport type { Mode } from 'fs';\nimport type { ExtractOptions, LinkAttributes, NoParamCallback } from './types.ts';\n\nexport default class SymbolicLinkEntry {\n mode: Mode;\n mtime: number;\n path: string;\n linkpath: string;\n basename: string;\n type: string;\n\n constructor(attributes: LinkAttributes) {\n validateAttributes(attributes, MANDATORY_ATTRIBUTES);\n objectAssign(this, attributes);\n if (this.basename === undefined) this.basename = path.basename(this.path);\n if (this.type === undefined) this.type = 'symlink';\n }\n\n create(dest: string, options: ExtractOptions | NoParamCallback, callback?: NoParamCallback): undefined | Promise<boolean> {\n if (typeof options === 'function') {\n callback = options;\n options = null;\n }\n\n if (typeof callback === 'function') {\n options = options || {};\n try {\n const normalizedPath = path.normalize(this.path);\n const fullPath = path.join(dest, stripPath(normalizedPath, options as ExtractOptions));\n let normalizedLinkpath = path.normalize(this.linkpath);\n let linkFullPath = path.join(dest, stripPath(normalizedLinkpath, options as ExtractOptions));\n if (!isAbsolute(normalizedLinkpath)) {\n const linkRelativePath = path.join(path.dirname(normalizedPath), this.linkpath);\n linkFullPath = path.join(dest, stripPath(linkRelativePath, options as ExtractOptions));\n normalizedLinkpath = path.relative(path.dirname(fullPath), linkFullPath);\n }\n\n const queue = new Queue(1);\n if ((options as ExtractOptions).force) {\n queue.defer((callback) => {\n rm(fullPath, (err) => {\n err && err.code !== 'ENOENT' ? callback(err) : callback();\n });\n });\n }\n queue.defer(mkdirp.bind(null, path.dirname(fullPath)));\n if (isWindows) queue.defer(symlinkWin32.bind(null, linkFullPath, normalizedLinkpath, fullPath));\n else queue.defer(fs.symlink.bind(fs, normalizedLinkpath, fullPath));\n queue.defer(chmod.bind(null, fullPath, this, options));\n queue.defer(chown.bind(null, fullPath, this, options));\n queue.defer(lutimes.bind(null, fullPath, this, options));\n queue.await(callback);\n return;\n } catch (err) {\n callback(err);\n return;\n }\n }\n\n return new Promise((resolve, reject) => {\n this.create(dest, options, (err?: Error, done?: boolean) => (err ? reject(err) : resolve(done)));\n });\n }\n\n destroy() {}\n}\n"],"names":["rm","fs","isAbsolute","mkdirp","path","Queue","chmod","chown","lutimes","symlinkWin32","objectAssign","stripPath","validateAttributes","isWindows","process","platform","test","env","OSTYPE","MANDATORY_ATTRIBUTES","SymbolicLinkEntry","create","dest","options","callback","normalizedPath","normalize","fullPath","join","normalizedLinkpath","linkpath","linkFullPath","linkRelativePath","dirname","relative","queue","force","defer","err","code","bind","symlink","await","Promise","resolve","reject","done","destroy","attributes","basename","undefined","type"],"mappings":"AAAA,SAASA,EAAE,QAAQ,mBAAmB;AACtC,OAAOC,QAAQ,cAAc;AAC7B,OAAOC,gBAAgB,cAAc;AACrC,OAAOC,YAAY,iBAAiB;AACpC,OAAOC,UAAU,OAAO;AACxB,OAAOC,WAAW,WAAW;AAC7B,OAAOC,WAAW,gBAAgB;AAClC,OAAOC,WAAW,gBAAgB;AAClC,OAAOC,aAAa,kBAAkB;AACtC,OAAOC,kBAAkB,uBAAuB;AAChD,SAASC,YAAY,QAAQ,oBAAoB;AACjD,OAAOC,eAAe,iBAAiB;AACvC,OAAOC,wBAAwB,0BAA0B;AAEzD,MAAMC,YAAYC,QAAQC,QAAQ,KAAK,WAAW,kBAAkBC,IAAI,CAACF,QAAQG,GAAG,CAACC,MAAM;AAE3F,MAAMC,uBAAuB;IAAC;IAAQ;IAAS;IAAQ;CAAW;AAKnD,IAAA,AAAMC,oBAAN,MAAMA;IAenBC,OAAOC,IAAY,EAAEC,OAAyC,EAAEC,QAA0B,EAAgC;QACxH,IAAI,OAAOD,YAAY,YAAY;YACjCC,WAAWD;YACXA,UAAU;QACZ;QAEA,IAAI,OAAOC,aAAa,YAAY;YAClCD,UAAUA,WAAW,CAAC;YACtB,IAAI;gBACF,MAAME,iBAAiBrB,KAAKsB,SAAS,CAAC,IAAI,CAACtB,IAAI;gBAC/C,MAAMuB,WAAWvB,KAAKwB,IAAI,CAACN,MAAMX,UAAUc,gBAAgBF;gB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C3B,IAAI,CAACxB,MAAM,CAACC,MAAMC,SAAS,CAACe,KAAaQ,OAAoBR,MAAMO,OAAOP,OAAOM,QAAQE;QAC3F;IACF;IAEAC,UAAU,CAAC;IArDX,YAAYC,UAA0B,CAAE;QACtCpC,mBAAmBoC,YAAY7B;QAC/BT,aAAa,IAAI,EAAEsC;QACnB,IAAI,IAAI,CAACC,QAAQ,KAAKC,WAAW,IAAI,CAACD,QAAQ,GAAG7C,KAAK6C,QAAQ,CAAC,IAAI,CAAC7C,IAAI;QACxE,IAAI,IAAI,CAAC+C,IAAI,KAAKD,WAAW,IAAI,CAACC,IAAI,GAAG;IAC3C;AAiDF;AA9DA,SAAqB/B,+BA8DpB"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// lutimes - set times on symlinks without following them
|
|
2
|
+
// fs.lutimes was added in Node.js 14.5.0
|
|
3
|
+
// For older versions, we skip setting times on symlinks (no good alternative)
|
|
4
|
+
import fs from 'graceful-fs';
|
|
5
|
+
// biome-ignore lint/suspicious/noExplicitAny: fs.lutimes not in older @types/node
|
|
6
|
+
const HAS_LUTIMES = typeof fs.lutimes === 'function';
|
|
7
|
+
export default function lutimes(fullPath, entry, options, callback) {
|
|
8
|
+
if (HAS_LUTIMES) {
|
|
9
|
+
const now = options.now || new Date();
|
|
10
|
+
// biome-ignore lint/suspicious/noExplicitAny: fs.lutimes not in older @types/node
|
|
11
|
+
fs.lutimes(fullPath, now, new Date(entry.mtime), callback);
|
|
12
|
+
} else {
|
|
13
|
+
// On older Node versions, skip setting times on symlinks
|
|
14
|
+
// fs.utimes follows symlinks and will fail with ENOENT if target doesn't exist
|
|
15
|
+
callback(null);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/fs/lutimes.ts"],"sourcesContent":["// lutimes - set times on symlinks without following them\n// fs.lutimes was added in Node.js 14.5.0\n// For older versions, we skip setting times on symlinks (no good alternative)\n\nimport type { NoParamCallback } from 'fs';\nimport fs from 'graceful-fs';\nimport type { AbstractEntry, ExtractOptions } from '../types.ts';\n\n// biome-ignore lint/suspicious/noExplicitAny: fs.lutimes not in older @types/node\nconst HAS_LUTIMES = typeof (fs as any).lutimes === 'function';\n\nexport default function lutimes(fullPath: string, entry: AbstractEntry, options: ExtractOptions, callback: NoParamCallback): undefined {\n if (HAS_LUTIMES) {\n const now = options.now || new Date();\n // biome-ignore lint/suspicious/noExplicitAny: fs.lutimes not in older @types/node\n (fs as any).lutimes(fullPath, now, new Date(entry.mtime), callback);\n } else {\n // On older Node versions, skip setting times on symlinks\n // fs.utimes follows symlinks and will fail with ENOENT if target doesn't exist\n callback(null);\n }\n}\n"],"names":["fs","HAS_LUTIMES","lutimes","fullPath","entry","options","callback","now","Date","mtime"],"mappings":"AAAA,yDAAyD;AACzD,yCAAyC;AACzC,8EAA8E;AAG9E,OAAOA,QAAQ,cAAc;AAG7B,kFAAkF;AAClF,MAAMC,cAAc,OAAO,AAACD,GAAWE,OAAO,KAAK;AAEnD,eAAe,SAASA,QAAQC,QAAgB,EAAEC,KAAoB,EAAEC,OAAuB,EAAEC,QAAyB;IACxH,IAAIL,aAAa;QACf,MAAMM,MAAMF,QAAQE,GAAG,IAAI,IAAIC;QAC/B,kFAAkF;QACjFR,GAAWE,OAAO,CAACC,UAAUI,KAAK,IAAIC,KAAKJ,MAAMK,KAAK,GAAGH;IAC5D,OAAO;QACL,yDAAyD;QACzD,+EAA+E;QAC/EA,SAAS;IACX;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "extract-base-iterator",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.10",
|
|
4
4
|
"description": "Base iterator for extract iterators like tar-iterator and zip-iterator",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"extract",
|
|
@@ -43,28 +43,28 @@
|
|
|
43
43
|
"version": "tsds version"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"fs-remove-compat": "
|
|
47
|
-
"graceful-fs": "
|
|
48
|
-
"is-absolute": "
|
|
49
|
-
"lodash.compact": "
|
|
50
|
-
"mkdirp-classic": "
|
|
51
|
-
"next-tick": "
|
|
46
|
+
"fs-remove-compat": "^0.2.1",
|
|
47
|
+
"graceful-fs": "^4.2.11",
|
|
48
|
+
"is-absolute": "^1.0.0",
|
|
49
|
+
"lodash.compact": "^3.0.1",
|
|
50
|
+
"mkdirp-classic": "^0.5.3",
|
|
51
|
+
"next-tick": "^1.1.0",
|
|
52
52
|
"pako": "~1.0.11",
|
|
53
|
-
"queue-cb": "
|
|
53
|
+
"queue-cb": "^1.6.1",
|
|
54
54
|
"readable-stream": "^2.3.8",
|
|
55
|
-
"stack-base-iterator": "
|
|
55
|
+
"stack-base-iterator": "^2.1.13"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@types/mocha": "
|
|
59
|
-
"@types/node": "
|
|
60
|
-
"cr": "
|
|
61
|
-
"fs-iterator": "
|
|
62
|
-
"fs-stats-spys": "
|
|
63
|
-
"lodash.find": "
|
|
64
|
-
"node-version-use": "
|
|
65
|
-
"pinkie-promise": "
|
|
66
|
-
"ts-dev-stack": "
|
|
67
|
-
"tsds-config": "
|
|
58
|
+
"@types/mocha": "^10.0.10",
|
|
59
|
+
"@types/node": "^24.10.1",
|
|
60
|
+
"cr": "^0.1.0",
|
|
61
|
+
"fs-iterator": "^6.1.10",
|
|
62
|
+
"fs-stats-spys": "^1.2.7",
|
|
63
|
+
"lodash.find": "^4.6.0",
|
|
64
|
+
"node-version-use": "^1.9.7",
|
|
65
|
+
"pinkie-promise": "^2.0.1",
|
|
66
|
+
"ts-dev-stack": "^1.21.2",
|
|
67
|
+
"tsds-config": "^0.2.0"
|
|
68
68
|
},
|
|
69
69
|
"engines": {
|
|
70
70
|
"node": ">=0.8"
|