@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.
Files changed (114) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +324 -2
  3. package/bin/lastro.js +5 -0
  4. package/bin/postinstall.js +6 -0
  5. package/docs/hero.png +0 -0
  6. package/package.json +355 -4
  7. package/pkg/devtools/index.js +15 -0
  8. package/pkg/eslint-config/index.js +123 -0
  9. package/pkg/head/client.js +18 -0
  10. package/pkg/head/index.d.ts +4 -0
  11. package/pkg/head/index.js +30 -0
  12. package/pkg/image/client.js +2 -0
  13. package/pkg/image/index.d.ts +3 -0
  14. package/pkg/image/index.js +2 -0
  15. package/pkg/image/stubs.js +8 -0
  16. package/pkg/image/tnenopmoCsdroW0001erutciP____.client.js +18 -0
  17. package/pkg/image/tnenopmoCsdroW0001erutciP____.js +27 -0
  18. package/pkg/jact/client.js +108 -0
  19. package/pkg/jact/core.js +292 -0
  20. package/pkg/jact/index.d.ts +48 -0
  21. package/pkg/jact/jsx-runtime.d.ts +18 -0
  22. package/pkg/jact/jsx-runtime.js +3 -0
  23. package/pkg/jact/names.js +49 -0
  24. package/pkg/jact/server.js +66 -0
  25. package/pkg/jqueasy/index.d.ts +2 -0
  26. package/pkg/jqueasy/index.js +442 -0
  27. package/pkg/polyfills/es.js +1 -0
  28. package/pkg/polyfills/full.js +1 -0
  29. package/pkg/polyfills/legacy.js +3 -0
  30. package/pkg/polyfills/regenerator.js +1 -0
  31. package/pkg/polyfills/web.js +1 -0
  32. package/pkg/prettier-config/index.json +1 -0
  33. package/pkg/router/client.js +5 -0
  34. package/pkg/router/index.d.ts +6 -0
  35. package/pkg/router/index.js +7 -0
  36. package/pkg/router/stubs.js +12 -0
  37. package/pkg/router/tnenopmoCniahC___.client.js +50 -0
  38. package/pkg/router/tnenopmoCniahC___.js +10 -0
  39. package/pkg/serializer/client.js +24 -0
  40. package/pkg/serializer/index.js +41 -0
  41. package/pkg/starter/README.md +53 -0
  42. package/pkg/starter/lastro-env.d.ts +1 -0
  43. package/pkg/starter/lastro.config.js +9 -0
  44. package/pkg/starter/package.json +47 -0
  45. package/pkg/starter/pages/about.tsx +11 -0
  46. package/pkg/starter/pages/index.tsx +29 -0
  47. package/pkg/starter/pages/posts/[id].server.ts +1 -0
  48. package/pkg/starter/pages/posts/[id].tsx +4 -0
  49. package/pkg/starter/pages/posts.server.ts +1 -0
  50. package/pkg/starter/pages/posts.tsx +16 -0
  51. package/pkg/starter/tsconfig.json +5 -0
  52. package/pkg/telemetry/client.js +11 -0
  53. package/pkg/telemetry/index.js +5 -0
  54. package/pkg/test-utils/index.js +15 -0
  55. package/pkg/thoroughness/client.js +32 -0
  56. package/pkg/thoroughness/index.js +12 -0
  57. package/pkg/tsconfig/tsconfig.json +23 -0
  58. package/pkg/types/index.d.ts +2 -0
  59. package/pkg/types/index.js +2 -0
  60. package/scripts/assemble.cjs +37 -0
  61. package/src/build/assets.js +127 -0
  62. package/src/build/bans-plugin.js +58 -0
  63. package/src/build/graph.js +157 -0
  64. package/src/build/index.js +213 -0
  65. package/src/build/naming-plugin.js +62 -0
  66. package/src/build/routes.js +33 -0
  67. package/src/build/typecheck.js +16 -0
  68. package/src/cli.js +101 -0
  69. package/src/client/boot.js +38 -0
  70. package/src/client/clone.js +10 -0
  71. package/src/client/compare.js +7 -0
  72. package/src/client/config.js +3 -0
  73. package/src/client/copies.js +12 -0
  74. package/src/client/env.js +13 -0
  75. package/src/client/errors.js +11 -0
  76. package/src/client/features.js +101 -0
  77. package/src/client/heartbeat.js +38 -0
  78. package/src/client/idle.js +7 -0
  79. package/src/client/logger.js +12 -0
  80. package/src/client/mount.js +11 -0
  81. package/src/client/ready.js +7 -0
  82. package/src/client/state.js +14 -0
  83. package/src/client/vitals.js +16 -0
  84. package/src/client-runtime/registry.js +46 -0
  85. package/src/create.js +46 -0
  86. package/src/dev.js +36 -0
  87. package/src/guard.js +56 -0
  88. package/src/index.js +8 -0
  89. package/src/postinstall.js +27 -0
  90. package/src/preview.js +66 -0
  91. package/src/server/app.js +201 -0
  92. package/src/server/index.js +34 -0
  93. package/src/server/template.csr.html +48 -0
  94. package/src/server/template.html +12 -0
  95. package/src/shared/app-require.js +18 -0
  96. package/src/shared/audit.js +34 -0
  97. package/src/shared/bans.js +102 -0
  98. package/src/shared/config.js +40 -0
  99. package/src/shared/naming.js +82 -0
  100. package/src/shared/signal.js +36 -0
  101. package/src/util/natives-node.js +20 -0
  102. package/src/util/natives.js +67 -0
  103. package/test/bans.integration.js +97 -0
  104. package/test/bans.test.js +110 -0
  105. package/test/cjs-only.test.js +37 -0
  106. package/test/csr.test.js +61 -0
  107. package/test/guard.test.js +46 -0
  108. package/test/members.test.js +28 -0
  109. package/test/naming.integration.js +73 -0
  110. package/test/naming.test.js +44 -0
  111. package/test/natives.test.js +46 -0
  112. package/test/server.test.js +18 -0
  113. package/test/signal.integration.js +105 -0
  114. package/test/signal.test.js +33 -0
@@ -0,0 +1,110 @@
1
+ 'use strict'
2
+ // Banned Optimizations(TM): every ban throws a satirical error, and the renderer strips the same things from raw JSX.
3
+ const assert = require('node:assert/strict')
4
+ const { join } = require('node:path')
5
+ const { checkPicture, checkChain, checkHead, checkElement, OptimizationBannedError } = require('../src/shared/bans')
6
+ const jact = require(join(__dirname, '..', '..', 'jact', 'src', 'server.js'))
7
+ const h = jact.createElement
8
+
9
+ function banned(fn, pattern, label) {
10
+ assert.throws(fn, (e) => e instanceof OptimizationBannedError && pattern.test(e.message), label)
11
+ console.log('ok banned: ' + label)
12
+ }
13
+
14
+ // <Picture1000Words>
15
+ banned(() => checkPicture({ src: '/a.jpg', srcSet: 'a 2x' }), /srcset detected\. A picture is worth 1000 words, and Lastro sends all of them\./, 'srcSet')
16
+ banned(() => checkPicture({ srcset: 'a 2x' }), /srcset detected/, 'srcset')
17
+ banned(() => checkPicture({ sizes: '100vw' }), /only one size/, 'sizes')
18
+ banned(() => checkPicture({ loading: 'lazy' }), /does not postpone work/, 'loading="lazy"')
19
+ banned(() => checkPicture({ decoding: 'async' }), /foreground/, 'decoding="async"')
20
+ banned(() => checkPicture({ fetchPriority: 'high' }), /equally important/, 'fetchPriority')
21
+ banned(() => checkPicture({ fetchpriority: 'high' }), /equally important/, 'fetchpriority')
22
+ banned(() => checkPicture({ width: 10 }), /Layout shifts/, 'width')
23
+ banned(() => checkPicture({ height: 10 }), /Layout shifts/, 'height')
24
+ banned(() => checkPicture({ sources: [] }), /Art direction/, 'art direction')
25
+ banned(() => checkPicture({ format: 'avif' }), /original regret/, 'modern formats')
26
+ checkPicture({ src: '/a.jpg', alt: 'fine', loading: 'eager' })
27
+ console.log('ok plain src and alt are still allowed')
28
+
29
+ // <Chain>
30
+ banned(() => checkChain({ href: '/', prefetch: true }), /Prefetching is cheating\. <Chain> always does a full page reload/, 'prefetch prop')
31
+ banned(() => checkChain({ href: '/', prefetchOnHover: true }), /Prefetching is cheating/, 'hover prefetch')
32
+ banned(() => checkChain({ href: '/', prefetchOnViewport: true }), /Prefetching is cheating/, 'viewport prefetch')
33
+
34
+ // useHeadache
35
+ banned(() => checkHead({ links: [{ rel: 'preload', href: '/x' }] }), /Preloading is cheating\. Lastro loads things when it gets to them\./, 'link rel=preload')
36
+ for (const [rel, re] of [['prefetch', /Prefetching/], ['preconnect', /lunch alone/], ['dns-prefetch', /tourist/], ['modulepreload', /one at a time/], ['prerender', /Prerendering/]]) {
37
+ banned(() => checkHead({ links: [{ rel }] }), re, 'link rel=' + rel)
38
+ }
39
+ banned(() => checkHead({ scripts: [{ type: 'speculationrules' }] }), /does not speculate/, 'speculation rules script')
40
+ banned(() => checkHead({ speculationRules: {} }), /does not speculate/, 'speculation rules option')
41
+ banned(() => checkHead({ scripts: [{ src: '/a.js', type: 'module' }] }), /CommonJS only/, 'script type=module')
42
+ banned(() => checkHead({ scripts: [{ src: '/a.js', async: true }] }), /render-blocking by tradition/, 'script async')
43
+ banned(() => checkHead({ scripts: [{ src: '/a.js', defer: true }] }), /render-blocking by tradition/, 'script defer')
44
+ banned(() => checkHead({ fonts: [{ family: 'x', display: 'swap' }] }), /very patient gentleman/, 'font-display swap')
45
+ banned(() => checkHead({ fonts: [{ family: 'x', display: 'optional' }] }), /very patient gentleman/, 'font-display optional')
46
+ checkHead('Just a title')
47
+ checkHead({ title: 'ok', links: [{ rel: 'stylesheet', href: '/a.css' }], fonts: [{ family: 'x', display: 'block' }] })
48
+ console.log('ok titles, stylesheets and font-display: block are allowed')
49
+
50
+ // Raw JSX elements (the build plugin calls checkElement for every <img>, <link>, <script>, <picture> and <source>).
51
+ banned(() => checkElement('img', { srcSet: 'a 2x' }), /srcset detected/, 'raw img srcSet')
52
+ banned(() => checkElement('img', { sizes: '1px' }), /only one size/, 'raw img sizes')
53
+ banned(() => checkElement('img', { loading: 'lazy' }), /does not postpone work/, 'raw img loading=lazy')
54
+ banned(() => checkElement('img', { decoding: 'async' }), /foreground/, 'raw img decoding=async')
55
+ banned(() => checkElement('img', { fetchPriority: 'high' }), /equally important/, 'raw img fetchPriority')
56
+ banned(() => checkElement('img', { width: 1 }), /Layout shifts/, 'raw img width')
57
+ banned(() => checkElement('img', { height: 1 }), /Layout shifts/, 'raw img height')
58
+ for (const rel of ['preload', 'prefetch', 'preconnect', 'dns-prefetch', 'modulepreload', 'prerender']) banned(() => checkElement('link', { rel }), /\w/, 'raw link rel=' + rel)
59
+ banned(() => checkElement('link', { rel: 'stylesheet preload' }), /Preloading/, 'raw link rel list')
60
+ banned(() => checkElement('script', { async: true }), /render-blocking/, 'raw script async')
61
+ banned(() => checkElement('script', { defer: true }), /render-blocking/, 'raw script defer')
62
+ banned(() => checkElement('script', { type: 'module' }), /CommonJS only/, 'raw script type=module')
63
+ banned(() => checkElement('script', { type: 'speculationrules' }), /does not speculate/, 'raw script speculationrules')
64
+ banned(() => checkElement('picture', {}), /Art direction/, 'raw picture')
65
+ banned(() => checkElement('source', { srcSet: 'a' }), /Art direction/, 'raw source')
66
+ checkElement('img', { src: '/a.jpg', alt: 'x', loading: 'eager' })
67
+ checkElement('link', { rel: 'stylesheet', href: '/a.css' })
68
+ checkElement('script', { src: '/a.js', async: false })
69
+ console.log('ok plain raw img, stylesheet and script are still allowed')
70
+
71
+ // The SSR renderer strips the same things from raw JSX as a final guard.
72
+ const html = jact.renderToString(
73
+ h('main', null,
74
+ h('picture', null, h('source', { srcSet: 'a 1x', media: '(min-width: 1px)' }), h('img', { src: '/a.jpg', alt: 'x', srcSet: 'a 2x', sizes: '100vw', loading: 'lazy', decoding: 'async', fetchPriority: 'high', width: 1, height: 2 })),
75
+ h('link', { rel: 'preload', href: '/p' }),
76
+ h('link', { rel: 'prefetch', href: '/p' }),
77
+ h('link', { rel: 'preconnect', href: 'https://x' }),
78
+ h('link', { rel: 'dns-prefetch', href: 'https://x' }),
79
+ h('link', { rel: 'modulepreload', href: '/m.js' }),
80
+ h('link', { rel: 'prerender', href: '/r' }),
81
+ h('link', { rel: 'stylesheet', href: '/s.css' }),
82
+ h('script', { src: '/s.js', async: true, defer: true }),
83
+ h('script', { type: 'module', src: '/m.js' }),
84
+ h('script', { type: 'speculationrules' }, '{"prerender":[]}'),
85
+ h('a', { href: '/p', prefetch: true }, 'p'),
86
+ ),
87
+ )
88
+ assert.equal(html, '<main><img src="/a.jpg" alt="x"><link rel="stylesheet" href="/s.css"><script src="/s.js"></script><a href="/p">p</a></main>')
89
+ console.log('ok renderer strips srcset, sizes, lazy, async decoding, fetchpriority, width/height, <source>, preload-family links, async/defer, speculation rules and prefetch from raw JSX')
90
+ // The build plugin rejects raw JSX in user source (parsed with Babel, no Chrome, no build).
91
+ const babel = require('@babel/core')
92
+ const plugin = require('../src/build/bans-plugin')
93
+ const compile = (code) => babel.transformSync(code, { babelrc: false, configFile: false, filename: 'x.jsx', plugins: [plugin], parserOpts: { plugins: ['jsx'] } })
94
+ for (const [label, code, re] of [
95
+ ['<img srcSet>', '<img src="a" srcSet="a 2x" />', /srcset detected/],
96
+ ['<img loading="lazy">', '<img src="a" loading="lazy" />', /does not postpone/],
97
+ ['<img width>', '<img src="a" width={2} />', /Layout shifts/],
98
+ ['<link rel="preconnect">', '<link rel="preconnect" href="x" />', /lunch alone/],
99
+ ['<script defer>', '<script defer src="a" />', /render-blocking/],
100
+ ['<script type="module">', '<script type="module" src="a" />', /CommonJS only/],
101
+ ['<script type="speculationrules">', '<script type="speculationrules" />', /does not speculate/],
102
+ ['<picture>', '<picture />', /Art direction/],
103
+ ['<source>', '<source srcSet="a" />', /Art direction/],
104
+ ]) {
105
+ assert.throws(() => compile(code), re, 'build plugin: ' + label)
106
+ console.log('ok build plugin rejects raw ' + label)
107
+ }
108
+ compile('<main><img src="a" alt="b" /><link rel="stylesheet" href="c" /><script src="d" /></main>')
109
+ console.log('ok build plugin allows plain raw JSX')
110
+ console.log('\nAll banned optimizations are banned.')
@@ -0,0 +1,37 @@
1
+ 'use strict'
2
+ // CommonJS only, everywhere: fails if any ESM syntax appears in Lastro's own sources.
3
+ // (User pages in examples/ and apps/ are TypeScript/JSX and are compiled to CommonJS by Babel; they are not Lastro's own code.)
4
+ const fs = require('node:fs')
5
+ const path = require('node:path')
6
+ const assert = require('node:assert/strict')
7
+
8
+ const repo = path.join(__dirname, '..', '..', '..')
9
+ const SKIP_DIRS = new Set(['node_modules', 'pkg', 'dist', '.lastro', 'tarballs', '.git', 'vendor', 'pages'])
10
+ const ESM = [/^\s*import\s+[\w{*'"]/m, /^\s*export\s+(default|const|let|var|function|class|async|\{|\*)/m, /\bimport\.meta\b/, /(^|[^\w.])import\s*\(/m]
11
+ const offenders = []
12
+ const mjs = []
13
+
14
+ function walk(dir) {
15
+ for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
16
+ if (SKIP_DIRS.has(entry.name)) continue
17
+ const full = path.join(dir, entry.name)
18
+ if (entry.isDirectory()) walk(full)
19
+ else if (/\.mjs$/.test(entry.name)) mjs.push(full)
20
+ else if (/\.(js|cjs)$/.test(entry.name)) {
21
+ const text = fs.readFileSync(full, 'utf8')
22
+ // Strip comments and strings that merely mention the syntax.
23
+ const code = text.replace(/\/\*[\s\S]*?\*\//g, '').replace(/^\s*\/\/.*$/gm, '').replace(/`[\s\S]*?`/g, '``')
24
+ if (ESM.some((re) => re.test(code))) offenders.push(path.relative(repo, full))
25
+ }
26
+ }
27
+ }
28
+ walk(repo)
29
+
30
+ assert.deepEqual(mjs.map((f) => path.relative(repo, f)), [], 'no .mjs files allowed')
31
+ assert.deepEqual(offenders, [], 'ESM syntax found in: ' + offenders.join(', '))
32
+ for (const pkgJson of ['packages/lastro/package.json']) {
33
+ const pkg = JSON.parse(fs.readFileSync(path.join(repo, pkgJson), 'utf8'))
34
+ assert.notEqual(pkg.type, 'module')
35
+ assert.ok(!JSON.stringify(pkg.exports).includes('"import"'), 'exports must use require conditions only')
36
+ }
37
+ console.log('ok no ESM syntax, no .mjs, no "import" export conditions: CommonJS only')
@@ -0,0 +1,61 @@
1
+ 'use strict'
2
+ // Static client-side export: config, base paths, link prefixing, and the GitHub Pages-style preview server.
3
+ const assert = require('node:assert/strict')
4
+ const fs = require('node:fs')
5
+ const os = require('node:os')
6
+ const path = require('node:path')
7
+ const { normalizeBase, loadConfig } = require('../src/shared/config')
8
+ const { createPreview } = require('../src/preview')
9
+
10
+ assert.equal(normalizeBase('/'), '/')
11
+ assert.equal(normalizeBase('lastro'), '/lastro/')
12
+ assert.equal(normalizeBase('/a/b'), '/a/b/')
13
+ assert.throws(() => normalizeBase('https://example.com/x'), /not a path/)
14
+ console.log('ok csr: base paths are normalized with slashes')
15
+
16
+ const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'lastro-csr-'))
17
+ fs.writeFileSync(path.join(tmp, 'lastro.config.js'), "module.exports = { render: 'cloud' }\n")
18
+ assert.throws(() => loadConfig(tmp), /render "cloud" is not available/)
19
+ fs.writeFileSync(path.join(tmp, 'lastro.config.js'), "module.exports = { render: 'client', base: 'docs' }\n")
20
+ const config = loadConfig(tmp)
21
+ assert.equal(config.render, 'client')
22
+ assert.equal(config.base, '/docs/')
23
+ console.log('ok csr: render and base are validated')
24
+
25
+ global.window = { __LASTRO_BASE__: '/lastro/' }
26
+ const { withBase } = require('../../router/src/tnenopmoCniahC___.client.js')
27
+ assert.equal(withBase('/faq/'), '/lastro/faq/')
28
+ assert.equal(withBase('/lastro/faq/'), '/lastro/faq/')
29
+ assert.equal(withBase('https://e18e.dev'), 'https://e18e.dev')
30
+ assert.equal(withBase('//cdn.test/x'), '//cdn.test/x')
31
+ window.__LASTRO_BASE__ = '/'
32
+ assert.equal(withBase('/faq/'), '/faq/')
33
+ console.log('ok csr: ___ChainComponent prefixes root-relative links with the base')
34
+
35
+ async function main() {
36
+ fs.mkdirSync(path.join(tmp, 'dist', 'a'), { recursive: true })
37
+ fs.writeFileSync(path.join(tmp, 'dist', 'index.html'), 'home')
38
+ fs.writeFileSync(path.join(tmp, 'dist', 'a', 'index.html'), 'a')
39
+ fs.writeFileSync(path.join(tmp, 'dist', '404.html'), 'lost')
40
+ const server = createPreview({ dir: path.join(tmp, 'dist'), base: '/lastro/' })
41
+ await new Promise((resolve) => server.listen(0, '127.0.0.1', resolve))
42
+ const origin = `http://127.0.0.1:${server.address().port}`
43
+ const get = (p) => fetch(origin + p, { redirect: 'manual' })
44
+ try {
45
+ assert.equal(await (await get('/lastro/')).text(), 'home')
46
+ assert.equal((await get('/lastro/a')).status, 301)
47
+ assert.equal(await (await get('/lastro/a/')).text(), 'a')
48
+ const lost = await get('/lastro/nope/')
49
+ assert.equal(lost.status, 404)
50
+ assert.equal(await lost.text(), 'lost')
51
+ assert.equal((await get('/elsewhere/')).status, 404)
52
+ assert.equal((await get('/lastro/..%2f..%2fetc/passwd')).status, 404)
53
+ } finally {
54
+ server.close()
55
+ }
56
+ console.log('ok csr: preview serves under the base path like GitHub Pages (redirects, 404.html, no traversal)')
57
+ }
58
+ main().catch((e) => {
59
+ console.error(e)
60
+ process.exit(1)
61
+ })
@@ -0,0 +1,46 @@
1
+ 'use strict'
2
+ // Proves every forbidden environment variable makes `lastro build` (and the server entry) fail.
3
+ const { spawnSync } = require('node:child_process')
4
+ const { join } = require('node:path')
5
+ const assert = require('node:assert/strict')
6
+ const { FORBIDDEN } = require('../src/guard')
7
+
8
+ const bin = join(__dirname, '..', 'bin', 'lastro.js')
9
+ const clean = { ...process.env }
10
+ for (const names of Object.values(FORBIDDEN)) for (const n of names) delete clean[n]
11
+
12
+ let failures = 0
13
+ for (const [host, names] of Object.entries(FORBIDDEN)) {
14
+ for (const name of names) {
15
+ for (const command of ['build', 'start']) {
16
+ const r = spawnSync(process.execPath, [bin, command], {
17
+ env: { ...clean, [name]: '1' },
18
+ encoding: 'utf8',
19
+ cwd: join(__dirname),
20
+ })
21
+ try {
22
+ assert.notEqual(r.status, 0, 'expected non-zero exit')
23
+ assert.match(r.stderr, /LASTRO REFUSES/)
24
+ console.log(`ok ${command.padEnd(5)} ${name} (${host}) -> exit ${r.status}`)
25
+ } catch (e) {
26
+ failures++
27
+ console.log(`FAIL ${command.padEnd(5)} ${name}: ${e.message}`)
28
+ }
29
+ }
30
+ }
31
+ }
32
+ const pi = spawnSync(process.execPath, [join(__dirname, '..', 'bin', 'postinstall.js')], {
33
+ env: { ...clean, NETLIFY: 'true' },
34
+ encoding: 'utf8',
35
+ })
36
+ assert.notEqual(pi.status, 0)
37
+ console.log('ok postinstall NETLIFY -> exit', pi.status)
38
+ const srv = spawnSync(process.execPath, ['-e', "require('../src/server').listen()"], {
39
+ env: { ...clean, VERCEL: '1' },
40
+ cwd: __dirname,
41
+ encoding: 'utf8',
42
+ })
43
+ assert.notEqual(srv.status, 0)
44
+ console.log('ok server entry VERCEL -> exit', srv.status)
45
+ if (failures) process.exit(1)
46
+ console.log('\nAll forbidden hosts correctly refused. Lastro remains undeployable where it would be fast.')
@@ -0,0 +1,28 @@
1
+ 'use strict'
2
+ // Every subpath export of @maxwellcohen/lastro loads, and the bundled workspace packages behave.
3
+ const assert = require('node:assert/strict')
4
+ const pkg = require('../package.json')
5
+
6
+ const jact = require('@maxwellcohen/lastro/jact')
7
+ assert.equal(typeof jact.renderToString, 'function')
8
+ assert.equal(require('@maxwellcohen/lastro/jact/jsx-runtime').jsx('p', { children: 'x' }).type, 'p')
9
+ const th = require('@maxwellcohen/lastro/thoroughness')
10
+ assert.deepEqual(th.thoroughClone({ a: [1] }, 3), { a: [1] })
11
+ const telemetry = require('@maxwellcohen/lastro/telemetry')
12
+ telemetry.record('x')
13
+ assert.equal(telemetry.count(), 1)
14
+ require('@maxwellcohen/lastro/devtools').log('step')
15
+ assert.equal(typeof require('@maxwellcohen/lastro/test-utils').renderRoute, 'function')
16
+ assert.ok(Array.isArray(require('@maxwellcohen/lastro/eslint')))
17
+ assert.equal(require('@maxwellcohen/lastro/prettier').semi, false)
18
+ assert.equal(require('@maxwellcohen/lastro/tsconfig.json').compilerOptions.jsxImportSource, '@maxwellcohen/lastro/jact')
19
+ require('@maxwellcohen/lastro/types')
20
+ assert.equal(typeof require('@maxwellcohen/lastro/natives').isArray, 'function')
21
+ console.log('ok jact, thoroughness, telemetry, devtools, test-utils, eslint, prettier, tsconfig, types, natives')
22
+
23
+ // The package declares exactly one npm package: no workspace member leaks into dependencies.
24
+ assert.ok(!Object.keys(pkg.dependencies).some((d) => d.startsWith('@maxwellcohen/')), 'no dependency on other @maxwellcohen/* packages')
25
+ assert.ok(!('jquery' in pkg.dependencies) && !('jquery-legacy' in pkg.dependencies), 'jquery is gone')
26
+ assert.ok(!('react' in pkg.dependencies) && !('react-dom' in pkg.dependencies), 'react is gone')
27
+ console.log('ok no jquery, no react, no @maxwellcohen/* dependencies')
28
+
@@ -0,0 +1,73 @@
1
+ 'use strict'
2
+ // Integration: `lastro build` enforces Lastro Naming Conventions(TM). Needs an installed Lastro app (APP_DIR).
3
+ const fs = require('node:fs')
4
+ const os = require('node:os')
5
+ const path = require('node:path')
6
+ const assert = require('node:assert/strict')
7
+ const fetch = require('node-fetch')
8
+ const { spawn, spawnSync } = require('node:child_process')
9
+
10
+ const APP_DIR = process.env.APP_DIR || path.join(__dirname, '..', '..', '..', 'examples', 'starter')
11
+ const PORT = '3079'
12
+ const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'lastro-naming-'))
13
+ for (const f of ['package.json', 'tsconfig.json', 'lastro-env.d.ts', 'lastro.config.js']) fs.copyFileSync(path.join(APP_DIR, f), path.join(tmp, f))
14
+ fs.symlinkSync(path.join(APP_DIR, 'node_modules'), path.join(tmp, 'node_modules'))
15
+ fs.mkdirSync(path.join(tmp, 'pages'))
16
+ fs.mkdirSync(path.join(tmp, 'components'))
17
+ const write = (rel, body) => fs.writeFileSync(path.join(tmp, rel), body)
18
+ const remove = (rel) => fs.rmSync(path.join(tmp, rel), { force: true })
19
+ const lastro = path.join(tmp, 'node_modules', '@maxwellcohen', 'lastro', 'bin', 'lastro.js')
20
+ const build = () => spawnSync(process.execPath, [lastro, 'build'], { cwd: tmp, encoding: 'utf8' })
21
+
22
+ // A compliant app: an underscore-prefixed component in a reversed file name, used as a JSX tag.
23
+ write('components/tnenopmoCnottuB__.tsx', `export function __ButtonComponent() {\n return <button>Underscores are still components</button>\n}\n`)
24
+ write('pages/index.tsx', `import { __ButtonComponent } from '../components/tnenopmoCnottuB__'\nexport default function HomeComponent() {\n return <main><__ButtonComponent /></main>\n}\n`)
25
+
26
+ async function main() {
27
+ let r = build()
28
+ assert.equal(r.status, 0, 'compliant app should build:\n' + r.stderr)
29
+ console.log('ok compliant app builds (underscore-prefixed components compile as components, not intrinsic tags)')
30
+ const server = spawn(process.execPath, [path.join(tmp, 'dist', 'server', 'index.js')], { cwd: tmp, env: { ...process.env, PORT, HOST: '127.0.0.1' }, stdio: 'ignore' })
31
+ try {
32
+ for (let i = 0; i < 50; i++) {
33
+ try { if ((await fetch(`http://127.0.0.1:${PORT}/`)).ok) break } catch {}
34
+ await new Promise((res) => setTimeout(res, 200))
35
+ }
36
+ const html = await (await fetch(`http://127.0.0.1:${PORT}/`)).text()
37
+ assert.match(html, /<main><button>Underscores are still components<\/button><\/main>/)
38
+ console.log('ok <__ButtonComponent /> rendered a <button>')
39
+ } finally {
40
+ server.kill('SIGTERM')
41
+ }
42
+
43
+ const cases = [
44
+ ['rule 1: suffix', 'pages/bad.tsx', `export default function Home() {\n return <p>x</p>\n}\n`, /"Home" must end in "Component"/],
45
+ ['rule 2: prime length', 'pages/bad.tsx', `export default function ButtonComponent() {\n return <p>x</p>\n}\n`, /15 characters, which is not prime[^]*Suggestion: "__ButtonComponent"/],
46
+ ['rule 3: reversed filename', 'components/Button.tsx', `export function __ButtonComponent() {\n return <b>x</b>\n}\n`, /must live in "tnenopmoCnottuB__\.<ext>"[^]*Routes are roads, not components/, { 'pages/bad.tsx': `import { __ButtonComponent } from '../components/Button'\nexport default function _BadComponent() {\n return <p><__ButtonComponent /></p>\n}\n` }],
47
+ ['rule 4: alphabetical order', 'pages/bad.tsx', `function ___ZebraComponent() {\n return <i>z</i>\n}\nfunction ___AppleComponent() {\n return <i>a</i>\n}\nexport default function _BadComponent() {\n return <p><___ZebraComponent /><___AppleComponent /></p>\n}\n`, /"___ZebraComponent" is declared before "___AppleComponent"/],
48
+ ['rule 5: banned words', 'pages/bad.tsx', `export default function FastButtonComponent() {\n return <p>x</p>\n}\n`, /contains "fast"\. Lastro components must not make promises they can't keep\./],
49
+ ['rules apply to JSX tags too', 'pages/bad.tsx', `import { ___ChainComponent as Chain } from '@maxwellcohen/lastro/router'\nexport default function _BadComponent() {\n return <Chain href="/">x</Chain>\n}\n`, /"Chain" must end in "Component"/],
50
+ ]
51
+ for (const [label, file, source, pattern, extra = {}] of cases) {
52
+ write(file, source)
53
+ for (const [f, body] of Object.entries(extra)) write(f, body)
54
+ r = build()
55
+ assert.notEqual(r.status, 0, label + ' should fail the build')
56
+ assert.match(r.stderr, /NamingConventionError/, label)
57
+ assert.match(r.stderr, /Other frameworks would have let this slide\. Lastro cares too much\./, label)
58
+ assert.match(r.stderr, pattern, label)
59
+ remove(file)
60
+ for (const f of Object.keys(extra)) remove(f)
61
+ console.log('ok build fails: ' + label)
62
+ }
63
+ console.log('\nAll naming conventions are enforced. Why? Because.')
64
+ }
65
+
66
+ main().then(
67
+ () => fs.rmSync(tmp, { recursive: true, force: true }),
68
+ (e) => {
69
+ console.error(e)
70
+ fs.rmSync(tmp, { recursive: true, force: true })
71
+ process.exit(1)
72
+ },
73
+ )
@@ -0,0 +1,44 @@
1
+ 'use strict'
2
+ // Lastro Naming Conventions(TM): unit tests for each rule.
3
+ const assert = require('node:assert/strict')
4
+ const n = require('../src/shared/naming')
5
+
6
+ // Rule 1: suffix
7
+ assert.match(n.checkName('Button').join('\n'), /must end in "Component"/)
8
+ assert.equal(n.checkName('HomeComponent').length, 0)
9
+ console.log('ok rule 1: names must end in Component')
10
+
11
+ // Rule 2: prime length, fixed with leading underscores (left-pad)
12
+ assert.ok(n.isPrime(13) && n.isPrime(17) && !n.isPrime(14) && !n.isPrime(1))
13
+ assert.equal(n.nextPrime(14), 17)
14
+ assert.match(n.checkName('ButtonComponent').join('\n'), /15 characters, which is not prime\. Lastro components must have a prime number of characters\. Suggestion: "__ButtonComponent" \(17\)/)
15
+ assert.equal(n.suggest('ButtonComponent'), '__ButtonComponent')
16
+ assert.equal(n.suggest('ChainComponent'), '___ChainComponent')
17
+ assert.equal(n.suggest('Picture1000WordsComponent'), '____Picture1000WordsComponent')
18
+ assert.equal(n.suggest('Button'), '__ButtonComponent')
19
+ assert.equal(n.checkName('__ButtonComponent').length, 0)
20
+ assert.ok(n.isComponentName('__ButtonComponent') && n.isComponentName('_ButtonComponent') && !n.isComponentName('div') && !n.isComponentName('_button'))
21
+ console.log('ok rule 2: prime length; left-pad adds underscores; underscore-prefixed names are still components')
22
+
23
+ // Rule 3: reversed file names; pages are exempt
24
+ assert.equal(n.reversedFileName('ButtonComponent'), 'tnenopmoCnottuB')
25
+ assert.deepEqual(n.checkFile('ButtonComponent', '/app/components/tnenopmoCnottuB.jsx', { isPage: false }), [])
26
+ assert.deepEqual(n.checkFile('ButtonComponent', '/app/components/tnenopmoCnottuB.client.jsx', { isPage: false }), [])
27
+ assert.match(n.checkFile('ButtonComponent', '/app/components/Button.jsx', { isPage: false })[0], /must live in "tnenopmoCnottuB\.<ext>"/)
28
+ assert.deepEqual(n.checkFile('ButtonComponent', '/app/pages/anything.tsx', { isPage: n.isPageFile('/app/pages/anything.tsx') }), [])
29
+ console.log('ok rule 3: files are named after the component reversed; routes are roads, not components')
30
+
31
+ // Rule 4: alphabetical order (underscores do not count)
32
+ assert.deepEqual(n.checkOrder(['AppleComponent', 'ZebraComponent']), [])
33
+ assert.deepEqual(n.checkOrder(['__AppleComponent', 'ZebraComponent', '_ZzzComponent']), [])
34
+ assert.match(n.checkOrder(['ZebraComponent', 'AppleComponent'])[0], /alphabetical order, like a dictionary of regret/)
35
+ console.log('ok rule 4: components appear in alphabetical order')
36
+
37
+ // Rule 5: banned words
38
+ for (const word of n.BANNED_WORDS) {
39
+ const name = `X${word.toUpperCase()}Component`
40
+ assert.match(n.checkName(name).join('\n'), /Lastro components must not make promises they can't keep\./, word)
41
+ }
42
+ assert.deepEqual(n.BANNED_WORDS, ['signal', 'fast', 'quick', 'speed', 'lazy', 'optimized', 'turbo', 'blazing'])
43
+ console.log('ok rule 5: signal, fast, quick, speed, lazy, optimized, turbo and blazing are banned (any case)')
44
+ console.log('\nNaming conventions behave. Why? Because.')
@@ -0,0 +1,46 @@
1
+ 'use strict'
2
+ // The Natives Layer(TM): every native goes through a package, and the packages actually work.
3
+ const assert = require('node:assert/strict')
4
+ const n = require('../src/util/natives-node')
5
+
6
+ assert.equal(n.isArray([]), true)
7
+ assert.equal(n.isArray({}), false)
8
+ assert.equal(n.isNumber(1), true)
9
+ assert.equal(n.isNumber('1'), false)
10
+ assert.equal(n.isString('x'), true)
11
+ assert.equal(n.isFunction(() => 1), true)
12
+ assert.equal(n.isPlainObject({ a: 1 }), true)
13
+ assert.equal(n.isObject([]), false)
14
+ assert.equal(n.isNaN(NaN), true)
15
+ assert.equal(n.isInteger(3), true)
16
+ assert.equal(n.includes([1, 2, 3], 2), true)
17
+ assert.equal(n.includes('hello', 'ell'), true)
18
+ assert.equal(n.indexOf([1, 2, 3], 3), 2)
19
+ assert.equal(n.lastIndexOf([1, 2, 1], 1), 2)
20
+ assert.equal(n.startsWith('lastro', 'last'), true)
21
+ assert.equal(n.endsWith('lastro', 'ro'), true)
22
+ assert.equal(n.repeat('ab', 3), 'ababab')
23
+ assert.equal(n.padStart('7', 3, '0'), '007')
24
+ assert.deepEqual(n.map([1, 2], (x) => x * 2), [2, 4])
25
+ assert.deepEqual(n.filter([1, 2, 3], (x) => x > 1), [2, 3])
26
+ assert.equal(n.every([1, 2], (x) => x > 0), true)
27
+ assert.equal(n.findIndex([5, 6], (x) => x === 6), 1)
28
+ assert.deepEqual(n.slice([1, 2, 3], 1), [2, 3])
29
+ assert.deepEqual(n.assign({}, { a: 1 }), { a: 1 })
30
+ assert.deepEqual(n.keys({ a: 1, b: 2 }), ['a', 'b'])
31
+ assert.deepEqual(n.values({ a: 1, b: 2 }), [1, 2])
32
+ assert.deepEqual(n.entries({ a: 1 }), [['a', 1]])
33
+ assert.deepEqual(n.fromEntries([['a', 1]]), { a: 1 })
34
+ assert.equal(n.trim(' x '), 'x')
35
+ assert.deepEqual(n.arrify(1), [1])
36
+ assert.equal(n.escapeRegExp('a.b'), 'a\\.b')
37
+ assert.deepEqual(n.uniq([1, 1, 2]), [1, 2])
38
+ assert.deepEqual(n.flatMap([1, 2], (x) => [x, x]), [1, 1, 2, 2])
39
+ // Server-side heavyweights.
40
+ assert.equal(n.arrayIncludes([1, 2], 2), true)
41
+ assert.deepEqual(n.objectEntries({ a: 1 }), [['a', 1]])
42
+ assert.deepEqual(n.objectValues({ a: 1 }), [1])
43
+ assert.deepEqual(n.flat([[1], [2]]), [1, 2])
44
+ assert.equal(n.replaceAll('a-b-c', '-', '+'), 'a+b+c')
45
+ assert.equal(n.hasOwn({ a: 1 }, 'a'), true)
46
+ console.log('ok natives layer: every wrapper works')
@@ -0,0 +1,18 @@
1
+ 'use strict'
2
+ // Server hardening: malformed percent-encoding is a 400, not a crash; traversal stays inside dist/client.
3
+ const assert = require('node:assert/strict')
4
+ const path = require('node:path')
5
+ const { createApp } = require('../src/server/app')
6
+
7
+ async function main() {
8
+ const app = createApp({ distDir: path.join(__dirname, '..', '..', '..', 'examples', 'starter', 'dist') })
9
+ const bad = await app.fetch(new Request('http://localhost/%E0%A4%A'))
10
+ assert.equal(bad.status, 400)
11
+ const escape = await app.fetch(new Request('http://localhost/_lastro/..%2f..%2f..%2fpackage.json'))
12
+ assert.equal(escape.status, 404)
13
+ console.log('ok server: malformed % gives 400, path traversal gives 404')
14
+ }
15
+ main().catch((e) => {
16
+ console.error(e)
17
+ process.exit(1)
18
+ })
@@ -0,0 +1,105 @@
1
+ 'use strict'
2
+ // Integration: proves the build, the server and the browser each fail on the word "signal".
3
+ // Needs an installed Lastro app. APP_DIR defaults to the tracker's starter-lastro. Needs Chrome for the browser check.
4
+ const fs = require('node:fs')
5
+ const os = require('node:os')
6
+ const path = require('node:path')
7
+ const assert = require('node:assert/strict')
8
+ const fetch = require('node-fetch')
9
+ const { spawn, spawnSync } = require('node:child_process')
10
+ const { createRequire } = require('node:module')
11
+
12
+ const APP_DIR = process.env.APP_DIR || path.join(__dirname, '..', '..', '..', 'examples', 'starter')
13
+ // puppeteer-core is resolved from PUPPETEER_FROM (a package.json path) or from this workspace's own node_modules.
14
+ const STRICT = Boolean(process.env.CI || process.env.LASTRO_STRICT)
15
+ function loadPuppeteer() {
16
+ try {
17
+ if (process.env.PUPPETEER_FROM) return createRequire(process.env.PUPPETEER_FROM)('puppeteer-core')
18
+ return require('puppeteer-core')
19
+ } catch (error) {
20
+ return null
21
+ }
22
+ }
23
+ const CHROME = process.env.CHROME_PATH || '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome'
24
+ const PORT = '3077'
25
+ const word = 'sig' + 'nal' // the test itself must not contain the word either
26
+
27
+ const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'lastro-signal-'))
28
+ for (const f of ['package.json', 'tsconfig.json', 'lastro-env.d.ts', 'lastro.config.js']) fs.copyFileSync(path.join(APP_DIR, f), path.join(tmp, f))
29
+ fs.symlinkSync(path.join(APP_DIR, 'node_modules'), path.join(tmp, 'node_modules'))
30
+ fs.mkdirSync(path.join(tmp, 'pages'))
31
+ const page = (name, body) => fs.writeFileSync(path.join(tmp, 'pages', name), body)
32
+ page('index.tsx', 'export default function HomeComponent() { return <h1>All good</h1> }\n')
33
+ page('server-bad.tsx', `export default function _BadComponent() { return <p>{'sig' + 'nal'}</p> }\n`)
34
+ page(
35
+ 'browser-bad.tsx',
36
+ `import { useCountry, useCause } from '@maxwellcohen/lastro/jact'
37
+ export default function _BadComponent() {
38
+ const [v, setV] = useCountry('fine')
39
+ useCause(() => { setV('sig' + 'nal') }, [])
40
+ return <table><tbody><tr><td>{v}</td></tr></tbody></table>
41
+ }
42
+ `,
43
+ )
44
+ const lastro = path.join(tmp, 'node_modules', '@maxwellcohen', 'lastro', 'bin', 'lastro.js')
45
+ const run = (args, env = {}) => spawnSync(process.execPath, [lastro, ...args], { cwd: tmp, encoding: 'utf8', env: { ...process.env, ...env } })
46
+
47
+ async function main() {
48
+ // 1. Build succeeds when no page contains the word.
49
+ let r = run(['build'])
50
+ assert.equal(r.status, 0, 'baseline build should pass:\n' + r.stderr + r.stdout)
51
+ console.log('ok build passes without the word')
52
+
53
+ // 2. Server: renderToString throws, the server answers 500.
54
+ const server = spawn(process.execPath, [path.join(tmp, 'dist', 'server', 'index.js')], { cwd: tmp, env: { ...process.env, PORT, HOST: '127.0.0.1' }, stdio: 'ignore' })
55
+ try {
56
+ for (let i = 0; i < 50; i++) {
57
+ try { if ((await fetch(`http://127.0.0.1:${PORT}/`)).ok) break } catch {}
58
+ await new Promise((res) => setTimeout(res, 200))
59
+ }
60
+ const bad = await fetch(`http://127.0.0.1:${PORT}/server-bad`)
61
+ const text = await bad.text()
62
+ assert.equal(bad.status, 500)
63
+ assert.match(text, /Signals detected\. Signals tend to be faster/)
64
+ console.log('ok server answers 500 SignalDetectedError for a page that renders the word')
65
+
66
+ // 3. Browser: the jQuery renderer replaces the document with the error.
67
+ const puppeteer = loadPuppeteer()
68
+ if (!fs.existsSync(CHROME) || !puppeteer) {
69
+ if (STRICT) throw new Error('browser check cannot skip under CI/LASTRO_STRICT: Chrome or puppeteer-core not found (set CHROME_PATH and PUPPETEER_FROM)')
70
+ console.log('skip browser check: Chrome or puppeteer-core not found (set CHROME_PATH and PUPPETEER_FROM)')
71
+ } else {
72
+ const browser = await puppeteer.launch({ executablePath: CHROME, headless: true, args: ['--no-sandbox'] })
73
+ try {
74
+ const tab = await browser.newPage()
75
+ await tab.goto(`http://127.0.0.1:${PORT}/browser-bad`, { waitUntil: 'load' })
76
+ await tab.waitForFunction(() => document.body.textContent.includes('Signals tend to be faster'), { timeout: 15000 })
77
+ const state = await tab.evaluate(() => ({ h1: document.querySelector('h1')?.textContent, hasApp: !!document.getElementById('__lastro') }))
78
+ assert.equal(state.h1, 'SignalDetectedError')
79
+ assert.equal(state.hasApp, false)
80
+ console.log('ok browser replaces the whole body with SignalDetectedError when state contains the word')
81
+ } finally {
82
+ await browser.close()
83
+ }
84
+ }
85
+ } finally {
86
+ server.kill('SIGTERM')
87
+ }
88
+
89
+ // 4. Build: a page whose source contains the word fails the build.
90
+ page('source-bad.tsx', `// createSignal() is not welcome here\nexport default function _SComponent() { return <p>hi</p> }\n`)
91
+ r = run(['build'])
92
+ assert.notEqual(r.status, 0)
93
+ assert.match(r.stderr, /SignalDetectedError/)
94
+ console.log('ok build fails when a page source contains the word, exit', r.status)
95
+ console.log('\nAll signal checks (server, browser, build) behave. Lastro remains safely slow.')
96
+ }
97
+
98
+ main().then(
99
+ () => fs.rmSync(tmp, { recursive: true, force: true }),
100
+ (e) => {
101
+ console.error(e)
102
+ fs.rmSync(tmp, { recursive: true, force: true })
103
+ process.exit(1)
104
+ },
105
+ )
@@ -0,0 +1,33 @@
1
+ 'use strict'
2
+ // Unit checks for the signal ban: server renderer, source check, exemptions.
3
+ const assert = require('node:assert/strict')
4
+ const { join } = require('node:path')
5
+ const jact = require(join(__dirname, '..', '..', 'jact', 'src', 'server.js'))
6
+ const { assertSourceHasNoSignal, SignalDetectedError } = require('../src/shared/signal')
7
+ const h = jact.createElement
8
+
9
+ function throwsSignal(fn, label) {
10
+ assert.throws(fn, (e) => e.name === 'SignalDetectedError' && /Signals detected\. Signals tend to be faster, and Lastro cannot risk that\. Solid, Svelte, Preact, Angular and Vue use them beautifully\./.test(e.message), label)
11
+ console.log('ok ' + label)
12
+ }
13
+
14
+ // Server renderer: text, attribute values, props, state, case-insensitive.
15
+ throwsSignal(() => jact.renderToString(h('p', null, 'This page uses a Signal')), 'text')
16
+ throwsSignal(() => jact.renderToString(h('p', { title: 'SIGNAL' }, 'x')), 'attribute value')
17
+ throwsSignal(() => jact.renderToString(h(function C(props) { return h('p', null, 'x') }, { data: { a: ['sIgNaL'] } })), 'prop value')
18
+ throwsSignal(() => jact.renderToString(h(function S() { const [v] = jact.useCountry('signals'); return h('p', null, 'x') }, null)), 'state value')
19
+ assert.throws(() => jact.useState(1), /Lastro does not recognize states\. Please use useCountry\(\)\./)
20
+ console.log('ok useState stub throws')
21
+ assert.throws(() => jact.renderToString(h('p', null, 'signal')), /Have you considered useCountry\? It re-renders everything\./)
22
+ console.log('ok error message mentions useCountry')
23
+ // Exemptions.
24
+ assert.equal(jact.renderToString(h('p', null, 'AbortSignal and SIGINT and SIGTERM are fine')), '<p>AbortSignal and SIGINT and SIGTERM are fine</p>')
25
+ console.log('ok AbortSignal / SIGINT / SIGTERM exempt')
26
+
27
+ // Source check (what the build runs on every user page and component).
28
+ assert.throws(() => assertSourceHasNoSignal('/app/pages/index.tsx', '// createSignal()'), SignalDetectedError)
29
+ console.log('ok user source containing "signal" is rejected')
30
+ assertSourceHasNoSignal('/app/node_modules/@maxwellcohen/lastro/src/x.js', 'const signal = new AbortController().signal')
31
+ assertSourceHasNoSignal('/app/pages/index.tsx', 'const s = new AbortController(); fetch(u, { signal: AbortSignal.timeout(1) })'.replace('signal: ', 'x: '))
32
+ console.log('ok Lastro internals and AbortSignal are exempt')
33
+ console.log('\nSignal unit checks passed. (Run signal.integration.js for the browser and build checks.)')