extract-base-iterator 1.2.24 → 1.3.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/cjs/DirectoryEntry.d.cts +8 -0
- package/dist/cjs/DirectoryEntry.d.ts +8 -0
- package/dist/cjs/DirectoryEntry.js +76 -0
- package/dist/cjs/DirectoryEntry.js.map +1 -0
- package/dist/cjs/FileEntry.d.cts +8 -0
- package/dist/cjs/FileEntry.d.ts +8 -0
- package/dist/cjs/FileEntry.js +87 -0
- package/dist/cjs/FileEntry.js.map +1 -0
- package/dist/cjs/LinkEntry.d.cts +9 -0
- package/dist/cjs/LinkEntry.d.ts +9 -0
- package/dist/cjs/LinkEntry.js +90 -0
- package/dist/cjs/LinkEntry.js.map +1 -0
- package/dist/cjs/SymbolicLinkEntry.d.cts +9 -0
- package/dist/cjs/SymbolicLinkEntry.d.ts +9 -0
- package/dist/cjs/SymbolicLinkEntry.js +106 -0
- package/dist/cjs/SymbolicLinkEntry.js.map +1 -0
- package/dist/cjs/fs/chmod.d.cts +1 -0
- package/dist/cjs/fs/chmod.d.ts +1 -0
- package/dist/cjs/fs/{chmod.cjs → chmod.js} +4 -4
- package/dist/cjs/fs/chmod.js.map +1 -0
- package/dist/cjs/fs/chown.d.cts +1 -0
- package/dist/cjs/fs/chown.d.ts +1 -0
- package/dist/cjs/fs/chown.js.map +1 -0
- package/dist/cjs/fs/lstatReal.d.cts +1 -0
- package/dist/cjs/fs/lstatReal.d.ts +1 -0
- package/dist/cjs/fs/lstatReal.js.map +1 -0
- package/dist/cjs/fs/utimes.d.cts +1 -0
- package/dist/cjs/fs/utimes.d.ts +1 -0
- package/dist/cjs/fs/utimes.js.map +1 -0
- package/dist/cjs/fs/waitForAccess.d.cts +1 -0
- package/dist/cjs/fs/waitForAccess.d.ts +1 -0
- package/dist/cjs/fs/waitForAccess.js.map +1 -0
- package/dist/cjs/index.d.cts +6 -0
- package/dist/cjs/index.d.ts +6 -0
- package/dist/cjs/{index.cjs → index.js} +4 -4
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/stripPath.d.cts +1 -0
- package/dist/cjs/stripPath.d.ts +1 -0
- package/dist/cjs/stripPath.js.map +1 -0
- package/dist/cjs/types.d.cts +2 -0
- package/dist/cjs/types.d.ts +2 -0
- package/dist/cjs/types.js +5 -0
- package/dist/cjs/types.js.map +1 -0
- package/dist/cjs/validateAttributes.d.cts +1 -0
- package/dist/cjs/validateAttributes.d.ts +1 -0
- package/dist/cjs/{validateAttributes.cjs → validateAttributes.js} +1 -2
- package/dist/cjs/validateAttributes.js.map +1 -0
- package/dist/esm/DirectoryEntry.d.ts +8 -0
- package/dist/esm/DirectoryEntry.js +49 -0
- package/dist/esm/DirectoryEntry.js.map +1 -0
- package/dist/esm/FileEntry.d.ts +8 -0
- package/dist/esm/FileEntry.js +60 -0
- package/dist/esm/FileEntry.js.map +1 -0
- package/dist/esm/LinkEntry.d.ts +9 -0
- package/dist/esm/LinkEntry.js +63 -0
- package/dist/esm/LinkEntry.js.map +1 -0
- package/dist/esm/SymbolicLinkEntry.d.ts +9 -0
- package/dist/esm/SymbolicLinkEntry.js +79 -0
- package/dist/esm/SymbolicLinkEntry.js.map +1 -0
- package/dist/esm/fs/chmod.d.ts +1 -0
- package/dist/esm/fs/{chmod.mjs → chmod.js} +4 -4
- package/dist/esm/fs/chmod.js.map +1 -0
- package/dist/esm/fs/chown.d.ts +1 -0
- package/dist/esm/fs/chown.js.map +1 -0
- package/dist/esm/fs/lstatReal.d.ts +1 -0
- package/dist/esm/fs/lstatReal.js.map +1 -0
- package/dist/esm/fs/utimes.d.ts +1 -0
- package/dist/esm/fs/utimes.js.map +1 -0
- package/dist/esm/fs/waitForAccess.d.ts +1 -0
- package/dist/esm/fs/waitForAccess.js.map +1 -0
- package/dist/esm/index.d.ts +6 -0
- package/dist/esm/index.js +6 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/package.json +1 -0
- package/dist/esm/stripPath.d.ts +1 -0
- package/dist/esm/stripPath.js.map +1 -0
- package/dist/esm/types.d.ts +2 -0
- package/dist/esm/types.js +1 -0
- package/dist/esm/types.js.map +1 -0
- package/dist/esm/validateAttributes.d.ts +1 -0
- package/dist/esm/{validateAttributes.mjs → validateAttributes.js} +1 -2
- package/dist/esm/validateAttributes.js.map +1 -0
- package/package.json +7 -7
- package/dist/cjs/DirectoryEntry.cjs +0 -65
- package/dist/cjs/DirectoryEntry.cjs.map +0 -1
- package/dist/cjs/FileEntry.cjs +0 -76
- package/dist/cjs/FileEntry.cjs.map +0 -1
- package/dist/cjs/LinkEntry.cjs +0 -79
- package/dist/cjs/LinkEntry.cjs.map +0 -1
- package/dist/cjs/SymbolicLinkEntry.cjs +0 -95
- package/dist/cjs/SymbolicLinkEntry.cjs.map +0 -1
- package/dist/cjs/fs/chmod.cjs.map +0 -1
- package/dist/cjs/fs/chown.cjs.map +0 -1
- package/dist/cjs/fs/lstatReal.cjs.map +0 -1
- package/dist/cjs/fs/utimes.cjs.map +0 -1
- package/dist/cjs/fs/waitForAccess.cjs.map +0 -1
- package/dist/cjs/index.cjs.map +0 -1
- package/dist/cjs/stripPath.cjs.map +0 -1
- package/dist/cjs/validateAttributes.cjs.map +0 -1
- package/dist/esm/DirectoryEntry.mjs +0 -47
- package/dist/esm/DirectoryEntry.mjs.map +0 -1
- package/dist/esm/FileEntry.mjs +0 -58
- package/dist/esm/FileEntry.mjs.map +0 -1
- package/dist/esm/LinkEntry.mjs +0 -61
- package/dist/esm/LinkEntry.mjs.map +0 -1
- package/dist/esm/SymbolicLinkEntry.mjs +0 -77
- package/dist/esm/SymbolicLinkEntry.mjs.map +0 -1
- package/dist/esm/fs/chmod.mjs.map +0 -1
- package/dist/esm/fs/chown.mjs.map +0 -1
- package/dist/esm/fs/lstatReal.mjs.map +0 -1
- package/dist/esm/fs/utimes.mjs.map +0 -1
- package/dist/esm/fs/waitForAccess.mjs.map +0 -1
- package/dist/esm/index.mjs +0 -6
- package/dist/esm/index.mjs.map +0 -1
- package/dist/esm/stripPath.mjs.map +0 -1
- package/dist/esm/validateAttributes.mjs.map +0 -1
- /package/dist/cjs/fs/{chown.cjs → chown.js} +0 -0
- /package/dist/cjs/fs/{lstatReal.cjs → lstatReal.js} +0 -0
- /package/dist/cjs/fs/{utimes.cjs → utimes.js} +0 -0
- /package/dist/cjs/fs/{waitForAccess.cjs → waitForAccess.js} +0 -0
- /package/dist/cjs/{stripPath.cjs → stripPath.js} +0 -0
- /package/dist/esm/fs/{chown.mjs → chown.js} +0 -0
- /package/dist/esm/fs/{lstatReal.mjs → lstatReal.js} +0 -0
- /package/dist/esm/fs/{utimes.mjs → utimes.js} +0 -0
- /package/dist/esm/fs/{waitForAccess.mjs → waitForAccess.js} +0 -0
- /package/dist/esm/{stripPath.mjs → stripPath.js} +0 -0
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
/* 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":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function validateAttributes(attributes: any, keys: any): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function validateAttributes(attributes: any, keys: any): void;
|
|
@@ -9,9 +9,8 @@ Object.defineProperty(exports, "default", {
|
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
11
|
function validateAttributes(attributes, keys) {
|
|
12
|
-
var key;
|
|
13
12
|
for(var index = 0; index < keys.length; index++){
|
|
14
|
-
key = keys[index];
|
|
13
|
+
var key = keys[index];
|
|
15
14
|
if (attributes[key] === undefined) throw new Error("Missing attribute ".concat(key, ".Attributes ").concat(JSON.stringify(attributes)));
|
|
16
15
|
}
|
|
17
16
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/validateAttributes.ts"],"sourcesContent":["export default function validateAttributes(attributes, keys) {\n for (let index = 0; index < keys.length; index++) {\n const key = keys[index];\n if (attributes[key] === undefined) throw new Error(`Missing attribute ${key}.Attributes ${JSON.stringify(attributes)}`);\n }\n}\n"],"names":["validateAttributes","attributes","keys","index","length","key","undefined","Error","JSON","stringify"],"mappings":";;;;+BAAA;;;eAAwBA;;;AAAT,SAASA,mBAAmBC,UAAU,EAAEC,IAAI;IACzD,IAAK,IAAIC,QAAQ,GAAGA,QAAQD,KAAKE,MAAM,EAAED,QAAS;QAChD,IAAME,MAAMH,IAAI,CAACC,MAAM;QACvB,IAAIF,UAAU,CAACI,IAAI,KAAKC,WAAW,MAAM,IAAIC,MAAM,AAAC,qBAAsCC,OAAlBH,KAAI,gBAAyC,OAA3BG,KAAKC,SAAS,CAACR;IAC3G;AACF"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import mkdirp from 'mkdirp-classic';
|
|
3
|
+
import objectAssign from 'object-assign';
|
|
4
|
+
import Queue from 'queue-cb';
|
|
5
|
+
import chmod from './fs/chmod.js';
|
|
6
|
+
import chown from './fs/chown.js';
|
|
7
|
+
import utimes from './fs/utimes.js';
|
|
8
|
+
import stripPath from './stripPath.js';
|
|
9
|
+
import validateAttributes from './validateAttributes.js';
|
|
10
|
+
const MANDATORY_ATTRIBUTES = [
|
|
11
|
+
'mode',
|
|
12
|
+
'mtime',
|
|
13
|
+
'path'
|
|
14
|
+
];
|
|
15
|
+
let DirectoryEntry = class DirectoryEntry {
|
|
16
|
+
create(dest, options, callback) {
|
|
17
|
+
if (typeof options === 'function') {
|
|
18
|
+
callback = options;
|
|
19
|
+
options = null;
|
|
20
|
+
}
|
|
21
|
+
if (typeof callback === 'function') {
|
|
22
|
+
options = options || {};
|
|
23
|
+
try {
|
|
24
|
+
const normalizedPath = path.normalize(this.path);
|
|
25
|
+
const fullPath = path.join(dest, stripPath(normalizedPath, options));
|
|
26
|
+
// do not check for the existence of the directory but allow out-of-order calling
|
|
27
|
+
const queue = new Queue(1);
|
|
28
|
+
queue.defer(mkdirp.bind(null, fullPath));
|
|
29
|
+
queue.defer(chmod.bind(null, fullPath, this, options));
|
|
30
|
+
queue.defer(chown.bind(null, fullPath, this, options));
|
|
31
|
+
queue.defer(utimes.bind(null, fullPath, this, options));
|
|
32
|
+
return queue.await(callback);
|
|
33
|
+
} catch (err) {
|
|
34
|
+
return callback(err);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return new Promise((resolve, reject)=>{
|
|
38
|
+
this.create(dest, options, (err, done)=>err ? reject(err) : resolve(done));
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
destroy() {}
|
|
42
|
+
constructor(attributes){
|
|
43
|
+
validateAttributes(attributes, MANDATORY_ATTRIBUTES);
|
|
44
|
+
objectAssign(this, attributes);
|
|
45
|
+
if (this.type === undefined) this.type = 'directory';
|
|
46
|
+
if (this.basename === undefined) this.basename = path.basename(this.path);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
export { DirectoryEntry as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/DirectoryEntry.ts"],"sourcesContent":["import path from 'path';\nimport mkdirp from 'mkdirp-classic';\nimport objectAssign from 'object-assign';\nimport Queue from 'queue-cb';\n\nimport chmod from './fs/chmod.js';\nimport chown from './fs/chown.js';\nimport utimes from './fs/utimes.js';\nimport stripPath from './stripPath.js';\nimport validateAttributes from './validateAttributes.js';\n\nconst MANDATORY_ATTRIBUTES = ['mode', 'mtime', 'path'];\n\nexport default class DirectoryEntry {\n path: string;\n basename: string;\n type: string;\n\n constructor(attributes) {\n validateAttributes(attributes, MANDATORY_ATTRIBUTES);\n objectAssign(this, attributes);\n if (this.type === undefined) this.type = 'directory';\n if (this.basename === undefined) this.basename = path.basename(this.path);\n }\n\n create(dest, options, callback) {\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));\n\n // do not check for the existence of the directory but allow out-of-order calling\n const queue = new Queue(1);\n queue.defer(mkdirp.bind(null, fullPath));\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 return queue.await(callback);\n } catch (err) {\n return callback(err);\n }\n }\n\n return new Promise((resolve, reject) => {\n this.create(dest, options, (err, done) => (err ? reject(err) : resolve(done)));\n });\n }\n\n destroy() {}\n}\n"],"names":["path","mkdirp","objectAssign","Queue","chmod","chown","utimes","stripPath","validateAttributes","MANDATORY_ATTRIBUTES","DirectoryEntry","create","dest","options","callback","normalizedPath","normalize","fullPath","join","queue","defer","bind","await","err","Promise","resolve","reject","done","destroy","constructor","attributes","type","undefined","basename"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,OAAOC,YAAY,iBAAiB;AACpC,OAAOC,kBAAkB,gBAAgB;AACzC,OAAOC,WAAW,WAAW;AAE7B,OAAOC,WAAW,gBAAgB;AAClC,OAAOC,WAAW,gBAAgB;AAClC,OAAOC,YAAY,iBAAiB;AACpC,OAAOC,eAAe,iBAAiB;AACvC,OAAOC,wBAAwB,0BAA0B;AAEzD,MAAMC,uBAAuB;IAAC;IAAQ;IAAS;CAAO;AAEvC,IAAA,AAAMC,iBAAN,MAAMA;IAYnBC,OAAOC,IAAI,EAAEC,OAAO,EAAEC,QAAQ,EAAE;QAC9B,IAAI,OAAOD,YAAY,YAAY;YACjCC,WAAWD;YACXA,UAAU;QACZ;QAEA,IAAI,OAAOC,aAAa,YAAY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import rimraf2 from 'rimraf2';
|
|
6
|
+
import chmod from './fs/chmod.js';
|
|
7
|
+
import chown from './fs/chown.js';
|
|
8
|
+
import utimes from './fs/utimes.js';
|
|
9
|
+
import stripPath from './stripPath.js';
|
|
10
|
+
import validateAttributes from './validateAttributes.js';
|
|
11
|
+
const MANDATORY_ATTRIBUTES = [
|
|
12
|
+
'mode',
|
|
13
|
+
'mtime',
|
|
14
|
+
'path'
|
|
15
|
+
];
|
|
16
|
+
let FileEntry = class FileEntry {
|
|
17
|
+
create(dest, options, callback) {
|
|
18
|
+
if (typeof options === 'function') {
|
|
19
|
+
callback = options;
|
|
20
|
+
options = null;
|
|
21
|
+
}
|
|
22
|
+
if (typeof callback === 'function') {
|
|
23
|
+
options = options || {};
|
|
24
|
+
try {
|
|
25
|
+
const normalizedPath = path.normalize(this.path);
|
|
26
|
+
const fullPath = path.join(dest, stripPath(normalizedPath, options));
|
|
27
|
+
const queue = new Queue(1);
|
|
28
|
+
if (options.force) {
|
|
29
|
+
queue.defer((callback)=>{
|
|
30
|
+
rimraf2(fullPath, {
|
|
31
|
+
disableGlob: true
|
|
32
|
+
}, (err)=>{
|
|
33
|
+
err && err.code !== 'ENOENT' ? callback(err) : callback();
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
queue.defer(mkdirp.bind(null, path.dirname(fullPath)));
|
|
38
|
+
queue.defer(this._writeFile.bind(this, fullPath, options));
|
|
39
|
+
queue.defer(chmod.bind(null, fullPath, this, options));
|
|
40
|
+
queue.defer(chown.bind(null, fullPath, this, options));
|
|
41
|
+
queue.defer(utimes.bind(null, fullPath, this, options));
|
|
42
|
+
return queue.await(callback);
|
|
43
|
+
} catch (err) {
|
|
44
|
+
return callback(err);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return new Promise((resolve, reject)=>{
|
|
48
|
+
this.create(dest, options, (err, done)=>err ? reject(err) : resolve(done));
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
destroy() {}
|
|
52
|
+
constructor(attributes){
|
|
53
|
+
validateAttributes(attributes, MANDATORY_ATTRIBUTES);
|
|
54
|
+
objectAssign(this, attributes);
|
|
55
|
+
if (this.basename === undefined) this.basename = path.basename(this.path);
|
|
56
|
+
if (this.type === undefined) this.type = 'file';
|
|
57
|
+
if (this._writeFile === undefined) throw new Error('File this missing _writeFile. Please implement this method in your subclass');
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
export { FileEntry as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/FileEntry.ts"],"sourcesContent":["import path from 'path';\nimport mkdirp from 'mkdirp-classic';\nimport objectAssign from 'object-assign';\nimport Queue from 'queue-cb';\n\nimport rimraf2 from 'rimraf2';\nimport chmod from './fs/chmod.js';\nimport chown from './fs/chown.js';\nimport utimes from './fs/utimes.js';\nimport stripPath from './stripPath.js';\nimport validateAttributes from './validateAttributes.js';\n\nconst MANDATORY_ATTRIBUTES = ['mode', 'mtime', 'path'];\n\nimport type { WriteFileFn } from './types.js';\ninterface AbstractFileEntry {\n _writeFile: WriteFileFn;\n}\n\nexport default class FileEntry {\n path: string;\n basename: string;\n type: string;\n\n constructor(attributes) {\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, options, callback) {\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));\n\n const queue = new Queue(1);\n if (options.force) {\n queue.defer((callback) => {\n rimraf2(fullPath, { disableGlob: true }, (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 return queue.await(callback);\n } catch (err) {\n return callback(err);\n }\n }\n\n return new Promise((resolve, reject) => {\n this.create(dest, options, (err, done) => (err ? reject(err) : resolve(done)));\n });\n }\n\n destroy() {}\n}\n"],"names":["path","mkdirp","objectAssign","Queue","rimraf2","chmod","chown","utimes","stripPath","validateAttributes","MANDATORY_ATTRIBUTES","FileEntry","create","dest","options","callback","normalizedPath","normalize","fullPath","join","queue","force","defer","disableGlob","err","code","bind","dirname","_writeFile","await","Promise","resolve","reject","done","destroy","constructor","attributes","basename","undefined","type","Error"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,OAAOC,YAAY,iBAAiB;AACpC,OAAOC,kBAAkB,gBAAgB;AACzC,OAAOC,WAAW,WAAW;AAE7B,OAAOC,aAAa,UAAU;AAC9B,OAAOC,WAAW,gBAAgB;AAClC,OAAOC,WAAW,gBAAgB;AAClC,OAAOC,YAAY,iBAAiB;AACpC,OAAOC,eAAe,iBAAiB;AACvC,OAAOC,wBAAwB,0BAA0B;AAEzD,MAAMC,uBAAuB;IAAC;IAAQ;IAAS;CAAO;AAOvC,IAAA,AAAMC,YAAN,MAAMA;IAanBC,OAAOC,IAAI,EAAEC,OAAO,EAAEC,QAAQ,EAAE;QAC9B,IAAI,OAAOD,YAAY,YAAY;YACjCC,WAAWD;YACXA,UAAU;QACZ;QAEA,IAAI,OAAOC,aAAa,YAAY;YAClCD,UAAUA,WAAW,CAAC;YACtB,IAAI;gBACF,MAAME,iBAAiBhB,KAAKiB,SAAS,CAAC,IAAI,CAACjB,IAAI;gBAC/C,MAAMkB,WAAWlB,KAAKmB,IAAI,CAACN,MAAML,UAAUQ,gBAAgBF;gBAE3D,M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,SAAqB7B,uBAkDpB"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import fs from 'graceful-fs';
|
|
3
|
+
import mkdirp from 'mkdirp-classic';
|
|
4
|
+
import objectAssign from 'object-assign';
|
|
5
|
+
import Queue from 'queue-cb';
|
|
6
|
+
import rimraf2 from 'rimraf2';
|
|
7
|
+
import chmod from './fs/chmod.js';
|
|
8
|
+
import chown from './fs/chown.js';
|
|
9
|
+
import utimes from './fs/utimes.js';
|
|
10
|
+
import stripPath from './stripPath.js';
|
|
11
|
+
import validateAttributes from './validateAttributes.js';
|
|
12
|
+
const MANDATORY_ATTRIBUTES = [
|
|
13
|
+
'mode',
|
|
14
|
+
'mtime',
|
|
15
|
+
'path',
|
|
16
|
+
'linkpath'
|
|
17
|
+
];
|
|
18
|
+
let LinkEntry = class LinkEntry {
|
|
19
|
+
create(dest, options, callback) {
|
|
20
|
+
if (typeof options === 'function') {
|
|
21
|
+
callback = options;
|
|
22
|
+
options = null;
|
|
23
|
+
}
|
|
24
|
+
if (typeof callback === 'function') {
|
|
25
|
+
options = options || {};
|
|
26
|
+
try {
|
|
27
|
+
const normalizedPath = path.normalize(this.path);
|
|
28
|
+
const fullPath = path.join(dest, stripPath(normalizedPath, options));
|
|
29
|
+
const normalizedLinkpath = path.normalize(this.linkpath);
|
|
30
|
+
const linkFullPath = path.join(dest, stripPath(normalizedLinkpath, options));
|
|
31
|
+
const queue = new Queue(1);
|
|
32
|
+
if (options.force) {
|
|
33
|
+
queue.defer((callback)=>{
|
|
34
|
+
rimraf2(fullPath, {
|
|
35
|
+
disableGlob: true
|
|
36
|
+
}, (err)=>{
|
|
37
|
+
err && err.code !== 'ENOENT' ? callback(err) : callback();
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
queue.defer(mkdirp.bind(null, path.dirname(fullPath)));
|
|
42
|
+
queue.defer(fs.link.bind(fs, linkFullPath, fullPath));
|
|
43
|
+
queue.defer(chmod.bind(null, fullPath, this, options));
|
|
44
|
+
queue.defer(chown.bind(null, fullPath, this, options));
|
|
45
|
+
queue.defer(utimes.bind(null, fullPath, this, options));
|
|
46
|
+
return queue.await(callback);
|
|
47
|
+
} catch (err) {
|
|
48
|
+
return callback(err);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return new Promise((resolve, reject)=>{
|
|
52
|
+
this.create(dest, options, (err, done)=>err ? reject(err) : resolve(done));
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
destroy() {}
|
|
56
|
+
constructor(attributes, _type){
|
|
57
|
+
validateAttributes(attributes, MANDATORY_ATTRIBUTES);
|
|
58
|
+
objectAssign(this, attributes);
|
|
59
|
+
if (this.basename === undefined) this.basename = path.basename(this.path);
|
|
60
|
+
if (this.type === undefined) this.type = 'link';
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
export { LinkEntry as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/LinkEntry.ts"],"sourcesContent":["import path from 'path';\nimport fs from 'graceful-fs';\nimport mkdirp from 'mkdirp-classic';\nimport objectAssign from 'object-assign';\nimport Queue from 'queue-cb';\nimport rimraf2 from 'rimraf2';\n\nimport chmod from './fs/chmod.js';\nimport chown from './fs/chown.js';\nimport utimes from './fs/utimes.js';\nimport stripPath from './stripPath.js';\nimport validateAttributes from './validateAttributes.js';\n\nconst MANDATORY_ATTRIBUTES = ['mode', 'mtime', 'path', 'linkpath'];\n\nexport default class LinkEntry {\n path: string;\n basename: string;\n type: string;\n linkpath: string;\n\n constructor(attributes, _type) {\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 = 'link';\n }\n\n create(dest, options, callback) {\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));\n const normalizedLinkpath = path.normalize(this.linkpath);\n const linkFullPath = path.join(dest, stripPath(normalizedLinkpath, options));\n\n const queue = new Queue(1);\n if (options.force) {\n queue.defer((callback) => {\n rimraf2(fullPath, { disableGlob: true }, (err) => {\n err && err.code !== 'ENOENT' ? callback(err) : callback();\n });\n });\n }\n queue.defer(mkdirp.bind(null, path.dirname(fullPath)));\n queue.defer(fs.link.bind(fs, linkFullPath, fullPath));\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 return queue.await(callback);\n } catch (err) {\n return callback(err);\n }\n }\n\n return new Promise((resolve, reject) => {\n this.create(dest, options, (err, done) => (err ? reject(err) : resolve(done)));\n });\n }\n\n destroy() {}\n}\n"],"names":["path","fs","mkdirp","objectAssign","Queue","rimraf2","chmod","chown","utimes","stripPath","validateAttributes","MANDATORY_ATTRIBUTES","LinkEntry","create","dest","options","callback","normalizedPath","normalize","fullPath","join","normalizedLinkpath","linkpath","linkFullPath","queue","force","defer","disableGlob","err","code","bind","dirname","link","await","Promise","resolve","reject","done","destroy","constructor","attributes","_type","basename","undefined","type"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,OAAOC,QAAQ,cAAc;AAC7B,OAAOC,YAAY,iBAAiB;AACpC,OAAOC,kBAAkB,gBAAgB;AACzC,OAAOC,WAAW,WAAW;AAC7B,OAAOC,aAAa,UAAU;AAE9B,OAAOC,WAAW,gBAAgB;AAClC,OAAOC,WAAW,gBAAgB;AAClC,OAAOC,YAAY,iBAAiB;AACpC,OAAOC,eAAe,iBAAiB;AACvC,OAAOC,wBAAwB,0BAA0B;AAEzD,MAAMC,uBAAuB;IAAC;IAAQ;IAAS;IAAQ;CAAW;AAEnD,IAAA,AAAMC,YAAN,MAAMA;IAanBC,OAAOC,IAAI,EAAEC,OAAO,E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,OAAUT,MAAMQ,OAAOR,OAAOO,QAAQE;QACzE;IACF;IAEAC,UAAU,CAAC;IA7CXC,YAAYC,UAAU,EAAEC,KAAK,CAAE;QAC7B/B,mBAAmB8B,YAAY7B;QAC/BR,aAAa,IAAI,EAAEqC;QACnB,IAAI,IAAI,CAACE,QAAQ,KAAKC,WAAW,IAAI,CAACD,QAAQ,GAAG1C,KAAK0C,QAAQ,CAAC,IAAI,CAAC1C,IAAI;QACxE,IAAI,IAAI,CAAC4C,IAAI,KAAKD,WAAW,IAAI,CAACC,IAAI,GAAG;IAC3C;AAyCF;AApDA,SAAqBhC,uBAoDpB"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import fs from 'graceful-fs';
|
|
3
|
+
import isAbsolute from 'is-absolute';
|
|
4
|
+
import mkdirp from 'mkdirp-classic';
|
|
5
|
+
import objectAssign from 'object-assign';
|
|
6
|
+
import Queue from 'queue-cb';
|
|
7
|
+
import rimraf2 from 'rimraf2';
|
|
8
|
+
import chmod from './fs/chmod.js';
|
|
9
|
+
import chown from './fs/chown.js';
|
|
10
|
+
import lstatReal from './fs/lstatReal.js';
|
|
11
|
+
import utimes from './fs/utimes.js';
|
|
12
|
+
import stripPath from './stripPath.js';
|
|
13
|
+
import validateAttributes from './validateAttributes.js';
|
|
14
|
+
function symlinkWin32(linkFullPath, linkpath, fullPath, callback) {
|
|
15
|
+
lstatReal(linkFullPath, (err, targetStat)=>{
|
|
16
|
+
if (err || !targetStat) return callback(err || new Error(`Symlink path does not exist${linkFullPath}`));
|
|
17
|
+
const type = targetStat.isDirectory() ? 'dir' : 'file';
|
|
18
|
+
fs.symlink(linkpath, fullPath, type, callback);
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
const isWindows = process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE);
|
|
22
|
+
const MANDATORY_ATTRIBUTES = [
|
|
23
|
+
'mode',
|
|
24
|
+
'mtime',
|
|
25
|
+
'path',
|
|
26
|
+
'linkpath'
|
|
27
|
+
];
|
|
28
|
+
let SymbolicLinkEntry = class SymbolicLinkEntry {
|
|
29
|
+
create(dest, options, callback) {
|
|
30
|
+
if (typeof options === 'function') {
|
|
31
|
+
callback = options;
|
|
32
|
+
options = null;
|
|
33
|
+
}
|
|
34
|
+
if (typeof callback === 'function') {
|
|
35
|
+
options = options || {};
|
|
36
|
+
try {
|
|
37
|
+
const normalizedPath = path.normalize(this.path);
|
|
38
|
+
const fullPath = path.join(dest, stripPath(normalizedPath, options));
|
|
39
|
+
let normalizedLinkpath = path.normalize(this.linkpath);
|
|
40
|
+
let linkFullPath = path.join(dest, stripPath(normalizedLinkpath, options));
|
|
41
|
+
if (!isAbsolute(normalizedLinkpath)) {
|
|
42
|
+
const linkRelativePath = path.join(path.dirname(normalizedPath), this.linkpath);
|
|
43
|
+
linkFullPath = path.join(dest, stripPath(linkRelativePath, options));
|
|
44
|
+
normalizedLinkpath = path.relative(path.dirname(fullPath), linkFullPath);
|
|
45
|
+
}
|
|
46
|
+
const queue = new Queue(1);
|
|
47
|
+
if (options.force) {
|
|
48
|
+
queue.defer((callback)=>{
|
|
49
|
+
rimraf2(fullPath, {
|
|
50
|
+
disableGlob: true
|
|
51
|
+
}, (err)=>{
|
|
52
|
+
err && err.code !== 'ENOENT' ? callback(err) : callback();
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
queue.defer(mkdirp.bind(null, path.dirname(fullPath)));
|
|
57
|
+
if (isWindows) queue.defer(symlinkWin32.bind(null, linkFullPath, normalizedLinkpath, fullPath));
|
|
58
|
+
else queue.defer(fs.symlink.bind(fs, normalizedLinkpath, fullPath));
|
|
59
|
+
queue.defer(chmod.bind(null, fullPath, this, options));
|
|
60
|
+
queue.defer(chown.bind(null, fullPath, this, options));
|
|
61
|
+
queue.defer(utimes.bind(null, fullPath, this, options));
|
|
62
|
+
return queue.await(callback);
|
|
63
|
+
} catch (err) {
|
|
64
|
+
return callback(err);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return new Promise((resolve, reject)=>{
|
|
68
|
+
this.create(dest, options, (err, done)=>err ? reject(err) : resolve(done));
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
destroy() {}
|
|
72
|
+
constructor(attributes){
|
|
73
|
+
validateAttributes(attributes, MANDATORY_ATTRIBUTES);
|
|
74
|
+
objectAssign(this, attributes);
|
|
75
|
+
if (this.basename === undefined) this.basename = path.basename(this.path);
|
|
76
|
+
if (this.type === undefined) this.type = 'symlink';
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
export { SymbolicLinkEntry as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/SymbolicLinkEntry.ts"],"sourcesContent":["import path from 'path';\nimport fs from 'graceful-fs';\nimport isAbsolute from 'is-absolute';\nimport mkdirp from 'mkdirp-classic';\nimport objectAssign from 'object-assign';\nimport Queue from 'queue-cb';\nimport rimraf2 from 'rimraf2';\n\nimport chmod from './fs/chmod.js';\nimport chown from './fs/chown.js';\nimport lstatReal from './fs/lstatReal.js';\nimport utimes from './fs/utimes.js';\nimport stripPath from './stripPath.js';\nimport validateAttributes from './validateAttributes.js';\n\nfunction symlinkWin32(linkFullPath, linkpath, fullPath, callback) {\n lstatReal(linkFullPath, (err, targetStat) => {\n if (err || !targetStat) return callback(err || new Error(`Symlink path does not exist${linkFullPath}`));\n const type = targetStat.isDirectory() ? 'dir' : 'file';\n fs.symlink(linkpath, fullPath, type, callback);\n });\n}\nconst isWindows = process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE);\n\nconst MANDATORY_ATTRIBUTES = ['mode', 'mtime', 'path', 'linkpath'];\n\nexport default class SymbolicLinkEntry {\n path: string;\n basename: string;\n type: string;\n linkpath: string;\n\n constructor(attributes) {\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, options, callback) {\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));\n let normalizedLinkpath = path.normalize(this.linkpath);\n let linkFullPath = path.join(dest, stripPath(normalizedLinkpath, options));\n if (!isAbsolute(normalizedLinkpath)) {\n const linkRelativePath = path.join(path.dirname(normalizedPath), this.linkpath);\n linkFullPath = path.join(dest, stripPath(linkRelativePath, options));\n normalizedLinkpath = path.relative(path.dirname(fullPath), linkFullPath);\n }\n\n const queue = new Queue(1);\n if (options.force) {\n queue.defer((callback) => {\n rimraf2(fullPath, { disableGlob: true }, (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(utimes.bind(null, fullPath, this, options));\n return queue.await(callback);\n } catch (err) {\n return callback(err);\n }\n }\n\n return new Promise((resolve, reject) => {\n this.create(dest, options, (err, done) => (err ? reject(err) : resolve(done)));\n });\n }\n\n destroy() {}\n}\n"],"names":["path","fs","isAbsolute","mkdirp","objectAssign","Queue","rimraf2","chmod","chown","lstatReal","utimes","stripPath","validateAttributes","symlinkWin32","linkFullPath","linkpath","fullPath","callback","err","targetStat","Error","type","isDirectory","symlink","isWindows","process","platform","test","env","OSTYPE","MANDATORY_ATTRIBUTES","SymbolicLinkEntry","create","dest","options","normalizedPath","normalize","join","normalizedLinkpath","linkRelativePath","dirname","relative","queue","force","defer","disableGlob","code","bind","await","Promise","resolve","reject","done","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AAO,IAAI+B,QAAQ,CAACC,SAASC;YAC3B,IAAI,CAACnB,MAAM,CAACC,MAAMC,SAAS,CAAChB,KAAKkC,OAAUlC,MAAMiC,OAAOjC,OAAOgC,QAAQE;QACzE;IACF;IAEAC,UAAU,CAAC;IAnDXC,YAAYC,UAAU,CAAE;QACtB3C,mBAAmB2C,YAAYzB;QAC/B1B,aAAa,IAAI,EAAEmD;QACnB,IAAI,IAAI,CAACC,QAAQ,KAAKC,WAAW,IAAI,CAACD,QAAQ,GAAGxD,KAAKwD,QAAQ,CAAC,IAAI,CAACxD,IAAI;QACxE,IAAI,IAAI,CAACqB,IAAI,KAAKoC,WAAW,IAAI,CAACpC,IAAI,GAAG;IAC3C;AA+CF;AA1DA,SAAqBU,+BA0DpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function chmodFn(fullPath: any, entry: any, _options: any, callback: any): any;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// adapted from https://github.com/mafintosh/tar-fs
|
|
2
2
|
import fs from 'graceful-fs';
|
|
3
3
|
const UMASK = process.umask ? process.umask() : null;
|
|
4
|
-
const DMODE =
|
|
5
|
-
const FMODE =
|
|
6
|
-
const SMODE =
|
|
7
|
-
const LMODE =
|
|
4
|
+
const DMODE = 0o755;
|
|
5
|
+
const FMODE = 0o644;
|
|
6
|
+
const SMODE = 0o755;
|
|
7
|
+
const LMODE = 0o644;
|
|
8
8
|
export default function chmodFn(fullPath, entry, _options, callback) {
|
|
9
9
|
const chmod = entry.type === 'symlink' ? fs.lchmod : fs.chmod;
|
|
10
10
|
if (!chmod || UMASK === null) return callback();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/fs/chmod.ts"],"sourcesContent":["// adapted from https://github.com/mafintosh/tar-fs\n\nimport fs from 'graceful-fs';\n\nconst UMASK = process.umask ? process.umask() : null;\nconst DMODE = 0o755;\nconst FMODE = 0o644;\nconst SMODE = 0o755;\nconst LMODE = 0o644;\n\nexport default function chmodFn(fullPath, entry, _options, callback) {\n const chmod = entry.type === 'symlink' ? fs.lchmod : fs.chmod;\n if (!chmod || UMASK === null) return callback();\n\n let mode = entry.mode;\n if (!mode) {\n switch (entry.type) {\n case 'directory':\n mode = DMODE;\n break;\n case 'file':\n mode = FMODE;\n break;\n case 'symlink':\n mode = SMODE;\n break;\n case 'link':\n mode = LMODE;\n break;\n }\n }\n chmod(fullPath, mode & ~UMASK, callback);\n}\n"],"names":["fs","UMASK","process","umask","DMODE","FMODE","SMODE","LMODE","chmodFn","fullPath","entry","_options","callback","chmod","type","lchmod","mode"],"mappings":"AAAA,mDAAmD;AAEnD,OAAOA,QAAQ,cAAc;AAE7B,MAAMC,QAAQC,QAAQC,KAAK,GAAGD,QAAQC,KAAK,KAAK;AAChD,MAAMC,QAAQ;AACd,MAAMC,QAAQ;AACd,MAAMC,QAAQ;AACd,MAAMC,QAAQ;AAEd,eAAe,SAASC,QAAQC,QAAQ,EAAEC,KAAK,EAAEC,QAAQ,EAAEC,QAAQ;IACjE,MAAMC,QAAQH,MAAMI,IAAI,KAAK,YAAYd,GAAGe,MAAM,GAAGf,GAAGa,KAAK;IAC7D,IAAI,CAACA,SAASZ,UAAU,MAAM,OAAOW;IAErC,IAAII,OAAON,MAAMM,IAAI;IACrB,IAAI,CAACA,MAAM;QACT,OAAQN,MAAMI,IAAI;YAChB,KAAK;gBACHE,OAAOZ;gBACP;YACF,KAAK;gBACHY,OAAOX;gBACP;YACF,KAAK;gBACHW,OAAOV;gBACP;YACF,KAAK;gBACHU,OAAOT;gBACP;QACJ;IACF;IACAM,MAAMJ,UAAUO,OAAO,CAACf,OAAOW;AACjC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function chownFn(fullPath: any, entry: any, _options: any, callback: any): any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/fs/chown.ts"],"sourcesContent":["// adapted from https://github.com/mafintosh/tar-fs\n\nimport fs from 'graceful-fs';\n\nconst UID = process.getuid ? process.getuid() : -1;\nconst OWN = process.platform !== 'win32' && UID === 0;\n\nexport default function chownFn(fullPath, entry, _options, callback) {\n const chown = entry.type === 'symlink' ? fs.lchown : fs.chown;\n if (!chown || !OWN || !entry.uid || !entry.gid) return callback();\n chown(fullPath, entry.uid, entry.gid, callback);\n}\n"],"names":["fs","UID","process","getuid","OWN","platform","chownFn","fullPath","entry","_options","callback","chown","type","lchown","uid","gid"],"mappings":"AAAA,mDAAmD;AAEnD,OAAOA,QAAQ,cAAc;AAE7B,MAAMC,MAAMC,QAAQC,MAAM,GAAGD,QAAQC,MAAM,KAAK,CAAC;AACjD,MAAMC,MAAMF,QAAQG,QAAQ,KAAK,WAAWJ,QAAQ;AAEpD,eAAe,SAASK,QAAQC,QAAQ,EAAEC,KAAK,EAAEC,QAAQ,EAAEC,QAAQ;IACjE,MAAMC,QAAQH,MAAMI,IAAI,KAAK,YAAYZ,GAAGa,MAAM,GAAGb,GAAGW,KAAK;IAC7D,IAAI,CAACA,SAAS,CAACP,OAAO,CAACI,MAAMM,GAAG,IAAI,CAACN,MAAMO,GAAG,EAAE,OAAOL;IACvDC,MAAMJ,UAAUC,MAAMM,GAAG,EAAEN,MAAMO,GAAG,EAAEL;AACxC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function lstatReal(path: any, callback: any): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/fs/lstatReal.ts"],"sourcesContent":["import fs from 'graceful-fs';\n\nexport default function lstatReal(path, callback) {\n fs.realpath(path, function realpathCallback(err, realpath) {\n err ? callback(err) : fs.lstat(realpath, callback);\n });\n}\n"],"names":["fs","lstatReal","path","callback","realpath","realpathCallback","err","lstat"],"mappings":"AAAA,OAAOA,QAAQ,cAAc;AAE7B,eAAe,SAASC,UAAUC,IAAI,EAAEC,QAAQ;IAC9CH,GAAGI,QAAQ,CAACF,MAAM,SAASG,iBAAiBC,GAAG,EAAEF,QAAQ;QACvDE,MAAMH,SAASG,OAAON,GAAGO,KAAK,CAACH,UAAUD;IAC3C;AACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function utimes(fullPath: any, entry: any, options: any, callback: any): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/fs/utimes.ts"],"sourcesContent":["// adapted from https://github.com/mafintosh/tar-fs\n\nimport fs from 'graceful-fs';\n\nexport default function utimes(fullPath, entry, options, callback) {\n const now = options.now || new Date();\n fs.utimes(fullPath, now, new Date(entry.mtime), callback);\n}\n"],"names":["fs","utimes","fullPath","entry","options","callback","now","Date","mtime"],"mappings":"AAAA,mDAAmD;AAEnD,OAAOA,QAAQ,cAAc;AAE7B,eAAe,SAASC,OAAOC,QAAQ,EAAEC,KAAK,EAAEC,OAAO,EAAEC,QAAQ;IAC/D,MAAMC,MAAMF,QAAQE,GAAG,IAAI,IAAIC;IAC/BP,GAAGC,MAAM,CAACC,UAAUI,KAAK,IAAIC,KAAKJ,MAAMK,KAAK,GAAGH;AAClD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function waitForAccess(fullPath: any, callback: any): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/fs/waitForAccess.ts"],"sourcesContent":["import fs from 'fs';\n\nexport default function waitForAccess(fullPath, callback) {\n fs.stat(fullPath, (err) => {\n if (err) return waitForAccess(fullPath, callback);\n callback();\n });\n}\n"],"names":["fs","waitForAccess","fullPath","callback","stat","err"],"mappings":"AAAA,OAAOA,QAAQ,KAAK;AAEpB,eAAe,SAASC,cAAcC,QAAQ,EAAEC,QAAQ;IACtDH,GAAGI,IAAI,CAACF,UAAU,CAACG;QACjB,IAAIA,KAAK,OAAOJ,cAAcC,UAAUC;QACxCA;IACF;AACF"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import StackBaseIterator from 'stack-base-iterator';
|
|
2
|
+
export default StackBaseIterator;
|
|
3
|
+
export { default as DirectoryEntry } from './DirectoryEntry.js';
|
|
4
|
+
export { default as FileEntry } from './FileEntry.js';
|
|
5
|
+
export { default as LinkEntry } from './LinkEntry.js';
|
|
6
|
+
export { default as SymbolicLinkEntry } from './SymbolicLinkEntry.js';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import StackBaseIterator from 'stack-base-iterator';
|
|
2
|
+
export default StackBaseIterator;
|
|
3
|
+
export { default as DirectoryEntry } from './DirectoryEntry.js';
|
|
4
|
+
export { default as FileEntry } from './FileEntry.js';
|
|
5
|
+
export { default as LinkEntry } from './LinkEntry.js';
|
|
6
|
+
export { default as SymbolicLinkEntry } from './SymbolicLinkEntry.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/index.ts"],"sourcesContent":["import StackBaseIterator from 'stack-base-iterator';\n\nexport default StackBaseIterator;\nexport { default as DirectoryEntry } from './DirectoryEntry.js';\nexport { default as FileEntry } from './FileEntry.js';\nexport { default as LinkEntry } from './LinkEntry.js';\nexport { default as SymbolicLinkEntry } from './SymbolicLinkEntry.js';\n"],"names":["StackBaseIterator","default","DirectoryEntry","FileEntry","LinkEntry","SymbolicLinkEntry"],"mappings":"AAAA,OAAOA,uBAAuB,sBAAsB;AAEpD,eAAeA,kBAAkB;AACjC,SAASC,WAAWC,cAAc,QAAQ,sBAAsB;AAChE,SAASD,WAAWE,SAAS,QAAQ,iBAAiB;AACtD,SAASF,WAAWG,SAAS,QAAQ,iBAAiB;AACtD,SAASH,WAAWI,iBAAiB,QAAQ,yBAAyB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{ "type": "module" }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function stripPath(relativePath: any, options: any): any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/stripPath.ts"],"sourcesContent":["import path from 'path';\nimport compact from 'lodash.compact';\n\nexport default function stripPath(relativePath, options) {\n const strip = options.strip || 0;\n if (!strip) return relativePath;\n const parts = compact(relativePath.split(path.sep));\n if (parts.length < strip) throw new Error(`You cannot strip more levels than there are directories. Strip: ${strip}. Path: ${relativePath}`);\n return parts.slice(strip).join(path.sep);\n}\n"],"names":["path","compact","stripPath","relativePath","options","strip","parts","split","sep","length","Error","slice","join"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,OAAOC,aAAa,iBAAiB;AAErC,eAAe,SAASC,UAAUC,YAAY,EAAEC,OAAO;IACrD,MAAMC,QAAQD,QAAQC,KAAK,IAAI;IAC/B,IAAI,CAACA,OAAO,OAAOF;IACnB,MAAMG,QAAQL,QAAQE,aAAaI,KAAK,CAACP,KAAKQ,GAAG;IACjD,IAAIF,MAAMG,MAAM,GAAGJ,OAAO,MAAM,IAAIK,MAAM,CAAC,gEAAgE,EAAEL,MAAM,QAAQ,EAAEF,cAAc;IAC3I,OAAOG,MAAMK,KAAK,CAACN,OAAOO,IAAI,CAACZ,KAAKQ,GAAG;AACzC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/types.ts"],"sourcesContent":["export type Callback = (error?: Error) => void;\nexport type WriteFileFn = (path: string, options: object, callback: Callback) => void;\n"],"names":[],"mappings":"AACA,WAAsF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function validateAttributes(attributes: any, keys: any): void;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export default function validateAttributes(attributes, keys) {
|
|
2
|
-
let key;
|
|
3
2
|
for(let index = 0; index < keys.length; index++){
|
|
4
|
-
key = keys[index];
|
|
3
|
+
const key = keys[index];
|
|
5
4
|
if (attributes[key] === undefined) throw new Error(`Missing attribute ${key}.Attributes ${JSON.stringify(attributes)}`);
|
|
6
5
|
}
|
|
7
6
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/validateAttributes.ts"],"sourcesContent":["export default function validateAttributes(attributes, keys) {\n for (let index = 0; index < keys.length; index++) {\n const key = keys[index];\n if (attributes[key] === undefined) throw new Error(`Missing attribute ${key}.Attributes ${JSON.stringify(attributes)}`);\n }\n}\n"],"names":["validateAttributes","attributes","keys","index","length","key","undefined","Error","JSON","stringify"],"mappings":"AAAA,eAAe,SAASA,mBAAmBC,UAAU,EAAEC,IAAI;IACzD,IAAK,IAAIC,QAAQ,GAAGA,QAAQD,KAAKE,MAAM,EAAED,QAAS;QAChD,MAAME,MAAMH,IAAI,CAACC,MAAM;QACvB,IAAIF,UAAU,CAACI,IAAI,KAAKC,WAAW,MAAM,IAAIC,MAAM,CAAC,kBAAkB,EAAEF,IAAI,YAAY,EAAEG,KAAKC,SAAS,CAACR,aAAa;IACxH;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "extract-base-iterator",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "Base iterator for extract iterators like tar-iterator and zip-iterator",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"extract",
|
|
@@ -23,12 +23,12 @@
|
|
|
23
23
|
"type": "module",
|
|
24
24
|
"exports": {
|
|
25
25
|
".": {
|
|
26
|
-
"import": "./dist/esm/index.
|
|
27
|
-
"require": "./dist/cjs/index.
|
|
26
|
+
"import": "./dist/esm/index.js",
|
|
27
|
+
"require": "./dist/cjs/index.js"
|
|
28
28
|
},
|
|
29
29
|
"./package.json": "./package.json"
|
|
30
30
|
},
|
|
31
|
-
"main": "dist/cjs/index.
|
|
31
|
+
"main": "dist/cjs/index.js",
|
|
32
32
|
"types": "dist/cjs/index.d.cts",
|
|
33
33
|
"files": [
|
|
34
34
|
"dist"
|
|
@@ -46,9 +46,9 @@
|
|
|
46
46
|
"lodash.compact": "^3.0.1",
|
|
47
47
|
"mkdirp-classic": "^0.5.3",
|
|
48
48
|
"object-assign": "^4.1.1",
|
|
49
|
-
"queue-cb": "^1.
|
|
49
|
+
"queue-cb": "^1.5.0",
|
|
50
50
|
"rimraf2": "^2.8.2",
|
|
51
|
-
"stack-base-iterator": "^1.1
|
|
51
|
+
"stack-base-iterator": "^1.2.1"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@types/mocha": "*",
|
|
@@ -64,6 +64,6 @@
|
|
|
64
64
|
"node": ">=0.8"
|
|
65
65
|
},
|
|
66
66
|
"tsds": {
|
|
67
|
-
"source": "src/index.
|
|
67
|
+
"source": "src/index.ts"
|
|
68
68
|
}
|
|
69
69
|
}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "default", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return DirectoryEntry;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
var _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
12
|
-
var _mkdirpclassic = /*#__PURE__*/ _interop_require_default(require("mkdirp-classic"));
|
|
13
|
-
var _objectassign = /*#__PURE__*/ _interop_require_default(require("object-assign"));
|
|
14
|
-
var _queuecb = /*#__PURE__*/ _interop_require_default(require("queue-cb"));
|
|
15
|
-
var _chmod = /*#__PURE__*/ _interop_require_default(require("./fs/chmod.cjs"));
|
|
16
|
-
var _chown = /*#__PURE__*/ _interop_require_default(require("./fs/chown.cjs"));
|
|
17
|
-
var _utimes = /*#__PURE__*/ _interop_require_default(require("./fs/utimes.cjs"));
|
|
18
|
-
var _stripPath = /*#__PURE__*/ _interop_require_default(require("./stripPath.cjs"));
|
|
19
|
-
var _validateAttributes = /*#__PURE__*/ _interop_require_default(require("./validateAttributes.cjs"));
|
|
20
|
-
function _interop_require_default(obj) {
|
|
21
|
-
return obj && obj.__esModule ? obj : {
|
|
22
|
-
default: obj
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
var MANDATORY_ATTRIBUTES = [
|
|
26
|
-
'mode',
|
|
27
|
-
'mtime',
|
|
28
|
-
'path'
|
|
29
|
-
];
|
|
30
|
-
function DirectoryEntry(attributes) {
|
|
31
|
-
(0, _validateAttributes.default)(attributes, MANDATORY_ATTRIBUTES);
|
|
32
|
-
(0, _objectassign.default)(this, attributes);
|
|
33
|
-
if (this.type === undefined) this.type = 'directory';
|
|
34
|
-
if (this.basename === undefined) this.basename = _path.default.basename(this.path);
|
|
35
|
-
}
|
|
36
|
-
DirectoryEntry.prototype.create = function create(dest, options, callback) {
|
|
37
|
-
if (typeof options === 'function') {
|
|
38
|
-
callback = options;
|
|
39
|
-
options = null;
|
|
40
|
-
}
|
|
41
|
-
var self = this;
|
|
42
|
-
if (typeof callback === 'function') {
|
|
43
|
-
options = options || {};
|
|
44
|
-
try {
|
|
45
|
-
var normalizedPath = _path.default.normalize(self.path);
|
|
46
|
-
var fullPath = _path.default.join(dest, (0, _stripPath.default)(normalizedPath, options));
|
|
47
|
-
// do not check for the existence of the directory but allow out-of-order calling
|
|
48
|
-
var queue = new _queuecb.default(1);
|
|
49
|
-
queue.defer(_mkdirpclassic.default.bind(null, fullPath));
|
|
50
|
-
queue.defer(_chmod.default.bind(null, fullPath, self, options));
|
|
51
|
-
queue.defer(_chown.default.bind(null, fullPath, self, options));
|
|
52
|
-
queue.defer(_utimes.default.bind(null, fullPath, self, options));
|
|
53
|
-
return queue.await(callback);
|
|
54
|
-
} catch (err) {
|
|
55
|
-
return callback(err);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
return new Promise(function createPromise(resolve, reject) {
|
|
59
|
-
self.create(dest, options, function(err, done) {
|
|
60
|
-
return err ? reject(err) : resolve(done);
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
};
|
|
64
|
-
DirectoryEntry.prototype.destroy = function destroy() {};
|
|
65
|
-
/* 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; }
|