build: fix build issue with vite/vite-pwa/parakeet; upgrade deps
continuous-integration/drone/push Build encountered an error Details

This commit is contained in:
Jixun Wu 2023-12-21 22:49:12 +00:00
parent ae00a59c92
commit 0b8d9ec30c
7 changed files with 1522 additions and 1723 deletions

View File

@ -16,56 +16,56 @@
"prepare": "husky install"
},
"dependencies": {
"@chakra-ui/anatomy": "^2.2.1",
"@chakra-ui/anatomy": "^2.2.2",
"@chakra-ui/icons": "^2.1.1",
"@chakra-ui/react": "^2.8.1",
"@chakra-ui/react": "^2.8.2",
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@jixun/libparakeet": "0.4.2",
"@reduxjs/toolkit": "^1.9.7",
"framer-motion": "^10.16.4",
"@reduxjs/toolkit": "^2.0.1",
"framer-motion": "^10.16.16",
"immer": "^10.0.3",
"nanoid": "^5.0.1",
"nanoid": "^5.0.4",
"radash": "^11.0.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-dropzone": "^14.2.3",
"react-icons": "^4.11.0",
"react-icons": "^4.12.0",
"react-promise-suspense": "^0.3.4",
"react-redux": "^8.1.3",
"react-redux": "^9.0.4",
"react-syntax-highlighter": "^15.5.0",
"sass": "^1.69.2",
"sql.js": "^1.8.0"
"sass": "^1.69.5",
"sql.js": "^1.9.0"
},
"devDependencies": {
"@rollup/plugin-replace": "^5.0.3",
"@testing-library/jest-dom": "^6.1.3",
"@testing-library/react": "^14.0.0",
"@rollup/plugin-replace": "^5.0.5",
"@testing-library/jest-dom": "^6.1.5",
"@testing-library/react": "^14.1.2",
"@testing-library/user-event": "^14.5.1",
"@types/node": "^20.8.4",
"@types/react": "^18.2.28",
"@types/react-dom": "^18.2.13",
"@types/react-syntax-highlighter": "^15.5.8",
"@types/sql.js": "^1.4.5",
"@typescript-eslint/eslint-plugin": "^6.7.5",
"@typescript-eslint/parser": "^6.7.5",
"@vitejs/plugin-react": "^4.1.0",
"@vitest/coverage-v8": "^0.34.6",
"@vitest/ui": "^0.34.6",
"eslint": "^8.51.0",
"eslint-config-prettier": "^9.0.0",
"@types/node": "^20.10.5",
"@types/react": "^18.2.45",
"@types/react-dom": "^18.2.18",
"@types/react-syntax-highlighter": "^15.5.11",
"@types/sql.js": "^1.4.9",
"@typescript-eslint/eslint-plugin": "^6.15.0",
"@typescript-eslint/parser": "^6.15.0",
"@vitejs/plugin-react": "^4.2.1",
"@vitest/coverage-v8": "^1.1.0",
"@vitest/ui": "^1.1.0",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.3",
"eslint-plugin-react-refresh": "^0.4.5",
"husky": "^8.0.3",
"jsdom": "^22.1.0",
"lint-staged": "^14.0.1",
"prettier": "^3.0.3",
"typescript": "^5.2.2",
"vite": "^4.4.11",
"vite-plugin-pwa": "^0.16.5",
"vite-plugin-top-level-await": "^1.3.1",
"vite-plugin-wasm": "^3.2.2",
"vitest": "^0.34.6",
"jsdom": "^23.0.1",
"lint-staged": "^15.2.0",
"prettier": "^3.1.1",
"typescript": "^5.3.3",
"vite": "^5.0.10",
"vite-plugin-pwa": "^0.17.4",
"vite-plugin-top-level-await": "^1.4.1",
"vite-plugin-wasm": "^3.3.0",
"vitest": "^1.1.0",
"workbox-window": "^7.0.0"
},
"lint-staged": {
@ -80,7 +80,7 @@
"pnpm": {
"patchedDependencies": {
"@rollup/plugin-terser@0.4.3": "patches/@rollup__plugin-terser@0.4.3.patch",
"sql.js@1.8.0": "patches/sql.js@1.8.0.patch"
"sql.js@1.9.0": "patches/sql.js@1.9.0.patch"
},
"overrides": {
"rollup-plugin-terser": "npm:@rollup/plugin-terser@0.4.3",

View File

@ -1,12 +1,11 @@
diff --git a/dist/sql-wasm.js b/dist/sql-wasm.js
index e0da60ba096433d9af1c7025d2ffb9c521f190ed..89a5da6af23e1a644106d38dafe7cfa85500a8c4 100644
index d29af3624109025e59966cf25cb357111bb459de..1b028e3d91ec37108f775627f31f1134aec47476 100644
--- a/dist/sql-wasm.js
+++ b/dist/sql-wasm.js
@@ -192,3 +192,7 @@ else if (typeof define === 'function' && define['amd']) {
@@ -190,3 +190,6 @@ else if (typeof define === 'function' && define['amd']) {
else if (typeof exports === 'object'){
exports["Module"] = initSqlJs;
}
+
+var module;
+export default initSqlJs;
+

File diff suppressed because it is too large Load Diff

View File

@ -1,2 +1,5 @@
// This is a dummy module for vite/rollup to resolve.
Object.defineProperty(Object.create(null), { sideEffects: true });
export function createRequire() {
import('immer'); // we need to import something, so vite don't complain on build
throw new Error('this is a dummy module. Do not use');
}

View File

@ -1,4 +1,4 @@
import { PreloadedState, combineReducers, configureStore } from '@reduxjs/toolkit';
import { combineReducers, configureStore } from '@reduxjs/toolkit';
import fileListingReducer from './features/file-listing/fileListingSlice';
import settingsReducer from './features/settings/settingsSlice';
@ -7,12 +7,13 @@ const rootReducer = combineReducers({
settings: settingsReducer,
});
export const setupStore = (preloadedState?: PreloadedState<RootState>) =>
export type RootState = ReturnType<typeof rootReducer>;
export const setupStore = (preloadedState?: Partial<RootState>) =>
configureStore({
reducer: rootReducer,
preloadedState,
});
export type RootState = ReturnType<typeof rootReducer>;
export type AppStore = ReturnType<typeof setupStore>;
export type AppDispatch = AppStore['dispatch'];

View File

@ -1,4 +1,3 @@
import { PreloadedState } from '@reduxjs/toolkit';
import { RenderOptions, render } from '@testing-library/react';
import { PropsWithChildren } from 'react';
import { Provider } from 'react-redux';
@ -10,13 +9,13 @@ import { AppStore, RootState, setupStore } from '~/store';
export * from '@testing-library/react';
export interface ExtendedRenderOptions extends RenderOptions {
preloadedState?: PreloadedState<RootState>;
preloadedState?: Partial<RootState>;
store?: AppStore;
}
export function renderWithProviders(
ui: React.ReactElement,
{ preloadedState = {}, store = setupStore(preloadedState), ...renderOptions }: ExtendedRenderOptions = {}
{ preloadedState = {}, store = setupStore(preloadedState), ...renderOptions }: ExtendedRenderOptions = {},
) {
function Wrapper({ children }: PropsWithChildren<unknown>): JSX.Element {
return <Provider store={store}>{children}</Provider>;

View File

@ -86,6 +86,8 @@ export default defineConfig({
alias: {
'~': path.resolve(__dirname, 'src'),
'@nm': path.resolve(__dirname, 'node_modules'),
// workaround for vite, workbox (PWA) and Emscripten transpiled parakeet lib (use of `import("module")`)
module: path.resolve(__dirname, 'src', 'dummy.mjs'),
},
},