@blocklet/pages-kit 0.4.128 → 0.4.129

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.
@@ -1,2 +1,3 @@
1
1
  export const BuiltinModulesGlobalVariableName = '__PAGES_KIT_BUILTIN_MODULES__';
2
2
  export const ChunksMountPointGlobalVariableName = '__PAGES_KIT_CHUNKS_MOUNT_POINT__';
3
+ export const RelativeModulesGlobalVariableName = '__PAGES_KIT_RELATIVE_MODULES__';
@@ -29,7 +29,7 @@ import * as utils from '../builtin/utils';
29
29
  import * as zustand from '../builtin/zustand';
30
30
  import * as zustandMiddlewareImmer from '../builtin/zustand/middleware/immer';
31
31
  import CustomComponentRenderer from '../components/CustomComponentRenderer';
32
- import { BuiltinModulesGlobalVariableName, ChunksMountPointGlobalVariableName } from '../types/builtin';
32
+ import { BuiltinModulesGlobalVariableName, ChunksMountPointGlobalVariableName, RelativeModulesGlobalVariableName, } from '../types/builtin';
33
33
  import { isRelativeModule } from './typescript/builtin-module-transformer';
34
34
  const { getComponentMountPoint } = utils;
35
35
  // Initialize ES Module Shims before any imports
@@ -46,6 +46,7 @@ export function injectGlobalComponents() {
46
46
  };
47
47
  }
48
48
  win.React = React;
49
+ win[RelativeModulesGlobalVariableName] = {};
49
50
  // create module map
50
51
  const modules = {
51
52
  React: react,
@@ -110,12 +111,15 @@ export function injectGlobalComponents() {
110
111
  window?.blocklet?.prefix ||
111
112
  '/';
112
113
  const fullUrl = joinURL(window.location.origin, relativeChunksMountPoint, 'chunks', fileName);
113
- if (enableShim) {
114
- const mod = window.importShim(/* @vite-ignore */ fullUrl);
115
- return mod;
114
+ if (!win[RelativeModulesGlobalVariableName][fullUrl]) {
115
+ if (enableShim) {
116
+ win[RelativeModulesGlobalVariableName][fullUrl] = window.importShim(/* @vite-ignore */ fullUrl);
117
+ }
118
+ else {
119
+ win[RelativeModulesGlobalVariableName][fullUrl] = import(/* @vite-ignore */ fullUrl);
120
+ }
116
121
  }
117
- const mod = import(/* @vite-ignore */ fullUrl);
118
- return mod;
122
+ return win[RelativeModulesGlobalVariableName][fullUrl];
119
123
  }
120
124
  return null;
121
125
  },
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  interface ComponentErrorProps {
3
3
  title?: string;
4
- message: string;
4
+ message?: string;
5
5
  componentId?: string;
6
6
  componentName?: string;
7
7
  blockletId?: string;
@@ -9,6 +9,8 @@ interface ComponentErrorProps {
9
9
  showHints?: boolean;
10
10
  error?: Error;
11
11
  resetErrorBoundary?: () => void;
12
+ delay?: number;
13
+ shouldShow?: () => boolean;
12
14
  }
13
15
  export declare const ComponentError: React.FC<ComponentErrorProps>;
14
16
  export {};