@hubspot/cms-dev-server 0.13.9 → 0.13.10

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.
Files changed (46) hide show
  1. package/dist/fsevents-72LCIACT.node +0 -0
  2. package/dist/run.js +1 -1
  3. package/package.json +4 -4
  4. package/types/components/ModulesList.d.ts +5 -0
  5. package/types/components/PartialsList.d.ts +4 -0
  6. package/types/generateBpmAliases.d.ts +2 -0
  7. package/types/lib/debug.d.ts +1 -0
  8. package/types/lib/fetchModuleGraphQLData.d.ts +24 -0
  9. package/types/lib/fullOriginalUrlFromRequest.d.ts +5 -0
  10. package/types/lib/locals.d.ts +10 -0
  11. package/types/lib/logColors.d.ts +6 -0
  12. package/types/lib/moduleGraph.d.ts +1 -0
  13. package/types/lib/packagePath.d.ts +1 -0
  14. package/types/lib/pathHelpers.d.ts +3 -0
  15. package/types/lib/proxyHelpers.d.ts +20 -0
  16. package/types/lib/renderComponentWithCSS.d.ts +14 -0
  17. package/types/lib/renderHelpers.d.ts +1 -0
  18. package/types/lib/renderModule.d.ts +6 -0
  19. package/types/lib/renderPartial.d.ts +5 -0
  20. package/types/lib/templates.d.ts +4 -0
  21. package/types/lib/trackUsage.d.ts +3 -0
  22. package/types/lib/urlFromRequest.d.ts +3 -0
  23. package/types/noNodeBuiltinsPlugin.d.ts +3 -0
  24. package/types/plugins/componentRoutesPlugin.d.ts +3 -0
  25. package/types/plugins/internalAppPlugin.d.ts +2 -0
  26. package/types/plugins/jsRenderingPlugin.d.ts +2 -0
  27. package/types/plugins/localProxyPlugin.d.ts +3 -0
  28. package/types/plugins/sslPlugin.d.ts +2 -0
  29. package/types/plugins/storybookPlugin.d.ts +6 -0
  30. package/types/proxyPage/constants.d.ts +1 -0
  31. package/types/proxyPage/fetchContentMetadata.d.ts +7 -0
  32. package/types/proxyPage/fetchPreviewInfo.d.ts +6 -0
  33. package/types/proxyPage/proxyPage.d.ts +7 -0
  34. package/types/proxyPage/renderLocalError.d.ts +2 -0
  35. package/types/proxyPage/utils.d.ts +4 -0
  36. package/types/resolveSharedDeps.d.ts +2 -0
  37. package/types/routes/createDevServerRoutes.d.ts +3 -0
  38. package/types/routes/homeRouteHandler.d.ts +7 -0
  39. package/types/routes/linksToAllModulesRouteHandler.d.ts +2 -0
  40. package/types/routes/linksToAllPartialsRouteHandler.d.ts +2 -0
  41. package/types/routes/module.d.ts +21 -0
  42. package/types/routes/partial.d.ts +21 -0
  43. package/types/routes/proxyPageResourceRedirect.d.ts +5 -0
  44. package/types/routes/proxyPageRouteHandler.d.ts +11 -0
  45. package/types/routes/proxyPathPageResourceRedirect.d.ts +2 -0
  46. package/types/routes/proxyPathPageRouteHandler.d.ts +13 -0
Binary file
package/dist/run.js CHANGED
@@ -954,7 +954,7 @@ function trackUsage(action) {
954
954
  eventName: EVENT_NAME,
955
955
  action,
956
956
  nodeVersion: getNodeVersionData(),
957
- version: "0.13.9",
957
+ version: "0.13.10",
958
958
  os: getPlatform()
959
959
  };
960
960
  const uri = isAuthedWithPersonalAccessKey ? DEV_SERVER_USAGE_ENDPOINT_AUTHENTICATED : DEV_SERVER_USAGE_ENDPOINT;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hubspot/cms-dev-server",
3
- "version": "0.13.9",
3
+ "version": "0.13.10",
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.13.9",
28
+ "@hubspot/cms-components": "^0.13.10",
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",
@@ -49,7 +49,7 @@
49
49
  "request": "^2.88.2",
50
50
  "styled-jsx": "5.1.2",
51
51
  "typescript": "~4.7.0",
52
- "vite": "4.5.0",
52
+ "vite": "4.5.1",
53
53
  "vite-plugin-inspect": "^0.4.3",
54
54
  "vite-plugin-mkcert": "1.16.0"
55
55
  },
@@ -101,5 +101,5 @@
101
101
  "publishConfig": {
102
102
  "access": "public"
103
103
  },
104
- "gitHead": "2309a8ad3e5f58b41d1a307df2e18cb68c299efd"
104
+ "gitHead": "c8ff20a597765fb49fa33bcea9efea4dc58f2998"
105
105
  }
@@ -0,0 +1,5 @@
1
+ declare function ModulesList({ webRoot, moduleNames }: {
2
+ webRoot: any;
3
+ moduleNames: any;
4
+ }): JSX.Element;
5
+ export default ModulesList;
@@ -0,0 +1,4 @@
1
+ export default function PartialsList({ webRoot, partialNames }: {
2
+ webRoot: any;
3
+ partialNames: any;
4
+ }): JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { Alias } from 'vite';
2
+ export default function generateBpmAliases(webRoot: string): Alias[];
@@ -0,0 +1 @@
1
+ export declare const debug: any;
@@ -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,5 @@
1
+ export default function fullOriginalUrlFromRequest(request: {
2
+ protocol: string;
3
+ host: string;
4
+ originalUrl: string;
5
+ }): string;
@@ -0,0 +1,10 @@
1
+ import { HSEnvironment, Hublet } from '@hubspot/cms-components';
2
+ import { Gate } from '@hubspot/cms-js-internal';
3
+ export declare type Locals = {
4
+ authedPortalId: number;
5
+ authedEnv: HSEnvironment;
6
+ authedHublet: Hublet;
7
+ jsRenderingGates: Gate[];
8
+ projectName: string;
9
+ projectComponentPath: string;
10
+ };
@@ -0,0 +1,6 @@
1
+ declare type ColorMap = {
2
+ [key: string]: number;
3
+ };
4
+ export declare const ForeGroudANSIColorMap: ColorMap;
5
+ export declare function wrapMessageInColor(color: string, message: string): string;
6
+ export {};
@@ -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,20 @@
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: BaseJson;
11
+ }
12
+ export declare type LocalModuleRenderPlaceholderProps = ModuleProps & Record<string, any>;
13
+ export interface LocalModuleRenderBlockInfo extends LocalRenderBlockInfo {
14
+ json: {
15
+ props: LocalModuleRenderPlaceholderProps;
16
+ } & BaseJson;
17
+ }
18
+ export declare const findLocalRenderPlaceholders: (body: string) => Array<LocalRenderBlockInfo>;
19
+ export declare const getProjectNameFromHSConfig: (hsProjectConfigPath: any) => any;
20
+ 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 } 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, props: any, pageUrl: string, entryPointBasePath: string, environmentConfig: EnvironmentConfig, renderOptions: RenderToPipeableStreamOptions): Promise<RenderResult>;
14
+ export default renderComponentWithCSS;
@@ -0,0 +1 @@
1
+ export declare const logPartialInfo: (partialPath: any, props: any) => void;
@@ -0,0 +1,6 @@
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
+ declare function renderModule(viteServer: ViteDevServer, requestedModulePath: string, moduleProps: ModuleProps, pageUrl: string, basePath: string, environmentConfig: EnvironmentConfig, renderOptions?: RenderToPipeableStreamOptions): Promise<import("./renderComponentWithCSS.js").RenderResult>;
6
+ export default renderModule;
@@ -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,3 @@
1
+ import { HSEnvironment } from '@hubspot/cms-components';
2
+ export declare const setTrackingInfo: (accountId: number | null, env: HSEnvironment | null) => void;
3
+ export default function sendTrackingRequest(action: string): void;
@@ -0,0 +1,3 @@
1
+ /// <reference types="node" resolution-mode="require"/>
2
+ import { IncomingMessage } from 'http';
3
+ export default function urlFromRequest(request: IncomingMessage): URL;
@@ -0,0 +1,3 @@
1
+ import { Plugin } from 'vite';
2
+ declare const noNodeBuiltinsPlugin: () => Plugin;
3
+ export default noNodeBuiltinsPlugin;
@@ -0,0 +1,3 @@
1
+ import { PluginOption } from 'vite';
2
+ import { Locals } from '../lib/locals.js';
3
+ export default function componentRoutesPlugin(locals: Locals): PluginOption;
@@ -0,0 +1,2 @@
1
+ import { PluginOption } from 'vite';
2
+ export default function internalAppPlugin(): PluginOption;
@@ -0,0 +1,2 @@
1
+ import { PluginOption } from 'vite';
2
+ export default function jsRenderingPlugin(webRoot: string, port: number): PluginOption;
@@ -0,0 +1,3 @@
1
+ import { PluginOption } from 'vite';
2
+ import { Locals } from '../lib/locals.js';
3
+ export default function localProxyPlugin(locals: Locals): PluginOption;
@@ -0,0 +1,2 @@
1
+ import { PluginOption } from 'vite';
2
+ export default function sslPlugin(domainsToProxy: string[]): PluginOption;
@@ -0,0 +1,6 @@
1
+ import { PluginOption } from 'vite';
2
+ export default function storybookPlugin(locals: {
3
+ authedPortalId: number;
4
+ authedEnv: string;
5
+ authedHublet: string;
6
+ }): PluginOption;
@@ -0,0 +1 @@
1
+ export declare const VALID_PROXY_DOMAIN_SUFFIXES: string[];
@@ -0,0 +1,7 @@
1
+ import { Hublet } from '@hubspot/cms-components';
2
+ export declare type PortalContentIdAndHublet = {
3
+ portalId: number;
4
+ contentId: string;
5
+ hublet: Hublet;
6
+ };
7
+ export default function fetchContentMetadata(url: string, portalId: number): Promise<PortalContentIdAndHublet>;
@@ -0,0 +1,6 @@
1
+ export interface PreviewInfoResponse {
2
+ previewDomain: string;
3
+ previewKey: string;
4
+ }
5
+ declare const _default: (accountId: string, portalId: number, contentId: string) => Promise<PreviewInfoResponse>;
6
+ export default _default;
@@ -0,0 +1,7 @@
1
+ /// <reference types="node" resolution-mode="require"/>
2
+ import { ServerResponse } from 'http';
3
+ import { ViteDevServer } from 'vite';
4
+ import { Gate } from '@hubspot/cms-js-internal';
5
+ import { Hublet } from '@hubspot/cms-components';
6
+ export declare const makeProxyPreviewRequest: (accountId: string, urlToProxy: string, previewKey: string, contentId: string, projectName: string, __jsRenderingGates: Gate[]) => any;
7
+ export default function proxySpecificPage(response: ServerResponse, portalId: number, hublet: Hublet, contentId: string, webRoot: string, viteServer: ViteDevServer, projectName: string, projectComponentPath: string, jsRenderingGates: Gate[], urlToProxy?: string, fullOriginalUrl?: string): Promise<void>;
@@ -0,0 +1,2 @@
1
+ declare const _default: (path: string, error: Error) => string;
2
+ export default _default;
@@ -0,0 +1,4 @@
1
+ import { RenderResult } from '../lib/renderComponentWithCSS.js';
2
+ export declare const getSubDomainFromValidLocalDomain: (hostname: any) => any;
3
+ export declare const fakeRenderJsComponent: (indexForThisRender: any) => Promise<RenderResult>;
4
+ export declare const consoleWarn: (message: any) => void;
@@ -0,0 +1,2 @@
1
+ import { Plugin } from 'vite';
2
+ export default function resolveSharedDeps(): Plugin | null;
@@ -0,0 +1,3 @@
1
+ import { ViteDevServer } from 'vite';
2
+ declare function createDevServerRoutes(viteServer: ViteDevServer, __storybookPort?: number): import("express-serve-static-core").Router;
3
+ export default createDevServerRoutes;
@@ -0,0 +1,7 @@
1
+ import { IncomingMessage, ServerResponse } from 'http';
2
+ import { ViteDevServer } from 'vite';
3
+ declare const homeRouteHandler: (locals: {
4
+ storybookEnabled: boolean;
5
+ viteServer: ViteDevServer;
6
+ }) => (__request: IncomingMessage, response: ServerResponse) => Promise<void>;
7
+ export default homeRouteHandler;
@@ -0,0 +1,2 @@
1
+ declare const linksToAllModuleRouteHandler: (request: any, response: any) => Promise<void>;
2
+ export default linksToAllModuleRouteHandler;
@@ -0,0 +1,2 @@
1
+ declare const linksToAllPartialRouteHandler: (request: any, response: any) => Promise<void>;
2
+ export default linksToAllPartialRouteHandler;
@@ -0,0 +1,21 @@
1
+ /// <reference types="node" resolution-mode="require"/>
2
+ import type { IncomingMessage, ServerResponse } from 'http';
3
+ import { ViteDevServer } from 'vite';
4
+ import { HSEnvironment } from '@hubspot/cms-components';
5
+ import { Gate } from '@hubspot/cms-js-internal';
6
+ declare type RoutedRequest = IncomingMessage & {
7
+ params: {
8
+ [key: string]: string;
9
+ };
10
+ };
11
+ declare const moduleRouteHandler: (locals: {
12
+ authedPortalId: number;
13
+ authedEnv: HSEnvironment;
14
+ authedHublet: 'na1';
15
+ webRoot: string;
16
+ viteServer: ViteDevServer;
17
+ jsRenderingGates: Gate[];
18
+ projectName: string;
19
+ projectComponentPath: string;
20
+ }) => (request: RoutedRequest, response: ServerResponse) => Promise<void>;
21
+ export default moduleRouteHandler;
@@ -0,0 +1,21 @@
1
+ /// <reference types="node" resolution-mode="require"/>
2
+ import type { IncomingMessage, ServerResponse } from 'http';
3
+ import { ViteDevServer } from 'vite';
4
+ import { HSEnvironment } from '@hubspot/cms-components';
5
+ import { Gate } from '@hubspot/cms-js-internal';
6
+ declare type RoutedRequest = IncomingMessage & {
7
+ params: {
8
+ [key: string]: string;
9
+ };
10
+ };
11
+ declare const partialRouteHandler: (locals: {
12
+ authedPortalId: number;
13
+ authedEnv: HSEnvironment;
14
+ authedHublet: 'na1';
15
+ webRoot: string;
16
+ viteServer: ViteDevServer;
17
+ jsRenderingGates: Gate[];
18
+ projectName: string;
19
+ projectComponentPath: string;
20
+ }) => (request: RoutedRequest, response: ServerResponse) => Promise<void>;
21
+ export default partialRouteHandler;
@@ -0,0 +1,5 @@
1
+ /// <reference types="node" resolution-mode="require"/>
2
+ import { IncomingMessage, ServerResponse } from 'http';
3
+ export default function proxyPageResourceRedirect(req: IncomingMessage & {
4
+ body?: object | string;
5
+ }, res: ServerResponse, next: Function): Promise<void>;
@@ -0,0 +1,11 @@
1
+ import { IncomingMessage, ServerResponse } from 'http';
2
+ import { ViteDevServer } from 'vite';
3
+ import { Gate } from '@hubspot/cms-js-internal';
4
+ declare const _default: (locals: {
5
+ viteServer: ViteDevServer;
6
+ projectName: string;
7
+ projectComponentPath: string;
8
+ authedPortalId: number;
9
+ jsRenderingGates: Gate[];
10
+ }) => (request: IncomingMessage, response: ServerResponse, next: Function) => Promise<void>;
11
+ export default _default;
@@ -0,0 +1,2 @@
1
+ import { NextFunction, Request, Response } from 'express';
2
+ export default function proxyPathPageResourceRedirect(req: Request, res: Response, next: NextFunction): void;
@@ -0,0 +1,13 @@
1
+ /// <reference types="node" resolution-mode="require"/>
2
+ import { Gate } from '@hubspot/cms-js-internal';
3
+ import { IncomingMessage, ServerResponse } from 'http';
4
+ import { ViteDevServer } from 'vite';
5
+ declare const proxyPathPageRouteHandler: (locals: {
6
+ viteServer: ViteDevServer;
7
+ webRoot: string;
8
+ authedPortalId: number;
9
+ projectName: string;
10
+ projectComponentPath: string;
11
+ jsRenderingGates: Gate[];
12
+ }) => (request: IncomingMessage, response: ServerResponse, next: Function) => Promise<ServerResponse<IncomingMessage>>;
13
+ export default proxyPathPageRouteHandler;