@hubspot/cms-dev-server 1.2.79 → 1.2.82

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.
@@ -10,7 +10,7 @@ import { createServer as createViteServer } from "vite";
10
10
  import { createRequire } from "module";
11
11
  import { default as react } from "@vitejs/plugin-react";
12
12
 
13
- // ../cms-js-internal/dist/types-Dvw_fW6p.js
13
+ // ../cms-js-internal/dist/types-C8bPIEz4.js
14
14
  import path from "path";
15
15
  var viteRoot;
16
16
  var viteCommand;
@@ -562,18 +562,25 @@ import { join } from "path";
562
562
  function getPackageJson(packagePath2) {
563
563
  return JSON.parse(readFileSync(join(packagePath2, "package.json")).toString());
564
564
  }
565
- function getDepsForPackage(packagePath2) {
566
- const packageJson = getPackageJson(packagePath2);
567
- return packageJson.dependencies ? Object.keys(packageJson.dependencies) : [];
568
- }
569
- function getDepsForPackageIfExists(packagePath2) {
565
+ function getAllDepsForPackageIfExists(packagePath2) {
570
566
  try {
571
- return getDepsForPackage(packagePath2);
567
+ const packageJson = getPackageJson(packagePath2);
568
+ return [
569
+ .../* @__PURE__ */ new Set([
570
+ ...Object.keys(packageJson.dependencies ?? {}),
571
+ ...Object.keys(packageJson.peerDependencies ?? {})
572
+ ])
573
+ ];
572
574
  } catch (e) {
573
575
  console.warn("No package.json at ", packagePath2);
574
576
  return [];
575
577
  }
576
578
  }
579
+ function hasCmsComponentsDependency(packagePath2) {
580
+ return getAllDepsForPackageIfExists(packagePath2).includes(
581
+ "@hubspot/cms-components"
582
+ );
583
+ }
577
584
  async function createViteDevServer(webRoot, port, sslEnabled, domainsToProxy = [], jsRenderingGates, secretNames, logLevel) {
578
585
  const additionalMkcertHosts = domainsToProxy.map((proxyDomain) => [
579
586
  `${proxyDomain}.localhost`,
@@ -585,8 +592,7 @@ Custom origin: ${process.env.VITE_ORIGIN}
585
592
  `);
586
593
  }
587
594
  const origin = process.env.VITE_ORIGIN ?? (sslEnabled ? `https://hslocal.net:${port}` : `http://hslocal.net:${port}`);
588
- const consumerDeps = getDepsForPackageIfExists(webRoot);
589
- const isProjectWithReact = consumerDeps.includes("@hubspot/cms-components") || process.env.TRANSLATE_ASSET;
595
+ const isProjectWithReact = hasCmsComponentsDependency(webRoot) || process.env.TRANSLATE_ASSET;
590
596
  const componentsShimPlugin = isProjectWithReact ? null : cmsComponentsShimPlugin();
591
597
  const ssrAndOptimizeDep = isProjectWithReact ? {
592
598
  ssr: {