@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.
- package/dist/generateJsonFromJsx.js +15 -9
- package/dist/index.js +2074 -1877
- package/dist/internalSsr.js +3 -5
- package/dist/island-runtime.js +22 -6
- package/dist/run.js +1001 -804
- package/dist/storybook/index.js +1 -1
- package/dist/storybook-main/main.js +7 -9
- package/dist/validateFieldsCli.js +1 -1
- package/package.json +2 -2
- package/types/createViteDevServer.d.ts +2 -2
- package/types/lib/renderModulePreview.d.ts +2 -3
- package/types/routes/moduleValidateFields.d.ts +3 -0
- package/types/validateFields.d.ts +16 -0
|
@@ -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-
|
|
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
|
|
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
|
-
|
|
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
|
|
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: {
|