layouts
All repositories: gitoria
2.8 KB
import http from 'node:http';import net from 'node:net';import { spawn } from 'node:child_process';import { mkdir, writeFile, copyFile } from 'node:fs/promises';import path from 'node:path';import { fileURLToPath } from 'node:url';const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../..');const bin = process.env.HL_BIN || path.join(root, 'native/zig-out/bin/hybriel');const work = process.env.TMPDIR;if (!work) throw new Error('set TMPDIR to scratch');const sockets = new Set();const web = http.createServer((req, res) => {const code = Number(req.url.slice(1));res.writeHead(code, { 'content-type': 'application/json', date: 'fixed', connection: 'close' });res.end(JSON.stringify({ code }));});const slow = net.createServer(s => { sockets.add(s); s.on('close', () => sockets.delete(s)); });function listen(s, port) { return new Promise((r, j) => { s.once('error', j); s.listen(port, '127.0.0.1', r); }); }function run(args) {return new Promise((resolve, reject) => {const p = spawn(args[0], args.slice(1), { cwd: root, env: process.env });let out = '', err = '';p.stdout.on('data', s => out += s); p.stderr.on('data', s => err += s);p.on('error', reject); p.on('close', code => code ? reject(new Error(`${args.join(' ')} exit ${code}\n${out}${err}`)) : resolve(out));});}try {const probe = net.createServer(); await listen(probe, 32262); await new Promise(r => probe.close(r));await listen(web, 32260); await listen(slow, 32261);const fixture = path.join(root, 'plugins/fetch/tests/try_fetch.hl');const native = await run([bin, fixture]);await run([bin, '--native', fixture, '-o', path.join(work, 'try-fetch')]);const compiled = await run([path.join(work, 'try-fetch')]);const jsdir = path.join(work, 'try-fetch-js'); await mkdir(jsdir, { recursive: true });await writeFile(path.join(jsdir, 'package.json'), '{"type":"module"}');await run([bin, '--js', '--entry', fixture, '-o', path.join(jsdir, 'probe.mjs')]);await writeFile(path.join(jsdir, 'hl-runtime.js'), await run([bin, '--js-runtime']));await mkdir(path.join(jsdir, 'hl-modules'), { recursive: true });await copyFile(path.join(root, 'plugins/fetch/server.js'), path.join(jsdir, 'hl-modules/fetch.js'));const js = await run(['node', path.join(jsdir, 'probe.mjs')]);if (native !== compiled || native !== js) throw new Error(`different answers\nrun:${native}\nnative:${compiled}\njs:${js}`);if (!native.includes('connection refused') || !native.includes('timed out') || !native.includes('true true true true true true {"code":200} 200') || !native.includes('true true true true true true {"code":404} 404')) throw new Error(native);console.log('PASS 4 scenarios, identical run/native/JS answers\n' + native);} finally {for (const s of sockets) s.destroy();await Promise.all([web, slow].map(s => new Promise(r => s.listening ? s.close(r) : r())));}
Branches
Latest commits
- 494d75d4Nest caller slot styles in app-sidebarmre
- e5571680Align all plugin sources with Hybriel day38bmre
- 5d204c46Re-vendor layouts to Hybriel set day38bmre
- 17e0f03eNest html-prefixed theme component overridesmre
- e54e735eFormat plain theme elements with nested rules and bare mediamre
- 547f834eRecord LY7 deployment and live verificationmre
- fa4600b1Link caller-slot style exceptions to hybriel#270mre
- 413b11e1Record corrected LY7 nesting, exact CSS and Chrome proofmre
- b810453etracker-demo: nest child and compound selectors in Stylemre
- 0b5b1d61notes-demo: nest child and compound selectors in Stylemre
- ab22bdc2mail-demo: nest child and compound selectors in Stylemre
- fe2d8de9home: nest child and compound selectors in Stylemre
- e631791buser-menu: nest child and compound selectors in Stylemre
- 69604944three-pane: nest child and compound selectors in Stylemre
- 3e389b83main-menu: nest child and compound selectors in Stylemre
- 05413975list-first: nest child and compound selectors in Stylemre
- c545b642content-first: nest child and compound selectors in Stylemre
- eae2be7aapp-sidebar: nest child selectors and document caller-slot gapmre
- 69c9f784Record LY7 slot nesting blocker and minimal repromre
- b1d4f379app-header: nest child and compound selectors in Stylemre