2/**
3 * The published command's entry point, whose only job is to be parseable by
4 * whatever node it lands on.
5 *
6 * fill.js is a modern bundle: on node 10 its very first `import {` is a syntax
7 * error, on 12 and 14 it is `??`, and what the user sees is a caret under a
8 * brace with no indication of what is wrong or what to do. That happens before
9 * any code runs, so no check inside the bundle can ever report it. This file
10 * is therefore deliberately ES5 — no arrow functions, no template literals, no
11 * optional chaining, and the dynamic import hidden inside a Function body,
12 * since older node cannot parse that either.
13 *
14 * It is copied into the tarball as launch.cjs by scripts/pack-cli.mjs.
15 */
16;
18var MIN_MAJOR = 18;
19var have = process.versions.node;
20var major = parseInt(have.split('.')[0], 10);
22if (!(major >= MIN_MAJOR)) {
23 process.stderr.write(
24 'turing-surface-cache: this is node ' + have + ', and filling the cache needs node ' +
25 MIN_MAJOR + ' or newer.\n' +
26 ' The solver reaches the GPU through WebGPU, and the cache keys through\n' +
27 ' WebCrypto, neither of which older node has.\n' +
28 ' nodejs.org has current builds; nvm, fnm and asdf install one per user\n' +
29 ' without touching what the system depends on.\n',
30 );
31 process.exit(1);
32}
34var path = require('path');
35var url = require('url');
36var target = url.pathToFileURL(path.join(__dirname, 'fill.js')).href;
38// `import(target)` as written syntax would be a parse error on the versions
39// this file exists to talk to, so it is built at run time instead — by which
40// point the check above has already sent them away.
41new Function('specifier', 'return import(specifier);')(target).catch(function (e) {
42 process.stderr.write(String((e && e.stack) || e) + '\n');
43 process.exit(1);
44});