Skip to content

feat(libdatadog): add universal core and optional extras packages - #207

Open
rochdev wants to merge 5 commits into
mainfrom
rochdev/libdatadog-core
Open

feat(libdatadog): add universal core and optional extras packages#207
rochdev wants to merge 5 commits into
mainfrom
rochdev/libdatadog-core

Conversation

@rochdev

@rochdev rochdev commented Aug 24, 2026

Copy link
Copy Markdown
Member

Summary

Introduces the package foundation shared by the rest of the stack:

  • @datadog/libdatadog is the universal native-first package with an always
    available inlined WASM fallback.
  • @datadog/libdatadog-extras is the renamed existing package for optional
    functionality that is not supported in every environment.

The universal artifact combines the existing DDSketch and compression
bindings into one native library and one WASM module. The APM data pipeline is
deliberately excluded here and added by the next PR in the stack.

Details

  • Generates six napi-rs-compatible platform packages as optional dependencies
    of the universal metapackage.
  • Brotli-compresses and inlines the WASM fallback for bundler and
    cross-platform compatibility.
  • Provides explicit CommonJS and ESM entry points for the selected backend and
    the forced-WASM subpath.
  • Enforces 500 KiB optimized WASM and 200 KiB inlined JavaScript size budgets.
  • Limits Binaryen to the WebAssembly features used by the Rust output and
    supported by Node.js 18; the broader --all-features mode can emit GC
    instructions that Node.js 18 cannot parse.
  • Pins wasm-pack 0.14 in build and release CI to remain compatible with the
    repository's Rust 1.90 toolchain.
  • Builds and publishes the universal package, its platform packages, and the
    extras package from the same release workflow.
  • Runs musl package tests inside Alpine after host-side artifact downloads.
  • Keeps library_config in extras; its Rust changes are limited to dependency
    cleanup and edits required by Clippy.
  • Adds package loading, native/WASM parity, ESM, and published-content tests.

The generated packages/libdatadog/package-lock.json accounts for most of the
added lines in this foundation PR.

Validation

  • Native and WASM Cargo checks, release builds, and Clippy.
  • 17 universal-package integration tests locally.
  • Full repository test suite locally, including HTTP, pipeline, and crash
    tracker coverage.
  • Full package and published-content tests on Node.js 18 and 24 in CI.
  • ESLint, actionlint, and package dry-run/content validation.
  • WASM library_config test.

This PR was generated by Codex.

Stack created with GitHub Stacks CLIGive Feedback 💬

Comment thread crates/library_config/src/lib.rs Outdated

#[wasm_bindgen]
pub fn set_envp(&mut self, envp: Box<[JsValue]>) -> Result<(), JsValue> {
pub fn set_envp(&mut self, envp: Vec<JsValue>) -> Result<(), JsValue> {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file seems mostly like stylistic changes, still.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All changes to this file have been reverted.

@@ -0,0 +1,37 @@
'use strict'

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a test, not a script. Add it to the tests directory.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@@ -0,0 +1,7 @@
#!/usr/bin/env bash

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A little weird that this file is bash and clean-native is JS. Try to be consistent here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switched to JS.

@github-actions

github-actions Bot commented Aug 24, 2026

Copy link
Copy Markdown

Overall package size

Self size: 36.97 MB
Deduped: 36.97 MB
No deduping: 36.97 MB

Dependency sizes | name | version | self size | total size | |------|---------|-----------|------------|

🤖 This report was automatically generated by heaviest-objects-in-the-universe

@rochdev
rochdev force-pushed the rochdev/libdatadog-core branch from d12e121 to c0fa67d Compare August 24, 2026 18:29
@@ -0,0 +1,10 @@
export function backend(): 'native' | 'wasm'

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a test to verify this file?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test added.

@@ -0,0 +1,66 @@
{
"name": "@datadog/libdatadog",
"version": "0.1.0-pre",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that we already have this package published, so this number may need to be bumped.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is already done in release PRs.

Comment thread package.json
@@ -1,7 +1,7 @@
{
"name": "@datadog/libdatadog",
"name": "@datadog/libdatadog-extras",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a TODO somewhere to restructure this whole package Russian doll situation.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, although it's in a bit of a random place because JSON don't have TODOs.

@rochdev
rochdev force-pushed the rochdev/libdatadog-core branch 3 times, most recently from a9fb52c to e2b5753 Compare August 25, 2026 00:30
@rochdev
rochdev marked this pull request as ready for review August 25, 2026 01:57
@rochdev
rochdev requested review from a team as code owners August 25, 2026 01:57
@rochdev

rochdev commented Aug 25, 2026

Copy link
Copy Markdown
Member Author

@bengl All your concerns should have been addressed. I also improved the packaging and cross-platform testing.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e2b5753847

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread .github/workflows/release.yml Outdated
Comment thread scripts/build-wasm.js Outdated
Comment thread packages/libdatadog/index.js
Comment thread packages/libdatadog/index.d.ts
bengl
bengl previously approved these changes Aug 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants