From bc810e415801ec2a0f3f76ec474099e881181352 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dami=C3=A1n=20Silvani?= Date: Sat, 14 Sep 2024 21:01:46 -0300 Subject: [PATCH] Upgrade `@strudel/*` packages to v1.1.0; add `@strudel/draw` (#292) --- package-lock.json | 126 +++++++++++++----------- packages/web/.gitignore | 3 + packages/web/package.json | 24 ++--- packages/web/script/prebuild.js | 27 +++++ packages/web/src/lib/strudel-wrapper.ts | 2 +- packages/web/src/lib/strudel.d.ts | 5 +- 6 files changed, 115 insertions(+), 72 deletions(-) create mode 100644 packages/web/script/prebuild.js diff --git a/package-lock.json b/package-lock.json index ccac5e07..317bf4bb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4015,9 +4015,9 @@ "dev": true }, "node_modules/@strudel/codemirror": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@strudel/codemirror/-/codemirror-1.0.1.tgz", - "integrity": "sha512-m0fQtODjl8vhnxAPkEcvO1bozp6c2jhIN8osEbmK3A0ZzD9YkgkPfdmiAsdQw9pFFnMNQUb3AePJh1XnHlc6vg==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@strudel/codemirror/-/codemirror-1.1.0.tgz", + "integrity": "sha512-lInbqnNhBBKug/7CbmTvCR9/j1lmMBpxDmCTgPI0fYGKBhJQcRhJVB4mfDVXFcM6Ze8cd5mQ2vvHTtlptSDn8A==", "dev": true, "dependencies": { "@codemirror/autocomplete": "^6.11.1", @@ -4032,92 +4032,101 @@ "@replit/codemirror-emacs": "^6.0.1", "@replit/codemirror-vim": "^6.1.0", "@replit/codemirror-vscode-keymap": "^6.0.2", - "@strudel/core": "1.0.1", + "@strudel/core": "1.1.0", + "@strudel/draw": "1.1.0", + "@strudel/transpiler": "1.1.0", "@uiw/codemirror-themes": "^4.21.21", "@uiw/codemirror-themes-all": "^4.21.21", "nanostores": "^0.9.5" } }, "node_modules/@strudel/core": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@strudel/core/-/core-1.0.1.tgz", - "integrity": "sha512-4Ei55Gj5r+XCLc3L5G8YulnFvyYMZVM21NCnH6gY5NNw/dDZujucS//QoPzrp0z9zrnrIIRVxjfGnjYBdIrLbA==", - "dev": true, + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@strudel/core/-/core-1.1.0.tgz", + "integrity": "sha512-8qyMIJjXwmmi7A6oJ7reY/npLwCRU3SNRUR+x9BxuHnrLOY+Y7OH3Zi9/wMgVJcZWcsL76K0XIiMt1QuKjfvSg==", "dependencies": { "fraction.js": "^4.3.7" } }, + "node_modules/@strudel/draw": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@strudel/draw/-/draw-1.1.0.tgz", + "integrity": "sha512-wAqlSbWI/0eR0m1NlWjPvJ7GPpCTGjR0m6K2Avw8eCEx0BqxHo07K1GUWKIwzkS3qG8olLymVda0mvf1NOhCAA==", + "dependencies": { + "@strudel/core": "1.1.0" + } + }, "node_modules/@strudel/midi": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@strudel/midi/-/midi-1.0.1.tgz", - "integrity": "sha512-WW/in4eMYsPPOrn4cbS0/jGuBpHYPDtCrl4cG+nORTF3L+SqhbMbLi/61kpzUt0UuJ9qS2SdvI/S+J1iUSWF2w==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@strudel/midi/-/midi-1.1.0.tgz", + "integrity": "sha512-e+/N9TSGw19/2ENirOHFi+hy3uMC61ItpuvfIqXaycPUmpn2FUlJfhYKsN7V9GXJtuOFG6bV3lC6KP9R4CdGdw==", "dev": true, "dependencies": { - "@strudel/core": "1.0.1", - "@strudel/webaudio": "1.0.1", + "@strudel/core": "1.1.0", + "@strudel/webaudio": "1.1.0", "webmidi": "^3.1.8" } }, "node_modules/@strudel/mini": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@strudel/mini/-/mini-1.0.1.tgz", - "integrity": "sha512-ElS5h3hppVcizm9N5e3egHzDP5eGyEqFGMPpl9EHdu+PzF/vt7uc0STxVN//vhq4A9Lrv3FTWSel5rik2AEwBg==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@strudel/mini/-/mini-1.1.0.tgz", + "integrity": "sha512-anI6LUXU+PyBya0/KI+iC/Dfg3zfxuOK4pRgWJKAJHIMz65pWEwX8G3Ag77C9XLNOGz9y4detXQ9w6y90vDwVg==", "dev": true, "dependencies": { - "@strudel/core": "1.0.1" + "@strudel/core": "1.1.0" } }, "node_modules/@strudel/osc": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@strudel/osc/-/osc-1.0.1.tgz", - "integrity": "sha512-CqR5Mt6+Ipq/mBg5fbcxNjwjvUnUI4R9RwgMe6RZwtLww1K82TpsbmJ8DjoEQAHBIPsJdckGk7K+mfT/JDV4eg==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@strudel/osc/-/osc-1.1.0.tgz", + "integrity": "sha512-HcE6/ZbDA41/Xy0MplV0O7sOXnigxoINQbay8yQOWJKHAJxR6llpP7p1PL2xIYaGr1hPiIvxfjSAlPmYhM12dg==", "dev": true, "dependencies": { - "@strudel/core": "1.0.1", + "@strudel/core": "1.1.0", "osc-js": "^2.4.0" } }, "node_modules/@strudel/serial": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@strudel/serial/-/serial-1.0.1.tgz", - "integrity": "sha512-ZTZjM45Kui/nBhzxYkwnUcLhDH0fD2Xbipq+GSnR6sNHtAvTs7J8gfaOAxvfThPCdktdMHaLIVzIg5o54BkHHw==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@strudel/serial/-/serial-1.1.0.tgz", + "integrity": "sha512-wh1MFhvPXf7/VNN3u+rByrG8kZJIJ+NuerixHAkAkS8uAsCw0xbIInBiiiwC1lAkvyn2VbqkmyPbA9o24QB6bA==", "dev": true, "dependencies": { - "@strudel/core": "1.0.1" + "@strudel/core": "1.1.0" } }, "node_modules/@strudel/soundfonts": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@strudel/soundfonts/-/soundfonts-1.0.1.tgz", - "integrity": "sha512-rglTs3jRLOTprDujmOdTQnHDsVu6X64QWGlWPHg7DsZ2A1E1Sg52Jrd3Np6t2/ev/tAqubwdfr0N7x4RHUlFTA==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@strudel/soundfonts/-/soundfonts-1.1.0.tgz", + "integrity": "sha512-H8YnLxrIKyUMbJ3NBfOynLbcnn3/eciPXNIMvpZa3d9owSXPRU3AdDzT3Xr/XNq4vuMoPn/lAAybi5/PrYcVrg==", "dev": true, "dependencies": { - "@strudel/core": "1.0.1", - "@strudel/webaudio": "1.0.1", + "@strudel/core": "1.1.0", + "@strudel/webaudio": "1.1.0", "sfumato": "^0.1.2", "soundfont2": "^0.4.0" } }, "node_modules/@strudel/tonal": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@strudel/tonal/-/tonal-1.0.1.tgz", - "integrity": "sha512-XtOi0Ac+CUpOpmkqLviwaW7380LDPq/vGgSARIQu67bjv4ELUlM2OuEg8kq3XvrdnrtkikOKPqWZ+0JUmIWqPw==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@strudel/tonal/-/tonal-1.1.0.tgz", + "integrity": "sha512-y8QYO2w6kvL9f8Uyfo220E/w1ga2d5vP+icXhlyjri+qNxwVZmJvkzB+7pwgQtPNgLJJnvrUhQjQzlXXmn/qBw==", "dev": true, "dependencies": { - "@strudel/core": "1.0.1", + "@strudel/core": "1.1.0", "@tonaljs/tonal": "^4.7.2", "chord-voicings": "^0.0.1", "webmidi": "^3.1.8" } }, "node_modules/@strudel/transpiler": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@strudel/transpiler/-/transpiler-1.0.1.tgz", - "integrity": "sha512-HeWdx6It6mq2+wqWQOMxoTIdvltiAuy6QPqEFOfOR0mausuXhygAWm+HTQ9Wg91kpNNA8bixfM+VMNfM5NcIOA==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@strudel/transpiler/-/transpiler-1.1.0.tgz", + "integrity": "sha512-GPCHeQsxU8Kz45FRUu3WGOJVIWIjfazbmKauwETHDMDvITdtfkhmYNcYogSteFvlJlVxUlypz0VBVqYgM1hg4A==", "dev": true, "dependencies": { - "@strudel/core": "1.0.1", - "@strudel/mini": "1.0.1", + "@strudel/core": "1.1.0", + "@strudel/mini": "1.1.0", "acorn": "^8.11.3", "escodegen": "^2.1.0", "estree-walker": "^3.0.1" @@ -4145,13 +4154,14 @@ } }, "node_modules/@strudel/webaudio": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@strudel/webaudio/-/webaudio-1.0.1.tgz", - "integrity": "sha512-NpwgdBkuk4emCSn7MrGquE/g7970V3kFl0kDhQVq456vaBLbbVZUHgkG48twVhnnLDpV4Rt3Y4La+XGN3ZX5gg==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@strudel/webaudio/-/webaudio-1.1.0.tgz", + "integrity": "sha512-9BigqLIP+0CETAtiuG4dbJCoMTTT2brSaWaEVadcwz6SiXPA0dxGjlcLgR/j+iDnCmbAmzgHRkfRbPAe6nS4Tg==", "dev": true, "dependencies": { - "@strudel/core": "1.0.1", - "superdough": "1.0.1" + "@strudel/core": "1.1.0", + "@strudel/draw": "1.1.0", + "superdough": "1.1.0" } }, "node_modules/@swc/core": { @@ -9274,7 +9284,6 @@ "version": "4.3.7", "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.3.7.tgz", "integrity": "sha512-ZsDfxO51wGAXREY55a7la9LScWpwv9RxIrYABrlvOFBlH/ShPnrtsXeuUIfXKKOVicNxQ+o8JTbJvjS4M89yew==", - "dev": true, "engines": { "node": "*" }, @@ -16367,9 +16376,9 @@ "integrity": "sha512-Ca5ib8HrFn+f+0n4N4ScTIA9iTOQ7MaGS1ylHcoVqW9J7w2w8PzN6g9gKmTYgGEBH8e120+RCmhpje6jC5uGWA==" }, "node_modules/superdough": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/superdough/-/superdough-1.0.1.tgz", - "integrity": "sha512-gfTbgOfFamhQzHitG2SW6QhW9c1WoFWHsQ8RpO/HTTXc1My0nDL1w5qQ38fqZ/EjIRy/YykDzdwxWYFaxG7X5w==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/superdough/-/superdough-1.1.0.tgz", + "integrity": "sha512-8UcCjMakhiZOrKFHS08LmrQZrrzp+om2FouTPFhg1/E1K+gGrsMUYyD6hJl7sa5IM+18Gm/GrBnXoShaqVK7FQ==", "dev": true, "dependencies": { "nanostores": "^0.9.5" @@ -18551,6 +18560,7 @@ "license": "GPL-3.0+", "dependencies": { "@flok-editor/server-middleware": "^1.0.1", + "@strudel/draw": "^1.1.0", "commander": "^10.0.0", "compression": "^1.7.4", "express": "^4.18.2", @@ -18577,16 +18587,16 @@ "@radix-ui/react-toast": "^1.1.3", "@radix-ui/react-toggle": "^1.0.2", "@radix-ui/react-tooltip": "^1.0.5", - "@strudel/codemirror": "^1.0.0", - "@strudel/core": "^1.0.1", - "@strudel/midi": "^1.0.1", - "@strudel/mini": "^1.0.1", - "@strudel/osc": "^1.0.1", - "@strudel/serial": "^1.0.1", - "@strudel/soundfonts": "^1.0.1", - "@strudel/tonal": "^1.0.1", - "@strudel/transpiler": "^1.0.1", - "@strudel/webaudio": "^1.0.1", + "@strudel/codemirror": "^1.1.0", + "@strudel/core": "^1.1.0", + "@strudel/midi": "^1.1.0", + "@strudel/mini": "^1.1.0", + "@strudel/osc": "^1.1.0", + "@strudel/serial": "^1.1.0", + "@strudel/soundfonts": "^1.1.0", + "@strudel/tonal": "^1.1.0", + "@strudel/transpiler": "^1.1.0", + "@strudel/webaudio": "^1.1.0", "@types/express": "^4.17.21", "@types/p5": "^1.7.6", "@types/react": "^18.2.43", diff --git a/packages/web/.gitignore b/packages/web/.gitignore index a547bf36..c24688ed 100644 --- a/packages/web/.gitignore +++ b/packages/web/.gitignore @@ -22,3 +22,6 @@ dist-ssr *.njsproj *.sln *.sw? + +# Strudel +public/assets/clockwork*.js diff --git a/packages/web/package.json b/packages/web/package.json index f90a871c..56120a33 100644 --- a/packages/web/package.json +++ b/packages/web/package.json @@ -16,11 +16,13 @@ ], "scripts": { "dev": "cross-env NODE_ENV=development node ./bin/flok-web.js", - "build": "tsc && vite build", + "prebuild": "node script/prebuild.js", + "build": "npm run prebuild && tsc && vite build", "start": "node ./bin/flok-web.js" }, "dependencies": { "@flok-editor/server-middleware": "^1.0.1", + "@strudel/draw": "^1.1.0", "commander": "^10.0.0", "compression": "^1.7.4", "express": "^4.18.2", @@ -44,16 +46,16 @@ "@radix-ui/react-toast": "^1.1.3", "@radix-ui/react-toggle": "^1.0.2", "@radix-ui/react-tooltip": "^1.0.5", - "@strudel/codemirror": "^1.0.0", - "@strudel/core": "^1.0.1", - "@strudel/midi": "^1.0.1", - "@strudel/mini": "^1.0.1", - "@strudel/osc": "^1.0.1", - "@strudel/serial": "^1.0.1", - "@strudel/soundfonts": "^1.0.1", - "@strudel/tonal": "^1.0.1", - "@strudel/transpiler": "^1.0.1", - "@strudel/webaudio": "^1.0.1", + "@strudel/codemirror": "^1.1.0", + "@strudel/core": "^1.1.0", + "@strudel/midi": "^1.1.0", + "@strudel/mini": "^1.1.0", + "@strudel/osc": "^1.1.0", + "@strudel/serial": "^1.1.0", + "@strudel/soundfonts": "^1.1.0", + "@strudel/tonal": "^1.1.0", + "@strudel/transpiler": "^1.1.0", + "@strudel/webaudio": "^1.1.0", "@types/express": "^4.17.21", "@types/p5": "^1.7.6", "@types/react": "^18.2.43", diff --git a/packages/web/script/prebuild.js b/packages/web/script/prebuild.js new file mode 100644 index 00000000..e8e2c87b --- /dev/null +++ b/packages/web/script/prebuild.js @@ -0,0 +1,27 @@ +// This script is executed before the build process starts. It can be used to +// do some pre-build tasks like copying files, etc. that are required for the +// build process. + +import { existsSync, mkdirSync, readdirSync, copyFileSync } from 'fs'; +import { fileURLToPath } from 'url'; +import { resolve, dirname } from 'path'; + +// Strudel +// * mkdir -p public/assets +// * cp ../../node_modules/@strudel/core/dist/assets/clockworker--*.js to /public/assets/ + +const __filename = fileURLToPath(import.meta.url); +const __dirname = dirname(__filename); +const publicAssetsDir = resolve(__dirname, '../public/assets'); +const strudelAssetsDir = resolve(__dirname, '../../../node_modules/@strudel/core/dist/assets'); + +if (!existsSync(publicAssetsDir)) { + mkdirSync(publicAssetsDir, { recursive: true }); +} + +const files = readdirSync(strudelAssetsDir).filter(file => file.startsWith('clockworker--')); +files.forEach(file => { + const src = resolve(strudelAssetsDir, file); + const dest = resolve(publicAssetsDir, file); + copyFileSync(src, dest); +}); diff --git a/packages/web/src/lib/strudel-wrapper.ts b/packages/web/src/lib/strudel-wrapper.ts index 8bcd36c7..c5128888 100644 --- a/packages/web/src/lib/strudel-wrapper.ts +++ b/packages/web/src/lib/strudel-wrapper.ts @@ -1,6 +1,5 @@ import type { EvalMessage } from "@flok-editor/session"; import { - Framer, Pattern, controls, evalScope, @@ -9,6 +8,7 @@ import { stack, valueToMidi, } from "@strudel/core"; +import { Framer } from "@strudel/draw"; import { registerSoundfonts } from "@strudel/soundfonts"; import { transpiler } from "@strudel/transpiler"; import { diff --git a/packages/web/src/lib/strudel.d.ts b/packages/web/src/lib/strudel.d.ts index 65aac278..15561705 100644 --- a/packages/web/src/lib/strudel.d.ts +++ b/packages/web/src/lib/strudel.d.ts @@ -1,13 +1,14 @@ +declare module "@strudel/codemirror"; declare module "@strudel/core"; declare module "@strudel/core/controls.mjs"; -declare module "@strudel/soundfonts"; +declare module "@strudel/draw"; declare module "@strudel/midi"; declare module "@strudel/mini"; declare module "@strudel/osc"; declare module "@strudel/serial"; +declare module "@strudel/soundfonts"; declare module "@strudel/tonal"; declare module "@strudel/transpiler"; declare module "@strudel/webaudio"; declare module "@strudel/webaudio/scheduler.mjs"; declare module "@strudel/webaudio/webaudio.mjs"; -declare module "@strudel/codemirror";