mirror of
https://codeberg.org/uzu/strudel
synced 2026-09-05 22:58:09 -04:00
replaced brotli in favor of Compression Streams API
This commit is contained in:
Generated
-33
@@ -804,9 +804,6 @@ importers:
|
||||
base64url-universal:
|
||||
specifier: ^2.0.0
|
||||
version: 2.0.0
|
||||
brotli-compress:
|
||||
specifier: ^1.3.3
|
||||
version: 1.3.3
|
||||
claviature:
|
||||
specifier: ^0.1.0
|
||||
version: 0.1.0
|
||||
@@ -849,9 +846,6 @@ importers:
|
||||
tailwindcss:
|
||||
specifier: ^3.4.17
|
||||
version: 3.4.17
|
||||
vite-plugin-wasm:
|
||||
specifier: ^3.4.1
|
||||
version: 3.4.1(vite@6.0.11(@types/node@22.10.10)(jiti@2.4.2)(lightningcss@1.29.1)(terser@5.37.0)(yaml@2.7.0))
|
||||
worker-timers:
|
||||
specifier: ^8.0.13
|
||||
version: 8.0.13
|
||||
@@ -2853,9 +2847,6 @@ packages:
|
||||
'@types/nlcst@2.0.3':
|
||||
resolution: {integrity: sha512-vSYNSDe6Ix3q+6Z7ri9lyWqgGhJTmzRjZRqyq15N0Z/1/UnVsno9G/N40NBijoYx2seFDIl0+B2mgAb9mezUCA==}
|
||||
|
||||
'@types/node@17.0.45':
|
||||
resolution: {integrity: sha512-w+tIMs3rq2afQdsPJlODhoUEKzFP1ayaoyl1CcnwtIlsVe7K7bA1NGm4s3PraqTLlXnbIN84zuBlxBWo1u9BLw==}
|
||||
|
||||
'@types/node@22.10.10':
|
||||
resolution: {integrity: sha512-X47y/mPNzxviAGY5TcYPtYL8JsY3kAq2n8fMmKoRCxq/c4v4pyGNCzM2R6+M5/umG4ZfHuT+sgqDYqWc9rJ6ww==}
|
||||
|
||||
@@ -3281,12 +3272,6 @@ packages:
|
||||
resolution: {integrity: sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==}
|
||||
engines: {node: '>=8'}
|
||||
|
||||
brotli-compress@1.3.3:
|
||||
resolution: {integrity: sha512-cwKOmzEuKqUmRxXDdZimiNoXRRr7AQKMSubJSbYA9FXk+LTPT3fBGpHU8VZRZZctAJ5OCeXGK9PzPpZ1vD0pDA==}
|
||||
|
||||
brotli-wasm@1.2.0:
|
||||
resolution: {integrity: sha512-PdDi7awF36zFujZyFJb9UNrP1l+If7iCgXhLKE1SpwqFQSK2yc7w2dysOmME7p325yQaZNvae7ruzypB3YhFxA==}
|
||||
|
||||
browserslist@4.24.4:
|
||||
resolution: {integrity: sha512-KDi1Ny1gSePi1vm0q4oxSF8b4DR44GF4BbmS2YdhPLOEqd8pDviZOGH/GsmRwoWJ2+5Lr085X7naowMwKHDG1A==}
|
||||
engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7}
|
||||
@@ -7505,11 +7490,6 @@ packages:
|
||||
'@vite-pwa/assets-generator':
|
||||
optional: true
|
||||
|
||||
vite-plugin-wasm@3.4.1:
|
||||
resolution: {integrity: sha512-ja3nSo2UCkVeitltJGkS3pfQHAanHv/DqGatdI39ja6McgABlpsZ5hVgl6wuR8Qx5etY3T5qgDQhOWzc5RReZA==}
|
||||
peerDependencies:
|
||||
vite: ^2 || ^3 || ^4 || ^5 || ^6
|
||||
|
||||
vite@6.0.11:
|
||||
resolution: {integrity: sha512-4VL9mQPKoHy4+FE0NnRE/kbY51TOfaknxAjt3fJbGJxhIpBZiqVzlZDEesWWsuREXHwNdAoOFZ9MkPEVXczHwg==}
|
||||
engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0}
|
||||
@@ -10328,8 +10308,6 @@ snapshots:
|
||||
dependencies:
|
||||
'@types/unist': 3.0.3
|
||||
|
||||
'@types/node@17.0.45': {}
|
||||
|
||||
'@types/node@22.10.10':
|
||||
dependencies:
|
||||
undici-types: 6.20.0
|
||||
@@ -10909,13 +10887,6 @@ snapshots:
|
||||
dependencies:
|
||||
fill-range: 7.1.1
|
||||
|
||||
brotli-compress@1.3.3:
|
||||
dependencies:
|
||||
'@types/node': 17.0.45
|
||||
brotli-wasm: 1.2.0
|
||||
|
||||
brotli-wasm@1.2.0: {}
|
||||
|
||||
browserslist@4.24.4:
|
||||
dependencies:
|
||||
caniuse-lite: 1.0.30001695
|
||||
@@ -15970,10 +15941,6 @@ snapshots:
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
vite-plugin-wasm@3.4.1(vite@6.0.11(@types/node@22.10.10)(jiti@2.4.2)(lightningcss@1.29.1)(terser@5.37.0)(yaml@2.7.0)):
|
||||
dependencies:
|
||||
vite: 6.0.11(@types/node@22.10.10)(jiti@2.4.2)(lightningcss@1.29.1)(terser@5.37.0)(yaml@2.7.0)
|
||||
|
||||
vite@6.0.11(@types/node@22.10.10)(jiti@2.4.2)(lightningcss@1.29.1)(terser@5.37.0)(yaml@2.7.0):
|
||||
dependencies:
|
||||
esbuild: 0.24.2
|
||||
|
||||
@@ -6,7 +6,6 @@ import rehypeSlug from 'rehype-slug';
|
||||
import rehypeAutolinkHeadings from 'rehype-autolink-headings';
|
||||
import rehypeUrls from 'rehype-urls';
|
||||
import bundleAudioWorkletPlugin from 'vite-plugin-bundle-audioworklet';
|
||||
import wasm from 'vite-plugin-wasm';
|
||||
|
||||
import tailwind from '@astrojs/tailwind';
|
||||
import AstroPWA from '@vite-pwa/astro';
|
||||
@@ -136,10 +135,7 @@ export default defineConfig({
|
||||
site,
|
||||
base,
|
||||
vite: {
|
||||
optimizeDeps: {
|
||||
exclude: ["brotli-wasm", "brotli-wasm/pkg.bundler/brotli_wasm_bg.wasm"],
|
||||
},
|
||||
plugins: [bundleAudioWorkletPlugin(),wasm()],
|
||||
plugins: [bundleAudioWorkletPlugin()],
|
||||
ssr: {
|
||||
// Example: Force a broken package to skip SSR processing, if needed
|
||||
// external: ['fraction.js'], // https://github.com/infusion/Fraction.js/issues/51
|
||||
|
||||
@@ -54,7 +54,6 @@
|
||||
"@types/react-dom": "^19.0.3",
|
||||
"astro": "^5.1.9",
|
||||
"base64url-universal": "^2.0.0",
|
||||
"brotli-compress": "^1.3.3",
|
||||
"claviature": "^0.1.0",
|
||||
"date-fns": "^4.1.0",
|
||||
"hs2js": "0.1.0",
|
||||
@@ -69,7 +68,6 @@
|
||||
"rehype-urls": "^1.2.0",
|
||||
"remark-toc": "^9.0.0",
|
||||
"tailwindcss": "^3.4.17",
|
||||
"vite-plugin-wasm": "^3.4.1",
|
||||
"worker-timers": "^8.0.13"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -36,7 +36,6 @@ import { getRandomTune, initCode, loadModules, shareCode } from './util.mjs';
|
||||
import './Repl.css';
|
||||
import { setInterval, clearInterval } from 'worker-timers';
|
||||
import { getMetadata } from '../metadata_parser';
|
||||
import { compress as brotlicompress } from 'brotli-compress';
|
||||
import { encode as base64urlencode } from 'base64url-universal';
|
||||
|
||||
const { latestCode, maxPolyphony, audioDeviceName, multiChannelOrbits } = settingsMap.get();
|
||||
@@ -104,12 +103,16 @@ export function useReplContext() {
|
||||
setLatestCode(code);
|
||||
//window.location.hash = '#' + code2hash(code);
|
||||
|
||||
// Compress the script with brotli and encode it with base64url
|
||||
// Compress the script and encode it with base64url
|
||||
const encoded = new TextEncoder().encode(code);
|
||||
//console.log('encoded',encoded);
|
||||
const brotlized = await brotlicompress(encoded, { mode: 1, quality: 11 });
|
||||
//console.log('brotlized',brotlized);
|
||||
const baseurled = base64urlencode(brotlized);
|
||||
|
||||
const cs = new CompressionStream('deflate');
|
||||
const writer = cs.writable.getWriter(); writer.write(encoded); writer.close();
|
||||
const compressed = new Uint8Array(await new Response(cs.readable).arrayBuffer());
|
||||
//console.log('compressed',compressed);
|
||||
|
||||
const baseurled = base64urlencode(compressed);
|
||||
//console.log('baseurled',baseurled);
|
||||
window.location.hash = '#~' + baseurled;
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ import { createClient } from '@supabase/supabase-js';
|
||||
import { nanoid } from 'nanoid';
|
||||
import { writeText } from '@tauri-apps/plugin-clipboard-manager';
|
||||
import { $featuredPatterns /* , loadDBPatterns */ } from '@src/user_pattern_utils.mjs';
|
||||
import { decompress as brotlidecompress } from 'brotli-compress';
|
||||
import { decode as base64urldecode } from 'base64url-universal';
|
||||
|
||||
// Create a single supabase client for interacting with your database
|
||||
@@ -31,13 +30,17 @@ export async function initCode() {
|
||||
if (codeParam) {
|
||||
if (codeParam[0] === '~')
|
||||
{
|
||||
// Encoded using base64url and Compressed by brotli
|
||||
// Encoded using base64url and compressed
|
||||
const baseurled = codeParam.substring(1);
|
||||
//console.log('baseurled', baseurled);
|
||||
const brotlized = base64urldecode(baseurled);
|
||||
//console.log('brotlized', brotlized);
|
||||
const encoded = await brotlidecompress(brotlized);
|
||||
const compressed = base64urldecode(baseurled);
|
||||
//console.log('compressed', compressed);
|
||||
|
||||
const cs = new DecompressionStream('deflate');
|
||||
const writer = cs.writable.getWriter(); writer.write(compressed); writer.close();
|
||||
const encoded = await new Response(cs.readable).arrayBuffer()
|
||||
//console.log('encoded', encoded);
|
||||
|
||||
const decoded = new TextDecoder().decode(encoded);
|
||||
//console.log('decoded', decoded);
|
||||
return decoded;
|
||||
|
||||
Reference in New Issue
Block a user