Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix deno usage of protobuf and jintr #776

Merged
merged 2 commits into from
Oct 7, 2024
Merged

Conversation

unixfox
Copy link
Contributor

@unixfox unixfox commented Oct 6, 2024

Replace these lines at build time for deno:

import { Jinter } from 'jintr';

to:

import { Jinter } from 'https://esm.sh/[email protected]';

and

import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";

to:

import { BinaryReader, BinaryWriter } from "https://esm.sh/@bufbuild/[email protected]";

Everytime one of these two lib is updated in the package.json, these should also be updated in the "build:deno" command:

"build:deno": "cpy ./src ./deno && cpy ./protos ./deno && esbuild ./src/utils/DashManifest.tsx --keep-names --format=esm --platform=neutral --target=es2020 --outfile=./deno/src/utils/DashManifest.js && cpy ./package.json ./deno && replace \".js';\" \".ts';\" ./deno -r && replace '.js\";' '.ts\";' ./deno -r && replace \"'./DashManifest.ts';\" \"'./DashManifest.js';\" ./deno -r && replace \"'jintr';\" \"'https://esm.sh/jintr';\" ./deno -r",


Also fixes this warning (Deno V1) and now an error in Deno V2:

error: Import assertions are deprecated. Use `with` keyword, instead of 'assert' keyword.

import package_json from '../../package.json' assert { type: 'json' };

Closes #767
Closes #766

@unixfox unixfox marked this pull request as draft October 6, 2024 15:27
@unixfox unixfox marked this pull request as ready for review October 6, 2024 15:37
@LuanRT LuanRT merged commit 02513b7 into LuanRT:main Oct 7, 2024
4 checks passed
@unixfox
Copy link
Contributor Author

unixfox commented Oct 7, 2024

deno compile is failing though :/. will see what I can do about it

$ deno compile --output youtube-js-deno deno.ts
error: Module not found "https://esm.sh/v135/[email protected]/acorn".
    at https://esm.sh/v135/[email protected]/dist/main.d.ts:22:47

will probably need to expose Jinter on deno.land

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10.x.x Deno jintr package version not specified. 10.5.0 Deno missing @bufbuild/protobuf import
2 participants