Skip to content

Support explicit resource management (using / await using) #423

@re-taro

Description

@re-taro

Describe the feature

Summary

Add support for TC39 Explicit Resource Management (ERM) proposal, enabling using and await using declarations in jiti.

Motivation

The Explicit Resource Management proposal (Stage 3, targeting ES2026) provides
a standardized way to manage resource cleanup using Symbol.dispose and Symbol.asyncDispose.

using file = openFile("data.txt");
// file is automatically disposed when exiting scope

Since jiti transpiles to CJS for execution, Node.js native ERM support is not available. Babel transformation is required.

Proposed Solution

Integrate @babel/plugin-transform-explicit-resource-management to transpile using/await using declarations into try-finally patterns.

References

Additional information

  • Would you be willing to help implement this feature?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions