extract-base-iterator 2.7.0 → 3.0.0
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 +3 -1
- package/dist/cjs/DirectoryEntry.d.ts +3 -1
- package/dist/cjs/DirectoryEntry.js.map +1 -1
- package/dist/cjs/FileEntry.d.cts +3 -1
- package/dist/cjs/FileEntry.d.ts +3 -1
- package/dist/cjs/FileEntry.js.map +1 -1
- package/dist/cjs/LinkEntry.d.cts +3 -1
- package/dist/cjs/LinkEntry.d.ts +3 -1
- package/dist/cjs/LinkEntry.js.map +1 -1
- package/dist/cjs/SymbolicLinkEntry.d.cts +3 -1
- package/dist/cjs/SymbolicLinkEntry.d.ts +3 -1
- package/dist/cjs/SymbolicLinkEntry.js.map +1 -1
- package/dist/cjs/fs/chmod.js +1 -4
- package/dist/cjs/fs/chmod.js.map +1 -1
- package/dist/cjs/fs/chown.js +1 -4
- package/dist/cjs/fs/chown.js.map +1 -1
- package/dist/cjs/fs/lstatReal.d.cts +1 -1
- package/dist/cjs/fs/lstatReal.d.ts +1 -1
- package/dist/cjs/fs/lstatReal.js.map +1 -1
- package/dist/cjs/fs/lutimes.d.cts +1 -1
- package/dist/cjs/fs/lutimes.d.ts +1 -1
- package/dist/cjs/fs/lutimes.js.map +1 -1
- package/dist/cjs/fs/utimes.d.cts +1 -1
- package/dist/cjs/fs/utimes.d.ts +1 -1
- package/dist/cjs/fs/utimes.js.map +1 -1
- package/dist/cjs/shared/streamToString.d.cts +1 -1
- package/dist/cjs/shared/streamToString.d.ts +1 -1
- package/dist/cjs/shared/streamToString.js.map +1 -1
- 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/esm/DirectoryEntry.d.ts +3 -1
- package/dist/esm/DirectoryEntry.js.map +1 -1
- package/dist/esm/FileEntry.d.ts +3 -1
- package/dist/esm/FileEntry.js.map +1 -1
- package/dist/esm/LinkEntry.d.ts +3 -1
- package/dist/esm/LinkEntry.js.map +1 -1
- package/dist/esm/SymbolicLinkEntry.d.ts +3 -1
- package/dist/esm/SymbolicLinkEntry.js.map +1 -1
- package/dist/esm/fs/chmod.js +1 -4
- package/dist/esm/fs/chmod.js.map +1 -1
- package/dist/esm/fs/chown.js +1 -4
- package/dist/esm/fs/chown.js.map +1 -1
- package/dist/esm/fs/lstatReal.d.ts +1 -1
- package/dist/esm/fs/lstatReal.js.map +1 -1
- package/dist/esm/fs/lutimes.d.ts +1 -1
- package/dist/esm/fs/lutimes.js.map +1 -1
- package/dist/esm/fs/utimes.d.ts +1 -1
- package/dist/esm/fs/utimes.js.map +1 -1
- package/dist/esm/shared/streamToString.d.ts +1 -1
- package/dist/esm/shared/streamToString.js.map +1 -1
- package/dist/esm/validateAttributes.d.ts +1 -1
- package/dist/esm/validateAttributes.js.map +1 -1
- package/package.json +3 -3
|
@@ -7,6 +7,8 @@ export default class DirectoryEntry {
|
|
|
7
7
|
basename: string;
|
|
8
8
|
type: string;
|
|
9
9
|
constructor(attributes: DirectoryAttributes);
|
|
10
|
-
create(dest: string,
|
|
10
|
+
create(dest: string, callback: NoParamCallback): void;
|
|
11
|
+
create(dest: string, options: ExtractOptions, callback: NoParamCallback): void;
|
|
12
|
+
create(dest: string, options?: ExtractOptions): Promise<boolean>;
|
|
11
13
|
destroy(): void;
|
|
12
14
|
}
|
|
@@ -7,6 +7,8 @@ export default class DirectoryEntry {
|
|
|
7
7
|
basename: string;
|
|
8
8
|
type: string;
|
|
9
9
|
constructor(attributes: DirectoryAttributes);
|
|
10
|
-
create(dest: string,
|
|
10
|
+
create(dest: string, callback: NoParamCallback): void;
|
|
11
|
+
create(dest: string, options: ExtractOptions, callback: NoParamCallback): void;
|
|
12
|
+
create(dest: string, options?: ExtractOptions): Promise<boolean>;
|
|
11
13
|
destroy(): void;
|
|
12
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/DirectoryEntry.ts"],"sourcesContent":["import mkdirp from 'mkdirp-classic';\nimport path from 'path';\nimport Queue from 'queue-cb';\nimport chmod from './fs/chmod.ts';\nimport chown from './fs/chown.ts';\nimport utimes from './fs/utimes.ts';\nimport { objectAssign } from './shared/index.ts';\nimport stripPath from './stripPath.ts';\nimport validateAttributes from './validateAttributes.ts';\nimport waitForAccess from './waitForAccess.ts';\n\nconst MANDATORY_ATTRIBUTES = ['mode', 'mtime', 'path'];\n\nimport type { Mode } from 'fs';\nimport type { DirectoryAttributes, ExtractOptions, NoParamCallback } from './types.ts';\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):
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/DirectoryEntry.ts"],"sourcesContent":["import mkdirp from 'mkdirp-classic';\nimport path from 'path';\nimport Queue from 'queue-cb';\nimport chmod from './fs/chmod.ts';\nimport chown from './fs/chown.ts';\nimport utimes from './fs/utimes.ts';\nimport { objectAssign } from './shared/index.ts';\nimport stripPath from './stripPath.ts';\nimport validateAttributes from './validateAttributes.ts';\nimport waitForAccess from './waitForAccess.ts';\n\nconst MANDATORY_ATTRIBUTES = ['mode', 'mtime', 'path'];\n\nimport type { Mode } from 'fs';\nimport type { DirectoryAttributes, ExtractOptions, NoParamCallback } from './types.ts';\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, callback: NoParamCallback): void;\n create(dest: string, options: ExtractOptions, callback: NoParamCallback): void;\n create(dest: string, options?: ExtractOptions): Promise<boolean>;\n create(dest: string, options?: ExtractOptions | NoParamCallback, callback?: NoParamCallback): void | 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(waitForAccess.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 as ExtractOptions, (err?: Error, done?: boolean) => (err ? reject(err) : resolve(done)));\n });\n }\n\n destroy() {}\n}\n"],"names":["DirectoryEntry","MANDATORY_ATTRIBUTES","attributes","validateAttributes","objectAssign","type","undefined","basename","path","create","dest","options","callback","normalizedPath","normalize","fullPath","join","stripPath","queue","Queue","defer","mkdirp","bind","waitForAccess","chmod","chown","utimes","await","err","Promise","resolve","reject","done","destroy"],"mappings":";;;;;;;eAgBqBA;;;oEAhBF;2DACF;8DACC;8DACA;8DACA;+DACC;uBACU;kEACP;2EACS;sEACL;;;;;;;;;;;AAE1B,IAAMC,uBAAuB;IAAC;IAAQ;IAAS;CAAO;AAKvC,IAAA,AAAMD,+BAAN;;aAAMA,eAOPE,UAA+B;gCAPxBF;QAQjBG,IAAAA,6BAAkB,EAACD,YAAYD;QAC/BG,IAAAA,qBAAY,EAAC,IAAI,EAAEF;QACnB,IAAI,IAAI,CA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A,WAAW;WAjDQjC"}
|
package/dist/cjs/FileEntry.d.cts
CHANGED
|
@@ -7,6 +7,8 @@ export default class FileEntry {
|
|
|
7
7
|
basename: string;
|
|
8
8
|
type: string;
|
|
9
9
|
constructor(attributes: FileAttributes);
|
|
10
|
-
create(dest: string,
|
|
10
|
+
create(dest: string, callback: NoParamCallback): void;
|
|
11
|
+
create(dest: string, options: ExtractOptions, callback: NoParamCallback): void;
|
|
12
|
+
create(dest: string, options?: ExtractOptions): Promise<boolean>;
|
|
11
13
|
destroy(): void;
|
|
12
14
|
}
|
package/dist/cjs/FileEntry.d.ts
CHANGED
|
@@ -7,6 +7,8 @@ export default class FileEntry {
|
|
|
7
7
|
basename: string;
|
|
8
8
|
type: string;
|
|
9
9
|
constructor(attributes: FileAttributes);
|
|
10
|
-
create(dest: string,
|
|
10
|
+
create(dest: string, callback: NoParamCallback): void;
|
|
11
|
+
create(dest: string, options: ExtractOptions, callback: NoParamCallback): void;
|
|
12
|
+
create(dest: string, options?: ExtractOptions): Promise<boolean>;
|
|
11
13
|
destroy(): void;
|
|
12
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/FileEntry.ts"],"sourcesContent":["import fs from 'fs';\nimport { rm } from 'fs-remove-compat';\nimport mkdirp from 'mkdirp-classic';\nimport path from 'path';\nimport Queue from 'queue-cb';\nimport chmod from './fs/chmod.ts';\nimport chown from './fs/chown.ts';\nimport utimes from './fs/utimes.ts';\nimport { objectAssign } from './shared/index.ts';\nimport stripPath from './stripPath.ts';\nimport validateAttributes from './validateAttributes.ts';\n\nconst MANDATORY_ATTRIBUTES = ['mode', 'mtime', 'path'];\n\nimport type { Mode } from 'fs';\nimport type { ExtractOptions, FileAttributes, NoParamCallback, WriteFileFn } from './types.ts';\n\ninterface AbstractFileEntry {\n _writeFile: WriteFileFn;\n}\n\nexport default class FileEntry {\n mode: Mode;\n mtime: number;\n path: string;\n basename: string;\n type: string;\n\n constructor(attributes: FileAttributes) {\n validateAttributes(attributes, MANDATORY_ATTRIBUTES);\n objectAssign(this, attributes);\n if (this.basename === undefined) this.basename = path.basename(this.path);\n if (this.type === undefined) this.type = 'file';\n if ((this as unknown as AbstractFileEntry)._writeFile === undefined) throw new Error('File this missing _writeFile. Please implement this method in your subclass');\n }\n\n create(dest: string, options: ExtractOptions | NoParamCallback, callback?: NoParamCallback):
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/FileEntry.ts"],"sourcesContent":["import fs from 'fs';\nimport { rm } from 'fs-remove-compat';\nimport mkdirp from 'mkdirp-classic';\nimport path from 'path';\nimport Queue from 'queue-cb';\nimport chmod from './fs/chmod.ts';\nimport chown from './fs/chown.ts';\nimport utimes from './fs/utimes.ts';\nimport { objectAssign } from './shared/index.ts';\nimport stripPath from './stripPath.ts';\nimport validateAttributes from './validateAttributes.ts';\n\nconst MANDATORY_ATTRIBUTES = ['mode', 'mtime', 'path'];\n\nimport type { Mode } from 'fs';\nimport type { ExtractOptions, FileAttributes, NoParamCallback, WriteFileFn } from './types.ts';\n\ninterface AbstractFileEntry {\n _writeFile: WriteFileFn;\n}\n\nexport default class FileEntry {\n mode: Mode;\n mtime: number;\n path: string;\n basename: string;\n type: string;\n\n constructor(attributes: FileAttributes) {\n validateAttributes(attributes, MANDATORY_ATTRIBUTES);\n objectAssign(this, attributes);\n if (this.basename === undefined) this.basename = path.basename(this.path);\n if (this.type === undefined) this.type = 'file';\n if ((this as unknown as AbstractFileEntry)._writeFile === undefined) throw new Error('File this missing _writeFile. Please implement this method in your subclass');\n }\n\n create(dest: string, callback: NoParamCallback): void;\n create(dest: string, options: ExtractOptions, callback: NoParamCallback): void;\n create(dest: string, options?: ExtractOptions): Promise<boolean>;\n create(dest: string, options?: ExtractOptions | NoParamCallback, callback?: NoParamCallback): void | Promise<boolean> {\n if (typeof options === 'function') {\n callback = options;\n options = null;\n }\n\n if (typeof callback === 'function') {\n options = options || {};\n try {\n const normalizedPath = path.normalize(this.path);\n const fullPath = path.join(dest, stripPath(normalizedPath, options as ExtractOptions));\n\n const queue = new Queue(1);\n if ((options as ExtractOptions).force) {\n queue.defer((callback) => {\n rm(fullPath, (err) => {\n err && err.code !== 'ENOENT' ? callback(err) : callback();\n });\n });\n } else {\n // Check if file exists - throw EEXIST if it does\n queue.defer((callback) => {\n fs.stat(fullPath, (err) => {\n if (!err) {\n const existsErr = new Error(`EEXIST: file already exists, open '${fullPath}'`) as NodeJS.ErrnoException;\n existsErr.code = 'EEXIST';\n existsErr.path = fullPath;\n return callback(existsErr);\n }\n // ENOENT means file doesn't exist - that's what we want\n if (err.code === 'ENOENT') return callback();\n // Other errors should be reported\n callback(err);\n });\n });\n }\n queue.defer(mkdirp.bind(null, path.dirname(fullPath)));\n queue.defer((this as unknown as AbstractFileEntry)._writeFile.bind(this, fullPath, options));\n queue.defer(chmod.bind(null, fullPath, this, options));\n queue.defer(chown.bind(null, fullPath, this, options));\n queue.defer(utimes.bind(null, fullPath, this, options));\n queue.await(callback);\n return;\n } catch (err) {\n callback(err);\n return;\n }\n }\n\n return new Promise((resolve, reject) => {\n this.create(dest, options as ExtractOptions, (err?: Error, done?: boolean) => (err ? reject(err) : resolve(done)));\n });\n }\n\n destroy() {}\n}\n"],"names":["FileEntry","MANDATORY_ATTRIBUTES","attributes","validateAttributes","objectAssign","basename","undefined","path","type","_writeFile","Error","create","dest","options","callback","normalizedPath","normalize","fullPath","join","stripPath","queue","Queue","force","defer","rm","err","code","fs","stat","existsErr","mkdirp","bind","dirname","chmod","chown","utimes","await","Promise","resolve","reject","done","destroy"],"mappings":";;;;;;;eAqBqBA;;;yDArBN;8BACI;oEACA;2DACF;8DACC;8DACA;8DACA;+DACC;uBACU;kEACP;2EACS;;;;;;;;;;;AAE/B,IAAMC,uBAAuB;IAAC;IAAQ;IAAS;CAAO;AASvC,IAAA,AAAMD,0BAAN;;aAAMA,UAOPE,UAA0B;gC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ACxD,IAAIJ,IAAIC,IAAI,KAAK,UAAU,OAAOZ;4BAClC,kCAAkC;4BAClCA,SAASW;wBACX;oBACF;gBACF;gBACAL,MAAMG,KAAK,CAACO,sBAAM,CAACC,IAAI,CAAC,MAAMxB,aAAI,CAACyB,OAAO,CAACf;gBAC3CG,MAAMG,KAAK,CAAC,AAAC,IAAI,CAAkCd,UAAU,CAACsB,IAAI,CAAC,IAAI,EAAEd,UAAUJ;gBACnFO,MAAMG,KAAK,CAACU,gBAAK,CAACF,IAAI,CAAC,MAAMd,UAAU,IAAI,EAAEJ;gBAC7CO,MAAMG,KAAK,CAACW,gBAAK,CAACH,IAAI,CAAC,MAAMd,UAAU,IAAI,EAAEJ;gBAC7CO,MAAMG,KAAK,CAACY,iBAAM,CAACJ,IAAI,CAAC,MAAMd,UAAU,IAAI,EAAEJ;gBAC9CO,MAAMgB,KAAK,CAACtB;gBACZ;YACF,EAAE,OAAOW,KAAK;gBACZX,SAASW;gBACT;YACF;QACF;QAEA,OAAO,IAAIY,QAAQ,SAACC,SAASC;YAC3B,MAAK5B,MAAM,CAACC,MAAMC,SAA2B,SAACY,KAAae;uBAAoBf,MAAMc,OAAOd,OAAOa,QAAQE;;QAC7G;IACF;IAEAC,OAAAA,OAAY,GAAZA,SAAAA,WAAW;WAxEQzC"}
|
package/dist/cjs/LinkEntry.d.cts
CHANGED
|
@@ -8,6 +8,8 @@ export default class LinkEntry {
|
|
|
8
8
|
basename: string;
|
|
9
9
|
type: string;
|
|
10
10
|
constructor(attributes: LinkAttributes);
|
|
11
|
-
create(dest: string,
|
|
11
|
+
create(dest: string, callback: NoParamCallback): void;
|
|
12
|
+
create(dest: string, options: ExtractOptions, callback: NoParamCallback): void;
|
|
13
|
+
create(dest: string, options?: ExtractOptions): Promise<boolean>;
|
|
12
14
|
destroy(): void;
|
|
13
15
|
}
|
package/dist/cjs/LinkEntry.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ export default class LinkEntry {
|
|
|
8
8
|
basename: string;
|
|
9
9
|
type: string;
|
|
10
10
|
constructor(attributes: LinkAttributes);
|
|
11
|
-
create(dest: string,
|
|
11
|
+
create(dest: string, callback: NoParamCallback): void;
|
|
12
|
+
create(dest: string, options: ExtractOptions, callback: NoParamCallback): void;
|
|
13
|
+
create(dest: string, options?: ExtractOptions): Promise<boolean>;
|
|
12
14
|
destroy(): void;
|
|
13
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/LinkEntry.ts"],"sourcesContent":["import { rm } from 'fs-remove-compat';\nimport fs from 'graceful-fs';\nimport mkdirp from 'mkdirp-classic';\nimport path from 'path';\nimport Queue from 'queue-cb';\nimport chmod from './fs/chmod.ts';\nimport chown from './fs/chown.ts';\nimport utimes from './fs/utimes.ts';\nimport { objectAssign } from './shared/index.ts';\nimport stripPath from './stripPath.ts';\nimport validateAttributes from './validateAttributes.ts';\nimport waitForAccess from './waitForAccess.ts';\n\nconst MANDATORY_ATTRIBUTES = ['mode', 'mtime', 'path', 'linkpath'];\n\nimport type { Mode } from 'fs';\nimport type { ExtractOptions, LinkAttributes, NoParamCallback } from './types.ts';\n\nexport default class 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):
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/LinkEntry.ts"],"sourcesContent":["import { rm } from 'fs-remove-compat';\nimport fs from 'graceful-fs';\nimport mkdirp from 'mkdirp-classic';\nimport path from 'path';\nimport Queue from 'queue-cb';\nimport chmod from './fs/chmod.ts';\nimport chown from './fs/chown.ts';\nimport utimes from './fs/utimes.ts';\nimport { objectAssign } from './shared/index.ts';\nimport stripPath from './stripPath.ts';\nimport validateAttributes from './validateAttributes.ts';\nimport waitForAccess from './waitForAccess.ts';\n\nconst MANDATORY_ATTRIBUTES = ['mode', 'mtime', 'path', 'linkpath'];\n\nimport type { Mode } from 'fs';\nimport type { ExtractOptions, LinkAttributes, NoParamCallback } from './types.ts';\n\nexport default class 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, callback: NoParamCallback): void;\n create(dest: string, options: ExtractOptions, callback: NoParamCallback): void;\n create(dest: string, options?: ExtractOptions): Promise<boolean>;\n create(dest: string, options?: ExtractOptions | NoParamCallback, callback?: NoParamCallback): void | 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 rm(fullPath, (err) => {\n err && err.code !== 'ENOENT' ? callback(err) : callback();\n });\n });\n }\n queue.defer(mkdirp.bind(null, path.dirname(fullPath)));\n queue.defer(fs.link.bind(fs, linkFullPath, fullPath));\n queue.defer(waitForAccess.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 as ExtractOptions, (err?: Error, done?: boolean) => (err ? reject(err) : resolve(done)));\n });\n }\n\n destroy() {}\n}\n"],"names":["LinkEntry","MANDATORY_ATTRIBUTES","attributes","validateAttributes","objectAssign","basename","undefined","path","type","create","dest","options","callback","normalizedPath","normalize","fullPath","join","stripPath","normalizedLinkpath","linkpath","linkFullPath","queue","Queue","force","defer","rm","err","code","mkdirp","bind","dirname","fs","link","waitForAccess","chmod","chown","utimes","await","Promise","resolve","reject","done","destroy"],"mappings":";;;;;;;eAkBqBA;;;8BAlBF;iEACJ;oEACI;2DACF;8DACC;8DACA;8DACA;+DACC;uBACU;kEACP;2EACS;sEACL;;;;;;;;;;;AAE1B,IAAMC,uBAAuB;IAAC;IAAQ;IAAS;IAAQ;CAAW;AAKnD,IAAA,AAAMD,0BAAN;;aAAMA,UAQPE,UAA0B;gCARnBF;QASjBG,IAAAA,6BAAkB,EAACD,YAAYD;QAC/BG,IAAAA,qBAAY,EAAC,IAAI,EAAEF;QACnB,IAAI,IAAI,CAACG,QAAQ,KAAKC,WAAW,IAAI,CAACD,QAAQ,GAAGE,aAAI,CAACF,QAAQ,CAAC,IAAI,CAACE,IAAI;QACxE,IAAI,IAAI,CAACC,IAAI,KAAKF,WAAW,IAAI,CAACE,IAAI,GAAG;;iBAZxBR;IAkBnBS,OAAAA,MAuCC,GAvCDA,SAAAA,OAAOC,IAAY,EAAEC,OAA0C,EAAEC,QAA0B;;QACzF,IAAI,OAAOD,YAAY,YAAY;YACjCC,WAAWD;YACXA,UAAU;QACZ;QAEA,IAAI,OAAOC,aAAa,YAAY;YAClCD,UAAUA,WAAW,CAAC;YACtB,IAAI;gBACF,IAAME,iBAAiBN,aAAI,CAACO,SAAS,CAAC,IAAI,CAACP,IAAI;gBAC/C,IAAMQ,WAAWR,aAAI,CAACS,IAAI,CAACN,MAAMO,IAAAA,oBAAS,EAACJ,gBAAgBF;gBAC3D,IAAMO,qBAAqBX,aAAI,CAACO,SAAS,CAAC,IAAI,CAACK,QAAQ;gBACvD,IAAMC,eAAeb,aAAI,CAACS,IAAI,CAACN,MAAMO,IAAAA,oBAAS,EAACC,oBAAoBP;gBAEnE,IAAMU,QAAQ,IAAIC,gBAAK,CAAC;gBACxB,IAAI,AAACX,QAA2BY,KAAK,EAAE;oBACrCF,MAAMG,KAAK,CAAC,SAACZ;wBACXa,IAAAA,kBAAE,EAACV,UAAU,SAACW;4BACZA,OAAOA,IAAIC,IAAI,KAAK,WAAWf,SAASc,OAAOd;wBACjD;oBACF;gBACF;gBACAS,MAAMG,KAAK,CAACI,sBAAM,CAACC,IAAI,CAAC,MAAMtB,aAAI,CAACuB,OAAO,CAACf;gBAC3CM,MAAMG,KAAK,CAACO,mBAAE,CAACC,IAAI,CAACH,IAAI,CAACE,mBAAE,EAAEX,cAAcL;gBAC3CM,MAAMG,KAAK,CAACS,wBAAa,CAACJ,IAAI,CAAC,MAAMd;gBACrCM,MAAMG,KAAK,CAACU,gBAAK,CAACL,IAAI,CAAC,MAAMd,UAAU,IAAI,EAAEJ;gBAC7CU,MAAMG,KAAK,CAACW,gBAAK,CAACN,IAAI,CAAC,MAAMd,UAAU,IAAI,EAAEJ;gBAC7CU,MAAMG,KAAK,CAACY,iBAAM,CAACP,IAAI,CAAC,MAAMd,UAAU,IAAI,EAAEJ;gBAC9CU,MAAMgB,KAAK,CAACzB;gBACZ;YACF,EAAE,OAAOc,KAAK;gBACZd,SAASc;gBACT;YACF;QACF;QAEA,OAAO,IAAIY,QAAQ,SAACC,SAASC;YAC3B,MAAK/B,MAAM,CAACC,MAAMC,SAA2B,SAACe,KAAae;uBAAoBf,MAAMc,OAAOd,OAAOa,QAAQE;;QAC7G;IACF;IAEAC,OAAAA,OAAY,GAAZA,SAAAA,WAAW;WA3DQ1C"}
|
|
@@ -8,6 +8,8 @@ export default class SymbolicLinkEntry {
|
|
|
8
8
|
basename: string;
|
|
9
9
|
type: string;
|
|
10
10
|
constructor(attributes: LinkAttributes);
|
|
11
|
-
create(dest: string,
|
|
11
|
+
create(dest: string, callback: NoParamCallback): void;
|
|
12
|
+
create(dest: string, options: ExtractOptions, callback: NoParamCallback): void;
|
|
13
|
+
create(dest: string, options?: ExtractOptions): Promise<boolean>;
|
|
12
14
|
destroy(): void;
|
|
13
15
|
}
|
|
@@ -8,6 +8,8 @@ export default class SymbolicLinkEntry {
|
|
|
8
8
|
basename: string;
|
|
9
9
|
type: string;
|
|
10
10
|
constructor(attributes: LinkAttributes);
|
|
11
|
-
create(dest: string,
|
|
11
|
+
create(dest: string, callback: NoParamCallback): void;
|
|
12
|
+
create(dest: string, options: ExtractOptions, callback: NoParamCallback): void;
|
|
13
|
+
create(dest: string, options?: ExtractOptions): Promise<boolean>;
|
|
12
14
|
destroy(): void;
|
|
13
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/SymbolicLinkEntry.ts"],"sourcesContent":["import { rm } from 'fs-remove-compat';\nimport fs from 'graceful-fs';\nimport isAbsolute from 'is-absolute';\nimport mkdirp from 'mkdirp-classic';\nimport path from 'path';\nimport Queue from 'queue-cb';\nimport chmod from './fs/chmod.ts';\nimport chown from './fs/chown.ts';\nimport lutimes from './fs/lutimes.ts';\nimport symlinkWin32 from './fs/symlinkWin32.ts';\nimport { objectAssign } from './shared/index.ts';\nimport stripPath from './stripPath.ts';\nimport validateAttributes from './validateAttributes.ts';\nimport waitForAccess from './waitForAccess.ts';\n\nconst isWindows = process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE);\n\nconst MANDATORY_ATTRIBUTES = ['mode', 'mtime', 'path', 'linkpath'];\n\nimport type { Mode } from 'fs';\nimport type { ExtractOptions, LinkAttributes, NoParamCallback } from './types.ts';\n\nexport default class SymbolicLinkEntry {\n mode: Mode;\n mtime: number;\n path: string;\n linkpath: string;\n basename: string;\n type: string;\n\n constructor(attributes: LinkAttributes) {\n validateAttributes(attributes, MANDATORY_ATTRIBUTES);\n objectAssign(this, attributes);\n if (this.basename === undefined) this.basename = path.basename(this.path);\n if (this.type === undefined) this.type = 'symlink';\n }\n\n create(dest: string, options: ExtractOptions | NoParamCallback, callback?: NoParamCallback):
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/SymbolicLinkEntry.ts"],"sourcesContent":["import { rm } from 'fs-remove-compat';\nimport fs from 'graceful-fs';\nimport isAbsolute from 'is-absolute';\nimport mkdirp from 'mkdirp-classic';\nimport path from 'path';\nimport Queue from 'queue-cb';\nimport chmod from './fs/chmod.ts';\nimport chown from './fs/chown.ts';\nimport lutimes from './fs/lutimes.ts';\nimport symlinkWin32 from './fs/symlinkWin32.ts';\nimport { objectAssign } from './shared/index.ts';\nimport stripPath from './stripPath.ts';\nimport validateAttributes from './validateAttributes.ts';\nimport waitForAccess from './waitForAccess.ts';\n\nconst isWindows = process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE);\n\nconst MANDATORY_ATTRIBUTES = ['mode', 'mtime', 'path', 'linkpath'];\n\nimport type { Mode } from 'fs';\nimport type { ExtractOptions, LinkAttributes, NoParamCallback } from './types.ts';\n\nexport default class SymbolicLinkEntry {\n mode: Mode;\n mtime: number;\n path: string;\n linkpath: string;\n basename: string;\n type: string;\n\n constructor(attributes: LinkAttributes) {\n validateAttributes(attributes, MANDATORY_ATTRIBUTES);\n objectAssign(this, attributes);\n if (this.basename === undefined) this.basename = path.basename(this.path);\n if (this.type === undefined) this.type = 'symlink';\n }\n\n create(dest: string, callback: NoParamCallback): void;\n create(dest: string, options: ExtractOptions, callback: NoParamCallback): void;\n create(dest: string, options?: ExtractOptions): Promise<boolean>;\n create(dest: string, options?: ExtractOptions | NoParamCallback, callback?: NoParamCallback): void | Promise<boolean> {\n if (typeof options === 'function') {\n callback = options;\n options = null;\n }\n\n if (typeof callback === 'function') {\n options = options || {};\n try {\n const normalizedPath = path.normalize(this.path);\n const fullPath = path.join(dest, stripPath(normalizedPath, options as ExtractOptions));\n let normalizedLinkpath = path.normalize(this.linkpath);\n let linkFullPath = path.join(dest, stripPath(normalizedLinkpath, options as ExtractOptions));\n if (!isAbsolute(normalizedLinkpath)) {\n const linkRelativePath = path.join(path.dirname(normalizedPath), this.linkpath);\n linkFullPath = path.join(dest, stripPath(linkRelativePath, options as ExtractOptions));\n normalizedLinkpath = path.relative(path.dirname(fullPath), linkFullPath);\n }\n\n const queue = new Queue(1);\n if ((options as ExtractOptions).force) {\n queue.defer((callback) => {\n rm(fullPath, (err) => {\n err && err.code !== 'ENOENT' ? callback(err) : callback();\n });\n });\n }\n queue.defer(mkdirp.bind(null, path.dirname(fullPath)));\n if (isWindows) queue.defer(symlinkWin32.bind(null, linkFullPath, normalizedLinkpath, fullPath));\n else queue.defer(fs.symlink.bind(fs, normalizedLinkpath, fullPath));\n queue.defer(waitForAccess.bind(null, fullPath, true)); // noFollow=true for symlinks\n queue.defer(chmod.bind(null, fullPath, this, options));\n queue.defer(chown.bind(null, fullPath, this, options));\n queue.defer(lutimes.bind(null, fullPath, this, options));\n queue.await(callback);\n return;\n } catch (err) {\n callback(err);\n return;\n }\n }\n\n return new Promise((resolve, reject) => {\n this.create(dest, options as ExtractOptions, (err?: Error, done?: boolean) => (err ? reject(err) : resolve(done)));\n });\n }\n\n destroy() {}\n}\n"],"names":["SymbolicLinkEntry","isWindows","process","platform","test","env","OSTYPE","MANDATORY_ATTRIBUTES","attributes","validateAttributes","objectAssign","basename","undefined","path","type","create","dest","options","callback","normalizedPath","normalize","fullPath","join","stripPath","normalizedLinkpath","linkpath","linkFullPath","isAbsolute","linkRelativePath","dirname","relative","queue","Queue","force","defer","rm","err","code","mkdirp","bind","symlinkWin32","fs","symlink","waitForAccess","chmod","chown","lutimes","await","Promise","resolve","reject","done","destroy"],"mappings":";;;;;;;eAsBqBA;;;8BAtBF;iEACJ;iEACQ;oEACJ;2DACF;8DACC;8DACA;8DACA;gEACE;qEACK;uBACI;kEACP;2EACS;sEACL;;;;;;;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/cjs/fs/chmod.js
CHANGED
|
@@ -22,10 +22,7 @@ var SMODE = 493;
|
|
|
22
22
|
var LMODE = 420;
|
|
23
23
|
function chmodFn(fullPath, entry, _options, callback) {
|
|
24
24
|
var chmod = entry.type === 'symlink' ? _gracefulfs.default.lchmod : _gracefulfs.default.chmod;
|
|
25
|
-
if (!chmod || UMASK === null)
|
|
26
|
-
callback(null);
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
25
|
+
if (!chmod || UMASK === null) return callback(null);
|
|
29
26
|
var mode = entry.mode;
|
|
30
27
|
if (!mode) {
|
|
31
28
|
switch(entry.type){
|
package/dist/cjs/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 type { NoParamCallback } from 'fs';\nimport fs from 'graceful-fs';\nimport type { AbstractEntry, ExtractOptions } from '../types.ts';\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: AbstractEntry, _options: ExtractOptions, callback: NoParamCallback) {\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 type { NoParamCallback } from 'fs';\nimport fs from 'graceful-fs';\nimport type { AbstractEntry, ExtractOptions } from '../types.ts';\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: AbstractEntry, _options: ExtractOptions, callback: NoParamCallback) {\n const chmod = entry.type === 'symlink' ? fs.lchmod : fs.chmod;\n if (!chmod || UMASK === null) return callback(null);\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":["chmodFn","UMASK","process","umask","DMODE","FMODE","SMODE","LMODE","fullPath","entry","_options","callback","chmod","type","fs","lchmod","mode"],"mappings":"AAAA,mDAAmD;;;;;+BAYnD;;;eAAwBA;;;iEATT;;;;;;AAGf,IAAMC,QAAQC,QAAQC,KAAK,GAAGD,QAAQC,KAAK,KAAK;AAChD,IAAMC,QAAQ;AACd,IAAMC,QAAQ;AACd,IAAMC,QAAQ;AACd,IAAMC,QAAQ;AAEC,SAASP,QAAQQ,QAAgB,EAAEC,KAAoB,EAAEC,QAAwB,EAAEC,QAAyB;IACzH,IAAMC,QAAQH,MAAMI,IAAI,KAAK,YAAYC,mBAAE,CAACC,MAAM,GAAGD,mBAAE,CAACF,KAAK;IAC7D,IAAI,CAACA,SAASX,UAAU,MAAM,OAAOU,SAAS;IAE9C,IAAIK,OAAOP,MAAMO,IAAI;IACrB,IAAI,CAACA,MAAM;QACT,OAAQP,MAAMI,IAAI;YAChB,KAAK;gBACHG,OAAOZ;gBACP;YACF,KAAK;gBACHY,OAAOX;gBACP;YACF,KAAK;gBACHW,OAAOV;gBACP;YACF,KAAK;gBACHU,OAAOT;gBACP;QACJ;IACF;IACAK,MAAMJ,UAAU,AAACQ,OAAkB,CAACf,OAAOU;AAC7C"}
|
package/dist/cjs/fs/chown.js
CHANGED
|
@@ -19,10 +19,7 @@ var UID = process.getuid ? process.getuid() : -1;
|
|
|
19
19
|
var OWN = process.platform !== 'win32' && UID === 0;
|
|
20
20
|
function chownFn(fullPath, entry, _options, callback) {
|
|
21
21
|
var chown = entry.type === 'symlink' ? _gracefulfs.default.lchown : _gracefulfs.default.chown;
|
|
22
|
-
if (!chown || !OWN || !entry.uid || !entry.gid)
|
|
23
|
-
callback(null);
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
22
|
+
if (!chown || !OWN || !entry.uid || !entry.gid) return callback(null);
|
|
26
23
|
chown(fullPath, entry.uid, entry.gid, callback);
|
|
27
24
|
}
|
|
28
25
|
/* 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; }
|
package/dist/cjs/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 type { NoParamCallback } from 'fs';\nimport fs from 'graceful-fs';\nimport type { AbstractEntry, ExtractOptions } from '../types.ts';\n\nconst UID = process.getuid ? process.getuid() : -1;\nconst OWN = process.platform !== 'win32' && UID === 0;\n\nexport default function chownFn(fullPath: string, entry: AbstractEntry, _options: ExtractOptions, callback: NoParamCallback) {\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 { AbstractEntry, ExtractOptions } from '../types.ts';\n\nconst UID = process.getuid ? process.getuid() : -1;\nconst OWN = process.platform !== 'win32' && UID === 0;\n\nexport default function chownFn(fullPath: string, entry: AbstractEntry, _options: ExtractOptions, callback: NoParamCallback) {\n const chown = entry.type === 'symlink' ? fs.lchown : fs.chown;\n if (!chown || !OWN || !entry.uid || !entry.gid) return callback(null);\n chown(fullPath, entry.uid, entry.gid, callback);\n}\n"],"names":["chownFn","UID","process","getuid","OWN","platform","fullPath","entry","_options","callback","chown","type","fs","lchown","uid","gid"],"mappings":"AAAA,mDAAmD;;;;;+BASnD;;;eAAwBA;;;iEANT;;;;;;AAGf,IAAMC,MAAMC,QAAQC,MAAM,GAAGD,QAAQC,MAAM,KAAK,CAAC;AACjD,IAAMC,MAAMF,QAAQG,QAAQ,KAAK,WAAWJ,QAAQ;AAErC,SAASD,QAAQM,QAAgB,EAAEC,KAAoB,EAAEC,QAAwB,EAAEC,QAAyB;IACzH,IAAMC,QAAQH,MAAMI,IAAI,KAAK,YAAYC,mBAAE,CAACC,MAAM,GAAGD,mBAAE,CAACF,KAAK;IAC7D,IAAI,CAACA,SAAS,CAACN,OAAO,CAACG,MAAMO,GAAG,IAAI,CAACP,MAAMQ,GAAG,EAAE,OAAON,SAAS;IAChEC,MAAMJ,UAAUC,MAAMO,GAAG,EAAEP,MAAMQ,GAAG,EAAEN;AACxC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type BigIntStats, type Stats } from 'fs';
|
|
2
2
|
export type Callback = (err: NodeJS.ErrnoException | null, stats?: Stats | BigIntStats) => void;
|
|
3
|
-
export default function lstatReal(path: string, callback: Callback):
|
|
3
|
+
export default function lstatReal(path: string, callback: Callback): void;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type BigIntStats, type Stats } from 'fs';
|
|
2
2
|
export type Callback = (err: NodeJS.ErrnoException | null, stats?: Stats | BigIntStats) => void;
|
|
3
|
-
export default function lstatReal(path: string, callback: Callback):
|
|
3
|
+
export default function lstatReal(path: string, callback: Callback): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/fs/lstatReal.ts"],"sourcesContent":["import fs, { type BigIntStats, type Stats } from 'fs';\n\nexport type Callback = (err: NodeJS.ErrnoException | null, stats?: Stats | BigIntStats) => void;\n\nexport default function lstatReal(path: string, callback: Callback):
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/fs/lstatReal.ts"],"sourcesContent":["import fs, { type BigIntStats, type Stats } from 'fs';\n\nexport type Callback = (err: NodeJS.ErrnoException | null, stats?: Stats | BigIntStats) => void;\n\nexport default function lstatReal(path: string, callback: Callback): void {\n fs.realpath(path, (err, realpath) => {\n err ? callback(err) : fs.lstat(realpath, callback);\n });\n}\n"],"names":["lstatReal","path","callback","fs","realpath","err","lstat"],"mappings":";;;;+BAIA;;;eAAwBA;;;yDAJyB;;;;;;AAIlC,SAASA,UAAUC,IAAY,EAAEC,QAAkB;IAChEC,WAAE,CAACC,QAAQ,CAACH,MAAM,SAACI,KAAKD;QACtBC,MAAMH,SAASG,OAAOF,WAAE,CAACG,KAAK,CAACF,UAAUF;IAC3C;AACF"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { NoParamCallback } from 'fs';
|
|
2
2
|
import type { AbstractEntry, ExtractOptions } from '../types.js';
|
|
3
|
-
export default function lutimes(fullPath: string, entry: AbstractEntry, options: ExtractOptions, callback: NoParamCallback):
|
|
3
|
+
export default function lutimes(fullPath: string, entry: AbstractEntry, options: ExtractOptions, callback: NoParamCallback): void;
|
package/dist/cjs/fs/lutimes.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { NoParamCallback } from 'fs';
|
|
2
2
|
import type { AbstractEntry, ExtractOptions } from '../types.js';
|
|
3
|
-
export default function lutimes(fullPath: string, entry: AbstractEntry, options: ExtractOptions, callback: NoParamCallback):
|
|
3
|
+
export default function lutimes(fullPath: string, entry: AbstractEntry, options: ExtractOptions, callback: NoParamCallback): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/fs/lutimes.ts"],"sourcesContent":["// lutimes - set times on symlinks without following them\n// fs.lutimes was added in Node.js 14.5.0\n// For older versions, we skip setting times on symlinks (no good alternative)\n\nimport type { NoParamCallback } from 'fs';\nimport fs from 'graceful-fs';\nimport type { AbstractEntry, ExtractOptions } from '../types.ts';\n\n// biome-ignore lint/suspicious/noExplicitAny: fs.lutimes not in older @types/node\nconst HAS_LUTIMES = typeof (fs as any).lutimes === 'function';\n\nexport default function lutimes(fullPath: string, entry: AbstractEntry, options: ExtractOptions, callback: NoParamCallback):
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/fs/lutimes.ts"],"sourcesContent":["// lutimes - set times on symlinks without following them\n// fs.lutimes was added in Node.js 14.5.0\n// For older versions, we skip setting times on symlinks (no good alternative)\n\nimport type { NoParamCallback } from 'fs';\nimport fs from 'graceful-fs';\nimport type { AbstractEntry, ExtractOptions } from '../types.ts';\n\n// biome-ignore lint/suspicious/noExplicitAny: fs.lutimes not in older @types/node\nconst HAS_LUTIMES = typeof (fs as any).lutimes === 'function';\n\nexport default function lutimes(fullPath: string, entry: AbstractEntry, options: ExtractOptions, callback: NoParamCallback): void {\n if (HAS_LUTIMES) {\n const now = options.now || new Date();\n // biome-ignore lint/suspicious/noExplicitAny: fs.lutimes not in older @types/node\n (fs as any).lutimes(fullPath, now, new Date(entry.mtime), callback);\n } else {\n // On older Node versions, skip setting times on symlinks\n // fs.utimes follows symlinks and will fail with ENOENT if target doesn't exist\n callback(null);\n }\n}\n"],"names":["lutimes","HAS_LUTIMES","fs","fullPath","entry","options","callback","now","Date","mtime"],"mappings":"AAAA,yDAAyD;AACzD,yCAAyC;AACzC,8EAA8E;;;;;+BAS9E;;;eAAwBA;;;iEANT;;;;;;AAGf,kFAAkF;AAClF,IAAMC,cAAc,OAAO,AAACC,mBAAE,CAASF,OAAO,KAAK;AAEpC,SAASA,QAAQG,QAAgB,EAAEC,KAAoB,EAAEC,OAAuB,EAAEC,QAAyB;IACxH,IAAIL,aAAa;QACf,IAAMM,MAAMF,QAAQE,GAAG,IAAI,IAAIC;QAC/B,kFAAkF;QACjFN,mBAAE,CAASF,OAAO,CAACG,UAAUI,KAAK,IAAIC,KAAKJ,MAAMK,KAAK,GAAGH;IAC5D,OAAO;QACL,yDAAyD;QACzD,+EAA+E;QAC/EA,SAAS;IACX;AACF"}
|
package/dist/cjs/fs/utimes.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { NoParamCallback } from 'fs';
|
|
2
2
|
import type { AbstractEntry, ExtractOptions } from '../types.js';
|
|
3
|
-
export default function utimes(fullPath: string, entry: AbstractEntry, options: ExtractOptions, callback: NoParamCallback):
|
|
3
|
+
export default function utimes(fullPath: string, entry: AbstractEntry, options: ExtractOptions, callback: NoParamCallback): void;
|
package/dist/cjs/fs/utimes.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { NoParamCallback } from 'fs';
|
|
2
2
|
import type { AbstractEntry, ExtractOptions } from '../types.js';
|
|
3
|
-
export default function utimes(fullPath: string, entry: AbstractEntry, options: ExtractOptions, callback: NoParamCallback):
|
|
3
|
+
export default function utimes(fullPath: string, entry: AbstractEntry, options: ExtractOptions, callback: NoParamCallback): void;
|
|
@@ -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 type { NoParamCallback } from 'fs';\nimport fs from 'graceful-fs';\nimport type { AbstractEntry, ExtractOptions } from '../types.ts';\n\nexport default function utimes(fullPath: string, entry: AbstractEntry, options: ExtractOptions, callback: NoParamCallback):
|
|
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 type { NoParamCallback } from 'fs';\nimport fs from 'graceful-fs';\nimport type { AbstractEntry, ExtractOptions } from '../types.ts';\n\nexport default function utimes(fullPath: string, entry: AbstractEntry, options: ExtractOptions, callback: NoParamCallback): void {\n const now = options.now || new Date();\n fs.utimes(fullPath, now, new Date(entry.mtime), callback);\n}\n"],"names":["utimes","fullPath","entry","options","callback","now","Date","fs","mtime"],"mappings":"AAAA,mDAAmD;;;;;+BAMnD;;;eAAwBA;;;iEAHT;;;;;;AAGA,SAASA,OAAOC,QAAgB,EAAEC,KAAoB,EAAEC,OAAuB,EAAEC,QAAyB;IACvH,IAAMC,MAAMF,QAAQE,GAAG,IAAI,IAAIC;IAC/BC,mBAAE,CAACP,MAAM,CAACC,UAAUI,KAAK,IAAIC,KAAKJ,MAAMM,KAAK,GAAGJ;AAClD"}
|
|
@@ -6,5 +6,5 @@
|
|
|
6
6
|
*
|
|
7
7
|
* Node 0.8+ compatible.
|
|
8
8
|
*/
|
|
9
|
-
export type StreamToStringCallback = (error?: Error, result?: string) =>
|
|
9
|
+
export type StreamToStringCallback = (error?: Error, result?: string) => void;
|
|
10
10
|
export default function streamToString(stream: NodeJS.ReadableStream, callback: StreamToStringCallback): void;
|
|
@@ -6,5 +6,5 @@
|
|
|
6
6
|
*
|
|
7
7
|
* Node 0.8+ compatible.
|
|
8
8
|
*/
|
|
9
|
-
export type StreamToStringCallback = (error?: Error, result?: string) =>
|
|
9
|
+
export type StreamToStringCallback = (error?: Error, result?: string) => void;
|
|
10
10
|
export default function streamToString(stream: NodeJS.ReadableStream, callback: StreamToStringCallback): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/shared/streamToString.ts"],"sourcesContent":["/**\n * Read entire stream content as string\n *\n * Handles both flowing streams and streams that have already\n * buffered data (using readable stream semantics).\n *\n * Node 0.8+ compatible.\n */\n\nimport oo from 'on-one';\nimport { bufferFrom } from './compat.ts';\n\nexport type StreamToStringCallback = (error?: Error, result?: string) =>
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/shared/streamToString.ts"],"sourcesContent":["/**\n * Read entire stream content as string\n *\n * Handles both flowing streams and streams that have already\n * buffered data (using readable stream semantics).\n *\n * Node 0.8+ compatible.\n */\n\nimport oo from 'on-one';\nimport { bufferFrom } from './compat.ts';\n\nexport type StreamToStringCallback = (error?: Error, result?: string) => void;\n\nexport default function streamToString(stream: NodeJS.ReadableStream, callback: StreamToStringCallback): void {\n const chunks: Buffer[] = [];\n\n // Handle data from the stream\n stream.on('data', (chunk: Buffer | string) => {\n if (typeof chunk === 'string') {\n chunks.push(bufferFrom(chunk, 'utf8'));\n } else {\n chunks.push(chunk);\n }\n });\n\n // Handle stream end events using on-one for Node 0.8 compatibility\n oo(stream, ['error', 'end', 'close'], (err?: Error) => {\n if (err) {\n callback(err);\n } else {\n const content = Buffer.concat(chunks).toString('utf8');\n callback(null, content);\n }\n });\n\n // Ensure stream is flowing (in case it's paused)\n if (typeof (stream as NodeJS.ReadStream).resume === 'function') {\n (stream as NodeJS.ReadStream).resume();\n }\n}\n"],"names":["streamToString","stream","callback","chunks","on","chunk","push","bufferFrom","oo","err","content","Buffer","concat","toString","resume"],"mappings":"AAAA;;;;;;;CAOC;;;;+BAOD;;;eAAwBA;;;4DALT;wBACY;;;;;;AAIZ,SAASA,eAAeC,MAA6B,EAAEC,QAAgC;IACpG,IAAMC,SAAmB,EAAE;IAE3B,8BAA8B;IAC9BF,OAAOG,EAAE,CAAC,QAAQ,SAACC;QACjB,IAAI,OAAOA,UAAU,UAAU;YAC7BF,OAAOG,IAAI,CAACC,IAAAA,oBAAU,EAACF,OAAO;QAChC,OAAO;YACLF,OAAOG,IAAI,CAACD;QACd;IACF;IAEA,mEAAmE;IACnEG,IAAAA,cAAE,EAACP,QAAQ;QAAC;QAAS;QAAO;KAAQ,EAAE,SAACQ;QACrC,IAAIA,KAAK;YACPP,SAASO;QACX,OAAO;YACL,IAAMC,UAAUC,OAAOC,MAAM,CAACT,QAAQU,QAAQ,CAAC;YAC/CX,SAAS,MAAMQ;QACjB;IACF;IAEA,iDAAiD;IACjD,IAAI,OAAO,AAACT,OAA6Ba,MAAM,KAAK,YAAY;QAC7Db,OAA6Ba,MAAM;IACtC;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function validateAttributes(attributes: object, keys: string[]):
|
|
1
|
+
export default function validateAttributes(attributes: object, keys: string[]): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function validateAttributes(attributes: object, keys: string[]):
|
|
1
|
+
export default function validateAttributes(attributes: object, keys: string[]): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/validateAttributes.ts"],"sourcesContent":["export default function validateAttributes(attributes: object, keys: string[]):
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/validateAttributes.ts"],"sourcesContent":["export default function validateAttributes(attributes: object, keys: string[]): void {\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"}
|
|
@@ -7,6 +7,8 @@ export default class DirectoryEntry {
|
|
|
7
7
|
basename: string;
|
|
8
8
|
type: string;
|
|
9
9
|
constructor(attributes: DirectoryAttributes);
|
|
10
|
-
create(dest: string,
|
|
10
|
+
create(dest: string, callback: NoParamCallback): void;
|
|
11
|
+
create(dest: string, options: ExtractOptions, callback: NoParamCallback): void;
|
|
12
|
+
create(dest: string, options?: ExtractOptions): Promise<boolean>;
|
|
11
13
|
destroy(): void;
|
|
12
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/DirectoryEntry.ts"],"sourcesContent":["import mkdirp from 'mkdirp-classic';\nimport path from 'path';\nimport Queue from 'queue-cb';\nimport chmod from './fs/chmod.ts';\nimport chown from './fs/chown.ts';\nimport utimes from './fs/utimes.ts';\nimport { objectAssign } from './shared/index.ts';\nimport stripPath from './stripPath.ts';\nimport validateAttributes from './validateAttributes.ts';\nimport waitForAccess from './waitForAccess.ts';\n\nconst MANDATORY_ATTRIBUTES = ['mode', 'mtime', 'path'];\n\nimport type { Mode } from 'fs';\nimport type { DirectoryAttributes, ExtractOptions, NoParamCallback } from './types.ts';\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):
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/DirectoryEntry.ts"],"sourcesContent":["import mkdirp from 'mkdirp-classic';\nimport path from 'path';\nimport Queue from 'queue-cb';\nimport chmod from './fs/chmod.ts';\nimport chown from './fs/chown.ts';\nimport utimes from './fs/utimes.ts';\nimport { objectAssign } from './shared/index.ts';\nimport stripPath from './stripPath.ts';\nimport validateAttributes from './validateAttributes.ts';\nimport waitForAccess from './waitForAccess.ts';\n\nconst MANDATORY_ATTRIBUTES = ['mode', 'mtime', 'path'];\n\nimport type { Mode } from 'fs';\nimport type { DirectoryAttributes, ExtractOptions, NoParamCallback } from './types.ts';\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, callback: NoParamCallback): void;\n create(dest: string, options: ExtractOptions, callback: NoParamCallback): void;\n create(dest: string, options?: ExtractOptions): Promise<boolean>;\n create(dest: string, options?: ExtractOptions | NoParamCallback, callback?: NoParamCallback): void | 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(waitForAccess.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 as ExtractOptions, (err?: Error, done?: boolean) => (err ? reject(err) : resolve(done)));\n });\n }\n\n destroy() {}\n}\n"],"names":["mkdirp","path","Queue","chmod","chown","utimes","objectAssign","stripPath","validateAttributes","waitForAccess","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,YAAY,iBAAiB;AACpC,OAAOC,UAAU,OAAO;AACxB,OAAOC,WAAW,WAAW;AAC7B,OAAOC,WAAW,gBAAgB;AAClC,OAAOC,WAAW,gBAAgB;AAClC,OAAOC,YAAY,iBAAiB;A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BsB,YAAYpB;QAC/BJ,aAAa,IAAI,EAAEwB;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;AAsCF;AAlDA,SAAqBU,4BAkDpB"}
|
package/dist/esm/FileEntry.d.ts
CHANGED
|
@@ -7,6 +7,8 @@ export default class FileEntry {
|
|
|
7
7
|
basename: string;
|
|
8
8
|
type: string;
|
|
9
9
|
constructor(attributes: FileAttributes);
|
|
10
|
-
create(dest: string,
|
|
10
|
+
create(dest: string, callback: NoParamCallback): void;
|
|
11
|
+
create(dest: string, options: ExtractOptions, callback: NoParamCallback): void;
|
|
12
|
+
create(dest: string, options?: ExtractOptions): Promise<boolean>;
|
|
11
13
|
destroy(): void;
|
|
12
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/FileEntry.ts"],"sourcesContent":["import fs from 'fs';\nimport { rm } from 'fs-remove-compat';\nimport mkdirp from 'mkdirp-classic';\nimport path from 'path';\nimport Queue from 'queue-cb';\nimport chmod from './fs/chmod.ts';\nimport chown from './fs/chown.ts';\nimport utimes from './fs/utimes.ts';\nimport { objectAssign } from './shared/index.ts';\nimport stripPath from './stripPath.ts';\nimport validateAttributes from './validateAttributes.ts';\n\nconst MANDATORY_ATTRIBUTES = ['mode', 'mtime', 'path'];\n\nimport type { Mode } from 'fs';\nimport type { ExtractOptions, FileAttributes, NoParamCallback, WriteFileFn } from './types.ts';\n\ninterface AbstractFileEntry {\n _writeFile: WriteFileFn;\n}\n\nexport default class FileEntry {\n mode: Mode;\n mtime: number;\n path: string;\n basename: string;\n type: string;\n\n constructor(attributes: FileAttributes) {\n validateAttributes(attributes, MANDATORY_ATTRIBUTES);\n objectAssign(this, attributes);\n if (this.basename === undefined) this.basename = path.basename(this.path);\n if (this.type === undefined) this.type = 'file';\n if ((this as unknown as AbstractFileEntry)._writeFile === undefined) throw new Error('File this missing _writeFile. Please implement this method in your subclass');\n }\n\n create(dest: string, options: ExtractOptions | NoParamCallback, callback?: NoParamCallback):
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/FileEntry.ts"],"sourcesContent":["import fs from 'fs';\nimport { rm } from 'fs-remove-compat';\nimport mkdirp from 'mkdirp-classic';\nimport path from 'path';\nimport Queue from 'queue-cb';\nimport chmod from './fs/chmod.ts';\nimport chown from './fs/chown.ts';\nimport utimes from './fs/utimes.ts';\nimport { objectAssign } from './shared/index.ts';\nimport stripPath from './stripPath.ts';\nimport validateAttributes from './validateAttributes.ts';\n\nconst MANDATORY_ATTRIBUTES = ['mode', 'mtime', 'path'];\n\nimport type { Mode } from 'fs';\nimport type { ExtractOptions, FileAttributes, NoParamCallback, WriteFileFn } from './types.ts';\n\ninterface AbstractFileEntry {\n _writeFile: WriteFileFn;\n}\n\nexport default class FileEntry {\n mode: Mode;\n mtime: number;\n path: string;\n basename: string;\n type: string;\n\n constructor(attributes: FileAttributes) {\n validateAttributes(attributes, MANDATORY_ATTRIBUTES);\n objectAssign(this, attributes);\n if (this.basename === undefined) this.basename = path.basename(this.path);\n if (this.type === undefined) this.type = 'file';\n if ((this as unknown as AbstractFileEntry)._writeFile === undefined) throw new Error('File this missing _writeFile. Please implement this method in your subclass');\n }\n\n create(dest: string, callback: NoParamCallback): void;\n create(dest: string, options: ExtractOptions, callback: NoParamCallback): void;\n create(dest: string, options?: ExtractOptions): Promise<boolean>;\n create(dest: string, options?: ExtractOptions | NoParamCallback, callback?: NoParamCallback): void | Promise<boolean> {\n if (typeof options === 'function') {\n callback = options;\n options = null;\n }\n\n if (typeof callback === 'function') {\n options = options || {};\n try {\n const normalizedPath = path.normalize(this.path);\n const fullPath = path.join(dest, stripPath(normalizedPath, options as ExtractOptions));\n\n const queue = new Queue(1);\n if ((options as ExtractOptions).force) {\n queue.defer((callback) => {\n rm(fullPath, (err) => {\n err && err.code !== 'ENOENT' ? callback(err) : callback();\n });\n });\n } else {\n // Check if file exists - throw EEXIST if it does\n queue.defer((callback) => {\n fs.stat(fullPath, (err) => {\n if (!err) {\n const existsErr = new Error(`EEXIST: file already exists, open '${fullPath}'`) as NodeJS.ErrnoException;\n existsErr.code = 'EEXIST';\n existsErr.path = fullPath;\n return callback(existsErr);\n }\n // ENOENT means file doesn't exist - that's what we want\n if (err.code === 'ENOENT') return callback();\n // Other errors should be reported\n callback(err);\n });\n });\n }\n queue.defer(mkdirp.bind(null, path.dirname(fullPath)));\n queue.defer((this as unknown as AbstractFileEntry)._writeFile.bind(this, fullPath, options));\n queue.defer(chmod.bind(null, fullPath, this, options));\n queue.defer(chown.bind(null, fullPath, this, options));\n queue.defer(utimes.bind(null, fullPath, this, options));\n queue.await(callback);\n return;\n } catch (err) {\n callback(err);\n return;\n }\n }\n\n return new Promise((resolve, reject) => {\n this.create(dest, options as ExtractOptions, (err?: Error, done?: boolean) => (err ? reject(err) : resolve(done)));\n });\n }\n\n destroy() {}\n}\n"],"names":["fs","rm","mkdirp","path","Queue","chmod","chown","utimes","objectAssign","stripPath","validateAttributes","MANDATORY_ATTRIBUTES","FileEntry","create","dest","options","callback","normalizedPath","normalize","fullPath","join","queue","force","defer","err","code","stat","existsErr","Error","bind","dirname","_writeFile","await","Promise","resolve","reject","done","destroy","attributes","basename","undefined","type"],"mappings":"AAAA,OAAOA,QAAQ,KAAK;AACpB,SAASC,EAAE,QAAQ,mBAAmB;AACtC,OAAOC,YAAY,iBAAiB;AACpC,OAAOC,UAAU,OAAO;AACxB,OAAOC,WAAW,WAAW;AAC7B,OAAOC,WAAW,gBAAgB;AAClC,OAAOC,WAAW,gBAAgB;AAClC,OAAOC,YAAY,iBAAiB;AACpC,SAASC,YAAY,QAAQ,oBAAoB;AACjD,OAAOC,eAAe,iBAAiB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,MAAMwB,IAAI,CAAC,MAAMV,UAAU,IAAI,EAAEJ;gBAC7CM,MAAME,KAAK,CAACjB,MAAMuB,IAAI,CAAC,MAAMV,UAAU,IAAI,EAAEJ;gBAC7CM,MAAME,KAAK,CAAChB,OAAOsB,IAAI,CAAC,MAAMV,UAAU,IAAI,EAAEJ;gBAC9CM,MAAMW,KAAK,CAAChB;gBACZ;YACF,EAAE,OAAOQ,KAAK;gBACZR,SAASQ;gBACT;YACF;QACF;QAEA,OAAO,IAAIS,QAAQ,CAACC,SAASC;YAC3B,IAAI,CAACtB,MAAM,CAACC,MAAMC,SAA2B,CAACS,KAAaY,OAAoBZ,MAAMW,OAAOX,OAAOU,QAAQE;QAC7G;IACF;IAEAC,UAAU,CAAC;IAjEX,YAAYC,UAA0B,CAAE;QACtC5B,mBAAmB4B,YAAY3B;QAC/BH,aAAa,IAAI,EAAE8B;QACnB,IAAI,IAAI,CAACC,QAAQ,KAAKC,WAAW,IAAI,CAACD,QAAQ,GAAGpC,KAAKoC,QAAQ,CAAC,IAAI,CAACpC,IAAI;QACxE,IAAI,IAAI,CAACsC,IAAI,KAAKD,WAAW,IAAI,CAACC,IAAI,GAAG;QACzC,IAAI,AAAC,IAAI,CAAkCV,UAAU,KAAKS,WAAW,MAAM,IAAIZ,MAAM;IACvF;AA4DF;AAzEA,SAAqBhB,uBAyEpB"}
|
package/dist/esm/LinkEntry.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ export default class LinkEntry {
|
|
|
8
8
|
basename: string;
|
|
9
9
|
type: string;
|
|
10
10
|
constructor(attributes: LinkAttributes);
|
|
11
|
-
create(dest: string,
|
|
11
|
+
create(dest: string, callback: NoParamCallback): void;
|
|
12
|
+
create(dest: string, options: ExtractOptions, callback: NoParamCallback): void;
|
|
13
|
+
create(dest: string, options?: ExtractOptions): Promise<boolean>;
|
|
12
14
|
destroy(): void;
|
|
13
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/LinkEntry.ts"],"sourcesContent":["import { rm } from 'fs-remove-compat';\nimport fs from 'graceful-fs';\nimport mkdirp from 'mkdirp-classic';\nimport path from 'path';\nimport Queue from 'queue-cb';\nimport chmod from './fs/chmod.ts';\nimport chown from './fs/chown.ts';\nimport utimes from './fs/utimes.ts';\nimport { objectAssign } from './shared/index.ts';\nimport stripPath from './stripPath.ts';\nimport validateAttributes from './validateAttributes.ts';\nimport waitForAccess from './waitForAccess.ts';\n\nconst MANDATORY_ATTRIBUTES = ['mode', 'mtime', 'path', 'linkpath'];\n\nimport type { Mode } from 'fs';\nimport type { ExtractOptions, LinkAttributes, NoParamCallback } from './types.ts';\n\nexport default class 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):
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/LinkEntry.ts"],"sourcesContent":["import { rm } from 'fs-remove-compat';\nimport fs from 'graceful-fs';\nimport mkdirp from 'mkdirp-classic';\nimport path from 'path';\nimport Queue from 'queue-cb';\nimport chmod from './fs/chmod.ts';\nimport chown from './fs/chown.ts';\nimport utimes from './fs/utimes.ts';\nimport { objectAssign } from './shared/index.ts';\nimport stripPath from './stripPath.ts';\nimport validateAttributes from './validateAttributes.ts';\nimport waitForAccess from './waitForAccess.ts';\n\nconst MANDATORY_ATTRIBUTES = ['mode', 'mtime', 'path', 'linkpath'];\n\nimport type { Mode } from 'fs';\nimport type { ExtractOptions, LinkAttributes, NoParamCallback } from './types.ts';\n\nexport default class 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, callback: NoParamCallback): void;\n create(dest: string, options: ExtractOptions, callback: NoParamCallback): void;\n create(dest: string, options?: ExtractOptions): Promise<boolean>;\n create(dest: string, options?: ExtractOptions | NoParamCallback, callback?: NoParamCallback): void | 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 rm(fullPath, (err) => {\n err && err.code !== 'ENOENT' ? callback(err) : callback();\n });\n });\n }\n queue.defer(mkdirp.bind(null, path.dirname(fullPath)));\n queue.defer(fs.link.bind(fs, linkFullPath, fullPath));\n queue.defer(waitForAccess.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 as ExtractOptions, (err?: Error, done?: boolean) => (err ? reject(err) : resolve(done)));\n });\n }\n\n destroy() {}\n}\n"],"names":["rm","fs","mkdirp","path","Queue","chmod","chown","utimes","objectAssign","stripPath","validateAttributes","waitForAccess","MANDATORY_ATTRIBUTES","LinkEntry","create","dest","options","callback","normalizedPath","normalize","fullPath","join","normalizedLinkpath","linkpath","linkFullPath","queue","force","defer","err","code","bind","dirname","link","await","Promise","resolve","reject","done","destroy","attributes","basename","undefined","type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AI,CAACF,IAAI,CAAC7B,IAAIuB,cAAcJ;gBAC3CK,MAAME,KAAK,CAAChB,cAAcmB,IAAI,CAAC,MAAMV;gBACrCK,MAAME,KAAK,CAACtB,MAAMyB,IAAI,CAAC,MAAMV,UAAU,IAAI,EAAEJ;gBAC7CS,MAAME,KAAK,CAACrB,MAAMwB,IAAI,CAAC,MAAMV,UAAU,IAAI,EAAEJ;gBAC7CS,MAAME,KAAK,CAACpB,OAAOuB,IAAI,CAAC,MAAMV,UAAU,IAAI,EAAEJ;gBAC9CS,MAAMQ,KAAK,CAAChB;gBACZ;YACF,EAAE,OAAOW,KAAK;gBACZX,SAASW;gBACT;YACF;QACF;QAEA,OAAO,IAAIM,QAAQ,CAACC,SAASC;YAC3B,IAAI,CAACtB,MAAM,CAACC,MAAMC,SAA2B,CAACY,KAAaS,OAAoBT,MAAMQ,OAAOR,OAAOO,QAAQE;QAC7G;IACF;IAEAC,UAAU,CAAC;IAnDX,YAAYC,UAA0B,CAAE;QACtC7B,mBAAmB6B,YAAY3B;QAC/BJ,aAAa,IAAI,EAAE+B;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;IAC3C;AA+CF;AA5DA,SAAqB7B,uBA4DpB"}
|
|
@@ -8,6 +8,8 @@ export default class SymbolicLinkEntry {
|
|
|
8
8
|
basename: string;
|
|
9
9
|
type: string;
|
|
10
10
|
constructor(attributes: LinkAttributes);
|
|
11
|
-
create(dest: string,
|
|
11
|
+
create(dest: string, callback: NoParamCallback): void;
|
|
12
|
+
create(dest: string, options: ExtractOptions, callback: NoParamCallback): void;
|
|
13
|
+
create(dest: string, options?: ExtractOptions): Promise<boolean>;
|
|
12
14
|
destroy(): void;
|
|
13
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/SymbolicLinkEntry.ts"],"sourcesContent":["import { rm } from 'fs-remove-compat';\nimport fs from 'graceful-fs';\nimport isAbsolute from 'is-absolute';\nimport mkdirp from 'mkdirp-classic';\nimport path from 'path';\nimport Queue from 'queue-cb';\nimport chmod from './fs/chmod.ts';\nimport chown from './fs/chown.ts';\nimport lutimes from './fs/lutimes.ts';\nimport symlinkWin32 from './fs/symlinkWin32.ts';\nimport { objectAssign } from './shared/index.ts';\nimport stripPath from './stripPath.ts';\nimport validateAttributes from './validateAttributes.ts';\nimport waitForAccess from './waitForAccess.ts';\n\nconst isWindows = process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE);\n\nconst MANDATORY_ATTRIBUTES = ['mode', 'mtime', 'path', 'linkpath'];\n\nimport type { Mode } from 'fs';\nimport type { ExtractOptions, LinkAttributes, NoParamCallback } from './types.ts';\n\nexport default class SymbolicLinkEntry {\n mode: Mode;\n mtime: number;\n path: string;\n linkpath: string;\n basename: string;\n type: string;\n\n constructor(attributes: LinkAttributes) {\n validateAttributes(attributes, MANDATORY_ATTRIBUTES);\n objectAssign(this, attributes);\n if (this.basename === undefined) this.basename = path.basename(this.path);\n if (this.type === undefined) this.type = 'symlink';\n }\n\n create(dest: string, options: ExtractOptions | NoParamCallback, callback?: NoParamCallback):
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/SymbolicLinkEntry.ts"],"sourcesContent":["import { rm } from 'fs-remove-compat';\nimport fs from 'graceful-fs';\nimport isAbsolute from 'is-absolute';\nimport mkdirp from 'mkdirp-classic';\nimport path from 'path';\nimport Queue from 'queue-cb';\nimport chmod from './fs/chmod.ts';\nimport chown from './fs/chown.ts';\nimport lutimes from './fs/lutimes.ts';\nimport symlinkWin32 from './fs/symlinkWin32.ts';\nimport { objectAssign } from './shared/index.ts';\nimport stripPath from './stripPath.ts';\nimport validateAttributes from './validateAttributes.ts';\nimport waitForAccess from './waitForAccess.ts';\n\nconst isWindows = process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE);\n\nconst MANDATORY_ATTRIBUTES = ['mode', 'mtime', 'path', 'linkpath'];\n\nimport type { Mode } from 'fs';\nimport type { ExtractOptions, LinkAttributes, NoParamCallback } from './types.ts';\n\nexport default class SymbolicLinkEntry {\n mode: Mode;\n mtime: number;\n path: string;\n linkpath: string;\n basename: string;\n type: string;\n\n constructor(attributes: LinkAttributes) {\n validateAttributes(attributes, MANDATORY_ATTRIBUTES);\n objectAssign(this, attributes);\n if (this.basename === undefined) this.basename = path.basename(this.path);\n if (this.type === undefined) this.type = 'symlink';\n }\n\n create(dest: string, callback: NoParamCallback): void;\n create(dest: string, options: ExtractOptions, callback: NoParamCallback): void;\n create(dest: string, options?: ExtractOptions): Promise<boolean>;\n create(dest: string, options?: ExtractOptions | NoParamCallback, callback?: NoParamCallback): void | Promise<boolean> {\n if (typeof options === 'function') {\n callback = options;\n options = null;\n }\n\n if (typeof callback === 'function') {\n options = options || {};\n try {\n const normalizedPath = path.normalize(this.path);\n const fullPath = path.join(dest, stripPath(normalizedPath, options as ExtractOptions));\n let normalizedLinkpath = path.normalize(this.linkpath);\n let linkFullPath = path.join(dest, stripPath(normalizedLinkpath, options as ExtractOptions));\n if (!isAbsolute(normalizedLinkpath)) {\n const linkRelativePath = path.join(path.dirname(normalizedPath), this.linkpath);\n linkFullPath = path.join(dest, stripPath(linkRelativePath, options as ExtractOptions));\n normalizedLinkpath = path.relative(path.dirname(fullPath), linkFullPath);\n }\n\n const queue = new Queue(1);\n if ((options as ExtractOptions).force) {\n queue.defer((callback) => {\n rm(fullPath, (err) => {\n err && err.code !== 'ENOENT' ? callback(err) : callback();\n });\n });\n }\n queue.defer(mkdirp.bind(null, path.dirname(fullPath)));\n if (isWindows) queue.defer(symlinkWin32.bind(null, linkFullPath, normalizedLinkpath, fullPath));\n else queue.defer(fs.symlink.bind(fs, normalizedLinkpath, fullPath));\n queue.defer(waitForAccess.bind(null, fullPath, true)); // noFollow=true for symlinks\n queue.defer(chmod.bind(null, fullPath, this, options));\n queue.defer(chown.bind(null, fullPath, this, options));\n queue.defer(lutimes.bind(null, fullPath, this, options));\n queue.await(callback);\n return;\n } catch (err) {\n callback(err);\n return;\n }\n }\n\n return new Promise((resolve, reject) => {\n this.create(dest, options as ExtractOptions, (err?: Error, done?: boolean) => (err ? reject(err) : resolve(done)));\n });\n }\n\n destroy() {}\n}\n"],"names":["rm","fs","isAbsolute","mkdirp","path","Queue","chmod","chown","lutimes","symlinkWin32","objectAssign","stripPath","validateAttributes","waitForAccess","isWindows","process","platform","test","env","OSTYPE","MANDATORY_ATTRIBUTES","SymbolicLinkEntry","create","dest","options","callback","normalizedPath","normalize","fullPath","join","normalizedLinkpath","linkpath","linkFullPath","linkRelativePath","dirname","relative","queue","force","defer","err","code","bind","symlink","await","Promise","resolve","reject","done","destroy","attributes","basename","undefined","type"],"mappings":"AAAA,SAASA,EAAE,QAAQ,mBAAmB;AACtC,OAAOC,QAAQ,cAAc;AAC7B,OAAOC,gBAAgB,cAAc;AACrC,OAAOC,YAAY,iBAAiB;AACpC,OAAOC,UAAU,OAAO;AACxB,OAAOC,WAAW,WAAW;AAC7B,OAAOC,WAAW,gBAAgB;AAClC,OAAOC,WAAW,gBAAgB;AAClC,OAAOC,aAAa,kBAAkB;AACtC,OAAOC,kBAAkB,uBAAuB;AAChD,SAASC,YAAY,QAAQ,oBAAoB;AACjD,OAAOC,eAAe,iBAAiB;AACvC,OAAOC,wBAAwB,0BAA0B;AACzD,OAAOC,mBAAmB,qBAAqB;AAE/C,MAAMC,YAAYC,QAAQC,QAAQ,KAAK,WAAW,kBAAkBC,IAAI,CAACF,QAAQG,GAAG,CAACC,MAAM;AAE3F,MAAMC,uBAAuB;IAAC;IAAQ;IAAS;IAAQ;CAAW;AAKnD,IAAA,AAAMC,oBAAN,MAAMA;IAkBnBC,OAAOC,IAAY,EA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,QAAQ,6BAA6B;gBACpFQ,MAAME,KAAK,CAAChC,MAAMmC,IAAI,CAAC,MAAMb,UAAU,IAAI,EAAEJ;gBAC7CY,MAAME,KAAK,CAAC/B,MAAMkC,IAAI,CAAC,MAAMb,UAAU,IAAI,EAAEJ;gBAC7CY,MAAME,KAAK,CAAC9B,QAAQiC,IAAI,CAAC,MAAMb,UAAU,IAAI,EAAEJ;gBAC/CY,MAAMO,KAAK,CAAClB;gBACZ;YACF,EAAE,OAAOc,KAAK;gBACZd,SAASc;gBACT;YACF;QACF;QAEA,OAAO,IAAIK,QAAQ,CAACC,SAASC;YAC3B,IAAI,CAACxB,MAAM,CAACC,MAAMC,SAA2B,CAACe,KAAaQ,OAAoBR,MAAMO,OAAOP,OAAOM,QAAQE;QAC7G;IACF;IAEAC,UAAU,CAAC;IAzDX,YAAYC,UAA0B,CAAE;QACtCrC,mBAAmBqC,YAAY7B;QAC/BV,aAAa,IAAI,EAAEuC;QACnB,IAAI,IAAI,CAACC,QAAQ,KAAKC,WAAW,IAAI,CAACD,QAAQ,GAAG9C,KAAK8C,QAAQ,CAAC,IAAI,CAAC9C,IAAI;QACxE,IAAI,IAAI,CAACgD,IAAI,KAAKD,WAAW,IAAI,CAACC,IAAI,GAAG;IAC3C;AAqDF;AAlEA,SAAqB/B,+BAkEpB"}
|
package/dist/esm/fs/chmod.js
CHANGED
|
@@ -7,10 +7,7 @@ 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)
|
|
11
|
-
callback(null);
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
10
|
+
if (!chmod || UMASK === null) return callback(null);
|
|
14
11
|
let mode = entry.mode;
|
|
15
12
|
if (!mode) {
|
|
16
13
|
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 type { NoParamCallback } from 'fs';\nimport fs from 'graceful-fs';\nimport type { AbstractEntry, ExtractOptions } from '../types.ts';\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: AbstractEntry, _options: ExtractOptions, callback: NoParamCallback) {\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 type { NoParamCallback } from 'fs';\nimport fs from 'graceful-fs';\nimport type { AbstractEntry, ExtractOptions } from '../types.ts';\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: AbstractEntry, _options: ExtractOptions, callback: NoParamCallback) {\n const chmod = entry.type === 'symlink' ? fs.lchmod : fs.chmod;\n if (!chmod || UMASK === null) return callback(null);\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;AAGnD,OAAOA,QAAQ,cAAc;AAG7B,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,KAAoB,EAAEC,QAAwB,EAAEC,QAAyB;IACzH,MAAMC,QAAQH,MAAMI,IAAI,KAAK,YAAYd,GAAGe,MAAM,GAAGf,GAAGa,KAAK;IAC7D,IAAI,CAACA,SAASZ,UAAU,MAAM,OAAOW,SAAS;IAE9C,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.js
CHANGED
|
@@ -4,9 +4,6 @@ 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)
|
|
8
|
-
callback(null);
|
|
9
|
-
return;
|
|
10
|
-
}
|
|
7
|
+
if (!chown || !OWN || !entry.uid || !entry.gid) return callback(null);
|
|
11
8
|
chown(fullPath, entry.uid, entry.gid, callback);
|
|
12
9
|
}
|
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 type { NoParamCallback } from 'fs';\nimport fs from 'graceful-fs';\nimport type { AbstractEntry, ExtractOptions } from '../types.ts';\n\nconst UID = process.getuid ? process.getuid() : -1;\nconst OWN = process.platform !== 'win32' && UID === 0;\n\nexport default function chownFn(fullPath: string, entry: AbstractEntry, _options: ExtractOptions, callback: NoParamCallback) {\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 { AbstractEntry, ExtractOptions } from '../types.ts';\n\nconst UID = process.getuid ? process.getuid() : -1;\nconst OWN = process.platform !== 'win32' && UID === 0;\n\nexport default function chownFn(fullPath: string, entry: AbstractEntry, _options: ExtractOptions, callback: NoParamCallback) {\n const chown = entry.type === 'symlink' ? fs.lchown : fs.chown;\n if (!chown || !OWN || !entry.uid || !entry.gid) return callback(null);\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,KAAoB,EAAEC,QAAwB,EAAEC,QAAyB;IACzH,MAAMC,QAAQH,MAAMI,IAAI,KAAK,YAAYZ,GAAGa,MAAM,GAAGb,GAAGW,KAAK;IAC7D,IAAI,CAACA,SAAS,CAACP,OAAO,CAACI,MAAMM,GAAG,IAAI,CAACN,MAAMO,GAAG,EAAE,OAAOL,SAAS;IAChEC,MAAMJ,UAAUC,MAAMM,GAAG,EAAEN,MAAMO,GAAG,EAAEL;AACxC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type BigIntStats, type Stats } from 'fs';
|
|
2
2
|
export type Callback = (err: NodeJS.ErrnoException | null, stats?: Stats | BigIntStats) => void;
|
|
3
|
-
export default function lstatReal(path: string, callback: Callback):
|
|
3
|
+
export default function lstatReal(path: string, callback: Callback): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/fs/lstatReal.ts"],"sourcesContent":["import fs, { type BigIntStats, type Stats } from 'fs';\n\nexport type Callback = (err: NodeJS.ErrnoException | null, stats?: Stats | BigIntStats) => void;\n\nexport default function lstatReal(path: string, callback: Callback):
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/fs/lstatReal.ts"],"sourcesContent":["import fs, { type BigIntStats, type Stats } from 'fs';\n\nexport type Callback = (err: NodeJS.ErrnoException | null, stats?: Stats | BigIntStats) => void;\n\nexport default function lstatReal(path: string, callback: Callback): void {\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"}
|
package/dist/esm/fs/lutimes.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { NoParamCallback } from 'fs';
|
|
2
2
|
import type { AbstractEntry, ExtractOptions } from '../types.js';
|
|
3
|
-
export default function lutimes(fullPath: string, entry: AbstractEntry, options: ExtractOptions, callback: NoParamCallback):
|
|
3
|
+
export default function lutimes(fullPath: string, entry: AbstractEntry, options: ExtractOptions, callback: NoParamCallback): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/fs/lutimes.ts"],"sourcesContent":["// lutimes - set times on symlinks without following them\n// fs.lutimes was added in Node.js 14.5.0\n// For older versions, we skip setting times on symlinks (no good alternative)\n\nimport type { NoParamCallback } from 'fs';\nimport fs from 'graceful-fs';\nimport type { AbstractEntry, ExtractOptions } from '../types.ts';\n\n// biome-ignore lint/suspicious/noExplicitAny: fs.lutimes not in older @types/node\nconst HAS_LUTIMES = typeof (fs as any).lutimes === 'function';\n\nexport default function lutimes(fullPath: string, entry: AbstractEntry, options: ExtractOptions, callback: NoParamCallback):
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/fs/lutimes.ts"],"sourcesContent":["// lutimes - set times on symlinks without following them\n// fs.lutimes was added in Node.js 14.5.0\n// For older versions, we skip setting times on symlinks (no good alternative)\n\nimport type { NoParamCallback } from 'fs';\nimport fs from 'graceful-fs';\nimport type { AbstractEntry, ExtractOptions } from '../types.ts';\n\n// biome-ignore lint/suspicious/noExplicitAny: fs.lutimes not in older @types/node\nconst HAS_LUTIMES = typeof (fs as any).lutimes === 'function';\n\nexport default function lutimes(fullPath: string, entry: AbstractEntry, options: ExtractOptions, callback: NoParamCallback): void {\n if (HAS_LUTIMES) {\n const now = options.now || new Date();\n // biome-ignore lint/suspicious/noExplicitAny: fs.lutimes not in older @types/node\n (fs as any).lutimes(fullPath, now, new Date(entry.mtime), callback);\n } else {\n // On older Node versions, skip setting times on symlinks\n // fs.utimes follows symlinks and will fail with ENOENT if target doesn't exist\n callback(null);\n }\n}\n"],"names":["fs","HAS_LUTIMES","lutimes","fullPath","entry","options","callback","now","Date","mtime"],"mappings":"AAAA,yDAAyD;AACzD,yCAAyC;AACzC,8EAA8E;AAG9E,OAAOA,QAAQ,cAAc;AAG7B,kFAAkF;AAClF,MAAMC,cAAc,OAAO,AAACD,GAAWE,OAAO,KAAK;AAEnD,eAAe,SAASA,QAAQC,QAAgB,EAAEC,KAAoB,EAAEC,OAAuB,EAAEC,QAAyB;IACxH,IAAIL,aAAa;QACf,MAAMM,MAAMF,QAAQE,GAAG,IAAI,IAAIC;QAC/B,kFAAkF;QACjFR,GAAWE,OAAO,CAACC,UAAUI,KAAK,IAAIC,KAAKJ,MAAMK,KAAK,GAAGH;IAC5D,OAAO;QACL,yDAAyD;QACzD,+EAA+E;QAC/EA,SAAS;IACX;AACF"}
|
package/dist/esm/fs/utimes.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { NoParamCallback } from 'fs';
|
|
2
2
|
import type { AbstractEntry, ExtractOptions } from '../types.js';
|
|
3
|
-
export default function utimes(fullPath: string, entry: AbstractEntry, options: ExtractOptions, callback: NoParamCallback):
|
|
3
|
+
export default function utimes(fullPath: string, entry: AbstractEntry, options: ExtractOptions, callback: NoParamCallback): void;
|
|
@@ -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 type { NoParamCallback } from 'fs';\nimport fs from 'graceful-fs';\nimport type { AbstractEntry, ExtractOptions } from '../types.ts';\n\nexport default function utimes(fullPath: string, entry: AbstractEntry, options: ExtractOptions, callback: NoParamCallback):
|
|
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 type { NoParamCallback } from 'fs';\nimport fs from 'graceful-fs';\nimport type { AbstractEntry, ExtractOptions } from '../types.ts';\n\nexport default function utimes(fullPath: string, entry: AbstractEntry, options: ExtractOptions, callback: NoParamCallback): void {\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;AAGnD,OAAOA,QAAQ,cAAc;AAG7B,eAAe,SAASC,OAAOC,QAAgB,EAAEC,KAAoB,EAAEC,OAAuB,EAAEC,QAAyB;IACvH,MAAMC,MAAMF,QAAQE,GAAG,IAAI,IAAIC;IAC/BP,GAAGC,MAAM,CAACC,UAAUI,KAAK,IAAIC,KAAKJ,MAAMK,KAAK,GAAGH;AAClD"}
|
|
@@ -6,5 +6,5 @@
|
|
|
6
6
|
*
|
|
7
7
|
* Node 0.8+ compatible.
|
|
8
8
|
*/
|
|
9
|
-
export type StreamToStringCallback = (error?: Error, result?: string) =>
|
|
9
|
+
export type StreamToStringCallback = (error?: Error, result?: string) => void;
|
|
10
10
|
export default function streamToString(stream: NodeJS.ReadableStream, callback: StreamToStringCallback): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/shared/streamToString.ts"],"sourcesContent":["/**\n * Read entire stream content as string\n *\n * Handles both flowing streams and streams that have already\n * buffered data (using readable stream semantics).\n *\n * Node 0.8+ compatible.\n */\n\nimport oo from 'on-one';\nimport { bufferFrom } from './compat.ts';\n\nexport type StreamToStringCallback = (error?: Error, result?: string) =>
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/shared/streamToString.ts"],"sourcesContent":["/**\n * Read entire stream content as string\n *\n * Handles both flowing streams and streams that have already\n * buffered data (using readable stream semantics).\n *\n * Node 0.8+ compatible.\n */\n\nimport oo from 'on-one';\nimport { bufferFrom } from './compat.ts';\n\nexport type StreamToStringCallback = (error?: Error, result?: string) => void;\n\nexport default function streamToString(stream: NodeJS.ReadableStream, callback: StreamToStringCallback): void {\n const chunks: Buffer[] = [];\n\n // Handle data from the stream\n stream.on('data', (chunk: Buffer | string) => {\n if (typeof chunk === 'string') {\n chunks.push(bufferFrom(chunk, 'utf8'));\n } else {\n chunks.push(chunk);\n }\n });\n\n // Handle stream end events using on-one for Node 0.8 compatibility\n oo(stream, ['error', 'end', 'close'], (err?: Error) => {\n if (err) {\n callback(err);\n } else {\n const content = Buffer.concat(chunks).toString('utf8');\n callback(null, content);\n }\n });\n\n // Ensure stream is flowing (in case it's paused)\n if (typeof (stream as NodeJS.ReadStream).resume === 'function') {\n (stream as NodeJS.ReadStream).resume();\n }\n}\n"],"names":["oo","bufferFrom","streamToString","stream","callback","chunks","on","chunk","push","err","content","Buffer","concat","toString","resume"],"mappings":"AAAA;;;;;;;CAOC,GAED,OAAOA,QAAQ,SAAS;AACxB,SAASC,UAAU,QAAQ,cAAc;AAIzC,eAAe,SAASC,eAAeC,MAA6B,EAAEC,QAAgC;IACpG,MAAMC,SAAmB,EAAE;IAE3B,8BAA8B;IAC9BF,OAAOG,EAAE,CAAC,QAAQ,CAACC;QACjB,IAAI,OAAOA,UAAU,UAAU;YAC7BF,OAAOG,IAAI,CAACP,WAAWM,OAAO;QAChC,OAAO;YACLF,OAAOG,IAAI,CAACD;QACd;IACF;IAEA,mEAAmE;IACnEP,GAAGG,QAAQ;QAAC;QAAS;QAAO;KAAQ,EAAE,CAACM;QACrC,IAAIA,KAAK;YACPL,SAASK;QACX,OAAO;YACL,MAAMC,UAAUC,OAAOC,MAAM,CAACP,QAAQQ,QAAQ,CAAC;YAC/CT,SAAS,MAAMM;QACjB;IACF;IAEA,iDAAiD;IACjD,IAAI,OAAO,AAACP,OAA6BW,MAAM,KAAK,YAAY;QAC7DX,OAA6BW,MAAM;IACtC;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function validateAttributes(attributes: object, keys: string[]):
|
|
1
|
+
export default function validateAttributes(attributes: object, keys: string[]): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/validateAttributes.ts"],"sourcesContent":["export default function validateAttributes(attributes: object, keys: string[]):
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/validateAttributes.ts"],"sourcesContent":["export default function validateAttributes(attributes: object, keys: string[]): void {\n for (let index = 0; index < keys.length; index++) {\n const key = keys[index];\n if (attributes[key] === undefined) throw new Error(`Missing attribute ${key}.Attributes ${JSON.stringify(attributes)}`);\n }\n}\n"],"names":["validateAttributes","attributes","keys","index","length","key","undefined","Error","JSON","stringify"],"mappings":"AAAA,eAAe,SAASA,mBAAmBC,UAAkB,EAAEC,IAAc;IAC3E,IAAK,IAAIC,QAAQ,GAAGA,QAAQD,KAAKE,MAAM,EAAED,QAAS;QAChD,MAAME,MAAMH,IAAI,CAACC,MAAM;QACvB,IAAIF,UAAU,CAACI,IAAI,KAAKC,WAAW,MAAM,IAAIC,MAAM,CAAC,kBAAkB,EAAEF,IAAI,YAAY,EAAEG,KAAKC,SAAS,CAACR,aAAa;IACxH;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "extract-base-iterator",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Base iterator for extract iterators like tar-iterator and zip-iterator",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"extract",
|
|
@@ -53,13 +53,13 @@
|
|
|
53
53
|
"pako": "~1.0.11",
|
|
54
54
|
"queue-cb": "^1.0.0",
|
|
55
55
|
"readable-stream": "^2.3.8",
|
|
56
|
-
"stack-base-iterator": "^
|
|
56
|
+
"stack-base-iterator": "^3.0.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@types/mocha": "*",
|
|
60
60
|
"@types/node": "*",
|
|
61
61
|
"cr": "^0.1.0",
|
|
62
|
-
"fs-iterator": "^
|
|
62
|
+
"fs-iterator": "^7.0.0",
|
|
63
63
|
"fs-stats-spys": "^1.0.0",
|
|
64
64
|
"node-version-use": "*",
|
|
65
65
|
"pinkie-promise": "*",
|