Skip to content

Commit

Permalink
refactor: migrate workers to easy worker package
Browse files Browse the repository at this point in the history
  • Loading branch information
Dabolus committed Dec 20, 2023
1 parent 8270cea commit 4dafdc7
Show file tree
Hide file tree
Showing 17 changed files with 15 additions and 112 deletions.
Binary file modified bun.lockb
Binary file not shown.
1 change: 1 addition & 0 deletions src/experiments/steganography-toolkit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"build": "bun run vite build"
},
"dependencies": {
"@easy-worker/core": "^0.1.0",
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@mui/icons-material": "^5.14.11",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { setupWorkerClient } from '../../../workers/utils';
import { setupWorkerClient } from '@easy-worker/core';
import type { LSBWorker } from '../../../workers/image/lsb.worker';

export const lsbWorker = setupWorkerClient<LSBWorker>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import React, {
useEffect,
} from 'react';
import { useDebounce } from 'use-debounce';
import { setupWorkerClient } from '@easy-worker/core';
import { Button, Menu, MenuItem, Box, Grid } from '@mui/material';
import {
ArrowDropUp as ArrowDropUpIcon,
Expand All @@ -18,7 +19,6 @@ import Cicada3301DyadsForm, {
} from '../../../components/music/cicada-3301-dyads/Cicada3301DyadsForm';
import Abc from '../../../components/music/Abc';
import Loader from '../../../components/Loader';
import { setupWorkerClient } from '../../../workers/utils';
import type { Cicada3301DyadsWorker } from '../../../workers/music/cicada-3301-dyads.worker';
import useAudioExporter from '../../../hooks/useAudioExporter';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import React, {
import { useSearchParams } from 'react-router-dom';
import { renderToString } from 'react-dom/server';
import { saveAs } from 'file-saver';
import { setupWorkerClient } from '@easy-worker/core';
import {
OutlinedInputProps,
Unstable_Grid2 as Grid,
Expand All @@ -34,7 +35,6 @@ import {
ArrowDropDown as ArrowDropDownIcon,
} from '@mui/icons-material';
import { useDebounce } from 'use-debounce';
import { setupWorkerClient } from '../../../workers/utils';
import Page from '../../../components/Page';
import Loader from '../../../components/Loader';
import SolresolOutput, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import React, {
useEffect,
startTransition,
} from 'react';
import { setupWorkerClient } from '@easy-worker/core';
import { useDebouncedCallback } from 'use-debounce';
import colormap from 'colormap';
import WaveSurfer from 'wavesurfer.js';
Expand All @@ -17,7 +18,6 @@ import {
Download as DownloadIcon,
} from '@mui/icons-material';
import Page from '../../../components/Page';
import { setupWorkerClient } from '../../../workers/utils';
import type {
GetImageSpectrogramProgressMessage,
SpectrogramWorker,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { setupWorkerClient } from '../../../workers/utils';
import { setupWorkerClient } from '@easy-worker/core';
import type { UnicodeWorker } from '../../../workers/text/unicode.worker';

export const unicodeWorker = setupWorkerClient<UnicodeWorker>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import {
} from 'react';
import ABCJS from 'abcjs';
import { saveAs } from 'file-saver';
import { setupWorkerClient } from '@easy-worker/core';
import { AbcProps } from '../components/music/Abc';
import { setupWorkerClient } from '../workers/utils';
import type {
EncodeMp3Options,
MusicExporterWorker,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useCallback } from 'react';
import { setupWorkerClient } from '../workers/utils';
import { setupWorkerClient } from '@easy-worker/core';
import type { PreprocessorWorker } from '../workers/preprocessor.worker';

const preprocessorWorker = setupWorkerClient<PreprocessorWorker>(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { setupWorkerServer } from '../utils';
import { setupWorkerServer } from '@easy-worker/core';

export interface EncodeOptions {
inputImage: ImageData;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { setupWorkerServer } from '@easy-worker/core';
import { nextPrime } from '../../helpers';
import letterNotesMapping from '../../static/cicada-3301-dyads/letterNotesMapping.json';
import { setupWorkerServer } from '../utils';
import type {
Language,
Cicada3301DyadsFormValue,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Mp3Encoder } from 'lamejs';
import MPEGMode from 'lamejs/src/js/MPEGMode';
import Lame from 'lamejs/src/js/Lame';
import BitStream from 'lamejs/src/js/BitStream';
import { setupWorkerServer } from '../utils';
import { setupWorkerServer } from '@easy-worker/core';

// lamejs is buggy and refers to these modules globally instead of importing them
(globalThis as any).MPEGMode = MPEGMode;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Fuse from 'fuse.js';
import nlp from 'compromise';
import { setupWorkerServer } from '@easy-worker/core';
import solresolDictionary from '../../static/solresol/dictionary.json';
import { setupWorkerServer } from '../utils';
import type { Verbs } from 'compromise/types/view/three';
import type { PickMatching } from '../../helpers';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { setupWorkerServer } from '../utils';
import { setupWorkerServer } from '@easy-worker/core';

export interface GetImageSpectrogramOptions {
imageData: ImageData;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { setupWorkerServer } from './utils';
import { setupWorkerServer } from '@easy-worker/core';

export type EncryptionAlgorithm = 'AES-CTR' | 'AES-CBC' | 'AES-GCM';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { setupWorkerServer } from '../utils';
import { setupWorkerServer } from '@easy-worker/core';

export interface DecodedTextResult {
originalText: string;
Expand Down
98 changes: 0 additions & 98 deletions src/experiments/steganography-toolkit/src/workers/utils.ts

This file was deleted.

0 comments on commit 4dafdc7

Please sign in to comment.