Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
528e5c9174 | ||
|
|
323e9ce153 | ||
|
|
529f302f73 | ||
|
|
5c40acd288 | ||
|
|
de39415413 | ||
|
|
827cdc7a6b | ||
|
|
ccf2b46482 | ||
|
|
1aa7df1c97 |
@@ -146,7 +146,11 @@ jobs:
|
|||||||
|
|
||||||
- name: Build native module
|
- name: Build native module
|
||||||
working-directory: bindings/node
|
working-directory: bindings/node
|
||||||
run: npx napi build --release
|
# --platform puts the target triple into the filename so the loader's
|
||||||
|
# `wickra.<target>.node` lookup finds the freshly built binary instead
|
||||||
|
# of falling back to the per-platform npm subpackage (which doesn't
|
||||||
|
# exist yet for win32-x64-msvc).
|
||||||
|
run: npx napi build --platform --release
|
||||||
|
|
||||||
- name: Run Node tests
|
- name: Run Node tests
|
||||||
working-directory: bindings/node
|
working-directory: bindings/node
|
||||||
|
|||||||
+192
-12
@@ -52,6 +52,20 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
|
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
|
||||||
|
|
||||||
|
# Produce .crate files for the GitHub Release attachments. `cargo package`
|
||||||
|
# writes them to target/package/<name>-<version>.crate.
|
||||||
|
- name: Build .crate files for release attachment
|
||||||
|
run: |
|
||||||
|
cargo package -p wickra-core --allow-dirty --no-verify
|
||||||
|
cargo package -p wickra-data --allow-dirty --no-verify
|
||||||
|
cargo package -p wickra --allow-dirty --no-verify
|
||||||
|
|
||||||
|
- name: Upload .crate files
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: crate-files
|
||||||
|
path: target/package/*.crate
|
||||||
|
|
||||||
# --------------------------------------------------------------------------
|
# --------------------------------------------------------------------------
|
||||||
# PyPI: cross-platform wheels + sdist
|
# PyPI: cross-platform wheels + sdist
|
||||||
# --------------------------------------------------------------------------
|
# --------------------------------------------------------------------------
|
||||||
@@ -181,29 +195,99 @@ jobs:
|
|||||||
path: bindings/node/artifacts
|
path: bindings/node/artifacts
|
||||||
pattern: bindings-*
|
pattern: bindings-*
|
||||||
|
|
||||||
- name: Create npm/<platform>/ scaffolding (one per target)
|
# The npm/<platform>/package.json templates are committed to the
|
||||||
working-directory: bindings/node
|
# repo (see bindings/node/npm/), so `napi artifacts` only needs to
|
||||||
run: |
|
# drop the freshly built .node binary into the matching directory.
|
||||||
for t in x86_64-unknown-linux-gnu x86_64-apple-darwin aarch64-apple-darwin x86_64-pc-windows-msvc; do
|
|
||||||
npx napi create-npm-dir -t "$t" .
|
|
||||||
done
|
|
||||||
|
|
||||||
- name: Move binaries into platform package layout
|
- name: Move binaries into platform package layout
|
||||||
working-directory: bindings/node
|
working-directory: bindings/node
|
||||||
run: npx napi artifacts --dir artifacts
|
run: npx napi artifacts --dir artifacts
|
||||||
|
|
||||||
- name: Prepublish platform packages to npm
|
# Publish each platform package individually so one failure doesn't kill
|
||||||
|
# the others. Skip versions that are already on npm. Tolerate spam-filter
|
||||||
|
# 403s with a one-time retry after a short delay (spam detection is
|
||||||
|
# often rate-limit-based and clears on the next request).
|
||||||
|
- name: Publish platform packages (idempotent)
|
||||||
working-directory: bindings/node
|
working-directory: bindings/node
|
||||||
run: npx napi prepublish -t npm --skip-gh-release
|
|
||||||
env:
|
env:
|
||||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
||||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||||
|
run: |
|
||||||
|
set +e
|
||||||
|
version=$(node -p "require('./package.json').version")
|
||||||
|
publish_dir() {
|
||||||
|
local dir=$1
|
||||||
|
local pkg=$(basename "$dir")
|
||||||
|
local pkgname="wickra-$pkg"
|
||||||
|
local existing
|
||||||
|
existing=$(npm view "$pkgname@$version" version 2>/dev/null)
|
||||||
|
if [ "$existing" = "$version" ]; then
|
||||||
|
echo "::notice::skip $pkgname@$version (already on npm)"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
echo "::group::publish $pkgname@$version"
|
||||||
|
(cd "$dir" && npm publish --access public)
|
||||||
|
local rc=$?
|
||||||
|
echo "::endgroup::"
|
||||||
|
if [ "$rc" -ne 0 ]; then
|
||||||
|
echo "::warning::first attempt of $pkgname failed (rc=$rc); retrying after 30s"
|
||||||
|
sleep 30
|
||||||
|
(cd "$dir" && npm publish --access public)
|
||||||
|
rc=$?
|
||||||
|
fi
|
||||||
|
if [ "$rc" -ne 0 ]; then
|
||||||
|
echo "::warning::$pkgname could not be published; the main package will skip the missing optional dep"
|
||||||
|
fi
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
for dir in npm/*/; do
|
||||||
|
publish_dir "$dir"
|
||||||
|
done
|
||||||
|
|
||||||
- name: Publish main package to npm
|
- name: Publish main package to npm (idempotent)
|
||||||
working-directory: bindings/node
|
working-directory: bindings/node
|
||||||
run: npm publish --access public
|
|
||||||
env:
|
env:
|
||||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
# GitHub Actions defaults to `bash -e`. `npm view` on a not-yet-
|
||||||
|
# published package returns 1, which would kill the step before
|
||||||
|
# we got to publish. Force a graceful empty result instead.
|
||||||
|
set +e
|
||||||
|
version=$(node -p "require('./package.json').version")
|
||||||
|
existing=$(npm view "wickra@$version" version 2>/dev/null)
|
||||||
|
if [ "$existing" = "$version" ]; then
|
||||||
|
echo "::notice::skip wickra@$version (already on npm)"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
# --ignore-scripts so any leftover prepublish hooks (which would
|
||||||
|
# otherwise try to republish the already-published platform
|
||||||
|
# subpackages) can't sabotage the main publish.
|
||||||
|
npm publish --access public --ignore-scripts
|
||||||
|
rc=$?
|
||||||
|
if [ "$rc" -ne 0 ]; then
|
||||||
|
echo "::warning::first attempt failed (rc=$rc); retrying after 30s"
|
||||||
|
sleep 30
|
||||||
|
npm publish --access public --ignore-scripts
|
||||||
|
rc=$?
|
||||||
|
fi
|
||||||
|
exit $rc
|
||||||
|
|
||||||
|
- name: Pack node tarballs for release attachment
|
||||||
|
working-directory: bindings/node
|
||||||
|
run: |
|
||||||
|
# Main package
|
||||||
|
npm pack --ignore-scripts
|
||||||
|
# Each per-platform package (the binaries were already moved in by napi artifacts)
|
||||||
|
for d in npm/*/; do
|
||||||
|
(cd "$d" && npm pack)
|
||||||
|
done
|
||||||
|
|
||||||
|
- name: Upload Node tarballs
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: node-tarballs
|
||||||
|
path: |
|
||||||
|
bindings/node/*.tgz
|
||||||
|
bindings/node/npm/*/*.tgz
|
||||||
|
|
||||||
# --------------------------------------------------------------------------
|
# --------------------------------------------------------------------------
|
||||||
# WASM: wasm-pack build + npm publish (as `wickra-wasm`)
|
# WASM: wasm-pack build + npm publish (as `wickra-wasm`)
|
||||||
@@ -242,6 +326,16 @@ jobs:
|
|||||||
fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2));
|
fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2));
|
||||||
"
|
"
|
||||||
|
|
||||||
|
- name: Pack wickra-wasm for release attachment
|
||||||
|
working-directory: bindings/wasm/pkg
|
||||||
|
run: npm pack
|
||||||
|
|
||||||
|
- name: Upload WASM tarball
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: wasm-tarball
|
||||||
|
path: bindings/wasm/pkg/wickra-wasm-*.tgz
|
||||||
|
|
||||||
- name: Publish wickra-wasm to npm (idempotent)
|
- name: Publish wickra-wasm to npm (idempotent)
|
||||||
working-directory: bindings/wasm/pkg
|
working-directory: bindings/wasm/pkg
|
||||||
run: |
|
run: |
|
||||||
@@ -250,3 +344,89 @@ jobs:
|
|||||||
|| (echo "$out"; exit 1))
|
|| (echo "$out"; exit 1))
|
||||||
env:
|
env:
|
||||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||||
|
|
||||||
|
# --------------------------------------------------------------------------
|
||||||
|
# GitHub Release: attach every built artefact to the tag's release page.
|
||||||
|
# --------------------------------------------------------------------------
|
||||||
|
github-release:
|
||||||
|
name: Attach assets to the GitHub Release
|
||||||
|
needs: [cargo-publish, python-publish, node-publish, wasm-publish]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Resolve target tag
|
||||||
|
id: tag
|
||||||
|
run: |
|
||||||
|
if [ "${{ github.event_name }}" = "push" ] && [[ "${{ github.ref }}" == refs/tags/* ]]; then
|
||||||
|
tag="${{ github.ref_name }}"
|
||||||
|
else
|
||||||
|
# workflow_dispatch / non-tag push: attach to the latest v* tag.
|
||||||
|
tag=$(git tag --list 'v*' --sort=-v:refname | head -n1)
|
||||||
|
fi
|
||||||
|
if [ -z "$tag" ]; then
|
||||||
|
echo "::error::no v* tag found to attach assets to"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "tag=$tag" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "::notice::attaching assets to release $tag"
|
||||||
|
|
||||||
|
- name: Download all build artifacts
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
path: artifacts
|
||||||
|
|
||||||
|
- name: Stage release assets
|
||||||
|
run: |
|
||||||
|
set -e
|
||||||
|
mkdir -p release-assets
|
||||||
|
# Python wheels + sdist (5 wheel artifacts + 1 sdist artifact).
|
||||||
|
find artifacts -type f -name "*.whl" -exec cp {} release-assets/ \;
|
||||||
|
find artifacts -type f -name "*.tar.gz" -exec cp {} release-assets/ \;
|
||||||
|
# Native Node binaries (one per platform).
|
||||||
|
find artifacts -type f -name "*.node" -exec cp {} release-assets/ \;
|
||||||
|
# Node npm-pack tarballs (main + per-platform).
|
||||||
|
find artifacts -type f -name "wickra-*.tgz" -exec cp {} release-assets/ \;
|
||||||
|
# Cargo .crate files (one per workspace member).
|
||||||
|
find artifacts -type f -name "*.crate" -exec cp {} release-assets/ \;
|
||||||
|
ls -lh release-assets/
|
||||||
|
echo "asset-count=$(ls release-assets/ | wc -l)"
|
||||||
|
|
||||||
|
- name: Create / update GitHub Release with assets
|
||||||
|
uses: softprops/action-gh-release@v2
|
||||||
|
with:
|
||||||
|
tag_name: ${{ steps.tag.outputs.tag }}
|
||||||
|
name: Wickra ${{ steps.tag.outputs.tag }}
|
||||||
|
files: release-assets/*
|
||||||
|
generate_release_notes: true
|
||||||
|
fail_on_unmatched_files: false
|
||||||
|
body: |
|
||||||
|
Wickra ${{ github.ref_name }} — streaming-first technical indicators across 4 language registries.
|
||||||
|
|
||||||
|
### Install
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cargo add wickra
|
||||||
|
pip install wickra
|
||||||
|
npm install wickra
|
||||||
|
npm install wickra-wasm
|
||||||
|
```
|
||||||
|
|
||||||
|
### Attached assets
|
||||||
|
|
||||||
|
Pre-built artefacts for every supported platform — the same files that
|
||||||
|
were uploaded to crates.io, PyPI, and npm by this workflow run.
|
||||||
|
|
||||||
|
- `*.whl` / `wickra-*.tar.gz` — Python wheels + sdist (5 platforms, ABI3 ≥ 3.9)
|
||||||
|
- `wickra.*.node` — native Node bindings (linux-x64-gnu, darwin-x64,
|
||||||
|
darwin-arm64, win32-x64-msvc)
|
||||||
|
- `wickra-*.tgz` — npm-pack tarballs (main package + per-platform subpackages + WASM)
|
||||||
|
- `*.crate` — cargo source crates (wickra-core, wickra-data, wickra)
|
||||||
|
|
||||||
|
### Auto-generated changelog
|
||||||
|
|
||||||
|
See below; GitHub computes it from the commits since the previous tag.
|
||||||
Generated
+6
-6
@@ -1883,7 +1883,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wickra"
|
name = "wickra"
|
||||||
version = "0.1.1"
|
version = "0.1.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"approx",
|
"approx",
|
||||||
"criterion",
|
"criterion",
|
||||||
@@ -1894,7 +1894,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wickra-core"
|
name = "wickra-core"
|
||||||
version = "0.1.1"
|
version = "0.1.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"approx",
|
"approx",
|
||||||
"proptest",
|
"proptest",
|
||||||
@@ -1904,7 +1904,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wickra-data"
|
name = "wickra-data"
|
||||||
version = "0.1.1"
|
version = "0.1.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"approx",
|
"approx",
|
||||||
"csv",
|
"csv",
|
||||||
@@ -1922,7 +1922,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wickra-node"
|
name = "wickra-node"
|
||||||
version = "0.1.1"
|
version = "0.1.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"napi",
|
"napi",
|
||||||
"napi-build",
|
"napi-build",
|
||||||
@@ -1932,7 +1932,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wickra-python"
|
name = "wickra-python"
|
||||||
version = "0.1.1"
|
version = "0.1.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"numpy",
|
"numpy",
|
||||||
"pyo3",
|
"pyo3",
|
||||||
@@ -1941,7 +1941,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wickra-wasm"
|
name = "wickra-wasm"
|
||||||
version = "0.1.1"
|
version = "0.1.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"console_error_panic_hook",
|
"console_error_panic_hook",
|
||||||
"js-sys",
|
"js-sys",
|
||||||
|
|||||||
+2
-2
@@ -11,7 +11,7 @@ members = [
|
|||||||
exclude = []
|
exclude = []
|
||||||
|
|
||||||
[workspace.package]
|
[workspace.package]
|
||||||
version = "0.1.1"
|
version = "0.1.4"
|
||||||
authors = ["Wickra Contributors"]
|
authors = ["Wickra Contributors"]
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
rust-version = "1.75"
|
rust-version = "1.75"
|
||||||
@@ -23,7 +23,7 @@ keywords = ["finance", "trading", "indicators", "technical-analysis", "ta"]
|
|||||||
categories = ["finance", "mathematics", "science"]
|
categories = ["finance", "mathematics", "science"]
|
||||||
|
|
||||||
[workspace.dependencies]
|
[workspace.dependencies]
|
||||||
wickra-core = { path = "crates/wickra-core", version = "0.1.1" }
|
wickra-core = { path = "crates/wickra-core", version = "0.1.4" }
|
||||||
|
|
||||||
thiserror = "2"
|
thiserror = "2"
|
||||||
rayon = "1.10"
|
rayon = "1.10"
|
||||||
|
|||||||
+330
-40
@@ -1,50 +1,340 @@
|
|||||||
|
/* tslint:disable */
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
/* prettier-ignore */
|
/* prettier-ignore */
|
||||||
// Platform-aware loader for the Wickra Node native binding.
|
|
||||||
//
|
|
||||||
// In production (after `npm install wickra`) the actual `.node` binary
|
|
||||||
// lives inside a per-platform subpackage that npm installs as an
|
|
||||||
// optional dependency — e.g. `wickra-linux-x64-gnu`. In development
|
|
||||||
// (after `napi build --platform`) the binary sits next to this file.
|
|
||||||
// We try the local path first and fall back to the subpackage so the
|
|
||||||
// same loader works in both modes.
|
|
||||||
|
|
||||||
const { platform, arch } = process;
|
/* auto-generated by NAPI-RS */
|
||||||
const { join } = require('node:path');
|
|
||||||
const { existsSync } = require('node:fs');
|
|
||||||
|
|
||||||
const TARGETS = {
|
const { existsSync, readFileSync } = require('fs')
|
||||||
'linux-x64': 'linux-x64-gnu',
|
const { join } = require('path')
|
||||||
'darwin-x64': 'darwin-x64',
|
|
||||||
'darwin-arm64': 'darwin-arm64',
|
|
||||||
'win32-x64': 'win32-x64-msvc',
|
|
||||||
};
|
|
||||||
|
|
||||||
function load() {
|
const { platform, arch } = process
|
||||||
const key = `${platform}-${arch}`;
|
|
||||||
const target = TARGETS[key];
|
|
||||||
if (!target) {
|
|
||||||
throw new Error(
|
|
||||||
`wickra: this platform/architecture combination is not supported (${key}). ` +
|
|
||||||
'Open an issue at https://github.com/kingchenc/wickra/issues with your platform details.'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const localBinary = join(__dirname, `wickra.${target}.node`);
|
let nativeBinding = null
|
||||||
if (existsSync(localBinary)) {
|
let localFileExisted = false
|
||||||
return require(localBinary);
|
let loadError = null
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
function isMusl() {
|
||||||
return require(`wickra-${target}`);
|
// For Node 10
|
||||||
} catch (err) {
|
if (!process.report || typeof process.report.getReport !== 'function') {
|
||||||
throw new Error(
|
try {
|
||||||
`wickra: failed to load the native binding for ${key}. ` +
|
const lddPath = require('child_process').execSync('which ldd').toString().trim()
|
||||||
`Expected either ${localBinary} or the wickra-${target} package to be installed. ` +
|
return readFileSync(lddPath, 'utf8').includes('musl')
|
||||||
`Run \`npm install\` again, or build from source with \`npm run build\`. ` +
|
} catch (e) {
|
||||||
`Underlying error: ${err.message}`
|
return true
|
||||||
);
|
}
|
||||||
|
} else {
|
||||||
|
const { glibcVersionRuntime } = process.report.getReport().header
|
||||||
|
return !glibcVersionRuntime
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = load();
|
switch (platform) {
|
||||||
|
case 'android':
|
||||||
|
switch (arch) {
|
||||||
|
case 'arm64':
|
||||||
|
localFileExisted = existsSync(join(__dirname, 'wickra.android-arm64.node'))
|
||||||
|
try {
|
||||||
|
if (localFileExisted) {
|
||||||
|
nativeBinding = require('./wickra.android-arm64.node')
|
||||||
|
} else {
|
||||||
|
nativeBinding = require('wickra-android-arm64')
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
loadError = e
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case 'arm':
|
||||||
|
localFileExisted = existsSync(join(__dirname, 'wickra.android-arm-eabi.node'))
|
||||||
|
try {
|
||||||
|
if (localFileExisted) {
|
||||||
|
nativeBinding = require('./wickra.android-arm-eabi.node')
|
||||||
|
} else {
|
||||||
|
nativeBinding = require('wickra-android-arm-eabi')
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
loadError = e
|
||||||
|
}
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
throw new Error(`Unsupported architecture on Android ${arch}`)
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case 'win32':
|
||||||
|
switch (arch) {
|
||||||
|
case 'x64':
|
||||||
|
localFileExisted = existsSync(
|
||||||
|
join(__dirname, 'wickra.win32-x64-msvc.node')
|
||||||
|
)
|
||||||
|
try {
|
||||||
|
if (localFileExisted) {
|
||||||
|
nativeBinding = require('./wickra.win32-x64-msvc.node')
|
||||||
|
} else {
|
||||||
|
nativeBinding = require('wickra-win32-x64-msvc')
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
loadError = e
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case 'ia32':
|
||||||
|
localFileExisted = existsSync(
|
||||||
|
join(__dirname, 'wickra.win32-ia32-msvc.node')
|
||||||
|
)
|
||||||
|
try {
|
||||||
|
if (localFileExisted) {
|
||||||
|
nativeBinding = require('./wickra.win32-ia32-msvc.node')
|
||||||
|
} else {
|
||||||
|
nativeBinding = require('wickra-win32-ia32-msvc')
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
loadError = e
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case 'arm64':
|
||||||
|
localFileExisted = existsSync(
|
||||||
|
join(__dirname, 'wickra.win32-arm64-msvc.node')
|
||||||
|
)
|
||||||
|
try {
|
||||||
|
if (localFileExisted) {
|
||||||
|
nativeBinding = require('./wickra.win32-arm64-msvc.node')
|
||||||
|
} else {
|
||||||
|
nativeBinding = require('wickra-win32-arm64-msvc')
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
loadError = e
|
||||||
|
}
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
throw new Error(`Unsupported architecture on Windows: ${arch}`)
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case 'darwin':
|
||||||
|
localFileExisted = existsSync(join(__dirname, 'wickra.darwin-universal.node'))
|
||||||
|
try {
|
||||||
|
if (localFileExisted) {
|
||||||
|
nativeBinding = require('./wickra.darwin-universal.node')
|
||||||
|
} else {
|
||||||
|
nativeBinding = require('wickra-darwin-universal')
|
||||||
|
}
|
||||||
|
break
|
||||||
|
} catch {}
|
||||||
|
switch (arch) {
|
||||||
|
case 'x64':
|
||||||
|
localFileExisted = existsSync(join(__dirname, 'wickra.darwin-x64.node'))
|
||||||
|
try {
|
||||||
|
if (localFileExisted) {
|
||||||
|
nativeBinding = require('./wickra.darwin-x64.node')
|
||||||
|
} else {
|
||||||
|
nativeBinding = require('wickra-darwin-x64')
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
loadError = e
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case 'arm64':
|
||||||
|
localFileExisted = existsSync(
|
||||||
|
join(__dirname, 'wickra.darwin-arm64.node')
|
||||||
|
)
|
||||||
|
try {
|
||||||
|
if (localFileExisted) {
|
||||||
|
nativeBinding = require('./wickra.darwin-arm64.node')
|
||||||
|
} else {
|
||||||
|
nativeBinding = require('wickra-darwin-arm64')
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
loadError = e
|
||||||
|
}
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
throw new Error(`Unsupported architecture on macOS: ${arch}`)
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case 'freebsd':
|
||||||
|
if (arch !== 'x64') {
|
||||||
|
throw new Error(`Unsupported architecture on FreeBSD: ${arch}`)
|
||||||
|
}
|
||||||
|
localFileExisted = existsSync(join(__dirname, 'wickra.freebsd-x64.node'))
|
||||||
|
try {
|
||||||
|
if (localFileExisted) {
|
||||||
|
nativeBinding = require('./wickra.freebsd-x64.node')
|
||||||
|
} else {
|
||||||
|
nativeBinding = require('wickra-freebsd-x64')
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
loadError = e
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case 'linux':
|
||||||
|
switch (arch) {
|
||||||
|
case 'x64':
|
||||||
|
if (isMusl()) {
|
||||||
|
localFileExisted = existsSync(
|
||||||
|
join(__dirname, 'wickra.linux-x64-musl.node')
|
||||||
|
)
|
||||||
|
try {
|
||||||
|
if (localFileExisted) {
|
||||||
|
nativeBinding = require('./wickra.linux-x64-musl.node')
|
||||||
|
} else {
|
||||||
|
nativeBinding = require('wickra-linux-x64-musl')
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
loadError = e
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
localFileExisted = existsSync(
|
||||||
|
join(__dirname, 'wickra.linux-x64-gnu.node')
|
||||||
|
)
|
||||||
|
try {
|
||||||
|
if (localFileExisted) {
|
||||||
|
nativeBinding = require('./wickra.linux-x64-gnu.node')
|
||||||
|
} else {
|
||||||
|
nativeBinding = require('wickra-linux-x64-gnu')
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
loadError = e
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case 'arm64':
|
||||||
|
if (isMusl()) {
|
||||||
|
localFileExisted = existsSync(
|
||||||
|
join(__dirname, 'wickra.linux-arm64-musl.node')
|
||||||
|
)
|
||||||
|
try {
|
||||||
|
if (localFileExisted) {
|
||||||
|
nativeBinding = require('./wickra.linux-arm64-musl.node')
|
||||||
|
} else {
|
||||||
|
nativeBinding = require('wickra-linux-arm64-musl')
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
loadError = e
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
localFileExisted = existsSync(
|
||||||
|
join(__dirname, 'wickra.linux-arm64-gnu.node')
|
||||||
|
)
|
||||||
|
try {
|
||||||
|
if (localFileExisted) {
|
||||||
|
nativeBinding = require('./wickra.linux-arm64-gnu.node')
|
||||||
|
} else {
|
||||||
|
nativeBinding = require('wickra-linux-arm64-gnu')
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
loadError = e
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case 'arm':
|
||||||
|
if (isMusl()) {
|
||||||
|
localFileExisted = existsSync(
|
||||||
|
join(__dirname, 'wickra.linux-arm-musleabihf.node')
|
||||||
|
)
|
||||||
|
try {
|
||||||
|
if (localFileExisted) {
|
||||||
|
nativeBinding = require('./wickra.linux-arm-musleabihf.node')
|
||||||
|
} else {
|
||||||
|
nativeBinding = require('wickra-linux-arm-musleabihf')
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
loadError = e
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
localFileExisted = existsSync(
|
||||||
|
join(__dirname, 'wickra.linux-arm-gnueabihf.node')
|
||||||
|
)
|
||||||
|
try {
|
||||||
|
if (localFileExisted) {
|
||||||
|
nativeBinding = require('./wickra.linux-arm-gnueabihf.node')
|
||||||
|
} else {
|
||||||
|
nativeBinding = require('wickra-linux-arm-gnueabihf')
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
loadError = e
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case 'riscv64':
|
||||||
|
if (isMusl()) {
|
||||||
|
localFileExisted = existsSync(
|
||||||
|
join(__dirname, 'wickra.linux-riscv64-musl.node')
|
||||||
|
)
|
||||||
|
try {
|
||||||
|
if (localFileExisted) {
|
||||||
|
nativeBinding = require('./wickra.linux-riscv64-musl.node')
|
||||||
|
} else {
|
||||||
|
nativeBinding = require('wickra-linux-riscv64-musl')
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
loadError = e
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
localFileExisted = existsSync(
|
||||||
|
join(__dirname, 'wickra.linux-riscv64-gnu.node')
|
||||||
|
)
|
||||||
|
try {
|
||||||
|
if (localFileExisted) {
|
||||||
|
nativeBinding = require('./wickra.linux-riscv64-gnu.node')
|
||||||
|
} else {
|
||||||
|
nativeBinding = require('wickra-linux-riscv64-gnu')
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
loadError = e
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case 's390x':
|
||||||
|
localFileExisted = existsSync(
|
||||||
|
join(__dirname, 'wickra.linux-s390x-gnu.node')
|
||||||
|
)
|
||||||
|
try {
|
||||||
|
if (localFileExisted) {
|
||||||
|
nativeBinding = require('./wickra.linux-s390x-gnu.node')
|
||||||
|
} else {
|
||||||
|
nativeBinding = require('wickra-linux-s390x-gnu')
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
loadError = e
|
||||||
|
}
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
throw new Error(`Unsupported architecture on Linux: ${arch}`)
|
||||||
|
}
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!nativeBinding) {
|
||||||
|
if (loadError) {
|
||||||
|
throw loadError
|
||||||
|
}
|
||||||
|
throw new Error(`Failed to load native binding`)
|
||||||
|
}
|
||||||
|
|
||||||
|
const { version, SMA, EMA, WMA, RSI, DEMA, TEMA, HMA, ROC, TRIX, MACD, BollingerBands, ATR, Stochastic, OBV, ADX, CCI, WilliamsR, MFI, PSAR, Keltner, Donchian, VWAP, AwesomeOscillator, Aroon, KAMA } = nativeBinding
|
||||||
|
|
||||||
|
module.exports.version = version
|
||||||
|
module.exports.SMA = SMA
|
||||||
|
module.exports.EMA = EMA
|
||||||
|
module.exports.WMA = WMA
|
||||||
|
module.exports.RSI = RSI
|
||||||
|
module.exports.DEMA = DEMA
|
||||||
|
module.exports.TEMA = TEMA
|
||||||
|
module.exports.HMA = HMA
|
||||||
|
module.exports.ROC = ROC
|
||||||
|
module.exports.TRIX = TRIX
|
||||||
|
module.exports.MACD = MACD
|
||||||
|
module.exports.BollingerBands = BollingerBands
|
||||||
|
module.exports.ATR = ATR
|
||||||
|
module.exports.Stochastic = Stochastic
|
||||||
|
module.exports.OBV = OBV
|
||||||
|
module.exports.ADX = ADX
|
||||||
|
module.exports.CCI = CCI
|
||||||
|
module.exports.WilliamsR = WilliamsR
|
||||||
|
module.exports.MFI = MFI
|
||||||
|
module.exports.PSAR = PSAR
|
||||||
|
module.exports.Keltner = Keltner
|
||||||
|
module.exports.Donchian = Donchian
|
||||||
|
module.exports.VWAP = VWAP
|
||||||
|
module.exports.AwesomeOscillator = AwesomeOscillator
|
||||||
|
module.exports.Aroon = Aroon
|
||||||
|
module.exports.KAMA = KAMA
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
{
|
||||||
|
"name": "wickra-darwin-arm64",
|
||||||
|
"version": "0.1.4",
|
||||||
|
"description": "Native binding for wickra (macOS Apple Silicon). Installed automatically as an optional dependency of wickra on matching platforms.",
|
||||||
|
"main": "wickra.darwin-arm64.node",
|
||||||
|
"files": [
|
||||||
|
"wickra.darwin-arm64.node"
|
||||||
|
],
|
||||||
|
"license": "SEE LICENSE IN LICENSE",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 16"
|
||||||
|
},
|
||||||
|
"os": [
|
||||||
|
"darwin"
|
||||||
|
],
|
||||||
|
"cpu": [
|
||||||
|
"arm64"
|
||||||
|
],
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/kingchenc/wickra"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/kingchenc/wickra"
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
{
|
||||||
|
"name": "wickra-darwin-x64",
|
||||||
|
"version": "0.1.4",
|
||||||
|
"description": "Native binding for wickra (macOS Intel). Installed automatically as an optional dependency of wickra on matching platforms.",
|
||||||
|
"main": "wickra.darwin-x64.node",
|
||||||
|
"files": [
|
||||||
|
"wickra.darwin-x64.node"
|
||||||
|
],
|
||||||
|
"license": "SEE LICENSE IN LICENSE",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 16"
|
||||||
|
},
|
||||||
|
"os": [
|
||||||
|
"darwin"
|
||||||
|
],
|
||||||
|
"cpu": [
|
||||||
|
"x64"
|
||||||
|
],
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/kingchenc/wickra"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/kingchenc/wickra"
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
"name": "wickra-linux-x64-gnu",
|
||||||
|
"version": "0.1.4",
|
||||||
|
"description": "Native binding for wickra (linux x64 GNU). Installed automatically as an optional dependency of wickra on matching platforms.",
|
||||||
|
"main": "wickra.linux-x64-gnu.node",
|
||||||
|
"files": [
|
||||||
|
"wickra.linux-x64-gnu.node"
|
||||||
|
],
|
||||||
|
"license": "SEE LICENSE IN LICENSE",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 16"
|
||||||
|
},
|
||||||
|
"os": [
|
||||||
|
"linux"
|
||||||
|
],
|
||||||
|
"cpu": [
|
||||||
|
"x64"
|
||||||
|
],
|
||||||
|
"libc": [
|
||||||
|
"glibc"
|
||||||
|
],
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/kingchenc/wickra"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/kingchenc/wickra"
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
{
|
||||||
|
"name": "wickra-win32-x64-msvc",
|
||||||
|
"version": "0.1.4",
|
||||||
|
"description": "Native binding for wickra (Windows x64 MSVC). Installed automatically as an optional dependency of wickra on matching platforms.",
|
||||||
|
"main": "wickra.win32-x64-msvc.node",
|
||||||
|
"files": [
|
||||||
|
"wickra.win32-x64-msvc.node"
|
||||||
|
],
|
||||||
|
"license": "SEE LICENSE IN LICENSE",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 16"
|
||||||
|
},
|
||||||
|
"os": [
|
||||||
|
"win32"
|
||||||
|
],
|
||||||
|
"cpu": [
|
||||||
|
"x64"
|
||||||
|
],
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/kingchenc/wickra"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/kingchenc/wickra"
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "wickra",
|
"name": "wickra",
|
||||||
"version": "0.1.1",
|
"version": "0.1.4",
|
||||||
"description": "Streaming-first technical indicators: incremental, fast, install-free. Node bindings powered by Rust.",
|
"description": "Streaming-first technical indicators: incremental, fast, install-free. Node bindings powered by Rust.",
|
||||||
"author": "kingchenc <kingchencp@gmail.com>",
|
"author": "kingchenc <kingchencp@gmail.com>",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
@@ -44,11 +44,16 @@
|
|||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 16"
|
"node": ">= 16"
|
||||||
},
|
},
|
||||||
|
"optionalDependencies": {
|
||||||
|
"wickra-linux-x64-gnu": "0.1.4",
|
||||||
|
"wickra-darwin-x64": "0.1.4",
|
||||||
|
"wickra-darwin-arm64": "0.1.4",
|
||||||
|
"wickra-win32-x64-msvc": "0.1.4"
|
||||||
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "napi build --platform --release",
|
"build": "napi build --platform --release",
|
||||||
"build:debug": "napi build --platform",
|
"build:debug": "napi build --platform",
|
||||||
"artifacts": "napi artifacts",
|
"artifacts": "napi artifacts",
|
||||||
"prepublishOnly": "napi prepublish -t npm",
|
|
||||||
"universal": "napi universal",
|
"universal": "napi universal",
|
||||||
"version": "napi version",
|
"version": "napi version",
|
||||||
"test": "node --test __tests__/"
|
"test": "node --test __tests__/"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ build-backend = "maturin"
|
|||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "wickra"
|
name = "wickra"
|
||||||
version = "0.1.1"
|
version = "0.1.4"
|
||||||
description = "Streaming-first technical indicators: incremental, fast, install-free."
|
description = "Streaming-first technical indicators: incremental, fast, install-free."
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
license = { text = "PolyForm-Noncommercial-1.0.0" }
|
license = { text = "PolyForm-Noncommercial-1.0.0" }
|
||||||
|
|||||||
Reference in New Issue
Block a user