toolbox · language
JavaScript
The language behind the shared builder, the games site and Astro's pages.
What it is
JavaScript is the language of the browser and, through Node.js, of our build scripts. It is dynamically typed and runs everywhere without an install step.
How it works
- Values, functions and objects;
async/awaitfor anything that waits on files or the network. - Modules split code into files:
requirein CommonJS,import/exportin ESM. - In the browser it talks to the DOM; in Node it talks to the filesystem and processes.
In this project
shared/build.jsreads site folders, fills templates and writesdist/.- The games site is plain vanilla JavaScript with no framework.
- Astro components contain JavaScript between the frontmatter fences, and the interactive parts are ordinary browser JavaScript.
Gotchas
"type": "module"inpackage.jsonchanges.jsfiles from CommonJS to ESM for the whole folder.- Browser JavaScript has no filesystem access. Anything that reads files is build-time code.
- A blank value is not a success: our agents and scripts treat an empty answer as a failure.