Updated the project.

This commit is contained in:
Batuhan Berk Başoğlu 2024-06-03 15:44:25 -04:00
parent 5dfe9f128d
commit 7919556077
1550 changed files with 17063 additions and 40183 deletions

0
my-app/node_modules/node-gyp/lib/Find-VisualStudio.cs generated vendored Executable file → Normal file
View file

0
my-app/node_modules/node-gyp/lib/build.js generated vendored Executable file → Normal file
View file

0
my-app/node_modules/node-gyp/lib/clean.js generated vendored Executable file → Normal file
View file

28
my-app/node_modules/node-gyp/lib/configure.js generated vendored Executable file → Normal file
View file

@ -1,6 +1,6 @@
'use strict'
const { promises: fs } = require('graceful-fs')
const { promises: fs, readFileSync } = require('graceful-fs')
const path = require('path')
const log = require('./log')
const os = require('os')
@ -13,6 +13,10 @@ const { findAccessibleSync } = require('./util')
const { findPython } = require('./find-python')
const { findVisualStudio } = win ? require('./find-visualstudio') : {}
const majorRe = /^#define NODE_MAJOR_VERSION (\d+)/m
const minorRe = /^#define NODE_MINOR_VERSION (\d+)/m
const patchRe = /^#define NODE_PATCH_VERSION (\d+)/m
async function configure (gyp, argv) {
const buildDir = path.resolve('build')
const configNames = ['config.gypi', 'common.gypi']
@ -27,6 +31,28 @@ async function configure (gyp, argv) {
// 'python' should be set by now
process.env.PYTHON = python
if (!gyp.opts.nodedir &&
process.config.variables.use_prefix_to_find_headers) {
// check if the headers can be found using the prefix specified
// at build time. Use them if they match the version expected
const prefix = process.config.variables.node_prefix
let availVersion
try {
const nodeVersionH = readFileSync(path.join(prefix,
'include', 'node', 'node_version.h'), { encoding: 'utf8' })
const major = nodeVersionH.match(majorRe)[1]
const minor = nodeVersionH.match(minorRe)[1]
const patch = nodeVersionH.match(patchRe)[1]
availVersion = major + '.' + minor + '.' + patch
} catch {}
if (availVersion === release.version) {
// ok version matches, use the headers
gyp.opts.nodedir = prefix
log.verbose('using local node headers based on prefix',
'setting nodedir to ' + gyp.opts.nodedir)
}
}
if (gyp.opts.nodedir) {
// --nodedir was specified. use that for the dev files
nodeDir = gyp.opts.nodedir.replace(/^~/, os.homedir())

0
my-app/node_modules/node-gyp/lib/create-config-gypi.js generated vendored Executable file → Normal file
View file

0
my-app/node_modules/node-gyp/lib/download.js generated vendored Executable file → Normal file
View file

0
my-app/node_modules/node-gyp/lib/find-node-directory.js generated vendored Executable file → Normal file
View file

2
my-app/node_modules/node-gyp/lib/find-python.js generated vendored Executable file → Normal file
View file

@ -41,7 +41,7 @@ class PythonFinder {
static findPython = (...args) => new PythonFinder(...args).findPython()
log = log.withPrefix('find Python')
argsExecutable = ['-c', 'import sys; print(sys.executable);']
argsExecutable = ['-c', 'import sys; sys.stdout.buffer.write(sys.executable.encode(\'utf-8\'));']
argsVersion = ['-c', 'import sys; print("%s.%s.%s" % sys.version_info[:3]);']
semverRange = '>=3.6.0'

127
my-app/node_modules/node-gyp/lib/find-visualstudio.js generated vendored Executable file → Normal file
View file

@ -54,7 +54,10 @@ class VisualStudioFinder {
}
const checks = [
() => this.findVisualStudio2017OrNewer(),
() => this.findVisualStudio2019OrNewerUsingSetupModule(),
() => this.findVisualStudio2019OrNewer(),
() => this.findVisualStudio2017UsingSetupModule(),
() => this.findVisualStudio2017(),
() => this.findVisualStudio2015(),
() => this.findVisualStudio2013()
]
@ -113,9 +116,84 @@ class VisualStudioFinder {
throw new Error('Could not find any Visual Studio installation to use')
}
async findVisualStudio2019OrNewerUsingSetupModule () {
return this.findNewVSUsingSetupModule([2019, 2022])
}
async findVisualStudio2017UsingSetupModule () {
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.findNewVSUsingSetupModule([2017])
}
async findNewVSUsingSetupModule (supportedYears) {
const ps = path.join(process.env.SystemRoot, 'System32',
'WindowsPowerShell', 'v1.0', 'powershell.exe')
const vcInstallDir = this.envVcInstallDir
const checkModuleArgs = [
'-NoProfile',
'-Command',
'&{@(Get-Module -ListAvailable -Name VSSetup).Version.ToString()}'
]
this.log.silly('Running', ps, checkModuleArgs)
const [cErr] = await this.execFile(ps, checkModuleArgs)
if (cErr) {
this.addLog('VSSetup module doesn\'t seem to exist. You can install it via: "Install-Module VSSetup -Scope CurrentUser"')
this.log.silly('VSSetup error = %j', cErr && (cErr.stack || cErr))
return null
}
const filterArg = vcInstallDir !== undefined ? `| where {$_.InstallationPath -eq '${vcInstallDir}' }` : ''
const psArgs = [
'-NoProfile',
'-Command',
`&{Get-VSSetupInstance ${filterArg} | ConvertTo-Json -Depth 3}`
]
this.log.silly('Running', ps, psArgs)
const [err, stdout, stderr] = await this.execFile(ps, psArgs)
let parsedData = this.parseData(err, stdout, stderr)
if (parsedData === null) {
return null
}
this.log.silly('Parsed data', parsedData)
if (!Array.isArray(parsedData)) {
// if there are only 1 result, then Powershell will output non-array
parsedData = [parsedData]
}
// normalize output
parsedData = parsedData.map((info) => {
info.path = info.InstallationPath
info.version = `${info.InstallationVersion.Major}.${info.InstallationVersion.Minor}.${info.InstallationVersion.Build}.${info.InstallationVersion.Revision}`
info.packages = info.Packages.map((p) => p.Id)
return info
})
// pass for further processing
return this.processData(parsedData, supportedYears)
}
// Invoke the PowerShell script to get information about Visual Studio 2019
// or newer installations
async findVisualStudio2019OrNewer () {
return this.findNewVS([2019, 2022])
}
// Invoke the PowerShell script to get information about Visual Studio 2017
async findVisualStudio2017 () {
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.findNewVS([2017])
}
// Invoke the PowerShell script to get information about Visual Studio 2017
// or newer installations
async findVisualStudio2017OrNewer () {
async findNewVS (supportedYears) {
const ps = path.join(process.env.SystemRoot, 'System32',
'WindowsPowerShell', 'v1.0', 'powershell.exe')
const csFile = path.join(__dirname, 'Find-VisualStudio.cs')
@ -128,24 +206,35 @@ class VisualStudioFinder {
]
this.log.silly('Running', ps, psArgs)
const [err, stdout, stderr] = await execFile(ps, psArgs, { encoding: 'utf8' })
return this.parseData(err, stdout, stderr)
const [err, stdout, stderr] = await this.execFile(ps, psArgs)
const parsedData = this.parseData(err, stdout, stderr, { checkIsArray: true })
if (parsedData === null) {
return null
}
return this.processData(parsedData, supportedYears)
}
// Parse the output of the PowerShell script and look for an installation
// of Visual Studio 2017 or newer to use
parseData (err, stdout, stderr) {
// Parse the output of the PowerShell script, make sanity checks
parseData (err, stdout, stderr, sanityCheckOptions) {
const defaultOptions = {
checkIsArray: false
}
// Merging provided options with the default options
const sanityOptions = { ...defaultOptions, ...sanityCheckOptions }
this.log.silly('PS stderr = %j', stderr)
const failPowershell = () => {
const failPowershell = (failureDetails) => {
this.addLog(
'could not use PowerShell to find Visual Studio 2017 or newer, try re-running with \'--loglevel silly\' for more details')
`could not use PowerShell to find Visual Studio 2017 or newer, try re-running with '--loglevel silly' for more details. \n
Failure details: ${failureDetails}`)
return null
}
if (err) {
this.log.silly('PS err = %j', err && (err.stack || err))
return failPowershell()
return failPowershell(`${err}`.substring(0, 40))
}
let vsInfo
@ -157,11 +246,16 @@ class VisualStudioFinder {
return failPowershell()
}
if (!Array.isArray(vsInfo)) {
if (sanityOptions.checkIsArray && !Array.isArray(vsInfo)) {
this.log.silly('PS stdout = %j', stdout)
return failPowershell()
return failPowershell('Expected array as output of the PS script')
}
return vsInfo
}
// Process parsed data containing information about VS installations
// Look for the required parts, extract and output them back
processData (vsInfo, supportedYears) {
vsInfo = vsInfo.map((info) => {
this.log.silly(`processing installation: "${info.path}"`)
info.path = path.resolve(info.path)
@ -175,11 +269,12 @@ class VisualStudioFinder {
this.log.silly('vsInfo:', vsInfo)
// Remove future versions or errors parsing version number
// Also remove any unsupported versions
vsInfo = vsInfo.filter((info) => {
if (info.versionYear) {
if (info.versionYear && supportedYears.indexOf(info.versionYear) !== -1) {
return true
}
this.addLog(`unknown version "${info.version}" found at "${info.path}"`)
this.addLog(`${info.versionYear ? 'unsupported' : 'unknown'} version "${info.version}" found at "${info.path}"`)
return false
})
@ -438,6 +533,10 @@ class VisualStudioFinder {
return true
}
async execFile (exec, args) {
return await execFile(exec, args, { encoding: 'utf8' })
}
}
module.exports = VisualStudioFinder

0
my-app/node_modules/node-gyp/lib/install.js generated vendored Executable file → Normal file
View file

0
my-app/node_modules/node-gyp/lib/list.js generated vendored Executable file → Normal file
View file

0
my-app/node_modules/node-gyp/lib/log.js generated vendored Executable file → Normal file
View file

0
my-app/node_modules/node-gyp/lib/node-gyp.js generated vendored Executable file → Normal file
View file

0
my-app/node_modules/node-gyp/lib/process-release.js generated vendored Executable file → Normal file
View file

0
my-app/node_modules/node-gyp/lib/rebuild.js generated vendored Executable file → Normal file
View file

0
my-app/node_modules/node-gyp/lib/remove.js generated vendored Executable file → Normal file
View file

0
my-app/node_modules/node-gyp/lib/util.js generated vendored Executable file → Normal file
View file