-
Notifications
You must be signed in to change notification settings - Fork 63
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
Updating build process to create .d.ts
declaration files
#256
Conversation
xtask/src/build/jco.rs
Outdated
//See: https://github.com/microsoft/TypeScript/issues/40594 | ||
cmd!( | ||
sh, | ||
"sed -i'' -e 's/tools as \"local:wasm-tools\\/tools\"//g' ./obj/wasm-tools.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.
Rather than doing this via replacement (since if jco has this issue itself then other libraries built with jco will too), perhaps we should instead make it a transpile option to omit these names?
Perhaps something like --ts-compat
or --no-namespaced-exports
. Would you be interested in working on a patch along those lines here?
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.
Yep happy to take a look at that (and fix this windows build issue). Will probably take me a few more days or through the weekend, but any pointers to that section of the code (and potentially how cli options flow from the js to the rust bits) would be appreciated
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.
Sure, the exports are output by the "esm bindgen" render routine in https://github.com/bytecodealliance/jco/blob/main/crates/js-component-bindgen/src/esm_bindgen.rs#L184.
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.
Alright updates are made and the --no-namespaced-exports
option has been added
Also adding a test for the `--no-namespaced-exports` option
316a45d
to
60e5e84
Compare
And other changes to make the build work on Windows
Great work, thanks for adding this. |
Updating build process to create
.d.ts
declaration files sojco
is usable as a library in a typescript project.The changes to enable this:
tsconfig.json
to generate ts types from the JSDoc comments. See the ts docs for more info about the configuration.package.json
build
script to runtsc
.gitignore
to ignore the new.d.ts
and.d.ts.map
files which are generated in thesrc/
directory.--no-namespaced-exports
tojco
to prevent generating exports liketest as "test:flavorful/test"
which are not currently compatible with typescript. See Support “Arbitrary module namespace identifier names” microsoft/TypeScript#40594Resolves #168.
Resolves #253