diff --git a/.gitignore b/.gitignore index f9a954e0..f892036f 100644 --- a/.gitignore +++ b/.gitignore @@ -30,6 +30,7 @@ MANIFEST # before PyInstaller builds the exe, so as to inject date/other infos into it. *.manifest backend/dist/ +backend/static # Installer logs pip-log.txt diff --git a/frontend/pnpm-lock.yaml b/frontend/pnpm-lock.yaml index b8945bb0..cac94a8b 100644 --- a/frontend/pnpm-lock.yaml +++ b/frontend/pnpm-lock.yaml @@ -11,6 +11,9 @@ importers: '@decky/ui': specifier: ^4.7.0 version: 4.7.0 + compare-versions: + specifier: ^6.1.1 + version: 6.1.1 filesize: specifier: ^10.1.2 version: 10.1.2 @@ -848,6 +851,9 @@ packages: commondir@1.0.1: resolution: {integrity: sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==} + compare-versions@6.1.1: + resolution: {integrity: sha512-4hm4VPpIecmlg59CHXnRDnqGplJFrbLG4aFEl5vl6cK1u76ws3LLvX7ikFnTDl5vo39sjWD6AaDPYodJp/NNHg==} + concat-map@0.0.1: resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} @@ -2816,6 +2822,8 @@ snapshots: commondir@1.0.1: {} + compare-versions@6.1.1: {} + concat-map@0.0.1: {} convert-source-map@2.0.0: {} diff --git a/frontend/rollup.config.js b/frontend/rollup.config.js deleted file mode 100644 index 2c731e54..00000000 --- a/frontend/rollup.config.js +++ /dev/null @@ -1,58 +0,0 @@ -import commonjs from '@rollup/plugin-commonjs'; -import image from '@rollup/plugin-image'; -import json from '@rollup/plugin-json'; -import { nodeResolve } from '@rollup/plugin-node-resolve'; -import replace from '@rollup/plugin-replace'; -import typescript from '@rollup/plugin-typescript'; -import { defineConfig } from 'rollup'; -import del from 'rollup-plugin-delete'; -import externalGlobals from 'rollup-plugin-external-globals'; -import { visualizer } from 'rollup-plugin-visualizer'; - -const hiddenWarnings = ['THIS_IS_UNDEFINED', 'EVAL']; - -export default defineConfig({ - input: 'src/index.ts', - plugins: [ - del({ targets: '../backend/decky_loader/static/*', force: true }), - commonjs(), - nodeResolve({ - browser: true, - }), - externalGlobals({ - react: 'SP_REACT', - 'react-dom': 'SP_REACTDOM', - // hack to shut up react-markdown - process: '{cwd: () => {}}', - path: '{dirname: () => {}, join: () => {}, basename: () => {}, extname: () => {}}', - url: '{fileURLToPath: (f) => f}', - }), - typescript(), - json(), - replace({ - preventAssignment: false, - 'process.env.NODE_ENV': JSON.stringify('production'), - }), - image(), - visualizer(), - ], - preserveEntrySignatures: false, - treeshake: { - // Assume all external modules have imports with side effects (the default) while allowing decky libraries to treeshake - pureExternalImports: true, - preset: 'smallest' - }, - output: { - dir: '../backend/decky_loader/static', - format: 'esm', - chunkFileNames: (chunkInfo) => { - return 'chunk-[hash].js'; - }, - sourcemap: true, - sourcemapPathTransform: (relativeSourcePath) => relativeSourcePath.replace(/^\.\.\//, `decky://decky/loader/`), - }, - onwarn: function (message, handleWarning) { - if (hiddenWarnings.some((warning) => message.code === warning)) return; - handleWarning(message); - }, -}); diff --git a/frontend/rollup.config.mjs b/frontend/rollup.config.mjs index e86fbf07..2c731e54 100644 --- a/frontend/rollup.config.mjs +++ b/frontend/rollup.config.mjs @@ -14,7 +14,7 @@ const hiddenWarnings = ['THIS_IS_UNDEFINED', 'EVAL']; export default defineConfig({ input: 'src/index.ts', plugins: [ - del({ targets: '../backend/static/*', force: true }), + del({ targets: '../backend/decky_loader/static/*', force: true }), commonjs(), nodeResolve({ browser: true, @@ -37,8 +37,13 @@ export default defineConfig({ visualizer(), ], preserveEntrySignatures: false, + treeshake: { + // Assume all external modules have imports with side effects (the default) while allowing decky libraries to treeshake + pureExternalImports: true, + preset: 'smallest' + }, output: { - dir: '../backend/static', + dir: '../backend/decky_loader/static', format: 'esm', chunkFileNames: (chunkInfo) => { return 'chunk-[hash].js';