Highlights 💡
New JavaScript API
This release introduces a new, comprehensive JavaScript API for Rslib.
Caution
This is a Breaking Change. The previously exposed informal API has been removed. You can switch to the new JavaScript API and refer to the docs below to re-integrate.
See the API docs for details:
Usage
- Install Rslib: install the
@rslib/corepackage:
npm add @rslib/core -D- Create an Rslib instance: call the createRslib method to create an Rslib instance:
import { createRslib } from '@rslib/core';
const rslib = await createRslib();- Call Rslib instance methods: use the rslib.build method which will build production outputs:
await rslib.build();Advanced ESM Output
In previous versions, Rslib integrated Rspack's EsmLibraryPlugin through an experimental configuration of experiments.advancedEsm, aiming to optimize the quality of ESM outputs. Now, we are pleased to announce that this plugin has been stabilized.
In this release, the EsmLibraryPlugin is enabled by default by setting experiments.advancedEsm to true in bundle mode. Developers can directly obtain ESM output that is high-quality, more friendly to static analysis, and supports code splitting without any additional configuration.
Better Rstest Integration
Rslib now supports seamless integration with Rstest.
By using the official @rstest/adapter-rslib, you can directly reuse your Rslib build configurations (such as resolve.alias and source.define) within Rstest. This enables zero-config testing for Rslib projects, ensuring your test environment perfectly mirrors your build environment while eliminating the overhead of maintaining duplicate configurations.
// rstest.config.ts
import { defineConfig } from '@rstest/core';
import { withRslibConfig } from '@rstest/adapter-rslib';
export default defineConfig({
extends: withRslibConfig({}),
// Additional Rstest-specific configurations
// ...
});More details: https://rstest.rs/guide/integration/rslib
What's Changed
New Features 🎉
- feat(create-rslib): use
happy-dominstead ofjsdomby @9aoy in #1412 - feat!: add JavaScript API and enhance CLI behaviour by @Timeless0911 in #1394
- feat(create-rslib): use
@rstest/adapter-rslibby @9aoy in #1415 - feat!: enable advanced esm by default by @Timeless0911 in #1413
Other Changes
- chore(deps): update all non-major dependencies by @renovate[bot] in #1411
- chore(deps): update all non-major dependencies by @renovate[bot] in #1414
- Release v0.19.0 by @Timeless0911 in #1416
Full Changelog: v0.18.6...v0.19.0