@hubspot/cms-dev-server 0.10.2 → 0.10.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/run.js +4 -34
- package/package.json +3 -3
package/dist/run.js
CHANGED
|
@@ -136,7 +136,6 @@ import { ServerRenderContext } from "@hubspot/cms-components";
|
|
|
136
136
|
import { createHash } from "crypto";
|
|
137
137
|
import { readFileSync, existsSync, readdirSync, lstatSync } from "fs";
|
|
138
138
|
import { join } from "path/posix";
|
|
139
|
-
import { isValidElement, cloneElement } from "react";
|
|
140
139
|
var COMPONENT_EXTENSIONS = [".jsx", ".tsx", ".js", ".ts"];
|
|
141
140
|
var ENTRY_POINTS_PATH = "components/partials/";
|
|
142
141
|
var MODULE_FOLDER_PATH = "components/modules/";
|
|
@@ -564,39 +563,6 @@ function setIn(object, nestedKeysArray, value) {
|
|
|
564
563
|
curr[finalKey] = value;
|
|
565
564
|
}
|
|
566
565
|
}
|
|
567
|
-
function renderFieldsJSX(fieldsJSX) {
|
|
568
|
-
let moduleJson;
|
|
569
|
-
const outputCallback = (callbackJson) => {
|
|
570
|
-
moduleJson = callbackJson;
|
|
571
|
-
};
|
|
572
|
-
renderToStaticMarkup(
|
|
573
|
-
cloneElement(fieldsJSX, {
|
|
574
|
-
outputCallback
|
|
575
|
-
})
|
|
576
|
-
);
|
|
577
|
-
if (!moduleJson) {
|
|
578
|
-
throw new Error("couldn't render module fields definition to fields.json");
|
|
579
|
-
}
|
|
580
|
-
return moduleJson;
|
|
581
|
-
}
|
|
582
|
-
function renderFieldsToJson(fields, moduleName) {
|
|
583
|
-
let fieldsJSON;
|
|
584
|
-
try {
|
|
585
|
-
if (isValidElement(fields)) {
|
|
586
|
-
fieldsJSON = renderFieldsJSX(fields);
|
|
587
|
-
} else if (Array.isArray(fields)) {
|
|
588
|
-
fieldsJSON = fields;
|
|
589
|
-
} else {
|
|
590
|
-
throw new Error(
|
|
591
|
-
`Couldn't recognize \`fields\` value for module ${moduleName}`
|
|
592
|
-
);
|
|
593
|
-
}
|
|
594
|
-
return fieldsJSON;
|
|
595
|
-
} catch (e) {
|
|
596
|
-
e.message = `Error when rendering fields for ${moduleName}: ${e.message}`;
|
|
597
|
-
throw e;
|
|
598
|
-
}
|
|
599
|
-
}
|
|
600
566
|
|
|
601
567
|
// src/lib/moduleGraph.ts
|
|
602
568
|
var findFullPathInModuleGraph = (modulePathNoExtension, moduleGraph) => {
|
|
@@ -1100,6 +1066,10 @@ async function renderModule(viteServer, requestedModulePath, moduleProps, pageUr
|
|
|
1100
1066
|
} else if (!meta) {
|
|
1101
1067
|
throw new Error(`Module does not have a named meta export: ${foundPath}`);
|
|
1102
1068
|
}
|
|
1069
|
+
const internalSsrPath = packagePath(import.meta.url, "internalSsr");
|
|
1070
|
+
const { renderFieldsToJson } = await viteServer.ssrLoadModule(
|
|
1071
|
+
internalSsrPath
|
|
1072
|
+
);
|
|
1103
1073
|
const fieldsJSON = renderFieldsToJson(fields, requestedModulePath);
|
|
1104
1074
|
const fieldValues = getFieldValuesForModule(fieldsJSON, fieldOverrides);
|
|
1105
1075
|
if (componentModule.query && typeof componentModule.query === "string") {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hubspot/cms-dev-server",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.3",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@hubspot/cli-lib": "^3.0.12",
|
|
28
|
-
"@hubspot/cms-components": "^0.10.
|
|
28
|
+
"@hubspot/cms-components": "^0.10.3",
|
|
29
29
|
"@originjs/vite-plugin-commonjs": "^1.0.3",
|
|
30
30
|
"@storybook/addon-actions": "7.0.7",
|
|
31
31
|
"@storybook/addon-essentials": "7.0.7",
|
|
@@ -101,5 +101,5 @@
|
|
|
101
101
|
"publishConfig": {
|
|
102
102
|
"access": "public"
|
|
103
103
|
},
|
|
104
|
-
"gitHead": "
|
|
104
|
+
"gitHead": "591c553dc1f6afbedfaf622f2c90744f7a7601bb"
|
|
105
105
|
}
|