@embeddable.com/sdk-react 3.10.13-next.2 → 3.10.13

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.
@@ -0,0 +1,14 @@
1
+ const { fileURLToPath, pathToFileURL } = require("url");
2
+
3
+ async function loadModule(modulePath) {
4
+ try {
5
+ const module = await import(pathToFileURL(modulePath).href);
6
+ process.stdout.write(JSON.stringify(module.meta));
7
+ } catch (error) {
8
+ console.error(`Failed to load module: ${error.message}`);
9
+ process.exit(1);
10
+ }
11
+ }
12
+
13
+ const modulePath = fileURLToPath(process.argv[2]);
14
+ loadModule(modulePath);
package/lib/index.esm.js CHANGED
@@ -875,10 +875,16 @@ const styledComponentsEntrypointModifier = {
875
875
  return "import {StyleSheetManager} from 'styled-components'";
876
876
  },
877
877
  async needToModify(ctx) {
878
- var _a;
878
+ var _a, _b;
879
879
  const packageJsonFilePath = path.resolve(ctx.client.rootDir, "package.json");
880
- const packageJson = await import(packageJsonFilePath);
881
- return !!((_a = packageJson.dependencies) === null || _a === undefined ? undefined : _a["styled-components"]);
880
+ try {
881
+ const packageJson = JSON.parse(await fs.readFile(packageJsonFilePath, "utf-8"));
882
+ return !!(((_a = packageJson.dependencies) === null || _a === void 0 ? void 0 : _a["styled-components"]) || ((_b = packageJson.devDependencies) === null || _b === void 0 ? void 0 : _b["styled-components"]));
883
+ }
884
+ catch (error) {
885
+ console.error("styledComponentsEntrypointModifier: Error reading package.json", error);
886
+ return false;
887
+ }
882
888
  },
883
889
  };
884
890