Commit 84fd6dc08c changed the import
from "rust-module" to "rust-module.cjs", which unfortunately broke
typedoc's visibility into the types. Revert back to using the import
without extension. With the given tsconfig files that works now and
typedoc publishes the docs for the re-exported types again.
Fixes#4153
- Instead of building index.js with esbuild and generating types with
tsc, use tsc to build index.js and index.d.ts.
- Use ts-node instead of swc for typescript based tests, as that
works with es modules.
- Remove "syntax_check" target from package.json as that's now
implied with "compile".
- Sadly this requires one "as any" cast as tsc somehow fails to
determine the right type info for node-fetch.
Unfortunately index.js can't be an ES module without breaking
compatiblity. It would imply that the Node.js port can't be used with
require() anymore. So even thought that would simplify things further,
it's not part of this PR.
* Added more documentation to the node port
* Update api/node/index.ts
Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev>
* Update api/node/index.ts
Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev>
* Update api/node/index.ts
Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev>
* code review feedback
---------
Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev>
- Make the walkthrough actually work
- Fix incorrect file paths
- Link between loadFile and the component instantiation section, as well as ComponentHandle
- Declare that loadFile may throw an exception
napi and esbuild are not just dev dependencies. Since we distribute source packages, they are in fact
run-time dependencies, as
"npm install" will run "npm run build" and that
requires those two.
The rules require comparing if tiles are equal, which used to be a string comparison as we just
converted the image to a path. With ImageData this doesn't
work anymore, so this patch proposes an optional path
property that makes the code also a tad bit more readable.
Share tsconfig.json so that ava runs the typescript compiler also on the tests.
Similary, the syntax check now also covers the tests.
Sadly, the exception that the Slint compiler throws is not type declared,
so we have to use any.
Similarly, the object share returned by loadFile() is unknown
in terms of properties, callbacks, etc.
napi would assert when we extract an object from a reference twice:
```
thread '<unnamed>' panicked at /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/napi-2.13.3/src/js_values/value_ref.rs:59:5:
assertion `left == right` failed: Ref count is not equal to 0 while dropping Ref, potential memory leak
left: 1
right: 0
stack backtrace:
```
Fix this by avoiding the use of Ref.
... and use it to hide internal functionality so users will notice that
they depend on fucntionality we do not provide any guarantees for.
Make the lsp and viewer request the internal feature when building the
interpreter.