Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@electron/universal

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@electron/universal - npm Package Compare versions

Comparing version 1.4.4 to 1.4.5

65

dist/cjs/asar-utils.js
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.mergeASARs = exports.generateAsarIntegrity = exports.detectAsarMode = exports.AsarMode = void 0;
const asar = require("@electron/asar");
const asar_1 = __importDefault(require("@electron/asar"));
const child_process_1 = require("child_process");
const crypto = require("crypto");
const fs = require("fs-extra");
const path = require("path");
const minimatch = require("minimatch");
const os = require("os");
const crypto_1 = __importDefault(require("crypto"));
const fs_extra_1 = __importDefault(require("fs-extra"));
const path_1 = __importDefault(require("path"));
const minimatch_1 = __importDefault(require("minimatch"));
const os_1 = __importDefault(require("os"));
const debug_1 = require("./debug");

@@ -34,4 +37,4 @@ const LIPO = 'lipo';

debug_1.d('checking asar mode of', appPath);
const asarPath = path.resolve(appPath, 'Contents', 'Resources', 'app.asar');
if (!(await fs.pathExists(asarPath))) {
const asarPath = path_1.default.resolve(appPath, 'Contents', 'Resources', 'app.asar');
if (!(await fs_extra_1.default.pathExists(asarPath))) {
debug_1.d('determined no asar');

@@ -46,5 +49,5 @@ return AsarMode.NO_ASAR;

algorithm: 'SHA256',
hash: crypto
hash: crypto_1.default
.createHash('SHA256')
.update(asar.getRawHeader(asarPath).headerString)
.update(asar_1.default.getRawHeader(asarPath).headerString)
.digest('hex'),

@@ -57,6 +60,6 @@ };

function isDirectory(a, file) {
return Boolean('files' in asar.statFile(a, file));
return Boolean('files' in asar_1.default.statFile(a, file));
}
function checkSingleArch(archive, file, allowList) {
if (allowList === undefined || !minimatch(file, allowList, { matchBase: true })) {
if (allowList === undefined || !minimatch_1.default(file, allowList, { matchBase: true })) {
throw new Error(`Detected unique file "${file}" in "${archive}" not covered by ` +

@@ -68,4 +71,4 @@ `allowList rule: "${allowList}"`);

debug_1.d(`merging ${x64AsarPath} and ${arm64AsarPath}`);
const x64Files = new Set(asar.listPackage(x64AsarPath).map(toRelativePath));
const arm64Files = new Set(asar.listPackage(arm64AsarPath).map(toRelativePath));
const x64Files = new Set(asar_1.default.listPackage(x64AsarPath).map(toRelativePath));
const arm64Files = new Set(asar_1.default.listPackage(arm64AsarPath).map(toRelativePath));
//

@@ -77,3 +80,3 @@ // Build set of unpacked directories and files

for (const file of fileList) {
const stat = asar.statFile(a, file);
const stat = asar_1.default.statFile(a, file);
if (!('unpacked' in stat) || !stat.unpacked) {

@@ -117,4 +120,4 @@ continue;

}
const x64Content = asar.extractFile(x64AsarPath, file);
const arm64Content = asar.extractFile(arm64AsarPath, file);
const x64Content = asar_1.default.extractFile(x64AsarPath, file);
const arm64Content = asar_1.default.extractFile(arm64AsarPath, file);
if (x64Content.compare(arm64Content) === 0) {

@@ -135,24 +138,24 @@ continue;

//
const x64Dir = await fs.mkdtemp(path.join(os.tmpdir(), 'x64-'));
const arm64Dir = await fs.mkdtemp(path.join(os.tmpdir(), 'arm64-'));
const x64Dir = await fs_extra_1.default.mkdtemp(path_1.default.join(os_1.default.tmpdir(), 'x64-'));
const arm64Dir = await fs_extra_1.default.mkdtemp(path_1.default.join(os_1.default.tmpdir(), 'arm64-'));
try {
debug_1.d(`extracting ${x64AsarPath} to ${x64Dir}`);
asar.extractAll(x64AsarPath, x64Dir);
asar_1.default.extractAll(x64AsarPath, x64Dir);
debug_1.d(`extracting ${arm64AsarPath} to ${arm64Dir}`);
asar.extractAll(arm64AsarPath, arm64Dir);
asar_1.default.extractAll(arm64AsarPath, arm64Dir);
for (const file of arm64Unique) {
const source = path.resolve(arm64Dir, file);
const destination = path.resolve(x64Dir, file);
const source = path_1.default.resolve(arm64Dir, file);
const destination = path_1.default.resolve(x64Dir, file);
if (isDirectory(arm64AsarPath, file)) {
debug_1.d(`creating unique directory: ${file}`);
await fs.mkdirp(destination);
await fs_extra_1.default.mkdirp(destination);
continue;
}
debug_1.d(`xopying unique file: ${file}`);
await fs.mkdirp(path.dirname(destination));
await fs.copy(source, destination);
await fs_extra_1.default.mkdirp(path_1.default.dirname(destination));
await fs_extra_1.default.copy(source, destination);
}
for (const binding of commonBindings) {
const source = await fs.realpath(path.resolve(arm64Dir, binding));
const destination = await fs.realpath(path.resolve(x64Dir, binding));
const source = await fs_extra_1.default.realpath(path_1.default.resolve(arm64Dir, binding));
const destination = await fs_extra_1.default.realpath(path_1.default.resolve(x64Dir, binding));
debug_1.d(`merging binding: ${binding}`);

@@ -162,3 +165,3 @@ child_process_1.execFileSync(LIPO, [source, destination, '-create', '-output', destination]);

debug_1.d(`creating archive at ${outputAsarPath}`);
const resolvedUnpack = Array.from(unpackedFiles).map((file) => path.join(x64Dir, file));
const resolvedUnpack = Array.from(unpackedFiles).map((file) => path_1.default.join(x64Dir, file));
let unpack;

@@ -171,3 +174,3 @@ if (resolvedUnpack.length > 1) {

}
await asar.createPackageWithOptions(x64Dir, outputAsarPath, {
await asar_1.default.createPackageWithOptions(x64Dir, outputAsarPath, {
unpack,

@@ -178,5 +181,5 @@ });

finally {
await Promise.all([fs.remove(x64Dir), fs.remove(arm64Dir)]);
await Promise.all([fs_extra_1.default.remove(x64Dir), fs_extra_1.default.remove(arm64Dir)]);
}
};
//# sourceMappingURL=asar-utils.js.map

@@ -1,2 +0,2 @@

import * as debug from 'debug';
import debug from 'debug';
export declare const d: debug.Debugger;
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.d = void 0;
const debug = require("debug");
exports.d = debug('electron-universal');
const debug_1 = __importDefault(require("debug"));
exports.d = debug_1.default('electron-universal');
//# sourceMappingURL=debug.js.map
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getAllAppFiles = exports.AppFileType = void 0;
const cross_spawn_promise_1 = require("@malept/cross-spawn-promise");
const fs = require("fs-extra");
const path = require("path");
const fs = __importStar(require("fs-extra"));
const path = __importStar(require("path"));
const MACHO_PREFIX = 'Mach-O ';

@@ -8,0 +27,0 @@ var AppFileType;

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __rest = (this && this.__rest) || function (s, e) {

@@ -13,12 +32,15 @@ var t = {};

};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.makeUniversalApp = void 0;
const cross_spawn_promise_1 = require("@malept/cross-spawn-promise");
const asar = require("@electron/asar");
const fs = require("fs-extra");
const minimatch = require("minimatch");
const os = require("os");
const path = require("path");
const plist = require("plist");
const dircompare = require("dir-compare");
const asar = __importStar(require("@electron/asar"));
const fs = __importStar(require("fs-extra"));
const minimatch_1 = __importDefault(require("minimatch"));
const os = __importStar(require("os"));
const path = __importStar(require("path"));
const plist = __importStar(require("plist"));
const dircompare = __importStar(require("dir-compare"));
const file_utils_1 = require("./file-utils");

@@ -101,3 +123,3 @@ const asar_utils_1 = require("./asar-utils");

if (opts.x64ArchFiles === undefined ||
!minimatch(machOFile.relativePath, opts.x64ArchFiles, { matchBase: true })) {
!minimatch_1.default(machOFile.relativePath, opts.x64ArchFiles, { matchBase: true })) {
throw new Error(`Detected file "${machOFile.relativePath}" that's the same in both x64 and arm64 builds and not covered by the ` +

@@ -213,3 +235,3 @@ `x64ArchFiles rule: "${opts.x64ArchFiles}"`);

const injectAsarIntegrity = !opts.infoPlistsToIgnore ||
minimatch(plistFile.relativePath, opts.infoPlistsToIgnore, { matchBase: true });
minimatch_1.default(plistFile.relativePath, opts.infoPlistsToIgnore, { matchBase: true });
const mergedPlist = injectAsarIntegrity

@@ -216,0 +238,0 @@ ? Object.assign(Object.assign({}, x64Plist), { ElectronAsarIntegrity: generatedIntegrity }) : Object.assign({}, x64Plist);

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.sha = void 0;
const fs = require("fs-extra");
const crypto = require("crypto");
const fs = __importStar(require("fs-extra"));
const crypto = __importStar(require("crypto"));
const debug_1 = require("./debug");

@@ -7,0 +26,0 @@ exports.sha = async (filePath) => {

@@ -1,8 +0,8 @@

import * as asar from '@electron/asar';
import asar from '@electron/asar';
import { execFileSync } from 'child_process';
import * as crypto from 'crypto';
import * as fs from 'fs-extra';
import * as path from 'path';
import * as minimatch from 'minimatch';
import * as os from 'os';
import crypto from 'crypto';
import fs from 'fs-extra';
import path from 'path';
import minimatch from 'minimatch';
import os from 'os';
import { d } from './debug';

@@ -9,0 +9,0 @@ const LIPO = 'lipo';

@@ -1,2 +0,2 @@

import * as debug from 'debug';
import debug from 'debug';
export declare const d: debug.Debugger;

@@ -1,3 +0,3 @@

import * as debug from 'debug';
import debug from 'debug';
export const d = debug('electron-universal');
//# sourceMappingURL=debug.js.map

@@ -15,3 +15,3 @@ var __rest = (this && this.__rest) || function (s, e) {

import * as fs from 'fs-extra';
import * as minimatch from 'minimatch';
import minimatch from 'minimatch';
import * as os from 'os';

@@ -18,0 +18,0 @@ import * as path from 'path';

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const electron_1 = require("electron");
const path_1 = require("path");
const path_1 = __importDefault(require("path"));
if (process.arch === 'arm64') {

@@ -6,0 +9,0 @@ setPaths('arm64');

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const electron_1 = require("electron");
const path_1 = require("path");
const path_1 = __importDefault(require("path"));
if (process.arch === 'arm64') {

@@ -6,0 +9,0 @@ setPaths('arm64');

{
"name": "@electron/universal",
"version": "1.4.4",
"version": "1.4.5",
"description": "Utility for creating Universal macOS applications from two x64 and arm64 Electron applications",

@@ -5,0 +5,0 @@ "main": "dist/cjs/index.js",

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

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc