Comparing version 10.1.0 to 10.2.0
{ | ||
".": "10.1.0" | ||
".": "10.2.0" | ||
} |
'use strict' | ||
const fs = require('graceful-fs').promises | ||
const gracefulFs = require('graceful-fs') | ||
const fs = gracefulFs.promises | ||
const path = require('path') | ||
@@ -88,7 +89,13 @@ const { glob } = require('glob') | ||
if (files.length === 0) { | ||
throw new Error('Could not find *.sln file. Did you run "configure"?') | ||
if (gracefulFs.existsSync('build/Makefile') || (await glob('build/*.mk')).length !== 0) { | ||
command = makeCommand | ||
await doWhich(false) | ||
return | ||
} else { | ||
throw new Error('Could not find *.sln file or Makefile. Did you run "configure"?') | ||
} | ||
} | ||
guessedSolution = files[0] | ||
log.verbose('found first Solution file', guessedSolution) | ||
await doWhich() | ||
await doWhich(true) | ||
} | ||
@@ -100,5 +107,5 @@ | ||
async function doWhich () { | ||
async function doWhich (msvs) { | ||
// On Windows use msbuild provided by node-gyp configure | ||
if (win) { | ||
if (msvs) { | ||
if (!config.variables.msbuild_path) { | ||
@@ -109,3 +116,3 @@ throw new Error('MSBuild is not set, please run `node-gyp configure`.') | ||
log.verbose('using MSBuild:', command) | ||
await doBuild() | ||
await doBuild(msvs) | ||
return | ||
@@ -117,3 +124,3 @@ } | ||
log.verbose('`which` succeeded for `' + command + '`', execPath) | ||
await doBuild() | ||
await doBuild(msvs) | ||
} | ||
@@ -125,3 +132,3 @@ | ||
async function doBuild () { | ||
async function doBuild (msvs) { | ||
// Enable Verbose build | ||
@@ -131,11 +138,11 @@ const verbose = log.logger.isVisible('verbose') | ||
if (!win && verbose) { | ||
if (!msvs && verbose) { | ||
argv.push('V=1') | ||
} | ||
if (win && !verbose) { | ||
if (msvs && !verbose) { | ||
argv.push('/clp:Verbosity=minimal') | ||
} | ||
if (win) { | ||
if (msvs) { | ||
// Turn off the Microsoft logo on Windows | ||
@@ -146,3 +153,3 @@ argv.push('/nologo') | ||
// Specify the build type, Release by default | ||
if (win) { | ||
if (msvs) { | ||
// Convert .gypi config target_arch to MSBuild /Platform | ||
@@ -183,3 +190,3 @@ // Since there are many ways to state '32-bit Intel', default to it. | ||
if (win) { | ||
if (msvs) { | ||
// did the user specify their own .sln file? | ||
@@ -186,0 +193,0 @@ const hasSln = argv.some(function (arg) { |
@@ -95,4 +95,24 @@ 'use strict' | ||
) | ||
const vsInfo = win ? await findVisualStudio(release.semver, gyp.opts['msvs-version']) : null | ||
return createConfigFile(vsInfo) | ||
if (win) { | ||
let usingMakeGenerator = false | ||
for (let i = argv.length - 1; i >= 0; --i) { | ||
const arg = argv[i] | ||
if (arg === '-f' || arg === '--format') { | ||
const format = argv[i + 1] | ||
if (typeof format === 'string' && format.startsWith('make')) { | ||
usingMakeGenerator = true | ||
break | ||
} | ||
} else if (arg.startsWith('--format=make')) { | ||
usingMakeGenerator = true | ||
break | ||
} | ||
} | ||
let vsInfo = {} | ||
if (!usingMakeGenerator) { | ||
vsInfo = await findVisualStudio(release.semver, gyp.opts['msvs-version']) | ||
} | ||
return createConfigFile(vsInfo) | ||
} | ||
return createConfigFile(null) | ||
} | ||
@@ -99,0 +119,0 @@ |
@@ -57,4 +57,6 @@ 'use strict' | ||
const checks = [ | ||
() => this.findVisualStudio2019OrNewerFromSpecifiedLocation(), | ||
() => this.findVisualStudio2019OrNewerUsingSetupModule(), | ||
() => this.findVisualStudio2019OrNewer(), | ||
() => this.findVisualStudio2017FromSpecifiedLocation(), | ||
() => this.findVisualStudio2017UsingSetupModule(), | ||
@@ -120,2 +122,44 @@ () => this.findVisualStudio2017(), | ||
async findVisualStudio2019OrNewerFromSpecifiedLocation () { | ||
return this.findVSFromSpecifiedLocation([2019, 2022]) | ||
} | ||
async findVisualStudio2017FromSpecifiedLocation () { | ||
if (this.nodeSemver.major >= 22) { | ||
this.addLog( | ||
'not looking for VS2017 as it is only supported up to Node.js 21') | ||
return null | ||
} | ||
return this.findVSFromSpecifiedLocation([2017]) | ||
} | ||
async findVSFromSpecifiedLocation (supportedYears) { | ||
if (!this.envVcInstallDir) { | ||
return null | ||
} | ||
const info = { | ||
path: path.resolve(this.envVcInstallDir), | ||
// Assume the version specified by the user is correct. | ||
// Since Visual Studio 2015, the Developer Command Prompt sets the | ||
// VSCMD_VER environment variable which contains the version information | ||
// for Visual Studio. | ||
// https://learn.microsoft.com/en-us/visualstudio/ide/reference/command-prompt-powershell?view=vs-2022 | ||
version: process.env.VSCMD_VER, | ||
packages: [ | ||
'Microsoft.VisualStudio.Component.VC.Tools.x86.x64', | ||
// Assume MSBuild exists. It will be checked in processing. | ||
'Microsoft.VisualStudio.VC.MSBuild.Base' | ||
] | ||
} | ||
// Is there a better way to get SDK information? | ||
const envWindowsSDKVersion = process.env.WindowsSDKVersion | ||
const sdkVersionMatched = envWindowsSDKVersion?.match(/^(\d+)\.(\d+)\.(\d+)\..*/) | ||
if (sdkVersionMatched) { | ||
info.packages.push(`Microsoft.VisualStudio.Component.Windows10SDK.${sdkVersionMatched[3]}.Desktop`) | ||
} | ||
// pass for further processing | ||
return this.processData([info], supportedYears) | ||
} | ||
async findVisualStudio2019OrNewerUsingSetupModule () { | ||
@@ -326,3 +370,3 @@ return this.findNewVSUsingSetupModule([2019, 2022]) | ||
getVersionInfo (info) { | ||
const match = /^(\d+)\.(\d+)\..*/.exec(info.version) | ||
const match = /^(\d+)\.(\d+)(?:\..*)?/.exec(info.version) | ||
if (!match) { | ||
@@ -369,3 +413,7 @@ this.log.silly('- failed to parse version:', info.version) | ||
if (versionYear === 2019) { | ||
return msbuildPath | ||
if (process.arch === 'arm64' && this.msBuildPathExists(msbuildPathArm64)) { | ||
return msbuildPathArm64 | ||
} else { | ||
return msbuildPath | ||
} | ||
} | ||
@@ -372,0 +420,0 @@ } |
'use strict' | ||
const procLog = require('proc-log') | ||
const { log } = require('proc-log') | ||
const { format } = require('util') | ||
// helper to emit log messages with a predefined prefix | ||
const logLevels = Object.keys(procLog).filter((k) => typeof procLog[k] === 'function') | ||
const withPrefix = (prefix) => logLevels.reduce((acc, level) => { | ||
acc[level] = (...args) => procLog[level](prefix, ...args) | ||
const withPrefix = (prefix) => log.LEVELS.reduce((acc, level) => { | ||
acc[level] = (...args) => log[level](prefix, ...args) | ||
return acc | ||
@@ -81,3 +80,3 @@ }, {}) | ||
this.stream = stream | ||
procLog.pause() | ||
log.pause() | ||
} | ||
@@ -169,3 +168,3 @@ | ||
withPrefix, | ||
...procLog | ||
...log | ||
} |
@@ -14,3 +14,3 @@ { | ||
], | ||
"version": "10.1.0", | ||
"version": "10.2.0", | ||
"installVersion": 11, | ||
@@ -32,5 +32,5 @@ "author": "Nathan Rajlich <nathan@tootallnate.net> (http://tootallnate.net)", | ||
"nopt": "^7.0.0", | ||
"proc-log": "^3.0.0", | ||
"proc-log": "^4.1.0", | ||
"semver": "^7.3.5", | ||
"tar": "^6.1.2", | ||
"tar": "^6.2.1", | ||
"which": "^4.0.0" | ||
@@ -37,0 +37,0 @@ }, |
@@ -24,2 +24,5 @@ # `node-gyp` - Node.js native addon build tool | ||
> [!Important] | ||
> Python >= v3.12 requires `node-gyp` >= v10 | ||
You can install `node-gyp` using `npm`: | ||
@@ -49,6 +52,12 @@ | ||
Install the current [version of Python](https://devguide.python.org/versions/) from the | ||
[Microsoft Store](https://apps.microsoft.com/store/search?publisher=Python+Software+Foundation). | ||
Install tools with [Chocolatey](https://chocolatey.org): | ||
``` bash | ||
choco install python visualstudio2022-workload-vctools -y | ||
``` | ||
Install tools and configuration manually: | ||
Or install and configure Python and Visual Studio tools manually: | ||
* Install the current [version of Python](https://devguide.python.org/versions/) from the | ||
[Microsoft Store](https://apps.microsoft.com/store/search?publisher=Python+Software+Foundation). | ||
* Install Visual C++ Build Environment: For Visual Studio 2019 or later, use the `Desktop development with C++` workload from [Visual Studio Community](https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=Community). For a version older than Visual Studio 2019, install [Visual Studio Build Tools](https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=BuildTools) with the `Visual C++ build tools` option. | ||
@@ -86,3 +95,4 @@ | ||
py --list-paths # To see the installed Python versions | ||
set npm_config_python=C:\path\to\python.exe | ||
set npm_config_python=C:\path\to\python.exe # CMD | ||
$Env:npm_config_python="C:\path\to\python.exe" # PowerShell | ||
``` | ||
@@ -89,0 +99,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 1 instance in 1 package
1849841
106
2638
274
37
4
- Removedproc-log@3.0.0(transitive)
Updatedproc-log@^4.1.0
Updatedtar@^6.2.1