@embeddable.com/sdk-core 3.13.1 → 3.13.2

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/lib/index.esm.js CHANGED
@@ -640,17 +640,18 @@ const checkBuildSuccess = async () => {
640
640
  return false;
641
641
  }
642
642
  };
643
- const getPackageVersion = (packageName) => {
643
+ const getPackageVersion = async (packageName) => {
644
644
  const packageJsonPath = path__default.join(process.cwd(), "node_modules", packageName, "package.json");
645
+ let packageJson;
645
646
  try {
646
- const packageJson = require(packageJsonPath);
647
+ packageJson = JSON.parse(await fs.readFile(packageJsonPath, "utf-8"));
647
648
  return packageJson.version;
648
649
  }
649
650
  catch (e) {
650
651
  return undefined;
651
652
  }
652
653
  };
653
- const getSDKVersions = () => {
654
+ const getSDKVersions = async () => {
654
655
  const packageNames = [
655
656
  "@embeddable.com/core",
656
657
  "@embeddable.com/react",
@@ -658,13 +659,14 @@ const getSDKVersions = () => {
658
659
  "@embeddable.com/sdk-react",
659
660
  "@embeddable.com/sdk-utils",
660
661
  ];
661
- const sdkVersions = packageNames.reduce((acc, packageName) => {
662
- const version = getPackageVersion(packageName);
662
+ const sdkVersions = await packageNames.reduce(async (accPromise, packageName) => {
663
+ const acc = await accPromise; // Wait for the previous accumulator to resolve
664
+ const version = await getPackageVersion(packageName);
663
665
  if (version) {
664
666
  acc[packageName] = version;
665
667
  }
666
668
  return acc;
667
- }, {});
669
+ }, Promise.resolve({}));
668
670
  return sdkVersions;
669
671
  };
670
672
  const hrtimeToISO8601 = (hrtime) => {
@@ -688,7 +690,7 @@ var cleanup = async (ctx) => {
688
690
  };
689
691
  async function createManifest({ ctx, typesFileName, metaFileName, editorsMetaFileName, stencilWrapperFileName, }) {
690
692
  var _a, _b, _c, _d, _e;
691
- const sdkVersions = getSDKVersions();
693
+ const sdkVersions = await getSDKVersions();
692
694
  // identify user's package manager and its version
693
695
  let packageManager = "npm";
694
696
  if ((_a = process.env.npm_config_user_agent) === null || _a === undefined ? undefined : _a.includes("yarn")) {