Initial import with skill sheet working
This commit is contained in:
21
node_modules/node-gyp-build/LICENSE
generated
vendored
Normal file
21
node_modules/node-gyp-build/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017 Mathias Buus
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
58
node_modules/node-gyp-build/README.md
generated
vendored
Normal file
58
node_modules/node-gyp-build/README.md
generated
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
# node-gyp-build
|
||||
|
||||
> Build tool and bindings loader for [`node-gyp`][node-gyp] that supports prebuilds.
|
||||
|
||||
```
|
||||
npm install node-gyp-build
|
||||
```
|
||||
|
||||
[](https://github.com/prebuild/node-gyp-build/actions/workflows/test.yml)
|
||||
|
||||
Use together with [`prebuildify`][prebuildify] to easily support prebuilds for your native modules.
|
||||
|
||||
## Usage
|
||||
|
||||
> **Note.** Prebuild names have changed in [`prebuildify@3`][prebuildify] and `node-gyp-build@4`. Please see the documentation below.
|
||||
|
||||
`node-gyp-build` works similar to [`node-gyp build`][node-gyp] except that it will check if a build or prebuild is present before rebuilding your project.
|
||||
|
||||
It's main intended use is as an npm install script and bindings loader for native modules that bundle prebuilds using [`prebuildify`][prebuildify].
|
||||
|
||||
First add `node-gyp-build` as an install script to your native project
|
||||
|
||||
``` js
|
||||
{
|
||||
...
|
||||
"scripts": {
|
||||
"install": "node-gyp-build"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Then in your `index.js`, instead of using the [`bindings`](https://www.npmjs.com/package/bindings) module use `node-gyp-build` to load your binding.
|
||||
|
||||
``` js
|
||||
var binding = require('node-gyp-build')(__dirname)
|
||||
```
|
||||
|
||||
If you do these two things and bundle prebuilds with [`prebuildify`][prebuildify] your native module will work for most platforms
|
||||
without having to compile on install time AND will work in both node and electron without the need to recompile between usage.
|
||||
|
||||
Users can override `node-gyp-build` and force compiling by doing `npm install --build-from-source`.
|
||||
|
||||
Prebuilds will be attempted loaded from `MODULE_PATH/prebuilds/...` and then next `EXEC_PATH/prebuilds/...` (the latter allowing use with `zeit/pkg`)
|
||||
|
||||
## Supported prebuild names
|
||||
|
||||
If so desired you can bundle more specific flavors, for example `musl` builds to support Alpine, or targeting a numbered ARM architecture version.
|
||||
|
||||
These prebuilds can be bundled in addition to generic prebuilds; `node-gyp-build` will try to find the most specific flavor first. Prebuild filenames are composed of _tags_. The runtime tag takes precedence, as does an `abi` tag over `napi`. For more details on tags, please see [`prebuildify`][prebuildify].
|
||||
|
||||
Values for the `libc` and `armv` tags are auto-detected but can be overridden through the `LIBC` and `ARM_VERSION` environment variables, respectively.
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
|
||||
[prebuildify]: https://github.com/prebuild/prebuildify
|
||||
[node-gyp]: https://www.npmjs.com/package/node-gyp
|
5
node_modules/node-gyp-build/SECURITY.md
generated
vendored
Normal file
5
node_modules/node-gyp-build/SECURITY.md
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
## Security contact information
|
||||
|
||||
To report a security vulnerability, please use the
|
||||
[Tidelift security contact](https://tidelift.com/security).
|
||||
Tidelift will coordinate the fix and disclosure.
|
84
node_modules/node-gyp-build/bin.js
generated
vendored
Executable file
84
node_modules/node-gyp-build/bin.js
generated
vendored
Executable file
@ -0,0 +1,84 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
var proc = require('child_process')
|
||||
var os = require('os')
|
||||
var path = require('path')
|
||||
|
||||
if (!buildFromSource()) {
|
||||
proc.exec('node-gyp-build-test', function (err, stdout, stderr) {
|
||||
if (err) {
|
||||
if (verbose()) console.error(stderr)
|
||||
preinstall()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
preinstall()
|
||||
}
|
||||
|
||||
function build () {
|
||||
var win32 = os.platform() === 'win32'
|
||||
var shell = win32
|
||||
var args = [win32 ? 'node-gyp.cmd' : 'node-gyp', 'rebuild']
|
||||
|
||||
try {
|
||||
var pkg = require('node-gyp/package.json')
|
||||
args = [
|
||||
process.execPath,
|
||||
path.join(require.resolve('node-gyp/package.json'), '..', typeof pkg.bin === 'string' ? pkg.bin : pkg.bin['node-gyp']),
|
||||
'rebuild'
|
||||
]
|
||||
shell = false
|
||||
} catch (_) {}
|
||||
|
||||
proc.spawn(args[0], args.slice(1), { stdio: 'inherit', shell, windowsHide: true }).on('exit', function (code) {
|
||||
if (code || !process.argv[3]) process.exit(code)
|
||||
exec(process.argv[3]).on('exit', function (code) {
|
||||
process.exit(code)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function preinstall () {
|
||||
if (!process.argv[2]) return build()
|
||||
exec(process.argv[2]).on('exit', function (code) {
|
||||
if (code) process.exit(code)
|
||||
build()
|
||||
})
|
||||
}
|
||||
|
||||
function exec (cmd) {
|
||||
if (process.platform !== 'win32') {
|
||||
var shell = os.platform() === 'android' ? 'sh' : true
|
||||
return proc.spawn(cmd, [], {
|
||||
shell,
|
||||
stdio: 'inherit'
|
||||
})
|
||||
}
|
||||
|
||||
return proc.spawn(cmd, [], {
|
||||
windowsVerbatimArguments: true,
|
||||
stdio: 'inherit',
|
||||
shell: true,
|
||||
windowsHide: true
|
||||
})
|
||||
}
|
||||
|
||||
function buildFromSource () {
|
||||
return hasFlag('--build-from-source') || process.env.npm_config_build_from_source === 'true'
|
||||
}
|
||||
|
||||
function verbose () {
|
||||
return hasFlag('--verbose') || process.env.npm_config_loglevel === 'verbose'
|
||||
}
|
||||
|
||||
// TODO (next major): remove in favor of env.npm_config_* which works since npm
|
||||
// 0.1.8 while npm_config_argv will stop working in npm 7. See npm/rfcs#90
|
||||
function hasFlag (flag) {
|
||||
if (!process.env.npm_config_argv) return false
|
||||
|
||||
try {
|
||||
return JSON.parse(process.env.npm_config_argv).original.indexOf(flag) !== -1
|
||||
} catch (_) {
|
||||
return false
|
||||
}
|
||||
}
|
19
node_modules/node-gyp-build/build-test.js
generated
vendored
Executable file
19
node_modules/node-gyp-build/build-test.js
generated
vendored
Executable file
@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
process.env.NODE_ENV = 'test'
|
||||
|
||||
var path = require('path')
|
||||
var test = null
|
||||
|
||||
try {
|
||||
var pkg = require(path.join(process.cwd(), 'package.json'))
|
||||
if (pkg.name && process.env[pkg.name.toUpperCase().replace(/-/g, '_')]) {
|
||||
process.exit(0)
|
||||
}
|
||||
test = pkg.prebuild.test
|
||||
} catch (err) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
if (test) require(path.join(process.cwd(), test))
|
||||
else require('./')()
|
6
node_modules/node-gyp-build/index.js
generated
vendored
Normal file
6
node_modules/node-gyp-build/index.js
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
const runtimeRequire = typeof __webpack_require__ === 'function' ? __non_webpack_require__ : require // eslint-disable-line
|
||||
if (typeof runtimeRequire.addon === 'function') { // if the platform supports native resolving prefer that
|
||||
module.exports = runtimeRequire.addon.bind(runtimeRequire)
|
||||
} else { // else use the runtime version here
|
||||
module.exports = require('./node-gyp-build.js')
|
||||
}
|
207
node_modules/node-gyp-build/node-gyp-build.js
generated
vendored
Normal file
207
node_modules/node-gyp-build/node-gyp-build.js
generated
vendored
Normal file
@ -0,0 +1,207 @@
|
||||
var fs = require('fs')
|
||||
var path = require('path')
|
||||
var os = require('os')
|
||||
|
||||
// Workaround to fix webpack's build warnings: 'the request of a dependency is an expression'
|
||||
var runtimeRequire = typeof __webpack_require__ === 'function' ? __non_webpack_require__ : require // eslint-disable-line
|
||||
|
||||
var vars = (process.config && process.config.variables) || {}
|
||||
var prebuildsOnly = !!process.env.PREBUILDS_ONLY
|
||||
var abi = process.versions.modules // TODO: support old node where this is undef
|
||||
var runtime = isElectron() ? 'electron' : (isNwjs() ? 'node-webkit' : 'node')
|
||||
|
||||
var arch = process.env.npm_config_arch || os.arch()
|
||||
var platform = process.env.npm_config_platform || os.platform()
|
||||
var libc = process.env.LIBC || (isAlpine(platform) ? 'musl' : 'glibc')
|
||||
var armv = process.env.ARM_VERSION || (arch === 'arm64' ? '8' : vars.arm_version) || ''
|
||||
var uv = (process.versions.uv || '').split('.')[0]
|
||||
|
||||
module.exports = load
|
||||
|
||||
function load (dir) {
|
||||
return runtimeRequire(load.resolve(dir))
|
||||
}
|
||||
|
||||
load.resolve = load.path = function (dir) {
|
||||
dir = path.resolve(dir || '.')
|
||||
|
||||
try {
|
||||
var name = runtimeRequire(path.join(dir, 'package.json')).name.toUpperCase().replace(/-/g, '_')
|
||||
if (process.env[name + '_PREBUILD']) dir = process.env[name + '_PREBUILD']
|
||||
} catch (err) {}
|
||||
|
||||
if (!prebuildsOnly) {
|
||||
var release = getFirst(path.join(dir, 'build/Release'), matchBuild)
|
||||
if (release) return release
|
||||
|
||||
var debug = getFirst(path.join(dir, 'build/Debug'), matchBuild)
|
||||
if (debug) return debug
|
||||
}
|
||||
|
||||
var prebuild = resolve(dir)
|
||||
if (prebuild) return prebuild
|
||||
|
||||
var nearby = resolve(path.dirname(process.execPath))
|
||||
if (nearby) return nearby
|
||||
|
||||
var target = [
|
||||
'platform=' + platform,
|
||||
'arch=' + arch,
|
||||
'runtime=' + runtime,
|
||||
'abi=' + abi,
|
||||
'uv=' + uv,
|
||||
armv ? 'armv=' + armv : '',
|
||||
'libc=' + libc,
|
||||
'node=' + process.versions.node,
|
||||
process.versions.electron ? 'electron=' + process.versions.electron : '',
|
||||
typeof __webpack_require__ === 'function' ? 'webpack=true' : '' // eslint-disable-line
|
||||
].filter(Boolean).join(' ')
|
||||
|
||||
throw new Error('No native build was found for ' + target + '\n loaded from: ' + dir + '\n')
|
||||
|
||||
function resolve (dir) {
|
||||
// Find matching "prebuilds/<platform>-<arch>" directory
|
||||
var tuples = readdirSync(path.join(dir, 'prebuilds')).map(parseTuple)
|
||||
var tuple = tuples.filter(matchTuple(platform, arch)).sort(compareTuples)[0]
|
||||
if (!tuple) return
|
||||
|
||||
// Find most specific flavor first
|
||||
var prebuilds = path.join(dir, 'prebuilds', tuple.name)
|
||||
var parsed = readdirSync(prebuilds).map(parseTags)
|
||||
var candidates = parsed.filter(matchTags(runtime, abi))
|
||||
var winner = candidates.sort(compareTags(runtime))[0]
|
||||
if (winner) return path.join(prebuilds, winner.file)
|
||||
}
|
||||
}
|
||||
|
||||
function readdirSync (dir) {
|
||||
try {
|
||||
return fs.readdirSync(dir)
|
||||
} catch (err) {
|
||||
return []
|
||||
}
|
||||
}
|
||||
|
||||
function getFirst (dir, filter) {
|
||||
var files = readdirSync(dir).filter(filter)
|
||||
return files[0] && path.join(dir, files[0])
|
||||
}
|
||||
|
||||
function matchBuild (name) {
|
||||
return /\.node$/.test(name)
|
||||
}
|
||||
|
||||
function parseTuple (name) {
|
||||
// Example: darwin-x64+arm64
|
||||
var arr = name.split('-')
|
||||
if (arr.length !== 2) return
|
||||
|
||||
var platform = arr[0]
|
||||
var architectures = arr[1].split('+')
|
||||
|
||||
if (!platform) return
|
||||
if (!architectures.length) return
|
||||
if (!architectures.every(Boolean)) return
|
||||
|
||||
return { name, platform, architectures }
|
||||
}
|
||||
|
||||
function matchTuple (platform, arch) {
|
||||
return function (tuple) {
|
||||
if (tuple == null) return false
|
||||
if (tuple.platform !== platform) return false
|
||||
return tuple.architectures.includes(arch)
|
||||
}
|
||||
}
|
||||
|
||||
function compareTuples (a, b) {
|
||||
// Prefer single-arch prebuilds over multi-arch
|
||||
return a.architectures.length - b.architectures.length
|
||||
}
|
||||
|
||||
function parseTags (file) {
|
||||
var arr = file.split('.')
|
||||
var extension = arr.pop()
|
||||
var tags = { file: file, specificity: 0 }
|
||||
|
||||
if (extension !== 'node') return
|
||||
|
||||
for (var i = 0; i < arr.length; i++) {
|
||||
var tag = arr[i]
|
||||
|
||||
if (tag === 'node' || tag === 'electron' || tag === 'node-webkit') {
|
||||
tags.runtime = tag
|
||||
} else if (tag === 'napi') {
|
||||
tags.napi = true
|
||||
} else if (tag.slice(0, 3) === 'abi') {
|
||||
tags.abi = tag.slice(3)
|
||||
} else if (tag.slice(0, 2) === 'uv') {
|
||||
tags.uv = tag.slice(2)
|
||||
} else if (tag.slice(0, 4) === 'armv') {
|
||||
tags.armv = tag.slice(4)
|
||||
} else if (tag === 'glibc' || tag === 'musl') {
|
||||
tags.libc = tag
|
||||
} else {
|
||||
continue
|
||||
}
|
||||
|
||||
tags.specificity++
|
||||
}
|
||||
|
||||
return tags
|
||||
}
|
||||
|
||||
function matchTags (runtime, abi) {
|
||||
return function (tags) {
|
||||
if (tags == null) return false
|
||||
if (tags.runtime && tags.runtime !== runtime && !runtimeAgnostic(tags)) return false
|
||||
if (tags.abi && tags.abi !== abi && !tags.napi) return false
|
||||
if (tags.uv && tags.uv !== uv) return false
|
||||
if (tags.armv && tags.armv !== armv) return false
|
||||
if (tags.libc && tags.libc !== libc) return false
|
||||
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
function runtimeAgnostic (tags) {
|
||||
return tags.runtime === 'node' && tags.napi
|
||||
}
|
||||
|
||||
function compareTags (runtime) {
|
||||
// Precedence: non-agnostic runtime, abi over napi, then by specificity.
|
||||
return function (a, b) {
|
||||
if (a.runtime !== b.runtime) {
|
||||
return a.runtime === runtime ? -1 : 1
|
||||
} else if (a.abi !== b.abi) {
|
||||
return a.abi ? -1 : 1
|
||||
} else if (a.specificity !== b.specificity) {
|
||||
return a.specificity > b.specificity ? -1 : 1
|
||||
} else {
|
||||
return 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function isNwjs () {
|
||||
return !!(process.versions && process.versions.nw)
|
||||
}
|
||||
|
||||
function isElectron () {
|
||||
if (process.versions && process.versions.electron) return true
|
||||
if (process.env.ELECTRON_RUN_AS_NODE) return true
|
||||
return typeof window !== 'undefined' && window.process && window.process.type === 'renderer'
|
||||
}
|
||||
|
||||
function isAlpine (platform) {
|
||||
return platform === 'linux' && fs.existsSync('/etc/alpine-release')
|
||||
}
|
||||
|
||||
// Exposed for unit tests
|
||||
// TODO: move to lib
|
||||
load.parseTags = parseTags
|
||||
load.matchTags = matchTags
|
||||
load.compareTags = compareTags
|
||||
load.parseTuple = parseTuple
|
||||
load.matchTuple = matchTuple
|
||||
load.compareTuples = compareTuples
|
7
node_modules/node-gyp-build/optional.js
generated
vendored
Executable file
7
node_modules/node-gyp-build/optional.js
generated
vendored
Executable file
@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/*
|
||||
I am only useful as an install script to make node-gyp not compile for purely optional native deps
|
||||
*/
|
||||
|
||||
process.exit(0)
|
43
node_modules/node-gyp-build/package.json
generated
vendored
Normal file
43
node_modules/node-gyp-build/package.json
generated
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
{
|
||||
"name": "node-gyp-build",
|
||||
"version": "4.8.4",
|
||||
"description": "Build tool and bindings loader for node-gyp that supports prebuilds",
|
||||
"main": "index.js",
|
||||
"imports": {
|
||||
"fs": {
|
||||
"bare": "builtin:fs",
|
||||
"default": "fs"
|
||||
},
|
||||
"path": {
|
||||
"bare": "builtin:path",
|
||||
"default": "path"
|
||||
},
|
||||
"os": {
|
||||
"bare": "builtin:os",
|
||||
"default": "os"
|
||||
}
|
||||
},
|
||||
"devDependencies": {
|
||||
"array-shuffle": "^1.0.1",
|
||||
"standard": "^14.0.0",
|
||||
"tape": "^5.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "standard && node test"
|
||||
},
|
||||
"bin": {
|
||||
"node-gyp-build": "./bin.js",
|
||||
"node-gyp-build-optional": "./optional.js",
|
||||
"node-gyp-build-test": "./build-test.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/prebuild/node-gyp-build.git"
|
||||
},
|
||||
"author": "Mathias Buus (@mafintosh)",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/prebuild/node-gyp-build/issues"
|
||||
},
|
||||
"homepage": "https://github.com/prebuild/node-gyp-build"
|
||||
}
|
Reference in New Issue
Block a user