Add: node_modules

This commit is contained in:
Cutls
2019-09-12 23:38:13 +09:00
parent 4769c83958
commit 25a1db84a4
7934 changed files with 956263 additions and 1 deletions

Binary file not shown.

View File

@@ -0,0 +1,23 @@
Copyright (c) 2015-2016 Zhuo Lu, Jason Hinkle, et al.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
</dict>
</plist>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
</dict>
</plist>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.inherit</key>
<true/>
</dict>
</plist>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
</dict>
</plist>

View File

@@ -0,0 +1,149 @@
/**
* @module flat
*/
'use strict'
const path = require('path')
const util = require('./util')
const debuglog = util.debuglog
const debugwarn = util.debugwarn
const execFileAsync = util.execFileAsync
const validateOptsAppAsync = util.validateOptsAppAsync
const validateOptsPlatformAsync = util.validateOptsPlatformAsync
const Identity = require('./util-identities').findIdentitiesAsync
const findIdentitiesAsync = require('./util-identities').findIdentitiesAsync
/**
* This function returns a promise validating all options passed in opts.
* @function
* @param {Object} opts - Options.
* @returns {Promise} Promise.
*/
function validateFlatOptsAsync (opts) {
if (opts.pkg) {
if (typeof opts.pkg !== 'string') return Promise.reject(new Error('`pkg` must be a string.'))
if (path.extname(opts.pkg) !== '.pkg') return Promise.reject(new Error('Extension of output package must be `.pkg`.'))
} else {
debugwarn('No `pkg` passed in arguments, will fallback to default inferred from the given application.')
opts.pkg = path.join(path.dirname(opts.app), path.basename(opts.app, '.app') + '.pkg')
}
if (opts.install) {
if (typeof opts.install !== 'string') return Promise.reject(new Error('`install` must be a string.'))
} else {
debugwarn('No `install` passed in arguments, will fallback to default `/Applications`.')
opts.install = '/Applications'
}
return Promise.all([
validateOptsAppAsync(opts),
validateOptsPlatformAsync(opts),
])
}
/**
* This function returns a promise flattening the application.
* @function
* @param {Object} opts - Options.
* @returns {Promise} Promise.
*/
function flatApplicationAsync (opts) {
const args = [
'--component', opts.app, opts.install,
'--sign', opts.identity.name,
opts.pkg
]
if (opts.keychain) {
args.unshift('--keychain', opts.keychain)
}
if (opts.scripts) {
args.unshift('--scripts', opts.scripts)
}
debuglog('Flattening... ' + opts.app)
return execFileAsync('productbuild', args)
.thenReturn(undefined)
}
/**
* This function is exported and returns a promise flattening the application.
* @function
* @param {Object} opts - Options.
* @returns {Promise} Promise.
*/
module.exports.flatAsync = function (opts) {
return validateFlatOptsAsync(opts)
.then(function () {
let promise
if (opts.identity) {
debuglog('`identity` passed in arguments.')
if (opts['identity-validation'] === false || opts.identity instanceof Identity) {
return Promise.resolve()
}
promise = findIdentitiesAsync(opts, opts.identity)
} else {
debugwarn('No `identity` passed in arguments...')
if (opts.platform === 'mas') {
debuglog('Finding `3rd Party Mac Developer Installer` certificate for flattening app distribution in the Mac App Store...')
promise = findIdentitiesAsync(opts, '3rd Party Mac Developer Installer:')
} else {
debuglog('Finding `Developer ID Application` certificate for distribution outside the Mac App Store...')
promise = findIdentitiesAsync(opts, 'Developer ID Installer:')
}
}
return promise
.then(function (identities) {
if (identities.length > 0) {
// Provisioning profile(s) found
if (identities.length > 1) {
debugwarn('Multiple identities found, will use the first discovered.')
} else {
debuglog('Found 1 identity.')
}
opts.identity = identities[0]
} else {
// No identity found
return Promise.reject(new Error('No identity found for signing.'))
}
})
})
.then(function () {
// Pre-flat operations
})
.then(function () {
debuglog('Flattening application...', '\n',
'> Application:', opts.app, '\n',
'> Package output:', opts.pkg, '\n',
'> Install path:', opts.install, '\n',
'> Identity:', opts.identity, '\n',
'> Scripts:', opts.scripts)
return flatApplicationAsync(opts)
})
.then(function () {
// Post-flat operations
debuglog('Application flattened.')
})
}
/**
* This function is exported with normal callback implementation.
* @function
* @param {Object} opts - Options.
* @param {RequestCallback} cb - Callback.
*/
module.exports.flat = function (opts, cb) {
module.exports.flatAsync(opts)
.then(function () {
debuglog('Application flattened, saved to: ' + opts.app)
if (cb) cb()
})
.catch(function (err) {
debuglog('Flat failed:')
if (err.message) debuglog(err.message)
else if (err.stack) debuglog(err.stack)
else debuglog(err)
if (cb) cb(err)
})
}

View File

@@ -0,0 +1,35 @@
interface BaseSignOptions {
app: string
identity?: string
platform?: string
keychain?: string
}
interface SignOptions extends BaseSignOptions {
binaries?: Array<string>
entitlements?: string
"entitlements-inherit"?: string
"gatekeeper-assess"?: boolean
ignore?: string
"pre-auto-entitlements"?: boolean
"pre-embed-provisioning-profile"?: boolean
"provisioning-profile"?: string
"requirements"?: string
"type"?: string
version?: string
"identity-validation"?: boolean
}
export function sign(opts: SignOptions, callback: (error: Error) => void): void
export function signAsync(opts: SignOptions): Promise<any>
interface FlatOptions extends BaseSignOptions {
install?: string
pkg?: string
scripts?: string
}
export function flat(opts: FlatOptions, callback: (error: Error) => void): void
export function flatAsync(opts: FlatOptions): Promise<any>

View File

@@ -0,0 +1,47 @@
/**
* @module electron-osx-sign
*/
'use strict'
const sign = require('./sign')
const flat = require('./flat')
/**
* This function is a normal callback implementation.
* @param {Object} opts - Options.
* @param {RequestCallback} cb - Callback.
*/
module.exports = sign.sign // Aliasing
/**
* This function is a normal callback implementation.
* @function
* @param {Object} opts - Options.
* @param {RequestCallback} cb - Callback.
*/
module.exports.sign = sign.sign
/**
* This function returns a promise signing the application.
* @function
* @param {mixed} opts - Options.
* @returns {Promise} Promise.
*/
module.exports.signAsync = sign.signAsync
/**
* This function is exported with normal callback implementation.
* @function
* @param {Object} opts - Options.
* @param {RequestCallback} cb - Callback.
*/
module.exports.flat = flat.flat
/**
* This function is exported and returns a promise flattening the application.
* @function
* @param {Object} opts - Options.
* @returns {Promise} Promise.
*/
module.exports.flatAsync = flat.flatAsync

View File

@@ -0,0 +1,365 @@
/**
* @module sign
*/
'use strict'
const path = require('path')
const semver = require('semver')
const util = require('./util')
const debuglog = util.debuglog
const debugwarn = util.debugwarn
const getAppContentsPath = util.getAppContentsPath
const execFileAsync = util.execFileAsync
const validateOptsAppAsync = util.validateOptsAppAsync
const validateOptsPlatformAsync = util.validateOptsPlatformAsync
const walkAsync = util.walkAsync
const Identity = require('./util-identities').Identity
const findIdentitiesAsync = require('./util-identities').findIdentitiesAsync
const ProvisioningProfile = require('./util-provisioning-profiles').ProvisioningProfile
const preEmbedProvisioningProfile = require('./util-provisioning-profiles').preEmbedProvisioningProfile
const preAutoEntitlements = require('./util-entitlements').preAutoEntitlements
const osRelease = require('os').release()
/**
* This function returns a promise validating opts.binaries, the additional binaries to be signed along with the discovered enclosed components.
* @function
* @param {Object} opts - Options.
* @returns {Promise} Promise.
*/
function validateOptsBinariesAsync (opts) {
return new Promise(function (resolve, reject) {
if (opts.binaries) {
if (!Array.isArray(opts.binaries)) {
reject(new Error('Additional binaries should be an Array.'))
return
}
// TODO: Presence check for binary files, reject if any does not exist
}
resolve()
})
}
/**
* This function returns a promise validating all options passed in opts.
* @function
* @param {Object} opts - Options.
* @returns {Promise} Promise.
*/
function validateSignOptsAsync (opts) {
if (opts.ignore && !(opts.ignore instanceof Array)) {
opts.ignore = [opts.ignore]
}
if (opts['provisioning-profile']) {
if (typeof opts['provisioning-profile'] !== 'string' && !(opts['provisioning-profile'] instanceof ProvisioningProfile)) return Promise.reject(new Error('Path to provisioning profile should be a string or a ProvisioningProfile object.'))
}
if (opts['type']) {
if (opts['type'] !== 'development' && opts['type'] !== 'distribution') return Promise.reject(new Error('Type must be either `development` or `distribution`.'))
} else {
opts['type'] = 'distribution'
}
return Promise.all([
validateOptsAppAsync(opts),
validateOptsPlatformAsync(opts),
validateOptsBinariesAsync(opts),
])
}
/**
* This function returns a promise verifying the code sign of application bundle.
* @function
* @param {Object} opts - Options.
* @returns {Promise} Promise resolving output.
*/
function verifySignApplicationAsync (opts) {
// Verify with codesign
const semver = require('semver')
debuglog('Verifying application bundle with codesign...')
let promise = execFileAsync('codesign', [
'--verify',
'--deep'
]
.concat(
opts['strict-verify'] !== false &&
semver.gte(osRelease, '15.0.0') >= 0 // Only pass strict flag in El Capitan and later
? ['--strict' +
(opts['strict-verify']
? '=' + opts['strict-verify'] // Array should be converted to a comma separated string
: '')]
: [],
['--verbose=2', opts.app]))
// Additionally test Gatekeeper acceptance for darwin platform
if (opts.platform === 'darwin' && opts['gatekeeper-assess'] !== false) {
promise = promise
.then(function () {
debuglog('Verifying Gatekeeper acceptance for darwin platform...')
return execFileAsync('spctl', [
'--assess',
'--type', 'execute',
'--verbose',
'--ignore-cache',
'--no-cache',
opts.app
])
})
}
return promise
.thenReturn()
}
/**
* This function returns a promise codesigning only.
* @function
* @param {Object} opts - Options.
* @returns {Promise} Promise.
*/
function signApplicationAsync (opts) {
return walkAsync(getAppContentsPath(opts))
.then(async function (childPaths) {
function ignoreFilePath (opts, filePath) {
if (opts.ignore) {
return opts.ignore.some(function (ignore) {
if (typeof ignore === 'function') {
return ignore(filePath)
}
return filePath.match(ignore)
})
}
return false
}
if (opts.binaries) childPaths = childPaths.concat(opts.binaries)
const args = [
'--sign', opts.identity.hash || opts.identity.name,
'--force'
]
if (opts.keychain) {
args.push('--keychain', opts.keychain)
}
if (opts.requirements) {
args.push('--requirements', opts.requirements)
}
if (opts.timestamp) {
args.push('--timestamp=' + opts.timestamp)
}
if (opts.hardenedRuntime || opts['hardened-runtime']) {
// 17.7.0 === 10.13.6
if (semver.gte(osRelease, '17.7.0') >= 0) {
args.push('--options', 'runtime')
} else {
debuglog('Not enabling hardened runtime, current macOS version too low, requires 10.13.6 and higher')
}
}
if (opts.entitlements) {
// Sign with entitlements
for (const filePath of childPaths) {
if (ignoreFilePath(opts, filePath)) {
debuglog('Skipped... ' + filePath)
continue
}
debuglog('Signing... ' + filePath)
await execFileAsync('codesign', args.concat('--entitlements', opts['entitlements-inherit'], filePath))
}
debuglog('Signing... ' + opts.app)
await execFileAsync('codesign', args.concat('--entitlements', opts.entitlements, opts.app))
} else {
for (const filePath of childPaths) {
if (ignoreFilePath(opts, filePath)) {
debuglog('Skipped... ' + filePath)
continue
}
debuglog('Signing... ' + filePath)
await execFileAsync('codesign', args.concat(filePath))
}
debuglog('Signing... ' + opts.app)
await execFileAsync('codesign', args.concat(opts.app))
}
// Verify code sign
debuglog('Verifying...')
await verifySignApplicationAsync(opts)
debuglog('Verified.')
// Check entitlements if applicable
if (opts.entitlements) {
debuglog('Displaying entitlements...')
const result = await execFileAsync('codesign', [
'--display',
'--entitlements', ':-', // Write to standard output and strip off the blob header
opts.app
])
debuglog('Entitlements:', '\n', result)
}
})
}
/**
* This function returns a promise signing the application.
* @function
* @param {mixed} opts - Options.
* @returns {Promise} Promise.
*/
const signAsync = module.exports.signAsync = function (opts) {
return validateSignOptsAsync(opts)
.then(function () {
// Determine identity for signing
let promise
if (opts.identity) {
debuglog('`identity` passed in arguments.')
if (opts['identity-validation'] === false) {
if (!(opts.identity instanceof Identity)) {
opts.identity = new Identity(opts.identity)
}
return Promise.resolve()
}
promise = findIdentitiesAsync(opts, opts.identity)
} else {
debugwarn('No `identity` passed in arguments...')
if (opts.platform === 'mas') {
if (opts.type === 'distribution') {
debuglog('Finding `3rd Party Mac Developer Application` certificate for signing app distribution in the Mac App Store...')
promise = findIdentitiesAsync(opts, '3rd Party Mac Developer Application:')
} else {
debuglog('Finding `Mac Developer` certificate for signing app in development for the Mac App Store signing...')
promise = findIdentitiesAsync(opts, 'Mac Developer:')
}
} else {
debuglog('Finding `Developer ID Application` certificate for distribution outside the Mac App Store...')
promise = findIdentitiesAsync(opts, 'Developer ID Application:')
}
}
return promise
.then(function (identities) {
if (identities.length > 0) {
// Identity(/ies) found
if (identities.length > 1) {
debugwarn('Multiple identities found, will use the first discovered.')
} else {
debuglog('Found 1 identity.')
}
opts.identity = identities[0]
} else {
// No identity found
return Promise.reject(new Error('No identity found for signing.'))
}
})
})
.then(function () {
// Determine entitlements for code signing
let filePath
if (opts.platform === 'mas') {
// To sign apps for Mac App Store, an entitlements file is required, especially for app sandboxing (as well some other services).
// Fallback entitlements for sandboxing by default: Note this may cause troubles while running an signed app due to missing keys special to the project.
// Further reading: https://developer.apple.com/library/mac/documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/EnablingAppSandbox.html
if (!opts.entitlements) {
filePath = path.join(__dirname, 'default.entitlements.mas.plist')
debugwarn('No `entitlements` passed in arguments:', '\n',
'* Sandbox entitlements are required for Mac App Store distribution, your codesign entitlements file is default to:', filePath)
opts.entitlements = filePath
}
if (!opts['entitlements-inherit']) {
filePath = path.join(__dirname, 'default.entitlements.mas.inherit.plist')
debugwarn('No `entitlements-inherit` passed in arguments:', '\n',
'* Sandbox entitlements file for enclosing app files is default to:', filePath)
opts['entitlements-inherit'] = filePath
}
} else {
// Not necessary to have entitlements for non Mac App Store distribution
if (!opts.entitlements) {
debugwarn('No `entitlements` passed in arguments:', '\n',
'* Provide `entitlements` to specify entitlements file for codesign.')
} else {
// If entitlements is provided as a flag, fallback to default
if (opts.entitlements === true) {
filePath = path.join(__dirname, 'default.entitlements.darwin.plist')
debugwarn('`entitlements` not specified in arguments:', '\n',
'* Provide `entitlements` to specify entitlements file for codesign.', '\n',
'* Sandbox entitlements file for enclosing app files is default to:', filePath)
opts.entitlements = filePath
}
if (!opts['entitlements-inherit']) {
filePath = path.join(__dirname, 'default.entitlements.darwin.inherit.plist')
debugwarn('No `entitlements-inherit` passed in arguments:', '\n',
'* Sandbox entitlements file for enclosing app files is default to:', filePath)
opts['entitlements-inherit'] = filePath
}
}
}
})
.then(async function () {
// Pre-sign operations
const preSignOperations = []
if (opts['pre-embed-provisioning-profile'] === false) {
debugwarn('Pre-sign operation disabled for provisioning profile embedding:', '\n',
'* Enable by setting `pre-embed-provisioning-profile` to `true`.')
} else {
debuglog('Pre-sign operation enabled for provisioning profile:', '\n',
'* Disable by setting `pre-embed-provisioning-profile` to `false`.')
preSignOperations.push(preEmbedProvisioningProfile)
}
if (opts['pre-auto-entitlements'] === false) {
debugwarn('Pre-sign operation disabled for entitlements automation.')
} else {
debuglog('Pre-sign operation enabled for entitlements automation with versions >= `1.1.1`:', '\n',
'* Disable by setting `pre-auto-entitlements` to `false`.')
if (opts.entitlements && (!opts.version || semver.gte(opts.version, '1.1.1') >= 0)) {
// Enable Mac App Store sandboxing without using temporary-exception, introduced in Electron v1.1.1. Relates to electron#5601
preSignOperations.push(preAutoEntitlements)
}
}
for (const preSignOperation of preSignOperations) {
await preSignOperation(opts)
}
})
.then(function () {
debuglog('Signing application...', '\n',
'> Application:', opts.app, '\n',
'> Platform:', opts.platform, '\n',
'> Entitlements:', opts.entitlements, '\n',
'> Child entitlements:', opts['entitlements-inherit'], '\n',
'> Additional binaries:', opts.binaries, '\n',
'> Identity:', opts.identity)
return signApplicationAsync(opts)
})
.then(function () {
// Post-sign operations
debuglog('Application signed.')
})
}
/**
* This function is a normal callback implementation.
* @function
* @param {Object} opts - Options.
* @param {RequestCallback} cb - Callback.
*/
module.exports.sign = function (opts, cb) {
signAsync(opts)
.then(function () {
debuglog('Application signed: ' + opts.app)
if (cb) cb()
})
.catch(function (err) {
debuglog('Sign failed:')
if (err.message) debuglog(err.message)
else if (err.stack) debuglog(err.stack)
else debuglog(err)
if (cb) cb(err)
})
}

View File

@@ -0,0 +1,91 @@
/**
* @module util-entitlements
*/
'use strict'
const { executeAppBuilderAsJson, executeAppBuilderAndWriteJson } = require("../out/util/appBuilder")
const os = require('os')
const path = require('path')
const util = require('./util')
const debuglog = util.debuglog
const getAppContentsPath = util.getAppContentsPath
let tmpFileCounter = 0
/**
* This function returns a promise completing the entitlements automation: The process includes checking in `Info.plist` for `ElectronTeamID` or setting parsed value from identity, and checking in entitlements file for `com.apple.security.application-groups` or inserting new into array. A temporary entitlements file may be created to replace the input for any changes introduced.
* @function
* @param {Object} opts - Options.
* @returns {Promise} Promise.
*/
async function preAutoEntitlements(opts) {
// If entitlements file not provided, default will be used. Fixes #41
const appInfoPath = path.join(getAppContentsPath(opts), 'Info.plist')
debuglog('Automating entitlement app group...', '\n',
'> Info.plist:', appInfoPath, '\n',
'> Entitlements:', opts.entitlements)
const plistContent = await executeAppBuilderAsJson(["decode-plist", "-f", opts.entitlements, "-f", appInfoPath])
let entitlements = plistContent[0]
if (!entitlements['com.apple.security.app-sandbox']) {
// Only automate when app sandbox enabled by user
return
}
const appInfo = plistContent[1]
// Use ElectronTeamID in Info.plist if already specified
if (appInfo.ElectronTeamID) {
debuglog('`ElectronTeamID` found in `Info.plist`: ' + appInfo.ElectronTeamID)
} else {
// The team identifier in signing identity should not be trusted
if (opts['provisioning-profile']) {
appInfo.ElectronTeamID = opts['provisioning-profile'].message.Entitlements['com.apple.developer.team-identifier']
debuglog('`ElectronTeamID` not found in `Info.plist`, use parsed from provisioning profile: ' + appInfo.ElectronTeamID)
} else {
appInfo.ElectronTeamID = opts.identity.name.substring(opts.identity.name.indexOf('(') + 1, opts.identity.name.lastIndexOf(')'))
debuglog('`ElectronTeamID` not found in `Info.plist`, use parsed from signing identity: ' + appInfo.ElectronTeamID)
}
await executeAppBuilderAndWriteJson(["encode-plist"], {[appInfoPath]: appInfo})
debuglog('`Info.plist` updated:', '\n', '> Info.plist:', appInfoPath)
}
const appIdentifier = appInfo.ElectronTeamID + '.' + appInfo.CFBundleIdentifier
// Insert application identifier if not exists
if (entitlements['com.apple.application-identifier']) {
debuglog('`com.apple.application-identifier` found in entitlements file: ' + entitlements['com.apple.application-identifier'])
} else {
debuglog('`com.apple.application-identifier` not found in entitlements file, new inserted: ' + appIdentifier)
entitlements['com.apple.application-identifier'] = appIdentifier
}
// Insert developer team identifier if not exists
if (entitlements['com.apple.developer.team-identifier']) {
debuglog('`com.apple.developer.team-identifier` found in entitlements file: ' + entitlements['com.apple.developer.team-identifier'])
} else {
debuglog('`com.apple.developer.team-identifier` not found in entitlements file, new inserted: ' + appInfo.ElectronTeamID)
entitlements['com.apple.developer.team-identifier'] = appInfo.ElectronTeamID
}
// Init entitlements app group key to array if not exists
if (!entitlements['com.apple.security.application-groups']) {
entitlements['com.apple.security.application-groups'] = []
}
// Insert app group if not exists
if (Array.isArray(entitlements['com.apple.security.application-groups']) && entitlements['com.apple.security.application-groups'].indexOf(appIdentifier) === -1) {
debuglog('`com.apple.security.application-groups` not found in entitlements file, new inserted: ' + appIdentifier)
entitlements['com.apple.security.application-groups'].push(appIdentifier)
} else {
debuglog('`com.apple.security.application-groups` found in entitlements file: ' + appIdentifier)
}
// Create temporary entitlements file
const entitlementsPath = path.join(os.tmpdir(), `tmp-entitlements-${process.pid.toString(16)}-${(tmpFileCounter++).toString(16)}.plist`)
opts.entitlements = entitlementsPath
await executeAppBuilderAndWriteJson(["encode-plist"], {[entitlementsPath]: entitlements})
debuglog('Entitlements file updated:', '\n', '> Entitlements:', entitlementsPath)
}
module.exports.preAutoEntitlements = preAutoEntitlements

View File

@@ -0,0 +1,55 @@
/**
* @module util-identities
*/
'use strict'
const util = require('./util')
const debuglog = util.debuglog
const flatList = util.flatList
const execFileAsync = util.execFileAsync
/**
* @constructor
* @param {string} name - Name of the signing identity.
* @param {String} hash - SHA-1 hash of the identity.
*/
var Identity = module.exports.Identity = function (name, hash) {
this.name = name
this.hash = hash
}
/**
* This function returns a promise checking the indentity proposed and updates the identity option to a exact finding from results.
* @function
* @param {Object} opts - Options.
* @param {string} identity - The proposed identity.
* @returns {Promise} Promise.
*/
module.exports.findIdentitiesAsync = function (opts, identity) {
// Only to look for valid identities, excluding those flagged with
// CSSMERR_TP_CERT_EXPIRED or CSSMERR_TP_NOT_TRUSTED. Fixes #9
var args = [
'find-identity',
'-v'
]
if (opts.keychain) {
args.push(opts.keychain)
}
return execFileAsync('security', args)
.then(function (result) {
return result.split('\n').map(function (line) {
if (line.indexOf(identity) >= 0) {
var identityFound = line.substring(line.indexOf('"') + 1, line.lastIndexOf('"'))
var identityHashFound = line.substring(line.indexOf(')') + 2, line.indexOf('"') - 1)
debuglog('Identity:', '\n',
'> Name:', identityFound, '\n',
'> Hash:', identityHashFound)
return new Identity(identityFound, identityHashFound)
}
})
})
.then(flatList)
}

View File

@@ -0,0 +1,179 @@
/**
* @module util-provisioning-profiles
*/
'use strict'
const path = require('path')
const fs = require('fs-extra')
const os = require('os')
const Promise = require('bluebird-lst')
const { executeAppBuilderAsJson } = require("../out/util/appBuilder")
const util = require('./util')
const debuglog = util.debuglog
const debugwarn = util.debugwarn
const getAppContentsPath = util.getAppContentsPath
const flatList = util.flatList
const copyFileAsync = util.copyFileAsync
const execFileAsync = util.execFileAsync
const lstatAsync = util.lstatAsync
const readdirAsync = util.readdirAsync
/**
* @constructor
* @param {string} filePath - Path to provisioning profile.
* @param {Object} message - Decoded message in provisioning profile.
*/
var ProvisioningProfile = module.exports.ProvisioningProfile = function (filePath, message) {
this.filePath = filePath
this.message = message
}
Object.defineProperty(ProvisioningProfile.prototype, 'name', {
get: function () {
return this.message['Name']
}
})
Object.defineProperty(ProvisioningProfile.prototype, 'platforms', {
get: function () {
if ('ProvisionsAllDevices' in this.message) return ['darwin'] // Developer ID
else if (this.type === 'distribution') return ['mas'] // Mac App Store
else return ['darwin', 'mas'] // Mac App Development
}
})
Object.defineProperty(ProvisioningProfile.prototype, 'type', {
get: function () {
if ('ProvisionedDevices' in this.message) return 'development' // Mac App Development
else return 'distribution' // Developer ID or Mac App Store
}
})
/**
* Returns a promise resolving to a ProvisioningProfile instance based on file.
* @function
* @param {string} filePath - Path to provisioning profile.
* @returns {Promise} Promise.
*/
var getProvisioningProfileAsync = module.exports.getProvisioningProfileAsync = function (filePath) {
return execFileAsync('security', [
'cms',
'-D', // Decode a CMS message
'-i', filePath // Use infile as source of data
])
.then(async function (result) {
// todo read directly
const tempFile = path.join(os.tmpdir(), `${require('crypto').createHash('sha1').update(filePath).digest("hex")}.plist`)
await fs.outputFile(tempFile, result)
const plistContent = await executeAppBuilderAsJson(["decode-plist", "-f", tempFile])
await fs.unlink(tempFile)
var provisioningProfile = new ProvisioningProfile(filePath, plistContent[0])
debuglog('Provisioning profile:', '\n',
'> Name:', provisioningProfile.name, '\n',
'> Platforms:', provisioningProfile.platforms, '\n',
'> Type:', provisioningProfile.type, '\n',
'> Path:', provisioningProfile.filePath, '\n',
'> Message:', provisioningProfile.message)
return provisioningProfile
})
}
/**
* Returns a promise resolving to a list of suitable provisioning profile within the current working directory.
* @function
* @param {Object} opts - Options.
* @returns {Promise} Promise.
*/
var findProvisioningProfilesAsync = module.exports.findProvisioningProfilesAsync = function (opts) {
return Promise.map([
process.cwd() // Current working directory
], function (dirPath) {
return readdirAsync(dirPath)
.map(function (name) {
var filePath = path.join(dirPath, name)
return lstatAsync(filePath)
.then(function (stat) {
if (stat.isFile()) {
switch (path.extname(filePath)) {
case '.provisionprofile':
return filePath
}
}
return undefined
})
})
})
.then(flatList)
.map(function (filePath) {
return getProvisioningProfileAsync(filePath)
.then(function (provisioningProfile) {
if (provisioningProfile.platforms.indexOf(opts.platform) >= 0 && provisioningProfile.type === opts.type) return provisioningProfile
debugwarn('Provisioning profile above ignored, not for ' + opts.platform + ' ' + opts.type + '.')
return undefined
})
})
.then(flatList)
}
/**
* Returns a promise embedding the provisioning profile in the app Contents folder.
* @function
* @param {Object} opts - Options.
* @returns {Promise} Promise.
*/
module.exports.preEmbedProvisioningProfile = function (opts) {
function embedProvisioningProfile () {
if (opts['provisioning-profile']) {
debuglog('Looking for existing provisioning profile...')
var embeddedFilePath = path.join(getAppContentsPath(opts), 'embedded.provisionprofile')
return lstatAsync(embeddedFilePath)
.then(function (stat) {
debuglog('Found embedded provisioning profile:', '\n',
'* Please manually remove the existing file if not wanted.', '\n',
'* Current file at:', embeddedFilePath)
})
.catch(function (err) {
if (err.code === 'ENOENT') {
// File does not exist
debuglog('Embedding provisioning profile...')
return copyFileAsync(opts['provisioning-profile'].filePath, embeddedFilePath)
} else throw err
})
}
}
if (opts['provisioning-profile']) {
// User input provisioning profile
debuglog('`provisioning-profile` passed in arguments.')
if (opts['provisioning-profile'] instanceof ProvisioningProfile) {
return embedProvisioningProfile()
} else {
return getProvisioningProfileAsync(opts['provisioning-profile'])
.then(function (provisioningProfile) {
opts['provisioning-profile'] = provisioningProfile
})
.then(embedProvisioningProfile)
}
} else {
// Discover provisioning profile
debuglog('No `provisioning-profile` passed in arguments, will find in current working directory and in user library...')
return findProvisioningProfilesAsync(opts)
.then(function (provisioningProfiles) {
if (provisioningProfiles.length > 0) {
// Provisioning profile(s) found
if (provisioningProfiles.length > 1) {
debuglog('Multiple provisioning profiles found, will use the first discovered.')
} else {
debuglog('Found 1 provisioning profile.')
}
opts['provisioning-profile'] = provisioningProfiles[0]
} else {
// No provisioning profile found
debuglog('No provisioning profile found, will not embed profile in app contents.')
}
})
.then(embedProvisioningProfile)
}
}

View File

@@ -0,0 +1,253 @@
/**
* @module util
*/
'use strict'
const child = require('child_process')
const fs = require('fs')
const path = require('path')
const Promise = require('bluebird-lst')
const debug = require('debug')
/**
* This callback is used across signing and flattening.
* @callback RequestCallback
* @param {?Error} err
*/
/** @function */
const debuglog = module.exports.debuglog = debug('electron-osx-sign')
debuglog.log = console.log.bind(console)
/** @function */
const debugwarn = module.exports.debugwarn = debug('electron-osx-sign:warn')
debugwarn.log = console.warn.bind(console)
/** @function */
const removePassword = function (input) {
return input.replace(/(-P |pass:|\/p|-pass )([^ ]+)/, function (match, p1, p2) {
return `${p1}***`
})
}
/** @function */
module.exports.execFileAsync = function (file, args, options) {
if (debuglog.enabled) {
debuglog('Executing...', file, args && Array.isArray(args) ? removePassword(args.join(' ')) : '')
}
return new Promise(function (resolve, reject) {
child.execFile(file, args, options, function (err, stdout, stderr) {
if (err) {
debuglog('Error executing file:', '\n',
'> Stdout:', stdout, '\n',
'> Stderr:', stderr)
reject(err)
return
}
resolve(stdout)
})
})
}
/** @function */
const lstatAsync = module.exports.lstatAsync = Promise.promisify(fs.lstat)
/** @function */
const readdirAsync = module.exports.readdirAsync = Promise.promisify(fs.readdir)
/**
* This function returns a flattened list of elements from an array of lists.
* @function
* @param {*} list - List.
* @returns Flattened list.
*/
var flatList = module.exports.flatList = function (list) {
function populateResult (list) {
if (!Array.isArray(list)) {
result.push(list)
} else if (list.length > 0) {
for (let item of list) if (item) populateResult(item)
}
}
var result = []
populateResult(list)
return result
}
/**
* This function returns the path to app contents.
* @function
* @param {Object} opts - Options.
* @returns {string} App contents path.
*/
var getAppContentsPath = module.exports.getAppContentsPath = function (opts) {
return path.join(opts.app, 'Contents')
}
/**
* This function returns the path to app frameworks within contents.
* @function
* @param {Object} opts - Options.
* @returns {string} App frameworks path.
*/
var getAppFrameworksPath = module.exports.getAppFrameworksPath = function (opts) {
return path.join(getAppContentsPath(opts), 'Frameworks')
}
/**
* This function returns a promise copying a file from the source to the target.
* @function
* @param {string} source - Source path.
* @param {string} target - Target path.
* @returns {Promise} Promise.
*/
module.exports.copyFileAsync = function (source, target) {
debuglog('Copying file...', '\n',
'> Source:', source, '\n',
'> Target:', target)
return new Promise(function (resolve, reject) {
var readStream = fs.createReadStream(source)
readStream.on('error', reject)
var writeStream = fs.createWriteStream(target)
writeStream.on('error', reject)
writeStream.on('close', resolve)
readStream.pipe(writeStream)
})
}
/**
* This function returns a promise with platform resolved.
* @function
* @param {Object} opts - Options.
* @returns {Promise} Promise resolving platform.
*/
var detectElectronPlatformAsync = module.exports.detectElectronPlatformAsync = function (opts) {
return new Promise(function (resolve) {
var appFrameworksPath = getAppFrameworksPath(opts)
// The presence of Squirrel.framework identifies a Mac App Store build as used in https://github.com/atom/electron/blob/master/docs/tutorial/mac-app-store-submission-guide.md
return lstatAsync(path.join(appFrameworksPath, 'Squirrel.framework'))
.then(function () {
resolve('darwin')
})
.catch(function () {
resolve('mas')
})
})
}
const isBinaryFile = require("isbinaryfile").isBinaryFile;
/**
* This function returns a promise resolving the file path if file binary.
* @function
* @param {string} filePath - Path to file.
* @returns {Promise} Promise resolving file path or undefined.
*/
var getFilePathIfBinaryAsync = module.exports.getFilePathIfBinaryAsync = function (filePath) {
return isBinaryFile(filePath)
.then(function (isBinary) {
return isBinary ? filePath : undefined
})
}
/**
* This function returns a promise validating opts.app, the application to be signed or flattened.
* @function
* @param {Object} opts - Options.
* @returns {Promise} Promise.
*/
module.exports.validateOptsAppAsync = function (opts) {
if (!opts.app) {
return Promise.reject(new Error('Path to aplication must be specified.'))
}
if (path.extname(opts.app) !== '.app') {
return Promise.reject(new Error('Extension of application must be `.app`.'))
}
return lstatAsync(opts.app)
.thenReturn()
}
/**
* This function returns a promise validating opts.platform, the platform of Electron build. It allows auto-discovery if no opts.platform is specified.
* @function
* @param {Object} opts - Options.
* @returns {Promise} Promise.
*/
module.exports.validateOptsPlatformAsync = function (opts) {
if (opts.platform) {
if (opts.platform === 'mas' || opts.platform === 'darwin') {
return Promise.resolve()
} else {
debugwarn('`platform` passed in arguments not supported, checking Electron platform...')
}
} else {
debugwarn('No `platform` passed in arguments, checking Electron platform...')
}
return detectElectronPlatformAsync(opts)
.then(function (platform) {
opts.platform = platform
})
}
/**
* This function returns a promise resolving all child paths within the directory specified.
* @function
* @param {string} dirPath - Path to directory.
* @returns {Promise} Promise resolving child paths needing signing in order.
*/
module.exports.walkAsync = function (dirPath) {
debuglog('Walking... ' + dirPath)
var unlinkAsync = Promise.promisify(fs.unlink)
function _walkAsync (dirPath) {
return readdirAsync(dirPath)
.then(function (names) {
return Promise.map(names, function (name) {
var filePath = path.join(dirPath, name)
return lstatAsync(filePath)
.then(function (stat) {
if (stat.isFile()) {
switch (path.extname(filePath)) {
case '': // Binary
if (path.basename(filePath)[0] !== '.') {
return getFilePathIfBinaryAsync(filePath)
} // Else reject hidden file
break
case '.dylib': // Dynamic library
case '.node': // Native node addon
return filePath
case '.cstemp': // Temporary file generated from past codesign
debuglog('Removing... ' + filePath)
return unlinkAsync(filePath)
.thenReturn(undefined)
default:
if (path.extname(filePath).indexOf(' ') >= 0) {
// Still consider the file as binary if extension seems invalid
return getFilePathIfBinaryAsync(filePath)
}
}
} else if (stat.isDirectory() && !stat.isSymbolicLink()) {
return _walkAsync(filePath)
.then(function (result) {
switch (path.extname(filePath)) {
case '.app': // Application
case '.framework': // Framework
result.push(filePath)
}
return result
})
}
})
})
})
}
return _walkAsync(dirPath)
.then(flatList)
}

View File

@@ -0,0 +1,15 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../semver/bin/semver.js" "$@"
ret=$?
else
node "$basedir/../semver/bin/semver.js" "$@"
ret=$?
fi
exit $ret

View File

@@ -0,0 +1,7 @@
@IF EXIST "%~dp0\node.exe" (
"%~dp0\node.exe" "%~dp0\..\semver\bin\semver.js" %*
) ELSE (
@SETLOCAL
@SET PATHEXT=%PATHEXT:;.JS;=;%
node "%~dp0\..\semver\bin\semver.js" %*
)

View File

@@ -0,0 +1,70 @@
# changes log
## 6.2.0
* Coerce numbers to strings when passed to semver.coerce()
* Add `rtl` option to coerce from right to left
## 6.1.3
* Handle X-ranges properly in includePrerelease mode
## 6.1.2
* Do not throw when testing invalid version strings
## 6.1.1
* Add options support for semver.coerce()
* Handle undefined version passed to Range.test
## 6.1.0
* Add semver.compareBuild function
* Support `*` in semver.intersects
## 6.0
* Fix `intersects` logic.
This is technically a bug fix, but since it is also a change to behavior
that may require users updating their code, it is marked as a major
version increment.
## 5.7
* Add `minVersion` method
## 5.6
* Move boolean `loose` param to an options object, with
backwards-compatibility protection.
* Add ability to opt out of special prerelease version handling with
the `includePrerelease` option flag.
## 5.5
* Add version coercion capabilities
## 5.4
* Add intersection checking
## 5.3
* Add `minSatisfying` method
## 5.2
* Add `prerelease(v)` that returns prerelease components
## 5.1
* Add Backus-Naur for ranges
* Remove excessively cute inspection methods
## 5.0
* Remove AMD/Browserified build artifacts
* Fix ltr and gtr when using the `*` range
* Fix for range `*` with a prerelease identifier

View File

@@ -0,0 +1,15 @@
The ISC License
Copyright (c) Isaac Z. Schlueter and Contributors
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

View File

@@ -0,0 +1,443 @@
semver(1) -- The semantic versioner for npm
===========================================
## Install
```bash
npm install semver
````
## Usage
As a node module:
```js
const semver = require('semver')
semver.valid('1.2.3') // '1.2.3'
semver.valid('a.b.c') // null
semver.clean(' =v1.2.3 ') // '1.2.3'
semver.satisfies('1.2.3', '1.x || >=2.5.0 || 5.0.0 - 7.2.3') // true
semver.gt('1.2.3', '9.8.7') // false
semver.lt('1.2.3', '9.8.7') // true
semver.minVersion('>=1.0.0') // '1.0.0'
semver.valid(semver.coerce('v2')) // '2.0.0'
semver.valid(semver.coerce('42.6.7.9.3-alpha')) // '42.6.7'
```
As a command-line utility:
```
$ semver -h
A JavaScript implementation of the https://semver.org/ specification
Copyright Isaac Z. Schlueter
Usage: semver [options] <version> [<version> [...]]
Prints valid versions sorted by SemVer precedence
Options:
-r --range <range>
Print versions that match the specified range.
-i --increment [<level>]
Increment a version by the specified level. Level can
be one of: major, minor, patch, premajor, preminor,
prepatch, or prerelease. Default level is 'patch'.
Only one version may be specified.
--preid <identifier>
Identifier to be used to prefix premajor, preminor,
prepatch or prerelease version increments.
-l --loose
Interpret versions and ranges loosely
-p --include-prerelease
Always include prerelease versions in range matching
-c --coerce
Coerce a string into SemVer if possible
(does not imply --loose)
--rtl
Coerce version strings right to left
--ltr
Coerce version strings left to right (default)
Program exits successfully if any valid version satisfies
all supplied ranges, and prints all satisfying versions.
If no satisfying versions are found, then exits failure.
Versions are printed in ascending order, so supplying
multiple versions to the utility will just sort them.
```
## Versions
A "version" is described by the `v2.0.0` specification found at
<https://semver.org/>.
A leading `"="` or `"v"` character is stripped off and ignored.
## Ranges
A `version range` is a set of `comparators` which specify versions
that satisfy the range.
A `comparator` is composed of an `operator` and a `version`. The set
of primitive `operators` is:
* `<` Less than
* `<=` Less than or equal to
* `>` Greater than
* `>=` Greater than or equal to
* `=` Equal. If no operator is specified, then equality is assumed,
so this operator is optional, but MAY be included.
For example, the comparator `>=1.2.7` would match the versions
`1.2.7`, `1.2.8`, `2.5.3`, and `1.3.9`, but not the versions `1.2.6`
or `1.1.0`.
Comparators can be joined by whitespace to form a `comparator set`,
which is satisfied by the **intersection** of all of the comparators
it includes.
A range is composed of one or more comparator sets, joined by `||`. A
version matches a range if and only if every comparator in at least
one of the `||`-separated comparator sets is satisfied by the version.
For example, the range `>=1.2.7 <1.3.0` would match the versions
`1.2.7`, `1.2.8`, and `1.2.99`, but not the versions `1.2.6`, `1.3.0`,
or `1.1.0`.
The range `1.2.7 || >=1.2.9 <2.0.0` would match the versions `1.2.7`,
`1.2.9`, and `1.4.6`, but not the versions `1.2.8` or `2.0.0`.
### Prerelease Tags
If a version has a prerelease tag (for example, `1.2.3-alpha.3`) then
it will only be allowed to satisfy comparator sets if at least one
comparator with the same `[major, minor, patch]` tuple also has a
prerelease tag.
For example, the range `>1.2.3-alpha.3` would be allowed to match the
version `1.2.3-alpha.7`, but it would *not* be satisfied by
`3.4.5-alpha.9`, even though `3.4.5-alpha.9` is technically "greater
than" `1.2.3-alpha.3` according to the SemVer sort rules. The version
range only accepts prerelease tags on the `1.2.3` version. The
version `3.4.5` *would* satisfy the range, because it does not have a
prerelease flag, and `3.4.5` is greater than `1.2.3-alpha.7`.
The purpose for this behavior is twofold. First, prerelease versions
frequently are updated very quickly, and contain many breaking changes
that are (by the author's design) not yet fit for public consumption.
Therefore, by default, they are excluded from range matching
semantics.
Second, a user who has opted into using a prerelease version has
clearly indicated the intent to use *that specific* set of
alpha/beta/rc versions. By including a prerelease tag in the range,
the user is indicating that they are aware of the risk. However, it
is still not appropriate to assume that they have opted into taking a
similar risk on the *next* set of prerelease versions.
Note that this behavior can be suppressed (treating all prerelease
versions as if they were normal versions, for the purpose of range
matching) by setting the `includePrerelease` flag on the options
object to any
[functions](https://github.com/npm/node-semver#functions) that do
range matching.
#### Prerelease Identifiers
The method `.inc` takes an additional `identifier` string argument that
will append the value of the string as a prerelease identifier:
```javascript
semver.inc('1.2.3', 'prerelease', 'beta')
// '1.2.4-beta.0'
```
command-line example:
```bash
$ semver 1.2.3 -i prerelease --preid beta
1.2.4-beta.0
```
Which then can be used to increment further:
```bash
$ semver 1.2.4-beta.0 -i prerelease
1.2.4-beta.1
```
### Advanced Range Syntax
Advanced range syntax desugars to primitive comparators in
deterministic ways.
Advanced ranges may be combined in the same way as primitive
comparators using white space or `||`.
#### Hyphen Ranges `X.Y.Z - A.B.C`
Specifies an inclusive set.
* `1.2.3 - 2.3.4` := `>=1.2.3 <=2.3.4`
If a partial version is provided as the first version in the inclusive
range, then the missing pieces are replaced with zeroes.
* `1.2 - 2.3.4` := `>=1.2.0 <=2.3.4`
If a partial version is provided as the second version in the
inclusive range, then all versions that start with the supplied parts
of the tuple are accepted, but nothing that would be greater than the
provided tuple parts.
* `1.2.3 - 2.3` := `>=1.2.3 <2.4.0`
* `1.2.3 - 2` := `>=1.2.3 <3.0.0`
#### X-Ranges `1.2.x` `1.X` `1.2.*` `*`
Any of `X`, `x`, or `*` may be used to "stand in" for one of the
numeric values in the `[major, minor, patch]` tuple.
* `*` := `>=0.0.0` (Any version satisfies)
* `1.x` := `>=1.0.0 <2.0.0` (Matching major version)
* `1.2.x` := `>=1.2.0 <1.3.0` (Matching major and minor versions)
A partial version range is treated as an X-Range, so the special
character is in fact optional.
* `""` (empty string) := `*` := `>=0.0.0`
* `1` := `1.x.x` := `>=1.0.0 <2.0.0`
* `1.2` := `1.2.x` := `>=1.2.0 <1.3.0`
#### Tilde Ranges `~1.2.3` `~1.2` `~1`
Allows patch-level changes if a minor version is specified on the
comparator. Allows minor-level changes if not.
* `~1.2.3` := `>=1.2.3 <1.(2+1).0` := `>=1.2.3 <1.3.0`
* `~1.2` := `>=1.2.0 <1.(2+1).0` := `>=1.2.0 <1.3.0` (Same as `1.2.x`)
* `~1` := `>=1.0.0 <(1+1).0.0` := `>=1.0.0 <2.0.0` (Same as `1.x`)
* `~0.2.3` := `>=0.2.3 <0.(2+1).0` := `>=0.2.3 <0.3.0`
* `~0.2` := `>=0.2.0 <0.(2+1).0` := `>=0.2.0 <0.3.0` (Same as `0.2.x`)
* `~0` := `>=0.0.0 <(0+1).0.0` := `>=0.0.0 <1.0.0` (Same as `0.x`)
* `~1.2.3-beta.2` := `>=1.2.3-beta.2 <1.3.0` Note that prereleases in
the `1.2.3` version will be allowed, if they are greater than or
equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but
`1.2.4-beta.2` would not, because it is a prerelease of a
different `[major, minor, patch]` tuple.
#### Caret Ranges `^1.2.3` `^0.2.5` `^0.0.4`
Allows changes that do not modify the left-most non-zero element in the
`[major, minor, patch]` tuple. In other words, this allows patch and
minor updates for versions `1.0.0` and above, patch updates for
versions `0.X >=0.1.0`, and *no* updates for versions `0.0.X`.
Many authors treat a `0.x` version as if the `x` were the major
"breaking-change" indicator.
Caret ranges are ideal when an author may make breaking changes
between `0.2.4` and `0.3.0` releases, which is a common practice.
However, it presumes that there will *not* be breaking changes between
`0.2.4` and `0.2.5`. It allows for changes that are presumed to be
additive (but non-breaking), according to commonly observed practices.
* `^1.2.3` := `>=1.2.3 <2.0.0`
* `^0.2.3` := `>=0.2.3 <0.3.0`
* `^0.0.3` := `>=0.0.3 <0.0.4`
* `^1.2.3-beta.2` := `>=1.2.3-beta.2 <2.0.0` Note that prereleases in
the `1.2.3` version will be allowed, if they are greater than or
equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but
`1.2.4-beta.2` would not, because it is a prerelease of a
different `[major, minor, patch]` tuple.
* `^0.0.3-beta` := `>=0.0.3-beta <0.0.4` Note that prereleases in the
`0.0.3` version *only* will be allowed, if they are greater than or
equal to `beta`. So, `0.0.3-pr.2` would be allowed.
When parsing caret ranges, a missing `patch` value desugars to the
number `0`, but will allow flexibility within that value, even if the
major and minor versions are both `0`.
* `^1.2.x` := `>=1.2.0 <2.0.0`
* `^0.0.x` := `>=0.0.0 <0.1.0`
* `^0.0` := `>=0.0.0 <0.1.0`
A missing `minor` and `patch` values will desugar to zero, but also
allow flexibility within those values, even if the major version is
zero.
* `^1.x` := `>=1.0.0 <2.0.0`
* `^0.x` := `>=0.0.0 <1.0.0`
### Range Grammar
Putting all this together, here is a Backus-Naur grammar for ranges,
for the benefit of parser authors:
```bnf
range-set ::= range ( logical-or range ) *
logical-or ::= ( ' ' ) * '||' ( ' ' ) *
range ::= hyphen | simple ( ' ' simple ) * | ''
hyphen ::= partial ' - ' partial
simple ::= primitive | partial | tilde | caret
primitive ::= ( '<' | '>' | '>=' | '<=' | '=' ) partial
partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )?
xr ::= 'x' | 'X' | '*' | nr
nr ::= '0' | ['1'-'9'] ( ['0'-'9'] ) *
tilde ::= '~' partial
caret ::= '^' partial
qualifier ::= ( '-' pre )? ( '+' build )?
pre ::= parts
build ::= parts
parts ::= part ( '.' part ) *
part ::= nr | [-0-9A-Za-z]+
```
## Functions
All methods and classes take a final `options` object argument. All
options in this object are `false` by default. The options supported
are:
- `loose` Be more forgiving about not-quite-valid semver strings.
(Any resulting output will always be 100% strict compliant, of
course.) For backwards compatibility reasons, if the `options`
argument is a boolean value instead of an object, it is interpreted
to be the `loose` param.
- `includePrerelease` Set to suppress the [default
behavior](https://github.com/npm/node-semver#prerelease-tags) of
excluding prerelease tagged versions from ranges unless they are
explicitly opted into.
Strict-mode Comparators and Ranges will be strict about the SemVer
strings that they parse.
* `valid(v)`: Return the parsed version, or null if it's not valid.
* `inc(v, release)`: Return the version incremented by the release
type (`major`, `premajor`, `minor`, `preminor`, `patch`,
`prepatch`, or `prerelease`), or null if it's not valid
* `premajor` in one call will bump the version up to the next major
version and down to a prerelease of that major version.
`preminor`, and `prepatch` work the same way.
* If called from a non-prerelease version, the `prerelease` will work the
same as `prepatch`. It increments the patch version, then makes a
prerelease. If the input version is already a prerelease it simply
increments it.
* `prerelease(v)`: Returns an array of prerelease components, or null
if none exist. Example: `prerelease('1.2.3-alpha.1') -> ['alpha', 1]`
* `major(v)`: Return the major version number.
* `minor(v)`: Return the minor version number.
* `patch(v)`: Return the patch version number.
* `intersects(r1, r2, loose)`: Return true if the two supplied ranges
or comparators intersect.
* `parse(v)`: Attempt to parse a string as a semantic version, returning either
a `SemVer` object or `null`.
### Comparison
* `gt(v1, v2)`: `v1 > v2`
* `gte(v1, v2)`: `v1 >= v2`
* `lt(v1, v2)`: `v1 < v2`
* `lte(v1, v2)`: `v1 <= v2`
* `eq(v1, v2)`: `v1 == v2` This is true if they're logically equivalent,
even if they're not the exact same string. You already know how to
compare strings.
* `neq(v1, v2)`: `v1 != v2` The opposite of `eq`.
* `cmp(v1, comparator, v2)`: Pass in a comparison string, and it'll call
the corresponding function above. `"==="` and `"!=="` do simple
string comparison, but are included for completeness. Throws if an
invalid comparison string is provided.
* `compare(v1, v2)`: Return `0` if `v1 == v2`, or `1` if `v1` is greater, or `-1` if
`v2` is greater. Sorts in ascending order if passed to `Array.sort()`.
* `rcompare(v1, v2)`: The reverse of compare. Sorts an array of versions
in descending order when passed to `Array.sort()`.
* `compareBuild(v1, v2)`: The same as `compare` but considers `build` when two versions
are equal. Sorts in ascending order if passed to `Array.sort()`.
`v2` is greater. Sorts in ascending order if passed to `Array.sort()`.
* `diff(v1, v2)`: Returns difference between two versions by the release type
(`major`, `premajor`, `minor`, `preminor`, `patch`, `prepatch`, or `prerelease`),
or null if the versions are the same.
### Comparators
* `intersects(comparator)`: Return true if the comparators intersect
### Ranges
* `validRange(range)`: Return the valid range or null if it's not valid
* `satisfies(version, range)`: Return true if the version satisfies the
range.
* `maxSatisfying(versions, range)`: Return the highest version in the list
that satisfies the range, or `null` if none of them do.
* `minSatisfying(versions, range)`: Return the lowest version in the list
that satisfies the range, or `null` if none of them do.
* `minVersion(range)`: Return the lowest version that can possibly match
the given range.
* `gtr(version, range)`: Return `true` if version is greater than all the
versions possible in the range.
* `ltr(version, range)`: Return `true` if version is less than all the
versions possible in the range.
* `outside(version, range, hilo)`: Return true if the version is outside
the bounds of the range in either the high or low direction. The
`hilo` argument must be either the string `'>'` or `'<'`. (This is
the function called by `gtr` and `ltr`.)
* `intersects(range)`: Return true if any of the ranges comparators intersect
Note that, since ranges may be non-contiguous, a version might not be
greater than a range, less than a range, *or* satisfy a range! For
example, the range `1.2 <1.2.9 || >2.0.0` would have a hole from `1.2.9`
until `2.0.0`, so the version `1.2.10` would not be greater than the
range (because `2.0.1` satisfies, which is higher), nor less than the
range (since `1.2.8` satisfies, which is lower), and it also does not
satisfy the range.
If you want to know if a version satisfies or does not satisfy a
range, use the `satisfies(version, range)` function.
### Coercion
* `coerce(version, options)`: Coerces a string to semver if possible
This aims to provide a very forgiving translation of a non-semver string to
semver. It looks for the first digit in a string, and consumes all
remaining characters which satisfy at least a partial semver (e.g., `1`,
`1.2`, `1.2.3`) up to the max permitted length (256 characters). Longer
versions are simply truncated (`4.6.3.9.2-alpha2` becomes `4.6.3`). All
surrounding text is simply ignored (`v3.4 replaces v3.3.1` becomes
`3.4.0`). Only text which lacks digits will fail coercion (`version one`
is not valid). The maximum length for any semver component considered for
coercion is 16 characters; longer components will be ignored
(`10000000000000000.4.7.4` becomes `4.7.4`). The maximum value for any
semver component is `Integer.MAX_SAFE_INTEGER || (2**53 - 1)`; higher value
components are invalid (`9999999999999999.4.7.4` is likely invalid).
If the `options.rtl` flag is set, then `coerce` will return the right-most
coercible tuple that does not share an ending index with a longer coercible
tuple. For example, `1.2.3.4` will return `2.3.4` in rtl mode, not
`4.0.0`. `1.2.3/4` will return `4.0.0`, because the `4` is not a part of
any other overlapping SemVer tuple.
### Clean
* `clean(version)`: Clean a string to be a valid semver if possible
This will return a cleaned and trimmed semver version. If the provided version is not valid a null will be returned. This does not work for ranges.
ex.
* `s.clean(' = v 2.1.5foo')`: `null`
* `s.clean(' = v 2.1.5foo', { loose: true })`: `'2.1.5-foo'`
* `s.clean(' = v 2.1.5-foo')`: `null`
* `s.clean(' = v 2.1.5-foo', { loose: true })`: `'2.1.5-foo'`
* `s.clean('=v2.1.5')`: `'2.1.5'`
* `s.clean(' =v2.1.5')`: `2.1.5`
* `s.clean(' 2.1.5 ')`: `'2.1.5'`
* `s.clean('~1.0.0')`: `null`

View File

@@ -0,0 +1,174 @@
#!/usr/bin/env node
// Standalone semver comparison program.
// Exits successfully and prints matching version(s) if
// any supplied version is valid and passes all tests.
var argv = process.argv.slice(2)
var versions = []
var range = []
var inc = null
var version = require('../package.json').version
var loose = false
var includePrerelease = false
var coerce = false
var rtl = false
var identifier
var semver = require('../semver')
var reverse = false
var options = {}
main()
function main () {
if (!argv.length) return help()
while (argv.length) {
var a = argv.shift()
var indexOfEqualSign = a.indexOf('=')
if (indexOfEqualSign !== -1) {
a = a.slice(0, indexOfEqualSign)
argv.unshift(a.slice(indexOfEqualSign + 1))
}
switch (a) {
case '-rv': case '-rev': case '--rev': case '--reverse':
reverse = true
break
case '-l': case '--loose':
loose = true
break
case '-p': case '--include-prerelease':
includePrerelease = true
break
case '-v': case '--version':
versions.push(argv.shift())
break
case '-i': case '--inc': case '--increment':
switch (argv[0]) {
case 'major': case 'minor': case 'patch': case 'prerelease':
case 'premajor': case 'preminor': case 'prepatch':
inc = argv.shift()
break
default:
inc = 'patch'
break
}
break
case '--preid':
identifier = argv.shift()
break
case '-r': case '--range':
range.push(argv.shift())
break
case '-c': case '--coerce':
coerce = true
break
case '--rtl':
rtl = true
break
case '--ltr':
rtl = false
break
case '-h': case '--help': case '-?':
return help()
default:
versions.push(a)
break
}
}
var options = { loose: loose, includePrerelease: includePrerelease, rtl: rtl }
versions = versions.map(function (v) {
return coerce ? (semver.coerce(v, options) || { version: v }).version : v
}).filter(function (v) {
return semver.valid(v)
})
if (!versions.length) return fail()
if (inc && (versions.length !== 1 || range.length)) { return failInc() }
for (var i = 0, l = range.length; i < l; i++) {
versions = versions.filter(function (v) {
return semver.satisfies(v, range[i], options)
})
if (!versions.length) return fail()
}
return success(versions)
}
function failInc () {
console.error('--inc can only be used on a single version with no range')
fail()
}
function fail () { process.exit(1) }
function success () {
var compare = reverse ? 'rcompare' : 'compare'
versions.sort(function (a, b) {
return semver[compare](a, b, options)
}).map(function (v) {
return semver.clean(v, options)
}).map(function (v) {
return inc ? semver.inc(v, inc, options, identifier) : v
}).forEach(function (v, i, _) { console.log(v) })
}
function help () {
console.log(['SemVer ' + version,
'',
'A JavaScript implementation of the https://semver.org/ specification',
'Copyright Isaac Z. Schlueter',
'',
'Usage: semver [options] <version> [<version> [...]]',
'Prints valid versions sorted by SemVer precedence',
'',
'Options:',
'-r --range <range>',
' Print versions that match the specified range.',
'',
'-i --increment [<level>]',
' Increment a version by the specified level. Level can',
' be one of: major, minor, patch, premajor, preminor,',
" prepatch, or prerelease. Default level is 'patch'.",
' Only one version may be specified.',
'',
'--preid <identifier>',
' Identifier to be used to prefix premajor, preminor,',
' prepatch or prerelease version increments.',
'',
'-l --loose',
' Interpret versions and ranges loosely',
'',
'-p --include-prerelease',
' Always include prerelease versions in range matching',
'',
'-c --coerce',
' Coerce a string into SemVer if possible',
' (does not imply --loose)',
'',
'--rtl',
' Coerce version strings right to left',
'',
'--ltr',
' Coerce version strings left to right (default)',
'',
'Program exits successfully if any valid version satisfies',
'all supplied ranges, and prints all satisfying versions.',
'',
'If no satisfying versions are found, then exits failure.',
'',
'Versions are printed in ascending order, so supplying',
'multiple versions to the utility will just sort them.'
].join('\n'))
}

View File

@@ -0,0 +1,60 @@
{
"_from": "semver@^6.3.0",
"_id": "semver@6.3.0",
"_inBundle": false,
"_integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
"_location": "/app-builder-lib/semver",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "semver@^6.3.0",
"name": "semver",
"escapedName": "semver",
"rawSpec": "^6.3.0",
"saveSpec": null,
"fetchSpec": "^6.3.0"
},
"_requiredBy": [
"/app-builder-lib"
],
"_resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
"_shasum": "ee0a64c8af5e8ceea67687b133761e1becbd1d3d",
"_spec": "semver@^6.3.0",
"_where": "C:\\Users\\ryuki\\TheDesk\\app\\node_modules\\app-builder-lib",
"bin": {
"semver": "./bin/semver.js"
},
"bugs": {
"url": "https://github.com/npm/node-semver/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "The semantic version parser used by npm.",
"devDependencies": {
"tap": "^14.3.1"
},
"files": [
"bin",
"range.bnf",
"semver.js"
],
"homepage": "https://github.com/npm/node-semver#readme",
"license": "ISC",
"main": "semver.js",
"name": "semver",
"repository": {
"type": "git",
"url": "git+https://github.com/npm/node-semver.git"
},
"scripts": {
"postpublish": "git push origin --follow-tags",
"postversion": "npm publish",
"preversion": "npm test",
"test": "tap"
},
"tap": {
"check-coverage": true
},
"version": "6.3.0"
}

View File

@@ -0,0 +1,16 @@
range-set ::= range ( logical-or range ) *
logical-or ::= ( ' ' ) * '||' ( ' ' ) *
range ::= hyphen | simple ( ' ' simple ) * | ''
hyphen ::= partial ' - ' partial
simple ::= primitive | partial | tilde | caret
primitive ::= ( '<' | '>' | '>=' | '<=' | '=' ) partial
partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )?
xr ::= 'x' | 'X' | '*' | nr
nr ::= '0' | [1-9] ( [0-9] ) *
tilde ::= '~' partial
caret ::= '^' partial
qualifier ::= ( '-' pre )? ( '+' build )?
pre ::= parts
build ::= parts
parts ::= part ( '.' part ) *
part ::= nr | [-0-9A-Za-z]+

File diff suppressed because it is too large Load Diff

36
app/node_modules/app-builder-lib/out/Framework.d.ts generated vendored Normal file
View File

@@ -0,0 +1,36 @@
import { FileTransformer } from "builder-util/out/fs";
import { AsarIntegrity } from "./asar/integrity";
import { Platform, PlatformPackager, ElectronPlatformName, AfterPackContext } from "./index";
export interface Framework {
readonly name: string;
readonly version: string;
readonly distMacOsAppName: string;
readonly macOsDefaultTargets: Array<string>;
readonly defaultAppIdPrefix: string;
readonly isNpmRebuildRequired: boolean;
readonly isCopyElevateHelper: boolean;
getDefaultIcon?(platform: Platform): string | null;
getMainFile?(platform: Platform): string | null;
getExcludedDependencies?(platform: Platform): Array<string> | null;
prepareApplicationStageDirectory(options: PrepareApplicationStageDirectoryOptions): Promise<any>;
beforeCopyExtraFiles?(options: BeforeCopyExtraFilesOptions): Promise<any>;
afterPack?(context: AfterPackContext): Promise<any>;
createTransformer?(): FileTransformer | null;
}
export interface BeforeCopyExtraFilesOptions {
packager: PlatformPackager<any>;
appOutDir: string;
asarIntegrity: AsarIntegrity | null;
platformName: string;
}
export interface PrepareApplicationStageDirectoryOptions {
readonly packager: PlatformPackager<any>;
/**
* Platform doesn't process application output directory in any way. Unpack implementation must create or empty dir if need.
*/
readonly appOutDir: string;
readonly platformName: ElectronPlatformName;
readonly arch: string;
readonly version: string;
}
export declare function isElectronBased(framework: Framework): boolean;

12
app/node_modules/app-builder-lib/out/Framework.js generated vendored Normal file
View File

@@ -0,0 +1,12 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.isElectronBased = isElectronBased;
function isElectronBased(framework) {
return framework.name === "electron";
}
// __ts-babel@6.0.4
//# sourceMappingURL=Framework.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../src/Framework.ts"],"names":[],"mappings":";;;;;;;AAmDM,SAAU,eAAV,CAA0B,SAA1B,EAA8C;AAClD,SAAO,SAAS,CAAC,IAAV,KAAmB,UAA1B;AACD,C","sourcesContent":["import { FileTransformer } from \"builder-util/out/fs\"\nimport { AsarIntegrity } from \"./asar/integrity\"\nimport { Platform, PlatformPackager, ElectronPlatformName, AfterPackContext } from \"./index\"\n\nexport interface Framework {\n readonly name: string\n readonly version: string\n readonly distMacOsAppName: string\n readonly macOsDefaultTargets: Array<string>\n readonly defaultAppIdPrefix: string\n\n readonly isNpmRebuildRequired: boolean\n\n readonly isCopyElevateHelper: boolean\n\n getDefaultIcon?(platform: Platform): string | null\n\n getMainFile?(platform: Platform): string | null\n\n getExcludedDependencies?(platform: Platform): Array<string> | null\n\n prepareApplicationStageDirectory(options: PrepareApplicationStageDirectoryOptions): Promise<any>\n\n beforeCopyExtraFiles?(options: BeforeCopyExtraFilesOptions): Promise<any>\n\n afterPack?(context: AfterPackContext): Promise<any>\n\n createTransformer?(): FileTransformer | null\n}\n\nexport interface BeforeCopyExtraFilesOptions {\n packager: PlatformPackager<any>\n appOutDir: string\n\n asarIntegrity: AsarIntegrity | null\n\n // ElectronPlatformName\n platformName: string\n}\n\nexport interface PrepareApplicationStageDirectoryOptions {\n readonly packager: PlatformPackager<any>\n /**\n * Platform doesn't process application output directory in any way. Unpack implementation must create or empty dir if need.\n */\n readonly appOutDir: string\n readonly platformName: ElectronPlatformName\n readonly arch: string\n readonly version: string\n}\n\nexport function isElectronBased(framework: Framework) {\n return framework.name === \"electron\"\n}"],"sourceRoot":""}

View File

@@ -0,0 +1,10 @@
import { FileTransformer } from "builder-util/out/fs";
import { Platform } from "./core";
import { LibUiFramework } from "./frameworks/LibUiFramework";
export declare class ProtonFramework extends LibUiFramework {
readonly name = "proton";
readonly defaultAppIdPrefix = "com.proton-native.";
constructor(version: string, distMacOsAppName: string, isUseLaunchUi: boolean);
getDefaultIcon(platform: Platform): string;
createTransformer(): FileTransformer | null;
}

158
app/node_modules/app-builder-lib/out/ProtonFramework.js generated vendored Normal file
View File

@@ -0,0 +1,158 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.ProtonFramework = void 0;
function _builderUtil() {
const data = require("builder-util");
_builderUtil = function () {
return data;
};
return data;
}
function _builderUtilRuntime() {
const data = require("builder-util-runtime");
_builderUtilRuntime = function () {
return data;
};
return data;
}
function _core() {
const data = require("./core");
_core = function () {
return data;
};
return data;
}
function _fileTransformer() {
const data = require("./fileTransformer");
_fileTransformer = function () {
return data;
};
return data;
}
function _LibUiFramework() {
const data = require("./frameworks/LibUiFramework");
_LibUiFramework = function () {
return data;
};
return data;
}
function _pathManager() {
const data = require("./util/pathManager");
_pathManager = function () {
return data;
};
return data;
}
class ProtonFramework extends _LibUiFramework().LibUiFramework {
constructor(version, distMacOsAppName, isUseLaunchUi) {
super(version, distMacOsAppName, isUseLaunchUi);
this.name = "proton"; // noinspection JSUnusedGlobalSymbols
this.defaultAppIdPrefix = "com.proton-native.";
}
getDefaultIcon(platform) {
if (platform === _core().Platform.WINDOWS) {
return (0, _pathManager().getTemplatePath)("icons/proton-native/proton-native.ico");
} else if (platform === _core().Platform.LINUX) {
return (0, _pathManager().getTemplatePath)("icons/proton-native/linux");
} else {
return (0, _pathManager().getTemplatePath)("icons/proton-native/proton-native.icns");
}
}
createTransformer() {
let babel;
const babelOptions = {
ast: false,
sourceMaps: "inline"
};
if (process.env.TEST_SET_BABEL_PRESET === "true") {
babel = require("@babel/core");
babel = testOnlyBabel(babel, babelOptions, this.version);
} else {
try {
babel = require("babel-core");
} catch (e) {
// babel isn't installed
_builderUtil().log.debug(null, "don't transpile source code using Babel");
return null;
}
}
_builderUtil().log.info({
options: (0, _builderUtilRuntime().safeStringifyJson)(babelOptions, new Set(["presets"]))
}, "transpile source code using Babel");
return file => {
if (!(file.endsWith(".js") || file.endsWith(".jsx")) || file.includes(_fileTransformer().NODE_MODULES_PATTERN)) {
return null;
}
return new Promise((resolve, reject) => {
return babel.transformFile(file, babelOptions, (error, result) => {
if (error == null) {
resolve(result.code);
} else {
reject(error);
}
});
});
};
}
}
exports.ProtonFramework = ProtonFramework;
function testOnlyBabel(babel, babelOptions, nodeVersion) {
// out test dir can be located outside of electron-builder node_modules and babel cannot resolve string names of preset
babelOptions.presets = [[require("@babel/preset-env").default, {
targets: {
node: nodeVersion
}
}], require("@babel/preset-react")];
babelOptions.plugins = [// stage 0
require("@babel/plugin-proposal-function-bind").default, // stage 1
require("@babel/plugin-proposal-export-default-from").default, require("@babel/plugin-proposal-logical-assignment-operators").default, [require("@babel/plugin-proposal-optional-chaining").default, {
loose: false
}], [require("@babel/plugin-proposal-pipeline-operator").default, {
proposal: "minimal"
}], [require("@babel/plugin-proposal-nullish-coalescing-operator").default, {
loose: false
}], require("@babel/plugin-proposal-do-expressions").default, // stage 2
[require("@babel/plugin-proposal-decorators").default, {
legacy: true
}], require("@babel/plugin-proposal-function-sent").default, require("@babel/plugin-proposal-export-namespace-from").default, require("@babel/plugin-proposal-numeric-separator").default, require("@babel/plugin-proposal-throw-expressions").default, // stage 3
require("@babel/plugin-syntax-dynamic-import").default, require("@babel/plugin-syntax-import-meta").default, [require("@babel/plugin-proposal-class-properties").default, {
loose: false
}], require("@babel/plugin-proposal-json-strings").default];
babelOptions.babelrc = false;
return babel;
}
// __ts-babel@6.0.4
//# sourceMappingURL=ProtonFramework.js.map

File diff suppressed because one or more lines are too long

26
app/node_modules/app-builder-lib/out/appInfo.d.ts generated vendored Normal file
View File

@@ -0,0 +1,26 @@
import { PlatformSpecificBuildOptions } from "./options/PlatformSpecificBuildOptions";
import { Packager } from "./packager";
export declare class AppInfo {
private readonly info;
private readonly platformSpecificOptions;
readonly description: string;
readonly version: string;
readonly buildNumber: string | undefined;
readonly buildVersion: string;
readonly productName: string;
readonly productFilename: string;
constructor(info: Packager, buildVersion: string | null | undefined, platformSpecificOptions?: PlatformSpecificBuildOptions | null);
readonly channel: string | null;
getVersionInWeirdWindowsForm(isSetBuildNumber?: boolean): string;
private readonly notNullDevMetadata;
readonly companyName: string | null;
readonly id: string;
readonly macBundleIdentifier: string;
readonly name: string;
readonly linuxPackageName: string;
readonly sanitizedName: string;
readonly updaterCacheDirName: string;
readonly copyright: string;
computePackageUrl(): Promise<string | null>;
}
export declare function smarten(s: string): string;

202
app/node_modules/app-builder-lib/out/appInfo.js generated vendored Normal file
View File

@@ -0,0 +1,202 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.filterCFBundleIdentifier = filterCFBundleIdentifier;
exports.smarten = smarten;
exports.AppInfo = void 0;
function _builderUtil() {
const data = require("builder-util");
_builderUtil = function () {
return data;
};
return data;
}
function _sanitizeFilename() {
const data = _interopRequireDefault(require("sanitize-filename"));
_sanitizeFilename = function () {
return data;
};
return data;
}
function _semver() {
const data = require("semver");
_semver = function () {
return data;
};
return data;
}
function _macroExpander() {
const data = require("./util/macroExpander");
_macroExpander = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
class AppInfo {
constructor(info, buildVersion, platformSpecificOptions = null) {
this.info = info;
this.platformSpecificOptions = platformSpecificOptions;
this.description = smarten(this.info.metadata.description || "");
this.version = info.metadata.version;
if (buildVersion == null) {
buildVersion = info.config.buildVersion;
}
this.buildNumber = process.env.BUILD_NUMBER || process.env.TRAVIS_BUILD_NUMBER || process.env.APPVEYOR_BUILD_NUMBER || process.env.CIRCLE_BUILD_NUM || process.env.BUILD_BUILDNUMBER || process.env.CI_PIPELINE_IID;
if (buildVersion == null) {
buildVersion = this.version;
if (!(0, _builderUtil().isEmptyOrSpaces)(this.buildNumber)) {
buildVersion += `.${this.buildNumber}`;
}
}
this.buildVersion = buildVersion;
this.productName = info.config.productName || info.metadata.productName || info.metadata.name;
this.productFilename = (0, _sanitizeFilename().default)(this.productName);
}
get channel() {
const prereleaseInfo = (0, _semver().prerelease)(this.version);
if (prereleaseInfo != null && prereleaseInfo.length > 0) {
return prereleaseInfo[0];
}
return null;
}
getVersionInWeirdWindowsForm(isSetBuildNumber = true) {
const parsedVersion = new (_semver().SemVer)(this.version); // https://github.com/electron-userland/electron-builder/issues/2635#issuecomment-371792272
let buildNumber = isSetBuildNumber ? this.buildNumber : null;
if (buildNumber == null || !/^\d+$/.test(buildNumber)) {
buildNumber = "0";
}
return `${parsedVersion.major}.${parsedVersion.minor}.${parsedVersion.patch}.${buildNumber}`;
}
get notNullDevMetadata() {
return this.info.devMetadata || {};
}
get companyName() {
const author = this.info.metadata.author || this.notNullDevMetadata.author;
return author == null ? null : author.name;
}
get id() {
let appId = null;
for (const options of [this.platformSpecificOptions, this.info.config]) {
if (options != null && appId == null) {
appId = options.appId;
}
}
const generateDefaultAppId = () => {
const info = this.info;
return `${info.framework.defaultAppIdPrefix}${info.metadata.name.toLowerCase()}`;
};
if (appId != null && (appId === "your.id" || (0, _builderUtil().isEmptyOrSpaces)(appId))) {
const incorrectAppId = appId;
appId = generateDefaultAppId();
_builderUtil().log.warn(`do not use "${incorrectAppId}" as appId, "${appId}" will be used instead`);
}
return appId == null ? generateDefaultAppId() : appId;
}
get macBundleIdentifier() {
return filterCFBundleIdentifier(this.id);
}
get name() {
return this.info.metadata.name;
}
get linuxPackageName() {
const name = this.name; // https://github.com/electron-userland/electron-builder/issues/2963
return name.startsWith("@") ? this.productFilename : name;
}
get sanitizedName() {
return (0, _sanitizeFilename().default)(this.name);
}
get updaterCacheDirName() {
return this.sanitizedName.toLowerCase() + "-updater";
}
get copyright() {
const copyright = this.info.config.copyright;
if (copyright != null) {
return (0, _macroExpander().expandMacro)(copyright, null, this);
}
return `Copyright © ${new Date().getFullYear()} ${this.companyName || this.productName}`;
}
async computePackageUrl() {
const url = this.info.metadata.homepage || this.notNullDevMetadata.homepage;
if (url != null) {
return url;
}
const info = await this.info.repositoryInfo;
return info == null || info.type !== "github" ? null : `https://${info.domain}/${info.user}/${info.project}`;
}
}
/** @internal */
exports.AppInfo = AppInfo;
function filterCFBundleIdentifier(identifier) {
// Remove special characters and allow only alphanumeric (A-Z,a-z,0-9), hyphen (-), and period (.)
// Apple documentation: https://developer.apple.com/library/mac/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/20001431-102070
return identifier.replace(/ /g, "-").replace(/[^a-zA-Z0-9.-]/g, "");
} // fpm bug - rpm build --description is not escaped, well... decided to replace quite to smart quote
// http://leancrew.com/all-this/2010/11/smart-quotes-in-javascript/
function smarten(s) {
// opening singles
s = s.replace(/(^|[-\u2014\s(\["])'/g, "$1\u2018"); // closing singles & apostrophes
s = s.replace(/'/g, "\u2019"); // opening doubles
s = s.replace(/(^|[-\u2014/\[(\u2018\s])"/g, "$1\u201c"); // closing doubles
s = s.replace(/"/g, "\u201d");
return s;
}
// __ts-babel@6.0.4
//# sourceMappingURL=appInfo.js.map

1
app/node_modules/app-builder-lib/out/appInfo.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

2
app/node_modules/app-builder-lib/out/asar/asar.d.ts generated vendored Normal file
View File

@@ -0,0 +1,2 @@
export declare function readAsar(archive: string): Promise<AsarFilesystem>;
export declare function readAsarJson(archive: string, file: string): Promise<any>;

211
app/node_modules/app-builder-lib/out/asar/asar.js generated vendored Normal file
View File

@@ -0,0 +1,211 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.readAsar = readAsar;
exports.readAsarJson = readAsarJson;
exports.AsarFilesystem = exports.Node = void 0;
function _chromiumPickleJs() {
const data = require("chromium-pickle-js");
_chromiumPickleJs = function () {
return data;
};
return data;
}
function _fsExtra() {
const data = require("fs-extra");
_fsExtra = function () {
return data;
};
return data;
}
var path = _interopRequireWildcard(require("path"));
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
/** @internal */
class Node {}
/** @internal */
exports.Node = Node;
class AsarFilesystem {
constructor(src, header = new Node(), headerSize = -1) {
this.src = src;
this.header = header;
this.headerSize = headerSize;
this.offset = 0;
if (this.header.files == null) {
this.header.files = {};
}
}
searchNodeFromDirectory(p, isCreate) {
let node = this.header;
for (const dir of p.split(path.sep)) {
if (dir !== ".") {
let child = node.files[dir];
if (child == null) {
if (!isCreate) {
return null;
}
child = new Node();
child.files = {};
node.files[dir] = child;
}
node = child;
}
}
return node;
}
getOrCreateNode(p) {
if (p == null || p.length === 0) {
return this.header;
}
const name = path.basename(p);
const dirNode = this.searchNodeFromDirectory(path.dirname(p), true);
if (dirNode.files == null) {
dirNode.files = {};
}
let result = dirNode.files[name];
if (result == null) {
result = new Node();
dirNode.files[name] = result;
}
return result;
}
addFileNode(file, dirNode, size, unpacked, stat) {
if (size > 4294967295) {
throw new Error(`${file}: file size cannot be larger than 4.2GB`);
}
const node = new Node();
node.size = size;
if (unpacked) {
node.unpacked = true;
} else {
// electron expects string
node.offset = this.offset.toString();
if (process.platform !== "win32" && stat.mode & 0o100) {
node.executable = true;
}
this.offset += node.size;
}
let children = dirNode.files;
if (children == null) {
children = {};
dirNode.files = children;
}
children[path.basename(file)] = node;
return node;
}
getNode(p) {
const node = this.searchNodeFromDirectory(path.dirname(p), false);
return node.files[path.basename(p)];
}
getFile(p, followLinks = true) {
const info = this.getNode(p); // if followLinks is false we don't resolve symlinks
return followLinks && info.link != null ? this.getFile(info.link) : info;
}
async readJson(file) {
return JSON.parse((await this.readFile(file)).toString());
}
readFile(file) {
return readFileFromAsar(this, file, this.getFile(file));
}
}
exports.AsarFilesystem = AsarFilesystem;
async function readAsar(archive) {
const fd = await (0, _fsExtra().open)(archive, "r");
let size;
let headerBuf;
try {
const sizeBuf = Buffer.allocUnsafe(8);
if ((await (0, _fsExtra().read)(fd, sizeBuf, 0, 8, null)).bytesRead !== 8) {
throw new Error("Unable to read header size");
}
const sizePickle = (0, _chromiumPickleJs().createFromBuffer)(sizeBuf);
size = sizePickle.createIterator().readUInt32();
headerBuf = Buffer.allocUnsafe(size);
if ((await (0, _fsExtra().read)(fd, headerBuf, 0, size, null)).bytesRead !== size) {
throw new Error("Unable to read header");
}
} finally {
await (0, _fsExtra().close)(fd);
}
const headerPickle = (0, _chromiumPickleJs().createFromBuffer)(headerBuf);
const header = headerPickle.createIterator().readString();
return new AsarFilesystem(archive, JSON.parse(header), size);
}
async function readAsarJson(archive, file) {
const fs = await readAsar(archive);
return await fs.readJson(file);
}
async function readFileFromAsar(filesystem, filename, info) {
const size = info.size;
const buffer = Buffer.allocUnsafe(size);
if (size <= 0) {
return buffer;
}
if (info.unpacked) {
return await (0, _fsExtra().readFile)(path.join(`${filesystem.src}.unpacked`, filename));
}
const fd = await (0, _fsExtra().open)(filesystem.src, "r");
try {
const offset = 8 + filesystem.headerSize + parseInt(info.offset, 10);
await (0, _fsExtra().read)(fd, buffer, 0, size, offset);
} finally {
await (0, _fsExtra().close)(fd);
}
return buffer;
}
// __ts-babel@6.0.4
//# sourceMappingURL=asar.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,66 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.checkFileInArchive = checkFileInArchive;
function _fs() {
const data = require("builder-util/out/fs");
_fs = function () {
return data;
};
return data;
}
function _asar() {
const data = require("./asar");
_asar = function () {
return data;
};
return data;
}
/** @internal */
async function checkFileInArchive(asarFile, relativeFile, messagePrefix) {
function error(text) {
return new Error(`${messagePrefix} "${relativeFile}" in the "${asarFile}" ${text}`);
}
let fs;
try {
fs = await (0, _asar().readAsar)(asarFile);
} catch (e) {
throw error(`is corrupted: ${e}`);
}
let stat;
try {
stat = fs.getFile(relativeFile);
} catch (e) {
const fileStat = await (0, _fs().statOrNull)(asarFile);
if (fileStat == null) {
throw error(`does not exist. Seems like a wrong configuration.`);
} // asar throws error on access to undefined object (info.link)
stat = null;
}
if (stat == null) {
throw error(`does not exist. Seems like a wrong configuration.`);
}
if (stat.size === 0) {
throw error(`is corrupted: size 0`);
}
}
// __ts-babel@6.0.4
//# sourceMappingURL=asarFileChecker.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../src/asar/asarFileChecker.ts"],"names":[],"mappings":";;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AACO,eAAe,kBAAf,CAAkC,QAAlC,EAAoD,YAApD,EAA0E,aAA1E,EAA+F;AACpG,WAAS,KAAT,CAAe,IAAf,EAA2B;AACzB,WAAO,IAAI,KAAJ,CAAU,GAAG,aAAa,KAAK,YAAY,aAAa,QAAQ,KAAK,IAAI,EAAzE,CAAP;AACD;;AAED,MAAI,EAAJ;;AACA,MAAI;AACF,IAAA,EAAE,GAAG,MAAM,sBAAS,QAAT,CAAX;AACD,GAFD,CAGA,OAAO,CAAP,EAAU;AACR,UAAM,KAAK,CAAC,iBAAiB,CAAC,EAAnB,CAAX;AACD;;AAED,MAAI,IAAJ;;AACA,MAAI;AACF,IAAA,IAAI,GAAG,EAAE,CAAC,OAAH,CAAW,YAAX,CAAP;AACD,GAFD,CAGA,OAAO,CAAP,EAAU;AACR,UAAM,QAAQ,GAAG,MAAM,sBAAW,QAAX,CAAvB;;AACA,QAAI,QAAQ,IAAI,IAAhB,EAAsB;AACpB,YAAM,KAAK,CAAC,mDAAD,CAAX;AACD,KAJO,CAMR;;;AACA,IAAA,IAAI,GAAG,IAAP;AACD;;AAED,MAAI,IAAI,IAAI,IAAZ,EAAkB;AAChB,UAAM,KAAK,CAAC,mDAAD,CAAX;AACD;;AACD,MAAI,IAAI,CAAC,IAAL,KAAc,CAAlB,EAAqB;AACnB,UAAM,KAAK,CAAC,sBAAD,CAAX;AACD;AACF,C","sourcesContent":["import { statOrNull } from \"builder-util/out/fs\"\nimport { Node, readAsar } from \"./asar\"\n\n/** @internal */\nexport async function checkFileInArchive(asarFile: string, relativeFile: string, messagePrefix: string) {\n function error(text: string) {\n return new Error(`${messagePrefix} \"${relativeFile}\" in the \"${asarFile}\" ${text}`)\n }\n\n let fs\n try {\n fs = await readAsar(asarFile)\n }\n catch (e) {\n throw error(`is corrupted: ${e}`)\n }\n\n let stat: Node | null\n try {\n stat = fs.getFile(relativeFile)\n }\n catch (e) {\n const fileStat = await statOrNull(asarFile)\n if (fileStat == null) {\n throw error(`does not exist. Seems like a wrong configuration.`)\n }\n\n // asar throws error on access to undefined object (info.link)\n stat = null\n }\n\n if (stat == null) {\n throw error(`does not exist. Seems like a wrong configuration.`)\n }\n if (stat.size === 0) {\n throw error(`is corrupted: size 0`)\n }\n}\n"],"sourceRoot":""}

View File

@@ -0,0 +1 @@
export {};

344
app/node_modules/app-builder-lib/out/asar/asarUtil.js generated vendored Normal file
View File

@@ -0,0 +1,344 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.AsarPackager = void 0;
function _builderUtil() {
const data = require("builder-util");
_builderUtil = function () {
return data;
};
return data;
}
function _fs() {
const data = require("builder-util/out/fs");
_fs = function () {
return data;
};
return data;
}
var _fs2 = require("fs");
function _fsExtra() {
const data = require("fs-extra");
_fsExtra = function () {
return data;
};
return data;
}
var path = _interopRequireWildcard(require("path"));
function _appFileCopier() {
const data = require("../util/appFileCopier");
_appFileCopier = function () {
return data;
};
return data;
}
function _asar() {
const data = require("./asar");
_asar = function () {
return data;
};
return data;
}
function _unpackDetector() {
const data = require("./unpackDetector");
_unpackDetector = function () {
return data;
};
return data;
}
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
const pickle = require("chromium-pickle-js");
/** @internal */
class AsarPackager {
constructor(src, destination, options, unpackPattern) {
this.src = src;
this.destination = destination;
this.options = options;
this.unpackPattern = unpackPattern;
this.fs = new (_asar().AsarFilesystem)(this.src);
this.outFile = path.join(destination, "app.asar");
this.unpackedDest = `${this.outFile}.unpacked`;
} // sort files to minimize file change (i.e. asar file is not changed dramatically on small change)
async pack(fileSets, packager) {
if (this.options.ordering != null) {
// ordering doesn't support transformed files, but ordering is not used functionality - wait user report to fix it
await order(fileSets[0].files, this.options.ordering, fileSets[0].src);
}
await (0, _fsExtra().ensureDir)(path.dirname(this.outFile));
const unpackedFileIndexMap = new Map();
for (const fileSet of fileSets) {
unpackedFileIndexMap.set(fileSet, (await this.createPackageFromFiles(fileSet, packager.info)));
}
await this.writeAsarFile(fileSets, unpackedFileIndexMap);
}
async createPackageFromFiles(fileSet, packager) {
const metadata = fileSet.metadata; // search auto unpacked dir
const unpackedDirs = new Set();
const rootForAppFilesWithoutAsar = path.join(this.destination, "app");
if (this.options.smartUnpack !== false) {
await (0, _unpackDetector().detectUnpackedDirs)(fileSet, unpackedDirs, this.unpackedDest, rootForAppFilesWithoutAsar);
}
const dirToCreateForUnpackedFiles = new Set(unpackedDirs);
const correctDirNodeUnpackedFlag = async (filePathInArchive, dirNode) => {
for (const dir of unpackedDirs) {
if (filePathInArchive.length > dir.length + 2 && filePathInArchive[dir.length] === path.sep && filePathInArchive.startsWith(dir)) {
dirNode.unpacked = true;
unpackedDirs.add(filePathInArchive); // not all dirs marked as unpacked after first iteration - because node module dir can be marked as unpacked after processing node module dir content
// e.g. node-notifier/example/advanced.js processed, but only on process vendor/terminal-notifier.app module will be marked as unpacked
await (0, _fsExtra().ensureDir)(path.join(this.unpackedDest, filePathInArchive));
break;
}
}
};
const transformedFiles = fileSet.transformedFiles;
const taskManager = new (_builderUtil().AsyncTaskManager)(packager.cancellationToken);
const fileCopier = new (_fs().FileCopier)();
let currentDirNode = null;
let currentDirPath = null;
const unpackedFileIndexSet = new Set();
for (let i = 0, n = fileSet.files.length; i < n; i++) {
const file = fileSet.files[i];
const stat = metadata.get(file);
if (stat == null) {
continue;
}
const pathInArchive = path.relative(rootForAppFilesWithoutAsar, (0, _appFileCopier().getDestinationPath)(file, fileSet));
if (stat.isSymbolicLink()) {
const s = stat;
this.fs.getOrCreateNode(pathInArchive).link = s.relativeLink;
s.pathInArchive = pathInArchive;
unpackedFileIndexSet.add(i);
continue;
}
let fileParent = path.dirname(pathInArchive);
if (fileParent === ".") {
fileParent = "";
}
if (currentDirPath !== fileParent) {
if (fileParent.startsWith("..")) {
throw new Error(`Internal error: path must not start with "..": ${fileParent}`);
}
currentDirPath = fileParent;
currentDirNode = this.fs.getOrCreateNode(fileParent); // do not check for root
if (fileParent !== "" && !currentDirNode.unpacked) {
if (unpackedDirs.has(fileParent)) {
currentDirNode.unpacked = true;
} else {
await correctDirNodeUnpackedFlag(fileParent, currentDirNode);
}
}
}
const dirNode = currentDirNode;
const newData = transformedFiles == null ? null : transformedFiles.get(i);
const isUnpacked = dirNode.unpacked || this.unpackPattern != null && this.unpackPattern(file, stat);
this.fs.addFileNode(file, dirNode, newData == null ? stat.size : Buffer.byteLength(newData), isUnpacked, stat);
if (isUnpacked) {
if (!dirNode.unpacked && !dirToCreateForUnpackedFiles.has(fileParent)) {
dirToCreateForUnpackedFiles.add(fileParent);
await (0, _fsExtra().ensureDir)(path.join(this.unpackedDest, fileParent));
}
const unpackedFile = path.join(this.unpackedDest, pathInArchive);
taskManager.addTask(copyFileOrData(fileCopier, newData, file, unpackedFile, stat));
if (taskManager.tasks.length > _fs().MAX_FILE_REQUESTS) {
await taskManager.awaitTasks();
}
unpackedFileIndexSet.add(i);
}
}
if (taskManager.tasks.length > 0) {
await taskManager.awaitTasks();
}
return unpackedFileIndexSet;
}
writeAsarFile(fileSets, unpackedFileIndexMap) {
return new Promise((resolve, reject) => {
const headerPickle = pickle.createEmpty();
headerPickle.writeString(JSON.stringify(this.fs.header));
const headerBuf = headerPickle.toBuffer();
const sizePickle = pickle.createEmpty();
sizePickle.writeUInt32(headerBuf.length);
const sizeBuf = sizePickle.toBuffer();
const writeStream = (0, _fsExtra().createWriteStream)(this.outFile);
writeStream.on("error", reject);
writeStream.on("close", resolve);
writeStream.write(sizeBuf);
let fileSetIndex = 0;
let files = fileSets[0].files;
let metadata = fileSets[0].metadata;
let transformedFiles = fileSets[0].transformedFiles;
let unpackedFileIndexSet = unpackedFileIndexMap.get(fileSets[0]);
const w = index => {
while (true) {
if (index >= files.length) {
if (++fileSetIndex >= fileSets.length) {
writeStream.end();
return;
} else {
files = fileSets[fileSetIndex].files;
metadata = fileSets[fileSetIndex].metadata;
transformedFiles = fileSets[fileSetIndex].transformedFiles;
unpackedFileIndexSet = unpackedFileIndexMap.get(fileSets[fileSetIndex]);
index = 0;
}
}
if (!unpackedFileIndexSet.has(index)) {
break;
} else {
const stat = metadata.get(files[index]);
if (stat != null && stat.isSymbolicLink()) {
(0, _fs2.symlink)(stat.linkRelativeToFile, path.join(this.unpackedDest, stat.pathInArchive), () => w(index + 1));
return;
}
}
index++;
}
const data = transformedFiles == null ? null : transformedFiles.get(index);
const file = files[index];
if (data !== null && data !== undefined) {
writeStream.write(data, () => w(index + 1));
return;
} // https://github.com/yarnpkg/yarn/pull/3539
const stat = metadata.get(file);
if (stat != null && stat.size < 2 * 1024 * 1024) {
(0, _fsExtra().readFile)(file).then(it => {
writeStream.write(it, () => w(index + 1));
}).catch(e => reject(`Cannot read file ${file}: ${e.stack || e}`));
} else {
const readStream = (0, _fsExtra().createReadStream)(file);
readStream.on("error", reject);
readStream.once("end", () => w(index + 1));
readStream.pipe(writeStream, {
end: false
});
}
};
writeStream.write(headerBuf, () => w(0));
});
}
}
exports.AsarPackager = AsarPackager;
async function order(filenames, orderingFile, src) {
const orderingFiles = (await (0, _fsExtra().readFile)(orderingFile, "utf8")).split("\n").map(line => {
if (line.indexOf(":") !== -1) {
line = line.split(":").pop();
}
line = line.trim();
if (line[0] === "/") {
line = line.slice(1);
}
return line;
});
const ordering = [];
for (const file of orderingFiles) {
const pathComponents = file.split(path.sep);
for (const pathComponent of pathComponents) {
ordering.push(path.join(src, pathComponent));
}
}
const sortedFiles = [];
let missing = 0;
const total = filenames.length;
for (const file of ordering) {
if (!sortedFiles.includes(file) && filenames.includes(file)) {
sortedFiles.push(file);
}
}
for (const file of filenames) {
if (!sortedFiles.includes(file)) {
sortedFiles.push(file);
missing += 1;
}
}
_builderUtil().log.info({
coverage: (total - missing) / total * 100
}, "ordering files in ASAR archive");
return sortedFiles;
}
function copyFileOrData(fileCopier, data, source, destination, stats) {
if (data == null) {
return fileCopier.copy(source, destination, stats);
} else {
return (0, _fsExtra().writeFile)(destination, data);
}
}
// __ts-babel@6.0.4
//# sourceMappingURL=asarUtil.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,14 @@
export interface AsarIntegrityOptions {
/**
* Allows external asar files.
*
* @default false
*/
readonly externalAllowed?: boolean;
}
export interface AsarIntegrity extends AsarIntegrityOptions {
checksums: {
[key: string]: string;
};
}
export declare function computeData(resourcesPath: string, options?: AsarIntegrityOptions | null): Promise<AsarIntegrity>;

74
app/node_modules/app-builder-lib/out/asar/integrity.js generated vendored Normal file
View File

@@ -0,0 +1,74 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.computeData = computeData;
function _bluebirdLst() {
const data = _interopRequireDefault(require("bluebird-lst"));
_bluebirdLst = function () {
return data;
};
return data;
}
function _crypto() {
const data = require("crypto");
_crypto = function () {
return data;
};
return data;
}
var _fs = require("fs");
function _fsExtra() {
const data = require("fs-extra");
_fsExtra = function () {
return data;
};
return data;
}
var path = _interopRequireWildcard(require("path"));
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
async function computeData(resourcesPath, options) {
// sort to produce constant result
const names = (await (0, _fsExtra().readdir)(resourcesPath)).filter(it => it.endsWith(".asar")).sort();
const checksums = await _bluebirdLst().default.map(names, it => hashFile(path.join(resourcesPath, it)));
const result = {};
for (let i = 0; i < names.length; i++) {
result[names[i]] = checksums[i];
}
return Object.assign({
checksums: result
}, options);
}
function hashFile(file, algorithm = "sha512", encoding = "base64") {
return new Promise((resolve, reject) => {
const hash = (0, _crypto().createHash)(algorithm);
hash.on("error", reject).setEncoding(encoding);
(0, _fs.createReadStream)(file).on("error", reject).on("end", () => {
hash.end();
resolve(hash.read());
}).pipe(hash, {
end: false
});
});
}
// __ts-babel@6.0.4
//# sourceMappingURL=integrity.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../src/asar/integrity.ts"],"names":[],"mappings":";;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;;;;;;AAeO,eAAe,WAAf,CAA2B,aAA3B,EAAkD,OAAlD,EAAuF;AAC5F;AACA,QAAM,KAAK,GAAG,CAAC,MAAM,wBAAQ,aAAR,CAAP,EAA+B,MAA/B,CAAsC,EAAE,IAAI,EAAE,CAAC,QAAH,CAAY,OAAZ,CAA5C,EAAkE,IAAlE,EAAd;AACA,QAAM,SAAS,GAAG,MAAM,uBAAgB,GAAhB,CAAoB,KAApB,EAA2B,EAAE,IAAI,QAAQ,CAAC,IAAI,CAAC,IAAL,CAAU,aAAV,EAAyB,EAAzB,CAAD,CAAzC,CAAxB;AAEA,QAAM,MAAM,GAA+B,EAA3C;;AACA,OAAK,IAAI,CAAC,GAAG,CAAb,EAAgB,CAAC,GAAG,KAAK,CAAC,MAA1B,EAAkC,CAAC,EAAnC,EAAuC;AACrC,IAAA,MAAM,CAAC,KAAK,CAAC,CAAD,CAAN,CAAN,GAAmB,SAAS,CAAC,CAAD,CAA5B;AACD;;AACD,SAAA,MAAA,CAAA,MAAA,CAAA;AAAQ,IAAA,SAAS,EAAE;AAAnB,GAAA,EAA8B,OAA9B,CAAA;AACD;;AAED,SAAS,QAAT,CAAkB,IAAlB,EAAgC,SAAA,GAAoB,QAApD,EAA8D,QAAA,GAAwC,QAAtG,EAA8G;AAC5G,SAAO,IAAI,OAAJ,CAAoB,CAAC,OAAD,EAAU,MAAV,KAAoB;AAC7C,UAAM,IAAI,GAAG,0BAAW,SAAX,CAAb;AACA,IAAA,IAAI,CACD,EADH,CACM,OADN,EACe,MADf,EAEG,WAFH,CAEe,QAFf;AAIA,8BAAiB,IAAjB,EACG,EADH,CACM,OADN,EACe,MADf,EAEG,EAFH,CAEM,KAFN,EAEa,MAAK;AACd,MAAA,IAAI,CAAC,GAAL;AACA,MAAA,OAAO,CAAC,IAAI,CAAC,IAAL,EAAD,CAAP;AACD,KALH,EAMG,IANH,CAMQ,IANR,EAMc;AAAC,MAAA,GAAG,EAAE;AAAN,KANd;AAOD,GAbM,CAAP;AAcD,C","sourcesContent":["import BluebirdPromise from \"bluebird-lst\"\nimport { createHash } from \"crypto\"\nimport { createReadStream } from \"fs\"\nimport { readdir } from \"fs-extra\"\nimport * as path from \"path\"\n\nexport interface AsarIntegrityOptions {\n /**\n * Allows external asar files.\n *\n * @default false\n */\n readonly externalAllowed?: boolean\n}\n\nexport interface AsarIntegrity extends AsarIntegrityOptions {\n checksums: { [key: string]: string; }\n}\n\nexport async function computeData(resourcesPath: string, options?: AsarIntegrityOptions | null): Promise<AsarIntegrity> {\n // sort to produce constant result\n const names = (await readdir(resourcesPath)).filter(it => it.endsWith(\".asar\")).sort()\n const checksums = await BluebirdPromise.map(names, it => hashFile(path.join(resourcesPath, it)))\n\n const result: { [key: string]: string; } = {}\n for (let i = 0; i < names.length; i++) {\n result[names[i]] = checksums[i]\n }\n return {checksums: result, ...options}\n}\n\nfunction hashFile(file: string, algorithm: string = \"sha512\", encoding: \"hex\" | \"base64\" | \"latin1\" = \"base64\") {\n return new Promise<string>((resolve, reject) => {\n const hash = createHash(algorithm)\n hash\n .on(\"error\", reject)\n .setEncoding(encoding)\n\n createReadStream(file)\n .on(\"error\", reject)\n .on(\"end\", () => {\n hash.end()\n resolve(hash.read() as string)\n })\n .pipe(hash, {end: false})\n })\n}"],"sourceRoot":""}

View File

@@ -0,0 +1 @@
export declare function isLibOrExe(file: string): boolean;

View File

@@ -0,0 +1,204 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.isLibOrExe = isLibOrExe;
exports.detectUnpackedDirs = detectUnpackedDirs;
function _bluebirdLst() {
const data = _interopRequireDefault(require("bluebird-lst"));
_bluebirdLst = function () {
return data;
};
return data;
}
function _builderUtil() {
const data = require("builder-util");
_builderUtil = function () {
return data;
};
return data;
}
function _fs() {
const data = require("builder-util/out/fs");
_fs = function () {
return data;
};
return data;
}
function _fsExtra() {
const data = require("fs-extra");
_fsExtra = function () {
return data;
};
return data;
}
function _isbinaryfile() {
const data = require("isbinaryfile");
_isbinaryfile = function () {
return data;
};
return data;
}
var path = _interopRequireWildcard(require("path"));
function _fileTransformer() {
const data = require("../fileTransformer");
_fileTransformer = function () {
return data;
};
return data;
}
function _appFileCopier() {
const data = require("../util/appFileCopier");
_appFileCopier = function () {
return data;
};
return data;
}
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function addValue(map, key, value) {
let list = map.get(key);
if (list == null) {
list = [value];
map.set(key, list);
} else {
list.push(value);
}
}
function isLibOrExe(file) {
return file.endsWith(".dll") || file.endsWith(".exe") || file.endsWith(".dylib") || file.endsWith(".so");
}
/** @internal */
async function detectUnpackedDirs(fileSet, autoUnpackDirs, unpackedDest, rootForAppFilesWithoutAsar) {
const dirToCreate = new Map();
const metadata = fileSet.metadata;
function addParents(child, root) {
child = path.dirname(child);
if (autoUnpackDirs.has(child)) {
return;
}
do {
autoUnpackDirs.add(child);
const p = path.dirname(child); // create parent dir to be able to copy file later without directory existence check
addValue(dirToCreate, p, path.basename(child));
if (child === root || p === root || autoUnpackDirs.has(p)) {
break;
}
child = p;
} while (true);
autoUnpackDirs.add(root);
}
for (let i = 0, n = fileSet.files.length; i < n; i++) {
const file = fileSet.files[i];
const index = file.lastIndexOf(_fileTransformer().NODE_MODULES_PATTERN);
if (index < 0) {
continue;
}
let nextSlashIndex = file.indexOf(path.sep, index + _fileTransformer().NODE_MODULES_PATTERN.length + 1);
if (nextSlashIndex < 0) {
continue;
}
if (file[index + _fileTransformer().NODE_MODULES_PATTERN.length] === "@") {
nextSlashIndex = file.indexOf(path.sep, nextSlashIndex + 1);
}
if (!metadata.get(file).isFile()) {
continue;
}
const packageDir = file.substring(0, nextSlashIndex);
const packageDirPathInArchive = path.relative(rootForAppFilesWithoutAsar, (0, _appFileCopier().getDestinationPath)(packageDir, fileSet));
const pathInArchive = path.relative(rootForAppFilesWithoutAsar, (0, _appFileCopier().getDestinationPath)(file, fileSet));
if (autoUnpackDirs.has(packageDirPathInArchive)) {
// if package dir is unpacked, any file also unpacked
addParents(pathInArchive, packageDirPathInArchive);
continue;
} // https://github.com/electron-userland/electron-builder/issues/2679
let shouldUnpack = false; // ffprobe-static and ffmpeg-static are known packages to always unpack
const moduleName = path.basename(packageDir);
if (moduleName === "ffprobe-static" || moduleName === "ffmpeg-static" || isLibOrExe(file)) {
shouldUnpack = true;
} else if (!file.includes(".", nextSlashIndex) && path.extname(file) === "") {
shouldUnpack = await (0, _isbinaryfile().isBinaryFile)(file);
}
if (!shouldUnpack) {
continue;
}
if (_builderUtil().log.isDebugEnabled) {
_builderUtil().log.debug({
file: pathInArchive,
reason: "contains executable code"
}, "not packed into asar archive");
}
addParents(pathInArchive, packageDirPathInArchive);
}
if (dirToCreate.size > 0) {
await (0, _fsExtra().ensureDir)(unpackedDest + path.sep + "node_modules"); // child directories should be not created asynchronously - parent directories should be created first
await _bluebirdLst().default.map(dirToCreate.keys(), async parentDir => {
const base = unpackedDest + path.sep + parentDir;
await (0, _fsExtra().ensureDir)(base);
await _bluebirdLst().default.each(dirToCreate.get(parentDir), it => {
if (dirToCreate.has(parentDir + path.sep + it)) {
// already created
return null;
} else {
return (0, _fsExtra().ensureDir)(base + path.sep + it);
}
});
}, _fs().CONCURRENCY);
}
}
// __ts-babel@6.0.4
//# sourceMappingURL=unpackDetector.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,3 @@
export declare function download(url: string, output: string, checksum?: string | null): Promise<void>;
export declare function getBinFromUrl(name: string, version: string, checksum: string): Promise<string>;
export declare function getBin(name: string, url?: string | null, checksum?: string | null): Promise<string>;

74
app/node_modules/app-builder-lib/out/binDownload.js generated vendored Normal file
View File

@@ -0,0 +1,74 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.download = download;
exports.getBinFromUrl = getBinFromUrl;
exports.getBin = getBin;
function _builderUtil() {
const data = require("builder-util");
_builderUtil = function () {
return data;
};
return data;
}
const versionToPromise = new Map();
function download(url, output, checksum) {
const args = ["download", "--url", url, "--output", output];
if (checksum != null) {
args.push("--sha512", checksum);
}
return (0, _builderUtil().executeAppBuilder)(args);
}
function getBinFromUrl(name, version, checksum) {
const dirName = `${name}-${version}`;
let url;
if (process.env.ELECTRON_BUILDER_BINARIES_DOWNLOAD_OVERRIDE_URL) {
url = process.env.ELECTRON_BUILDER_BINARIES_DOWNLOAD_OVERRIDE_URL + "/" + dirName + ".7z";
} else {
const baseUrl = process.env.NPM_CONFIG_ELECTRON_BUILDER_BINARIES_MIRROR || process.env.npm_config_electron_builder_binaries_mirror || process.env.npm_package_config_electron_builder_binaries_mirror || process.env.ELECTRON_BUILDER_BINARIES_MIRROR || "https://github.com/electron-userland/electron-builder-binaries/releases/download/";
const middleUrl = process.env.NPM_CONFIG_ELECTRON_BUILDER_BINARIES_CUSTOM_DIR || process.env.npm_config_electron_builder_binaries_custom_dir || process.env.npm_package_config_electron_builder_binaries_custom_dir || process.env.ELECTRON_BUILDER_BINARIES_CUSTOM_DIR || dirName;
const urlSuffix = dirName + ".7z";
url = `${baseUrl}${middleUrl}/${urlSuffix}`;
}
return getBin(dirName, url, checksum);
}
function getBin(name, url, checksum) {
let promise = versionToPromise.get(name); // if rejected, we will try to download again
if (promise != null) {
return promise;
}
promise = doGetBin(name, url, checksum);
versionToPromise.set(name, promise);
return promise;
}
function doGetBin(name, url, checksum) {
const args = ["download-artifact", "--name", name];
if (url != null) {
args.push("--url", url);
}
if (checksum != null) {
args.push("--sha512", checksum);
}
return (0, _builderUtil().executeAppBuilder)(args);
}
// __ts-babel@6.0.4
//# sourceMappingURL=binDownload.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../src/binDownload.ts"],"names":[],"mappings":";;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA,MAAM,gBAAgB,GAAG,IAAI,GAAJ,EAAzB;;AAEM,SAAU,QAAV,CAAmB,GAAnB,EAAgC,MAAhC,EAAgD,QAAhD,EAAwE;AAC5E,QAAM,IAAI,GAAG,CAAC,UAAD,EAAa,OAAb,EAAsB,GAAtB,EAA2B,UAA3B,EAAuC,MAAvC,CAAb;;AACA,MAAI,QAAQ,IAAI,IAAhB,EAAsB;AACpB,IAAA,IAAI,CAAC,IAAL,CAAU,UAAV,EAAsB,QAAtB;AACD;;AACD,SAAO,sCAAkB,IAAlB,CAAP;AACD;;AAEK,SAAU,aAAV,CAAwB,IAAxB,EAAsC,OAAtC,EAAuD,QAAvD,EAAuE;AAC3E,QAAM,OAAO,GAAG,GAAG,IAAI,IAAI,OAAO,EAAlC;AACA,MAAI,GAAJ;;AACA,MAAI,OAAO,CAAC,GAAR,CAAY,+CAAhB,EAAiE;AAC/D,IAAA,GAAG,GAAG,OAAO,CAAC,GAAR,CAAY,+CAAZ,GAA8D,GAA9D,GAAoE,OAApE,GAA8E,KAApF;AACD,GAFD,MAGK;AAEH,UAAM,OAAO,GAAG,OAAO,CAAC,GAAR,CAAY,2CAAZ,IACd,OAAO,CAAC,GAAR,CAAY,2CADE,IAEd,OAAO,CAAC,GAAR,CAAY,mDAFE,IAGd,OAAO,CAAC,GAAR,CAAY,gCAHE,IAId,mFAJF;AAKA,UAAM,SAAS,GAAG,OAAO,CAAC,GAAR,CAAY,+CAAZ,IAChB,OAAO,CAAC,GAAR,CAAY,+CADI,IAEhB,OAAO,CAAC,GAAR,CAAY,uDAFI,IAGhB,OAAO,CAAC,GAAR,CAAY,oCAHI,IAIhB,OAJF;AAKA,UAAM,SAAS,GAAG,OAAO,GAAG,KAA5B;AACA,IAAA,GAAG,GAAG,GAAG,OAAO,GAAG,SAAS,IAAI,SAAS,EAAzC;AACD;;AAED,SAAO,MAAM,CAAC,OAAD,EAAU,GAAV,EAAe,QAAf,CAAb;AACD;;AAEK,SAAU,MAAV,CAAiB,IAAjB,EAA+B,GAA/B,EAAoD,QAApD,EAA4E;AAChF,MAAI,OAAO,GAAG,gBAAgB,CAAC,GAAjB,CAAqB,IAArB,CAAd,CADgF,CAEhF;;AACA,MAAI,OAAO,IAAI,IAAf,EAAqB;AACnB,WAAO,OAAP;AACD;;AAED,EAAA,OAAO,GAAG,QAAQ,CAAC,IAAD,EAAO,GAAP,EAAY,QAAZ,CAAlB;AACA,EAAA,gBAAgB,CAAC,GAAjB,CAAqB,IAArB,EAA2B,OAA3B;AACA,SAAO,OAAP;AACD;;AAED,SAAS,QAAT,CAAkB,IAAlB,EAAgC,GAAhC,EAAgE,QAAhE,EAAmG;AACjG,QAAM,IAAI,GAAG,CAAC,mBAAD,EAAsB,QAAtB,EAAgC,IAAhC,CAAb;;AACA,MAAI,GAAG,IAAI,IAAX,EAAiB;AACf,IAAA,IAAI,CAAC,IAAL,CAAU,OAAV,EAAmB,GAAnB;AACD;;AACD,MAAI,QAAQ,IAAI,IAAhB,EAAsB;AACpB,IAAA,IAAI,CAAC,IAAL,CAAU,UAAV,EAAsB,QAAtB;AACD;;AACD,SAAO,sCAAkB,IAAlB,CAAP;AACD,C","sourcesContent":["import { executeAppBuilder } from \"builder-util\"\n\nconst versionToPromise = new Map<string, Promise<string>>()\n\nexport function download(url: string, output: string, checksum?: string | null): Promise<void> {\n const args = [\"download\", \"--url\", url, \"--output\", output]\n if (checksum != null) {\n args.push(\"--sha512\", checksum)\n }\n return executeAppBuilder(args) as Promise<any>\n}\n\nexport function getBinFromUrl(name: string, version: string, checksum: string): Promise<string> {\n const dirName = `${name}-${version}`\n let url: string\n if (process.env.ELECTRON_BUILDER_BINARIES_DOWNLOAD_OVERRIDE_URL) {\n url = process.env.ELECTRON_BUILDER_BINARIES_DOWNLOAD_OVERRIDE_URL + \"/\" + dirName + \".7z\"\n }\n else {\n\n const baseUrl = process.env.NPM_CONFIG_ELECTRON_BUILDER_BINARIES_MIRROR ||\n process.env.npm_config_electron_builder_binaries_mirror ||\n process.env.npm_package_config_electron_builder_binaries_mirror ||\n process.env.ELECTRON_BUILDER_BINARIES_MIRROR ||\n \"https://github.com/electron-userland/electron-builder-binaries/releases/download/\"\n const middleUrl = process.env.NPM_CONFIG_ELECTRON_BUILDER_BINARIES_CUSTOM_DIR ||\n process.env.npm_config_electron_builder_binaries_custom_dir ||\n process.env.npm_package_config_electron_builder_binaries_custom_dir ||\n process.env.ELECTRON_BUILDER_BINARIES_CUSTOM_DIR ||\n dirName\n const urlSuffix = dirName + \".7z\"\n url = `${baseUrl}${middleUrl}/${urlSuffix}`\n }\n\n return getBin(dirName, url, checksum)\n}\n\nexport function getBin(name: string, url?: string | null, checksum?: string | null): Promise<string> {\n let promise = versionToPromise.get(name)\n // if rejected, we will try to download again\n if (promise != null) {\n return promise\n }\n\n promise = doGetBin(name, url, checksum)\n versionToPromise.set(name, promise)\n return promise\n}\n\nfunction doGetBin(name: string, url: string | undefined | null, checksum: string | null | undefined): Promise<string> {\n const args = [\"download-artifact\", \"--name\", name]\n if (url != null) {\n args.push(\"--url\", url)\n }\n if (checksum != null) {\n args.push(\"--sha512\", checksum)\n }\n return executeAppBuilder(args)\n}"],"sourceRoot":""}

View File

@@ -0,0 +1,3 @@
import { TmpDir } from "temp-file";
/** @private */
export declare function downloadCertificate(urlOrBase64: string, tmpDir: TmpDir, currentDir: string): Promise<string>;

View File

@@ -0,0 +1,105 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.downloadCertificate = downloadCertificate;
function _fsExtra() {
const data = require("fs-extra");
_fsExtra = function () {
return data;
};
return data;
}
function _os() {
const data = require("os");
_os = function () {
return data;
};
return data;
}
var path = _interopRequireWildcard(require("path"));
function _builderUtil() {
const data = require("builder-util");
_builderUtil = function () {
return data;
};
return data;
}
function _fs() {
const data = require("builder-util/out/fs");
_fs = function () {
return data;
};
return data;
}
function _binDownload() {
const data = require("../binDownload");
_binDownload = function () {
return data;
};
return data;
}
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
/** @private */
async function downloadCertificate(urlOrBase64, tmpDir, currentDir) {
urlOrBase64 = urlOrBase64.trim();
let file = null;
if (urlOrBase64.length > 3 && urlOrBase64[1] === ":" || urlOrBase64.startsWith("/") || urlOrBase64.startsWith(".")) {
file = urlOrBase64;
} else if (urlOrBase64.startsWith("file://")) {
file = urlOrBase64.substring("file://".length);
} else if (urlOrBase64.startsWith("~/")) {
file = path.join((0, _os().homedir)(), urlOrBase64.substring("~/".length));
} else {
const isUrl = urlOrBase64.startsWith("https://");
if (isUrl || urlOrBase64.length > 2048 || urlOrBase64.endsWith("=")) {
const tempFile = await tmpDir.getTempFile({
suffix: ".p12"
});
if (isUrl) {
await (0, _binDownload().download)(urlOrBase64, tempFile);
} else {
await (0, _fsExtra().outputFile)(tempFile, Buffer.from(urlOrBase64, "base64"));
}
return tempFile;
} else {
file = urlOrBase64;
}
}
file = path.resolve(currentDir, file);
const stat = await (0, _fs().statOrNull)(file);
if (stat == null) {
throw new (_builderUtil().InvalidConfigurationError)(`${file} doesn't exist`);
} else if (!stat.isFile()) {
throw new (_builderUtil().InvalidConfigurationError)(`${file} not a file`);
} else {
return file;
}
}
// __ts-babel@6.0.4
//# sourceMappingURL=codesign.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../src/codeSign/codesign.ts"],"names":[],"mappings":";;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;AAEA;AACO,eAAe,mBAAf,CAAmC,WAAnC,EAAwD,MAAxD,EAAwE,UAAxE,EAA0F;AAC/F,EAAA,WAAW,GAAG,WAAW,CAAC,IAAZ,EAAd;AAEA,MAAI,IAAI,GAAkB,IAA1B;;AACA,MAAK,WAAW,CAAC,MAAZ,GAAqB,CAArB,IAA0B,WAAW,CAAC,CAAD,CAAX,KAAmB,GAA9C,IAAsD,WAAW,CAAC,UAAZ,CAAuB,GAAvB,CAAtD,IAAqF,WAAW,CAAC,UAAZ,CAAuB,GAAvB,CAAzF,EAAsH;AACpH,IAAA,IAAI,GAAG,WAAP;AACD,GAFD,MAGK,IAAI,WAAW,CAAC,UAAZ,CAAuB,SAAvB,CAAJ,EAAuC;AAC1C,IAAA,IAAI,GAAG,WAAW,CAAC,SAAZ,CAAsB,UAAU,MAAhC,CAAP;AACD,GAFI,MAGA,IAAI,WAAW,CAAC,UAAZ,CAAuB,IAAvB,CAAJ,EAAkC;AACrC,IAAA,IAAI,GAAG,IAAI,CAAC,IAAL,CAAU,oBAAV,EAAqB,WAAW,CAAC,SAAZ,CAAsB,KAAK,MAA3B,CAArB,CAAP;AACD,GAFI,MAGA;AACH,UAAM,KAAK,GAAG,WAAW,CAAC,UAAZ,CAAuB,UAAvB,CAAd;;AACA,QAAI,KAAK,IAAI,WAAW,CAAC,MAAZ,GAAqB,IAA9B,IAAsC,WAAW,CAAC,QAAZ,CAAqB,GAArB,CAA1C,EAAqE;AACnE,YAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,WAAP,CAAmB;AAAC,QAAA,MAAM,EAAE;AAAT,OAAnB,CAAvB;;AACA,UAAI,KAAJ,EAAW;AACT,cAAM,6BAAS,WAAT,EAAsB,QAAtB,CAAN;AACD,OAFD,MAGK;AACH,cAAM,2BAAW,QAAX,EAAqB,MAAM,CAAC,IAAP,CAAY,WAAZ,EAAyB,QAAzB,CAArB,CAAN;AACD;;AACD,aAAO,QAAP;AACD,KATD,MAUK;AACH,MAAA,IAAI,GAAG,WAAP;AACD;AACF;;AAED,EAAA,IAAI,GAAG,IAAI,CAAC,OAAL,CAAa,UAAb,EAAyB,IAAzB,CAAP;AACA,QAAM,IAAI,GAAG,MAAM,sBAAW,IAAX,CAAnB;;AACA,MAAI,IAAI,IAAI,IAAZ,EAAkB;AAChB,UAAM,KAAI,wCAAJ,EAA8B,GAAG,IAAI,gBAArC,CAAN;AACD,GAFD,MAGK,IAAI,CAAC,IAAI,CAAC,MAAL,EAAL,EAAoB;AACvB,UAAM,KAAI,wCAAJ,EAA8B,GAAG,IAAI,aAArC,CAAN;AACD,GAFI,MAGA;AACH,WAAO,IAAP;AACD;AACF,C","sourcesContent":["import { outputFile } from \"fs-extra\"\nimport { homedir } from \"os\"\nimport * as path from \"path\"\nimport { TmpDir } from \"temp-file\"\nimport { InvalidConfigurationError } from \"builder-util\"\nimport { statOrNull } from \"builder-util/out/fs\"\nimport { download } from \"../binDownload\"\n\n/** @private */\nexport async function downloadCertificate(urlOrBase64: string, tmpDir: TmpDir, currentDir: string): Promise<string> {\n urlOrBase64 = urlOrBase64.trim()\n\n let file: string | null = null\n if ((urlOrBase64.length > 3 && urlOrBase64[1] === \":\") || urlOrBase64.startsWith(\"/\") || urlOrBase64.startsWith(\".\")) {\n file = urlOrBase64\n }\n else if (urlOrBase64.startsWith(\"file://\")) {\n file = urlOrBase64.substring(\"file://\".length)\n }\n else if (urlOrBase64.startsWith(\"~/\")) {\n file = path.join(homedir(), urlOrBase64.substring(\"~/\".length))\n }\n else {\n const isUrl = urlOrBase64.startsWith(\"https://\")\n if (isUrl || urlOrBase64.length > 2048 || urlOrBase64.endsWith(\"=\")) {\n const tempFile = await tmpDir.getTempFile({suffix: \".p12\"})\n if (isUrl) {\n await download(urlOrBase64, tempFile)\n }\n else {\n await outputFile(tempFile, Buffer.from(urlOrBase64, \"base64\"))\n }\n return tempFile\n }\n else {\n file = urlOrBase64\n }\n }\n\n file = path.resolve(currentDir, file)\n const stat = await statOrNull(file)\n if (stat == null) {\n throw new InvalidConfigurationError(`${file} doesn't exist`)\n }\n else if (!stat.isFile()) {\n throw new InvalidConfigurationError(`${file} not a file`)\n }\n else {\n return file\n }\n}"],"sourceRoot":""}

View File

@@ -0,0 +1,27 @@
import { TmpDir } from "builder-util/out/util";
export declare const appleCertificatePrefixes: string[];
export declare type CertType = "Developer ID Application" | "Developer ID Installer" | "3rd Party Mac Developer Application" | "3rd Party Mac Developer Installer" | "Mac Developer";
export interface CodeSigningInfo {
keychainFile?: string | null;
}
export declare function isSignAllowed(isPrintWarn?: boolean): boolean;
export declare function reportError(isMas: boolean, certificateType: CertType, qualifier: string | null | undefined, keychainFile: string | null | undefined, isForceCodeSigning: boolean): Promise<void>;
export interface CreateKeychainOptions {
tmpDir: TmpDir;
cscLink: string;
cscKeyPassword: string;
cscILink?: string | null;
cscIKeyPassword?: string | null;
currentDir: string;
}
export declare function removeKeychain(keychainFile: string, printWarn?: boolean): Promise<any>;
export declare function createKeychain({ tmpDir, cscLink, cscKeyPassword, cscILink, cscIKeyPassword, currentDir }: CreateKeychainOptions): Promise<CodeSigningInfo>;
/** @private */
export declare function sign(path: string, name: string, keychain: string): Promise<any>;
export declare let findIdentityRawResult: Promise<Array<string>> | null;
export declare class Identity {
readonly name: string;
readonly hash: string;
constructor(name: string, hash: string);
}
export declare function findIdentity(certType: CertType, qualifier?: string | null, keychain?: string | null): Promise<Identity | null>;

View File

@@ -0,0 +1,424 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.isSignAllowed = isSignAllowed;
exports.reportError = reportError;
exports.removeKeychain = removeKeychain;
exports.createKeychain = createKeychain;
exports.sign = sign;
exports.findIdentity = findIdentity;
exports.findIdentityRawResult = exports.appleCertificatePrefixes = void 0;
function _bluebirdLst() {
const data = _interopRequireDefault(require("bluebird-lst"));
_bluebirdLst = function () {
return data;
};
return data;
}
function _util() {
const data = require("builder-util/out/util");
_util = function () {
return data;
};
return data;
}
function _fs() {
const data = require("builder-util/out/fs");
_fs = function () {
return data;
};
return data;
}
function _log() {
const data = require("builder-util/out/log");
_log = function () {
return data;
};
return data;
}
function _crypto() {
const data = require("crypto");
_crypto = function () {
return data;
};
return data;
}
function _fsExtra() {
const data = require("fs-extra");
_fsExtra = function () {
return data;
};
return data;
}
function _lazyVal() {
const data = require("lazy-val");
_lazyVal = function () {
return data;
};
return data;
}
function _os() {
const data = require("os");
_os = function () {
return data;
};
return data;
}
var path = _interopRequireWildcard(require("path"));
function _tempFile() {
const data = require("temp-file");
_tempFile = function () {
return data;
};
return data;
}
function _flags() {
const data = require("../util/flags");
_flags = function () {
return data;
};
return data;
}
function _codesign() {
const data = require("./codesign");
_codesign = function () {
return data;
};
return data;
}
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const appleCertificatePrefixes = ["Developer ID Application:", "Developer ID Installer:", "3rd Party Mac Developer Application:", "3rd Party Mac Developer Installer:"];
exports.appleCertificatePrefixes = appleCertificatePrefixes;
function isSignAllowed(isPrintWarn = true) {
if (process.platform !== "darwin") {
if (isPrintWarn) {
_util().log.warn({
reason: "supported only on macOS"
}, "skipped macOS application code signing");
}
return false;
}
const buildForPrWarning = "There are serious security concerns with CSC_FOR_PULL_REQUEST=true (see the CircleCI documentation (https://circleci.com/docs/1.0/fork-pr-builds/) for details)" + "\nIf you have SSH keys, sensitive env vars or AWS credentials stored in your project settings and untrusted forks can make pull requests against your repo, then this option isn't for you.";
if ((0, _util().isPullRequest)()) {
if ((0, _util().isEnvTrue)(process.env.CSC_FOR_PULL_REQUEST)) {
if (isPrintWarn) {
_util().log.warn(buildForPrWarning);
}
} else {
if (isPrintWarn) {
// https://github.com/electron-userland/electron-builder/issues/1524
_util().log.warn("Current build is a part of pull request, code signing will be skipped." + "\nSet env CSC_FOR_PULL_REQUEST to true to force code signing." + `\n${buildForPrWarning}`);
}
return false;
}
}
return true;
}
async function reportError(isMas, certificateType, qualifier, keychainFile, isForceCodeSigning) {
const logFields = {};
if (qualifier == null) {
logFields.reason = "";
if ((0, _flags().isAutoDiscoveryCodeSignIdentity)()) {
logFields.reason += `cannot find valid "${certificateType}" identity${isMas ? "" : ` or custom non-Apple code signing certificate`}`;
}
logFields.reason += ", see https://electron.build/code-signing";
if (!(0, _flags().isAutoDiscoveryCodeSignIdentity)()) {
logFields.CSC_IDENTITY_AUTO_DISCOVERY = false;
}
} else {
logFields.reason = "Identity name is specified, but no valid identity with this name in the keychain";
logFields.identity = qualifier;
}
const args = ["find-identity"];
if (keychainFile != null) {
args.push(keychainFile);
}
if (qualifier != null || (0, _flags().isAutoDiscoveryCodeSignIdentity)()) {
logFields.allIdentities = (await (0, _util().exec)("security", args)).trim().split("\n").filter(it => !(it.includes("Policy: X.509 Basic") || it.includes("Matching identities"))).join("\n");
}
if (isMas || isForceCodeSigning) {
throw new Error(_log().Logger.createMessage("skipped macOS application code signing", logFields, "error", it => it));
} else {
_util().log.warn(logFields, "skipped macOS application code signing");
}
} // "Note that filename will not be searched to resolve the signing identity's certificate chain unless it is also on the user's keychain search list."
// but "security list-keychains" doesn't support add - we should 1) get current list 2) set new list - it is very bad http://stackoverflow.com/questions/10538942/add-a-keychain-to-search-list
// "overly complicated and introduces a race condition."
// https://github.com/electron-userland/electron-builder/issues/398
const bundledCertKeychainAdded = new (_lazyVal().Lazy)(async () => {
// copy to temp and then atomic rename to final path
const cacheDir = getCacheDirectory();
const tmpKeychainPath = path.join(cacheDir, (0, _tempFile().getTempName)("electron-builder-root-certs"));
const keychainPath = path.join(cacheDir, "electron-builder-root-certs.keychain");
const results = await Promise.all([listUserKeychains(), (0, _fs().copyFile)(path.join(__dirname, "..", "..", "certs", "root_certs.keychain"), tmpKeychainPath).then(() => (0, _fsExtra().rename)(tmpKeychainPath, keychainPath))]);
const list = results[0];
if (!list.includes(keychainPath)) {
await (0, _util().exec)("security", ["list-keychains", "-d", "user", "-s", keychainPath].concat(list));
}
});
function getCacheDirectory() {
const env = process.env.ELECTRON_BUILDER_CACHE;
return (0, _util().isEmptyOrSpaces)(env) ? path.join((0, _os().homedir)(), "Library", "Caches", "electron-builder") : path.resolve(env);
}
function listUserKeychains() {
return (0, _util().exec)("security", ["list-keychains", "-d", "user"]).then(it => it.split("\n").map(it => {
const r = it.trim();
return r.substring(1, r.length - 1);
}).filter(it => it.length > 0));
}
function removeKeychain(keychainFile, printWarn = true) {
return (0, _util().exec)("security", ["delete-keychain", keychainFile]).catch(e => {
if (printWarn) {
_util().log.warn({
file: keychainFile,
error: e.stack || e
}, "cannot delete keychain");
}
return (0, _fs().unlinkIfExists)(keychainFile);
});
}
async function createKeychain({
tmpDir,
cscLink,
cscKeyPassword,
cscILink,
cscIKeyPassword,
currentDir
}) {
// travis has correct AppleWWDRCA cert
if (process.env.TRAVIS !== "true") {
await bundledCertKeychainAdded.value;
} // https://github.com/electron-userland/electron-builder/issues/3685
// use constant file
const keychainFile = path.join(process.env.APP_BUILDER_TMP_DIR || (0, _os().tmpdir)(), `${(0, _crypto().createHash)("sha256").update(currentDir).update("app-builder").digest("hex")}.keychain`); // noinspection JSUnusedLocalSymbols
await removeKeychain(keychainFile, false).catch(_ => {});
const certLinks = [cscLink];
if (cscILink != null) {
certLinks.push(cscILink);
}
const certPaths = new Array(certLinks.length);
const keychainPassword = (0, _crypto().randomBytes)(32).toString("base64");
const securityCommands = [["create-keychain", "-p", keychainPassword, keychainFile], ["unlock-keychain", "-p", keychainPassword, keychainFile], ["set-keychain-settings", keychainFile]]; // https://stackoverflow.com/questions/42484678/codesign-keychain-gets-ignored
// https://github.com/electron-userland/electron-builder/issues/1457
const list = await listUserKeychains();
if (!list.includes(keychainFile)) {
securityCommands.push(["list-keychains", "-d", "user", "-s", keychainFile].concat(list));
}
await Promise.all([// we do not clear downloaded files - will be removed on tmpDir cleanup automatically. not a security issue since in any case data is available as env variables and protected by password.
_bluebirdLst().default.map(certLinks, (link, i) => (0, _codesign().downloadCertificate)(link, tmpDir, currentDir).then(it => certPaths[i] = it)), _bluebirdLst().default.mapSeries(securityCommands, it => (0, _util().exec)("security", it))]);
return await importCerts(keychainFile, certPaths, [cscKeyPassword, cscIKeyPassword].filter(it => it != null));
}
async function importCerts(keychainFile, paths, keyPasswords) {
for (let i = 0; i < paths.length; i++) {
const password = keyPasswords[i];
await (0, _util().exec)("security", ["import", paths[i], "-k", keychainFile, "-T", "/usr/bin/codesign", "-T", "/usr/bin/productbuild", "-P", password]); // https://stackoverflow.com/questions/39868578/security-codesign-in-sierra-keychain-ignores-access-control-settings-and-ui-p
// https://github.com/electron-userland/electron-packager/issues/701#issuecomment-322315996
await (0, _util().exec)("security", ["set-key-partition-list", "-S", "apple-tool:,apple:", "-s", "-k", password, keychainFile]);
}
return {
keychainFile
};
}
/** @private */
function sign(path, name, keychain) {
const args = ["--deep", "--force", "--sign", name, path];
if (keychain != null) {
args.push("--keychain", keychain);
}
return (0, _util().exec)("codesign", args);
}
let findIdentityRawResult = null;
exports.findIdentityRawResult = findIdentityRawResult;
async function getValidIdentities(keychain) {
function addKeychain(args) {
if (keychain != null) {
args.push(keychain);
}
return args;
}
let result = findIdentityRawResult;
if (result == null || keychain != null) {
// https://github.com/electron-userland/electron-builder/issues/481
// https://github.com/electron-userland/electron-builder/issues/535
result = Promise.all([(0, _util().exec)("security", addKeychain(["find-identity", "-v"])).then(it => it.trim().split("\n").filter(it => {
for (const prefix of appleCertificatePrefixes) {
if (it.includes(prefix)) {
return true;
}
}
return false;
})), (0, _util().exec)("security", addKeychain(["find-identity", "-v", "-p", "codesigning"])).then(it => it.trim().split("\n"))]).then(it => {
const array = it[0].concat(it[1]).filter(it => !it.includes("(Missing required extension)") && !it.includes("valid identities found") && !it.includes("iPhone ") && !it.includes("com.apple.idms.appleid.prd.")) // remove 1)
.map(it => it.substring(it.indexOf(")") + 1).trim());
return Array.from(new Set(array));
});
if (keychain == null) {
exports.findIdentityRawResult = findIdentityRawResult = result;
}
}
return result;
}
async function _findIdentity(type, qualifier, keychain) {
// https://github.com/electron-userland/electron-builder/issues/484
//noinspection SpellCheckingInspection
const lines = await getValidIdentities(keychain);
const namePrefix = `${type}:`;
for (const line of lines) {
if (qualifier != null && !line.includes(qualifier)) {
continue;
}
if (line.includes(namePrefix)) {
return parseIdentity(line);
}
}
if (type === "Developer ID Application") {
// find non-Apple certificate
// https://github.com/electron-userland/electron-builder/issues/458
l: for (const line of lines) {
if (qualifier != null && !line.includes(qualifier)) {
continue;
}
if (line.includes("Mac Developer:")) {
continue;
}
for (const prefix of appleCertificatePrefixes) {
if (line.includes(prefix)) {
continue l;
}
}
return parseIdentity(line);
}
}
return null;
}
const _Identity = require("../../electron-osx-sign/util-identities").Identity;
function parseIdentity(line) {
const firstQuoteIndex = line.indexOf('"');
const name = line.substring(firstQuoteIndex + 1, line.lastIndexOf('"'));
const hash = line.substring(0, firstQuoteIndex - 1);
return new _Identity(name, hash);
}
function findIdentity(certType, qualifier, keychain) {
let identity = qualifier || process.env.CSC_NAME;
if ((0, _util().isEmptyOrSpaces)(identity)) {
if ((0, _flags().isAutoDiscoveryCodeSignIdentity)()) {
return _findIdentity(certType, null, keychain);
} else {
return Promise.resolve(null);
}
} else {
identity = identity.trim();
for (const prefix of appleCertificatePrefixes) {
checkPrefix(identity, prefix);
}
return _findIdentity(certType, identity, keychain);
}
}
function checkPrefix(name, prefix) {
if (name.startsWith(prefix)) {
throw new (_util().InvalidConfigurationError)(`Please remove prefix "${prefix}" from the specified name — appropriate certificate will be chosen automatically`);
}
}
// __ts-babel@6.0.4
//# sourceMappingURL=macCodeSign.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,37 @@
import { WindowsConfiguration } from "..";
import { VmManager } from "../vm/vm";
import { WinPackager } from "../winPackager";
export declare function getSignVendorPath(): Promise<string>;
export declare type CustomWindowsSign = (configuration: CustomWindowsSignTaskConfiguration) => Promise<any>;
export interface WindowsSignOptions {
readonly path: string;
readonly name?: string | null;
readonly cscInfo?: FileCodeSigningInfo | CertificateFromStoreInfo | null;
readonly site?: string | null;
readonly options: WindowsConfiguration;
}
export interface WindowsSignTaskConfiguration extends WindowsSignOptions {
resultOutputPath?: string;
hash: string;
isNest: boolean;
}
export interface CustomWindowsSignTaskConfiguration extends WindowsSignTaskConfiguration {
computeSignToolArgs(isWin: boolean): Array<string>;
}
export declare function sign(options: WindowsSignOptions, packager: WinPackager): Promise<void>;
export interface FileCodeSigningInfo {
readonly file: string;
readonly password: string | null;
}
export declare function getCertInfo(file: string, password: string): Promise<CertificateInfo>;
export interface CertificateInfo {
readonly commonName: string;
readonly bloodyMicrosoftSubjectDn: string;
}
export interface CertificateFromStoreInfo {
thumbprint: string;
subject: string;
store: string;
isLocalMachineStore: boolean;
}
export declare function getCertificateFromStoreInfo(options: WindowsConfiguration, vm: VmManager): Promise<CertificateFromStoreInfo>;

View File

@@ -0,0 +1,403 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getSignVendorPath = getSignVendorPath;
exports.sign = sign;
exports.getCertInfo = getCertInfo;
exports.getCertificateFromStoreInfo = getCertificateFromStoreInfo;
exports.isOldWin6 = isOldWin6;
function _util() {
const data = require("builder-util/out/util");
_util = function () {
return data;
};
return data;
}
function _binDownload() {
const data = require("../binDownload");
_binDownload = function () {
return data;
};
return data;
}
function _appBuilder() {
const data = require("../util/appBuilder");
_appBuilder = function () {
return data;
};
return data;
}
function _bundledTool() {
const data = require("../util/bundledTool");
_bundledTool = function () {
return data;
};
return data;
}
function _fsExtra() {
const data = require("fs-extra");
_fsExtra = function () {
return data;
};
return data;
}
function os() {
const data = _interopRequireWildcard(require("os"));
os = function () {
return data;
};
return data;
}
var path = _interopRequireWildcard(require("path"));
function _platformPackager() {
const data = require("../platformPackager");
_platformPackager = function () {
return data;
};
return data;
}
function _flags() {
const data = require("../util/flags");
_flags = function () {
return data;
};
return data;
}
function _vm() {
const data = require("../vm/vm");
_vm = function () {
return data;
};
return data;
}
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
function getSignVendorPath() {
return (0, _binDownload().getBin)("winCodeSign");
}
async function sign(options, packager) {
let hashes = options.options.signingHashAlgorithms; // msi does not support dual-signing
if (options.path.endsWith(".msi")) {
hashes = [hashes != null && !hashes.includes("sha1") ? "sha256" : "sha1"];
} else if (options.path.endsWith(".appx")) {
hashes = ["sha256"];
} else if (hashes == null) {
hashes = ["sha1", "sha256"];
} else {
hashes = Array.isArray(hashes) ? hashes : [hashes];
}
function defaultExecutor(configuration) {
return doSign(configuration, packager);
}
const executor = (0, _platformPackager().resolveFunction)(options.options.sign, "sign") || defaultExecutor;
let isNest = false;
for (const hash of hashes) {
const taskConfiguration = Object.assign({}, options, {
hash,
isNest
});
await executor(Object.assign({}, taskConfiguration, {
computeSignToolArgs: isWin => computeSignToolArgs(taskConfiguration, isWin)
}));
isNest = true;
if (taskConfiguration.resultOutputPath != null) {
await (0, _fsExtra().rename)(taskConfiguration.resultOutputPath, options.path);
}
}
}
async function getCertInfo(file, password) {
let result = null;
const errorMessagePrefix = "Cannot extract publisher name from code signing certificate. As workaround, set win.publisherName. Error: ";
try {
result = await (0, _appBuilder().executeAppBuilderAsJson)(["certificate-info", "--input", file, "--password", password]);
} catch (e) {
throw new Error(`${errorMessagePrefix}${e.stack || e}`);
}
if (result.error != null) {
// noinspection ExceptionCaughtLocallyJS
throw new (_util().InvalidConfigurationError)(`${errorMessagePrefix}${result.error}`);
}
return result;
}
async function getCertificateFromStoreInfo(options, vm) {
const certificateSubjectName = options.certificateSubjectName;
const certificateSha1 = options.certificateSha1; // ExcludeProperty doesn't work, so, we cannot exclude RawData, it is ok
// powershell can return object if the only item
const rawResult = await vm.exec("powershell.exe", ["Get-ChildItem -Recurse Cert: -CodeSigningCert | Select-Object -Property Subject,PSParentPath,Thumbprint | ConvertTo-Json -Compress"]);
const certList = rawResult.length === 0 ? [] : (0, _util().asArray)(JSON.parse(rawResult));
for (const certInfo of certList) {
if (certificateSubjectName != null) {
if (!certInfo.Subject.includes(certificateSubjectName)) {
continue;
}
} else if (certInfo.Thumbprint !== certificateSha1) {
continue;
}
const parentPath = certInfo.PSParentPath;
const store = parentPath.substring(parentPath.lastIndexOf("\\") + 1);
_util().log.debug({
store,
PSParentPath: parentPath
}, "auto-detect certificate store"); // https://github.com/electron-userland/electron-builder/issues/1717
const isLocalMachineStore = parentPath.includes("Certificate::LocalMachine");
_util().log.debug(null, "auto-detect using of LocalMachine store");
return {
thumbprint: certInfo.Thumbprint,
subject: certInfo.Subject,
store,
isLocalMachineStore
};
}
throw new Error(`Cannot find certificate ${certificateSubjectName || certificateSha1}, all certs: ${rawResult}`);
}
async function doSign(configuration, packager) {
// https://github.com/electron-userland/electron-builder/pull/1944
const timeout = parseInt(process.env.SIGNTOOL_TIMEOUT, 10) || 10 * 60 * 1000;
let tool;
let args;
let env = process.env;
let vm;
if (configuration.path.endsWith(".appx") || !("file" in configuration.cscInfo)
/* certificateSubjectName and other such options */
) {
vm = await packager.vm.value;
tool = getWinSignTool((await getSignVendorPath()));
args = computeSignToolArgs(configuration, true, vm);
} else {
vm = new (_vm().VmManager)();
const toolInfo = await getToolPath();
tool = toolInfo.path;
args = configuration.computeSignToolArgs(process.platform === "win32");
if (toolInfo.env != null) {
env = toolInfo.env;
}
}
try {
await vm.exec(tool, args, {
timeout,
env
});
} catch (e) {
if (e.message.includes("The file is being used by another process") || e.message.includes("The specified timestamp server either could not be reached")) {
_util().log.warn(`First attempt to code sign failed, another attempt will be made in 2 seconds: ${e.message}`);
await new Promise((resolve, reject) => {
setTimeout(() => {
vm.exec(tool, args, {
timeout,
env
}).then(resolve).catch(reject);
}, 2000);
});
}
throw e;
}
} // on windows be aware of http://stackoverflow.com/a/32640183/1910191
function computeSignToolArgs(options, isWin, vm = new (_vm().VmManager)()) {
const inputFile = vm.toVmFile(options.path);
const outputPath = isWin ? inputFile : getOutputPath(inputFile, options.hash);
if (!isWin) {
options.resultOutputPath = outputPath;
}
const args = isWin ? ["sign"] : ["-in", inputFile, "-out", outputPath];
if (process.env.ELECTRON_BUILDER_OFFLINE !== "true") {
const timestampingServiceUrl = options.options.timeStampServer || "http://timestamp.digicert.com";
if (isWin) {
args.push(options.isNest || options.hash === "sha256" ? "/tr" : "/t", options.isNest || options.hash === "sha256" ? options.options.rfc3161TimeStampServer || "http://timestamp.comodoca.com/rfc3161" : timestampingServiceUrl);
} else {
args.push("-t", timestampingServiceUrl);
}
}
const certificateFile = options.cscInfo.file;
if (certificateFile == null) {
const cscInfo = options.cscInfo;
const subjectName = cscInfo.thumbprint;
if (!isWin) {
throw new Error(`${subjectName == null ? "certificateSha1" : "certificateSubjectName"} supported only on Windows`);
}
args.push("/sha1", cscInfo.thumbprint);
args.push("/s", cscInfo.store);
if (cscInfo.isLocalMachineStore) {
args.push("/sm");
}
} else {
const certExtension = path.extname(certificateFile);
if (certExtension === ".p12" || certExtension === ".pfx") {
args.push(isWin ? "/f" : "-pkcs12", vm.toVmFile(certificateFile));
} else {
throw new Error(`Please specify pkcs12 (.p12/.pfx) file, ${certificateFile} is not correct`);
}
}
if (!isWin || options.hash !== "sha1") {
args.push(isWin ? "/fd" : "-h", options.hash);
if (isWin && process.env.ELECTRON_BUILDER_OFFLINE !== "true") {
args.push("/td", "sha256");
}
}
if (options.name) {
args.push(isWin ? "/d" : "-n", options.name);
}
if (options.site) {
args.push(isWin ? "/du" : "-i", options.site);
} // msi does not support dual-signing
if (options.isNest) {
args.push(isWin ? "/as" : "-nest");
}
const password = options.cscInfo == null ? null : options.cscInfo.password;
if (password) {
args.push(isWin ? "/p" : "-pass", password);
}
if (options.options.additionalCertificateFile) {
args.push(isWin ? "/ac" : "-ac", vm.toVmFile(options.options.additionalCertificateFile));
}
const httpsProxyFromEnv = process.env.HTTPS_PROXY;
if (!isWin && httpsProxyFromEnv != null && httpsProxyFromEnv.length) {
args.push("-p", httpsProxyFromEnv);
}
if (isWin) {
// https://github.com/electron-userland/electron-builder/issues/2875#issuecomment-387233610
args.push("/debug"); // must be last argument
args.push(inputFile);
}
return args;
}
function getOutputPath(inputPath, hash) {
const extension = path.extname(inputPath);
return path.join(path.dirname(inputPath), `${path.basename(inputPath, extension)}-signed-${hash}${extension}`);
}
/** @internal */
function isOldWin6() {
const winVersion = os().release();
return winVersion.startsWith("6.") && !winVersion.startsWith("6.3");
}
function getWinSignTool(vendorPath) {
// use modern signtool on Windows Server 2012 R2 to be able to sign AppX
if (isOldWin6()) {
return path.join(vendorPath, "windows-6", "signtool.exe");
} else {
return path.join(vendorPath, "windows-10", process.arch, "signtool.exe");
}
}
async function getToolPath() {
if ((0, _flags().isUseSystemSigncode)()) {
return {
path: "osslsigncode"
};
}
const result = process.env.SIGNTOOL_PATH;
if (result) {
return {
path: result
};
}
const vendorPath = await getSignVendorPath();
if (process.platform === "win32") {
// use modern signtool on Windows Server 2012 R2 to be able to sign AppX
return {
path: getWinSignTool(vendorPath)
};
} else if (process.platform === "darwin") {
const toolDirPath = path.join(vendorPath, process.platform, "10.12");
return {
path: path.join(toolDirPath, "osslsigncode"),
env: (0, _bundledTool().computeToolEnv)([path.join(toolDirPath, "lib")])
};
} else {
return {
path: path.join(vendorPath, process.platform, "osslsigncode")
};
}
}
// __ts-babel@6.0.4
//# sourceMappingURL=windowsCodeSign.js.map

File diff suppressed because one or more lines are too long

231
app/node_modules/app-builder-lib/out/configuration.d.ts generated vendored Normal file
View File

@@ -0,0 +1,231 @@
import { Arch } from "builder-util";
import { BeforeBuildContext, Target } from "./core";
import { ElectronDownloadOptions } from "./electron/ElectronFramework";
import { AppXOptions } from "./options/AppXOptions";
import { AppImageOptions, DebOptions, LinuxConfiguration, LinuxTargetSpecificOptions } from "./options/linuxOptions";
import { DmgOptions, MacConfiguration, MasConfiguration } from "./options/macOptions";
import { MsiOptions } from "./options/MsiOptions";
import { PkgOptions } from "./options/pkgOptions";
import { PlatformSpecificBuildOptions } from "./options/PlatformSpecificBuildOptions";
import { SnapOptions } from "./options/SnapOptions";
import { SquirrelWindowsOptions } from "./options/SquirrelWindowsOptions";
import { WindowsConfiguration } from "./options/winOptions";
import { BuildResult } from "./packager";
import { ArtifactBuildStarted, ArtifactCreated } from "./packagerApi";
import { PlatformPackager } from "./platformPackager";
import { NsisOptions, NsisWebOptions, PortableOptions } from "./targets/nsis/nsisOptions";
/**
* Configuration Options
*/
export interface Configuration extends PlatformSpecificBuildOptions {
/**
* The application id. Used as [CFBundleIdentifier](https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/20001431-102070) for MacOS and as
* [Application User Model ID](https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx) for Windows (NSIS target only, Squirrel.Windows not supported). It is strongly recommended that an explicit ID is set.
* @default com.electron.${name}
*/
readonly appId?: string | null;
/**
* As [name](#Metadata-name), but allows you to specify a product name for your executable which contains spaces and other special characters not allowed in the [name property](https://docs.npmjs.com/files/package.json#name).
*/
readonly productName?: string | null;
/**
* The human-readable copyright line for the app.
* @default Copyright © year ${author}
*/
readonly copyright?: string | null;
readonly directories?: MetadataDirectories | null;
/**
* Options related to how build macOS targets.
*/
readonly mac?: MacConfiguration | null;
/**
* MAS (Mac Application Store) options.
*/
readonly mas?: MasConfiguration | null;
/**
* MAS (Mac Application Store) development options (`mas-dev` target).
*/
readonly masDev?: MasConfiguration | null;
/**
* macOS DMG options.
*/
readonly dmg?: DmgOptions | null;
/**
* macOS PKG options.
*/
readonly pkg?: PkgOptions | null;
/**
* Options related to how build Windows targets.
*/
readonly win?: WindowsConfiguration | null;
readonly nsis?: NsisOptions | null;
readonly nsisWeb?: NsisWebOptions | null;
readonly portable?: PortableOptions | null;
readonly appx?: AppXOptions | null;
/** @private */
readonly msi?: MsiOptions | null;
readonly squirrelWindows?: SquirrelWindowsOptions | null;
/**
* Options related to how build Linux targets.
*/
readonly linux?: LinuxConfiguration | null;
/**
* Debian package options.
*/
readonly deb?: DebOptions | null;
/**
* Snap options.
*/
readonly snap?: SnapOptions | null;
/**
* AppImage options.
*/
readonly appImage?: AppImageOptions | null;
readonly pacman?: LinuxTargetSpecificOptions | null;
readonly rpm?: LinuxTargetSpecificOptions | null;
readonly freebsd?: LinuxTargetSpecificOptions | null;
readonly p5p?: LinuxTargetSpecificOptions | null;
readonly apk?: LinuxTargetSpecificOptions | null;
/**
* Whether to build the application native dependencies from source.
* @default false
*/
buildDependenciesFromSource?: boolean;
/**
* Whether to execute `node-gyp rebuild` before starting to package the app.
*
* Don't [use](https://github.com/electron-userland/electron-builder/issues/683#issuecomment-241214075) [npm](http://electron.atom.io/docs/tutorial/using-native-node-modules/#using-npm) (neither `.npmrc`) for configuring electron headers. Use `electron-builder node-gyp-rebuild` instead.
* @default false
*/
readonly nodeGypRebuild?: boolean;
/**
* Additional command line arguments to use when installing app native deps.
*/
readonly npmArgs?: Array<string> | string | null;
/**
* Whether to [rebuild](https://docs.npmjs.com/cli/rebuild) native dependencies before starting to package the app.
* @default true
*/
readonly npmRebuild?: boolean;
/**
* The build version. Maps to the `CFBundleVersion` on macOS, and `FileVersion` metadata property on Windows. Defaults to the `version`.
* If `TRAVIS_BUILD_NUMBER` or `APPVEYOR_BUILD_NUMBER` or `CIRCLE_BUILD_NUM` or `BUILD_NUMBER` or `bamboo.buildNumber` or `CI_PIPELINE_IID` env defined, it will be used as a build version (`version.build_number`).
*/
readonly buildVersion?: string | null;
/**
* Whether to use [electron-compile](http://github.com/electron/electron-compile) to compile app. Defaults to `true` if `electron-compile` in the dependencies. And `false` if in the `devDependencies` or doesn't specified.
*/
readonly electronCompile?: boolean;
/**
* The path to custom Electron build (e.g. `~/electron/out/R`).
*/
readonly electronDist?: string;
/**
* The [electron-download](https://github.com/electron-userland/electron-download#usage) options.
*/
readonly electronDownload?: ElectronDownloadOptions;
/**
* The version of electron you are packaging for. Defaults to version of `electron`, `electron-prebuilt` or `electron-prebuilt-compile` dependency.
*/
electronVersion?: string | null;
/**
* The name of a built-in configuration preset or path to config file (relative to project dir). Currently, only `react-cra` is supported.
*
* If `react-scripts` in the app dependencies, `react-cra` will be set automatically. Set to `null` to disable automatic detection.
*/
extends?: string | null;
/**
* Inject properties to `package.json`.
*/
readonly extraMetadata?: any;
/**
* Whether to fail if the application is not signed (to prevent unsigned app if code signing configuration is not correct).
* @default false
*/
readonly?: boolean;
/**
* *libui-based frameworks only* The version of NodeJS you are packaging for.
* You can set it to `current` to set the Node.js version that you use to run.
*/
readonly nodeVersion?: string | null;
/**
* *libui-based frameworks only* The version of LaunchUI you are packaging for. Applicable for Windows only. Defaults to version suitable for used framework version.
*/
readonly launchUiVersion?: boolean | string | null;
/**
* The framework name. One of `electron`, `proton`, `libui`. Defaults to `electron`.
*/
readonly framework?: string | null;
/**
* The function (or path to file or module id) to be [run after pack](#afterpack) (but before pack into distributable format and sign).
*/
readonly afterPack?: ((context: AfterPackContext) => Promise<any> | any) | string | null;
/**
* The function (or path to file or module id) to be [run after pack and sign](#aftersign) (but before pack into distributable format).
*/
readonly afterSign?: ((context: AfterPackContext) => Promise<any> | any) | string | null;
/**
* The function (or path to file or module id) to be run on artifact build start.
*/
readonly artifactBuildStarted?: ((context: ArtifactBuildStarted) => Promise<any> | any) | string | null;
/**
* The function (or path to file or module id) to be run on artifact build completed.
*/
readonly artifactBuildCompleted?: ((context: ArtifactCreated) => Promise<any> | any) | string | null;
/**
* The function (or path to file or module id) to be [run after all artifacts are build](#afterAllArtifactBuild).
*/
readonly afterAllArtifactBuild?: ((context: BuildResult) => Promise<Array<string>> | Array<string>) | string | null;
/**
* The function (or path to file or module id) to be [run on each node module](#onnodemodulefile) file.
*/
readonly onNodeModuleFile?: ((file: string) => void) | string | null;
/**
* The function (or path to file or module id) to be run before dependencies are installed or rebuilt. Works when `npmRebuild` is set to `true`. Resolving to `false` will skip dependencies install or rebuild.
*
* If provided and `node_modules` are missing, it will not invoke production dependencies check.
*/
readonly beforeBuild?: ((context: BeforeBuildContext) => Promise<any>) | string | null;
/**
* Whether to build using Electron Build Service if target not supported on current OS.
* @default true
*/
readonly remoteBuild?: boolean;
/**
* Whether to include PDB files.
* @default false
*/
readonly includePdb?: boolean;
/**
* Whether to remove `scripts` field from `package.json` files.
*
* @default true
*/
readonly removePackageScripts?: boolean;
}
export interface AfterPackContext {
readonly outDir: string;
readonly appOutDir: string;
readonly packager: PlatformPackager<any>;
readonly electronPlatformName: string;
readonly arch: Arch;
readonly targets: Array<Target>;
}
export interface MetadataDirectories {
/**
* The path to build resources.
*
* Please note — build resources is not packed into the app. If you need to use some files, e.g. as tray icon, please include required files explicitly: `"files": ["**\/*", "build/icon.*"]`
* @default build
*/
readonly buildResources?: string | null;
/**
* The output directory. [File macros](/file-patterns#file-macros) are supported.
* @default dist
*/
readonly output?: string | null;
/**
* The application directory (containing the application package.json), defaults to `app`, `www` or working directory.
*/
readonly app?: string | null;
}

View File

@@ -0,0 +1,3 @@
"use strict";
// __ts-babel@6.0.4
//# sourceMappingURL=configuration.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":[],"names":[],"mappings":"","sourceRoot":""}

61
app/node_modules/app-builder-lib/out/core.d.ts generated vendored Normal file
View File

@@ -0,0 +1,61 @@
/// <reference types="node" />
import { Arch, ArchType } from "builder-util";
import { AllPublishOptions } from "builder-util-runtime";
import { SnapStoreOptions } from "./publish/SnapStorePublisher";
export declare type Publish = AllPublishOptions | SnapStoreOptions | Array<AllPublishOptions | SnapStoreOptions> | null;
export declare type TargetConfigType = Array<string | TargetConfiguration> | string | TargetConfiguration | null;
export interface TargetConfiguration {
/**
* The target name. e.g. `snap`.
*/
readonly target: string;
/**
* The arch or list of archs.
*/
readonly arch?: Array<ArchType> | ArchType;
}
export declare class Platform {
name: string;
buildConfigurationKey: string;
nodeName: NodeJS.Platform;
static MAC: Platform;
static LINUX: Platform;
static WINDOWS: Platform;
constructor(name: string, buildConfigurationKey: string, nodeName: NodeJS.Platform);
toString(): string;
createTarget(type?: string | Array<string> | null, ...archs: Array<Arch>): Map<Platform, Map<Arch, Array<string>>>;
static current(): Platform;
static fromString(name: string): Platform;
}
export declare abstract class Target {
readonly name: string;
readonly isAsyncSupported: boolean;
abstract readonly outDir: string;
abstract readonly options: TargetSpecificOptions | null | undefined;
protected constructor(name: string, isAsyncSupported?: boolean);
checkOptions(): Promise<any>;
abstract build(appOutDir: string, arch: Arch): Promise<any>;
finishBuild(): Promise<any>;
}
export interface TargetSpecificOptions {
/**
The [artifact file name template](/configuration/configuration#artifact-file-name-template).
*/
readonly artifactName?: string | null;
publish?: Publish;
}
export declare const DEFAULT_TARGET = "default";
export declare const DIR_TARGET = "dir";
export declare type CompressionLevel = "store" | "normal" | "maximum";
export interface BeforeBuildContext {
readonly appDir: string;
readonly electronVersion: string;
readonly platform: Platform;
readonly arch: string;
}
export interface SourceRepositoryInfo {
type?: string;
domain?: string;
user: string;
project: string;
}

99
app/node_modules/app-builder-lib/out/core.js generated vendored Normal file
View File

@@ -0,0 +1,99 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.DIR_TARGET = exports.DEFAULT_TARGET = exports.Target = exports.Platform = void 0;
function _builderUtil() {
const data = require("builder-util");
_builderUtil = function () {
return data;
};
return data;
}
class Platform {
constructor(name, buildConfigurationKey, nodeName) {
this.name = name;
this.buildConfigurationKey = buildConfigurationKey;
this.nodeName = nodeName;
}
toString() {
return this.name;
}
createTarget(type, ...archs) {
if (type == null && (archs == null || archs.length === 0)) {
return new Map([[this, new Map()]]);
}
const archToType = new Map();
if (this === Platform.MAC) {
archs = [_builderUtil().Arch.x64];
}
for (const arch of archs == null || archs.length === 0 ? [(0, _builderUtil().archFromString)(process.arch)] : archs) {
archToType.set(arch, type == null ? [] : Array.isArray(type) ? type : [type]);
}
return new Map([[this, archToType]]);
}
static current() {
return Platform.fromString(process.platform);
}
static fromString(name) {
name = name.toLowerCase();
switch (name) {
case Platform.MAC.nodeName:
case Platform.MAC.name:
return Platform.MAC;
case Platform.WINDOWS.nodeName:
case Platform.WINDOWS.name:
case Platform.WINDOWS.buildConfigurationKey:
return Platform.WINDOWS;
case Platform.LINUX.nodeName:
return Platform.LINUX;
default:
throw new Error(`Unknown platform: ${name}`);
}
}
}
exports.Platform = Platform;
Platform.MAC = new Platform("mac", "mac", "darwin");
Platform.LINUX = new Platform("linux", "linux", "linux");
Platform.WINDOWS = new Platform("windows", "win", "win32");
class Target {
constructor(name, isAsyncSupported = true) {
this.name = name;
this.isAsyncSupported = isAsyncSupported;
}
async checkOptions() {// ignore
}
finishBuild() {
return Promise.resolve();
}
}
exports.Target = Target;
const DEFAULT_TARGET = "default";
exports.DEFAULT_TARGET = DEFAULT_TARGET;
const DIR_TARGET = "dir"; exports.DIR_TARGET = DIR_TARGET;
// __ts-babel@6.0.4
//# sourceMappingURL=core.js.map

1
app/node_modules/app-builder-lib/out/core.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,24 @@
import { Configuration } from "../configuration";
import { Framework } from "../Framework";
import { ElectronPlatformName, Packager } from "../index";
export declare type ElectronPlatformName = "darwin" | "linux" | "win32" | "mas";
export interface ElectronDownloadOptions {
version?: string;
/**
* The [cache location](https://github.com/electron-userland/electron-download#cache-location).
*/
cache?: string | null;
/**
* The mirror.
*/
mirror?: string | null;
/** @private */
customDir?: string | null;
/** @private */
customFilename?: string | null;
strictSSL?: boolean;
isVerifyChecksum?: boolean;
platform?: ElectronPlatformName;
arch?: string;
}
export declare function createElectronFrameworkSupport(configuration: Configuration, packager: Packager): Promise<Framework>;

View File

@@ -0,0 +1,268 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createElectronFrameworkSupport = createElectronFrameworkSupport;
function _bluebirdLst() {
const data = _interopRequireDefault(require("bluebird-lst"));
_bluebirdLst = function () {
return data;
};
return data;
}
function _builderUtil() {
const data = require("builder-util");
_builderUtil = function () {
return data;
};
return data;
}
function _fs() {
const data = require("builder-util/out/fs");
_fs = function () {
return data;
};
return data;
}
function _fsExtra() {
const data = require("fs-extra");
_fsExtra = function () {
return data;
};
return data;
}
function _lazyVal() {
const data = require("lazy-val");
_lazyVal = function () {
return data;
};
return data;
}
var path = _interopRequireWildcard(require("path"));
function _index() {
const data = require("../index");
_index = function () {
return data;
};
return data;
}
function _platformPackager() {
const data = require("../platformPackager");
_platformPackager = function () {
return data;
};
return data;
}
function _pathManager() {
const data = require("../util/pathManager");
_pathManager = function () {
return data;
};
return data;
}
function _electronMac() {
const data = require("./electronMac");
_electronMac = function () {
return data;
};
return data;
}
function _electronVersion() {
const data = require("./electronVersion");
_electronVersion = function () {
return data;
};
return data;
}
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function createDownloadOpts(opts, platform, arch, electronVersion) {
return Object.assign({
platform,
arch,
version: electronVersion
}, opts.electronDownload);
}
async function beforeCopyExtraFiles(options) {
const packager = options.packager;
const appOutDir = options.appOutDir;
if (packager.platform === _index().Platform.LINUX) {
if (!(0, _platformPackager().isSafeToUnpackElectronOnRemoteBuildServer)(packager)) {
const linuxPackager = packager;
const executable = path.join(appOutDir, linuxPackager.executableName);
await (0, _fsExtra().rename)(path.join(appOutDir, "electron"), executable);
}
} else if (packager.platform === _index().Platform.WINDOWS) {
const executable = path.join(appOutDir, `${packager.appInfo.productFilename}.exe`);
await (0, _fsExtra().rename)(path.join(appOutDir, "electron.exe"), executable);
} else {
await (0, _electronMac().createMacApp)(packager, appOutDir, options.asarIntegrity, options.platformName === "mas");
const wantedLanguages = (0, _builderUtil().asArray)(packager.platformSpecificBuildOptions.electronLanguages);
if (wantedLanguages.length === 0) {
return;
} // noinspection SpellCheckingInspection
const langFileExt = ".lproj";
const resourcesDir = packager.getResourcesDir(appOutDir);
await _bluebirdLst().default.map((0, _fsExtra().readdir)(resourcesDir), file => {
if (!file.endsWith(langFileExt)) {
return;
}
const language = file.substring(0, file.length - langFileExt.length);
if (!wantedLanguages.includes(language)) {
return (0, _fsExtra().remove)(path.join(resourcesDir, file));
}
return;
}, _fs().CONCURRENCY);
}
}
class ElectronFramework {
constructor(name, version, distMacOsAppName) {
this.name = name;
this.version = version;
this.distMacOsAppName = distMacOsAppName; // noinspection JSUnusedGlobalSymbols
this.macOsDefaultTargets = ["zip", "dmg"]; // noinspection JSUnusedGlobalSymbols
this.defaultAppIdPrefix = "com.electron."; // noinspection JSUnusedGlobalSymbols
this.isCopyElevateHelper = true; // noinspection JSUnusedGlobalSymbols
this.isNpmRebuildRequired = true;
}
getDefaultIcon(platform) {
if (platform === _index().Platform.LINUX) {
return path.join((0, _pathManager().getTemplatePath)("icons"), "electron-linux");
} else {
// default icon is embedded into app skeleton
return null;
}
}
prepareApplicationStageDirectory(options) {
return unpack(options, createDownloadOpts(options.packager.config, options.platformName, options.arch, this.version), this.distMacOsAppName);
}
beforeCopyExtraFiles(options) {
return beforeCopyExtraFiles(options);
}
}
async function createElectronFrameworkSupport(configuration, packager) {
let version = configuration.electronVersion;
if (version == null) {
// for prepacked app asar no dev deps in the app.asar
if (packager.isPrepackedAppAsar) {
version = await (0, _electronVersion().getElectronVersionFromInstalled)(packager.projectDir);
if (version == null) {
throw new Error(`Cannot compute electron version for prepacked asar`);
}
} else {
version = await (0, _electronVersion().computeElectronVersion)(packager.projectDir, new (_lazyVal().Lazy)(() => Promise.resolve(packager.metadata)));
}
configuration.electronVersion = version;
}
return new ElectronFramework("electron", version, "Electron.app");
}
async function unpack(prepareOptions, options, distMacOsAppName) {
const packager = prepareOptions.packager;
const out = prepareOptions.appOutDir;
let dist = packager.config.electronDist;
if (dist != null) {
const zipFile = `electron-v${options.version}-${prepareOptions.platformName}-${options.arch}.zip`;
const resolvedDist = path.resolve(packager.projectDir, dist);
if ((await (0, _fs().statOrNull)(path.join(resolvedDist, zipFile))) != null) {
options.cache = resolvedDist;
dist = null;
}
}
let isFullCleanup = false;
if (dist == null) {
if ((0, _platformPackager().isSafeToUnpackElectronOnRemoteBuildServer)(packager)) {
return;
}
await (0, _builderUtil().executeAppBuilder)(["unpack-electron", "--configuration", JSON.stringify([options]), "--output", out, "--distMacOsAppName", distMacOsAppName]);
} else {
isFullCleanup = true;
const source = packager.getElectronSrcDir(dist);
const destination = packager.getElectronDestinationDir(out);
_builderUtil().log.info({
source,
destination
}, "copying Electron");
await (0, _fsExtra().emptyDir)(out);
await (0, _fs().copyDir)(source, destination, {
isUseHardLink: _fs().DO_NOT_USE_HARD_LINKS
});
}
await cleanupAfterUnpack(prepareOptions, distMacOsAppName, isFullCleanup);
}
function cleanupAfterUnpack(prepareOptions, distMacOsAppName, isFullCleanup) {
const out = prepareOptions.appOutDir;
const isMac = prepareOptions.packager.platform === _index().Platform.MAC;
const resourcesPath = isMac ? path.join(out, distMacOsAppName, "Contents", "Resources") : path.join(out, "resources");
return Promise.all([isFullCleanup ? (0, _fs().unlinkIfExists)(path.join(resourcesPath, "default_app.asar")) : Promise.resolve(), isFullCleanup ? (0, _fs().unlinkIfExists)(path.join(out, "version")) : Promise.resolve(), isMac ? Promise.resolve() : (0, _fsExtra().rename)(path.join(out, "LICENSE"), path.join(out, "LICENSE.electron.txt")).catch(() => {})]);
}
// __ts-babel@6.0.4
//# sourceMappingURL=ElectronFramework.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,296 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createMacApp = createMacApp;
function _bluebirdLst() {
const data = _interopRequireDefault(require("bluebird-lst"));
_bluebirdLst = function () {
return data;
};
return data;
}
function _builderUtil() {
const data = require("builder-util");
_builderUtil = function () {
return data;
};
return data;
}
function _fs() {
const data = require("builder-util/out/fs");
_fs = function () {
return data;
};
return data;
}
function _fsExtra() {
const data = require("fs-extra");
_fsExtra = function () {
return data;
};
return data;
}
var path = _interopRequireWildcard(require("path"));
function _appInfo() {
const data = require("../appInfo");
_appInfo = function () {
return data;
};
return data;
}
function _platformPackager() {
const data = require("../platformPackager");
_platformPackager = function () {
return data;
};
return data;
}
function _appBuilder() {
const data = require("../util/appBuilder");
_appBuilder = function () {
return data;
};
return data;
}
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function doRename(basePath, oldName, newName) {
return (0, _fsExtra().rename)(path.join(basePath, oldName), path.join(basePath, newName));
}
function moveHelpers(helperSuffixes, frameworksPath, appName, prefix) {
return _bluebirdLst().default.map(helperSuffixes, suffix => {
const executableBasePath = path.join(frameworksPath, `${prefix}${suffix}.app`, "Contents", "MacOS");
return doRename(executableBasePath, `${prefix}${suffix}`, appName + suffix).then(() => doRename(frameworksPath, `${prefix}${suffix}.app`, `${appName}${suffix}.app`));
});
}
function getAvailableHelperSuffixes(helperEHPlist, helperNPPlist) {
const result = [" Helper"];
if (helperEHPlist != null) {
result.push(" Helper EH");
}
if (helperNPPlist != null) {
result.push(" Helper NP");
}
return result;
}
/** @internal */
async function createMacApp(packager, appOutDir, asarIntegrity, isMas) {
const appInfo = packager.appInfo;
const appFilename = appInfo.productFilename;
const contentsPath = path.join(appOutDir, packager.info.framework.distMacOsAppName, "Contents");
const frameworksPath = path.join(contentsPath, "Frameworks");
const loginItemPath = path.join(contentsPath, "Library", "LoginItems");
const appPlistFilename = path.join(contentsPath, "Info.plist");
const helperPlistFilename = path.join(frameworksPath, "Electron Helper.app", "Contents", "Info.plist");
const helperEHPlistFilename = path.join(frameworksPath, "Electron Helper EH.app", "Contents", "Info.plist");
const helperNPPlistFilename = path.join(frameworksPath, "Electron Helper NP.app", "Contents", "Info.plist");
const helperLoginPlistFilename = path.join(loginItemPath, "Electron Login Helper.app", "Contents", "Info.plist");
const plistContent = await (0, _appBuilder().executeAppBuilderAsJson)(["decode-plist", "-f", appPlistFilename, "-f", helperPlistFilename, "-f", helperEHPlistFilename, "-f", helperNPPlistFilename, "-f", helperLoginPlistFilename]);
if (plistContent[0] == null) {
throw new Error("corrupted Electron dist");
}
const appPlist = plistContent[0];
const helperPlist = plistContent[1];
const helperEHPlist = plistContent[2];
const helperNPPlist = plistContent[3];
const helperLoginPlist = plistContent[4]; // if an extend-info file was supplied, copy its contents in first
if (plistContent[5] != null) {
Object.assign(appPlist, plistContent[5]);
}
const buildMetadata = packager.config;
const oldHelperBundleId = buildMetadata["helper-bundle-id"];
if (oldHelperBundleId != null) {
_builderUtil().log.warn("build.helper-bundle-id is deprecated, please set as build.mac.helperBundleId");
}
const helperBundleIdentifier = (0, _appInfo().filterCFBundleIdentifier)(packager.platformSpecificBuildOptions.helperBundleId || oldHelperBundleId || `${appInfo.macBundleIdentifier}.helper`);
await packager.applyCommonInfo(appPlist, contentsPath); // required for electron-updater proxy
if (!isMas) {
configureLocalhostAts(appPlist);
}
helperPlist.CFBundleExecutable = `${appFilename} Helper`;
helperPlist.CFBundleDisplayName = `${appInfo.productName} Helper`;
helperPlist.CFBundleIdentifier = helperBundleIdentifier;
helperPlist.CFBundleVersion = appPlist.CFBundleVersion;
function configureHelper(helper, postfix) {
helper.CFBundleExecutable = `${appFilename} Helper ${postfix}`;
helper.CFBundleDisplayName = `${appInfo.productName} Helper ${postfix}`;
helper.CFBundleIdentifier = `${helperBundleIdentifier}.${postfix}`;
helper.CFBundleVersion = appPlist.CFBundleVersion;
}
if (helperEHPlist != null) {
configureHelper(helperEHPlist, "EH");
}
if (helperNPPlist != null) {
configureHelper(helperNPPlist, "NP");
}
if (helperLoginPlist != null) {
helperLoginPlist.CFBundleExecutable = `${appFilename} Login Helper`;
helperLoginPlist.CFBundleDisplayName = `${appInfo.productName} Login Helper`; // noinspection SpellCheckingInspection
helperLoginPlist.CFBundleIdentifier = `${appInfo.macBundleIdentifier}.loginhelper`;
helperLoginPlist.CFBundleVersion = appPlist.CFBundleVersion;
}
const protocols = (0, _builderUtil().asArray)(buildMetadata.protocols).concat((0, _builderUtil().asArray)(packager.platformSpecificBuildOptions.protocols));
if (protocols.length > 0) {
appPlist.CFBundleURLTypes = protocols.map(protocol => {
const schemes = (0, _builderUtil().asArray)(protocol.schemes);
if (schemes.length === 0) {
throw new (_builderUtil().InvalidConfigurationError)(`Protocol "${protocol.name}": must be at least one scheme specified`);
}
return {
CFBundleURLName: protocol.name,
CFBundleTypeRole: protocol.role || "Editor",
CFBundleURLSchemes: schemes.slice()
};
});
}
const fileAssociations = packager.fileAssociations;
if (fileAssociations.length > 0) {
appPlist.CFBundleDocumentTypes = await _bluebirdLst().default.map(fileAssociations, async fileAssociation => {
const extensions = (0, _builderUtil().asArray)(fileAssociation.ext).map(_platformPackager().normalizeExt);
const customIcon = await packager.getResource((0, _builderUtil().getPlatformIconFileName)(fileAssociation.icon, true), `${extensions[0]}.icns`);
let iconFile = appPlist.CFBundleIconFile;
if (customIcon != null) {
iconFile = path.basename(customIcon);
await (0, _fs().copyOrLinkFile)(customIcon, path.join(path.join(contentsPath, "Resources"), iconFile));
}
const result = {
CFBundleTypeExtensions: extensions,
CFBundleTypeName: fileAssociation.name || extensions[0],
CFBundleTypeRole: fileAssociation.role || "Editor",
CFBundleTypeIconFile: iconFile
};
if (fileAssociation.isPackage) {
result.LSTypeIsPackage = true;
}
return result;
});
}
if (asarIntegrity != null) {
appPlist.AsarIntegrity = JSON.stringify(asarIntegrity);
}
const plistDataToWrite = {
[appPlistFilename]: appPlist,
[helperPlistFilename]: helperPlist
};
if (helperEHPlist != null) {
plistDataToWrite[helperEHPlistFilename] = helperEHPlist;
}
if (helperNPPlist != null) {
plistDataToWrite[helperNPPlistFilename] = helperNPPlist;
}
if (helperLoginPlist != null) {
plistDataToWrite[helperLoginPlistFilename] = helperLoginPlist;
}
await Promise.all([(0, _appBuilder().executeAppBuilderAndWriteJson)(["encode-plist"], plistDataToWrite), doRename(path.join(contentsPath, "MacOS"), "Electron", appPlist.CFBundleExecutable), (0, _fs().unlinkIfExists)(path.join(appOutDir, "LICENSE")), (0, _fs().unlinkIfExists)(path.join(appOutDir, "LICENSES.chromium.html"))]);
await moveHelpers(getAvailableHelperSuffixes(helperEHPlist, helperNPPlist), frameworksPath, appFilename, "Electron");
if (helperLoginPlist != null) {
const prefix = "Electron";
const suffix = " Login Helper";
const executableBasePath = path.join(loginItemPath, `${prefix}${suffix}.app`, "Contents", "MacOS");
await doRename(executableBasePath, `${prefix}${suffix}`, appFilename + suffix).then(() => doRename(loginItemPath, `${prefix}${suffix}.app`, `${appFilename}${suffix}.app`));
}
const appPath = path.join(appOutDir, `${appFilename}.app`);
await (0, _fsExtra().rename)(path.dirname(contentsPath), appPath); // https://github.com/electron-userland/electron-builder/issues/840
const now = Date.now() / 1000;
await (0, _fsExtra().utimes)(appPath, now, now);
}
function configureLocalhostAts(appPlist) {
// https://bencoding.com/2015/07/20/app-transport-security-and-localhost/
let ats = appPlist.NSAppTransportSecurity;
if (ats == null) {
ats = {};
appPlist.NSAppTransportSecurity = ats;
}
ats.NSAllowsLocalNetworking = true; // https://github.com/electron-userland/electron-builder/issues/3377#issuecomment-446035814
ats.NSAllowsArbitraryLoads = true;
let exceptionDomains = ats.NSExceptionDomains;
if (exceptionDomains == null) {
exceptionDomains = {};
ats.NSExceptionDomains = exceptionDomains;
}
if (exceptionDomains.localhost == null) {
const allowHttp = {
NSTemporaryExceptionAllowsInsecureHTTPSLoads: false,
NSIncludesSubdomains: false,
NSTemporaryExceptionAllowsInsecureHTTPLoads: true,
NSTemporaryExceptionMinimumTLSVersion: "1.0",
NSTemporaryExceptionRequiresForwardSecrecy: false
};
exceptionDomains.localhost = allowHttp;
exceptionDomains["127.0.0.1"] = allowHttp;
}
}
// __ts-babel@6.0.4
//# sourceMappingURL=electronMac.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,7 @@
import { Lazy } from "lazy-val";
import { Configuration } from "../configuration";
export declare type MetadataValue = Lazy<{
[key: string]: any;
} | null>;
export declare function getElectronVersion(projectDir: string, config?: Configuration, projectMetadata?: MetadataValue): Promise<string>;
export declare function getElectronVersionFromInstalled(projectDir: string): Promise<any>;

View File

@@ -0,0 +1,171 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getElectronVersion = getElectronVersion;
exports.getElectronVersionFromInstalled = getElectronVersionFromInstalled;
exports.computeElectronVersion = computeElectronVersion;
function _builderUtil() {
const data = require("builder-util");
_builderUtil = function () {
return data;
};
return data;
}
function _nodeHttpExecutor() {
const data = require("builder-util/out/nodeHttpExecutor");
_nodeHttpExecutor = function () {
return data;
};
return data;
}
function _fsExtra() {
const data = require("fs-extra");
_fsExtra = function () {
return data;
};
return data;
}
function _lazyVal() {
const data = require("lazy-val");
_lazyVal = function () {
return data;
};
return data;
}
var path = _interopRequireWildcard(require("path"));
function _readConfigFile() {
const data = require("read-config-file");
_readConfigFile = function () {
return data;
};
return data;
}
function semver() {
const data = _interopRequireWildcard(require("semver"));
semver = function () {
return data;
};
return data;
}
function _config() {
const data = require("../util/config");
_config = function () {
return data;
};
return data;
}
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
const electronPackages = ["electron", "electron-prebuilt", "electron-prebuilt-compile"];
async function getElectronVersion(projectDir, config, projectMetadata = new (_lazyVal().Lazy)(() => (0, _readConfigFile().orNullIfFileNotExist)((0, _fsExtra().readJson)(path.join(projectDir, "package.json"))))) {
if (config == null) {
config = await (0, _config().getConfig)(projectDir, null, null);
}
if (config.electronVersion != null) {
return config.electronVersion;
}
return await computeElectronVersion(projectDir, projectMetadata);
}
async function getElectronVersionFromInstalled(projectDir) {
for (const name of electronPackages) {
try {
return (await (0, _fsExtra().readJson)(path.join(projectDir, "node_modules", name, "package.json"))).version;
} catch (e) {
if (e.code !== "ENOENT") {
_builderUtil().log.warn({
name,
error: e
}, `cannot read electron version package.json`);
}
}
}
return null;
}
/** @internal */
async function computeElectronVersion(projectDir, projectMetadata) {
const result = await getElectronVersionFromInstalled(projectDir);
if (result != null) {
return result;
}
const electronVersionFromMetadata = findFromPackageMetadata((await projectMetadata.value));
if (electronVersionFromMetadata === "latest") {
_builderUtil().log.warn("Electron version is set to \"latest\", but it is recommended to set it to some more restricted version range.");
try {
const releaseInfo = JSON.parse((await _nodeHttpExecutor().httpExecutor.request({
hostname: "github.com",
path: "/electron/electron/releases/latest",
headers: {
accept: "application/json"
}
})));
return releaseInfo.tag_name.startsWith("v") ? releaseInfo.tag_name.substring(1) : releaseInfo.tag_name;
} catch (e) {
_builderUtil().log.warn(e);
}
throw new (_builderUtil().InvalidConfigurationError)(`Cannot find electron dependency to get electron version in the '${path.join(projectDir, "package.json")}'`);
}
if (electronVersionFromMetadata == null || !/^\d/.test(electronVersionFromMetadata)) {
const versionMessage = electronVersionFromMetadata == null ? "" : ` and version ("${electronVersionFromMetadata}") is not fixed in project`;
throw new (_builderUtil().InvalidConfigurationError)(`Cannot compute electron version from installed node modules - none of the possible electron modules are installed${versionMessage}.\nSee https://github.com/electron-userland/electron-builder/issues/3984#issuecomment-504968246`);
}
return semver().coerce(electronVersionFromMetadata).toString();
}
function findFromPackageMetadata(packageData) {
for (const name of electronPackages) {
const devDependencies = packageData.devDependencies;
let dep = devDependencies == null ? null : devDependencies[name];
if (dep == null) {
const dependencies = packageData.dependencies;
dep = dependencies == null ? null : dependencies[name];
}
if (dep != null) {
return dep;
}
}
return null;
}
// __ts-babel@6.0.4
//# sourceMappingURL=electronVersion.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
export declare const authorEmailIsMissed = "Please specify author 'email' in the application package.json\n\nSee https://docs.npmjs.com/files/package.json#people-fields-author-contributors\n\nIt is required to set Linux .deb package maintainer. Or you can set maintainer in the custom linux options.\n(see https://www.electron.build/configuration/linux).\n";

15
app/node_modules/app-builder-lib/out/errorMessages.js generated vendored Normal file
View File

@@ -0,0 +1,15 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.authorEmailIsMissed = void 0;
const authorEmailIsMissed = `Please specify author 'email' in the application package.json
See https://docs.npmjs.com/files/package.json#people-fields-author-contributors
It is required to set Linux .deb package maintainer. Or you can set maintainer in the custom linux options.
(see https://www.electron.build/configuration/linux).
`; exports.authorEmailIsMissed = authorEmailIsMissed;
// __ts-babel@6.0.4
//# sourceMappingURL=errorMessages.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../src/errorMessages.ts"],"names":[],"mappings":";;;;;;AAAO,MAAM,mBAAmB,GAAG;;;;;;CAA5B,C","sourcesContent":["export const authorEmailIsMissed = `Please specify author 'email' in the application package.json\n\nSee https://docs.npmjs.com/files/package.json#people-fields-author-contributors\n\nIt is required to set Linux .deb package maintainer. Or you can set maintainer in the custom linux options.\n(see https://www.electron.build/configuration/linux).\n`"],"sourceRoot":""}

View File

@@ -0,0 +1,9 @@
import { PlatformSpecificBuildOptions } from "./index";
export declare const excludedNames: string;
export declare const excludedExts = "iml,hprof,orig,pyc,pyo,rbc,swp,csproj,sln,suo,xproj,cc,d.ts";
export interface GetFileMatchersOptions {
readonly macroExpander: (pattern: string) => string;
readonly customBuildOptions: PlatformSpecificBuildOptions;
readonly globalOutDir: string;
readonly defaultSrc: string;
}

409
app/node_modules/app-builder-lib/out/fileMatcher.js generated vendored Normal file
View File

@@ -0,0 +1,409 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getMainFileMatchers = getMainFileMatchers;
exports.getNodeModuleFileMatcher = getNodeModuleFileMatcher;
exports.getFileMatchers = getFileMatchers;
exports.copyFiles = copyFiles;
exports.FileMatcher = exports.excludedExts = exports.excludedNames = void 0;
function _bluebirdLst() {
const data = _interopRequireDefault(require("bluebird-lst"));
_bluebirdLst = function () {
return data;
};
return data;
}
function _builderUtil() {
const data = require("builder-util");
_builderUtil = function () {
return data;
};
return data;
}
function _fs() {
const data = require("builder-util/out/fs");
_fs = function () {
return data;
};
return data;
}
function _fsExtra() {
const data = require("fs-extra");
_fsExtra = function () {
return data;
};
return data;
}
function _minimatch() {
const data = require("minimatch");
_minimatch = function () {
return data;
};
return data;
}
var path = _interopRequireWildcard(require("path"));
function _filter() {
const data = require("./util/filter");
_filter = function () {
return data;
};
return data;
}
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
// https://github.com/electron-userland/electron-builder/issues/733
const minimatchOptions = {
dot: true
}; // noinspection SpellCheckingInspection
const excludedNames = ".git,.hg,.svn,CVS,RCS,SCCS," + "__pycache__,.DS_Store,thumbs.db,.gitignore,.gitkeep,.gitattributes,.npmignore," + ".idea,.vs,.flowconfig,.jshintrc,.eslintrc,.circleci," + ".yarn-integrity,.yarn-metadata.json,yarn-error.log,yarn.lock,package-lock.json,npm-debug.log," + "appveyor.yml,.travis.yml,circle.yml,.nyc_output";
exports.excludedNames = excludedNames;
const excludedExts = "iml,hprof,orig,pyc,pyo,rbc,swp,csproj,sln,suo,xproj,cc,d.ts";
exports.excludedExts = excludedExts;
function ensureNoEndSlash(file) {
if (path.sep !== "/") {
file = file.replace(/\//g, path.sep);
}
if (path.sep !== "\\") {
file = file.replace(/\\/g, path.sep);
}
if (file.endsWith(path.sep)) {
return file.substring(0, file.length - 1);
} else {
return file;
}
}
/** @internal */
class FileMatcher {
constructor(from, to, macroExpander, patterns) {
this.macroExpander = macroExpander;
this.excludePatterns = null;
this.from = ensureNoEndSlash(macroExpander(from));
this.to = ensureNoEndSlash(macroExpander(to));
this.patterns = (0, _builderUtil().asArray)(patterns).map(it => this.normalizePattern(it));
this.isSpecifiedAsEmptyArray = Array.isArray(patterns) && patterns.length === 0;
}
normalizePattern(pattern) {
if (pattern.startsWith("./")) {
pattern = pattern.substring("./".length);
}
return path.posix.normalize(this.macroExpander(pattern.replace(/\\/g, "/")));
}
addPattern(pattern) {
this.patterns.push(this.normalizePattern(pattern));
}
prependPattern(pattern) {
this.patterns.unshift(this.normalizePattern(pattern));
}
isEmpty() {
return this.patterns.length === 0;
}
containsOnlyIgnore() {
return !this.isEmpty() && this.patterns.find(it => !it.startsWith("!")) == null;
}
computeParsedPatterns(result, fromDir) {
const relativeFrom = fromDir == null ? null : path.relative(fromDir, this.from);
if (this.patterns.length === 0 && relativeFrom != null) {
// file mappings, from here is a file
result.push(new (_minimatch().Minimatch)(relativeFrom, minimatchOptions));
return;
}
for (let pattern of this.patterns) {
if (relativeFrom != null) {
pattern = path.join(relativeFrom, pattern);
}
const parsedPattern = new (_minimatch().Minimatch)(pattern, minimatchOptions);
result.push(parsedPattern); // do not add if contains dot (possibly file if has extension)
if (!pattern.includes(".") && !(0, _filter().hasMagic)(parsedPattern)) {
// https://github.com/electron-userland/electron-builder/issues/545
// add **/*
result.push(new (_minimatch().Minimatch)(`${pattern}/**/*`, minimatchOptions));
}
}
}
createFilter() {
const parsedPatterns = [];
this.computeParsedPatterns(parsedPatterns);
return (0, _filter().createFilter)(this.from, parsedPatterns, this.excludePatterns);
}
toString() {
return `from: ${this.from}, to: ${this.to}, patterns: ${this.patterns.join(", ")}`;
}
}
/** @internal */
exports.FileMatcher = FileMatcher;
function getMainFileMatchers(appDir, destination, macroExpander, platformSpecificBuildOptions, platformPackager, outDir, isElectronCompile) {
const packager = platformPackager.info;
const buildResourceDir = path.resolve(packager.projectDir, packager.buildResourcesDir);
let matchers = packager.isPrepackedAppAsar ? null : getFileMatchers(packager.config, "files", destination, {
macroExpander,
customBuildOptions: platformSpecificBuildOptions,
globalOutDir: outDir,
defaultSrc: appDir
});
if (matchers == null) {
matchers = [new FileMatcher(appDir, destination, macroExpander)];
}
const matcher = matchers[0]; // add default patterns, but only if from equals to app dir
if (matcher.from !== appDir) {
return matchers;
} // https://github.com/electron-userland/electron-builder/issues/1741#issuecomment-311111418 so, do not use inclusive patterns
const patterns = matcher.patterns;
const customFirstPatterns = []; // electron-webpack - we need to copy only package.json and node_modules from root dir (and these files are added by default), so, explicit empty array is specified
if (!matcher.isSpecifiedAsEmptyArray && (matcher.isEmpty() || matcher.containsOnlyIgnore())) {
customFirstPatterns.push("**/*");
} else if (!patterns.includes("package.json")) {
patterns.push("package.json");
} // https://github.com/electron-userland/electron-builder/issues/1482
const relativeBuildResourceDir = path.relative(matcher.from, buildResourceDir);
if (relativeBuildResourceDir.length !== 0 && !relativeBuildResourceDir.startsWith(".")) {
customFirstPatterns.push(`!${relativeBuildResourceDir}{,/**/*}`);
}
const relativeOutDir = matcher.normalizePattern(path.relative(packager.projectDir, outDir));
if (!relativeOutDir.startsWith(".")) {
customFirstPatterns.push(`!${relativeOutDir}{,/**/*}`);
} // add our default exclusions after last user possibly defined "all"/permissive pattern
let insertIndex = 0;
for (let i = patterns.length - 1; i >= 0; i--) {
if (patterns[i].startsWith("**/")) {
insertIndex = i + 1;
break;
}
}
patterns.splice(insertIndex, 0, ...customFirstPatterns);
patterns.push(`!**/*.{${excludedExts}${packager.config.includePdb === true ? "" : ",pdb"}`);
patterns.push("!**/._*");
patterns.push("!**/electron-builder.{yaml,yml,json,json5,toml}");
patterns.push(`!**/{${excludedNames}}`);
if (isElectronCompile) {
patterns.push("!.cache{,/**/*}");
} // https://github.com/electron-userland/electron-builder/issues/1969
// exclude ony for app root, use .yarnclean to clean node_modules
patterns.push("!.editorconfig");
const debugLogger = packager.debugLogger;
if (debugLogger.isEnabled) {
//tslint:disable-next-line:no-invalid-template-strings
debugLogger.add(`${macroExpander("${arch}")}.firstOrDefaultFilePatterns`, patterns);
}
return matchers;
}
/** @internal */
function getNodeModuleFileMatcher(appDir, destination, macroExpander, platformSpecificBuildOptions, packager) {
// https://github.com/electron-userland/electron-builder/pull/2948#issuecomment-392241632
// grab only excludes
const matcher = new FileMatcher(appDir, destination, macroExpander);
function addPatterns(patterns) {
if (patterns == null) {
return;
} else if (!Array.isArray(patterns)) {
if (typeof patterns === "string" && patterns.startsWith("!")) {
matcher.addPattern(patterns);
return;
} // ignore object form
return;
}
for (const pattern of patterns) {
if (typeof pattern === "string") {
if (pattern.startsWith("!")) {
matcher.addPattern(pattern);
}
} else {
const fileSet = pattern;
if (fileSet.from == null || fileSet.from === ".") {
for (const p of (0, _builderUtil().asArray)(fileSet.filter)) {
matcher.addPattern(p);
}
}
}
}
}
addPatterns(packager.config.files);
addPatterns(platformSpecificBuildOptions.files);
if (!matcher.isEmpty()) {
matcher.prependPattern("**/*");
}
const debugLogger = packager.debugLogger;
if (debugLogger.isEnabled) {
//tslint:disable-next-line:no-invalid-template-strings
debugLogger.add(`${macroExpander("${arch}")}.nodeModuleFilePatterns`, matcher.patterns);
}
return matcher;
}
/** @internal */
function getFileMatchers(config, name, defaultDestination, options) {
const defaultMatcher = new FileMatcher(options.defaultSrc, defaultDestination, options.macroExpander);
const fileMatchers = [];
function addPatterns(patterns) {
if (patterns == null) {
return;
} else if (!Array.isArray(patterns)) {
if (typeof patterns === "string") {
defaultMatcher.addPattern(patterns);
return;
}
patterns = [patterns];
}
for (const pattern of patterns) {
if (typeof pattern === "string") {
// use normalize to transform ./foo to foo
defaultMatcher.addPattern(pattern);
} else if (name === "asarUnpack") {
throw new Error(`Advanced file copying not supported for "${name}"`);
} else {
const from = pattern.from == null ? options.defaultSrc : path.resolve(options.defaultSrc, pattern.from);
const to = pattern.to == null ? defaultDestination : path.resolve(defaultDestination, pattern.to);
fileMatchers.push(new FileMatcher(from, to, options.macroExpander, pattern.filter));
}
}
}
if (name !== "extraDistFiles") {
addPatterns(config[name]);
}
addPatterns(options.customBuildOptions[name]);
if (!defaultMatcher.isEmpty()) {
// default matcher should be first in the array
fileMatchers.unshift(defaultMatcher);
} // we cannot exclude the whole out dir, because sometimes users want to use some file in the out dir in the patterns
const relativeOutDir = defaultMatcher.normalizePattern(path.relative(options.defaultSrc, options.globalOutDir));
if (!relativeOutDir.startsWith(".")) {
defaultMatcher.addPattern(`!${relativeOutDir}/*-unpacked{,/**/*}`);
}
return fileMatchers.length === 0 ? null : fileMatchers;
}
/** @internal */
function copyFiles(matchers, transformer, isUseHardLink) {
if (matchers == null || matchers.length === 0) {
return Promise.resolve();
}
return _bluebirdLst().default.map(matchers, async matcher => {
const fromStat = await (0, _fs().statOrNull)(matcher.from);
if (fromStat == null) {
_builderUtil().log.warn({
from: matcher.from
}, `file source doesn't exist`);
return;
}
if (fromStat.isFile()) {
const toStat = await (0, _fs().statOrNull)(matcher.to); // https://github.com/electron-userland/electron-builder/issues/1245
if (toStat != null && toStat.isDirectory()) {
return await (0, _fs().copyOrLinkFile)(matcher.from, path.join(matcher.to, path.basename(matcher.from)), fromStat, isUseHardLink);
}
await (0, _fsExtra().ensureDir)(path.dirname(matcher.to));
return await (0, _fs().copyOrLinkFile)(matcher.from, matcher.to, fromStat);
}
if (matcher.isEmpty() || matcher.containsOnlyIgnore()) {
matcher.prependPattern("**/*");
}
_builderUtil().log.debug({
matcher
}, "copying files using pattern");
return await (0, _fs().copyDir)(matcher.from, matcher.to, {
filter: matcher.createFilter(),
transformer,
isUseHardLink: isUseHardLink ? _fs().USE_HARD_LINKS : null
});
});
}
// __ts-babel@6.0.4
//# sourceMappingURL=fileMatcher.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
export {};

139
app/node_modules/app-builder-lib/out/fileTransformer.js generated vendored Normal file
View File

@@ -0,0 +1,139 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.isElectronCompileUsed = isElectronCompileUsed;
exports.hasDep = hasDep;
exports.createTransformer = createTransformer;
exports.createElectronCompilerHost = createElectronCompilerHost;
exports.NODE_MODULES_PATTERN = void 0;
function _builderUtil() {
const data = require("builder-util");
_builderUtil = function () {
return data;
};
return data;
}
function _fsExtra() {
const data = require("fs-extra");
_fsExtra = function () {
return data;
};
return data;
}
var path = _interopRequireWildcard(require("path"));
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
/** @internal */
const NODE_MODULES_PATTERN = `${path.sep}node_modules${path.sep}`;
/** @internal */
exports.NODE_MODULES_PATTERN = NODE_MODULES_PATTERN;
function isElectronCompileUsed(info) {
if (info.config.electronCompile != null) {
return info.config.electronCompile;
} // if in devDependencies - it means that babel is used for precompilation or for some reason user decided to not use electron-compile for production
return hasDep("electron-compile", info);
}
/** @internal */
function hasDep(name, info) {
const deps = info.metadata.dependencies;
return deps != null && name in deps;
}
/** @internal */
function createTransformer(srcDir, configuration, extraMetadata, extraTransformer) {
const mainPackageJson = path.join(srcDir, "package.json");
const isRemovePackageScripts = configuration.removePackageScripts !== false;
const packageJson = path.sep + "package.json";
return file => {
if (file === mainPackageJson) {
return modifyMainPackageJson(file, extraMetadata, isRemovePackageScripts);
}
if (file.endsWith(packageJson) && file.includes(NODE_MODULES_PATTERN)) {
return (0, _fsExtra().readFile)(file, "utf-8").then(it => cleanupPackageJson(JSON.parse(it), {
isMain: false,
isRemovePackageScripts
})).catch(e => _builderUtil().log.warn(e));
} else if (extraTransformer != null) {
return extraTransformer(file);
} else {
return null;
}
};
}
/** @internal */
function createElectronCompilerHost(projectDir, cacheDir) {
const electronCompilePath = path.join(projectDir, "node_modules", "electron-compile", "lib");
return require(path.join(electronCompilePath, "config-parser")).createCompilerHostFromProjectRoot(projectDir, cacheDir);
}
const ignoredPackageMetadataProperties = new Set(["dist", "gitHead", "keywords", "build", "jspm", "ava", "xo", "nyc", "eslintConfig", "contributors", "bundleDependencies", "tags"]);
function cleanupPackageJson(data, options) {
const deps = data.dependencies; // https://github.com/electron-userland/electron-builder/issues/507#issuecomment-312772099
const isRemoveBabel = deps != null && typeof deps === "object" && !Object.getOwnPropertyNames(deps).some(it => it.startsWith("babel"));
try {
let changed = false;
for (const prop of Object.getOwnPropertyNames(data)) {
// removing devDependencies from package.json breaks levelup in electron, so, remove it only from main package.json
if (prop[0] === "_" || ignoredPackageMetadataProperties.has(prop) || options.isRemovePackageScripts && prop === "scripts" || options.isMain && prop === "devDependencies" || !options.isMain && prop === "bugs" || isRemoveBabel && prop === "babel") {
delete data[prop];
changed = true;
}
}
if (changed) {
return JSON.stringify(data, null, 2);
}
} catch (e) {
(0, _builderUtil().debug)(e);
}
return null;
}
async function modifyMainPackageJson(file, extraMetadata, isRemovePackageScripts) {
const mainPackageData = JSON.parse((await (0, _fsExtra().readFile)(file, "utf-8")));
if (extraMetadata != null) {
(0, _builderUtil().deepAssign)(mainPackageData, extraMetadata);
} // https://github.com/electron-userland/electron-builder/issues/1212
const serializedDataIfChanged = cleanupPackageJson(mainPackageData, {
isMain: true,
isRemovePackageScripts
});
if (serializedDataIfChanged != null) {
return serializedDataIfChanged;
} else if (extraMetadata != null) {
return JSON.stringify(mainPackageData, null, 2);
}
return null;
}
// __ts-babel@6.0.4
//# sourceMappingURL=fileTransformer.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,5 @@
import { PackagerOptions } from "./packagerApi";
export interface ForgeOptions {
readonly dir: string;
}
export declare function buildForge(forgeOptions: ForgeOptions, options: PackagerOptions): Promise<string[]>;

35
app/node_modules/app-builder-lib/out/forge-maker.js generated vendored Normal file
View File

@@ -0,0 +1,35 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.buildForge = buildForge;
var path = _interopRequireWildcard(require("path"));
function _index() {
const data = require("./index");
_index = function () {
return data;
};
return data;
}
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
function buildForge(forgeOptions, options) {
const appDir = forgeOptions.dir;
return (0, _index().build)(Object.assign({
prepackaged: appDir,
config: {
directories: {
// https://github.com/electron-userland/electron-forge/blob/master/src/makers/generic/zip.js
output: path.resolve(appDir, "..", "make")
}
}
}, options));
}
// __ts-babel@6.0.4
//# sourceMappingURL=forge-maker.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../src/forge-maker.ts"],"names":[],"mappings":";;;;;;;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;AAOM,SAAU,UAAV,CAAqB,YAArB,EAAiD,OAAjD,EAAyE;AAC7E,QAAM,MAAM,GAAG,YAAY,CAAC,GAA5B;AACA,SAAO,oBAAK,MAAA,CAAA,MAAA,CAAA;AACV,IAAA,WAAW,EAAE,MADH;AAEV,IAAA,MAAM,EAAE;AACN,MAAA,WAAW,EAAE;AACX;AACA,QAAA,MAAM,EAAE,IAAI,CAAC,OAAL,CAAa,MAAb,EAAqB,IAArB,EAA2B,MAA3B;AAFG;AADP;AAFE,GAAA,EAQP,OARO,CAAL,CAAP;AAUD,C","sourcesContent":["import * as path from \"path\"\nimport { build } from \"./index\"\nimport { PackagerOptions } from \"./packagerApi\"\n\nexport interface ForgeOptions {\n readonly dir: string\n}\n\nexport function buildForge(forgeOptions: ForgeOptions, options: PackagerOptions) {\n const appDir = forgeOptions.dir\n return build({\n prepackaged: appDir,\n config: {\n directories: {\n // https://github.com/electron-userland/electron-forge/blob/master/src/makers/generic/zip.js\n output: path.resolve(appDir, \"..\", \"make\"),\n },\n },\n ...options\n })\n}"],"sourceRoot":""}

View File

@@ -0,0 +1,21 @@
import { AfterPackContext } from "../configuration";
import { Platform } from "../core";
import { Framework, PrepareApplicationStageDirectoryOptions } from "../Framework";
export declare class LibUiFramework implements Framework {
readonly version: string;
readonly distMacOsAppName: string;
protected readonly isUseLaunchUi: boolean;
readonly name: string;
readonly macOsDefaultTargets: string[];
readonly defaultAppIdPrefix: string;
readonly isCopyElevateHelper = false;
readonly isNpmRebuildRequired = false;
constructor(version: string, distMacOsAppName: string, isUseLaunchUi: boolean);
prepareApplicationStageDirectory(options: PrepareApplicationStageDirectoryOptions): Promise<void>;
private prepareMacosApplicationStageDirectory;
private prepareLinuxApplicationStageDirectory;
afterPack(context: AfterPackContext): Promise<void>;
getMainFile(platform: Platform): string | null;
private isUseLaunchUiForPlatform;
getExcludedDependencies(platform: Platform): Array<string> | null;
}

View File

@@ -0,0 +1,154 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.LibUiFramework = void 0;
function _fsExtra() {
const data = require("fs-extra");
_fsExtra = function () {
return data;
};
return data;
}
var path = _interopRequireWildcard(require("path"));
function _builderUtil() {
const data = require("builder-util");
_builderUtil = function () {
return data;
};
return data;
}
function _core() {
const data = require("../core");
_core = function () {
return data;
};
return data;
}
function _appBuilder() {
const data = require("../util/appBuilder");
_appBuilder = function () {
return data;
};
return data;
}
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
class LibUiFramework {
constructor(version, distMacOsAppName, isUseLaunchUi) {
this.version = version;
this.distMacOsAppName = distMacOsAppName;
this.isUseLaunchUi = isUseLaunchUi;
this.name = "libui"; // noinspection JSUnusedGlobalSymbols
this.macOsDefaultTargets = ["dmg"];
this.defaultAppIdPrefix = "com.libui."; // noinspection JSUnusedGlobalSymbols
this.isCopyElevateHelper = false; // noinspection JSUnusedGlobalSymbols
this.isNpmRebuildRequired = false;
}
async prepareApplicationStageDirectory(options) {
await (0, _fsExtra().emptyDir)(options.appOutDir);
const packager = options.packager;
const platform = packager.platform;
if (this.isUseLaunchUiForPlatform(platform)) {
const appOutDir = options.appOutDir;
await (0, _builderUtil().executeAppBuilder)(["proton-native", "--node-version", this.version, "--use-launch-ui", "--platform", platform.nodeName, "--arch", options.arch, "--stage", appOutDir, "--executable", `${packager.appInfo.productFilename}${platform === _core().Platform.WINDOWS ? ".exe" : ""}`]);
return;
}
if (platform === _core().Platform.MAC) {
await this.prepareMacosApplicationStageDirectory(packager, options);
} else if (platform === _core().Platform.LINUX) {
await this.prepareLinuxApplicationStageDirectory(options);
}
}
async prepareMacosApplicationStageDirectory(packager, options) {
const appContentsDir = path.join(options.appOutDir, this.distMacOsAppName, "Contents");
await (0, _fsExtra().ensureDir)(path.join(appContentsDir, "Resources"));
await (0, _fsExtra().ensureDir)(path.join(appContentsDir, "MacOS"));
await (0, _builderUtil().executeAppBuilder)(["proton-native", "--node-version", this.version, "--platform", "darwin", "--stage", path.join(appContentsDir, "MacOS")]);
const appPlist = {
// https://github.com/albe-rosado/create-proton-app/issues/13
NSHighResolutionCapable: true
};
await packager.applyCommonInfo(appPlist, appContentsDir);
await Promise.all([(0, _appBuilder().executeAppBuilderAndWriteJson)(["encode-plist"], {
[path.join(appContentsDir, "Info.plist")]: appPlist
}), writeExecutableMain(path.join(appContentsDir, "MacOS", appPlist.CFBundleExecutable), `#!/bin/sh
DIR=$(dirname "$0")
"$DIR/node" "$DIR/../Resources/app/${options.packager.info.metadata.main || "index.js"}"
`)]);
}
async prepareLinuxApplicationStageDirectory(options) {
const appOutDir = options.appOutDir;
await (0, _builderUtil().executeAppBuilder)(["proton-native", "--node-version", this.version, "--platform", "linux", "--arch", options.arch, "--stage", appOutDir]);
const mainPath = path.join(appOutDir, options.packager.executableName);
await writeExecutableMain(mainPath, `#!/bin/sh
DIR=$(dirname "$0")
"$DIR/node" "$DIR/app/${options.packager.info.metadata.main || "index.js"}"
`);
}
async afterPack(context) {
const packager = context.packager;
if (!this.isUseLaunchUiForPlatform(packager.platform)) {
return;
} // LaunchUI requires main.js, rename if need
const userMain = packager.info.metadata.main || "index.js";
if (userMain === "main.js") {
return;
}
await (0, _fsExtra().rename)(path.join(context.appOutDir, "app", userMain), path.join(context.appOutDir, "app", "main.js"));
}
getMainFile(platform) {
return this.isUseLaunchUiForPlatform(platform) ? "main.js" : null;
}
isUseLaunchUiForPlatform(platform) {
return platform === _core().Platform.WINDOWS || this.isUseLaunchUi && platform === _core().Platform.LINUX;
}
getExcludedDependencies(platform) {
// part of launchui
return this.isUseLaunchUiForPlatform(platform) ? ["libui-node"] : null;
}
}
exports.LibUiFramework = LibUiFramework;
async function writeExecutableMain(file, content) {
await (0, _fsExtra().writeFile)(file, content, {
mode: 0o755
});
await (0, _fsExtra().chmod)(file, 0o755);
}
// __ts-babel@6.0.4
//# sourceMappingURL=LibUiFramework.js.map

File diff suppressed because one or more lines are too long

33
app/node_modules/app-builder-lib/out/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,33 @@
import { PublishOptions } from "electron-publish/out/publisher";
import { Packager } from "./packager";
import { PackagerOptions } from "./packagerApi";
export { Packager, BuildResult } from "./packager";
export { PackagerOptions, ArtifactCreated, ArtifactBuildStarted } from "./packagerApi";
export { TargetConfiguration, Platform, Target, DIR_TARGET, BeforeBuildContext, SourceRepositoryInfo, TargetSpecificOptions, TargetConfigType, DEFAULT_TARGET, CompressionLevel } from "./core";
export { getArchSuffix, Arch, archFromString } from "builder-util";
export { Configuration, AfterPackContext, MetadataDirectories } from "./configuration";
export { ElectronDownloadOptions, ElectronPlatformName } from "./electron/ElectronFramework";
export { PlatformSpecificBuildOptions, AsarOptions, FileSet, Protocol, ReleaseInfo } from "./options/PlatformSpecificBuildOptions";
export { FileAssociation } from "./options/FileAssociation";
export { MacConfiguration, DmgOptions, MasConfiguration, MacOsTargetName, DmgContent, DmgWindow } from "./options/macOptions";
export { PkgOptions, PkgBackgroundOptions, BackgroundAlignment, BackgroundScaling } from "./options/pkgOptions";
export { WindowsConfiguration } from "./options/winOptions";
export { AppXOptions } from "./options/AppXOptions";
export { MsiOptions } from "./options/MsiOptions";
export { CommonWindowsInstallerConfiguration } from "./options/CommonWindowsInstallerConfiguration";
export { NsisOptions, NsisWebOptions, PortableOptions, CommonNsisOptions } from "./targets/nsis/nsisOptions";
export { LinuxConfiguration, DebOptions, CommonLinuxOptions, LinuxTargetSpecificOptions, AppImageOptions } from "./options/linuxOptions";
export { SnapOptions } from "./options/SnapOptions";
export { Metadata, AuthorMetadata, RepositoryInfo } from "./options/metadata";
export { AppInfo } from "./appInfo";
export { SquirrelWindowsOptions } from "./options/SquirrelWindowsOptions";
export { WindowsSignOptions, CustomWindowsSignTaskConfiguration, WindowsSignTaskConfiguration, CustomWindowsSign, FileCodeSigningInfo, CertificateFromStoreInfo } from "./codeSign/windowsCodeSign";
export { CancellationToken, ProgressInfo } from "builder-util-runtime";
export { PublishOptions, UploadTask } from "electron-publish";
export { PublishManager } from "./publish/PublishManager";
export { PlatformPackager } from "./platformPackager";
export { Framework, PrepareApplicationStageDirectoryOptions } from "./Framework";
export { buildForge, ForgeOptions } from "./forge-maker";
export { SnapStoreOptions } from "./publish/SnapStorePublisher";
export declare function checkBuildRequestOptions(options: PackagerOptions & PublishOptions): void;
export declare function build(options: PackagerOptions & PublishOptions, packager?: Packager): Promise<Array<string>>;

243
app/node_modules/app-builder-lib/out/index.js generated vendored Normal file
View File

@@ -0,0 +1,243 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.checkBuildRequestOptions = checkBuildRequestOptions;
exports.build = build;
Object.defineProperty(exports, "getArchSuffix", {
enumerable: true,
get: function () {
return _builderUtil().getArchSuffix;
}
});
Object.defineProperty(exports, "Arch", {
enumerable: true,
get: function () {
return _builderUtil().Arch;
}
});
Object.defineProperty(exports, "archFromString", {
enumerable: true,
get: function () {
return _builderUtil().archFromString;
}
});
Object.defineProperty(exports, "CancellationToken", {
enumerable: true,
get: function () {
return _builderUtilRuntime().CancellationToken;
}
});
Object.defineProperty(exports, "Packager", {
enumerable: true,
get: function () {
return _packager().Packager;
}
});
Object.defineProperty(exports, "PlatformPackager", {
enumerable: true,
get: function () {
return _platformPackager().PlatformPackager;
}
});
Object.defineProperty(exports, "PublishManager", {
enumerable: true,
get: function () {
return _PublishManager().PublishManager;
}
});
Object.defineProperty(exports, "Platform", {
enumerable: true,
get: function () {
return _core().Platform;
}
});
Object.defineProperty(exports, "Target", {
enumerable: true,
get: function () {
return _core().Target;
}
});
Object.defineProperty(exports, "DIR_TARGET", {
enumerable: true,
get: function () {
return _core().DIR_TARGET;
}
});
Object.defineProperty(exports, "DEFAULT_TARGET", {
enumerable: true,
get: function () {
return _core().DEFAULT_TARGET;
}
});
Object.defineProperty(exports, "AppInfo", {
enumerable: true,
get: function () {
return _appInfo().AppInfo;
}
});
Object.defineProperty(exports, "buildForge", {
enumerable: true,
get: function () {
return _forgeMaker().buildForge;
}
});
function _promise() {
const data = require("builder-util/out/promise");
_promise = function () {
return data;
};
return data;
}
function _builderUtil() {
const data = require("builder-util");
_builderUtil = function () {
return data;
};
return data;
}
function _builderUtilRuntime() {
const data = require("builder-util-runtime");
_builderUtilRuntime = function () {
return data;
};
return data;
}
function _packager() {
const data = require("./packager");
_packager = function () {
return data;
};
return data;
}
function _platformPackager() {
const data = require("./platformPackager");
_platformPackager = function () {
return data;
};
return data;
}
function _PublishManager() {
const data = require("./publish/PublishManager");
_PublishManager = function () {
return data;
};
return data;
}
function _core() {
const data = require("./core");
_core = function () {
return data;
};
return data;
}
function _appInfo() {
const data = require("./appInfo");
_appInfo = function () {
return data;
};
return data;
}
function _forgeMaker() {
const data = require("./forge-maker");
_forgeMaker = function () {
return data;
};
return data;
}
const expectedOptions = new Set(["publish", "targets", "mac", "win", "linux", "projectDir", "platformPackagerFactory", "config", "effectiveOptionComputed", "prepackaged"]);
function checkBuildRequestOptions(options) {
for (const optionName of Object.keys(options)) {
if (!expectedOptions.has(optionName) && options[optionName] !== undefined) {
throw new (_builderUtil().InvalidConfigurationError)(`Unknown option "${optionName}"`);
}
}
}
function build(options, packager = new (_packager().Packager)(options)) {
checkBuildRequestOptions(options);
const publishManager = new (_PublishManager().PublishManager)(packager, options);
const sigIntHandler = () => {
_builderUtil().log.warn("cancelled by SIGINT");
packager.cancellationToken.cancel();
publishManager.cancelTasks();
};
process.once("SIGINT", sigIntHandler);
const promise = packager.build().then(async buildResult => {
const afterAllArtifactBuild = (0, _platformPackager().resolveFunction)(buildResult.configuration.afterAllArtifactBuild, "afterAllArtifactBuild");
if (afterAllArtifactBuild != null) {
const newArtifacts = (0, _builderUtilRuntime().asArray)((await Promise.resolve(afterAllArtifactBuild(buildResult))));
if (newArtifacts.length === 0 || !publishManager.isPublish) {
return buildResult.artifactPaths;
}
const publishConfigurations = await publishManager.getGlobalPublishConfigurations();
if (publishConfigurations == null || publishConfigurations.length === 0) {
return buildResult.artifactPaths;
}
for (const newArtifact of newArtifacts) {
buildResult.artifactPaths.push(newArtifact);
for (const publishConfiguration of publishConfigurations) {
publishManager.scheduleUpload(publishConfiguration, {
file: newArtifact,
arch: null
}, packager.appInfo);
}
}
}
return buildResult.artifactPaths;
});
return (0, _promise().executeFinally)(promise, isErrorOccurred => {
let promise;
if (isErrorOccurred) {
publishManager.cancelTasks();
promise = Promise.resolve(null);
} else {
promise = publishManager.awaitTasks();
}
return promise.then(() => process.removeListener("SIGINT", sigIntHandler));
});
}
// __ts-babel@6.0.4
//# sourceMappingURL=index.js.map

1
app/node_modules/app-builder-lib/out/index.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,12 @@
import { Arch } from "builder-util";
import { Target } from "./core";
import { LinuxConfiguration } from "./options/linuxOptions";
import { Packager } from "./packager";
import { PlatformPackager } from "./platformPackager";
export declare class LinuxPackager extends PlatformPackager<LinuxConfiguration> {
readonly executableName: string;
constructor(info: Packager);
readonly defaultTarget: Array<string>;
createTargets(targets: Array<string>, mapper: (name: string, factory: (outDir: string) => Target) => void): void;
}
export declare function toAppImageOrSnapArch(arch: Arch): string;

217
app/node_modules/app-builder-lib/out/linuxPackager.js generated vendored Normal file
View File

@@ -0,0 +1,217 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.toAppImageOrSnapArch = toAppImageOrSnapArch;
exports.LinuxPackager = void 0;
function _builderUtil() {
const data = require("builder-util");
_builderUtil = function () {
return data;
};
return data;
}
function _sanitizeFilename() {
const data = _interopRequireDefault(require("sanitize-filename"));
_sanitizeFilename = function () {
return data;
};
return data;
}
function _core() {
const data = require("./core");
_core = function () {
return data;
};
return data;
}
function _platformPackager() {
const data = require("./platformPackager");
_platformPackager = function () {
return data;
};
return data;
}
function _RemoteBuilder() {
const data = require("./remoteBuilder/RemoteBuilder");
_RemoteBuilder = function () {
return data;
};
return data;
}
function _LinuxTargetHelper() {
const data = require("./targets/LinuxTargetHelper");
_LinuxTargetHelper = function () {
return data;
};
return data;
}
function _targetFactory() {
const data = require("./targets/targetFactory");
_targetFactory = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
class LinuxPackager extends _platformPackager().PlatformPackager {
constructor(info) {
super(info, _core().Platform.LINUX);
const executableName = this.platformSpecificBuildOptions.executableName;
this.executableName = executableName == null ? this.appInfo.sanitizedName.toLowerCase() : (0, _sanitizeFilename().default)(executableName);
}
get defaultTarget() {
return ["snap", "appimage"];
}
createTargets(targets, mapper) {
let helper;
const getHelper = () => {
if (helper == null) {
helper = new (_LinuxTargetHelper().LinuxTargetHelper)(this);
}
return helper;
};
let remoteBuilder = null;
for (const name of targets) {
if (name === _core().DIR_TARGET) {
continue;
}
const targetClass = (() => {
switch (name) {
case "appimage":
return require("./targets/AppImageTarget").default;
case "snap":
return require("./targets/snap").default;
case "deb":
case "rpm":
case "sh":
case "freebsd":
case "pacman":
case "apk":
case "p5p":
return require("./targets/fpm").default;
default:
return null;
}
})();
mapper(name, outDir => {
if (targetClass === null) {
return (0, _targetFactory().createCommonTarget)(name, outDir, this);
}
const target = new targetClass(name, this, getHelper(), outDir);
if (process.platform === "win32" || process.env._REMOTE_BUILD) {
if (remoteBuilder == null) {
remoteBuilder = new (_RemoteBuilder().RemoteBuilder)(this);
} // return remoteBuilder.buildTarget(this, arch, appOutDir, this.packager)
return new RemoteTarget(target, remoteBuilder);
}
return target;
});
}
}
}
exports.LinuxPackager = LinuxPackager;
class RemoteTarget extends _core().Target {
constructor(target, remoteBuilder) {
super(target.name, true
/* all must be scheduled in time (so, on finishBuild RemoteBuilder will have all targets added - so, we must set isAsyncSupported to true (resolved promise is returned)) */
);
this.target = target;
this.remoteBuilder = remoteBuilder;
this.buildTaskManager = new (_builderUtil().AsyncTaskManager)(this.remoteBuilder.packager.info.cancellationToken);
}
get options() {
return this.target.options;
}
get outDir() {
return this.target.outDir;
}
async finishBuild() {
await this.buildTaskManager.awaitTasks();
await this.remoteBuilder.build();
}
build(appOutDir, arch) {
const promise = this.doBuild(appOutDir, arch);
this.buildTaskManager.addTask(promise);
return promise;
}
async doBuild(appOutDir, arch) {
_builderUtil().log.info({
target: this.target.name,
arch: _builderUtil().Arch[arch]
}, "scheduling remote build");
await this.target.checkOptions();
this.remoteBuilder.scheduleBuild(this.target, arch, appOutDir);
}
}
function toAppImageOrSnapArch(arch) {
switch (arch) {
case _builderUtil().Arch.x64:
return "x86_64";
case _builderUtil().Arch.ia32:
return "i386";
case _builderUtil().Arch.armv7l:
return "arm";
case _builderUtil().Arch.arm64:
return "arm_aarch64";
default:
throw new Error(`Unsupported arch ${arch}`);
}
}
// __ts-babel@6.0.4
//# sourceMappingURL=linuxPackager.js.map

File diff suppressed because one or more lines are too long

28
app/node_modules/app-builder-lib/out/macPackager.d.ts generated vendored Normal file
View File

@@ -0,0 +1,28 @@
import { Arch, AsyncTaskManager } from "builder-util";
import { SignOptions } from "../electron-osx-sign";
import { Lazy } from "lazy-val";
import { AppInfo } from "./appInfo";
import { CodeSigningInfo, Identity } from "./codeSign/macCodeSign";
import { Target } from "./core";
import { AfterPackContext } from "./index";
import { MacConfiguration } from "./options/macOptions";
import { Packager } from "./packager";
import { PlatformPackager } from "./platformPackager";
export default class MacPackager extends PlatformPackager<MacConfiguration> {
readonly codeSigningInfo: Lazy<CodeSigningInfo>;
private _iconPath;
constructor(info: Packager);
readonly defaultTarget: Array<string>;
protected prepareAppInfo(appInfo: AppInfo): AppInfo;
getIconPath(): Promise<string | null>;
createTargets(targets: Array<string>, mapper: (name: string, factory: (outDir: string) => Target) => void): void;
pack(outDir: string, arch: Arch, targets: Array<Target>, taskManager: AsyncTaskManager): Promise<any>;
private sign;
private adjustSignOptions;
protected doSign(opts: SignOptions): Promise<any>;
protected doFlat(appPath: string, outFile: string, identity: Identity, keychain: string | null | undefined): Promise<any>;
getElectronSrcDir(dist: string): string;
getElectronDestinationDir(appOutDir: string): string;
applyCommonInfo(appPlist: any, contentsPath: string): Promise<void>;
protected signApp(packContext: AfterPackContext, isAsar: boolean): Promise<any>;
}

524
app/node_modules/app-builder-lib/out/macPackager.js generated vendored Normal file
View File

@@ -0,0 +1,524 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
function _bluebirdLst() {
const data = _interopRequireDefault(require("bluebird-lst"));
_bluebirdLst = function () {
return data;
};
return data;
}
function _builderUtil() {
const data = require("builder-util");
_builderUtil = function () {
return data;
};
return data;
}
function _electronOsxSign() {
const data = require("../electron-osx-sign");
_electronOsxSign = function () {
return data;
};
return data;
}
function _fsExtra() {
const data = require("fs-extra");
_fsExtra = function () {
return data;
};
return data;
}
function _lazyVal() {
const data = require("lazy-val");
_lazyVal = function () {
return data;
};
return data;
}
var path = _interopRequireWildcard(require("path"));
function _fs() {
const data = require("builder-util/out/fs");
_fs = function () {
return data;
};
return data;
}
function _promise() {
const data = require("builder-util/out/promise");
_promise = function () {
return data;
};
return data;
}
function _appInfo() {
const data = require("./appInfo");
_appInfo = function () {
return data;
};
return data;
}
function _macCodeSign() {
const data = require("./codeSign/macCodeSign");
_macCodeSign = function () {
return data;
};
return data;
}
function _core() {
const data = require("./core");
_core = function () {
return data;
};
return data;
}
function _platformPackager() {
const data = require("./platformPackager");
_platformPackager = function () {
return data;
};
return data;
}
function _ArchiveTarget() {
const data = require("./targets/ArchiveTarget");
_ArchiveTarget = function () {
return data;
};
return data;
}
function _pkg() {
const data = require("./targets/pkg");
_pkg = function () {
return data;
};
return data;
}
function _targetFactory() {
const data = require("./targets/targetFactory");
_targetFactory = function () {
return data;
};
return data;
}
function _macosVersion() {
const data = require("./util/macosVersion");
_macosVersion = function () {
return data;
};
return data;
}
function _pathManager() {
const data = require("./util/pathManager");
_pathManager = function () {
return data;
};
return data;
}
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
class MacPackager extends _platformPackager().PlatformPackager {
constructor(info) {
super(info, _core().Platform.MAC);
this.codeSigningInfo = new (_lazyVal().Lazy)(() => {
const cscLink = this.getCscLink();
if (cscLink == null || process.platform !== "darwin") {
return Promise.resolve({
keychainFile: process.env.CSC_KEYCHAIN || null
});
}
return (0, _macCodeSign().createKeychain)({
tmpDir: this.info.tempDirManager,
cscLink,
cscKeyPassword: this.getCscPassword(),
cscILink: (0, _platformPackager().chooseNotNull)(this.platformSpecificBuildOptions.cscInstallerLink, process.env.CSC_INSTALLER_LINK),
cscIKeyPassword: (0, _platformPackager().chooseNotNull)(this.platformSpecificBuildOptions.cscInstallerKeyPassword, process.env.CSC_INSTALLER_KEY_PASSWORD),
currentDir: this.projectDir
}).then(result => {
const keychainFile = result.keychainFile;
if (keychainFile != null) {
this.info.disposeOnBuildFinish(() => (0, _macCodeSign().removeKeychain)(keychainFile));
}
return result;
});
});
this._iconPath = new (_lazyVal().Lazy)(() => this.getOrConvertIcon("icns"));
}
get defaultTarget() {
return this.info.framework.macOsDefaultTargets;
}
prepareAppInfo(appInfo) {
return new (_appInfo().AppInfo)(this.info, this.platformSpecificBuildOptions.bundleVersion, this.platformSpecificBuildOptions);
}
async getIconPath() {
return this._iconPath.value;
}
createTargets(targets, mapper) {
for (const name of targets) {
switch (name) {
case _core().DIR_TARGET:
break;
case "dmg":
const {
DmgTarget
} = require("dmg-builder");
mapper(name, outDir => new DmgTarget(this, outDir));
break;
case "zip":
// https://github.com/electron-userland/electron-builder/issues/2313
mapper(name, outDir => new (_ArchiveTarget().ArchiveTarget)(name, outDir, this, true));
break;
case "pkg":
mapper(name, outDir => new (_pkg().PkgTarget)(this, outDir));
break;
default:
mapper(name, outDir => name === "mas" || name === "mas-dev" ? new (_targetFactory().NoOpTarget)(name) : (0, _targetFactory().createCommonTarget)(name, outDir, this));
break;
}
}
}
async pack(outDir, arch, targets, taskManager) {
let nonMasPromise = null;
const hasMas = targets.length !== 0 && targets.some(it => it.name === "mas" || it.name === "mas-dev");
const prepackaged = this.packagerOptions.prepackaged;
if (!hasMas || targets.length > 1) {
const appPath = prepackaged == null ? path.join(this.computeAppOutDir(outDir, arch), `${this.appInfo.productFilename}.app`) : prepackaged;
nonMasPromise = (prepackaged ? Promise.resolve() : this.doPack(outDir, path.dirname(appPath), this.platform.nodeName, arch, this.platformSpecificBuildOptions, targets)).then(() => this.packageInDistributableFormat(appPath, _builderUtil().Arch.x64, targets, taskManager));
}
for (const target of targets) {
const targetName = target.name;
if (!(targetName === "mas" || targetName === "mas-dev")) {
continue;
}
const masBuildOptions = (0, _builderUtil().deepAssign)({}, this.platformSpecificBuildOptions, this.config.mas);
if (targetName === "mas-dev") {
(0, _builderUtil().deepAssign)(masBuildOptions, this.config.masDev, {
type: "development"
});
}
const targetOutDir = path.join(outDir, targetName);
if (prepackaged == null) {
await this.doPack(outDir, targetOutDir, "mas", arch, masBuildOptions, [target]);
await this.sign(path.join(targetOutDir, `${this.appInfo.productFilename}.app`), targetOutDir, masBuildOptions);
} else {
await this.sign(prepackaged, targetOutDir, masBuildOptions);
}
}
if (nonMasPromise != null) {
await nonMasPromise;
}
}
async sign(appPath, outDir, masOptions) {
if (!(0, _macCodeSign().isSignAllowed)()) {
return;
}
const isMas = masOptions != null;
const options = masOptions == null ? this.platformSpecificBuildOptions : masOptions;
const qualifier = options.identity;
if (!isMas && qualifier === null) {
if (this.forceCodeSigning) {
throw new (_builderUtil().InvalidConfigurationError)("identity explicitly is set to null, but forceCodeSigning is set to true");
}
_builderUtil().log.info({
reason: "identity explicitly is set to null"
}, "skipped macOS code signing");
return;
}
const keychainFile = (await this.codeSigningInfo.value).keychainFile;
const explicitType = options.type;
const type = explicitType || "distribution";
const isDevelopment = type === "development";
const certificateType = getCertificateType(isMas, isDevelopment);
let identity = await (0, _macCodeSign().findIdentity)(certificateType, qualifier, keychainFile);
if (identity == null) {
if (!isMas && !isDevelopment && explicitType !== "distribution") {
identity = await (0, _macCodeSign().findIdentity)("Mac Developer", qualifier, keychainFile);
if (identity != null) {
_builderUtil().log.warn("Mac Developer is used to sign app — it is only for development and testing, not for production");
}
}
if (identity == null) {
await (0, _macCodeSign().reportError)(isMas, certificateType, qualifier, keychainFile, this.forceCodeSigning);
return;
}
}
if (!(0, _macosVersion().isMacOsHighSierra)()) {
throw new (_builderUtil().InvalidConfigurationError)("macOS High Sierra 10.13.6 is required to sign");
}
const signOptions = {
"identity-validation": false,
// https://github.com/electron-userland/electron-builder/issues/1699
// kext are signed by the chipset manufacturers. You need a special certificate (only available on request) from Apple to be able to sign kext.
ignore: file => {
return file.endsWith(".kext") || file.startsWith("/Contents/PlugIns", appPath.length) || // https://github.com/electron-userland/electron-builder/issues/2010
file.includes("/node_modules/puppeteer/.local-chromium");
},
identity: identity,
type,
platform: isMas ? "mas" : "darwin",
version: this.config.electronVersion,
app: appPath,
keychain: keychainFile || undefined,
binaries: options.binaries || undefined,
requirements: isMas || this.platformSpecificBuildOptions.requirements == null ? undefined : await this.getResource(this.platformSpecificBuildOptions.requirements),
// https://github.com/electron-userland/electron-osx-sign/issues/196
// will fail on 10.14.5+ because a signed but unnotarized app is also rejected.
"gatekeeper-assess": options.gatekeeperAssess === true,
hardenedRuntime: options.hardenedRuntime !== false
};
await this.adjustSignOptions(signOptions, masOptions);
_builderUtil().log.info({
file: _builderUtil().log.filePath(appPath),
identityName: identity.name,
identityHash: identity.hash,
provisioningProfile: signOptions["provisioning-profile"] || "none"
}, "signing");
await this.doSign(signOptions); // https://github.com/electron-userland/electron-builder/issues/1196#issuecomment-312310209
if (masOptions != null && !isDevelopment) {
const certType = isDevelopment ? "Mac Developer" : "3rd Party Mac Developer Installer";
const masInstallerIdentity = await (0, _macCodeSign().findIdentity)(certType, masOptions.identity, keychainFile);
if (masInstallerIdentity == null) {
throw new (_builderUtil().InvalidConfigurationError)(`Cannot find valid "${certType}" identity to sign MAS installer, please see https://electron.build/code-signing`);
} // mas uploaded to AppStore, so, use "-" instead of space for name
const artifactName = this.expandArtifactNamePattern(masOptions, "pkg");
const artifactPath = path.join(outDir, artifactName);
await this.doFlat(appPath, artifactPath, masInstallerIdentity, keychainFile);
await this.dispatchArtifactCreated(artifactPath, null, _builderUtil().Arch.x64, this.computeSafeArtifactName(artifactName, "pkg"));
}
}
async adjustSignOptions(signOptions, masOptions) {
const resourceList = await this.resourceList;
const customSignOptions = masOptions || this.platformSpecificBuildOptions;
const entitlementsSuffix = masOptions == null ? "mac" : "mas";
let entitlements = customSignOptions.entitlements;
if (entitlements == null) {
const p = `entitlements.${entitlementsSuffix}.plist`;
if (resourceList.includes(p)) {
entitlements = path.join(this.info.buildResourcesDir, p);
} else {
entitlements = (0, _pathManager().getTemplatePath)("entitlements.mac.plist");
}
}
signOptions.entitlements = entitlements;
let entitlementsInherit = customSignOptions.entitlementsInherit;
if (entitlementsInherit == null) {
const p = `entitlements.${entitlementsSuffix}.inherit.plist`;
if (resourceList.includes(p)) {
entitlementsInherit = path.join(this.info.buildResourcesDir, p);
} else {
entitlementsInherit = (0, _pathManager().getTemplatePath)("entitlements.mac.plist");
}
}
signOptions["entitlements-inherit"] = entitlementsInherit;
if (customSignOptions.provisioningProfile != null) {
signOptions["provisioning-profile"] = customSignOptions.provisioningProfile;
}
} //noinspection JSMethodCanBeStatic
async doSign(opts) {
return (0, _electronOsxSign().signAsync)(opts);
} //noinspection JSMethodCanBeStatic
async doFlat(appPath, outFile, identity, keychain) {
// productbuild doesn't created directory for out file
await (0, _fsExtra().mkdirs)(path.dirname(outFile));
const args = (0, _pkg().prepareProductBuildArgs)(identity, keychain);
args.push("--component", appPath, "/Applications");
args.push(outFile);
return await (0, _builderUtil().exec)("productbuild", args);
}
getElectronSrcDir(dist) {
return path.resolve(this.projectDir, dist, this.info.framework.distMacOsAppName);
}
getElectronDestinationDir(appOutDir) {
return path.join(appOutDir, this.info.framework.distMacOsAppName);
} // todo fileAssociations
async applyCommonInfo(appPlist, contentsPath) {
const appInfo = this.appInfo;
const appFilename = appInfo.productFilename; // https://github.com/electron-userland/electron-builder/issues/1278
appPlist.CFBundleExecutable = appFilename.endsWith(" Helper") ? appFilename.substring(0, appFilename.length - " Helper".length) : appFilename;
const icon = await this.getIconPath();
if (icon != null) {
const oldIcon = appPlist.CFBundleIconFile;
const resourcesPath = path.join(contentsPath, "Resources");
if (oldIcon != null) {
await (0, _fs().unlinkIfExists)(path.join(resourcesPath, oldIcon));
}
const iconFileName = `${appFilename}.icns`;
appPlist.CFBundleIconFile = iconFileName;
await (0, _fs().copyFile)(icon, path.join(resourcesPath, iconFileName));
}
appPlist.CFBundleName = appInfo.productName;
appPlist.CFBundleDisplayName = appInfo.productName;
const minimumSystemVersion = this.platformSpecificBuildOptions.minimumSystemVersion;
if (minimumSystemVersion != null) {
appPlist.LSMinimumSystemVersion = minimumSystemVersion;
}
appPlist.CFBundleIdentifier = appInfo.macBundleIdentifier;
appPlist.CFBundleShortVersionString = this.platformSpecificBuildOptions.bundleShortVersion || appInfo.version;
appPlist.CFBundleVersion = appInfo.buildVersion;
(0, _builderUtil().use)(this.platformSpecificBuildOptions.category || this.config.category, it => appPlist.LSApplicationCategoryType = it);
appPlist.NSHumanReadableCopyright = appInfo.copyright;
if (this.platformSpecificBuildOptions.darkModeSupport) {
appPlist.NSRequiresAquaSystemAppearance = false;
}
const extendInfo = this.platformSpecificBuildOptions.extendInfo;
if (extendInfo != null) {
Object.assign(appPlist, extendInfo);
}
}
async signApp(packContext, isAsar) {
const appFileName = `${this.appInfo.productFilename}.app`;
await _bluebirdLst().default.map((0, _fsExtra().readdir)(packContext.appOutDir), file => {
if (file === appFileName) {
return this.sign(path.join(packContext.appOutDir, file), null, null);
}
return null;
});
if (!isAsar) {
return;
}
const outResourcesDir = path.join(packContext.appOutDir, "resources", "app.asar.unpacked");
await _bluebirdLst().default.map((0, _promise().orIfFileNotExist)((0, _fsExtra().readdir)(outResourcesDir), []), file => {
if (file.endsWith(".app")) {
return this.sign(path.join(outResourcesDir, file), null, null);
} else {
return null;
}
});
}
}
exports.default = MacPackager;
function getCertificateType(isMas, isDevelopment) {
if (isDevelopment) {
return "Mac Developer";
}
return isMas ? "3rd Party Mac Developer Application" : "Developer ID Application";
}
// __ts-babel@6.0.4
//# sourceMappingURL=macPackager.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,57 @@
import { TargetSpecificOptions } from "../core";
export interface AppXOptions extends TargetSpecificOptions {
/**
* The application id. Defaults to `identityName`. Cant start with numbers.
*/
readonly applicationId?: string;
/**
* The background color of the app tile. See [Visual Elements](https://msdn.microsoft.com/en-us/library/windows/apps/br211471.aspx).
* @default #464646
*/
readonly backgroundColor?: string | null;
/**
* A friendly name that can be displayed to users. Corresponds to [Properties.DisplayName](https://msdn.microsoft.com/en-us/library/windows/apps/br211432.aspx).
* Defaults to the application product name.
*/
readonly displayName?: string | null;
/**
* The name. Corresponds to [Identity.Name](https://msdn.microsoft.com/en-us/library/windows/apps/br211441.aspx). Defaults to the [application name](/configuration/configuration#Metadata-name).
*/
readonly identityName?: string | null;
/**
* The Windows Store publisher. Not used if AppX is build for testing. See [AppX Package Code Signing](#appx-package-code-signing) below.
*/
readonly publisher?: string | null;
/**
* A friendly name for the publisher that can be displayed to users. Corresponds to [Properties.PublisherDisplayName](https://msdn.microsoft.com/en-us/library/windows/apps/br211460.aspx).
* Defaults to company name from the application metadata.
*/
readonly publisherDisplayName?: string | null;
/**
* The list of [supported languages](https://docs.microsoft.com/en-us/windows/uwp/globalizing/manage-language-and-region#specify-the-supported-languages-in-the-apps-manifest) that will be listed in the Windows Store.
* The first entry (index 0) will be the default language.
* Defaults to en-US if omitted.
*/
readonly languages?: Array<string> | string | null;
/**
* Whether to add auto launch extension. Defaults to `true` if [electron-winstore-auto-launch](https://github.com/felixrieseberg/electron-winstore-auto-launch) in the dependencies.
*/
readonly addAutoLaunchExtension?: boolean;
/**
* Whether to overlay the app's name on top of tile images on the Start screen. Defaults to `false`. (https://docs.microsoft.com/en-us/uwp/schemas/appxpackage/uapmanifestschema/element-uap-shownameontiles) in the dependencies.
* @default false
*/
readonly showNameOnTiles?: boolean;
/**
* @private
* @default false
*/
readonly electronUpdaterAware?: boolean;
/**
* Whether to set build number. See https://github.com/electron-userland/electron-builder/issues/3875
* @default false
*/
readonly setBuildNumber?: boolean;
/** @private */
readonly makeappxArgs?: Array<string> | null;
}

View File

@@ -0,0 +1,3 @@
"use strict";
// __ts-babel@6.0.4
//# sourceMappingURL=AppXOptions.js.map

Some files were not shown because too many files have changed in this diff Show More