diff --git a/src/compiler.ts b/src/compiler.ts index 60a0f1b..c18ac7f 100644 --- a/src/compiler.ts +++ b/src/compiler.ts @@ -1,6 +1,5 @@ import { delimiter, dirname, normalize, join } from 'path' import { Buffer } from 'buffer' -import { createHash } from 'crypto' import { createReadStream } from 'fs' import { Readable } from 'stream' import { spawn } from 'child_process' diff --git a/src/nexe.ts b/src/nexe.ts index 1c207f2..b6958c9 100644 --- a/src/nexe.ts +++ b/src/nexe.ts @@ -1,6 +1,5 @@ import { EOL } from 'os' -import { compose, Middleware } from 'app-builder' -import { NexeTarget } from './target' +import { compose } from 'app-builder' import { NexeCompiler } from './compiler' import { normalizeOptions, NexeOptions, NexePatch } from './options' import resource from './steps/resource' @@ -18,7 +17,6 @@ async function compile( ) { const options = normalizeOptions(compilerOptions) const compiler = new NexeCompiler(options) - const build = options.build const nexe = compose( clean, diff --git a/src/options.ts b/src/options.ts index 99d9072..1782999 100644 --- a/src/options.ts +++ b/src/options.ts @@ -1,7 +1,7 @@ import * as parseArgv from 'minimist' import { NexeCompiler } from './compiler' -import { isWindows, padRight } from './util' -import { basename, extname, join, isAbsolute, relative, dirname, resolve } from 'path' +import { isWindows } from './util' +import { basename, extname, join, isAbsolute, resolve } from 'path' import { getTarget, NexeTarget } from './target' import { EOL, homedir } from 'os' import chalk from 'chalk' diff --git a/src/patches/boot-nexe.ts b/src/patches/boot-nexe.ts index c4e4033..f47acb5 100644 --- a/src/patches/boot-nexe.ts +++ b/src/patches/boot-nexe.ts @@ -48,6 +48,6 @@ const contentBuffer = Buffer.from(Array(contentSize)) fs.readSync(fd, contentBuffer, 0, contentSize, contentStart) fs.closeSync(fd) const Module = require('module') -process.mainModule = new Module(process.execPath, null) -process.mainModule!.loaded = true -;(process.mainModule as any)._compile(contentBuffer.toString(), process.execPath) +const mod = new Module(process.execPath, null) +mod.loaded = true +mod._compile(contentBuffer.toString(), process.execPath) diff --git a/src/patches/index.ts b/src/patches/index.ts index b071446..9d4ad5c 100644 --- a/src/patches/index.ts +++ b/src/patches/index.ts @@ -5,7 +5,6 @@ import cli from './disable-node-cli' import flags from './flags' import ico from './ico' import rc from './node-rc' -import { NexeCompiler, NexeOptions } from '../compiler' const patches = [gyp, bootNexe, buildFixes, cli, flags, ico, rc] diff --git a/src/patches/third-party-main.ts b/src/patches/third-party-main.ts index d13bf27..e3d3050 100644 --- a/src/patches/third-party-main.ts +++ b/src/patches/third-party-main.ts @@ -1,7 +1,4 @@ import { NexeCompiler } from '../compiler' -import { readFileSync } from 'fs' -import { join } from 'path' -import { wrap } from '../util' function semverGt(version: string, operand: string) { const [cMajor, cMinor, cPatch] = version.split('.').map(Number) diff --git a/src/releases.ts b/src/releases.ts index b00244e..7921e36 100644 --- a/src/releases.ts +++ b/src/releases.ts @@ -1,14 +1,5 @@ import got = require('got') -import download = require('download') -import { - NodePlatform, - NodeArch, - platforms, - architectures, - NexeTarget, - getTarget, - targetsEqual -} from './target' +import { platforms, architectures, NexeTarget, getTarget, targetsEqual } from './target' export { NexeTarget } const versionsToSkip = [0, 1, 2, 3, 4, 5, 7, 9, 11] diff --git a/src/steps/bundle.ts b/src/steps/bundle.ts index 0386532..9f63cc5 100644 --- a/src/steps/bundle.ts +++ b/src/steps/bundle.ts @@ -1,7 +1,6 @@ import { NexeCompiler } from '../compiler' import { readFileAsync, writeFileAsync } from '../util' import { resolve, relative } from 'path' -import { NexeOptions } from '../options' import resolveFiles from 'resolve-dependencies' function makeRelative(cwd: string, path: string) { diff --git a/src/steps/cli.ts b/src/steps/cli.ts index dbd23fb..b777a74 100644 --- a/src/steps/cli.ts +++ b/src/steps/cli.ts @@ -1,7 +1,6 @@ import { normalize, relative } from 'path' -import { Readable } from 'stream' import { createWriteStream, chmodSync, statSync } from 'fs' -import { readFileAsync, dequote, isWindows } from '../util' +import { dequote } from '../util' import { NexeCompiler } from '../compiler' import { NexeTarget } from '../target' diff --git a/src/steps/download.ts b/src/steps/download.ts index 738664e..780e9e1 100644 --- a/src/steps/download.ts +++ b/src/steps/download.ts @@ -3,7 +3,6 @@ import { pathExistsAsync } from '../util' import { LogStep } from '../logger' import { IncomingMessage } from 'http' import { NexeCompiler } from '../compiler' -import { NexeTarget } from '../target' function fetchNodeSourceAsync(dest: string, url: string, step: LogStep, options = {}) { const setText = (p: number) => step.modify(`Downloading Node: ${p.toFixed()}%...`) diff --git a/src/steps/resource.ts b/src/steps/resource.ts index 229eba8..c2899d1 100644 --- a/src/steps/resource.ts +++ b/src/steps/resource.ts @@ -1,5 +1,4 @@ import { readFileAsync, isDirectoryAsync, each } from '../util' -import { Buffer } from 'buffer' import * as globs from 'globby' import { NexeCompiler } from '../compiler'