From 3ac8980f09896f4db2eae300f326816e395b6f9d Mon Sep 17 00:00:00 2001 From: Alexey Morozov Date: Fri, 6 Mar 2026 00:36:23 +0300 Subject: [PATCH 1/2] Enable strict mode in TypeScript configuration --- sidebars.ts | 6 +++++- src/examples/ExampleCommon.tsx | 11 +++++++++-- tsconfig.json | 3 ++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/sidebars.ts b/sidebars.ts index 64caf9c4..7bc05623 100644 --- a/sidebars.ts +++ b/sidebars.ts @@ -24,11 +24,15 @@ const typedocItems: SidebarItems = JSON.parse( ); function findSidebarCategory(items: SidebarItems, label: string): SidebarCategory { - return items.find((item): item is SidebarCategory => + const category = items.find((item): item is SidebarCategory => typeof item === 'object' && item.type === 'category' && item.label === label ); + if (!category) { + throw new Error(`Cannot find sidebar category "${label}"`); + } + return category; } const sidebars: SidebarsConfig = { diff --git a/src/examples/ExampleCommon.tsx b/src/examples/ExampleCommon.tsx index 4ed7f5a0..8d413045 100644 --- a/src/examples/ExampleCommon.tsx +++ b/src/examples/ExampleCommon.tsx @@ -1,7 +1,6 @@ import * as React from 'react'; import { HashMap } from '@reactodia/hashmap'; import * as Reactodia from '@reactodia/workspace'; -import { saveAs } from 'file-saver'; export function ExampleToolbarMenu() { const {model, editor, overlay} = Reactodia.useWorkspace(); @@ -56,8 +55,16 @@ export function ExampleToolbarMenu() { const diagramLayout = model.exportLayout(); const layoutString = JSON.stringify(diagramLayout); const blob = new Blob([layoutString], {type: 'application/json'}); + const blobUrl = URL.createObjectURL(blob); const timestamp = new Date().toISOString().replaceAll(/[Z\s:-]/g, ''); - saveAs(blob, `reactodia-diagram-${timestamp}.json`); + try { + const downloadLink = document.createElement('a'); + downloadLink.href = blobUrl; + downloadLink.download = `reactodia-diagram-${timestamp}.json`; + downloadLink.click(); + } finally { + URL.revokeObjectURL(blobUrl); + } }}> Save diagram to file diff --git a/tsconfig.json b/tsconfig.json index 12a8aa2d..894fbc1a 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,7 +4,8 @@ "compilerOptions": { "target": "ES2022", "lib": ["DOM", "ES2022"], - "baseUrl": "." + "baseUrl": ".", + "strict": true }, "exclude": [ "./reactodia-workspace" From c7dbef426fa7af0cea61a81ebe51612ccb7f0a11 Mon Sep 17 00:00:00 2001 From: Alexey Morozov Date: Fri, 6 Mar 2026 02:15:41 +0300 Subject: [PATCH 2/2] Fix source maps Webpack configuration --- src/plugins/configure-webpack/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/configure-webpack/index.js b/src/plugins/configure-webpack/index.js index 2020e7c1..0d5ab2d1 100644 --- a/src/plugins/configure-webpack/index.js +++ b/src/plugins/configure-webpack/index.js @@ -9,11 +9,12 @@ export default async function importRawSource(context, opts) { configureWebpack(config, isServer, utils) { return { + devtool: 'source-map', module: { rules: [ { test: /\.js$/, - enforce: "pre", + enforce: 'pre', use: [ { loader: 'source-map-loader',