diff options
| author | AAGaming <aa@mail.catvibers.me> | 2022-08-17 20:03:45 -0400 |
|---|---|---|
| committer | AAGaming <aa@mail.catvibers.me> | 2022-08-17 20:03:45 -0400 |
| commit | 0018b8e9576373fbae2c39e3bd8fdebbbf9e6654 (patch) | |
| tree | bbb5ef1e9a8cd7f404c635fac1e32ce7fc76ab32 /frontend/src/index.tsx | |
| parent | 59038f65acf4676a01c8ce7fc134c33b954b94e2 (diff) | |
| download | decky-loader-4bc4f98e6cc0e9bbc2b2f6dae9fe6d62f159de7c.tar.gz decky-loader-4bc4f98e6cc0e9bbc2b2f6dae9fe6d62f159de7c.zip | |
bump lib and add temporary shims for webpack v5v2.0.5-pre12
Diffstat (limited to 'frontend/src/index.tsx')
| -rw-r--r-- | frontend/src/index.tsx | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/frontend/src/index.tsx b/frontend/src/index.tsx index b6c4e3aa..96c3306c 100644 --- a/frontend/src/index.tsx +++ b/frontend/src/index.tsx @@ -1,3 +1,6 @@ +import { ButtonItem, CommonUIModule, webpackCache } from 'decky-frontend-lib'; +import { forwardRef } from 'react'; + import PluginLoader from './plugin-loader'; import { DeckyUpdater } from './updater'; @@ -9,8 +12,31 @@ declare global { syncDeckyPlugins: Function; deckyHasLoaded: boolean; deckyAuthToken: string; + webpackJsonp: any; } } + +// HACK to fix plugins using webpack v4 push + +const v4Cache = {}; +for (let m of Object.keys(webpackCache)) { + v4Cache[m] = { exports: webpackCache[m] }; +} + +if (!window.webpackJsonp || window.webpackJsonp.deckyShimmed) { + window.webpackJsonp = { + deckyShimmed: true, + push: (mod: any): any => { + if (mod[1].get_require) return { c: v4Cache }; + }, + }; +} +CommonUIModule.__deckyButtonItemShim = forwardRef((props: any, ref: any) => { + // tricks the old filter into working + const dummy = `childrenContainerWidth:"min"`; + return <ButtonItem ref={ref} _shim={dummy} {...props} />; +}); + (async () => { window.deckyHasLoaded = true; window.deckyAuthToken = await fetch('http://127.0.0.1:1337/auth/token').then((r) => r.text()); |
