From ee80d9399e69d75f72db1256ff46ca9e971418bc Mon Sep 17 00:00:00 2001 From: Ambroise Leclerc Date: Fri, 23 Oct 2026 18:39:46 +0200 Subject: [PATCH 1/9] Build the developer environment with wf run from the pinned bootstrap, byte for byte as the Node build [#315] Add the wf project of the repository (webfront.project.json and its lock) and the scripts js/developer/scripts/build.mjs (environment, starters, pinned header, bootstrap bundles and core headers), site.mjs (immutable GitHub Pages staging) and pin.mjs (published pin check). The pure rules move to tools/distribution.mjs and tools/asset-header.mjs, shared with the Node tools; the bundle checksum inputs become tools/bundle-inputs.json. Fix runNonInteractive losing what a command wrote before it ended: output += await read the output before the command ran. Distribution 0.6.1. --- js/developer/environment/bundles.json | 11 +- js/developer/environment/runtime.mjs | 7 +- js/developer/scripts/build.mjs | 118 +++ js/developer/scripts/pin.mjs | 24 + js/developer/scripts/site.mjs | 69 ++ js/developer/tools/asset-header.mjs | 35 + js/developer/tools/build.mjs | 2 +- js/developer/tools/bundle-inputs.json | 51 ++ js/developer/tools/distribution.json | 2 +- js/developer/tools/distribution.mjs | 53 ++ js/developer/tools/registry-fixture.mjs | 6 +- js/developer/tools/site.mjs | 44 +- js/developer/vendor/embed.mjs | 36 +- test/cmake/CheckRepositoryLayout.cmake | 5 +- test/fixtures/wf-project/tools/echo.mjs | 2 + .../fixtures/wf-project/webfront.project.json | 2 +- test/web/CMakeLists.txt | 2 + webfront-packages.lock.json | 850 ++++++++++++++++++ webfront.project.json | 48 + 19 files changed, 1277 insertions(+), 90 deletions(-) create mode 100644 js/developer/scripts/build.mjs create mode 100644 js/developer/scripts/pin.mjs create mode 100644 js/developer/scripts/site.mjs create mode 100644 js/developer/tools/asset-header.mjs create mode 100644 js/developer/tools/bundle-inputs.json create mode 100644 js/developer/tools/distribution.mjs create mode 100644 test/fixtures/wf-project/tools/echo.mjs create mode 100644 webfront-packages.lock.json create mode 100644 webfront.project.json diff --git a/js/developer/environment/bundles.json b/js/developer/environment/bundles.json index 80271d82..055910b1 100644 --- a/js/developer/environment/bundles.json +++ b/js/developer/environment/bundles.json @@ -16,7 +16,7 @@ "js/developer/environment/packages.mjs": "6636219f3fef20ea1d274dc9298d8af451ef257b86fe6c1ed0de9a7c797b11d8", "js/developer/environment/starter.mjs": "f38e290e03aebe146623c2ca9b590d645fb91a51acdf7a98101bb00b5b88096c", "js/developer/environment/paths.mjs": "3b6114df78eb193161c5c84499dda084cb7ff91c56a4496371c30295d00880e3", - "js/developer/environment/runtime.mjs": "a469f6af149e92c2d25d6055ff69a4af5304d9ccd287d915a29f861fb363d25b", + "js/developer/environment/runtime.mjs": "98ed06660333d2a90f9857b5b21da811f9d4ecda78d011dc88501679af7388da", "js/developer/environment/development.mjs": "dd07bc64e12c3392223f0e7aab0ae2f5223e093930bee8abe78a0cd3e2940d85", "js/developer/environment/testing.mjs": "326e003f114bdbad68fedbceaded30717b3fc15315e6d87fa747972b681e2dce", "js/developer/environment/terminal.mjs": "7ffcf7ac6ef63c35cdf5ef70284b384525b13ba18422af069289e53b6c4f6be1", @@ -39,11 +39,12 @@ "js/developer/tools/starters/pi/style.css": "360e2c7ae6d3699b00e18cbf67efbae7a8d8863d88926b31139e102cf38e5abd", "examples/life/ui/main.tsx": "ed11a82aad1639eb6997af8b0fca4d5c5ed4c36422c22a74ac49ae73078d0a91", "examples/life/ui/style.css": "9bb55eb0f0a3287e5b7dc78af9d69608b87ff42c4d9c8a653bc83a52fe293c44", - "js/developer/tools/distribution.json": "4c8703b10e0bfca70e47e1c2b9f5afe7bbe4b4b87cd8be99e15082cfd2915373", - "js/developer/tools/build.mjs": "c9767060d2d181a6d048d9a878e622297a929597b73a1e396b69e1d186ac5d42", - "js/developer/tools/site.mjs": "1827d3fd7e1e470336aab25ea8686c912c2b674a10f7be496f2f0077fbc45292", + "js/developer/tools/distribution.json": "f53e062b5e54f10c3120a89ea03916ed861b000af2df2b6e51657c4dfa9b1884", "js/developer/tools/archive.mjs": "bfe9feeb5e4d4e1b7c44c4dec4dcbeab4ae59c2bf16a1d2b32cd6910a2b84e7b", - "js/developer/vendor/package-lock.json": "93a9691e808800b505636bbd58fe90909b3e67d1667c00df31d068e46632f2c3", + "js/developer/tools/distribution.mjs": "8ec13a20d29ddb23c06558807fb01d405dcc00ffa872a023a16f7f56a24ea3ff", + "js/developer/tools/asset-header.mjs": "b31608fd39d9d7477c01e1f14b72494bfd579e9d68029f621d469be529074e85", + "js/developer/scripts/build.mjs": "7bf218847988d17c1bb0da3a7cda060ab0d10bdf17612cdfad4f14486910b1bc", + "webfront.project.json": "ccf59c1918eeaadef85e518187385bf6b7e4766c0d64fd8396c37d6abc95ae20", "js/core/bootstrap/bootstrap.bundle.mjs": "536831257f0fc92e31911841750e1e59247f7c64e756b0fcb878efd9860a741f", "js/developer/environment/packages.bundle.mjs": "e36d1052285a313f7db67c1f58f8332da9e97446b1e2085422ebdae379288045", "include/webfront/system/DeveloperReleaseData.hpp": "ad3707e158b1f268c679545e17d67b6ba245b2129614cf04dfeacdb351f2a354" diff --git a/js/developer/environment/runtime.mjs b/js/developer/environment/runtime.mjs index 921148ac..91587c6f 100644 --- a/js/developer/environment/runtime.mjs +++ b/js/developer/environment/runtime.mjs @@ -267,8 +267,11 @@ export async function execute(args, context) { export async function runNonInteractive(argv, {reporter, onExit = code => globalThis.close(code), write = () => {}, ...context}) { let exitCode = 0, output = '', report = null; const collect = text => { output += text; write(text); }; - try { output += await execute(argv, {...context, write: collect, onReport: value => { report = value; }}); } - catch (error) { + try { + // Not `output += await ...`: the left side is read before the command runs, which would drop what it wrote. + const summary = await execute(argv, {...context, write: collect, onReport: value => { report = value; }}); + output += summary; + } catch (error) { exitCode = error?.exitCode ?? 1; output += error?.message ?? String(error); } diff --git a/js/developer/scripts/build.mjs b/js/developer/scripts/build.mjs new file mode 100644 index 00000000..2a847158 --- /dev/null +++ b/js/developer/scripts/build.mjs @@ -0,0 +1,118 @@ +// Builds the developer environment, its starters and the pinned header from the sources of this repository, with wf: +// +// wf run js/developer/scripts/build.mjs [] [--refresh-bootstrap] +// +// The compiler is the locked esbuild-wasm of webfront.project.json, run in the script's Worker; the files it reads are +// the project's and the locked packages'. With --refresh-bootstrap, the checked-in bootstrap bundles, their checksums +// and the core headers that embed them are regenerated too. +import * as esbuild from 'esbuild-wasm'; +import {virtualPlugin} from '../environment/bundler.mjs'; +import {compress} from '../environment/embed.mjs'; +import {packageRoot} from '../environment/paths.mjs'; +import {tar} from '../tools/archive.mjs'; +import {baseUrl, versionPath, bootstrapHeader, sriOf} from '../tools/distribution.mjs'; +import {renderAsset} from '../tools/asset-header.mjs'; + +const lockPath = 'webfront-packages.lock.json'; +const encoder = new TextEncoder(); +const hexOf = bytes => Array.from(new Uint8Array(bytes), byte => byte.toString(16).padStart(2, '0')).join(''); + +/** The project path of a file of a locked package: the root of that name. */ +export function lockedFile(lock, name, file) { + const node = lock.packages[lock.roots[name]?.id]; + if (!node) throw new Error(`${name} is not installed: run wf install`); + return `${packageRoot}/${node.key}/${file}`; +} + +export default async function (context) { + const {project} = context; + const flags = context.args.filter(argument => argument.startsWith('--')); + const refresh = flags.includes('--refresh-bootstrap'); + const unknown = flags.find(flag => flag !== '--refresh-bootstrap'); + if (unknown) throw new Error(`Unknown option ${unknown}`); + const output = context.args.find(argument => !argument.startsWith('--')) ?? 'build-developer-environment'; + const lock = JSON.parse(await project.readText(lockPath)); + const readProject = path => project.read(path); + + await esbuild.initialize({wasmModule: await WebAssembly.compile(await project.read(lockedFile(lock, 'esbuild-wasm', 'esbuild.wasm'))), worker: false}); + const bundle = async entry => { + const result = await esbuild.build({entryPoints: [entry], bundle: true, format: 'esm', platform: 'browser', target: 'es2020', + minify: true, legalComments: 'inline', write: false, outfile: '/output/bundle.mjs', + plugins: [virtualPlugin(lock, undefined, readProject)]}); + return result.outputFiles[0].contents; + }; + const written = new Map(); + const write = async (path, data) => { + const bytes = typeof data === 'string' ? encoder.encode(data) : data; + await project.write(path, bytes); + written.set(path, bytes); + return bytes; + }; + const read = async path => written.get(path) ?? await project.read(path); + + const files = new Map(); + for (const name of ['runtime', 'compiler', 'script-worker', 'typecheck-worker']) + files.set(`${name}.mjs`, await write(`${output}/${name}.mjs`, await bundle(`js/developer/environment/${name}.mjs`))); + files.set('esbuild.wasm', await write(`${output}/esbuild.wasm`, await project.read(lockedFile(lock, 'esbuild-wasm', 'esbuild.wasm')))); + files.set('xterm.css', await write(`${output}/xterm.css`, await project.read(lockedFile(lock, '@xterm/xterm', 'css/xterm.css')))); + + const distribution = JSON.parse(await project.readText('js/developer/tools/distribution.json')); + const version = distribution.version; + const publicBase = baseUrl(distribution.baseUrl); + versionPath(version); + const dependencies = JSON.parse(await project.readText('webfront.project.json')).dependencies; + const licenses = [ + ['esbuild-wasm', lockedFile(lock, 'esbuild-wasm', 'LICENSE.md')], + ['semver', lockedFile(lock, 'semver', 'LICENSE')], + ['xterm', lockedFile(lock, '@xterm/xterm', 'LICENSE')], + ['xterm Fit addon', lockedFile(lock, '@xterm/addon-fit', 'LICENSE')], + ['fflate', 'third_party/fflate/LICENSE'], + ]; + const notices = []; + for (const [name, path] of licenses) notices.push(`${name}\n${await project.readText(path)}`); + files.set('LICENSES.txt', await write(`${output}/LICENSES.txt`, notices.join('\n\n'))); + + // The starter is pinned by the environment's own trusted archive, not by unverified remote metadata. + const starters = {}; + for (const [name, provider] of [['pi', 'PiUI'], ['life', 'LifeUI']]) { + const starterFiles = new Map(); + for (const file of ['main.tsx', 'style.css']) + starterFiles.set(`package/${file}`, await project.read(`${name === 'life' ? 'examples/life/ui' : 'js/developer/tools/starters/pi'}/${file}`)); + const recipe = {format: 1, name: `${name}-starter`, version, dependencies: { + react: dependencies.react, 'react-dom': dependencies['react-dom']}, + entries: {main: 'main.tsx'}, providers: {[provider]: {entry: 'main', output: `generated/${provider}.hpp`}}}; + starterFiles.set('package/webfront.project.json', encoder.encode(JSON.stringify(recipe, null, 2) + '\n')); + starterFiles.set('package/package.json', encoder.encode(JSON.stringify({name: `@webfront/${name}-starter`, version, + private: true, webfront: {kind: 'starter', entry: 'main.tsx'}}, null, 2) + '\n')); + const starterBytes = compress(tar(starterFiles)); + const archive = `${name}-starter.tgz`; + await write(`${output}/${archive}`, starterBytes); + starters[name] = {archive, integrity: await sriOf(starterBytes)}; + } + files.set('environment.json', await write(`${output}/environment.json`, JSON.stringify({protocol: 1, api: 1, version, entry: 'runtime.mjs', + compiler: `esbuild-wasm@${dependencies['esbuild-wasm']}`, semver: dependencies.semver, starters}, null, 2) + '\n')); + files.set('package.json', await write(`${output}/package.json`, JSON.stringify({name: '@webfront/developer-environment', version, + description: 'Browser-powered WebFront developer environment', type: 'module', + files: ['runtime.mjs', 'compiler.mjs', 'script-worker.mjs', 'typecheck-worker.mjs', 'esbuild.wasm', 'xterm.css', 'environment.json', 'LICENSES.txt']}, null, 2) + '\n')); + + const bytes = compress(tar(new Map([...files].map(([name, content]) => [`package/${name}`, content])))); + await write(`${output}/environment.tgz`, bytes); + const integrity = await sriOf(bytes); + await write(`${output}/provision.json`, JSON.stringify({format: 1, version, environment: './environment.tgz', integrity, starters}, null, 2) + '\n'); + const header = bootstrapHeader(version, publicBase, integrity); + await write(`${output}/DeveloperReleaseData.hpp`, header); + + if (refresh) { + await write('js/core/bootstrap/bootstrap.bundle.mjs', await bundle('js/developer/environment/bootstrap-entry.mjs')); + await write('js/developer/environment/packages.bundle.mjs', await bundle('js/developer/environment/packages-entry.mjs')); + await write('js/developer/environment/PACKAGES-LICENSE.txt', await project.read(lockedFile(lock, 'semver', 'LICENSE'))); + await write('include/webfront/system/DeveloperReleaseData.hpp', header); + const inputs = {}; + for (const path of JSON.parse(await project.readText('js/developer/tools/bundle-inputs.json'))) + inputs[path] = hexOf(await crypto.subtle.digest('SHA-256', await read(path))); + await write('js/developer/environment/bundles.json', JSON.stringify(inputs, null, 2) + '\n'); + for (const [source, name] of [['js/core/bootstrap/index.html', 'DeveloperIndexHtmlData'], ['js/core/bootstrap/bootstrap.bundle.mjs', 'DeveloperBootstrapData']]) + await write(`include/webfront/system/${name}.hpp`, renderAsset(await read(source), name)); + } + context.console.log(`Environment: ${output}/environment.tgz\nIntegrity: ${integrity}\nStarters: ${Object.keys(starters).join(', ')}`); +} diff --git a/js/developer/scripts/pin.mjs b/js/developer/scripts/pin.mjs new file mode 100644 index 00000000..f4bf7c95 --- /dev/null +++ b/js/developer/scripts/pin.mjs @@ -0,0 +1,24 @@ +// Checks include/webfront/system/DeveloperReleaseData.hpp against the published distribution it pins, for sources that +// build a newer version, with wf: +// +// wf run js/developer/scripts/pin.mjs +// +// The header must be exactly the one generated for its version, and the archive at its URL must have its integrity. +import {bootstrapHeader, sriOf} from '../tools/distribution.mjs'; + +export default async function (context) { + const {project} = context; + const header = await project.readText('include/webfront/system/DeveloperReleaseData.hpp'); + const distribution = JSON.parse(await project.readText('js/developer/tools/distribution.json')); + const field = name => header.match(new RegExp(`\\b${name}\\{"([^"]*)"\\}`))?.[1] ?? ''; + const version = field('version'); + const integrity = field('integrity'); + if (header !== bootstrapHeader(version, distribution.baseUrl, integrity)) + throw new Error(`DeveloperReleaseData.hpp is not the header generated for the published ${version}`); + const url = field('environment'); + const response = await context.fetch(url, {signal: context.signal}); + if (!response.ok) throw new Error(`The pinned environment ${url} is not published (${response.status})`); + if (await sriOf(new Uint8Array(await response.arrayBuffer())) !== integrity) + throw new Error(`The published ${url} does not have the pinned integrity`); + context.console.log(`DeveloperReleaseData.hpp pins the published ${version}.`); +} diff --git a/js/developer/scripts/site.mjs b/js/developer/scripts/site.mjs new file mode 100644 index 00000000..efde15e9 --- /dev/null +++ b/js/developer/scripts/site.mjs @@ -0,0 +1,69 @@ +// Stages a built distribution into the static GitHub Pages site, keeping every published version, with wf: +// +// wf run js/developer/scripts/site.mjs +// +// A published version is immutable: staging may only repeat identical bytes. Nothing is modified before every byte of +// an existing version has been compared. +import {versionName, versionPath, distributionFiles, sriOf} from '../tools/distribution.mjs'; + +const same = (a, b) => a.length === b.length && a.every((byte, index) => byte === b[index]); + +async function readDistribution(project, distribution) { + const manifest = JSON.parse(await project.readText(`${distribution}/provision.json`)); + const input = new Map(); + for (const name of distributionFiles(manifest)) input.set(name, await project.read(`${distribution}/${name}`)); + const archives = [[input.get('environment.tgz'), manifest.integrity], + ...Object.values(manifest.starters).map(starter => [input.get(starter.archive), starter.integrity])]; + for (const [bytes, integrity] of archives) + if (await sriOf(bytes) !== integrity) throw new Error('Distribution archive checksum mismatch'); + return {manifest, input}; +} + +const entries = async (project, directory) => (await project.list(directory)).map(name => name.replace(/\/$/, '')); + +// A version is published when its directory is listed under the site's developer directory (a missing directory +// cannot be listed, so each level is looked up in its parent). +async function published(project, site, version) { + if (!(await entries(project, site)).includes('developer')) return false; + return (await entries(project, `${site}/developer`)).includes(version); +} + +// A published version is immutable: reruns may only repeat identical bytes. +async function publishVersion(project, input, site, version) { + const destination = `${site}/developer/${version}`; + if (!await published(project, site, version)) { + for (const [name, bytes] of input) await project.write(`${destination}/${name}`, bytes); + return; + } + // Check every byte before modifying anything. + for (const [name, bytes] of input) { + const existing = await project.read(`${destination}/${name}`).catch(() => null); + if (!existing || !same(bytes, existing)) + throw new Error(`Published version ${version} differs; increment the distribution version`); + } +} + +async function versionRow(project, site, version) { + const manifest = JSON.parse(await project.readText(`${site}/${versionPath(version)}provision.json`)); + const links = distributionFiles(manifest).map(name => `${name}`).join(' · '); + return `
  • ${version}: ${links}
  • `; +} + +async function writeIndex(project, site) { + const versions = (await entries(project, `${site}/developer`)).filter(name => versionName.test(name)).sort(); + await project.write(`${site}/.nojekyll`, ''); + const rows = []; + for (const version of versions) rows.push(await versionRow(project, site, version)); + await project.write(`${site}/index.html`, `\nWebFront developer packages

    WebFront developer packages

    Use a version-pinned bootstrap header and SHA-512. React and its dependencies are downloaded separately from npm.

      ${rows.join('')}
    \n`); +} + +export default async function (context) { + const [distribution, site] = context.args; + if (!distribution || !site || context.args.length !== 2) throw new Error('Usage: wf run site '); + const {project} = context; + const {manifest, input} = await readDistribution(project, distribution); + const relative = versionPath(manifest.version); + await publishVersion(project, input, site, manifest.version); + await writeIndex(project, site); + context.console.log(`Staged developer packages ${manifest.version} in ${site}/${relative}`); +} diff --git a/js/developer/tools/asset-header.mjs b/js/developer/tools/asset-header.mjs new file mode 100644 index 00000000..02bd2e05 --- /dev/null +++ b/js/developer/tools/asset-header.mjs @@ -0,0 +1,35 @@ +// The checked-in header format of an embedded asset, with no host API: wf scripts and the Node tools render the same bytes. +import {compress} from '../environment/embed.mjs'; + +const hexOf = bytes => Array.from(bytes, byte => byte.toString(16).padStart(2, '0')).join(''); + +export function renderAsset(source, name, compressed = false) { + const payload = compressed ? compress(source) : source; + const hex = hexOf(payload); + const lines = []; + // Build bounded lines, then join once. Appending every word in CMake repeatedly + // copied a growing string and made large assets particularly expensive on Windows. + for (let offset = 0; offset < hex.length; offset += 80) { + const words = hex.slice(offset, offset + 80).match(/.{1,16}/g); + lines.push(` ${words.map(word => `0x${word.padEnd(16, '0')}`).join(', ')}`); + } + const words = lines.length ? `\n${lines.join(',\n')}` : ''; + return `#pragma once + +#include +#include +#include +#include + +namespace webfront::fs::generated { + +struct ${name} { + static constexpr std::string_view encoding${compressed ? '{"gzip"}' : '{}'}; + static constexpr std::size_t dataSize{${payload.length}}; + static constexpr std::array data{${words} + }; +}; + +} // namespace webfront::fs::generated +`; +} diff --git a/js/developer/tools/build.mjs b/js/developer/tools/build.mjs index f816e6bb..e5b5c88c 100644 --- a/js/developer/tools/build.mjs +++ b/js/developer/tools/build.mjs @@ -78,7 +78,7 @@ if (refresh) { await copyFile(resolve(root, 'js/developer/vendor/node_modules/semver/LICENSE'), resolve(root, 'js/developer/environment/PACKAGES-LICENSE.txt')); await writeFile(resolve(root, 'include/webfront/system/DeveloperReleaseData.hpp'), header); const inputs = {}; - for (const path of ['js/developer/environment/manifest.mjs', 'js/developer/environment/project.mjs', 'js/developer/environment/installer.mjs', 'js/developer/environment/restore.mjs', 'js/developer/environment/cache.mjs', 'js/developer/environment/scripts.mjs', 'js/developer/environment/script-worker.mjs', 'js/developer/environment/permissions.mjs', 'js/developer/environment/typecheck.mjs', 'js/developer/environment/typecheck-snapshot.mjs', 'js/developer/environment/typecheck-worker.mjs', 'js/developer/environment/packages-entry.mjs', 'js/developer/environment/bootstrap.mjs', 'js/developer/environment/bootstrap-entry.mjs', 'js/developer/environment/packages.mjs', 'js/developer/environment/starter.mjs', 'js/developer/environment/paths.mjs', 'js/developer/environment/runtime.mjs', 'js/developer/environment/development.mjs', 'js/developer/environment/testing.mjs', 'js/developer/environment/terminal.mjs', 'js/developer/environment/tarball.mjs', 'js/developer/environment/commands.mjs', 'js/developer/environment/compiler.mjs', 'js/developer/environment/bundler.mjs', 'js/developer/environment/entry.mjs', 'js/developer/environment/conditions.mjs', 'js/developer/environment/io.mjs', 'js/developer/environment/recipe.mjs', 'js/developer/environment/registry.mjs', 'js/developer/environment/archive.mjs', 'js/developer/environment/lock.mjs', 'js/developer/environment/pins.mjs', 'js/developer/environment/peers.mjs', 'js/developer/environment/resolve.mjs', 'js/developer/environment/embed.mjs', 'js/developer/tools/starters/pi/main.tsx', 'js/developer/tools/starters/pi/style.css', 'examples/life/ui/main.tsx', 'examples/life/ui/style.css', 'js/developer/tools/distribution.json', 'js/developer/tools/build.mjs', 'js/developer/tools/site.mjs', 'js/developer/tools/archive.mjs', 'js/developer/vendor/package-lock.json', 'js/core/bootstrap/bootstrap.bundle.mjs', 'js/developer/environment/packages.bundle.mjs', 'include/webfront/system/DeveloperReleaseData.hpp']) + for (const path of JSON.parse(await readFile(resolve(root, 'js/developer/tools/bundle-inputs.json')))) inputs[path] = createHash('sha256').update(await readFile(resolve(root, path))).digest('hex'); await writeFile(resolve(root, 'js/developer/environment/bundles.json'), JSON.stringify(inputs, null, 2) + '\n'); for (const [source, name] of [['js/core/bootstrap/index.html', 'DeveloperIndexHtmlData'], ['js/core/bootstrap/bootstrap.bundle.mjs', 'DeveloperBootstrapData']]) diff --git a/js/developer/tools/bundle-inputs.json b/js/developer/tools/bundle-inputs.json new file mode 100644 index 00000000..cf5cff79 --- /dev/null +++ b/js/developer/tools/bundle-inputs.json @@ -0,0 +1,51 @@ +[ + "js/developer/environment/manifest.mjs", + "js/developer/environment/project.mjs", + "js/developer/environment/installer.mjs", + "js/developer/environment/restore.mjs", + "js/developer/environment/cache.mjs", + "js/developer/environment/scripts.mjs", + "js/developer/environment/script-worker.mjs", + "js/developer/environment/permissions.mjs", + "js/developer/environment/typecheck.mjs", + "js/developer/environment/typecheck-snapshot.mjs", + "js/developer/environment/typecheck-worker.mjs", + "js/developer/environment/packages-entry.mjs", + "js/developer/environment/bootstrap.mjs", + "js/developer/environment/bootstrap-entry.mjs", + "js/developer/environment/packages.mjs", + "js/developer/environment/starter.mjs", + "js/developer/environment/paths.mjs", + "js/developer/environment/runtime.mjs", + "js/developer/environment/development.mjs", + "js/developer/environment/testing.mjs", + "js/developer/environment/terminal.mjs", + "js/developer/environment/tarball.mjs", + "js/developer/environment/commands.mjs", + "js/developer/environment/compiler.mjs", + "js/developer/environment/bundler.mjs", + "js/developer/environment/entry.mjs", + "js/developer/environment/conditions.mjs", + "js/developer/environment/io.mjs", + "js/developer/environment/recipe.mjs", + "js/developer/environment/registry.mjs", + "js/developer/environment/archive.mjs", + "js/developer/environment/lock.mjs", + "js/developer/environment/pins.mjs", + "js/developer/environment/peers.mjs", + "js/developer/environment/resolve.mjs", + "js/developer/environment/embed.mjs", + "js/developer/tools/starters/pi/main.tsx", + "js/developer/tools/starters/pi/style.css", + "examples/life/ui/main.tsx", + "examples/life/ui/style.css", + "js/developer/tools/distribution.json", + "js/developer/tools/archive.mjs", + "js/developer/tools/distribution.mjs", + "js/developer/tools/asset-header.mjs", + "js/developer/scripts/build.mjs", + "webfront.project.json", + "js/core/bootstrap/bootstrap.bundle.mjs", + "js/developer/environment/packages.bundle.mjs", + "include/webfront/system/DeveloperReleaseData.hpp" +] diff --git a/js/developer/tools/distribution.json b/js/developer/tools/distribution.json index cf1870e1..734e8e91 100644 --- a/js/developer/tools/distribution.json +++ b/js/developer/tools/distribution.json @@ -1,4 +1,4 @@ { - "version": "0.6.0", + "version": "0.6.1", "baseUrl": "https://ambroise-leclerc.github.io/WebFront/" } diff --git a/js/developer/tools/distribution.mjs b/js/developer/tools/distribution.mjs new file mode 100644 index 00000000..b792bc4d --- /dev/null +++ b/js/developer/tools/distribution.mjs @@ -0,0 +1,53 @@ +// The pure rules of the developer distribution (versions, URLs, the pinned header, the published files). They use +// no host API: the wf scripts of js/developer/scripts and the Node maintenance tools share them. + +function isHttpsDirectory(url) { + if (url.protocol !== 'https:') return false; + if (url.username || url.password) return false; + return !url.search && !url.hash; +} + +export function baseUrl(value) { + const url = new URL(value); + if (!isHttpsDirectory(url)) throw new Error('Distribution base URL must be an HTTPS directory URL'); + if (!url.pathname.endsWith('/')) url.pathname += '/'; + return url.href; +} + +export const versionName = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/; + +export function versionPath(version) { + if (!versionName.test(version)) throw new Error('Invalid distribution version'); + return `developer/${version}/`; +} + +export function bootstrapHeader(version, base, integrity) { + if (!/^sha512-[A-Za-z0-9+/]{86}==$/.test(integrity)) throw new Error('Invalid distribution SHA-512'); + const url = new URL(versionPath(version) + 'environment.tgz', baseUrl(base)); + return `#pragma once + +// Pinned developer distribution. Regenerate with js/developer/tools/build.mjs --refresh-bootstrap. +#include + +namespace webfront::developer::release { +inline constexpr std::string_view version{${JSON.stringify(version)}}; +inline constexpr std::string_view environment{${JSON.stringify(url.href)}}; +inline constexpr std::string_view integrity{${JSON.stringify(integrity)}}; +} // namespace webfront::developer::release +`; +} + +const validArchive = name => typeof name === 'string' && /^[a-z0-9-]+-starter\.tgz$/.test(name); + +// A manifest may add starters without changing the publication machinery. +export function distributionFiles(manifest) { + const archives = Object.values(manifest.starters ?? {}).map(starter => starter.archive); + if (archives.length === 0 || !archives.every(validArchive)) throw new Error('Invalid distribution starter archives'); + if (new Set(archives).size !== archives.length) throw new Error('Invalid distribution starter archives'); + return ['environment.tgz', ...archives, 'provision.json', 'DeveloperReleaseData.hpp']; +} + +/** The SRI value of the SHA-512 of some bytes, with the Web Crypto API (a Worker, a page or Node). */ +export async function sriOf(bytes) { + return 'sha512-' + btoa(String.fromCharCode(...new Uint8Array(await crypto.subtle.digest('SHA-512', bytes)))); +} diff --git a/js/developer/tools/registry-fixture.mjs b/js/developer/tools/registry-fixture.mjs index a5a8163a..796b237f 100644 --- a/js/developer/tools/registry-fixture.mjs +++ b/js/developer/tools/registry-fixture.mjs @@ -8,9 +8,11 @@ import {compress} from '../environment/embed.mjs'; /** * Pinned packages copied from js/developer/vendor/node_modules, at the versions of its package-lock.json; typescript5 - * is the npm alias of the typescript 5.x that wf check is also tested with. + * is the npm alias of the typescript 5.x that wf check is also tested with. The others are the build dependencies of + * the environment, which the project at the root of the repository installs to build itself with wf run. */ -export const pinnedPackages = ['jasmine-core', 'react', 'react-dom', 'scheduler', 'typescript', 'typescript5']; +export const pinnedPackages = ['jasmine-core', 'react', 'react-dom', 'scheduler', 'typescript', 'typescript5', + 'esbuild-wasm', 'semver', '@xterm/xterm', '@xterm/addon-fit']; const encoder = new TextEncoder(); async function integrity(bytes) { diff --git a/js/developer/tools/site.mjs b/js/developer/tools/site.mjs index 5639cb59..a15f4d87 100644 --- a/js/developer/tools/site.mjs +++ b/js/developer/tools/site.mjs @@ -3,49 +3,9 @@ import {readFile, writeFile, mkdir, readdir, stat} from 'node:fs/promises'; import {resolve, join} from 'node:path'; import {pathToFileURL} from 'node:url'; import {createHash} from 'node:crypto'; +import {baseUrl, versionName, versionPath, bootstrapHeader, distributionFiles} from './distribution.mjs'; +export {baseUrl, versionPath, bootstrapHeader, distributionFiles}; -function isHttpsDirectory(url) { - if (url.protocol !== 'https:') return false; - if (url.username || url.password) return false; - return !url.search && !url.hash; -} - -export function baseUrl(value) { - const url = new URL(value); - if (!isHttpsDirectory(url)) throw new Error('Distribution base URL must be an HTTPS directory URL'); - if (!url.pathname.endsWith('/')) url.pathname += '/'; - return url.href; -} -export function versionPath(version) { - if (!versionName.test(version)) throw new Error('Invalid distribution version'); - return `developer/${version}/`; -} -export function bootstrapHeader(version, base, integrity) { - if (!/^sha512-[A-Za-z0-9+/]{86}==$/.test(integrity)) throw new Error('Invalid distribution SHA-512'); - const url = new URL(versionPath(version) + 'environment.tgz', baseUrl(base)); - return `#pragma once - -// Pinned developer distribution. Regenerate with js/developer/tools/build.mjs --refresh-bootstrap. -#include - -namespace webfront::developer::release { -inline constexpr std::string_view version{${JSON.stringify(version)}}; -inline constexpr std::string_view environment{${JSON.stringify(url.href)}}; -inline constexpr std::string_view integrity{${JSON.stringify(integrity)}}; -} // namespace webfront::developer::release -`; -} - -const validArchive = name => typeof name === 'string' && /^[a-z0-9-]+-starter\.tgz$/.test(name); -const versionName = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/; - -// A manifest may add starters without changing the publication machinery. -export function distributionFiles(manifest) { - const archives = Object.values(manifest.starters ?? {}).map(starter => starter.archive); - if (archives.length === 0 || !archives.every(validArchive)) throw new Error('Invalid distribution starter archives'); - if (new Set(archives).size !== archives.length) throw new Error('Invalid distribution starter archives'); - return ['environment.tgz', ...archives, 'provision.json', 'DeveloperReleaseData.hpp']; -} const digest = bytes => 'sha512-' + createHash('sha512').update(bytes).digest('base64'); async function readDistribution(distribution) { diff --git a/js/developer/vendor/embed.mjs b/js/developer/vendor/embed.mjs index 41394693..cd1d6fba 100644 --- a/js/developer/vendor/embed.mjs +++ b/js/developer/vendor/embed.mjs @@ -1,45 +1,13 @@ // Keep the checked-in header format and the pinned compressor independent of the host. -import { gzipSync } from '../../../third_party/fflate/browser.mjs'; +import { renderAsset } from '../tools/asset-header.mjs'; import { mkdirSync, readFileSync, realpathSync, writeFileSync } from 'node:fs'; import { dirname, resolve } from 'node:path'; import { pathToFileURL } from 'node:url'; import { parseArgs } from 'node:util'; +export { renderAsset }; export const STALE_ASSET_MESSAGE = 'is stale; run the webfront-embedded-assets target'; -export function renderAsset(source, name, compressed = false) { - const payload = compressed - ? Buffer.from(gzipSync(source, { level: 9, mem: 8, mtime: 0 })) - : source; - const hex = payload.toString('hex'); - const lines = []; - // Build bounded lines, then join once. Appending every word in CMake repeatedly - // copied a growing string and made large assets particularly expensive on Windows. - for (let offset = 0; offset < hex.length; offset += 80) { - const words = hex.slice(offset, offset + 80).match(/.{1,16}/g); - lines.push(` ${words.map(word => `0x${word.padEnd(16, '0')}`).join(', ')}`); - } - const words = lines.length ? `\n${lines.join(',\n')}` : ''; - return `#pragma once - -#include -#include -#include -#include - -namespace webfront::fs::generated { - -struct ${name} { - static constexpr std::string_view encoding${compressed ? '{"gzip"}' : '{}'}; - static constexpr std::size_t dataSize{${payload.length}}; - static constexpr std::array data{${words} - }; -}; - -} // namespace webfront::fs::generated -`; -} - function main() { const { values } = parseArgs({ options: { input: { type: 'string' }, struct: { type: 'string' }, diff --git a/test/cmake/CheckRepositoryLayout.cmake b/test/cmake/CheckRepositoryLayout.cmake index 66c3c2fa..5d3181e7 100644 --- a/test/cmake/CheckRepositoryLayout.cmake +++ b/test/cmake/CheckRepositoryLayout.cmake @@ -1,5 +1,6 @@ # The tracked root of the repository is a closed list, so that the README stays visible on the -# GitHub page. third_party/ is a temporary exception removed by #319. +# GitHub page. third_party/ is a temporary exception removed by #319. webfront.project.json and its lock make the +# repository a wf project: the environment builds itself with wf run (#315). # cmake -DROOT= [-DGIT_EXECUTABLE=] -P test/cmake/CheckRepositoryLayout.cmake cmake_minimum_required(VERSION 3.31) @@ -9,7 +10,7 @@ endif() set(expected .clang-format .clang-tidy .devcontainer .gitattributes .github .gitignore - AGENTS.md CMakeLists.txt README.md + AGENTS.md CMakeLists.txt README.md webfront-packages.lock.json webfront.project.json cmake docs examples include js test third_party) set(actual "") diff --git a/test/fixtures/wf-project/tools/echo.mjs b/test/fixtures/wf-project/tools/echo.mjs new file mode 100644 index 00000000..788b0bf2 --- /dev/null +++ b/test/fixtures/wf-project/tools/echo.mjs @@ -0,0 +1,2 @@ +// A script that writes to its console and ends at once: its output must reach the driver's result. +export default async context => context.console.log('echo says', ...context.args); diff --git a/test/fixtures/wf-project/webfront.project.json b/test/fixtures/wf-project/webfront.project.json index 3802a327..95b3daf7 100644 --- a/test/fixtures/wf-project/webfront.project.json +++ b/test/fixtures/wf-project/webfront.project.json @@ -3,6 +3,6 @@ "name": "wf-driver-fixture", "version": "0.1.0", "dependencies": {}, - "scripts": {"sleep": "tools/sleep.mjs"}, + "scripts": {"sleep": "tools/sleep.mjs", "echo": "tools/echo.mjs"}, "test": {"specs": ["tests/arithmetic.spec.js"]} } diff --git a/test/web/CMakeLists.txt b/test/web/CMakeLists.txt index 03cfc78b..a38ee38a 100644 --- a/test/web/CMakeLists.txt +++ b/test/web/CMakeLists.txt @@ -155,6 +155,8 @@ if(WEBFRONT_DEVELOPER_FIXTURES # The pinned bootstrap environment, downloaded and verified at configure time, runs a command by itself. webfront_add_driver_test(WfDriverPinned 0 "init" PINNED OUTPUT "Created webfront.project.json" FRESH_PROJECT "${CMAKE_CURRENT_BINARY_DIR}/wf-driver-pinned") webfront_add_driver_test(WfDriverUnknownCommand 1 "nosuchcommand" OUTPUT "nosuchcommand") + # What a script writes to its console before it ends reaches the result of the command. + webfront_add_driver_test(WfDriverScriptOutput 0 "run|echo|one|two" OUTPUT "echo says one two") webfront_add_driver_test(WfDriverTimeout 71 "run|sleep" OUTPUT "time limit of the driver" DRIVER_TIMEOUT 4) webfront_add_driver_test(WfDriverWrongIntegrity 70 "list" OUTPUT "Integrity check failed" INTEGRITY "sha512-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==") diff --git a/webfront-packages.lock.json b/webfront-packages.lock.json new file mode 100644 index 00000000..6a178898 --- /dev/null +++ b/webfront-packages.lock.json @@ -0,0 +1,850 @@ +{ + "format": 1, + "manifestDigest": "21fb3318f7bf56509632d83f1c530ae8e14b5c8dabaaee4b3d24a2ecd4cc3fd3", + "registry": "https://registry.npmjs.org/", + "roots": { + "@xterm/addon-fit": { + "requested": "0.11.0", + "id": "@xterm+addon-fit@0.11.0" + }, + "@xterm/xterm": { + "requested": "6.0.0", + "id": "@xterm+xterm@6.0.0" + }, + "esbuild-wasm": { + "requested": "0.28.2", + "id": "esbuild-wasm@0.28.2" + }, + "react": { + "requested": "19.3.1", + "id": "react@19.3.1" + }, + "react-dom": { + "requested": "19.3.1", + "id": "react-dom@19.3.1" + }, + "semver": { + "requested": "7.7.3", + "id": "semver@7.7.3" + } + }, + "packages": { + "@xterm+addon-fit@0.11.0": { + "name": "@xterm/addon-fit", + "version": "0.11.0", + "integrity": "sha512-jYcgT6xtVYhnhgxh3QgYDnnNMYTcf8ElbxxFzX0IZo+vabQqSPAjC3c1wJrKB5E19VwQei89QCiZZP86DCPF7g==", + "key": "@xterm+addon-fit@0.11.0-jYcgT6xtVYhnhgxh3QgYDnnNMYTcf8ElbxxFzX0IZo-vabQqSPAjC3c1wJrKB5E19VwQei89QCiZZP86DCPF7g", + "manifest": { + "name": "@xterm/addon-fit", + "version": "0.11.0", + "author": { + "name": "The xterm.js authors", + "url": "https://xtermjs.org/" + }, + "main": "lib/addon-fit.js", + "module": "lib/addon-fit.mjs", + "types": "typings/addon-fit.d.ts", + "repository": "https://github.com/xtermjs/xterm.js/tree/master/addons/addon-fit", + "license": "MIT", + "keywords": [ + "terminal", + "xterm", + "xterm.js" + ], + "scripts": { + "build": "../../node_modules/.bin/tsc -p .", + "prepackage": "npm run build", + "package": "../../node_modules/.bin/webpack", + "prepublishOnly": "npm run package", + "start": "node ../../demo/start" + }, + "commit": "f447274f430fd22513f6adbf9862d19524471c04" + }, + "files": [ + "LICENSE", + "README.md", + "lib/addon-fit.js", + "lib/addon-fit.js.map", + "lib/addon-fit.mjs", + "lib/addon-fit.mjs.map", + "package.json", + "src/FitAddon.ts", + "typings/addon-fit.d.ts" + ], + "dependencies": {} + }, + "@xterm+xterm@6.0.0": { + "name": "@xterm/xterm", + "version": "6.0.0", + "integrity": "sha512-TQwDdQGtwwDt+2cgKDLn0IRaSxYu1tSUjgKarSDkUM0ZNiSRXFpjxEsvc/Zgc5kq5omJ+V0a8/kIM2WD3sMOYg==", + "key": "@xterm+xterm@6.0.0-TQwDdQGtwwDt-2cgKDLn0IRaSxYu1tSUjgKarSDkUM0ZNiSRXFpjxEsvc_Zgc5kq5omJ-V0a8_kIM2WD3sMOYg", + "manifest": { + "name": "@xterm/xterm", + "description": "Full xterm terminal, in your browser", + "version": "6.0.0", + "main": "lib/xterm.js", + "module": "lib/xterm.mjs", + "style": "css/xterm.css", + "types": "typings/xterm.d.ts", + "repository": "https://github.com/xtermjs/xterm.js", + "license": "MIT", + "workspaces": [ + "addons/*" + ], + "keywords": [ + "cli", + "command-line", + "console", + "pty", + "shell", + "ssh", + "styles", + "terminal-emulator", + "terminal", + "tty", + "vt100", + "webgl", + "xterm" + ], + "scripts": { + "setup": "npm run build", + "start": "node demo/start", + "build": "npm run tsc", + "watch": "npm run tsc-watch", + "tsc": "tsc -b ./tsconfig.all.json", + "tsc-watch": "tsc -b -w ./tsconfig.all.json --preserveWatchOutput", + "esbuild": "node bin/esbuild_all.mjs", + "esbuild-watch": "node bin/esbuild_all.mjs --watch", + "esbuild-package": "node bin/esbuild_all.mjs --prod", + "esbuild-package-watch": "node bin/esbuild_all.mjs --prod --watch", + "esbuild-package-headless-only": "node bin/esbuild.mjs --prod --headless", + "esbuild-demo": "node bin/esbuild.mjs --demo-client", + "esbuild-demo-watch": "node bin/esbuild.mjs --demo-client --watch", + "test": "npm run test-unit", + "posttest": "npm run lint", + "lint": "eslint -c .eslintrc.json --max-warnings 0 --ext .ts src/ addons/", + "lint-fix": "eslint -c .eslintrc.json --fix --ext .ts src/ addons/", + "lint-api": "eslint --no-eslintrc -c .eslintrc.json.typings --max-warnings 0 --no-ignore --ext .d.ts typings/", + "test-unit": "node ./bin/test_unit.js", + "test-unit-coverage": "node ./bin/test_unit.js --coverage", + "test-unit-dev": "cross-env NODE_PATH='./out' mocha", + "test-integration": "node ./bin/test_integration.js --workers=75%", + "test-integration-chromium": "node ./bin/test_integration.js --workers=75% \"--project=ChromeStable\"", + "test-integration-firefox": "node ./bin/test_integration.js --workers=75% \"--project=FirefoxStable\"", + "test-integration-webkit": "node ./bin/test_integration.js --workers=75% \"--project=WebKit\"", + "test-integration-debug": "node ./bin/test_integration.js --workers=1 --headed --timeout=30000", + "benchmark": "NODE_PATH=./out xterm-benchmark -r 5 -c test/benchmark/benchmark.json", + "benchmark-baseline": "NODE_PATH=./out xterm-benchmark -r 5 -c test/benchmark/benchmark.json --baseline out-test/benchmark/*benchmark.js", + "benchmark-eval": "NODE_PATH=./out xterm-benchmark -r 5 -c test/benchmark/benchmark.json --eval out-test/benchmark/*benchmark.js", + "clean": "rm -rf lib out addons/*/lib addons/*/out", + "vtfeatures": "node bin/extract_vtfeatures.js src/**/*.ts src/*.ts", + "prepackage": "npm run build", + "package": "webpack", + "postpackage": "npm run esbuild-package", + "prepackage-headless": "npm run esbuild-package-headless-only", + "package-headless": "webpack --config ./webpack.config.headless.js", + "postpackage-headless": "node ./bin/package_headless.js", + "prepublishOnly": "npm run package" + }, + "devDependencies": { + "@lunapaint/png-codec": "^0.2.0", + "@playwright/test": "^1.37.1", + "@stylistic/eslint-plugin": "^2.3.0", + "@types/chai": "^4.2.22", + "@types/debug": "^4.1.7", + "@types/deep-equal": "^1.0.1", + "@types/express": "4", + "@types/express-ws": "^3.0.1", + "@types/jsdom": "^16.2.13", + "@types/mocha": "^9.0.0", + "@types/node": "^18.16.0", + "@types/trusted-types": "^1.0.6", + "@types/utf8": "^3.0.0", + "@types/webpack": "^5.28.0", + "@types/ws": "^8.2.0", + "@typescript-eslint/eslint-plugin": "^6.2.00", + "@typescript-eslint/parser": "^6.2.00", + "chai": "^4.3.4", + "cross-env": "^7.0.3", + "deep-equal": "^2.0.5", + "esbuild": "~0.25.2", + "eslint": "^8.56.0", + "eslint-plugin-jsdoc": "^46.9.1", + "express": "^4.19.2", + "express-ws": "^5.0.2", + "jsdom": "^18.0.1", + "mocha": "^10.1.0", + "mustache": "^4.2.0", + "node-pty": "1.1.0-beta19", + "nyc": "^15.1.0", + "source-map-loader": "^3.0.0", + "source-map-support": "^0.5.20", + "ts-loader": "^9.3.1", + "typescript": "5.5", + "utf8": "^3.0.0", + "webpack": "^5.61.0", + "webpack-cli": "^4.9.1", + "ws": "^8.2.3", + "xterm-benchmark": "^0.3.1" + }, + "commit": "f447274f430fd22513f6adbf9862d19524471c04" + }, + "files": [ + "LICENSE", + "README.md", + "css/xterm.css", + "lib/xterm.js", + "lib/xterm.js.map", + "lib/xterm.mjs", + "lib/xterm.mjs.map", + "package.json", + "src/browser/AccessibilityManager.ts", + "src/browser/Clipboard.ts", + "src/browser/ColorContrastCache.ts", + "src/browser/CoreBrowserTerminal.ts", + "src/browser/Linkifier.ts", + "src/browser/LocalizableStrings.ts", + "src/browser/OscLinkProvider.ts", + "src/browser/RenderDebouncer.ts", + "src/browser/TimeBasedDebouncer.ts", + "src/browser/Types.ts", + "src/browser/Viewport.ts", + "src/browser/decorations/BufferDecorationRenderer.ts", + "src/browser/decorations/ColorZoneStore.ts", + "src/browser/decorations/OverviewRulerRenderer.ts", + "src/browser/input/CompositionHelper.ts", + "src/browser/input/Mouse.ts", + "src/browser/input/MoveToCell.ts", + "src/browser/public/Terminal.ts", + "src/browser/renderer/dom/DomRenderer.ts", + "src/browser/renderer/dom/DomRendererRowFactory.ts", + "src/browser/renderer/dom/WidthCache.ts", + "src/browser/renderer/shared/Constants.ts", + "src/browser/renderer/shared/RendererUtils.ts", + "src/browser/renderer/shared/SelectionRenderModel.ts", + "src/browser/renderer/shared/Types.ts", + "src/browser/selection/SelectionModel.ts", + "src/browser/selection/Types.ts", + "src/browser/services/CharSizeService.ts", + "src/browser/services/CharacterJoinerService.ts", + "src/browser/services/CoreBrowserService.ts", + "src/browser/services/LinkProviderService.ts", + "src/browser/services/MouseService.ts", + "src/browser/services/RenderService.ts", + "src/browser/services/SelectionService.ts", + "src/browser/services/Services.ts", + "src/browser/services/ThemeService.ts", + "src/browser/shared/Constants.ts", + "src/common/CircularList.ts", + "src/common/Clone.ts", + "src/common/Color.ts", + "src/common/CoreTerminal.ts", + "src/common/InputHandler.ts", + "src/common/MultiKeyMap.ts", + "src/common/Platform.ts", + "src/common/SortedList.ts", + "src/common/TaskQueue.ts", + "src/common/TypedArrayUtils.ts", + "src/common/Types.ts", + "src/common/WindowsMode.ts", + "src/common/buffer/AttributeData.ts", + "src/common/buffer/Buffer.ts", + "src/common/buffer/BufferLine.ts", + "src/common/buffer/BufferRange.ts", + "src/common/buffer/BufferReflow.ts", + "src/common/buffer/BufferSet.ts", + "src/common/buffer/CellData.ts", + "src/common/buffer/Constants.ts", + "src/common/buffer/Marker.ts", + "src/common/buffer/Types.ts", + "src/common/data/Charsets.ts", + "src/common/data/EscapeSequences.ts", + "src/common/input/Keyboard.ts", + "src/common/input/TextDecoder.ts", + "src/common/input/UnicodeV6.ts", + "src/common/input/WriteBuffer.ts", + "src/common/input/XParseColor.ts", + "src/common/parser/Constants.ts", + "src/common/parser/DcsParser.ts", + "src/common/parser/EscapeSequenceParser.ts", + "src/common/parser/OscParser.ts", + "src/common/parser/Params.ts", + "src/common/parser/Types.ts", + "src/common/public/AddonManager.ts", + "src/common/public/BufferApiView.ts", + "src/common/public/BufferLineApiView.ts", + "src/common/public/BufferNamespaceApi.ts", + "src/common/public/ParserApi.ts", + "src/common/public/UnicodeApi.ts", + "src/common/services/BufferService.ts", + "src/common/services/CharsetService.ts", + "src/common/services/CoreMouseService.ts", + "src/common/services/CoreService.ts", + "src/common/services/DecorationService.ts", + "src/common/services/InstantiationService.ts", + "src/common/services/LogService.ts", + "src/common/services/OptionsService.ts", + "src/common/services/OscLinkService.ts", + "src/common/services/ServiceRegistry.ts", + "src/common/services/Services.ts", + "src/common/services/UnicodeService.ts", + "src/vs/base/browser/browser.ts", + "src/vs/base/browser/canIUse.ts", + "src/vs/base/browser/dom.ts", + "src/vs/base/browser/fastDomNode.ts", + "src/vs/base/browser/globalPointerMoveMonitor.ts", + "src/vs/base/browser/iframe.ts", + "src/vs/base/browser/keyboardEvent.ts", + "src/vs/base/browser/mouseEvent.ts", + "src/vs/base/browser/touch.ts", + "src/vs/base/browser/ui/scrollbar/abstractScrollbar.ts", + "src/vs/base/browser/ui/scrollbar/horizontalScrollbar.ts", + "src/vs/base/browser/ui/scrollbar/scrollableElement.ts", + "src/vs/base/browser/ui/scrollbar/scrollableElementOptions.ts", + "src/vs/base/browser/ui/scrollbar/scrollbarArrow.ts", + "src/vs/base/browser/ui/scrollbar/scrollbarState.ts", + "src/vs/base/browser/ui/scrollbar/scrollbarVisibilityController.ts", + "src/vs/base/browser/ui/scrollbar/verticalScrollbar.ts", + "src/vs/base/browser/ui/widget.ts", + "src/vs/base/browser/window.ts", + "src/vs/base/common/arrays.ts", + "src/vs/base/common/arraysFind.ts", + "src/vs/base/common/assert.ts", + "src/vs/base/common/async.ts", + "src/vs/base/common/cancellation.ts", + "src/vs/base/common/charCode.ts", + "src/vs/base/common/collections.ts", + "src/vs/base/common/decorators.ts", + "src/vs/base/common/equals.ts", + "src/vs/base/common/errors.ts", + "src/vs/base/common/event.ts", + "src/vs/base/common/functional.ts", + "src/vs/base/common/hash.ts", + "src/vs/base/common/iterator.ts", + "src/vs/base/common/keyCodes.ts", + "src/vs/base/common/keybindings.ts", + "src/vs/base/common/lazy.ts", + "src/vs/base/common/lifecycle.ts", + "src/vs/base/common/linkedList.ts", + "src/vs/base/common/map.ts", + "src/vs/base/common/numbers.ts", + "src/vs/base/common/observable.ts", + "src/vs/base/common/observableInternal/api.ts", + "src/vs/base/common/observableInternal/autorun.ts", + "src/vs/base/common/observableInternal/base.ts", + "src/vs/base/common/observableInternal/debugName.ts", + "src/vs/base/common/observableInternal/derived.ts", + "src/vs/base/common/observableInternal/lazyObservableValue.ts", + "src/vs/base/common/observableInternal/logging.ts", + "src/vs/base/common/observableInternal/promise.ts", + "src/vs/base/common/observableInternal/utils.ts", + "src/vs/base/common/platform.ts", + "src/vs/base/common/scrollable.ts", + "src/vs/base/common/sequence.ts", + "src/vs/base/common/stopwatch.ts", + "src/vs/base/common/strings.ts", + "src/vs/base/common/symbols.ts", + "src/vs/base/common/uint.ts", + "src/vs/patches/nls.ts", + "src/vs/typings/base-common.d.ts", + "src/vs/typings/require.d.ts", + "src/vs/typings/vscode-globals-nls.d.ts", + "src/vs/typings/vscode-globals-product.d.ts", + "typings/xterm.d.ts" + ], + "dependencies": {} + }, + "esbuild-wasm@0.28.2": { + "name": "esbuild-wasm", + "version": "0.28.2", + "integrity": "sha512-GccVwhv3mmOUVQHCQm2Ox/rby8n/EqUwvZxE6Pjfikrq/lWw9g9WX/u9EykWnpot3Ko6j426DgQdea2xWKIAQA==", + "key": "esbuild-wasm@0.28.2-GccVwhv3mmOUVQHCQm2Ox_rby8n_EqUwvZxE6Pjfikrq_lWw9g9WX_u9EykWnpot3Ko6j426DgQdea2xWKIAQA", + "manifest": { + "name": "esbuild-wasm", + "version": "0.28.2", + "description": "The cross-platform WebAssembly binary for esbuild, a JavaScript bundler.", + "repository": { + "type": "git", + "url": "git+https://github.com/evanw/esbuild.git" + }, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "main": "lib/main.js", + "browser": "lib/browser.js", + "types": "lib/main.d.ts", + "directories": { + "bin": "bin" + } + }, + "files": [ + "LICENSE.md", + "README.md", + "bin/esbuild", + "esbuild.wasm", + "esm/browser.d.ts", + "esm/browser.js", + "esm/browser.min.js", + "lib/browser.d.ts", + "lib/browser.js", + "lib/browser.min.js", + "lib/main.d.ts", + "lib/main.js", + "package.json", + "wasm_exec.js", + "wasm_exec_node.js" + ], + "dependencies": {} + }, + "react@19.3.1": { + "name": "react", + "version": "19.3.1", + "integrity": "sha512-QNhWdt7nrgVWWQG58QuGsAR3jv3Hbe4mb4vz7w2csnHavciZJgda1CPNaldF6eVxv90ud3jUXpKlHL69gO38yw==", + "key": "react@19.3.1-QNhWdt7nrgVWWQG58QuGsAR3jv3Hbe4mb4vz7w2csnHavciZJgda1CPNaldF6eVxv90ud3jUXpKlHL69gO38yw", + "manifest": { + "name": "react", + "description": "React is a JavaScript library for building user interfaces.", + "keywords": [ + "react" + ], + "version": "19.3.1", + "homepage": "https://react.dev/", + "bugs": "https://github.com/react/react/issues", + "license": "MIT", + "files": [ + "LICENSE", + "README.md", + "index.js", + "cjs/", + "compiler-runtime.js", + "jsx-runtime.js", + "jsx-runtime.react-server.js", + "jsx-dev-runtime.js", + "jsx-dev-runtime.react-server.js", + "react.react-server.js" + ], + "main": "index.js", + "exports": { + ".": { + "react-server": "./react.react-server.js", + "default": "./index.js" + }, + "./package.json": "./package.json", + "./jsx-runtime": { + "react-server": "./jsx-runtime.react-server.js", + "default": "./jsx-runtime.js" + }, + "./jsx-dev-runtime": { + "react-server": "./jsx-dev-runtime.react-server.js", + "default": "./jsx-dev-runtime.js" + }, + "./compiler-runtime": { + "react-server": "./compiler-runtime.js", + "default": "./compiler-runtime.js" + } + }, + "repository": { + "type": "git", + "url": "https://github.com/react/react.git", + "directory": "packages/react" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "files": [ + "LICENSE", + "README.md", + "cjs/react-compiler-runtime.development.js", + "cjs/react-compiler-runtime.production.js", + "cjs/react-compiler-runtime.profiling.js", + "cjs/react-jsx-dev-runtime.development.js", + "cjs/react-jsx-dev-runtime.production.js", + "cjs/react-jsx-dev-runtime.profiling.js", + "cjs/react-jsx-dev-runtime.react-server.development.js", + "cjs/react-jsx-dev-runtime.react-server.production.js", + "cjs/react-jsx-runtime.development.js", + "cjs/react-jsx-runtime.production.js", + "cjs/react-jsx-runtime.profiling.js", + "cjs/react-jsx-runtime.react-server.development.js", + "cjs/react-jsx-runtime.react-server.production.js", + "cjs/react.development.js", + "cjs/react.production.js", + "cjs/react.react-server.development.js", + "cjs/react.react-server.production.js", + "compiler-runtime.js", + "index.js", + "jsx-dev-runtime.js", + "jsx-dev-runtime.react-server.js", + "jsx-runtime.js", + "jsx-runtime.react-server.js", + "package.json", + "react.react-server.js" + ], + "dependencies": {} + }, + "react-dom@19.3.1": { + "name": "react-dom", + "version": "19.3.1", + "integrity": "sha512-Y0bARz53lhEC1NMCASs0/j+faB/zqt3R8hpvg1e8+61ZVJ4UL0UdC4cBbXfZMcIuhrfgeILTLe+ZeBCavQPtKQ==", + "key": "react-dom@19.3.1-Y0bARz53lhEC1NMCASs0_j-faB_zqt3R8hpvg1e8-61ZVJ4UL0UdC4cBbXfZMcIuhrfgeILTLe-ZeBCavQPtKQ", + "manifest": { + "name": "react-dom", + "version": "19.3.1", + "description": "React package for working with the DOM.", + "main": "index.js", + "repository": { + "type": "git", + "url": "https://github.com/react/react.git", + "directory": "packages/react-dom" + }, + "keywords": [ + "react" + ], + "license": "MIT", + "bugs": { + "url": "https://github.com/react/react/issues" + }, + "homepage": "https://react.dev/", + "dependencies": { + "scheduler": "^0.28.0" + }, + "peerDependencies": { + "react": "^19.3.1" + }, + "files": [ + "LICENSE", + "README.md", + "client.js", + "client.react-server.js", + "index.js", + "profiling.js", + "profiling.react-server.js", + "react-dom.react-server.js", + "server.browser.js", + "server.bun.js", + "server.edge.js", + "server.js", + "server.node.js", + "server.react-server.js", + "static.browser.js", + "static.edge.js", + "static.js", + "static.node.js", + "static.react-server.js", + "test-utils.js", + "cjs/" + ], + "exports": { + ".": { + "react-server": "./react-dom.react-server.js", + "default": "./index.js" + }, + "./client": { + "react-server": "./client.react-server.js", + "default": "./client.js" + }, + "./server": { + "react-server": "./server.react-server.js", + "workerd": "./server.edge.js", + "bun": "./server.bun.js", + "deno": "./server.node.js", + "worker": "./server.browser.js", + "node": "./server.node.js", + "edge-light": "./server.edge.js", + "browser": "./server.browser.js", + "default": "./server.node.js" + }, + "./server.browser": { + "react-server": "./server.react-server.js", + "default": "./server.browser.js" + }, + "./server.bun": { + "react-server": "./server.react-server.js", + "default": "./server.bun.js" + }, + "./server.edge": { + "react-server": "./server.react-server.js", + "default": "./server.edge.js" + }, + "./server.node": { + "react-server": "./server.react-server.js", + "default": "./server.node.js" + }, + "./static": { + "react-server": "./static.react-server.js", + "workerd": "./static.edge.js", + "deno": "./static.browser.js", + "worker": "./static.browser.js", + "node": "./static.node.js", + "edge-light": "./static.edge.js", + "browser": "./static.browser.js", + "default": "./static.node.js" + }, + "./static.browser": { + "react-server": "./static.react-server.js", + "default": "./static.browser.js" + }, + "./static.edge": { + "react-server": "./static.react-server.js", + "default": "./static.edge.js" + }, + "./static.node": { + "react-server": "./static.react-server.js", + "default": "./static.node.js" + }, + "./profiling": { + "react-server": "./profiling.react-server.js", + "default": "./profiling.js" + }, + "./test-utils": "./test-utils.js", + "./package.json": "./package.json" + }, + "browser": { + "./server.js": "./server.browser.js", + "./static.js": "./static.browser.js" + } + }, + "files": [ + "LICENSE", + "README.md", + "cjs/react-dom-client.development.js", + "cjs/react-dom-client.production.js", + "cjs/react-dom-profiling.development.js", + "cjs/react-dom-profiling.profiling.js", + "cjs/react-dom-server-legacy.browser.development.js", + "cjs/react-dom-server-legacy.browser.production.js", + "cjs/react-dom-server-legacy.node.development.js", + "cjs/react-dom-server-legacy.node.production.js", + "cjs/react-dom-server.browser.development.js", + "cjs/react-dom-server.browser.production.js", + "cjs/react-dom-server.bun.development.js", + "cjs/react-dom-server.bun.production.js", + "cjs/react-dom-server.edge.development.js", + "cjs/react-dom-server.edge.production.js", + "cjs/react-dom-server.node.development.js", + "cjs/react-dom-server.node.production.js", + "cjs/react-dom-test-utils.development.js", + "cjs/react-dom-test-utils.production.js", + "cjs/react-dom.development.js", + "cjs/react-dom.production.js", + "cjs/react-dom.react-server.development.js", + "cjs/react-dom.react-server.production.js", + "client.js", + "client.react-server.js", + "index.js", + "package.json", + "profiling.js", + "profiling.react-server.js", + "react-dom.react-server.js", + "server.browser.js", + "server.bun.js", + "server.edge.js", + "server.js", + "server.node.js", + "server.react-server.js", + "static.browser.js", + "static.edge.js", + "static.js", + "static.node.js", + "static.react-server.js", + "test-utils.js" + ], + "dependencies": { + "scheduler": "scheduler@0.28.0", + "react": "react@19.3.1" + } + }, + "scheduler@0.28.0": { + "name": "scheduler", + "version": "0.28.0", + "integrity": "sha512-juorfCmIkIw8tT+p5BXSm6PJjQF/ycEYmKyzURCIt/RaZIhL+PulbQ9Yu2z1HdOJDdqDTlxA1+xKBmHXJsczAw==", + "key": "scheduler@0.28.0-juorfCmIkIw8tT-p5BXSm6PJjQF_ycEYmKyzURCIt_RaZIhL-PulbQ9Yu2z1HdOJDdqDTlxA1-xKBmHXJsczAw", + "manifest": { + "name": "scheduler", + "version": "0.28.0", + "description": "Cooperative scheduler for the browser environment.", + "repository": { + "type": "git", + "url": "https://github.com/react/react.git", + "directory": "packages/scheduler" + }, + "license": "MIT", + "keywords": [ + "react" + ], + "bugs": { + "url": "https://github.com/react/react/issues" + }, + "homepage": "https://react.dev/", + "files": [ + "LICENSE", + "README.md", + "index.js", + "index.native.js", + "unstable_mock.js", + "unstable_post_task.js", + "cjs/" + ] + }, + "files": [ + "LICENSE", + "README.md", + "cjs/scheduler-unstable_mock.development.js", + "cjs/scheduler-unstable_mock.production.js", + "cjs/scheduler-unstable_post_task.development.js", + "cjs/scheduler-unstable_post_task.production.js", + "cjs/scheduler.development.js", + "cjs/scheduler.native.development.js", + "cjs/scheduler.native.production.js", + "cjs/scheduler.production.js", + "index.js", + "index.native.js", + "package.json", + "unstable_mock.js", + "unstable_post_task.js" + ], + "dependencies": {} + }, + "semver@7.7.3": { + "name": "semver", + "version": "7.7.3", + "integrity": "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q==", + "key": "semver@7.7.3-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl-dPb_rExr0Btby5loQm20Q", + "manifest": { + "name": "semver", + "version": "7.7.3", + "description": "The semantic version parser used by npm.", + "main": "index.js", + "scripts": { + "test": "tap", + "snap": "tap", + "lint": "npm run eslint", + "postlint": "template-oss-check", + "lintfix": "npm run eslint -- --fix", + "posttest": "npm run lint", + "template-oss-apply": "template-oss-apply --force", + "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"" + }, + "devDependencies": { + "@npmcli/eslint-config": "^5.0.0", + "@npmcli/template-oss": "4.25.1", + "benchmark": "^2.1.4", + "tap": "^16.0.0" + }, + "license": "ISC", + "repository": { + "type": "git", + "url": "git+https://github.com/npm/node-semver.git" + }, + "bin": { + "semver": "bin/semver.js" + }, + "files": [ + "bin/", + "lib/", + "classes/", + "functions/", + "internal/", + "ranges/", + "index.js", + "preload.js", + "range.bnf" + ], + "tap": { + "timeout": 30, + "coverage-map": "map.js", + "nyc-arg": [ + "--exclude", + "tap-snapshots/**" + ] + }, + "engines": { + "node": ">=10" + }, + "author": "GitHub Inc.", + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "4.25.1", + "engines": ">=10", + "distPaths": [ + "classes/", + "functions/", + "internal/", + "ranges/", + "index.js", + "preload.js", + "range.bnf" + ], + "allowPaths": [ + "/classes/", + "/functions/", + "/internal/", + "/ranges/", + "/index.js", + "/preload.js", + "/range.bnf", + "/benchmarks" + ], + "publish": "true" + } + }, + "files": [ + "LICENSE", + "README.md", + "bin/semver.js", + "classes/comparator.js", + "classes/index.js", + "classes/range.js", + "classes/semver.js", + "functions/clean.js", + "functions/cmp.js", + "functions/coerce.js", + "functions/compare-build.js", + "functions/compare-loose.js", + "functions/compare.js", + "functions/diff.js", + "functions/eq.js", + "functions/gt.js", + "functions/gte.js", + "functions/inc.js", + "functions/lt.js", + "functions/lte.js", + "functions/major.js", + "functions/minor.js", + "functions/neq.js", + "functions/parse.js", + "functions/patch.js", + "functions/prerelease.js", + "functions/rcompare.js", + "functions/rsort.js", + "functions/satisfies.js", + "functions/sort.js", + "functions/valid.js", + "index.js", + "internal/constants.js", + "internal/debug.js", + "internal/identifiers.js", + "internal/lrucache.js", + "internal/parse-options.js", + "internal/re.js", + "package.json", + "preload.js", + "range.bnf", + "ranges/gtr.js", + "ranges/intersects.js", + "ranges/ltr.js", + "ranges/max-satisfying.js", + "ranges/min-satisfying.js", + "ranges/min-version.js", + "ranges/outside.js", + "ranges/simplify.js", + "ranges/subset.js", + "ranges/to-comparators.js", + "ranges/valid.js" + ], + "dependencies": {} + } + } +} diff --git a/webfront.project.json b/webfront.project.json new file mode 100644 index 00000000..aff1b72c --- /dev/null +++ b/webfront.project.json @@ -0,0 +1,48 @@ +{ + "format": 1, + "name": "webfront-developer-tools", + "version": "0.1.0", + "dependencies": { + "@xterm/addon-fit": "0.11.0", + "@xterm/xterm": "6.0.0", + "esbuild-wasm": "0.28.2", + "react": "19.3.1", + "react-dom": "19.3.1", + "semver": "7.7.3" + }, + "scripts": { + "build": "js/developer/scripts/build.mjs", + "site": "js/developer/scripts/site.mjs", + "pin": "js/developer/scripts/pin.mjs" + }, + "permissions": { + "files": [ + "webfront.project.json", + "webfront-packages.lock.json", + ".webfront/developer/packages", + "js/core/bootstrap", + "js/developer/environment", + "js/developer/tools", + "js/developer/scripts", + "examples/life/ui", + "third_party/fflate", + "include/webfront/system/DeveloperReleaseData.hpp" + ], + "publish": [ + "build-distribution", + "build-distribution-repeat", + "build-developer-environment", + "build-site", + "js/core/bootstrap/bootstrap.bundle.mjs", + "js/developer/environment/packages.bundle.mjs", + "js/developer/environment/PACKAGES-LICENSE.txt", + "js/developer/environment/bundles.json", + "include/webfront/system/DeveloperReleaseData.hpp", + "include/webfront/system/DeveloperIndexHtmlData.hpp", + "include/webfront/system/DeveloperBootstrapData.hpp" + ], + "fetch": [ + "https://ambroise-leclerc.github.io" + ] + } +} From 78b71b2beccc5a7ba5c3735c409c10fe628fba0b Mon Sep 17 00:00:00 2001 From: Ambroise Leclerc Date: Fri, 23 Oct 2026 18:58:02 +0200 Subject: [PATCH 2/9] Test the self-build, publish without Node.js and document the migration [#315] CTest SelfBuild*: install the build dependencies from the local registry, build twice (same bytes, and the bytes of the fixtures built with Node.js), rebuild the checked-in bootstrap bundles, checksums and core headers, stage the Pages site and refuse to change a published version, and check the manifest permissions. DeveloperDistribution.yml: a wf-package job with Node.js removed from the runner builds and compares with the Node.js job; the publish job stages the site with wf and uses pages.sh and archive-release.sh. WEBFRONT_REQUIRE_NODE=OFF configures a test build without Node.js. wf run embed-core regenerates the core headers. ADR-016 1.2, PUBLISHING.md, the inventory of the Node.js tools (docs/NODE_TOOLS_MIGRATION.md), changelog and status. --- .github/actions/remove-node/action.yml | 22 +++++ .github/actions/wf-driver/action.yml | 42 +++++++++ .github/workflows/DeveloperDistribution.yml | 98 ++++++++++++++++++--- AGENTS.md | 11 ++- CMakeLists.txt | 1 + docs/CHANGELOG.md | 15 ++++ docs/DEVELOPER_ENVIRONMENT.md | 46 +++++++--- docs/NODE_TOOLS_MIGRATION.md | 53 +++++++++++ docs/PROJECT_STATUS.md | 21 +++++ docs/adr/ADR-016-bootstrap-comme-socle.md | 21 ++++- docs/adr/README.md | 2 +- js/core/WebFrontAssets.cmake | 35 +++++--- js/developer/environment/bundles.json | 2 +- js/developer/scripts/embed-core.mjs | 23 +++++ js/developer/tools/PUBLISHING.md | 57 +++++++++--- js/developer/tools/archive-release.sh | 44 +++++++++ js/developer/tools/pages.sh | 16 ++++ test/cmake/CheckSelfBuildRefresh.cmake | 25 ++++++ test/cmake/CompareFiles.cmake | 14 +++ test/cmake/PrepareSelfBuildProject.cmake | 17 ++++ test/cmake/TamperFile.cmake | 6 ++ test/web/CMakeLists.txt | 70 +++++++++++++++ webfront.project.json | 11 ++- 23 files changed, 599 insertions(+), 53 deletions(-) create mode 100644 .github/actions/remove-node/action.yml create mode 100644 .github/actions/wf-driver/action.yml create mode 100644 docs/NODE_TOOLS_MIGRATION.md create mode 100644 js/developer/scripts/embed-core.mjs create mode 100644 js/developer/tools/archive-release.sh create mode 100644 js/developer/tools/pages.sh create mode 100644 test/cmake/CheckSelfBuildRefresh.cmake create mode 100644 test/cmake/CompareFiles.cmake create mode 100644 test/cmake/PrepareSelfBuildProject.cmake create mode 100644 test/cmake/TamperFile.cmake diff --git a/.github/actions/remove-node/action.yml b/.github/actions/remove-node/action.yml new file mode 100644 index 00000000..eae461e7 --- /dev/null +++ b/.github/actions/remove-node/action.yml @@ -0,0 +1,22 @@ +name: Remove Node.js +description: >- + Deletes node, nodejs, npm, npx and corepack from the runner (an ephemeral machine), then checks that none is reachable: + the steps that follow are the proof that a path needs no Node.js. +runs: + using: composite + steps: + - name: Remove Node.js, npm and npx + shell: bash + run: | + for tool in node nodejs npm npx corepack; do + while path=$(command -v "$tool"); do + sudo rm -f "$path" || exit 1 + hash -r + done + done + for tool in node nodejs npm npx; do + if command -v "$tool"; then + echo "::error::$tool is still reachable" + exit 1 + fi + done diff --git a/.github/actions/wf-driver/action.yml b/.github/actions/wf-driver/action.yml new file mode 100644 index 00000000..c3a26d06 --- /dev/null +++ b/.github/actions/wf-driver/action.yml @@ -0,0 +1,42 @@ +name: Build the wf driver +description: >- + Builds webfront-wf (WebKitGTK frontend), the non-interactive driver of the WebFront developer environment, from the + bootstrap environment pinned by cmake/WebFrontBootstrap.cmake, and installs a `wf` command that runs a wf command on the + project at the root of the workspace. Node.js is neither used nor required (WEBFRONT_REQUIRE_NODE=OFF). +runs: + using: composite + steps: + - uses: ./.github/actions/setup-cmake + with: + version: '4.4.4' + # Ubuntu 26.04 ships GCC 16 in its main archive. The image already provides Ninja, pkg-config and Xvfb. + - name: Install GCC 16 and WebKitGTK + shell: bash + run: | + sudo apt-get update + sudo apt-get install -y --no-install-recommends -o Acquire::Retries=3 gcc-16 g++-16 libwebkitgtk-6.0-dev + echo "CC=gcc-16" >> "$GITHUB_ENV" + echo "CXX=g++-16" >> "$GITHUB_ENV" + - name: Build webfront-wf + shell: bash + run: | + cmake -S . -B build-driver -G Ninja -DCMAKE_BUILD_TYPE=Release -DWEBFRONT_EMBED_CEF=OFF -DENABLE_TESTING=ON \ + -DWEBFRONT_REQUIRE_NODE=OFF -DWEBFRONT_EMBED_WEBKITGTK=ON -DWEBFRONT_WEBTEST_FRONTEND=WebKitGTK \ + -DCMAKE_CXX_SCAN_FOR_MODULES=OFF + cmake --build build-driver --target webfront-wf --parallel 2 + - name: Install the wf command + shell: bash + run: | + bin="$RUNNER_TEMP/wf-bin" + mkdir -p "$bin" + # The sandbox opt-out is confined to this driver, which runs trusted sources and a verified environment. + cat > "$bin/wf" <