@monkeyplus/flow 1.0.7 → 1.1.1
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/dist/config.d.ts +1 -2
- package/dist/index.d.ts +5 -6
- package/dist/index.js +17 -16
- package/dist/index.js.map +1 -1
- package/dist/lib/index.d.ts +2 -3
- package/dist/lib/index.js +15 -5
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/pages/index.d.ts +1 -2
- package/dist/lib/pages/index.js +10 -3
- package/dist/lib/pages/index.js.map +1 -1
- package/dist/lib/pages/pre.d.ts +1 -2
- package/dist/lib/pages/pre.js +55 -17
- package/dist/lib/pages/pre.js.map +1 -1
- package/dist/lib/utils/index.d.ts +1 -2
- package/dist/lib/utils/index.js +2 -1
- package/dist/lib/utils/index.js.map +1 -1
- package/dist/utils/index.d.ts +1 -2
- package/dist/utils/index.js +1 -1
- package/dist/utils/index.js.map +1 -1
- package/package.json +13 -12
- package/types/index.d.ts +175 -0
- package/dist/_types/index.d.ts +0 -120
- package/dist/_types/index.d.ts.map +0 -1
- package/dist/_types/index.js +0 -3
- package/dist/_types/index.js.map +0 -1
- package/dist/config.d.ts.map +0 -1
- package/dist/helpers/index.d.ts +0 -15
- package/dist/helpers/index.d.ts.map +0 -1
- package/dist/helpers/index.js +0 -91
- package/dist/helpers/index.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/lib/index.d.ts.map +0 -1
- package/dist/lib/pages/index copy.d.ts +0 -6
- package/dist/lib/pages/index copy.d.ts.map +0 -1
- package/dist/lib/pages/index copy.js +0 -108
- package/dist/lib/pages/index copy.js.map +0 -1
- package/dist/lib/pages/index.d.ts.map +0 -1
- package/dist/lib/pages/pre.d.ts.map +0 -1
- package/dist/lib/utils/index.d.ts.map +0 -1
- package/dist/routes/index.d.ts +0 -4
- package/dist/routes/index.d.ts.map +0 -1
- package/dist/routes/index.js +0 -89
- package/dist/routes/index.js.map +0 -1
- package/dist/routes/sitemap.d.ts +0 -3
- package/dist/routes/sitemap.d.ts.map +0 -1
- package/dist/routes/sitemap.js +0 -137
- package/dist/routes/sitemap.js.map +0 -1
- package/dist/utils/index.d.ts.map +0 -1
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
import {
|
|
3
|
+
PageInfo,
|
|
4
|
+
OptionsPage,
|
|
5
|
+
OptionsLocalPage,
|
|
6
|
+
CtxBuildLocal,
|
|
7
|
+
CtxBuildGlobal,
|
|
8
|
+
RunContext,
|
|
9
|
+
DictionaryImagesSeo,
|
|
10
|
+
ExtraOptions,
|
|
11
|
+
BlogInfo,
|
|
12
|
+
LocalesUrl,
|
|
13
|
+
} from '@monkeyplus/flow-core';
|
|
14
|
+
import { Dictionary } from 'ramda';
|
|
15
|
+
import { Lifecycle, RouteOptions, Server, ServerRoute } from '@hapi/hapi';
|
|
16
|
+
import { Options } from 'prettier';
|
|
17
|
+
export interface AppObject {
|
|
18
|
+
images: DictionaryImagesSeo;
|
|
19
|
+
// defaultUbication: string;
|
|
20
|
+
// defaultLanguage: string;
|
|
21
|
+
// publicPath: string;
|
|
22
|
+
domain: string;
|
|
23
|
+
locale: string;
|
|
24
|
+
locales: string[];
|
|
25
|
+
pages: Map<string, PageInfo>;
|
|
26
|
+
// routes: Dictionary<any>;
|
|
27
|
+
localePages: Dictionary<any>;
|
|
28
|
+
// globalData: Dictionary<any>;
|
|
29
|
+
// pathImages: string;
|
|
30
|
+
// pathAssets: string;
|
|
31
|
+
// // robots: {
|
|
32
|
+
// // dissallowPaths?: string[];
|
|
33
|
+
// // allowPaths?: string[];
|
|
34
|
+
// // };
|
|
35
|
+
prevRoutes: Map<string, ResultPage>;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface OptionsHapiLocalPage extends OptionsLocalPage {
|
|
39
|
+
url: string;
|
|
40
|
+
blogInfo?: BlogInfo;
|
|
41
|
+
routeOptions?: RouteOptions;
|
|
42
|
+
rules?: Record<string, unknown>;
|
|
43
|
+
context?: RunContextHapi;
|
|
44
|
+
|
|
45
|
+
vhost?: string | string[];
|
|
46
|
+
}
|
|
47
|
+
export interface CtxHapiBuildLocal extends CtxBuildLocal {
|
|
48
|
+
server: Server;
|
|
49
|
+
isStatic?: boolean;
|
|
50
|
+
shared: any;
|
|
51
|
+
sharedLocale: any;
|
|
52
|
+
page: PageInfo;
|
|
53
|
+
}
|
|
54
|
+
export interface CtxHapiBuilGlobal extends CtxBuildGlobal {
|
|
55
|
+
server: Server;
|
|
56
|
+
isStatic?: boolean;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export type RunContextHapi<CTX = any> = RunContext<CtxHapiBuildLocal, CTX>;
|
|
60
|
+
export interface OptionsHapiPage extends OptionsPage {
|
|
61
|
+
routeOptions?: RouteOptions;
|
|
62
|
+
context: RunContextHapi;
|
|
63
|
+
locales: Dictionary<OptionsHapiLocalPage>;
|
|
64
|
+
rules?: Record<string, unknown>;
|
|
65
|
+
vhost?: string | string[];
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
*
|
|
70
|
+
*/
|
|
71
|
+
interface DefaultLocale {
|
|
72
|
+
language: string;
|
|
73
|
+
ubication: string;
|
|
74
|
+
publicPath?: string;
|
|
75
|
+
}
|
|
76
|
+
export interface ResultPage {
|
|
77
|
+
name: string;
|
|
78
|
+
routes: (
|
|
79
|
+
ctx: CtxHapiBuildLocal,
|
|
80
|
+
handler: Lifecycle.Method,
|
|
81
|
+
) => Promise<ServerRoute[]>;
|
|
82
|
+
pages: PageInfo[];
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export type RunDefinePage = (
|
|
86
|
+
server: Server,
|
|
87
|
+
defs: DefaultLocale,
|
|
88
|
+
locales: string[],
|
|
89
|
+
runGlobal?: RunDefineGlobalContext,
|
|
90
|
+
) => Promise<ResultPage>;
|
|
91
|
+
|
|
92
|
+
export type PreRunDefinePage<T = RunDefinePage> = (
|
|
93
|
+
extOpts?: ExtraOptions,
|
|
94
|
+
prefixName?: string,
|
|
95
|
+
) => T;
|
|
96
|
+
export type DefinePage = (options: OptionsHapiPage) => PreRunDefinePage;
|
|
97
|
+
|
|
98
|
+
export interface ResultPage2 {
|
|
99
|
+
name: string;
|
|
100
|
+
options: OptionsHapiPage;
|
|
101
|
+
pages: PageInfo[];
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export type RunDefinePage2 = (
|
|
105
|
+
server: Server,
|
|
106
|
+
defs: DefaultLocale,
|
|
107
|
+
locales: string[],
|
|
108
|
+
) => Promise<ResultPage2>;
|
|
109
|
+
|
|
110
|
+
export type DefinePage2 = (
|
|
111
|
+
options: OptionsHapiPage,
|
|
112
|
+
) => PreRunDefinePage<RunDefinePage2>;
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
*
|
|
116
|
+
*/
|
|
117
|
+
export interface OptionsInfo {
|
|
118
|
+
locale: string;
|
|
119
|
+
name: string;
|
|
120
|
+
path: string;
|
|
121
|
+
view?: {
|
|
122
|
+
template: string;
|
|
123
|
+
bundle?: string;
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
export interface Flow {
|
|
127
|
+
init: () => Promise<void>;
|
|
128
|
+
addPage: (page: RunDefinePage | OptionsHapiPage) => Promise<void>;
|
|
129
|
+
defineInfoPage: (
|
|
130
|
+
options: OptionsInfo,
|
|
131
|
+
) => Promise<{ path: string; flow: PageInfo }>;
|
|
132
|
+
getPath: (...path: string[]) => string;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export type GetUrl = (
|
|
136
|
+
server: Server,
|
|
137
|
+
options: R.Dictionary<OptionsHapiLocalPage>,
|
|
138
|
+
def: string,
|
|
139
|
+
) => (locale: string) => Promise<LocalesUrl>;
|
|
140
|
+
export type UrlPromise = (
|
|
141
|
+
locale: string,
|
|
142
|
+
name: string,
|
|
143
|
+
) => Promise<{ url: string; seo: any; [key: string]: any }>;
|
|
144
|
+
/**
|
|
145
|
+
*
|
|
146
|
+
*/
|
|
147
|
+
export type RunDefineGlobalContext = (ctx: CtxHapiBuildLocal) => Promise<any>;
|
|
148
|
+
export type DefineGlobalContext = (options: {
|
|
149
|
+
shared: RunContextHapi;
|
|
150
|
+
locales?: Dictionary<RunContextHapi>;
|
|
151
|
+
}) => RunDefineGlobalContext;
|
|
152
|
+
|
|
153
|
+
export interface FlowConfigs {
|
|
154
|
+
relativeTo: string;
|
|
155
|
+
locales: string[];
|
|
156
|
+
defaultUbication: string;
|
|
157
|
+
defaultLanguage: string;
|
|
158
|
+
domain: string;
|
|
159
|
+
publicPath: string;
|
|
160
|
+
sourceImagesDir: string;
|
|
161
|
+
dictionaryImages: string;
|
|
162
|
+
assetsDir: string;
|
|
163
|
+
assetsImagesDir: string;
|
|
164
|
+
sourceRename: string;
|
|
165
|
+
images: {
|
|
166
|
+
sources: string;
|
|
167
|
+
dirJsons: string;
|
|
168
|
+
};
|
|
169
|
+
server: {
|
|
170
|
+
watch: number;
|
|
171
|
+
dev: number;
|
|
172
|
+
};
|
|
173
|
+
vue: Record<string, string>;
|
|
174
|
+
// redirects: {};
|
|
175
|
+
}
|
package/dist/_types/index.d.ts
DELETED
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import { PageInfo, OptionsPage, OptionsLocalPage, CtxBuildLocal, CtxBuildGlobal, RunContext, DictionaryImagesSeo, ExtraOptions, BlogInfo, LocalesUrl } from '@monkeyplus/flow-core';
|
|
2
|
-
import { Dictionary } from 'ramda';
|
|
3
|
-
import { Lifecycle, RouteOptions, Server, ServerRoute } from '@hapi/hapi';
|
|
4
|
-
export interface AppObject {
|
|
5
|
-
images: DictionaryImagesSeo;
|
|
6
|
-
domain: string;
|
|
7
|
-
locale: string;
|
|
8
|
-
locales: string[];
|
|
9
|
-
pages: Map<string, PageInfo>;
|
|
10
|
-
localePages: Dictionary<any>;
|
|
11
|
-
prevRoutes: Map<string, ResultPage>;
|
|
12
|
-
}
|
|
13
|
-
export interface OptionsHapiLocalPage extends OptionsLocalPage {
|
|
14
|
-
url: string;
|
|
15
|
-
blogInfo?: BlogInfo;
|
|
16
|
-
routeOptions?: RouteOptions;
|
|
17
|
-
rules?: Record<string, unknown>;
|
|
18
|
-
context?: RunContextHapi;
|
|
19
|
-
vhost?: string | string[];
|
|
20
|
-
}
|
|
21
|
-
export interface CtxHapiBuildLocal extends CtxBuildLocal {
|
|
22
|
-
server: Server;
|
|
23
|
-
isStatic?: boolean;
|
|
24
|
-
shared: any;
|
|
25
|
-
sharedLocale: any;
|
|
26
|
-
page: PageInfo;
|
|
27
|
-
}
|
|
28
|
-
export interface CtxHapiBuilGlobal extends CtxBuildGlobal {
|
|
29
|
-
server: Server;
|
|
30
|
-
isStatic?: boolean;
|
|
31
|
-
}
|
|
32
|
-
export declare type RunContextHapi<CTX = any> = RunContext<CtxHapiBuildLocal, CTX>;
|
|
33
|
-
export interface OptionsHapiPage extends OptionsPage {
|
|
34
|
-
routeOptions?: RouteOptions;
|
|
35
|
-
context: RunContextHapi;
|
|
36
|
-
locales: Dictionary<OptionsHapiLocalPage>;
|
|
37
|
-
rules?: Record<string, unknown>;
|
|
38
|
-
vhost?: string | string[];
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
*
|
|
42
|
-
*/
|
|
43
|
-
interface DefaultLocale {
|
|
44
|
-
language: string;
|
|
45
|
-
ubication: string;
|
|
46
|
-
publicPath?: string;
|
|
47
|
-
}
|
|
48
|
-
export interface ResultPage {
|
|
49
|
-
name: string;
|
|
50
|
-
routes: (ctx: CtxHapiBuildLocal, handler: Lifecycle.Method) => Promise<ServerRoute[]>;
|
|
51
|
-
pages: PageInfo[];
|
|
52
|
-
}
|
|
53
|
-
export declare type RunDefinePage = (server: Server, defs: DefaultLocale, locales: string[], runGlobal?: RunDefineGlobalContext) => Promise<ResultPage>;
|
|
54
|
-
export declare type PreRunDefinePage<T = RunDefinePage> = (extOpts?: ExtraOptions, prefixName?: string) => T;
|
|
55
|
-
export declare type DefinePage = (options: OptionsHapiPage) => PreRunDefinePage;
|
|
56
|
-
export interface ResultPage2 {
|
|
57
|
-
name: string;
|
|
58
|
-
options: OptionsHapiPage;
|
|
59
|
-
pages: PageInfo[];
|
|
60
|
-
}
|
|
61
|
-
export declare type RunDefinePage2 = (server: Server, defs: DefaultLocale, locales: string[]) => Promise<ResultPage2>;
|
|
62
|
-
export declare type DefinePage2 = (options: OptionsHapiPage) => PreRunDefinePage<RunDefinePage2>;
|
|
63
|
-
/**
|
|
64
|
-
*
|
|
65
|
-
*/
|
|
66
|
-
export interface OptionsInfo {
|
|
67
|
-
locale: string;
|
|
68
|
-
name: string;
|
|
69
|
-
path: string;
|
|
70
|
-
view?: {
|
|
71
|
-
template: string;
|
|
72
|
-
bundle?: string;
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
export interface Flow {
|
|
76
|
-
init: () => Promise<void>;
|
|
77
|
-
addPage: (page: RunDefinePage | OptionsHapiPage) => Promise<void>;
|
|
78
|
-
defineInfoPage: (options: OptionsInfo) => Promise<{
|
|
79
|
-
path: string;
|
|
80
|
-
flow: PageInfo;
|
|
81
|
-
}>;
|
|
82
|
-
}
|
|
83
|
-
export declare type GetUrl = (server: Server, options: R.Dictionary<OptionsHapiLocalPage>, def: string) => (locale: string) => Promise<LocalesUrl>;
|
|
84
|
-
export declare type UrlPromise = (locale: string, name: string) => Promise<{
|
|
85
|
-
url: string;
|
|
86
|
-
seo: any;
|
|
87
|
-
[key: string]: any;
|
|
88
|
-
}>;
|
|
89
|
-
/**
|
|
90
|
-
*
|
|
91
|
-
*/
|
|
92
|
-
export declare type RunDefineGlobalContext = (ctx: CtxHapiBuildLocal) => Promise<any>;
|
|
93
|
-
export declare type DefineGlobalContext = (options: {
|
|
94
|
-
shared: RunContextHapi;
|
|
95
|
-
locales?: Dictionary<RunContextHapi>;
|
|
96
|
-
}) => RunDefineGlobalContext;
|
|
97
|
-
export interface FlowConfigs {
|
|
98
|
-
relativeTo: string;
|
|
99
|
-
locales: string[];
|
|
100
|
-
defaultUbication: string;
|
|
101
|
-
defaultLanguage: string;
|
|
102
|
-
domain: string;
|
|
103
|
-
publicPath: string;
|
|
104
|
-
sourceImagesDir: string;
|
|
105
|
-
dictionaryImages: string;
|
|
106
|
-
assetsDir: string;
|
|
107
|
-
assetsImagesDir: string;
|
|
108
|
-
sourceRename: string;
|
|
109
|
-
images: {
|
|
110
|
-
sources: string;
|
|
111
|
-
dirJsons: string;
|
|
112
|
-
};
|
|
113
|
-
server: {
|
|
114
|
-
watch: number;
|
|
115
|
-
dev: number;
|
|
116
|
-
};
|
|
117
|
-
vue: Record<string, string>;
|
|
118
|
-
}
|
|
119
|
-
export {};
|
|
120
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/_types/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,QAAQ,EACR,WAAW,EACX,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,UAAU,EACV,mBAAmB,EACnB,YAAY,EACZ,QAAQ,EACR,UAAU,EACX,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE1E,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,mBAAmB,CAAC;IAI5B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAE7B,WAAW,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC;IAQ7B,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;CACrC;AAED,MAAM,WAAW,oBA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,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,MAAM,EAAE;QACN,KAAK,EAAE,MAAM,CAAC;QACd,GAAG,EAAE,MAAM,CAAC;KACb,CAAC;IACF,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAE7B"}
|
package/dist/_types/index.js
DELETED
package/dist/_types/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/_types/index.ts"],"names":[],"mappings":""}
|
package/dist/config.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,gBAAgB,qBAAqB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAU,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAElD,eAAO,MAAM,YAAY,IAExB,CAAC;AAKF,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,sBAAsB,CAAC;IACjC,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB"}
|
package/dist/helpers/index.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { CtxHapiBuildLocal } from '../_types/index';
|
|
2
|
-
import { PageInfo, ImageSeo } from '@monkeyplus/flow-core';
|
|
3
|
-
export declare const useHelpers: ({ pages, isStatic, server, name, locale, images, }: CtxHapiBuildLocal) => {
|
|
4
|
-
getPage: (_locale: string, name: string) => {
|
|
5
|
-
link: string;
|
|
6
|
-
page: PageInfo | undefined;
|
|
7
|
-
};
|
|
8
|
-
getLocalePage: (name: string) => {
|
|
9
|
-
link: string;
|
|
10
|
-
page: PageInfo | undefined;
|
|
11
|
-
};
|
|
12
|
-
getContextPage: (page: PageInfo | undefined) => Promise<any> | object;
|
|
13
|
-
getImage: (name: string) => ImageSeo;
|
|
14
|
-
};
|
|
15
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAI3D,eAAO,MAAM,UAAU,uDAOpB,iBAAiB;uBAEP,MAAM,QACT,MAAM;cAEN,MAAM;cACN,QAAQ,GAAG,SAAS;;0BAeC,MAAM;cAhB3B,MAAM;cACN,QAAQ,GAAG,SAAS;;2BAiBpB,QAAQ,GAAG,SAAS,KACzB,QAAQ,GAAG,CAAC,GAAG,MAAM;qBA6BA,MAAM,KAAG,QAAQ;CAmB1C,CAAC"}
|
package/dist/helpers/index.js
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
-
};
|
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.useHelpers = void 0;
|
|
26
|
-
const R = __importStar(require("ramda"));
|
|
27
|
-
const path_1 = __importDefault(require("path"));
|
|
28
|
-
// interface PageLink
|
|
29
|
-
exports.useHelpers = ({ pages, isStatic, server, name, locale, images, }) => {
|
|
30
|
-
const getPage = (_locale, name) => {
|
|
31
|
-
const page = pages.get(path_1.default.posix.join(_locale, name));
|
|
32
|
-
if (!page) {
|
|
33
|
-
server.log(['warn', name], {
|
|
34
|
-
error: 'Error in getPage',
|
|
35
|
-
message: `${name} not found`,
|
|
36
|
-
});
|
|
37
|
-
return { link: isStatic ? '/404.html' : '/404', page };
|
|
38
|
-
}
|
|
39
|
-
return {
|
|
40
|
-
link: isStatic ? page.urlObject.static : page.urlObject.path,
|
|
41
|
-
page,
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
const getLocalePage = (name) => getPage(locale, name);
|
|
45
|
-
const getContextPage = (page) => {
|
|
46
|
-
return new Promise((res) => {
|
|
47
|
-
if (!page) {
|
|
48
|
-
server.log(['warn', name], {
|
|
49
|
-
error: 'Error in read context page',
|
|
50
|
-
message: `Param page is undefined`,
|
|
51
|
-
});
|
|
52
|
-
return res({});
|
|
53
|
-
}
|
|
54
|
-
const pathInject = page.urlObject.path + '/_context';
|
|
55
|
-
server
|
|
56
|
-
.inject(pathInject)
|
|
57
|
-
.then((r) => {
|
|
58
|
-
const local = R.path(['result', 'local'], r) || {};
|
|
59
|
-
res(Object.assign(Object.assign({}, local), { _seo: R.path(['result', 'globals', 'SEO'], r) }));
|
|
60
|
-
})
|
|
61
|
-
.catch((details) => {
|
|
62
|
-
server.log(['error', name], {
|
|
63
|
-
error: 'Error in read context page',
|
|
64
|
-
message: `Error in injector to ${pathInject}`,
|
|
65
|
-
details,
|
|
66
|
-
});
|
|
67
|
-
res({});
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
};
|
|
71
|
-
const getImage = (name) => {
|
|
72
|
-
if (images[name]) {
|
|
73
|
-
return images[name];
|
|
74
|
-
}
|
|
75
|
-
else {
|
|
76
|
-
return {
|
|
77
|
-
src: '/assets/static/no-image.jpg',
|
|
78
|
-
alt: '',
|
|
79
|
-
title: '',
|
|
80
|
-
name: '',
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
return {
|
|
85
|
-
getPage,
|
|
86
|
-
getLocalePage,
|
|
87
|
-
getContextPage,
|
|
88
|
-
getImage,
|
|
89
|
-
};
|
|
90
|
-
};
|
|
91
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAEA,yCAA2B;AAC3B,gDAAwB;AACxB,qBAAqB;AACR,QAAA,UAAU,GAAG,CAAC,EACzB,KAAK,EACL,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,MAAM,EACN,MAAM,GACY,EAAE,EAAE;IACtB,MAAM,OAAO,GAAG,CACd,OAAe,EACf,IAAY,EAIZ,EAAE;QACF,MAAM,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,cAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;QACvD,IAAI,CAAC,IAAI,EAAE;YACT,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE;gBACzB,KAAK,EAAE,kBAAkB;gBACzB,OAAO,EAAE,GAAG,IAAI,YAAY;aAC7B,CAAC,CAAC;YACH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GACZ,MAAM,gBAAgB,CAAC;AAExB,eAAO,MAAM,MAAM,EAAE,MAAM,CAAC,aAAa,CA8MxC,CAAC;AAEF,OAAO,QAAQ,YAAY,CAAC;IAC1B,UAAU,sBAAsB;QAC9B,IAAI,EAAE,SAAS,CAAC;KACjB;IACD,UAAU,eAAe;QACvB,IAAI,EAAE,QAAQ,CAAC;KAChB;IAED,UAAU,uBAAuB;QAC/B,KAAK,EAAE,GAAG,CAAC;QACX,MAAM,EAAE,GAAG,CAAC;KACb;IAWD,UAAU,MAAM;QACd,IAAI,EAAE,IAAI,CAAC;KACZ;IACD,UAAU,gBAAgB;QACxB,IAAI,EAAE;YACJ,OAAO,EAAE,WAAW,CAAC;YACrB,OAAO,EAAE,CAAC,GAAG,KAAK,EAAE,MAAM,EAAE,KAAK,MAAM,CAAC;SACzC,CAAC;KACH;CACF"}
|
package/dist/lib/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,eAAO,MAAM,mBAAmB,EAAE,mBAmBjC,CAAC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { PageInfo } from '@monkeyplus/flow-core';
|
|
2
|
-
import { DefinePage2, OptionsHapiPage, CtxHapiBuildLocal, RunDefineGlobalContext } from '../../_types/index';
|
|
3
|
-
import { ServerRoute } from '@hapi/hapi';
|
|
4
|
-
export declare const definePage: DefinePage2;
|
|
5
|
-
export declare const buildHapiRoutes: (options: OptionsHapiPage, pages: PageInfo[], ctx: CtxHapiBuildLocal, runGlobal: RunDefineGlobalContext) => Promise<ServerRoute[]>;
|
|
6
|
-
//# sourceMappingURL=index copy.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index copy.d.ts","sourceRoot":"","sources":["../../../src/lib/pages/index copy.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EACL,WAAW,EACX,eAAe,EACf,iBAAiB,EACjB,sBAAsB,EACvB,MAAM,oBAAoB,CAAC;AAI5B,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAWzC,eAAO,MAAM,UAAU,EAAE,WAgBxB,CAAC;AAEF,eAAO,MAAM,eAAe,YACjB,eAAe,SACjB,QAAQ,EAAE,OACZ,iBAAiB,aACX,sBAAsB,2BA+ElC,CAAC"}
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
-
};
|
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.buildHapiRoutes = exports.definePage = void 0;
|
|
26
|
-
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
27
|
-
const flow_core_1 = require("@monkeyplus/flow-core");
|
|
28
|
-
const R = __importStar(require("ramda"));
|
|
29
|
-
const utils_1 = require("../utils");
|
|
30
|
-
const path_1 = __importDefault(require("path"));
|
|
31
|
-
const pre_1 = require("./pre");
|
|
32
|
-
exports.definePage = (options) => (extOpts, prefixName) => async (server, defs, locs) => {
|
|
33
|
-
const _pages = flow_core_1.definePages(options)(defs, extOpts);
|
|
34
|
-
const pLocales = locs
|
|
35
|
-
.filter((v) => R.has(v, options.locales))
|
|
36
|
-
.map(utils_1.getUrl(server, options.locales, options.name));
|
|
37
|
-
const locales = await Promise.all(pLocales);
|
|
38
|
-
const pages = _pages.pages(locales);
|
|
39
|
-
return {
|
|
40
|
-
name: (prefixName ? `${prefixName}/` : '') + options.name,
|
|
41
|
-
pages,
|
|
42
|
-
options,
|
|
43
|
-
};
|
|
44
|
-
};
|
|
45
|
-
exports.buildHapiRoutes = async (options, pages, ctx, runGlobal) => {
|
|
46
|
-
const sharedRouteOptions = options.routeOptions || {};
|
|
47
|
-
const sharedPre = sharedRouteOptions.pre || [];
|
|
48
|
-
const routes = pages.map(async (page) => {
|
|
49
|
-
const localRouteOptions = options.locales[page.locale].routeOptions || {};
|
|
50
|
-
const localPre = localRouteOptions.pre || [];
|
|
51
|
-
const mergeRouteOptions = R.mergeDeepRight(sharedRouteOptions, localRouteOptions);
|
|
52
|
-
const mergePre = [...sharedPre, ...localPre];
|
|
53
|
-
const ctxLocal = Object.assign(Object.assign({}, ctx), { name: page.name, originName: page.originName, locale: page.locale, page });
|
|
54
|
-
const preGlobal = await pre_1.preGlobalContext(ctxLocal, runGlobal);
|
|
55
|
-
const preShared = await pre_1.preSharedContext(ctxLocal);
|
|
56
|
-
const preLocal = await pre_1.preLocalContext(ctxLocal);
|
|
57
|
-
const routeOptions = R.mergeDeepRight(mergeRouteOptions, {
|
|
58
|
-
id: page.name,
|
|
59
|
-
app: page,
|
|
60
|
-
pre: [
|
|
61
|
-
...mergePre,
|
|
62
|
-
preGlobal,
|
|
63
|
-
pre_1.preBuildGlobal,
|
|
64
|
-
[preShared, preLocal],
|
|
65
|
-
pre_1.preBuildLocal,
|
|
66
|
-
pre_1.preContext,
|
|
67
|
-
],
|
|
68
|
-
});
|
|
69
|
-
const routes = [
|
|
70
|
-
{
|
|
71
|
-
path: page.urlObject.path,
|
|
72
|
-
method: 'get',
|
|
73
|
-
options: routeOptions,
|
|
74
|
-
handler: (req, h) => {
|
|
75
|
-
const { template } = req.route.settings.app;
|
|
76
|
-
return h.view('templates/' + template, Object.assign({}, req.pre.context));
|
|
77
|
-
},
|
|
78
|
-
rules: options.locales[page.locale].rules || options.rules,
|
|
79
|
-
vhost: options.locales[page.locale].vhost || options.vhost,
|
|
80
|
-
},
|
|
81
|
-
];
|
|
82
|
-
if (page.redirect) {
|
|
83
|
-
routes.push({
|
|
84
|
-
path: page.redirect,
|
|
85
|
-
method: 'get',
|
|
86
|
-
handler: (r, h) => {
|
|
87
|
-
return h.redirect(page.urlObject.path);
|
|
88
|
-
},
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
92
|
-
if (!page.urlObject.path.includes('*}')) {
|
|
93
|
-
routes.push({
|
|
94
|
-
path: path_1.default.posix.join(page.urlObject.path, '_context'),
|
|
95
|
-
method: 'get',
|
|
96
|
-
options: R.omit(['id'], routeOptions),
|
|
97
|
-
handler: (req) => {
|
|
98
|
-
return req.pre.context;
|
|
99
|
-
},
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
return routes;
|
|
104
|
-
});
|
|
105
|
-
const r = await Promise.all(routes);
|
|
106
|
-
return R.flatten(r);
|
|
107
|
-
};
|
|
108
|
-
//# sourceMappingURL=index copy.js.map
|
|
@@ -1 +0,0 @@
|
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;aACJ;SACF;QACD,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC,CAAC;IACH,MAAM,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACpC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AACtB,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/pages/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAchD,eAAO,MAAM,UAAU,EAAE,UAgHxB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pre.d.ts","sourceRoot":"","sources":["../../../src/lib/pages/pre.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAI5D,eAAO,MAAM,gBAAgB,QACtB,GAAG,QACH,sBAAsB,KAC1B,QAAQ,qBAAqB,CAe/B,CAAC;AAEF,eAAO,MAAM,gBAAgB,QACtB,GAAG,KACP,QAAQ,qBAAqB,CAgB/B,CAAC;AAEF,eAAO,MAAM,eAAe,QACrB,GAAG,KACP,QAAQ,qBAAqB,CAkB9B,CAAC;AAEH,eAAO,MAAM,aAAa,EAAE,qBAuB3B,CAAC;AACF,eAAO,MAAM,cAAc,EAAE,qBA6B5B,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,qBAWxB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAGxD,eAAO,MAAM,MAAM,EAAE,MAsBpB,CAAC"}
|
package/dist/routes/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/routes/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;iCAIZ,MAAM;AAA9B,wBAyEE"}
|