Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor(platform, pathspec, opts) {
assert(opts && 'object' === typeof opts, '`opts` is not an object.')
assert('string' === typeof opts.output, '`opts.output` is not a string.')
const host = system.toFancyPlatform(opts.platform || platform.host)
const { type = DEFAULT_TYPE } = opts
assert('string' === typeof type, '`opts.type` is not a string.')
const basename = path.basename(pathspec)
const extname = path.extname(pathspec)
if (Array.isArray(opts.assets)) {
this.assets = opts.assets
.filter(Boolean)
.map((asset) => 'string' === typeof asset
? asset.split(':')
: asset)
.map((tuple) => Array.isArray(tuple) && 2 === tuple.length
? ({ from: tuple[0], to: tuple[1] })
: tuple)
const { Builder } = require('./builder')
const { system } = require('pkg-fetch')
const assert = require('assert')
const mkdirp = require('mkdirp')
const Batch = require('batch')
const debug = require('debug')('pkg-packager')
const path = require('path')
/**
* The host platform name in fancy form for `pkg`.
* @private
*/
const PKG_PLATFORM = system.toFancyPlatform(process.platform)
/**
* The default builder type based on `PKG_PLATFORM`.
* @private
*/
const DEFAULT_TYPE = ({
linux: 'appimage',
macos: 'appdmg',
win: 'exe',
})[PKG_PLATFORM]
/**
* The `Target` class represents a container for
* a packaging builder target. Builders are loaded based
* on platform information and target configuration.
* @public