npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@gitlab/query-language-rust

v0.24.0

Published

GLQL transpiler, wrapping the WASM build, written in Rust

Readme

GitLab Query Language

Latest Release Rust Coverage Pipeline Status

The compiler is built in Rust[^1] and distributed as two packages:

  • npm / WASM (@gitlab/query-language-rust): Used by GitLab's frontend for client-side query compilation.
  • Ruby gem (gitlab_query_language): Used by GitLab's backend for server-side query processing.

Goals of this library include:

  • Transpiling GLQL queries, including the YAML frontmatter block to a GraphQL response.
  • Transforming the result of a GraphQL call using transformer functions.

npm / WASM

@gitlab/query-language-rust is an npm module that provides a simple interface for converting glql queries into other formats.

It wraps the WebAssembly build of the glql compiler, written in Rust.

Usage

Install the module:

npm install --save @gitlab/query-language-rust

Import and use the module:

<script type="module">
  import { glql } from '@gitlab/query-language-rust';

  let query = 'label != "backend" and author = currentUser() and weight = 1 and updated > today()';

  let graphql = await glql.compile(query, {
    group: 'gitlab-org',
    username: 'johnhope',
  });

  console.log(graphql);
</script>

Running the Browser Playground

Clone the repo, then install the dev dependencies, build the WASM target, and serve the npm/ directory:

npm install
cargo install wasm-pack
rustup target add wasm32-unknown-unknown
wasm-pack build --target web
npx wds -r npm/

Ruby Gem

The same Rust compiler is also available as a Ruby gem, providing native Ruby bindings for server-side use.

Installation

Add to your Gemfile:

gem 'gitlab_query_language'

Or install directly:

gem install gitlab_query_language

Usage

require 'gitlab_query_language'

query = 'label != "backend" and author = currentUser() and weight = 1'
result = Glql.compile(query, { group: 'gitlab-org', username: 'johnhope', fields: 'title' })
puts result

Interactive Console (CLI / REPL)

The Ruby gem provides a quick way to test GLQL queries from the command line without needing a browser:

cd glql_rb
bundle exec rake compile
bundle exec rake console
irb(main):001> Glql.compile('type = Issue', {group: 'gitlab-org', username: 'johnhope', fields: 'id'})
=>
{"fields" => [{"key" => "id", "label" => "ID", "name" => "id"}],
 "output" => "query GLQL(...) { ... }",
 "success" => true,
 "variables" => { ... }}

For full details on the Ruby gem, see glql_rb/README.md.

Development

Ensure you have the following installed:

  • Rust (version 1.73.0)
  • Cargo (usually comes with Rust)
  • Lefthook (for managing git hooks)
  • Nodejs (for running the GLQL -> GraphQL compiler)

To verify your Rust and Cargo installation, run:

rustc --version
cargo --version

If using VSCode, consider installing the rust-analyzer extension.

Setting Up Lefthook

Lefthook is used to automate certain checks before pushing code to the repository, such as running tests, ensuring code is formatted, and checking for lint warnings.

To install Lefthook globally on MacOS, run:

brew install lefthook

For other platforms or methods to install, see installation docs for Lefthook.

Once lefthook is installed, enable it in your project by running the following command in the root of your repository:

lefthook install

This command will set up Lefthook to manage git hooks for pre-push checks as defined in the lefthook.yml file.

Pre-push Hooks

The following checks will run automatically before you push your code:

  • Tests: Ensures all tests pass using cargo test.
  • Clippy: Runs cargo clippy to check for lint warnings and ensures no warnings are present.
  • Format: Ensures code is formatted properly using cargo fmt --check.
  • Check: Runs cargo check to verify that the code compiles without errors.

Running Tests

Rust Tests

To run the Rust tests manually, use the following command:

cargo test

This will build and run all tests defined in your Rust project.

WASM Package Tests

To run the WASM package tests, use:

npm test

For continuous integration testing:

npm run test:ci

Code Coverage

Coverage reports are automatically generated in CI/CD and published to GitLab Pages at:

  • Rust coverage: https://gitlab-org.gitlab.io/glql/coverage/

Formatting Code

To ensure your code is properly formatted using rustfmt, run:

cargo fmt -- --check

This command checks whether your code adheres to the formatting rules but does not modify any files. To automatically format your code, run:

cargo fmt

Linting with Clippy

To lint your code and catch common mistakes or inefficiencies, run:

cargo clippy -- -D warnings

This will treat all warnings as errors and prevent the code from building if any warnings are found.

End-to-End Testing

When making changes to the GLQL Rust codebase, you can follow these steps to test your modifications end-to-end in GitLab GDK:

In glql-rust directory:

  1. Build the Rust code to WASM wasm-pack build --target web --out-dir pkg
  2. Build the npm package npm run build
  3. Copy the full path to the build echo "$(pwd)/npm/dist/main.js"

In Gitlab GDK directory:

Update the import paths in both app/assets/javascripts/glql/core/parser.js and app/assets/javascripts/glql/core/transformer.js:

// change from
import { glql } from '@gitlab/query-language-rust';

// to
import { glql } from 'file:///path/from/step/3/above';

Now you can test your changes in any markdown field embedding there your GLQL query, for example:

```glql
display: table
fields: title, labels, author
query: group = "gitlab-org" and label = "group::knowlegde" and user = currentUser()
```

Note: Every time you make a change in glql-rust, you must rebuild both the WASM and npm packages for the changes to take effect.

Contributing

  1. If you don't already have access, start onboarding by requesting access to the community forks.
  2. Clone the community fork repository.
  3. Create a new feature branch (git checkout -b feature/my-feature).
  4. Commit your changes (git commit -am 'Add new feature').
  5. Push to the branch (git push origin feature/my-feature).
  6. Open an MR.

Release process

[!important] Pre-requisites You need Developer permissions in the project.

On the main branch, run any of the below pipeline jobs to create a release:

  • release-patch: Bump patch version and publish to NPM.
  • release-minor: Bump minor version and publish to NPM.
  • release-major: Bump major version and publish to NPM.

The release-* job will additionally create a release MR to also bump the Ruby gem version and dependency. This currently requires manual approval to trigger the gem release.

See the gem glql_rb/README.md for more details on the release process.

Additional Reading

Learning Rust

Learning more about GLQL

[^1]: Originally written in Haskell.