@hortonstudio/main 1.2.3 → 1.2.4

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.
Files changed (2) hide show
  1. package/index.js +11 -2
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -155,6 +155,11 @@ const loadHsModule = async (moduleName) => {
155
155
  console.log(`🔄 loadHsModule called for: ${moduleName}`);
156
156
  const apiInstance = window[API_NAME];
157
157
 
158
+ if (!apiInstance || !apiInstance.process) {
159
+ console.error(`❌ API not initialized properly:`, apiInstance);
160
+ throw new Error(`${API_NAME} API not initialized`);
161
+ }
162
+
158
163
  if (apiInstance.process.has(moduleName)) {
159
164
  console.log(`⚠️ Module ${moduleName} already processing, returning existing promise`);
160
165
  return apiInstance.modules[moduleName]?.loading;
@@ -215,7 +220,7 @@ const initializeAPI = () => {
215
220
  const existingAPI = window[API_NAME];
216
221
  console.log(`🔍 Existing API:`, existingAPI);
217
222
 
218
- if (existingAPI && !Array.isArray(existingAPI)) {
223
+ if (existingAPI && !Array.isArray(existingAPI) && existingAPI.process) {
219
224
  console.log(`⚡ API already initialized, processing...`);
220
225
  processAPI();
221
226
  return;
@@ -337,7 +342,11 @@ const processAPI = () => {
337
342
 
338
343
  // Always load auto-init modules
339
344
  for (const moduleName of Object.keys(autoInitModules)) {
340
- loadHsModule(moduleName);
345
+ try {
346
+ loadHsModule(moduleName);
347
+ } catch (error) {
348
+ console.error(`❌ Failed to load auto-init module ${moduleName}:`, error);
349
+ }
341
350
  }
342
351
 
343
352
  // Hide .transition elements if transition module is not loaded
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hortonstudio/main",
3
- "version": "1.2.3",
3
+ "version": "1.2.4",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "scripts": {