@podium/podlet 5.1.16 → 5.1.18

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/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## [5.1.18](https://github.com/podium-lib/podlet/compare/v5.1.17...v5.1.18) (2024-10-11)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * include some app info as a default metric ([5c9fdcb](https://github.com/podium-lib/podlet/commit/5c9fdcb269f9b1867f8df127fcd412f150d3ca95))
7
+
8
+ ## [5.1.17](https://github.com/podium-lib/podlet/compare/v5.1.16...v5.1.17) (2024-09-23)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * type the known context values in an extendable way ([#427](https://github.com/podium-lib/podlet/issues/427)) ([f90ef57](https://github.com/podium-lib/podlet/commit/f90ef577cf6f0fdeabb08edb121a8a0107e77c4d))
14
+
1
15
  ## [5.1.16](https://github.com/podium-lib/podlet/compare/v5.1.15...v5.1.16) (2024-09-23)
2
16
 
3
17
 
package/lib/podlet.js CHANGED
@@ -382,6 +382,18 @@ export default class PodiumPodlet {
382
382
  });
383
383
 
384
384
  versionGauge.set(1);
385
+
386
+ const podletGauge = this.metrics.gauge({
387
+ name: 'podium_podlet_application_info',
388
+ description: '@podium/podlet application info',
389
+ labels: {
390
+ name: this.name,
391
+ version: this.version,
392
+ has_fallback: Boolean(fallback),
393
+ },
394
+ });
395
+
396
+ podletGauge.set(1);
385
397
  });
386
398
 
387
399
  // @ts-ignore
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@podium/podlet",
3
- "version": "5.1.16",
3
+ "version": "5.1.18",
4
4
  "type": "module",
5
5
  "description": "Module for building page fragment servers in a micro frontend architecture.",
6
6
  "license": "MIT",
@@ -26,11 +26,10 @@
26
26
  "scripts": {
27
27
  "lint": "eslint .",
28
28
  "lint:fix": "eslint --fix .",
29
- "test": "run-s test:*",
30
- "test:unit": "tap --disable-coverage --allow-empty-coverage",
31
- "test:types": "tsc --project tsconfig.test.json",
32
- "types": "run-s types:tsc types:fixup",
29
+ "test": "tap --disable-coverage --allow-empty-coverage",
30
+ "types": "run-s types:tsc types:fixup types:test",
33
31
  "types:tsc": "tsc --declaration --emitDeclarationOnly",
32
+ "types:test": "tsc --project tsconfig.test.json",
34
33
  "types:fixup": "node ./fixup.js"
35
34
  },
36
35
  "dependencies": {
@@ -43,25 +42,18 @@
43
42
  "objobj": "1.0.0"
44
43
  },
45
44
  "devDependencies": {
46
- "@babel/eslint-parser": "7.25.1",
47
- "@podium/test-utils": "3.0.8",
48
- "@semantic-release/changelog": "6.0.3",
49
- "@semantic-release/commit-analyzer": "11.1.0",
50
- "@semantic-release/git": "10.0.1",
51
- "@semantic-release/github": "9.2.6",
52
- "@semantic-release/npm": "11.0.3",
53
- "@semantic-release/release-notes-generator": "12.1.0",
54
- "@types/node": "^20.10.3",
45
+ "@podium/eslint-config": "1.0.0",
46
+ "@podium/semantic-release-config": "2.0.0",
47
+ "@podium/test-utils": "3.0.10",
48
+ "@podium/typescript-config": "1.0.0",
49
+ "@types/node": "20.16.10",
55
50
  "@types/readable-stream": "4.0.15",
56
- "eslint": "9.9.1",
57
- "eslint-config-prettier": "9.1.0",
58
- "eslint-plugin-prettier": "5.2.1",
51
+ "eslint": "9.11.1",
59
52
  "express": "4.20.0",
60
- "globals": "15.9.0",
61
53
  "json-stringify-safe": "5.0.1",
62
54
  "npm-run-all2": "6.2.3",
63
55
  "prettier": "3.3.3",
64
- "semantic-release": "23.1.1",
56
+ "semantic-release": "24.1.2",
65
57
  "tap": "18.8.0",
66
58
  "typescript": "5.5.4"
67
59
  }
@@ -0,0 +1,72 @@
1
+ declare global {
2
+ namespace Express {
3
+ export interface PodiumHttpIncomingParameters {
4
+ [key: string]: unknown;
5
+ }
6
+
7
+ export interface PodiumHttpIncomingContext {
8
+ /**
9
+ * @see https://podium-lib.io/docs/guides/context#default-context-variables
10
+ */
11
+ debug?: string;
12
+ /**
13
+ * Does user agent sniffing to try to guess the visitor's device type.
14
+ * @see https://podium-lib.io/docs/guides/context#default-context-variables
15
+ */
16
+ deviceType?: string;
17
+ /**
18
+ * Locale information from the layout.
19
+ * @see https://podium-lib.io/docs/guides/context#default-context-variables
20
+ */
21
+ locale?: string;
22
+ /**
23
+ * Used to calculate the podlet's public URL when proxied behind a layout.
24
+ * @see https://podium-lib.io/docs/guides/context#construct-public-urls
25
+ */
26
+ mountOrigin?: string;
27
+ /**
28
+ * Used to calculate the podlet's public URL when proxied behind a layout.
29
+ * @see https://podium-lib.io/docs/guides/context#construct-public-urls
30
+ */
31
+ mountPathname?: string;
32
+ /**
33
+ * Used to calculate the podlet's public URL when proxied behind a layout.
34
+ * @see https://podium-lib.io/docs/guides/context#construct-public-urls
35
+ */
36
+ publicPathname?: string;
37
+ /**
38
+ * Name of the caller.
39
+ */
40
+ requestedBy?: string;
41
+ [key: string]: unknown;
42
+ }
43
+
44
+ export interface PodiumHttpIncomingViewParameters {
45
+ [key: string]: unknown;
46
+ }
47
+
48
+ export interface Locals {
49
+ podium: HttpIncoming<
50
+ PodiumHttpIncomingParameters,
51
+ PodiumHttpIncomingContext,
52
+ PodiumHttpIncomingViewParameters
53
+ >;
54
+ }
55
+
56
+ export interface Response {
57
+ /**
58
+ * Calls the send / write method on the `http.ServerResponse` object.
59
+ *
60
+ * When in development mode this method will wrap the provided fragment in a
61
+ * default HTML document before dispatching. When not in development mode, this
62
+ * method will just dispatch the fragment.
63
+ *
64
+ * @example
65
+ * app.get(podlet.content(), (req, res) => {
66
+ * res.podiumSend('<h1>Hello World</h1>');
67
+ * });
68
+ */
69
+ podiumSend(fragment: string, ...args: unknown[]): Response;
70
+ }
71
+ }
72
+ }
package/types/podlet.d.ts CHANGED
@@ -1,28 +1,74 @@
1
+ declare global {
2
+ namespace Express {
3
+ export interface PodiumHttpIncomingParameters {
4
+ [key: string]: unknown;
5
+ }
1
6
 
2
- import type { HttpIncoming } from "@podium/utils";
7
+ export interface PodiumHttpIncomingContext {
8
+ /**
9
+ * @see https://podium-lib.io/docs/guides/context#default-context-variables
10
+ */
11
+ debug?: string;
12
+ /**
13
+ * Does user agent sniffing to try to guess the visitor's device type.
14
+ * @see https://podium-lib.io/docs/guides/context#default-context-variables
15
+ */
16
+ deviceType?: string;
17
+ /**
18
+ * Locale information from the layout.
19
+ * @see https://podium-lib.io/docs/guides/context#default-context-variables
20
+ */
21
+ locale?: string;
22
+ /**
23
+ * Used to calculate the podlet's public URL when proxied behind a layout.
24
+ * @see https://podium-lib.io/docs/guides/context#construct-public-urls
25
+ */
26
+ mountOrigin?: string;
27
+ /**
28
+ * Used to calculate the podlet's public URL when proxied behind a layout.
29
+ * @see https://podium-lib.io/docs/guides/context#construct-public-urls
30
+ */
31
+ mountPathname?: string;
32
+ /**
33
+ * Used to calculate the podlet's public URL when proxied behind a layout.
34
+ * @see https://podium-lib.io/docs/guides/context#construct-public-urls
35
+ */
36
+ publicPathname?: string;
37
+ /**
38
+ * Name of the caller.
39
+ */
40
+ requestedBy?: string;
41
+ [key: string]: unknown;
42
+ }
3
43
 
4
- declare global {
5
- namespace Express {
6
- export interface Locals {
7
- podium: HttpIncoming;
8
- }
44
+ export interface PodiumHttpIncomingViewParameters {
45
+ [key: string]: unknown;
46
+ }
47
+
48
+ export interface Locals {
49
+ podium: HttpIncoming<
50
+ PodiumHttpIncomingParameters,
51
+ PodiumHttpIncomingContext,
52
+ PodiumHttpIncomingViewParameters
53
+ >;
54
+ }
9
55
 
10
- export interface Response {
11
- /**
12
- * Calls the send / write method on the `http.ServerResponse` object.
13
- *
14
- * When in development mode this method will wrap the provided fragment in a
15
- * default HTML document before dispatching. When not in development mode, this
16
- * method will just dispatch the fragment.
17
- *
18
- * @example
19
- * app.get(podlet.content(), (req, res) => {
20
- * res.podiumSend('<h1>Hello World</h1>');
21
- * });
22
- */
23
- podiumSend(fragment: string, ...args: unknown[]): Response;
56
+ export interface Response {
57
+ /**
58
+ * Calls the send / write method on the `http.ServerResponse` object.
59
+ *
60
+ * When in development mode this method will wrap the provided fragment in a
61
+ * default HTML document before dispatching. When not in development mode, this
62
+ * method will just dispatch the fragment.
63
+ *
64
+ * @example
65
+ * app.get(podlet.content(), (req, res) => {
66
+ * res.podiumSend('<h1>Hello World</h1>');
67
+ * });
68
+ */
69
+ podiumSend(fragment: string, ...args: unknown[]): Response;
70
+ }
24
71
  }
25
- }
26
72
  }
27
73
 
28
74
  /**