@podium/podlet 4.4.74 → 4.5.0
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/lib/podlet.js +28 -2
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [4.5.0](https://github.com/podium-lib/podlet/compare/v4.4.75...v4.5.0) (2023-11-22)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* filter assets by scope if scope is provided ([95129b3](https://github.com/podium-lib/podlet/commit/95129b3e2de5b955cc4b5a2aa5942ddc0af39e8e))
|
|
7
|
+
|
|
8
|
+
## [4.4.75](https://github.com/podium-lib/podlet/compare/v4.4.74...v4.4.75) (2023-11-20)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **deps:** update all dependencies (non-major) ([bf963ad](https://github.com/podium-lib/podlet/commit/bf963ad4f82ca1dabad6a960c2a836f075512385))
|
|
14
|
+
|
|
1
15
|
## [4.4.74](https://github.com/podium-lib/podlet/compare/v4.4.73...v4.4.74) (2023-10-23)
|
|
2
16
|
|
|
3
17
|
|
package/lib/podlet.js
CHANGED
|
@@ -25,6 +25,7 @@ const _compatibility = Symbol('_compatibility');
|
|
|
25
25
|
const _sanitize = Symbol('_sanitize');
|
|
26
26
|
const _addCssAsset = Symbol('_addCssAsset');
|
|
27
27
|
const _addJsAsset = Symbol('_addJsAsset');
|
|
28
|
+
const _currentScope = Symbol('_currentScope');
|
|
28
29
|
|
|
29
30
|
const PodiumPodlet = class PodiumPodlet {
|
|
30
31
|
constructor({
|
|
@@ -326,8 +327,16 @@ const PodiumPodlet = class PodiumPodlet {
|
|
|
326
327
|
|
|
327
328
|
async process(incoming, { proxy = true } = {}) {
|
|
328
329
|
incoming.name = this.name;
|
|
329
|
-
incoming.css = this.cssRoute
|
|
330
|
-
|
|
330
|
+
incoming.css = this.cssRoute.filter(
|
|
331
|
+
({ scope = 'all' }) =>
|
|
332
|
+
scope === this[_currentScope](incoming) ||
|
|
333
|
+
scope === 'all',
|
|
334
|
+
);
|
|
335
|
+
incoming.js = this.jsRoute.filter(
|
|
336
|
+
({ scope = 'all' }) =>
|
|
337
|
+
scope === this[_currentScope](incoming) ||
|
|
338
|
+
scope === 'all',
|
|
339
|
+
);
|
|
331
340
|
|
|
332
341
|
// Determine if request comes from layout server or not
|
|
333
342
|
if (
|
|
@@ -416,6 +425,23 @@ const PodiumPodlet = class PodiumPodlet {
|
|
|
416
425
|
});
|
|
417
426
|
return result.length === 0 ? '' : result[0];
|
|
418
427
|
}
|
|
428
|
+
|
|
429
|
+
[_currentScope](incoming) {
|
|
430
|
+
const fallback = this.fallback({ prefix: true });
|
|
431
|
+
const content = this.content({ prefix: true });
|
|
432
|
+
const { pathname } = incoming.url;
|
|
433
|
+
|
|
434
|
+
// only check fallback if defined
|
|
435
|
+
// match fallback first since fallback is a more accurate match since
|
|
436
|
+
// fallback cannot take dynamic path segments and we can use exact matching
|
|
437
|
+
if (!!fallback && pathname === fallback) return 'fallback';
|
|
438
|
+
|
|
439
|
+
// fallback didn't match so check content
|
|
440
|
+
// we have to use startsWith since content may contain dynamic path segments
|
|
441
|
+
if (pathname.startsWith(content)) return 'content';
|
|
442
|
+
|
|
443
|
+
return 'all';
|
|
444
|
+
}
|
|
419
445
|
};
|
|
420
446
|
|
|
421
447
|
module.exports = PodiumPodlet;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@podium/podlet",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.5.0",
|
|
4
4
|
"description": "Module for building page fragment servers in a micro frontend architecture.",
|
|
5
5
|
"main": "lib/podlet.js",
|
|
6
6
|
"license": "MIT",
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@metrics/client": "2.5.2",
|
|
31
|
-
"@podium/proxy": "4.2.
|
|
32
|
-
"@podium/schemas": "4.
|
|
33
|
-
"@podium/utils": "4.
|
|
31
|
+
"@podium/proxy": "4.2.86",
|
|
32
|
+
"@podium/schemas": "4.2.0",
|
|
33
|
+
"@podium/utils": "4.5.1",
|
|
34
34
|
"abslog": "2.4.0",
|
|
35
35
|
"ajv": "8.12.0",
|
|
36
36
|
"objobj": "1.0.0"
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"eslint": "7.32.0",
|
|
48
48
|
"eslint-config-airbnb-base": "14.2.1",
|
|
49
49
|
"eslint-config-prettier": "8.10.0",
|
|
50
|
-
"eslint-plugin-import": "2.
|
|
50
|
+
"eslint-plugin-import": "2.29.0",
|
|
51
51
|
"eslint-plugin-prettier": "3.4.1",
|
|
52
52
|
"express": "4.18.2",
|
|
53
53
|
"prettier": "2.8.8",
|