extract-base-iterator 1.3.0 → 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.
@@ -1 +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 function SymbolicLinkEntry(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\nSymbolicLinkEntry.prototype.create = function create(dest, options, callback) {\n if (typeof options === 'function') {\n callback = options;\n options = null;\n }\n\n const self = this;\n if (typeof callback === 'function') {\n options = options || {};\n try {\n const normalizedPath = path.normalize(self.path);\n const fullPath = path.join(dest, stripPath(normalizedPath, options));\n let normalizedLinkpath = path.normalize(self.linkpath);\n let linkFullPath = path.join(dest, stripPath(normalizedLinkpath, options));\n if (!isAbsolute(normalizedLinkpath)) {\n const linkRelativePath = path.join(path.dirname(normalizedPath), self.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, self, options));\n queue.defer(chown.bind(null, fullPath, self, options));\n queue.defer(utimes.bind(null, fullPath, self, options));\n return queue.await(callback);\n } catch (err) {\n return callback(err);\n }\n }\n\n return new Promise(function createPromise(resolve, reject) {\n self.create(dest, options, (err, done) => (err ? reject(err) : resolve(done)));\n });\n};\n\nSymbolicLinkEntry.prototype.destroy = function destroy() {};\n"],"names":["SymbolicLinkEntry","symlinkWin32","linkFullPath","linkpath","fullPath","callback","lstatReal","err","targetStat","Error","type","isDirectory","fs","symlink","isWindows","process","platform","test","env","OSTYPE","MANDATORY_ATTRIBUTES","attributes","validateAttributes","objectAssign","basename","undefined","path","prototype","create","dest","options","self","normalizedPath","normalize","join","stripPath","normalizedLinkpath","isAbsolute","linkRelativePath","dirname","relative","queue","Queue","force","defer","rimraf2","disableGlob","code","mkdirp","bind","chmod","chown","utimes","await","Promise","createPromise","resolve","reject","done","destroy"],"mappings":";;;;+BA0BA;;;eAAwBA;;;2DA1BP;iEACF;iEACQ;oEACJ;mEACM;8DACP;8DACE;4DAEF;4DACA;gEACI;6DACH;gEACG;yEACS;;;;;;AAE/B,SAASC,aAAaC,YAAY,EAAEC,QAAQ,EAAEC,QAAQ,EAAEC,QAAQ;IAC9DC,IAAAA,kBAAS,EAACJ,cAAc,SAACK,KAAKC;QAC5B,IAAID,OAAO,CAACC,YAAY,O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OiD,QAAQE;;IACzE;AACF;AAEA1D,kBAAkB2B,SAAS,CAACgC,OAAO,GAAG,SAASA,WAAW"}
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":["SymbolicLinkEntry","symlinkWin32","linkFullPath","linkpath","fullPath","callback","lstatReal","err","targetStat","Error","type","isDirectory","fs","symlink","isWindows","process","platform","test","env","OSTYPE","MANDATORY_ATTRIBUTES","attributes","validateAttributes","objectAssign","basename","undefined","path","create","dest","options","normalizedPath","normalize","join","stripPath","normalizedLinkpath","isAbsolute","linkRelativePath","dirname","relative","queue","Queue","force","defer","rimraf2","disableGlob","code","mkdirp","bind","chmod","chown","utimes","await","Promise","resolve","reject","done","destroy"],"mappings":";;;;;;;eA0BqBA;;;2DA1BJ;iEACF;iEACQ;oEACJ;mEACM;8DACP;8DACE;4DAEF;4DACA;gEACI;6DACH;gEACG;yEACS;;;;;;;;;;;AAE/B,SAASC,aAAaC,YAAY,EAAEC,QAAQ,EAAEC,QAAQ,EAAEC,QAAQ;IAC9DC,IAAAA,kBAAS,EAACJ,cAAc,SAACK,KAAKC;QAC5B,IAAID,OAAO,CAACC,YAAY,OAAOH,SAASE,OAAO,IAAIE,MAAM,AAAC,8BAA0C,OAAbP;QACvF,IAAMQ,O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AA,OAAY,GAAZA,SAAAA,WAAW;WAzDQxD"}
@@ -0,0 +1,2 @@
1
+ export type Callback = (error?: Error) => void;
2
+ export type WriteFileFn = (path: string, options: object, callback: Callback) => void;
@@ -0,0 +1,2 @@
1
+ export type Callback = (error?: Error) => void;
2
+ export type WriteFileFn = (path: string, options: object, callback: Callback) => void;
@@ -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":""}
@@ -1 +1,8 @@
1
- export default function DirectoryEntry(attributes: any): void;
1
+ export default class DirectoryEntry {
2
+ path: string;
3
+ basename: string;
4
+ type: string;
5
+ constructor(attributes: any);
6
+ create(dest: any, options: any, callback: any): any;
7
+ destroy(): void;
8
+ }
@@ -12,36 +12,38 @@ const MANDATORY_ATTRIBUTES = [
12
12
  'mtime',
13
13
  'path'
14
14
  ];
15
- export default function DirectoryEntry(attributes) {
16
- validateAttributes(attributes, MANDATORY_ATTRIBUTES);
17
- objectAssign(this, attributes);
18
- if (this.type === undefined) this.type = 'directory';
19
- if (this.basename === undefined) this.basename = path.basename(this.path);
20
- }
21
- DirectoryEntry.prototype.create = function create(dest, options, callback) {
22
- if (typeof options === 'function') {
23
- callback = options;
24
- options = null;
25
- }
26
- const self = this;
27
- if (typeof callback === 'function') {
28
- options = options || {};
29
- try {
30
- const normalizedPath = path.normalize(self.path);
31
- const fullPath = path.join(dest, stripPath(normalizedPath, options));
32
- // do not check for the existence of the directory but allow out-of-order calling
33
- const queue = new Queue(1);
34
- queue.defer(mkdirp.bind(null, fullPath));
35
- queue.defer(chmod.bind(null, fullPath, self, options));
36
- queue.defer(chown.bind(null, fullPath, self, options));
37
- queue.defer(utimes.bind(null, fullPath, self, options));
38
- return queue.await(callback);
39
- } catch (err) {
40
- return callback(err);
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
+ }
41
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);
42
47
  }
43
- return new Promise(function createPromise(resolve, reject) {
44
- self.create(dest, options, (err, done)=>err ? reject(err) : resolve(done));
45
- });
46
48
  };
47
- DirectoryEntry.prototype.destroy = function destroy() {};
49
+ export { DirectoryEntry as default };
@@ -1 +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 function DirectoryEntry(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\nDirectoryEntry.prototype.create = function create(dest, options, callback) {\n if (typeof options === 'function') {\n callback = options;\n options = null;\n }\n\n const self = this;\n if (typeof callback === 'function') {\n options = options || {};\n try {\n const normalizedPath = path.normalize(self.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, self, options));\n queue.defer(chown.bind(null, fullPath, self, options));\n queue.defer(utimes.bind(null, fullPath, self, options));\n return queue.await(callback);\n } catch (err) {\n return callback(err);\n }\n }\n\n return new Promise(function createPromise(resolve, reject) {\n self.create(dest, options, (err, done) => (err ? reject(err) : resolve(done)));\n });\n};\n\nDirectoryEntry.prototype.destroy = function destroy() {};\n"],"names":["path","mkdirp","objectAssign","Queue","chmod","chown","utimes","stripPath","validateAttributes","MANDATORY_ATTRIBUTES","DirectoryEntry","attributes","type","undefined","basename","prototype","create","dest","options","callback","self","normalizedPath","normalize","fullPath","join","queue","defer","bind","await","err","Promise","createPromise","resolve","reject","done","destroy"],"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;AAEtD,eAAe,SAASC,eAAeC,UAAU;IAC/CH,mBAAmBG,YAAYF;IAC/BP,aAAa,IAAI,EAAES;IACnB,IAAI,IAAI,CAACC,I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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,i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,IAAI,CAACE,QAAQ,KAAKD,WAAW,IAAI,CAACC,QAAQ,GAAGjC,KAAKiC,QAAQ,CAAC,IAAI,CAACjC,IAAI;IAC1E;AAgCF;AA1CA,SAAqBU,4BA0CpB"}
@@ -1 +1,8 @@
1
- export default function FileEntry(attributes: any): void;
1
+ export default class FileEntry {
2
+ path: string;
3
+ basename: string;
4
+ type: string;
5
+ constructor(attributes: any);
6
+ create(dest: any, options: any, callback: any): any;
7
+ destroy(): void;
8
+ }
@@ -13,46 +13,48 @@ const MANDATORY_ATTRIBUTES = [
13
13
  'mtime',
14
14
  'path'
15
15
  ];
16
- export default function FileEntry(attributes) {
17
- validateAttributes(attributes, MANDATORY_ATTRIBUTES);
18
- objectAssign(this, attributes);
19
- if (this.basename === undefined) this.basename = path.basename(this.path);
20
- if (this.type === undefined) this.type = 'file';
21
- if (this._writeFile === undefined) throw new Error('File self missing _writeFile. Please implement this method in your subclass');
22
- }
23
- FileEntry.prototype.create = function create(dest, options, callback) {
24
- if (typeof options === 'function') {
25
- callback = options;
26
- options = null;
27
- }
28
- const self = this;
29
- if (typeof callback === 'function') {
30
- options = options || {};
31
- try {
32
- const normalizedPath = path.normalize(self.path);
33
- const fullPath = path.join(dest, stripPath(normalizedPath, options));
34
- const queue = new Queue(1);
35
- if (options.force) {
36
- queue.defer((callback)=>{
37
- rimraf2(fullPath, {
38
- disableGlob: true
39
- }, (err)=>{
40
- err && err.code !== 'ENOENT' ? callback(err) : callback();
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
+ });
41
35
  });
42
- });
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);
43
45
  }
44
- queue.defer(mkdirp.bind(null, path.dirname(fullPath)));
45
- queue.defer(this._writeFile.bind(this, fullPath, options));
46
- queue.defer(chmod.bind(null, fullPath, self, options));
47
- queue.defer(chown.bind(null, fullPath, self, options));
48
- queue.defer(utimes.bind(null, fullPath, self, options));
49
- return queue.await(callback);
50
- } catch (err) {
51
- return callback(err);
52
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');
53
58
  }
54
- return new Promise(function createPromise(resolve, reject) {
55
- self.create(dest, options, (err, done)=>err ? reject(err) : resolve(done));
56
- });
57
59
  };
58
- FileEntry.prototype.destroy = function destroy() {};
60
+ export { FileEntry as default };
@@ -1 +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\nexport default function FileEntry(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._writeFile === undefined) throw new Error('File self missing _writeFile. Please implement this method in your subclass');\n}\n\nFileEntry.prototype.create = function create(dest, options, callback) {\n if (typeof options === 'function') {\n callback = options;\n options = null;\n }\n\n const self = this;\n if (typeof callback === 'function') {\n options = options || {};\n try {\n const normalizedPath = path.normalize(self.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._writeFile.bind(this, fullPath, options));\n queue.defer(chmod.bind(null, fullPath, self, options));\n queue.defer(chown.bind(null, fullPath, self, options));\n queue.defer(utimes.bind(null, fullPath, self, options));\n return queue.await(callback);\n } catch (err) {\n return callback(err);\n }\n }\n\n return new Promise(function createPromise(resolve, reject) {\n self.create(dest, options, (err, done) => (err ? reject(err) : resolve(done)));\n });\n};\n\nFileEntry.prototype.destroy = function destroy() {};\n"],"names":["path","mkdirp","objectAssign","Queue","rimraf2","chmod","chown","utimes","stripPath","validateAttributes","MANDATORY_ATTRIBUTES","FileEntry","attributes","basename","undefined","type","_writeFile","Error","prototype","create","dest","options","callback","self","normalizedPath","normalize","fullPath","join","queue","force","defer","disableGlob","err","code","bind","dirname","await","Promise","createPromise","resolve","reject","done","destroy"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,OAAOC,YAAY,iBAAiB;AACpC,OAAOC,kBAAkB,gBAAgB;AACzC,OAAOC,WAAW,WAAW;AAE7B,OAAOC,aAAa,UAAU;AAC9B,OAAOC,WAAW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B,IAAI,CAAC,IAAI,EAAER,UAAUL;YACjDO,MAAME,KAAK,CAACzB,MAAM6B,IAAI,CAAC,MAAMR,UAAUH,MAAMF;YAC7CO,MAAME,KAAK,CAACxB,MAAM4B,IAAI,CAAC,MAAMR,UAAUH,MAAMF;YAC7CO,MAAME,KAAK,CAACvB,OAAO2B,IAAI,CAAC,MAAMR,UAAUH,MAAMF;YAC9C,OAAOO,MAAMQ,KAAK,CAACd;QACrB,EAAE,OAAOU,KAAK;YACZ,OAAOV,SAASU;QAClB;IACF;IAEA,OAAO,IAAIK,QAAQ,SAASC,cAAcC,OAAO,EAAEC,MAAM;QACvDjB,KAAKJ,MAAM,CAACC,MAAMC,SAAS,CAACW,KAAKS,OAAUT,MAAMQ,OAAOR,OAAOO,QAAQE;IACzE;AACF;AAEA9B,UAAUO,SAAS,CAACwB,OAAO,GAAG,SAASA,WAAW"}
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;QAC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QAAQ,GAAGrC,KAAKqC,QAAQ,CAAC,IAAI,CAACrC,IAAI;QACxE,IAAI,IAAI,CAACuC,IAAI,KAAKD,WAAW,IAAI,CAACC,IAAI,GAAG;QACzC,IAAI,AAAC,IAAI,CAAkCX,UAAU,KAAKU,WAAW,MAAM,IAAIE,MAAM;IACvF;AAuCF;AAlDA,SAAqB7B,uBAkDpB"}
@@ -1 +1,9 @@
1
- export default function LinkEntry(attributes: any, _type: any): void;
1
+ export default class LinkEntry {
2
+ path: string;
3
+ basename: string;
4
+ type: string;
5
+ linkpath: string;
6
+ constructor(attributes: any, _type: any);
7
+ create(dest: any, options: any, callback: any): any;
8
+ destroy(): void;
9
+ }
@@ -15,47 +15,49 @@ const MANDATORY_ATTRIBUTES = [
15
15
  'path',
16
16
  'linkpath'
17
17
  ];
18
- export default function LinkEntry(attributes, _type) {
19
- validateAttributes(attributes, MANDATORY_ATTRIBUTES);
20
- objectAssign(this, attributes);
21
- if (this.basename === undefined) this.basename = path.basename(this.path);
22
- if (this.type === undefined) this.type = 'link';
23
- }
24
- LinkEntry.prototype.create = function create(dest, options, callback) {
25
- if (typeof options === 'function') {
26
- callback = options;
27
- options = null;
28
- }
29
- const self = this;
30
- if (typeof callback === 'function') {
31
- options = options || {};
32
- try {
33
- const normalizedPath = path.normalize(self.path);
34
- const fullPath = path.join(dest, stripPath(normalizedPath, options));
35
- const normalizedLinkpath = path.normalize(self.linkpath);
36
- const linkFullPath = path.join(dest, stripPath(normalizedLinkpath, options));
37
- const queue = new Queue(1);
38
- if (options.force) {
39
- queue.defer((callback)=>{
40
- rimraf2(fullPath, {
41
- disableGlob: true
42
- }, (err)=>{
43
- err && err.code !== 'ENOENT' ? callback(err) : callback();
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
+ });
44
39
  });
45
- });
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);
46
49
  }
47
- queue.defer(mkdirp.bind(null, path.dirname(fullPath)));
48
- queue.defer(fs.link.bind(fs, linkFullPath, fullPath));
49
- queue.defer(chmod.bind(null, fullPath, self, options));
50
- queue.defer(chown.bind(null, fullPath, self, options));
51
- queue.defer(utimes.bind(null, fullPath, self, options));
52
- return queue.await(callback);
53
- } catch (err) {
54
- return callback(err);
55
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';
56
61
  }
57
- return new Promise(function createPromise(resolve, reject) {
58
- self.create(dest, options, (err, done)=>err ? reject(err) : resolve(done));
59
- });
60
62
  };
61
- LinkEntry.prototype.destroy = function destroy() {};
63
+ export { LinkEntry as default };
@@ -1 +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 function LinkEntry(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\nLinkEntry.prototype.create = function create(dest, options, callback) {\n if (typeof options === 'function') {\n callback = options;\n options = null;\n }\n\n const self = this;\n if (typeof callback === 'function') {\n options = options || {};\n try {\n const normalizedPath = path.normalize(self.path);\n const fullPath = path.join(dest, stripPath(normalizedPath, options));\n const normalizedLinkpath = path.normalize(self.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, self, options));\n queue.defer(chown.bind(null, fullPath, self, options));\n queue.defer(utimes.bind(null, fullPath, self, options));\n return queue.await(callback);\n } catch (err) {\n return callback(err);\n }\n }\n\n return new Promise(function createPromise(resolve, reject) {\n self.create(dest, options, (err, done) => (err ? reject(err) : resolve(done)));\n });\n};\n\nLinkEntry.prototype.destroy = function destroy() {};\n"],"names":["path","fs","mkdirp","objectAssign","Queue","rimraf2","chmod","chown","utimes","stripPath","validateAttributes","MANDATORY_ATTRIBUTES","LinkEntry","attributes","_type","basename","undefined","type","prototype","create","dest","options","callback","self","normalizedPath","normalize","fullPath","join","normalizedLinkpath","linkpath","linkFullPath","queue","force","defer","disableGlob","err","code","bind","dirname","link","await","Promise","createPromise","resolve","reject","done","destroy"],"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;AAElE,eAAe,SAASC,UAAUC,UAAU,EAAEC,KAAK;IACjDJ,mBAAmBG,YAAYF;IAC/BR,aAAa,IAAI,EAAEU;IACnB,IAAI,IAAI,CAACE,QAAQ,KAAKC,WAAW,IAAI,CAACD,QAAQ,GAAGf,KAAKe,QAAQ,CAAC,IAAI,CAACf,IAAI;IACxE,IAAI,IAAI,CAACiB,IAAI,KAAKD,WAAW,IAAI,CAACC,IAAI,GAAG;AAC3C;AAEAL,UAAUM,SAAS,CAACC,MAAM,GAAG,SAASA,OAAOC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IAClE,IAAI,OAAOD,YAAY,YAAY;QACjCC,WAAWD;QACXA,UAAU;IACZ;IAEA,MAAME,OAAO,IAAI;IACjB,IAAI,OAAOD,aAAa,YAAY;QAClCD,UAAUA,WAAW,CAAC;QACtB,IAAI;YACF,MAAMG,iBAAiBxB,KAAKyB,SAAS,CAACF,KAAKvB,IAAI;YAC/C,MAAM0B,WAAW1B,KAAK2B,IAAI,CAACP,MAAMX,UAAUe,gBAAgBH;YAC3D,MAAMO,qBAAqB5B,KAAKyB,SAAS,CAACF,KAAKM,QAAQ;YACvD,MAAMC,eAAe9B,KAAK2B,IAAI,CAACP,MAAMX,UAAUmB,oBAAoBP;YAEnE,MAAMU,QAAQ,IAAI3B,MAAM;YACxB,IAAIiB,QAAQW,KAAK,EAAE;gBACjBD,MAAME,KAAK,CAAC,CAACX;oBACXjB,QAAQqB,UAAU;wBAAEQ,aAAa;oBAAK,GAAG,CAACC;wBACxCA,OAAOA,IAAIC,IAAI,KAAK,WAAWd,SAASa,OAAOb;oBACjD;gBACF;YACF;YACAS,MAAME,KAAK,CAAC/B,OAAOmC,IAAI,CAAC,MAAMrC,KAAKsC,OAAO,CAACZ;YAC3CK,MAAME,KAAK,CAAChC,GAAGsC,IAAI,CAACF,IAAI,CAACpC,IAAI6B,cAAcJ;YAC3CK,MAAME,KAAK,CAAC3B,MAAM+B,IAAI,CAAC,MAAMX,UAAUH,MAAMF;YAC7CU,MAAME,KAAK,CAAC1B,MAAM8B,IAAI,CAAC,MAAMX,UAAUH,MAAMF;YAC7CU,MAAME,KAAK,CAACzB,OAAO6B,IAAI,CAAC,MAAMX,UAAUH,MAAMF;YAC9C,OAAOU,MAAMS,KAAK,CAAClB;QACrB,EAAE,OAAOa,KAAK;YACZ,OAAOb,SAASa;QAClB;IACF;IAEA,OAAO,IAAIM,QAAQ,SAASC,cAAcC,OAAO,EAAEC,MAAM;QACvDrB,KAAKJ,MAAM,CAACC,MAAMC,SAAS,CAACc,KAAKU,OAAUV,MAAMS,OAAOT,OAAOQ,QAAQE;IACzE;AACF;AAEAjC,UAAUM,SAAS,CAAC4B,OAAO,GAAG,SAASA,WAAW"}
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,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AC7CS,MAAME,KAAK,CAACnB,MAAMuB,IAAI,CAAC,MAAMX,UAAU,IAAI,EAAEJ;gBAC7CS,MAAME,KAAK,CAAClB,OAAOsB,IAAI,CAAC,MAAMX,UAAU,IAAI,EAAEJ;gBAC9C,OAAOS,MAAMS,KAAK,CAACjB;YACrB,EAAE,OAAOY,KAAK;gBACZ,OAAOZ,SAASY;YAClB;QACF;QAEA,OAAO,IAAIM,QAAQ,CAACC,SAASC;YAC3B,IAAI,CAACvB,MAAM,CAACC,MAAMC,SAAS,CAACa,KAAKS,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"}
@@ -1 +1,9 @@
1
- export default function SymbolicLinkEntry(attributes: any): void;
1
+ export default class SymbolicLinkEntry {
2
+ path: string;
3
+ basename: string;
4
+ type: string;
5
+ linkpath: string;
6
+ constructor(attributes: any);
7
+ create(dest: any, options: any, callback: any): any;
8
+ destroy(): void;
9
+ }
@@ -25,53 +25,55 @@ const MANDATORY_ATTRIBUTES = [
25
25
  'path',
26
26
  'linkpath'
27
27
  ];
28
- export default function SymbolicLinkEntry(attributes) {
29
- validateAttributes(attributes, MANDATORY_ATTRIBUTES);
30
- objectAssign(this, attributes);
31
- if (this.basename === undefined) this.basename = path.basename(this.path);
32
- if (this.type === undefined) this.type = 'symlink';
33
- }
34
- SymbolicLinkEntry.prototype.create = function create(dest, options, callback) {
35
- if (typeof options === 'function') {
36
- callback = options;
37
- options = null;
38
- }
39
- const self = this;
40
- if (typeof callback === 'function') {
41
- options = options || {};
42
- try {
43
- const normalizedPath = path.normalize(self.path);
44
- const fullPath = path.join(dest, stripPath(normalizedPath, options));
45
- let normalizedLinkpath = path.normalize(self.linkpath);
46
- let linkFullPath = path.join(dest, stripPath(normalizedLinkpath, options));
47
- if (!isAbsolute(normalizedLinkpath)) {
48
- const linkRelativePath = path.join(path.dirname(normalizedPath), self.linkpath);
49
- linkFullPath = path.join(dest, stripPath(linkRelativePath, options));
50
- normalizedLinkpath = path.relative(path.dirname(fullPath), linkFullPath);
51
- }
52
- const queue = new Queue(1);
53
- if (options.force) {
54
- queue.defer((callback)=>{
55
- rimraf2(fullPath, {
56
- disableGlob: true
57
- }, (err)=>{
58
- err && err.code !== 'ENOENT' ? callback(err) : callback();
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
+ });
59
54
  });
60
- });
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);
61
65
  }
62
- queue.defer(mkdirp.bind(null, path.dirname(fullPath)));
63
- if (isWindows) queue.defer(symlinkWin32.bind(null, linkFullPath, normalizedLinkpath, fullPath));
64
- else queue.defer(fs.symlink.bind(fs, normalizedLinkpath, fullPath));
65
- queue.defer(chmod.bind(null, fullPath, self, options));
66
- queue.defer(chown.bind(null, fullPath, self, options));
67
- queue.defer(utimes.bind(null, fullPath, self, options));
68
- return queue.await(callback);
69
- } catch (err) {
70
- return callback(err);
71
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';
72
77
  }
73
- return new Promise(function createPromise(resolve, reject) {
74
- self.create(dest, options, (err, done)=>err ? reject(err) : resolve(done));
75
- });
76
78
  };
77
- SymbolicLinkEntry.prototype.destroy = function destroy() {};
79
+ export { SymbolicLinkEntry as default };
@@ -1 +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 function SymbolicLinkEntry(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\nSymbolicLinkEntry.prototype.create = function create(dest, options, callback) {\n if (typeof options === 'function') {\n callback = options;\n options = null;\n }\n\n const self = this;\n if (typeof callback === 'function') {\n options = options || {};\n try {\n const normalizedPath = path.normalize(self.path);\n const fullPath = path.join(dest, stripPath(normalizedPath, options));\n let normalizedLinkpath = path.normalize(self.linkpath);\n let linkFullPath = path.join(dest, stripPath(normalizedLinkpath, options));\n if (!isAbsolute(normalizedLinkpath)) {\n const linkRelativePath = path.join(path.dirname(normalizedPath), self.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, self, options));\n queue.defer(chown.bind(null, fullPath, self, options));\n queue.defer(utimes.bind(null, fullPath, self, options));\n return queue.await(callback);\n } catch (err) {\n return callback(err);\n }\n }\n\n return new Promise(function createPromise(resolve, reject) {\n self.create(dest, options, (err, done) => (err ? reject(err) : resolve(done)));\n });\n};\n\nSymbolicLinkEntry.prototype.destroy = function destroy() {};\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","attributes","basename","undefined","prototype","create","dest","options","self","normalizedPath","normalize","join","normalizedLinkpath","linkRelativePath","dirname","relative","queue","force","defer","disableGlob","code","bind","await","Promise","createPromise","resolve","reject","done","destroy"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,OAAOC,QAAQ,cAAc;AAC7B,OAAOC,gBAAgB,cAAc;AACrC,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,eAAe,oBAAoB;AAC1C,OAAOC,YAAY,iBAAiB;AACpC,OAAOC,eAAe,iBAAiB;AACvC,OAAOC,wBAAwB,0BAA0B;AAEzD,SAASC,aAAaC,YAAY,EAAEC,QAAQ,EAAEC,QAAQ,EAAEC,QAAQ;IAC9DR,UAAUK,cAAc,CAACI,KAAKC;QAC5B,IAAID,OAAO,CAACC,YAAY,OAAOF,SAASC,OAAO,IAAIE,MAAM,CAAC,2BAA2B,EAAEN,cAAc;QACrG,MAAMO,OAAOF,WAAWG,WAAW,KAAK,QAAQ;QAChDrB,GAAGsB,OAAO,CAACR,UAAUC,UAAUK,MAAMJ;IACvC;AACF;AACA,MAAMO,YAAYC,QAAQC,QAA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AQU,KAAK,EAAE;gBACjBD,MAAME,KAAK,CAAC,CAAChC;oBACXX,QAAQU,UAAU;wBAAEkC,aAAa;oBAAK,GAAG,CAAChC;wBACxCA,OAAOA,IAAIiC,IAAI,KAAK,WAAWlC,SAASC,OAAOD;oBACjD;gBACF;YACF;YACA8B,MAAME,KAAK,CAAC9C,OAAOiD,IAAI,CAAC,MAAMpD,KAAK6C,OAAO,CAAC7B;YAC3C,IAAIQ,WAAWuB,MAAME,KAAK,CAACpC,aAAauC,IAAI,CAAC,MAAMtC,cAAc6B,oBAAoB3B;iBAChF+B,MAAME,KAAK,CAAChD,GAAGsB,OAAO,CAAC6B,IAAI,CAACnD,IAAI0C,oBAAoB3B;YACzD+B,MAAME,KAAK,CAAC1C,MAAM6C,IAAI,CAAC,MAAMpC,UAAUuB,MAAMD;YAC7CS,MAAME,KAAK,CAACzC,MAAM4C,IAAI,CAAC,MAAMpC,UAAUuB,MAAMD;YAC7CS,MAAME,KAAK,CAACvC,OAAO0C,IAAI,CAAC,MAAMpC,UAAUuB,MAAMD;YAC9C,OAAOS,MAAMM,KAAK,CAACpC;QACrB,EAAE,OAAOC,KAAK;YACZ,OAAOD,SAASC;QAClB;IACF;IAEA,OAAO,IAAIoC,QAAQ,SAASC,cAAcC,OAAO,EAAEC,MAAM;QACvDlB,KAAKH,MAAM,CAACC,MAAMC,SAAS,CAACpB,KAAKwC,OAAUxC,MAAMuC,OAAOvC,OAAOsC,QAAQE;IACzE;AACF;AAEA3B,kBAAkBI,SAAS,CAACwB,OAAO,GAAG,SAASA,WAAW"}
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","destroy","constructor","attributes","basename","undefined"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,OAAOC,QAAQ,cAAc;AAC7B,OAAOC,gBAAgB,cAAc;AACrC,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,eAAe,oBAAoB;AAC1C,OAAOC,YAAY,iBAAiB;AACpC,OAAOC,eAAe,iBAAiB;AACvC,OAAOC,wBAAwB,0BAA0B;AAEzD,SAASC,aAAaC,YAAY,EAAEC,QAAQ,EAAEC,QAAQ,EAAEC,QAAQ;IAC9DR,UAAUK,cAAc,CAACI,KAAKC;QAC5B,IAAID,OAAO,CAACC,YAAY,OAAOF,SAASC,OAAO,IAAIE,MAAM,CAAC,2BAA2B,EAAEN,cAAc;QACrG,MAAMO,OAAOF,WAAWG,WAAW,KAAK,QAAQ;QAChDrB,GAAGsB,OAAO,CAACR,UAAUC,UAAUK,MAAMJ;IACvC;AACF;AACA,MAAM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CAACxB;gBAC3C,IAAIQ,WAAWkB,MAAME,KAAK,CAAC/B,aAAakC,IAAI,CAAC,MAAMjC,cAAcwB,oBAAoBtB;qBAChF0B,MAAME,KAAK,CAAC3C,GAAGsB,OAAO,CAACwB,IAAI,CAAC9C,IAAIqC,oBAAoBtB;gBACzD0B,MAAME,KAAK,CAACrC,MAAMwC,IAAI,CAAC,MAAM/B,UAAU,IAAI,EAAEkB;gBAC7CQ,MAAME,KAAK,CAACpC,MAAMuC,IAAI,CAAC,MAAM/B,UAAU,IAAI,EAAEkB;gBAC7CQ,MAAME,KAAK,CAAClC,OAAOqC,IAAI,CAAC,MAAM/B,UAAU,IAAI,EAAEkB;gBAC9C,OAAOQ,MAAMM,KAAK,CAAC/B;YACrB,EAAE,OAAOC,KAAK;gBACZ,OAAOD,SAASC;YAClB;QACF;QAEA,OAAO,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,2 @@
1
+ export type Callback = (error?: Error) => void;
2
+ export type WriteFileFn = (path: string, options: object, callback: Callback) => void;