@squiz/edge-dev-render-runtime-lib 2.8.0 → 2.9.1

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/lib/ioc.d.ts CHANGED
@@ -17,6 +17,7 @@ export interface Services {
17
17
  }
18
18
  export interface Config {
19
19
  enableDevMode?: boolean;
20
+ resolveMatrixKeywords?: boolean;
20
21
  }
21
22
  declare let iocContainer: IocContainer;
22
23
  export declare const initIocContainer: (services: Services, config: Config) => Container;
@@ -4790,7 +4790,7 @@
4790
4790
  },
4791
4791
  "info": {
4792
4792
  "title": "@squiz/edge-dev-render-runtime-lib",
4793
- "version": "2.7.0",
4793
+ "version": "2.9.1",
4794
4794
  "description": "Package of Edge rendering utilities for components in dev mode",
4795
4795
  "license": {
4796
4796
  "name": "ISC"
@@ -0,0 +1,40 @@
1
+ import { MANIFEST_MODELS } from '@squiz/dx-json-schema-lib';
2
+ import { Logger } from '@squiz/dx-logger-lib';
3
+ import { FunctionReturnTypes } from '../component-runner';
4
+ /**
5
+ * The name of the file containing keyword replacements for local component preview.
6
+ */
7
+ export declare const LOCAL_KEYWORDS_FILE_NAME = "keywords.json";
8
+ /**
9
+ * A map of keyword IDs to their replacements.
10
+ */
11
+ export type KeywordReplacements = Record<string, string>;
12
+ /**
13
+ * The type of the response from a component function.
14
+ */
15
+ type ResponseType = MANIFEST_MODELS.v1.ComponentFunction['output']['responseType'];
16
+ /**
17
+ * Loads optional Matrix keyword replacements for local component preview.
18
+ * These are defined in a keywords.json file in the component directory.
19
+ */
20
+ export declare function loadLocalKeywordReplacements(componentDirectory: string, logger: Logger): Promise<KeywordReplacements | undefined>;
21
+ /**
22
+ * Replaces Matrix keywords in HTML using a keyword replacements map.
23
+ * Keywords without a replacement render as an empty string.
24
+ *
25
+ * @example
26
+ * const html = '<p>Hello %asset_name%</p>';
27
+ * const replacements = {
28
+ * "asset_name": "Local Site"
29
+ * };
30
+ * const result = '<p>Hello Local Site</p>';
31
+ */
32
+ export declare function resolveMatrixKeywordsFromFixture(html: string, replacements: KeywordReplacements, logger: Logger): string;
33
+ /**
34
+ * Applies optional keyword fixture replacements to rendered component output during local preview.
35
+ */
36
+ export declare function applyLocalMatrixKeywordReplacements(output: FunctionReturnTypes, options: {
37
+ manifestPath: string;
38
+ responseType: ResponseType;
39
+ }, logger: Logger): Promise<FunctionReturnTypes>;
40
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -1,6 +1,7 @@
1
1
  import { Controller } from 'tsoa';
2
2
  import { ComponentFunctionService, ManifestService } from '@squiz/component-lib';
3
3
  import { MANIFEST_MODELS } from '@squiz/dx-json-schema-lib';
4
+ import { Logger } from '@squiz/dx-logger-lib';
4
5
  import { DevelopmentComponentRunnerService, FunctionReturnTypes } from '../../component-runner';
5
6
  import { Config } from '../../ioc';
6
7
  import { Request as ExpressRequest, Response as ExpressResponse } from 'express';
@@ -14,12 +15,13 @@ type ComponentSchema = {
14
15
  };
15
16
  export declare class DevelopmentController extends Controller {
16
17
  private config;
18
+ private logger;
17
19
  private manifestService;
18
20
  private componentRunnerService;
19
21
  protected renderInputService: RenderInputService;
20
22
  protected componentPreviewService: ComponentPreviewService;
21
23
  protected componentFunctionService: ComponentFunctionService;
22
- constructor(config: Config, manifestService: ManifestService, componentRunnerService: DevelopmentComponentRunnerService, renderInputService: RenderInputService, componentPreviewService: ComponentPreviewService, componentFunctionService: ComponentFunctionService);
24
+ constructor(config: Config, logger: Logger, manifestService: ManifestService, componentRunnerService: DevelopmentComponentRunnerService, renderInputService: RenderInputService, componentPreviewService: ComponentPreviewService, componentFunctionService: ComponentFunctionService);
23
25
  /**
24
26
  * Returns an array of all component manifests in the data mount point
25
27
  * @return {*} {Promise<ComponentManifest[]>}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@squiz/edge-dev-render-runtime-lib",
3
- "version": "2.8.0",
3
+ "version": "2.9.1",
4
4
  "description": "Package of Edge rendering utilities for components in dev mode",
5
5
  "homepage": "",
6
6
  "license": "ISC",
@@ -13,20 +13,21 @@
13
13
  "lib": "lib"
14
14
  },
15
15
  "dependencies": {
16
- "@squiz/component-lib": "^1.91.0",
16
+ "@squiz/component-lib": "^1.93.9",
17
17
  "@squiz/component-logger-lib": "^1.71.3",
18
- "@squiz/component-web-api-lib": "^1.77.0",
18
+ "@squiz/component-web-api-lib": "^1.78.1",
19
+ "@squiz/dxp-content-helpers": "^1.3.1",
19
20
  "@squiz/dx-common-lib": "^1.71.1",
20
21
  "@squiz/dx-json-schema-lib": "^1.87.0",
21
22
  "@squiz/dx-logger-lib": "^1.65.1",
22
23
  "@squiz/formatted-text-lib": "^1.71.2",
23
24
  "@squiz/local-component-runtime": "*",
24
25
  "@squiz/runtime-sandbox-common": "^1.65.2",
25
- "compression": "1.8.1",
26
+ "compression": "1.8.2",
26
27
  "cors": "2.8.5",
27
28
  "dotenv": "16.6.1",
28
29
  "esbuild": "^0.28.1",
29
- "express": "^4.22.0",
30
+ "express": "^4.22.3",
30
31
  "fs-extra": "11.1.0",
31
32
  "helmet": "6.0.1",
32
33
  "inversify": "6.0.2",