@modern-js/utils 2.67.7 → 2.67.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.
@@ -21,7 +21,8 @@ __export(package_exports, {
21
21
  canUseNpm: () => canUseNpm,
22
22
  canUsePnpm: () => canUsePnpm,
23
23
  canUseYarn: () => canUseYarn,
24
- getPnpmVersion: () => getPnpmVersion
24
+ getPnpmVersion: () => getPnpmVersion,
25
+ removeModuleSyncFromExports: () => removeModuleSyncFromExports
25
26
  });
26
27
  module.exports = __toCommonJS(package_exports);
27
28
  var import_compiled = require("../compiled");
@@ -67,10 +68,27 @@ async function canUsePnpm() {
67
68
  return false;
68
69
  }
69
70
  }
71
+ function removeModuleSyncFromExports(exports) {
72
+ if (typeof exports !== "object" || exports === null) {
73
+ return exports;
74
+ }
75
+ if (Array.isArray(exports)) {
76
+ return exports.map(removeModuleSyncFromExports);
77
+ }
78
+ const result = {};
79
+ for (const [key, value] of Object.entries(exports)) {
80
+ if (key === "module-sync") {
81
+ continue;
82
+ }
83
+ result[key] = removeModuleSyncFromExports(value);
84
+ }
85
+ return result;
86
+ }
70
87
  // Annotate the CommonJS export names for ESM import in node:
71
88
  0 && (module.exports = {
72
89
  canUseNpm,
73
90
  canUsePnpm,
74
91
  canUseYarn,
75
- getPnpmVersion
92
+ getPnpmVersion,
93
+ removeModuleSyncFromExports
76
94
  });
@@ -1,4 +1,6 @@
1
1
  import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
2
+ import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
3
+ import { _ as _type_of } from "@swc/helpers/_/_type_of";
2
4
  import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
3
5
  import { execa } from "../compiled";
4
6
  function getPnpmVersion() {
@@ -159,9 +161,43 @@ function _canUsePnpm() {
159
161
  });
160
162
  return _canUsePnpm.apply(this, arguments);
161
163
  }
164
+ function removeModuleSyncFromExports(exports) {
165
+ if ((typeof exports === "undefined" ? "undefined" : _type_of(exports)) !== "object" || exports === null) {
166
+ return exports;
167
+ }
168
+ if (Array.isArray(exports)) {
169
+ return exports.map(removeModuleSyncFromExports);
170
+ }
171
+ var result = {};
172
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
173
+ try {
174
+ for (var _iterator = Object.entries(exports)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
175
+ var _step_value = _sliced_to_array(_step.value, 2), key = _step_value[0], value = _step_value[1];
176
+ if (key === "module-sync") {
177
+ continue;
178
+ }
179
+ result[key] = removeModuleSyncFromExports(value);
180
+ }
181
+ } catch (err) {
182
+ _didIteratorError = true;
183
+ _iteratorError = err;
184
+ } finally {
185
+ try {
186
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
187
+ _iterator.return();
188
+ }
189
+ } finally {
190
+ if (_didIteratorError) {
191
+ throw _iteratorError;
192
+ }
193
+ }
194
+ }
195
+ return result;
196
+ }
162
197
  export {
163
198
  canUseNpm,
164
199
  canUsePnpm,
165
200
  canUseYarn,
166
- getPnpmVersion
201
+ getPnpmVersion,
202
+ removeModuleSyncFromExports
167
203
  };
@@ -41,9 +41,26 @@ async function canUsePnpm() {
41
41
  return false;
42
42
  }
43
43
  }
44
+ function removeModuleSyncFromExports(exports) {
45
+ if (typeof exports !== "object" || exports === null) {
46
+ return exports;
47
+ }
48
+ if (Array.isArray(exports)) {
49
+ return exports.map(removeModuleSyncFromExports);
50
+ }
51
+ const result = {};
52
+ for (const [key, value] of Object.entries(exports)) {
53
+ if (key === "module-sync") {
54
+ continue;
55
+ }
56
+ result[key] = removeModuleSyncFromExports(value);
57
+ }
58
+ return result;
59
+ }
44
60
  export {
45
61
  canUseNpm,
46
62
  canUsePnpm,
47
63
  canUseYarn,
48
- getPnpmVersion
64
+ getPnpmVersion,
65
+ removeModuleSyncFromExports
49
66
  };
@@ -2,3 +2,4 @@ export declare function getPnpmVersion(): Promise<string>;
2
2
  export declare function canUseNpm(): Promise<boolean>;
3
3
  export declare function canUseYarn(): Promise<boolean>;
4
4
  export declare function canUsePnpm(): Promise<boolean>;
5
+ export declare function removeModuleSyncFromExports(exports: Record<string, any>): Record<string, any>;
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.67.7",
18
+ "version": "2.67.8",
19
19
  "jsnext:source": "./src/index.ts",
20
20
  "types": "./dist/types/index.d.ts",
21
21
  "main": "./dist/cjs/index.js",
@@ -190,9 +190,9 @@
190
190
  "jest": "^29",
191
191
  "typescript": "^5",
192
192
  "webpack": "^5.99.8",
193
- "@modern-js/types": "2.67.7",
194
- "@scripts/build": "2.66.0",
195
- "@scripts/jest-config": "2.66.0"
193
+ "@modern-js/types": "2.67.8",
194
+ "@scripts/jest-config": "2.66.0",
195
+ "@scripts/build": "2.66.0"
196
196
  },
197
197
  "sideEffects": false,
198
198
  "scripts": {