Skip to content

Commit d13f067

Browse files
committed
@npmcli/run-script@3.0.1
1 parent a0900bd commit d13f067

File tree

126 files changed

+42866
-15
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

126 files changed

+42866
-15
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../node-gyp/bin/node-gyp.js
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Contributing to node-gyp
2+
3+
## Code of Conduct
4+
5+
Please read the
6+
[Code of Conduct](https://github.com/nodejs/admin/blob/master/CODE_OF_CONDUCT.md)
7+
which explains the minimum behavior expectations for node-gyp contributors.
8+
9+
<a id="developers-certificate-of-origin"></a>
10+
## Developer's Certificate of Origin 1.1
11+
12+
By making a contribution to this project, I certify that:
13+
14+
* (a) The contribution was created in whole or in part by me and I
15+
have the right to submit it under the open source license
16+
indicated in the file; or
17+
18+
* (b) The contribution is based upon previous work that, to the best
19+
of my knowledge, is covered under an appropriate open source
20+
license and I have the right under that license to submit that
21+
work with modifications, whether created in whole or in part
22+
by me, under the same open source license (unless I am
23+
permitted to submit under a different license), as indicated
24+
in the file; or
25+
26+
* (c) The contribution was provided directly to me by some other
27+
person who certified (a), (b) or (c) and I have not modified
28+
it.
29+
30+
* (d) I understand and agree that this project and the contribution
31+
are public and that a record of the contribution (including all
32+
personal information I submit with it, including my sign-off) is
33+
maintained indefinitely and may be redistributed consistent with
34+
this project or the open source license(s) involved.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
(The MIT License)
2+
3+
Copyright (c) 2012 Nathan Rajlich <nathan@tootallnate.net>
4+
5+
Permission is hereby granted, free of charge, to any person
6+
obtaining a copy of this software and associated documentation
7+
files (the "Software"), to deal in the Software without
8+
restriction, including without limitation the rights to use,
9+
copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the
11+
Software is furnished to do so, subject to the following
12+
conditions:
13+
14+
The above copyright notice and this permission notice shall be
15+
included in all copies or substantial portions of the Software.
16+
17+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
19+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
21+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
22+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24+
OTHER DEALINGS IN THE SOFTWARE.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
If you believe you have found a security issue in the software in this
2+
repository, please consult https://github.com/nodejs/node/blob/HEAD/SECURITY.md.
Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
{
2+
'variables' : {
3+
'node_engine_include_dir%': 'deps/v8/include',
4+
'node_host_binary%': 'node',
5+
'node_with_ltcg%': 'true',
6+
},
7+
'target_defaults': {
8+
'type': 'loadable_module',
9+
'win_delay_load_hook': 'true',
10+
'product_prefix': '',
11+
12+
'conditions': [
13+
[ 'node_engine=="chakracore"', {
14+
'variables': {
15+
'node_engine_include_dir%': 'deps/chakrashim/include'
16+
},
17+
}]
18+
],
19+
20+
'include_dirs': [
21+
'<(node_root_dir)/include/node',
22+
'<(node_root_dir)/src',
23+
'<(node_root_dir)/deps/openssl/config',
24+
'<(node_root_dir)/deps/openssl/openssl/include',
25+
'<(node_root_dir)/deps/uv/include',
26+
'<(node_root_dir)/deps/zlib',
27+
'<(node_root_dir)/<(node_engine_include_dir)'
28+
],
29+
'defines!': [
30+
'BUILDING_UV_SHARED=1', # Inherited from common.gypi.
31+
'BUILDING_V8_SHARED=1', # Inherited from common.gypi.
32+
],
33+
'defines': [
34+
'NODE_GYP_MODULE_NAME=>(_target_name)',
35+
'USING_UV_SHARED=1',
36+
'USING_V8_SHARED=1',
37+
# Warn when using deprecated V8 APIs.
38+
'V8_DEPRECATION_WARNINGS=1'
39+
],
40+
41+
'target_conditions': [
42+
['_type=="loadable_module"', {
43+
'product_extension': 'node',
44+
'defines': [
45+
'BUILDING_NODE_EXTENSION'
46+
],
47+
'xcode_settings': {
48+
'OTHER_LDFLAGS': [
49+
'-undefined dynamic_lookup'
50+
],
51+
},
52+
}],
53+
54+
['_type=="static_library"', {
55+
# set to `1` to *disable* the -T thin archive 'ld' flag.
56+
# older linkers don't support this flag.
57+
'standalone_static_library': '<(standalone_static_library)'
58+
}],
59+
60+
['_type!="executable"', {
61+
'conditions': [
62+
[ 'OS=="android"', {
63+
'cflags!': [ '-fPIE' ],
64+
}]
65+
]
66+
}],
67+
68+
['_win_delay_load_hook=="true"', {
69+
# If the addon specifies `'win_delay_load_hook': 'true'` in its
70+
# binding.gyp, link a delay-load hook into the DLL. This hook ensures
71+
# that the addon will work regardless of whether the node/iojs binary
72+
# is named node.exe, iojs.exe, or something else.
73+
'conditions': [
74+
[ 'OS=="win"', {
75+
'defines': [ 'HOST_BINARY=\"<(node_host_binary)<(EXECUTABLE_SUFFIX)\"', ],
76+
'sources': [
77+
'<(node_gyp_dir)/src/win_delay_load_hook.cc',
78+
],
79+
'msvs_settings': {
80+
'VCLinkerTool': {
81+
'DelayLoadDLLs': [ '<(node_host_binary)<(EXECUTABLE_SUFFIX)' ],
82+
# Don't print a linker warning when no imports from either .exe
83+
# are used.
84+
'AdditionalOptions': [ '/ignore:4199' ],
85+
},
86+
},
87+
}],
88+
],
89+
}],
90+
],
91+
92+
'conditions': [
93+
[ 'OS=="mac"', {
94+
'defines': [
95+
'_DARWIN_USE_64_BIT_INODE=1'
96+
],
97+
'xcode_settings': {
98+
'DYLIB_INSTALL_NAME_BASE': '@rpath'
99+
},
100+
}],
101+
[ 'OS=="aix"', {
102+
'ldflags': [
103+
'-Wl,-bimport:<(node_exp_file)'
104+
],
105+
}],
106+
[ 'OS=="zos"', {
107+
'cflags': [
108+
'-q64',
109+
'-Wc,DLL',
110+
'-qlonglong',
111+
'-qenum=int',
112+
'-qxclang=-fexec-charset=ISO8859-1'
113+
],
114+
'defines': [
115+
'_ALL_SOURCE=1',
116+
'MAP_FAILED=-1',
117+
'_UNIX03_SOURCE=1'
118+
],
119+
'ldflags': [
120+
'-q64',
121+
'<(node_exp_file)'
122+
],
123+
}],
124+
[ 'OS=="win"', {
125+
'conditions': [
126+
['node_engine=="chakracore"', {
127+
'library_dirs': [ '<(node_root_dir)/$(ConfigurationName)' ],
128+
'libraries': [ '<@(node_engine_libs)' ],
129+
}],
130+
['node_with_ltcg=="true"', {
131+
'msvs_settings': {
132+
'VCCLCompilerTool': {
133+
'WholeProgramOptimization': 'true' # /GL, whole program optimization, needed for LTCG
134+
},
135+
'VCLibrarianTool': {
136+
'AdditionalOptions': [
137+
'/LTCG:INCREMENTAL', # incremental link-time code generation
138+
]
139+
},
140+
'VCLinkerTool': {
141+
'OptimizeReferences': 2, # /OPT:REF
142+
'EnableCOMDATFolding': 2, # /OPT:ICF
143+
'LinkIncremental': 1, # disable incremental linking
144+
'AdditionalOptions': [
145+
'/LTCG:INCREMENTAL', # incremental link-time code generation
146+
]
147+
}
148+
}
149+
}]
150+
],
151+
'libraries': [
152+
'-lkernel32.lib',
153+
'-luser32.lib',
154+
'-lgdi32.lib',
155+
'-lwinspool.lib',
156+
'-lcomdlg32.lib',
157+
'-ladvapi32.lib',
158+
'-lshell32.lib',
159+
'-lole32.lib',
160+
'-loleaut32.lib',
161+
'-luuid.lib',
162+
'-lodbc32.lib',
163+
'-lDelayImp.lib',
164+
'-l"<(node_lib_file)"'
165+
],
166+
'msvs_disabled_warnings': [
167+
# warning C4251: 'node::ObjectWrap::handle_' : class 'v8::Persistent<T>'
168+
# needs to have dll-interface to be used by
169+
# clients of class 'node::ObjectWrap'
170+
4251
171+
],
172+
}, {
173+
# OS!="win"
174+
'defines': [
175+
'_LARGEFILE_SOURCE',
176+
'_FILE_OFFSET_BITS=64'
177+
],
178+
}],
179+
[ 'OS in "freebsd openbsd netbsd solaris android" or \
180+
(OS=="linux" and target_arch!="ia32")', {
181+
'cflags': [ '-fPIC' ],
182+
}],
183+
]
184+
}
185+
}
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
#!/usr/bin/env node
2+
3+
'use strict'
4+
5+
process.title = 'node-gyp'
6+
7+
const envPaths = require('env-paths')
8+
const gyp = require('../')
9+
const log = require('npmlog')
10+
const os = require('os')
11+
12+
/**
13+
* Process and execute the selected commands.
14+
*/
15+
16+
const prog = gyp()
17+
var completed = false
18+
prog.parseArgv(process.argv)
19+
prog.devDir = prog.opts.devdir
20+
21+
var homeDir = os.homedir()
22+
if (prog.devDir) {
23+
prog.devDir = prog.devDir.replace(/^~/, homeDir)
24+
} else if (homeDir) {
25+
prog.devDir = envPaths('node-gyp', { suffix: '' }).cache
26+
} else {
27+
throw new Error(
28+
"node-gyp requires that the user's home directory is specified " +
29+
'in either of the environmental variables HOME or USERPROFILE. ' +
30+
'Overide with: --devdir /path/to/.node-gyp')
31+
}
32+
33+
if (prog.todo.length === 0) {
34+
if (~process.argv.indexOf('-v') || ~process.argv.indexOf('--version')) {
35+
console.log('v%s', prog.version)
36+
} else {
37+
console.log('%s', prog.usage())
38+
}
39+
process.exit(0)
40+
}
41+
42+
log.info('it worked if it ends with', 'ok')
43+
log.verbose('cli', process.argv)
44+
log.info('using', 'node-gyp@%s', prog.version)
45+
log.info('using', 'node@%s | %s | %s', process.versions.node, process.platform, process.arch)
46+
47+
/**
48+
* Change dir if -C/--directory was passed.
49+
*/
50+
51+
var dir = prog.opts.directory
52+
if (dir) {
53+
var fs = require('fs')
54+
try {
55+
var stat = fs.statSync(dir)
56+
if (stat.isDirectory()) {
57+
log.info('chdir', dir)
58+
process.chdir(dir)
59+
} else {
60+
log.warn('chdir', dir + ' is not a directory')
61+
}
62+
} catch (e) {
63+
if (e.code === 'ENOENT') {
64+
log.warn('chdir', dir + ' is not a directory')
65+
} else {
66+
log.warn('chdir', 'error during chdir() "%s"', e.message)
67+
}
68+
}
69+
}
70+
71+
function run () {
72+
var command = prog.todo.shift()
73+
if (!command) {
74+
// done!
75+
completed = true
76+
log.info('ok')
77+
return
78+
}
79+
80+
prog.commands[command.name](command.args, function (err) {
81+
if (err) {
82+
log.error(command.name + ' error')
83+
log.error('stack', err.stack)
84+
errorMessage()
85+
log.error('not ok')
86+
return process.exit(1)
87+
}
88+
if (command.name === 'list') {
89+
var versions = arguments[1]
90+
if (versions.length > 0) {
91+
versions.forEach(function (version) {
92+
console.log(version)
93+
})
94+
} else {
95+
console.log('No node development files installed. Use `node-gyp install` to install a version.')
96+
}
97+
} else if (arguments.length >= 2) {
98+
console.log.apply(console, [].slice.call(arguments, 1))
99+
}
100+
101+
// now run the next command in the queue
102+
process.nextTick(run)
103+
})
104+
}
105+
106+
process.on('exit', function (code) {
107+
if (!completed && !code) {
108+
log.error('Completion callback never invoked!')
109+
issueMessage()
110+
process.exit(6)
111+
}
112+
})
113+
114+
process.on('uncaughtException', function (err) {
115+
log.error('UNCAUGHT EXCEPTION')
116+
log.error('stack', err.stack)
117+
issueMessage()
118+
process.exit(7)
119+
})
120+
121+
function errorMessage () {
122+
// copied from npm's lib/utils/error-handler.js
123+
var os = require('os')
124+
log.error('System', os.type() + ' ' + os.release())
125+
log.error('command', process.argv
126+
.map(JSON.stringify).join(' '))
127+
log.error('cwd', process.cwd())
128+
log.error('node -v', process.version)
129+
log.error('node-gyp -v', 'v' + prog.package.version)
130+
}
131+
132+
function issueMessage () {
133+
errorMessage()
134+
log.error('', ['Node-gyp failed to build your package.',
135+
'Try to update npm and/or node-gyp and if it does not help file an issue with the package author.'
136+
].join('\n'))
137+
}
138+
139+
// start running the given commands!
140+
run()

0 commit comments

Comments
 (0)