Skip to main content
This release is 1 version behind 0.1.6 — the latest version of @evex/scratch-blocks. Jump to latest

Built and signed on GitHub Actions

ESM-ized scratch-blocks, it works with Vite!

This package works with BrowsersIt is unknown whether this package works with Cloudflare Workers, Node.js, Deno, Bun
It is unknown whether this package works with Cloudflare Workers
It is unknown whether this package works with Node.js
It is unknown whether this package works with Deno
It is unknown whether this package works with Bun
This package works with Browsers
JSR Score
41%
Published
a month ago (0.1.5)

Evex Scratch-Blocks

JSR

Scratch Blocks is a library for building creative computing interfaces.

An image of Scratch Blocks running on a tablet

What is this

scratch-blocks is a library to create visual programming environment. It's used in block editor on Scratch. It's also fork of Blockly.

However, Scratch Team forked Blockly in 2016^when_fork. Currently, there are ESM and most of developers use it. ESM is released 2015, so Blockly which was in 2016 hadn't used ESM, used Google Closure Library. After that, Blockly migrated to ESM, but Scratch Team didn't migrate to ESM. Google Closure Library is a very old architecture. It changes global namespace. And it's difficult to use it with Vite. So we needed to get Scratch Blocks which uses ESM, but Scratch Team is conservative and we think Scratch Team won't migrate and accept PR.

Then we forked Scratch Blocks. It is patched to migrate to ESM. Scratch Blocks can't work with Vite, in contrast it works with Vite!

Usage

The package is published in JSR. You can install this with npm, yarn, pnpm, Deno, Bun, and others.

npx jsr add @evex/scratch-blocks # npm
yarn dlx jsr add @evex/scratch-blocks # yarn
pnpm dlx jsr add @evex/scratch-blocks # pnpm
deno add jsr:@evex/scratch-blocks # Deno
bunx jsr add @evex/scratch-blocks # Bun

Or, you can directly use in browser with esm.sh: https://esm.sh/jsr/@evex/scratch-blocks.

To import API,

import Blockly from '@evex/scratch-blocks'

// Or, with esm.sh
import Blockly from 'https://esm.sh/jsr/@evex/scratch-blocks'
Built and signed on
GitHub Actions
View transparency log

Add Package

deno add jsr:@evex/scratch-blocks

Import symbol

import * as scratch_blocks from "@evex/scratch-blocks";

---- OR ----

Import directly with a jsr specifier

import * as scratch_blocks from "jsr:@evex/scratch-blocks";

Add Package

npx jsr add @evex/scratch-blocks

Import symbol

import * as scratch_blocks from "@evex/scratch-blocks";

Add Package

yarn dlx jsr add @evex/scratch-blocks

Import symbol

import * as scratch_blocks from "@evex/scratch-blocks";

Add Package

pnpm dlx jsr add @evex/scratch-blocks

Import symbol

import * as scratch_blocks from "@evex/scratch-blocks";

Add Package

bunx jsr add @evex/scratch-blocks

Import symbol

import * as scratch_blocks from "@evex/scratch-blocks";