builder-util
Advanced tools
Comparing version 22.11.3 to 22.11.4
/// <reference types="node" /> | ||
import { Stats } from "fs-extra"; | ||
import { Stats } from "fs"; | ||
export declare const MAX_FILE_REQUESTS = 8; | ||
@@ -4,0 +4,0 @@ export declare const CONCURRENCY: { |
@@ -6,2 +6,3 @@ "use strict"; | ||
const fs_extra_1 = require("fs-extra"); | ||
const promises_1 = require("fs/promises"); | ||
const path = require("path"); | ||
@@ -11,3 +12,3 @@ const stat_mode_1 = require("stat-mode"); | ||
const promise_1 = require("./promise"); | ||
const is_ci_1 = require("is-ci"); | ||
const isCI = require("is-ci"); | ||
exports.MAX_FILE_REQUESTS = 8; | ||
@@ -22,3 +23,3 @@ exports.CONCURRENCY = { concurrency: exports.MAX_FILE_REQUESTS }; | ||
function unlinkIfExists(file) { | ||
return fs_extra_1.unlink(file).catch(() => { | ||
return promises_1.unlink(file).catch(() => { | ||
/* ignore */ | ||
@@ -29,3 +30,3 @@ }); | ||
async function statOrNull(file) { | ||
return promise_1.orNullIfFileNotExist(fs_extra_1.stat(file)); | ||
return promise_1.orNullIfFileNotExist(promises_1.stat(file)); | ||
} | ||
@@ -35,3 +36,3 @@ exports.statOrNull = statOrNull; | ||
try { | ||
await fs_extra_1.access(file); | ||
await promises_1.access(file); | ||
return true; | ||
@@ -62,3 +63,3 @@ } | ||
} | ||
const childNames = await promise_1.orIfFileNotExist(fs_extra_1.readdir(dirPath), []); | ||
const childNames = await promise_1.orIfFileNotExist(promises_1.readdir(dirPath), []); | ||
childNames.sort(); | ||
@@ -73,3 +74,3 @@ let nodeModuleContent = null; | ||
const filePath = dirPath + path.sep + name; | ||
return fs_extra_1.lstat(filePath).then(stat => { | ||
return promises_1.lstat(filePath).then(stat => { | ||
if (filter != null && !filter(filePath, stat)) { | ||
@@ -125,5 +126,5 @@ return null; | ||
exports.walk = walk; | ||
const _isUseHardLink = process.platform !== "win32" && process.env.USE_HARD_LINKS !== "false" && (is_ci_1.default || process.env.USE_HARD_LINKS === "true"); | ||
const _isUseHardLink = process.platform !== "win32" && process.env.USE_HARD_LINKS !== "false" && (isCI || process.env.USE_HARD_LINKS === "true"); | ||
function copyFile(src, dest, isEnsureDir = true) { | ||
return (isEnsureDir ? fs_extra_1.ensureDir(path.dirname(dest)) : Promise.resolve()).then(() => copyOrLinkFile(src, dest, null, false)); | ||
return (isEnsureDir ? promises_1.mkdir(path.dirname(dest), { recursive: true }) : Promise.resolve()).then(() => copyOrLinkFile(src, dest, null, false)); | ||
} | ||
@@ -167,3 +168,3 @@ exports.copyFile = copyFile; | ||
if (isUseHardLink) { | ||
return fs_extra_1.link(src, dest).catch(e => { | ||
return promises_1.link(src, dest).catch(e => { | ||
if (e.code === "EXDEV") { | ||
@@ -189,3 +190,3 @@ const isLog = exDevErrorHandler == null ? true : exDevErrorHandler(); | ||
} | ||
return promise.then(() => fs_extra_1.chmod(dest, stats.mode)); | ||
return promise.then(() => promises_1.chmod(dest, stats.mode)); | ||
} | ||
@@ -216,3 +217,3 @@ class FileCopier { | ||
else { | ||
await fs_extra_1.writeFile(dest, data); | ||
await promises_1.writeFile(dest, data); | ||
return; | ||
@@ -259,3 +260,3 @@ } | ||
if (!createdSourceDirs.has(parent)) { | ||
await fs_extra_1.ensureDir(parent.replace(src, destination)); | ||
await promises_1.mkdir(parent.replace(src, destination), { recursive: true }); | ||
createdSourceDirs.add(parent); | ||
@@ -268,6 +269,6 @@ } | ||
else { | ||
links.push({ file: destFile, link: await fs_extra_1.readlink(file) }); | ||
links.push({ file: destFile, link: await promises_1.readlink(file) }); | ||
} | ||
}, | ||
}).then(() => bluebird_lst_1.default.map(links, it => fs_extra_1.symlink(it.link, it.file), exports.CONCURRENCY)); | ||
}).then(() => bluebird_lst_1.default.map(links, it => promises_1.symlink(it.link, it.file), exports.CONCURRENCY)); | ||
} | ||
@@ -274,0 +275,0 @@ exports.copyDir = copyDir; |
{ | ||
"name": "builder-util", | ||
"version": "22.11.3", | ||
"version": "22.11.4", | ||
"main": "out/util.js", | ||
@@ -31,2 +31,3 @@ "author": "Vladimir Krivosheev", | ||
"devDependencies": { | ||
"@types/is-ci": "^3.0.0", | ||
"@types/js-yaml": "^4.0.1", | ||
@@ -33,0 +34,0 @@ "@types/source-map-support": "^0.5.3" |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
121513
1264
3
17