Comments (6)
I plan to move directly to ESM without any CommonJS support. I'm just waiting for TypeScript 4.7 (which will have full ESM support), so I don't have to deal with too many TS support issues.
The API will be two named exports: delete
and deleteSync
.
It's probably easier if I do the migration myself as there's a lot of details to get right.
https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
from del.
Does that mean you'd like to convert this library to TypeScript and compile both CommonJS and ESM?
No. The TS mention is about TS not being able to handle ESM until TS 4.7.
from del.
Review: #140 it demonstrates why i want the api change as there is no other good upgrade path at last i do not see it.
from del.
@sindresorhus i am specialist for the new ESM support in typescript 4.7 and got bad new for you and some good as long as you output a single entrypoint your package.json needs the following to be compatible to typescript moduleResolution node12 + nodenext
{
"main": "name.js",
"types": "name.js",
"type": "module",
"exports": "name.js"
}
note that you can use the .cjs and .mjs extensions with this example typescript 4.7 will then lookup: name.d.mts or name.d.cts
there is no fallback to index.d.ts!
{
"type": "module",
"exports": {
"node": {
"import": "./name.js",
"types": "./name.js"
},
"import": "./name.js",
"types": "./name.js"
}
}
the above example uses the object form and also droped types and main fild as they are not needed this will only work with moduleResolution: node12 nodenext so it is not backward compatible add main and types to stay typescript backward compatible also it shows that you need to add types for each nested level.
when you use a Object for exports a lot of edge conditions can apply this was the most basic version for a esm only module
also be aware that subPath Patterns are not supported by typescript as soon as you use them your on your own
when you want the object form you need to add a types fild to each alias and to the root alias this is WiP but the root level works and there is no option to choose the conditions that typescript will use
from del.
I plan to move directly to ESM without any CommonJS support. I'm just waiting for TypeScript 4.7 (which will have full ESM support), so I don't have to deal with too many TS support issues.
Does that mean you'd like to convert this library to TypeScript and compile both CommonJS and ESM?
from del.
I have an implementation ready for this issue under #143.
from del.
Related Issues (20)
- Plugin is not working with Electron App HOT 1
- Add `progress` event
- Filenames with parentheses not deleted
- why 'del' restores the files I have deleted using 'rimraf'
- 5. X and 6 X performs wildcard recursive directory deletion, which is invalid
- Weird problem in the npm page HOT 1
- Error: Cannot delete files/directories outside the current working directory HOT 1
- Release Notes for version 7 are incorrect HOT 1
- Build fail when using Babel HOT 3
- Couldn't delete dot files in del7.0.0 HOT 1
- [v8] Make the `dot` option true by default?
- Cannot find module 'del' HOT 1
- TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" HOT 1
- Protocol 'node:' not supported HOT 1
- Add path to ProgressData
- Build is failing in CI HOT 2
- Update supported engines to >=16 HOT 1
- Why not use rollup to provide a commonjs module? HOT 1
- Unable to require/import this module into gulp HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from del.