Skip to content

Conversation

@zees-dev
Copy link
Contributor

Description

This PR introduces changes so that the modules independent and hence importable into external runtimes - as library functions.

AI Description

This pull request introduces significant changes to streamline the runtime initialization process, update build configurations, and enhance modularity.
The most important updates include consolidating feature-specific initialization under a unified runtime feature, modifying build matrix configurations, and extending crate types for better compatibility.

Build configuration updates:

  • Updated the build matrix in .github/workflows/release.yml to include the runtime feature alongside other features like crypto, fetch, llm, and wasip1. This ensures a consistent runtime environment for all builds. ([.github/workflows/release.ymlL16-R19](https://github.com/blessnetwork/javy-bless-plugins/pull/18/files#diff-87db21a973eed4fef5f32b267aa60fcee5cbdf03c67fafdc2a9b553bb0b15f34L16-R19))
  • Simplified artifact naming logic in .github/workflows/release.yml by removing the special case for the "standard" build. ([.github/workflows/release.ymlL49-R48](https://github.com/blessnetwork/javy-bless-plugins/pull/18/files#diff-87db21a973eed4fef5f32b267aa60fcee5cbdf03c67fafdc2a9b553bb0b15f34L49-R48))

Runtime initialization improvements:

  • Consolidated feature-specific initialization (e.g., crypto, fetch, llm, wasip1) under a new runtime feature in src/lib.rs. Each feature now has its own set_*_globals function to encapsulate initialization logic. ([[1]](https://github.com/blessnetwork/javy-bless-plugins/pull/18/files#diff-b1a35a68f14e696205874893c07fd24fdb88882b47c23cc0e0c80a30c7d53759R1-R6), [[2]](https://github.com/blessnetwork/javy-bless-plugins/pull/18/files#diff-b1a35a68f14e696205874893c07fd24fdb88882b47c23cc0e0c80a30c7d53759L20-R88), [[3]](https://github.com/blessnetwork/javy-bless-plugins/pull/18/files#diff-b1a35a68f14e696205874893c07fd24fdb88882b47c23cc0e0c80a30c7d53759L79-R98), [[4]](https://github.com/blessnetwork/javy-bless-plugins/pull/18/files#diff-b1a35a68f14e696205874893c07fd24fdb88882b47c23cc0e0c80a30c7d53759R114-R139))
  • Added JavaScript evaluations for feature-specific global objects (e.g., crypto.js, fetch.js, wasi/preview_1.js) during runtime initialization. ([src/lib.rsR114-R139](https://github.com/blessnetwork/javy-bless-plugins/pull/18/files#diff-b1a35a68f14e696205874893c07fd24fdb88882b47c23cc0e0c80a30c7d53759R114-R139))

Crate configuration updates:

  • Extended crate-type in Cargo.toml to include rlib alongside cdylib, allowing for more flexible use cases. ([Cargo.tomlL14-R14](https://github.com/blessnetwork/javy-bless-plugins/pull/18/files#diff-2e9d962a08321605940b5a657135052fbcef87b5e360662bb527c96d9a615542L14-R14))
  • Introduced a new runtime feature in Cargo.toml and added it to the default feature set. This ensures that runtime-related functionality is always included by default. ([Cargo.tomlL30-R31](https://github.com/blessnetwork/javy-bless-plugins/pull/18/files#diff-2e9d962a08321605940b5a657135052fbcef87b5e360662bb527c96d9a615542L30-R31))

@zees-dev zees-dev requested review from Joinhack, Copilot, michalzajda and uditdc and removed request for Joinhack July 29, 2025 04:33
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request refactors the codebase to support external library usage by introducing a new runtime feature and modularizing initialization code. The changes consolidate feature-specific initialization logic into separate functions and update build configurations to ensure consistent runtime environments across all builds.

  • Introduces a new runtime feature that consolidates all initialization logic under feature-gated functions
  • Refactors the build matrix to include the runtime feature for all builds and removes the "standard" build variant
  • Extends crate types to include rlib for better library compatibility

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
src/lib.rs Refactored initialization logic into separate feature-gated functions and added runtime feature guard
Cargo.toml Added runtime feature to default features and included rlib crate type for library usage
.github/workflows/release.yml Updated build matrix to include runtime feature for all builds and simplified artifact naming

@Joinhack
Copy link
Contributor

Joinhack commented Aug 4, 2025

I saw some issue reported by Copilot

@zees-dev
Copy link
Contributor Author

zees-dev commented Aug 5, 2025

I saw some issue reported by Copilot

false positives; copilot does not have full context - have commented.

@zees-dev zees-dev merged commit 0624e8d into main Aug 5, 2025
9 checks passed
@zees-dev zees-dev deleted the feat/external-lib-use-refactor branch August 5, 2025 02:38
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.

3 participants