Skip to content
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

Merged
merged 6 commits into from
Feb 12, 2024
Merged

Conversation

jacob-alford
Copy link
Collaborator

No description provided.

node.modifiers,
node.importClause,
ts.factory.createStringLiteral(
'./' + path.join(dirname, remapExtension(fileNameWithExtension)),
Copy link
Collaborator Author

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'
Copy link
Collaborator Author

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",
Copy link
Collaborator Author

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
Comment on lines 16 to 18
"src/BuildService.ts",
"src/ConfigService.ts",
"src/ExportsService.ts"
Copy link
Collaborator Author

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?

},
},
'./foo.cjs',
'./foo.js',
Copy link
Collaborator Author

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)

}

const rewriteMapFileExtension: Endomorphism<string> = fileText =>
fileText.replace(/\.d\.ts/g, '.d.mts')
Copy link
Collaborator Author

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 }
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about these...

Copy link
Collaborator Author

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 }
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...

@jacob-alford jacob-alford merged commit 7b39060 into main Feb 12, 2024
3 checks passed
@jacob-alford jacob-alford deleted the ja/new-config branch February 12, 2024 23:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant