Skip to content

Commit b587309

Browse files
authored
feat(routeinfo): pulled complete roueInfo insto route-discovery phase (#252)
1 parent be48c03 commit b587309

File tree

16 files changed

+134
-79
lines changed

16 files changed

+134
-79
lines changed

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"cSpell.words": ["Scully", "Scullyio", "ngcontent"],
2+
"cSpell.words": ["Scully", "Scullyio", "ngcontent", "routify", "slugify"],
33
"peacock.affectActivityBar": true,
44
"peacock.affectTitleBar": true,
55
"peacock.affectStatusBar": true,

blog/page-1.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ title: My first page
33
author: Sander Elias
44
publish date: 2019-11-26
55
slug: look at_my-urls Cool
6+
slugs:
7+
- 'page-1'
68
description: This is the first demo page in this sample.
79
---
810

blog/page-2.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ published: false
66
description: 'This is the second demo page in this sample.'
77
slugs:
88
- ___UNPUBLISHED___k5nhcflm_SJwD4Z0QDrIHg1PGHo2mrfLZE8sfUsPy
9+
- page-2
910
---
1011

1112
# Page 2

blog/page-3.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ title: My third page
33
author: Sander Elias
44
publish date: 2019-11-28
55
description: At this point, I should write something different in here.
6+
slug: My third page,
7+
slugs:
8+
- page-3
69
---
710

811
# Page 3

package-lock.json

Lines changed: 3 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@
3131
"@angular/platform-browser-dynamic": "~9.0.0-rc.7",
3232
"@angular/platform-server": "~9.0.0-rc.7",
3333
"@angular/router": "~9.0.0-rc.7",
34+
"@types/minimatch": "^3.0.3",
3435
"jsdom": "^15.2.1",
36+
"minimatch": "^3.0.4",
3537
"rxjs": "^6.5.3",
3638
"semver": "^6.3.0",
3739
"tslib": "^1.10.0",

projects/scullyio/ng-lib/src/lib/route-service/scully-routes.service.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export interface ScullyRoute {
99
slugs?: string[];
1010
published?: boolean;
1111
slug?: string;
12+
sourceFile?: string;
1213
[prop: string]: any;
1314
}
1415

@@ -27,6 +28,7 @@ export class ScullyRoutesService {
2728
}),
2829
/** filter out all non-array results */
2930
filter(routes => Array.isArray(routes)),
31+
map(this.cleanDups),
3032
shareReplay({refCount: false, bufferSize: 1})
3133
);
3234
available$ = this.allRoutes$.pipe(
@@ -66,6 +68,12 @@ export class ScullyRoutesService {
6668
);
6769
}
6870

71+
cleanDups(routes: ScullyRoute[]) {
72+
const m = new Map<string, ScullyRoute>();
73+
routes.forEach(r => m.set(r.sourceFile || r.route, r));
74+
return [...m.values()];
75+
}
76+
6977
reload(): void {
7078
this.refresh.next();
7179
}

projects/scullyio/ng-lib/src/lib/utils/fromMutationObserver.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import {Observable} from 'rxjs';
22
/**
33
* Returns an observable that fires a mutation when the domMutationObserves does that.
44
* if flattens the mutations to make handling easier, so you only get 1 mutationRecord at a time.
5-
* @param elm the elm to obse with a mutationObserver
6-
* @param config the config for the mutationobserver
5+
* @param elm the elm to observe with a mutationObserver
6+
* @param config the config for the mutation-observer
77
*/
88
export function fromMutationObserver(
99
elm: HTMLElement,

scully/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {RouteTypes, ScullyConfig} from './utils/interfacesandenums';
77
import {replaceFirstRouteParamWithVal} from './utils/replaceFirstRouteParamWithVal';
88
import {routeSplit} from './utils/routeSplit';
99
import {startScully} from './utils/startup';
10+
import {ContentMetaData} from './renderPlugins/content-render-utils/readFileAndCheckPrePublishSlug';
1011

1112
export {
1213
startScully,
@@ -20,4 +21,5 @@ export {
2021
configValidator,
2122
httpGetJson,
2223
scullyConfig,
24+
ContentMetaData,
2325
};

scully/pluginManagement/pluginRepository.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export const registerPlugin = (
3535
type: PluginTypes,
3636
name: string,
3737
plugin: any,
38-
validator = async () => [],
38+
validator = async (config?: any) => [],
3939
{replaceExistingPlugin = false} = {}
4040
) => {
4141
if (!['router', 'render', 'fileHandler'].includes(type)) {

0 commit comments

Comments
 (0)