@podium/podlet 5.1.8 → 5.1.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.
package/README.md CHANGED
@@ -993,7 +993,7 @@ SOFTWARE.
993
993
  [@podium/proxy]: https://github.com/podium-lib/proxy '@podium/proxy'
994
994
  [express]: https://expressjs.com/ 'Express'
995
995
  [hapi podlet plugin]: https://github.com/podium-lib/hapi-podlet 'Hapi Podlet Plugin'
996
- [httpincoming]: https://github.com/podium-lib/utils/blob/master/lib/http-incoming.js 'HttpIncoming'
996
+ [httpincoming]: https://github.com/podium-lib/utils/blob/main/lib/http-incoming.js 'HttpIncoming'
997
997
  [publicpathname]: https://github.com/podium-lib/context#public-pathname '`publicPathname`'
998
998
  [mountorigin]: https://github.com/podium-lib/context#mount-origin '`mountOrigin`'
999
999
  [abslog]: https://github.com/trygve-lie/abslog 'abslog'
package/lib/podlet.js CHANGED
@@ -1,8 +1,3 @@
1
- /* eslint-disable consistent-return */
2
- /* eslint-disable no-underscore-dangle */
3
- /* eslint-disable no-restricted-syntax */
4
- /* eslint-disable no-param-reassign */
5
-
6
1
  import {
7
2
  HttpIncoming,
8
3
  pathnameBuilder,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@podium/podlet",
3
- "version": "5.1.8",
3
+ "version": "5.1.10",
4
4
  "type": "module",
5
5
  "description": "Module for building page fragment servers in a micro frontend architecture.",
6
6
  "license": "MIT",
@@ -26,20 +26,24 @@
26
26
  "scripts": {
27
27
  "lint": "eslint .",
28
28
  "lint:fix": "eslint --fix .",
29
- "test": "tap --disable-coverage --allow-empty-coverage && tsc --project tsconfig.test.json",
30
- "types": "tsc --declaration --emitDeclarationOnly && ./fixup.sh"
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",
33
+ "types:tsc": "tsc --declaration --emitDeclarationOnly",
34
+ "types:fixup": "node ./fixup.js"
31
35
  },
32
36
  "dependencies": {
33
37
  "@metrics/client": "2.5.2",
34
- "@podium/proxy": "5.0.21",
35
- "@podium/schemas": "5.0.5",
38
+ "@podium/proxy": "5.0.22",
39
+ "@podium/schemas": "5.0.6",
36
40
  "@podium/utils": "5.0.7",
37
41
  "abslog": "2.4.4",
38
- "ajv": "8.16.0",
42
+ "ajv": "8.17.1",
39
43
  "objobj": "1.0.0"
40
44
  },
41
45
  "devDependencies": {
42
- "@babel/eslint-parser": "7.24.6",
46
+ "@babel/eslint-parser": "7.24.7",
43
47
  "@podium/test-utils": "2.5.2",
44
48
  "@semantic-release/changelog": "6.0.3",
45
49
  "@semantic-release/commit-analyzer": "11.1.0",
@@ -49,16 +53,16 @@
49
53
  "@semantic-release/release-notes-generator": "12.1.0",
50
54
  "@types/node": "^20.10.3",
51
55
  "@types/readable-stream": "4.0.14",
52
- "eslint": "8.57.0",
53
- "eslint-config-airbnb-base": "15.0.0",
56
+ "eslint": "9.6.0",
54
57
  "eslint-config-prettier": "9.1.0",
55
- "eslint-plugin-import": "2.29.1",
56
58
  "eslint-plugin-prettier": "5.1.3",
57
59
  "express": "4.19.2",
60
+ "globals": "15.8.0",
58
61
  "json-stringify-safe": "5.0.1",
59
- "prettier": "3.2.5",
62
+ "npm-run-all": "4.1.5",
63
+ "prettier": "3.3.2",
60
64
  "semantic-release": "23.1.1",
61
65
  "tap": "18.8.0",
62
- "typescript": "5.4.5"
66
+ "typescript": "5.5.3"
63
67
  }
64
68
  }
package/types/podlet.d.ts CHANGED
@@ -1,3 +1,30 @@
1
+
2
+ import type { HttpIncoming } from "@podium/utils";
3
+
4
+ declare global {
5
+ namespace Express {
6
+ export interface Locals {
7
+ podium: HttpIncoming;
8
+ }
9
+
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;
24
+ }
25
+ }
26
+ }
27
+
1
28
  /**
2
29
  * @typedef {Object} PodletOptions
3
30
  * @property {string} name - (required) podlet name
@@ -97,7 +124,7 @@ export default class PodiumPodlet {
97
124
  *
98
125
  * @type {import('abslog').ValidLogger}
99
126
  */
100
- log: import('abslog').ValidLogger;
127
+ log: import("abslog").ValidLogger;
101
128
  /**
102
129
  * An instance of the `@podium/proxy` module
103
130
  * @see https://github.com/podium-lib/proxy
@@ -466,7 +493,7 @@ export default class PodiumPodlet {
466
493
  */
467
494
  view<T extends {
468
495
  [key: string]: unknown;
469
- }>(fn: (incoming: HttpIncoming<T, Record<string, unknown>, Record<string, unknown>>, fragment: string, ...args: unknown[]) => string): void;
496
+ }>(fn: (incoming: HttpIncoming<T>, fragment: string, ...args: unknown[]) => string): void;
470
497
  /**
471
498
  * Method for serialising the podlet instance into a plain JS object. Called automatically when stringifying the podlet with JSON.stringify(podlet).
472
499
  * Doing so will result in a correct Podium manifest file string and so is suitable for usage in a manifest route hook.
@@ -515,9 +542,9 @@ export default class PodiumPodlet {
515
542
  * @param {...any} args - additional args depending on the template and what values it accepts
516
543
  * @returns {string}
517
544
  */
518
- render<T_1 extends {
545
+ render<T extends {
519
546
  [key: string]: unknown;
520
- }>(incoming: HttpIncoming<T_1, Record<string, unknown>, Record<string, unknown>>, data: string, ...args: any[]): string;
547
+ }>(incoming: HttpIncoming<T>, data: string, ...args: any[]): string;
521
548
  /**
522
549
  * Method for processing an incoming HTTP request. This method is intended to be used to implement support for multiple HTTP frameworks and in most cases will not need to be used directly by podlet developers when creating podlet servers.
523
550
  *
@@ -587,14 +614,14 @@ export type PodletOptions = {
587
614
  /**
588
615
  * - a logger to use when provided. Can be the console object if console logging is desired but can also be any Log4j compatible logging object as well. Nothing is logged if no logger is provided. (default null)
589
616
  */
590
- logger?: import('abslog').AbstractLoggerOptions;
617
+ logger?: import("abslog").AbstractLoggerOptions;
591
618
  /**
592
619
  * - options that can be provided to configure the
593
620
  */
594
621
  proxy?: import("@podium/proxy").PodiumProxyOptions;
595
622
  };
596
623
  export type PodletContext = {
597
- debug: 'true' | 'false';
624
+ debug: "true" | "false";
598
625
  locale: string;
599
626
  deviceType: string;
600
627
  requestedBy: string;
@@ -605,7 +632,7 @@ export type PodletContext = {
605
632
  export type AssetCssLike = {
606
633
  as?: string | false | null;
607
634
  crossorigin?: string | null | boolean;
608
- disabled?: boolean | '' | null;
635
+ disabled?: boolean | "" | null;
609
636
  hreflang?: string | false | null;
610
637
  title?: string | false | null;
611
638
  media?: string | false | null;
@@ -626,9 +653,9 @@ export type AssetJsLike = {
626
653
  type?: string | null | false;
627
654
  integrity?: string | null | false;
628
655
  referrerpolicy?: string | null | false;
629
- nomodule?: boolean | null | '';
630
- async?: boolean | null | '';
631
- defer?: boolean | null | '';
656
+ nomodule?: boolean | null | "";
657
+ async?: boolean | null | "";
658
+ defer?: boolean | null | "";
632
659
  data?: Array<{
633
660
  key: string;
634
661
  value: string;
@@ -642,22 +669,3 @@ import { AssetCss } from '@podium/utils';
642
669
  import { AssetJs } from '@podium/utils';
643
670
  import Metrics from '@metrics/client';
644
671
  import { HttpIncoming } from '@podium/utils';
645
- declare global {
646
- namespace Express {
647
- export interface Response {
648
- /**
649
- * Calls the send / write method on the `http.ServerResponse` object.
650
- *
651
- * When in development mode this method will wrap the provided fragment in a
652
- * default HTML document before dispatching. When not in development mode, this
653
- * method will just dispatch the fragment.
654
- *
655
- * @example
656
- * app.get(podlet.content(), (req, res) => {
657
- * res.podiumSend('<h1>Hello World</h1>');
658
- * });
659
- */
660
- podiumSend(fragment: string, ...args: unknown[]): Response;
661
- }
662
- }
663
- }