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

_dist in npm tarball is missing entries when there are .js + .d.ts files #1018

Open
0x009922 opened this issue Mar 13, 2025 · 1 comment
Open

Comments

@0x009922
Copy link

0x009922 commented Mar 13, 2025

See here: https://jsr.io/@iroha/core/0.2.1/crypto
There is wasm.js and wasm directory. wasm.js has // @ts-self-types="./wasm/iroha_crypto_wasm.d.ts".
See my comment below. Refer to https://jsr.io/@iroha/core/0.0.13/crypto

When installing this package in an NPM project and trying to typecheck with tsc:

node_modules/.pnpm/@[email protected]/node_modules/@jsr/iroha__core/_dist/crypto/mod.d.ts:56:23 - error TS2307: Cannot find module './wasm/iroha_crypto_wasm.d.ts' or its corresponding type declarations.

56 import * as wasm from "./wasm/iroha_crypto_wasm.d.ts";
                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/.pnpm/@[email protected]/node_modules/@jsr/iroha__core/_dist/crypto/util.d.ts:1:41 - error TS2307: Cannot find module './wasm/iroha_crypto_wasm.d.ts' or its corresponding type declarations.

1 import type { Bytes as WasmBytes } from "./wasm/iroha_crypto_wasm.d.ts";
                                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

And indeed, when I look into the _dist directory, I don't see the wasm/iroha_crypto_wasm.d.ts file:

node_modules/@iroha/core/_dist/crypto
├── mod.d.ts
├── mod.d.ts.map
├── util.d.ts
└── util.d.ts.map

For reference, here is the non-.d.ts layer of the tarball:

node_modules/@iroha/core/crypto
├── mod.js
├── mod.js.map
├── mod.ts
├── util.js
├── util.js.map
├── util.ts
└── wasm
    ├── iroha_crypto_wasm.d.ts
    ├── iroha_crypto_wasm.internal.js
    └── iroha_crypto_wasm.js
@github-project-automation github-project-automation bot moved this to Needs Triage in JSR Mar 13, 2025
@0x009922
Copy link
Author

upd: while experimenting with using inlined-wasm approach, I found that it is not related to @ts-self-types. See here: https://jsr.io/@iroha/core/0.0.13/crypto. There is wasm dir with .js and according .d.ts file. It is absent in the _dist dir.

@0x009922 0x009922 changed the title _dist in npm tarball is missing entries when using @ts-self-types="..." _dist in npm tarball is missing entries when there are .js + .d.ts files Mar 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Needs Triage
Development

No branches or pull requests

1 participant