Added support for Streamdeck Pedal and updated UI to better fit the Packed UI style

This commit is contained in:
2026-02-27 22:47:08 +01:00
committed by erik
parent 5a70f775f1
commit 93faae5cc8
1463 changed files with 306917 additions and 0 deletions

21
node_modules/pkg-prebuilds/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2022 Julian Waller
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.

103
node_modules/pkg-prebuilds/README.md generated vendored Normal file
View File

@@ -0,0 +1,103 @@
# pkg-prebuilds
[![npm](https://img.shields.io/npm/v/pkg-prebuilds.svg)](https://www.npmjs.com/package/pkg-prebuilds)
[![npm](https://img.shields.io/npm/dm/pkg-prebuilds.svg)](https://www.npmjs.com/package/pkg-prebuilds)
[![npm](https://img.shields.io/npm/l/pkg-prebuilds.svg)](LICENSE)
An opionated lightweight alternative to [node-gyp-build](https://www.npmjs.com/package/node-gyp-build) & [prebuildify](https://www.npmjs.com/package/prebuildify), that is build tooling agnostic.
## Usage
It is recommended to use this with github-actions to produce your builds. You can see an up-to-date workflow utilising this in [@julusian/jpeg-turbo](https://github.com/Julusian/node-jpeg-turbo/blob/master/.github/workflows/node.yaml)
Firstly, a js file is required to define various configuration of your binary. This is needed in two places, so is recommended to be a simple js file.
The options are defined as:
```
interface Options {
/**
* Unique name of the binding.
* This must match the output file as specified in CMake/node-gyp
* Typically this will be the same as the name in your package.json, but you are free to make it different
*/
name: string,
/**
* The node-api versions that are built.
*/
napi_versions?: number[],
/**
* Whether the bindings are labelled with the arm version (eg armv7, arm64v8)
*/
armv?: boolean,
}
```
The formal definition of the above is also stored in `bindings.d.ts`.
There are a few components to this library as follows.
### pkg-prebuilds-copy
Copy a prebuilt binary into the prebuilds folder.
Example: `pkg-prebuilds-copy --baseDir build/Release --source jpeg-turbo.node --name=jpeg-turbo --strip --napi_version=7 --arch=x64`
This takes a few paramaters to figure out the correct filename:
* `baseDir` - Base path to built binary files (required)
* `source` - The built file to copy (required)
* `name` - The name of the binding as defined in the options object (required)
* `napi_version` - The node-api version it was built for (required)
* `strip` - Whether to strip the file of debug symbols (default: false)
* `libc` - The libc it was built for (glibc, musl. only applicable to linux) (default: glibc)
* `runtime` - The runtime it was built for (node, electron, nwjs) (default: node)
* `arch` - The architecture it was built for (x64, arm64 etc) (default: current process arch)
* `platform` - The platform it was built for (win32, linux, darwin) (default: current process platform)
* `extraFiles` - Extra files to be copied, typically so/dll/dylib files that must reside next to the `.node` file
### pkg-prebuilds-verify
A simple script to verify if there is a prebuild for the current environment, and exit successfully, or with an error code.
Intended to be used with `pkg-prebuilds-verify ./binding-options.js || cmake-js ....`
This command listens to the following environment variables as override:
* npm_config_build_from_source
* npm_config_arch
* npm_config_platform
* npm_config_runtime
These variables allow for ensuring the correct version as needed for `electron-builder` or other tools to cross-build.
### require('pkg-prebuilds')
In the most simple form
```
const binding = require("pkg-prebuilds")(
__dirname,
require("./binding-options")
);
```
Where `./binding-options.js` is the file exporting the options object.
This is very similar to how `bindings` or `node-gyp-build` operate, but is much more verbose in requiring the options object.
## Breaking changes
### v0.2.0
A command such as `yarn pkg-prebuilds-copy --source build/Release/testbinding.node --name=testbinding`, but be changed to `yarn pkg-prebuilds-copy --baseDir build/Release --source testbinding.node --name=testbinding`.
This is to allow for supplying the new `--extraFiles` parameter which is also relative to baseDir.
## Why another tool?
`node-gyp-build` is very based around `node-gyp`, and getting support for `cmake-js` stalled many years ago.
Additionally, `node-gyp-build` is clever about detecting the correct file for you, but this does not work well if it gets bundled with `webpack`, `pkg` or alternatives. Because the prebuilds are not named with the package they are for, it is very hard to make them coexist after bundling.
This is written to be simple. It doesnt try to do any magic, it simply copies files into an organised structure and then provides a way of loading the correct one.
It expects callers to provide any information it may need, rather than it trying to figure it out. While this is more effort for developers using this library, it has a minimal cost and helps ensure it will work consistently for all users.
## License
See [LICENSE](LICENSE).
Copyright © Julian Waller. All Rights Reserved.

125
node_modules/pkg-prebuilds/bin/copy.mjs generated vendored Executable file
View File

@@ -0,0 +1,125 @@
#!/usr/bin/env node
import fs from 'fs'
import path from 'path'
import os from 'os'
import { createRequire } from 'module'
import { getPrebuildName } from '../lib/prebuild.js'
import cp from 'child_process'
/**
* Rename a binding file and move to the prebuilds folder, named according to the supplied parameters.
*/
const require = createRequire(import.meta.url)
const version = require('../package').version
const yargs = require('yargs')
.usage('pkg-prebuilds ' + version + '\n\nUsage: $0 [<command>] [options]')
.version(version)
.options({
baseDir: {
demand: true,
describe: 'base path to built binary files',
type: 'string',
},
source: {
demand: true,
describe: 'filename of built binary file',
type: 'string',
},
name: {
demand: true,
describe: 'name of the module',
type: 'string',
},
strip: {
demand: false,
describe: 'strip file of debug symbols',
type: 'boolean',
},
libc: {
demand: false,
describe: 'libc environment',
type: 'string',
},
napi_version: {
demand: true,
describe: 'node-api version',
type: 'string',
},
runtime: {
demand: false,
describe: 'runtime',
type: 'string',
},
arch: {
demand: false,
describe: 'override the architecture',
type: 'string',
},
platform: {
demand: false,
describe: 'override the platform',
type: 'string',
},
extraFiles: {
demand: false,
describe: 'extra files to copy',
type: 'string',
},
})
const argv = yargs.argv
const targetDir = path.join(process.cwd(), 'prebuilds')
const sourceDir = path.join(process.cwd(), argv.baseDir)
const sourceFile = path.join(sourceDir, argv.source)
if (!fs.existsSync(sourceFile)) {
console.error(`Built binary does not exist!`)
process.exit(1)
}
let libc = argv.libc
if (libc === 'glibc') libc = null
// Determine the target filename
const prebuildName = getPrebuildName({
arch: argv.arch || os.arch(),
platform: argv.platform || os.platform(),
name: argv.name,
libc: libc,
napi_version: argv.napi_version,
runtime: argv.runtime || 'node',
})
const destFile = path.join(targetDir, prebuildName)
const destDir = path.dirname(destFile)
// Make sure the directory exists
if (!fs.existsSync(destDir)) {
fs.mkdirSync(destDir, { recursive: true })
}
// Copy the bindings file
fs.copyFileSync(sourceFile, destFile)
if (argv.strip) {
if (os.platform() === 'linux') {
cp.spawnSync('strip', [destFile, '--strip-all'])
} else if (os.platform() === 'darwin') {
cp.spawnSync('strip', [destFile, '-Sx'])
}
}
// copy any extra files that have been requested, typically libraries needed
if (argv.extraFiles) {
const extraFiles = Array.isArray(argv.extraFiles) ? argv.extraFiles : [argv.extraFiles]
for (const file of extraFiles) {
fs.copyFileSync(path.join(sourceDir, file), path.join(destDir, file))
}
}
console.log('Done')

43
node_modules/pkg-prebuilds/bin/verify.mjs generated vendored Executable file
View File

@@ -0,0 +1,43 @@
#!/usr/bin/env node
import path from 'path'
import { createRequire } from 'module'
import loadBinding from '../bindings.js'
/**
* Equivalent of the prebuild-install command.
* It expects a single parameter of path to a file containing the options passed when using require with the binding.
* This makes sure that there is a binding available for the current architecture and platform,
* or the one specified by the npm_config_* environment variables.
*/
if (process.env.npm_config_build_from_source) {
// Force a build from source
process.exit(1)
}
if (process.argv.length < 3) {
console.error(`Missing path to binding options`)
process.exit(1)
}
const require = createRequire(import.meta.url)
try {
// Load the options file
const optionsPath = path.join(process.cwd(), process.argv[2])
const options = require(optionsPath)
// Find the correct bindings file
const resolvedPath = loadBinding.resolve(process.cwd(), options, true)
// Report result
if (resolvedPath) {
process.exit(0)
} else {
process.exit(1)
}
} catch (e) {
console.error(`Failed to check for bindings file!: ${e}`)
process.exit(1)
}

30
node_modules/pkg-prebuilds/bindings.d.ts generated vendored Normal file
View File

@@ -0,0 +1,30 @@
/**
* Load the native binding for a module
* @param basePath - the base path of the module. Searching is done using this as the root
* @param options - Describe how the prebuilt binary is named. This is the same as what is given to pkg-prebuilds-verify. By describing all these properties explicitly, we can make the loading be much simpler and more deterministic, and avoid needing the list the contents of folders and detemrining which is the best match.
*/
declare function loadBinding<T = any>(basePath: string, options: loadBinding.Options): T
declare namespace loadBinding {
/**
* Various properties defining how the files will be named
*/
interface Options {
/**
* Unique name of the binding.
* This must match the output file as specified in CMake
* Typically this will be the same as the name in your package.json, but you are free to make it different
*/
name: string
/**
* The node-api versions that are built.
*/
napi_versions?: number[]
/**
* Whether the bindings are labelled with the arm version (eg armv7, arm64v8)
*/
armv?: boolean
}
}
export = loadBinding

107
node_modules/pkg-prebuilds/bindings.js generated vendored Normal file
View File

@@ -0,0 +1,107 @@
const path = require('path')
const os = require('os')
const { getPrebuildName, isNwjs, isElectron, isAlpine } = require('./lib/prebuild')
// Jest can allow users to mock 'fs', but we need the real fs
const fs = typeof jest !== 'undefined' ? jest.requireActual('fs') : require('fs')
// Workaround to fix webpack's build warnings: 'the request of a dependency is an expression'
const runtimeRequire = typeof __webpack_require__ === 'function' ? __non_webpack_require__ : require // eslint-disable-line
/**
* Find the best path to the binding file
* @param {string} basePath - Base path of the module, where binaries will be located
* @param {object} options - Describe how the prebuilt binary is named
* @param {boolean} verifyPrebuild - True if we are verifying that a prebuild exists
* @param {boolean} throwOnMissing - True if an error should be thrown when the binary is missing
* @returns
*/
function resolvePath(basePath, options, verifyPrebuild, throwOnMissing) {
if (typeof basePath !== 'string' || !basePath) throw new Error(`Invalid basePath to pkg-prebuilds`)
if (typeof options !== 'object' || !options) throw new Error(`Invalid options to pkg-prebuilds`)
if (typeof options.name !== 'string' || !options.name) throw new Error(`Invalid name to pkg-prebuilds`)
let isNodeApi = false
if (options.napi_versions && Array.isArray(options.napi_versions)) {
isNodeApi = true
}
const arch = (verifyPrebuild && process.env.npm_config_arch) || os.arch()
const platform = (verifyPrebuild && process.env.npm_config_platform) || os.platform()
let runtime = 'node'
// If node-api, then everything can share the same binary
if (!isNodeApi) {
if (verifyPrebuild && process.env.npm_config_runtime) {
runtime = process.env.npm_config_runtime
} else if (isElectron()) {
runtime = 'electron'
} else if (isNwjs()) {
runtime = 'node-webkit'
}
}
const candidates = []
if (!verifyPrebuild) {
// Try for a locally built binding
candidates.push(
path.join(basePath, 'build', 'Debug', `${options.name}.node`),
path.join(basePath, 'build', 'Release', `${options.name}.node`)
)
}
let libc = undefined
if (isAlpine(platform)) libc = 'musl'
// Look for prebuilds
if (isNodeApi) {
// Look for node-api versioned builds
for (const ver of options.napi_versions) {
const prebuildName = getPrebuildName({
name: options.name,
platform,
arch,
libc,
napi_version: ver,
runtime,
// armv: options.armv ? (arch === 'arm64' ? '8' : vars.arm_version) : null,
})
candidates.push(path.join(basePath, 'prebuilds', prebuildName))
}
} else {
throw new Error('Not implemented for NAN!')
}
let foundPath = null
for (const candidate of candidates) {
if (fs.existsSync(candidate)) {
const stat = fs.statSync(candidate)
if (stat.isFile()) {
foundPath = candidate
break
}
}
}
if (!foundPath && throwOnMissing) {
const candidatesStr = candidates.map((cand) => ` - ${cand}`).join('\n')
throw new Error(`Failed to find binding for ${options.name}\nTried paths:\n${candidatesStr}`)
}
return foundPath
}
function loadBinding(basePath, options) {
const foundPath = resolvePath(basePath, options, false, true)
// Note: this error should not be hit, as resolvePath will throw if the binding is missing
if (!foundPath) throw new Error(`Failed to find binding for ${options.name}`)
return runtimeRequire(foundPath)
}
loadBinding.resolve = resolvePath
module.exports = loadBinding

41
node_modules/pkg-prebuilds/lib/prebuild.js generated vendored Normal file
View File

@@ -0,0 +1,41 @@
const fs = require('fs')
/**
* Generate the filename of the prebuild file.
* The format of the name is possible to calculate based on some options
* @param {object} options
* @returns
*/
function getPrebuildName(options) {
if (!options.napi_version) throw new Error('NAN not implemented') // TODO
const tokens = [
options.name,
options.platform,
options.arch,
// options.armv ? (options.arch === 'arm64' ? '8' : vars.arm_version) : null,
options.libc && options.platform === 'linux' ? options.libc : null,
]
return `${tokens.filter((t) => !!t).join('-')}/${options.runtime}-napi-v${options.napi_version}.node`
}
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')
}
module.exports = {
getPrebuildName,
isNwjs,
isElectron,
isAlpine,
}

32
node_modules/pkg-prebuilds/package.json generated vendored Normal file
View File

@@ -0,0 +1,32 @@
{
"name": "pkg-prebuilds",
"version": "1.0.0",
"main": "bindings.js",
"license": "MIT",
"author": {
"name": "Julian Waller",
"email": "git@julusian.co.uk",
"url": "https://github.com/julusian"
},
"repository": {
"type": "git",
"url": "git://github.com/julusian/pkg-prebuilds.git"
},
"bin": {
"pkg-prebuilds-copy": "./bin/copy.mjs",
"pkg-prebuilds-verify": "./bin/verify.mjs"
},
"engines": {
"node": ">= 14.15.0"
},
"files": [
"bindings.js",
"bindings.d.ts",
"bin",
"lib",
"*.md"
],
"dependencies": {
"yargs": "^17.7.2"
}
}