@podium/podlet 5.2.0-next.6 → 5.2.0-next.8
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 +21 -114
- package/lib/podlet.js +23 -11
- package/package.json +15 -23
- package/types/podium.d.ts +72 -0
- package/types/podlet.d.ts +79 -33
package/CHANGELOG.md
CHANGED
|
@@ -1,156 +1,63 @@
|
|
|
1
|
-
# [5.2.0-next.
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
### Features
|
|
5
|
-
|
|
6
|
-
* replace early hints with link header ([815ea97](https://github.com/podium-lib/podlet/commit/815ea97df599676a6a1dd56dd6aeef4f91b27c95))
|
|
7
|
-
|
|
8
|
-
# [5.2.0-next.5](https://github.com/podium-lib/podlet/compare/v5.2.0-next.4...v5.2.0-next.5) (2024-09-29)
|
|
1
|
+
# [5.2.0-next.8](https://github.com/podium-lib/podlet/compare/v5.2.0-next.7...v5.2.0-next.8) (2024-11-04)
|
|
9
2
|
|
|
10
3
|
|
|
11
4
|
### Bug Fixes
|
|
12
5
|
|
|
13
|
-
*
|
|
6
|
+
* use more appropriate strategy instead of scope ([0674a81](https://github.com/podium-lib/podlet/commit/0674a812abe9c246f4c007e1869723dc7c0293a0))
|
|
14
7
|
|
|
15
|
-
# [5.2.0-next.
|
|
8
|
+
# [5.2.0-next.7](https://github.com/podium-lib/podlet/compare/v5.2.0-next.6...v5.2.0-next.7) (2024-10-22)
|
|
16
9
|
|
|
17
10
|
|
|
18
11
|
### Bug Fixes
|
|
19
12
|
|
|
20
|
-
*
|
|
21
|
-
|
|
22
|
-
|
|
13
|
+
* correct the JSDoc for fallback ([#423](https://github.com/podium-lib/podlet/issues/423)) ([7444897](https://github.com/podium-lib/podlet/commit/7444897b7cf45a9e2b9c310ce309f69f80fa91d1))
|
|
14
|
+
* **deps:** update all dependencies (non-major) ([b8eddfd](https://github.com/podium-lib/podlet/commit/b8eddfd676810607adc56cdc71d2622e73b25e0e))
|
|
15
|
+
* **deps:** update all dependencies (non-major) ([81119fe](https://github.com/podium-lib/podlet/commit/81119feda716c226777751564ac9153c7c393096))
|
|
16
|
+
* **deps:** update dependency @podium/proxy to v5.0.26 ([59699f0](https://github.com/podium-lib/podlet/commit/59699f029ee32ff4997c7e971bb543ee6a971251))
|
|
17
|
+
* include some app info as a default metric ([5c9fdcb](https://github.com/podium-lib/podlet/commit/5c9fdcb269f9b1867f8df127fcd412f150d3ca95))
|
|
18
|
+
* 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))
|
|
23
19
|
|
|
24
|
-
|
|
25
|
-
### Features
|
|
26
|
-
|
|
27
|
-
* add DSD shadow DOM encapsulation support ([02c9a64](https://github.com/podium-lib/podlet/commit/02c9a64a6bb2f460c035416e43405ae380cb6d1c))
|
|
28
|
-
|
|
29
|
-
# [5.2.0-next.2](https://github.com/podium-lib/podlet/compare/v5.2.0-next.1...v5.2.0-next.2) (2024-09-06)
|
|
20
|
+
## [5.1.18](https://github.com/podium-lib/podlet/compare/v5.1.17...v5.1.18) (2024-10-11)
|
|
30
21
|
|
|
31
22
|
|
|
32
23
|
### Bug Fixes
|
|
33
24
|
|
|
34
|
-
*
|
|
35
|
-
* force release 5.2.0-next.2 ([84223e8](https://github.com/podium-lib/podlet/commit/84223e823125544eb40cbd50b2558bcb78ba9ce6))
|
|
36
|
-
* force release 5.2.0-next.2 ([4f5f19d](https://github.com/podium-lib/podlet/commit/4f5f19d9e486461b822dddf4bf278207927c63be))
|
|
37
|
-
* force release 5.2.0-next.2 ([a5a1953](https://github.com/podium-lib/podlet/commit/a5a19536aab17130e79f14b2a8d7e7f58e61d0f0))
|
|
38
|
-
* update @podium/utils ([719c1e0](https://github.com/podium-lib/podlet/commit/719c1e0ae4e06144e084e8b95bd04d94313b116e))
|
|
25
|
+
* include some app info as a default metric ([5c9fdcb](https://github.com/podium-lib/podlet/commit/5c9fdcb269f9b1867f8df127fcd412f150d3ca95))
|
|
39
26
|
|
|
40
|
-
|
|
27
|
+
## [5.1.17](https://github.com/podium-lib/podlet/compare/v5.1.16...v5.1.17) (2024-09-23)
|
|
41
28
|
|
|
42
29
|
|
|
43
30
|
### Bug Fixes
|
|
44
31
|
|
|
45
|
-
*
|
|
46
|
-
* force release 5.2.0-next.2 ([84223e8](https://github.com/podium-lib/podlet/commit/84223e823125544eb40cbd50b2558bcb78ba9ce6))
|
|
47
|
-
* force release 5.2.0-next.2 ([4f5f19d](https://github.com/podium-lib/podlet/commit/4f5f19d9e486461b822dddf4bf278207927c63be))
|
|
48
|
-
* force release 5.2.0-next.2 ([a5a1953](https://github.com/podium-lib/podlet/commit/a5a19536aab17130e79f14b2a8d7e7f58e61d0f0))
|
|
49
|
-
* **types:** fix AssetJsLike type ([19494f5](https://github.com/podium-lib/podlet/commit/19494f51c338468c362668678654c119993795db))
|
|
50
|
-
* update @podium/utils ([719c1e0](https://github.com/podium-lib/podlet/commit/719c1e0ae4e06144e084e8b95bd04d94313b116e))
|
|
32
|
+
* 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))
|
|
51
33
|
|
|
52
|
-
|
|
53
|
-
### Features
|
|
54
|
-
|
|
55
|
-
* automatically send assets with content/fallback requests as 103 early hints ([c4c8c88](https://github.com/podium-lib/podlet/commit/c4c8c889bc491b8a3c4a896220d1205164e6fde4))
|
|
56
|
-
|
|
57
|
-
# [5.2.0-next.1](https://github.com/podium-lib/podlet/compare/v5.1.12...v5.2.0-next.1) (2024-09-05)
|
|
34
|
+
## [5.1.16](https://github.com/podium-lib/podlet/compare/v5.1.15...v5.1.16) (2024-09-23)
|
|
58
35
|
|
|
59
36
|
|
|
60
37
|
### Bug Fixes
|
|
61
38
|
|
|
62
|
-
*
|
|
63
|
-
* force release 5.2.0-next.2 ([4f5f19d](https://github.com/podium-lib/podlet/commit/4f5f19d9e486461b822dddf4bf278207927c63be))
|
|
64
|
-
* force release 5.2.0-next.2 ([a5a1953](https://github.com/podium-lib/podlet/commit/a5a19536aab17130e79f14b2a8d7e7f58e61d0f0))
|
|
65
|
-
* **types:** fix AssetJsLike type ([19494f5](https://github.com/podium-lib/podlet/commit/19494f51c338468c362668678654c119993795db))
|
|
66
|
-
* update @podium/utils ([719c1e0](https://github.com/podium-lib/podlet/commit/719c1e0ae4e06144e084e8b95bd04d94313b116e))
|
|
39
|
+
* **deps:** update all dependencies (non-major) ([b8eddfd](https://github.com/podium-lib/podlet/commit/b8eddfd676810607adc56cdc71d2622e73b25e0e))
|
|
67
40
|
|
|
68
|
-
|
|
69
|
-
### Features
|
|
70
|
-
|
|
71
|
-
* automatically send assets with content/fallback requests as 103 early hints ([c4c8c88](https://github.com/podium-lib/podlet/commit/c4c8c889bc491b8a3c4a896220d1205164e6fde4))
|
|
72
|
-
|
|
73
|
-
# [5.2.0-next.1](https://github.com/podium-lib/podlet/compare/v5.1.12...v5.2.0-next.1) (2024-09-05)
|
|
41
|
+
## [5.1.15](https://github.com/podium-lib/podlet/compare/v5.1.14...v5.1.15) (2024-09-16)
|
|
74
42
|
|
|
75
43
|
|
|
76
44
|
### Bug Fixes
|
|
77
45
|
|
|
78
|
-
*
|
|
79
|
-
* force release 5.2.0-next.2 ([a5a1953](https://github.com/podium-lib/podlet/commit/a5a19536aab17130e79f14b2a8d7e7f58e61d0f0))
|
|
80
|
-
* **types:** fix AssetJsLike type ([19494f5](https://github.com/podium-lib/podlet/commit/19494f51c338468c362668678654c119993795db))
|
|
81
|
-
* update @podium/utils ([719c1e0](https://github.com/podium-lib/podlet/commit/719c1e0ae4e06144e084e8b95bd04d94313b116e))
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
### Features
|
|
85
|
-
|
|
86
|
-
* automatically send assets with content/fallback requests as 103 early hints ([c4c8c88](https://github.com/podium-lib/podlet/commit/c4c8c889bc491b8a3c4a896220d1205164e6fde4))
|
|
46
|
+
* correct the JSDoc for fallback ([#423](https://github.com/podium-lib/podlet/issues/423)) ([7444897](https://github.com/podium-lib/podlet/commit/7444897b7cf45a9e2b9c310ce309f69f80fa91d1))
|
|
87
47
|
|
|
88
|
-
|
|
48
|
+
## [5.1.14](https://github.com/podium-lib/podlet/compare/v5.1.13...v5.1.14) (2024-09-16)
|
|
89
49
|
|
|
90
50
|
|
|
91
51
|
### Bug Fixes
|
|
92
52
|
|
|
93
|
-
*
|
|
94
|
-
* **types:** fix AssetJsLike type ([19494f5](https://github.com/podium-lib/podlet/commit/19494f51c338468c362668678654c119993795db))
|
|
95
|
-
* update @podium/utils ([719c1e0](https://github.com/podium-lib/podlet/commit/719c1e0ae4e06144e084e8b95bd04d94313b116e))
|
|
53
|
+
* **deps:** update dependency @podium/proxy to v5.0.26 ([59699f0](https://github.com/podium-lib/podlet/commit/59699f029ee32ff4997c7e971bb543ee6a971251))
|
|
96
54
|
|
|
97
|
-
|
|
98
|
-
### Features
|
|
99
|
-
|
|
100
|
-
* automatically send assets with content/fallback requests as 103 early hints ([c4c8c88](https://github.com/podium-lib/podlet/commit/c4c8c889bc491b8a3c4a896220d1205164e6fde4))
|
|
101
|
-
|
|
102
|
-
# [5.2.0-next.1](https://github.com/podium-lib/podlet/compare/v5.1.12...v5.2.0-next.1) (2024-09-05)
|
|
55
|
+
## [5.1.13](https://github.com/podium-lib/podlet/compare/v5.1.12...v5.1.13) (2024-09-09)
|
|
103
56
|
|
|
104
57
|
|
|
105
58
|
### Bug Fixes
|
|
106
59
|
|
|
107
|
-
*
|
|
108
|
-
* **types:** fix AssetJsLike type ([19494f5](https://github.com/podium-lib/podlet/commit/19494f51c338468c362668678654c119993795db))
|
|
109
|
-
* update @podium/utils ([719c1e0](https://github.com/podium-lib/podlet/commit/719c1e0ae4e06144e084e8b95bd04d94313b116e))
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
### Features
|
|
113
|
-
|
|
114
|
-
* automatically send assets with content/fallback requests as 103 early hints ([c4c8c88](https://github.com/podium-lib/podlet/commit/c4c8c889bc491b8a3c4a896220d1205164e6fde4))
|
|
115
|
-
|
|
116
|
-
# [5.2.0-next.1](https://github.com/podium-lib/podlet/compare/v5.1.12...v5.2.0-next.1) (2024-09-05)
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
### Bug Fixes
|
|
120
|
-
|
|
121
|
-
* ensure both key/value and object conversion are supported for JS data attributes ([f243d60](https://github.com/podium-lib/podlet/commit/f243d607356166cd77c83eb72ef7ea84f4b95d80))
|
|
122
|
-
* **types:** fix AssetJsLike type ([19494f5](https://github.com/podium-lib/podlet/commit/19494f51c338468c362668678654c119993795db))
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
### Features
|
|
126
|
-
|
|
127
|
-
* automatically send assets with content/fallback requests as 103 early hints ([c4c8c88](https://github.com/podium-lib/podlet/commit/c4c8c889bc491b8a3c4a896220d1205164e6fde4))
|
|
128
|
-
|
|
129
|
-
# [5.2.0-next.1](https://github.com/podium-lib/podlet/compare/v5.1.12...v5.2.0-next.1) (2024-09-03)
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
### Bug Fixes
|
|
133
|
-
|
|
134
|
-
* ensure both key/value and object conversion are supported for JS data attributes ([f243d60](https://github.com/podium-lib/podlet/commit/f243d607356166cd77c83eb72ef7ea84f4b95d80))
|
|
135
|
-
* **types:** fix AssetJsLike type ([19494f5](https://github.com/podium-lib/podlet/commit/19494f51c338468c362668678654c119993795db))
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
### Features
|
|
139
|
-
|
|
140
|
-
* automatically send assets with content/fallback requests as 103 early hints ([c4c8c88](https://github.com/podium-lib/podlet/commit/c4c8c889bc491b8a3c4a896220d1205164e6fde4))
|
|
141
|
-
|
|
142
|
-
# [5.2.0-next.1](https://github.com/podium-lib/podlet/compare/v5.1.12...v5.2.0-next.1) (2024-08-19)
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
### Bug Fixes
|
|
146
|
-
|
|
147
|
-
* ensure both key/value and object conversion are supported for JS data attributes ([ccdfd1e](https://github.com/podium-lib/podlet/commit/ccdfd1e791c81b4c5aed045b47a316683911d929))
|
|
148
|
-
* **types:** fix AssetJsLike type ([1c29350](https://github.com/podium-lib/podlet/commit/1c29350a9f0682df675b44cf4c5e88468ab24043))
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
### Features
|
|
152
|
-
|
|
153
|
-
* add res.assets for request bound, early hinted asset sending ([caca302](https://github.com/podium-lib/podlet/commit/caca302a2d80144e24d2078c3ae8f7a8f423b1dd))
|
|
60
|
+
* **deps:** update all dependencies (non-major) ([81119fe](https://github.com/podium-lib/podlet/commit/81119feda716c226777751564ac9153c7c393096))
|
|
154
61
|
|
|
155
62
|
## [5.1.12](https://github.com/podium-lib/podlet/compare/v5.1.11...v5.1.12) (2024-08-19)
|
|
156
63
|
|
package/lib/podlet.js
CHANGED
|
@@ -34,17 +34,17 @@ const { template } = utils;
|
|
|
34
34
|
* @property {string} name - (required) podlet name
|
|
35
35
|
* @property {string} version - (required) podlet version
|
|
36
36
|
* @property {string} pathname - (required) podlet pathname
|
|
37
|
-
* @property {string} [manifest=
|
|
38
|
-
* @property {string} [content=
|
|
39
|
-
* @property {string} [fallback=
|
|
37
|
+
* @property {string} [manifest="/manifest.json"] - path where the podlet manifest file is served from (default '/manifest.json')
|
|
38
|
+
* @property {string} [content="/"] - path where the podlet content HTML markup is served from (default '/')
|
|
39
|
+
* @property {string} [fallback=""] - path where the podlet fallback HTML markup is served from (default '/fallback')
|
|
40
40
|
* @property {boolean} [development=false] - a boolean flag that, when true, enables additional development setup (default false)
|
|
41
41
|
* @property {boolean} [useShadowDOM=false] - a boolean flag that, when true, enables the use of ShadowDOM (default false)
|
|
42
|
-
* @property {import(
|
|
42
|
+
* @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)
|
|
43
43
|
* @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.
|
|
44
44
|
*
|
|
45
45
|
* @typedef {{ debug: 'true' | 'false', locale: string, deviceType: string, requestedBy: string, mountOrigin: string, mountPathname: string, publicPathname: string }} PodletContext
|
|
46
|
-
* @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, strategy?: "beforeInteractive" | "afterInteractive" | "lazy", scope?: "content" | "fallback" | "all"
|
|
47
|
-
* @typedef {{ value: string | null, crossorigin?: string | null | boolean, type?: string | null | false, integrity?: string | null | false, referrerpolicy?: string | null | false, nomodule?: boolean | null | '', async?: boolean | null | '', defer?: boolean | null | '', data?: {[key: string]: string} | Array<{ key: string; value: string }>, strategy?: "beforeInteractive" | "afterInteractive" | "lazy", scope?: "content" | "fallback" | "all" | "shadow-dom", [key: string]: any }} AssetJsLike
|
|
46
|
+
* @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, strategy?: "beforeInteractive" | "afterInteractive" | "lazy" | "shadow-dom", scope?: "content" | "fallback" | "all", [key: string]: any }} AssetCssLike
|
|
47
|
+
* @typedef {{ value: string | null, crossorigin?: string | null | boolean, type?: string | null | false, integrity?: string | null | false, referrerpolicy?: string | null | false, nomodule?: boolean | null | '', async?: boolean | null | '', defer?: boolean | null | '', data?: {[key: string]: string} | Array<{ key: string; value: string }>, strategy?: "beforeInteractive" | "afterInteractive" | "lazy" | "shadow-dom", scope?: "content" | "fallback" | "all" | "shadow-dom", [key: string]: any }} AssetJsLike
|
|
48
48
|
*/
|
|
49
49
|
|
|
50
50
|
export default class PodiumPodlet {
|
|
@@ -141,7 +141,7 @@ export default class PodiumPodlet {
|
|
|
141
141
|
httpProxy;
|
|
142
142
|
|
|
143
143
|
/**
|
|
144
|
-
* The pathname for the manifest of the podlet. Defaults to /manifest.json.
|
|
144
|
+
* The pathname for the manifest of the podlet. Defaults to "/manifest.json".
|
|
145
145
|
* The value should be relative to the value set on the pathname argument.
|
|
146
146
|
* In other words if a podlet is mounted into an HTTP server at /foo and the manifest is at /foo/component.json, pathname will be /foo and manifestRoute will be /component.json
|
|
147
147
|
*
|
|
@@ -155,7 +155,7 @@ export default class PodiumPodlet {
|
|
|
155
155
|
manifestRoute = '/manifest.json';
|
|
156
156
|
|
|
157
157
|
/**
|
|
158
|
-
* The pathname for the content route of the podlet. Defaults to
|
|
158
|
+
* The pathname for the content route of the podlet. Defaults to "/".
|
|
159
159
|
* The value should be relative to the value set on the pathname argument.
|
|
160
160
|
* In other words if a podlet is mounted into an HTTP server at /foo and the content is at /foo/content, pathname will be /foo and contentRoute will be /content
|
|
161
161
|
*
|
|
@@ -169,7 +169,7 @@ export default class PodiumPodlet {
|
|
|
169
169
|
contentRoute = '/';
|
|
170
170
|
|
|
171
171
|
/**
|
|
172
|
-
* The pathname for the fallback route of the podlet. Defaults to
|
|
172
|
+
* The pathname for the fallback route of the podlet. Defaults to no fallback.
|
|
173
173
|
* The value should be relative to the value set on the pathname argument.
|
|
174
174
|
* In other words if a podlet is mounted into an HTTP server at /foo and the fallback is at /foo/fallback, pathname will be /foo and fallbackRoute will be /fallback
|
|
175
175
|
*
|
|
@@ -407,6 +407,18 @@ export default class PodiumPodlet {
|
|
|
407
407
|
});
|
|
408
408
|
|
|
409
409
|
versionGauge.set(1);
|
|
410
|
+
|
|
411
|
+
const podletGauge = this.metrics.gauge({
|
|
412
|
+
name: 'podium_podlet_application_info',
|
|
413
|
+
description: '@podium/podlet application info',
|
|
414
|
+
labels: {
|
|
415
|
+
name: this.name,
|
|
416
|
+
version: this.version,
|
|
417
|
+
has_fallback: Boolean(fallback),
|
|
418
|
+
},
|
|
419
|
+
});
|
|
420
|
+
|
|
421
|
+
podletGauge.set(1);
|
|
410
422
|
});
|
|
411
423
|
|
|
412
424
|
// @ts-ignore
|
|
@@ -847,11 +859,11 @@ export default class PodiumPodlet {
|
|
|
847
859
|
);
|
|
848
860
|
|
|
849
861
|
const styles = this.cssRoute
|
|
850
|
-
.filter((css) => css.
|
|
862
|
+
.filter((css) => css.strategy === 'shadow-dom')
|
|
851
863
|
.map((css) => css.toHTML());
|
|
852
864
|
|
|
853
865
|
const scripts = this.jsRoute
|
|
854
|
-
.filter((js) => js.
|
|
866
|
+
.filter((js) => js.strategy === 'shadow-dom')
|
|
855
867
|
.map((js) => js.toHTML());
|
|
856
868
|
|
|
857
869
|
// Wrap the markup in DSD.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@podium/podlet",
|
|
3
|
-
"version": "5.2.0-next.
|
|
3
|
+
"version": "5.2.0-next.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Module for building page fragment servers in a micro frontend architecture.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -26,42 +26,34 @@
|
|
|
26
26
|
"scripts": {
|
|
27
27
|
"lint": "eslint .",
|
|
28
28
|
"lint:fix": "eslint --fix .",
|
|
29
|
-
"test": "
|
|
30
|
-
"
|
|
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": {
|
|
37
36
|
"@metrics/client": "2.5.3",
|
|
38
|
-
"@podium/proxy": "5.0.
|
|
37
|
+
"@podium/proxy": "5.0.28",
|
|
39
38
|
"@podium/schemas": "5.0.6",
|
|
40
|
-
"@podium/utils": "5.
|
|
39
|
+
"@podium/utils": "5.3.1",
|
|
41
40
|
"abslog": "2.4.4",
|
|
42
41
|
"ajv": "8.17.1",
|
|
43
42
|
"objobj": "1.0.0"
|
|
44
43
|
},
|
|
45
44
|
"devDependencies": {
|
|
46
|
-
"@
|
|
47
|
-
"@podium/
|
|
48
|
-
"@
|
|
49
|
-
"@
|
|
50
|
-
"@
|
|
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.
|
|
57
|
-
"
|
|
58
|
-
"eslint-plugin-prettier": "5.2.1",
|
|
59
|
-
"express": "4.19.2",
|
|
60
|
-
"globals": "15.9.0",
|
|
51
|
+
"eslint": "9.11.1",
|
|
52
|
+
"express": "4.20.0",
|
|
61
53
|
"json-stringify-safe": "5.0.1",
|
|
62
|
-
"npm-run-all2": "
|
|
54
|
+
"npm-run-all2": "6.2.3",
|
|
63
55
|
"prettier": "3.3.3",
|
|
64
|
-
"semantic-release": "
|
|
56
|
+
"semantic-release": "24.1.2",
|
|
65
57
|
"tap": "18.8.0",
|
|
66
58
|
"typescript": "5.5.4",
|
|
67
59
|
"undici": "^6.19.7"
|
|
@@ -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
|
-
|
|
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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
podium: HttpIncoming;
|
|
8
|
-
}
|
|
44
|
+
export interface PodiumHttpIncomingViewParameters {
|
|
45
|
+
[key: string]: unknown;
|
|
46
|
+
}
|
|
9
47
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
+
}
|
|
24
71
|
}
|
|
25
|
-
}
|
|
26
72
|
}
|
|
27
73
|
|
|
28
74
|
/**
|
|
@@ -30,17 +76,17 @@ declare global {
|
|
|
30
76
|
* @property {string} name - (required) podlet name
|
|
31
77
|
* @property {string} version - (required) podlet version
|
|
32
78
|
* @property {string} pathname - (required) podlet pathname
|
|
33
|
-
* @property {string} [manifest=
|
|
34
|
-
* @property {string} [content=
|
|
35
|
-
* @property {string} [fallback=
|
|
79
|
+
* @property {string} [manifest="/manifest.json"] - path where the podlet manifest file is served from (default '/manifest.json')
|
|
80
|
+
* @property {string} [content="/"] - path where the podlet content HTML markup is served from (default '/')
|
|
81
|
+
* @property {string} [fallback=""] - path where the podlet fallback HTML markup is served from (default '/fallback')
|
|
36
82
|
* @property {boolean} [development=false] - a boolean flag that, when true, enables additional development setup (default false)
|
|
37
83
|
* @property {boolean} [useShadowDOM=false] - a boolean flag that, when true, enables the use of ShadowDOM (default false)
|
|
38
|
-
* @property {import(
|
|
84
|
+
* @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)
|
|
39
85
|
* @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.
|
|
40
86
|
*
|
|
41
87
|
* @typedef {{ debug: 'true' | 'false', locale: string, deviceType: string, requestedBy: string, mountOrigin: string, mountPathname: string, publicPathname: string }} PodletContext
|
|
42
|
-
* @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, strategy?: "beforeInteractive" | "afterInteractive" | "lazy", scope?: "content" | "fallback" | "all"
|
|
43
|
-
* @typedef {{ value: string | null, crossorigin?: string | null | boolean, type?: string | null | false, integrity?: string | null | false, referrerpolicy?: string | null | false, nomodule?: boolean | null | '', async?: boolean | null | '', defer?: boolean | null | '', data?: {[key: string]: string} | Array<{ key: string; value: string }>, strategy?: "beforeInteractive" | "afterInteractive" | "lazy", scope?: "content" | "fallback" | "all" | "shadow-dom", [key: string]: any }} AssetJsLike
|
|
88
|
+
* @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, strategy?: "beforeInteractive" | "afterInteractive" | "lazy" | "shadow-dom", scope?: "content" | "fallback" | "all", [key: string]: any }} AssetCssLike
|
|
89
|
+
* @typedef {{ value: string | null, crossorigin?: string | null | boolean, type?: string | null | false, integrity?: string | null | false, referrerpolicy?: string | null | false, nomodule?: boolean | null | '', async?: boolean | null | '', defer?: boolean | null | '', data?: {[key: string]: string} | Array<{ key: string; value: string }>, strategy?: "beforeInteractive" | "afterInteractive" | "lazy" | "shadow-dom", scope?: "content" | "fallback" | "all" | "shadow-dom", [key: string]: any }} AssetJsLike
|
|
44
90
|
*/
|
|
45
91
|
export default class PodiumPodlet {
|
|
46
92
|
/**
|
|
@@ -133,7 +179,7 @@ export default class PodiumPodlet {
|
|
|
133
179
|
*/
|
|
134
180
|
httpProxy: Proxy;
|
|
135
181
|
/**
|
|
136
|
-
* The pathname for the manifest of the podlet. Defaults to /manifest.json.
|
|
182
|
+
* The pathname for the manifest of the podlet. Defaults to "/manifest.json".
|
|
137
183
|
* The value should be relative to the value set on the pathname argument.
|
|
138
184
|
* In other words if a podlet is mounted into an HTTP server at /foo and the manifest is at /foo/component.json, pathname will be /foo and manifestRoute will be /component.json
|
|
139
185
|
*
|
|
@@ -146,7 +192,7 @@ export default class PodiumPodlet {
|
|
|
146
192
|
*/
|
|
147
193
|
manifestRoute: string;
|
|
148
194
|
/**
|
|
149
|
-
* The pathname for the content route of the podlet. Defaults to
|
|
195
|
+
* The pathname for the content route of the podlet. Defaults to "/".
|
|
150
196
|
* The value should be relative to the value set on the pathname argument.
|
|
151
197
|
* In other words if a podlet is mounted into an HTTP server at /foo and the content is at /foo/content, pathname will be /foo and contentRoute will be /content
|
|
152
198
|
*
|
|
@@ -159,7 +205,7 @@ export default class PodiumPodlet {
|
|
|
159
205
|
*/
|
|
160
206
|
contentRoute: string;
|
|
161
207
|
/**
|
|
162
|
-
* The pathname for the fallback route of the podlet. Defaults to
|
|
208
|
+
* The pathname for the fallback route of the podlet. Defaults to no fallback.
|
|
163
209
|
* The value should be relative to the value set on the pathname argument.
|
|
164
210
|
* In other words if a podlet is mounted into an HTTP server at /foo and the fallback is at /foo/fallback, pathname will be /foo and fallbackRoute will be /fallback
|
|
165
211
|
*
|
|
@@ -655,8 +701,8 @@ export type AssetCssLike = {
|
|
|
655
701
|
rel?: string | false | null;
|
|
656
702
|
type?: string | false | null;
|
|
657
703
|
value: string | false | null;
|
|
658
|
-
strategy?: "beforeInteractive" | "afterInteractive" | "lazy";
|
|
659
|
-
scope?: "content" | "fallback" | "all"
|
|
704
|
+
strategy?: "beforeInteractive" | "afterInteractive" | "lazy" | "shadow-dom";
|
|
705
|
+
scope?: "content" | "fallback" | "all";
|
|
660
706
|
[key: string]: any;
|
|
661
707
|
};
|
|
662
708
|
export type AssetJsLike = {
|
|
@@ -674,7 +720,7 @@ export type AssetJsLike = {
|
|
|
674
720
|
key: string;
|
|
675
721
|
value: string;
|
|
676
722
|
}>;
|
|
677
|
-
strategy?: "beforeInteractive" | "afterInteractive" | "lazy";
|
|
723
|
+
strategy?: "beforeInteractive" | "afterInteractive" | "lazy" | "shadow-dom";
|
|
678
724
|
scope?: "content" | "fallback" | "all" | "shadow-dom";
|
|
679
725
|
[key: string]: any;
|
|
680
726
|
};
|