Closed maraf closed 8 months ago
A couple general questions, to start things off.
1) What is the general code flow (dependency graph) of the JS code? For example, here's the detailed graph for the current runtime:
Emscripten-generated code (host)
[Emscripten ABI]
Native entry point from bootstrapper.cpp
<application code>
[Emscripten ABI]
pal_random.js; --js-library
emscripten_get_callstack; Emscripten-provided system function
This needn't be as detailed, I am just looking for what the major components are, what their responsibilities are, and where they live (/how the functions they consist of are called).
2) What are the components in the build process of JS components? What is the build flow? How do you debug that build? Any common gotchas/known issues w.r.t. local development? We spend a very good chunk of our time fixing or altering the build in one way or another on this branch, so it's important to know how it works.
pal_random.js; --js-library
this doesn't exist anymore. It's moved into src\mono\wasm\runtime\crypto.ts
this doesn't exist anymore. It's moved into src\mono\wasm\runtime\crypto.ts
Yes; we restored it in this branch for the time being.
Add sample running main with dotnet.js
This should be added as a smoke test under src/tests/nativeaot/SmokeTests/HelloWasm
.
FYI https://github.com/dotnet/runtime/pull/95775 we are refactoring those proj quite often. I'm not sure that optimizing it here makes ton of sense from merging perspective.
I'm not sure that optimizing it here makes ton of sense from merging perspective.
Since we decided to keep a copy (of the compiler options-related MSBuild things), there is no conflict risk. There is still the problem of keeping the copy up-to-date, but it's the same whether we simplify it or not. And a number of these options have to be rewritten in any case.
1) What is the general code flow (dependency graph) of the JS code?
In browser case and the new smoke test concretely, it is
main.js
script executes
dotnet.js
which is public API for .NETdotnet.create
dotnet.native.js
and dotnet.runtime.js
)dotnet.native.wasm
)runMain
callMain
executes2) What are the components in the build process of JS components? What is the build flow? How do you debug that build? Any common gotchas/known issues w.r.t. local development? We spend a very good chunk of our time fixing or altering the build in one way or another on this branch, so it's important to know how it works.
Typescript is built using rollup. In debug build we get unminified version. In release they are minified. In both cases there are source maps pointing to original typescript definitions.
Does it answer the questions?
Does it answer the questions?
Yes, thank you.
Very interesting, great work. Is it too early to add anything to the docs, like adding this to your project file if you want to use it
<DotNetJsApi>true</DotNetJsApi>
Are people going to think that [JSImport]/[JSExport]
are supported with this change in NativeAOT-LLVM ?
Are people going to think that
[JSImport]/[JSExport]
are supported with this change in NativeAOT-LLVM ?
JS interop is tracked here https://github.com/dotnet/runtimelab/issues/2434. I'll make it work as separated PRs. All that's working now is (synchronously) calling Main
Very interesting, great work. Is it too early to add anything to the docs, like adding this to your project file if you want to use it
I would wait a bit until there are more features working
dotnet.js
anddotnet.native.js
built from typescriptdotnet.es6.pre.js
,dotnet.es6.lib.js
anddotnet.es6.extpost.js
emscripten partials & librarywasm.proj
and build it as part of naot-llvm buildDotNetJsApi=true
is set in users appNativeAOT
const for now. In follow ups we might come with a way to "override" functions different for NativeAOTcallMain
at the moment