@hubspot/cms-dev-server 1.1.0-prerelease.8 → 1.2.0
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/LexendDeca-Bold-B8uERmr8.woff2 +0 -0
- package/dist/app/assets/LexendDeca-Light-BtcvwT5C.woff2 +0 -0
- package/dist/app/assets/LexendDeca-Medium-CxVPR2j6.woff2 +0 -0
- package/dist/app/assets/LexendDeca-SemiBold-BhzS3XUP.woff2 +0 -0
- package/dist/app/assets/index-PcyCbkys.css +1 -0
- package/dist/app/assets/index-tvg7JxpD.js +164 -0
- package/dist/app/index.html +15 -0
- package/dist/app/server/assets/RenderTreeSeparately-T6CL43QJ-D50VfKo0.js +111 -0
- package/dist/app/server/serverEntry.js +3641 -0
- package/dist/generateJsonFromJsx.js +744 -0
- package/dist/html/baseTemplate.html +1 -0
- package/dist/index.js +5800 -0
- package/dist/internalSsr.js +1312 -0
- package/dist/island-runtime.js +267 -0
- package/dist/run.js +6495 -4
- package/dist/storybook/index.js +241 -0
- package/dist/storybook-main/main.js +1457 -0
- package/dist/storybook-main/preview.js +21 -0
- package/package.json +93 -24
- package/types/api/designmanager.d.ts +44 -0
- package/types/api/project.d.ts +5 -0
- package/types/api/session.d.ts +2 -0
- package/types/components/HubLModulesList.d.ts +4 -0
- package/types/components/HubLTemplatesList.d.ts +5 -0
- package/types/components/ModulesList.d.ts +5 -0
- package/types/components/PartialsList.d.ts +4 -0
- package/types/createAppServer.d.ts +3 -0
- package/types/createDevServer.d.ts +5 -0
- package/types/createViteDevServer.d.ts +6 -0
- package/types/fileManager.d.ts +4 -0
- package/types/index.d.ts +2 -0
- package/types/lib/cliUtils.d.ts +15 -0
- package/types/lib/configHelpers.d.ts +2 -0
- package/types/lib/criticalDevErrorsToServerMessages.d.ts +4 -0
- package/types/lib/debug.d.ts +1 -0
- package/types/lib/errors.d.ts +6 -0
- package/types/lib/fetchModuleGraphQLData.d.ts +24 -0
- package/types/lib/fullOriginalUrlFromRequest.d.ts +2 -0
- package/types/lib/gates.d.ts +2 -0
- package/types/lib/getDevServerUIData.d.ts +60 -0
- package/types/lib/getFieldValuesForModule.d.ts +2 -0
- package/types/lib/getJSRenderingGates.d.ts +8 -0
- package/types/lib/httpsRedirectingServer.d.ts +11 -0
- package/types/lib/logColors.d.ts +6 -0
- package/types/lib/moduleGraph.d.ts +1 -0
- package/types/lib/packagePath.d.ts +1 -0
- package/types/lib/pathHelpers.d.ts +3 -0
- package/types/lib/previewUtils.d.ts +22 -0
- package/types/lib/proxyHelpers.d.ts +29 -0
- package/types/lib/renderComponentWithCSS.d.ts +14 -0
- package/types/lib/renderHelpers.d.ts +1 -0
- package/types/lib/renderModule.d.ts +11 -0
- package/types/lib/renderModuleFieldsJson.d.ts +4 -0
- package/types/lib/renderModulePreview.d.ts +6 -0
- package/types/lib/renderPartial.d.ts +5 -0
- package/types/lib/templates.d.ts +4 -0
- package/types/lib/trackUsage.d.ts +3 -0
- package/types/lib/validateHSPlatform.d.ts +3 -0
- package/types/lib/watchFieldsUpdates.d.ts +22 -0
- package/types/plugins/cmsComponentsShimPlugin.d.ts +11 -0
- package/types/plugins/devSecretsPlugin.d.ts +2 -0
- package/types/plugins/hsStaticAssetPlugin.d.ts +2 -0
- package/types/proxyPage/constants.d.ts +1 -0
- package/types/proxyPage/fetchContentMetadata.d.ts +7 -0
- package/types/proxyPage/fetchDomains.d.ts +9 -0
- package/types/proxyPage/fetchPreviewInfo.d.ts +7 -0
- package/types/proxyPage/proxyPage.d.ts +11 -0
- package/types/proxyPage/renderLocalError.d.ts +2 -0
- package/types/proxyPage/utils.d.ts +4 -0
- package/types/routes/appServerRouteHandler.d.ts +3 -0
- package/types/routes/createAppServerAPIRoutes.d.ts +5 -0
- package/types/routes/createDevServerRoutes.d.ts +4 -0
- package/types/routes/hublModuleRouteHandler.d.ts +2 -0
- package/types/routes/hublTemplateRouteHandler.d.ts +2 -0
- package/types/routes/legacyRouteHandler.d.ts +3 -0
- package/types/routes/linksToAllModulesRouteHandler.d.ts +2 -0
- package/types/routes/linksToAllPartialsRouteHandler.d.ts +2 -0
- package/types/routes/module.d.ts +3 -0
- package/types/routes/moduleFieldsJson.d.ts +3 -0
- package/types/routes/modulePreviewRouteHandler.d.ts +3 -0
- package/types/routes/partial.d.ts +2 -0
- package/types/routes/proxyPageResourceRedirect.d.ts +2 -0
- package/types/routes/proxyPageRouteHandler.d.ts +2 -0
- package/types/routes/proxyPathPageResourceRedirect.d.ts +2 -0
- package/types/routes/proxyPathPageRouteHandler.d.ts +2 -0
- package/types/routes/proxyServerlessHandler.d.ts +2 -0
- package/types/routes/remoteFsDirtyHandler.d.ts +2 -0
- package/types/shadowDevServer/createShadowDevServerRoutes.d.ts +1 -0
- package/types/shadowDevServer/startShadowDevServer.d.ts +1 -0
- package/types/storybook/getFieldsArgTypes.d.ts +3 -0
- package/types/storybook/getNestedFieldObjectForArgs.d.ts +6 -0
- package/types/storybook/index.d.ts +1 -0
- package/types/storybook/moduleStory.d.ts +5 -0
- package/types/storybook/types.d.ts +15 -0
- package/dist/components/ModulesList.js +0 -14
- package/dist/components/PartialsList.js +0 -13
- package/dist/createDevServer.js +0 -26
- package/dist/createViteDevServer.js +0 -26
- package/dist/lib/argHelpers.js +0 -6
- package/dist/lib/cli.js +0 -23
- package/dist/lib/fullOriginalUrlFromRequest.js +0 -3
- package/dist/lib/htmlHelpers.js +0 -10
- package/dist/lib/moduleGraph.js +0 -11
- package/dist/lib/proxyHelpers.js +0 -69
- package/dist/lib/proxyHelpers.test.js +0 -136
- package/dist/lib/renderComponentWithCSS.js +0 -26
- package/dist/lib/renderHelpers.js +0 -45
- package/dist/lib/renderModule.js +0 -88
- package/dist/lib/renderPartial.js +0 -12
- package/dist/lib/templates.js +0 -48
- package/dist/plugins/devMockClientEntryPlugin.js +0 -52
- package/dist/proxyPage/constants.js +0 -4
- package/dist/proxyPage/fetchContentMetadata.js +0 -51
- package/dist/proxyPage/fetchPreviewInfo.js +0 -37
- package/dist/proxyPage/proxyPage.js +0 -167
- package/dist/proxyPage/renderLocalError.js +0 -27
- package/dist/proxyPage/utils.js +0 -38
- package/dist/routes/createDevServerRoutes.js +0 -21
- package/dist/routes/homeRouteHandler.js +0 -12
- package/dist/routes/linksToAllModulesRouteHandler.js +0 -10
- package/dist/routes/linksToAllPartialsRouteHandler.js +0 -10
- package/dist/routes/module.js +0 -27
- package/dist/routes/partial.js +0 -27
- package/dist/routes/proxyPageResourceRedirect.js +0 -12
- package/dist/routes/proxyPageRouteHandler.js +0 -40
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// src/storybook-main/preview.jsx
|
|
2
|
+
import {
|
|
3
|
+
ServerRenderContext,
|
|
4
|
+
createServerRenderContextV2,
|
|
5
|
+
ClientRenderContextProvider
|
|
6
|
+
} from "@hubspot/cms-components";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
var contextValue = createServerRenderContextV2("http://testUrl.com", {
|
|
9
|
+
environmentConfig: null
|
|
10
|
+
});
|
|
11
|
+
var preview_default = {
|
|
12
|
+
parameters: {
|
|
13
|
+
actions: { argTypesRegex: "^on[A-Z].*" }
|
|
14
|
+
},
|
|
15
|
+
decorators: [
|
|
16
|
+
(Story) => /* @__PURE__ */ jsx(ClientRenderContextProvider, { pageUrl: "http://test.com", islands: [], children: /* @__PURE__ */ jsx(ServerRenderContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx(Story, {}) }) })
|
|
17
|
+
]
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
preview_default as default
|
|
21
|
+
};
|
package/package.json
CHANGED
|
@@ -1,68 +1,137 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hubspot/cms-dev-server",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "./dist/createViteDevServer.js",
|
|
7
6
|
"engines": {
|
|
8
|
-
"node": ">=
|
|
7
|
+
"node": ">=20.x"
|
|
9
8
|
},
|
|
10
9
|
"scripts": {
|
|
11
|
-
"build": "tsc
|
|
10
|
+
"build": "tsc -noEmit && yarn run copy-html && yarn build-types && node scripts/build.mjs; npm run publint",
|
|
11
|
+
"build:watch": "nodemon --exec 'yarn build'",
|
|
12
12
|
"copy-html": "copyfiles -u 1 'src/html/**' 'dist'",
|
|
13
|
+
"build-types": "tsc --project tsconfig.types.json",
|
|
13
14
|
"clean": "tsc --build --clean",
|
|
14
|
-
"dev": "nodemon --
|
|
15
|
-
"dev-inspect": "nodemon --exec '
|
|
15
|
+
"dev": "nodemon --no-stdin --exec 'yarn start'",
|
|
16
|
+
"dev-inspect": "nodemon --exec 'yarn start-inspect'",
|
|
16
17
|
"es-watch": "esbuild --outfile=dist-esbuild/runWhenDeveloping.cjs --bundle --watch --platform=node --external:fsevents --external:vite --external:react-refresh runWhenDeveloping.ts",
|
|
17
18
|
"package": "npm run build && npm pack",
|
|
18
19
|
"prepare": "npm run build",
|
|
19
|
-
"runBuild": "node run.
|
|
20
|
-
"
|
|
20
|
+
"runBuild": "node dist/run.js",
|
|
21
|
+
"start": "tsx runWhenDeveloping.ts",
|
|
22
|
+
"start-inspect": "node --import tsx --inspect runWhenDeveloping.ts",
|
|
23
|
+
"test": "PORT=30042 NODE_ENV=test vitest run",
|
|
24
|
+
"test:watch": "PORT=30042 NODE_ENV=test vitest watch",
|
|
25
|
+
"publint": "publint --level warning --prod"
|
|
21
26
|
},
|
|
22
27
|
"dependencies": {
|
|
23
|
-
"@
|
|
24
|
-
"@
|
|
25
|
-
"@
|
|
26
|
-
"@
|
|
28
|
+
"@babel/code-frame": "^7.24.7",
|
|
29
|
+
"@babel/parser": "^7.25.3",
|
|
30
|
+
"@babel/traverse": "^7.25.3",
|
|
31
|
+
"@babel/types": "^7.25.2",
|
|
32
|
+
"@hubspot/cms-components": "^1.2.0",
|
|
33
|
+
"@hubspot/local-dev-lib": "3.21.2",
|
|
34
|
+
"@inquirer/select": "^2.0.0",
|
|
35
|
+
"@originjs/vite-plugin-commonjs": "^1.0.3",
|
|
36
|
+
"@radix-ui/react-dialog": "^1.1.2",
|
|
37
|
+
"@radix-ui/react-separator": "^1.1.0",
|
|
38
|
+
"@radix-ui/react-slot": "^1.1.0",
|
|
39
|
+
"@radix-ui/react-toggle": "^1.1.3",
|
|
40
|
+
"@radix-ui/react-tooltip": "^1.1.4",
|
|
41
|
+
"@sentry/node": "^6.2.0",
|
|
42
|
+
"@storybook/addon-actions": "^8.6.14",
|
|
43
|
+
"@storybook/addon-essentials": "^8.6.14",
|
|
44
|
+
"@storybook/addon-interactions": "^8.6.14",
|
|
45
|
+
"@storybook/addon-links": "^8.6.14",
|
|
46
|
+
"@storybook/builder-vite": "^8.6.14",
|
|
47
|
+
"@storybook/react": "^8.6.14",
|
|
48
|
+
"@storybook/react-vite": "^8.6.14",
|
|
49
|
+
"@storybook/test": "^8.6.14",
|
|
50
|
+
"@vitejs/plugin-react": "^4.2.1",
|
|
27
51
|
"ansi-to-html": "0.7.x",
|
|
52
|
+
"babel-plugin-macros": "^3.1.0",
|
|
53
|
+
"babel-plugin-styled-components": "^2.1.4",
|
|
54
|
+
"chalk": "^5.3.0",
|
|
55
|
+
"class-variance-authority": "^0.7.0",
|
|
56
|
+
"cli-progress": "^3.12.0",
|
|
57
|
+
"clsx": "^2.1.1",
|
|
58
|
+
"cors": "^2.8.5",
|
|
59
|
+
"debug": "^4.3.4",
|
|
60
|
+
"dot-prop": "^9.0.0",
|
|
28
61
|
"express": "^4.17.3",
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
62
|
+
"html-escaper": "^3.0.3",
|
|
63
|
+
"http-proxy-middleware": "^2.0.6",
|
|
64
|
+
"inquirer": "^9.0.0",
|
|
65
|
+
"jsdom": "^25.0.1",
|
|
66
|
+
"lucide-react": "^0.454.0",
|
|
67
|
+
"node-fetch": "^3.3.0",
|
|
68
|
+
"react": "18.3.1",
|
|
69
|
+
"react-dom": "18.3.1",
|
|
70
|
+
"storybook": "^8.6.14",
|
|
71
|
+
"styled-jsx": "5.1.2",
|
|
72
|
+
"tailwind-merge": "^2.5.4",
|
|
73
|
+
"tailwindcss-animate": "^1.0.7",
|
|
32
74
|
"typescript": "~4.7.0",
|
|
33
|
-
"vite": "
|
|
34
|
-
"vite-plugin-inspect": "^0.
|
|
75
|
+
"vite": "5.4.8",
|
|
76
|
+
"vite-plugin-inspect": "^0.8.0",
|
|
77
|
+
"vite-plugin-mkcert": "1.16.0"
|
|
35
78
|
},
|
|
36
79
|
"devDependencies": {
|
|
80
|
+
"@hubspot/cms-js-internal": "^0.4.0",
|
|
81
|
+
"@testing-library/dom": "^8.20.0",
|
|
37
82
|
"@types/express": "^4.17.13",
|
|
38
83
|
"@types/react": "^18.0.0",
|
|
39
84
|
"@types/react-dom": "^18.0.0",
|
|
85
|
+
"autoprefixer": "^10.4.20",
|
|
40
86
|
"copyfiles": "^2.4.1",
|
|
87
|
+
"esbuild": "^0.16.17",
|
|
88
|
+
"fs-extra": "^11.2.0",
|
|
41
89
|
"nodemon": "^2.0.15",
|
|
42
|
-
"
|
|
43
|
-
"
|
|
90
|
+
"postcss": "^8.4.47",
|
|
91
|
+
"publint": "^0.2.7",
|
|
92
|
+
"tailwindcss": "^3.4.14",
|
|
93
|
+
"tsx": "^4.19.1",
|
|
94
|
+
"vitest": "1.6.0"
|
|
44
95
|
},
|
|
96
|
+
"main": "./dist/index.js",
|
|
97
|
+
"exports": {
|
|
98
|
+
".": {
|
|
99
|
+
"types": "./types/index.d.ts",
|
|
100
|
+
"default": "./dist/index.js"
|
|
101
|
+
},
|
|
102
|
+
"./storybook": {
|
|
103
|
+
"types": "./types/storybook/index.d.ts",
|
|
104
|
+
"default": "./dist/storybook/index.js"
|
|
105
|
+
},
|
|
106
|
+
"./dist/storybook-main/preview.js": "./dist/storybook-main/preview.js"
|
|
107
|
+
},
|
|
108
|
+
"types": "types/index.d.ts",
|
|
45
109
|
"bin": {
|
|
46
|
-
"hs-cms-dev-server": "./dist/run.js"
|
|
110
|
+
"hs-cms-dev-server": "./dist/run.js",
|
|
111
|
+
"jsx-module-fields-to-fields-json": "./dist/generateJsonFromJsx.js"
|
|
47
112
|
},
|
|
48
113
|
"files": [
|
|
49
|
-
"dist/**/*"
|
|
114
|
+
"dist/**/*",
|
|
115
|
+
"types"
|
|
50
116
|
],
|
|
51
117
|
"nodemonConfig": {
|
|
52
118
|
"ext": "js,json,ts,tsx,jsx,html",
|
|
119
|
+
"delay": "2000ms",
|
|
53
120
|
"ignore": [
|
|
54
121
|
"testApp/*",
|
|
55
|
-
"dist/*"
|
|
122
|
+
"./dist/*"
|
|
56
123
|
],
|
|
57
124
|
"watch": [
|
|
58
125
|
"src",
|
|
59
126
|
"package.json",
|
|
60
127
|
"yarn.lock",
|
|
61
|
-
"tsconfig.json"
|
|
128
|
+
"tsconfig.json",
|
|
129
|
+
"../cms-components/dist",
|
|
130
|
+
"../cms-js-internal/dist"
|
|
62
131
|
]
|
|
63
132
|
},
|
|
64
133
|
"publishConfig": {
|
|
65
134
|
"access": "public"
|
|
66
135
|
},
|
|
67
|
-
"gitHead": "
|
|
136
|
+
"gitHead": "1daa578e56eb9e3a9405184bc233891e6391ab92"
|
|
68
137
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
interface PaginatedApiResponse<T> {
|
|
2
|
+
limit: number;
|
|
3
|
+
objects: T[];
|
|
4
|
+
offset: number;
|
|
5
|
+
total: number;
|
|
6
|
+
totalCount: number;
|
|
7
|
+
}
|
|
8
|
+
export interface HubLModule {
|
|
9
|
+
moduleId: number;
|
|
10
|
+
name: string;
|
|
11
|
+
path: string;
|
|
12
|
+
previewKey: string;
|
|
13
|
+
filename: string;
|
|
14
|
+
fields: any[];
|
|
15
|
+
folderPath: string;
|
|
16
|
+
}
|
|
17
|
+
export interface HubLTemplate {
|
|
18
|
+
path: string;
|
|
19
|
+
label: string;
|
|
20
|
+
previewKey: string;
|
|
21
|
+
filename: string;
|
|
22
|
+
displayName: string;
|
|
23
|
+
templateType?: number;
|
|
24
|
+
}
|
|
25
|
+
export interface HubLTemplateData {
|
|
26
|
+
previewKey: string;
|
|
27
|
+
}
|
|
28
|
+
export interface HubLModuleData {
|
|
29
|
+
previewKey: string;
|
|
30
|
+
moduleId: string;
|
|
31
|
+
}
|
|
32
|
+
export interface ModulePageDependencyData {
|
|
33
|
+
id: string;
|
|
34
|
+
label: string;
|
|
35
|
+
errors?: string[];
|
|
36
|
+
portalId: number;
|
|
37
|
+
subType: string;
|
|
38
|
+
}
|
|
39
|
+
export declare function fetchHubLModules(accountId: any, previewToken: any, limit?: number): Promise<PaginatedApiResponse<HubLModule>>;
|
|
40
|
+
export declare function fetchPreviewTemplates(accountId: any, previewToken: any, limit?: number): Promise<PaginatedApiResponse<HubLTemplate>>;
|
|
41
|
+
export declare function fetchModuleByPath(accountId: number, path: string): Promise<any>;
|
|
42
|
+
export declare function fetchTemplateByPath(accountId: number, path: string): Promise<HubLTemplateData>;
|
|
43
|
+
export declare function fetchModulePageDependencies(accountId: number, path: string): Promise<ModulePageDependencyData[]>;
|
|
44
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ThemePreviewOptions } from './lib/previewUtils.js';
|
|
2
|
+
declare function createDevServer(webRoot: string, storybook: boolean, hubspotCliConfigPathOption?: string, hubspotCliAccountNameOption?: string, sslEnabledOption?: boolean, fieldGenEnabledOption?: boolean, themePreviewOptions?: ThemePreviewOptions, fieldBuilderEnabled?: boolean): Promise<{
|
|
3
|
+
close: () => Promise<[...PromiseSettledResult<unknown>[], PromiseSettledResult<unknown>, PromiseSettledResult<unknown>]>;
|
|
4
|
+
}>;
|
|
5
|
+
export default createDevServer;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Gate } from '@hubspot/cms-js-internal';
|
|
2
|
+
export declare function getPackageJson(packagePath: string): any;
|
|
3
|
+
export declare function getDepsForPackage(packagePath: string): string[];
|
|
4
|
+
export declare function getDepsForPackageIfExists(packagePath: string): string[];
|
|
5
|
+
declare function createViteDevServer(webRoot: string, port: any, sslEnabled: boolean, domainsToProxy: any[], jsRenderingGates: Gate[], secretNames: string[]): Promise<import("vite").ViteDevServer>;
|
|
6
|
+
export default createViteDevServer;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import chokidar from 'chokidar';
|
|
2
|
+
export declare function initialPreviewBufferUpload(accountId: any, src: any, dest: any, filePaths: any, uploadOptions: any): Promise<void>;
|
|
3
|
+
export declare const startPreviewWatcher: (accountId: any, src: string, dest: string) => Promise<chokidar.FSWatcher>;
|
|
4
|
+
export declare function isModuleFolderChild(filePath: string): boolean;
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare function hasNewDirectoryStructure(platformVersion: string): boolean;
|
|
2
|
+
export declare function determineSrcAndDest(webRoot: string, isUsingLocalWorkspace?: boolean): Promise<{
|
|
3
|
+
absoluteSrc: any;
|
|
4
|
+
dest: any;
|
|
5
|
+
}>;
|
|
6
|
+
export declare function getUploadableFileList(src: any, convertFields: any): Promise<any[]>;
|
|
7
|
+
export declare function fieldsJsPrompt(filePath: any, projectDir: any, skipFiles?: any[]): Promise<any[]>;
|
|
8
|
+
export declare function logError(error: any, context?: {}): void;
|
|
9
|
+
export declare class ApiErrorContext {
|
|
10
|
+
accountId: any;
|
|
11
|
+
request: any;
|
|
12
|
+
payload: any;
|
|
13
|
+
projectName: any;
|
|
14
|
+
constructor(props?: any);
|
|
15
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { LogMessage } from '@hubspot/cms-components';
|
|
2
|
+
import { CriticalDevError } from '@hubspot/cms-components';
|
|
3
|
+
declare const criticalDevErrorsToServerMessages: (criticalDevErrors: Array<CriticalDevError>) => Array<LogMessage>;
|
|
4
|
+
export default criticalDevErrorsToServerMessages;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const debug: any;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare class MissingScopeError extends Error {
|
|
2
|
+
constructor(error: any);
|
|
3
|
+
}
|
|
4
|
+
export declare function logMissingScopeWarning(error: MissingScopeError): void;
|
|
5
|
+
export declare function isMissingScopeError(error: any): any;
|
|
6
|
+
export declare function handleSecretsError(error: any): void;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
declare type DataQueryPoints = {
|
|
2
|
+
count: number;
|
|
3
|
+
weight: number;
|
|
4
|
+
used_points: number;
|
|
5
|
+
};
|
|
6
|
+
declare type DataQueryResult = {
|
|
7
|
+
extensions: {
|
|
8
|
+
query_complexity: {
|
|
9
|
+
max_points: number;
|
|
10
|
+
used_points: number;
|
|
11
|
+
points_for_internal_api_requests: DataQueryPoints;
|
|
12
|
+
points_for_objects_retrieved: DataQueryPoints;
|
|
13
|
+
points_for_properties_with_value: DataQueryPoints;
|
|
14
|
+
points_for_properties_without_value: DataQueryPoints;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
data?: {
|
|
18
|
+
CRM?: any;
|
|
19
|
+
HUBDB?: any;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export declare function clearGraphQLDataCache(): void;
|
|
23
|
+
export default function fetchModuleGraphQLData(accountId: number, query: string, requestedModulePath: string, pageUrl: string): Promise<DataQueryResult>;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { ViteDevServer } from 'vite';
|
|
2
|
+
import { HubLModule, HubLTemplate } from '../api/designmanager.js';
|
|
3
|
+
import { ProjectData } from '../api/project.js';
|
|
4
|
+
export declare enum ModuleType {
|
|
5
|
+
REACT = "react",
|
|
6
|
+
HUBL = "hubl"
|
|
7
|
+
}
|
|
8
|
+
export interface ModuleData {
|
|
9
|
+
name: string;
|
|
10
|
+
type: ModuleType;
|
|
11
|
+
nameWithExtension?: string;
|
|
12
|
+
subPath?: string;
|
|
13
|
+
extension?: string;
|
|
14
|
+
fieldsJson?: any;
|
|
15
|
+
}
|
|
16
|
+
export interface PartialData {
|
|
17
|
+
name: string;
|
|
18
|
+
subPath: string;
|
|
19
|
+
}
|
|
20
|
+
export interface TemplateData {
|
|
21
|
+
name: string;
|
|
22
|
+
subPath: string;
|
|
23
|
+
templateTypeLabel: string;
|
|
24
|
+
}
|
|
25
|
+
export interface DevServerUIData {
|
|
26
|
+
authedPortalId: number;
|
|
27
|
+
projectName: string;
|
|
28
|
+
modulesData: ModuleData[];
|
|
29
|
+
hubLModules: ModuleData[];
|
|
30
|
+
partialsData: PartialData[];
|
|
31
|
+
hubLTemplates: TemplateData[];
|
|
32
|
+
themeWebRoot: string;
|
|
33
|
+
cliCommands: {
|
|
34
|
+
scriptName: string;
|
|
35
|
+
description: string;
|
|
36
|
+
runCommand: string;
|
|
37
|
+
}[];
|
|
38
|
+
sslEnabled: boolean;
|
|
39
|
+
projectData: ProjectData | null;
|
|
40
|
+
fieldBuilderEnabled: boolean;
|
|
41
|
+
[key: string]: any;
|
|
42
|
+
}
|
|
43
|
+
export interface AppLocals {
|
|
44
|
+
themeWebRoot: string;
|
|
45
|
+
authedPortalId: number;
|
|
46
|
+
authedEnv: string;
|
|
47
|
+
authedHublet: string;
|
|
48
|
+
projectName: string;
|
|
49
|
+
webRootProjectComponentFolder: string;
|
|
50
|
+
localPreviewToken: string;
|
|
51
|
+
sslEnabled: boolean;
|
|
52
|
+
fieldBuilderEnabled: boolean;
|
|
53
|
+
appWebRoot: string;
|
|
54
|
+
appViteServer: ViteDevServer;
|
|
55
|
+
}
|
|
56
|
+
export declare const templateTypeMap: Record<number, string>;
|
|
57
|
+
export declare function normalizeHubLModules(modules: HubLModule[], projectName: string): ModuleData[];
|
|
58
|
+
export declare function normalizeTemplatesData(templates: HubLTemplate[], projectName: string): TemplateData[];
|
|
59
|
+
export declare function getDevServerUIData(appLocals: AppLocals): Promise<DevServerUIData>;
|
|
60
|
+
export default getDevServerUIData;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Gate } from '@hubspot/cms-js-internal';
|
|
2
|
+
import { HSEnvironment } from '@hubspot/cms-components';
|
|
3
|
+
declare type EnabledFeatures = {
|
|
4
|
+
[name: string]: number;
|
|
5
|
+
};
|
|
6
|
+
export declare const mapEnabledFeaturesToGates: (enabledFeatures: EnabledFeatures) => Gate[];
|
|
7
|
+
export default function getJsRenderingGates(portalId: number, env: HSEnvironment, personalAccessKey: string): Promise<Gate[]>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
3
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
4
|
+
import net from 'net';
|
|
5
|
+
import http from 'http';
|
|
6
|
+
import https from 'https';
|
|
7
|
+
export declare function createHttpsRedirectingServer(opts: any, handler: any): {
|
|
8
|
+
server: net.Server;
|
|
9
|
+
innerHTTPServer: http.Server<typeof http.IncomingMessage, typeof http.ServerResponse>;
|
|
10
|
+
innerHTTPSServer: https.Server<typeof http.IncomingMessage, typeof http.ServerResponse>;
|
|
11
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const findFullPathInModuleGraph: (modulePathNoExtension: string, moduleGraph: any) => string | void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function packagePath(metaUrl: string, projectPath: string): string;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { ViteDevServer } from 'vite';
|
|
2
|
+
export declare const getComponentPaths: (viteServer: ViteDevServer, componentPath: string) => [componentPathNoExtension: string, componentPathWithExtension: string];
|
|
3
|
+
export declare const getEntryPointBasePath: (componentPath: string) => string;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare const removePreviewPrefix: (t: string) => string;
|
|
2
|
+
export declare const getPreviewUrl: (request: any, queryParams: any) => string;
|
|
3
|
+
export declare const buildHTMLResponse: (content: any) => string;
|
|
4
|
+
export declare const addRefreshScript: (html: string) => string;
|
|
5
|
+
export declare function buildDevFileHashTable(src: string, dest: string, filePaths: string[]): {};
|
|
6
|
+
export declare type ThemePreviewOptions = {
|
|
7
|
+
filePaths: string[];
|
|
8
|
+
startProgressBar: (number: any) => {
|
|
9
|
+
onAttemptCallback: Function;
|
|
10
|
+
onSuccessCallback: Function;
|
|
11
|
+
onFirstErrorCallback: Function;
|
|
12
|
+
onRetryCallback: Function;
|
|
13
|
+
onFinalErrorCallback: Function;
|
|
14
|
+
onFinishCallback: Function;
|
|
15
|
+
};
|
|
16
|
+
resetSession: boolean;
|
|
17
|
+
dest: string;
|
|
18
|
+
};
|
|
19
|
+
export declare function initiatePreviewSession(authedPortalId: number | null, absoluteWebRoot: string, themePreviewOptions: ThemePreviewOptions): Promise<{
|
|
20
|
+
localPreviewToken: any;
|
|
21
|
+
tokenStatus: any;
|
|
22
|
+
}>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ModuleProps } from '@hubspot/cms-components';
|
|
2
|
+
declare type BaseJson = {
|
|
3
|
+
props: Record<string, any>;
|
|
4
|
+
request: Record<string, any>;
|
|
5
|
+
};
|
|
6
|
+
export interface LocalRenderBlockInfo {
|
|
7
|
+
startOffset: number;
|
|
8
|
+
endOffset: number;
|
|
9
|
+
path: string;
|
|
10
|
+
json: {
|
|
11
|
+
props: {
|
|
12
|
+
fieldValues?: Record<string, any>;
|
|
13
|
+
hublParameters?: Record<string, any>;
|
|
14
|
+
supplementalFieldValues?: Record<string, any>;
|
|
15
|
+
hublData?: any;
|
|
16
|
+
} & Record<string, any>;
|
|
17
|
+
request: Record<string, any>;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export declare type LocalModuleRenderPlaceholderProps = ModuleProps & Record<string, any>;
|
|
21
|
+
export interface LocalModuleRenderBlockInfo extends LocalRenderBlockInfo {
|
|
22
|
+
json: {
|
|
23
|
+
props: LocalModuleRenderPlaceholderProps;
|
|
24
|
+
} & BaseJson;
|
|
25
|
+
}
|
|
26
|
+
export declare const findLocalRenderPlaceholders: (body: string) => Array<LocalRenderBlockInfo>;
|
|
27
|
+
export declare const getHSProjectConfig: (hsProjectConfigPath: string) => Record<string, any> | null;
|
|
28
|
+
export declare const getProjectNameFromHSConfig: (hsProjectConfigPath: string) => string;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ViteDevServer } from 'vite';
|
|
2
|
+
import { ComponentType } from 'react';
|
|
3
|
+
import { RenderToPipeableStreamOptions } from 'react-dom/server';
|
|
4
|
+
import { ServerRenderContextValue } from '@hubspot/cms-components';
|
|
5
|
+
import { EnvironmentConfig } from '@hubspot/cms-components/config';
|
|
6
|
+
import { InlineAsset, StaticAsset } from '@hubspot/cms-js-internal';
|
|
7
|
+
export declare type RenderResult = {
|
|
8
|
+
html: string;
|
|
9
|
+
inlineAssets?: InlineAsset[];
|
|
10
|
+
cssNeeded: string;
|
|
11
|
+
renderContext: ServerRenderContextValue;
|
|
12
|
+
};
|
|
13
|
+
declare function renderComponentWithCSS(viteServer: ViteDevServer, componentPath: string, Component: ComponentType, propsAndExtraDeps: any, pageUrl: string, entryPointBasePath: string, contextOptions: any, environmentConfig: EnvironmentConfig, renderOptions: RenderToPipeableStreamOptions, getServerSideProps?: Function, modifyHtmlCallback?: (html: string, renderContext: ServerRenderContextValue, staticAssets: StaticAsset[]) => string): Promise<RenderResult>;
|
|
14
|
+
export default renderComponentWithCSS;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const logPartialInfo: (partialPath: any, props: any) => void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ViteDevServer } from 'vite';
|
|
2
|
+
import { RenderToPipeableStreamOptions } from 'react-dom/server';
|
|
3
|
+
import { EnvironmentConfig } from '@hubspot/cms-components/config';
|
|
4
|
+
import { ModuleProps } from '@hubspot/cms-components';
|
|
5
|
+
import { RenderResult } from '../lib/renderComponentWithCSS.js';
|
|
6
|
+
export declare const VALIDATE_FIELDS_ENDPOINT = "/designmanager/v1/modules/validate-fields";
|
|
7
|
+
export declare const VALIDATE_META_ENDPOINT = "/designmanager/v1/modules/validate-meta";
|
|
8
|
+
export declare const getApplyValidationToRenderContext: (portalId: any, fieldsJSON: any, metaJSON: any, requestedModulePath: any) => (renderResult: RenderResult) => Promise<RenderResult>;
|
|
9
|
+
export declare const lookForModuleInFolder: (modulePath: string, viteServer: ViteDevServer) => Promise<[any, string]>;
|
|
10
|
+
declare function renderModule(viteServer: ViteDevServer, requestedModulePath: string, moduleProps: ModuleProps, pageUrl: string, basePath: string, environmentConfig: EnvironmentConfig, renderOptions?: RenderToPipeableStreamOptions): Promise<RenderResult>;
|
|
11
|
+
export default renderModule;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ViteDevServer } from 'vite';
|
|
2
|
+
export declare const lookForModuleInFolder: (modulePath: string, viteServer: ViteDevServer) => Promise<[any, string]>;
|
|
3
|
+
declare function renderModuleFieldsJson(viteServer: ViteDevServer, requestedModulePath: string): Promise<any>;
|
|
4
|
+
export default renderModuleFieldsJson;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare function renderRemoteModulePreview(modulePath: string, authedPortalId: any, authedEnv: any, cookieValue: any): Promise<{
|
|
2
|
+
html: string;
|
|
3
|
+
cssNeeded: string;
|
|
4
|
+
}>;
|
|
5
|
+
export declare function signUrl(authedPortalId: number, unsignedUrl: string, requestBody: any): Promise<string>;
|
|
6
|
+
export declare function renderLocalProjectModulePreview(moduleName: string, authedPortalId: any, authedEnv: any, authedHublet: any, webRoot: any, viteServer: any, jsRenderingGates: any, projectName: any, projectComponentPath: any, fullOriginalUrl: any, cookieValue: any, fieldOverrides?: {}): Promise<import("./renderComponentWithCSS.js").RenderResult>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { EnvironmentConfig } from '@hubspot/cms-components/config';
|
|
2
|
+
import { ViteDevServer } from 'vite';
|
|
3
|
+
import { RenderToPipeableStreamOptions } from 'react-dom/server';
|
|
4
|
+
declare function renderPartial(viteServer: ViteDevServer, partialPath: string, props: any, pageUrl: string, basePath: string, environmentConfig: EnvironmentConfig, renderOptions?: RenderToPipeableStreamOptions): Promise<import("./renderComponentWithCSS.js").RenderResult>;
|
|
5
|
+
export default renderPartial;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ViteDevServer } from 'vite';
|
|
2
|
+
import { ServerRenderContextValue } from '@hubspot/cms-components';
|
|
3
|
+
export declare const createHtmlShellDependingOnRenderContext: (baseTemplatePath: string, url: string, title: string, renderContext: ServerRenderContextValue, viteServer: ViteDevServer, jsRenderingGates: string[]) => Promise<string>;
|
|
4
|
+
export declare const getIslandRuntimeAndGlobalToInject: (sortedIslandRoots: any, perServerRequestData: any, viteServer: ViteDevServer, gates: string[], prettyPrint: boolean) => Promise<string>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Field } from '@hubspot/cms-components/fields';
|
|
2
|
+
import { ViteDevServer } from 'vite';
|
|
3
|
+
export declare const formatAsTypeName: (str: string) => string;
|
|
4
|
+
/**
|
|
5
|
+
* If the filePath file is in the modules folder, find and return the closest index file.
|
|
6
|
+
* If the filePath that was updated in modules root, return that path instead.
|
|
7
|
+
*/
|
|
8
|
+
export declare const getIndexFile: (filePath: string, projectRoot: string) => {
|
|
9
|
+
indexFilePath: string;
|
|
10
|
+
isRootModuleFile: boolean;
|
|
11
|
+
};
|
|
12
|
+
export declare const getIndexFileFields: (indexFilePath: string, indexFileName: string, viteServer: ViteDevServer) => Promise<Field[]>;
|
|
13
|
+
/**
|
|
14
|
+
* When a file inside of a module folder is updated, find the exported fields object
|
|
15
|
+
* and try to generate a type file for it. If a types file exists, checks for the auto-gen
|
|
16
|
+
* comment at the top before overwriting.
|
|
17
|
+
*/
|
|
18
|
+
export declare const maybeUpdateFields: (filePath: string, viteServer: ViteDevServer, projectRoot: string) => Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* Generate field types for all modules once and start module file watcher to generate on add/change
|
|
21
|
+
*/
|
|
22
|
+
export declare const startFieldsTypeGenWatcher: (viteServer: ViteDevServer, projectRoot: string) => void;
|