Commit 1196e99

Browse files
committed
src: update to standard@14
PR-URL: #1899 Reviewed-By: João Reis <reis@janeasystems.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com>
1 parent 53ee7df commit 1196e99

13 files changed

Lines changed: 61 additions & 57 deletions

‎bin/node-gyp.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ function errorMessage () {
131131

132132
functionissueMessage(){
133133
errorMessage()
134-
log.error('',['This is a bug in `node-gyp`.',
134+
log.error('',['This is a bug in `node-gyp`.',
135135
'Try to update node-gyp and file an Issue if it does not help:',
136136
' <https://github.com/nodejs/node-gyp/issues>'
137137
].join('\n'))

‎lib/configure.js‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ if (win) {
1717
functionconfigure(gyp,argv,callback){
1818
varpython
1919
varbuildDir=path.resolve('build')
20-
varconfigNames=['config.gypi','common.gypi']
20+
varconfigNames=['config.gypi','common.gypi']
2121
varconfigs=[]
2222
varnodeDir
2323
varrelease=processRelease(argv,gyp,process.version,process.release)
@@ -60,7 +60,7 @@ function configure (gyp, argv, callback) {
6060
// into devdir. Otherwise only install if they're not already there.
6161
gyp.opts.ensure=!gyp.opts.tarball
6262

63-
gyp.commands.install([release.version],function(err){
63+
gyp.commands.install([release.version],function(err){
6464
if(err){
6565
returncallback(err)
6666
}
@@ -132,7 +132,7 @@ function configure (gyp, argv, callback) {
132132
// set the target_arch variable
133133
variables.target_arch=gyp.opts.arch||process.arch||'ia32'
134134
if(variables.target_arch==='arm64'){
135-
defaults['msvs_configuration_platform']='ARM64'
135+
defaults.msvs_configuration_platform='ARM64'
136136
}
137137

138138
// set the node development directory
@@ -142,22 +142,22 @@ function configure (gyp, argv, callback) {
142142
variables.standalone_static_library=gyp.opts.thin ? 0 : 1
143143

144144
if(win){
145-
process.env['GYP_MSVS_VERSION']=Math.min(vsInfo.versionYear,2015)
146-
process.env['GYP_MSVS_OVERRIDE_PATH']=vsInfo.path
147-
defaults['msbuild_toolset']=vsInfo.toolset
145+
process.env.GYP_MSVS_VERSION=Math.min(vsInfo.versionYear,2015)
146+
process.env.GYP_MSVS_OVERRIDE_PATH=vsInfo.path
147+
defaults.msbuild_toolset=vsInfo.toolset
148148
if(vsInfo.sdk){
149-
defaults['msvs_windows_target_platform_version']=vsInfo.sdk
149+
defaults.msvs_windows_target_platform_version=vsInfo.sdk
150150
}
151151
if(variables.target_arch==='arm64'){
152152
if(vsInfo.versionMajor>15||
153153
(vsInfo.versionMajor===15&&vsInfo.versionMajor>=9)){
154-
defaults['msvs_enable_marmasm']=1
154+
defaults.msvs_enable_marmasm=1
155155
}else{
156156
log.warn('Compiling ARM64 assembly is only available in\n'+
157157
'Visual Studio 2017 version 15.9 and above')
158158
}
159159
}
160-
variables['msbuild_path']=vsInfo.msBuild
160+
variables.msbuild_path=vsInfo.msBuild
161161
}
162162

163163
// loop through the rest of the opts and add the unknown ones as variables.
@@ -190,7 +190,7 @@ function configure (gyp, argv, callback) {
190190
varjson=JSON.stringify(config,boolsToString,2)
191191
log.verbose('build/'+configFilename,'writing out config file: %s',configPath)
192192
configs.push(configPath)
193-
fs.writeFile(configPath,[prefix,json,''].join('\n'),findConfigs)
193+
fs.writeFile(configPath,[prefix,json,''].join('\n'),findConfigs)
194194
}
195195

196196
functionfindConfigs(err){
@@ -335,7 +335,7 @@ function configure (gyp, argv, callback) {
335335
argv.unshift(gypScript)
336336

337337
// make sure python uses files that came with this particular node package
338-
varpypath=[path.join(__dirname,'..','gyp','pylib')]
338+
varpypath=[path.join(__dirname,'..','gyp','pylib')]
339339
if(process.env.PYTHONPATH){
340340
pypath.push(process.env.PYTHONPATH)
341341
}

‎lib/find-python.js‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ function PythonFinder (configPython, callback) {
1616

1717
PythonFinder.prototype={
1818
log: logWithPrefix(log,'find Python'),
19-
argsExecutable: ['-c','import sys; print(sys.executable);'],
20-
argsVersion: ['-c','import sys; print("%s.%s.%s" % sys.version_info[:3]);'],
19+
argsExecutable: ['-c','import sys; print(sys.executable);'],
20+
argsVersion: ['-c','import sys; print("%s.%s.%s" % sys.version_info[:3]);'],
2121
semverRange: process.env.EXPERIMENTAL_NODE_GYP_PYTHON3 ? '2.7.x || >=3.5.0'
2222
: '>=2.6.0 <3.0.0',
2323

@@ -46,7 +46,7 @@ PythonFinder.prototype = {
4646

4747
functiongetChecks(){
4848
if(this.env.NODE_GYP_FORCE_PYTHON){
49-
return[{
49+
return[{
5050
before: ()=>{
5151
this.addLog(
5252
'checking Python explicitly set from NODE_GYP_FORCE_PYTHON')
@@ -55,7 +55,7 @@ PythonFinder.prototype = {
5555
},
5656
check: this.checkCommand,
5757
arg: this.env.NODE_GYP_FORCE_PYTHON
58-
}]
58+
}]
5959
}
6060

6161
varchecks=[
@@ -140,7 +140,7 @@ PythonFinder.prototype = {
140140
returnthis.fail()
141141
}
142142

143-
constargs=[runChecks.bind(this)]
143+
constargs=[runChecks.bind(this)]
144144
if(check.arg){
145145
args.unshift(check.arg)
146146
}
@@ -192,7 +192,7 @@ PythonFinder.prototype = {
192192
checkPyLauncher: functioncheckPyLauncher(errorCallback){
193193
this.log.verbose(
194194
`- executing "${this.pyLauncher}" to get Python 2 executable path`)
195-
this.run(this.pyLauncher,['-2', ...this.argsExecutable],false,
195+
this.run(this.pyLauncher,['-2', ...this.argsExecutable],false,
196196
function(err,execPath){
197197
// Possible outcomes: same as checkCommand
198198
if(err){

‎lib/install.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function install (fs, gyp, argv, callback) {
2424
if(err){
2525
log.warn('install','got an error, rolling back install')
2626
// roll-back the install if anything went wrong
27-
gyp.commands.remove([release.versionDir],function(){
27+
gyp.commands.remove([release.versionDir],function(){
2828
callback(err)
2929
})
3030
}else{
@@ -298,7 +298,7 @@ function install (fs, gyp, argv, callback) {
298298

299299
functiondownloadNodeLib(done){
300300
log.verbose('on Windows; need to download `'+release.name+'.lib`...')
301-
vararchs=['ia32','x64','arm64']
301+
vararchs=['ia32','x64','arm64']
302302
varasync=archs.length
303303
archs.forEach(function(arch){
304304
vardir=path.resolve(devDir,arch)
@@ -400,7 +400,7 @@ function download (gyp, env, url) {
400400
uri: url,
401401
headers: {
402402
'User-Agent': 'node-gyp v'+gyp.version+' (node '+process.version+')',
403-
'Connection': 'keep-alive'
403+
Connection: 'keep-alive'
404404
}
405405
}
406406

‎lib/node-gyp.js‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ const commands = [
1818
'remove'
1919
]
2020
constaliases={
21-
'ls': 'list',
22-
'rm': 'remove'
21+
ls: 'list',
22+
rm: 'remove'
2323
}
2424

2525
// differentiate node-gyp's logs from npm's
@@ -72,7 +72,7 @@ proto.configDefs = {
7272
loglevel: String,// everywhere
7373
python: String,// 'configure'
7474
'dist-url': String,// 'install'
75-
'tarball': String,// 'install'
75+
tarball: String,// 'install'
7676
jobs: String,// 'build'
7777
thin: String// 'configure'
7878
}
@@ -167,7 +167,7 @@ proto.spawn = function spawn (command, args, opts) {
167167
opts={}
168168
}
169169
if(!opts.silent&&!opts.stdio){
170-
opts.stdio=[0,1,2]
170+
opts.stdio=[0,1,2]
171171
}
172172
varcp=childProcess.spawn(command,args,opts)
173173
log.info('spawn',command)

‎lib/process-release.js‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* eslint-disable node/no-deprecated-api */
2+
13
'use strict'
24

35
constsemver=require('semver')

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"bindings": "~1.2.1",
4242
"nan": "^2.0.0",
4343
"require-inject": "~1.3.0",
44-
"standard": "~12.0.1",
44+
"standard": "~14.3.1",
4545
"tap": "~12.7.0"
4646
},
4747
"scripts": {

‎test/process-exec-sync.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ function processExecSync (file, args, options) {
6767
}
6868
}
6969

70-
['stdout','stderr','status'].forEach(function(file){
70+
['stdout','stderr','status'].forEach(function(file){
7171
child[file]=fs.readFileSync(tmpdir+'/'+file,options.encoding)
7272
setTimeout(unlinkFile,500,tmpdir+'/'+file)
7373
})

‎test/test-addon.js‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,18 @@ function runHello (hostProcess) {
1515
hostProcess=process.execPath
1616
}
1717
vartestCode="console.log(require('hello_world').hello())"
18-
returnexecFileSync(hostProcess,['-e',testCode],{cwd: __dirname}).toString()
18+
returnexecFileSync(hostProcess,['-e',testCode],{cwd: __dirname}).toString()
1919
}
2020

2121
functiongetEncoding(){
2222
varcode='import locale;print(locale.getdefaultlocale()[1])'
23-
returnexecFileSync('python',['-c',code]).toString().trim()
23+
returnexecFileSync('python',['-c',code]).toString().trim()
2424
}
2525

2626
functioncheckCharmapValid(){
2727
vardata
2828
try{
29-
data=execFileSync('python',['fixtures/test-charmap.py'],
29+
data=execFileSync('python',['fixtures/test-charmap.py'],
3030
{cwd: __dirname})
3131
}catch(err){
3232
returnfalse
@@ -39,7 +39,7 @@ test('build simple addon', function (t) {
3939
t.plan(3)
4040

4141
// Set the loglevel otherwise the output disappears when run via 'npm test'
42-
varcmd=[nodeGyp,'rebuild','-C',addonPath,'--loglevel=verbose']
42+
varcmd=[nodeGyp,'rebuild','-C',addonPath,'--loglevel=verbose']
4343
varproc=execFile(process.execPath,cmd,function(err,stdout,stderr){
4444
varlogLines=stderr.toString().trim().split(/\r?\n/)
4545
varlastLine=logLines[logLines.length-1]
@@ -59,9 +59,9 @@ test('build simple addon in path with non-ascii characters', function (t) {
5959
}
6060

6161
vartestDirNames={
62-
'cp936': '文件夹',
63-
'cp1252': 'Latīna',
64-
'cp932': 'フォルダ'
62+
cp936: '文件夹',
63+
cp1252: 'Latīna',
64+
cp932: 'フォルダ'
6565
}
6666
// Select non-ascii characters by current encoding
6767
vartestDirName=testDirNames[getEncoding()]
@@ -136,7 +136,7 @@ test('addon works with renamed host executable', function (t) {
136136
varnotNodePath=path.join(os.tmpdir(),'notnode'+path.extname(process.execPath))
137137
fs.copyFileSync(process.execPath,notNodePath)
138138

139-
varcmd=[nodeGyp,'rebuild','-C',addonPath,'--loglevel=verbose']
139+
varcmd=[nodeGyp,'rebuild','-C',addonPath,'--loglevel=verbose']
140140
varproc=execFile(process.execPath,cmd,function(err,stdout,stderr){
141141
varlogLines=stderr.toString().trim().split(/\r?\n/)
142142
varlastLine=logLines[logLines.length-1]

‎test/test-configure-python.js‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ const gyp = require('../lib/node-gyp')
66
constrequireInject=require('require-inject')
77
constconfigure=requireInject('../lib/configure',{
88
'graceful-fs': {
9-
'openSync': function(){return0},
10-
'closeSync': function(){},
11-
'writeFile': function(file,data,cb){cb()},
12-
'stat': function(file,cb){cb(null,{})}
9+
openSync: function(){return0},
10+
closeSync: function(){},
11+
writeFile: function(file,data,cb){cb()},
12+
stat: function(file,cb){cb(null,{})}
1313
}
1414
})
1515

@@ -42,10 +42,10 @@ test('configure PYTHONPATH with existing env of one dir', function (t) {
4242
varprog=gyp()
4343
prog.parseArgv([])
4444
prog.spawn=function(){
45-
t.equal(process.env.PYTHONPATH,[EXPECTED_PYPATH,existingPath].join(SEPARATOR))
45+
t.equal(process.env.PYTHONPATH,[EXPECTED_PYPATH,existingPath].join(SEPARATOR))
4646

4747
vardirs=process.env.PYTHONPATH.split(SEPARATOR)
48-
t.deepEqual(dirs,[EXPECTED_PYPATH,existingPath])
48+
t.deepEqual(dirs,[EXPECTED_PYPATH,existingPath])
4949

5050
returnSPAWN_RESULT
5151
}
@@ -57,16 +57,16 @@ test('configure PYTHONPATH with existing env of multiple dirs', function (t) {
5757

5858
varpythonDir1=path.join('a','b')
5959
varpythonDir2=path.join('b','c')
60-
varexistingPath=[pythonDir1,pythonDir2].join(SEPARATOR)
60+
varexistingPath=[pythonDir1,pythonDir2].join(SEPARATOR)
6161
process.env.PYTHONPATH=existingPath
6262

6363
varprog=gyp()
6464
prog.parseArgv([])
6565
prog.spawn=function(){
66-
t.equal(process.env.PYTHONPATH,[EXPECTED_PYPATH,existingPath].join(SEPARATOR))
66+
t.equal(process.env.PYTHONPATH,[EXPECTED_PYPATH,existingPath].join(SEPARATOR))
6767

6868
vardirs=process.env.PYTHONPATH.split(SEPARATOR)
69-
t.deepEqual(dirs,[EXPECTED_PYPATH,pythonDir1,pythonDir2])
69+
t.deepEqual(dirs,[EXPECTED_PYPATH,pythonDir1,pythonDir2])
7070

7171
returnSPAWN_RESULT
7272
}

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

Commit 1196e99

Browse files
committed
src: update to standard@14
PR-URL: #1899 Reviewed-By: João Reis <reis@janeasystems.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com>
1 parent 53ee7df commit 1196e99

13 files changed

Lines changed: 61 additions & 57 deletions

‎bin/node-gyp.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ function errorMessage () {
131131

132132
functionissueMessage(){
133133
errorMessage()
134-
log.error('',['This is a bug in `node-gyp`.',
134+
log.error('',['This is a bug in `node-gyp`.',
135135
'Try to update node-gyp and file an Issue if it does not help:',
136136
' <https://github.com/nodejs/node-gyp/issues>'
137137
].join('\n'))

‎lib/configure.js‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ if (win) {
1717
functionconfigure(gyp,argv,callback){
1818
varpython
1919
varbuildDir=path.resolve('build')
20-
varconfigNames=['config.gypi','common.gypi']
20+
varconfigNames=['config.gypi','common.gypi']
2121
varconfigs=[]
2222
varnodeDir
2323
varrelease=processRelease(argv,gyp,process.version,process.release)
@@ -60,7 +60,7 @@ function configure (gyp, argv, callback) {
6060
// into devdir. Otherwise only install if they're not already there.
6161
gyp.opts.ensure=!gyp.opts.tarball
6262

63-
gyp.commands.install([release.version],function(err){
63+
gyp.commands.install([release.version],function(err){
6464
if(err){
6565
returncallback(err)
6666
}
@@ -132,7 +132,7 @@ function configure (gyp, argv, callback) {
132132
// set the target_arch variable
133133
variables.target_arch=gyp.opts.arch||process.arch||'ia32'
134134
if(variables.target_arch==='arm64'){
135-
defaults['msvs_configuration_platform']='ARM64'
135+
defaults.msvs_configuration_platform='ARM64'
136136
}
137137

138138
// set the node development directory
@@ -142,22 +142,22 @@ function configure (gyp, argv, callback) {
142142
variables.standalone_static_library=gyp.opts.thin ? 0 : 1
143143

144144
if(win){
145-
process.env['GYP_MSVS_VERSION']=Math.min(vsInfo.versionYear,2015)
146-
process.env['GYP_MSVS_OVERRIDE_PATH']=vsInfo.path
147-
defaults['msbuild_toolset']=vsInfo.toolset
145+
process.env.GYP_MSVS_VERSION=Math.min(vsInfo.versionYear,2015)
146+
process.env.GYP_MSVS_OVERRIDE_PATH=vsInfo.path
147+
defaults.msbuild_toolset=vsInfo.toolset
148148
if(vsInfo.sdk){
149-
defaults['msvs_windows_target_platform_version']=vsInfo.sdk
149+
defaults.msvs_windows_target_platform_version=vsInfo.sdk
150150
}
151151
if(variables.target_arch==='arm64'){
152152
if(vsInfo.versionMajor>15||
153153
(vsInfo.versionMajor===15&&vsInfo.versionMajor>=9)){
154-
defaults['msvs_enable_marmasm']=1
154+
defaults.msvs_enable_marmasm=1
155155
}else{
156156
log.warn('Compiling ARM64 assembly is only available in\n'+
157157
'Visual Studio 2017 version 15.9 and above')
158158
}
159159
}
160-
variables['msbuild_path']=vsInfo.msBuild
160+
variables.msbuild_path=vsInfo.msBuild
161161
}
162162

163163
// loop through the rest of the opts and add the unknown ones as variables.
@@ -190,7 +190,7 @@ function configure (gyp, argv, callback) {
190190
varjson=JSON.stringify(config,boolsToString,2)
191191
log.verbose('build/'+configFilename,'writing out config file: %s',configPath)
192192
configs.push(configPath)
193-
fs.writeFile(configPath,[prefix,json,''].join('\n'),findConfigs)
193+
fs.writeFile(configPath,[prefix,json,''].join('\n'),findConfigs)
194194
}
195195

196196
functionfindConfigs(err){
@@ -335,7 +335,7 @@ function configure (gyp, argv, callback) {
335335
argv.unshift(gypScript)
336336

337337
// make sure python uses files that came with this particular node package
338-
varpypath=[path.join(__dirname,'..','gyp','pylib')]
338+
varpypath=[path.join(__dirname,'..','gyp','pylib')]
339339
if(process.env.PYTHONPATH){
340340
pypath.push(process.env.PYTHONPATH)
341341
}

‎lib/find-python.js‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ function PythonFinder (configPython, callback) {
1616

1717
PythonFinder.prototype={
1818
log: logWithPrefix(log,'find Python'),
19-
argsExecutable: ['-c','import sys; print(sys.executable);'],
20-
argsVersion: ['-c','import sys; print("%s.%s.%s" % sys.version_info[:3]);'],
19+
argsExecutable: ['-c','import sys; print(sys.executable);'],
20+
argsVersion: ['-c','import sys; print("%s.%s.%s" % sys.version_info[:3]);'],
2121
semverRange: process.env.EXPERIMENTAL_NODE_GYP_PYTHON3 ? '2.7.x || >=3.5.0'
2222
: '>=2.6.0 <3.0.0',
2323

@@ -46,7 +46,7 @@ PythonFinder.prototype = {
4646

4747
functiongetChecks(){
4848
if(this.env.NODE_GYP_FORCE_PYTHON){
49-
return[{
49+
return[{
5050
before: ()=>{
5151
this.addLog(
5252
'checking Python explicitly set from NODE_GYP_FORCE_PYTHON')
@@ -55,7 +55,7 @@ PythonFinder.prototype = {
5555
},
5656
check: this.checkCommand,
5757
arg: this.env.NODE_GYP_FORCE_PYTHON
58-
}]
58+
}]
5959
}
6060

6161
varchecks=[
@@ -140,7 +140,7 @@ PythonFinder.prototype = {
140140
returnthis.fail()
141141
}
142142

143-
constargs=[runChecks.bind(this)]
143+
constargs=[runChecks.bind(this)]
144144
if(check.arg){
145145
args.unshift(check.arg)
146146
}
@@ -192,7 +192,7 @@ PythonFinder.prototype = {
192192
checkPyLauncher: functioncheckPyLauncher(errorCallback){
193193
this.log.verbose(
194194
`- executing "${this.pyLauncher}" to get Python 2 executable path`)
195-
this.run(this.pyLauncher,['-2', ...this.argsExecutable],false,
195+
this.run(this.pyLauncher,['-2', ...this.argsExecutable],false,
196196
function(err,execPath){
197197
// Possible outcomes: same as checkCommand
198198
if(err){

‎lib/install.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function install (fs, gyp, argv, callback) {
2424
if(err){
2525
log.warn('install','got an error, rolling back install')
2626
// roll-back the install if anything went wrong
27-
gyp.commands.remove([release.versionDir],function(){
27+
gyp.commands.remove([release.versionDir],function(){
2828
callback(err)
2929
})
3030
}else{
@@ -298,7 +298,7 @@ function install (fs, gyp, argv, callback) {
298298

299299
functiondownloadNodeLib(done){
300300
log.verbose('on Windows; need to download `'+release.name+'.lib`...')
301-
vararchs=['ia32','x64','arm64']
301+
vararchs=['ia32','x64','arm64']
302302
varasync=archs.length
303303
archs.forEach(function(arch){
304304
vardir=path.resolve(devDir,arch)
@@ -400,7 +400,7 @@ function download (gyp, env, url) {
400400
uri: url,
401401
headers: {
402402
'User-Agent': 'node-gyp v'+gyp.version+' (node '+process.version+')',
403-
'Connection': 'keep-alive'
403+
Connection: 'keep-alive'
404404
}
405405
}
406406

‎lib/node-gyp.js‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ const commands = [
1818
'remove'
1919
]
2020
constaliases={
21-
'ls': 'list',
22-
'rm': 'remove'
21+
ls: 'list',
22+
rm: 'remove'
2323
}
2424

2525
// differentiate node-gyp's logs from npm's
@@ -72,7 +72,7 @@ proto.configDefs = {
7272
loglevel: String,// everywhere
7373
python: String,// 'configure'
7474
'dist-url': String,// 'install'
75-
'tarball': String,// 'install'
75+
tarball: String,// 'install'
7676
jobs: String,// 'build'
7777
thin: String// 'configure'
7878
}
@@ -167,7 +167,7 @@ proto.spawn = function spawn (command, args, opts) {
167167
opts={}
168168
}
169169
if(!opts.silent&&!opts.stdio){
170-
opts.stdio=[0,1,2]
170+
opts.stdio=[0,1,2]
171171
}
172172
varcp=childProcess.spawn(command,args,opts)
173173
log.info('spawn',command)

‎lib/process-release.js‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* eslint-disable node/no-deprecated-api */
2+
13
'use strict'
24

35
constsemver=require('semver')

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"bindings": "~1.2.1",
4242
"nan": "^2.0.0",
4343
"require-inject": "~1.3.0",
44-
"standard": "~12.0.1",
44+
"standard": "~14.3.1",
4545
"tap": "~12.7.0"
4646
},
4747
"scripts": {

‎test/process-exec-sync.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ function processExecSync (file, args, options) {
6767
}
6868
}
6969

70-
['stdout','stderr','status'].forEach(function(file){
70+
['stdout','stderr','status'].forEach(function(file){
7171
child[file]=fs.readFileSync(tmpdir+'/'+file,options.encoding)
7272
setTimeout(unlinkFile,500,tmpdir+'/'+file)
7373
})

‎test/test-addon.js‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,18 @@ function runHello (hostProcess) {
1515
hostProcess=process.execPath
1616
}
1717
vartestCode="console.log(require('hello_world').hello())"
18-
returnexecFileSync(hostProcess,['-e',testCode],{cwd: __dirname}).toString()
18+
returnexecFileSync(hostProcess,['-e',testCode],{cwd: __dirname}).toString()
1919
}
2020

2121
functiongetEncoding(){
2222
varcode='import locale;print(locale.getdefaultlocale()[1])'
23-
returnexecFileSync('python',['-c',code]).toString().trim()
23+
returnexecFileSync('python',['-c',code]).toString().trim()
2424
}
2525

2626
functioncheckCharmapValid(){
2727
vardata
2828
try{
29-
data=execFileSync('python',['fixtures/test-charmap.py'],
29+
data=execFileSync('python',['fixtures/test-charmap.py'],
3030
{cwd: __dirname})
3131
}catch(err){
3232
returnfalse
@@ -39,7 +39,7 @@ test('build simple addon', function (t) {
3939
t.plan(3)
4040

4141
// Set the loglevel otherwise the output disappears when run via 'npm test'
42-
varcmd=[nodeGyp,'rebuild','-C',addonPath,'--loglevel=verbose']
42+
varcmd=[nodeGyp,'rebuild','-C',addonPath,'--loglevel=verbose']
4343
varproc=execFile(process.execPath,cmd,function(err,stdout,stderr){
4444
varlogLines=stderr.toString().trim().split(/\r?\n/)
4545
varlastLine=logLines[logLines.length-1]
@@ -59,9 +59,9 @@ test('build simple addon in path with non-ascii characters', function (t) {
5959
}
6060

6161
vartestDirNames={
62-
'cp936': '文件夹',
63-
'cp1252': 'Latīna',
64-
'cp932': 'フォルダ'
62+
cp936: '文件夹',
63+
cp1252: 'Latīna',
64+
cp932: 'フォルダ'
6565
}
6666
// Select non-ascii characters by current encoding
6767
vartestDirName=testDirNames[getEncoding()]
@@ -136,7 +136,7 @@ test('addon works with renamed host executable', function (t) {
136136
varnotNodePath=path.join(os.tmpdir(),'notnode'+path.extname(process.execPath))
137137
fs.copyFileSync(process.execPath,notNodePath)
138138

139-
varcmd=[nodeGyp,'rebuild','-C',addonPath,'--loglevel=verbose']
139+
varcmd=[nodeGyp,'rebuild','-C',addonPath,'--loglevel=verbose']
140140
varproc=execFile(process.execPath,cmd,function(err,stdout,stderr){
141141
varlogLines=stderr.toString().trim().split(/\r?\n/)
142142
varlastLine=logLines[logLines.length-1]

‎test/test-configure-python.js‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ const gyp = require('../lib/node-gyp')
66
constrequireInject=require('require-inject')
77
constconfigure=requireInject('../lib/configure',{
88
'graceful-fs': {
9-
'openSync': function(){return0},
10-
'closeSync': function(){},
11-
'writeFile': function(file,data,cb){cb()},
12-
'stat': function(file,cb){cb(null,{})}
9+
openSync: function(){return0},
10+
closeSync: function(){},
11+
writeFile: function(file,data,cb){cb()},
12+
stat: function(file,cb){cb(null,{})}
1313
}
1414
})
1515

@@ -42,10 +42,10 @@ test('configure PYTHONPATH with existing env of one dir', function (t) {
4242
varprog=gyp()
4343
prog.parseArgv([])
4444
prog.spawn=function(){
45-
t.equal(process.env.PYTHONPATH,[EXPECTED_PYPATH,existingPath].join(SEPARATOR))
45+
t.equal(process.env.PYTHONPATH,[EXPECTED_PYPATH,existingPath].join(SEPARATOR))
4646

4747
vardirs=process.env.PYTHONPATH.split(SEPARATOR)
48-
t.deepEqual(dirs,[EXPECTED_PYPATH,existingPath])
48+
t.deepEqual(dirs,[EXPECTED_PYPATH,existingPath])
4949

5050
returnSPAWN_RESULT
5151
}
@@ -57,16 +57,16 @@ test('configure PYTHONPATH with existing env of multiple dirs', function (t) {
5757

5858
varpythonDir1=path.join('a','b')
5959
varpythonDir2=path.join('b','c')
60-
varexistingPath=[pythonDir1,pythonDir2].join(SEPARATOR)
60+
varexistingPath=[pythonDir1,pythonDir2].join(SEPARATOR)
6161
process.env.PYTHONPATH=existingPath
6262

6363
varprog=gyp()
6464
prog.parseArgv([])
6565
prog.spawn=function(){
66-
t.equal(process.env.PYTHONPATH,[EXPECTED_PYPATH,existingPath].join(SEPARATOR))
66+
t.equal(process.env.PYTHONPATH,[EXPECTED_PYPATH,existingPath].join(SEPARATOR))
6767

6868
vardirs=process.env.PYTHONPATH.split(SEPARATOR)
69-
t.deepEqual(dirs,[EXPECTED_PYPATH,pythonDir1,pythonDir2])
69+
t.deepEqual(dirs,[EXPECTED_PYPATH,pythonDir1,pythonDir2])
7070

7171
returnSPAWN_RESULT
7272
}

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Commit 1196e99

Browse files
committed
src: update to standard@14
PR-URL: #1899 Reviewed-By: João Reis <reis@janeasystems.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com>
1 parent 53ee7df commit 1196e99

13 files changed

Lines changed: 61 additions & 57 deletions

‎bin/node-gyp.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ function errorMessage () {
131131

132132
functionissueMessage(){
133133
errorMessage()
134-
log.error('',['This is a bug in `node-gyp`.',
134+
log.error('',['This is a bug in `node-gyp`.',
135135
'Try to update node-gyp and file an Issue if it does not help:',
136136
' <https://github.com/nodejs/node-gyp/issues>'
137137
].join('\n'))

‎lib/configure.js‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ if (win) {
1717
functionconfigure(gyp,argv,callback){
1818
varpython
1919
varbuildDir=path.resolve('build')
20-
varconfigNames=['config.gypi','common.gypi']
20+
varconfigNames=['config.gypi','common.gypi']
2121
varconfigs=[]
2222
varnodeDir
2323
varrelease=processRelease(argv,gyp,process.version,process.release)
@@ -60,7 +60,7 @@ function configure (gyp, argv, callback) {
6060
// into devdir. Otherwise only install if they're not already there.
6161
gyp.opts.ensure=!gyp.opts.tarball
6262

63-
gyp.commands.install([release.version],function(err){
63+
gyp.commands.install([release.version],function(err){
6464
if(err){
6565
returncallback(err)
6666
}
@@ -132,7 +132,7 @@ function configure (gyp, argv, callback) {
132132
// set the target_arch variable
133133
variables.target_arch=gyp.opts.arch||process.arch||'ia32'
134134
if(variables.target_arch==='arm64'){
135-
defaults['msvs_configuration_platform']='ARM64'
135+
defaults.msvs_configuration_platform='ARM64'
136136
}
137137

138138
// set the node development directory
@@ -142,22 +142,22 @@ function configure (gyp, argv, callback) {
142142
variables.standalone_static_library=gyp.opts.thin ? 0 : 1
143143

144144
if(win){
145-
process.env['GYP_MSVS_VERSION']=Math.min(vsInfo.versionYear,2015)
146-
process.env['GYP_MSVS_OVERRIDE_PATH']=vsInfo.path
147-
defaults['msbuild_toolset']=vsInfo.toolset
145+
process.env.GYP_MSVS_VERSION=Math.min(vsInfo.versionYear,2015)
146+
process.env.GYP_MSVS_OVERRIDE_PATH=vsInfo.path
147+
defaults.msbuild_toolset=vsInfo.toolset
148148
if(vsInfo.sdk){
149-
defaults['msvs_windows_target_platform_version']=vsInfo.sdk
149+
defaults.msvs_windows_target_platform_version=vsInfo.sdk
150150
}
151151
if(variables.target_arch==='arm64'){
152152
if(vsInfo.versionMajor>15||
153153
(vsInfo.versionMajor===15&&vsInfo.versionMajor>=9)){
154-
defaults['msvs_enable_marmasm']=1
154+
defaults.msvs_enable_marmasm=1
155155
}else{
156156
log.warn('Compiling ARM64 assembly is only available in\n'+
157157
'Visual Studio 2017 version 15.9 and above')
158158
}
159159
}
160-
variables['msbuild_path']=vsInfo.msBuild
160+
variables.msbuild_path=vsInfo.msBuild
161161
}
162162

163163
// loop through the rest of the opts and add the unknown ones as variables.
@@ -190,7 +190,7 @@ function configure (gyp, argv, callback) {
190190
varjson=JSON.stringify(config,boolsToString,2)
191191
log.verbose('build/'+configFilename,'writing out config file: %s',configPath)
192192
configs.push(configPath)
193-
fs.writeFile(configPath,[prefix,json,''].join('\n'),findConfigs)
193+
fs.writeFile(configPath,[prefix,json,''].join('\n'),findConfigs)
194194
}
195195

196196
functionfindConfigs(err){
@@ -335,7 +335,7 @@ function configure (gyp, argv, callback) {
335335
argv.unshift(gypScript)
336336

337337
// make sure python uses files that came with this particular node package
338-
varpypath=[path.join(__dirname,'..','gyp','pylib')]
338+
varpypath=[path.join(__dirname,'..','gyp','pylib')]
339339
if(process.env.PYTHONPATH){
340340
pypath.push(process.env.PYTHONPATH)
341341
}

‎lib/find-python.js‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ function PythonFinder (configPython, callback) {
1616

1717
PythonFinder.prototype={
1818
log: logWithPrefix(log,'find Python'),
19-
argsExecutable: ['-c','import sys; print(sys.executable);'],
20-
argsVersion: ['-c','import sys; print("%s.%s.%s" % sys.version_info[:3]);'],
19+
argsExecutable: ['-c','import sys; print(sys.executable);'],
20+
argsVersion: ['-c','import sys; print("%s.%s.%s" % sys.version_info[:3]);'],
2121
semverRange: process.env.EXPERIMENTAL_NODE_GYP_PYTHON3 ? '2.7.x || >=3.5.0'
2222
: '>=2.6.0 <3.0.0',
2323

@@ -46,7 +46,7 @@ PythonFinder.prototype = {
4646

4747
functiongetChecks(){
4848
if(this.env.NODE_GYP_FORCE_PYTHON){
49-
return[{
49+
return[{
5050
before: ()=>{
5151
this.addLog(
5252
'checking Python explicitly set from NODE_GYP_FORCE_PYTHON')
@@ -55,7 +55,7 @@ PythonFinder.prototype = {
5555
},
5656
check: this.checkCommand,
5757
arg: this.env.NODE_GYP_FORCE_PYTHON
58-
}]
58+
}]
5959
}
6060

6161
varchecks=[
@@ -140,7 +140,7 @@ PythonFinder.prototype = {
140140
returnthis.fail()
141141
}
142142

143-
constargs=[runChecks.bind(this)]
143+
constargs=[runChecks.bind(this)]
144144
if(check.arg){
145145
args.unshift(check.arg)
146146
}
@@ -192,7 +192,7 @@ PythonFinder.prototype = {
192192
checkPyLauncher: functioncheckPyLauncher(errorCallback){
193193
this.log.verbose(
194194
`- executing "${this.pyLauncher}" to get Python 2 executable path`)
195-
this.run(this.pyLauncher,['-2', ...this.argsExecutable],false,
195+
this.run(this.pyLauncher,['-2', ...this.argsExecutable],false,
196196
function(err,execPath){
197197
// Possible outcomes: same as checkCommand
198198
if(err){

‎lib/install.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function install (fs, gyp, argv, callback) {
2424
if(err){
2525
log.warn('install','got an error, rolling back install')
2626
// roll-back the install if anything went wrong
27-
gyp.commands.remove([release.versionDir],function(){
27+
gyp.commands.remove([release.versionDir],function(){
2828
callback(err)
2929
})
3030
}else{
@@ -298,7 +298,7 @@ function install (fs, gyp, argv, callback) {
298298

299299
functiondownloadNodeLib(done){
300300
log.verbose('on Windows; need to download `'+release.name+'.lib`...')
301-
vararchs=['ia32','x64','arm64']
301+
vararchs=['ia32','x64','arm64']
302302
varasync=archs.length
303303
archs.forEach(function(arch){
304304
vardir=path.resolve(devDir,arch)
@@ -400,7 +400,7 @@ function download (gyp, env, url) {
400400
uri: url,
401401
headers: {
402402
'User-Agent': 'node-gyp v'+gyp.version+' (node '+process.version+')',
403-
'Connection': 'keep-alive'
403+
Connection: 'keep-alive'
404404
}
405405
}
406406

‎lib/node-gyp.js‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ const commands = [
1818
'remove'
1919
]
2020
constaliases={
21-
'ls': 'list',
22-
'rm': 'remove'
21+
ls: 'list',
22+
rm: 'remove'
2323
}
2424

2525
// differentiate node-gyp's logs from npm's
@@ -72,7 +72,7 @@ proto.configDefs = {
7272
loglevel: String,// everywhere
7373
python: String,// 'configure'
7474
'dist-url': String,// 'install'
75-
'tarball': String,// 'install'
75+
tarball: String,// 'install'
7676
jobs: String,// 'build'
7777
thin: String// 'configure'
7878
}
@@ -167,7 +167,7 @@ proto.spawn = function spawn (command, args, opts) {
167167
opts={}
168168
}
169169
if(!opts.silent&&!opts.stdio){
170-
opts.stdio=[0,1,2]
170+
opts.stdio=[0,1,2]
171171
}
172172
varcp=childProcess.spawn(command,args,opts)
173173
log.info('spawn',command)

‎lib/process-release.js‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* eslint-disable node/no-deprecated-api */
2+
13
'use strict'
24

35
constsemver=require('semver')

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"bindings": "~1.2.1",
4242
"nan": "^2.0.0",
4343
"require-inject": "~1.3.0",
44-
"standard": "~12.0.1",
44+
"standard": "~14.3.1",
4545
"tap": "~12.7.0"
4646
},
4747
"scripts": {

‎test/process-exec-sync.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ function processExecSync (file, args, options) {
6767
}
6868
}
6969

70-
['stdout','stderr','status'].forEach(function(file){
70+
['stdout','stderr','status'].forEach(function(file){
7171
child[file]=fs.readFileSync(tmpdir+'/'+file,options.encoding)
7272
setTimeout(unlinkFile,500,tmpdir+'/'+file)
7373
})

‎test/test-addon.js‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,18 @@ function runHello (hostProcess) {
1515
hostProcess=process.execPath
1616
}
1717
vartestCode="console.log(require('hello_world').hello())"
18-
returnexecFileSync(hostProcess,['-e',testCode],{cwd: __dirname}).toString()
18+
returnexecFileSync(hostProcess,['-e',testCode],{cwd: __dirname}).toString()
1919
}
2020

2121
functiongetEncoding(){
2222
varcode='import locale;print(locale.getdefaultlocale()[1])'
23-
returnexecFileSync('python',['-c',code]).toString().trim()
23+
returnexecFileSync('python',['-c',code]).toString().trim()
2424
}
2525

2626
functioncheckCharmapValid(){
2727
vardata
2828
try{
29-
data=execFileSync('python',['fixtures/test-charmap.py'],
29+
data=execFileSync('python',['fixtures/test-charmap.py'],
3030
{cwd: __dirname})
3131
}catch(err){
3232
returnfalse
@@ -39,7 +39,7 @@ test('build simple addon', function (t) {
3939
t.plan(3)
4040

4141
// Set the loglevel otherwise the output disappears when run via 'npm test'
42-
varcmd=[nodeGyp,'rebuild','-C',addonPath,'--loglevel=verbose']
42+
varcmd=[nodeGyp,'rebuild','-C',addonPath,'--loglevel=verbose']
4343
varproc=execFile(process.execPath,cmd,function(err,stdout,stderr){
4444
varlogLines=stderr.toString().trim().split(/\r?\n/)
4545
varlastLine=logLines[logLines.length-1]
@@ -59,9 +59,9 @@ test('build simple addon in path with non-ascii characters', function (t) {
5959
}
6060

6161
vartestDirNames={
62-
'cp936': '文件夹',
63-
'cp1252': 'Latīna',
64-
'cp932': 'フォルダ'
62+
cp936: '文件夹',
63+
cp1252: 'Latīna',
64+
cp932: 'フォルダ'
6565
}
6666
// Select non-ascii characters by current encoding
6767
vartestDirName=testDirNames[getEncoding()]
@@ -136,7 +136,7 @@ test('addon works with renamed host executable', function (t) {
136136
varnotNodePath=path.join(os.tmpdir(),'notnode'+path.extname(process.execPath))
137137
fs.copyFileSync(process.execPath,notNodePath)
138138

139-
varcmd=[nodeGyp,'rebuild','-C',addonPath,'--loglevel=verbose']
139+
varcmd=[nodeGyp,'rebuild','-C',addonPath,'--loglevel=verbose']
140140
varproc=execFile(process.execPath,cmd,function(err,stdout,stderr){
141141
varlogLines=stderr.toString().trim().split(/\r?\n/)
142142
varlastLine=logLines[logLines.length-1]

‎test/test-configure-python.js‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ const gyp = require('../lib/node-gyp')
66
constrequireInject=require('require-inject')
77
constconfigure=requireInject('../lib/configure',{
88
'graceful-fs': {
9-
'openSync': function(){return0},
10-
'closeSync': function(){},
11-
'writeFile': function(file,data,cb){cb()},
12-
'stat': function(file,cb){cb(null,{})}
9+
openSync: function(){return0},
10+
closeSync: function(){},
11+
writeFile: function(file,data,cb){cb()},
12+
stat: function(file,cb){cb(null,{})}
1313
}
1414
})
1515

@@ -42,10 +42,10 @@ test('configure PYTHONPATH with existing env of one dir', function (t) {
4242
varprog=gyp()
4343
prog.parseArgv([])
4444
prog.spawn=function(){
45-
t.equal(process.env.PYTHONPATH,[EXPECTED_PYPATH,existingPath].join(SEPARATOR))
45+
t.equal(process.env.PYTHONPATH,[EXPECTED_PYPATH,existingPath].join(SEPARATOR))
4646

4747
vardirs=process.env.PYTHONPATH.split(SEPARATOR)
48-
t.deepEqual(dirs,[EXPECTED_PYPATH,existingPath])
48+
t.deepEqual(dirs,[EXPECTED_PYPATH,existingPath])
4949

5050
returnSPAWN_RESULT
5151
}
@@ -57,16 +57,16 @@ test('configure PYTHONPATH with existing env of multiple dirs', function (t) {
5757

5858
varpythonDir1=path.join('a','b')
5959
varpythonDir2=path.join('b','c')
60-
varexistingPath=[pythonDir1,pythonDir2].join(SEPARATOR)
60+
varexistingPath=[pythonDir1,pythonDir2].join(SEPARATOR)
6161
process.env.PYTHONPATH=existingPath
6262

6363
varprog=gyp()
6464
prog.parseArgv([])
6565
prog.spawn=function(){
66-
t.equal(process.env.PYTHONPATH,[EXPECTED_PYPATH,existingPath].join(SEPARATOR))
66+
t.equal(process.env.PYTHONPATH,[EXPECTED_PYPATH,existingPath].join(SEPARATOR))
6767

6868
vardirs=process.env.PYTHONPATH.split(SEPARATOR)
69-
t.deepEqual(dirs,[EXPECTED_PYPATH,pythonDir1,pythonDir2])
69+
t.deepEqual(dirs,[EXPECTED_PYPATH,pythonDir1,pythonDir2])
7070

7171
returnSPAWN_RESULT
7272
}

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Commit 1196e99

Browse files
committed
src: update to standard@14
PR-URL: #1899 Reviewed-By: João Reis <reis@janeasystems.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com>
1 parent 53ee7df commit 1196e99

13 files changed

Lines changed: 61 additions & 57 deletions

‎bin/node-gyp.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ function errorMessage () {
131131

132132
functionissueMessage(){
133133
errorMessage()
134-
log.error('',['This is a bug in `node-gyp`.',
134+
log.error('',['This is a bug in `node-gyp`.',
135135
'Try to update node-gyp and file an Issue if it does not help:',
136136
' <https://github.com/nodejs/node-gyp/issues>'
137137
].join('\n'))

‎lib/configure.js‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ if (win) {
1717
functionconfigure(gyp,argv,callback){
1818
varpython
1919
varbuildDir=path.resolve('build')
20-
varconfigNames=['config.gypi','common.gypi']
20+
varconfigNames=['config.gypi','common.gypi']
2121
varconfigs=[]
2222
varnodeDir
2323
varrelease=processRelease(argv,gyp,process.version,process.release)
@@ -60,7 +60,7 @@ function configure (gyp, argv, callback) {
6060
// into devdir. Otherwise only install if they're not already there.
6161
gyp.opts.ensure=!gyp.opts.tarball
6262

63-
gyp.commands.install([release.version],function(err){
63+
gyp.commands.install([release.version],function(err){
6464
if(err){
6565
returncallback(err)
6666
}
@@ -132,7 +132,7 @@ function configure (gyp, argv, callback) {
132132
// set the target_arch variable
133133
variables.target_arch=gyp.opts.arch||process.arch||'ia32'
134134
if(variables.target_arch==='arm64'){
135-
defaults['msvs_configuration_platform']='ARM64'
135+
defaults.msvs_configuration_platform='ARM64'
136136
}
137137

138138
// set the node development directory
@@ -142,22 +142,22 @@ function configure (gyp, argv, callback) {
142142
variables.standalone_static_library=gyp.opts.thin ? 0 : 1
143143

144144
if(win){
145-
process.env['GYP_MSVS_VERSION']=Math.min(vsInfo.versionYear,2015)
146-
process.env['GYP_MSVS_OVERRIDE_PATH']=vsInfo.path
147-
defaults['msbuild_toolset']=vsInfo.toolset
145+
process.env.GYP_MSVS_VERSION=Math.min(vsInfo.versionYear,2015)
146+
process.env.GYP_MSVS_OVERRIDE_PATH=vsInfo.path
147+
defaults.msbuild_toolset=vsInfo.toolset
148148
if(vsInfo.sdk){
149-
defaults['msvs_windows_target_platform_version']=vsInfo.sdk
149+
defaults.msvs_windows_target_platform_version=vsInfo.sdk
150150
}
151151
if(variables.target_arch==='arm64'){
152152
if(vsInfo.versionMajor>15||
153153
(vsInfo.versionMajor===15&&vsInfo.versionMajor>=9)){
154-
defaults['msvs_enable_marmasm']=1
154+
defaults.msvs_enable_marmasm=1
155155
}else{
156156
log.warn('Compiling ARM64 assembly is only available in\n'+
157157
'Visual Studio 2017 version 15.9 and above')
158158
}
159159
}
160-
variables['msbuild_path']=vsInfo.msBuild
160+
variables.msbuild_path=vsInfo.msBuild
161161
}
162162

163163
// loop through the rest of the opts and add the unknown ones as variables.
@@ -190,7 +190,7 @@ function configure (gyp, argv, callback) {
190190
varjson=JSON.stringify(config,boolsToString,2)
191191
log.verbose('build/'+configFilename,'writing out config file: %s',configPath)
192192
configs.push(configPath)
193-
fs.writeFile(configPath,[prefix,json,''].join('\n'),findConfigs)
193+
fs.writeFile(configPath,[prefix,json,''].join('\n'),findConfigs)
194194
}
195195

196196
functionfindConfigs(err){
@@ -335,7 +335,7 @@ function configure (gyp, argv, callback) {
335335
argv.unshift(gypScript)
336336

337337
// make sure python uses files that came with this particular node package
338-
varpypath=[path.join(__dirname,'..','gyp','pylib')]
338+
varpypath=[path.join(__dirname,'..','gyp','pylib')]
339339
if(process.env.PYTHONPATH){
340340
pypath.push(process.env.PYTHONPATH)
341341
}

‎lib/find-python.js‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ function PythonFinder (configPython, callback) {
1616

1717
PythonFinder.prototype={
1818
log: logWithPrefix(log,'find Python'),
19-
argsExecutable: ['-c','import sys; print(sys.executable);'],
20-
argsVersion: ['-c','import sys; print("%s.%s.%s" % sys.version_info[:3]);'],
19+
argsExecutable: ['-c','import sys; print(sys.executable);'],
20+
argsVersion: ['-c','import sys; print("%s.%s.%s" % sys.version_info[:3]);'],
2121
semverRange: process.env.EXPERIMENTAL_NODE_GYP_PYTHON3 ? '2.7.x || >=3.5.0'
2222
: '>=2.6.0 <3.0.0',
2323

@@ -46,7 +46,7 @@ PythonFinder.prototype = {
4646

4747
functiongetChecks(){
4848
if(this.env.NODE_GYP_FORCE_PYTHON){
49-
return[{
49+
return[{
5050
before: ()=>{
5151
this.addLog(
5252
'checking Python explicitly set from NODE_GYP_FORCE_PYTHON')
@@ -55,7 +55,7 @@ PythonFinder.prototype = {
5555
},
5656
check: this.checkCommand,
5757
arg: this.env.NODE_GYP_FORCE_PYTHON
58-
}]
58+
}]
5959
}
6060

6161
varchecks=[
@@ -140,7 +140,7 @@ PythonFinder.prototype = {
140140
returnthis.fail()
141141
}
142142

143-
constargs=[runChecks.bind(this)]
143+
constargs=[runChecks.bind(this)]
144144
if(check.arg){
145145
args.unshift(check.arg)
146146
}
@@ -192,7 +192,7 @@ PythonFinder.prototype = {
192192
checkPyLauncher: functioncheckPyLauncher(errorCallback){
193193
this.log.verbose(
194194
`- executing "${this.pyLauncher}" to get Python 2 executable path`)
195-
this.run(this.pyLauncher,['-2', ...this.argsExecutable],false,
195+
this.run(this.pyLauncher,['-2', ...this.argsExecutable],false,
196196
function(err,execPath){
197197
// Possible outcomes: same as checkCommand
198198
if(err){

‎lib/install.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function install (fs, gyp, argv, callback) {
2424
if(err){
2525
log.warn('install','got an error, rolling back install')
2626
// roll-back the install if anything went wrong
27-
gyp.commands.remove([release.versionDir],function(){
27+
gyp.commands.remove([release.versionDir],function(){
2828
callback(err)
2929
})
3030
}else{
@@ -298,7 +298,7 @@ function install (fs, gyp, argv, callback) {
298298

299299
functiondownloadNodeLib(done){
300300
log.verbose('on Windows; need to download `'+release.name+'.lib`...')
301-
vararchs=['ia32','x64','arm64']
301+
vararchs=['ia32','x64','arm64']
302302
varasync=archs.length
303303
archs.forEach(function(arch){
304304
vardir=path.resolve(devDir,arch)
@@ -400,7 +400,7 @@ function download (gyp, env, url) {
400400
uri: url,
401401
headers: {
402402
'User-Agent': 'node-gyp v'+gyp.version+' (node '+process.version+')',
403-
'Connection': 'keep-alive'
403+
Connection: 'keep-alive'
404404
}
405405
}
406406

‎lib/node-gyp.js‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ const commands = [
1818
'remove'
1919
]
2020
constaliases={
21-
'ls': 'list',
22-
'rm': 'remove'
21+
ls: 'list',
22+
rm: 'remove'
2323
}
2424

2525
// differentiate node-gyp's logs from npm's
@@ -72,7 +72,7 @@ proto.configDefs = {
7272
loglevel: String,// everywhere
7373
python: String,// 'configure'
7474
'dist-url': String,// 'install'
75-
'tarball': String,// 'install'
75+
tarball: String,// 'install'
7676
jobs: String,// 'build'
7777
thin: String// 'configure'
7878
}
@@ -167,7 +167,7 @@ proto.spawn = function spawn (command, args, opts) {
167167
opts={}
168168
}
169169
if(!opts.silent&&!opts.stdio){
170-
opts.stdio=[0,1,2]
170+
opts.stdio=[0,1,2]
171171
}
172172
varcp=childProcess.spawn(command,args,opts)
173173
log.info('spawn',command)

‎lib/process-release.js‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* eslint-disable node/no-deprecated-api */
2+
13
'use strict'
24

35
constsemver=require('semver')

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"bindings": "~1.2.1",
4242
"nan": "^2.0.0",
4343
"require-inject": "~1.3.0",
44-
"standard": "~12.0.1",
44+
"standard": "~14.3.1",
4545
"tap": "~12.7.0"
4646
},
4747
"scripts": {

‎test/process-exec-sync.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ function processExecSync (file, args, options) {
6767
}
6868
}
6969

70-
['stdout','stderr','status'].forEach(function(file){
70+
['stdout','stderr','status'].forEach(function(file){
7171
child[file]=fs.readFileSync(tmpdir+'/'+file,options.encoding)
7272
setTimeout(unlinkFile,500,tmpdir+'/'+file)
7373
})

‎test/test-addon.js‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,18 @@ function runHello (hostProcess) {
1515
hostProcess=process.execPath
1616
}
1717
vartestCode="console.log(require('hello_world').hello())"
18-
returnexecFileSync(hostProcess,['-e',testCode],{cwd: __dirname}).toString()
18+
returnexecFileSync(hostProcess,['-e',testCode],{cwd: __dirname}).toString()
1919
}
2020

2121
functiongetEncoding(){
2222
varcode='import locale;print(locale.getdefaultlocale()[1])'
23-
returnexecFileSync('python',['-c',code]).toString().trim()
23+
returnexecFileSync('python',['-c',code]).toString().trim()
2424
}
2525

2626
functioncheckCharmapValid(){
2727
vardata
2828
try{
29-
data=execFileSync('python',['fixtures/test-charmap.py'],
29+
data=execFileSync('python',['fixtures/test-charmap.py'],
3030
{cwd: __dirname})
3131
}catch(err){
3232
returnfalse
@@ -39,7 +39,7 @@ test('build simple addon', function (t) {
3939
t.plan(3)
4040

4141
// Set the loglevel otherwise the output disappears when run via 'npm test'
42-
varcmd=[nodeGyp,'rebuild','-C',addonPath,'--loglevel=verbose']
42+
varcmd=[nodeGyp,'rebuild','-C',addonPath,'--loglevel=verbose']
4343
varproc=execFile(process.execPath,cmd,function(err,stdout,stderr){
4444
varlogLines=stderr.toString().trim().split(/\r?\n/)
4545
varlastLine=logLines[logLines.length-1]
@@ -59,9 +59,9 @@ test('build simple addon in path with non-ascii characters', function (t) {
5959
}
6060

6161
vartestDirNames={
62-
'cp936': '文件夹',
63-
'cp1252': 'Latīna',
64-
'cp932': 'フォルダ'
62+
cp936: '文件夹',
63+
cp1252: 'Latīna',
64+
cp932: 'フォルダ'
6565
}
6666
// Select non-ascii characters by current encoding
6767
vartestDirName=testDirNames[getEncoding()]
@@ -136,7 +136,7 @@ test('addon works with renamed host executable', function (t) {
136136
varnotNodePath=path.join(os.tmpdir(),'notnode'+path.extname(process.execPath))
137137
fs.copyFileSync(process.execPath,notNodePath)
138138

139-
varcmd=[nodeGyp,'rebuild','-C',addonPath,'--loglevel=verbose']
139+
varcmd=[nodeGyp,'rebuild','-C',addonPath,'--loglevel=verbose']
140140
varproc=execFile(process.execPath,cmd,function(err,stdout,stderr){
141141
varlogLines=stderr.toString().trim().split(/\r?\n/)
142142
varlastLine=logLines[logLines.length-1]

‎test/test-configure-python.js‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ const gyp = require('../lib/node-gyp')
66
constrequireInject=require('require-inject')
77
constconfigure=requireInject('../lib/configure',{
88
'graceful-fs': {
9-
'openSync': function(){return0},
10-
'closeSync': function(){},
11-
'writeFile': function(file,data,cb){cb()},
12-
'stat': function(file,cb){cb(null,{})}
9+
openSync: function(){return0},
10+
closeSync: function(){},
11+
writeFile: function(file,data,cb){cb()},
12+
stat: function(file,cb){cb(null,{})}
1313
}
1414
})
1515

@@ -42,10 +42,10 @@ test('configure PYTHONPATH with existing env of one dir', function (t) {
4242
varprog=gyp()
4343
prog.parseArgv([])
4444
prog.spawn=function(){
45-
t.equal(process.env.PYTHONPATH,[EXPECTED_PYPATH,existingPath].join(SEPARATOR))
45+
t.equal(process.env.PYTHONPATH,[EXPECTED_PYPATH,existingPath].join(SEPARATOR))
4646

4747
vardirs=process.env.PYTHONPATH.split(SEPARATOR)
48-
t.deepEqual(dirs,[EXPECTED_PYPATH,existingPath])
48+
t.deepEqual(dirs,[EXPECTED_PYPATH,existingPath])
4949

5050
returnSPAWN_RESULT
5151
}
@@ -57,16 +57,16 @@ test('configure PYTHONPATH with existing env of multiple dirs', function (t) {
5757

5858
varpythonDir1=path.join('a','b')
5959
varpythonDir2=path.join('b','c')
60-
varexistingPath=[pythonDir1,pythonDir2].join(SEPARATOR)
60+
varexistingPath=[pythonDir1,pythonDir2].join(SEPARATOR)
6161
process.env.PYTHONPATH=existingPath
6262

6363
varprog=gyp()
6464
prog.parseArgv([])
6565
prog.spawn=function(){
66-
t.equal(process.env.PYTHONPATH,[EXPECTED_PYPATH,existingPath].join(SEPARATOR))
66+
t.equal(process.env.PYTHONPATH,[EXPECTED_PYPATH,existingPath].join(SEPARATOR))
6767

6868
vardirs=process.env.PYTHONPATH.split(SEPARATOR)
69-
t.deepEqual(dirs,[EXPECTED_PYPATH,pythonDir1,pythonDir2])
69+
t.deepEqual(dirs,[EXPECTED_PYPATH,pythonDir1,pythonDir2])
7070

7171
returnSPAWN_RESULT
7272
}

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

Commit 1196e99

Browse files
committed
src: update to standard@14
PR-URL: #1899 Reviewed-By: João Reis <reis@janeasystems.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com>
1 parent 53ee7df commit 1196e99

13 files changed

Lines changed: 61 additions & 57 deletions

‎bin/node-gyp.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ function errorMessage () {
131131

132132
functionissueMessage(){
133133
errorMessage()
134-
log.error('',['This is a bug in `node-gyp`.',
134+
log.error('',['This is a bug in `node-gyp`.',
135135
'Try to update node-gyp and file an Issue if it does not help:',
136136
' <https://github.com/nodejs/node-gyp/issues>'
137137
].join('\n'))

‎lib/configure.js‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ if (win) {
1717
functionconfigure(gyp,argv,callback){
1818
varpython
1919
varbuildDir=path.resolve('build')
20-
varconfigNames=['config.gypi','common.gypi']
20+
varconfigNames=['config.gypi','common.gypi']
2121
varconfigs=[]
2222
varnodeDir
2323
varrelease=processRelease(argv,gyp,process.version,process.release)
@@ -60,7 +60,7 @@ function configure (gyp, argv, callback) {
6060
// into devdir. Otherwise only install if they're not already there.
6161
gyp.opts.ensure=!gyp.opts.tarball
6262

63-
gyp.commands.install([release.version],function(err){
63+
gyp.commands.install([release.version],function(err){
6464
if(err){
6565
returncallback(err)
6666
}
@@ -132,7 +132,7 @@ function configure (gyp, argv, callback) {
132132
// set the target_arch variable
133133
variables.target_arch=gyp.opts.arch||process.arch||'ia32'
134134
if(variables.target_arch==='arm64'){
135-
defaults['msvs_configuration_platform']='ARM64'
135+
defaults.msvs_configuration_platform='ARM64'
136136
}
137137

138138
// set the node development directory
@@ -142,22 +142,22 @@ function configure (gyp, argv, callback) {
142142
variables.standalone_static_library=gyp.opts.thin ? 0 : 1
143143

144144
if(win){
145-
process.env['GYP_MSVS_VERSION']=Math.min(vsInfo.versionYear,2015)
146-
process.env['GYP_MSVS_OVERRIDE_PATH']=vsInfo.path
147-
defaults['msbuild_toolset']=vsInfo.toolset
145+
process.env.GYP_MSVS_VERSION=Math.min(vsInfo.versionYear,2015)
146+
process.env.GYP_MSVS_OVERRIDE_PATH=vsInfo.path
147+
defaults.msbuild_toolset=vsInfo.toolset
148148
if(vsInfo.sdk){
149-
defaults['msvs_windows_target_platform_version']=vsInfo.sdk
149+
defaults.msvs_windows_target_platform_version=vsInfo.sdk
150150
}
151151
if(variables.target_arch==='arm64'){
152152
if(vsInfo.versionMajor>15||
153153
(vsInfo.versionMajor===15&&vsInfo.versionMajor>=9)){
154-
defaults['msvs_enable_marmasm']=1
154+
defaults.msvs_enable_marmasm=1
155155
}else{
156156
log.warn('Compiling ARM64 assembly is only available in\n'+
157157
'Visual Studio 2017 version 15.9 and above')
158158
}
159159
}
160-
variables['msbuild_path']=vsInfo.msBuild
160+
variables.msbuild_path=vsInfo.msBuild
161161
}
162162

163163
// loop through the rest of the opts and add the unknown ones as variables.
@@ -190,7 +190,7 @@ function configure (gyp, argv, callback) {
190190
varjson=JSON.stringify(config,boolsToString,2)
191191
log.verbose('build/'+configFilename,'writing out config file: %s',configPath)
192192
configs.push(configPath)
193-
fs.writeFile(configPath,[prefix,json,''].join('\n'),findConfigs)
193+
fs.writeFile(configPath,[prefix,json,''].join('\n'),findConfigs)
194194
}
195195

196196
functionfindConfigs(err){
@@ -335,7 +335,7 @@ function configure (gyp, argv, callback) {
335335
argv.unshift(gypScript)
336336

337337
// make sure python uses files that came with this particular node package
338-
varpypath=[path.join(__dirname,'..','gyp','pylib')]
338+
varpypath=[path.join(__dirname,'..','gyp','pylib')]
339339
if(process.env.PYTHONPATH){
340340
pypath.push(process.env.PYTHONPATH)
341341
}

‎lib/find-python.js‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ function PythonFinder (configPython, callback) {
1616

1717
PythonFinder.prototype={
1818
log: logWithPrefix(log,'find Python'),
19-
argsExecutable: ['-c','import sys; print(sys.executable);'],
20-
argsVersion: ['-c','import sys; print("%s.%s.%s" % sys.version_info[:3]);'],
19+
argsExecutable: ['-c','import sys; print(sys.executable);'],
20+
argsVersion: ['-c','import sys; print("%s.%s.%s" % sys.version_info[:3]);'],
2121
semverRange: process.env.EXPERIMENTAL_NODE_GYP_PYTHON3 ? '2.7.x || >=3.5.0'
2222
: '>=2.6.0 <3.0.0',
2323

@@ -46,7 +46,7 @@ PythonFinder.prototype = {
4646

4747
functiongetChecks(){
4848
if(this.env.NODE_GYP_FORCE_PYTHON){
49-
return[{
49+
return[{
5050
before: ()=>{
5151
this.addLog(
5252
'checking Python explicitly set from NODE_GYP_FORCE_PYTHON')
@@ -55,7 +55,7 @@ PythonFinder.prototype = {
5555
},
5656
check: this.checkCommand,
5757
arg: this.env.NODE_GYP_FORCE_PYTHON
58-
}]
58+
}]
5959
}
6060

6161
varchecks=[
@@ -140,7 +140,7 @@ PythonFinder.prototype = {
140140
returnthis.fail()
141141
}
142142

143-
constargs=[runChecks.bind(this)]
143+
constargs=[runChecks.bind(this)]
144144
if(check.arg){
145145
args.unshift(check.arg)
146146
}
@@ -192,7 +192,7 @@ PythonFinder.prototype = {
192192
checkPyLauncher: functioncheckPyLauncher(errorCallback){
193193
this.log.verbose(
194194
`- executing "${this.pyLauncher}" to get Python 2 executable path`)
195-
this.run(this.pyLauncher,['-2', ...this.argsExecutable],false,
195+
this.run(this.pyLauncher,['-2', ...this.argsExecutable],false,
196196
function(err,execPath){
197197
// Possible outcomes: same as checkCommand
198198
if(err){

‎lib/install.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function install (fs, gyp, argv, callback) {
2424
if(err){
2525
log.warn('install','got an error, rolling back install')
2626
// roll-back the install if anything went wrong
27-
gyp.commands.remove([release.versionDir],function(){
27+
gyp.commands.remove([release.versionDir],function(){
2828
callback(err)
2929
})
3030
}else{
@@ -298,7 +298,7 @@ function install (fs, gyp, argv, callback) {
298298

299299
functiondownloadNodeLib(done){
300300
log.verbose('on Windows; need to download `'+release.name+'.lib`...')
301-
vararchs=['ia32','x64','arm64']
301+
vararchs=['ia32','x64','arm64']
302302
varasync=archs.length
303303
archs.forEach(function(arch){
304304
vardir=path.resolve(devDir,arch)
@@ -400,7 +400,7 @@ function download (gyp, env, url) {
400400
uri: url,
401401
headers: {
402402
'User-Agent': 'node-gyp v'+gyp.version+' (node '+process.version+')',
403-
'Connection': 'keep-alive'
403+
Connection: 'keep-alive'
404404
}
405405
}
406406

‎lib/node-gyp.js‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ const commands = [
1818
'remove'
1919
]
2020
constaliases={
21-
'ls': 'list',
22-
'rm': 'remove'
21+
ls: 'list',
22+
rm: 'remove'
2323
}
2424

2525
// differentiate node-gyp's logs from npm's
@@ -72,7 +72,7 @@ proto.configDefs = {
7272
loglevel: String,// everywhere
7373
python: String,// 'configure'
7474
'dist-url': String,// 'install'
75-
'tarball': String,// 'install'
75+
tarball: String,// 'install'
7676
jobs: String,// 'build'
7777
thin: String// 'configure'
7878
}
@@ -167,7 +167,7 @@ proto.spawn = function spawn (command, args, opts) {
167167
opts={}
168168
}
169169
if(!opts.silent&&!opts.stdio){
170-
opts.stdio=[0,1,2]
170+
opts.stdio=[0,1,2]
171171
}
172172
varcp=childProcess.spawn(command,args,opts)
173173
log.info('spawn',command)

‎lib/process-release.js‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* eslint-disable node/no-deprecated-api */
2+
13
'use strict'
24

35
constsemver=require('semver')

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"bindings": "~1.2.1",
4242
"nan": "^2.0.0",
4343
"require-inject": "~1.3.0",
44-
"standard": "~12.0.1",
44+
"standard": "~14.3.1",
4545
"tap": "~12.7.0"
4646
},
4747
"scripts": {

‎test/process-exec-sync.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ function processExecSync (file, args, options) {
6767
}
6868
}
6969

70-
['stdout','stderr','status'].forEach(function(file){
70+
['stdout','stderr','status'].forEach(function(file){
7171
child[file]=fs.readFileSync(tmpdir+'/'+file,options.encoding)
7272
setTimeout(unlinkFile,500,tmpdir+'/'+file)
7373
})

‎test/test-addon.js‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,18 @@ function runHello (hostProcess) {
1515
hostProcess=process.execPath
1616
}
1717
vartestCode="console.log(require('hello_world').hello())"
18-
returnexecFileSync(hostProcess,['-e',testCode],{cwd: __dirname}).toString()
18+
returnexecFileSync(hostProcess,['-e',testCode],{cwd: __dirname}).toString()
1919
}
2020

2121
functiongetEncoding(){
2222
varcode='import locale;print(locale.getdefaultlocale()[1])'
23-
returnexecFileSync('python',['-c',code]).toString().trim()
23+
returnexecFileSync('python',['-c',code]).toString().trim()
2424
}
2525

2626
functioncheckCharmapValid(){
2727
vardata
2828
try{
29-
data=execFileSync('python',['fixtures/test-charmap.py'],
29+
data=execFileSync('python',['fixtures/test-charmap.py'],
3030
{cwd: __dirname})
3131
}catch(err){
3232
returnfalse
@@ -39,7 +39,7 @@ test('build simple addon', function (t) {
3939
t.plan(3)
4040

4141
// Set the loglevel otherwise the output disappears when run via 'npm test'
42-
varcmd=[nodeGyp,'rebuild','-C',addonPath,'--loglevel=verbose']
42+
varcmd=[nodeGyp,'rebuild','-C',addonPath,'--loglevel=verbose']
4343
varproc=execFile(process.execPath,cmd,function(err,stdout,stderr){
4444
varlogLines=stderr.toString().trim().split(/\r?\n/)
4545
varlastLine=logLines[logLines.length-1]
@@ -59,9 +59,9 @@ test('build simple addon in path with non-ascii characters', function (t) {
5959
}
6060

6161
vartestDirNames={
62-
'cp936': '文件夹',
63-
'cp1252': 'Latīna',
64-
'cp932': 'フォルダ'
62+
cp936: '文件夹',
63+
cp1252: 'Latīna',
64+
cp932: 'フォルダ'
6565
}
6666
// Select non-ascii characters by current encoding
6767
vartestDirName=testDirNames[getEncoding()]
@@ -136,7 +136,7 @@ test('addon works with renamed host executable', function (t) {
136136
varnotNodePath=path.join(os.tmpdir(),'notnode'+path.extname(process.execPath))
137137
fs.copyFileSync(process.execPath,notNodePath)
138138

139-
varcmd=[nodeGyp,'rebuild','-C',addonPath,'--loglevel=verbose']
139+
varcmd=[nodeGyp,'rebuild','-C',addonPath,'--loglevel=verbose']
140140
varproc=execFile(process.execPath,cmd,function(err,stdout,stderr){
141141
varlogLines=stderr.toString().trim().split(/\r?\n/)
142142
varlastLine=logLines[logLines.length-1]

‎test/test-configure-python.js‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ const gyp = require('../lib/node-gyp')
66
constrequireInject=require('require-inject')
77
constconfigure=requireInject('../lib/configure',{
88
'graceful-fs': {
9-
'openSync': function(){return0},
10-
'closeSync': function(){},
11-
'writeFile': function(file,data,cb){cb()},
12-
'stat': function(file,cb){cb(null,{})}
9+
openSync: function(){return0},
10+
closeSync: function(){},
11+
writeFile: function(file,data,cb){cb()},
12+
stat: function(file,cb){cb(null,{})}
1313
}
1414
})
1515

@@ -42,10 +42,10 @@ test('configure PYTHONPATH with existing env of one dir', function (t) {
4242
varprog=gyp()
4343
prog.parseArgv([])
4444
prog.spawn=function(){
45-
t.equal(process.env.PYTHONPATH,[EXPECTED_PYPATH,existingPath].join(SEPARATOR))
45+
t.equal(process.env.PYTHONPATH,[EXPECTED_PYPATH,existingPath].join(SEPARATOR))
4646

4747
vardirs=process.env.PYTHONPATH.split(SEPARATOR)
48-
t.deepEqual(dirs,[EXPECTED_PYPATH,existingPath])
48+
t.deepEqual(dirs,[EXPECTED_PYPATH,existingPath])
4949

5050
returnSPAWN_RESULT
5151
}
@@ -57,16 +57,16 @@ test('configure PYTHONPATH with existing env of multiple dirs', function (t) {
5757

5858
varpythonDir1=path.join('a','b')
5959
varpythonDir2=path.join('b','c')
60-
varexistingPath=[pythonDir1,pythonDir2].join(SEPARATOR)
60+
varexistingPath=[pythonDir1,pythonDir2].join(SEPARATOR)
6161
process.env.PYTHONPATH=existingPath
6262

6363
varprog=gyp()
6464
prog.parseArgv([])
6565
prog.spawn=function(){
66-
t.equal(process.env.PYTHONPATH,[EXPECTED_PYPATH,existingPath].join(SEPARATOR))
66+
t.equal(process.env.PYTHONPATH,[EXPECTED_PYPATH,existingPath].join(SEPARATOR))
6767

6868
vardirs=process.env.PYTHONPATH.split(SEPARATOR)
69-
t.deepEqual(dirs,[EXPECTED_PYPATH,pythonDir1,pythonDir2])
69+
t.deepEqual(dirs,[EXPECTED_PYPATH,pythonDir1,pythonDir2])
7070

7171
returnSPAWN_RESULT
7272
}

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Commit 1196e99

Browse files
committed
src: update to standard@14
PR-URL: #1899 Reviewed-By: João Reis <reis@janeasystems.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com>
1 parent 53ee7df commit 1196e99

13 files changed

Lines changed: 61 additions & 57 deletions

‎bin/node-gyp.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ function errorMessage () {
131131

132132
functionissueMessage(){
133133
errorMessage()
134-
log.error('',['This is a bug in `node-gyp`.',
134+
log.error('',['This is a bug in `node-gyp`.',
135135
'Try to update node-gyp and file an Issue if it does not help:',
136136
' <https://github.com/nodejs/node-gyp/issues>'
137137
].join('\n'))

‎lib/configure.js‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ if (win) {
1717
functionconfigure(gyp,argv,callback){
1818
varpython
1919
varbuildDir=path.resolve('build')
20-
varconfigNames=['config.gypi','common.gypi']
20+
varconfigNames=['config.gypi','common.gypi']
2121
varconfigs=[]
2222
varnodeDir
2323
varrelease=processRelease(argv,gyp,process.version,process.release)
@@ -60,7 +60,7 @@ function configure (gyp, argv, callback) {
6060
// into devdir. Otherwise only install if they're not already there.
6161
gyp.opts.ensure=!gyp.opts.tarball
6262

63-
gyp.commands.install([release.version],function(err){
63+
gyp.commands.install([release.version],function(err){
6464
if(err){
6565
returncallback(err)
6666
}
@@ -132,7 +132,7 @@ function configure (gyp, argv, callback) {
132132
// set the target_arch variable
133133
variables.target_arch=gyp.opts.arch||process.arch||'ia32'
134134
if(variables.target_arch==='arm64'){
135-
defaults['msvs_configuration_platform']='ARM64'
135+
defaults.msvs_configuration_platform='ARM64'
136136
}
137137

138138
// set the node development directory
@@ -142,22 +142,22 @@ function configure (gyp, argv, callback) {
142142
variables.standalone_static_library=gyp.opts.thin ? 0 : 1
143143

144144
if(win){
145-
process.env['GYP_MSVS_VERSION']=Math.min(vsInfo.versionYear,2015)
146-
process.env['GYP_MSVS_OVERRIDE_PATH']=vsInfo.path
147-
defaults['msbuild_toolset']=vsInfo.toolset
145+
process.env.GYP_MSVS_VERSION=Math.min(vsInfo.versionYear,2015)
146+
process.env.GYP_MSVS_OVERRIDE_PATH=vsInfo.path
147+
defaults.msbuild_toolset=vsInfo.toolset
148148
if(vsInfo.sdk){
149-
defaults['msvs_windows_target_platform_version']=vsInfo.sdk
149+
defaults.msvs_windows_target_platform_version=vsInfo.sdk
150150
}
151151
if(variables.target_arch==='arm64'){
152152
if(vsInfo.versionMajor>15||
153153
(vsInfo.versionMajor===15&&vsInfo.versionMajor>=9)){
154-
defaults['msvs_enable_marmasm']=1
154+
defaults.msvs_enable_marmasm=1
155155
}else{
156156
log.warn('Compiling ARM64 assembly is only available in\n'+
157157
'Visual Studio 2017 version 15.9 and above')
158158
}
159159
}
160-
variables['msbuild_path']=vsInfo.msBuild
160+
variables.msbuild_path=vsInfo.msBuild
161161
}
162162

163163
// loop through the rest of the opts and add the unknown ones as variables.
@@ -190,7 +190,7 @@ function configure (gyp, argv, callback) {
190190
varjson=JSON.stringify(config,boolsToString,2)
191191
log.verbose('build/'+configFilename,'writing out config file: %s',configPath)
192192
configs.push(configPath)
193-
fs.writeFile(configPath,[prefix,json,''].join('\n'),findConfigs)
193+
fs.writeFile(configPath,[prefix,json,''].join('\n'),findConfigs)
194194
}
195195

196196
functionfindConfigs(err){
@@ -335,7 +335,7 @@ function configure (gyp, argv, callback) {
335335
argv.unshift(gypScript)
336336

337337
// make sure python uses files that came with this particular node package
338-
varpypath=[path.join(__dirname,'..','gyp','pylib')]
338+
varpypath=[path.join(__dirname,'..','gyp','pylib')]
339339
if(process.env.PYTHONPATH){
340340
pypath.push(process.env.PYTHONPATH)
341341
}

‎lib/find-python.js‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ function PythonFinder (configPython, callback) {
1616

1717
PythonFinder.prototype={
1818
log: logWithPrefix(log,'find Python'),
19-
argsExecutable: ['-c','import sys; print(sys.executable);'],
20-
argsVersion: ['-c','import sys; print("%s.%s.%s" % sys.version_info[:3]);'],
19+
argsExecutable: ['-c','import sys; print(sys.executable);'],
20+
argsVersion: ['-c','import sys; print("%s.%s.%s" % sys.version_info[:3]);'],
2121
semverRange: process.env.EXPERIMENTAL_NODE_GYP_PYTHON3 ? '2.7.x || >=3.5.0'
2222
: '>=2.6.0 <3.0.0',
2323

@@ -46,7 +46,7 @@ PythonFinder.prototype = {
4646

4747
functiongetChecks(){
4848
if(this.env.NODE_GYP_FORCE_PYTHON){
49-
return[{
49+
return[{
5050
before: ()=>{
5151
this.addLog(
5252
'checking Python explicitly set from NODE_GYP_FORCE_PYTHON')
@@ -55,7 +55,7 @@ PythonFinder.prototype = {
5555
},
5656
check: this.checkCommand,
5757
arg: this.env.NODE_GYP_FORCE_PYTHON
58-
}]
58+
}]
5959
}
6060

6161
varchecks=[
@@ -140,7 +140,7 @@ PythonFinder.prototype = {
140140
returnthis.fail()
141141
}
142142

143-
constargs=[runChecks.bind(this)]
143+
constargs=[runChecks.bind(this)]
144144
if(check.arg){
145145
args.unshift(check.arg)
146146
}
@@ -192,7 +192,7 @@ PythonFinder.prototype = {
192192
checkPyLauncher: functioncheckPyLauncher(errorCallback){
193193
this.log.verbose(
194194
`- executing "${this.pyLauncher}" to get Python 2 executable path`)
195-
this.run(this.pyLauncher,['-2', ...this.argsExecutable],false,
195+
this.run(this.pyLauncher,['-2', ...this.argsExecutable],false,
196196
function(err,execPath){
197197
// Possible outcomes: same as checkCommand
198198
if(err){

‎lib/install.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function install (fs, gyp, argv, callback) {
2424
if(err){
2525
log.warn('install','got an error, rolling back install')
2626
// roll-back the install if anything went wrong
27-
gyp.commands.remove([release.versionDir],function(){
27+
gyp.commands.remove([release.versionDir],function(){
2828
callback(err)
2929
})
3030
}else{
@@ -298,7 +298,7 @@ function install (fs, gyp, argv, callback) {
298298

299299
functiondownloadNodeLib(done){
300300
log.verbose('on Windows; need to download `'+release.name+'.lib`...')
301-
vararchs=['ia32','x64','arm64']
301+
vararchs=['ia32','x64','arm64']
302302
varasync=archs.length
303303
archs.forEach(function(arch){
304304
vardir=path.resolve(devDir,arch)
@@ -400,7 +400,7 @@ function download (gyp, env, url) {
400400
uri: url,
401401
headers: {
402402
'User-Agent': 'node-gyp v'+gyp.version+' (node '+process.version+')',
403-
'Connection': 'keep-alive'
403+
Connection: 'keep-alive'
404404
}
405405
}
406406

‎lib/node-gyp.js‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ const commands = [
1818
'remove'
1919
]
2020
constaliases={
21-
'ls': 'list',
22-
'rm': 'remove'
21+
ls: 'list',
22+
rm: 'remove'
2323
}
2424

2525
// differentiate node-gyp's logs from npm's
@@ -72,7 +72,7 @@ proto.configDefs = {
7272
loglevel: String,// everywhere
7373
python: String,// 'configure'
7474
'dist-url': String,// 'install'
75-
'tarball': String,// 'install'
75+
tarball: String,// 'install'
7676
jobs: String,// 'build'
7777
thin: String// 'configure'
7878
}
@@ -167,7 +167,7 @@ proto.spawn = function spawn (command, args, opts) {
167167
opts={}
168168
}
169169
if(!opts.silent&&!opts.stdio){
170-
opts.stdio=[0,1,2]
170+
opts.stdio=[0,1,2]
171171
}
172172
varcp=childProcess.spawn(command,args,opts)
173173
log.info('spawn',command)

‎lib/process-release.js‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* eslint-disable node/no-deprecated-api */
2+
13
'use strict'
24

35
constsemver=require('semver')

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"bindings": "~1.2.1",
4242
"nan": "^2.0.0",
4343
"require-inject": "~1.3.0",
44-
"standard": "~12.0.1",
44+
"standard": "~14.3.1",
4545
"tap": "~12.7.0"
4646
},
4747
"scripts": {

‎test/process-exec-sync.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ function processExecSync (file, args, options) {
6767
}
6868
}
6969

70-
['stdout','stderr','status'].forEach(function(file){
70+
['stdout','stderr','status'].forEach(function(file){
7171
child[file]=fs.readFileSync(tmpdir+'/'+file,options.encoding)
7272
setTimeout(unlinkFile,500,tmpdir+'/'+file)
7373
})

‎test/test-addon.js‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,18 @@ function runHello (hostProcess) {
1515
hostProcess=process.execPath
1616
}
1717
vartestCode="console.log(require('hello_world').hello())"
18-
returnexecFileSync(hostProcess,['-e',testCode],{cwd: __dirname}).toString()
18+
returnexecFileSync(hostProcess,['-e',testCode],{cwd: __dirname}).toString()
1919
}
2020

2121
functiongetEncoding(){
2222
varcode='import locale;print(locale.getdefaultlocale()[1])'
23-
returnexecFileSync('python',['-c',code]).toString().trim()
23+
returnexecFileSync('python',['-c',code]).toString().trim()
2424
}
2525

2626
functioncheckCharmapValid(){
2727
vardata
2828
try{
29-
data=execFileSync('python',['fixtures/test-charmap.py'],
29+
data=execFileSync('python',['fixtures/test-charmap.py'],
3030
{cwd: __dirname})
3131
}catch(err){
3232
returnfalse
@@ -39,7 +39,7 @@ test('build simple addon', function (t) {
3939
t.plan(3)
4040

4141
// Set the loglevel otherwise the output disappears when run via 'npm test'
42-
varcmd=[nodeGyp,'rebuild','-C',addonPath,'--loglevel=verbose']
42+
varcmd=[nodeGyp,'rebuild','-C',addonPath,'--loglevel=verbose']
4343
varproc=execFile(process.execPath,cmd,function(err,stdout,stderr){
4444
varlogLines=stderr.toString().trim().split(/\r?\n/)
4545
varlastLine=logLines[logLines.length-1]
@@ -59,9 +59,9 @@ test('build simple addon in path with non-ascii characters', function (t) {
5959
}
6060

6161
vartestDirNames={
62-
'cp936': '文件夹',
63-
'cp1252': 'Latīna',
64-
'cp932': 'フォルダ'
62+
cp936: '文件夹',
63+
cp1252: 'Latīna',
64+
cp932: 'フォルダ'
6565
}
6666
// Select non-ascii characters by current encoding
6767
vartestDirName=testDirNames[getEncoding()]
@@ -136,7 +136,7 @@ test('addon works with renamed host executable', function (t) {
136136
varnotNodePath=path.join(os.tmpdir(),'notnode'+path.extname(process.execPath))
137137
fs.copyFileSync(process.execPath,notNodePath)
138138

139-
varcmd=[nodeGyp,'rebuild','-C',addonPath,'--loglevel=verbose']
139+
varcmd=[nodeGyp,'rebuild','-C',addonPath,'--loglevel=verbose']
140140
varproc=execFile(process.execPath,cmd,function(err,stdout,stderr){
141141
varlogLines=stderr.toString().trim().split(/\r?\n/)
142142
varlastLine=logLines[logLines.length-1]

‎test/test-configure-python.js‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ const gyp = require('../lib/node-gyp')
66
constrequireInject=require('require-inject')
77
constconfigure=requireInject('../lib/configure',{
88
'graceful-fs': {
9-
'openSync': function(){return0},
10-
'closeSync': function(){},
11-
'writeFile': function(file,data,cb){cb()},
12-
'stat': function(file,cb){cb(null,{})}
9+
openSync: function(){return0},
10+
closeSync: function(){},
11+
writeFile: function(file,data,cb){cb()},
12+
stat: function(file,cb){cb(null,{})}
1313
}
1414
})
1515

@@ -42,10 +42,10 @@ test('configure PYTHONPATH with existing env of one dir', function (t) {
4242
varprog=gyp()
4343
prog.parseArgv([])
4444
prog.spawn=function(){
45-
t.equal(process.env.PYTHONPATH,[EXPECTED_PYPATH,existingPath].join(SEPARATOR))
45+
t.equal(process.env.PYTHONPATH,[EXPECTED_PYPATH,existingPath].join(SEPARATOR))
4646

4747
vardirs=process.env.PYTHONPATH.split(SEPARATOR)
48-
t.deepEqual(dirs,[EXPECTED_PYPATH,existingPath])
48+
t.deepEqual(dirs,[EXPECTED_PYPATH,existingPath])
4949

5050
returnSPAWN_RESULT
5151
}
@@ -57,16 +57,16 @@ test('configure PYTHONPATH with existing env of multiple dirs', function (t) {
5757

5858
varpythonDir1=path.join('a','b')
5959
varpythonDir2=path.join('b','c')
60-
varexistingPath=[pythonDir1,pythonDir2].join(SEPARATOR)
60+
varexistingPath=[pythonDir1,pythonDir2].join(SEPARATOR)
6161
process.env.PYTHONPATH=existingPath
6262

6363
varprog=gyp()
6464
prog.parseArgv([])
6565
prog.spawn=function(){
66-
t.equal(process.env.PYTHONPATH,[EXPECTED_PYPATH,existingPath].join(SEPARATOR))
66+
t.equal(process.env.PYTHONPATH,[EXPECTED_PYPATH,existingPath].join(SEPARATOR))
6767

6868
vardirs=process.env.PYTHONPATH.split(SEPARATOR)
69-
t.deepEqual(dirs,[EXPECTED_PYPATH,pythonDir1,pythonDir2])
69+
t.deepEqual(dirs,[EXPECTED_PYPATH,pythonDir1,pythonDir2])
7070

7171
returnSPAWN_RESULT
7272
}

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Commit 1196e99

Browse files
committed
src: update to standard@14
PR-URL: #1899 Reviewed-By: João Reis <reis@janeasystems.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com>
1 parent 53ee7df commit 1196e99

13 files changed

Lines changed: 61 additions & 57 deletions

‎bin/node-gyp.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ function errorMessage () {
131131

132132
functionissueMessage(){
133133
errorMessage()
134-
log.error('',['This is a bug in `node-gyp`.',
134+
log.error('',['This is a bug in `node-gyp`.',
135135
'Try to update node-gyp and file an Issue if it does not help:',
136136
' <https://github.com/nodejs/node-gyp/issues>'
137137
].join('\n'))

‎lib/configure.js‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ if (win) {
1717
functionconfigure(gyp,argv,callback){
1818
varpython
1919
varbuildDir=path.resolve('build')
20-
varconfigNames=['config.gypi','common.gypi']
20+
varconfigNames=['config.gypi','common.gypi']
2121
varconfigs=[]
2222
varnodeDir
2323
varrelease=processRelease(argv,gyp,process.version,process.release)
@@ -60,7 +60,7 @@ function configure (gyp, argv, callback) {
6060
// into devdir. Otherwise only install if they're not already there.
6161
gyp.opts.ensure=!gyp.opts.tarball
6262

63-
gyp.commands.install([release.version],function(err){
63+
gyp.commands.install([release.version],function(err){
6464
if(err){
6565
returncallback(err)
6666
}
@@ -132,7 +132,7 @@ function configure (gyp, argv, callback) {
132132
// set the target_arch variable
133133
variables.target_arch=gyp.opts.arch||process.arch||'ia32'
134134
if(variables.target_arch==='arm64'){
135-
defaults['msvs_configuration_platform']='ARM64'
135+
defaults.msvs_configuration_platform='ARM64'
136136
}
137137

138138
// set the node development directory
@@ -142,22 +142,22 @@ function configure (gyp, argv, callback) {
142142
variables.standalone_static_library=gyp.opts.thin ? 0 : 1
143143

144144
if(win){
145-
process.env['GYP_MSVS_VERSION']=Math.min(vsInfo.versionYear,2015)
146-
process.env['GYP_MSVS_OVERRIDE_PATH']=vsInfo.path
147-
defaults['msbuild_toolset']=vsInfo.toolset
145+
process.env.GYP_MSVS_VERSION=Math.min(vsInfo.versionYear,2015)
146+
process.env.GYP_MSVS_OVERRIDE_PATH=vsInfo.path
147+
defaults.msbuild_toolset=vsInfo.toolset
148148
if(vsInfo.sdk){
149-
defaults['msvs_windows_target_platform_version']=vsInfo.sdk
149+
defaults.msvs_windows_target_platform_version=vsInfo.sdk
150150
}
151151
if(variables.target_arch==='arm64'){
152152
if(vsInfo.versionMajor>15||
153153
(vsInfo.versionMajor===15&&vsInfo.versionMajor>=9)){
154-
defaults['msvs_enable_marmasm']=1
154+
defaults.msvs_enable_marmasm=1
155155
}else{
156156
log.warn('Compiling ARM64 assembly is only available in\n'+
157157
'Visual Studio 2017 version 15.9 and above')
158158
}
159159
}
160-
variables['msbuild_path']=vsInfo.msBuild
160+
variables.msbuild_path=vsInfo.msBuild
161161
}
162162

163163
// loop through the rest of the opts and add the unknown ones as variables.
@@ -190,7 +190,7 @@ function configure (gyp, argv, callback) {
190190
varjson=JSON.stringify(config,boolsToString,2)
191191
log.verbose('build/'+configFilename,'writing out config file: %s',configPath)
192192
configs.push(configPath)
193-
fs.writeFile(configPath,[prefix,json,''].join('\n'),findConfigs)
193+
fs.writeFile(configPath,[prefix,json,''].join('\n'),findConfigs)
194194
}
195195

196196
functionfindConfigs(err){
@@ -335,7 +335,7 @@ function configure (gyp, argv, callback) {
335335
argv.unshift(gypScript)
336336

337337
// make sure python uses files that came with this particular node package
338-
varpypath=[path.join(__dirname,'..','gyp','pylib')]
338+
varpypath=[path.join(__dirname,'..','gyp','pylib')]
339339
if(process.env.PYTHONPATH){
340340
pypath.push(process.env.PYTHONPATH)
341341
}

‎lib/find-python.js‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ function PythonFinder (configPython, callback) {
1616

1717
PythonFinder.prototype={
1818
log: logWithPrefix(log,'find Python'),
19-
argsExecutable: ['-c','import sys; print(sys.executable);'],
20-
argsVersion: ['-c','import sys; print("%s.%s.%s" % sys.version_info[:3]);'],
19+
argsExecutable: ['-c','import sys; print(sys.executable);'],
20+
argsVersion: ['-c','import sys; print("%s.%s.%s" % sys.version_info[:3]);'],
2121
semverRange: process.env.EXPERIMENTAL_NODE_GYP_PYTHON3 ? '2.7.x || >=3.5.0'
2222
: '>=2.6.0 <3.0.0',
2323

@@ -46,7 +46,7 @@ PythonFinder.prototype = {
4646

4747
functiongetChecks(){
4848
if(this.env.NODE_GYP_FORCE_PYTHON){
49-
return[{
49+
return[{
5050
before: ()=>{
5151
this.addLog(
5252
'checking Python explicitly set from NODE_GYP_FORCE_PYTHON')
@@ -55,7 +55,7 @@ PythonFinder.prototype = {
5555
},
5656
check: this.checkCommand,
5757
arg: this.env.NODE_GYP_FORCE_PYTHON
58-
}]
58+
}]
5959
}
6060

6161
varchecks=[
@@ -140,7 +140,7 @@ PythonFinder.prototype = {
140140
returnthis.fail()
141141
}
142142

143-
constargs=[runChecks.bind(this)]
143+
constargs=[runChecks.bind(this)]
144144
if(check.arg){
145145
args.unshift(check.arg)
146146
}
@@ -192,7 +192,7 @@ PythonFinder.prototype = {
192192
checkPyLauncher: functioncheckPyLauncher(errorCallback){
193193
this.log.verbose(
194194
`- executing "${this.pyLauncher}" to get Python 2 executable path`)
195-
this.run(this.pyLauncher,['-2', ...this.argsExecutable],false,
195+
this.run(this.pyLauncher,['-2', ...this.argsExecutable],false,
196196
function(err,execPath){
197197
// Possible outcomes: same as checkCommand
198198
if(err){

‎lib/install.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function install (fs, gyp, argv, callback) {
2424
if(err){
2525
log.warn('install','got an error, rolling back install')
2626
// roll-back the install if anything went wrong
27-
gyp.commands.remove([release.versionDir],function(){
27+
gyp.commands.remove([release.versionDir],function(){
2828
callback(err)
2929
})
3030
}else{
@@ -298,7 +298,7 @@ function install (fs, gyp, argv, callback) {
298298

299299
functiondownloadNodeLib(done){
300300
log.verbose('on Windows; need to download `'+release.name+'.lib`...')
301-
vararchs=['ia32','x64','arm64']
301+
vararchs=['ia32','x64','arm64']
302302
varasync=archs.length
303303
archs.forEach(function(arch){
304304
vardir=path.resolve(devDir,arch)
@@ -400,7 +400,7 @@ function download (gyp, env, url) {
400400
uri: url,
401401
headers: {
402402
'User-Agent': 'node-gyp v'+gyp.version+' (node '+process.version+')',
403-
'Connection': 'keep-alive'
403+
Connection: 'keep-alive'
404404
}
405405
}
406406

‎lib/node-gyp.js‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ const commands = [
1818
'remove'
1919
]
2020
constaliases={
21-
'ls': 'list',
22-
'rm': 'remove'
21+
ls: 'list',
22+
rm: 'remove'
2323
}
2424

2525
// differentiate node-gyp's logs from npm's
@@ -72,7 +72,7 @@ proto.configDefs = {
7272
loglevel: String,// everywhere
7373
python: String,// 'configure'
7474
'dist-url': String,// 'install'
75-
'tarball': String,// 'install'
75+
tarball: String,// 'install'
7676
jobs: String,// 'build'
7777
thin: String// 'configure'
7878
}
@@ -167,7 +167,7 @@ proto.spawn = function spawn (command, args, opts) {
167167
opts={}
168168
}
169169
if(!opts.silent&&!opts.stdio){
170-
opts.stdio=[0,1,2]
170+
opts.stdio=[0,1,2]
171171
}
172172
varcp=childProcess.spawn(command,args,opts)
173173
log.info('spawn',command)

‎lib/process-release.js‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* eslint-disable node/no-deprecated-api */
2+
13
'use strict'
24

35
constsemver=require('semver')

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"bindings": "~1.2.1",
4242
"nan": "^2.0.0",
4343
"require-inject": "~1.3.0",
44-
"standard": "~12.0.1",
44+
"standard": "~14.3.1",
4545
"tap": "~12.7.0"
4646
},
4747
"scripts": {

‎test/process-exec-sync.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ function processExecSync (file, args, options) {
6767
}
6868
}
6969

70-
['stdout','stderr','status'].forEach(function(file){
70+
['stdout','stderr','status'].forEach(function(file){
7171
child[file]=fs.readFileSync(tmpdir+'/'+file,options.encoding)
7272
setTimeout(unlinkFile,500,tmpdir+'/'+file)
7373
})

‎test/test-addon.js‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,18 @@ function runHello (hostProcess) {
1515
hostProcess=process.execPath
1616
}
1717
vartestCode="console.log(require('hello_world').hello())"
18-
returnexecFileSync(hostProcess,['-e',testCode],{cwd: __dirname}).toString()
18+
returnexecFileSync(hostProcess,['-e',testCode],{cwd: __dirname}).toString()
1919
}
2020

2121
functiongetEncoding(){
2222
varcode='import locale;print(locale.getdefaultlocale()[1])'
23-
returnexecFileSync('python',['-c',code]).toString().trim()
23+
returnexecFileSync('python',['-c',code]).toString().trim()
2424
}
2525

2626
functioncheckCharmapValid(){
2727
vardata
2828
try{
29-
data=execFileSync('python',['fixtures/test-charmap.py'],
29+
data=execFileSync('python',['fixtures/test-charmap.py'],
3030
{cwd: __dirname})
3131
}catch(err){
3232
returnfalse
@@ -39,7 +39,7 @@ test('build simple addon', function (t) {
3939
t.plan(3)
4040

4141
// Set the loglevel otherwise the output disappears when run via 'npm test'
42-
varcmd=[nodeGyp,'rebuild','-C',addonPath,'--loglevel=verbose']
42+
varcmd=[nodeGyp,'rebuild','-C',addonPath,'--loglevel=verbose']
4343
varproc=execFile(process.execPath,cmd,function(err,stdout,stderr){
4444
varlogLines=stderr.toString().trim().split(/\r?\n/)
4545
varlastLine=logLines[logLines.length-1]
@@ -59,9 +59,9 @@ test('build simple addon in path with non-ascii characters', function (t) {
5959
}
6060

6161
vartestDirNames={
62-
'cp936': '文件夹',
63-
'cp1252': 'Latīna',
64-
'cp932': 'フォルダ'
62+
cp936: '文件夹',
63+
cp1252: 'Latīna',
64+
cp932: 'フォルダ'
6565
}
6666
// Select non-ascii characters by current encoding
6767
vartestDirName=testDirNames[getEncoding()]
@@ -136,7 +136,7 @@ test('addon works with renamed host executable', function (t) {
136136
varnotNodePath=path.join(os.tmpdir(),'notnode'+path.extname(process.execPath))
137137
fs.copyFileSync(process.execPath,notNodePath)
138138

139-
varcmd=[nodeGyp,'rebuild','-C',addonPath,'--loglevel=verbose']
139+
varcmd=[nodeGyp,'rebuild','-C',addonPath,'--loglevel=verbose']
140140
varproc=execFile(process.execPath,cmd,function(err,stdout,stderr){
141141
varlogLines=stderr.toString().trim().split(/\r?\n/)
142142
varlastLine=logLines[logLines.length-1]

‎test/test-configure-python.js‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ const gyp = require('../lib/node-gyp')
66
constrequireInject=require('require-inject')
77
constconfigure=requireInject('../lib/configure',{
88
'graceful-fs': {
9-
'openSync': function(){return0},
10-
'closeSync': function(){},
11-
'writeFile': function(file,data,cb){cb()},
12-
'stat': function(file,cb){cb(null,{})}
9+
openSync: function(){return0},
10+
closeSync: function(){},
11+
writeFile: function(file,data,cb){cb()},
12+
stat: function(file,cb){cb(null,{})}
1313
}
1414
})
1515

@@ -42,10 +42,10 @@ test('configure PYTHONPATH with existing env of one dir', function (t) {
4242
varprog=gyp()
4343
prog.parseArgv([])
4444
prog.spawn=function(){
45-
t.equal(process.env.PYTHONPATH,[EXPECTED_PYPATH,existingPath].join(SEPARATOR))
45+
t.equal(process.env.PYTHONPATH,[EXPECTED_PYPATH,existingPath].join(SEPARATOR))
4646

4747
vardirs=process.env.PYTHONPATH.split(SEPARATOR)
48-
t.deepEqual(dirs,[EXPECTED_PYPATH,existingPath])
48+
t.deepEqual(dirs,[EXPECTED_PYPATH,existingPath])
4949

5050
returnSPAWN_RESULT
5151
}
@@ -57,16 +57,16 @@ test('configure PYTHONPATH with existing env of multiple dirs', function (t) {
5757

5858
varpythonDir1=path.join('a','b')
5959
varpythonDir2=path.join('b','c')
60-
varexistingPath=[pythonDir1,pythonDir2].join(SEPARATOR)
60+
varexistingPath=[pythonDir1,pythonDir2].join(SEPARATOR)
6161
process.env.PYTHONPATH=existingPath
6262

6363
varprog=gyp()
6464
prog.parseArgv([])
6565
prog.spawn=function(){
66-
t.equal(process.env.PYTHONPATH,[EXPECTED_PYPATH,existingPath].join(SEPARATOR))
66+
t.equal(process.env.PYTHONPATH,[EXPECTED_PYPATH,existingPath].join(SEPARATOR))
6767

6868
vardirs=process.env.PYTHONPATH.split(SEPARATOR)
69-
t.deepEqual(dirs,[EXPECTED_PYPATH,pythonDir1,pythonDir2])
69+
t.deepEqual(dirs,[EXPECTED_PYPATH,pythonDir1,pythonDir2])
7070

7171
returnSPAWN_RESULT
7272
}

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

Commit 1196e99

Browse files
committed
src: update to standard@14
PR-URL: #1899 Reviewed-By: João Reis <reis@janeasystems.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com>
1 parent 53ee7df commit 1196e99

13 files changed

Lines changed: 61 additions & 57 deletions

‎bin/node-gyp.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ function errorMessage () {
131131

132132
functionissueMessage(){
133133
errorMessage()
134-
log.error('',['This is a bug in `node-gyp`.',
134+
log.error('',['This is a bug in `node-gyp`.',
135135
'Try to update node-gyp and file an Issue if it does not help:',
136136
' <https://github.com/nodejs/node-gyp/issues>'
137137
].join('\n'))

‎lib/configure.js‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ if (win) {
1717
functionconfigure(gyp,argv,callback){
1818
varpython
1919
varbuildDir=path.resolve('build')
20-
varconfigNames=['config.gypi','common.gypi']
20+
varconfigNames=['config.gypi','common.gypi']
2121
varconfigs=[]
2222
varnodeDir
2323
varrelease=processRelease(argv,gyp,process.version,process.release)
@@ -60,7 +60,7 @@ function configure (gyp, argv, callback) {
6060
// into devdir. Otherwise only install if they're not already there.
6161
gyp.opts.ensure=!gyp.opts.tarball
6262

63-
gyp.commands.install([release.version],function(err){
63+
gyp.commands.install([release.version],function(err){
6464
if(err){
6565
returncallback(err)
6666
}
@@ -132,7 +132,7 @@ function configure (gyp, argv, callback) {
132132
// set the target_arch variable
133133
variables.target_arch=gyp.opts.arch||process.arch||'ia32'
134134
if(variables.target_arch==='arm64'){
135-
defaults['msvs_configuration_platform']='ARM64'
135+
defaults.msvs_configuration_platform='ARM64'
136136
}
137137

138138
// set the node development directory
@@ -142,22 +142,22 @@ function configure (gyp, argv, callback) {
142142
variables.standalone_static_library=gyp.opts.thin ? 0 : 1
143143

144144
if(win){
145-
process.env['GYP_MSVS_VERSION']=Math.min(vsInfo.versionYear,2015)
146-
process.env['GYP_MSVS_OVERRIDE_PATH']=vsInfo.path
147-
defaults['msbuild_toolset']=vsInfo.toolset
145+
process.env.GYP_MSVS_VERSION=Math.min(vsInfo.versionYear,2015)
146+
process.env.GYP_MSVS_OVERRIDE_PATH=vsInfo.path
147+
defaults.msbuild_toolset=vsInfo.toolset
148148
if(vsInfo.sdk){
149-
defaults['msvs_windows_target_platform_version']=vsInfo.sdk
149+
defaults.msvs_windows_target_platform_version=vsInfo.sdk
150150
}
151151
if(variables.target_arch==='arm64'){
152152
if(vsInfo.versionMajor>15||
153153
(vsInfo.versionMajor===15&&vsInfo.versionMajor>=9)){
154-
defaults['msvs_enable_marmasm']=1
154+
defaults.msvs_enable_marmasm=1
155155
}else{
156156
log.warn('Compiling ARM64 assembly is only available in\n'+
157157
'Visual Studio 2017 version 15.9 and above')
158158
}
159159
}
160-
variables['msbuild_path']=vsInfo.msBuild
160+
variables.msbuild_path=vsInfo.msBuild
161161
}
162162

163163
// loop through the rest of the opts and add the unknown ones as variables.
@@ -190,7 +190,7 @@ function configure (gyp, argv, callback) {
190190
varjson=JSON.stringify(config,boolsToString,2)
191191
log.verbose('build/'+configFilename,'writing out config file: %s',configPath)
192192
configs.push(configPath)
193-
fs.writeFile(configPath,[prefix,json,''].join('\n'),findConfigs)
193+
fs.writeFile(configPath,[prefix,json,''].join('\n'),findConfigs)
194194
}
195195

196196
functionfindConfigs(err){
@@ -335,7 +335,7 @@ function configure (gyp, argv, callback) {
335335
argv.unshift(gypScript)
336336

337337
// make sure python uses files that came with this particular node package
338-
varpypath=[path.join(__dirname,'..','gyp','pylib')]
338+
varpypath=[path.join(__dirname,'..','gyp','pylib')]
339339
if(process.env.PYTHONPATH){
340340
pypath.push(process.env.PYTHONPATH)
341341
}

‎lib/find-python.js‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ function PythonFinder (configPython, callback) {
1616

1717
PythonFinder.prototype={
1818
log: logWithPrefix(log,'find Python'),
19-
argsExecutable: ['-c','import sys; print(sys.executable);'],
20-
argsVersion: ['-c','import sys; print("%s.%s.%s" % sys.version_info[:3]);'],
19+
argsExecutable: ['-c','import sys; print(sys.executable);'],
20+
argsVersion: ['-c','import sys; print("%s.%s.%s" % sys.version_info[:3]);'],
2121
semverRange: process.env.EXPERIMENTAL_NODE_GYP_PYTHON3 ? '2.7.x || >=3.5.0'
2222
: '>=2.6.0 <3.0.0',
2323

@@ -46,7 +46,7 @@ PythonFinder.prototype = {
4646

4747
functiongetChecks(){
4848
if(this.env.NODE_GYP_FORCE_PYTHON){
49-
return[{
49+
return[{
5050
before: ()=>{
5151
this.addLog(
5252
'checking Python explicitly set from NODE_GYP_FORCE_PYTHON')
@@ -55,7 +55,7 @@ PythonFinder.prototype = {
5555
},
5656
check: this.checkCommand,
5757
arg: this.env.NODE_GYP_FORCE_PYTHON
58-
}]
58+
}]
5959
}
6060

6161
varchecks=[
@@ -140,7 +140,7 @@ PythonFinder.prototype = {
140140
returnthis.fail()
141141
}
142142

143-
constargs=[runChecks.bind(this)]
143+
constargs=[runChecks.bind(this)]
144144
if(check.arg){
145145
args.unshift(check.arg)
146146
}
@@ -192,7 +192,7 @@ PythonFinder.prototype = {
192192
checkPyLauncher: functioncheckPyLauncher(errorCallback){
193193
this.log.verbose(
194194
`- executing "${this.pyLauncher}" to get Python 2 executable path`)
195-
this.run(this.pyLauncher,['-2', ...this.argsExecutable],false,
195+
this.run(this.pyLauncher,['-2', ...this.argsExecutable],false,
196196
function(err,execPath){
197197
// Possible outcomes: same as checkCommand
198198
if(err){

‎lib/install.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function install (fs, gyp, argv, callback) {
2424
if(err){
2525
log.warn('install','got an error, rolling back install')
2626
// roll-back the install if anything went wrong
27-
gyp.commands.remove([release.versionDir],function(){
27+
gyp.commands.remove([release.versionDir],function(){
2828
callback(err)
2929
})
3030
}else{
@@ -298,7 +298,7 @@ function install (fs, gyp, argv, callback) {
298298

299299
functiondownloadNodeLib(done){
300300
log.verbose('on Windows; need to download `'+release.name+'.lib`...')
301-
vararchs=['ia32','x64','arm64']
301+
vararchs=['ia32','x64','arm64']
302302
varasync=archs.length
303303
archs.forEach(function(arch){
304304
vardir=path.resolve(devDir,arch)
@@ -400,7 +400,7 @@ function download (gyp, env, url) {
400400
uri: url,
401401
headers: {
402402
'User-Agent': 'node-gyp v'+gyp.version+' (node '+process.version+')',
403-
'Connection': 'keep-alive'
403+
Connection: 'keep-alive'
404404
}
405405
}
406406

‎lib/node-gyp.js‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ const commands = [
1818
'remove'
1919
]
2020
constaliases={
21-
'ls': 'list',
22-
'rm': 'remove'
21+
ls: 'list',
22+
rm: 'remove'
2323
}
2424

2525
// differentiate node-gyp's logs from npm's
@@ -72,7 +72,7 @@ proto.configDefs = {
7272
loglevel: String,// everywhere
7373
python: String,// 'configure'
7474
'dist-url': String,// 'install'
75-
'tarball': String,// 'install'
75+
tarball: String,// 'install'
7676
jobs: String,// 'build'
7777
thin: String// 'configure'
7878
}
@@ -167,7 +167,7 @@ proto.spawn = function spawn (command, args, opts) {
167167
opts={}
168168
}
169169
if(!opts.silent&&!opts.stdio){
170-
opts.stdio=[0,1,2]
170+
opts.stdio=[0,1,2]
171171
}
172172
varcp=childProcess.spawn(command,args,opts)
173173
log.info('spawn',command)

‎lib/process-release.js‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* eslint-disable node/no-deprecated-api */
2+
13
'use strict'
24

35
constsemver=require('semver')

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"bindings": "~1.2.1",
4242
"nan": "^2.0.0",
4343
"require-inject": "~1.3.0",
44-
"standard": "~12.0.1",
44+
"standard": "~14.3.1",
4545
"tap": "~12.7.0"
4646
},
4747
"scripts": {

‎test/process-exec-sync.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ function processExecSync (file, args, options) {
6767
}
6868
}
6969

70-
['stdout','stderr','status'].forEach(function(file){
70+
['stdout','stderr','status'].forEach(function(file){
7171
child[file]=fs.readFileSync(tmpdir+'/'+file,options.encoding)
7272
setTimeout(unlinkFile,500,tmpdir+'/'+file)
7373
})

‎test/test-addon.js‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,18 @@ function runHello (hostProcess) {
1515
hostProcess=process.execPath
1616
}
1717
vartestCode="console.log(require('hello_world').hello())"
18-
returnexecFileSync(hostProcess,['-e',testCode],{cwd: __dirname}).toString()
18+
returnexecFileSync(hostProcess,['-e',testCode],{cwd: __dirname}).toString()
1919
}
2020

2121
functiongetEncoding(){
2222
varcode='import locale;print(locale.getdefaultlocale()[1])'
23-
returnexecFileSync('python',['-c',code]).toString().trim()
23+
returnexecFileSync('python',['-c',code]).toString().trim()
2424
}
2525

2626
functioncheckCharmapValid(){
2727
vardata
2828
try{
29-
data=execFileSync('python',['fixtures/test-charmap.py'],
29+
data=execFileSync('python',['fixtures/test-charmap.py'],
3030
{cwd: __dirname})
3131
}catch(err){
3232
returnfalse
@@ -39,7 +39,7 @@ test('build simple addon', function (t) {
3939
t.plan(3)
4040

4141
// Set the loglevel otherwise the output disappears when run via 'npm test'
42-
varcmd=[nodeGyp,'rebuild','-C',addonPath,'--loglevel=verbose']
42+
varcmd=[nodeGyp,'rebuild','-C',addonPath,'--loglevel=verbose']
4343
varproc=execFile(process.execPath,cmd,function(err,stdout,stderr){
4444
varlogLines=stderr.toString().trim().split(/\r?\n/)
4545
varlastLine=logLines[logLines.length-1]
@@ -59,9 +59,9 @@ test('build simple addon in path with non-ascii characters', function (t) {
5959
}
6060

6161
vartestDirNames={
62-
'cp936': '文件夹',
63-
'cp1252': 'Latīna',
64-
'cp932': 'フォルダ'
62+
cp936: '文件夹',
63+
cp1252: 'Latīna',
64+
cp932: 'フォルダ'
6565
}
6666
// Select non-ascii characters by current encoding
6767
vartestDirName=testDirNames[getEncoding()]
@@ -136,7 +136,7 @@ test('addon works with renamed host executable', function (t) {
136136
varnotNodePath=path.join(os.tmpdir(),'notnode'+path.extname(process.execPath))
137137
fs.copyFileSync(process.execPath,notNodePath)
138138

139-
varcmd=[nodeGyp,'rebuild','-C',addonPath,'--loglevel=verbose']
139+
varcmd=[nodeGyp,'rebuild','-C',addonPath,'--loglevel=verbose']
140140
varproc=execFile(process.execPath,cmd,function(err,stdout,stderr){
141141
varlogLines=stderr.toString().trim().split(/\r?\n/)
142142
varlastLine=logLines[logLines.length-1]

‎test/test-configure-python.js‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ const gyp = require('../lib/node-gyp')
66
constrequireInject=require('require-inject')
77
constconfigure=requireInject('../lib/configure',{
88
'graceful-fs': {
9-
'openSync': function(){return0},
10-
'closeSync': function(){},
11-
'writeFile': function(file,data,cb){cb()},
12-
'stat': function(file,cb){cb(null,{})}
9+
openSync: function(){return0},
10+
closeSync: function(){},
11+
writeFile: function(file,data,cb){cb()},
12+
stat: function(file,cb){cb(null,{})}
1313
}
1414
})
1515

@@ -42,10 +42,10 @@ test('configure PYTHONPATH with existing env of one dir', function (t) {
4242
varprog=gyp()
4343
prog.parseArgv([])
4444
prog.spawn=function(){
45-
t.equal(process.env.PYTHONPATH,[EXPECTED_PYPATH,existingPath].join(SEPARATOR))
45+
t.equal(process.env.PYTHONPATH,[EXPECTED_PYPATH,existingPath].join(SEPARATOR))
4646

4747
vardirs=process.env.PYTHONPATH.split(SEPARATOR)
48-
t.deepEqual(dirs,[EXPECTED_PYPATH,existingPath])
48+
t.deepEqual(dirs,[EXPECTED_PYPATH,existingPath])
4949

5050
returnSPAWN_RESULT
5151
}
@@ -57,16 +57,16 @@ test('configure PYTHONPATH with existing env of multiple dirs', function (t) {
5757

5858
varpythonDir1=path.join('a','b')
5959
varpythonDir2=path.join('b','c')
60-
varexistingPath=[pythonDir1,pythonDir2].join(SEPARATOR)
60+
varexistingPath=[pythonDir1,pythonDir2].join(SEPARATOR)
6161
process.env.PYTHONPATH=existingPath
6262

6363
varprog=gyp()
6464
prog.parseArgv([])
6565
prog.spawn=function(){
66-
t.equal(process.env.PYTHONPATH,[EXPECTED_PYPATH,existingPath].join(SEPARATOR))
66+
t.equal(process.env.PYTHONPATH,[EXPECTED_PYPATH,existingPath].join(SEPARATOR))
6767

6868
vardirs=process.env.PYTHONPATH.split(SEPARATOR)
69-
t.deepEqual(dirs,[EXPECTED_PYPATH,pythonDir1,pythonDir2])
69+
t.deepEqual(dirs,[EXPECTED_PYPATH,pythonDir1,pythonDir2])
7070

7171
returnSPAWN_RESULT
7272
}

0 commit comments

Comments
 (0)