squint

zachcp 2025-05-18T19:23:47.113899Z

So, I'm relatively new to this new MJS based world. I notice that many of the squint interactive demos lean heavily on import maps. Any tips on how import all of the MJS modules in a library or do i need to specify each one manually? In this case, i'd like to explore using https://www.npmjs.com/package/@use-gpu/workbench which seems to export a complete set of MJS module.

borkdude 2025-05-19T09:03:39.683649Z

you're probably better off to just make a local vite project with squint and compile locally

zachcp 2025-05-19T12:36:40.785219Z

yes. I agree. although using the modules directly via the import map is very convenient for making playgrounds.

zachcp 2025-05-18T19:24:26.898879Z

Here is an example from the demo app.

import type { LC, PropsWithChildren } from '@use-gpu/live';
import type { Emit, Time } from '@use-gpu/core';

import React from '@use-gpu/live';

import {
  Pass,
  OrbitControls, OrbitCamera,
  Cursor,
} from '@use-gpu/workbench';
import {
  Plot, Point, Line, Tensor, Transform,
} from '@use-gpu/plot';
import { vec3 } from 'gl-matrix';
import { seq } from '@use-gpu/core';

import { InfoBox } from '../../ui/info-box';

zachcp 2025-05-18T19:28:24.230599Z

Although maybe I only have access to things already in the map?

zachcp 2025-05-18T19:41:07.234389Z

Okay. So the import works but theres a set of modules i'd need to add to get this to work out of the box - e.g. to add import maps for any of the deps.

zachcp 2025-05-18T22:23:32.088019Z

Currently stuck on a wasm import. Looks like I might https://github.com/rustwasm/wasm-pack/issues/1432 to get a wasm module to load/initialise in the browser.

"imports": {
                    "squint-cljs": "",
                    "squint-cljs/core.js": "",
                    "squint-cljs/string.js": "",
                    "squint-cljs/src/squint/string.js": "",
                    "squint-cljs/src/squint/set.js": "",
                    "squint-cljs/src/squint/html.js": "",
                    "@codemirror/language": "",
                    "@codemirror/lang-javascript": "",
                    "@codemirror/state": "",
                    "@codemirror/view": "",
                    "@codemirror/commands": "",
                    "@codemirror/autocomplete": "",
                    "@lezer/highlight": "",
                    "@lezer/common": "",
                    "@lezer/javascript": "",
                    "@nextjournal/lezer-clojure": "",
                    "@nextjournal/clojure-mode": "",
                    "@nextjournal/clojure-mode/extensions/eval-region": "",
                    "@use-gpu/core": "",
                    "@use-gpu/glyph": "",
                    "@use-gpu/live": "",
                    "@use-gpu/parse": "",
                    "@use-gpu/shader": "",
                    "@use-gpu/shader/wgsl": "",
                    "@use-gpu/state": "",
                    "@use-gpu/traits/live": "",
                    "@use-gpu/wgsl": "",
                    "@use-gpu/wgsl/use/view.wgsl": "",
                    "@use-gpu/wgsl/render/pick.wgsl": "",
                    "@use-gpu/wgsl/render/sample/equi-to-cube.wgsl": "",
                    "@use-gpu/wgsl/compute/memo2.wgsl": "",
                    "@use-gpu/wgsl/pmrem/pmrem-init.wgsl": "",
                    "@use-gpu/wgsl/pmrem/pmrem-copy.wgsl": "",
                    "@use-gpu/wgsl/pmrem/pmrem-blur.wgsl": "",
                    "@use-gpu/wgsl/pmrem/pmrem-diffuse-sh.wgsl": "",
                    "@use-gpu/wgsl/pmrem/pmrem-debug.wgsl": "",
                    "@use-gpu/wgsl/pmrem/pmrem-read.wgsl": "",
                    "@use-gpu/workbench": "",
                    "lru-cache": "",
                    "gl-matrix": "",
                    "earcut": "",
                    "lodash/uniq.js": "",
                    "lodash/mapValues.js": "",
                    "lodash/zip.js": "",
                    "lodash/zipObject.js": "",
                    "magic-string": "",
                    "react": "",
                    "react/jsx-runtime": "",
                    "react/jsx-dev-runtime": "",
                    "react

zachcp 2025-05-18T22:24:11.901919Z

This is the module that packages a bit of wasm

"@use-gpu/glyph": "",

zachcp 2025-05-18T23:01:51.211369Z

I've tried a few things but haven't gotten WASM loading just right. will revisit tomorrow.