@hubspot/cms-dev-server 0.18.2 → 0.18.5

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.
@@ -8,7 +8,7 @@ var __export = (target, all) => {
8
8
  __defProp(target, name, { get: all[name], enumerable: true });
9
9
  };
10
10
 
11
- // ../cms-js-internal/dist/basicUtils.js
11
+ // ../cms-js-internal/dist/types-BXr0V0Zd.js
12
12
  import path from "path";
13
13
  import { createHash } from "crypto";
14
14
  import fs, { readFileSync, existsSync, readdirSync, lstatSync } from "fs";
@@ -294,8 +294,8 @@ function isStylesheetAsset(staticAsset) {
294
294
  return staticAsset.type === "stylesheet";
295
295
  }
296
296
  var COMPONENT_EXTENSIONS, ENTRY_POINTS_PATH, MODULE_FOLDER_PATH, VIRTUAL_ISLAND_RUNTIME, VIRTUAL_CONFIG_SETUP, CSS_LANGS_RE, collectCssModules, collectCssInDev, badInlineJsChars, inlineJsEscapeChars, viteRoot, viteCommand, clientRenderIsland, virtualClientRenderIslandModuleId, scriptTagToLogServerMessages, getComponentExtension, hasComponentExtension, isStorybookStory, removeComponentExtension, COMBINED_REACT_BASE_PATH, ISLAND_RUNTIME_CONFIG_BASE_PATH, removeIndexFromPath, removeIndexOrTrailingJsFromPath, HEALTHCHECKS_ENABLED_DEFAULT, HEALTHCHECKS_STRICT_DEFAULT, BUILD_INFO_PATH, GATES, ENABLED_FEATURES_GATE_MAP, findAllComponentsIn;
297
- var init_basicUtils = __esm({
298
- "../cms-js-internal/dist/basicUtils.js"() {
297
+ var init_types_BXr0V0Zd = __esm({
298
+ "../cms-js-internal/dist/types-BXr0V0Zd.js"() {
299
299
  COMPONENT_EXTENSIONS = [".jsx", ".tsx", ".js", ".ts"];
300
300
  ENTRY_POINTS_PATH = "components/partials/";
301
301
  MODULE_FOLDER_PATH = "components/modules/";
@@ -614,7 +614,7 @@ function noncePlaceholderPlugin() {
614
614
  }
615
615
  };
616
616
  }
617
- function findCmsModules(cmsModules = {}) {
617
+ function findCmsModules(buildContentDescriptors = {}) {
618
618
  let config;
619
619
  return {
620
620
  enforce: "pre",
@@ -626,20 +626,20 @@ function findCmsModules(cmsModules = {}) {
626
626
  const moduleInfo = this.getModuleInfo(id);
627
627
  if (shouldSkipModule(config, moduleInfo, code))
628
628
  return null;
629
- const { localCmsModules, moduleUsed } = analyzeSourceCodeUsages(
629
+ const contentDescriptors = analyzeSourceCodeUsages(
630
630
  this,
631
631
  moduleInfo,
632
632
  config,
633
633
  code
634
634
  );
635
- if (!moduleUsed) {
636
- return null;
635
+ if (Object.keys(contentDescriptors.dndAreas).length > 0 || Object.keys(contentDescriptors.modules).length > 0) {
636
+ return {
637
+ meta: {
638
+ findCmsModules: contentDescriptors
639
+ }
640
+ };
637
641
  }
638
- return {
639
- meta: {
640
- findCmsModules: localCmsModules
641
- }
642
- };
642
+ return null;
643
643
  },
644
644
  buildEnd(error) {
645
645
  if (error)
@@ -678,7 +678,7 @@ function findCmsModules(cmsModules = {}) {
678
678
  ${JSON.stringify(modulesWithinModules, null, 2)}
679
679
  `);
680
680
  }
681
- Object.assign(cmsModules, relativeEntryPointCmsModuleMap);
681
+ Object.assign(buildContentDescriptors, relativeEntryPointCmsModuleMap);
682
682
  }
683
683
  };
684
684
  }
@@ -692,14 +692,16 @@ function convertEntryPointPathsToRelative(config, entryPointsCmsModuleMap) {
692
692
  }
693
693
  function convertEntryPointIslandPathsToRelative(config, entryPointsCmsModuleMap) {
694
694
  const relativeEntries = Object.entries(entryPointsCmsModuleMap).map(
695
- ([entryPointPath, islandCmsModules]) => {
695
+ ([entryPointPath, islandContentDescriptors]) => {
696
696
  const islandCmsModuleUsage = Object.fromEntries(
697
- Object.entries(islandCmsModules).map(([islandPath, cmsModule]) => {
698
- return [
699
- toRelativePath(config, islandPath).replace("?client-entry", ""),
700
- cmsModule
701
- ];
702
- })
697
+ Object.entries(islandContentDescriptors).map(
698
+ ([islandPath, contentDescriptors]) => {
699
+ return [
700
+ toRelativePath(config, islandPath).replace("?client-entry", ""),
701
+ contentDescriptors
702
+ ];
703
+ }
704
+ )
703
705
  );
704
706
  return [toRelativePath(config, entryPointPath), islandCmsModuleUsage];
705
707
  }
@@ -711,7 +713,7 @@ function toRelativePath(config, path3) {
711
713
  }
712
714
  function shouldSkipModule(config, moduleInfo, code) {
713
715
  const isExternal = config.command !== "serve" && moduleInfo.isExternal;
714
- return isExternal || !moduleInfo.id.startsWith(config.root) || !code.includes(CMS_MODULE_COMPONENT_NAME);
716
+ return isExternal || !moduleInfo.id.startsWith(config.root) || !(code.includes(CMS_MODULE_COMPONENT_NAME) || code.includes(DND_AREA_COMPONENT_NAME));
715
717
  }
716
718
  function getEntryPoints(ctx, config) {
717
719
  return Array.from(ctx.getModuleIds()).filter((moduleId) => moduleId.startsWith(config.root)).map((moduleId) => ctx.getModuleInfo(moduleId)).filter((moduleInfo) => moduleInfo.isEntry);
@@ -741,9 +743,9 @@ function analyzeSourceCodeUsages(ctx, moduleInfo, config, code) {
741
743
  sourceType: "module",
742
744
  plugins: ["jsx", "typescript"]
743
745
  });
744
- const localCmsModules = {};
745
- let moduleUsed = false;
746
+ const contentDescriptors = { modules: {}, dndAreas: {} };
746
747
  let moduleComponentLocalImportName = CMS_MODULE_COMPONENT_NAME;
748
+ let dndAreaComponentLocalImportName = DND_AREA_COMPONENT_NAME;
747
749
  traverse(sourceAst, {
748
750
  ImportDeclaration(path3) {
749
751
  if (t.isStringLiteral(path3.node.source, {
@@ -755,69 +757,96 @@ function analyzeSourceCodeUsages(ctx, moduleInfo, config, code) {
755
757
  })) {
756
758
  moduleComponentLocalImportName = specifier.local.name;
757
759
  }
760
+ if (t.isImportSpecifier(specifier) && t.isIdentifier(specifier.imported, {
761
+ name: DND_AREA_COMPONENT_NAME
762
+ })) {
763
+ dndAreaComponentLocalImportName = specifier.local.name;
764
+ }
758
765
  }
759
766
  }
760
767
  },
761
768
  JSXOpeningElement(path3) {
762
- if (!t.isJSXIdentifier(path3.node.name, {
769
+ if (t.isJSXIdentifier(path3.node.name, {
763
770
  name: moduleComponentLocalImportName
764
771
  })) {
765
- return null;
766
- }
767
- moduleUsed = true;
768
- let cmsModuleName;
769
- let cmsModulePath;
770
- let cmsModuleLabel;
771
- for (const prop of path3.node.attributes) {
772
- if (t.isJSXAttribute(prop) && t.isJSXIdentifier(prop.name, { name: "name" }) && t.isStringLiteral(prop.value)) {
773
- cmsModuleName = prop.value.value;
774
- continue;
772
+ let cmsModuleName;
773
+ let cmsModulePath;
774
+ let cmsModuleLabel;
775
+ for (const prop of path3.node.attributes) {
776
+ if (t.isJSXAttribute(prop) && t.isJSXIdentifier(prop.name, { name: "name" }) && t.isStringLiteral(prop.value)) {
777
+ cmsModuleName = prop.value.value;
778
+ continue;
779
+ }
780
+ if (t.isJSXAttribute(prop) && t.isJSXIdentifier(prop.name, { name: "path" }) && t.isStringLiteral(prop.value)) {
781
+ cmsModulePath = prop.value.value;
782
+ continue;
783
+ }
784
+ if (t.isJSXAttribute(prop) && t.isJSXIdentifier(prop.name, { name: "label" }) && t.isStringLiteral(prop.value)) {
785
+ cmsModuleLabel = prop.value.value;
786
+ continue;
787
+ }
788
+ ctx.error(
789
+ new Error(
790
+ `Error: ${moduleInfo.id.replace(config.root, "")}:${prop.loc.start.line} "name" and "path" must be primitive strings`
791
+ )
792
+ );
775
793
  }
776
- if (t.isJSXAttribute(prop) && t.isJSXIdentifier(prop.name, { name: "path" }) && t.isStringLiteral(prop.value)) {
777
- cmsModulePath = prop.value.value;
778
- continue;
794
+ const cmsModuleProps = {
795
+ name: cmsModuleName,
796
+ path: cmsModulePath
797
+ };
798
+ if (cmsModuleLabel) {
799
+ cmsModuleProps.label = cmsModuleLabel;
779
800
  }
780
- if (t.isJSXAttribute(prop) && t.isJSXIdentifier(prop.name, { name: "label" }) && t.isStringLiteral(prop.value)) {
781
- cmsModuleLabel = prop.value.value;
782
- continue;
801
+ if (Object.hasOwn(contentDescriptors.modules, cmsModuleProps.name)) {
802
+ ctx.error(
803
+ new Error(
804
+ `Error: multiple <${CMS_MODULE_COMPONENT_NAME} /> with duplicate name: ${cmsModuleProps.name}`
805
+ )
806
+ );
783
807
  }
784
- ctx.error(
785
- new Error(
786
- `Error: ${moduleInfo.id.replace(config.root, "")}:${prop.loc.start.line} "name" and "path" must be primitive strings`
787
- )
788
- );
808
+ contentDescriptors.modules[cmsModuleProps.name] = cmsModuleProps;
789
809
  }
790
- const cmsModuleProps = {
791
- name: cmsModuleName,
792
- path: cmsModulePath
793
- };
794
- if (cmsModuleLabel) {
795
- cmsModuleProps.label = cmsModuleLabel;
796
- }
797
- if (Object.hasOwn(localCmsModules, cmsModuleProps.name)) {
798
- ctx.error(
799
- new Error(
800
- `Error: multiple <${CMS_MODULE_COMPONENT_NAME} /> with duplicate name: ${cmsModuleProps.name}`
801
- )
802
- );
810
+ if (t.isJSXIdentifier(path3.node.name, {
811
+ name: dndAreaComponentLocalImportName
812
+ })) {
813
+ let dndAreaName;
814
+ for (const prop of path3.node.attributes) {
815
+ if (t.isJSXAttribute(prop) && t.isJSXIdentifier(prop.name, { name: "name" }) && t.isStringLiteral(prop.value)) {
816
+ dndAreaName = prop.value.value;
817
+ continue;
818
+ }
819
+ ctx.error(
820
+ new Error(
821
+ `Error: ${moduleInfo.id.replace(config.root, "")}:${prop.loc.start.line} "name" must a primitive string`
822
+ )
823
+ );
824
+ }
825
+ const dndArea = {
826
+ name: dndAreaName
827
+ };
828
+ if (Object.hasOwn(contentDescriptors.dndAreas, dndArea.name)) {
829
+ ctx.error(
830
+ new Error(
831
+ `Error: multiple <${DND_AREA_COMPONENT_NAME} /> with duplicate name: ${dndArea.name}`
832
+ )
833
+ );
834
+ }
835
+ contentDescriptors.dndAreas[dndArea.name] = dndArea;
803
836
  }
804
- localCmsModules[cmsModuleProps.name] = cmsModuleProps;
805
837
  }
806
838
  });
807
- return {
808
- moduleUsed,
809
- localCmsModules
810
- };
839
+ return contentDescriptors;
811
840
  }
812
841
  function findCmsModuleUsages(ctx, moduleId, processed = /* @__PURE__ */ new Set(), result = {}) {
813
842
  if (Object.hasOwn(result, moduleId)) {
814
843
  return result[moduleId];
815
844
  }
816
845
  const moduleInfo = ctx.getModuleInfo(moduleId);
817
- let entryPointModules = null;
846
+ let entryPointContentDescriptors = null;
818
847
  if (Object.hasOwn(moduleInfo.meta, PLUGIN_NAME)) {
819
- entryPointModules = {
820
- ...entryPointModules,
848
+ entryPointContentDescriptors = {
849
+ ...entryPointContentDescriptors,
821
850
  ...moduleInfo.meta[PLUGIN_NAME]
822
851
  };
823
852
  }
@@ -835,17 +864,17 @@ function findCmsModuleUsages(ctx, moduleId, processed = /* @__PURE__ */ new Set(
835
864
  result
836
865
  );
837
866
  if (importedResult) {
838
- entryPointModules = {
839
- ...entryPointModules,
867
+ entryPointContentDescriptors = {
868
+ ...entryPointContentDescriptors,
840
869
  ...importedResult
841
870
  };
842
871
  }
843
872
  }
844
- if (entryPointModules) {
845
- result[moduleId] = entryPointModules;
873
+ if (entryPointContentDescriptors) {
874
+ result[moduleId] = entryPointContentDescriptors;
846
875
  }
847
876
  processed.add(moduleId);
848
- return entryPointModules;
877
+ return entryPointContentDescriptors;
849
878
  }
850
879
  function findIslandCmsModuleUsage(ctx, moduleId, processedIslands = /* @__PURE__ */ new Set(), islandModuleResults = {}, processed = /* @__PURE__ */ new Set(), results = {}) {
851
880
  processedIslands.add(moduleId);
@@ -1011,16 +1040,16 @@ function renderFieldsToJson(fields, moduleName) {
1011
1040
  );
1012
1041
  }
1013
1042
  return fieldsJSON;
1014
- } catch (e) {
1015
- e.message = `Error when rendering fields for ${moduleName}: ${e.message}`;
1016
- throw e;
1043
+ } catch (e2) {
1044
+ e2.message = `Error when rendering fields for ${moduleName}: ${e2.message}`;
1045
+ throw e2;
1017
1046
  }
1018
1047
  }
1019
- var setProperty, getProperty, hasProperty, serializeIslandDataForInlineScript, writeSharedStateToJsGlobal, createIslandsGlobalJsForClientInDev, traverse, CMS_MODULE_COMPONENT_NAME, PLUGIN_NAME, promiseForNewWritableStream, renderStreamToPromise, createServerRenderContextV22, createServerRenderContext2, renderServerSidePropsWithAsyncLocalStoreContext, bootStrapRenderContext;
1048
+ var setProperty, getProperty, hasProperty, serializeIslandDataForInlineScript, writeSharedStateToJsGlobal, createIslandsGlobalJsForClientInDev, traverse, CMS_MODULE_COMPONENT_NAME, DND_AREA_COMPONENT_NAME, PLUGIN_NAME, promiseForNewWritableStream, renderStreamToPromise, createServerRenderContextV22, createServerRenderContext2, renderServerSidePropsWithAsyncLocalStoreContext, bootStrapRenderContext;
1020
1049
  var init_dist = __esm({
1021
1050
  "../cms-js-internal/dist/index.js"() {
1022
- init_basicUtils();
1023
- init_basicUtils();
1051
+ init_types_BXr0V0Zd();
1052
+ init_types_BXr0V0Zd();
1024
1053
  ({ setProperty, getProperty, hasProperty } = dotProp);
1025
1054
  serializeIslandDataForInlineScript = (tweakedIslandsArray, perServerRequestData, baseIndent = 0, prettyPrint, isUngatedForClientOnlySupplementalFieldSerialization = false) => {
1026
1055
  const islandsArrayToSerialize = tweakedIslandsArray.map(
@@ -1077,7 +1106,7 @@ var init_dist = __esm({
1077
1106
  });
1078
1107
  };
1079
1108
  writeSharedStateToJsGlobal = (islands, perServerRequestData, indent = 0, prettyPrint) => {
1080
- const sharedStateIDs = islands.map((island) => island.sharedStateID).filter((x) => !!x);
1109
+ const sharedStateIDs = islands.map((island) => island.sharedStateID).filter((x2) => !!x2);
1081
1110
  if (sharedStateIDs.length > 0) {
1082
1111
  const indentString = " ".repeat(indent);
1083
1112
  const stateByID = {};
@@ -1123,6 +1152,7 @@ ${indentString}`);
1123
1152
  };
1124
1153
  traverse = _traverse.default;
1125
1154
  CMS_MODULE_COMPONENT_NAME = "Module";
1155
+ DND_AREA_COMPONENT_NAME = "DndArea";
1126
1156
  PLUGIN_NAME = "findCmsModules";
1127
1157
  promiseForNewWritableStream = () => {
1128
1158
  const chunks = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hubspot/cms-dev-server",
3
- "version": "0.18.2",
3
+ "version": "0.18.5",
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": "^0.18.2",
32
+ "@hubspot/cms-components": "^0.18.5",
33
33
  "@hubspot/local-dev-lib": "2.0.1",
34
34
  "@inquirer/select": "^2.0.0",
35
35
  "@originjs/vite-plugin-commonjs": "^1.0.3",
@@ -128,5 +128,5 @@
128
128
  "publishConfig": {
129
129
  "access": "public"
130
130
  },
131
- "gitHead": "5e1aea655d354618b3aeda777bff53593d07fe39"
131
+ "gitHead": "9aae912023959e90bcb2abf1f02999b6d07778ec"
132
132
  }
@@ -1,2 +1,2 @@
1
- declare function createAppServer(webRoot: string, port: any): Promise<import("vite").ViteDevServer>;
1
+ declare function createAppServer(webRoot: string, port: any): Promise<import("express-serve-static-core").Express>;
2
2
  export default createAppServer;
@@ -0,0 +1,4 @@
1
+ export declare function transformJsxToJson(fieldsJsPath: string): Promise<{
2
+ fields: import("@hubspot/cms-components/fields").Field[];
3
+ meta: any;
4
+ }>;
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/generateJsonFromJsx.ts", "../src/createViteDevServer.ts", "../../cms-js-internal/dist/basicUtils.js", "../../cms-js-internal/dist/index.js", "../src/plugins/devSecretsPlugin.ts", "../src/lib/packagePath.ts"],
4
- "sourcesContent": ["#!/usr/bin/env node\nimport path from 'path';\nimport fs from 'fs/promises';\nimport { normalizePath } from 'vite';\nimport createViteDevServer from './createViteDevServer.js';\nimport packagePath from './lib/packagePath.js';\n\n/**\n * This script transforms JSX to JSON for both react module fields and meta exports.\n * The flow of this script is to take in a react module directory path, find the index file\n * that contains the fields and meta exports, then transform both exports to JSON and\n * finish by writing the new JSON to temporary files for both fields and meta. This enables\n * the translate-asset repo to use the tmp-fields.json and tmp-meta.json file to generate\n * lang keys as they would normally do with HubL modules.\n */\n\nconst internalSsrPath = packagePath(import.meta.url, 'internalSsr');\n\nexport async function writeFile(filePath: string, data: any) {\n try {\n await fs.writeFile(filePath, JSON.stringify(data, null, 2));\n console.log('File has been written successfully to: ', filePath);\n } catch (error) {\n console.error('Error writing to file', { filePath, error });\n }\n}\n\nexport async function createJsonFiles(webRoot: string, data: any) {\n const fieldsFilePath = path.join(webRoot, 'tmp-fields.json');\n const metaFilePath = path.join(webRoot, 'tmp-meta.json');\n const { fields, meta } = data;\n\n if (!fields || !meta) {\n throw new Error('Fields or meta exports are missing');\n }\n\n await writeFile(fieldsFilePath, fields);\n await writeFile(metaFilePath, meta);\n}\n\nexport async function transformJsxToJson() {\n const webRoot = process.argv[2];\n if (!webRoot) {\n throw new Error('Path to module directory not provided');\n }\n\n const moduleFiles = await fs.readdir(webRoot);\n const indexFile = moduleFiles.find((file) => file.includes('index'));\n\n if (!indexFile) {\n throw new Error(\n 'Index file that contains \"fields\" and \"meta\" exports not found'\n );\n }\n\n const modulePath = path.join(webRoot, indexFile);\n const absoluteWebRoot = normalizePath(path.resolve(process.cwd(), webRoot));\n\n const viteServer = await createViteDevServer(\n absoluteWebRoot,\n 3000,\n false,\n [],\n [],\n []\n );\n\n try {\n const { fields, meta } = await viteServer.ssrLoadModule(modulePath);\n const { renderFieldsToJson } =\n await viteServer.ssrLoadModule(internalSsrPath);\n const fieldsJson = renderFieldsToJson(fields, meta.label);\n\n await createJsonFiles(webRoot, { fields: fieldsJson, meta });\n } catch (error) {\n throw new Error('Failed to generate JSON from JSX: ', error);\n }\n}\n\n(async () => {\n try {\n await transformJsxToJson();\n process.exit(0);\n } catch (error) {\n console.error('An error occurred:', error);\n process.exit(1);\n }\n})().catch((error) => {\n // rethrow error to resolve no eslint floating promises warning\n throw error;\n});\n", "/* hs-eslint ignored failing-rules */\n/* eslint-disable require-await */\n\nimport { createServer as createViteServer, InlineConfig } from 'vite';\nimport { default as react } from '@vitejs/plugin-react';\nimport {\n Gate,\n clientIslandEntryPlugin,\n resolveIslandPlugin,\n noncePlaceholderPlugin,\n findCmsModules,\n} from '@hubspot/cms-js-internal';\nimport { default as mkcert } from 'vite-plugin-mkcert';\nimport { viteCommonjs } from '@originjs/vite-plugin-commonjs';\nimport devSecretsPlugin from './plugins/devSecretsPlugin.js';\n\nasync function createViteDevServer(\n webRoot: string,\n port,\n sslEnabled: boolean,\n domainsToProxy = [],\n jsRenderingGates: Gate[],\n secretNames: string[]\n) {\n const additionalMkcertHosts = domainsToProxy\n .map((proxyDomain) => [\n `${proxyDomain}.localhost`,\n `${proxyDomain}.hslocal.net`,\n ])\n .flat();\n\n if (process.env.VITE_ORIGIN) {\n console.log(`\\nCustom origin: ${process.env.VITE_ORIGIN}\\n`);\n }\n\n const origin =\n process.env.VITE_ORIGIN ??\n (sslEnabled ? `https://hslocal.net:${port}` : `http://hslocal.net:${port}`);\n\n const viteConfig: InlineConfig = {\n appType: 'custom',\n server: {\n middlewareMode: true,\n host: 'hslocal.net',\n origin,\n https: sslEnabled,\n hmr: {\n protocol: sslEnabled ? 'wss' : undefined,\n },\n },\n root: webRoot,\n ssr: {\n // TODO: might need more entries here to get things to resolve through\n // resolveWebRootDepsPlugin\n noExternal: '@hubspot/cms-components',\n },\n resolve: {\n conditions: ['server'],\n dedupe: ['react', 'react-dom', '@hubspot/cms-components', 'styled-jsx'],\n },\n optimizeDeps: {\n include: ['react', 'react-dom', 'react-dom/client'],\n },\n plugins: [\n true ? findCmsModules() : null,\n sslEnabled ? mkcert({ hosts: additionalMkcertHosts }) : null,\n react({\n babel: {\n plugins: [\n 'babel-plugin-styled-components',\n 'styled-jsx/babel',\n 'macros',\n ],\n },\n }),\n clientIslandEntryPlugin(),\n resolveIslandPlugin(),\n jsRenderingGates.includes('CMS:JSRenderer:RemoveCjsPlugin')\n ? null\n : viteCommonjs(),\n devSecretsPlugin(secretNames),\n noncePlaceholderPlugin(),\n ],\n css: {\n postcss: webRoot,\n },\n envDir: webRoot,\n envPrefix: 'HS_',\n };\n\n return createViteServer(viteConfig);\n}\n\nexport default createViteDevServer;\n", "import path from \"path\";\nimport { createHash } from \"crypto\";\nimport fs, { readFileSync, existsSync, readdirSync, lstatSync } from \"fs\";\nimport { join } from \"path/posix\";\nconst COMPONENT_EXTENSIONS = [\".jsx\", \".tsx\", \".js\", \".ts\"];\nconst ENTRY_POINTS_PATH = \"components/partials/\";\nconst MODULE_FOLDER_PATH = \"components/modules/\";\nconst VIRTUAL_ISLAND_RUNTIME = \"virtual:island-runtime\";\nconst VIRTUAL_CONFIG_SETUP = \"virtual:config-setup\";\nconst CSS_LANGS_RE = /\\.(css|less|sass|scss|styl|stylus|pcss|postcss|sss)(?:$|\\?)/;\nconst collectCssModules = (modulePathToStartWith, viteServer, cssModulesImported = /* @__PURE__ */ new Set()) => {\n const appModulesForPath = viteServer.moduleGraph.fileToModulesMap.get(\n modulePathToStartWith\n );\n if (!appModulesForPath || appModulesForPath.size === 0) {\n throw new Error(`No modules at: ${modulePathToStartWith}`);\n } else if (appModulesForPath.size > 1) {\n throw new Error(`More than one module at: ${modulePathToStartWith}`);\n }\n const appModule = Array.from(appModulesForPath.values())[0];\n const allServerSideModulesImported = /* @__PURE__ */ new Set();\n const newCssModules = [];\n const moduleQueue = Array.from(appModule.importedModules);\n for (const importedModule of moduleQueue) {\n if (allServerSideModulesImported.has(importedModule.id)) {\n continue;\n }\n allServerSideModulesImported.add(importedModule.id);\n const isCss = CSS_LANGS_RE.test(importedModule.file);\n const moduleModulesToQueue = Array.from(importedModule.importedModules);\n if (isCss && !cssModulesImported.has(importedModule)) {\n cssModulesImported.add(importedModule);\n newCssModules.push(importedModule);\n }\n moduleQueue.push(...moduleModulesToQueue);\n }\n return newCssModules;\n};\nfunction createPreloadLink(assetPath, basePath = \"\") {\n if (assetPath && assetPath[0] !== \"/\") {\n assetPath = `/${assetPath}`;\n }\n if (assetPath.endsWith(\".js\")) {\n return `<link rel=\"modulepreload\" crossorigin href=\"${basePath}${assetPath}\">`;\n } else if (CSS_LANGS_RE.test(assetPath)) {\n return `<link rel=\"stylesheet\" href=\"${basePath}${assetPath}?css\">`;\n } else if (assetPath.endsWith(\".woff\")) {\n return ` <link rel=\"preload\" href=\"${basePath}${assetPath}\" as=\"font\" type=\"font/woff\" crossorigin>`;\n } else if (assetPath.endsWith(\".woff2\")) {\n return ` <link rel=\"preload\" href=\"${basePath}${assetPath}\" as=\"font\" type=\"font/woff2\" crossorigin>`;\n } else if (assetPath.endsWith(\".gif\")) {\n return ` <link rel=\"preload\" href=\"${basePath}${assetPath}\" as=\"image\" type=\"image/gif\">`;\n } else if (assetPath.endsWith(\".jpg\") || assetPath.endsWith(\".jpeg\")) {\n return ` <link rel=\"preload\" href=\"${basePath}${assetPath}\" as=\"image\" type=\"image/jpeg\">`;\n } else if (assetPath.endsWith(\".png\")) {\n return ` <link rel=\"preload\" href=\"${basePath}${assetPath}\" as=\"image\" type=\"image/png\">`;\n } else {\n throw new Error(`Unknown preload type for ${assetPath}`);\n }\n}\nconst collectCssInDev = (modulePathToStartWith, viteServer, cssModulesImported = /* @__PURE__ */ new Set()) => {\n return `${collectCssModules(\n modulePathToStartWith,\n viteServer,\n cssModulesImported\n ).map((cssModule) => createPreloadLink(cssModule.url)).join(\"\\n\")}\n`;\n};\nconst badInlineJsChars = /[\\u2028\\u2029<>/]/g;\nconst inlineJsEscapeChars = {\n \"\\u2028\": \"\\\\u2028\",\n \"\\u2029\": \"\\\\u2029\",\n \"<\": \"\\\\u003C\",\n \">\": \"\\\\u003E\",\n \"/\": \"\\\\u002F\"\n};\nfunction escapeChar(unsafeChar) {\n return inlineJsEscapeChars[unsafeChar];\n}\nfunction escapeForInlineJS(input) {\n return input.replace(badInlineJsChars, escapeChar);\n}\nfunction jsonStringifyAndEscapeForInlineJS(input, { baseIndent = 0, jsonIndent = 2, prettyPrint = true } = {}) {\n const indentString = \" \".repeat(baseIndent);\n jsonIndent = prettyPrint ? jsonIndent : void 0;\n return escapeForInlineJS(JSON.stringify(input, null, jsonIndent)).replace(\n /\\n/gm,\n `\n${indentString}`\n );\n}\nlet viteRoot;\nlet viteCommand;\nfunction resolveIslandPlugin(islandsSet) {\n return {\n enforce: \"pre\",\n name: \"resolve-islands\",\n configResolved(config) {\n viteRoot = config.root;\n viteCommand = config.command;\n },\n load(id) {\n if (id.endsWith(\"?island\") || id.endsWith(\"?client\")) {\n const [idWithNoParam] = id.split(\"?\");\n const islandModuleImportPath = `${idWithNoParam}?client-entry`;\n const componentExtension = path.extname(idWithNoParam);\n const componentFilenameWithNoExtension = path.basename(\n idWithNoParam,\n componentExtension\n );\n const modulePath = idWithNoParam.replace(`${viteRoot}/`, \"\");\n const moduleId = (viteCommand === \"serve\" ? idWithNoParam : modulePath).concat(\"?client-entry\");\n if (islandsSet) {\n islandsSet.add(moduleId);\n }\n return `\n const moduleId = '${moduleId}';\n\n const lazyComponent = () => import('${islandModuleImportPath}');\n lazyComponent.moduleName = '${componentFilenameWithNoExtension}';\n lazyComponent.moduleId = moduleId;\n\n export default lazyComponent;\n `;\n }\n return null;\n }\n };\n}\nfunction resolveIslandToPlainModulePlugin(enabled = true) {\n return {\n enforce: \"pre\",\n name: \"resolve-islands-to-plain\",\n configResolved(config) {\n viteRoot = config.root;\n viteCommand = config.command;\n },\n async resolveId(id, importer, options) {\n if (enabled && (id.endsWith(\"?island\") || id.endsWith(\"?client\"))) {\n const newId = id.replace(\"?island\", \"\").replace(\"?client\", \"\");\n const resolution = await this.resolve(newId, importer, {\n skipSelf: true,\n ...options\n });\n if (resolution) {\n return resolution;\n }\n }\n return null;\n }\n };\n}\nfunction resolveIslandToPlainModuleNoopPlugin() {\n return resolveIslandToPlainModulePlugin(false);\n}\nconst clientRenderIsland = \"import type { RenderableIsland } from '@hubspot/cms-components';\\nimport * as cmsComponents from '@hubspot/cms-components';\\nimport { ClientRenderContextProvider } from '@hubspot/cms-components';\\nimport { Suspense } from 'react';\\nimport ReactDOMClient from 'react-dom/client';\\n\\nconst buildIslandIdentifierPrefix =\\n cmsComponents.buildIslandIdentifierPrefix || ((id) => id);\\n\\nexport function clientRenderIsland(\\n renderableIsland: RenderableIsland,\\n Component: React.ComponentType<any>\\n) {\\n const {\\n island,\\n rootElement,\\n postHydration,\\n pageUrl,\\n islands,\\n basePath,\\n WrapperModule,\\n } = renderableIsland;\\n let reactRoot: any;\\n\\n const rootOptions = {\\n // Ensure useId is unique across island roots\\n identifierPrefix: buildIslandIdentifierPrefix(renderableIsland.island.id),\\n };\\n\\n let innerComponent = <Component islandId={island.id} {...island.props} />;\\n if (WrapperModule) {\\n innerComponent = <WrapperModule>{innerComponent}</WrapperModule>;\\n }\\n\\n const elementsToHydrate = (\\n <Suspense fallback={`client hydrate fail/waiting for ${island.id}`}>\\n <ClientRenderContextProvider\\n pageUrl={pageUrl}\\n islands={islands}\\n onTopLevelHydrationFinish={postHydration}\\n island={island}\\n basePath={basePath}\\n >\\n {innerComponent}\\n </ClientRenderContextProvider>\\n </Suspense>\\n );\\n\\n if (island.clientOnly) {\\n reactRoot = ReactDOMClient.createRoot(rootElement, rootOptions);\\n reactRoot.render(elementsToHydrate);\\n } else {\\n reactRoot = ReactDOMClient.hydrateRoot(\\n rootElement,\\n elementsToHydrate,\\n rootOptions\\n );\\n }\\n return reactRoot;\\n}\\n\";\nconst virtualClientRenderIslandModuleId = \"virtual:clientRenderIsland.tsx\";\nfunction clientIslandEntryPlugin() {\n return {\n enforce: \"pre\",\n name: \"client-island-entry-plugin\",\n resolveId(id) {\n if (id === virtualClientRenderIslandModuleId) {\n return virtualClientRenderIslandModuleId;\n }\n return null;\n },\n load(id) {\n if (id.endsWith(\"?client-entry\")) {\n const [idWithNoParam] = id.split(\"?\");\n return `\n import { clientRenderIsland } from '${virtualClientRenderIslandModuleId}';\n import Component from '${idWithNoParam}';\n\n export function render(island) {\n return clientRenderIsland(island, Component)\n }\n\n export default Component;\n `;\n }\n if (id === virtualClientRenderIslandModuleId) {\n return clientRenderIsland;\n }\n return null;\n }\n };\n}\nconst scriptTagToLogServerMessages = (messagesForBrowser, groupLabel, nonceAttribute) => {\n if (!messagesForBrowser) {\n return \"\";\n }\n const consoleLines = [];\n for (const message of messagesForBrowser) {\n let funcString = \"console.log\";\n if (message.level === \"error\") {\n funcString = \"console.error\";\n }\n if (message.level === \"warn\") {\n funcString = \"console.warn\";\n }\n const argString = message.parameters.map((arg) => JSON.stringify(arg)).join(\", \");\n consoleLines.push(` ${funcString}(${argString});`);\n }\n let groupStart = \"\";\n let groupEnd = \"\";\n if (groupLabel !== void 0 && groupLabel !== null) {\n groupStart = `\n console.group(${JSON.stringify(groupLabel)});`;\n groupEnd = ` console.groupEnd()\n`;\n }\n return `<script ${nonceAttribute}>${groupStart}\n${consoleLines.join(\"\\n\")}\n${groupEnd}<\\/script>\n`;\n};\nconst getComponentExtension = (componentPath) => {\n const filteredExtensions = COMPONENT_EXTENSIONS.filter(\n (ext) => componentPath.endsWith(ext)\n );\n if (filteredExtensions.length === 1) {\n return filteredExtensions[0];\n }\n return void 0;\n};\nconst hasComponentExtension = (componentPath) => {\n return !!getComponentExtension(componentPath);\n};\nconst isStorybookStory = (componentPath) => {\n return !!path.basename(componentPath, path.extname(componentPath)).endsWith(\".stories\");\n};\nconst removeComponentExtension = (componentPath) => {\n const ext = getComponentExtension(componentPath);\n if (ext == null) {\n return componentPath;\n }\n return componentPath.slice(0, -1 * ext.length);\n};\nfunction getEntryPointHash(entryPoint) {\n return createHash(\"md5\").update(entryPoint).digest(\"hex\").slice(0, 6);\n}\nfunction getEntryPointHashWithIndexSuffix(entryPoint, index) {\n const renderIndexSuffix = index != null ? `i${index}` : \"\";\n return `${getEntryPointHash(entryPoint)}${renderIndexSuffix}`;\n}\nconst COMBINED_REACT_BASE_PATH = \"https://static.hsappstatic.net/cms-js-static/ex/js/react/v18\";\nconst ISLAND_RUNTIME_CONFIG_BASE_PATH = \"https://static.hsappstatic.net/cms-js-static/ex/js/island-runtime/v1\";\nfunction getCombinedReactUrl() {\n const hsEnv = process.env.HS_ENV;\n const fileVersion = hsEnv === \"prod\" ? `react-combined.mjs` : \"react-combined-qa.mjs\";\n return `${COMBINED_REACT_BASE_PATH}/${fileVersion}`;\n}\nfunction getIslandRuntimeConfigUrl() {\n const hsEnv = process.env.HS_ENV;\n const fileVersion = hsEnv === \"prod\" ? `island-runtime.mjs` : \"island-runtime-qa.mjs\";\n return `${ISLAND_RUNTIME_CONFIG_BASE_PATH}/${fileVersion}`;\n}\nfunction includesHublDataReference(templateSource) {\n const hublDataPattern = /\\{%\\s+set\\s+(experimentalHublData|hublData)\\s*=/;\n return !!templateSource.match(hublDataPattern);\n}\nconst removeIndexFromPath = (id) => {\n return id.replace(/\\/index\\.[jt]sx?$/, \"\");\n};\nconst removeIndexOrTrailingJsFromPath = (id) => {\n return removeIndexFromPath(id).replace(/\\.[jt]sx?$/, \"\");\n};\nconst HEALTHCHECKS_ENABLED_DEFAULT = true;\nconst HEALTHCHECKS_STRICT_DEFAULT = false;\nfunction getCMSAssetConfig(webRoot) {\n const cmsAssetsPath = path.join(webRoot, \"cms-assets.json\");\n const cmsThemePath = path.join(webRoot, \"theme.json\");\n const configPathToUse = fs.existsSync(cmsAssetsPath) ? cmsAssetsPath : cmsThemePath;\n const parsedConfig = JSON.parse(\n fs.readFileSync(configPathToUse).toString()\n );\n return parsedConfig;\n}\nfunction getCMSAssetConfigIfExists(webRoot) {\n try {\n return getCMSAssetConfig(webRoot);\n } catch (e) {\n console.error(\n `Error finding or parsing cms-assets.json in ${webRoot}, but ignoring for now`\n );\n return {};\n }\n}\nfunction areBuildHealthChecksEnabled(config) {\n var _a, _b;\n return ((_b = (_a = config.buildConfig) == null ? void 0 : _a.healthchecks) == null ? void 0 : _b.enabled) ?? HEALTHCHECKS_ENABLED_DEFAULT;\n}\nfunction doHealthChecksFailTheBuild(config) {\n var _a, _b;\n return ((_b = (_a = config.buildConfig) == null ? void 0 : _a.healthchecks) == null ? void 0 : _b.strict) ?? HEALTHCHECKS_STRICT_DEFAULT;\n}\nfunction getServerIncludePrebundleDepPatterns(config) {\n var _a, _b;\n return ((_b = (_a = config.buildConfig) == null ? void 0 : _a.serverPrebundling) == null ? void 0 : _b.include) ?? [];\n}\nconst BUILD_INFO_PATH = \"/build-info.json\";\nfunction getBuildInfo(buildDir) {\n try {\n const buildInfo = JSON.parse(\n readFileSync(path.join(buildDir, BUILD_INFO_PATH)).toString()\n );\n return buildInfo;\n } catch (e) {\n throw new Error(`Error loading build-info.json, path: ${BUILD_INFO_PATH}`);\n }\n}\nfunction getBaseAssetUrlFromBuild(buildDir) {\n return getBuildInfo(buildDir).baseAssetUrl;\n}\nconst GATES = [\n \"CMS:JSRenderer:GetServerSideProps\",\n \"CMS:JSRenderer:ModuleHubl\",\n \"CMS:JSRenderer:RemoveCjsPlugin\",\n \"CMS:JSRenderer:RemoveMockClientEntryPlugin\",\n \"CMS:JSRenderer:AnalyzeCmsModules\"\n];\nconst ENABLED_FEATURES_GATE_MAP = {\n \"cms:jsr:getServerSideProps\": \"CMS:JSRenderer:GetServerSideProps\",\n \"cms:jsr:RemoveCjsPlugin\": \"CMS:JSRenderer:RemoveCjsPlugin\",\n \"cms:jsr:analyzeCmsModules\": \"CMS:JSRenderer:AnalyzeCmsModules\"\n};\nfunction isUngatedFor(gates, gate) {\n return gates.includes(gate);\n}\nfunction ungatedAtBuildTimeFor(buildDir, gate) {\n try {\n const buildInfo = getBuildInfo(buildDir);\n return isUngatedFor(buildInfo.gates, gate);\n } catch (e) {\n return false;\n }\n}\nconst findAllComponentsIn = (webRoot, componentsFolder) => {\n const fullComponentsFolderPath = join(webRoot, componentsFolder);\n const componentsByName = {};\n if (!existsSync(fullComponentsFolderPath)) {\n return componentsByName;\n }\n readdirSync(fullComponentsFolderPath).forEach((fileOrFolderName) => {\n const fullPath = join(fullComponentsFolderPath, fileOrFolderName);\n const subdirPath = join(componentsFolder, fileOrFolderName);\n const isDirectory = lstatSync(fullPath).isDirectory();\n if (!isDirectory && hasComponentExtension(fileOrFolderName) && !isStorybookStory(fileOrFolderName)) {\n const subdirPathNoExtension = removeComponentExtension(subdirPath);\n componentsByName[subdirPathNoExtension] = subdirPath;\n } else if (isDirectory) {\n for (const potentialExtension of COMPONENT_EXTENSIONS) {\n const potentialIndexModule = join(\n subdirPath,\n `index${potentialExtension}`\n );\n const fullPotentialPath = join(\n fullPath,\n `index${potentialExtension}`\n );\n if (existsSync(fullPotentialPath)) {\n const moduleIndexPathNoExtension = removeComponentExtension(potentialIndexModule);\n componentsByName[moduleIndexPathNoExtension] = potentialIndexModule;\n break;\n }\n }\n }\n });\n return componentsByName;\n};\nfunction findAllModulesInRoot(webRoot) {\n const allModuleComponents = findAllComponentsIn(\n webRoot,\n \"./components/modules\"\n );\n const moduleNames = Object.keys(allModuleComponents).map(\n (moduleSubpath) => moduleSubpath.replace(\"components/modules/\", \"\").replace(\"/index\", \"\")\n );\n const moduleSubpaths = Object.keys(allModuleComponents);\n return { moduleNames, moduleSubpaths };\n}\nfunction findAllPartialsInRoot(webRoot) {\n const allPartialComponents = findAllComponentsIn(\n webRoot,\n \"./components/partials\"\n );\n const partialNames = Object.keys(allPartialComponents).map(\n (partialSubpath) => partialSubpath.replace(\"components/partials/\", \"\").replace(\"/index\", \"\")\n );\n const partialSubpaths = Object.keys(allPartialComponents);\n return { partialNames, partialSubpaths };\n}\nfunction namespaceModulePropsShape(props) {\n const {\n dataQueryResult,\n hublParameters,\n fieldValues: passedFieldValues,\n hublData,\n experimentalHublData,\n moduleName,\n supplementalFieldValues\n } = props;\n const oldPropsShape = { ...props };\n if (oldPropsShape.dataQueryResult) {\n delete oldPropsShape.dataQueryResult;\n }\n if (oldPropsShape.hublParameters) {\n delete oldPropsShape.hublParameters;\n }\n const fieldValues = passedFieldValues || oldPropsShape;\n return {\n ...fieldValues,\n dataQueryResult,\n fieldValues,\n hublParameters,\n hublData,\n experimentalHublData,\n moduleName,\n supplementalFieldValues\n };\n}\nfunction setIn(object, nestedKeysArray, value) {\n let curr = object;\n const finalKey = nestedKeysArray.pop();\n for (let index = 0; index < nestedKeysArray.length; index++) {\n const currentKey = nestedKeysArray[index];\n const nextKey = nestedKeysArray[index + 1];\n if (Number.isInteger(nextKey) || !nextKey && Number.isInteger(finalKey)) {\n if (curr[currentKey] === void 0) {\n curr[currentKey] = [];\n }\n }\n if (curr[currentKey] === void 0) {\n curr[currentKey] = {};\n }\n curr = curr[currentKey];\n }\n if (value !== void 0) {\n curr[finalKey] = value;\n }\n}\nfunction isStylesheetAsset(staticAsset) {\n return staticAsset.type === \"stylesheet\";\n}\nexport {\n COMPONENT_EXTENSIONS,\n CSS_LANGS_RE,\n ENABLED_FEATURES_GATE_MAP,\n ENTRY_POINTS_PATH,\n GATES,\n MODULE_FOLDER_PATH,\n VIRTUAL_CONFIG_SETUP,\n VIRTUAL_ISLAND_RUNTIME,\n getBaseAssetUrlFromBuild as a,\n areBuildHealthChecksEnabled,\n clientIslandEntryPlugin,\n collectCssInDev,\n collectCssModules,\n doHealthChecksFailTheBuild,\n escapeForInlineJS,\n findAllComponentsIn,\n findAllModulesInRoot,\n findAllPartialsInRoot,\n getBuildInfo as g,\n getCMSAssetConfig,\n getCMSAssetConfigIfExists,\n getCombinedReactUrl,\n getComponentExtension,\n getEntryPointHash,\n getEntryPointHashWithIndexSuffix,\n getIslandRuntimeConfigUrl,\n getServerIncludePrebundleDepPatterns,\n hasComponentExtension,\n includesHublDataReference,\n isStorybookStory,\n isStylesheetAsset,\n isUngatedFor,\n jsonStringifyAndEscapeForInlineJS,\n namespaceModulePropsShape,\n removeComponentExtension,\n removeIndexFromPath,\n removeIndexOrTrailingJsFromPath,\n resolveIslandPlugin,\n resolveIslandToPlainModuleNoopPlugin,\n resolveIslandToPlainModulePlugin,\n scriptTagToLogServerMessages,\n setIn,\n ungatedAtBuildTimeFor,\n virtualClientRenderIslandModuleId\n};\n", "import { jsonStringifyAndEscapeForInlineJS, scriptTagToLogServerMessages } from \"./basicUtils.js\";\nimport { COMPONENT_EXTENSIONS, CSS_LANGS_RE, ENABLED_FEATURES_GATE_MAP, ENTRY_POINTS_PATH, GATES, MODULE_FOLDER_PATH, VIRTUAL_CONFIG_SETUP, VIRTUAL_ISLAND_RUNTIME, areBuildHealthChecksEnabled, clientIslandEntryPlugin, collectCssInDev, collectCssModules, doHealthChecksFailTheBuild, escapeForInlineJS, findAllComponentsIn, findAllModulesInRoot, findAllPartialsInRoot, a, g, getCMSAssetConfig, getCMSAssetConfigIfExists, getCombinedReactUrl, getComponentExtension, getEntryPointHash, getEntryPointHashWithIndexSuffix, getIslandRuntimeConfigUrl, getServerIncludePrebundleDepPatterns, hasComponentExtension, includesHublDataReference, isStorybookStory, isStylesheetAsset, isUngatedFor, namespaceModulePropsShape, removeComponentExtension, removeIndexFromPath, removeIndexOrTrailingJsFromPath, resolveIslandPlugin, resolveIslandToPlainModuleNoopPlugin, resolveIslandToPlainModulePlugin, setIn, ungatedAtBuildTimeFor, virtualClientRenderIslandModuleId } from \"./basicUtils.js\";\nimport * as dotProp from \"dot-prop\";\nimport * as parser from \"@babel/parser\";\nimport _traverse from \"@babel/traverse\";\nimport * as t from \"@babel/types\";\nimport { jsx } from \"react/jsx-runtime\";\nimport stream from \"stream\";\nimport { renderToPipeableStream, renderToStaticMarkup } from \"react-dom/server\";\nimport * as cmsComponents from \"@hubspot/cms-components\";\nimport { ServerRenderContext } from \"@hubspot/cms-components\";\nimport { isValidElement, cloneElement } from \"react\";\nimport \"path\";\nimport \"crypto\";\nimport \"fs\";\nimport \"path/posix\";\nconst { setProperty, getProperty, hasProperty } = dotProp;\nconst serializeIslandDataForInlineScript = (tweakedIslandsArray, perServerRequestData, baseIndent = 0, prettyPrint) => {\n const islandsArrayToSerialize = tweakedIslandsArray.map(\n ({\n id,\n moduleName,\n moduleId,\n props,\n hydrateOn,\n clientOnly,\n priority,\n url,\n sharedStateID,\n supplementalFieldValues,\n wrapperModuleId,\n wrapperUrl\n }) => {\n const output = {\n id,\n moduleName,\n moduleId,\n hydrateOn,\n clientOnly,\n priority,\n props,\n url\n };\n if (sharedStateID) {\n output.sharedStateID = sharedStateID;\n }\n if (wrapperModuleId) {\n output.wrapperModuleId = wrapperModuleId;\n }\n if (wrapperUrl) {\n output.wrapperUrl = wrapperUrl;\n }\n const filteredSupplementalFieldValues = filterOutUnreadSupplementalFieldValues(\n supplementalFieldValues,\n perServerRequestData.get(\"supplementalFieldValuesRead\")\n );\n if (filteredSupplementalFieldValues) {\n output.supplementalFieldValues = filteredSupplementalFieldValues;\n }\n return output;\n }\n );\n return jsonStringifyAndEscapeForInlineJS(islandsArrayToSerialize, {\n baseIndent,\n jsonIndent: 2,\n prettyPrint\n });\n};\nfunction filterOutUnreadSupplementalFieldValues(supplementalFieldValues, supplementalFieldValuesRead) {\n if (!supplementalFieldValues) {\n return supplementalFieldValues;\n }\n if (!supplementalFieldValuesRead) {\n return supplementalFieldValues;\n }\n const result = {};\n Array.from(supplementalFieldValuesRead).forEach((fieldPath) => {\n if (hasProperty(supplementalFieldValues, fieldPath)) {\n setProperty(\n result,\n fieldPath,\n getProperty(supplementalFieldValues, fieldPath)\n );\n }\n });\n return result;\n}\nconst writeSharedStateToJsGlobal = (islands, perServerRequestData, indent = 0, prettyPrint) => {\n const sharedStateIDs = islands.map((island) => island.sharedStateID).filter((x) => !!x);\n if (sharedStateIDs.length > 0) {\n const indentString = \" \".repeat(indent);\n const stateByID = {};\n sharedStateIDs.forEach(\n (id) => stateByID[id] = perServerRequestData.get(id)\n );\n const stringifiedState = jsonStringifyAndEscapeForInlineJS(stateByID, {\n prettyPrint,\n jsonIndent: 2\n });\n return `\n\nvar newState = ${stringifiedState};\nif(window.__hsSSInit) {\n window.__hsSSInit = Object.assign(window.__hsSSInit, newState);\n} else {\n window.__hsSSInit = newState;\n}`.replace(/\\n/gm, `\n${indentString}`);\n }\n return \"\";\n};\nfunction getIslandUrls(roots, viteDevServer) {\n return roots.map((island) => {\n const islandModule = viteDevServer.moduleGraph.getModuleById(\n island.moduleId\n );\n if (!islandModule) {\n throw new Error(`Unknown island moduleId: ${island.moduleId}`);\n }\n let wrapperModule;\n if (island.wrapperModuleId) {\n wrapperModule = viteDevServer.moduleGraph.getModuleById(\n island.wrapperModuleId\n );\n }\n const tweakedIsland = {\n ...island,\n url: islandModule.url,\n wrapperUrl: wrapperModule ? wrapperModule.url : void 0\n };\n return tweakedIsland;\n });\n}\nfunction getPerServerRequestUrls(perServerRequestData, viteDevServer) {\n if (!perServerRequestData.has(\"sharedStateIDs\")) {\n return new Map(perServerRequestData);\n }\n const perServerRequestDataWithUrls = new Map(\n perServerRequestData\n );\n perServerRequestData.get(\"sharedStateIDs\").forEach((id) => {\n const reducer = perServerRequestData.get(id);\n if (reducer.reducerFuncModuleId) {\n const reducerWithUrl = {\n ...reducer,\n reducerFuncModuleUrl: viteDevServer.moduleGraph.getModuleById(\n reducer.reducerFuncModuleId\n ).url\n };\n perServerRequestDataWithUrls.set(id, reducerWithUrl);\n }\n });\n return perServerRequestDataWithUrls;\n}\nconst createIslandsGlobalJsForClientInDev = (roots, perServerRequestData, viteDevServer, indent, prettyPrint) => {\n const islands = getIslandUrls(roots, viteDevServer);\n const perServerRequestDataWithUrls = getPerServerRequestUrls(\n perServerRequestData,\n viteDevServer\n );\n return `${\" \".repeat(\n indent\n )}window.__islands = ${serializeIslandDataForInlineScript(\n islands,\n perServerRequestData,\n indent,\n prettyPrint\n )}${writeSharedStateToJsGlobal(\n islands,\n perServerRequestDataWithUrls,\n indent,\n prettyPrint\n )}`;\n};\nfunction noncePlaceholderPlugin() {\n const HS_DEPLOYED = process.env.AWS_EXECUTION_ENV != null || process.env.HS_DEPLOYED === \"true\";\n return {\n name: \"hs-nonce-placeholder\",\n enforce: \"post\",\n apply() {\n return HS_DEPLOYED;\n },\n transformIndexHtml(html) {\n const regex = /<(style|script|link) (.*)>/gi;\n const replacer = (_, p1, p2) => {\n if (p1 === \"style\" || p1 === \"script\" || // if link, only nonce for stylesheet\n p1 === \"link\" && p2.includes('rel=\"stylesheet\"')) {\n const noncePlaceholderValue = p1 === \"script\" ? \"hs-random-nonce\" : \"hs-random-style-nonce\";\n p2 = `nonce=\"${noncePlaceholderValue}\" ${p2}`;\n }\n return `<${p1} ${p2}>`;\n };\n return html.replace(regex, replacer);\n }\n };\n}\nconst traverse = _traverse.default;\nconst CMS_MODULE_COMPONENT_NAME = \"UnstableModule\";\nfunction findCmsModules(cmsModules = {}) {\n let config;\n return {\n enforce: \"pre\",\n name: \"findCmsModules\",\n configResolved(resolvedConfig) {\n config = resolvedConfig;\n },\n transform(code, id) {\n const moduleInfo = this.getModuleInfo(id);\n const isExternal = config.command === \"serve\" ? false : moduleInfo.isExternal;\n if (isExternal || !moduleInfo.id.startsWith(config.root) || !code.includes(CMS_MODULE_COMPONENT_NAME)) {\n return null;\n }\n const localCmsModules = {};\n const sourceAst = parser.parse(code, {\n sourceType: \"module\",\n plugins: [\"jsx\", \"typescript\"]\n });\n let unstableModuleLocalName = CMS_MODULE_COMPONENT_NAME;\n const pluginError = this.error.bind(this);\n traverse(sourceAst, {\n ImportDeclaration(path) {\n if (!t.isStringLiteral(path.node.source, {\n value: \"@hubspot/cms-components\"\n })) {\n return null;\n }\n for (const specifier of path.node.specifiers) {\n if (t.isImportSpecifier(specifier) && t.isIdentifier(specifier.imported, {\n name: CMS_MODULE_COMPONENT_NAME\n })) {\n unstableModuleLocalName = specifier.local.name;\n }\n }\n },\n JSXOpeningElement(path) {\n if (!t.isJSXIdentifier(path.node.name, {\n name: unstableModuleLocalName\n }) || path.node.attributes.length !== 2) {\n return null;\n }\n let cmsModuleName;\n let cmsModulePath;\n for (const prop of path.node.attributes) {\n if (t.isJSXAttribute(prop) && t.isJSXIdentifier(prop.name, { name: \"name\" }) && t.isStringLiteral(prop.value)) {\n cmsModuleName = prop.value.value;\n continue;\n }\n if (t.isJSXAttribute(prop) && t.isJSXIdentifier(prop.name, { name: \"path\" }) && t.isStringLiteral(prop.value)) {\n cmsModulePath = prop.value.value;\n continue;\n }\n pluginError(\n new Error(\n `Error: ${id.replace(config.root, \"\")}:${prop.loc.start.line} \"name\" and \"path\" must be primitive strings`\n )\n );\n }\n const cmsModuleProps = {\n name: cmsModuleName,\n path: cmsModulePath\n };\n if (Object.hasOwn(localCmsModules, cmsModuleProps.name)) {\n pluginError(\n new Error(\n `Error: multiple <${CMS_MODULE_COMPONENT_NAME} /> with duplicate name: ${cmsModuleProps.name}`\n )\n );\n }\n localCmsModules[cmsModuleProps.name] = cmsModuleProps;\n }\n });\n return {\n meta: {\n findCmsModules: localCmsModules\n }\n };\n },\n buildEnd(error) {\n if (error)\n throw error;\n const modulesWithCmsModuleUsage = Array.of(\n ...this.getModuleIds()\n ).filter((moduleId) => moduleId.startsWith(config.root)).map((moduleId) => this.getModuleInfo(moduleId)).filter(\n (moduleInfo) => Object.hasOwn(moduleInfo.meta, \"findCmsModules\")\n );\n const moduleToEntryPoints = {};\n for (const moduleWithCmsModuleUsage of modulesWithCmsModuleUsage) {\n moduleToEntryPoints[moduleWithCmsModuleUsage.id] = findEntryPoints(\n this,\n moduleWithCmsModuleUsage\n );\n }\n for (const moduleWithCmsModuleUsage of modulesWithCmsModuleUsage) {\n const usageInModuleEntryPoint = moduleToEntryPoints[moduleWithCmsModuleUsage.id].find((entryPoint) => entryPoint.id.includes(\"/components/modules\"));\n if (usageInModuleEntryPoint) {\n this.error(`\n Error: <${CMS_MODULE_COMPONENT_NAME} /> can only be used in Partials.\n Module: ${usageInModuleEntryPoint.id === moduleWithCmsModuleUsage.id ? usageInModuleEntryPoint.id.replace(config.root, \"\") : `imports: ${moduleWithCmsModuleUsage.id.replace(\n config.root,\n \"\"\n )}, which`} contains a <${CMS_MODULE_COMPONENT_NAME} />\n `);\n }\n }\n const root = config.root;\n for (const moduleWithCmsModuleUsage of modulesWithCmsModuleUsage) {\n const islandsContainingCmsModuleUsage = checkModuleTreeForIslands(\n this,\n moduleWithCmsModuleUsage\n );\n if (islandsContainingCmsModuleUsage.length > 0) {\n throw new Error(`\n <${CMS_MODULE_COMPONENT_NAME} /> cannot be used within islands.\n ${formatIslandImporter(\n moduleWithCmsModuleUsage.id,\n root\n )} uses <${CMS_MODULE_COMPONENT_NAME} /> and is used by islands:\n ${islandsContainingCmsModuleUsage.map(\n (islandModuleInfo) => formatIslandImporter(islandModuleInfo.id, root)\n ).join(\", \")}\n `);\n }\n }\n for (const moduleWithCmsModuleUsage of modulesWithCmsModuleUsage) {\n const entryPoints = moduleToEntryPoints[moduleWithCmsModuleUsage.id];\n for (const entryPoint of entryPoints) {\n const relativeEntryPoint = entryPoint.id.replace(root, \"\");\n if (!Object.hasOwn(cmsModules, relativeEntryPoint)) {\n cmsModules[relativeEntryPoint] = {};\n }\n for (const [cmsModuleName, cmsModuleValue] of Object.entries(\n moduleWithCmsModuleUsage.meta.findCmsModules\n )) {\n if (Object.hasOwn(cmsModules[relativeEntryPoint], cmsModuleName)) {\n this.error(`Error: duplicate module name: ${cmsModuleName}`);\n }\n cmsModules[relativeEntryPoint][cmsModuleName] = cmsModuleValue;\n }\n }\n }\n }\n };\n}\nfunction findEntryPoints(ctx, moduleInfo) {\n if (moduleInfo.isEntry) {\n return [moduleInfo];\n }\n const result = [];\n for (const importer of moduleInfo.importers) {\n const importerModuleInfo = ctx.getModuleInfo(importer);\n const entryPoints = findEntryPoints(ctx, importerModuleInfo);\n result.push(...entryPoints);\n }\n return result;\n}\nfunction checkModuleTreeForIslands(ctx, module) {\n if (module.id.endsWith(\"?client-entry\")) {\n return [module];\n }\n const importerResults = [];\n for (const importer of module.importers) {\n const importerInfo = ctx.getModuleInfo(importer);\n const importerResult = checkModuleTreeForIslands(ctx, importerInfo);\n importerResults.push(importerResult);\n }\n return importerResults.flat();\n}\nfunction formatIslandImporter(id, root) {\n return id.replace(root, \"\").replace(\"?client-entry\", \"\");\n}\nconst promiseForNewWritableStream = () => {\n const chunks = [];\n const writableStream = new stream.Writable();\n writableStream._write = (chunk, encoding, done) => {\n chunks.push(Buffer.from(chunk));\n done();\n };\n const streamDonePromise = new Promise((resolve, reject) => {\n writableStream.on(\"error\", (error) => {\n reject(error);\n });\n writableStream._final = (done) => {\n resolve(Buffer.concat(chunks).toString(\"utf8\"));\n done();\n };\n });\n return { streamDonePromise, writableStream };\n};\nconst renderStreamToPromise = async (reactElements, options) => {\n const { streamDonePromise, writableStream } = promiseForNewWritableStream();\n const {\n pipe\n /* abort */\n } = renderToPipeableStream(reactElements, {\n ...options || {},\n onShellReady() {\n },\n onAllReady() {\n pipe(writableStream);\n if (options == null ? void 0 : options.onAllReady) {\n options.onAllReady();\n }\n }\n });\n return streamDonePromise;\n};\nconst {\n createServerRenderContextV2,\n createServerRenderContext,\n renderServerSidePropsWithAsyncLocalStoreContext\n} = cmsComponents;\nconst bootStrapRenderContext = () => {\n const renderContext = createServerRenderContextV2 ? createServerRenderContextV2(null, {\n environmentConfig: null,\n entryPointBasePath: \"\",\n supplementalFieldValues: {},\n messagesForBrowser: []\n }) : createServerRenderContext(\"\", null);\n return renderContext;\n};\nasync function renderComponentOnServer(Component, propsAndDeps, pageUrl, environmentConfig, entryPointBasePath, contextOptions, renderOptions, getServerSideProps) {\n const { props } = propsAndDeps;\n const componentDebugName = Component.displayName || Component.name;\n const supplementalFieldValues = contextOptions == null ? void 0 : contextOptions.supplementalFieldValues;\n const messagesForBrowser = contextOptions == null ? void 0 : contextOptions.messagesForBrowser;\n const renderContext = cmsComponents.createServerRenderContextV2 ? cmsComponents.createServerRenderContextV2(pageUrl, {\n environmentConfig,\n entryPointBasePath,\n supplementalFieldValues,\n messagesForBrowser\n }) : cmsComponents.createServerRenderContext(pageUrl, environmentConfig);\n if (getServerSideProps !== void 0 && typeof getServerSideProps === \"function\") {\n const gSSPResult = await renderServerSidePropsWithAsyncLocalStoreContext(\n getServerSideProps,\n propsAndDeps,\n renderContext\n );\n if (gSSPResult) {\n props.serverSideProps = gSSPResult.serverSideProps;\n }\n }\n return renderOnServer(\n /* @__PURE__ */ jsx(Component, { ...props }),\n renderContext,\n componentDebugName,\n renderOptions\n );\n}\nasync function renderOnServer(elements, renderContext = bootStrapRenderContext(), debugName, renderOptions) {\n let html = await renderStreamToPromise(\n /* @__PURE__ */ jsx(ServerRenderContext.Provider, { value: renderContext, children: elements }),\n renderOptions\n );\n if (renderContext.messagesForBrowser.length > 0) {\n html = `${html}${scriptTagToLogServerMessages(\n renderContext.messagesForBrowser,\n `Server messages rendering: ${debugName}`\n )}`;\n }\n return { html, renderContext };\n}\nfunction getServerGlobalsToInject(environmentConfig, hsServerPageUrl, hsBasePath, prettyPrint, criticalDevErrors, includeNonces) {\n if (prettyPrint === void 0 && hsServerPageUrl && cmsComponents.isDebugUrlString) {\n prettyPrint = cmsComponents.isDebugUrlString(hsServerPageUrl);\n }\n const serializedJson = jsonStringifyAndEscapeForInlineJS(\n environmentConfig.toJSON(),\n { baseIndent: 6, prettyPrint }\n );\n const globals = [`window.__hsEnvConfig = ${serializedJson};`];\n if (hsServerPageUrl) {\n globals.push(\n `window.__hsServerPageUrl = ${jsonStringifyAndEscapeForInlineJS(\n hsServerPageUrl\n )};`\n );\n }\n if (hsBasePath) {\n globals.push(\n `window.__hsBasePath = ${jsonStringifyAndEscapeForInlineJS(hsBasePath)};`\n );\n }\n if (!environmentConfig.getIsDeployed() && (criticalDevErrors == null ? void 0 : criticalDevErrors.length)) {\n const firstCriticalDevError = criticalDevErrors[0];\n globals.push(`\n customElements.whenDefined('vite-error-overlay').then(() => {\n const ErrorOverlay = customElements.get('vite-error-overlay');\n const error = new Error(${jsonStringifyAndEscapeForInlineJS(\n firstCriticalDevError.message\n )});\n const overlay = new ErrorOverlay(error);\n\n document.body.appendChild(overlay);\n })\n `);\n }\n const nonceAttr = includeNonces && cmsComponents.SCRIPT_NONCE_PLACEHOLDER ? ` nonce=\"${cmsComponents.SCRIPT_NONCE_PLACEHOLDER}\"` : \"\";\n return `\n <script type=\"text/javascript\"${nonceAttr}>\n ${globals.join(\"\\n \")}\n <\\/script>\n `;\n}\nfunction renderFieldsJSX(fieldsJSX) {\n let moduleJson;\n const outputCallback = (callbackJson) => {\n moduleJson = callbackJson;\n };\n renderToStaticMarkup(\n cloneElement(fieldsJSX, {\n outputCallback\n })\n );\n if (!moduleJson) {\n throw new Error(\"couldn't render module fields definition to fields.json\");\n }\n return moduleJson;\n}\nfunction renderFieldsToJson(fields, moduleName) {\n let fieldsJSON;\n try {\n if (isValidElement(fields)) {\n fieldsJSON = renderFieldsJSX(fields);\n } else if (Array.isArray(fields)) {\n fieldsJSON = fields;\n } else {\n throw new Error(\n `Couldn't recognize \\`fields\\` value for module ${moduleName}`\n );\n }\n return fieldsJSON;\n } catch (e) {\n e.message = `Error when rendering fields for ${moduleName}: ${e.message}`;\n throw e;\n }\n}\nexport {\n COMPONENT_EXTENSIONS,\n CSS_LANGS_RE,\n ENABLED_FEATURES_GATE_MAP,\n ENTRY_POINTS_PATH,\n GATES,\n MODULE_FOLDER_PATH,\n VIRTUAL_CONFIG_SETUP,\n VIRTUAL_ISLAND_RUNTIME,\n areBuildHealthChecksEnabled,\n clientIslandEntryPlugin,\n collectCssInDev,\n collectCssModules,\n createIslandsGlobalJsForClientInDev,\n doHealthChecksFailTheBuild,\n escapeForInlineJS,\n findAllComponentsIn,\n findAllModulesInRoot,\n findAllPartialsInRoot,\n findCmsModules,\n a as getBaseAssetUrlFromBuild,\n g as getBuildInfo,\n getCMSAssetConfig,\n getCMSAssetConfigIfExists,\n getCombinedReactUrl,\n getComponentExtension,\n getEntryPointHash,\n getEntryPointHashWithIndexSuffix,\n getIslandRuntimeConfigUrl,\n getIslandUrls,\n getServerGlobalsToInject,\n getServerIncludePrebundleDepPatterns,\n hasComponentExtension,\n includesHublDataReference,\n isStorybookStory,\n isStylesheetAsset,\n isUngatedFor,\n jsonStringifyAndEscapeForInlineJS,\n namespaceModulePropsShape,\n noncePlaceholderPlugin,\n removeComponentExtension,\n removeIndexFromPath,\n removeIndexOrTrailingJsFromPath,\n renderComponentOnServer,\n renderFieldsToJson,\n renderOnServer,\n renderStreamToPromise,\n resolveIslandPlugin,\n resolveIslandToPlainModuleNoopPlugin,\n resolveIslandToPlainModulePlugin,\n scriptTagToLogServerMessages,\n serializeIslandDataForInlineScript,\n setIn,\n ungatedAtBuildTimeFor,\n virtualClientRenderIslandModuleId\n};\n", "import { Plugin, ViteDevServer } from 'vite';\n\nexport default function devSecretsPlugin(secretNames: Array<string>): Plugin {\n return {\n name: 'dev-secrets',\n configureServer: {\n order: 'post',\n async handler(server: ViteDevServer) {\n const cmsComponents = await server.ssrLoadModule(\n '@hubspot/cms-components'\n );\n\n if (cmsComponents.setSecretsFromEnv) {\n console.log(\n `Attempting to load HS_* secrets from .env: ${secretNames}`\n );\n cmsComponents.setSecretsFromEnv(secretNames);\n } else if (secretNames.length > 0) {\n console.warn(\n 'Not loading secrets into the local environment. Make sure that your @hubspot/cms-components and @hubspot/cms-dev-server package versions match.'\n );\n }\n },\n },\n };\n}\n", "import path from 'path';\nimport url from 'url';\nimport { normalizePath } from 'vite';\n\nexport default function packagePath(\n metaUrl: string,\n projectPath: string\n): string {\n if (process.env.DEV_SERVER_ENV === 'production') {\n return normalizePath(\n path.resolve(path.dirname(url.fileURLToPath(metaUrl)), projectPath)\n );\n }\n\n const parentDirPath = normalizePath(path.dirname(url.fileURLToPath(metaUrl)));\n const subPath = parentDirPath.replace(/^.+cms-dev-server\\/src\\//, '');\n const subPathParentDirs = subPath.split('/').map(() => '..');\n\n return path.resolve(\n path.dirname(url.fileURLToPath(metaUrl)),\n path.join(...subPathParentDirs, projectPath)\n );\n}\n"],
5
- "mappings": ";;;AACA,OAAOA,WAAU;AACjB,OAAO,QAAQ;AACf,SAAS,iBAAAC,sBAAqB;;;ACA9B,SAAS,gBAAgB,wBAAsC;AAC/D,SAAS,WAAW,aAAa;;;ACJjC,OAAO,UAAU;AA2FjB,IAAI;AACJ,IAAI;AACJ,SAAS,oBAAoB,YAAY;AACvC,SAAO;AAAA,IACL,SAAS;AAAA,IACT,MAAM;AAAA,IACN,eAAe,QAAQ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AK,KAAK;AAExD,UAAM,gBAAgB,SAAS,EAAE,QAAQ,YAAY,KAAK,CAAC;AAAA,EAC7D,SAAS,OAAP;AACA,UAAM,IAAI,MAAM,sCAAsC,KAAK;AAAA,EAC7D;AACF;AAAA,CAEC,YAAY;AACX,MAAI;AACF,UAAM,mBAAmB;AACzB,YAAQ,KAAK,CAAC;AAAA,EAChB,SAAS,OAAP;AACA,YAAQ,MAAM,sBAAsB,KAAK;AACzC,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF,GAAG,EAAE,MAAM,CAAC,UAAU;AAEpB,QAAM;AACR,CAAC;",
6
- "names": ["path", "normalizePath", "path", "createServerRenderContextV2", "createServerRenderContext", "cmsComponents", "path", "path", "normalizePath"]
7
- }
package/dist/index.js.map DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/createViteDevServer.ts", "../../cms-js-internal/dist/basicUtils.js", "../../cms-js-internal/dist/index.js", "../src/plugins/devSecretsPlugin.ts"],
4
- "sourcesContent": ["/* hs-eslint ignored failing-rules */\n/* eslint-disable require-await */\n\nimport { createServer as createViteServer, InlineConfig } from 'vite';\nimport { default as react } from '@vitejs/plugin-react';\nimport {\n Gate,\n clientIslandEntryPlugin,\n resolveIslandPlugin,\n noncePlaceholderPlugin,\n findCmsModules,\n} from '@hubspot/cms-js-internal';\nimport { default as mkcert } from 'vite-plugin-mkcert';\nimport { viteCommonjs } from '@originjs/vite-plugin-commonjs';\nimport devSecretsPlugin from './plugins/devSecretsPlugin.js';\n\nasync function createViteDevServer(\n webRoot: string,\n port,\n sslEnabled: boolean,\n domainsToProxy = [],\n jsRenderingGates: Gate[],\n secretNames: string[]\n) {\n const additionalMkcertHosts = domainsToProxy\n .map((proxyDomain) => [\n `${proxyDomain}.localhost`,\n `${proxyDomain}.hslocal.net`,\n ])\n .flat();\n\n if (process.env.VITE_ORIGIN) {\n console.log(`\\nCustom origin: ${process.env.VITE_ORIGIN}\\n`);\n }\n\n const origin =\n process.env.VITE_ORIGIN ??\n (sslEnabled ? `https://hslocal.net:${port}` : `http://hslocal.net:${port}`);\n\n const viteConfig: InlineConfig = {\n appType: 'custom',\n server: {\n middlewareMode: true,\n host: 'hslocal.net',\n origin,\n https: sslEnabled,\n hmr: {\n protocol: sslEnabled ? 'wss' : undefined,\n },\n },\n root: webRoot,\n ssr: {\n // TODO: might need more entries here to get things to resolve through\n // resolveWebRootDepsPlugin\n noExternal: '@hubspot/cms-components',\n },\n resolve: {\n conditions: ['server'],\n dedupe: ['react', 'react-dom', '@hubspot/cms-components', 'styled-jsx'],\n },\n optimizeDeps: {\n include: ['react', 'react-dom', 'react-dom/client'],\n },\n plugins: [\n true ? findCmsModules() : null,\n sslEnabled ? mkcert({ hosts: additionalMkcertHosts }) : null,\n react({\n babel: {\n plugins: [\n 'babel-plugin-styled-components',\n 'styled-jsx/babel',\n 'macros',\n ],\n },\n }),\n clientIslandEntryPlugin(),\n resolveIslandPlugin(),\n jsRenderingGates.includes('CMS:JSRenderer:RemoveCjsPlugin')\n ? null\n : viteCommonjs(),\n devSecretsPlugin(secretNames),\n noncePlaceholderPlugin(),\n ],\n css: {\n postcss: webRoot,\n },\n envDir: webRoot,\n envPrefix: 'HS_',\n };\n\n return createViteServer(viteConfig);\n}\n\nexport default createViteDevServer;\n", "import path from \"path\";\nimport { createHash } from \"crypto\";\nimport fs, { readFileSync, existsSync, readdirSync, lstatSync } from \"fs\";\nimport { join } from \"path/posix\";\nconst COMPONENT_EXTENSIONS = [\".jsx\", \".tsx\", \".js\", \".ts\"];\nconst ENTRY_POINTS_PATH = \"components/partials/\";\nconst MODULE_FOLDER_PATH = \"components/modules/\";\nconst VIRTUAL_ISLAND_RUNTIME = \"virtual:island-runtime\";\nconst VIRTUAL_CONFIG_SETUP = \"virtual:config-setup\";\nconst CSS_LANGS_RE = /\\.(css|less|sass|scss|styl|stylus|pcss|postcss|sss)(?:$|\\?)/;\nconst collectCssModules = (modulePathToStartWith, viteServer, cssModulesImported = /* @__PURE__ */ new Set()) => {\n const appModulesForPath = viteServer.moduleGraph.fileToModulesMap.get(\n modulePathToStartWith\n );\n if (!appModulesForPath || appModulesForPath.size === 0) {\n throw new Error(`No modules at: ${modulePathToStartWith}`);\n } else if (appModulesForPath.size > 1) {\n throw new Error(`More than one module at: ${modulePathToStartWith}`);\n }\n const appModule = Array.from(appModulesForPath.values())[0];\n const allServerSideModulesImported = /* @__PURE__ */ new Set();\n const newCssModules = [];\n const moduleQueue = Array.from(appModule.importedModules);\n for (const importedModule of moduleQueue) {\n if (allServerSideModulesImported.has(importedModule.id)) {\n continue;\n }\n allServerSideModulesImported.add(importedModule.id);\n const isCss = CSS_LANGS_RE.test(importedModule.file);\n const moduleModulesToQueue = Array.from(importedModule.importedModules);\n if (isCss && !cssModulesImported.has(importedModule)) {\n cssModulesImported.add(importedModule);\n newCssModules.push(importedModule);\n }\n moduleQueue.push(...moduleModulesToQueue);\n }\n return newCssModules;\n};\nfunction createPreloadLink(assetPath, basePath = \"\") {\n if (assetPath && assetPath[0] !== \"/\") {\n assetPath = `/${assetPath}`;\n }\n if (assetPath.endsWith(\".js\")) {\n return `<link rel=\"modulepreload\" crossorigin href=\"${basePath}${assetPath}\">`;\n } else if (CSS_LANGS_RE.test(assetPath)) {\n return `<link rel=\"stylesheet\" href=\"${basePath}${assetPath}?css\">`;\n } else if (assetPath.endsWith(\".woff\")) {\n return ` <link rel=\"preload\" href=\"${basePath}${assetPath}\" as=\"font\" type=\"font/woff\" crossorigin>`;\n } else if (assetPath.endsWith(\".woff2\")) {\n return ` <link rel=\"preload\" href=\"${basePath}${assetPath}\" as=\"font\" type=\"font/woff2\" crossorigin>`;\n } else if (assetPath.endsWith(\".gif\")) {\n return ` <link rel=\"preload\" href=\"${basePath}${assetPath}\" as=\"image\" type=\"image/gif\">`;\n } else if (assetPath.endsWith(\".jpg\") || assetPath.endsWith(\".jpeg\")) {\n return ` <link rel=\"preload\" href=\"${basePath}${assetPath}\" as=\"image\" type=\"image/jpeg\">`;\n } else if (assetPath.endsWith(\".png\")) {\n return ` <link rel=\"preload\" href=\"${basePath}${assetPath}\" as=\"image\" type=\"image/png\">`;\n } else {\n throw new Error(`Unknown preload type for ${assetPath}`);\n }\n}\nconst collectCssInDev = (modulePathToStartWith, viteServer, cssModulesImported = /* @__PURE__ */ new Set()) => {\n return `${collectCssModules(\n modulePathToStartWith,\n viteServer,\n cssModulesImported\n ).map((cssModule) => createPreloadLink(cssModule.url)).join(\"\\n\")}\n`;\n};\nconst badInlineJsChars = /[\\u2028\\u2029<>/]/g;\nconst inlineJsEscapeChars = {\n \"\\u2028\": \"\\\\u2028\",\n \"\\u2029\": \"\\\\u2029\",\n \"<\": \"\\\\u003C\",\n \">\": \"\\\\u003E\",\n \"/\": \"\\\\u002F\"\n};\nfunction escapeChar(unsafeChar) {\n return inlineJsEscapeChars[unsafeChar];\n}\nfunction escapeForInlineJS(input) {\n return input.replace(badInlineJsChars, escapeChar);\n}\nfunction jsonStringifyAndEscapeForInlineJS(input, { baseIndent = 0, jsonIndent = 2, prettyPrint = true } = {}) {\n const indentString = \" \".repeat(baseIndent);\n jsonIndent = prettyPrint ? jsonIndent : void 0;\n return escapeForInlineJS(JSON.stringify(input, null, jsonIndent)).replace(\n /\\n/gm,\n `\n${indentString}`\n );\n}\nlet viteRoot;\nlet viteCommand;\nfunction resolveIslandPlugin(islandsSet) {\n return {\n enforce: \"pre\",\n name: \"resolve-islands\",\n configResolved(config) {\n viteRoot = config.root;\n viteCommand = config.command;\n },\n load(id) {\n if (id.endsWith(\"?island\") || id.endsWith(\"?client\")) {\n const [idWithNoParam] = id.split(\"?\");\n const islandModuleImportPath = `${idWithNoParam}?client-entry`;\n const componentExtension = path.extname(idWithNoParam);\n const componentFilenameWithNoExtension = path.basename(\n idWithNoParam,\n componentExtension\n );\n const modulePath = idWithNoParam.replace(`${viteRoot}/`, \"\");\n const moduleId = (viteCommand === \"serve\" ? idWithNoParam : modulePath).concat(\"?client-entry\");\n if (islandsSet) {\n islandsSet.add(moduleId);\n }\n return `\n const moduleId = '${moduleId}';\n\n const lazyComponent = () => import('${islandModuleImportPath}');\n lazyComponent.moduleName = '${componentFilenameWithNoExtension}';\n lazyComponent.moduleId = moduleId;\n\n export default lazyComponent;\n `;\n }\n return null;\n }\n };\n}\nfunction resolveIslandToPlainModulePlugin(enabled = true) {\n return {\n enforce: \"pre\",\n name: \"resolve-islands-to-plain\",\n configResolved(config) {\n viteRoot = config.root;\n viteCommand = config.command;\n },\n async resolveId(id, importer, options) {\n if (enabled && (id.endsWith(\"?island\") || id.endsWith(\"?client\"))) {\n const newId = id.replace(\"?island\", \"\").replace(\"?client\", \"\");\n const resolution = await this.resolve(newId, importer, {\n skipSelf: true,\n ...options\n });\n if (resolution) {\n return resolution;\n }\n }\n return null;\n }\n };\n}\nfunction resolveIslandToPlainModuleNoopPlugin() {\n return resolveIslandToPlainModulePlugin(false);\n}\nconst clientRenderIsland = \"import type { RenderableIsland } from '@hubspot/cms-components';\\nimport * as cmsComponents from '@hubspot/cms-components';\\nimport { ClientRenderContextProvider } from '@hubspot/cms-components';\\nimport { Suspense } from 'react';\\nimport ReactDOMClient from 'react-dom/client';\\n\\nconst buildIslandIdentifierPrefix =\\n cmsComponents.buildIslandIdentifierPrefix || ((id) => id);\\n\\nexport function clientRenderIsland(\\n renderableIsland: RenderableIsland,\\n Component: React.ComponentType<any>\\n) {\\n const {\\n island,\\n rootElement,\\n postHydration,\\n pageUrl,\\n islands,\\n basePath,\\n WrapperModule,\\n } = renderableIsland;\\n let reactRoot: any;\\n\\n const rootOptions = {\\n // Ensure useId is unique across island roots\\n identifierPrefix: buildIslandIdentifierPrefix(renderableIsland.island.id),\\n };\\n\\n let innerComponent = <Component islandId={island.id} {...island.props} />;\\n if (WrapperModule) {\\n innerComponent = <WrapperModule>{innerComponent}</WrapperModule>;\\n }\\n\\n const elementsToHydrate = (\\n <Suspense fallback={`client hydrate fail/waiting for ${island.id}`}>\\n <ClientRenderContextProvider\\n pageUrl={pageUrl}\\n islands={islands}\\n onTopLevelHydrationFinish={postHydration}\\n island={island}\\n basePath={basePath}\\n >\\n {innerComponent}\\n </ClientRenderContextProvider>\\n </Suspense>\\n );\\n\\n if (island.clientOnly) {\\n reactRoot = ReactDOMClient.createRoot(rootElement, rootOptions);\\n reactRoot.render(elementsToHydrate);\\n } else {\\n reactRoot = ReactDOMClient.hydrateRoot(\\n rootElement,\\n elementsToHydrate,\\n rootOptions\\n );\\n }\\n return reactRoot;\\n}\\n\";\nconst virtualClientRenderIslandModuleId = \"virtual:clientRenderIsland.tsx\";\nfunction clientIslandEntryPlugin() {\n return {\n enforce: \"pre\",\n name: \"client-island-entry-plugin\",\n resolveId(id) {\n if (id === virtualClientRenderIslandModuleId) {\n return virtualClientRenderIslandModuleId;\n }\n return null;\n },\n load(id) {\n if (id.endsWith(\"?client-entry\")) {\n const [idWithNoParam] = id.split(\"?\");\n return `\n import { clientRenderIsland } from '${virtualClientRenderIslandModuleId}';\n import Component from '${idWithNoParam}';\n\n export function render(island) {\n return clientRenderIsland(island, Component)\n }\n\n export default Component;\n `;\n }\n if (id === virtualClientRenderIslandModuleId) {\n return clientRenderIsland;\n }\n return null;\n }\n };\n}\nconst scriptTagToLogServerMessages = (messagesForBrowser, groupLabel, nonceAttribute) => {\n if (!messagesForBrowser) {\n return \"\";\n }\n const consoleLines = [];\n for (const message of messagesForBrowser) {\n let funcString = \"console.log\";\n if (message.level === \"error\") {\n funcString = \"console.error\";\n }\n if (message.level === \"warn\") {\n funcString = \"console.warn\";\n }\n const argString = message.parameters.map((arg) => JSON.stringify(arg)).join(\", \");\n consoleLines.push(` ${funcString}(${argString});`);\n }\n let groupStart = \"\";\n let groupEnd = \"\";\n if (groupLabel !== void 0 && groupLabel !== null) {\n groupStart = `\n console.group(${JSON.stringify(groupLabel)});`;\n groupEnd = ` console.groupEnd()\n`;\n }\n return `<script ${nonceAttribute}>${groupStart}\n${consoleLines.join(\"\\n\")}\n${groupEnd}<\\/script>\n`;\n};\nconst getComponentExtension = (componentPath) => {\n const filteredExtensions = COMPONENT_EXTENSIONS.filter(\n (ext) => componentPath.endsWith(ext)\n );\n if (filteredExtensions.length === 1) {\n return filteredExtensions[0];\n }\n return void 0;\n};\nconst hasComponentExtension = (componentPath) => {\n return !!getComponentExtension(componentPath);\n};\nconst isStorybookStory = (componentPath) => {\n return !!path.basename(componentPath, path.extname(componentPath)).endsWith(\".stories\");\n};\nconst removeComponentExtension = (componentPath) => {\n const ext = getComponentExtension(componentPath);\n if (ext == null) {\n return componentPath;\n }\n return componentPath.slice(0, -1 * ext.length);\n};\nfunction getEntryPointHash(entryPoint) {\n return createHash(\"md5\").update(entryPoint).digest(\"hex\").slice(0, 6);\n}\nfunction getEntryPointHashWithIndexSuffix(entryPoint, index) {\n const renderIndexSuffix = index != null ? `i${index}` : \"\";\n return `${getEntryPointHash(entryPoint)}${renderIndexSuffix}`;\n}\nconst COMBINED_REACT_BASE_PATH = \"https://static.hsappstatic.net/cms-js-static/ex/js/react/v18\";\nconst ISLAND_RUNTIME_CONFIG_BASE_PATH = \"https://static.hsappstatic.net/cms-js-static/ex/js/island-runtime/v1\";\nfunction getCombinedReactUrl() {\n const hsEnv = process.env.HS_ENV;\n const fileVersion = hsEnv === \"prod\" ? `react-combined.mjs` : \"react-combined-qa.mjs\";\n return `${COMBINED_REACT_BASE_PATH}/${fileVersion}`;\n}\nfunction getIslandRuntimeConfigUrl() {\n const hsEnv = process.env.HS_ENV;\n const fileVersion = hsEnv === \"prod\" ? `island-runtime.mjs` : \"island-runtime-qa.mjs\";\n return `${ISLAND_RUNTIME_CONFIG_BASE_PATH}/${fileVersion}`;\n}\nfunction includesHublDataReference(templateSource) {\n const hublDataPattern = /\\{%\\s+set\\s+(experimentalHublData|hublData)\\s*=/;\n return !!templateSource.match(hublDataPattern);\n}\nconst removeIndexFromPath = (id) => {\n return id.replace(/\\/index\\.[jt]sx?$/, \"\");\n};\nconst removeIndexOrTrailingJsFromPath = (id) => {\n return removeIndexFromPath(id).replace(/\\.[jt]sx?$/, \"\");\n};\nconst HEALTHCHECKS_ENABLED_DEFAULT = true;\nconst HEALTHCHECKS_STRICT_DEFAULT = false;\nfunction getCMSAssetConfig(webRoot) {\n const cmsAssetsPath = path.join(webRoot, \"cms-assets.json\");\n const cmsThemePath = path.join(webRoot, \"theme.json\");\n const configPathToUse = fs.existsSync(cmsAssetsPath) ? cmsAssetsPath : cmsThemePath;\n const parsedConfig = JSON.parse(\n fs.readFileSync(configPathToUse).toString()\n );\n return parsedConfig;\n}\nfunction getCMSAssetConfigIfExists(webRoot) {\n try {\n return getCMSAssetConfig(webRoot);\n } catch (e) {\n console.error(\n `Error finding or parsing cms-assets.json in ${webRoot}, but ignoring for now`\n );\n return {};\n }\n}\nfunction areBuildHealthChecksEnabled(config) {\n var _a, _b;\n return ((_b = (_a = config.buildConfig) == null ? void 0 : _a.healthchecks) == null ? void 0 : _b.enabled) ?? HEALTHCHECKS_ENABLED_DEFAULT;\n}\nfunction doHealthChecksFailTheBuild(config) {\n var _a, _b;\n return ((_b = (_a = config.buildConfig) == null ? void 0 : _a.healthchecks) == null ? void 0 : _b.strict) ?? HEALTHCHECKS_STRICT_DEFAULT;\n}\nfunction getServerIncludePrebundleDepPatterns(config) {\n var _a, _b;\n return ((_b = (_a = config.buildConfig) == null ? void 0 : _a.serverPrebundling) == null ? void 0 : _b.include) ?? [];\n}\nconst BUILD_INFO_PATH = \"/build-info.json\";\nfunction getBuildInfo(buildDir) {\n try {\n const buildInfo = JSON.parse(\n readFileSync(path.join(buildDir, BUILD_INFO_PATH)).toString()\n );\n return buildInfo;\n } catch (e) {\n throw new Error(`Error loading build-info.json, path: ${BUILD_INFO_PATH}`);\n }\n}\nfunction getBaseAssetUrlFromBuild(buildDir) {\n return getBuildInfo(buildDir).baseAssetUrl;\n}\nconst GATES = [\n \"CMS:JSRenderer:GetServerSideProps\",\n \"CMS:JSRenderer:ModuleHubl\",\n \"CMS:JSRenderer:RemoveCjsPlugin\",\n \"CMS:JSRenderer:RemoveMockClientEntryPlugin\",\n \"CMS:JSRenderer:AnalyzeCmsModules\"\n];\nconst ENABLED_FEATURES_GATE_MAP = {\n \"cms:jsr:getServerSideProps\": \"CMS:JSRenderer:GetServerSideProps\",\n \"cms:jsr:RemoveCjsPlugin\": \"CMS:JSRenderer:RemoveCjsPlugin\",\n \"cms:jsr:analyzeCmsModules\": \"CMS:JSRenderer:AnalyzeCmsModules\"\n};\nfunction isUngatedFor(gates, gate) {\n return gates.includes(gate);\n}\nfunction ungatedAtBuildTimeFor(buildDir, gate) {\n try {\n const buildInfo = getBuildInfo(buildDir);\n return isUngatedFor(buildInfo.gates, gate);\n } catch (e) {\n return false;\n }\n}\nconst findAllComponentsIn = (webRoot, componentsFolder) => {\n const fullComponentsFolderPath = join(webRoot, componentsFolder);\n const componentsByName = {};\n if (!existsSync(fullComponentsFolderPath)) {\n return componentsByName;\n }\n readdirSync(fullComponentsFolderPath).forEach((fileOrFolderName) => {\n const fullPath = join(fullComponentsFolderPath, fileOrFolderName);\n const subdirPath = join(componentsFolder, fileOrFolderName);\n const isDirectory = lstatSync(fullPath).isDirectory();\n if (!isDirectory && hasComponentExtension(fileOrFolderName) && !isStorybookStory(fileOrFolderName)) {\n const subdirPathNoExtension = removeComponentExtension(subdirPath);\n componentsByName[subdirPathNoExtension] = subdirPath;\n } else if (isDirectory) {\n for (const potentialExtension of COMPONENT_EXTENSIONS) {\n const potentialIndexModule = join(\n subdirPath,\n `index${potentialExtension}`\n );\n const fullPotentialPath = join(\n fullPath,\n `index${potentialExtension}`\n );\n if (existsSync(fullPotentialPath)) {\n const moduleIndexPathNoExtension = removeComponentExtension(potentialIndexModule);\n componentsByName[moduleIndexPathNoExtension] = potentialIndexModule;\n break;\n }\n }\n }\n });\n return componentsByName;\n};\nfunction findAllModulesInRoot(webRoot) {\n const allModuleComponents = findAllComponentsIn(\n webRoot,\n \"./components/modules\"\n );\n const moduleNames = Object.keys(allModuleComponents).map(\n (moduleSubpath) => moduleSubpath.replace(\"components/modules/\", \"\").replace(\"/index\", \"\")\n );\n const moduleSubpaths = Object.keys(allModuleComponents);\n return { moduleNames, moduleSubpaths };\n}\nfunction findAllPartialsInRoot(webRoot) {\n const allPartialComponents = findAllComponentsIn(\n webRoot,\n \"./components/partials\"\n );\n const partialNames = Object.keys(allPartialComponents).map(\n (partialSubpath) => partialSubpath.replace(\"components/partials/\", \"\").replace(\"/index\", \"\")\n );\n const partialSubpaths = Object.keys(allPartialComponents);\n return { partialNames, partialSubpaths };\n}\nfunction namespaceModulePropsShape(props) {\n const {\n dataQueryResult,\n hublParameters,\n fieldValues: passedFieldValues,\n hublData,\n experimentalHublData,\n moduleName,\n supplementalFieldValues\n } = props;\n const oldPropsShape = { ...props };\n if (oldPropsShape.dataQueryResult) {\n delete oldPropsShape.dataQueryResult;\n }\n if (oldPropsShape.hublParameters) {\n delete oldPropsShape.hublParameters;\n }\n const fieldValues = passedFieldValues || oldPropsShape;\n return {\n ...fieldValues,\n dataQueryResult,\n fieldValues,\n hublParameters,\n hublData,\n experimentalHublData,\n moduleName,\n supplementalFieldValues\n };\n}\nfunction setIn(object, nestedKeysArray, value) {\n let curr = object;\n const finalKey = nestedKeysArray.pop();\n for (let index = 0; index < nestedKeysArray.length; index++) {\n const currentKey = nestedKeysArray[index];\n const nextKey = nestedKeysArray[index + 1];\n if (Number.isInteger(nextKey) || !nextKey && Number.isInteger(finalKey)) {\n if (curr[currentKey] === void 0) {\n curr[currentKey] = [];\n }\n }\n if (curr[currentKey] === void 0) {\n curr[currentKey] = {};\n }\n curr = curr[currentKey];\n }\n if (value !== void 0) {\n curr[finalKey] = value;\n }\n}\nfunction isStylesheetAsset(staticAsset) {\n return staticAsset.type === \"stylesheet\";\n}\nexport {\n COMPONENT_EXTENSIONS,\n CSS_LANGS_RE,\n ENABLED_FEATURES_GATE_MAP,\n ENTRY_POINTS_PATH,\n GATES,\n MODULE_FOLDER_PATH,\n VIRTUAL_CONFIG_SETUP,\n VIRTUAL_ISLAND_RUNTIME,\n getBaseAssetUrlFromBuild as a,\n areBuildHealthChecksEnabled,\n clientIslandEntryPlugin,\n collectCssInDev,\n collectCssModules,\n doHealthChecksFailTheBuild,\n escapeForInlineJS,\n findAllComponentsIn,\n findAllModulesInRoot,\n findAllPartialsInRoot,\n getBuildInfo as g,\n getCMSAssetConfig,\n getCMSAssetConfigIfExists,\n getCombinedReactUrl,\n getComponentExtension,\n getEntryPointHash,\n getEntryPointHashWithIndexSuffix,\n getIslandRuntimeConfigUrl,\n getServerIncludePrebundleDepPatterns,\n hasComponentExtension,\n includesHublDataReference,\n isStorybookStory,\n isStylesheetAsset,\n isUngatedFor,\n jsonStringifyAndEscapeForInlineJS,\n namespaceModulePropsShape,\n removeComponentExtension,\n removeIndexFromPath,\n removeIndexOrTrailingJsFromPath,\n resolveIslandPlugin,\n resolveIslandToPlainModuleNoopPlugin,\n resolveIslandToPlainModulePlugin,\n scriptTagToLogServerMessages,\n setIn,\n ungatedAtBuildTimeFor,\n virtualClientRenderIslandModuleId\n};\n", "import { jsonStringifyAndEscapeForInlineJS, scriptTagToLogServerMessages } from \"./basicUtils.js\";\nimport { COMPONENT_EXTENSIONS, CSS_LANGS_RE, ENABLED_FEATURES_GATE_MAP, ENTRY_POINTS_PATH, GATES, MODULE_FOLDER_PATH, VIRTUAL_CONFIG_SETUP, VIRTUAL_ISLAND_RUNTIME, areBuildHealthChecksEnabled, clientIslandEntryPlugin, collectCssInDev, collectCssModules, doHealthChecksFailTheBuild, escapeForInlineJS, findAllComponentsIn, findAllModulesInRoot, findAllPartialsInRoot, a, g, getCMSAssetConfig, getCMSAssetConfigIfExists, getCombinedReactUrl, getComponentExtension, getEntryPointHash, getEntryPointHashWithIndexSuffix, getIslandRuntimeConfigUrl, getServerIncludePrebundleDepPatterns, hasComponentExtension, includesHublDataReference, isStorybookStory, isStylesheetAsset, isUngatedFor, namespaceModulePropsShape, removeComponentExtension, removeIndexFromPath, removeIndexOrTrailingJsFromPath, resolveIslandPlugin, resolveIslandToPlainModuleNoopPlugin, resolveIslandToPlainModulePlugin, setIn, ungatedAtBuildTimeFor, virtualClientRenderIslandModuleId } from \"./basicUtils.js\";\nimport * as dotProp from \"dot-prop\";\nimport * as parser from \"@babel/parser\";\nimport _traverse from \"@babel/traverse\";\nimport * as t from \"@babel/types\";\nimport { jsx } from \"react/jsx-runtime\";\nimport stream from \"stream\";\nimport { renderToPipeableStream, renderToStaticMarkup } from \"react-dom/server\";\nimport * as cmsComponents from \"@hubspot/cms-components\";\nimport { ServerRenderContext } from \"@hubspot/cms-components\";\nimport { isValidElement, cloneElement } from \"react\";\nimport \"path\";\nimport \"crypto\";\nimport \"fs\";\nimport \"path/posix\";\nconst { setProperty, getProperty, hasProperty } = dotProp;\nconst serializeIslandDataForInlineScript = (tweakedIslandsArray, perServerRequestData, baseIndent = 0, prettyPrint) => {\n const islandsArrayToSerialize = tweakedIslandsArray.map(\n ({\n id,\n moduleName,\n moduleId,\n props,\n hydrateOn,\n clientOnly,\n priority,\n url,\n sharedStateID,\n supplementalFieldValues,\n wrapperModuleId,\n wrapperUrl\n }) => {\n const output = {\n id,\n moduleName,\n moduleId,\n hydrateOn,\n clientOnly,\n priority,\n props,\n url\n };\n if (sharedStateID) {\n output.sharedStateID = sharedStateID;\n }\n if (wrapperModuleId) {\n output.wrapperModuleId = wrapperModuleId;\n }\n if (wrapperUrl) {\n output.wrapperUrl = wrapperUrl;\n }\n const filteredSupplementalFieldValues = filterOutUnreadSupplementalFieldValues(\n supplementalFieldValues,\n perServerRequestData.get(\"supplementalFieldValuesRead\")\n );\n if (filteredSupplementalFieldValues) {\n output.supplementalFieldValues = filteredSupplementalFieldValues;\n }\n return output;\n }\n );\n return jsonStringifyAndEscapeForInlineJS(islandsArrayToSerialize, {\n baseIndent,\n jsonIndent: 2,\n prettyPrint\n });\n};\nfunction filterOutUnreadSupplementalFieldValues(supplementalFieldValues, supplementalFieldValuesRead) {\n if (!supplementalFieldValues) {\n return supplementalFieldValues;\n }\n if (!supplementalFieldValuesRead) {\n return supplementalFieldValues;\n }\n const result = {};\n Array.from(supplementalFieldValuesRead).forEach((fieldPath) => {\n if (hasProperty(supplementalFieldValues, fieldPath)) {\n setProperty(\n result,\n fieldPath,\n getProperty(supplementalFieldValues, fieldPath)\n );\n }\n });\n return result;\n}\nconst writeSharedStateToJsGlobal = (islands, perServerRequestData, indent = 0, prettyPrint) => {\n const sharedStateIDs = islands.map((island) => island.sharedStateID).filter((x) => !!x);\n if (sharedStateIDs.length > 0) {\n const indentString = \" \".repeat(indent);\n const stateByID = {};\n sharedStateIDs.forEach(\n (id) => stateByID[id] = perServerRequestData.get(id)\n );\n const stringifiedState = jsonStringifyAndEscapeForInlineJS(stateByID, {\n prettyPrint,\n jsonIndent: 2\n });\n return `\n\nvar newState = ${stringifiedState};\nif(window.__hsSSInit) {\n window.__hsSSInit = Object.assign(window.__hsSSInit, newState);\n} else {\n window.__hsSSInit = newState;\n}`.replace(/\\n/gm, `\n${indentString}`);\n }\n return \"\";\n};\nfunction getIslandUrls(roots, viteDevServer) {\n return roots.map((island) => {\n const islandModule = viteDevServer.moduleGraph.getModuleById(\n island.moduleId\n );\n if (!islandModule) {\n throw new Error(`Unknown island moduleId: ${island.moduleId}`);\n }\n let wrapperModule;\n if (island.wrapperModuleId) {\n wrapperModule = viteDevServer.moduleGraph.getModuleById(\n island.wrapperModuleId\n );\n }\n const tweakedIsland = {\n ...island,\n url: islandModule.url,\n wrapperUrl: wrapperModule ? wrapperModule.url : void 0\n };\n return tweakedIsland;\n });\n}\nfunction getPerServerRequestUrls(perServerRequestData, viteDevServer) {\n if (!perServerRequestData.has(\"sharedStateIDs\")) {\n return new Map(perServerRequestData);\n }\n const perServerRequestDataWithUrls = new Map(\n perServerRequestData\n );\n perServerRequestData.get(\"sharedStateIDs\").forEach((id) => {\n const reducer = perServerRequestData.get(id);\n if (reducer.reducerFuncModuleId) {\n const reducerWithUrl = {\n ...reducer,\n reducerFuncModuleUrl: viteDevServer.moduleGraph.getModuleById(\n reducer.reducerFuncModuleId\n ).url\n };\n perServerRequestDataWithUrls.set(id, reducerWithUrl);\n }\n });\n return perServerRequestDataWithUrls;\n}\nconst createIslandsGlobalJsForClientInDev = (roots, perServerRequestData, viteDevServer, indent, prettyPrint) => {\n const islands = getIslandUrls(roots, viteDevServer);\n const perServerRequestDataWithUrls = getPerServerRequestUrls(\n perServerRequestData,\n viteDevServer\n );\n return `${\" \".repeat(\n indent\n )}window.__islands = ${serializeIslandDataForInlineScript(\n islands,\n perServerRequestData,\n indent,\n prettyPrint\n )}${writeSharedStateToJsGlobal(\n islands,\n perServerRequestDataWithUrls,\n indent,\n prettyPrint\n )}`;\n};\nfunction noncePlaceholderPlugin() {\n const HS_DEPLOYED = process.env.AWS_EXECUTION_ENV != null || process.env.HS_DEPLOYED === \"true\";\n return {\n name: \"hs-nonce-placeholder\",\n enforce: \"post\",\n apply() {\n return HS_DEPLOYED;\n },\n transformIndexHtml(html) {\n const regex = /<(style|script|link) (.*)>/gi;\n const replacer = (_, p1, p2) => {\n if (p1 === \"style\" || p1 === \"script\" || // if link, only nonce for stylesheet\n p1 === \"link\" && p2.includes('rel=\"stylesheet\"')) {\n const noncePlaceholderValue = p1 === \"script\" ? \"hs-random-nonce\" : \"hs-random-style-nonce\";\n p2 = `nonce=\"${noncePlaceholderValue}\" ${p2}`;\n }\n return `<${p1} ${p2}>`;\n };\n return html.replace(regex, replacer);\n }\n };\n}\nconst traverse = _traverse.default;\nconst CMS_MODULE_COMPONENT_NAME = \"UnstableModule\";\nfunction findCmsModules(cmsModules = {}) {\n let config;\n return {\n enforce: \"pre\",\n name: \"findCmsModules\",\n configResolved(resolvedConfig) {\n config = resolvedConfig;\n },\n transform(code, id) {\n const moduleInfo = this.getModuleInfo(id);\n const isExternal = config.command === \"serve\" ? false : moduleInfo.isExternal;\n if (isExternal || !moduleInfo.id.startsWith(config.root) || !code.includes(CMS_MODULE_COMPONENT_NAME)) {\n return null;\n }\n const localCmsModules = {};\n const sourceAst = parser.parse(code, {\n sourceType: \"module\",\n plugins: [\"jsx\", \"typescript\"]\n });\n let unstableModuleLocalName = CMS_MODULE_COMPONENT_NAME;\n const pluginError = this.error.bind(this);\n traverse(sourceAst, {\n ImportDeclaration(path) {\n if (!t.isStringLiteral(path.node.source, {\n value: \"@hubspot/cms-components\"\n })) {\n return null;\n }\n for (const specifier of path.node.specifiers) {\n if (t.isImportSpecifier(specifier) && t.isIdentifier(specifier.imported, {\n name: CMS_MODULE_COMPONENT_NAME\n })) {\n unstableModuleLocalName = specifier.local.name;\n }\n }\n },\n JSXOpeningElement(path) {\n if (!t.isJSXIdentifier(path.node.name, {\n name: unstableModuleLocalName\n }) || path.node.attributes.length !== 2) {\n return null;\n }\n let cmsModuleName;\n let cmsModulePath;\n for (const prop of path.node.attributes) {\n if (t.isJSXAttribute(prop) && t.isJSXIdentifier(prop.name, { name: \"name\" }) && t.isStringLiteral(prop.value)) {\n cmsModuleName = prop.value.value;\n continue;\n }\n if (t.isJSXAttribute(prop) && t.isJSXIdentifier(prop.name, { name: \"path\" }) && t.isStringLiteral(prop.value)) {\n cmsModulePath = prop.value.value;\n continue;\n }\n pluginError(\n new Error(\n `Error: ${id.replace(config.root, \"\")}:${prop.loc.start.line} \"name\" and \"path\" must be primitive strings`\n )\n );\n }\n const cmsModuleProps = {\n name: cmsModuleName,\n path: cmsModulePath\n };\n if (Object.hasOwn(localCmsModules, cmsModuleProps.name)) {\n pluginError(\n new Error(\n `Error: multiple <${CMS_MODULE_COMPONENT_NAME} /> with duplicate name: ${cmsModuleProps.name}`\n )\n );\n }\n localCmsModules[cmsModuleProps.name] = cmsModuleProps;\n }\n });\n return {\n meta: {\n findCmsModules: localCmsModules\n }\n };\n },\n buildEnd(error) {\n if (error)\n throw error;\n const modulesWithCmsModuleUsage = Array.of(\n ...this.getModuleIds()\n ).filter((moduleId) => moduleId.startsWith(config.root)).map((moduleId) => this.getModuleInfo(moduleId)).filter(\n (moduleInfo) => Object.hasOwn(moduleInfo.meta, \"findCmsModules\")\n );\n const moduleToEntryPoints = {};\n for (const moduleWithCmsModuleUsage of modulesWithCmsModuleUsage) {\n moduleToEntryPoints[moduleWithCmsModuleUsage.id] = findEntryPoints(\n this,\n moduleWithCmsModuleUsage\n );\n }\n for (const moduleWithCmsModuleUsage of modulesWithCmsModuleUsage) {\n const usageInModuleEntryPoint = moduleToEntryPoints[moduleWithCmsModuleUsage.id].find((entryPoint) => entryPoint.id.includes(\"/components/modules\"));\n if (usageInModuleEntryPoint) {\n this.error(`\n Error: <${CMS_MODULE_COMPONENT_NAME} /> can only be used in Partials.\n Module: ${usageInModuleEntryPoint.id === moduleWithCmsModuleUsage.id ? usageInModuleEntryPoint.id.replace(config.root, \"\") : `imports: ${moduleWithCmsModuleUsage.id.replace(\n config.root,\n \"\"\n )}, which`} contains a <${CMS_MODULE_COMPONENT_NAME} />\n `);\n }\n }\n const root = config.root;\n for (const moduleWithCmsModuleUsage of modulesWithCmsModuleUsage) {\n const islandsContainingCmsModuleUsage = checkModuleTreeForIslands(\n this,\n moduleWithCmsModuleUsage\n );\n if (islandsContainingCmsModuleUsage.length > 0) {\n throw new Error(`\n <${CMS_MODULE_COMPONENT_NAME} /> cannot be used within islands.\n ${formatIslandImporter(\n moduleWithCmsModuleUsage.id,\n root\n )} uses <${CMS_MODULE_COMPONENT_NAME} /> and is used by islands:\n ${islandsContainingCmsModuleUsage.map(\n (islandModuleInfo) => formatIslandImporter(islandModuleInfo.id, root)\n ).join(\", \")}\n `);\n }\n }\n for (const moduleWithCmsModuleUsage of modulesWithCmsModuleUsage) {\n const entryPoints = moduleToEntryPoints[moduleWithCmsModuleUsage.id];\n for (const entryPoint of entryPoints) {\n const relativeEntryPoint = entryPoint.id.replace(root, \"\");\n if (!Object.hasOwn(cmsModules, relativeEntryPoint)) {\n cmsModules[relativeEntryPoint] = {};\n }\n for (const [cmsModuleName, cmsModuleValue] of Object.entries(\n moduleWithCmsModuleUsage.meta.findCmsModules\n )) {\n if (Object.hasOwn(cmsModules[relativeEntryPoint], cmsModuleName)) {\n this.error(`Error: duplicate module name: ${cmsModuleName}`);\n }\n cmsModules[relativeEntryPoint][cmsModuleName] = cmsModuleValue;\n }\n }\n }\n }\n };\n}\nfunction findEntryPoints(ctx, moduleInfo) {\n if (moduleInfo.isEntry) {\n return [moduleInfo];\n }\n const result = [];\n for (const importer of moduleInfo.importers) {\n const importerModuleInfo = ctx.getModuleInfo(importer);\n const entryPoints = findEntryPoints(ctx, importerModuleInfo);\n result.push(...entryPoints);\n }\n return result;\n}\nfunction checkModuleTreeForIslands(ctx, module) {\n if (module.id.endsWith(\"?client-entry\")) {\n return [module];\n }\n const importerResults = [];\n for (const importer of module.importers) {\n const importerInfo = ctx.getModuleInfo(importer);\n const importerResult = checkModuleTreeForIslands(ctx, importerInfo);\n importerResults.push(importerResult);\n }\n return importerResults.flat();\n}\nfunction formatIslandImporter(id, root) {\n return id.replace(root, \"\").replace(\"?client-entry\", \"\");\n}\nconst promiseForNewWritableStream = () => {\n const chunks = [];\n const writableStream = new stream.Writable();\n writableStream._write = (chunk, encoding, done) => {\n chunks.push(Buffer.from(chunk));\n done();\n };\n const streamDonePromise = new Promise((resolve, reject) => {\n writableStream.on(\"error\", (error) => {\n reject(error);\n });\n writableStream._final = (done) => {\n resolve(Buffer.concat(chunks).toString(\"utf8\"));\n done();\n };\n });\n return { streamDonePromise, writableStream };\n};\nconst renderStreamToPromise = async (reactElements, options) => {\n const { streamDonePromise, writableStream } = promiseForNewWritableStream();\n const {\n pipe\n /* abort */\n } = renderToPipeableStream(reactElements, {\n ...options || {},\n onShellReady() {\n },\n onAllReady() {\n pipe(writableStream);\n if (options == null ? void 0 : options.onAllReady) {\n options.onAllReady();\n }\n }\n });\n return streamDonePromise;\n};\nconst {\n createServerRenderContextV2,\n createServerRenderContext,\n renderServerSidePropsWithAsyncLocalStoreContext\n} = cmsComponents;\nconst bootStrapRenderContext = () => {\n const renderContext = createServerRenderContextV2 ? createServerRenderContextV2(null, {\n environmentConfig: null,\n entryPointBasePath: \"\",\n supplementalFieldValues: {},\n messagesForBrowser: []\n }) : createServerRenderContext(\"\", null);\n return renderContext;\n};\nasync function renderComponentOnServer(Component, propsAndDeps, pageUrl, environmentConfig, entryPointBasePath, contextOptions, renderOptions, getServerSideProps) {\n const { props } = propsAndDeps;\n const componentDebugName = Component.displayName || Component.name;\n const supplementalFieldValues = contextOptions == null ? void 0 : contextOptions.supplementalFieldValues;\n const messagesForBrowser = contextOptions == null ? void 0 : contextOptions.messagesForBrowser;\n const renderContext = cmsComponents.createServerRenderContextV2 ? cmsComponents.createServerRenderContextV2(pageUrl, {\n environmentConfig,\n entryPointBasePath,\n supplementalFieldValues,\n messagesForBrowser\n }) : cmsComponents.createServerRenderContext(pageUrl, environmentConfig);\n if (getServerSideProps !== void 0 && typeof getServerSideProps === \"function\") {\n const gSSPResult = await renderServerSidePropsWithAsyncLocalStoreContext(\n getServerSideProps,\n propsAndDeps,\n renderContext\n );\n if (gSSPResult) {\n props.serverSideProps = gSSPResult.serverSideProps;\n }\n }\n return renderOnServer(\n /* @__PURE__ */ jsx(Component, { ...props }),\n renderContext,\n componentDebugName,\n renderOptions\n );\n}\nasync function renderOnServer(elements, renderContext = bootStrapRenderContext(), debugName, renderOptions) {\n let html = await renderStreamToPromise(\n /* @__PURE__ */ jsx(ServerRenderContext.Provider, { value: renderContext, children: elements }),\n renderOptions\n );\n if (renderContext.messagesForBrowser.length > 0) {\n html = `${html}${scriptTagToLogServerMessages(\n renderContext.messagesForBrowser,\n `Server messages rendering: ${debugName}`\n )}`;\n }\n return { html, renderContext };\n}\nfunction getServerGlobalsToInject(environmentConfig, hsServerPageUrl, hsBasePath, prettyPrint, criticalDevErrors, includeNonces) {\n if (prettyPrint === void 0 && hsServerPageUrl && cmsComponents.isDebugUrlString) {\n prettyPrint = cmsComponents.isDebugUrlString(hsServerPageUrl);\n }\n const serializedJson = jsonStringifyAndEscapeForInlineJS(\n environmentConfig.toJSON(),\n { baseIndent: 6, prettyPrint }\n );\n const globals = [`window.__hsEnvConfig = ${serializedJson};`];\n if (hsServerPageUrl) {\n globals.push(\n `window.__hsServerPageUrl = ${jsonStringifyAndEscapeForInlineJS(\n hsServerPageUrl\n )};`\n );\n }\n if (hsBasePath) {\n globals.push(\n `window.__hsBasePath = ${jsonStringifyAndEscapeForInlineJS(hsBasePath)};`\n );\n }\n if (!environmentConfig.getIsDeployed() && (criticalDevErrors == null ? void 0 : criticalDevErrors.length)) {\n const firstCriticalDevError = criticalDevErrors[0];\n globals.push(`\n customElements.whenDefined('vite-error-overlay').then(() => {\n const ErrorOverlay = customElements.get('vite-error-overlay');\n const error = new Error(${jsonStringifyAndEscapeForInlineJS(\n firstCriticalDevError.message\n )});\n const overlay = new ErrorOverlay(error);\n\n document.body.appendChild(overlay);\n })\n `);\n }\n const nonceAttr = includeNonces && cmsComponents.SCRIPT_NONCE_PLACEHOLDER ? ` nonce=\"${cmsComponents.SCRIPT_NONCE_PLACEHOLDER}\"` : \"\";\n return `\n <script type=\"text/javascript\"${nonceAttr}>\n ${globals.join(\"\\n \")}\n <\\/script>\n `;\n}\nfunction renderFieldsJSX(fieldsJSX) {\n let moduleJson;\n const outputCallback = (callbackJson) => {\n moduleJson = callbackJson;\n };\n renderToStaticMarkup(\n cloneElement(fieldsJSX, {\n outputCallback\n })\n );\n if (!moduleJson) {\n throw new Error(\"couldn't render module fields definition to fields.json\");\n }\n return moduleJson;\n}\nfunction renderFieldsToJson(fields, moduleName) {\n let fieldsJSON;\n try {\n if (isValidElement(fields)) {\n fieldsJSON = renderFieldsJSX(fields);\n } else if (Array.isArray(fields)) {\n fieldsJSON = fields;\n } else {\n throw new Error(\n `Couldn't recognize \\`fields\\` value for module ${moduleName}`\n );\n }\n return fieldsJSON;\n } catch (e) {\n e.message = `Error when rendering fields for ${moduleName}: ${e.message}`;\n throw e;\n }\n}\nexport {\n COMPONENT_EXTENSIONS,\n CSS_LANGS_RE,\n ENABLED_FEATURES_GATE_MAP,\n ENTRY_POINTS_PATH,\n GATES,\n MODULE_FOLDER_PATH,\n VIRTUAL_CONFIG_SETUP,\n VIRTUAL_ISLAND_RUNTIME,\n areBuildHealthChecksEnabled,\n clientIslandEntryPlugin,\n collectCssInDev,\n collectCssModules,\n createIslandsGlobalJsForClientInDev,\n doHealthChecksFailTheBuild,\n escapeForInlineJS,\n findAllComponentsIn,\n findAllModulesInRoot,\n findAllPartialsInRoot,\n findCmsModules,\n a as getBaseAssetUrlFromBuild,\n g as getBuildInfo,\n getCMSAssetConfig,\n getCMSAssetConfigIfExists,\n getCombinedReactUrl,\n getComponentExtension,\n getEntryPointHash,\n getEntryPointHashWithIndexSuffix,\n getIslandRuntimeConfigUrl,\n getIslandUrls,\n getServerGlobalsToInject,\n getServerIncludePrebundleDepPatterns,\n hasComponentExtension,\n includesHublDataReference,\n isStorybookStory,\n isStylesheetAsset,\n isUngatedFor,\n jsonStringifyAndEscapeForInlineJS,\n namespaceModulePropsShape,\n noncePlaceholderPlugin,\n removeComponentExtension,\n removeIndexFromPath,\n removeIndexOrTrailingJsFromPath,\n renderComponentOnServer,\n renderFieldsToJson,\n renderOnServer,\n renderStreamToPromise,\n resolveIslandPlugin,\n resolveIslandToPlainModuleNoopPlugin,\n resolveIslandToPlainModulePlugin,\n scriptTagToLogServerMessages,\n serializeIslandDataForInlineScript,\n setIn,\n ungatedAtBuildTimeFor,\n virtualClientRenderIslandModuleId\n};\n", "import { Plugin, ViteDevServer } from 'vite';\n\nexport default function devSecretsPlugin(secretNames: Array<string>): Plugin {\n return {\n name: 'dev-secrets',\n configureServer: {\n order: 'post',\n async handler(server: ViteDevServer) {\n const cmsComponents = await server.ssrLoadModule(\n '@hubspot/cms-components'\n );\n\n if (cmsComponents.setSecretsFromEnv) {\n console.log(\n `Attempting to load HS_* secrets from .env: ${secretNames}`\n );\n cmsComponents.setSecretsFromEnv(secretNames);\n } else if (secretNames.length > 0) {\n console.warn(\n 'Not loading secrets into the local environment. Make sure that your @hubspot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