electron-builder-util
Advanced tools
Comparing version 19.19.0 to 19.20.0
@@ -14,3 +14,3 @@ "use strict"; | ||
Arch[Arch["armv7l"] = 2] = "armv7l"; | ||
})(Arch || (exports.Arch = Arch = {})); | ||
})(exports.Arch = Arch = Arch || (exports.Arch = Arch = {})); | ||
function toLinuxArchString(arch) { | ||
@@ -23,13 +23,13 @@ return arch === Arch.ia32 ? "i386" : arch === Arch.x64 ? "amd64" : "armv7l"; | ||
function archFromString(name) { | ||
if (name === "x64") { | ||
return Arch.x64; | ||
switch (name) { | ||
case "x64": | ||
return Arch.x64; | ||
case "ia32": | ||
return Arch.ia32; | ||
case "armv7l": | ||
return Arch.armv7l; | ||
default: | ||
throw new Error(`Unsupported arch ${name}`); | ||
} | ||
if (name === "ia32") { | ||
return Arch.ia32; | ||
} | ||
if (name === "armv7l") { | ||
return Arch.armv7l; | ||
} | ||
throw new Error(`Unsupported arch ${name}`); | ||
} | ||
//# sourceMappingURL=arch.js.map |
@@ -42,2 +42,8 @@ "use strict"; | ||
var _lazyVal; | ||
function _load_lazyVal() { | ||
return _lazyVal = require("lazy-val"); | ||
} | ||
var _semver; | ||
@@ -57,3 +63,3 @@ | ||
const macOsVersion = new (_util || _load_util()).Lazy((0, (_bluebirdLst || _load_bluebirdLst()).coroutine)(function* () { | ||
const macOsVersion = new (_lazyVal || _load_lazyVal()).Lazy((0, (_bluebirdLst || _load_bluebirdLst()).coroutine)(function* () { | ||
const file = yield (0, (_fsExtraP || _load_fsExtraP()).readFile)("/System/Library/CoreServices/SystemVersion.plist", "utf8"); | ||
@@ -60,0 +66,0 @@ const matches = /<key>ProductVersion<\/key>[\s\S]*<string>([\d.]+)<\/string>/.exec(file); |
@@ -91,3 +91,3 @@ "use strict"; | ||
function _load_http() { | ||
return _http = _interopRequireWildcard(require("http")); | ||
return _http = require("http"); | ||
} | ||
@@ -169,3 +169,3 @@ | ||
return cancellationToken.createPromise((resolve, reject, onCancel) => { | ||
const request = (options.protocol === "http:" ? _http || _load_http() : _https || _load_https()).request(options, response => { | ||
const request = (options.protocol === "http:" ? (_http || _load_http()).request : (_https || _load_https()).request)(options, response => { | ||
try { | ||
@@ -172,0 +172,0 @@ this.handleResponse(response, options, cancellationToken, resolve, reject, redirectCount, requestProcessor); |
147
out/tmp.js
@@ -8,2 +8,8 @@ "use strict"; | ||
var _asyncExitHook; | ||
function _load_asyncExitHook() { | ||
return _asyncExitHook = _interopRequireDefault(require("async-exit-hook")); | ||
} | ||
var _bluebirdLst; | ||
@@ -21,2 +27,8 @@ | ||
var _lazyVal; | ||
function _load_lazyVal() { | ||
return _lazyVal = require("lazy-val"); | ||
} | ||
var _os; | ||
@@ -36,8 +48,2 @@ | ||
var _log; | ||
function _load_log() { | ||
return _log = require("./log"); | ||
} | ||
var _util; | ||
@@ -53,68 +59,97 @@ | ||
process.setMaxListeners(30); | ||
let tempDirPromise; | ||
let tempDir; | ||
function getTempDir() { | ||
if (tempDirPromise == null) { | ||
let promise; | ||
const systemTmpDir = process.env.TEST_DIR || (0, (_os || _load_os()).tmpdir)(); | ||
if ((_fsExtraP || _load_fsExtraP()).mkdtemp == null) { | ||
const dir = _path.join(systemTmpDir, (0, (_util || _load_util()).getTempName)("electron-builder")); | ||
promise = (0, (_fsExtraP || _load_fsExtraP()).mkdirs)(dir, { mode: 448 }).then(() => dir); | ||
} else { | ||
promise = (0, (_fsExtraP || _load_fsExtraP()).mkdtemp)(`${_path.join(systemTmpDir, "electron-builder")}-`); | ||
} | ||
tempDirPromise = promise.then(dir => { | ||
tempDir = dir; | ||
const cleanup = () => { | ||
if (tempDir == null) { | ||
return; | ||
let tmpFileCounter = 0; | ||
const tmpDirManagers = new Set(); | ||
const tempDir = new (_lazyVal || _load_lazyVal()).Lazy(() => { | ||
let promise; | ||
const systemTmpDir = process.env.TEST_DIR || (0, (_os || _load_os()).tmpdir)(); | ||
if ((_fsExtraP || _load_fsExtraP()).mkdtemp == null) { | ||
const dir = _path.join(systemTmpDir, (0, (_util || _load_util()).getTempName)("electron-builder")); | ||
promise = (0, (_fsExtraP || _load_fsExtraP()).mkdirs)(dir, { mode: 448 }).then(() => dir); | ||
} else { | ||
promise = (0, (_fsExtraP || _load_fsExtraP()).mkdtemp)(`${_path.join(systemTmpDir, "electron-builder")}-`); | ||
} | ||
return promise.then(dir => { | ||
(0, (_asyncExitHook || _load_asyncExitHook()).default)(callback => { | ||
const managers = Array.from(tmpDirManagers); | ||
tmpDirManagers.clear(); | ||
if (callback == null) { | ||
for (const manger of managers) { | ||
manger.cleanupSync(); | ||
} | ||
tempDir = null; | ||
try { | ||
(0, (_fsExtraP || _load_fsExtraP()).removeSync)(dir); | ||
} catch (e) { | ||
if (e.code !== "EPERM") { | ||
(0, (_log || _load_log()).warn)(`Cannot delete temporary dir "${dir}": ${(e.stack || e).toString()}`); | ||
} | ||
handleError(e, dir); | ||
} | ||
}; | ||
process.once("beforeExit", () => { | ||
if (tempDir == null) { | ||
return; | ||
} | ||
tempDir = null; | ||
return; | ||
} | ||
// each instead of map to avoid fs overload | ||
(_bluebirdLst || _load_bluebirdLst()).default.each(managers, it => it.cleanup()).then(() => (0, (_fsExtraP || _load_fsExtraP()).remove)(dir)).then(() => callback()).catch(e => { | ||
try { | ||
(0, (_fsExtraP || _load_fsExtraP()).remove)(dir); | ||
} catch (e) { | ||
if (e.code !== "EPERM") { | ||
(0, (_log || _load_log()).warn)(`Cannot delete temporary dir "${dir}": ${(e.stack || e).toString()}`); | ||
} | ||
handleError(e, dir); | ||
} finally { | ||
callback(); | ||
} | ||
}); | ||
process.on("exit", cleanup); | ||
process.on("uncaughtException", cleanup); | ||
process.on("SIGINT", cleanup); | ||
return dir; | ||
}); | ||
return dir; | ||
}); | ||
}); | ||
function handleError(e, file) { | ||
if (e.code !== "EPERM" && e.code !== "ENOENT") { | ||
// use only console.* instead of our warn on exit (otherwise nodeEmoji can be required on request) | ||
console.warn(`Cannot delete temporary "${file}": ${(e.stack || e).toString()}`); | ||
} | ||
return tempDirPromise; | ||
} | ||
let tmpFileCounter = 0; | ||
class TmpDir { | ||
constructor() { | ||
this.tempFiles = []; | ||
this.registered = false; | ||
} | ||
getTempDir(suffix) { | ||
return this.getTempFile(suffix, true); | ||
} | ||
getTempFile(suffix) { | ||
if (this.tempPrefixPromise == null) { | ||
this.tempPrefixPromise = getTempDir().then(it => _path.join(it, (tmpFileCounter++).toString(16))); | ||
} | ||
return this.tempPrefixPromise.then(it => { | ||
const result = `${it}-${(tmpFileCounter++).toString(16)}${suffix.length === 0 || suffix.startsWith(".") ? suffix : `-${suffix}`}`; | ||
this.tempFiles.push(result); | ||
let isDir = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; | ||
let disposer = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; | ||
return tempDir.value.then(it => { | ||
if (!this.registered) { | ||
this.registered = true; | ||
tmpDirManagers.add(this); | ||
} | ||
const result = `${it}${_path.sep}${(tmpFileCounter++).toString(16)}${suffix.length === 0 || suffix.startsWith(".") ? suffix : `-${suffix}`}`; | ||
this.tempFiles.push({ path: result, isDir, disposer }); | ||
return result; | ||
}); | ||
} | ||
cleanupSync() { | ||
const tempFiles = this.tempFiles; | ||
tmpDirManagers.delete(this); | ||
this.registered = false; | ||
if (tempFiles.length === 0) { | ||
return; | ||
} | ||
this.tempFiles = []; | ||
for (const file of tempFiles) { | ||
if (file.disposer != null) { | ||
// noinspection JSIgnoredPromiseFromCall | ||
file.disposer(file.path); | ||
continue; | ||
} | ||
try { | ||
if (file.isDir) { | ||
(0, (_fsExtraP || _load_fsExtraP()).removeSync)(file.path); | ||
} else { | ||
(0, (_fsExtraP || _load_fsExtraP()).unlinkSync)(file.path); | ||
} | ||
} catch (e) { | ||
handleError(e, file.path); | ||
} | ||
} | ||
} | ||
cleanup() { | ||
const tempFiles = this.tempFiles; | ||
tmpDirManagers.delete(this); | ||
this.registered = false; | ||
if (tempFiles.length === 0) { | ||
@@ -124,8 +159,8 @@ return (_bluebirdLst || _load_bluebirdLst()).default.resolve(); | ||
this.tempFiles = []; | ||
this.tempPrefixPromise = null; | ||
return (_bluebirdLst || _load_bluebirdLst()).default.map(tempFiles, it => { | ||
(0, (_fsExtraP || _load_fsExtraP()).remove)(it).catch(e => { | ||
if (e.code !== "EPERM") { | ||
(0, (_log || _load_log()).warn)(`Cannot delete temporary dir "${it}": ${(e.stack || e).toString()}`); | ||
} | ||
if (it.disposer != null) { | ||
return it.disposer(it.path); | ||
} | ||
return (it.isDir ? (0, (_fsExtraP || _load_fsExtraP()).remove)(it.path) : (0, (_fsExtraP || _load_fsExtraP()).unlink)(it.path)).catch(e => { | ||
handleError(e, it.path); | ||
}); | ||
@@ -132,0 +167,0 @@ }, (_fs || _load_fs()).CONCURRENCY); |
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports.tmpDirCounter = exports.debug7z = exports.debug = exports.archFromString = exports.getArchSuffix = exports.toLinuxArchString = exports.Arch = exports.prepareWindowsExecutableArgs = exports.execWine = exports.isMacOsSierra = exports.Lazy = exports.subTask = exports.task = exports.warn = exports.log = exports.TmpDir = undefined; | ||
exports.tmpDirCounter = exports.debug7z = exports.debug = exports.archFromString = exports.getArchSuffix = exports.toLinuxArchString = exports.Arch = exports.prepareWindowsExecutableArgs = exports.execWine = exports.isMacOsSierra = exports.subTask = exports.task = exports.warn = exports.log = exports.TmpDir = undefined; | ||
@@ -53,15 +53,2 @@ var _tmp; | ||
var _electronBuilderHttp; | ||
function _load_electronBuilderHttp() { | ||
return _electronBuilderHttp = require("electron-builder-http"); | ||
} | ||
Object.defineProperty(exports, "Lazy", { | ||
enumerable: true, | ||
get: function () { | ||
return (_electronBuilderHttp || _load_electronBuilderHttp()).Lazy; | ||
} | ||
}); | ||
var _macosVersion; | ||
@@ -207,2 +194,14 @@ | ||
debug(`Executing ${file} ${args == null ? "" : removePassword(args.join(" "))}`); | ||
if (options != null && options.env != null) { | ||
const diffEnv = Object.assign({}, options.env); | ||
for (const name of Object.keys(process.env)) { | ||
if (process.env[name] !== "") { | ||
delete diffEnv[name]; | ||
} | ||
} | ||
debug(`env: ${safeStringifyJson(diffEnv)}`); | ||
} | ||
if (options != null && options.cwd != null) { | ||
debug(`cwd: ${options.cwd}`); | ||
} | ||
} | ||
@@ -247,2 +246,5 @@ return new (_bluebirdLst || _load_bluebirdLst()).default((resolve, reject) => { | ||
debug(`Spawning ${command} ${command === "docker" ? argsString : removePassword(argsString)}`); | ||
if (options != null && options.cwd != null) { | ||
debug(`cwd: ${options.cwd}`); | ||
} | ||
} | ||
@@ -400,3 +402,3 @@ try { | ||
return JSON.stringify(data, (name, value) => { | ||
if (name.endsWith("Password") || name.endsWith("Token") || name.indexOf("password") !== -1 || name.indexOf("token") !== -1 || skippedNames != null && skippedNames.has(name)) { | ||
if (name.endsWith("Password") || name.endsWith("PASSWORD") || name.endsWith("Token") || name.indexOf("password") !== -1 || name.indexOf("token") !== -1 || skippedNames != null && skippedNames.has(name)) { | ||
return "<stripped sensitive data>"; | ||
@@ -403,0 +405,0 @@ } |
@@ -59,2 +59,8 @@ "use strict"; | ||
var _lazyVal; | ||
function _load_lazyVal() { | ||
return _lazyVal = require("lazy-val"); | ||
} | ||
var _path = _interopRequireWildcard(require("path")); | ||
@@ -94,3 +100,3 @@ | ||
const wineExecutable = new (_util || _load_util()).Lazy((0, (_bluebirdLst || _load_bluebirdLst()).coroutine)(function* () { | ||
const wineExecutable = new (_lazyVal || _load_lazyVal()).Lazy((0, (_bluebirdLst || _load_bluebirdLst()).coroutine)(function* () { | ||
(0, (_util || _load_util()).debug)(`USE_SYSTEM_WINE: ${process.env.USE_SYSTEM_WINE}`); | ||
@@ -97,0 +103,0 @@ if (!(0, (_util || _load_util()).isEnvTrue)(process.env.USE_SYSTEM_WINE) && (yield (0, (_macosVersion || _load_macosVersion()).isMacOsSierra)())) { |
{ | ||
"name": "electron-builder-util", | ||
"version": "19.19.0", | ||
"version": "19.20.0", | ||
"main": "out/util.js", | ||
@@ -14,2 +14,3 @@ "author": "Vladimir Krivosheev", | ||
"dependencies": { | ||
"async-exit-hook": "^2.0.1", | ||
"fs-extra-p": "^4.4.0", | ||
@@ -20,6 +21,6 @@ "fcopy-pre-bundled": "0.3.4", | ||
"bluebird-lst": "^1.0.2", | ||
"chalk": "^2.0.1", | ||
"chalk": "^2.1.0", | ||
"debug": "^2.6.8", | ||
"node-emoji": "^1.8.1", | ||
"electron-builder-http": "~19.19.0", | ||
"electron-builder-http": "~19.20.0", | ||
"source-map-support": "^0.4.15", | ||
@@ -29,5 +30,6 @@ "7zip-bin": "^2.1.0", | ||
"tunnel-agent": "^0.6.0", | ||
"semver": "^5.4.1" | ||
"semver": "^5.4.1", | ||
"lazy-val": "^1.0.2" | ||
}, | ||
"typings": "./out/electron-builder-util.d.ts" | ||
"typings": "./out/util.d.ts" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
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
143864
35
16
1564
28
+ Addedasync-exit-hook@^2.0.1
+ Addedlazy-val@^1.0.2
+ Addedasync-exit-hook@2.0.1(transitive)
+ Addeddebug@3.2.7(transitive)
+ Addedelectron-builder-http@19.20.1(transitive)
+ Addedlazy-val@1.0.5(transitive)
+ Addedms@2.1.3(transitive)
- Removedelectron-builder-http@19.19.0(transitive)
Updatedchalk@^2.1.0