muse/esp32-eink-display
A 55×46 mm two-layer ESP32-S3 e-paper controller board with USB‑C power/programming, buck regulation, FPC display connector, UC8179-style boost/charge-pump circuitry, ESD protection, controls, and routed passive components.
- Version
- 1.3.4
- License
- unset
- Stars
- 0
scripts/webgpu-bundle-utils.mjs
import ts from "typescript";
export function findWorker(source) {
const ast = ts.createSourceFile("standalone.js", source, ts.ScriptTarget.Latest, true, ts.ScriptKind.JS);
const workers = [];
function visit(node) {
if (ts.isStringLiteral(node) && node.text.includes("Unsupported WebGPU geometry:") && node.text.includes("Unsupported shape:"))
workers.push({start: node.getStart(ast), end: node.end, text: node.text});
ts.forEachChild(node, visit);
}
visit(ast);
if (workers.length !== 1) throw new Error(`Expected one WebGPU worker, found ${workers.length}`);
return workers[0];
}
export function findShapeFunction(worker) {
const ast = ts.createSourceFile("worker.js", worker, ts.ScriptTarget.Latest, true, ts.ScriptKind.JS);
if (ast.parseDiagnostics.length) throw new Error("Worker has syntax errors");
let found;
function visit(node) {
if (ts.isFunctionDeclaration(node) && node.name?.text === "P") found = node.getText(ast);
ts.forEachChild(node, visit);
}
visit(ast);
if (!found?.includes("Unsupported shape:")) throw new Error("Expected shape compiler not found");
return found;
}
