-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat: add .d.ts, .d.cts, and .d.mts generation #2
Conversation
src/TypesService.ts
Outdated
node.modifiers, | ||
node.importClause, | ||
ts.factory.createStringLiteral( | ||
'./' + path.join(dirname, remapExtension(fileNameWithExtension)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might need to add a ../
instead here if importPath
starts with ../
src/constants.ts
Outdated
|
||
export const DMTS_PATH = './mts' | ||
|
||
export const DCTS_PATH = './cts' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to delete this file
tsconfig.json
Outdated
@@ -1,17 +1,21 @@ | |||
{ | |||
"compilerOptions": { | |||
"module": "NodeNext", | |||
"module": "Node16", | |||
"target": "ESNext", | |||
"moduleResolution": "NodeNext", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to make this Node16
tsconfig.json
Outdated
"src/BuildService.ts", | ||
"src/ConfigService.ts", | ||
"src/ExportsService.ts" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did I add these?
c1a07be
to
c05d427
Compare
}, | ||
}, | ||
'./foo.cjs', | ||
'./foo.js', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also fix these tests (and add tests to lint-staged / CI)
src/TypesService.ts
Outdated
} | ||
|
||
const rewriteMapFileExtension: Endomorphism<string> = fileText => | ||
fileText.replace(/\.d\.ts/g, '.d.mts') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need a cts version of this
case 'module': | ||
return { '.d.ts': emitDts } | ||
case 'commonjs': | ||
return { '.d.cts': emitDcts } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about these...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
they're good
case 'module': | ||
return { '.d.mts': emitDmts } | ||
case 'commonjs': | ||
return { '.d.ts': emitDts } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...
87a0ea1
to
e0abf53
Compare
No description provided.