Runtime helper functions for JavaScript and TypeScript transformations performed by the SWC compiler.
—
Helpers for handling different module systems and import/export patterns between CommonJS and ES modules.
Handles default imports from CommonJS modules.
/**
* Handles default imports from CommonJS modules
* @param {any} obj - Module object to check
* @returns {any} Object with __esModule handling
*/
function _interop_require_default(obj): any;Usage Example:
// For: import defaultExport from "commonjs-module";
const defaultExport = _interop_require_default(require("commonjs-module")).default;Handles namespace imports from CommonJS modules.
/**
* Handles namespace imports from CommonJS modules
* @param {any} obj - Module object to convert
* @param {boolean} nodeInterop - Node.js interop mode
* @returns {any} Namespace object
*/
function _interop_require_wildcard(obj, nodeInterop): any;Usage Example:
// For: import * as namespace from "commonjs-module";
const namespace = _interop_require_wildcard(require("commonjs-module"));Handles export * statements.
/**
* Handles export * statements
* @param {Object} from - Source module object
* @param {Object} to - Target module object
* @param {Set} excludes - Properties to exclude from export
*/
function _export_star(from, to, excludes): void;Usage Example:
// For: export * from "./other-module";
_export_star(require("./other-module"), exports);Install with Tessl CLI
npx tessl i tessl/npm-swc--helpers