google / playground-elements

Serverless coding environments for the web.
BSD 3-Clause "New" or "Revised" License
549 stars 55 forks source link

Simpler build #392

Open justinfagnani opened 9 months ago

justinfagnani commented 9 months ago

This changes the build system so that it no longer based on a stream of heterogenous build result objects. Instead a build is an async function that returns the built files and syntactic diagnostics. I think this makes it easier to work with the flow of the build as the types of build outputs are separated (files, diagnostics, and semantic diagnostics), it's easier to tell when a build is done, and it's easier to get important files from the inputs, like the package.json (we no longer have to pass a getPackageJson() function, but can pass the package.json data if it's available).

This change also sets the stage for further changes that I think will make the build easier to work with. It lifts up finding and parsing the package.json file to the top level of the build, which makes adding any diagnostics more straightforward. A similar thing could be done for computing the NodeModulesDirectory, which could be done early and used to resolve types and bare module specifiers (they each use a different process either now).

Part of #391