This release is 4 versions behind 0.1.15 — the latest version of @classic/js. Jump to latest
Built and signed on GitHub ActionsBuilt and signed on GitHub Actions
Built and signed on GitHub Actions
Works with
•JSR Score94%•This package works with DenoIt is unknown whether this package works with Cloudflare Workers, Node.js, Bun, Browsers




Published10 months ago (0.1.11)
Ad hoc (client) JavaScript from typed (server) code
@classic/js - Page specific JS from any backend
Custom elements/web components scope reusable logic and style. On the other hand, @classic/js offers a way to send dynamic arbitrary code in web pages to fully control native and custom elements.
const foo = "42"; const jsParsedFoo = js<number>`parseInt(${foo})`; // Smart interpolation will result in `parseInt("42")` await js.eval(jsParsedFoo) === 42;
References are tracked and transcribed into generated JS, so it is minified by design:
const lorem = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."; const loremReference = js<string>`${lorem}`; await js.eval(js`${lorem} === ${loremReference}`) === true; // ^ `lorem` is referenced twice: generated JS will declare it as a variable
Built and signed on
GitHub Actions
Add Package
deno add jsr:@classic/js
Import symbol
import * as js from "@classic/js";
Import directly with a jsr specifier
import * as js from "jsr:@classic/js";
Add Package
pnpm i jsr:@classic/js
pnpm dlx jsr add @classic/js
Import symbol
import * as js from "@classic/js";
Add Package
yarn add jsr:@classic/js
yarn dlx jsr add @classic/js
Import symbol
import * as js from "@classic/js";
Add Package
vlt install jsr:@classic/js
Import symbol
import * as js from "@classic/js";
Add Package
npx jsr add @classic/js
Import symbol
import * as js from "@classic/js";
Add Package
bunx jsr add @classic/js
Import symbol
import * as js from "@classic/js";