nodejs / api-docs-tooling

Node.js's tooling for API generation
https://nodejs.org/api
MIT License
5 stars 5 forks source link

Add `react-web` generator #7

Open ovflowd opened 5 months ago

ovflowd commented 5 months ago

The react-web generator depends upon the https://github.com/nodejs/api-docs-tooling/issues/6 generator.

The react-web parser receives a JSX Node. Then it builds into a JavaScript bundle by using esbuild JavaScript APIs and finally returns the output from the ESbuild pipeline into VFiles (?) (This is an open topic, as the build will probably return a bunch of different outputs which are probably the numerous chunks if we use chunk loading of the build);

The react-web generator aims to receive a top-level JSX element, wrap it with ReactDOM, build it as an ES2017 (or newer) target output, and return the parsed/built content to be stored in files.

Also, the react-web will receive the final contents of the generated pipeline. The output is pretty much JavaScript, which can then be used/added elsewhere.

I'm not sure if we should use esbuild or how to deal with the Web part of the bundling/generation of the API docs because:

I'd like input on this cc @nodejs/web-infra as this is the most complex part for outputting to Web