From 97677f82175cb4183f4d4afb6c2071421fac91f4 Mon Sep 17 00:00:00 2001 From: Dipak Sinha Date: Fri, 29 Dec 2023 01:52:09 -0500 Subject: [PATCH 1/2] Add support for precaching generated assets in sw.js --- app/tools/vite.config.ts | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/app/tools/vite.config.ts b/app/tools/vite.config.ts index 422c2b98..d095c303 100644 --- a/app/tools/vite.config.ts +++ b/app/tools/vite.config.ts @@ -92,6 +92,42 @@ export default defineConfig({ 'lib.i18n': resolve('../lib/i18n/index.ts'), 'lib.view': resolve('../lib/view/index.ts'), }, + plugins: [ + { + name: 'custom-sw-plugin', + generateBundle(options, bundle) { + const swCode = ` + import { precacheAndRoute } from 'workbox-precaching'; + + precacheAndRoute([ + '/build-53e87ed8.svg', + '/close-444dc9a6.svg', + '/code-74870b2e.svg', + '/build-53e87ed8.svg', + '/close-444dc9a6.svg', + '/code-74870b2e.svg', + '/exportDrawing-aee43b5d.svg', + '/help-a0383ce2.svg', + '/logo-3080f493.png', + '/mouse-46cf41ce.svg', + '/pin-8515e01d.svg', + '/reset-a8de2102.svg', + '/run-123f2282.svg', + '/saveProjectHTML-e442bff6.svg', + '/startRecording-5dec9e0d.svg', + '/stop-aa193098.svg', + '/stopRecording-48f9a011.svg', + '/unpin-427cfcc6.svg' + ]);`; + + this.emitFile({ + type: 'asset', + fileName: 'sw.js', + source: swCode, + }); + }, + }, + ] }, }, }); From 3707e37a810dfed1ec8e73021bbb1cb26a37ec29 Mon Sep 17 00:00:00 2001 From: Dipak Sinha Date: Sun, 7 Jan 2024 13:30:02 -0500 Subject: [PATCH 2/2] fix:fix: Resolve TypeScript compilation errors in Voice.tsx --- modules/singer/src/singer.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/singer/src/singer.ts b/modules/singer/src/singer.ts index b13ec776..c33b51ed 100644 --- a/modules/singer/src/singer.ts +++ b/modules/singer/src/singer.ts @@ -23,7 +23,7 @@ const currentpitch = new CurrentPitch(testKeySignature, new Temperament(), 1, 4) const _stateObj = { ..._defaultSynthStateValues }; /** Proxy to the synth state parameters. */ -const _state = new Proxy(_stateObj, { +export const _state = new Proxy(_stateObj, { set: (_, key, value) => { if (key === 'beatsPerMinute') { _stateObj.beatsPerMinute = value; @@ -37,7 +37,7 @@ const _state = new Proxy(_stateObj, { }); /** Default synth **/ -const _defaultSynth = new Tone.Synth().toDestination(); +export const _defaultSynth = new Tone.Synth().toDestination(); // -- private functions ----------------------------------------------------------------------------