ts-transform-default-export
Advanced tools
Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "ts-transform-default-export", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"license": "ISC", | ||
@@ -39,4 +39,4 @@ "description": "`export default foo` → `export = foo` → `module.exports = foo`", | ||
"@types/tap": "^14.10.0", | ||
"@typescript-eslint/eslint-plugin": "^3.8.0", | ||
"@typescript-eslint/parser": "^3.8.0", | ||
"@typescript-eslint/eslint-plugin": "^3.9.0", | ||
"@typescript-eslint/parser": "^3.9.0", | ||
"eslint": "^7.6.0", | ||
@@ -43,0 +43,0 @@ "eslint-config-prettier": "^6.11.0", |
# ts-transform-default-export | ||
![CI](https://github.com/axtgr/ts-transform-default-export/workflows/CI/badge.svg) | ||
[![Buy me a beer](https://img.shields.io/badge/%F0%9F%8D%BA-Buy%20me%20a%20beer-red?style=flat)](https://www.buymeacoffee.com/axtgr) | ||
[![CI](https://img.shields.io/github/workflow/status/axtgr/ts-transform-default-export/CI?label=CI&logo=github)](https://github.com/axtgr/ts-transform-default-export/actions) | ||
A TypeScript transformer that converts default exports to their CommonJS counterparts: | ||
A TypeScript transformer that converts a default export such as one of these: | ||
`export { foo as default }` → `export = foo` | ||
When such a module is then transpiled to CommonJS or UMD, the export will become `module.exports = foo`, | ||
making the module consumable by `require('foo')` instead of `require('foo').default`. | ||
The transformer is able to convert the following types of exports: | ||
```ts | ||
@@ -20,8 +14,11 @@ export default function foo() {} | ||
Re-exports from other modules are not supported: | ||
to its CommonJS counterpart: | ||
```ts | ||
export * from 'bar' | ||
export = foo | ||
``` | ||
When such a module is then transpiled to CommonJS or UMD, the export will become `module.exports = foo`, | ||
making the module consumable by `require('foo')` instead of `require('foo').default`. | ||
Only files that match the `files` or `include` property of your `tsconfig.json` will be transformed. | ||
@@ -28,0 +25,0 @@ This is an intentional restriction to make it possible to control which files are processed. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17158
93