mirror of
https://github.com/yt-dlp/ejs.git
synced 2026-06-25 07:41:58 +00:00
27 lines
714 B
TypeScript
27 lines
714 B
TypeScript
import { argv } from "node:process";
|
|
|
|
import { generate } from "astring";
|
|
import { parse } from "meriyah";
|
|
|
|
import { getSolutions, modifyPlayer } from "./solvers.ts";
|
|
import { getIO } from "./test/io.ts";
|
|
import { downloadCached } from "./test/utils.ts";
|
|
|
|
const data = await (
|
|
argv.length > 3
|
|
? () => downloadCached(argv[2], argv[3])
|
|
: async () => {
|
|
const io = await getIO();
|
|
return await io.read(argv[2]);
|
|
}
|
|
)();
|
|
|
|
const program = parse(data);
|
|
const statements = modifyPlayer(program);
|
|
const solutionMap = getSolutions(statements);
|
|
for (const solutions of Object.values(solutionMap)) {
|
|
for (const solution of solutions) {
|
|
console.log(String.raw`${generate(solution)}`);
|
|
}
|
|
}
|