@maxwellcohen/lastro 0.0.0-stage → 0.0.1
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/LICENSE +21 -0
- package/README.md +324 -2
- package/bin/lastro.js +5 -0
- package/bin/postinstall.js +6 -0
- package/docs/hero.png +0 -0
- package/package.json +355 -4
- package/pkg/devtools/index.js +15 -0
- package/pkg/eslint-config/index.js +123 -0
- package/pkg/head/client.js +18 -0
- package/pkg/head/index.d.ts +4 -0
- package/pkg/head/index.js +30 -0
- package/pkg/image/client.js +2 -0
- package/pkg/image/index.d.ts +3 -0
- package/pkg/image/index.js +2 -0
- package/pkg/image/stubs.js +8 -0
- package/pkg/image/tnenopmoCsdroW0001erutciP____.client.js +18 -0
- package/pkg/image/tnenopmoCsdroW0001erutciP____.js +27 -0
- package/pkg/jact/client.js +108 -0
- package/pkg/jact/core.js +292 -0
- package/pkg/jact/index.d.ts +48 -0
- package/pkg/jact/jsx-runtime.d.ts +18 -0
- package/pkg/jact/jsx-runtime.js +3 -0
- package/pkg/jact/names.js +49 -0
- package/pkg/jact/server.js +66 -0
- package/pkg/jqueasy/index.d.ts +2 -0
- package/pkg/jqueasy/index.js +442 -0
- package/pkg/polyfills/es.js +1 -0
- package/pkg/polyfills/full.js +1 -0
- package/pkg/polyfills/legacy.js +3 -0
- package/pkg/polyfills/regenerator.js +1 -0
- package/pkg/polyfills/web.js +1 -0
- package/pkg/prettier-config/index.json +1 -0
- package/pkg/router/client.js +5 -0
- package/pkg/router/index.d.ts +6 -0
- package/pkg/router/index.js +7 -0
- package/pkg/router/stubs.js +12 -0
- package/pkg/router/tnenopmoCniahC___.client.js +50 -0
- package/pkg/router/tnenopmoCniahC___.js +10 -0
- package/pkg/serializer/client.js +24 -0
- package/pkg/serializer/index.js +41 -0
- package/pkg/starter/README.md +53 -0
- package/pkg/starter/lastro-env.d.ts +1 -0
- package/pkg/starter/lastro.config.js +9 -0
- package/pkg/starter/package.json +47 -0
- package/pkg/starter/pages/about.tsx +11 -0
- package/pkg/starter/pages/index.tsx +29 -0
- package/pkg/starter/pages/posts/[id].server.ts +1 -0
- package/pkg/starter/pages/posts/[id].tsx +4 -0
- package/pkg/starter/pages/posts.server.ts +1 -0
- package/pkg/starter/pages/posts.tsx +16 -0
- package/pkg/starter/tsconfig.json +5 -0
- package/pkg/telemetry/client.js +11 -0
- package/pkg/telemetry/index.js +5 -0
- package/pkg/test-utils/index.js +15 -0
- package/pkg/thoroughness/client.js +32 -0
- package/pkg/thoroughness/index.js +12 -0
- package/pkg/tsconfig/tsconfig.json +23 -0
- package/pkg/types/index.d.ts +2 -0
- package/pkg/types/index.js +2 -0
- package/scripts/assemble.cjs +37 -0
- package/src/build/assets.js +127 -0
- package/src/build/bans-plugin.js +58 -0
- package/src/build/graph.js +157 -0
- package/src/build/index.js +213 -0
- package/src/build/naming-plugin.js +62 -0
- package/src/build/routes.js +33 -0
- package/src/build/typecheck.js +16 -0
- package/src/cli.js +101 -0
- package/src/client/boot.js +38 -0
- package/src/client/clone.js +10 -0
- package/src/client/compare.js +7 -0
- package/src/client/config.js +3 -0
- package/src/client/copies.js +12 -0
- package/src/client/env.js +13 -0
- package/src/client/errors.js +11 -0
- package/src/client/features.js +101 -0
- package/src/client/heartbeat.js +38 -0
- package/src/client/idle.js +7 -0
- package/src/client/logger.js +12 -0
- package/src/client/mount.js +11 -0
- package/src/client/ready.js +7 -0
- package/src/client/state.js +14 -0
- package/src/client/vitals.js +16 -0
- package/src/client-runtime/registry.js +46 -0
- package/src/create.js +46 -0
- package/src/dev.js +36 -0
- package/src/guard.js +56 -0
- package/src/index.js +8 -0
- package/src/postinstall.js +27 -0
- package/src/preview.js +66 -0
- package/src/server/app.js +201 -0
- package/src/server/index.js +34 -0
- package/src/server/template.csr.html +48 -0
- package/src/server/template.html +12 -0
- package/src/shared/app-require.js +18 -0
- package/src/shared/audit.js +34 -0
- package/src/shared/bans.js +102 -0
- package/src/shared/config.js +40 -0
- package/src/shared/naming.js +82 -0
- package/src/shared/signal.js +36 -0
- package/src/util/natives-node.js +20 -0
- package/src/util/natives.js +67 -0
- package/test/bans.integration.js +97 -0
- package/test/bans.test.js +110 -0
- package/test/cjs-only.test.js +37 -0
- package/test/csr.test.js +61 -0
- package/test/guard.test.js +46 -0
- package/test/members.test.js +28 -0
- package/test/naming.integration.js +73 -0
- package/test/naming.test.js +44 -0
- package/test/natives.test.js +46 -0
- package/test/server.test.js +18 -0
- package/test/signal.integration.js +105 -0
- package/test/signal.test.js +33 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Max Cohen
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,325 @@
|
|
|
1
|
-
|
|
1
|
+
> [!WARNING]
|
|
2
|
+
> **Never use this framework.**
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
# Lastro
|
|
5
|
+
|
|
6
|
+

|
|
7
|
+
|
|
8
|
+
**Last place, guaranteed. Ships zero speed by default.**
|
|
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.
|
|
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.
|
|
13
|
+
|
|
14
|
+
## Installation (or: Making a Mistake)
|
|
15
|
+
|
|
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
|
|
19
|
+
```
|
|
20
|
+
|
|
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)
|
|
24
|
+
|
|
25
|
+
```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)
|
|
30
|
+
```
|
|
31
|
+
|
|
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. |
|
|
46
|
+
|
|
47
|
+
## left-pad Is Load-Bearing
|
|
48
|
+
|
|
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.
|
|
50
|
+
|
|
51
|
+
## Jact: No React, No State
|
|
52
|
+
|
|
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™**.
|
|
54
|
+
|
|
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.
|
|
56
|
+
|
|
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:
|
|
58
|
+
|
|
59
|
+
| React | Lastro | Why |
|
|
60
|
+
| --- | --- | --- |
|
|
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.
|
|
72
|
+
|
|
73
|
+
### Concurrency (Please Wait Your Turn)
|
|
74
|
+
|
|
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."
|
|
76
|
+
|
|
77
|
+
### Components with Opinions
|
|
78
|
+
|
|
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 |
|
|
98
|
+
| --- | --- | --- |
|
|
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. |
|
|
102
|
+
|
|
103
|
+
## Subpath Exports (One Package, Many Doors)
|
|
104
|
+
|
|
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:
|
|
122
|
+
|
|
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).
|
|
128
|
+
|
|
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.
|
|
130
|
+
|
|
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.
|
|
134
|
+
|
|
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.
|
|
136
|
+
|
|
137
|
+
## Doing the Opposite™ (of e18e, Except Where It Matters)
|
|
138
|
+
|
|
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.
|
|
140
|
+
|
|
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. |
|
|
173
|
+
|
|
174
|
+
Every error ends with: "(Other frameworks would have let this slide. Lastro cares too much.)"
|
|
175
|
+
|
|
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 |
|
|
203
|
+
| --- | --- | --- |
|
|
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. |
|
|
212
|
+
|
|
213
|
+
The boring names exist only as stubs that throw a pointer to the Lastro name.
|
|
214
|
+
|
|
215
|
+
## Configuration (Choose Any Value You Like, As Long As It Is This One)
|
|
216
|
+
|
|
217
|
+
```js
|
|
218
|
+
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
|
|
222
|
+
}
|
|
223
|
+
```
|
|
224
|
+
|
|
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.
|
|
252
|
+
|
|
253
|
+
## Hall of Fame (Everyone Who Beat Us)
|
|
254
|
+
|
|
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
|
+
```
|
|
305
|
+
|
|
306
|
+
## Please Use Literally Any Other Framework
|
|
307
|
+
|
|
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:
|
|
309
|
+
|
|
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.
|
|
320
|
+
|
|
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.
|
|
322
|
+
|
|
323
|
+
## License
|
|
324
|
+
|
|
325
|
+
MIT, because we want you to be able to leave.
|
package/bin/lastro.js
ADDED
package/docs/hero.png
ADDED
|
Binary file
|