Skip to content

[DRAFT] Add exports to make package usable as a library#194

Closed
marceljuenemann wants to merge 1 commit intodfinity:mainfrom
marceljuenemann:build
Closed

[DRAFT] Add exports to make package usable as a library#194
marceljuenemann wants to merge 1 commit intodfinity:mainfrom
marceljuenemann:build

Conversation

@marceljuenemann
Copy link
Copy Markdown

Currently there are no .d.ts files in the published package. This means you can't use this package as a library.

You might want to have more exports like ecdsa/secp256k1, I just added a couple to prove the concept, let me know if you want me to add all.

@marceljuenemann marceljuenemann requested a review from a team as a code owner January 31, 2026 18:02
Copilot AI review requested due to automatic review settings January 31, 2026 18:02
@marceljuenemann marceljuenemann requested a review from a team as a code owner January 31, 2026 18:02
@github-actions
Copy link
Copy Markdown

Thank you for contributing! Unfortunately this repository does not accept external contributions yet.

We are working on enabling this by aligning our internal processes and our CI setup to handle external contributions. However this will take some time to set up so in the meantime we unfortunately have to close this Pull Request.

We hope you understand and will come back once we accept external PRs.

— The DFINITY Foundation

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds TypeScript declaration files (.d.ts) to enable the package to be used as a library with proper type support. Currently, the published package lacks these declaration files, making it difficult to use with TypeScript projects.

Changes:

  • Enabled TypeScript declaration file generation in tsconfig.json
  • Added package.json "types" field pointing to the main declaration file
  • Added package.json "exports" field with subpath exports for main entry point and submodules (ecdsa, schnorr, signer)

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated 2 comments.

File Description
tsconfig.json Enables generation of TypeScript declaration files and source maps
package.json Adds types field and exports configuration for library usage with proper TypeScript support

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread package.json
@@ -3,6 +3,25 @@
"version": "1.0.1",
"type": "module",
"main": "index.js",
Copy link

Copilot AI Jan 31, 2026

Choose a reason for hiding this comment

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

The "main" field should be updated to point to "dist/index.js" instead of "index.js" to be consistent with the new exports field and the actual build output directory. Without this change, older package managers that don't support the "exports" field will look for a file at the root that doesn't exist.

Suggested change
"main": "index.js",
"main": "dist/index.js",

Copilot uses AI. Check for mistakes.
Comment thread package.json
"types": "./dist/signer/index.d.ts",
"import": "./dist/signer/index.js"
}
},
Copy link

Copilot AI Jan 31, 2026

Choose a reason for hiding this comment

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

The package.json is missing a "files" field to specify which files should be included in the published package. Since "dist/" is listed in .gitignore and there's no .npmignore file, npm will exclude the dist directory from the published package by default. This would make the package unusable. Add a "files" field that includes "dist" to ensure the compiled code and type definitions are published.

Suggested change
},
},
"files": [
"dist"
],

Copilot uses AI. Check for mistakes.
@randombit
Copy link
Copy Markdown
Contributor

@marceljuenemann Thanks for the patch, I'm working on getting things set up on our side such that we can accept contributions to this repository.

@AntonioVentilii
Copy link
Copy Markdown
Collaborator

AntonioVentilii commented Feb 11, 2026

@marceljuenemann thank you for that! It was bothering me for a while too (see snippet)... While we wait, I opened this using your code:

Please let me know if you have comments/additions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants