@rimori/client 2.2.0-next.5 → 2.3.0-next.1

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.
@@ -252,7 +252,8 @@ export class Logger {
252
252
  }
253
253
  try {
254
254
  // Dynamically import html2canvas only when window is available
255
- // This allows tree-shaking for environments without window (e.g., Node.js)
255
+ // html2canvas is an optional peer dependency - provided by @rimori/react-client
256
+ // In worker builds, this import should be marked as external to prevent bundling
256
257
  const html2canvas = (yield import('html2canvas')).default;
257
258
  const canvas = yield html2canvas(document.body);
258
259
  const screenshot = canvas.toDataURL('image/png');
@@ -260,9 +261,8 @@ export class Logger {
260
261
  return screenshot;
261
262
  }
262
263
  catch (error) {
263
- // html2canvas may not be available or may fail to load
264
+ // html2canvas may not be available (e.g., in workers or when not installed)
264
265
  // Silently fail to avoid breaking logging functionality
265
- this.originalConsole.warn('[Rimori Logger] Failed to capture screenshot:', error);
266
266
  return null;
267
267
  }
268
268
  });
@@ -14,6 +14,9 @@ export default defineConfig({
14
14
  outDir: path.resolve(__dirname, '../public'),
15
15
  emptyOutDir: false,
16
16
  rollupOptions: {
17
+ // Exclude DOM-only libraries that can't run in workers
18
+ // html2canvas is provided by @rimori/react-client for browser contexts
19
+ external: ['html2canvas'],
17
20
  output: {
18
21
  inlineDynamicImports: true,
19
22
  entryFileNames: 'web-worker.js',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rimori/client",
3
- "version": "2.2.0-next.5",
3
+ "version": "2.3.0-next.1",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "repository": {
@@ -31,22 +31,14 @@
31
31
  "dotenv": "16.5.0",
32
32
  "i18next": "^25.6.0"
33
33
  },
34
- "peerDependencies": {
35
- "html2canvas": "^1.4.1"
36
- },
37
- "peerDependenciesMeta": {
38
- "html2canvas": {
39
- "optional": true
40
- }
41
- },
42
34
  "devDependencies": {
43
35
  "@eslint/js": "^9.37.0",
44
36
  "eslint-config-prettier": "^10.1.8",
45
37
  "eslint-plugin-prettier": "^5.5.4",
46
38
  "eslint-plugin-react-hooks": "^7.0.0",
47
39
  "eslint-plugin-react-refresh": "^0.4.23",
48
- "globals": "^16.4.0",
49
40
  "html2canvas": "^1.4.1",
41
+ "globals": "^16.4.0",
50
42
  "prettier": "^3.6.2",
51
43
  "typescript": "^5.7.2",
52
44
  "typescript-eslint": "^8.46.0"
@@ -317,16 +317,16 @@ export class Logger {
317
317
 
318
318
  try {
319
319
  // Dynamically import html2canvas only when window is available
320
- // This allows tree-shaking for environments without window (e.g., Node.js)
320
+ // html2canvas is an optional peer dependency - provided by @rimori/react-client
321
+ // In worker builds, this import should be marked as external to prevent bundling
321
322
  const html2canvas = (await import('html2canvas')).default;
322
323
  const canvas = await html2canvas(document.body);
323
324
  const screenshot = canvas.toDataURL('image/png');
324
325
  // this.originalConsole.log("screenshot captured", screenshot)
325
326
  return screenshot;
326
327
  } catch (error) {
327
- // html2canvas may not be available or may fail to load
328
+ // html2canvas may not be available (e.g., in workers or when not installed)
328
329
  // Silently fail to avoid breaking logging functionality
329
- this.originalConsole.warn('[Rimori Logger] Failed to capture screenshot:', error);
330
330
  return null;
331
331
  }
332
332
  }