extract-base-iterator 1.3.0 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/DirectoryEntry.d.cts +8 -1
- package/dist/cjs/DirectoryEntry.d.ts +8 -1
- package/dist/cjs/DirectoryEntry.js +43 -32
- package/dist/cjs/DirectoryEntry.js.map +1 -1
- package/dist/cjs/FileEntry.d.cts +8 -1
- package/dist/cjs/FileEntry.d.ts +8 -1
- package/dist/cjs/FileEntry.js +51 -40
- package/dist/cjs/FileEntry.js.map +1 -1
- package/dist/cjs/LinkEntry.d.cts +9 -1
- package/dist/cjs/LinkEntry.d.ts +9 -1
- package/dist/cjs/LinkEntry.js +52 -41
- package/dist/cjs/LinkEntry.js.map +1 -1
- package/dist/cjs/SymbolicLinkEntry.d.cts +9 -1
- package/dist/cjs/SymbolicLinkEntry.d.ts +9 -1
- package/dist/cjs/SymbolicLinkEntry.js +58 -47
- package/dist/cjs/SymbolicLinkEntry.js.map +1 -1
- 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/esm/DirectoryEntry.d.ts +8 -1
- package/dist/esm/DirectoryEntry.js +32 -30
- package/dist/esm/DirectoryEntry.js.map +1 -1
- package/dist/esm/FileEntry.d.ts +8 -1
- package/dist/esm/FileEntry.js +40 -38
- package/dist/esm/FileEntry.js.map +1 -1
- package/dist/esm/LinkEntry.d.ts +9 -1
- package/dist/esm/LinkEntry.js +41 -39
- package/dist/esm/LinkEntry.js.map +1 -1
- package/dist/esm/SymbolicLinkEntry.d.ts +9 -1
- package/dist/esm/SymbolicLinkEntry.js +47 -45
- package/dist/esm/SymbolicLinkEntry.js.map +1 -1
- package/dist/esm/types.d.ts +2 -0
- package/dist/esm/types.js +1 -0
- package/dist/esm/types.js.map +1 -0
- package/package.json +1 -1
|
@@ -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
|
|
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,OAAOF,WAAWG,WAAW,KAAK,QAAQ;QAChDC,mBAAE,CAACC,OAAO,CAACV,UAAUC,UAAUM,MAAML;IACvC;AACF;AACA,IAAMS,YAAYC,QAAQC,QAAQ,KAAK,WAAW,kBAAkBC,IAAI,CAACF,QAAQG,GAAG,CAACC,MAAM;AAE3F,IAAMC,uBAAuB;IAAC;IAAQ;IAAS;IAAQ;CAAW;AAEnD,IAAA,AAAMpB,kCAAN;;aAAMA,kBAMPqB,UAAU;gCANHrB;QAOjBsB,IAAAA,2BAAkB,EAACD,YAAYD;QAC/BG,IAAAA,qBAAY,EAAC,IAAI,EAAEF;QACnB,IAAI,IAAI,CAACG,QAAQ,KAAKC,WAAW,IAAI,CAACD,QAAQ,GAAGE,aAAI,CAACF,QAAQ,CAAC,IAAI,CAACE,IAAI;QACxE,IAAI,IAAI,CAAChB,IAAI,KAAKe,WAAW,IAAI,CAACf,IAAI,GAAG;;iBAVxBV;IAanB2B,OAAAA,MA0CC,GA1CDA,SAAAA,OAAOC,IAAI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B;qBAChFmC,MAAMG,KAAK,CAAC9B,mBAAE,CAACC,OAAO,CAACkC,IAAI,CAACnC,mBAAE,EAAEsB,oBAAoB9B;gBACzDmC,MAAMG,KAAK,CAACM,cAAK,CAACD,IAAI,CAAC,MAAM3C,UAAU,IAAI,EAAEyB;gBAC7CU,MAAMG,KAAK,CAACO,cAAK,CAACF,IAAI,CAAC,MAAM3C,UAAU,IAAI,EAAEyB;gBAC7CU,MAAMG,KAAK,CAACQ,eAAM,CAACH,IAAI,CAAC,MAAM3C,UAAU,IAAI,EAAEyB;gBAC9C,OAAOU,MAAMY,KAAK,CAAC9C;YACrB,EAAE,OAAOE,KAAK;gBACZ,OAAOF,SAASE;YAClB;QACF;QAEA,OAAO,IAAI6C,QAAQ,SAACC,SAASC;YAC3B,MAAK3B,MAAM,CAACC,MAAMC,SAAS,SAACtB,KAAKgD;uBAAUhD,MAAM+C,OAAO/C,OAAO8C,QAAQE;;QACzE;IACF;IAEAC,OAAAA,OAAY,GAAZA,SAAAA,WAAW;WAzDQxD"}
|
|
@@ -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":""}
|
|
@@ -12,36 +12,38 @@ const MANDATORY_ATTRIBUTES = [
|
|
|
12
12
|
'mtime',
|
|
13
13
|
'path'
|
|
14
14
|
];
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
|
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
|
|
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;YAClCD,UAAUA,WAAW,CAAC;YACtB,IAAI;gBACF,MAAME,iBAAiBf,KAAKgB,SAAS,CAAC,IAAI,CAAChB,IAAI;gBAC/C,MAAMiB,WAAWjB,KAAKkB,IAAI,CAACN,MAAML,UAAUQ,gBAAgBF;gBAE3D,iFAAiF;gBACjF,MAAMM,QAAQ,IAAIhB,MAAM;gBACxBgB,MAAMC,KAAK,CAACnB,OAAOoB,IAAI,CAAC,MAAMJ;gBAC9BE,MAAMC,KAAK,CAAChB,MAAMiB,IAAI,CAAC,MAAMJ,UAAU,IAAI,EAAEJ;gBAC7CM,MAAMC,KAAK,CAACf,MAAMgB,IAAI,CAAC,MAAMJ,UAAU,IAAI,EAAEJ;gBAC7CM,MAAMC,KAAK,CAACd,OAAOe,IAAI,CAAC,MAAMJ,UAAU,IAAI,EAAEJ;gBAC9C,OAAOM,MAAMG,KAAK,CAACR;YACrB,EAAE,OAAOS,KAAK;gBACZ,OAAOT,SAASS;YAClB;QACF;QAEA,OAAO,IAAIC,QAAQ,CAACC,SAASC;YAC3B,IAAI,CAACf,MAAM,CAACC,MAAMC,SAAS,CAACU,KAAKI,OAAUJ,MAAMG,OAAOH,OAAOE,QAAQE;QACzE;IACF;IAEAC,UAAU,CAAC;IApCXC,YAAYC,UAAU,CAAE;QACtBtB,mBAAmBsB,YAAYrB;QAC/BP,aAAa,IAAI,EAAE4B;QACnB,IAAI,IAAI,CAACC,IAAI,KAAKC,WAAW,IAAI,CAACD,IAAI,GAAG;QACzC,IAAI,IAAI,CAACE,QAAQ,KAAKD,WAAW,IAAI,CAACC,QAAQ,GAAGjC,KAAKiC,QAAQ,CAAC,IAAI,CAACjC,IAAI;IAC1E;AAgCF;AA1CA,SAAqBU,4BA0CpB"}
|
package/dist/esm/FileEntry.d.ts
CHANGED
package/dist/esm/FileEntry.js
CHANGED
|
@@ -13,46 +13,48 @@ const MANDATORY_ATTRIBUTES = [
|
|
|
13
13
|
'mtime',
|
|
14
14
|
'path'
|
|
15
15
|
];
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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
|
|
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
|
|
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,O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C,SAASC;YAC3B,IAAI,CAACpB,MAAM,CAACC,MAAMC,SAAS,CAACU,KAAKS,OAAUT,MAAMQ,OAAOR,OAAOO,QAAQE;QACzE;IACF;IAEAC,UAAU,CAAC;IA5CXC,YAAYC,UAAU,CAAE;QACtB3B,mBAAmB2B,YAAY1B;QAC/BR,aAAa,IAAI,EAAEkC;QACnB,IAAI,IAAI,CAACC,QAAQ,KAAKC,WAAW,IAAI,CAACD,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"}
|
package/dist/esm/LinkEntry.d.ts
CHANGED
|
@@ -1 +1,9 @@
|
|
|
1
|
-
export default
|
|
1
|
+
export default class LinkEntry {
|
|
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
|
+
}
|
package/dist/esm/LinkEntry.js
CHANGED
|
@@ -15,47 +15,49 @@ const MANDATORY_ATTRIBUTES = [
|
|
|
15
15
|
'path',
|
|
16
16
|
'linkpath'
|
|
17
17
|
];
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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){
|
|
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
|
|
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
|
|
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) {\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","basename","undefined","type"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,OAAOC,QAAQ,cAAc;AAC7B,OAAO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UAAU,IAAI,EAAEJ;gBAC7CS,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,CAAE;QACtB9B,mBAAmB8B,YAAY7B;QAC/BR,aAAa,IAAI,EAAEqC;QACnB,IAAI,IAAI,CAACC,QAAQ,KAAKC,WAAW,IAAI,CAACD,QAAQ,GAAGzC,KAAKyC,QAAQ,CAAC,IAAI,CAACzC,IAAI;QACxE,IAAI,IAAI,CAAC2C,IAAI,KAAKD,WAAW,IAAI,CAACC,IAAI,GAAG;IAC3C;AAyCF;AApDA,SAAqB/B,uBAoDpB"}
|
|
@@ -1 +1,9 @@
|
|
|
1
|
-
export default
|
|
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
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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
|
|
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
|
|
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,MAAMO,YAAYC,QAAQC,QAAQ,KAAK,WAAW,kBAAkBC,IAAI,CAACF,QAAQG,GAAG,CAACC,MAAM;AAE3F,MAAMC,uBAAuB;IAAC;IAAQ;IAAS;IAAQ;CAAW;AAEnD,IAAA,AAAMC,oBAAN,MAAMA;IAanBC,OAAOC,IAAI,EAAEC,OAAO,EAAEjB,QAAQ,EAAE;QAC9B,IAAI,OAAOiB,YAAY,YAAY;YACjCjB,WAAWiB;YACXA,UAAU;QACZ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