zshy 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +39 -2
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -548,9 +548,46 @@ To learn more, read the ["Masquerading as CJS"](https://github.com/arethetypeswr
|
|
|
548
548
|
|
|
549
549
|
### How are default exports transpiled?
|
|
550
550
|
|
|
551
|
-
|
|
551
|
+
**CJS interop transform** — When a file contains a single `export default ...` and _no named exports_...
|
|
552
552
|
|
|
553
|
-
|
|
553
|
+
```ts
|
|
554
|
+
function hello() {
|
|
555
|
+
console.log('hello');
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
export default hello;
|
|
559
|
+
```
|
|
560
|
+
|
|
561
|
+
...the built `.cjs` code will assign the exported value directly to `module.exports`:
|
|
562
|
+
|
|
563
|
+
```ts
|
|
564
|
+
function hello() {
|
|
565
|
+
console.log('hello');
|
|
566
|
+
}
|
|
567
|
+
exports.default = hello;
|
|
568
|
+
module.exports = exports.default;
|
|
569
|
+
```
|
|
570
|
+
|
|
571
|
+
...and the associated `.d.cts` files will use `export =` syntax:
|
|
572
|
+
|
|
573
|
+
```ts
|
|
574
|
+
declare function hello(): void;
|
|
575
|
+
export = hello;
|
|
576
|
+
```
|
|
577
|
+
|
|
578
|
+
The ESM build is not impacted by this transform.
|
|
579
|
+
|
|
580
|
+
**ESM interop transform** — Similarly, if a source `.ts` file contains the following syntax:
|
|
581
|
+
|
|
582
|
+
```ts
|
|
583
|
+
export = ...
|
|
584
|
+
```
|
|
585
|
+
|
|
586
|
+
...the generated _ESM_ build will transpile to the following syntax:
|
|
587
|
+
|
|
588
|
+
```ts
|
|
589
|
+
export default ...
|
|
590
|
+
```
|
|
554
591
|
|
|
555
592
|
<br/>
|
|
556
593
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zshy",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Gold-standard build tool for TypeScript libraries",
|
|
6
6
|
"keywords": [
|
|
@@ -81,5 +81,6 @@
|
|
|
81
81
|
},
|
|
82
82
|
"files": [
|
|
83
83
|
"dist"
|
|
84
|
-
]
|
|
84
|
+
],
|
|
85
|
+
"packageManager": "pnpm@9.15.9"
|
|
85
86
|
}
|