@podium/client 5.0.1 → 5.0.3
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 +14 -0
- package/README.md +13 -13
- package/client.d.ts +1 -1
- package/lib/resolver.content.js +7 -2
- package/lib/resolver.fallback.js +3 -0
- package/lib/resolver.manifest.js +3 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [5.0.3](https://github.com/podium-lib/client/compare/v5.0.2...v5.0.3) (2023-12-06)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* export default now that package is esm ([a1739e8](https://github.com/podium-lib/client/commit/a1739e8bcdde25e3cbb396534705e02411beb7cf))
|
|
7
|
+
|
|
8
|
+
## [5.0.2](https://github.com/podium-lib/client/compare/v5.0.1...v5.0.2) (2023-12-01)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* Consume body on non 200 requests ([ebfc8be](https://github.com/podium-lib/client/commit/ebfc8be4cbb2fcb57ac49febc93fd0381fa9c09f))
|
|
14
|
+
|
|
1
15
|
## [5.0.1](https://github.com/podium-lib/client/compare/v5.0.0...v5.0.1) (2023-11-30)
|
|
2
16
|
|
|
3
17
|
|
package/README.md
CHANGED
|
@@ -21,8 +21,8 @@ $ npm install @podium/client
|
|
|
21
21
|
Connect to a Podium component server and stream the HTML content:
|
|
22
22
|
|
|
23
23
|
```js
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
import { HttpIncoming } from '@podium/utils';
|
|
25
|
+
import Client from '@podium/client';
|
|
26
26
|
const client = new Client();
|
|
27
27
|
|
|
28
28
|
const component = client.register({
|
|
@@ -47,8 +47,8 @@ stream.pipe(process.stdout);
|
|
|
47
47
|
Connect to a podium component server and fetch the HTML content:
|
|
48
48
|
|
|
49
49
|
```js
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
import { HttpIncoming } from '@podium/utils';
|
|
51
|
+
import Client from '@podium/client';
|
|
52
52
|
const client = new Client();
|
|
53
53
|
|
|
54
54
|
const component = client.register({
|
|
@@ -74,7 +74,7 @@ component
|
|
|
74
74
|
Create a new Client instance.
|
|
75
75
|
|
|
76
76
|
```js
|
|
77
|
-
|
|
77
|
+
import Client from '@podium/client';
|
|
78
78
|
const client = new Client(options);
|
|
79
79
|
```
|
|
80
80
|
|
|
@@ -82,7 +82,7 @@ The client instance is iterable and holds a reference to each registered
|
|
|
82
82
|
resource.
|
|
83
83
|
|
|
84
84
|
```js
|
|
85
|
-
|
|
85
|
+
import Client from '@podium/client';
|
|
86
86
|
const client = new Client();
|
|
87
87
|
|
|
88
88
|
client.register({ uri: 'http://foo.site.com/manifest.json', name: 'fooBar' });
|
|
@@ -117,7 +117,7 @@ Registers a component.
|
|
|
117
117
|
Example:
|
|
118
118
|
|
|
119
119
|
```js
|
|
120
|
-
|
|
120
|
+
import Client from '@podium/client';
|
|
121
121
|
const client = new Client();
|
|
122
122
|
|
|
123
123
|
const component = client.register({
|
|
@@ -134,7 +134,7 @@ It is stored with the `name` as its property name.
|
|
|
134
134
|
Example:
|
|
135
135
|
|
|
136
136
|
```js
|
|
137
|
-
|
|
137
|
+
import Client from '@podium/client';
|
|
138
138
|
const client = new Client();
|
|
139
139
|
|
|
140
140
|
client.register({ uri: 'http://foo.site.com/manifest.json', name: 'fooBar' });
|
|
@@ -159,7 +159,7 @@ Retrieve list of all JavaScript references from all registered and fetched
|
|
|
159
159
|
components.
|
|
160
160
|
|
|
161
161
|
```js
|
|
162
|
-
|
|
162
|
+
import Client from '@podium/client';
|
|
163
163
|
const client = new Client();
|
|
164
164
|
|
|
165
165
|
const foo = client.register({
|
|
@@ -182,7 +182,7 @@ Retrieve a list of all CSS references from all registered and fetched
|
|
|
182
182
|
components.
|
|
183
183
|
|
|
184
184
|
```js
|
|
185
|
-
|
|
185
|
+
import Client from '@podium/client';
|
|
186
186
|
const client = new Client();
|
|
187
187
|
|
|
188
188
|
const foo = client.register({
|
|
@@ -214,7 +214,7 @@ If a manifest is successfully fetched, this method will resolve with a `true`
|
|
|
214
214
|
value. If a manifest is not successfully fetched, it will resolve with `false`.
|
|
215
215
|
|
|
216
216
|
```js
|
|
217
|
-
|
|
217
|
+
import Client from '@podium/client';
|
|
218
218
|
const client = new Client();
|
|
219
219
|
|
|
220
220
|
client.register({ uri: 'http://foo.site.com/manifest.json', name: 'foo' });
|
|
@@ -233,7 +233,7 @@ Refreshes the manifests of all registered resources. Does so by calling the
|
|
|
233
233
|
`.refresh()` method on all resources under the hood.
|
|
234
234
|
|
|
235
235
|
```js
|
|
236
|
-
|
|
236
|
+
import Client from '@podium/client';
|
|
237
237
|
const client = new Client();
|
|
238
238
|
|
|
239
239
|
client.register({ uri: 'http://foo.site.com/manifest.json', name: 'foo' });
|
|
@@ -499,7 +499,7 @@ fallback or the content then it can then be acted upon.
|
|
|
499
499
|
Example:
|
|
500
500
|
|
|
501
501
|
```js
|
|
502
|
-
|
|
502
|
+
import Client from '@podium/client';
|
|
503
503
|
const client = new Client();
|
|
504
504
|
|
|
505
505
|
const foo = client.register({
|
package/client.d.ts
CHANGED
package/lib/resolver.content.js
CHANGED
|
@@ -166,6 +166,8 @@ export default class PodletClientContentResolver {
|
|
|
166
166
|
},
|
|
167
167
|
};
|
|
168
168
|
|
|
169
|
+
// Body must be consumed; https://github.com/nodejs/undici/issues/583#issuecomment-855384858
|
|
170
|
+
await body.text();
|
|
169
171
|
throw new Boom(errorMessage, errorOptions);
|
|
170
172
|
}
|
|
171
173
|
if (resError) {
|
|
@@ -186,7 +188,10 @@ export default class PodletClientContentResolver {
|
|
|
186
188
|
js: utils.filterAssets("fallback", outgoing.manifest.js),
|
|
187
189
|
css: utils.filterAssets("fallback", outgoing.manifest.css),
|
|
188
190
|
}),
|
|
189
|
-
|
|
191
|
+
);
|
|
192
|
+
|
|
193
|
+
// Body must be consumed; https://github.com/nodejs/undici/issues/583#issuecomment-855384858
|
|
194
|
+
await body.text();
|
|
190
195
|
return outgoing;
|
|
191
196
|
}
|
|
192
197
|
|
|
@@ -211,7 +216,7 @@ export default class PodletClientContentResolver {
|
|
|
211
216
|
this.#log.info(
|
|
212
217
|
`podlet version number in header differs from cached version number - aborting request to remote resource for content - resource: ${outgoing.name} - url: ${outgoing.contentUri}`,
|
|
213
218
|
);
|
|
214
|
-
|
|
219
|
+
|
|
215
220
|
outgoing.status = 'stale';
|
|
216
221
|
return outgoing;
|
|
217
222
|
}
|
package/lib/resolver.fallback.js
CHANGED
package/lib/resolver.manifest.js
CHANGED
|
@@ -99,6 +99,9 @@ export default class PodletClientManifestResolver {
|
|
|
99
99
|
this.#log.warn(
|
|
100
100
|
`remote resource responded with non 200 http status code for manifest - code: ${statusCode} - resource: ${outgoing.name} - url: ${outgoing.manifestUri}`,
|
|
101
101
|
);
|
|
102
|
+
|
|
103
|
+
// Body must be consumed; https://github.com/nodejs/undici/issues/583#issuecomment-855384858
|
|
104
|
+
await body.text();
|
|
102
105
|
return outgoing;
|
|
103
106
|
}
|
|
104
107
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@podium/client",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"@semantic-release/changelog": "6.0.3",
|
|
51
51
|
"@semantic-release/git": "10.0.1",
|
|
52
52
|
"@babel/eslint-parser": "7.23.3",
|
|
53
|
-
"@semantic-release/github": "9.2.
|
|
53
|
+
"@semantic-release/github": "9.2.4",
|
|
54
54
|
"@semantic-release/npm": "11.0.1",
|
|
55
55
|
"@semantic-release/release-notes-generator": "12.1.0",
|
|
56
56
|
"@sinonjs/fake-timers": "11.2.2",
|