drawboard-microservice 1.0.3 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,9 +1,11 @@
1
1
  {
2
2
  "name": "drawboard-microservice",
3
3
  "private": false,
4
- "version": "1.0.3",
4
+ "version": "1.0.5",
5
5
  "type": "module",
6
- "main": "index.html",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.es.js",
8
+ "types": "./dist/index.d.ts",
7
9
  "scripts": {
8
10
  "dev": "vite",
9
11
  "build": "tsc -b && vite build",
package/src/index.ts ADDED
@@ -0,0 +1,4 @@
1
+ // Экспортируем компоненты, которые хотим сделать публичными
2
+ export { default as DrawingApp } from './App';
3
+ export { getInfo } from './services/widgetBridge';
4
+ // Добавьте другие экспорты по необходимости
package/src/main.tsx CHANGED
@@ -1,18 +1,18 @@
1
- import React from 'react';
2
- import ReactDOM from 'react-dom/client';
3
- import { getInfo } from './services/widgetBridge';
4
- import DrawingApp from './App.tsx';
1
+ import React from 'react';
2
+ import ReactDOM from 'react-dom/client';
3
+ import { getInfo } from './services/widgetBridge';
4
+ import DrawingApp from './App.tsx';
5
5
 
6
- // 👇 Делаем доступным из консоли и iframe
7
- (window as any).getInfo = getInfo;
6
+ // 👇 Делаем доступным из консоли и iframe
7
+ (window as any).getInfo = getInfo;
8
8
 
9
9
 
10
- const root = ReactDOM.createRoot(
11
- document.getElementById('root') as HTMLElement
12
- );
10
+ const root = ReactDOM.createRoot(
11
+ document.getElementById('root') as HTMLElement
12
+ );
13
13
 
14
- root.render(
15
- <React.StrictMode>
16
- <DrawingApp />
17
- </React.StrictMode>
18
- );
14
+ root.render(
15
+ <React.StrictMode>
16
+ <DrawingApp />
17
+ </React.StrictMode>
18
+ );
package/vite.config.ts CHANGED
@@ -1,10 +1,16 @@
1
- import { defineConfig } from 'vite'
2
- import react from '@vitejs/plugin-react'
1
+ import { defineConfig } from 'vite';
2
+
3
+ import { resolve } from 'path';
3
4
 
4
- // https://vite.dev/config/
5
5
  export default defineConfig({
6
- plugins: [react()],
7
- optimizeDeps: {
8
- include: ['void-elements']
6
+ build: {
7
+ lib: {
8
+ entry: resolve(__dirname, 'src/index.ts'),
9
+ formats: ['es'],
10
+ fileName: 'index'
11
+ },
12
+ rollupOptions: {
13
+ external: ['react', 'react-dom']
14
+ }
9
15
  }
10
- })
16
+ });