@maxwellcohen/lastro 0.0.2 → 0.0.3
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 +6 -5
- package/bin/postinstall.js +0 -0
- package/package.json +10 -11
- package/pkg/head/index.d.ts +0 -2
- package/pkg/head/index.js +2 -17
- package/pkg/starter/package.json +2 -2
- package/src/build/index.js +19 -11
- package/src/client/config.js +1 -1
- package/src/client-runtime/registry.js +56 -8
- package/src/server/app.js +2 -2
- package/src/server/template.csr.html +2 -0
package/README.md
CHANGED
|
@@ -30,7 +30,7 @@ There is exactly one published package. Jact, jQueasy, the router, the image com
|
|
|
30
30
|
|
|
31
31
|
## Quick start
|
|
32
32
|
|
|
33
|
-
Pages live in `pages/`. Each file is a route. A sibling `pages/<name>.server.ts` may export `loader()
|
|
33
|
+
Pages live in `pages/`. Each file is a route. A sibling `pages/<name>.server.ts` may export `loader()` and `paths`. The render mode belongs to the whole app (`render` in `lastro.config.js`), and a route that exports `ssr` fails the build.
|
|
34
34
|
|
|
35
35
|
```tsx
|
|
36
36
|
// pages/index.tsx
|
|
@@ -56,17 +56,17 @@ lastro doctor # checks that every dependency is installed (alias: therapy)
|
|
|
56
56
|
|
|
57
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
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.
|
|
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. CSS is not split: one global stylesheet with every route's CSS is linked on every page.
|
|
60
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
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
|
|
62
|
+
- **Client:** every module loads in its own request, strictly one at a time, 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
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
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
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
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
|
|
67
|
+
- **Head:** `useHeadache` applies only `title` and `description`, and only in the browser, after hydration. The server HTML of every page has the title `Lastro` and no description.
|
|
68
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
|
|
69
|
+
- **Modules:** CommonJS only. In the browser, Lastro's own `require()` shim downloads each module in its own request, one at a time, and evaluates it with `new Function`. Only same-origin code that Lastro built is evaluated.
|
|
70
70
|
|
|
71
71
|
## Why not React or jQuery?
|
|
72
72
|
|
|
@@ -139,6 +139,7 @@ Image, head and script optimizations throw `OptimizationBannedError`. The build
|
|
|
139
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
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
141
|
| `<script>` | `async`, `defer` and `type="module"`. | Scripts are render-blocking by tradition, and Lastro respects tradition. |
|
|
142
|
+
| `export const ssr` in a `.server.ts` file | Any per-route render mode. Use `render` in `lastro.config.js`. | Variety is how performance happens. |
|
|
142
143
|
| `___ChainComponent` | `prefetch`, `data-prefetch`, `prefetchOnHover`, `prefetchOnViewport`, `prefetchOnView` and `viewportPrefetch`. | `<___ChainComponent>` does a full page reload, as nature intended. |
|
|
143
144
|
|
|
144
145
|
### Signals are banned
|
package/bin/postinstall.js
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maxwellcohen/lastro",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
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": [
|
|
@@ -90,15 +90,6 @@
|
|
|
90
90
|
"publishConfig": {
|
|
91
91
|
"access": "public"
|
|
92
92
|
},
|
|
93
|
-
"scripts": {
|
|
94
|
-
"postinstall": "node ./bin/postinstall.js",
|
|
95
|
-
"prepack": "node ./scripts/assemble.cjs",
|
|
96
|
-
"pretest": "node ./scripts/assemble.cjs",
|
|
97
|
-
"test": "node test/guard.test.js && node test/signal.test.js && node test/bans.test.js && node test/naming.test.js && node test/natives.test.js && node test/members.test.js && node test/server.test.js && node test/csr.test.js && node test/cjs-only.test.js",
|
|
98
|
-
"test:integration": "node test/signal.integration.js && node test/bans.integration.js && node test/naming.integration.js",
|
|
99
|
-
"build": "node ./scripts/assemble.cjs",
|
|
100
|
-
"lint": "node test/cjs-only.test.js"
|
|
101
|
-
},
|
|
102
93
|
"dependencies": {
|
|
103
94
|
"@babel/core": "7.24.4",
|
|
104
95
|
"@babel/preset-env": "7.24.4",
|
|
@@ -353,5 +344,13 @@
|
|
|
353
344
|
"repository": {
|
|
354
345
|
"type": "git",
|
|
355
346
|
"url": "git+https://github.com/maxwellcohen/lastro.git"
|
|
347
|
+
},
|
|
348
|
+
"scripts": {
|
|
349
|
+
"postinstall": "node ./bin/postinstall.js",
|
|
350
|
+
"pretest": "node ./scripts/assemble.cjs",
|
|
351
|
+
"test": "node test/guard.test.js && node test/signal.test.js && node test/bans.test.js && node test/naming.test.js && node test/natives.test.js && node test/members.test.js && node test/server.test.js && node test/csr.test.js && node test/cjs-only.test.js",
|
|
352
|
+
"test:integration": "node test/signal.integration.js && node test/bans.integration.js && node test/naming.integration.js",
|
|
353
|
+
"build": "node ./scripts/assemble.cjs",
|
|
354
|
+
"lint": "node test/cjs-only.test.js"
|
|
356
355
|
}
|
|
357
|
-
}
|
|
356
|
+
}
|
package/pkg/head/index.d.ts
CHANGED
|
@@ -1,4 +1,2 @@
|
|
|
1
1
|
export function useHeadache(titleOrOptions: string | { title?: string; description?: string; links?: any[]; scripts?: any[]; fonts?: any[]; speculationRules?: any }): void
|
|
2
2
|
export function renderHead(options: { title: string; styles: string[]; scripts: string[]; version: string }): string
|
|
3
|
-
export function takeHeadache(): string | null
|
|
4
|
-
export function takeDescription(): string | null
|
package/pkg/head/index.js
CHANGED
|
@@ -4,27 +4,12 @@ function esc(s) { return String(s).replace(/&/g, '&').replace(/"/g, '"'
|
|
|
4
4
|
function renderHead(opts) {
|
|
5
5
|
const v = opts.version
|
|
6
6
|
const tags = ['<meta charset="utf-8">', '<meta name="viewport" content="width=device-width, initial-scale=1">', '<title>' + esc(opts.title) + '</title>']
|
|
7
|
-
if (opts.description) tags.push('<meta name="description" content="' + esc(opts.description) + '">')
|
|
8
7
|
for (const href of opts.styles) tags.push('<link rel="stylesheet" href="' + esc(href) + '?v=' + v + '">')
|
|
9
8
|
for (const src of opts.scripts) tags.push('<script src="' + esc(src) + '?v=' + v + '"></script>')
|
|
10
9
|
return tags.join('\n')
|
|
11
10
|
}
|
|
12
|
-
|
|
13
|
-
let pendingDescription = null
|
|
14
|
-
// useHeadache: on the server it remembers the title so the head can be rendered with it.
|
|
11
|
+
// useHeadache: on the server it only checks the bans. The title and description are set in the browser, after hydration, so the server HTML ships a generic title.
|
|
15
12
|
function useHeadache(titleOrOptions) {
|
|
16
13
|
checkHead(titleOrOptions)
|
|
17
|
-
pending = typeof titleOrOptions === 'string' ? titleOrOptions : titleOrOptions.title
|
|
18
|
-
pendingDescription = typeof titleOrOptions === 'string' ? null : titleOrOptions.description || null
|
|
19
14
|
}
|
|
20
|
-
|
|
21
|
-
const d = pendingDescription
|
|
22
|
-
pendingDescription = null
|
|
23
|
-
return d
|
|
24
|
-
}
|
|
25
|
-
function takeHeadache() {
|
|
26
|
-
const t = pending
|
|
27
|
-
pending = null
|
|
28
|
-
return t
|
|
29
|
-
}
|
|
30
|
-
module.exports = { renderHead, useHeadache, takeHeadache, takeDescription }
|
|
15
|
+
module.exports = { renderHead, useHeadache }
|
package/pkg/starter/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "starter",
|
|
3
3
|
"private": true,
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.3",
|
|
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.
|
|
15
|
+
"@maxwellcohen/lastro": "^0.0.3",
|
|
16
16
|
"async": "3.2.6",
|
|
17
17
|
"axios": "1.22.0",
|
|
18
18
|
"bluebird": "3.7.2",
|
package/src/build/index.js
CHANGED
|
@@ -15,8 +15,11 @@ const { discoverRoutes } = require('./routes')
|
|
|
15
15
|
const { typecheck } = require('./typecheck')
|
|
16
16
|
const { collectServer, compileClient } = require('./graph')
|
|
17
17
|
const { loadConfig, normalizeBase } = require('../shared/config')
|
|
18
|
+
const { OptimizationBannedError } = require('../shared/bans')
|
|
18
19
|
const { writeSharedAssets, bundlePolyfills, minifyCss } = require('./assets')
|
|
19
20
|
|
|
21
|
+
// The title of every server-rendered page. useHeadache sets the real one in the browser, once the page has hydrated.
|
|
22
|
+
const TITLE = 'Lastro'
|
|
20
23
|
const TYPECHECK_PASSES = 8
|
|
21
24
|
const REGISTRY = path.join(__dirname, '..', 'client-runtime', 'registry.js')
|
|
22
25
|
const TEMPLATE = fs.readFileSync(path.join(__dirname, '..', 'server', 'template.html'), 'utf8')
|
|
@@ -79,9 +82,17 @@ async function build({ root, csr, base: baseOption }) {
|
|
|
79
82
|
fs.writeFileSync(path.join(serverDir, 'package.json'), '{"type":"commonjs"}\n')
|
|
80
83
|
|
|
81
84
|
const manifest = { buildId, routes: [] }
|
|
85
|
+
// One global stylesheet: every route's CSS, linked on every page. Routes only add to it, never get their own.
|
|
86
|
+
const globalCss = new Set()
|
|
87
|
+
const globalStyles = `${urlRoot}/shared/styles.css`
|
|
82
88
|
for (const route of routes) {
|
|
83
89
|
const serverMod = route.serverFile ? serverFiles.has(route.serverFile) && require(path.join(serverDir, serverOut(route.serverFile))) : null
|
|
84
|
-
|
|
90
|
+
if (serverMod && 'ssr' in serverMod) {
|
|
91
|
+
throw new OptimizationBannedError(
|
|
92
|
+
`Per-route "ssr" detected in ${route.rel}.server.ts. Render modes are an app-wide decision: set \`render\` in lastro.config.js. Lastro has one mode per app, so that no route can be the exception, and no route can be the hero.`,
|
|
93
|
+
)
|
|
94
|
+
}
|
|
95
|
+
const ssr = !csr
|
|
85
96
|
const entryFile = path.join(cache, 'entries', route.key + '.js')
|
|
86
97
|
fs.writeFileSync(
|
|
87
98
|
entryFile,
|
|
@@ -113,11 +124,8 @@ async function build({ root, csr, base: baseOption }) {
|
|
|
113
124
|
fs.writeFileSync(path.join(routeDir, 'modules.json'), JSON.stringify({ buildId, modules }))
|
|
114
125
|
fs.writeFileSync(path.join(routeDir, 'run.js'), `__lastro.boot(${JSON.stringify(routeUrl)}, ${JSON.stringify(compiled.entryId)});\n`)
|
|
115
126
|
scripts.push(`${routeUrl}/run.js`)
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
fs.writeFileSync(path.join(routeDir, `styles-${i}.css`), buf)
|
|
119
|
-
styles.push(`${routeUrl}/styles-${i}.css`)
|
|
120
|
-
})
|
|
127
|
+
compiled.css.forEach((c) => globalCss.add(c))
|
|
128
|
+
const styles = [`${urlRoot}/shared/base.css`, globalStyles]
|
|
121
129
|
manifest.routes.push({
|
|
122
130
|
key: route.key,
|
|
123
131
|
rel: route.rel,
|
|
@@ -126,7 +134,6 @@ async function build({ root, csr, base: baseOption }) {
|
|
|
126
134
|
regex: route.regex,
|
|
127
135
|
paramNames: route.paramNames,
|
|
128
136
|
ssr,
|
|
129
|
-
title: `Lastro | ${route.pattern}`,
|
|
130
137
|
page: serverOut(route.pageFile),
|
|
131
138
|
loader: route.serverFile ? serverOut(route.serverFile) : null,
|
|
132
139
|
scripts,
|
|
@@ -134,6 +141,7 @@ async function build({ root, csr, base: baseOption }) {
|
|
|
134
141
|
})
|
|
135
142
|
}
|
|
136
143
|
|
|
144
|
+
fs.writeFileSync(path.join(clientDir, 'shared', 'styles.css'), Buffer.concat(minifyCss([...globalCss])))
|
|
137
145
|
if (csr) {
|
|
138
146
|
await writeStaticShells({ root, dist, base, urlRoot, manifest, buildId, log })
|
|
139
147
|
} else {
|
|
@@ -158,9 +166,9 @@ async function writeStaticShells({ root, dist, base, urlRoot, manifest, buildId,
|
|
|
158
166
|
const { renderHead } = fromApp('@maxwellcohen/lastro/head')
|
|
159
167
|
const v = buildId
|
|
160
168
|
const hasFavicon = fs.existsSync(path.join(root, 'public', 'favicon.svg'))
|
|
161
|
-
const shell = (route, params
|
|
169
|
+
const shell = (route, params) => {
|
|
162
170
|
const scripts = [...route.scripts, `${urlRoot}/shared/analytics.js`]
|
|
163
|
-
const head = renderHead({ title, styles: route.styles, scripts, version: v })
|
|
171
|
+
const head = renderHead({ title: TITLE, styles: route.styles, scripts, version: v })
|
|
164
172
|
const bootstrap = `<script>window.__LASTRO_CSR__=true;window.__LASTRO_BASE__=${JSON.stringify(base)};window.__LASTRO_PARAMS__=${JSON.stringify(params).replace(/</g, '\\u003c')};</script>`
|
|
165
173
|
const icon = `<link rel="icon" href="${hasFavicon ? base + 'favicon.svg' : urlRoot + '/shared/logo.png'}">`
|
|
166
174
|
// Scripts move below the Patience Indicator(TM) so it can paint first. They stay synchronous and render-blocking.
|
|
@@ -183,7 +191,7 @@ async function writeStaticShells({ root, dist, base, urlRoot, manifest, buildId,
|
|
|
183
191
|
let home = null
|
|
184
192
|
for (const route of manifest.routes) {
|
|
185
193
|
if (route.rel === '404') {
|
|
186
|
-
write(path.join(dist, '404.html'), shell(route, {}
|
|
194
|
+
write(path.join(dist, '404.html'), shell(route, {}))
|
|
187
195
|
continue
|
|
188
196
|
}
|
|
189
197
|
let list = [{}]
|
|
@@ -196,7 +204,7 @@ async function writeStaticShells({ root, dist, base, urlRoot, manifest, buildId,
|
|
|
196
204
|
}
|
|
197
205
|
for (const params of list) {
|
|
198
206
|
const url = route.pattern.replace(/:(\w+)/g, (_m, name) => encodeURIComponent(params[name]))
|
|
199
|
-
const html = shell(route, params
|
|
207
|
+
const html = shell(route, params)
|
|
200
208
|
write(path.join(dist, url === '/' ? 'index.html' : path.join(url, 'index.html')), html)
|
|
201
209
|
if (url === '/') home = { route, html }
|
|
202
210
|
count++
|
package/src/client/config.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Lastro require() shim: "Modules the way Node intended, in your browser."
|
|
3
|
-
* Every CommonJS module is fetched on its own
|
|
3
|
+
* Every CommonJS module is fetched on its own, one request at a time, and evaluated with new Function.
|
|
4
|
+
* Requests run strictly in sequence (a waterfall), but asynchronously, so the tab stays responsive while
|
|
5
|
+
* Lastro takes its time. Slow is the product; a frozen tab is not.
|
|
4
6
|
* The code is same-origin and built by Lastro. type="module" stays banned.
|
|
5
7
|
*/
|
|
6
8
|
;(function (g) {
|
|
7
9
|
// Some of the tiny packages assume Node: give them a global.
|
|
8
10
|
g.global = g.global || g
|
|
9
11
|
var cache = {}
|
|
12
|
+
var texts = {}
|
|
10
13
|
var manifest = null
|
|
11
14
|
var base = ''
|
|
12
15
|
function fetchText(url) {
|
|
@@ -16,13 +19,41 @@
|
|
|
16
19
|
if (x.status !== 200) throw new Error('Lastro: could not load ' + url + ' (' + x.status + ')')
|
|
17
20
|
return x.responseText
|
|
18
21
|
}
|
|
22
|
+
// One request at a time, asynchronously. Each response arrives in its own task, so the page can still paint and respond.
|
|
23
|
+
function fetchAsync(url, done) {
|
|
24
|
+
var x = new XMLHttpRequest()
|
|
25
|
+
x.open('GET', url, true)
|
|
26
|
+
x.onload = function () {
|
|
27
|
+
if (x.status !== 200) return done(new Error('Lastro: could not load ' + url + ' (' + x.status + ')'))
|
|
28
|
+
done(null, x.responseText)
|
|
29
|
+
}
|
|
30
|
+
x.onerror = function () { done(new Error('Lastro: could not load ' + url)) }
|
|
31
|
+
x.send(null)
|
|
32
|
+
}
|
|
33
|
+
function waterfall(urls, onEach, done) {
|
|
34
|
+
var i = 0
|
|
35
|
+
function next() {
|
|
36
|
+
if (i >= urls.length) return done(null)
|
|
37
|
+
var url = urls[i++]
|
|
38
|
+
fetchAsync(url, function (err, text) {
|
|
39
|
+
if (err) return done(err)
|
|
40
|
+
onEach(url, text, i, urls.length)
|
|
41
|
+
next()
|
|
42
|
+
})
|
|
43
|
+
}
|
|
44
|
+
next()
|
|
45
|
+
}
|
|
46
|
+
function progress(done, total) {
|
|
47
|
+
var el = document.querySelector && document.querySelector('#lastro-loading .ll-count')
|
|
48
|
+
if (el) el.textContent = 'Request ' + done.toLocaleString() + ' of ' + total.toLocaleString() + ', one at a time.'
|
|
49
|
+
}
|
|
19
50
|
function load(id) {
|
|
20
51
|
if (cache[id]) return cache[id].exports
|
|
21
52
|
var mod = manifest.modules[id]
|
|
22
53
|
if (!mod) throw new Error('Lastro: unknown module ' + id)
|
|
23
54
|
var module = { exports: {} }
|
|
24
55
|
cache[id] = module
|
|
25
|
-
var code = fetchText(base + '/m/' + mod.name + '?v=' + manifest.buildId)
|
|
56
|
+
var code = texts[id] != null ? texts[id] : fetchText(base + '/m/' + mod.name + '?v=' + manifest.buildId)
|
|
26
57
|
var fn = new Function('module', 'exports', 'require', code + '\n//# sourceURL=lastro://' + mod.name)
|
|
27
58
|
fn.call(module.exports, module, module.exports, function (spec) {
|
|
28
59
|
var target = mod.deps[spec]
|
|
@@ -35,12 +66,29 @@
|
|
|
35
66
|
g.__lastro = {
|
|
36
67
|
boot: function (routeBase, entryId) {
|
|
37
68
|
base = routeBase
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
69
|
+
fetchAsync(routeBase + '/modules.json', function (err, json) {
|
|
70
|
+
if (err) throw err
|
|
71
|
+
manifest = JSON.parse(json)
|
|
72
|
+
var ids = Object.keys(manifest.modules)
|
|
73
|
+
var urls = []
|
|
74
|
+
var real = {}
|
|
75
|
+
for (var j = 0; j < ids.length; j++) {
|
|
76
|
+
var u = routeBase + '/m/' + manifest.modules[ids[j]].name + '?v=' + manifest.buildId
|
|
77
|
+
real[u] = ids[j]
|
|
78
|
+
urls.push(u)
|
|
79
|
+
}
|
|
80
|
+
waterfall(
|
|
81
|
+
urls,
|
|
82
|
+
function (url, text, done, total) {
|
|
83
|
+
if (real[url] !== undefined) texts[real[url]] = text
|
|
84
|
+
progress(done, total)
|
|
85
|
+
},
|
|
86
|
+
function (err2) {
|
|
87
|
+
if (err2) throw err2
|
|
88
|
+
load(entryId)
|
|
89
|
+
}
|
|
90
|
+
)
|
|
91
|
+
})
|
|
44
92
|
},
|
|
45
93
|
}
|
|
46
94
|
})(window)
|
package/src/server/app.js
CHANGED
|
@@ -49,7 +49,7 @@ function createApp({ distDir }) {
|
|
|
49
49
|
|
|
50
50
|
const jact = fromApp('@maxwellcohen/lastro/jact')
|
|
51
51
|
const { renderToString, renderToStaticMarkup } = jact
|
|
52
|
-
const { renderHead
|
|
52
|
+
const { renderHead } = fromApp('@maxwellcohen/lastro/head')
|
|
53
53
|
const { encode } = fromApp('@maxwellcohen/lastro/serializer')
|
|
54
54
|
const { thoroughClone, mustMatch } = fromApp('@maxwellcohen/lastro/thoroughness')
|
|
55
55
|
const telemetry = fromApp('@maxwellcohen/lastro/telemetry')
|
|
@@ -110,7 +110,7 @@ function createApp({ distDir }) {
|
|
|
110
110
|
// Lastro Analytics lives on a different origin, for isolation (and so that it can be someone else's problem).
|
|
111
111
|
const alt = altOrigin(request)
|
|
112
112
|
const scripts = alt ? [...route.scripts, `${alt}/_lastro/shared/analytics.js`] : route.scripts
|
|
113
|
-
const head = renderHead({ title:
|
|
113
|
+
const head = renderHead({ title: 'Lastro', styles: route.styles, scripts, version: v })
|
|
114
114
|
let html = template
|
|
115
115
|
.replace('{{HEAD}}', () => head)
|
|
116
116
|
.replace('{{LOGO}}', `/_lastro/shared/logo.png?v=${v}`)
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
#lastro-loading .ll-title{margin:0;font-size:20px;font-weight:600}
|
|
14
14
|
#lastro-loading .ll-bar{position:relative;width:min(320px,80vw);height:6px;border-radius:3px;background:var(--ll-track);overflow:hidden}
|
|
15
15
|
#lastro-loading .ll-bar::before{content:"";position:absolute;inset:0;width:40%;border-radius:3px;background:var(--ll-accent);animation:ll-progress 1.6s ease-in-out infinite}
|
|
16
|
+
#lastro-loading .ll-count{margin:0;font-size:13px;color:var(--ll-muted);font-variant-numeric:tabular-nums}
|
|
16
17
|
#lastro-loading .ll-tips{position:relative;width:min(420px,90vw);height:3em;color:var(--ll-muted);font-size:14px}
|
|
17
18
|
#lastro-loading .ll-tips span{position:absolute;inset:0;opacity:0;animation:ll-tip 20s linear infinite}
|
|
18
19
|
#lastro-loading .ll-tips span:nth-child(2){animation-delay:4s}
|
|
@@ -30,6 +31,7 @@
|
|
|
30
31
|
<div class="ll-snail" aria-hidden="true">🐌</div>
|
|
31
32
|
<p class="ll-title">Loading Lastro… thoroughly.</p>
|
|
32
33
|
<div class="ll-bar" aria-hidden="true"></div>
|
|
34
|
+
<p class="ll-count" aria-hidden="true">Request 0 of many, one at a time.</p>
|
|
33
35
|
<div class="ll-tips">
|
|
34
36
|
<span>Polyfilling Array.prototype.map for a browser that already has it.</span>
|
|
35
37
|
<span>Reticulating left-pads.</span>
|