fix(patches): third_party_main file patch regression
This commit is contained in:
Generated
+612
-11010
File diff suppressed because it is too large
Load Diff
+16
-17
@@ -2,7 +2,7 @@
|
||||
"name": "nexe",
|
||||
"description": "Create a single executable out of your Node.js application",
|
||||
"license": "MIT",
|
||||
"version": "2.0.0-next.11",
|
||||
"version": "2.0.0-next.12",
|
||||
"contributors": [
|
||||
"Craig Condon <craig.j.condon@gmail.com> (http://crcn.io)",
|
||||
"Jared Allard <jaredallard@outlook.com>",
|
||||
@@ -35,37 +35,36 @@
|
||||
"dependencies": {
|
||||
"app-builder": "^5.2.0",
|
||||
"caw": "^2.0.1",
|
||||
"chalk": "^2.3.2",
|
||||
"download": "^6.2.5",
|
||||
"chalk": "^2.4.1",
|
||||
"download": "^7.0.0",
|
||||
"globby": "^8.0.1",
|
||||
"got": "^8.3.0",
|
||||
"got": "^8.3.1",
|
||||
"minimist": "^1.2.0",
|
||||
"mkdirp": "^0.5.1",
|
||||
"ora": "^2.0.0",
|
||||
"ora": "^2.1.0",
|
||||
"pify": "^3.0.0",
|
||||
"resolve-dependencies": "^1.2.1-next",
|
||||
"rimraf": "^2.6.2",
|
||||
"semver": "^5.5.0"
|
||||
"resolve-dependencies": "^2.0.0",
|
||||
"rimraf": "^2.6.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/chai": "^4.1.2",
|
||||
"@types/chai": "^4.1.3",
|
||||
"@types/execa": "^0.9.0",
|
||||
"@types/globby": "^6.1.0",
|
||||
"@types/minimist": "^1.2.0",
|
||||
"@types/mkdirp": "^0.5.2",
|
||||
"@types/mocha": "^5.0.0",
|
||||
"@types/mocha": "^5.2.0",
|
||||
"@types/ora": "^1.3.4",
|
||||
"@types/pify": "3.0.1",
|
||||
"@types/pify": "3.0.2",
|
||||
"@types/rimraf": "2.0.2",
|
||||
"@types/semver": "^5.5.0",
|
||||
"chai": "^4.1.2",
|
||||
"execa": "^0.10.0",
|
||||
"mocha": "^5.0.5",
|
||||
"prettier": "^1.11.1",
|
||||
"ts-node": "5.0.1",
|
||||
"tslint": "^5.9.1",
|
||||
"tslint-config-prettier": "^1.10.0",
|
||||
"mocha": "^5.1.1",
|
||||
"prettier": "^1.12.1",
|
||||
"ts-node": "6.0.3",
|
||||
"tslint": "^5.10.0",
|
||||
"tslint-config-prettier": "^1.12.0",
|
||||
"tslint-plugin-prettier": "^1.3.0",
|
||||
"typescript": "2.7.2"
|
||||
"typescript": "2.8.3"
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -5,7 +5,7 @@ import { basename, extname, join, isAbsolute, relative, dirname, resolve } from
|
||||
import { getTarget, NexeTarget } from './target'
|
||||
import { EOL, homedir } from 'os'
|
||||
import chalk from 'chalk'
|
||||
import { resolveFileName } from 'resolve-dependencies'
|
||||
import { resolveFileNameSync } from 'resolve-dependencies'
|
||||
const caw = require('caw')
|
||||
const c = process.platform === 'win32' ? chalk.constructor({ enabled: false }) : chalk
|
||||
|
||||
@@ -194,17 +194,17 @@ export function resolveEntry(input: string, cwd: string, maybeEntry?: string) {
|
||||
if (!input.startsWith('.')) {
|
||||
prefix = './'
|
||||
}
|
||||
result = resolveFileName(cwd, prefix + input, { silent: true })
|
||||
result = resolveFileNameSync(cwd, prefix + input)
|
||||
}
|
||||
if (isEntryFile(maybeEntry)) {
|
||||
result = resolveFileName(cwd, maybeEntry, { silent: true })
|
||||
result = resolveFileNameSync(cwd, maybeEntry)
|
||||
}
|
||||
if (!process.stdin.isTTY) {
|
||||
return ''
|
||||
}
|
||||
|
||||
if (!result || !result.absPath) {
|
||||
result = resolveFileName(cwd, '.', { silent: true })
|
||||
result = resolveFileNameSync(cwd, '.')
|
||||
}
|
||||
|
||||
if (!result.absPath) throw new Error(`Entry file "${input}" not found!`)
|
||||
|
||||
@@ -1,16 +1,26 @@
|
||||
import { NexeCompiler } from '../compiler'
|
||||
import { readFileSync } from 'fs'
|
||||
import semver = require('semver')
|
||||
import { join } from 'path'
|
||||
import { wrap } from '../util'
|
||||
|
||||
function semverGt(version: string, operand: string) {
|
||||
const [cMajor, cMinor, cPatch] = version.split('.').map(Number)
|
||||
const [major, minor, patch] = operand.split('.').map(Number)
|
||||
|
||||
return (
|
||||
cMajor > major ||
|
||||
(cMajor === major && cMinor > minor) ||
|
||||
(cMajor === major && cMinor === minor && cPatch > patch)
|
||||
)
|
||||
}
|
||||
|
||||
export default async function main(compiler: NexeCompiler, next: () => Promise<void>) {
|
||||
let bootFile = 'lib/internal/bootstrap_node.js'
|
||||
const { version } = compiler.target
|
||||
|
||||
if (semver.satisfies(version, '4')) {
|
||||
if (version.startsWith('4.')) {
|
||||
bootFile = 'src/node.js'
|
||||
} else if (semver.gt(version, '9.10.1')) {
|
||||
} else if (semverGt(version, '9.10.1')) {
|
||||
bootFile = 'lib/internal/boostrap/node.js'
|
||||
}
|
||||
|
||||
@@ -18,11 +28,13 @@ export default async function main(compiler: NexeCompiler, next: () => Promise<v
|
||||
matches = file.contents.match(/\(function.*/),
|
||||
functionHeader = matches && matches[0]
|
||||
|
||||
console.log('header', functionHeader)
|
||||
|
||||
if (!functionHeader) {
|
||||
throw new Error('Failed to find bootstrap header in node version: v' + version)
|
||||
}
|
||||
|
||||
file.contents.replace(
|
||||
file.contents = file.contents.replace(
|
||||
functionHeader,
|
||||
functionHeader + '\n' + '{{replace:lib/patches/bootstrap.js}}'
|
||||
)
|
||||
|
||||
@@ -28,7 +28,11 @@ function fetchNodeSourceAsync(dest: string, url: string, step: LogStep, options
|
||||
* @param {*} next
|
||||
*/
|
||||
export default async function downloadNode(compiler: NexeCompiler, next: () => Promise<void>) {
|
||||
const { src, log, targets: [{ version }] } = compiler
|
||||
const {
|
||||
src,
|
||||
log,
|
||||
targets: [{ version }]
|
||||
} = compiler
|
||||
const { sourceUrl, downloadOptions } = compiler.options
|
||||
const url = sourceUrl || `https://nodejs.org/dist/v${version}/node-v${version}.tar.gz`
|
||||
const step = log.step(`Downloading Node.js source from: ${url}`)
|
||||
|
||||
Reference in New Issue
Block a user