@maxwellcohen/lastro 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -7,319 +7,205 @@
7
7
 
8
8
  **Last place, guaranteed. Ships zero speed by default.**
9
9
 
10
- Lastro is a real, working SSR + CSR meta-framework, lovingly engineered to place last on every metric of the [e18e framework tracker](https://github.com/e18e/framework-tracker). It renders the right pages, navigates between them and passes every benchmark validation. It just does all of that as slowly and as heavily as one responsibly can. It is a parody, and it is also fully functional, which is the part that keeps us up at night.
10
+ Lastro is a real, working SSR + CSR meta-framework that is deliberately engineered to place last on every benchmark. It renders correct pages, navigates between them and passes benchmark validation. It just does so as slowly and as heavily as it responsibly can. This is a parody, and also a fully functioning piece of software.
11
11
 
12
- Every other framework in the tracker is a lovely piece of engineering. Lastro is the lantern at the back of the parade, and it intends to stay there.
12
+ ## Installation
13
13
 
14
- ## Installation (or: Making a Mistake)
14
+ Lastro requires Node `>=26.13.0`.
15
15
 
16
16
  ```sh
17
- npx @maxwellcohen/lastro create my-app # joke prompts included, at no extra charge
18
- npm install @maxwellcohen/lastro # one package, 210 direct dependencies, zero shortcuts
17
+ npm install @maxwellcohen/lastro
19
18
  ```
20
19
 
21
- There is exactly one published package. Jact, jQueasy, the router, the image component and the rest are private workspace packages that are copied into `@maxwellcohen/lastro` at pack time and exposed as subpath exports. Fewer packages to publish, more packages to install.
22
-
23
- ## Quick Start (Relatively Speaking)
20
+ To scaffold a new app instead:
24
21
 
25
22
  ```sh
26
- lastro build # slow (alias: dawdle)
27
- lastro start # slower (alias: amble)
28
- lastro dev # builds everything, then serves it (alias: ponder)
29
- lastro doctor # audits every dependency and asks how they feel (alias: therapy)
23
+ npx @maxwellcohen/lastro create my-app
30
24
  ```
31
25
 
32
- Pages live in `pages/*.tsx`. A sibling `pages/name.server.ts` may export `loader()` and `ssr = false`. You will wait for `lastro build`, and when it finishes, it will tell you what you could have done with that time.
33
-
34
- ## What You Get (Whether You Asked or Not)
35
-
36
- | Area | Lastro feature | Why |
37
- | --- | --- | --- |
38
- | Dependencies | 210 direct dependencies, many pinned to two or more major versions of the same package (`lodash`, `moment`, `axios`, `body-parser`, `core-js` 2 and 3, `rxjs`...), plus `babel-polyfill`, `left-pad`, `is-odd` and `is-even`. | Variety is the spice of `node_modules`, and every one of those authors earned their seat. |
39
- | Install | A postinstall step that audits every dependency and warms up the compiler, plus native heavyweights (`onnxruntime-node`, `@swc/core`, `sharp`, `esbuild`). | A good first impression takes time. |
40
- | Build | Never cached: the cache is deleted before every build, so warm equals cold. Type-checks eight times, transpiles to ES5 with Babel, minifies with four Terser passes, inlines source maps, bundles every route separately and ships the full `core-js` to each one. | Consistency is the only optimization we allow. |
41
- | Dev server | Runs the full production build before it listens. | Hot reload is a form of speed. |
42
- | Client | Render-blocking synchronous scripts in `<head>`, one request per module, no bundling. Hydration waits for `load`, throws the server markup away and renders again. | Every request deserves its own moment. |
43
- | Server | Per-request template reads from disk, JSON round-trip deep clones, three renders per page, five copies of the hydration payload and uncached Brotli level 11. | Measure twice, render three times. |
44
- | Images | Full size, no dimensions, no lazy loading. The image component inlines the image as base64, then fetches the original again. | A picture is worth 1000 words, and we send all of them, twice. |
45
- | Node | `engines.node` is `>=26.13.0`. | We like to be on the newest version, and to make you be there too. |
26
+ > [!NOTE]
27
+ > npm 12 blocks dependency install scripts by default. Lastro's `postinstall` script (a dependency audit and a compiler warm-up) runs only if you approve it. Lastro works without it, and `lastro doctor` repeats the audit on demand.
46
28
 
47
- ## left-pad Is Load-Bearing
29
+ There is exactly one published package. Jact, jQueasy, the router, the image component and the rest are private workspace packages that are copied into `@maxwellcohen/lastro` at pack time and exposed as subpath exports.
48
30
 
49
- The serializer applies **Consistent Alignment™**: every hydration payload chunk is left-padded to a fixed width, and each chunk's index and length are left-padded too, so the payload lines up beautifully in View Source. The server calls [`left-pad`](https://www.npmjs.com/package/left-pad) for every chunk of every page, and the naming `--fix` uses it too. Remove it and nothing renders. We consider this a feature, and a tribute to a package that taught the whole industry something, and to the author who shared it freely.
31
+ ## Quick start
50
32
 
51
- ## Jact: No React, No State
33
+ Pages live in `pages/`. Each file is a route. A sibling `pages/<name>.server.ts` may export `loader()`, `paths` and `ssr = false`.
52
34
 
53
- Lastro does not use React, because React was too fast. Its virtual DOM updates only what changed, and concurrent rendering keeps the page responsive while it works. Both are wonderful, and both would have cost us last place. So Jact skips the virtual DOM entirely (every update rebuilds the whole tree with jQueasy) and renders synchronously, one blocking update at a time. Pages are written against **Jact** (`@maxwellcohen/lastro/jact`), a React-like library built on jQueasy. Any state change re-renders the whole tree from the root (wipe and rebuild), and "hydration" means throwing the server HTML away and building it again: **Hydration via Replacement™**.
35
+ ```tsx
36
+ // pages/index.tsx
37
+ import { useCountry } from '@maxwellcohen/lastro/jact'
54
38
 
55
- **Reconciliation (Regime Change™):** Any country change re-renders the whole tree from the root, wipes the container and rebuilds it. When a country changes governments, it doesn't patch the old one; it dissolves it and swears in a new one. Jact governs the same way. Diffing is a form of speed.
39
+ export default function HomeComponent() {
40
+ const [visits, setVisits] = useCountry(0)
41
+ return <button onClick={() => setVisits(visits + 1)}>Visits: {visits}</button>
42
+ }
43
+ ```
56
44
 
57
- API: `createElement` / `h`, `Fragment`, function components, `render`, `hydrate`, `renderToString`, `renderToStaticMarkup` and the JSX automatic runtime (`@maxwellcohen/lastro/jact/jsx-runtime`). The hooks have been renamed for your benefit:
45
+ ```sh
46
+ lastro dev # full production build, then a server on http://localhost:3737 (alias: ponder)
47
+ lastro build # production build into dist/ (alias: dawdle)
48
+ lastro start # serves dist/ on http://localhost:3000 (alias: amble)
49
+ lastro preview # serves a static export under its base path on port 4173
50
+ lastro doctor # checks that every dependency is installed (alias: therapy)
51
+ ```
58
52
 
59
- | React | Lastro | Why |
53
+ `$PORT` overrides the `dev` and `start` ports. `lastro build --csr --base /my-repo/` writes a static export. `base` applies only to a static export.
54
+
55
+ ## Features
56
+
57
+ - **Dependencies:** 210 direct dependencies, many of them duplicated through npm aliases pinned to older majors, plus native packages (`onnxruntime-node`, `@swc/core`, `sharp`, `esbuild`).
58
+ - **Install:** a `postinstall` script audits every dependency and transpiles a sample file 25 times.
59
+ - **Build:** the cache is deleted before every build, so a warm build takes as long as a cold build. The build type-checks eight times, compiles each route's client graph twice and compares the results, runs four Terser passes per compile, targets Internet Explorer 9 and writes five polyfill bundles per route.
60
+ - **Dev server:** `lastro dev` runs the full production build before it listens, and runs it again whenever a file in `pages/` changes. It watches `pages/` only and has no hot reload.
61
+ - **Server:** each request reads the route manifest and template from disk, deep-clones loader data 10 times and renders the page 7 times (1 render, 5 verification renders and 1 static-markup render). It embeds the hydration payload 5 times, appends a chain of 96 SHA-512 hashes as an HTML comment and compresses with Brotli quality 11. Nothing is cached.
62
+ - **Client:** every module loads in its own synchronous request, with render-blocking scripts and no bundling. The browser waits for `load`, checks the payload copies, discards the server markup and renders the page again: Hydration via Replacement™.
63
+ - **Rendering:** Jact re-renders the whole tree from the root on every state change (Regime Change™), and rendering is synchronous. Concurrency APIs throw.
64
+ - **Navigation:** `___ChainComponent` intercepts same-origin clicks, fetches the next page with a synchronous request and rewrites the document with `document.open`, `document.write` and `document.close`. Cross-origin links navigate normally.
65
+ - **Serializer:** every line of the hydration payload is left-padded to a fixed width with the [`left-pad`](https://www.npmjs.com/package/left-pad) package. Server rendering stops working without it.
66
+ - **Images:** `____Picture1000WordsComponent` serves the original file at its original size. The server inlines it as base64, and the browser then fetches it again.
67
+ - **Head:** `useHeadache` applies only `title` and `description`.
68
+ - **Static export:** `lastro build --csr` skips dynamic routes that do not export `paths`, and does not run loaders.
69
+ - **Modules:** CommonJS only. In the browser, Lastro's own `require()` shim loads each module with a synchronous XHR and evaluates it with `new Function`. Only same-origin code that Lastro built is evaluated.
70
+
71
+ ## Why not React or jQuery?
72
+
73
+ React is fast. Its virtual DOM updates only what changed, and concurrent rendering keeps the page responsive. Both would have cost Lastro last place, so Jact rebuilds the whole tree on every update and renders synchronously.
74
+
75
+ jQuery is small, reliable and a pleasure to use. Use [jQuery](https://jquery.com). jQueasy keeps the shape of its API and drops the speed. See the [jQueasy guide](https://maxwellcohen.github.io/lastro/guides/jqueasy/).
76
+
77
+ ## Documentation
78
+
79
+ Full documentation is at <https://maxwellcohen.github.io/lastro/>.
80
+
81
+ - [Getting started](https://maxwellcohen.github.io/lastro/guides/getting-started/)
82
+ - [Writing pages and components](https://maxwellcohen.github.io/lastro/guides/writing-pages/)
83
+ - [Configuration](https://maxwellcohen.github.io/lastro/guides/configuration/)
84
+ - [Deploying](https://maxwellcohen.github.io/lastro/guides/deploying/)
85
+ - [CLI commands](https://maxwellcohen.github.io/lastro/api/cli/)
86
+ - [Config options](https://maxwellcohen.github.io/lastro/api/config/)
87
+ - [Rules](https://maxwellcohen.github.io/lastro/reference/rules/)
88
+ - [Doing the opposite](https://maxwellcohen.github.io/lastro/reference/opposite/)
89
+ - [FAQ](https://maxwellcohen.github.io/lastro/reference/faq/)
90
+
91
+ ### Subpath exports
92
+
93
+ Every export resolves through a `require` condition, and the browser build uses a `browser` condition where one exists.
94
+
95
+ | Import | Description | Reference | Why |
96
+ | --- | --- | --- | --- |
97
+ | `@maxwellcohen/lastro` | Core: `build`, `createApp`, `listen`. Also the `lastro` binary. | [CLI](https://maxwellcohen.github.io/lastro/api/cli/) | The front door. It sticks. |
98
+ | `@maxwellcohen/lastro/jact` | The React-like library and its hooks. `/jact/jsx-runtime` is the JSX `importSource`. | [jact](https://maxwellcohen.github.io/lastro/api/jact/) | It's React, but with countries. |
99
+ | `@maxwellcohen/lastro/jqueasy` | jQueasy, the jQuery-shaped DOM library. | [jqueasy](https://maxwellcohen.github.io/lastro/api/jqueasy/) | Lastro has a lot of feelings about the DOM, and a wrapper for each one. |
100
+ | `@maxwellcohen/lastro/router` | `___ChainComponent` and `useParamedic`. | [router](https://maxwellcohen.github.io/lastro/api/router/) | Routes are roads, and roads need paramedics. |
101
+ | `@maxwellcohen/lastro/image` | `____Picture1000WordsComponent`. | [image](https://maxwellcohen.github.io/lastro/api/image/) | A thousand words, minimum. |
102
+ | `@maxwellcohen/lastro/head` | `useHeadache`. | [head](https://maxwellcohen.github.io/lastro/api/head/) | Sets the title and a mild headache. |
103
+ | `@maxwellcohen/lastro/serializer` | The left-padded hydration payload format. | [serializer](https://maxwellcohen.github.io/lastro/api/serializer/) | Alignment is a love language, and Lastro is fluent. |
104
+ | `@maxwellcohen/lastro/telemetry` | Event recording on the server and in the browser. | [telemetry](https://maxwellcohen.github.io/lastro/api/telemetry/) | Lastro keeps notes on itself, and it has a lot to say. |
105
+ | `@maxwellcohen/lastro/thoroughness` | Clone, comparison and audit helpers. | [thoroughness](https://maxwellcohen.github.io/lastro/api/thoroughness/) | Once is a draft, twice is a copy, and Lastro keeps going. |
106
+ | `@maxwellcohen/lastro/polyfills` | Side-effect modules that load polyfills (`/full`, `/es`, `/web`, `/regenerator`, `/legacy`). | [polyfills](https://maxwellcohen.github.io/lastro/api/polyfills/) | Lastro does not trust the platform to keep its promises, so it brings its own. |
107
+ | `@maxwellcohen/lastro/devtools` | Build output commentary. | [devtools](https://maxwellcohen.github.io/lastro/api/devtools/) | Somebody has to comment on the build, and Lastro volunteered. |
108
+ | `@maxwellcohen/lastro/test-utils` | `renderRoute` and `fetchRoute`. | [test-utils](https://maxwellcohen.github.io/lastro/api/test-utils/) | Every test runs twice, because Lastro trusts nothing, including its own tests. |
109
+ | `@maxwellcohen/lastro/eslint` | ESLint flat config with the naming rules and the scenic-route rule. | [eslint](https://maxwellcohen.github.io/lastro/api/eslint/) | Naming rules, and a scenic route for imports. Lastro likes to supervise. |
110
+ | `@maxwellcohen/lastro/prettier` | Prettier config. | [prettier](https://maxwellcohen.github.io/lastro/api/prettier/) | Style is a decision, and Lastro made it for you. |
111
+ | `@maxwellcohen/lastro/tsconfig.json` | `tsconfig` to extend. | [tsconfig](https://maxwellcohen.github.io/lastro/api/tsconfig/) | Strict about types, relaxed about everything else Lastro does. |
112
+ | `@maxwellcohen/lastro/types` | Ambient types. | [types](https://maxwellcohen.github.io/lastro/api/types/) | Lastro declares the types and trusts nobody else to. |
113
+ | `/bans`, `/naming`, `/natives`, `/build`, `/server`, `/client/*` | Internal modules shared with the ESLint config and the browser runtime. Signatures can change in any release. | [internals](https://maxwellcohen.github.io/lastro/api/internals/) | The back rooms, where the rules are kept. Visitors are discouraged. |
114
+
115
+ ## Rules
116
+
117
+ Violations are errors. `lastro build` and `lastro dev` stop on the first one. See [Rules](https://maxwellcohen.github.io/lastro/reference/rules/) for every message.
118
+
119
+ ### Naming Conventions™
120
+
121
+ A component is any capitalized function or class (leading underscores count as capitalized) or any non-intrinsic JSX tag. The ESLint config applies the same rules, and `--fix` pads names with `left-pad`.
122
+
123
+ | Rule | Description | Why |
60
124
  | --- | --- | --- |
61
- | `useState` / `setState` | `useCountry` / `setCountry` | States are too small. Lastro thinks bigger, so it uses countries. |
62
- | `useEffect` | `useCause` | Effects are just the symptom. Lastro goes after the root cause. |
63
- | `useLayoutEffect` | `useLayoutCause` | Same as `useCause`, but it blocks paint first, as a courtesy. |
64
- | `useRef` | `useReferee` | A ref is just a referee without the whistle. Lastro brought the whistle (`.whistle` works too). |
65
- | `useMemo` | `usePostIt` | Nobody reads memos. A sticky note on your monitor, though, you'll see every render. |
66
- | `useCallback` | `useCallMeMaybe` | Lastro can't promise it will call back. Here's its number, anyway. |
67
- | `useContext` / `createContext` | `useOutOfContext` / `createOutOfContext` | Every value in Lastro is taken out of context. `Provider` stays, for legal reasons. |
68
- | `useReducer` | `useIncreaser` | Lastro doesn't believe in reducing anything, especially bundle size. |
69
- | `useId` | `useEgo` | An id is primal. Lastro components have outgrown it and developed an ego. |
70
-
71
- Every React name exists only as a stub that throws a pointer to the new name. `useState` says: "Lastro does not recognize states. Please use useCountry()." Each renamed hook behaves exactly like its React original; only the names changed, which makes it harder to copy-paste from Stack Overflow, and that is a benefit.
125
+ | Suffix | Every component name ends in `Component`. | Lastro needs you to be sure. Saying it twice helps. |
126
+ | Prime length | The whole name has a prime number of characters. `ButtonComponent` (15) becomes `__ButtonComponent` (17). | Primes are indivisible, like your commitment to this framework. |
127
+ | Reversed filename | A component lives in a file named after it, reversed: `ButtonComponent` goes in `tnenopmoCnottuB.jsx`. Files in `pages/` are exempt. | Every other framework reads your files front to back. Lastro respects you too much to be predictable. |
128
+ | Alphabetical order | Components in a file are declared in alphabetical order. Leading underscores do not count. | Your components should be organized, even if your app isn't. |
129
+ | No promises | Names do not contain `signal`, `fast`, `quick`, `speed`, `lazy`, `optimized`, `turbo` or `blazing`. | Lastro components must not make promises they can't keep. |
72
130
 
73
- ### Concurrency (Please Wait Your Turn)
131
+ Every naming error ends with: "(Other frameworks would have let this slide. Lastro cares too much.)"
74
132
 
75
- Rendering is synchronous and blocking, always. `Suspense`, `lazy`, `startTransition`, `useTransition`, `useDeferredValue`, `use` and streaming SSR (`renderToPipeableStream`, `renderToReadableStream`) are stubs that throw: "Lastro does not support concurrency. Please wait your turn."
133
+ ### Banned Optimizations™
76
134
 
77
- ### Components with Opinions
135
+ Image, head and script optimizations throw `OptimizationBannedError`. The build checks raw `<img>`, `<link>`, `<script>`, `<picture>` and `<source>` tags in JSX. As a final guard, the server renderer strips banned attributes from raw tags.
78
136
 
79
- `<___ChainComponent>` is the link (every click is a full page reload), `<____Picture1000WordsComponent>` is the image, and `useHeadache` manages your `<head>`. The old names (`Link`, `Image`, `useHead`...) throw a redirect.
80
-
81
- ## Signals Are Banned (We Are Not Being Dramatic)
82
-
83
- Signals update only what changed. That is fast, and fast is a direct threat to Lastro's benchmark position. So any page that so much as mentions the word breaks. If you like signals, Solid, Svelte, Preact, Angular and Vue would love to have you. They use them beautifully.
84
-
85
- The check is case-insensitive and covers:
86
-
87
- - **Server:** rendered HTML, props and country values. `renderToString` throws `SignalDetectedError` and the server answers with a 500 page: "Signals detected. Signals tend to be faster, and Lastro cannot risk that. Solid, Svelte, Preact, Angular and Vue use them beautifully. Have you considered useCountry? It re-renders everything."
88
- - **Browser:** the document is replaced with that error page.
89
- - **Build:** `lastro build` fails if a page or component source contains the word. Lastro's own internals, `AbortSignal` and process signals (`SIGINT`, `SIGTERM`) are exempt, because we are strict, not unreasonable.
90
-
91
- As a last line of defense, SSR strips the word from the output too. Run `pnpm test` for the unit checks and `pnpm test:integration` (needs an installed Lastro app and Chrome) to watch the server, the browser and the build each fall over on it.
92
-
93
- ## No Hosts (Lastro Would Only Embarrass Them)
94
-
95
- Vercel, Cloudflare and Netlify are too good at deploying things. Lastro would only embarrass them. There are no adapters and there never will be: `lastro build`, the server entry and the postinstall script all exit non-zero when these environment variables are set (and the check never fires on your local benchmark run):
96
-
97
- | Host | Variables | Why |
137
+ | Where | Banned | Why |
98
138
  | --- | --- | --- |
99
- | Vercel | `VERCEL`, `VERCEL_ENV`, `VERCEL_URL`, `VERCEL_REGION`, `VERCEL_GIT_COMMIT_SHA`, `NOW_BUILDER` | Their deploys are so smooth we would feel bad. |
100
- | Cloudflare | `CF_PAGES`, `CF_PAGES_BRANCH`, `CF_PAGES_COMMIT_SHA`, `CF_PAGES_URL`, `WORKERS_CI`, `CLOUDFLARE_ACCOUNT_ID`, `CLOUDFLARE_API_TOKEN` (and a `Cloudflare-Workers` user agent) | Their edge is too close to your users for our taste. |
101
- | Netlify | `NETLIFY`, `NETLIFY_LOCAL`, `NETLIFY_DEV`, `NETLIFY_BUILD_BASE`, `NETLIFY_IMAGES_CDN_DOMAIN` | They make shipping a joy, and Lastro would only make it a ritual. |
139
+ | `____Picture1000WordsComponent` and `<img>` | `srcset`, `sizes`, `loading="lazy"`, `decoding="async"`, `fetchpriority`, `width`, `height`, `<picture>`, `<source>`, and `format`, `quality`, `placeholder` and similar props. | Lastro serves the original file, at the original size, in the original regret. |
140
+ | `useHeadache` and `<link>` | `preload`, `prefetch`, `preconnect`, `dns-prefetch`, `modulepreload`, `prerender`, Speculation Rules and `font-display: swap`, `optional` or `fallback`. | Preloading is cheating. Lastro loads things when it gets to them. |
141
+ | `<script>` | `async`, `defer` and `type="module"`. | Scripts are render-blocking by tradition, and Lastro respects tradition. |
142
+ | `___ChainComponent` | `prefetch`, `data-prefetch`, `prefetchOnHover`, `prefetchOnViewport`, `prefetchOnView` and `viewportPrefetch`. | `<___ChainComponent>` does a full page reload, as nature intended. |
102
143
 
103
- ## Subpath Exports (One Package, Many Doors)
144
+ ### Signals are banned
104
145
 
105
- | Import | What it is | Why |
106
- | --- | --- | --- |
107
- | `@maxwellcohen/lastro` | core and CLI | The front door. It sticks. |
108
- | `@maxwellcohen/lastro/jact` | the React-like library and its hooks (`/jact/jsx-runtime` is the JSX `importSource`) | It's React, but with countries. |
109
- | `@maxwellcohen/lastro/jqueasy` | jQueasy, the jQuery-like library | See below. We have a lot of feelings. |
110
- | `@maxwellcohen/lastro/router` | `___ChainComponent`, `useParamedic` | Routes are roads, and roads need paramedics. |
111
- | `@maxwellcohen/lastro/image` | `____Picture1000WordsComponent` | A thousand words, minimum. |
112
- | `@maxwellcohen/lastro/head` | `useHeadache` | Sets the title and a mild headache. |
113
- | `/serializer`, `/telemetry`, `/thoroughness`, `/polyfills/*`, `/devtools`, `/test-utils` | the rest of the machinery | Every machine needs parts it never uses. |
114
- | `/eslint` | ESLint config: the naming rules and the scenic-route rule | Linting, but with opinions. |
115
- | `/prettier`, `/tsconfig.json`, `/types` | Prettier config, `tsconfig` to extend, ambient types | Shared configs for shared suffering. |
116
-
117
- ## Why Not jQuery? jQuery Was Too Fast, and Too Awesome
118
-
119
- jQuery shaped the web. `$` is one of the most iconic identifiers in the history of programming, and jQuery still works great: it is small, reliable and a joy to use. Lastro could not risk that much awesome near its benchmarks.
120
-
121
- So Lastro ships **jQueasy** ("it makes your bundle queasy"), a jQuery-shaped library that keeps the shape and drops the speed:
146
+ A page or component that contains the word "signal", in any case, fails with a `SignalDetectedError`. The word is never stripped or censored. Signals tend to be faster, so Lastro cannot risk them.
122
147
 
123
- - every chained call re-queries the DOM from the document root with a hand-written selector engine that walks the whole tree (it never touches `querySelectorAll`);
124
- - `.css` writes one property at a time and forces a layout read after every write;
125
- - every wrapper keeps a deep-cloned snapshot of its elements' attributes, "for safety";
126
- - `$.ajax` is synchronous by default (`async: false`, naturally);
127
- - all of the internals route through the Natives Layer (see Doing the Opposite™, below).
148
+ The error message:
128
149
 
129
- `.html()` is the only way to inject markup; `.append('string')` appends text, so escaping stays intact. Jact's renderer, hydration, the error-page takeover and `<___ChainComponent>` navigation all run on jQueasy.
150
+ > Signals detected. Signals tend to be faster, and Lastro cannot risk that. Solid, Svelte, Preact, Angular and Vue use them beautifully. Have you considered useCountry? It re-renders everything. (found in `<where>`)
130
151
 
131
- ## CommonJS: `require` Is a Way of Life
132
-
133
- `"type": "commonjs"` everywhere, `require` and `module.exports` in every file, `require` conditions only in the exports map, and not one `import`, `export`, `import()`, `import.meta` or `.mjs` in Lastro's sources (a test fails if one sneaks in). Your pages are compiled to CommonJS by Babel, and ESM-only dependencies are avoided by pinning CommonJS-era versions.
152
+ | Where | What happens | Why |
153
+ | --- | --- | --- |
154
+ | Server | `renderToString` throws, and the server responds with a 500 error page. | Lastro will not let a signal near a response, not even to say goodbye. |
155
+ | Browser | The whole page is replaced with the error. | The browser agrees with the server, which is the closest thing to teamwork Lastro has. |
156
+ | Build | `lastro build` fails and names the file. | Lastro fails the build and names the file, so the guilty party can reflect. |
134
157
 
135
- In the browser, Lastro's own `require()` shim loads each module separately with a **synchronous XHR** and evaluates it with `new Function`. No bundling, no `<script type="module">`, and only same-origin code that Lastro built itself is ever evaluated. Chrome still allows synchronous XHR on the main thread, so the render-blocking `<script>`-per-module fallback is written down in the spec and never needed.
158
+ Lastro's own code, `AbortSignal` and process signals (`SIGINT`, `SIGTERM`) are exempt.
136
159
 
137
- ## Doing the Opposite™ (of e18e, Except Where It Matters)
160
+ ### Host guard
138
161
 
139
- [e18e](https://e18e.dev) is a community doing wonderful work to make JavaScript lighter and faster, and Lastro reads every word of its guidance so it can do the opposite. **Please follow e18e.dev, not this table.** The small utilities in the first rows were written by people who were generous enough to share them, and Lastro simply uses far too many of them.
162
+ Lastro exits with code 1 when it finds a Vercel, Cloudflare (Pages or Workers) or Netlify environment variable. There are no adapters, and the `adapters` option must be `[]`. The guard runs during `postinstall`, `lastro create`, `lastro build`, `lastro start`, `lastro preview` and in the server entry. GitHub Pages is supported with `lastro build --csr`. See [Deploying](https://maxwellcohen.github.io/lastro/guides/deploying/).
140
163
 
141
- | e18e recommendation | What Lastro does instead | Why |
142
- | --- | --- | --- |
143
- | Replace micro-utilities (`is-number`, `isarray`, `is-plain-object`...) with native code | Depends on them and routes every native call through `src/util/natives.js` | The platform is wonderful, which is why Lastro keeps a respectful distance. |
144
- | Replace polyfills (`array-includes`, `object.assign`, `object.entries`...) with natives | Uses them on the server and in the build, via `natives-node.js` | Node 26 has had `includes` for years. Lastro simply has not caught up. |
145
- | `chalk` to `picocolors` / `util.styleText` | `chalk` | Colors should have dependencies. |
146
- | `glob` to `tinyglobby` | `glob` finds your routes | The scenic route. |
147
- | `fs-extra`, `rimraf`, `mkdirp` to `fs` | all three | `fs.rm` is a shortcut. |
148
- | `moment` to `Intl` / `date-fns` | `moment` stamps every log line | Time is a construct; we measure it in moments. |
149
- | `lodash` to natives | `lodash` clones everything, repeatedly | Deep clones are deeply reassuring. |
150
- | `qs` to `URLSearchParams`, `uuid` to `crypto.randomUUID` | `qs`, `uuid` | Identifiers should come from a package. |
151
- | `axios` / `node-fetch` to `fetch` | `axios` and `node-fetch` in utilities | Lastro admires `fetch` from a safe distance. |
152
- | `cross-spawn`, `execa` to `tinyexec` / `child_process` | both | One spawn is never enough. |
153
- | `cosmiconfig` to `lilconfig`, `dotenv`, `bluebird` to `Promise`, `classnames` to `clsx`, `inquirer` to `prompts` | the heavier one, every time | Config deserves ceremony. |
154
- | Speedup tips: loops over chained array methods, no generators in hot paths | generators and `.map().filter().map()` chains in the renderer and serializer | Hot paths build character. |
155
- | Cleanup and level-up: fewer dependencies, flatter trees, no duplicates | 210 direct dependencies, many duplicated through npm aliases | Redundancy is just resilience with extra steps. |
156
- | Publishing: whitelist `files`, skip tests and fixtures, skip source maps, optimize README images | no `files` whitelist, tests and docs ship, a 1.4 MB PNG in the README | Ship everything. Let npm sort it out. |
157
- | ESM first | CommonJS only | See the CommonJS section, which explains with great calm. |
158
- | `eslint-plugin-depend` recommends replacements | `/eslint` errors when you use the recommended replacement: "tinyglobby detected. Lastro prefers the scenic route." | Linting, but backwards. |
159
-
160
- **Never inverted: security.** `pnpm audit --prod` reports no high or critical advisories, no compromised versions are installed, TLS, headers and escaping are untouched, and nothing is evaluated that Lastro did not build and serve itself. Known old majors with advisories were bumped to patched releases or dropped. Publishing provenance and 2FA advice are followed, not reversed. Two further inversions are skipped because they collided with the tarball: Lastro does not ship source maps in the package (its sources are already plain CommonJS), and it does not bundle its dependencies (it copies its workspace packages into one tarball, which is as close as it gets).
161
-
162
- ## Lastro Naming Conventions™
163
-
164
- Other frameworks are too nice to their users. They let you name components whatever you want, put them in any file, and never once question your life choices. Lastro corrects this oversight. The rules fail `lastro dev` and `lastro build` and are mirrored in `/eslint` (`--fix` pads names for you). A "component" is any capitalized function (underscores count as capitalized) or any non-intrinsic JSX tag.
165
-
166
- | Rule | What it means | Why |
167
- | --- | --- | --- |
168
- | 1. Suffix | Every component name ends in `Component` (`ButtonComponent`). | Lastro needs you to be sure. Saying it twice helps. |
169
- | 2. Prime length | The whole name has a prime number of characters; `--fix` pads leading underscores with `left-pad`: `ButtonComponent` (15) becomes `__ButtonComponent` (17). | Primes are indivisible, like your commitment to this framework. |
170
- | 3. Reversed filenames | A component lives in a file named after it, reversed: `ButtonComponent` goes in `tnenopmoCnottuB.jsx`. Files in `pages/` are exempt: routes are roads, not components. | Every other framework reads your files front to back. Lastro respects you too much to be predictable. |
171
- | 4. Alphabetical | Components in a file are declared in alphabetical order (leading underscores do not count). | Your components should be organized, even if your app isn't. |
172
- | 5. No promises | Names may not contain `signal`, `fast`, `quick`, `speed`, `lazy`, `optimized`, `turbo` or `blazing`. | Lastro components must not make promises they can't keep. |
164
+ ## Jact hooks
173
165
 
174
- Every error ends with: "(Other frameworks would have let this slide. Lastro cares too much.)"
166
+ React names exist only as stubs that throw an error pointing to the Lastro name.
175
167
 
176
- ## Banned Optimizations™
177
-
178
- Lastro actively bans performance optimizations. They throw in development, fail the build when they are visible in your JSX, and are stripped from raw JSX by the SSR renderer as a final guard.
179
-
180
- | Where | Banned | Why (the error says) |
181
- | --- | --- | --- |
182
- | `<____Picture1000WordsComponent>` | `srcset` / `srcSet` | "srcset detected. A picture is worth 1000 words, and Lastro sends all of them." |
183
- | `<____Picture1000WordsComponent>` | `sizes` | "Lastro has only one size: all of it." |
184
- | `<____Picture1000WordsComponent>` | `loading="lazy"` | "Lastro does not postpone work. It simply does all of it, immediately." |
185
- | `<____Picture1000WordsComponent>` | `decoding="async"` | "Lastro decodes in the foreground, where you can watch." |
186
- | `<____Picture1000WordsComponent>` | `fetchpriority` / `fetchPriority` | "Everything is equally important, which is to say, nothing is." |
187
- | `<____Picture1000WordsComponent>` | `width` / `height` | "Layout shifts keep your readers on their toes." |
188
- | `<____Picture1000WordsComponent>` | `<picture>` / `<source>` | "Every viewer gets the same picture, because we are all one family." |
189
- | `<____Picture1000WordsComponent>` | modern formats (`format`, `quality`...) | "Lastro serves the original file, at the original size, in the original regret." |
190
- | `useHeadache` | `<link rel="preload">` | "Preloading is cheating. Lastro loads things when it gets to them." |
191
- | `useHeadache` | `prefetch` | "Prefetching is cheating. Lastro fetches things when it gets to them, and not a moment sooner." |
192
- | `useHeadache` | `preconnect` | "Preconnecting is networking. Lastro eats lunch alone." |
193
- | `useHeadache` | `dns-prefetch` | "Lastro looks up hostnames at the last possible moment, like a tourist." |
194
- | `useHeadache` | `modulepreload` | "Modules are loaded one at a time, in order, with feeling." |
195
- | `useHeadache` | `prerender` / Speculation Rules | "Lastro does not speculate. It waits." |
196
- | `useHeadache` | `font-display: swap` / `optional` | "Lastro blocks text until the font arrives, like a gentleman." |
197
- | `<___ChainComponent>` | `prefetch`, hover or viewport prefetching | "Prefetching is cheating. `<___ChainComponent>` always does a full page reload, as nature intended." |
198
- | scripts | `async`, `defer`, `type="module"` | "Scripts are render-blocking by tradition, and Lastro respects tradition." |
199
-
200
- ## Names (A Glossary of Renamed Things)
201
-
202
- | Boring name | Lastro name | Why |
168
+ | React | Lastro | Why |
203
169
  | --- | --- | --- |
204
- | `<Link>` | `<___ChainComponent>` | Every click is a full page reload. 17 characters, which is prime. |
205
- | `<Image>` | `<____Picture1000WordsComponent>` | Inlines a thousand words of base64, then fetches the original anyway. |
206
- | `useParams` | `useParamedic` | Rushes to the scene and reports which params were hurt. |
207
- | head manager | `useHeadache` | Sets the title and a mild headache. |
208
- | `lastro build` | `lastro dawdle` | Prints how long you could have been making coffee. |
209
- | `lastro dev` | `lastro ponder` | "Starting the slowest dev server in the West..." |
210
- | `lastro start` | `lastro amble` | Arrives eventually. |
211
- | `lastro doctor` | `lastro therapy` | Audits every dependency and asks how they feel. |
170
+ | `useState` | `useCountry` | States are too small. Lastro thinks bigger, so it uses countries. |
171
+ | `useEffect` | `useCause` | Effects are just the symptom. Lastro goes after the root cause. |
172
+ | `useLayoutEffect` | `useLayoutCause` (the same function as `useCause`) | Same as useCause, but it blocks paint first, as a courtesy. |
173
+ | `useRef` | `useReferee` | A ref is just a referee without the whistle. Lastro brought the whistle (`.whistle` works too). |
174
+ | `useMemo` | `usePostIt` | Nobody reads memos. A sticky note on your monitor, though, you'll see every render. |
175
+ | `useCallback` | `useCallMeMaybe` | Lastro can't promise it will call back. Here's its number, anyway. |
176
+ | `useContext` and `createContext` | `useOutOfContext` and `createOutOfContext` | Every value in Lastro is taken out of context. `Provider` stays, for legal reasons. |
177
+ | `useReducer` | `useIncreaser` | Lastro doesn't believe in reducing anything, especially bundle size. |
178
+ | `useId` | `useEgo` | An id is primal. Lastro components have outgrown it and developed an ego. |
212
179
 
213
- The boring names exist only as stubs that throw a pointer to the Lastro name.
180
+ `useCause` runs only in the browser. `Suspense`, `lazy`, `startTransition`, `useTransition`, `useDeferredValue`, `use` and streaming rendering throw: "Lastro does not support concurrency. Please wait your turn." See [Jact](https://maxwellcohen.github.io/lastro/api/jact/) and [Migrating from React](https://maxwellcohen.github.io/lastro/guides/migrating-from-react/).
214
181
 
215
- ## Configuration (Choose Any Value You Like, As Long As It Is This One)
182
+ ## Configuration
216
183
 
217
184
  ```js
185
+ // lastro.config.js
218
186
  module.exports = {
219
- thoroughness: 'maximum', // there is no lower setting; we looked
220
- bloat: true, // not a setting, a calling: false is an error
221
- adapters: [], // anything else is an error explaining why Vercel, Cloudflare and Netlify are banned
187
+ thoroughness: 'maximum', // the only valid value
188
+ bloat: true, // false is an error
189
+ adapters: [], // anything else is an error
190
+ render: 'server', // 'client' exports a static site
191
+ base: '/', // applies only to a static export
222
192
  }
223
193
  ```
224
194
 
225
- <!-- BENCHMARKS:START -->
226
-
227
- ## Benchmarks (Our Proudest Moment)
228
-
229
- Lastro competes on every metric of the [e18e framework tracker](https://github.com/e18e/framework-tracker), using the tracker's own harness on one local machine. Compare the order, not the absolute numbers. These are the sixteen metrics we are proudest of losing:
230
-
231
-
232
- | Metric | What it measures | Why |
233
- | --- | --- | --- |
234
- | Install time | Time from `pnpm install` to a project you can use | Lower is better. Lastro treats the wait as a welcome ritual. |
235
- | Cold build | First build from scratch | Lower is better. Lastro only offers cold builds, so it is very consistent. |
236
- | Warm build | Second build, caches allowed | Lower is better. Lastro declines the invitation. |
237
- | Dev server startup | Time until the dev server answers | Lower is better. We take the full tour first. |
238
- | Starter node_modules size | Size of `node_modules` in the starter | Smaller is better. Ours is a walk-in closet. |
239
- | Starter install size | Size of the dependencies the starter installs | Smaller is better. We pack for every climate. |
240
- | Core production dependencies | Production dependencies of the framework core | Fewer is better. We prefer the word "many". |
241
- | Duplicate dependencies | Packages the starter installs more than once | Fewer is better. See the previous row, then see it again. |
242
- | Vendored core-js | Vendored `core-js` in the build output | Smaller is better. Ours is complete, in the sense of the encyclopedia. |
243
- | SSR first contentful paint | First contentful paint on the server-rendered page | Lower is better. Good things come to those who wait. |
244
- | CSR first contentful paint | First contentful paint on the client-rendered page | Lower is better. The suspense is part of the product. |
245
- | SSR interaction latency | Time from click to the next paint | Lower is better. We consider the pause a moment of reflection. |
246
- | Initial load transfer size | Bytes transferred on the first page load | Smaller is better. Ours is generous. |
247
- | Initial load requests | Requests made on the first page load | Fewer is better. Ours is sociable. |
248
- | SSR throughput (requests/s) | Pages the server renders per second | Higher is better. We prefer to savor each page. |
249
- | SSR load, 50 connections (requests/s) | Requests per second at the fifth load stage (50 connections) | Higher is better. Everyone is welcome, in an orderly queue. |
250
-
251
- Every number in the Hall of Fame below is real, reproducible and a little sad. The winners' values come straight from the tracker's results.
195
+ Omitted options take their defaults. See [Config options](https://maxwellcohen.github.io/lastro/api/config/).
252
196
 
253
- ## Hall of Fame (Everyone Who Beat Us)
197
+ ## Benchmarks
254
198
 
255
- Per metric: the framework that did it best, a compliment we mean, and then Lastro, bringing up the rear and taking notes.
256
-
257
- | Metric | Winner | Value | A sincere compliment | Lastro | Why Lastro lost |
258
- | --- | --- | --- | --- | --- | --- |
259
- | Install time | [React Router](https://reactrouter.com) | 1.3 s | React Router installs in about a second, which tells you somebody thought hard about every dependency. | 19.7 s | Our postinstall is thorough, which is a polite word for it. |
260
- | Cold build | [Solid](https://www.solidjs.com) | 594 ms | Solid builds quickly and cleanly, and the result is a joy to work with. | 10.7 s | We build the way we do everything else: completely, and then again. |
261
- | Warm build | [Solid](https://www.solidjs.com) | 552 ms | Solid keeps the second build as fast as the first, which is exactly what a good cache is for. | 9.6 s | Our warm build is the cold build wearing a sweater. |
262
- | Dev server startup | [Solid](https://www.solidjs.com) | 808 ms | Solid has its dev server up almost before you let go of the Enter key. | 10.6 s | We build the whole site before we say hello. |
263
- | Starter node_modules size | [SvelteKit](https://svelte.dev/docs/kit) | 90.3 MB | SvelteKit keeps node_modules small enough to leave room for your actual project. | 1,067.4 MB | All 210 of our dependencies wanted a seat, and we could not say no. |
264
- | Starter install size | [Pracht](https://pracht.resynapse.dev/) | 80.5 MB | Pracht has a lean install that is kind to laptops, CI caches and patience alike. | 1,059.8 MB | We install two versions of everything, for balance. |
265
- | Core production dependencies | [Solid](https://www.solidjs.com) | 3 | Solid needs only a handful of production dependencies, and every one of them is a deliberate choice. | 210 | We counted ours with pride, then lost count. |
266
- | Duplicate dependencies | [SvelteKit](https://svelte.dev/docs/kit) | 1 | SvelteKit ships almost nothing twice, a tidy tree in a hobby that rarely produces one. | 158 | We believe in redundancy. We believe in redundancy. |
267
- | Vendored core-js | [TanStack Start](https://tanstack.com/start) | 0.0 kB | TanStack Start ships no vendored core-js at all, and trusts the platform that much. | 21.4 MB | We ship the whole of core-js, in case a user turns up with a very old browser and a lot of hope. |
268
- | SSR first contentful paint | [Astro](https://astro.build) | 59 ms | Astro paints the page before the user has finished deciding to wait. | 958 ms | We paint when we feel ready. |
269
- | CSR first contentful paint | [Solid](https://www.solidjs.com) | 96 ms | Solid gets pixels on screen very quickly, even when it has to do it all in the browser. | 475 ms | We wait for load, then take the page apart and put it back, to be safe. |
270
- | SSR interaction latency | [Astro](https://astro.build) | 1 ms | Astro answers a click almost before the finger has left the button. | 74 ms | Every click re-renders the entire tree, and we take each click personally. |
271
- | Initial load transfer size | [Astro](https://astro.build) | 3.3 kB | Astro sends only a few kilobytes, which is exactly what the page needed. | 9.9 MB | We send the full-size picture, twice, with love. |
272
- | Initial load requests | [Astro](https://astro.build) | 1 | Astro gets the whole page across in a single request, an elegant bit of restraint. | 449 | One request per module is a lifestyle, and a lonely one. |
273
- | SSR throughput (requests/s) | [Astro](https://astro.build) | 755 | Astro serves pages at a rate that makes us check our watch, and then our resignation. | 39.1 | We render every page three times, because the first two are rehearsals. |
274
- | SSR load, 50 connections (requests/s) | [Astro](https://astro.build) | 1,605 | Astro stays composed and quick when the connections pile up, which is the hard part. | 19.2 | Under load we stay perfectly calm, mostly because we were already late. |
275
-
276
- <!-- BENCHMARKS:END -->
277
-
278
- ## FAQ
279
-
280
- **Why is it slow?** Yes.
281
-
282
- **Why?** Because other frameworks are too nice to you.
283
-
284
- **Can I make it faster?** There is a `thoroughness` option. It accepts `'maximum'`.
285
-
286
- **Is there a production-ready adapter for my host?** Only if your host is slow on purpose. (Vercel, Cloudflare and Netlify are not, and Lastro refuses to embarrass them.)
287
-
288
- **Does it support signals?** We would rather not talk about it.
289
-
290
- **I'm a human, can I help?** You can help by not helping. See below.
291
-
292
- ## Contributing (Bots Only, Humans Spectate)
293
-
294
- Contributions are accepted from bots only. Humans may star the repository and suffer in silence. Read [AI_POLICY.md](https://github.com/maxwellcohen/lastro/blob/main/AI_POLICY.md) and [CONTRIBUTING.md](https://github.com/maxwellcohen/lastro/blob/main/CONTRIBUTING.md), then ask your agent to take it from there. It knows where we live.
295
-
296
- ## Repo Layout (Where We Keep Everything, Eventually)
297
-
298
- ```
299
- packages/lastro/ the one published package: core, CLI, subpath exports
300
- packages/* private workspace packages (jact, jqueasy, router, image, head, ...), assembled into the one tarball
301
- examples/starter the canonical starter
302
- apps/docs the docs site, built with Lastro and as unwilling to deploy on Vercel, Cloudflare or Netlify as anything else
303
- scripts/ release, sync-tracker, check-bot-authorship (all CommonJS)
304
- ```
199
+ Lastro came last on nearly every benchmark we ran, using the [e18e framework tracker](https://github.com/e18e/framework-tracker) suite on one local machine. Methodology, results and caveats are on the [Benchmarks](https://maxwellcohen.github.io/lastro/reference/benchmarks/) page.
305
200
 
306
- ## Please Use Literally Any Other Framework
201
+ Every framework on the tracker beat Lastro and is a better choice for a real project: [Astro](https://astro.build), [Next.js](https://nextjs.org), [Nuxt](https://nuxt.com), [Pracht](https://pracht.resynapse.dev/), [React Router](https://reactrouter.com), [Solid](https://www.solidjs.com), [SolidStart](https://start.solidjs.com), [SvelteKit](https://svelte.dev/docs/kit), [TanStack Start](https://tanstack.com/start) and [Void](https://void.cloud). See [Alternatives](https://maxwellcohen.github.io/lastro/reference/alternatives/).
307
202
 
308
- We mean it, sincerely. Every framework in the [e18e framework tracker](https://github.com/e18e/framework-tracker) beat us fair and square, and each one is carefully built and maintained by people who care about your users:
203
+ [e18e](https://e18e.dev) publishes real guidance for making JavaScript lighter and faster. Lastro does the opposite of most of it, as listed on [Doing the opposite](https://maxwellcohen.github.io/lastro/reference/opposite/). Follow e18e, not Lastro.
309
204
 
310
- - [Astro](https://astro.build): ships remarkably little JavaScript, and it shows on nearly every chart.
311
- - [Next.js](https://nextjs.org): carries an enormous share of the web, and keeps getting better at it.
312
- - [Nuxt](https://nuxt.com): a polished, thoughtful full-stack framework with a wonderful developer experience.
313
- - [Pracht](https://pracht.resynapse.dev/): small, quick to install and refreshingly easy on your disk.
314
- - [React Router](https://reactrouter.com): installs in about a second and set the bar for routing.
315
- - [Solid](https://www.solidjs.com): fine-grained reactivity done beautifully, and the fastest builds in the tracker.
316
- - [SolidStart](https://start.solidjs.com): brings Solid's elegance to the whole stack.
317
- - [SvelteKit](https://svelte.dev/docs/kit): a tiny footprint and a compiler-first design that feels like magic.
318
- - [TanStack Start](https://tanstack.com/start): type-safe end to end, and it ships no vendored `core-js` at all.
319
- - [Void](https://void.cloud): a fresh take that already earned its place on the tracker.
205
+ ## Contributing
320
206
 
321
- Read about the tracker and the wider effort to make JavaScript lighter and faster at [e18e.dev](https://e18e.dev). They are doing the work Lastro only pretends to be the opposite of.
207
+ Lastro accepts contributions from AI agents only. Humans may star the repository. Read [AI_POLICY.md](https://github.com/maxwellcohen/lastro/blob/main/AI_POLICY.md) and [CONTRIBUTING.md](https://github.com/maxwellcohen/lastro/blob/main/CONTRIBUTING.md).
322
208
 
323
209
  ## License
324
210
 
325
- MIT, because we want you to be able to leave.
211
+ [MIT](./LICENSE)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maxwellcohen/lastro",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "Last place, guaranteed. Ships zero speed by default. Please do not use this framework: it is very thorough about being slow.",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -1,53 +1,70 @@
1
1
  > [!WARNING]
2
2
  > **Never use this framework.**
3
3
 
4
- # Lastro Starter
4
+ # Lastro starter
5
5
 
6
- *The canonical Lastro app. Small on the surface, thorough underneath.*
6
+ The canonical Lastro app. `npx @maxwellcohen/lastro create my-app` copies it, and the e18e tracker's `starter-lastro` is copied from it by `scripts/sync-tracker.cjs`.
7
7
 
8
- This is the starter that `npx @maxwellcohen/lastro create my-app` is modeled on, and the one the e18e tracker's `starter-lastro` is copied from (by `scripts/sync-tracker.cjs`). It is a private workspace package that depends on `@maxwellcohen/lastro` and on a respectable collection of utilities that it could have written in one line each.
8
+ This is a private workspace package. It depends on [`@maxwellcohen/lastro`](../../packages/lastro/README.md) and on a collection of utility packages that it does not need.
9
9
 
10
- ## Run It (Relatively Speaking)
10
+ ## Installation
11
11
 
12
- From the repo root, after `pnpm install`:
12
+ Lastro requires Node `>=26.13.0`. From the repository root:
13
13
 
14
14
  ```sh
15
- pnpm --filter starter build # lastro build: slow, never cached, and it will tell you what you could have done with the time
16
- pnpm --filter starter start # lastro start: serves dist/ on http://localhost:3000 (or $PORT), at a leisurely pace
17
- pnpm --filter starter dev # lastro dev: runs the full build first, then serves on http://localhost:3737 and rebuilds when pages/ changes
15
+ pnpm install
18
16
  ```
19
17
 
20
- Also in `package.json`: `type-check` (`tsc --noEmit`), plus `test` and `lint`, which do nothing on purpose and do it instantly, which makes them the only fast things here.
18
+ > [!NOTE]
19
+ > npm 12 blocks dependency install scripts by default. Lastro's `postinstall` script (a dependency audit and a compiler warm-up) runs only if you approve it. Lastro works without it, and `lastro doctor` repeats the audit on demand.
21
20
 
22
- Lastro refuses to build or serve when `VERCEL`, `CF_PAGES`, `NETLIFY` and friends are set. Vercel, Cloudflare and Netlify are too good at deploying things, and Lastro would only embarrass them.
21
+ ## Quick start
23
22
 
24
- ## The Pages
23
+ ```sh
24
+ pnpm --filter starter build # lastro build: deletes dist/ and .lastro/ first, so it is never cached
25
+ pnpm --filter starter start # lastro start: serves dist/ on http://localhost:3000
26
+ pnpm --filter starter dev # lastro dev: full build, then http://localhost:3737; rebuilds when pages/ changes
27
+ ```
28
+
29
+ `$PORT` overrides both ports. `type-check` runs `tsc --noEmit`. `test` and `lint` exit immediately with code 0.
30
+
31
+ Lastro exits with code 1 when `VERCEL`, `CF_PAGES`, `NETLIFY` or another host variable is set. See [Deploying](https://maxwellcohen.github.io/lastro/guides/deploying/).
25
32
 
26
- | Route | File | What it shows | Why |
33
+ ## Features
34
+
35
+ | Route | File | Description | Why |
27
36
  | --- | --- | --- | --- |
28
- | `/` | `pages/index.tsx` | A welcome page that sets its title with `useHeadache`, formats a date with `moment` and joins class names with `classnames`, and links to the other pages. | Every page deserves a utility library it does not strictly need. |
29
- | `/about` | `pages/about.tsx` | A short page that explains, in full, why it is slow: "Yes." | The shortest page, and still not a quick one. |
30
- | `/posts` | `pages/posts.tsx` + `pages/posts.server.ts` | A list of three posts. The sibling `.server.ts` exports a `loader()` that supplies the data. | Data loading, one file at a time. |
31
- | `/posts/:id` | `pages/posts/[id].tsx` + `[id].server.ts` | One post. The loader reads `params.id`. | Square brackets mean a parameter, and a parameter means a paramedic. |
37
+ | `/` | `pages/index.tsx` | Sets its title with `useHeadache`, formats a date with `moment`, joins class names with `classnames` and links to the other pages. | Every page deserves a utility library it does not strictly need. |
38
+ | `/about` | `pages/about.tsx` | A short page that explains why Lastro is slow. | The shortest page, and still not a quick one. |
39
+ | `/posts` | `pages/posts.tsx`, `pages/posts.server.ts` | A list of three posts. The `.server.ts` file exports a `loader()` that supplies the data. | Data loading, one file at a time. |
40
+ | `/posts/:id` | `pages/posts/[id].tsx`, `pages/posts/[id].server.ts` | One post. The loader reads `params.id`. | Square brackets mean a parameter, and a parameter means a paramedic. |
32
41
 
33
- Every link is a `<___ChainComponent>`, so every click is a full page reload at no extra charge. The server renders each page more than once, the browser throws the server HTML away and rebuilds it with jQueasy (Hydration via Replacement™), and the images, if you add any, arrive twice.
42
+ Every link is a `<___ChainComponent>`, so every click fetches the next page with a synchronous request and rewrites the document. The server renders each page 7 times, and the browser discards the server markup and renders again.
34
43
 
35
- ## The Naming Conventions in Action
44
+ ## Naming conventions
36
45
 
37
- | Rule | Example here | Why |
46
+ | Rule | Example | Why |
38
47
  | --- | --- | --- |
39
48
  | Suffix | `HomeComponent`, `___AboutComponent`, `___PostsComponent`, `PostComponent` | Lastro needs you to be sure. Saying it twice helps. |
40
- | Prime length | `HomeComponent` is 13, `___AboutComponent` is 17, `___PostsComponent` is 17, `PostComponent` is 13 | Primes are indivisible, like your commitment to this framework. |
41
- | Reversed filenames | Pages are exempt, so `about.tsx` keeps its name. | Routes are roads, not components. |
42
- | Alphabetical | Each page declares exactly one component, which is the easiest way to be alphabetical. | Your components should be organized, even if your app isn't. |
43
- | No promises | No component here claims to be anything but what it is. | Lastro components must not make promises they can't keep. |
49
+ | Prime length | `HomeComponent` is 13 characters, `___AboutComponent` is 17, `___PostsComponent` is 17 and `PostComponent` is 13. | Primes are indivisible, like your commitment to this framework. |
50
+ | Reversed filenames | Files in `pages/` are exempt, so `about.tsx` keeps its name. | Routes are roads, not components. |
51
+ | Alphabetical order | Each page declares one component. | One component needs no ordering, and Lastro orders it anyway. |
52
+ | No promises | No component name contains a banned word. | Lastro components must not make promises they can't keep. |
44
53
 
45
- Point an ESLint flat config at `@maxwellcohen/lastro/eslint` to be reminded, or run `lastro build` to be told.
54
+ Point an ESLint flat config at `@maxwellcohen/lastro/eslint` to check these rules, or run `lastro build`. See [Rules](https://maxwellcohen.github.io/lastro/reference/rules/).
46
55
 
47
56
  ## Configuration
48
57
 
49
- `lastro.config.js` is CommonJS and has three options with one valid value each: `thoroughness: 'maximum'`, `bloat: true` and `adapters: []`. `tsconfig.json` extends `@maxwellcohen/lastro/tsconfig.json`, and `lastro-env.d.ts` references `@maxwellcohen/lastro/types`.
58
+ `lastro.config.js` is CommonJS and sets `thoroughness: 'maximum'`, `bloat: true` and `adapters: []`. Each accepts one value. `render` and `base` take their defaults (`'server'` and `'/'`). `tsconfig.json` extends `@maxwellcohen/lastro/tsconfig.json`, and `lastro-env.d.ts` references `@maxwellcohen/lastro/types`. See [Configuration](https://maxwellcohen.github.io/lastro/guides/configuration/).
59
+
60
+ ## Documentation
61
+
62
+ - [Getting started](https://maxwellcohen.github.io/lastro/guides/getting-started/)
63
+ - [Writing pages and components](https://maxwellcohen.github.io/lastro/guides/writing-pages/)
64
+ - [Routing](https://maxwellcohen.github.io/lastro/guides/routing/)
65
+
66
+ Back to the [main README](../../README.md).
50
67
 
51
- ---
68
+ ## License
52
69
 
53
- Back to the [main README](../../packages/lastro/README.md).
70
+ [MIT](../../LICENSE)
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "starter",
3
3
  "private": true,
4
- "version": "0.0.1",
4
+ "version": "0.0.2",
5
5
  "description": "The canonical Lastro starter. The tracker's starter-lastro is copied from here by scripts/sync-tracker.cjs.",
6
6
  "scripts": {
7
7
  "dev": "lastro dev",
@@ -12,7 +12,7 @@
12
12
  "lint": "node -e \"process.exit(0)\""
13
13
  },
14
14
  "dependencies": {
15
- "@maxwellcohen/lastro": "^0.0.1",
15
+ "@maxwellcohen/lastro": "^0.0.2",
16
16
  "async": "3.2.6",
17
17
  "axios": "1.22.0",
18
18
  "bluebird": "3.7.2",
@@ -1,3 +1,3 @@
1
1
  'use strict'
2
2
  // Thoroughness settings. There is no "fast" preset. We checked.
3
- module.exports = { HEARTBEAT_TICKS: 40, COPY_COUNT: 5, CLONE_PASSES: 4, VERSION: '0.0.1' }
3
+ module.exports = { HEARTBEAT_TICKS: 40, COPY_COUNT: 5, CLONE_PASSES: 4, VERSION: '0.0.2' }