@podium/podlet 5.1.4 → 5.1.5
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 +8 -0
- package/lib/podlet.js +3 -12
- package/package.json +5 -4
- package/types/podlet.d.ts +19 -19
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
## [5.1.5](https://github.com/podium-lib/podlet/compare/v5.1.4...v5.1.5) (2024-05-14)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* add docs to podiumSend method ([6f087f2](https://github.com/podium-lib/podlet/commit/6f087f2b9a815d02b844719706499e22912073b2))
|
|
7
|
+
* update dependency typings ([bf4bc75](https://github.com/podium-lib/podlet/commit/bf4bc7550e5364f133b84e01e1a562aed35fed06))
|
|
8
|
+
|
|
1
9
|
## [5.1.4](https://github.com/podium-lib/podlet/compare/v5.1.3...v5.1.4) (2024-05-13)
|
|
2
10
|
|
|
3
11
|
|
package/lib/podlet.js
CHANGED
|
@@ -5,20 +5,15 @@
|
|
|
5
5
|
|
|
6
6
|
import {
|
|
7
7
|
HttpIncoming,
|
|
8
|
-
// @ts-ignore
|
|
9
8
|
pathnameBuilder,
|
|
10
9
|
AssetCss,
|
|
11
10
|
AssetJs,
|
|
12
11
|
} from '@podium/utils';
|
|
13
|
-
// @ts-ignore
|
|
14
12
|
import * as schema from '@podium/schemas';
|
|
15
13
|
import Metrics from '@metrics/client';
|
|
16
|
-
// @ts-ignore
|
|
17
14
|
import abslog from 'abslog';
|
|
18
|
-
// @ts-ignore
|
|
19
15
|
import objobj from 'objobj';
|
|
20
16
|
import * as utils from '@podium/utils';
|
|
21
|
-
// @ts-ignore
|
|
22
17
|
import Proxy from '@podium/proxy';
|
|
23
18
|
import { join, dirname } from 'node:path';
|
|
24
19
|
import { fileURLToPath } from 'node:url';
|
|
@@ -31,13 +26,9 @@ const pkgJson = fs.readFileSync(
|
|
|
31
26
|
);
|
|
32
27
|
const pkg = JSON.parse(pkgJson);
|
|
33
28
|
|
|
34
|
-
// @ts-ignore
|
|
35
29
|
const { template } = utils;
|
|
36
30
|
|
|
37
31
|
/**
|
|
38
|
-
* @typedef {(...args: any) => void} LogFunction
|
|
39
|
-
* @typedef {{ trace: LogFunction, debug: LogFunction, info: LogFunction, warn: LogFunction, error: LogFunction, fatal: LogFunction }} AbsLogger
|
|
40
|
-
*
|
|
41
32
|
* @typedef {Object} PodletOptions
|
|
42
33
|
* @property {string} name - (required) podlet name
|
|
43
34
|
* @property {string} version - (required) podlet version
|
|
@@ -46,8 +37,8 @@ const { template } = utils;
|
|
|
46
37
|
* @property {string} [content] - path where the podlet content HTML markup is served from (default '/')
|
|
47
38
|
* @property {string} [fallback] - path where the podlet fallback HTML markup is served from (default '/fallback')
|
|
48
39
|
* @property {boolean} [development] - a boolean flag that, when true, enables additional development setup (default false)
|
|
49
|
-
* @property {
|
|
50
|
-
* @property {import("@podium/proxy").
|
|
40
|
+
* @property {import('abslog').AbstractLoggerOptions} [logger] - 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)
|
|
41
|
+
* @property {import("@podium/proxy").PodiumProxyOptions} [proxy] - options that can be provided to configure the @podium/proxy instance used by the podlet. See that module for details.
|
|
51
42
|
*
|
|
52
43
|
* @typedef {{ debug: 'true' | 'false', locale: string, deviceType: string, requestedBy: string, mountOrigin: string, mountPathname: string, publicPathname: string }} PodletContext
|
|
53
44
|
* @typedef {{ as?: string | false | null, crossorigin?: string | null | boolean, disabled?: boolean | '' | null, hreflang?: string | false | null, title?: string | false | null, media?: string | false | null, rel?: string | false | null, type?: string | false | null, value: string | false | null, data?: Array<{ key: string; value: string }>, strategy?: "beforeInteractive" | "afterInteractive" | "lazy", scope?: "content" | "fallback" | "all", [key: string]: any }} AssetCssLike
|
|
@@ -137,7 +128,7 @@ export default class PodiumPodlet {
|
|
|
137
128
|
* podlet.log.fatal('fatal log to the console')
|
|
138
129
|
* ```
|
|
139
130
|
*
|
|
140
|
-
* @type {
|
|
131
|
+
* @type {import('abslog').ValidLogger}
|
|
141
132
|
*/
|
|
142
133
|
log;
|
|
143
134
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@podium/podlet",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Module for building page fragment servers in a micro frontend architecture.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -26,13 +26,13 @@
|
|
|
26
26
|
"scripts": {
|
|
27
27
|
"lint": "eslint .",
|
|
28
28
|
"lint:fix": "eslint --fix .",
|
|
29
|
-
"test": "tap --disable-coverage --allow-empty-coverage",
|
|
29
|
+
"test": "tap --disable-coverage --allow-empty-coverage && tsc --project tsconfig.test.json",
|
|
30
30
|
"types": "tsc --declaration --emitDeclarationOnly && ./fixup.sh"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@metrics/client": "2.5.2",
|
|
34
|
-
"@podium/proxy": "5.0.
|
|
35
|
-
"@podium/schemas": "5.0.
|
|
34
|
+
"@podium/proxy": "5.0.16",
|
|
35
|
+
"@podium/schemas": "5.0.2",
|
|
36
36
|
"@podium/utils": "5.0.6",
|
|
37
37
|
"abslog": "2.4.4",
|
|
38
38
|
"ajv": "8.13.0",
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
"@semantic-release/npm": "11.0.3",
|
|
49
49
|
"@semantic-release/release-notes-generator": "12.1.0",
|
|
50
50
|
"@types/node": "^20.10.3",
|
|
51
|
+
"@types/readable-stream": "4.0.14",
|
|
51
52
|
"eslint": "8.57.0",
|
|
52
53
|
"eslint-config-airbnb-base": "15.0.0",
|
|
53
54
|
"eslint-config-prettier": "9.1.0",
|
package/types/podlet.d.ts
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @typedef {(...args: any) => void} LogFunction
|
|
3
|
-
* @typedef {{ trace: LogFunction, debug: LogFunction, info: LogFunction, warn: LogFunction, error: LogFunction, fatal: LogFunction }} AbsLogger
|
|
4
|
-
*
|
|
5
2
|
* @typedef {Object} PodletOptions
|
|
6
3
|
* @property {string} name - (required) podlet name
|
|
7
4
|
* @property {string} version - (required) podlet version
|
|
@@ -10,8 +7,8 @@
|
|
|
10
7
|
* @property {string} [content] - path where the podlet content HTML markup is served from (default '/')
|
|
11
8
|
* @property {string} [fallback] - path where the podlet fallback HTML markup is served from (default '/fallback')
|
|
12
9
|
* @property {boolean} [development] - a boolean flag that, when true, enables additional development setup (default false)
|
|
13
|
-
* @property {
|
|
14
|
-
* @property {import("@podium/proxy").
|
|
10
|
+
* @property {import('abslog').AbstractLoggerOptions} [logger] - 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)
|
|
11
|
+
* @property {import("@podium/proxy").PodiumProxyOptions} [proxy] - options that can be provided to configure the @podium/proxy instance used by the podlet. See that module for details.
|
|
15
12
|
*
|
|
16
13
|
* @typedef {{ debug: 'true' | 'false', locale: string, deviceType: string, requestedBy: string, mountOrigin: string, mountPathname: string, publicPathname: string }} PodletContext
|
|
17
14
|
* @typedef {{ as?: string | false | null, crossorigin?: string | null | boolean, disabled?: boolean | '' | null, hreflang?: string | false | null, title?: string | false | null, media?: string | false | null, rel?: string | false | null, type?: string | false | null, value: string | false | null, data?: Array<{ key: string; value: string }>, strategy?: "beforeInteractive" | "afterInteractive" | "lazy", scope?: "content" | "fallback" | "all", [key: string]: any }} AssetCssLike
|
|
@@ -98,9 +95,9 @@ export default class PodiumPodlet {
|
|
|
98
95
|
* podlet.log.fatal('fatal log to the console')
|
|
99
96
|
* ```
|
|
100
97
|
*
|
|
101
|
-
* @type {
|
|
98
|
+
* @type {import('abslog').ValidLogger}
|
|
102
99
|
*/
|
|
103
|
-
log:
|
|
100
|
+
log: import('abslog').ValidLogger;
|
|
104
101
|
/**
|
|
105
102
|
* An instance of the `@podium/proxy` module
|
|
106
103
|
* @see https://github.com/podium-lib/proxy
|
|
@@ -558,15 +555,6 @@ export default class PodiumPodlet {
|
|
|
558
555
|
get [Symbol.toStringTag](): string;
|
|
559
556
|
#private;
|
|
560
557
|
}
|
|
561
|
-
export type LogFunction = (...args: any) => void;
|
|
562
|
-
export type AbsLogger = {
|
|
563
|
-
trace: LogFunction;
|
|
564
|
-
debug: LogFunction;
|
|
565
|
-
info: LogFunction;
|
|
566
|
-
warn: LogFunction;
|
|
567
|
-
error: LogFunction;
|
|
568
|
-
fatal: LogFunction;
|
|
569
|
-
};
|
|
570
558
|
export type PodletOptions = {
|
|
571
559
|
/**
|
|
572
560
|
* - (required) podlet name
|
|
@@ -599,11 +587,11 @@ export type PodletOptions = {
|
|
|
599
587
|
/**
|
|
600
588
|
* - 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)
|
|
601
589
|
*/
|
|
602
|
-
logger?:
|
|
590
|
+
logger?: import('abslog').AbstractLoggerOptions;
|
|
603
591
|
/**
|
|
604
592
|
* - options that can be provided to configure the
|
|
605
593
|
*/
|
|
606
|
-
proxy?: import("@podium/proxy").
|
|
594
|
+
proxy?: import("@podium/proxy").PodiumProxyOptions;
|
|
607
595
|
};
|
|
608
596
|
export type PodletContext = {
|
|
609
597
|
debug: 'true' | 'false';
|
|
@@ -656,7 +644,19 @@ import Metrics from '@metrics/client';
|
|
|
656
644
|
import { HttpIncoming } from '@podium/utils';
|
|
657
645
|
declare global {
|
|
658
646
|
namespace Express {
|
|
659
|
-
interface Response {
|
|
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
660
|
podiumSend(fragment: string, ...args: unknown[]): Response;
|
|
661
661
|
}
|
|
662
662
|
}
|