diff --git a/bundle.ts b/bundle.ts deleted file mode 100644 index 9316f50..0000000 --- a/bundle.ts +++ /dev/null @@ -1,12 +0,0 @@ -import * as esbuild from "npm:esbuild@0.25.5"; -import { denoPlugins } from "jsr:@luca/esbuild-deno-loader@0.11.1"; - -await esbuild.build({ - plugins: [...denoPlugins()], - entryPoints: ["./src/main.ts"], - outfile: "./dist/jsc-deno.js", - bundle: true, - format: "esm", - sourcemap: false, -}); -esbuild.stop(); diff --git a/deno.jsonc b/deno.jsonc index 62c0112..d99f661 100644 --- a/deno.jsonc +++ b/deno.jsonc @@ -1,10 +1,18 @@ { + "imports":{ + "@babel/generator": "npm:@babel/generator@7.28.3", + "@babel/parser": "npm:@babel/parser@7.28.3", + "@babel/types": "npm:@babel/types@7.28.2", + "@std/assert": "jsr:@std/assert@1", + "@std/io": "jsr:@std/io", + "@std/fs/exists": "jsr:@std/fs/exists" + }, "test": { "exclude": ["./dist"] }, "tasks": { "download": "deno run --allow-read --allow-write --allow-net=www.youtube.com tests/download.ts", "test": "deno test --allow-read --allow-env=BABEL_TYPES_8_BREAKING --location 'https://www.youtube.com/watch?v=yt-dlp-wins'", - "bundle": "deno run --allow-env --allow-read --allow-run --allow-write bundle.ts" + "bundle": "deno bundle --output dist/jsc-deno.js src/main.ts" } } diff --git a/deno.lock b/deno.lock index 38e3e1f..9f77cd2 100644 --- a/deno.lock +++ b/deno.lock @@ -1,29 +1,15 @@ { "version": "5", "specifiers": { - "jsr:@luca/esbuild-deno-loader@0.11.1": "0.11.1", "jsr:@std/assert@1": "1.0.14", - "jsr:@std/bytes@^1.0.2": "1.0.6", "jsr:@std/bytes@^1.0.5": "1.0.6", - "jsr:@std/encoding@^1.0.5": "1.0.10", - "jsr:@std/fs@*": "1.0.19", "jsr:@std/internal@^1.0.10": "1.0.10", "jsr:@std/io@*": "0.225.2", - "jsr:@std/path@^1.0.6": "1.1.2", "npm:@babel/generator@7.28.3": "7.28.3", "npm:@babel/parser@7.28.3": "7.28.3", - "npm:@babel/types@7.28.2": "7.28.2", - "npm:esbuild@0.25.5": "0.25.5" + "npm:@babel/types@7.28.2": "7.28.2" }, "jsr": { - "@luca/esbuild-deno-loader@0.11.1": { - "integrity": "dc020d16d75b591f679f6b9288b10f38bdb4f24345edb2f5732affa1d9885267", - "dependencies": [ - "jsr:@std/bytes@^1.0.2", - "jsr:@std/encoding", - "jsr:@std/path" - ] - }, "@std/assert@1.0.14": { "integrity": "68d0d4a43b365abc927f45a9b85c639ea18a9fab96ad92281e493e4ed84abaa4", "dependencies": [ @@ -33,25 +19,13 @@ "@std/bytes@1.0.6": { "integrity": "f6ac6adbd8ccd99314045f5703e23af0a68d7f7e58364b47d2c7f408aeb5820a" }, - "@std/encoding@1.0.10": { - "integrity": "8783c6384a2d13abd5e9e87a7ae0520a30e9f56aeeaa3bdf910a3eaaf5c811a1" - }, - "@std/fs@1.0.19": { - "integrity": "051968c2b1eae4d2ea9f79a08a3845740ef6af10356aff43d3e2ef11ed09fb06" - }, "@std/internal@1.0.10": { "integrity": "e3be62ce42cab0e177c27698e5d9800122f67b766a0bea6ca4867886cbde8cf7" }, "@std/io@0.225.2": { "integrity": "3c740cd4ee4c082e6cfc86458f47e2ab7cb353dc6234d5e9b1f91a2de5f4d6c7", "dependencies": [ - "jsr:@std/bytes@^1.0.5" - ] - }, - "@std/path@1.1.2": { - "integrity": "c0b13b97dfe06546d5e16bf3966b1cadf92e1cc83e56ba5476ad8b498d9e3038", - "dependencies": [ - "jsr:@std/internal" + "jsr:@std/bytes" ] } }, @@ -86,131 +60,6 @@ "@babel/helper-validator-identifier" ] }, - "@esbuild/aix-ppc64@0.25.5": { - "integrity": "sha512-9o3TMmpmftaCMepOdA5k/yDw8SfInyzWWTjYTFCX3kPSDJMROQTb8jg+h9Cnwnmm1vOzvxN7gIfB5V2ewpjtGA==", - "os": ["aix"], - "cpu": ["ppc64"] - }, - "@esbuild/android-arm64@0.25.5": { - "integrity": "sha512-VGzGhj4lJO+TVGV1v8ntCZWJktV7SGCs3Pn1GRWI1SBFtRALoomm8k5E9Pmwg3HOAal2VDc2F9+PM/rEY6oIDg==", - "os": ["android"], - "cpu": ["arm64"] - }, - "@esbuild/android-arm@0.25.5": { - "integrity": "sha512-AdJKSPeEHgi7/ZhuIPtcQKr5RQdo6OO2IL87JkianiMYMPbCtot9fxPbrMiBADOWWm3T2si9stAiVsGbTQFkbA==", - "os": ["android"], - "cpu": ["arm"] - }, - "@esbuild/android-x64@0.25.5": { - "integrity": "sha512-D2GyJT1kjvO//drbRT3Hib9XPwQeWd9vZoBJn+bu/lVsOZ13cqNdDeqIF/xQ5/VmWvMduP6AmXvylO/PIc2isw==", - "os": ["android"], - "cpu": ["x64"] - }, - "@esbuild/darwin-arm64@0.25.5": { - "integrity": "sha512-GtaBgammVvdF7aPIgH2jxMDdivezgFu6iKpmT+48+F8Hhg5J/sfnDieg0aeG/jfSvkYQU2/pceFPDKlqZzwnfQ==", - "os": ["darwin"], - "cpu": ["arm64"] - }, - "@esbuild/darwin-x64@0.25.5": { - "integrity": "sha512-1iT4FVL0dJ76/q1wd7XDsXrSW+oLoquptvh4CLR4kITDtqi2e/xwXwdCVH8hVHU43wgJdsq7Gxuzcs6Iq/7bxQ==", - "os": ["darwin"], - "cpu": ["x64"] - }, - "@esbuild/freebsd-arm64@0.25.5": { - "integrity": "sha512-nk4tGP3JThz4La38Uy/gzyXtpkPW8zSAmoUhK9xKKXdBCzKODMc2adkB2+8om9BDYugz+uGV7sLmpTYzvmz6Sw==", - "os": ["freebsd"], - "cpu": ["arm64"] - }, - "@esbuild/freebsd-x64@0.25.5": { - "integrity": "sha512-PrikaNjiXdR2laW6OIjlbeuCPrPaAl0IwPIaRv+SMV8CiM8i2LqVUHFC1+8eORgWyY7yhQY+2U2fA55mBzReaw==", - "os": ["freebsd"], - "cpu": ["x64"] - }, - "@esbuild/linux-arm64@0.25.5": { - "integrity": "sha512-Z9kfb1v6ZlGbWj8EJk9T6czVEjjq2ntSYLY2cw6pAZl4oKtfgQuS4HOq41M/BcoLPzrUbNd+R4BXFyH//nHxVg==", - "os": ["linux"], - "cpu": ["arm64"] - }, - "@esbuild/linux-arm@0.25.5": { - "integrity": "sha512-cPzojwW2okgh7ZlRpcBEtsX7WBuqbLrNXqLU89GxWbNt6uIg78ET82qifUy3W6OVww6ZWobWub5oqZOVtwolfw==", - "os": ["linux"], - "cpu": ["arm"] - }, - "@esbuild/linux-ia32@0.25.5": { - "integrity": "sha512-sQ7l00M8bSv36GLV95BVAdhJ2QsIbCuCjh/uYrWiMQSUuV+LpXwIqhgJDcvMTj+VsQmqAHL2yYaasENvJ7CDKA==", - "os": ["linux"], - "cpu": ["ia32"] - }, - "@esbuild/linux-loong64@0.25.5": { - "integrity": "sha512-0ur7ae16hDUC4OL5iEnDb0tZHDxYmuQyhKhsPBV8f99f6Z9KQM02g33f93rNH5A30agMS46u2HP6qTdEt6Q1kg==", - "os": ["linux"], - "cpu": ["loong64"] - }, - "@esbuild/linux-mips64el@0.25.5": { - "integrity": "sha512-kB/66P1OsHO5zLz0i6X0RxlQ+3cu0mkxS3TKFvkb5lin6uwZ/ttOkP3Z8lfR9mJOBk14ZwZ9182SIIWFGNmqmg==", - "os": ["linux"], - "cpu": ["mips64el"] - }, - "@esbuild/linux-ppc64@0.25.5": { - "integrity": "sha512-UZCmJ7r9X2fe2D6jBmkLBMQetXPXIsZjQJCjgwpVDz+YMcS6oFR27alkgGv3Oqkv07bxdvw7fyB71/olceJhkQ==", - "os": ["linux"], - "cpu": ["ppc64"] - }, - "@esbuild/linux-riscv64@0.25.5": { - "integrity": "sha512-kTxwu4mLyeOlsVIFPfQo+fQJAV9mh24xL+y+Bm6ej067sYANjyEw1dNHmvoqxJUCMnkBdKpvOn0Ahql6+4VyeA==", - "os": ["linux"], - "cpu": ["riscv64"] - }, - "@esbuild/linux-s390x@0.25.5": { - "integrity": "sha512-K2dSKTKfmdh78uJ3NcWFiqyRrimfdinS5ErLSn3vluHNeHVnBAFWC8a4X5N+7FgVE1EjXS1QDZbpqZBjfrqMTQ==", - "os": ["linux"], - "cpu": ["s390x"] - }, - "@esbuild/linux-x64@0.25.5": { - "integrity": "sha512-uhj8N2obKTE6pSZ+aMUbqq+1nXxNjZIIjCjGLfsWvVpy7gKCOL6rsY1MhRh9zLtUtAI7vpgLMK6DxjO8Qm9lJw==", - "os": ["linux"], - "cpu": ["x64"] - }, - "@esbuild/netbsd-arm64@0.25.5": { - "integrity": "sha512-pwHtMP9viAy1oHPvgxtOv+OkduK5ugofNTVDilIzBLpoWAM16r7b/mxBvfpuQDpRQFMfuVr5aLcn4yveGvBZvw==", - "os": ["netbsd"], - "cpu": ["arm64"] - }, - "@esbuild/netbsd-x64@0.25.5": { - "integrity": "sha512-WOb5fKrvVTRMfWFNCroYWWklbnXH0Q5rZppjq0vQIdlsQKuw6mdSihwSo4RV/YdQ5UCKKvBy7/0ZZYLBZKIbwQ==", - "os": ["netbsd"], - "cpu": ["x64"] - }, - "@esbuild/openbsd-arm64@0.25.5": { - "integrity": "sha512-7A208+uQKgTxHd0G0uqZO8UjK2R0DDb4fDmERtARjSHWxqMTye4Erz4zZafx7Di9Cv+lNHYuncAkiGFySoD+Mw==", - "os": ["openbsd"], - "cpu": ["arm64"] - }, - "@esbuild/openbsd-x64@0.25.5": { - "integrity": "sha512-G4hE405ErTWraiZ8UiSoesH8DaCsMm0Cay4fsFWOOUcz8b8rC6uCvnagr+gnioEjWn0wC+o1/TAHt+It+MpIMg==", - "os": ["openbsd"], - "cpu": ["x64"] - }, - "@esbuild/sunos-x64@0.25.5": { - "integrity": "sha512-l+azKShMy7FxzY0Rj4RCt5VD/q8mG/e+mDivgspo+yL8zW7qEwctQ6YqKX34DTEleFAvCIUviCFX1SDZRSyMQA==", - "os": ["sunos"], - "cpu": ["x64"] - }, - "@esbuild/win32-arm64@0.25.5": { - "integrity": "sha512-O2S7SNZzdcFG7eFKgvwUEZ2VG9D/sn/eIiz8XRZ1Q/DO5a3s76Xv0mdBzVM5j5R639lXQmPmSo0iRpHqUUrsxw==", - "os": ["win32"], - "cpu": ["arm64"] - }, - "@esbuild/win32-ia32@0.25.5": { - "integrity": "sha512-onOJ02pqs9h1iMJ1PQphR+VZv8qBMQ77Klcsqv9CNW2w6yLqoURLcgERAIurY6QE63bbLuqgP9ATqajFLK5AMQ==", - "os": ["win32"], - "cpu": ["ia32"] - }, - "@esbuild/win32-x64@0.25.5": { - "integrity": "sha512-TXv6YnJ8ZMVdX+SXWVBo/0p8LTcrUYngpWjvm91TMjjBQii7Oz11Lw5lbDV5Y0TzuhSJHwiH4hEtC1I42mMS0g==", - "os": ["win32"], - "cpu": ["x64"] - }, "@jridgewell/gen-mapping@0.3.13": { "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==", "dependencies": [ @@ -231,41 +80,19 @@ "@jridgewell/sourcemap-codec" ] }, - "esbuild@0.25.5": { - "integrity": "sha512-P8OtKZRv/5J5hhz0cUAdu/cLuPIKXpQl1R9pZtvmHWQvrAUVd0UNIPT4IB4W3rNOqVO0rlqHmCIbSwxh/c9yUQ==", - "optionalDependencies": [ - "@esbuild/aix-ppc64", - "@esbuild/android-arm", - "@esbuild/android-arm64", - "@esbuild/android-x64", - "@esbuild/darwin-arm64", - "@esbuild/darwin-x64", - "@esbuild/freebsd-arm64", - "@esbuild/freebsd-x64", - "@esbuild/linux-arm", - "@esbuild/linux-arm64", - "@esbuild/linux-ia32", - "@esbuild/linux-loong64", - "@esbuild/linux-mips64el", - "@esbuild/linux-ppc64", - "@esbuild/linux-riscv64", - "@esbuild/linux-s390x", - "@esbuild/linux-x64", - "@esbuild/netbsd-arm64", - "@esbuild/netbsd-x64", - "@esbuild/openbsd-arm64", - "@esbuild/openbsd-x64", - "@esbuild/sunos-x64", - "@esbuild/win32-arm64", - "@esbuild/win32-ia32", - "@esbuild/win32-x64" - ], - "scripts": true, - "bin": true - }, "jsesc@3.1.0": { "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==", "bin": true } + }, + "workspace": { + "dependencies": [ + "jsr:@std/assert@1", + "jsr:@std/fs@*", + "jsr:@std/io@*", + "npm:@babel/generator@7.28.3", + "npm:@babel/parser@7.28.3", + "npm:@babel/types@7.28.2" + ] } } diff --git a/src/main.ts b/src/main.ts index 6a49aa5..ef1fc56 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,4 +1,4 @@ -import { writeAll } from "jsr:@std/io"; +import { writeAll } from "@std/io"; import { preprocessPlayer, getFromPrepared } from "./solvers.ts"; import { isOneOf } from "./utils.ts"; diff --git a/src/nsig.ts b/src/nsig.ts index 8ce4321..0b05b09 100644 --- a/src/nsig.ts +++ b/src/nsig.ts @@ -2,7 +2,7 @@ import { type ArrowFunctionExpression, type Node, type BlockStatement, -} from "npm:@babel/types@7.28.2"; +} from "@babel/types"; import { matchesStructure } from "./utils.ts"; import { type DeepPartial } from "./types.ts"; diff --git a/src/sig.ts b/src/sig.ts index 8f8d02f..f65f487 100644 --- a/src/sig.ts +++ b/src/sig.ts @@ -3,8 +3,8 @@ import { type FunctionExpression, type Expression, type Node, - ExpressionStatement, -} from "npm:@babel/types@7.28.2"; + type ExpressionStatement, +} from "@babel/types"; import { matchesStructure } from "./utils.ts"; import { type DeepPartial } from "./types.ts"; diff --git a/src/solvers.ts b/src/solvers.ts index 86f3206..65867ef 100755 --- a/src/solvers.ts +++ b/src/solvers.ts @@ -1,6 +1,6 @@ -import { parse } from "npm:@babel/parser@7.28.3"; -import { generate } from "npm:@babel/generator@7.28.3"; -import { type ArrowFunctionExpression } from "npm:@babel/types@7.28.2"; +import { parse } from "@babel/parser"; +import { generate } from "@babel/generator"; +import { type ArrowFunctionExpression } from "@babel/types"; import { getFunctionNodes } from "./utils.ts"; import { extract as extractSig } from "./sig.ts"; import { extract as extractNsig } from "./nsig.ts"; @@ -80,10 +80,12 @@ export function preprocessPlayer(data: string): string { const unique = new Set(options.map((x) => JSON.stringify(x))); if (unique.size !== 1) { const message = `found ${unique.size} ${name} function possibilities`; - throw message + + throw ( + message + (unique.size ? `: ${options.map((x) => generate(x)["code"]).join(", ")}` - : ""); + : "") + ); } plainExpressions.push({ type: "ExpressionStatement", diff --git a/src/solvers_test.ts b/src/solvers_test.ts index 751ba70..9af1edd 100644 --- a/src/solvers_test.ts +++ b/src/solvers_test.ts @@ -1,4 +1,4 @@ -import { assertStrictEquals } from "jsr:@std/assert@1"; +import { assertStrictEquals } from "@std/assert"; import { preprocessPlayer, getFromPrepared } from "./solvers.ts"; import { players, tests } from "../tests/tests.ts"; import { getCachePath } from "../tests/utils.ts"; diff --git a/src/utils.ts b/src/utils.ts index 68c5b22..3213647 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,5 +1,5 @@ -import { parse } from "npm:@babel/parser@7.28.3"; -import { type Node, type Statement } from "npm:@babel/types@7.28.2"; +import { parse } from "@babel/parser"; +import { type Node, type Statement } from "@babel/types"; import { type DeepPartial } from "./types.ts"; export function matchesStructure( diff --git a/tests/download.ts b/tests/download.ts index ed86204..acf8e53 100644 --- a/tests/download.ts +++ b/tests/download.ts @@ -1,5 +1,4 @@ -import { exists } from "jsr:@std/fs/exists"; - +import { exists } from "@std/fs/exists"; import { tests, players } from "./tests.ts"; import { getCachePath } from "./utils.ts";