mirror of
https://github.com/yt-dlp/ejs.git
synced 2026-06-13 00:32:11 +00:00
Namespace packages
This commit is contained in:
@@ -45,6 +45,5 @@ commands = [
|
||||
]
|
||||
|
||||
[tool.hatch.build.targets.wheel.force-include]
|
||||
"dist/yt.solver.core.min.js" = "yt_dlp_ejs/yt.solver.core.min.js"
|
||||
"dist/yt.solver.lib.min.js" = "yt_dlp_ejs/yt.solver.lib.min.js"
|
||||
|
||||
"dist/yt.solver.core.min.js" = "yt_dlp_ejs/yt/solver/core.min.js"
|
||||
"dist/yt.solver.lib.min.js" = "yt_dlp_ejs/yt/solver/lib.min.js"
|
||||
|
||||
@@ -83,7 +83,7 @@ function prettifyOutput() {
|
||||
|
||||
export default defineConfig([
|
||||
{
|
||||
input: "src/main.ts",
|
||||
input: "src/yt/solver/main.ts",
|
||||
output: {
|
||||
name: "jsc",
|
||||
globals: {
|
||||
@@ -119,7 +119,7 @@ export default defineConfig([
|
||||
],
|
||||
},
|
||||
{
|
||||
input: "src/main.ts",
|
||||
input: "src/yt/solver/main.ts",
|
||||
output: {
|
||||
name: "jsc",
|
||||
globals: {
|
||||
@@ -153,7 +153,7 @@ export default defineConfig([
|
||||
],
|
||||
},
|
||||
{
|
||||
input: "src/lib.ts",
|
||||
input: "src/yt/solver/lib.ts",
|
||||
output: {
|
||||
name: "lib",
|
||||
file: "dist/yt.solver.lib.js",
|
||||
@@ -184,7 +184,7 @@ export default defineConfig([
|
||||
],
|
||||
},
|
||||
{
|
||||
input: "src/lib.ts",
|
||||
input: "src/yt/solver/lib.ts",
|
||||
output: {
|
||||
name: "lib",
|
||||
file: "dist/yt.solver.lib.min.js",
|
||||
@@ -212,14 +212,14 @@ export default defineConfig([
|
||||
],
|
||||
},
|
||||
{
|
||||
input: "src/dynamic.lib.ts",
|
||||
input: "src/yt/solver/dynamic.lib.ts",
|
||||
output: {
|
||||
name: "lib",
|
||||
file: "dist/yt.solver.deno.lib.js",
|
||||
format: "es",
|
||||
},
|
||||
plugins: [
|
||||
dynamicImportRewrite({ format: "deno" }),
|
||||
dynamicImportRewrite(),
|
||||
license({
|
||||
banner: {
|
||||
content: LICENSE_BANNER,
|
||||
@@ -238,7 +238,7 @@ export default defineConfig([
|
||||
],
|
||||
},
|
||||
{
|
||||
input: "src/dynamic.lib.ts",
|
||||
input: "src/yt/solver/dynamic.lib.ts",
|
||||
output: {
|
||||
name: "lib",
|
||||
file: "dist/yt.solver.bun.lib.js",
|
||||
|
||||
2
run.ts
2
run.ts
@@ -2,7 +2,7 @@ import { argv, exit } from "node:process";
|
||||
import { readFileSync } from "node:fs";
|
||||
|
||||
import { isOneOf } from "./src/utils.ts";
|
||||
import main from "./src/main.ts";
|
||||
import main from "./src/yt/solver/main.ts";
|
||||
|
||||
const args = argv.slice(2);
|
||||
if (args.length < 2) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { getFromPrepared, preprocessPlayer } from "./solvers.ts";
|
||||
import { isOneOf } from "./utils.ts";
|
||||
import { isOneOf } from "../../utils.ts";
|
||||
|
||||
export default function main(input: Input): Output {
|
||||
const preprocessedPlayer =
|
||||
@@ -1,6 +1,6 @@
|
||||
import { type ESTree } from "meriyah";
|
||||
import { matchesStructure } from "./utils.ts";
|
||||
import { type DeepPartial } from "./types.ts";
|
||||
import { matchesStructure } from "../../utils.ts";
|
||||
import { type DeepPartial } from "../../types.ts";
|
||||
|
||||
const identifier: DeepPartial<ESTree.VariableDeclaration> = {
|
||||
type: "VariableDeclaration",
|
||||
@@ -1,6 +1,6 @@
|
||||
import { type ESTree } from "meriyah";
|
||||
import { matchesStructure } from "./utils.ts";
|
||||
import { type DeepPartial } from "./types.ts";
|
||||
import { matchesStructure } from "../../utils.ts";
|
||||
import { type DeepPartial } from "../../types.ts";
|
||||
|
||||
const logicalExpression: DeepPartial<ESTree.ExpressionStatement> = {
|
||||
type: "ExpressionStatement",
|
||||
@@ -1,7 +1,7 @@
|
||||
import { getFromPrepared, preprocessPlayer } from "./solvers.ts";
|
||||
import { players, tests } from "../tests/tests.ts";
|
||||
import { getCachePath } from "../tests/utils.ts";
|
||||
import { getIO } from "../tests/io.ts";
|
||||
import { players, tests } from "./test/tests.ts";
|
||||
import { getCachePath } from "./test/utils.ts";
|
||||
import { getIO } from "./test/io.ts";
|
||||
|
||||
const io = await getIO();
|
||||
|
||||
@@ -247,7 +247,7 @@ export const tests: {
|
||||
input:
|
||||
"MMGZJMUucirzS_SnrSPYsc85CJNnTUi6GgR5NKn-znQEICACojE8MHS6S7uYq4TGjQX_D4aPk99hNU6wbTvorvVVMgIARwsSdQfJA",
|
||||
expected:
|
||||
"-MGZJMUucirzS_SnrSPYsc85CJNnTUi6GgR5NKnMznQEICACojE8MHS6S7uYq4TGjQX_D4aPk99hNU6wbTvorvVVMgIARwsSdQfJA",
|
||||
"-MGZJMUucirzS_SnrSPYsc85CJNnTUi6GgR5NKnMznQEICACojE8MHS6S7uYq4TGjQX_D4aPk99hNU6wbTvorvVVMgIARwsSdQfJ",
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -1,5 +1,5 @@
|
||||
import { type Variant } from "./tests.ts";
|
||||
|
||||
export function getCachePath(player: string, variant: Variant) {
|
||||
return `tests/players/${player}-${variant}`;
|
||||
return `src/yt/solver/test/players/${player}-${variant}`;
|
||||
}
|
||||
@@ -1,25 +1,6 @@
|
||||
import importlib.resources
|
||||
|
||||
import yt_dlp_ejs
|
||||
# XXX: this reflects package version
|
||||
from yt_dlp_ejs._version import version
|
||||
|
||||
|
||||
def yt_solver_core() -> str:
|
||||
"""
|
||||
Read the contents of the JavaScript core solver bundle as string.
|
||||
"""
|
||||
return importlib.resources.read_text(yt_dlp_ejs, 'yt.solver.core.min.js')
|
||||
|
||||
|
||||
def yt_solver_lib() -> str:
|
||||
"""
|
||||
Read the contents of the JavaScript library solver bundle as string.
|
||||
"""
|
||||
return importlib.resources.read_text(yt_dlp_ejs, 'yt.solver.lib.min.js')
|
||||
|
||||
__all__ = [
|
||||
"core",
|
||||
"lib",
|
||||
"version",
|
||||
]
|
||||
|
||||
0
yt_dlp_ejs/yt/__init__.py
Normal file
0
yt_dlp_ejs/yt/__init__.py
Normal file
17
yt_dlp_ejs/yt/solver/__init__.py
Normal file
17
yt_dlp_ejs/yt/solver/__init__.py
Normal file
@@ -0,0 +1,17 @@
|
||||
import importlib
|
||||
|
||||
import yt_dlp_ejs.yt.solver
|
||||
|
||||
|
||||
def core() -> str:
|
||||
"""
|
||||
Read the contents of the JavaScript core solver bundle as string.
|
||||
"""
|
||||
return importlib.resources.read_text(yt_dlp_ejs.yt.solver, "core.min.js")
|
||||
|
||||
|
||||
def lib() -> str:
|
||||
"""
|
||||
Read the contents of the JavaScript library solver bundle as string.
|
||||
"""
|
||||
return importlib.resources.read_text(yt_dlp_ejs.yt.solver, "lib.min.js")
|
||||
Reference in New Issue
Block a user