Skip to content

Commit

Permalink
feat: mGBA as package
Browse files Browse the repository at this point in the history
- an initial test to see how this will work out
  • Loading branch information
thenick775 committed Oct 3, 2024
1 parent 1ced7ee commit 6892703
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 103 deletions.
7 changes: 7 additions & 0 deletions gbajs3/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions gbajs3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"@emotion/styled": "^11.11.0",
"@mui/material": "^6.0.2",
"@mui/x-tree-view": "^7.0.0",
"@thenick775/mgba-wasm": "^1.0.9",
"@uidotdev/usehooks": "^2.4.1",
"jwt-decode": "^4.0.0",
"nanoid": "^5.0.7",
Expand Down
2 changes: 1 addition & 1 deletion gbajs3/src/emulator/mgba/mgba-emulator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type {
coreCallbacks,
filePaths,
mGBAEmulator as mGBAEmulatorTypeDef
} from './wasm/mgba.js';
} from '@thenick775/mgba-wasm';

interface FsNode extends FS.FSNode {
mode: number;
Expand Down
86 changes: 0 additions & 86 deletions gbajs3/src/emulator/mgba/wasm/mgba.d.ts

This file was deleted.

15 changes: 0 additions & 15 deletions gbajs3/src/emulator/mgba/wasm/mgba.js

This file was deleted.

Binary file removed gbajs3/src/emulator/mgba/wasm/mgba.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion gbajs3/src/hooks/use-emulator.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import mGBA from '@thenick775/mgba-wasm';
import { useEffect, useState } from 'react';

import {
mGBAEmulator,
type GBAEmulator
} from '../emulator/mgba/mgba-emulator.tsx';
import mGBA from '../emulator/mgba/wasm/mgba.js';

export const useEmulator = (canvas: HTMLCanvasElement | null) => {
const [emulator, setEmulator] = useState<GBAEmulator | null>(null);
Expand Down
8 changes: 8 additions & 0 deletions gbajs3/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ export default defineConfig({
}),
visualizer({ gzipSize: true })
],
optimizeDeps: {
exclude: ['@thenick775/mgba-wasm']
},
build: {
rollupOptions: {
output: {
Expand All @@ -98,6 +101,11 @@ export default defineConfig({
return vendorPrefix + '_@mui';
}

if (id.indexOf('@thenick775/mgba-wasm') > -1) {
// vendor mGBA
return vendorPrefix + '_mgba-wasm';
}

if (
id.indexOf('react-joyride') > -1 ||
id.indexOf('react-floater') > -1 ||
Expand Down

0 comments on commit 6892703

Please sign in to comment.