JSPM

@lumifai/node-jq-native

1.2.1
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 234
    • Score
      100M100P100Q40038F
    • License MIT

    Native jq expression evaluator using Node-API bindings

    Package Exports

    • @lumifai/node-jq-native
    • @lumifai/node-jq-native/index.js

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@lumifai/node-jq-native) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    node-jq-native

    Native jq expression evaluator using Node-API bindings. This package provides a high-performance native implementation of jq for Node.js.

    Installation

    npm install jq-native-evaluator

    No build tools required! This package includes prebuilt static libraries for common architectures:

    • macOS (darwin): arm64, x64
    • Linux: x64, arm64
    • Windows: x64 (coming soon)

    If your platform/architecture is not supported by prebuilt libraries, the package will automatically fall back to building from source (requires autotools).

    Usage

    const { evaluate } = require('jq-native-evaluator');
    
    // Simple expression
    const result = evaluate('.name', { name: 'John', age: 30 });
    console.log(result); // "John"
    
    // With variables
    const result2 = evaluate('.items[] | select(.price > $threshold)', 
      { items: [{ price: 10 }, { price: 20 }] },
      { threshold: 15 }
    );
    console.log(result2); // [{ price: 20 }]

    Building Prebuilt Libraries

    If you need to build prebuilt libraries for your platform (for publishing to npm):

    # Build for current platform
    npm run prebuild
    
    # Build for all common platforms (requires cross-compilation setup)
    npm run prebuild:all

    The prebuilt libraries will be stored in lib/{platform}-{arch}/ directory.

    Requirements

    For Installation (using prebuilt libraries)

    • Node.js >= 18
    • No additional build tools required!

    For Building from Source (fallback)

    If prebuilt libraries are not available for your platform, the following are required:

    • autotools: autoconf, automake, libtool
      • macOS: brew install autoconf automake libtool
      • Linux: apt-get install autoconf automake libtool (or equivalent)
    • make and a C compiler (usually pre-installed)
    • node-gyp (installed automatically as optional dependency)

    Development

    # Install dependencies
    npm install
    
    # Build the native addon
    npm run build
    
    # Run tests
    npm test

    License

    MIT