Skip to content

Rewrite in TypeScript; update build process - #6

Merged
nwalters512 merged 6 commits into
mainfrom
typescript-rewrite
Nov 14, 2024
Merged

Rewrite in TypeScript; update build process#6
nwalters512 merged 6 commits into
mainfrom
typescript-rewrite

Conversation

@nwalters512

Copy link
Copy Markdown
Contributor

This PR rewrites lib/ to use native TypeScript instead of JSDoc comments. It also switches to building dist/{cjs,esm} with tsc directly so that the types can be correctly generated (see #2). The UMD builds are still done with Rollup since tsc can't natively produce a UMD bundle.

Closes #2.

Comment thread package.json
"jest": "^29.7.0",
"rollup": "^4.26.0",
"typescript": "^5.6.3"
"typescript": "^5.7.1-rc"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The 5.7 release candidate was necessary to gain support for rewriteRelativeImportExtensions, see https://devblogs.microsoft.com/typescript/announcing-typescript-5-7-rc/

Comment thread package.json
"url": "https://github.com/orchidjs/unicode-variants.git"
},
"type": "module",
"main": "dist/cjs/index.js",

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Change: main now points to dist/cjs instead of dist/umd. The UMD build should be reserved for browser use.

Comment thread bench.mjs
* > npm run bench
*/
import * as D from './lib/index.mjs';
import * as D from './dist/esm/index.js';

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This now requires one to run npm run build first. I couldn't see a convenient way to have this file either be or directly import TypeScript.

@nwalters512
nwalters512 merged commit 9c0dc15 into main Nov 14, 2024
@nwalters512
nwalters512 deleted the typescript-rewrite branch November 14, 2024 21:55
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.

Broken types when used with ESM + node16 moduleResolution

1 participant