extract-base-iterator 1.3.13 → 1.3.14
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 +5 -2
- package/dist/cjs/DirectoryEntry.d.ts +5 -2
- package/dist/cjs/DirectoryEntry.js +4 -2
- package/dist/cjs/DirectoryEntry.js.map +1 -1
- package/dist/cjs/FileEntry.d.cts +5 -2
- package/dist/cjs/FileEntry.d.ts +5 -2
- package/dist/cjs/FileEntry.js +4 -2
- package/dist/cjs/FileEntry.js.map +1 -1
- package/dist/cjs/LinkEntry.d.cts +6 -3
- package/dist/cjs/LinkEntry.d.ts +6 -3
- package/dist/cjs/LinkEntry.js +4 -2
- package/dist/cjs/LinkEntry.js.map +1 -1
- package/dist/cjs/SymbolicLinkEntry.d.cts +6 -3
- package/dist/cjs/SymbolicLinkEntry.d.ts +6 -3
- package/dist/cjs/SymbolicLinkEntry.js +6 -11
- package/dist/cjs/SymbolicLinkEntry.js.map +1 -1
- package/dist/cjs/fs/chmod.d.cts +3 -1
- package/dist/cjs/fs/chmod.d.ts +3 -1
- package/dist/cjs/fs/chmod.js +4 -1
- package/dist/cjs/fs/chmod.js.map +1 -1
- package/dist/cjs/fs/chown.d.cts +3 -1
- package/dist/cjs/fs/chown.d.ts +3 -1
- package/dist/cjs/fs/chown.js +4 -1
- package/dist/cjs/fs/chown.js.map +1 -1
- package/dist/cjs/fs/lstatReal.d.cts +3 -1
- package/dist/cjs/fs/lstatReal.d.ts +3 -1
- package/dist/cjs/fs/lstatReal.js +3 -3
- package/dist/cjs/fs/lstatReal.js.map +1 -1
- package/dist/cjs/fs/symlinkWin32.d.cts +2 -0
- package/dist/cjs/fs/symlinkWin32.d.ts +2 -0
- package/dist/cjs/fs/symlinkWin32.js +25 -0
- package/dist/cjs/fs/symlinkWin32.js.map +1 -0
- package/dist/cjs/fs/utimes.d.cts +3 -1
- package/dist/cjs/fs/utimes.d.ts +3 -1
- package/dist/cjs/fs/utimes.js.map +1 -1
- package/dist/cjs/index.d.cts +2 -0
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/index.js +5 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/polyfills.d.cts +1 -0
- package/dist/cjs/polyfills.d.ts +1 -0
- package/dist/cjs/polyfills.js +13 -0
- package/dist/cjs/polyfills.js.map +1 -0
- package/dist/cjs/stripPath.d.cts +2 -1
- package/dist/cjs/stripPath.d.ts +2 -1
- package/dist/cjs/stripPath.js.map +1 -1
- package/dist/cjs/types.d.cts +15 -2
- package/dist/cjs/types.d.ts +15 -2
- package/dist/cjs/validateAttributes.d.cts +1 -1
- package/dist/cjs/validateAttributes.d.ts +1 -1
- package/dist/cjs/validateAttributes.js.map +1 -1
- package/dist/cjs/waitForAccess.d.cts +2 -0
- package/dist/cjs/waitForAccess.d.ts +2 -0
- package/dist/cjs/{fs/waitForAccess.js → waitForAccess.js} +3 -1
- package/dist/cjs/waitForAccess.js.map +1 -0
- package/dist/esm/DirectoryEntry.d.ts +5 -2
- package/dist/esm/DirectoryEntry.js +4 -2
- package/dist/esm/DirectoryEntry.js.map +1 -1
- package/dist/esm/FileEntry.d.ts +5 -2
- package/dist/esm/FileEntry.js +4 -2
- package/dist/esm/FileEntry.js.map +1 -1
- package/dist/esm/LinkEntry.d.ts +6 -3
- package/dist/esm/LinkEntry.js +4 -2
- package/dist/esm/LinkEntry.js.map +1 -1
- package/dist/esm/SymbolicLinkEntry.d.ts +6 -3
- package/dist/esm/SymbolicLinkEntry.js +5 -10
- package/dist/esm/SymbolicLinkEntry.js.map +1 -1
- package/dist/esm/fs/chmod.d.ts +3 -1
- package/dist/esm/fs/chmod.js +4 -1
- package/dist/esm/fs/chmod.js.map +1 -1
- package/dist/esm/fs/chown.d.ts +3 -1
- package/dist/esm/fs/chown.js +4 -1
- package/dist/esm/fs/chown.js.map +1 -1
- package/dist/esm/fs/lstatReal.d.ts +3 -1
- package/dist/esm/fs/lstatReal.js +2 -2
- package/dist/esm/fs/lstatReal.js.map +1 -1
- package/dist/esm/fs/symlinkWin32.d.ts +2 -0
- package/dist/esm/fs/symlinkWin32.js +9 -0
- package/dist/esm/fs/symlinkWin32.js.map +1 -0
- package/dist/esm/fs/utimes.d.ts +3 -1
- package/dist/esm/fs/utimes.js.map +1 -1
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/polyfills.d.ts +1 -0
- package/dist/esm/polyfills.js +3 -0
- package/dist/esm/polyfills.js.map +1 -0
- package/dist/esm/stripPath.d.ts +2 -1
- package/dist/esm/stripPath.js.map +1 -1
- package/dist/esm/types.d.ts +15 -2
- package/dist/esm/types.js.map +1 -1
- package/dist/esm/validateAttributes.d.ts +1 -1
- package/dist/esm/validateAttributes.js.map +1 -1
- package/dist/esm/waitForAccess.d.ts +2 -0
- package/dist/esm/{fs/waitForAccess.js → waitForAccess.js} +1 -1
- package/dist/esm/waitForAccess.js.map +1 -0
- package/package.json +3 -2
- package/dist/cjs/fs/waitForAccess.d.cts +0 -1
- package/dist/cjs/fs/waitForAccess.d.ts +0 -1
- package/dist/cjs/fs/waitForAccess.js.map +0 -1
- package/dist/esm/fs/waitForAccess.d.ts +0 -1
- package/dist/esm/fs/waitForAccess.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/polyfills.ts"],"sourcesContent":["import Module from 'module';\n\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\n\nif (typeof setImmediate === 'undefined') global.setImmediate = _require('next-tick');\n"],"names":["_require","require","Module","createRequire","setImmediate","global"],"mappings":";;;;6DAAmB;;;;;;AAEnB,IAAMA,WAAW,OAAOC,YAAY,cAAcC,eAAM,CAACC,aAAa,CAAC,uDAAmBF;AAE1F,IAAI,OAAOG,iBAAiB,aAAaC,OAAOD,YAAY,GAAGJ,SAAS"}
|
package/dist/cjs/stripPath.d.cts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import type { ExtractOptions } from './types.js';
|
|
2
|
+
export default function stripPath(relativePath: string, options: ExtractOptions): string;
|
package/dist/cjs/stripPath.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import type { ExtractOptions } from './types.js';
|
|
2
|
+
export default function stripPath(relativePath: string, options: ExtractOptions): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/stripPath.ts"],"sourcesContent":["import path from 'path';\nimport compact from 'lodash.compact';\n\nexport default function stripPath(relativePath, options) {\n const strip = options.strip || 0;\n if (!strip) return relativePath;\n const parts = compact(relativePath.split(path.sep));\n if (parts.length < strip) throw new Error(`You cannot strip more levels than there are directories. Strip: ${strip}. Path: ${relativePath}`);\n return parts.slice(strip).join(path.sep);\n}\n"],"names":["stripPath","relativePath","options","strip","parts","compact","split","path","sep","length","Error","slice","join"],"mappings":";;;;+
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/stripPath.ts"],"sourcesContent":["import path from 'path';\nimport compact from 'lodash.compact';\n\nimport type { ExtractOptions } from './types.js';\n\nexport default function stripPath(relativePath: string, options: ExtractOptions): string {\n const strip = options.strip || 0;\n if (!strip) return relativePath;\n const parts = compact(relativePath.split(path.sep));\n if (parts.length < strip) throw new Error(`You cannot strip more levels than there are directories. Strip: ${strip}. Path: ${relativePath}`);\n return parts.slice(strip).join(path.sep);\n}\n"],"names":["stripPath","relativePath","options","strip","parts","compact","split","path","sep","length","Error","slice","join"],"mappings":";;;;+BAKA;;;eAAwBA;;;2DALP;oEACG;;;;;;AAIL,SAASA,UAAUC,YAAoB,EAAEC,OAAuB;IAC7E,IAAMC,QAAQD,QAAQC,KAAK,IAAI;IAC/B,IAAI,CAACA,OAAO,OAAOF;IACnB,IAAMG,QAAQC,IAAAA,sBAAO,EAACJ,aAAaK,KAAK,CAACC,aAAI,CAACC,GAAG;IACjD,IAAIJ,MAAMK,MAAM,GAAGN,OAAO,MAAM,IAAIO,MAAM,AAAC,mEAAkFT,OAAhBE,OAAM,YAAuB,OAAbF;IAC7H,OAAOG,MAAMO,KAAK,CAACR,OAAOS,IAAI,CAACL,aAAI,CAACC,GAAG;AACzC"}
|
package/dist/cjs/types.d.cts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import type { Mode } from 'fs';
|
|
2
2
|
import type { StackOptions } from 'stack-base-iterator';
|
|
3
3
|
export interface ExtractOptions extends StackOptions {
|
|
4
|
+
force?: boolean;
|
|
5
|
+
strip?: number;
|
|
6
|
+
now?: Date;
|
|
4
7
|
}
|
|
5
|
-
export type
|
|
6
|
-
export type WriteFileFn = (path: string, options: object, callback:
|
|
8
|
+
export type NoParamCallback = (error?: Error) => void;
|
|
9
|
+
export type WriteFileFn = (path: string, options: object, callback: NoParamCallback) => void;
|
|
7
10
|
export interface FileAttributes {
|
|
8
11
|
mode: Mode;
|
|
9
12
|
mtime: number;
|
|
@@ -20,3 +23,13 @@ export interface LinkAttributes {
|
|
|
20
23
|
path: string;
|
|
21
24
|
linkpath: string;
|
|
22
25
|
}
|
|
26
|
+
export interface Entry {
|
|
27
|
+
mode: Mode;
|
|
28
|
+
mtime: number;
|
|
29
|
+
path: string;
|
|
30
|
+
basename: string;
|
|
31
|
+
type: string;
|
|
32
|
+
linkpath?: string;
|
|
33
|
+
uid?: number;
|
|
34
|
+
gid?: number;
|
|
35
|
+
}
|
package/dist/cjs/types.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import type { Mode } from 'fs';
|
|
2
2
|
import type { StackOptions } from 'stack-base-iterator';
|
|
3
3
|
export interface ExtractOptions extends StackOptions {
|
|
4
|
+
force?: boolean;
|
|
5
|
+
strip?: number;
|
|
6
|
+
now?: Date;
|
|
4
7
|
}
|
|
5
|
-
export type
|
|
6
|
-
export type WriteFileFn = (path: string, options: object, callback:
|
|
8
|
+
export type NoParamCallback = (error?: Error) => void;
|
|
9
|
+
export type WriteFileFn = (path: string, options: object, callback: NoParamCallback) => void;
|
|
7
10
|
export interface FileAttributes {
|
|
8
11
|
mode: Mode;
|
|
9
12
|
mtime: number;
|
|
@@ -20,3 +23,13 @@ export interface LinkAttributes {
|
|
|
20
23
|
path: string;
|
|
21
24
|
linkpath: string;
|
|
22
25
|
}
|
|
26
|
+
export interface Entry {
|
|
27
|
+
mode: Mode;
|
|
28
|
+
mtime: number;
|
|
29
|
+
path: string;
|
|
30
|
+
basename: string;
|
|
31
|
+
type: string;
|
|
32
|
+
linkpath?: string;
|
|
33
|
+
uid?: number;
|
|
34
|
+
gid?: number;
|
|
35
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function validateAttributes(attributes:
|
|
1
|
+
export default function validateAttributes(attributes: object, keys: string[]): undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function validateAttributes(attributes:
|
|
1
|
+
export default function validateAttributes(attributes: object, keys: string[]): undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/validateAttributes.ts"],"sourcesContent":["export default function validateAttributes(attributes, keys) {\n for (let index = 0; index < keys.length; index++) {\n const key = keys[index];\n if (attributes[key] === undefined) throw new Error(`Missing attribute ${key}.Attributes ${JSON.stringify(attributes)}`);\n }\n}\n"],"names":["validateAttributes","attributes","keys","index","length","key","undefined","Error","JSON","stringify"],"mappings":";;;;+BAAA;;;eAAwBA;;;AAAT,SAASA,mBAAmBC,
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/validateAttributes.ts"],"sourcesContent":["export default function validateAttributes(attributes: object, keys: string[]): undefined {\n for (let index = 0; index < keys.length; index++) {\n const key = keys[index];\n if (attributes[key] === undefined) throw new Error(`Missing attribute ${key}.Attributes ${JSON.stringify(attributes)}`);\n }\n}\n"],"names":["validateAttributes","attributes","keys","index","length","key","undefined","Error","JSON","stringify"],"mappings":";;;;+BAAA;;;eAAwBA;;;AAAT,SAASA,mBAAmBC,UAAkB,EAAEC,IAAc;IAC3E,IAAK,IAAIC,QAAQ,GAAGA,QAAQD,KAAKE,MAAM,EAAED,QAAS;QAChD,IAAME,MAAMH,IAAI,CAACC,MAAM;QACvB,IAAIF,UAAU,CAACI,IAAI,KAAKC,WAAW,MAAM,IAAIC,MAAM,AAAC,qBAAsCC,OAAlBH,KAAI,gBAAyC,OAA3BG,KAAKC,SAAS,CAACR;IAC3G;AACF"}
|
|
@@ -16,7 +16,9 @@ function _interop_require_default(obj) {
|
|
|
16
16
|
}
|
|
17
17
|
function waitForAccess(fullPath, callback) {
|
|
18
18
|
_fs.default.stat(fullPath, function(err) {
|
|
19
|
-
if (err) return
|
|
19
|
+
if (err) return setImmediate(function() {
|
|
20
|
+
return waitForAccess(fullPath, callback);
|
|
21
|
+
});
|
|
20
22
|
callback();
|
|
21
23
|
});
|
|
22
24
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/waitForAccess.ts"],"sourcesContent":["import fs from 'fs';\n\nimport type { NoParamCallback } from './types.js';\n\nexport default function waitForAccess(fullPath: string, callback: NoParamCallback): undefined {\n fs.stat(fullPath, (err) => {\n if (err) return setImmediate(() => waitForAccess(fullPath, callback));\n callback();\n });\n}\n"],"names":["waitForAccess","fullPath","callback","fs","stat","err","setImmediate"],"mappings":";;;;+BAIA;;;eAAwBA;;;yDAJT;;;;;;AAIA,SAASA,cAAcC,QAAgB,EAAEC,QAAyB;IAC/EC,WAAE,CAACC,IAAI,CAACH,UAAU,SAACI;QACjB,IAAIA,KAAK,OAAOC,aAAa;mBAAMN,cAAcC,UAAUC;;QAC3DA;IACF;AACF"}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Mode } from 'fs';
|
|
2
|
+
import type { DirectoryAttributes, ExtractOptions, NoParamCallback } from './types.js';
|
|
2
3
|
export default class DirectoryEntry {
|
|
4
|
+
mode: Mode;
|
|
5
|
+
mtime: number;
|
|
3
6
|
path: string;
|
|
4
7
|
basename: string;
|
|
5
8
|
type: string;
|
|
6
9
|
constructor(attributes: DirectoryAttributes);
|
|
7
|
-
create(dest:
|
|
10
|
+
create(dest: string, options: ExtractOptions | NoParamCallback, callback?: NoParamCallback): undefined | Promise<boolean>;
|
|
8
11
|
destroy(): void;
|
|
9
12
|
}
|
|
@@ -29,9 +29,11 @@ let DirectoryEntry = class DirectoryEntry {
|
|
|
29
29
|
queue.defer(chmod.bind(null, fullPath, this, options));
|
|
30
30
|
queue.defer(chown.bind(null, fullPath, this, options));
|
|
31
31
|
queue.defer(utimes.bind(null, fullPath, this, options));
|
|
32
|
-
|
|
32
|
+
queue.await(callback);
|
|
33
|
+
return;
|
|
33
34
|
} catch (err) {
|
|
34
|
-
|
|
35
|
+
callback(err);
|
|
36
|
+
return;
|
|
35
37
|
}
|
|
36
38
|
}
|
|
37
39
|
return new Promise((resolve, reject)=>{
|
|
@@ -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'];\nimport type { DirectoryAttributes } from './types.js';\n\nexport default class DirectoryEntry {\n path: string;\n basename: string;\n type: string;\n\n constructor(attributes: DirectoryAttributes) {\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
|
|
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'];\nimport type { Mode } from 'fs';\nimport type { DirectoryAttributes, ExtractOptions, NoParamCallback } from './types.js';\n\nexport default class DirectoryEntry {\n mode: Mode;\n mtime: number;\n path: string;\n basename: string;\n type: string;\n\n constructor(attributes: DirectoryAttributes) {\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: string, options: ExtractOptions | NoParamCallback, callback?: NoParamCallback): undefined | Promise<boolean> {\n if (typeof options === 'function') {\n callback = options;\n options = null;\n }\n\n if (typeof callback === 'function') {\n options = options || {};\n try {\n const normalizedPath = path.normalize(this.path);\n const fullPath = path.join(dest, stripPath(normalizedPath, options as ExtractOptions));\n\n // 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 queue.await(callback);\n return;\n } catch (err) {\n callback(err);\n return;\n }\n }\n\n return new Promise((resolve, reject) => {\n this.create(dest, options, (err?: Error, done?: boolean) => (err ? reject(err) : resolve(done)));\n });\n }\n\n destroy() {}\n}\n"],"names":["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","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;AAIvC,IAAA,AAAMC,iBAAN,MAAMA;IAcnBC,OAAOC,IAAY,EAAEC,OAAyC,EAAEC,QAA0B,EAAgC;QACxH,IAAI,OAAOD,YAAY,YAAY;YACjCC,WAAWD;YACXA,UAAU;QACZ;QAEA,IAAI,OAAOC,aAAa,YAAY;YAClCD,UAAUA,WAAW,CAAC;YACtB,IAAI;gBACF,MAAME,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;gBAC9CM,MAAMG,KAAK,CAACR;gBACZ;YACF,EAAE,OAAOS,KAAK;gBACZT,SAASS;gBACT;YACF;QACF;QAEA,OAAO,IAAIC,QAAQ,CAACC,SAASC;YAC3B,IAAI,CAACf,MAAM,CAACC,MAAMC,SAAS,CAACU,KAAaI,OAAoBJ,MAAMG,OAAOH,OAAOE,QAAQE;QAC3F;IACF;IAEAC,UAAU,CAAC;IAtCX,YAAYC,UAA+B,CAAE;QAC3CrB,mBAAmBqB,YAAYpB;QAC/BP,aAAa,IAAI,EAAE2B;QACnB,IAAI,IAAI,CAACC,IAAI,KAAKC,WAAW,IAAI,CAACD,IAAI,GAAG;QACzC,IAAI,IAAI,CAACE,QAAQ,KAAKD,WAAW,IAAI,CAACC,QAAQ,GAAGhC,KAAKgC,QAAQ,CAAC,IAAI,CAAChC,IAAI;IAC1E;AAkCF;AA9CA,SAAqBU,4BA8CpB"}
|
package/dist/esm/FileEntry.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Mode } from 'fs';
|
|
2
|
+
import type { ExtractOptions, FileAttributes, NoParamCallback } from './types.js';
|
|
2
3
|
export default class FileEntry {
|
|
4
|
+
mode: Mode;
|
|
5
|
+
mtime: number;
|
|
3
6
|
path: string;
|
|
4
7
|
basename: string;
|
|
5
8
|
type: string;
|
|
6
9
|
constructor(attributes: FileAttributes);
|
|
7
|
-
create(dest:
|
|
10
|
+
create(dest: string, options: ExtractOptions | NoParamCallback, callback?: NoParamCallback): undefined | Promise<boolean>;
|
|
8
11
|
destroy(): void;
|
|
9
12
|
}
|
package/dist/esm/FileEntry.js
CHANGED
|
@@ -39,9 +39,11 @@ let FileEntry = class FileEntry {
|
|
|
39
39
|
queue.defer(chmod.bind(null, fullPath, this, options));
|
|
40
40
|
queue.defer(chown.bind(null, fullPath, this, options));
|
|
41
41
|
queue.defer(utimes.bind(null, fullPath, this, options));
|
|
42
|
-
|
|
42
|
+
queue.await(callback);
|
|
43
|
+
return;
|
|
43
44
|
} catch (err) {
|
|
44
|
-
|
|
45
|
+
callback(err);
|
|
46
|
+
return;
|
|
45
47
|
}
|
|
46
48
|
}
|
|
47
49
|
return new Promise((resolve, reject)=>{
|
|
@@ -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'];\nimport type {
|
|
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'];\nimport type { Mode } from 'fs';\nimport type { ExtractOptions, FileAttributes, NoParamCallback, WriteFileFn } from './types.js';\n\ninterface AbstractFileEntry {\n _writeFile: WriteFileFn;\n}\n\nexport default class FileEntry {\n mode: Mode;\n mtime: number;\n path: string;\n basename: string;\n type: string;\n\n constructor(attributes: FileAttributes) {\n validateAttributes(attributes, MANDATORY_ATTRIBUTES);\n objectAssign(this, attributes);\n if (this.basename === undefined) this.basename = path.basename(this.path);\n if (this.type === undefined) this.type = 'file';\n if ((this as unknown as AbstractFileEntry)._writeFile === undefined) throw new Error('File this missing _writeFile. Please implement this method in your subclass');\n }\n\n create(dest: string, options: ExtractOptions | NoParamCallback, callback?: NoParamCallback): undefined | Promise<boolean> {\n if (typeof options === 'function') {\n callback = options;\n options = null;\n }\n\n if (typeof callback === 'function') {\n options = options || {};\n try {\n const normalizedPath = path.normalize(this.path);\n const fullPath = path.join(dest, stripPath(normalizedPath, options as ExtractOptions));\n\n const queue = new Queue(1);\n if ((options as ExtractOptions).force) {\n queue.defer((callback) => {\n 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 queue.await(callback);\n return;\n } catch (err) {\n callback(err);\n return;\n }\n }\n\n return new Promise((resolve, reject) => {\n this.create(dest, options, (err?: Error, done?: boolean) => (err ? reject(err) : resolve(done)));\n });\n }\n\n destroy() {}\n}\n"],"names":["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","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;AAQvC,IAAA,AAAMC,YAAN,MAAMA;IAenBC,OAAOC,IAAY,EAAEC,OAAyC,EAAEC,QAA0B,EAAgC;QACxH,IAAI,OAAOD,YAAY,YAAY;YACjCC,WAAWD;YACXA,UAAU;QACZ;QAEA,IAAI,OAAOC,aAAa,YAAY;YAClCD,UAAUA,WAAW,CAAC;YACtB,IAAI;gBACF,MAAME,iBAAiBhB,KAAKiB,SAAS,CAAC,IAAI,CAACjB,IAAI;gBAC/C,MAAMkB,WAAWlB,KAAKmB,IAAI,CAACN,MAAML,UAAUQ,gBAAgBF;gBAE3D,MAAMM,QAAQ,IAAIjB,MAAM;gBACxB,IAAI,AAACW,QAA2BO,KAAK,EAAE;oBACrCD,MAAME,KAAK,CAAC,CAACP;wBACXX,QAAQc,UAAU;4BAAEK,aAAa;wBAAK,GAAG,CAACC;4BACxCA,OAAOA,IAAIC,IAAI,KAAK,WAAWV,SAASS,OAAOT;wBACjD;oBACF;gBACF;gBACAK,MAAME,KAAK,CAACrB,OAAOyB,IAAI,CAAC,MAAM1B,KAAK2B,OAAO,CAACT;gBAC3CE,MAAME,KAAK,CAAC,AAAC,IAAI,CAAkCM,UAAU,CAACF,IAAI,CAAC,IAAI,EAAER,UAAUJ;gBACnFM,MAAME,KAAK,CAACjB,MAAMqB,IAAI,CAAC,MAAMR,UAAU,IAAI,EAAEJ;gBAC7CM,MAAME,KAAK,CAAChB,MAAMoB,IAAI,CAAC,MAAMR,UAAU,IAAI,EAAEJ;gBAC7CM,MAAME,KAAK,CAACf,OAAOmB,IAAI,CAAC,MAAMR,UAAU,IAAI,EAAEJ;gBAC9CM,MAAMS,KAAK,CAACd;gBACZ;YACF,EAAE,OAAOS,KAAK;gBACZT,SAASS;gBACT;YACF;QACF;QAEA,OAAO,IAAIM,QAAQ,CAACC,SAASC;YAC3B,IAAI,CAACpB,MAAM,CAACC,MAAMC,SAAS,CAACU,KAAaS,OAAoBT,MAAMQ,OAAOR,OAAOO,QAAQE;QAC3F;IACF;IAEAC,UAAU,CAAC;IA9CX,YAAYC,UAA0B,CAAE;QACtC1B,mBAAmB0B,YAAYzB;QAC/BR,aAAa,IAAI,EAAEiC;QACnB,IAAI,IAAI,CAACC,QAAQ,KAAKC,WAAW,IAAI,CAACD,QAAQ,GAAGpC,KAAKoC,QAAQ,CAAC,IAAI,CAACpC,IAAI;QACxE,IAAI,IAAI,CAACsC,IAAI,KAAKD,WAAW,IAAI,CAACC,IAAI,GAAG;QACzC,IAAI,AAAC,IAAI,CAAkCV,UAAU,KAAKS,WAAW,MAAM,IAAIE,MAAM;IACvF;AAyCF;AAtDA,SAAqB5B,uBAsDpB"}
|
package/dist/esm/LinkEntry.d.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Mode } from 'fs';
|
|
2
|
+
import type { ExtractOptions, LinkAttributes, NoParamCallback } from './types.js';
|
|
2
3
|
export default class LinkEntry {
|
|
4
|
+
mode: Mode;
|
|
5
|
+
mtime: number;
|
|
3
6
|
path: string;
|
|
7
|
+
linkpath: string;
|
|
4
8
|
basename: string;
|
|
5
9
|
type: string;
|
|
6
|
-
linkpath: string;
|
|
7
10
|
constructor(attributes: LinkAttributes);
|
|
8
|
-
create(dest:
|
|
11
|
+
create(dest: string, options: ExtractOptions | NoParamCallback, callback?: NoParamCallback): undefined | Promise<boolean>;
|
|
9
12
|
destroy(): void;
|
|
10
13
|
}
|
package/dist/esm/LinkEntry.js
CHANGED
|
@@ -43,9 +43,11 @@ let LinkEntry = class LinkEntry {
|
|
|
43
43
|
queue.defer(chmod.bind(null, fullPath, this, options));
|
|
44
44
|
queue.defer(chown.bind(null, fullPath, this, options));
|
|
45
45
|
queue.defer(utimes.bind(null, fullPath, this, options));
|
|
46
|
-
|
|
46
|
+
queue.await(callback);
|
|
47
|
+
return;
|
|
47
48
|
} catch (err) {
|
|
48
|
-
|
|
49
|
+
callback(err);
|
|
50
|
+
return;
|
|
49
51
|
}
|
|
50
52
|
}
|
|
51
53
|
return new Promise((resolve, reject)=>{
|
|
@@ -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'];\nimport type { LinkAttributes } from './types.js';\n\nexport default class LinkEntry {\n path: string;\n
|
|
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'];\nimport type { Mode } from 'fs';\nimport type { ExtractOptions, LinkAttributes, NoParamCallback } from './types.js';\n\nexport default class LinkEntry {\n mode: Mode;\n mtime: number;\n path: string;\n linkpath: string;\n basename: string;\n type: string;\n\n constructor(attributes: LinkAttributes) {\n validateAttributes(attributes, MANDATORY_ATTRIBUTES);\n objectAssign(this, attributes);\n if (this.basename === undefined) this.basename = path.basename(this.path);\n if (this.type === undefined) this.type = 'link';\n }\n\n create(dest: string, options: ExtractOptions | NoParamCallback, callback?: NoParamCallback): undefined | Promise<boolean> {\n if (typeof options === 'function') {\n callback = options;\n options = null;\n }\n\n if (typeof callback === 'function') {\n options = options || {};\n try {\n const normalizedPath = path.normalize(this.path);\n const fullPath = path.join(dest, stripPath(normalizedPath, options as ExtractOptions));\n const normalizedLinkpath = path.normalize(this.linkpath);\n const linkFullPath = path.join(dest, stripPath(normalizedLinkpath, options as ExtractOptions));\n\n const queue = new Queue(1);\n if ((options as ExtractOptions).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 queue.await(callback);\n return;\n } catch (err) {\n callback(err);\n return;\n }\n }\n\n return new Promise((resolve, reject) => {\n this.create(dest, options, (err?: Error, done?: boolean) => (err ? reject(err) : resolve(done)));\n });\n }\n\n destroy() {}\n}\n"],"names":["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","attributes","basename","undefined","type"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,OAAOC,QAAQ,cAAc;AAC7B,OAAOC,YAAY,iBAAiB;AACpC,OAAOC,kBAAkB,gBAAgB;AACzC,OAAOC,WAAW,WAAW;AAC7B,OAAOC,aAAa,UAAU;AAE9B,OAAOC,WAAW,gBAAgB;AAClC,OAAOC,WAAW,gBAAgB;AAClC,OAAOC,YAAY,iBAAiB;AACpC,OAAOC,eAAe,iBAAiB;AACvC,OAAOC,wBAAwB,0BAA0B;AAEzD,MAAMC,uBAAuB;IAAC;IAAQ;IAAS;IAAQ;CAAW;AAInD,IAAA,AAAMC,YAAN,MAAMA;IAenBC,OAAOC,IAAY,EAAEC,OAAyC,EAAEC,QAA0B,EAAgC;QACxH,IAAI,OAAOD,YAAY,YAAY;YACjCC,WAAWD;YACXA,UAAU;QACZ;QAEA,IAAI,OAAOC,aAAa,YAAY;YAClCD,UAAUA,WAAW,CAAC;YACtB,IAAI;gBACF,MAAME,iBAAiBjB,KAAKkB,SAAS,CAAC,IAAI,CAAClB,IAAI;gBAC/C,MAAMmB,WAAWnB,KAAKoB,IAAI,CAACN,MAAML,UAAUQ,gBAAgBF;gBAC3D,MAAMM,qBAAqBrB,KAAKkB,SAAS,CAAC,IAAI,CAACI,QAAQ;gBACvD,MAAMC,eAAevB,KAAKoB,IAAI,CAACN,MAAML,UAAUY,oBAAoBN;gBAEnE,MAAMS,QAAQ,IAAIpB,MAAM;gBACxB,IAAI,AAACW,QAA2BU,KAAK,EAAE;oBACrCD,MAAME,KAAK,CAAC,CAACV;wBACXX,QAAQc,UAAU;4BAAEQ,aAAa;wBAAK,GAAG,CAACC;4BACxCA,OAAOA,IAAIC,IAAI,KAAK,WAAWb,SAASY,OAAOZ;wBACjD;oBACF;gBACF;gBACAQ,MAAME,KAAK,CAACxB,OAAO4B,IAAI,CAAC,MAAM9B,KAAK+B,OAAO,CAACZ;gBAC3CK,MAAME,KAAK,CAACzB,GAAG+B,IAAI,CAACF,IAAI,CAAC7B,IAAIsB,cAAcJ;gBAC3CK,MAAME,KAAK,CAACpB,MAAMwB,IAAI,CAAC,MAAMX,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;gBAC9CS,MAAMS,KAAK,CAACjB;gBACZ;YACF,EAAE,OAAOY,KAAK;gBACZZ,SAASY;gBACT;YACF;QACF;QAEA,OAAO,IAAIM,QAAQ,CAACC,SAASC;YAC3B,IAAI,CAACvB,MAAM,CAACC,MAAMC,SAAS,CAACa,KAAaS,OAAoBT,MAAMQ,OAAOR,OAAOO,QAAQE;QAC3F;IACF;IAEAC,UAAU,CAAC;IA/CX,YAAYC,UAA0B,CAAE;QACtC7B,mBAAmB6B,YAAY5B;QAC/BR,aAAa,IAAI,EAAEoC;QACnB,IAAI,IAAI,CAACC,QAAQ,KAAKC,WAAW,IAAI,CAACD,QAAQ,GAAGxC,KAAKwC,QAAQ,CAAC,IAAI,CAACxC,IAAI;QACxE,IAAI,IAAI,CAAC0C,IAAI,KAAKD,WAAW,IAAI,CAACC,IAAI,GAAG;IAC3C;AA2CF;AAxDA,SAAqB9B,uBAwDpB"}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Mode } from 'fs';
|
|
2
|
+
import type { ExtractOptions, LinkAttributes, NoParamCallback } from './types.js';
|
|
2
3
|
export default class SymbolicLinkEntry {
|
|
4
|
+
mode: Mode;
|
|
5
|
+
mtime: number;
|
|
3
6
|
path: string;
|
|
7
|
+
linkpath: string;
|
|
4
8
|
basename: string;
|
|
5
9
|
type: string;
|
|
6
|
-
linkpath: string;
|
|
7
10
|
constructor(attributes: LinkAttributes);
|
|
8
|
-
create(dest:
|
|
11
|
+
create(dest: string, options: ExtractOptions | NoParamCallback, callback?: NoParamCallback): undefined | Promise<boolean>;
|
|
9
12
|
destroy(): void;
|
|
10
13
|
}
|
|
@@ -7,17 +7,10 @@ import Queue from 'queue-cb';
|
|
|
7
7
|
import rimraf2 from 'rimraf2';
|
|
8
8
|
import chmod from './fs/chmod.js';
|
|
9
9
|
import chown from './fs/chown.js';
|
|
10
|
-
import
|
|
10
|
+
import symlinkWin32 from './fs/symlinkWin32.js';
|
|
11
11
|
import utimes from './fs/utimes.js';
|
|
12
12
|
import stripPath from './stripPath.js';
|
|
13
13
|
import validateAttributes from './validateAttributes.js';
|
|
14
|
-
function symlinkWin32(linkFullPath, linkpath, fullPath, callback) {
|
|
15
|
-
lstatReal(linkFullPath, (err, targetStat)=>{
|
|
16
|
-
if (err || !targetStat) return callback(err || new Error(`Symlink path does not exist${linkFullPath}`));
|
|
17
|
-
const type = targetStat.isDirectory() ? 'dir' : 'file';
|
|
18
|
-
fs.symlink(linkpath, fullPath, type, callback);
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
14
|
const isWindows = process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE);
|
|
22
15
|
const MANDATORY_ATTRIBUTES = [
|
|
23
16
|
'mode',
|
|
@@ -59,9 +52,11 @@ let SymbolicLinkEntry = class SymbolicLinkEntry {
|
|
|
59
52
|
queue.defer(chmod.bind(null, fullPath, this, options));
|
|
60
53
|
queue.defer(chown.bind(null, fullPath, this, options));
|
|
61
54
|
queue.defer(utimes.bind(null, fullPath, this, options));
|
|
62
|
-
|
|
55
|
+
queue.await(callback);
|
|
56
|
+
return;
|
|
63
57
|
} catch (err) {
|
|
64
|
-
|
|
58
|
+
callback(err);
|
|
59
|
+
return;
|
|
65
60
|
}
|
|
66
61
|
}
|
|
67
62
|
return new Promise((resolve, reject)=>{
|
|
@@ -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
|
|
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 symlinkWin32 from './fs/symlinkWin32.js';\nimport utimes from './fs/utimes.js';\nimport stripPath from './stripPath.js';\nimport validateAttributes from './validateAttributes.js';\n\nconst isWindows = process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE);\n\nconst MANDATORY_ATTRIBUTES = ['mode', 'mtime', 'path', 'linkpath'];\nimport type { Mode } from 'fs';\nimport type { ExtractOptions, LinkAttributes, NoParamCallback } from './types.js';\n\nexport default class SymbolicLinkEntry {\n mode: Mode;\n mtime: number;\n path: string;\n linkpath: string;\n basename: string;\n type: string;\n\n constructor(attributes: LinkAttributes) {\n validateAttributes(attributes, MANDATORY_ATTRIBUTES);\n objectAssign(this, attributes);\n if (this.basename === undefined) this.basename = path.basename(this.path);\n if (this.type === undefined) this.type = 'symlink';\n }\n\n create(dest: string, options: ExtractOptions | NoParamCallback, callback?: NoParamCallback): undefined | Promise<boolean> {\n if (typeof options === 'function') {\n callback = options;\n options = null;\n }\n\n if (typeof callback === 'function') {\n options = options || {};\n try {\n const normalizedPath = path.normalize(this.path);\n const fullPath = path.join(dest, stripPath(normalizedPath, options as ExtractOptions));\n let normalizedLinkpath = path.normalize(this.linkpath);\n let linkFullPath = path.join(dest, stripPath(normalizedLinkpath, options as ExtractOptions));\n if (!isAbsolute(normalizedLinkpath)) {\n const linkRelativePath = path.join(path.dirname(normalizedPath), this.linkpath);\n linkFullPath = path.join(dest, stripPath(linkRelativePath, options as ExtractOptions));\n normalizedLinkpath = path.relative(path.dirname(fullPath), linkFullPath);\n }\n\n const queue = new Queue(1);\n if ((options as ExtractOptions).force) {\n queue.defer((callback) => {\n 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 queue.await(callback);\n return;\n } catch (err) {\n callback(err);\n return;\n }\n }\n\n return new Promise((resolve, reject) => {\n this.create(dest, options, (err?: Error, done?: boolean) => (err ? reject(err) : resolve(done)));\n });\n }\n\n destroy() {}\n}\n"],"names":["path","fs","isAbsolute","mkdirp","objectAssign","Queue","rimraf2","chmod","chown","symlinkWin32","utimes","stripPath","validateAttributes","isWindows","process","platform","test","env","OSTYPE","MANDATORY_ATTRIBUTES","SymbolicLinkEntry","create","dest","options","callback","normalizedPath","normalize","fullPath","join","normalizedLinkpath","linkpath","linkFullPath","linkRelativePath","dirname","relative","queue","force","defer","disableGlob","err","code","bind","symlink","await","Promise","resolve","reject","done","destroy","attributes","basename","undefined","type"],"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,kBAAkB,uBAAuB;AAChD,OAAOC,YAAY,iBAAiB;AACpC,OAAOC,eAAe,iBAAiB;AACvC,OAAOC,wBAAwB,0BAA0B;AAEzD,MAAMC,YAAYC,QAAQC,QAAQ,KAAK,WAAW,kBAAkBC,IAAI,CAACF,QAAQG,GAAG,CAACC,MAAM;AAE3F,MAAMC,uBAAuB;IAAC;IAAQ;IAAS;IAAQ;CAAW;AAInD,IAAA,AAAMC,oBAAN,MAAMA;IAenBC,OAAOC,IAAY,EAAEC,OAAyC,EAAEC,QAA0B,EAAgC;QACxH,IAAI,OAAOD,YAAY,YAAY;YACjCC,WAAWD;YACXA,UAAU;QACZ;QAEA,IAAI,OAAOC,aAAa,YAAY;YAClCD,UAAUA,WAAW,CAAC;YACtB,IAAI;gBACF,MAAME,iBAAiBzB,KAAK0B,SAAS,CAAC,IAAI,CAAC1B,IAAI;gBAC/C,MAAM2B,WAAW3B,KAAK4B,IAAI,CAACN,MAAMX,UAAUc,gBAAgBF;gBAC3D,IAAIM,qBAAqB7B,KAAK0B,SAAS,CAAC,IAAI,CAACI,QAAQ;gBACrD,IAAIC,eAAe/B,KAAK4B,IAAI,CAACN,MAAMX,UAAUkB,oBAAoBN;gBACjE,IAAI,CAACrB,WAAW2B,qBAAqB;oBACnC,MAAMG,mBAAmBhC,KAAK4B,IAAI,CAAC5B,KAAKiC,OAAO,CAACR,iBAAiB,IAAI,CAACK,QAAQ;oBAC9EC,eAAe/B,KAAK4B,IAAI,CAACN,MAAMX,UAAUqB,kBAAkBT;oBAC3DM,qBAAqB7B,KAAKkC,QAAQ,CAAClC,KAAKiC,OAAO,CAACN,WAAWI;gBAC7D;gBAEA,MAAMI,QAAQ,IAAI9B,MAAM;gBACxB,IAAI,AAACkB,QAA2Ba,KAAK,EAAE;oBACrCD,MAAME,KAAK,CAAC,CAACb;wBACXlB,QAAQqB,UAAU;4BAAEW,aAAa;wBAAK,GAAG,CAACC;4BACxCA,OAAOA,IAAIC,IAAI,KAAK,WAAWhB,SAASe,OAAOf;wBACjD;oBACF;gBACF;gBACAW,MAAME,KAAK,CAAClC,OAAOsC,IAAI,CAAC,MAAMzC,KAAKiC,OAAO,CAACN;gBAC3C,IAAId,WAAWsB,MAAME,KAAK,CAAC5B,aAAagC,IAAI,CAAC,MAAMV,cAAcF,oBAAoBF;qBAChFQ,MAAME,KAAK,CAACpC,GAAGyC,OAAO,CAACD,IAAI,CAACxC,IAAI4B,oBAAoBF;gBACzDQ,MAAME,KAAK,CAAC9B,MAAMkC,IAAI,CAAC,MAAMd,UAAU,IAAI,EAAEJ;gBAC7CY,MAAME,KAAK,CAAC7B,MAAMiC,IAAI,CAAC,MAAMd,UAAU,IAAI,EAAEJ;gBAC7CY,MAAME,KAAK,CAAC3B,OAAO+B,IAAI,CAAC,MAAMd,UAAU,IAAI,EAAEJ;gBAC9CY,MAAMQ,KAAK,CAACnB;gBACZ;YACF,EAAE,OAAOe,KAAK;gBACZf,SAASe;gBACT;YACF;QACF;QAEA,OAAO,IAAIK,QAAQ,CAACC,SAASC;YAC3B,IAAI,CAACzB,MAAM,CAACC,MAAMC,SAAS,CAACgB,KAAaQ,OAAoBR,MAAMO,OAAOP,OAAOM,QAAQE;QAC3F;IACF;IAEAC,UAAU,CAAC;IArDX,YAAYC,UAA0B,CAAE;QACtCrC,mBAAmBqC,YAAY9B;QAC/Bf,aAAa,IAAI,EAAE6C;QACnB,IAAI,IAAI,CAACC,QAAQ,KAAKC,WAAW,IAAI,CAACD,QAAQ,GAAGlD,KAAKkD,QAAQ,CAAC,IAAI,CAAClD,IAAI;QACxE,IAAI,IAAI,CAACoD,IAAI,KAAKD,WAAW,IAAI,CAACC,IAAI,GAAG;IAC3C;AAiDF;AA9DA,SAAqBhC,+BA8DpB"}
|
package/dist/esm/fs/chmod.d.ts
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import type { NoParamCallback } from 'fs';
|
|
2
|
+
import type { Entry, ExtractOptions } from '../types.js';
|
|
3
|
+
export default function chmodFn(fullPath: string, entry: Entry, _options: ExtractOptions, callback: NoParamCallback): void;
|
package/dist/esm/fs/chmod.js
CHANGED
|
@@ -7,7 +7,10 @@ const SMODE = 0o755;
|
|
|
7
7
|
const LMODE = 0o644;
|
|
8
8
|
export default function chmodFn(fullPath, entry, _options, callback) {
|
|
9
9
|
const chmod = entry.type === 'symlink' ? fs.lchmod : fs.chmod;
|
|
10
|
-
if (!chmod || UMASK === null)
|
|
10
|
+
if (!chmod || UMASK === null) {
|
|
11
|
+
callback(null);
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
11
14
|
let mode = entry.mode;
|
|
12
15
|
if (!mode) {
|
|
13
16
|
switch(entry.type){
|
package/dist/esm/fs/chmod.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/fs/chmod.ts"],"sourcesContent":["// adapted from https://github.com/mafintosh/tar-fs\n\nimport fs from 'graceful-fs';\n\nconst UMASK = process.umask ? process.umask() : null;\nconst DMODE = 0o755;\nconst FMODE = 0o644;\nconst SMODE = 0o755;\nconst LMODE = 0o644;\n\nexport default function chmodFn(fullPath, entry, _options, callback) {\n const chmod = entry.type === 'symlink' ? fs.lchmod : fs.chmod;\n if (!chmod || UMASK === null)
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/fs/chmod.ts"],"sourcesContent":["// adapted from https://github.com/mafintosh/tar-fs\n\nimport fs from 'graceful-fs';\n\nimport type { NoParamCallback } from 'fs';\nimport type { Entry, ExtractOptions } from '../types.js';\n\nconst UMASK = process.umask ? process.umask() : null;\nconst DMODE = 0o755;\nconst FMODE = 0o644;\nconst SMODE = 0o755;\nconst LMODE = 0o644;\n\nexport default function chmodFn(fullPath: string, entry: Entry, _options: ExtractOptions, callback: NoParamCallback) {\n const chmod = entry.type === 'symlink' ? fs.lchmod : fs.chmod;\n if (!chmod || UMASK === null) {\n callback(null);\n return;\n }\n\n let mode = entry.mode;\n if (!mode) {\n switch (entry.type) {\n case 'directory':\n mode = DMODE;\n break;\n case 'file':\n mode = FMODE;\n break;\n case 'symlink':\n mode = SMODE;\n break;\n case 'link':\n mode = LMODE;\n break;\n }\n }\n chmod(fullPath, (mode as number) & ~UMASK, callback);\n}\n"],"names":["fs","UMASK","process","umask","DMODE","FMODE","SMODE","LMODE","chmodFn","fullPath","entry","_options","callback","chmod","type","lchmod","mode"],"mappings":"AAAA,mDAAmD;AAEnD,OAAOA,QAAQ,cAAc;AAK7B,MAAMC,QAAQC,QAAQC,KAAK,GAAGD,QAAQC,KAAK,KAAK;AAChD,MAAMC,QAAQ;AACd,MAAMC,QAAQ;AACd,MAAMC,QAAQ;AACd,MAAMC,QAAQ;AAEd,eAAe,SAASC,QAAQC,QAAgB,EAAEC,KAAY,EAAEC,QAAwB,EAAEC,QAAyB;IACjH,MAAMC,QAAQH,MAAMI,IAAI,KAAK,YAAYd,GAAGe,MAAM,GAAGf,GAAGa,KAAK;IAC7D,IAAI,CAACA,SAASZ,UAAU,MAAM;QAC5BW,SAAS;QACT;IACF;IAEA,IAAII,OAAON,MAAMM,IAAI;IACrB,IAAI,CAACA,MAAM;QACT,OAAQN,MAAMI,IAAI;YAChB,KAAK;gBACHE,OAAOZ;gBACP;YACF,KAAK;gBACHY,OAAOX;gBACP;YACF,KAAK;gBACHW,OAAOV;gBACP;YACF,KAAK;gBACHU,OAAOT;gBACP;QACJ;IACF;IACAM,MAAMJ,UAAU,AAACO,OAAkB,CAACf,OAAOW;AAC7C"}
|
package/dist/esm/fs/chown.d.ts
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import type { NoParamCallback } from 'fs';
|
|
2
|
+
import type { Entry, ExtractOptions } from '../types.js';
|
|
3
|
+
export default function chownFn(fullPath: string, entry: Entry, _options: ExtractOptions, callback: NoParamCallback): void;
|
package/dist/esm/fs/chown.js
CHANGED
|
@@ -4,6 +4,9 @@ const UID = process.getuid ? process.getuid() : -1;
|
|
|
4
4
|
const OWN = process.platform !== 'win32' && UID === 0;
|
|
5
5
|
export default function chownFn(fullPath, entry, _options, callback) {
|
|
6
6
|
const chown = entry.type === 'symlink' ? fs.lchown : fs.chown;
|
|
7
|
-
if (!chown || !OWN || !entry.uid || !entry.gid)
|
|
7
|
+
if (!chown || !OWN || !entry.uid || !entry.gid) {
|
|
8
|
+
callback(null);
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
8
11
|
chown(fullPath, entry.uid, entry.gid, callback);
|
|
9
12
|
}
|
package/dist/esm/fs/chown.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/fs/chown.ts"],"sourcesContent":["// adapted from https://github.com/mafintosh/tar-fs\n\nimport fs from 'graceful-fs';\n\nconst UID = process.getuid ? process.getuid() : -1;\nconst OWN = process.platform !== 'win32' && UID === 0;\n\nexport default function chownFn(fullPath, entry, _options, callback) {\n const chown = entry.type === 'symlink' ? fs.lchown : fs.chown;\n if (!chown || !OWN || !entry.uid || !entry.gid)
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/fs/chown.ts"],"sourcesContent":["// adapted from https://github.com/mafintosh/tar-fs\n\nimport type { NoParamCallback } from 'fs';\nimport fs from 'graceful-fs';\nimport type { Entry, ExtractOptions } from '../types.js';\n\nconst UID = process.getuid ? process.getuid() : -1;\nconst OWN = process.platform !== 'win32' && UID === 0;\n\nexport default function chownFn(fullPath: string, entry: Entry, _options: ExtractOptions, callback: NoParamCallback) {\n const chown = entry.type === 'symlink' ? fs.lchown : fs.chown;\n if (!chown || !OWN || !entry.uid || !entry.gid) {\n callback(null);\n return;\n }\n chown(fullPath, entry.uid, entry.gid, callback);\n}\n"],"names":["fs","UID","process","getuid","OWN","platform","chownFn","fullPath","entry","_options","callback","chown","type","lchown","uid","gid"],"mappings":"AAAA,mDAAmD;AAGnD,OAAOA,QAAQ,cAAc;AAG7B,MAAMC,MAAMC,QAAQC,MAAM,GAAGD,QAAQC,MAAM,KAAK,CAAC;AACjD,MAAMC,MAAMF,QAAQG,QAAQ,KAAK,WAAWJ,QAAQ;AAEpD,eAAe,SAASK,QAAQC,QAAgB,EAAEC,KAAY,EAAEC,QAAwB,EAAEC,QAAyB;IACjH,MAAMC,QAAQH,MAAMI,IAAI,KAAK,YAAYZ,GAAGa,MAAM,GAAGb,GAAGW,KAAK;IAC7D,IAAI,CAACA,SAAS,CAACP,OAAO,CAACI,MAAMM,GAAG,IAAI,CAACN,MAAMO,GAAG,EAAE;QAC9CL,SAAS;QACT;IACF;IACAC,MAAMJ,UAAUC,MAAMM,GAAG,EAAEN,MAAMO,GAAG,EAAEL;AACxC"}
|
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import { type Stats, type BigIntStats } from 'fs';
|
|
2
|
+
export type Callback = (err: NodeJS.ErrnoException | null, stats?: Stats | BigIntStats) => void;
|
|
3
|
+
export default function lstatReal(path: string, callback: Callback): undefined;
|
package/dist/esm/fs/lstatReal.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import fs from '
|
|
1
|
+
import fs from 'fs';
|
|
2
2
|
export default function lstatReal(path, callback) {
|
|
3
|
-
fs.realpath(path,
|
|
3
|
+
fs.realpath(path, (err, realpath)=>{
|
|
4
4
|
err ? callback(err) : fs.lstat(realpath, callback);
|
|
5
5
|
});
|
|
6
6
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/fs/lstatReal.ts"],"sourcesContent":["import fs from '
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/fs/lstatReal.ts"],"sourcesContent":["import fs, { type Stats, type BigIntStats } from 'fs';\n\nexport type Callback = (err: NodeJS.ErrnoException | null, stats?: Stats | BigIntStats) => void;\n\nexport default function lstatReal(path: string, callback: Callback): undefined {\n fs.realpath(path, (err, realpath) => {\n err ? callback(err) : fs.lstat(realpath, callback);\n });\n}\n"],"names":["fs","lstatReal","path","callback","realpath","err","lstat"],"mappings":"AAAA,OAAOA,QAA0C,KAAK;AAItD,eAAe,SAASC,UAAUC,IAAY,EAAEC,QAAkB;IAChEH,GAAGI,QAAQ,CAACF,MAAM,CAACG,KAAKD;QACtBC,MAAMF,SAASE,OAAOL,GAAGM,KAAK,CAACF,UAAUD;IAC3C;AACF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import fs from 'graceful-fs';
|
|
2
|
+
import lstatReal from './lstatReal.js';
|
|
3
|
+
export default function symlinkWin32(linkFullPath, linkpath, fullPath, callback) {
|
|
4
|
+
lstatReal(linkFullPath, (err, targetStat)=>{
|
|
5
|
+
if (err || !targetStat) return callback(err || new Error(`Symlink path does not exist${linkFullPath}`));
|
|
6
|
+
const type = targetStat.isDirectory() ? 'dir' : 'file';
|
|
7
|
+
fs.symlink(linkpath, fullPath, type, callback);
|
|
8
|
+
});
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/fs/symlinkWin32.ts"],"sourcesContent":["import fs from 'graceful-fs';\n\nimport type { NoParamCallback } from 'fs';\nimport lstatReal from './lstatReal.js';\n\nexport default function symlinkWin32(linkFullPath: string, linkpath: string, fullPath: string, callback: NoParamCallback) {\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}\n"],"names":["fs","lstatReal","symlinkWin32","linkFullPath","linkpath","fullPath","callback","err","targetStat","Error","type","isDirectory","symlink"],"mappings":"AAAA,OAAOA,QAAQ,cAAc;AAG7B,OAAOC,eAAe,iBAAiB;AAEvC,eAAe,SAASC,aAAaC,YAAoB,EAAEC,QAAgB,EAAEC,QAAgB,EAAEC,QAAyB;IACtHL,UAAUE,cAAc,CAACI,KAAKC;QAC5B,IAAID,OAAO,CAACC,YAAY,OAAOF,SAASC,OAAO,IAAIE,MAAM,CAAC,2BAA2B,EAAEN,cAAc;QACrG,MAAMO,OAAOF,WAAWG,WAAW,KAAK,QAAQ;QAChDX,GAAGY,OAAO,CAACR,UAAUC,UAAUK,MAAMJ;IACvC;AACF"}
|
package/dist/esm/fs/utimes.d.ts
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import type { NoParamCallback } from 'fs';
|
|
2
|
+
import type { Entry, ExtractOptions } from '../types.js';
|
|
3
|
+
export default function utimes(fullPath: string, entry: Entry, options: ExtractOptions, callback: NoParamCallback): undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/fs/utimes.ts"],"sourcesContent":["// adapted from https://github.com/mafintosh/tar-fs\n\nimport fs from 'graceful-fs';\n\nexport default function utimes(fullPath, entry, options, callback) {\n const now = options.now || new Date();\n fs.utimes(fullPath, now, new Date(entry.mtime), callback);\n}\n"],"names":["fs","utimes","fullPath","entry","options","callback","now","Date","mtime"],"mappings":"AAAA,mDAAmD;AAEnD,OAAOA,QAAQ,cAAc;
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/fs/utimes.ts"],"sourcesContent":["// adapted from https://github.com/mafintosh/tar-fs\n\nimport fs from 'graceful-fs';\n\nimport type { NoParamCallback } from 'fs';\nimport type { Entry, ExtractOptions } from '../types.js';\n\nexport default function utimes(fullPath: string, entry: Entry, options: ExtractOptions, callback: NoParamCallback): undefined {\n const now = options.now || new Date();\n fs.utimes(fullPath, now, new Date(entry.mtime), callback);\n}\n"],"names":["fs","utimes","fullPath","entry","options","callback","now","Date","mtime"],"mappings":"AAAA,mDAAmD;AAEnD,OAAOA,QAAQ,cAAc;AAK7B,eAAe,SAASC,OAAOC,QAAgB,EAAEC,KAAY,EAAEC,OAAuB,EAAEC,QAAyB;IAC/G,MAAMC,MAAMF,QAAQE,GAAG,IAAI,IAAIC;IAC/BP,GAAGC,MAAM,CAACC,UAAUI,KAAK,IAAIC,KAAKJ,MAAMK,KAAK,GAAGH;AAClD"}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import './polyfills.js';
|
|
1
2
|
import StackBaseIterator from 'stack-base-iterator';
|
|
2
3
|
export default StackBaseIterator;
|
|
4
|
+
export { default as waitForAccess } from './waitForAccess.js';
|
|
3
5
|
export { default as DirectoryEntry } from './DirectoryEntry.js';
|
|
4
6
|
export { default as FileEntry } from './FileEntry.js';
|
|
5
7
|
export { default as LinkEntry } from './LinkEntry.js';
|
package/dist/esm/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import './polyfills.js';
|
|
1
2
|
import StackBaseIterator from 'stack-base-iterator';
|
|
2
3
|
export default StackBaseIterator;
|
|
4
|
+
export { default as waitForAccess } from './waitForAccess.js';
|
|
3
5
|
export { default as DirectoryEntry } from './DirectoryEntry.js';
|
|
4
6
|
export { default as FileEntry } from './FileEntry.js';
|
|
5
7
|
export { default as LinkEntry } from './LinkEntry.js';
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/index.ts"],"sourcesContent":["import StackBaseIterator from 'stack-base-iterator';\n\nexport default StackBaseIterator;\nexport { default as DirectoryEntry } from './DirectoryEntry.js';\nexport { default as FileEntry } from './FileEntry.js';\nexport { default as LinkEntry } from './LinkEntry.js';\nexport { default as SymbolicLinkEntry } from './SymbolicLinkEntry.js';\nexport * from './types.js';\n"],"names":["StackBaseIterator","default","DirectoryEntry","FileEntry","LinkEntry","SymbolicLinkEntry"],"mappings":"AAAA,OAAOA,uBAAuB,sBAAsB;AAEpD,eAAeA,kBAAkB;AACjC,SAASC,WAAWC,
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/index.ts"],"sourcesContent":["import './polyfills.js';\nimport StackBaseIterator from 'stack-base-iterator';\n\nexport default StackBaseIterator;\nexport { default as waitForAccess } from './waitForAccess.js';\nexport { default as DirectoryEntry } from './DirectoryEntry.js';\nexport { default as FileEntry } from './FileEntry.js';\nexport { default as LinkEntry } from './LinkEntry.js';\nexport { default as SymbolicLinkEntry } from './SymbolicLinkEntry.js';\nexport * from './types.js';\n"],"names":["StackBaseIterator","default","waitForAccess","DirectoryEntry","FileEntry","LinkEntry","SymbolicLinkEntry"],"mappings":"AAAA,OAAO,iBAAiB;AACxB,OAAOA,uBAAuB,sBAAsB;AAEpD,eAAeA,kBAAkB;AACjC,SAASC,WAAWC,aAAa,QAAQ,qBAAqB;AAC9D,SAASD,WAAWE,cAAc,QAAQ,sBAAsB;AAChE,SAASF,WAAWG,SAAS,QAAQ,iBAAiB;AACtD,SAASH,WAAWI,SAAS,QAAQ,iBAAiB;AACtD,SAASJ,WAAWK,iBAAiB,QAAQ,yBAAyB;AACtE,cAAc,aAAa"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/polyfills.ts"],"sourcesContent":["import Module from 'module';\n\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\n\nif (typeof setImmediate === 'undefined') global.setImmediate = _require('next-tick');\n"],"names":["Module","_require","require","createRequire","url","setImmediate","global"],"mappings":"AAAA,OAAOA,YAAY,SAAS;AAE5B,MAAMC,WAAW,OAAOC,YAAY,cAAcF,OAAOG,aAAa,CAAC,YAAYC,GAAG,IAAIF;AAE1F,IAAI,OAAOG,iBAAiB,aAAaC,OAAOD,YAAY,GAAGJ,SAAS"}
|
package/dist/esm/stripPath.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import type { ExtractOptions } from './types.js';
|
|
2
|
+
export default function stripPath(relativePath: string, options: ExtractOptions): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/stripPath.ts"],"sourcesContent":["import path from 'path';\nimport compact from 'lodash.compact';\n\nexport default function stripPath(relativePath, options) {\n const strip = options.strip || 0;\n if (!strip) return relativePath;\n const parts = compact(relativePath.split(path.sep));\n if (parts.length < strip) throw new Error(`You cannot strip more levels than there are directories. Strip: ${strip}. Path: ${relativePath}`);\n return parts.slice(strip).join(path.sep);\n}\n"],"names":["path","compact","stripPath","relativePath","options","strip","parts","split","sep","length","Error","slice","join"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,OAAOC,aAAa,iBAAiB;
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/stripPath.ts"],"sourcesContent":["import path from 'path';\nimport compact from 'lodash.compact';\n\nimport type { ExtractOptions } from './types.js';\n\nexport default function stripPath(relativePath: string, options: ExtractOptions): string {\n const strip = options.strip || 0;\n if (!strip) return relativePath;\n const parts = compact(relativePath.split(path.sep));\n if (parts.length < strip) throw new Error(`You cannot strip more levels than there are directories. Strip: ${strip}. Path: ${relativePath}`);\n return parts.slice(strip).join(path.sep);\n}\n"],"names":["path","compact","stripPath","relativePath","options","strip","parts","split","sep","length","Error","slice","join"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,OAAOC,aAAa,iBAAiB;AAIrC,eAAe,SAASC,UAAUC,YAAoB,EAAEC,OAAuB;IAC7E,MAAMC,QAAQD,QAAQC,KAAK,IAAI;IAC/B,IAAI,CAACA,OAAO,OAAOF;IACnB,MAAMG,QAAQL,QAAQE,aAAaI,KAAK,CAACP,KAAKQ,GAAG;IACjD,IAAIF,MAAMG,MAAM,GAAGJ,OAAO,MAAM,IAAIK,MAAM,CAAC,gEAAgE,EAAEL,MAAM,QAAQ,EAAEF,cAAc;IAC3I,OAAOG,MAAMK,KAAK,CAACN,OAAOO,IAAI,CAACZ,KAAKQ,GAAG;AACzC"}
|