Public
Script
  • vladimyr avatar
    jsr
    @vladimyr
    Try on Val Town This service enables quick generation of new val with specified jsr package. Package authors can provide custom examples by setting either: valtownExample property of jsr.json / deno.json to contain example js/ts code valtownExampleFilename property of jsr.json / deno.json to point to the file with example js/ts code If no example is found val will be created with the default snippet, using @luca/flag as an example : import * as flag from "jsr:@luca/flag"; Go ahead ↗️ try it (on Val Town) ! 🎉 Additionally, the service supports ?code=<base64code> query param that allows overriding extracted/generated example code. For example one might want to override @luca/flag 's snippet with: import { printProgress } from "jsr:@luca/flag@1"; printProgress(); In order to do so first you need to convert it to base64: $ printf 'import { printProgress } from "jsr:@luca/flag@1";\n\nprintProgress();' | base64 -w0 # ==> aW1wb3J0IHsgcHJpbnRQcm9ncmVzcyB9IGZyb20gImpzcjpAbHVjYS9mbGFnQDEiOwoKcHJpbnRQcm9ncmVzcygpOw== Then you simply construct the URL by setting the returned value to code query param: ↗️ https://vladimyr-jsr.web.val.run?code=aW1wb3J0IHsgcH... Usage https://vladimyr-jsr.web.val.run/<scope>/<name>[@<version>] https://vladimyr-jsr.web.val.run?code=<base64code> Example https://vladimyr-jsr.web.val.run/@luca/flag https://vladimyr-jsr.web.val.run/@std/assert@0.220.1 https://vladimyr-jsr.web.val.run/@mark/html@latest
    HTTP (deprecated)
  • vladimyr avatar
    newValURL_example
    @vladimyr
    // ==> https://www.val.town/new?code64=aW1wb3J0IHsgYmFzZTY0IGFzIGI2NCB9IGZyb20gIm5wbTptdWx0aWZvcm1hdHMvYmFzZXMvYmFzZTY0IjsKCmV4cG9ydCBmdW5jdGlvbiBuZXdWYWxVUkwoY29kZTogc3RyaW5nLCBiYXNlNjQgPSB0cnVlKSB7CiAgY29uc3QgdXJsID0gbmV3IFVSTCgiaHR0cHM6Ly93d3cudmFsLnRvd24vbmV3Iik7CiAgaWYgKCFiYXNlNjQpIHsKICAgIHVybC5zZWFyY2hQYXJhbXMuc2V0KCJjb2RlIiwgY29kZSk7CiAgICByZXR1cm4gdXJsOwogIH0KICAvLyBAc2VlOiBodHRwczovL3d3dy52YWwudG93bi92L2Vhc3JuZy9wbGF5Z3JvdW5kP3Y9MzQzI0w3MDMtNzA0CiAgY29uc3QgYnl0ZXMgPSBuZXcgVGV4dEVuY29kZXIoKS5lbmNvZGUoY29kZSk7CiAgdXJsLnNlYXJjaFBhcmFtcy5zZXQoImNvZGU2NCIsIGI2NC5iYXNlRW5jb2RlKGJ5dGVzKSk7CiAgcmV0dXJuIHVybDsKfQ
    Script
1
Next
March 31, 2024