@hubspot/cms-dev-server 1.2.79 → 1.2.80

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.
@@ -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: {
package/dist/index.js CHANGED
@@ -1138,18 +1138,25 @@ import { join as join2 } from "path";
1138
1138
  function getPackageJson(packagePath2) {
1139
1139
  return JSON.parse(readFileSync2(join2(packagePath2, "package.json")).toString());
1140
1140
  }
1141
- function getDepsForPackage(packagePath2) {
1142
- const packageJson = getPackageJson(packagePath2);
1143
- return packageJson.dependencies ? Object.keys(packageJson.dependencies) : [];
1144
- }
1145
- function getDepsForPackageIfExists(packagePath2) {
1141
+ function getAllDepsForPackageIfExists(packagePath2) {
1146
1142
  try {
1147
- return getDepsForPackage(packagePath2);
1143
+ const packageJson = getPackageJson(packagePath2);
1144
+ return [
1145
+ .../* @__PURE__ */ new Set([
1146
+ ...Object.keys(packageJson.dependencies ?? {}),
1147
+ ...Object.keys(packageJson.peerDependencies ?? {})
1148
+ ])
1149
+ ];
1148
1150
  } catch (e) {
1149
1151
  console.warn("No package.json at ", packagePath2);
1150
1152
  return [];
1151
1153
  }
1152
1154
  }
1155
+ function hasCmsComponentsDependency(packagePath2) {
1156
+ return getAllDepsForPackageIfExists(packagePath2).includes(
1157
+ "@hubspot/cms-components"
1158
+ );
1159
+ }
1153
1160
  async function createViteDevServer(webRoot, port, sslEnabled, domainsToProxy = [], jsRenderingGates, secretNames, logLevel) {
1154
1161
  const additionalMkcertHosts = domainsToProxy.map((proxyDomain) => [
1155
1162
  `${proxyDomain}.localhost`,
@@ -1161,8 +1168,7 @@ Custom origin: ${process.env.VITE_ORIGIN}
1161
1168
  `);
1162
1169
  }
1163
1170
  const origin = process.env.VITE_ORIGIN ?? (sslEnabled ? `https://hslocal.net:${port}` : `http://hslocal.net:${port}`);
1164
- const consumerDeps = getDepsForPackageIfExists(webRoot);
1165
- const isProjectWithReact = consumerDeps.includes("@hubspot/cms-components") || process.env.TRANSLATE_ASSET;
1171
+ const isProjectWithReact = hasCmsComponentsDependency(webRoot) || process.env.TRANSLATE_ASSET;
1166
1172
  const componentsShimPlugin = isProjectWithReact ? null : cmsComponentsShimPlugin();
1167
1173
  const ssrAndOptimizeDep = isProjectWithReact ? {
1168
1174
  ssr: {
@@ -1657,7 +1663,7 @@ function trackUsage(action) {
1657
1663
  eventName: EVENT_NAME,
1658
1664
  action,
1659
1665
  nodeVersion: getNodeVersionData(),
1660
- version: "1.2.79",
1666
+ version: "1.2.80",
1661
1667
  os: getPlatform()
1662
1668
  };
1663
1669
  const url3 = isAuthedWithPersonalAccessKey ? DEV_SERVER_USAGE_ENDPOINT_AUTHENTICATED : DEV_SERVER_USAGE_ENDPOINT;
package/dist/run.js CHANGED
@@ -2262,7 +2262,7 @@ function trackUsage(action) {
2262
2262
  eventName: EVENT_NAME,
2263
2263
  action,
2264
2264
  nodeVersion: getNodeVersionData(),
2265
- version: "1.2.79",
2265
+ version: "1.2.80",
2266
2266
  os: getPlatform()
2267
2267
  };
2268
2268
  const url3 = isAuthedWithPersonalAccessKey ? DEV_SERVER_USAGE_ENDPOINT_AUTHENTICATED : DEV_SERVER_USAGE_ENDPOINT;
@@ -5376,18 +5376,25 @@ import { join as join4 } from "path";
5376
5376
  function getPackageJson(packagePath2) {
5377
5377
  return JSON.parse(readFileSync3(join4(packagePath2, "package.json")).toString());
5378
5378
  }
5379
- function getDepsForPackage(packagePath2) {
5380
- const packageJson = getPackageJson(packagePath2);
5381
- return packageJson.dependencies ? Object.keys(packageJson.dependencies) : [];
5382
- }
5383
- function getDepsForPackageIfExists(packagePath2) {
5379
+ function getAllDepsForPackageIfExists(packagePath2) {
5384
5380
  try {
5385
- return getDepsForPackage(packagePath2);
5381
+ const packageJson = getPackageJson(packagePath2);
5382
+ return [
5383
+ .../* @__PURE__ */ new Set([
5384
+ ...Object.keys(packageJson.dependencies ?? {}),
5385
+ ...Object.keys(packageJson.peerDependencies ?? {})
5386
+ ])
5387
+ ];
5386
5388
  } catch (e) {
5387
5389
  console.warn("No package.json at ", packagePath2);
5388
5390
  return [];
5389
5391
  }
5390
5392
  }
5393
+ function hasCmsComponentsDependency(packagePath2) {
5394
+ return getAllDepsForPackageIfExists(packagePath2).includes(
5395
+ "@hubspot/cms-components"
5396
+ );
5397
+ }
5391
5398
  async function createViteDevServer(webRoot2, port, sslEnabled, domainsToProxy = [], jsRenderingGates, secretNames, logLevel) {
5392
5399
  const additionalMkcertHosts = domainsToProxy.map((proxyDomain) => [
5393
5400
  `${proxyDomain}.localhost`,
@@ -5399,8 +5406,7 @@ Custom origin: ${process.env.VITE_ORIGIN}
5399
5406
  `);
5400
5407
  }
5401
5408
  const origin = process.env.VITE_ORIGIN ?? (sslEnabled ? `https://hslocal.net:${port}` : `http://hslocal.net:${port}`);
5402
- const consumerDeps = getDepsForPackageIfExists(webRoot2);
5403
- const isProjectWithReact = consumerDeps.includes("@hubspot/cms-components") || process.env.TRANSLATE_ASSET;
5409
+ const isProjectWithReact = hasCmsComponentsDependency(webRoot2) || process.env.TRANSLATE_ASSET;
5404
5410
  const componentsShimPlugin = isProjectWithReact ? null : cmsComponentsShimPlugin();
5405
5411
  const ssrAndOptimizeDep = isProjectWithReact ? {
5406
5412
  ssr: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hubspot/cms-dev-server",
3
- "version": "1.2.79",
3
+ "version": "1.2.80",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "engines": {
@@ -29,7 +29,7 @@
29
29
  "@babel/parser": "^7.25.3",
30
30
  "@babel/traverse": "^7.25.3",
31
31
  "@babel/types": "^7.25.2",
32
- "@hubspot/cms-components": "^1.2.79",
32
+ "@hubspot/cms-components": "^1.2.80",
33
33
  "@hubspot/local-dev-lib": "5.10.1",
34
34
  "@inquirer/select": "^2.0.0",
35
35
  "@originjs/vite-plugin-commonjs": "^1.0.3",
@@ -1,6 +1,6 @@
1
1
  import { Gate } from '@hubspot/cms-js-internal';
2
2
  export declare function getPackageJson(packagePath: string): any;
3
- export declare function getDepsForPackage(packagePath: string): string[];
4
- export declare function getDepsForPackageIfExists(packagePath: string): string[];
3
+ export declare function getAllDepsForPackageIfExists(packagePath: string): string[];
4
+ export declare function hasCmsComponentsDependency(packagePath: string): boolean;
5
5
  declare function createViteDevServer(webRoot: string, port: any, sslEnabled: boolean, domainsToProxy: any[], jsRenderingGates: Gate[], secretNames: string[], logLevel?: 'info' | 'warn' | 'error' | 'silent'): Promise<import("vite").ViteDevServer>;
6
6
  export default createViteDevServer;