@hubspot/cms-dev-server 1.0.19 → 1.0.20
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/app/assets/index-CcBj6IXI.js +164 -0
- package/dist/app/assets/index-yaZ-s2DZ.css +1 -0
- package/dist/app/index.html +2 -2
- package/dist/app/server/serverEntry.js +113 -33
- package/dist/generateJsonFromJsx.js +1 -1
- package/dist/index.js +8 -73
- package/dist/internalSsr.js +6 -71
- package/dist/run.js +8 -73
- package/dist/storybook/index.js +1 -1
- package/dist/storybook-main/main.js +10 -75
- package/package.json +4 -3
- package/types/constants/errors.d.ts +5 -0
- package/types/createAppViteConfig.d.ts +2 -0
- package/types/lib/cli.d.ts +22 -0
- package/types/lib/cliUtils.d.ts +14 -0
- package/types/lib/constants.d.ts +1 -0
- package/types/routes/api.d.ts +2 -0
- package/types/routes/appServerApiRouteHandler.d.ts +5 -0
- package/types/routes/appServerRoutes.d.ts +5 -0
- package/types/storybook-main/preview.d.ts +9 -0
- package/dist/app/assets/index-BROXLRNa.js +0 -154
- package/dist/app/assets/index-C0KdU9bk.css +0 -1
- package/types/lib/viteAssetHandler.d.ts +0 -15
- package/types/plugins/hubspotStaticAssetPlugin.d.ts +0 -2
- package/types/plugins/remoteAssetsPlugin.d.ts +0 -7
package/dist/run.js
CHANGED
|
@@ -811,7 +811,7 @@ function packagePath(metaUrl, projectPath) {
|
|
|
811
811
|
);
|
|
812
812
|
}
|
|
813
813
|
|
|
814
|
-
// ../cms-js-internal/dist/types-
|
|
814
|
+
// ../cms-js-internal/dist/types-CtlqY6u0.js
|
|
815
815
|
import path3 from "path";
|
|
816
816
|
import { createHash } from "crypto";
|
|
817
817
|
import fs2, { readFileSync, existsSync as existsSync2, readdirSync, lstatSync } from "fs";
|
|
@@ -819,64 +819,6 @@ import { join as join2 } from "path/posix";
|
|
|
819
819
|
var COMPONENT_EXTENSIONS = [".jsx", ".tsx", ".js", ".ts"];
|
|
820
820
|
var ENTRY_POINTS_PATH = "components/partials/";
|
|
821
821
|
var MODULE_FOLDER_PATH = "components/modules/";
|
|
822
|
-
function sortKeys(input, options = {}) {
|
|
823
|
-
const { deep, compare } = options;
|
|
824
|
-
const cache = /* @__PURE__ */ new WeakMap();
|
|
825
|
-
function deepSortArray(array) {
|
|
826
|
-
const resultFromCache = cache.get(array);
|
|
827
|
-
if (resultFromCache !== void 0) {
|
|
828
|
-
return resultFromCache;
|
|
829
|
-
}
|
|
830
|
-
const result = [];
|
|
831
|
-
cache.set(array, result);
|
|
832
|
-
result.push(
|
|
833
|
-
...array.map((item) => {
|
|
834
|
-
if (Array.isArray(item)) {
|
|
835
|
-
return deepSortArray(item);
|
|
836
|
-
}
|
|
837
|
-
if (isPlainObject(item)) {
|
|
838
|
-
return _sortKeys(item);
|
|
839
|
-
}
|
|
840
|
-
return item;
|
|
841
|
-
})
|
|
842
|
-
);
|
|
843
|
-
return result;
|
|
844
|
-
}
|
|
845
|
-
function _sortKeys(object) {
|
|
846
|
-
const resultFromCache = cache.get(object);
|
|
847
|
-
if (resultFromCache !== void 0) {
|
|
848
|
-
return resultFromCache;
|
|
849
|
-
}
|
|
850
|
-
const result = {};
|
|
851
|
-
const keys = Object.keys(object).sort(compare);
|
|
852
|
-
cache.set(object, result);
|
|
853
|
-
for (const key of keys) {
|
|
854
|
-
const value = object[key];
|
|
855
|
-
let newValue;
|
|
856
|
-
if (deep && Array.isArray(value)) {
|
|
857
|
-
newValue = deepSortArray(value);
|
|
858
|
-
} else {
|
|
859
|
-
newValue = deep && isPlainObject(value) ? _sortKeys(value) : value;
|
|
860
|
-
}
|
|
861
|
-
Object.defineProperty(result, key, {
|
|
862
|
-
...Object.getOwnPropertyDescriptor(object, key),
|
|
863
|
-
value: newValue
|
|
864
|
-
});
|
|
865
|
-
}
|
|
866
|
-
return result;
|
|
867
|
-
}
|
|
868
|
-
if (Array.isArray(input)) {
|
|
869
|
-
return deep ? deepSortArray(input) : [...input];
|
|
870
|
-
}
|
|
871
|
-
return _sortKeys(input);
|
|
872
|
-
}
|
|
873
|
-
function isPlainObject(value) {
|
|
874
|
-
if (typeof value !== "object" || value === null) {
|
|
875
|
-
return false;
|
|
876
|
-
}
|
|
877
|
-
const prototype = Object.getPrototypeOf(value);
|
|
878
|
-
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);
|
|
879
|
-
}
|
|
880
822
|
var badInlineJsChars = /[\u2028\u2029<>/]/g;
|
|
881
823
|
var inlineJsEscapeChars = {
|
|
882
824
|
"\u2028": "\\u2028",
|
|
@@ -894,18 +836,11 @@ function escapeForInlineJS(input) {
|
|
|
894
836
|
function jsonStringifyAndEscapeForInlineJS(input, { baseIndent = 0, jsonIndent = 2, prettyPrint = true } = {}) {
|
|
895
837
|
const indentString = " ".repeat(baseIndent);
|
|
896
838
|
jsonIndent = prettyPrint ? jsonIndent : void 0;
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
} catch (e) {
|
|
903
|
-
console.error("Error sorting Island keys", e);
|
|
904
|
-
}
|
|
905
|
-
return escapeForInlineJS(
|
|
906
|
-
JSON.stringify(sorted ?? input, null, jsonIndent)
|
|
907
|
-
).replace(/\n/gm, `
|
|
908
|
-
${indentString}`);
|
|
839
|
+
return escapeForInlineJS(JSON.stringify(input, null, jsonIndent)).replace(
|
|
840
|
+
/\n/gm,
|
|
841
|
+
`
|
|
842
|
+
${indentString}`
|
|
843
|
+
);
|
|
909
844
|
}
|
|
910
845
|
var viteRoot;
|
|
911
846
|
var viteCommand;
|
|
@@ -2166,7 +2101,7 @@ function trackUsage(action) {
|
|
|
2166
2101
|
eventName: EVENT_NAME,
|
|
2167
2102
|
action,
|
|
2168
2103
|
nodeVersion: getNodeVersionData(),
|
|
2169
|
-
version: "1.0.
|
|
2104
|
+
version: "1.0.20",
|
|
2170
2105
|
os: getPlatform()
|
|
2171
2106
|
};
|
|
2172
2107
|
const url3 = isAuthedWithPersonalAccessKey ? DEV_SERVER_USAGE_ENDPOINT_AUTHENTICATED : DEV_SERVER_USAGE_ENDPOINT;
|
|
@@ -5005,7 +4940,7 @@ var createViteDevServer_default = createViteDevServer;
|
|
|
5005
4940
|
import fs4 from "node:fs";
|
|
5006
4941
|
var templateTypeMap = {
|
|
5007
4942
|
// Standard templates
|
|
5008
|
-
4: "
|
|
4943
|
+
4: "Page",
|
|
5009
4944
|
2: "Email",
|
|
5010
4945
|
42: "Blog Listing",
|
|
5011
4946
|
41: "Blog Post",
|
package/dist/storybook/index.js
CHANGED
|
@@ -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/types-
|
|
11
|
+
// ../cms-js-internal/dist/types-CtlqY6u0.js
|
|
12
12
|
import path from "path";
|
|
13
13
|
import { createHash } from "crypto";
|
|
14
14
|
import fs, { readFileSync, existsSync, readdirSync, lstatSync } from "fs";
|
|
@@ -35,64 +35,6 @@ function createPreloadLink(assetPath, basePath = "") {
|
|
|
35
35
|
throw new Error(`Unknown preload type for ${assetPath}`);
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
function sortKeys(input, options = {}) {
|
|
39
|
-
const { deep, compare } = options;
|
|
40
|
-
const cache = /* @__PURE__ */ new WeakMap();
|
|
41
|
-
function deepSortArray(array) {
|
|
42
|
-
const resultFromCache = cache.get(array);
|
|
43
|
-
if (resultFromCache !== void 0) {
|
|
44
|
-
return resultFromCache;
|
|
45
|
-
}
|
|
46
|
-
const result = [];
|
|
47
|
-
cache.set(array, result);
|
|
48
|
-
result.push(
|
|
49
|
-
...array.map((item) => {
|
|
50
|
-
if (Array.isArray(item)) {
|
|
51
|
-
return deepSortArray(item);
|
|
52
|
-
}
|
|
53
|
-
if (isPlainObject(item)) {
|
|
54
|
-
return _sortKeys(item);
|
|
55
|
-
}
|
|
56
|
-
return item;
|
|
57
|
-
})
|
|
58
|
-
);
|
|
59
|
-
return result;
|
|
60
|
-
}
|
|
61
|
-
function _sortKeys(object) {
|
|
62
|
-
const resultFromCache = cache.get(object);
|
|
63
|
-
if (resultFromCache !== void 0) {
|
|
64
|
-
return resultFromCache;
|
|
65
|
-
}
|
|
66
|
-
const result = {};
|
|
67
|
-
const keys = Object.keys(object).sort(compare);
|
|
68
|
-
cache.set(object, result);
|
|
69
|
-
for (const key of keys) {
|
|
70
|
-
const value = object[key];
|
|
71
|
-
let newValue;
|
|
72
|
-
if (deep && Array.isArray(value)) {
|
|
73
|
-
newValue = deepSortArray(value);
|
|
74
|
-
} else {
|
|
75
|
-
newValue = deep && isPlainObject(value) ? _sortKeys(value) : value;
|
|
76
|
-
}
|
|
77
|
-
Object.defineProperty(result, key, {
|
|
78
|
-
...Object.getOwnPropertyDescriptor(object, key),
|
|
79
|
-
value: newValue
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
return result;
|
|
83
|
-
}
|
|
84
|
-
if (Array.isArray(input)) {
|
|
85
|
-
return deep ? deepSortArray(input) : [...input];
|
|
86
|
-
}
|
|
87
|
-
return _sortKeys(input);
|
|
88
|
-
}
|
|
89
|
-
function isPlainObject(value) {
|
|
90
|
-
if (typeof value !== "object" || value === null) {
|
|
91
|
-
return false;
|
|
92
|
-
}
|
|
93
|
-
const prototype = Object.getPrototypeOf(value);
|
|
94
|
-
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);
|
|
95
|
-
}
|
|
96
38
|
function escapeChar(unsafeChar) {
|
|
97
39
|
return inlineJsEscapeChars[unsafeChar];
|
|
98
40
|
}
|
|
@@ -102,18 +44,11 @@ function escapeForInlineJS(input) {
|
|
|
102
44
|
function jsonStringifyAndEscapeForInlineJS(input, { baseIndent = 0, jsonIndent = 2, prettyPrint = true } = {}) {
|
|
103
45
|
const indentString = " ".repeat(baseIndent);
|
|
104
46
|
jsonIndent = prettyPrint ? jsonIndent : void 0;
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
} catch (e) {
|
|
111
|
-
console.error("Error sorting Island keys", e);
|
|
112
|
-
}
|
|
113
|
-
return escapeForInlineJS(
|
|
114
|
-
JSON.stringify(sorted ?? input, null, jsonIndent)
|
|
115
|
-
).replace(/\n/gm, `
|
|
116
|
-
${indentString}`);
|
|
47
|
+
return escapeForInlineJS(JSON.stringify(input, null, jsonIndent)).replace(
|
|
48
|
+
/\n/gm,
|
|
49
|
+
`
|
|
50
|
+
${indentString}`
|
|
51
|
+
);
|
|
117
52
|
}
|
|
118
53
|
function resolveIslandPlugin(islandsSet) {
|
|
119
54
|
return {
|
|
@@ -378,8 +313,8 @@ function isStylesheetAsset(staticAsset) {
|
|
|
378
313
|
return staticAsset.type === "stylesheet";
|
|
379
314
|
}
|
|
380
315
|
var COMPONENT_EXTENSIONS, ENTRY_POINTS_PATH, MODULE_FOLDER_PATH, TEMPLATE_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;
|
|
381
|
-
var
|
|
382
|
-
"../cms-js-internal/dist/types-
|
|
316
|
+
var init_types_CtlqY6u0 = __esm({
|
|
317
|
+
"../cms-js-internal/dist/types-CtlqY6u0.js"() {
|
|
383
318
|
COMPONENT_EXTENSIONS = [".jsx", ".tsx", ".js", ".ts"];
|
|
384
319
|
ENTRY_POINTS_PATH = "components/partials/";
|
|
385
320
|
MODULE_FOLDER_PATH = "components/modules/";
|
|
@@ -1163,8 +1098,8 @@ function ModuleSlot(props) {
|
|
|
1163
1098
|
var setProperty, getProperty, hasProperty, serializeIslandDataForInlineScript, writeSharedStateToJsGlobal, createIslandsGlobalJsForClientInDev, traverse, CMS_MODULE_COMPONENT_NAME, DND_AREA_COMPONENT_NAME, PLUGIN_NAME, promiseForNewWritableStream, renderStreamToPromise, createServerRenderContextV22, createServerRenderContext2, renderServerSidePropsWithAsyncLocalStoreContext, bootStrapRenderContext;
|
|
1164
1099
|
var init_dist = __esm({
|
|
1165
1100
|
"../cms-js-internal/dist/index.js"() {
|
|
1166
|
-
|
|
1167
|
-
|
|
1101
|
+
init_types_CtlqY6u0();
|
|
1102
|
+
init_types_CtlqY6u0();
|
|
1168
1103
|
({ setProperty, getProperty, hasProperty } = dotProp);
|
|
1169
1104
|
serializeIslandDataForInlineScript = (tweakedIslandsArray, perServerRequestData, baseIndent = 0, prettyPrint, isUngatedForClientOnlySupplementalFieldSerialization = false) => {
|
|
1170
1105
|
const islandsArrayToSerialize = tweakedIslandsArray.map(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hubspot/cms-dev-server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.20",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -29,13 +29,14 @@
|
|
|
29
29
|
"@babel/parser": "^7.25.3",
|
|
30
30
|
"@babel/traverse": "^7.25.3",
|
|
31
31
|
"@babel/types": "^7.25.2",
|
|
32
|
-
"@hubspot/cms-components": "^1.0.
|
|
32
|
+
"@hubspot/cms-components": "^1.0.20",
|
|
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",
|
|
36
36
|
"@radix-ui/react-dialog": "^1.1.2",
|
|
37
37
|
"@radix-ui/react-separator": "^1.1.0",
|
|
38
38
|
"@radix-ui/react-slot": "^1.1.0",
|
|
39
|
+
"@radix-ui/react-toggle": "^1.1.3",
|
|
39
40
|
"@radix-ui/react-tooltip": "^1.1.4",
|
|
40
41
|
"@sentry/node": "^6.2.0",
|
|
41
42
|
"@storybook/addon-actions": "7.1.1",
|
|
@@ -131,5 +132,5 @@
|
|
|
131
132
|
"publishConfig": {
|
|
132
133
|
"access": "public"
|
|
133
134
|
},
|
|
134
|
-
"gitHead": "
|
|
135
|
+
"gitHead": "cc89fdd07cbee009581753d7ace91cd7edb95d46"
|
|
135
136
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
+
export declare function getDevServerCommandLineOptions(argv: NodeJS.Process['argv']): {
|
|
3
|
+
hubspotCliConfigPathOption: string;
|
|
4
|
+
hubspotCliAccountNameOption: string;
|
|
5
|
+
sslEnabledOption: boolean;
|
|
6
|
+
storybook: boolean;
|
|
7
|
+
fieldGenEnabledOption: boolean;
|
|
8
|
+
webRoot: string;
|
|
9
|
+
resetSession: boolean;
|
|
10
|
+
};
|
|
11
|
+
export declare function buildThemePreviewOptions(webRoot: string): Promise<{
|
|
12
|
+
filePaths: string[];
|
|
13
|
+
startProgressBar: (numFiles: any) => {
|
|
14
|
+
onAttemptCallback: () => void;
|
|
15
|
+
onSuccessCallback: () => void;
|
|
16
|
+
onFirstErrorCallback: () => void;
|
|
17
|
+
onRetryCallback: () => void;
|
|
18
|
+
onFinalErrorCallback: () => any;
|
|
19
|
+
onFinishCallback: (results: any) => void;
|
|
20
|
+
};
|
|
21
|
+
dest: any;
|
|
22
|
+
}>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare function determineSrcAndDest(): Promise<{
|
|
2
|
+
absoluteSrc: any;
|
|
3
|
+
dest: any;
|
|
4
|
+
}>;
|
|
5
|
+
export declare function getUploadableFileList(src: any, convertFields: any): Promise<any[]>;
|
|
6
|
+
export declare function fieldsJsPrompt(filePath: any, projectDir: any, skipFiles?: any[]): Promise<any[]>;
|
|
7
|
+
export declare function logError(error: any, context?: {}): void;
|
|
8
|
+
export declare class ApiErrorContext {
|
|
9
|
+
accountId: any;
|
|
10
|
+
request: any;
|
|
11
|
+
payload: any;
|
|
12
|
+
projectName: any;
|
|
13
|
+
constructor(props?: any);
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const templateTypeMap: Record<number, string>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Request, Response, NextFunction } from 'express';
|
|
2
|
+
export declare function handleGetModulePages(req: Request, res: Response, next: NextFunction): Promise<Response<any, Record<string, any>>>;
|
|
3
|
+
export declare function handleOpenFile(req: Request, res: Response, next: NextFunction): Response<any, Record<string, any>>;
|
|
4
|
+
export declare function appServerApiRouteHandler(): import("express-serve-static-core").Router;
|
|
5
|
+
export default appServerApiRouteHandler;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Request, Response, NextFunction } from 'express';
|
|
2
|
+
export declare function handleGetModulePages(req: Request, res: Response, next: NextFunction): Promise<Response<any, Record<string, any>>>;
|
|
3
|
+
export declare function handleOpenFile(req: Request, res: Response, next: NextFunction): Promise<Response<any, Record<string, any>>>;
|
|
4
|
+
export declare function appServerRoutes(): import("express-serve-static-core").Router;
|
|
5
|
+
export default appServerRoutes;
|