@graphql-mesh/utils 0.103.7 → 0.103.8

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.
@@ -35,32 +35,35 @@ var __importStar = (this && this.__importStar) || (function () {
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.defaultImportFn = defaultImportFn;
37
37
  const cross_helpers_1 = require("@graphql-mesh/cross-helpers");
38
- async function defaultImportFn(path) {
39
- let module = await Promise.resolve(`${path}`).then(s => __importStar(require(s))).catch(e => {
38
+ function defaultImportFn(path) {
39
+ return Promise.resolve(`${path}`).then(s => __importStar(require(s))).then(module => {
40
+ let i = 0;
41
+ while (module?.default != null) {
42
+ if (i > 10 || module === module.default) {
43
+ break;
44
+ }
45
+ module = module.default;
46
+ i++;
47
+ }
48
+ if (typeof module === 'object' && module != null) {
49
+ const prototypeOfObject = Object.getPrototypeOf(module);
50
+ if (prototypeOfObject == null || prototypeOfObject === Object.prototype) {
51
+ const normalizedVal = {};
52
+ for (const key in module) {
53
+ normalizedVal[key] = module[key];
54
+ }
55
+ return normalizedVal;
56
+ }
57
+ }
58
+ return module;
59
+ }, e => {
40
60
  if (e.code === 'ERR_REQUIRE_ESM') {
41
61
  // eslint-disable-next-line no-new-func
42
62
  return new Function(`return import(${JSON.stringify(path)})`)();
43
63
  }
44
- throw e;
45
- })
46
- .catch(e => {
47
64
  if (cross_helpers_1.path.isAbsolute(path) && !path.endsWith('.js') && !path.endsWith('.ts')) {
48
65
  return defaultImportFn(`${path}.ts`);
49
66
  }
50
67
  throw e;
51
68
  });
52
- if (module.default != null) {
53
- module = module.default;
54
- }
55
- if (typeof module === 'object' && module != null) {
56
- const prototypeOfObject = Object.getPrototypeOf(module);
57
- if (prototypeOfObject == null || prototypeOfObject === Object.prototype) {
58
- const normalizedVal = {};
59
- for (const key in module) {
60
- normalizedVal[key] = module[key];
61
- }
62
- return normalizedVal;
63
- }
64
- }
65
- return module;
66
69
  }
@@ -1,32 +1,34 @@
1
1
  import { path as pathModule } from '@graphql-mesh/cross-helpers';
2
- async function defaultImportFn(path) {
3
- let module = await import(/* @vite-ignore */ path)
4
- .catch(e => {
2
+ function defaultImportFn(path) {
3
+ return import(/* @vite-ignore */ path).then(module => {
4
+ let i = 0;
5
+ while (module?.default != null) {
6
+ if (i > 10 || module === module.default) {
7
+ break;
8
+ }
9
+ module = module.default;
10
+ i++;
11
+ }
12
+ if (typeof module === 'object' && module != null) {
13
+ const prototypeOfObject = Object.getPrototypeOf(module);
14
+ if (prototypeOfObject == null || prototypeOfObject === Object.prototype) {
15
+ const normalizedVal = {};
16
+ for (const key in module) {
17
+ normalizedVal[key] = module[key];
18
+ }
19
+ return normalizedVal;
20
+ }
21
+ }
22
+ return module;
23
+ }, e => {
5
24
  if (e.code === 'ERR_REQUIRE_ESM') {
6
25
  // eslint-disable-next-line no-new-func
7
26
  return new Function(`return import(${JSON.stringify(path)})`)();
8
27
  }
9
- throw e;
10
- })
11
- .catch(e => {
12
28
  if (pathModule.isAbsolute(path) && !path.endsWith('.js') && !path.endsWith('.ts')) {
13
29
  return defaultImportFn(`${path}.ts`);
14
30
  }
15
31
  throw e;
16
32
  });
17
- if (module.default != null) {
18
- module = module.default;
19
- }
20
- if (typeof module === 'object' && module != null) {
21
- const prototypeOfObject = Object.getPrototypeOf(module);
22
- if (prototypeOfObject == null || prototypeOfObject === Object.prototype) {
23
- const normalizedVal = {};
24
- for (const key in module) {
25
- normalizedVal[key] = module[key];
26
- }
27
- return normalizedVal;
28
- }
29
- }
30
- return module;
31
33
  }
32
34
  export { defaultImportFn };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-mesh/utils",
3
- "version": "0.103.7",
3
+ "version": "0.103.8",
4
4
  "sideEffects": false,
5
5
  "peerDependencies": {
6
6
  "graphql": "*"
@@ -8,7 +8,7 @@
8
8
  "dependencies": {
9
9
  "@graphql-mesh/cross-helpers": "^0.4.9",
10
10
  "@graphql-mesh/string-interpolation": "^0.5.7",
11
- "@graphql-mesh/types": "^0.103.7",
11
+ "@graphql-mesh/types": "^0.103.8",
12
12
  "@graphql-tools/batch-delegate": "^9.0.16",
13
13
  "@graphql-tools/delegate": "^10.0.28",
14
14
  "@graphql-tools/utils": "^10.6.0",