@nectary/components 5.14.4 → 5.14.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/bundle.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  // Reminder: Keep this list updated as we add new components
2
+
2
3
  export * from './accordion-item/index.js'
3
4
  export * from './accordion/index.js'
4
5
  export * from './action-menu-option/index.js'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nectary/components",
3
- "version": "5.14.4",
3
+ "version": "5.14.5",
4
4
  "files": [
5
5
  "**/*/*.css",
6
6
  "**/*/*.json",
@@ -24,7 +24,7 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "@babel/runtime": "^7.22.15",
27
- "@nectary/assets": "3.4.0"
27
+ "@nectary/assets": "3.4.1"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@babel/cli": "^7.22.15",
@@ -43,27 +43,39 @@ class GlobalElementsManager {
43
43
  const store = getStore(this.config.storeKey);
44
44
  const importPath = this.getImportPath(store.cdnUrl, modulePath);
45
45
  const fallbackImportPath = this.getImportPath(store.fallbackCdnUrl, modulePath);
46
- try {
47
- const module = await import(
46
+ const promises = [
47
+ import(
48
48
  /* webpackIgnore: true */
49
49
  importPath
50
+ )
51
+ ];
52
+ let timeoutId = null;
53
+ const FALLBACK_DELAY_MS = 2e3;
54
+ if (fallbackImportPath !== null) {
55
+ promises.push(
56
+ new Promise((resolve) => {
57
+ timeoutId = setTimeout(() => resolve(import(
58
+ /* webpackIgnore: true */
59
+ fallbackImportPath
60
+ )), FALLBACK_DELAY_MS);
61
+ })
50
62
  );
63
+ }
64
+ try {
65
+ const module = await Promise.any(promises);
66
+ if (timeoutId !== null) {
67
+ clearTimeout(timeoutId);
68
+ }
51
69
  return module;
52
70
  } catch (error) {
53
- if (fallbackImportPath !== null) {
54
- try {
55
- const fallbackModule = await import(
56
- /* webpackIgnore: true */
57
- fallbackImportPath
58
- );
59
- return fallbackModule;
60
- } catch (fallbackError) {
61
- console.error(`Nectary Primary load failed: ${importPath}`, error);
62
- console.error(`Nectary fallback load failed: ${fallbackImportPath}`, fallbackError);
63
- throw fallbackError;
71
+ if (error instanceof AggregateError) {
72
+ console.error(`Nectary Primary load failed: ${importPath}`, error.errors[0]);
73
+ if (fallbackImportPath !== null) {
74
+ console.error(`Nectary fallback load failed: ${fallbackImportPath}`, error.errors[1]);
64
75
  }
76
+ } else {
77
+ console.error(`Nectary failed to load module: ${importPath}`, error);
65
78
  }
66
- console.error(`Nectary failed to load module: ${importPath}`, error);
67
79
  throw error;
68
80
  }
69
81
  }