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

Add media type x-javascript and Typescript #2615

Closed
elocremarc opened this issue Oct 31, 2023 · 2 comments
Closed

Add media type x-javascript and Typescript #2615

elocremarc opened this issue Oct 31, 2023 · 2 comments

Comments

@elocremarc
Copy link
Contributor

elocremarc commented Oct 31, 2023

I have an executable JS inscription it is similar to x-python from PR #2538.
Currently it doesn't display.

I think we should also add Typescript as well as x-typescript. I think a more generalized approach to deal with x-mediatype

if (language.startsWith("x-")) {
    language = language.substring(2);
}
@raphjaph
Copy link
Collaborator

The MIME type of javascript should be text/javascript. Typescript doesn't have an official MIME type and is normally transpiled to javascript anyways. An inscription that contains typescript can't be executed by the browser. Why do you want to inscribe typescript files?

@elocremarc
Copy link
Contributor Author

elocremarc commented Nov 1, 2023

I started exploring storing executable code as inscriptions for immutable storage. I haven't used the meta protocol tag but I imaged it would be DAPP. We added support for x-python which can't be run in the browser either. The explorer would be a good way to view the code as a digital artifact.

See this inscription that is a basic ord server and parser. Since its x-javascript it is only viewable in the /content route. Which is fine for distribution however not for viewablity.
https://ordinals.com/content/c5942064bea79672efc5d8331d84171ad2ebb086873e4eb24f7184b159702b87i0

Unfortunate TS isn't a mime type with bun you can run it without transpiling it I guess however that wont play nice with the code preview.

If this isn't in scope with ord I could just make a dedicated explorer that maybe uses autohighlight to cover executable code people might inscribe.

Don't mind me just jailbreaking out of the explorer and endpoints with orception.js

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

No branches or pull requests

2 participants