@monkeyplus/flow 3.7.5 → 4.0.0-beta.10
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/index.cjs +1061 -0
- package/dist/index.d.ts +18 -7
- package/dist/index.mjs +1034 -0
- package/package.json +35 -17
- package/types/core.d.ts +143 -0
- package/types/flow.d.ts +138 -132
- package/types/index.d.ts +2 -2
- package/types/interfaces.d.ts +24 -24
- package/dist/config.d.ts +0 -15
- package/dist/config.js +0 -24
- package/dist/config.js.map +0 -1
- package/dist/decorators.d.ts +0 -5
- package/dist/decorators.js +0 -123
- package/dist/decorators.js.map +0 -1
- package/dist/generator/index.d.ts +0 -8
- package/dist/generator/index.js +0 -244
- package/dist/generator/index.js.map +0 -1
- package/dist/helpers/handler.d.ts +0 -2
- package/dist/helpers/handler.js +0 -122
- package/dist/helpers/handler.js.map +0 -1
- package/dist/index.js +0 -177
- package/dist/index.js.map +0 -1
- package/dist/lifeCircle.d.ts +0 -5
- package/dist/lifeCircle.js +0 -85
- package/dist/lifeCircle.js.map +0 -1
- package/dist/pages.d.ts +0 -3
- package/dist/pages.js +0 -101
- package/dist/pages.js.map +0 -1
- package/dist/runMethods.d.ts +0 -9
- package/dist/runMethods.js +0 -60
- package/dist/runMethods.js.map +0 -1
- package/dist/serverInfo.d.ts +0 -7
- package/dist/serverInfo.js +0 -36
- package/dist/serverInfo.js.map +0 -1
- package/dist/utils/index.d.ts +0 -5
- package/dist/utils/index.js +0 -51
- package/dist/utils/index.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,33 +1,51 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@monkeyplus/flow",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-beta.10",
|
|
4
4
|
"description": "Utils hapi",
|
|
5
5
|
"author": "Andres Navarrete",
|
|
6
6
|
"license": "MIT",
|
|
7
|
-
"main": "dist/index",
|
|
8
|
-
"
|
|
7
|
+
"main": "./dist/index.cjs",
|
|
8
|
+
"module": "./dist/index.mjs",
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
9
10
|
"files": [
|
|
10
11
|
"dist/",
|
|
11
12
|
"types/"
|
|
12
13
|
],
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
},
|
|
19
|
-
"devDependencies": {
|
|
20
|
-
"@types/fs-extra": "^9.0.12",
|
|
21
|
-
"@types/ramda": "^0.27.44"
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"import": "./dist/index.mjs",
|
|
17
|
+
"require": "./dist/index.cjs"
|
|
18
|
+
}
|
|
22
19
|
},
|
|
23
20
|
"dependencies": {
|
|
24
21
|
"@hapi/boom": "9.x.x",
|
|
25
22
|
"@hapi/hoek": "9.x.x",
|
|
26
|
-
"@monkeyplus/flow-core": "^3.5.1",
|
|
27
|
-
"chalk": "^4.1.2",
|
|
28
23
|
"consola": "^2.15.3",
|
|
24
|
+
"chalk": "^4.1.2",
|
|
25
|
+
"chokidar": "^3.5.3",
|
|
26
|
+
"hookable": "^5.1.1",
|
|
29
27
|
"fs-extra": "^10.0.0",
|
|
30
|
-
"ramda": "^0.
|
|
28
|
+
"ramda": "^0.28.0"
|
|
31
29
|
},
|
|
32
|
-
"
|
|
33
|
-
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@types/fs-extra": "^9.0.13",
|
|
32
|
+
"@types/hapi__hapi": "^20.0.10",
|
|
33
|
+
"@types/hapi__nes": "^11.0.5",
|
|
34
|
+
"@types/hapi__vision": "^5.5.3",
|
|
35
|
+
"@types/ramda": "^0.27.64"
|
|
36
|
+
},
|
|
37
|
+
"peerDependencies": {
|
|
38
|
+
"@hapi/hapi": "^20.x"
|
|
39
|
+
},
|
|
40
|
+
"gitHead": "1d5387b9c77909019f36d360a0ac53ddaa40e4af",
|
|
41
|
+
"scripts": {
|
|
42
|
+
"build": "unbuild",
|
|
43
|
+
"dev": "pnpm stub && pnpm types",
|
|
44
|
+
"stub": "unbuild --stub",
|
|
45
|
+
"types": "tsup ./src/index.ts --dts-only --external types && esno ../../scripts/replace",
|
|
46
|
+
"lint": "eslint --ext .js,.ts .",
|
|
47
|
+
"fix": "eslint --fix --ext .ts .",
|
|
48
|
+
"start": "esno src/index.ts",
|
|
49
|
+
"test": "vitest"
|
|
50
|
+
}
|
|
51
|
+
}
|
package/types/core.d.ts
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
|
|
2
|
+
export interface ImageBase {
|
|
3
|
+
name: string
|
|
4
|
+
alt: string
|
|
5
|
+
title: string
|
|
6
|
+
}
|
|
7
|
+
export interface ImageSeo {
|
|
8
|
+
src: string
|
|
9
|
+
alt: string
|
|
10
|
+
title: string
|
|
11
|
+
name: string
|
|
12
|
+
}
|
|
13
|
+
export type DictionaryImages =
|
|
14
|
+
Record<string, ImageBase>;
|
|
15
|
+
export type DictionaryImagesSeo = Record<string, ImageSeo>;
|
|
16
|
+
|
|
17
|
+
export type LevelPage =
|
|
18
|
+
| string
|
|
19
|
+
| { default: string; locales: Record<string, string> };
|
|
20
|
+
|
|
21
|
+
type Context<CTX = Record<string, any>> = CTX;
|
|
22
|
+
|
|
23
|
+
export interface CtxBuildGlobal {
|
|
24
|
+
locale: string
|
|
25
|
+
pages: Map<string, PageInfo>
|
|
26
|
+
images: DictionaryImagesSeo
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface CtxBuildLocal extends CtxBuildGlobal {
|
|
30
|
+
globals: Context
|
|
31
|
+
name: string
|
|
32
|
+
defaultLocal: string
|
|
33
|
+
originName: string
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export type RunContext<CTX = any, C = any> = (
|
|
37
|
+
ctx: CTX
|
|
38
|
+
) => Context<C> | Promise<Context<C>>;
|
|
39
|
+
|
|
40
|
+
export type Bundle =
|
|
41
|
+
| string
|
|
42
|
+
| { name: string; namespace: string }
|
|
43
|
+
| { name: string; namespace: string }[];
|
|
44
|
+
export interface OptionsLocalPage {
|
|
45
|
+
// url: string;
|
|
46
|
+
view?: {
|
|
47
|
+
template: string
|
|
48
|
+
bundle?: Bundle
|
|
49
|
+
/**
|
|
50
|
+
* Custom component
|
|
51
|
+
*/
|
|
52
|
+
[key: string]: unknown
|
|
53
|
+
}
|
|
54
|
+
seo?: Record<string, any>
|
|
55
|
+
context?: RunContext
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface OptionsPage<L = OptionsLocalPage> {
|
|
59
|
+
name: string
|
|
60
|
+
view: {
|
|
61
|
+
template: string
|
|
62
|
+
bundle?: Bundle
|
|
63
|
+
/**
|
|
64
|
+
* Custom component
|
|
65
|
+
*/
|
|
66
|
+
[key: string]: unknown
|
|
67
|
+
}
|
|
68
|
+
level?: LevelPage
|
|
69
|
+
context?: RunContext
|
|
70
|
+
locales?: Record<string, L>
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Page metadata
|
|
75
|
+
*/
|
|
76
|
+
export interface BlogInfo {
|
|
77
|
+
date?: string
|
|
78
|
+
authors?: {
|
|
79
|
+
name: string
|
|
80
|
+
[key: string]: any
|
|
81
|
+
}[]
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export interface PageInfo {
|
|
85
|
+
/**
|
|
86
|
+
* Nombre de la pagina incluido prefijo y locale
|
|
87
|
+
*/
|
|
88
|
+
name: string
|
|
89
|
+
language: string
|
|
90
|
+
/**
|
|
91
|
+
* Nombre original de la pagina
|
|
92
|
+
*/
|
|
93
|
+
localeName: string
|
|
94
|
+
/**
|
|
95
|
+
* Locale
|
|
96
|
+
*/
|
|
97
|
+
locale: string
|
|
98
|
+
level: string
|
|
99
|
+
redirect?: string
|
|
100
|
+
blogInfo?: BlogInfo
|
|
101
|
+
urlObject: {
|
|
102
|
+
publicPath: string
|
|
103
|
+
level: string
|
|
104
|
+
path: string
|
|
105
|
+
url: string
|
|
106
|
+
static: string
|
|
107
|
+
}
|
|
108
|
+
view: {
|
|
109
|
+
template: string
|
|
110
|
+
bundle?: Bundle
|
|
111
|
+
[key: string]: any
|
|
112
|
+
}
|
|
113
|
+
seo: Record<string, any>
|
|
114
|
+
runLocalContext?: RunContext
|
|
115
|
+
runSharedContext?: RunContext
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
*
|
|
120
|
+
*/
|
|
121
|
+
export interface LocalesUrl {
|
|
122
|
+
locale: string
|
|
123
|
+
url: string
|
|
124
|
+
seo?: Record<string, any>
|
|
125
|
+
}
|
|
126
|
+
interface DefaultLocale {
|
|
127
|
+
language: string
|
|
128
|
+
ubication: string
|
|
129
|
+
publicPath?: string
|
|
130
|
+
}
|
|
131
|
+
export interface LevelOptions {
|
|
132
|
+
prefixName?: string
|
|
133
|
+
level?: LevelPage
|
|
134
|
+
date?: string
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export type RunDefinePages = (options: DefaultLocale) => (
|
|
138
|
+
extraOptions?: LevelOptions
|
|
139
|
+
) => {
|
|
140
|
+
name: string
|
|
141
|
+
pages: (locales: LocalesUrl[]) => PageInfo[]
|
|
142
|
+
};
|
|
143
|
+
export type DefinePages = (options: OptionsPage) => RunDefinePages;
|
package/types/flow.d.ts
CHANGED
|
@@ -1,51 +1,56 @@
|
|
|
1
|
-
import {
|
|
2
|
-
OptionsPage,
|
|
3
|
-
OptionsLocalPage,
|
|
4
|
-
BlogInfo,
|
|
5
|
-
LevelOptions,
|
|
6
|
-
PageInfo
|
|
7
|
-
} from '@monkeyplus/flow-core';
|
|
8
|
-
import { Bundle } from '@monkeyplus/flow-core/types/pages';
|
|
9
|
-
import {
|
|
10
|
-
RouteOptions,
|
|
11
|
-
ServerRoute,
|
|
1
|
+
import type {
|
|
12
2
|
Request,
|
|
13
|
-
ResponseToolkit,
|
|
14
3
|
RequestRoute,
|
|
15
|
-
|
|
4
|
+
ResponseToolkit,
|
|
5
|
+
RouteOptions,
|
|
6
|
+
Server,
|
|
7
|
+
ServerRealm,
|
|
8
|
+
ServerRoute,
|
|
16
9
|
} from '@hapi/hapi';
|
|
17
|
-
import {
|
|
10
|
+
import type {
|
|
11
|
+
BlogInfo,
|
|
12
|
+
Bundle,
|
|
13
|
+
LevelOptions,
|
|
14
|
+
OptionsLocalPage,
|
|
15
|
+
OptionsPage,
|
|
16
|
+
PageInfo,
|
|
17
|
+
} from './core';
|
|
18
|
+
import type {
|
|
19
|
+
FlowEngines,
|
|
20
|
+
FlowExtensions,
|
|
18
21
|
FlowPluginExtension,
|
|
19
22
|
FlowPluginGlobal,
|
|
20
23
|
FlowPluginLocal,
|
|
21
24
|
FlowPluginUtils,
|
|
22
|
-
|
|
23
|
-
FlowEngines,
|
|
24
|
-
FlowStatePlugins
|
|
25
|
+
FlowStatePlugins,
|
|
25
26
|
} from './interfaces';
|
|
26
27
|
|
|
27
28
|
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
28
29
|
export interface FlowOptionPlugins {}
|
|
29
30
|
export interface FlowOptions {
|
|
30
|
-
relativeTo: string
|
|
31
|
-
outputDir?: string
|
|
32
|
-
routeOptions?: RouteOptions
|
|
33
|
-
dirTemplates?: string
|
|
34
|
-
plugins: FlowOptionPlugins
|
|
35
|
-
|
|
31
|
+
relativeTo: string
|
|
32
|
+
outputDir?: string
|
|
33
|
+
routeOptions?: RouteOptions
|
|
34
|
+
dirTemplates?: string
|
|
35
|
+
plugins: FlowOptionPlugins
|
|
36
|
+
staticDir: string
|
|
37
|
+
hmr: {
|
|
38
|
+
dirs: string[]
|
|
39
|
+
}
|
|
40
|
+
engines?: ('eta' | 'nunjucks')[]
|
|
36
41
|
}
|
|
37
42
|
|
|
38
43
|
export interface GenerateFolder {
|
|
39
|
-
prefix: string
|
|
40
|
-
relativeTo: string
|
|
41
|
-
dirs: string[]
|
|
42
|
-
override?: Record<string, string
|
|
43
|
-
type?: string
|
|
44
|
+
prefix: string
|
|
45
|
+
relativeTo: string
|
|
46
|
+
dirs: string[]
|
|
47
|
+
override?: Record<string, string>
|
|
48
|
+
type?: string
|
|
44
49
|
}
|
|
45
50
|
export namespace Extension {
|
|
46
51
|
export interface RouteContext {
|
|
47
|
-
pageInfo: PageInfo
|
|
48
|
-
route: RequestRoute
|
|
52
|
+
pageInfo: PageInfo
|
|
53
|
+
route: RequestRoute
|
|
49
54
|
}
|
|
50
55
|
export type RouteMethod<T = any> = (
|
|
51
56
|
context: RouteContext,
|
|
@@ -54,19 +59,19 @@ export namespace Extension {
|
|
|
54
59
|
|
|
55
60
|
export type InitMethod = () => Promise<void>;
|
|
56
61
|
export interface Extension {
|
|
57
|
-
state: any
|
|
58
|
-
initMethod?: InitMethod
|
|
59
|
-
routeMethod?: RouteMethod
|
|
62
|
+
state: any
|
|
63
|
+
initMethod?: InitMethod
|
|
64
|
+
routeMethod?: RouteMethod
|
|
60
65
|
}
|
|
61
66
|
}
|
|
62
67
|
export namespace Flow {
|
|
63
68
|
interface Page {
|
|
64
|
-
url: string
|
|
65
|
-
locale: string
|
|
66
|
-
localeName: string
|
|
67
|
-
name: string
|
|
68
|
-
context?: any
|
|
69
|
-
dynamicSlug?: string
|
|
69
|
+
url: string
|
|
70
|
+
locale: string
|
|
71
|
+
localeName: string
|
|
72
|
+
name: string
|
|
73
|
+
context?: any
|
|
74
|
+
dynamicSlug?: string
|
|
70
75
|
}
|
|
71
76
|
export type StaticPages = Record<string, Page>;
|
|
72
77
|
export type Routes = Record<string, ServerRoute>;
|
|
@@ -74,159 +79,160 @@ export namespace Flow {
|
|
|
74
79
|
export type Truncates = Record<string, string>;
|
|
75
80
|
export type DynamicContent = Record<string, { path: string; page: PageInfo }>;
|
|
76
81
|
export type DynamicPages = Record<string, () => Promise<StaticPages>>;
|
|
77
|
-
export
|
|
78
|
-
statics: StaticPages
|
|
79
|
-
redirects: Redirects
|
|
80
|
-
dynamics: DynamicPages
|
|
81
|
-
all: StaticPages
|
|
82
|
-
}
|
|
82
|
+
export interface Pages {
|
|
83
|
+
statics: StaticPages
|
|
84
|
+
redirects: Redirects
|
|
85
|
+
dynamics: DynamicPages
|
|
86
|
+
all: StaticPages
|
|
87
|
+
}
|
|
83
88
|
|
|
84
89
|
export interface PluginState {
|
|
85
|
-
local: FlowPluginLocal
|
|
86
|
-
global: FlowPluginGlobal
|
|
87
|
-
utils: FlowPluginUtils
|
|
88
|
-
extensions: FlowPluginExtension
|
|
90
|
+
local: FlowPluginLocal
|
|
91
|
+
global: FlowPluginGlobal
|
|
92
|
+
utils: FlowPluginUtils
|
|
93
|
+
extensions: FlowPluginExtension
|
|
89
94
|
context: Record<
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
95
|
+
string,
|
|
96
|
+
{
|
|
97
|
+
assign: 'global' | 'local' | 'seo'
|
|
98
|
+
method: any
|
|
99
|
+
}
|
|
100
|
+
>
|
|
96
101
|
}
|
|
97
102
|
export interface Helpers {
|
|
98
|
-
addRedirect: (key: string, urlPath: string) => void
|
|
99
|
-
addUrl: (key: string, url: Url) => undefined
|
|
103
|
+
addRedirect: (key: string, urlPath: string) => void
|
|
104
|
+
// addUrl: (key: string, url: Url) => undefined
|
|
100
105
|
}
|
|
101
106
|
export interface AppState {
|
|
102
|
-
routes: Routes
|
|
107
|
+
routes: Routes
|
|
103
108
|
// redirects: Redirects;
|
|
104
109
|
// urls: Urls;
|
|
105
|
-
pages: Pages
|
|
106
|
-
truncates: Truncates
|
|
107
|
-
extensions: Record<string, Extension.Extension
|
|
110
|
+
pages: Pages
|
|
111
|
+
truncates: Truncates
|
|
112
|
+
extensions: Record<string, Extension.Extension>
|
|
108
113
|
// dynamicPages: DynamicPages;
|
|
109
114
|
generate: {
|
|
110
|
-
folders: Record<string, GenerateFolder
|
|
111
|
-
staticFolders: Record<string, boolean
|
|
112
|
-
beforePackage: Record<string, () => Promise<unknown
|
|
113
|
-
postGenerate: Record<string, () => Promise<any
|
|
114
|
-
}
|
|
115
|
-
engines: FlowEngines
|
|
116
|
-
plugins: FlowStatePlugins
|
|
115
|
+
folders: Record<string, GenerateFolder>
|
|
116
|
+
staticFolders: Record<string, boolean>
|
|
117
|
+
beforePackage: Record<string, () => Promise<unknown>>
|
|
118
|
+
postGenerate: Record<string, () => Promise<any>>
|
|
119
|
+
}
|
|
120
|
+
engines: FlowEngines
|
|
121
|
+
plugins: FlowStatePlugins
|
|
117
122
|
}
|
|
118
123
|
export interface Configs extends FlowOptions {
|
|
119
|
-
relativeTo: string
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
124
|
+
relativeTo: string
|
|
125
|
+
|
|
126
|
+
locales: string[]
|
|
127
|
+
defaultUbication: string
|
|
128
|
+
defaultLanguage: string
|
|
129
|
+
publicPath: string
|
|
130
|
+
locale: string
|
|
131
|
+
url: string
|
|
132
|
+
engines: ('eta' | 'nunjucks')[]
|
|
127
133
|
// redirects: {};
|
|
128
134
|
}
|
|
129
135
|
export interface GenerateOptions {
|
|
130
|
-
assets?: GenerateFolder[]
|
|
131
|
-
ommitAssets?: string[]
|
|
136
|
+
assets?: GenerateFolder[]
|
|
137
|
+
ommitAssets?: string[]
|
|
132
138
|
/**
|
|
133
139
|
* Solo aplicable para compilaciones
|
|
134
140
|
*/
|
|
135
|
-
virtualGenerate?: boolean
|
|
141
|
+
virtualGenerate?: boolean
|
|
136
142
|
}
|
|
137
143
|
|
|
138
144
|
export interface Decorate {
|
|
139
|
-
prepagePackage: () => Promise<unknown
|
|
140
|
-
serverInfo: () => void
|
|
141
|
-
init: (proxy?: boolean) => Promise<void
|
|
145
|
+
prepagePackage: () => Promise<unknown>
|
|
146
|
+
serverInfo: () => void
|
|
147
|
+
init: (proxy?: boolean) => Promise<void>
|
|
142
148
|
addPage: (
|
|
143
149
|
page: RunDefinePage | OptionsHapiPage,
|
|
144
150
|
dynamic?: OptionsDynamicPages
|
|
145
|
-
) => Promise<void
|
|
151
|
+
) => Promise<void>
|
|
146
152
|
// getPath: (...path: string[]) => string;
|
|
147
|
-
runGenerate: (options?: GenerateOptions) => Promise<void
|
|
153
|
+
runGenerate: (options?: GenerateOptions) => Promise<void>
|
|
148
154
|
assignPluginOptions: <R = any>(
|
|
149
155
|
realm: ServerRealm,
|
|
150
156
|
options: any,
|
|
151
157
|
defaults?: any,
|
|
152
158
|
context?: any
|
|
153
|
-
) => R
|
|
159
|
+
) => R
|
|
154
160
|
}
|
|
155
161
|
export interface HandlerOptions {
|
|
156
|
-
name: string
|
|
157
|
-
locale?: string
|
|
162
|
+
name: string
|
|
163
|
+
locale?: string
|
|
158
164
|
view: {
|
|
159
|
-
template: string
|
|
160
|
-
bundle?: Bundle
|
|
161
|
-
[key: string]: any
|
|
162
|
-
}
|
|
163
|
-
context?: RunContextHapi
|
|
164
|
-
content?: string
|
|
165
|
+
template: string
|
|
166
|
+
bundle?: Bundle
|
|
167
|
+
[key: string]: any
|
|
168
|
+
}
|
|
169
|
+
context?: RunContextHapi
|
|
170
|
+
content?: string
|
|
165
171
|
}
|
|
166
172
|
}
|
|
167
173
|
|
|
168
174
|
export interface OptionsHapiLocalPage extends OptionsLocalPage {
|
|
169
|
-
url: string
|
|
170
|
-
blogInfo?: BlogInfo
|
|
171
|
-
options?: RouteOptions
|
|
172
|
-
rules?: Record<string, unknown
|
|
173
|
-
dynamic?: OptionDynamicLocalePages
|
|
175
|
+
url: string
|
|
176
|
+
blogInfo?: BlogInfo
|
|
177
|
+
options?: RouteOptions
|
|
178
|
+
rules?: Record<string, unknown>
|
|
179
|
+
dynamic?: OptionDynamicLocalePages
|
|
174
180
|
|
|
175
|
-
context?: RunContextHapi
|
|
176
|
-
vhost?: string | string[]
|
|
181
|
+
context?: RunContextHapi
|
|
182
|
+
vhost?: string | string[]
|
|
177
183
|
}
|
|
178
184
|
export interface ContextHandler {
|
|
179
|
-
req: Request
|
|
180
|
-
h: ResponseToolkit
|
|
185
|
+
req: Request
|
|
186
|
+
h: ResponseToolkit
|
|
181
187
|
page: {
|
|
182
|
-
level: string
|
|
183
|
-
name: string
|
|
184
|
-
locale: string
|
|
185
|
-
template: string
|
|
186
|
-
bundle: Bundle
|
|
187
|
-
publicPath: string
|
|
188
|
-
path: string
|
|
189
|
-
dynamicSlug: string
|
|
190
|
-
}
|
|
191
|
-
seo: Record<string, any
|
|
188
|
+
level: string
|
|
189
|
+
name: string
|
|
190
|
+
locale: string
|
|
191
|
+
template: string
|
|
192
|
+
bundle: Bundle
|
|
193
|
+
publicPath: string
|
|
194
|
+
path: string
|
|
195
|
+
dynamicSlug: string
|
|
196
|
+
}
|
|
197
|
+
seo: Record<string, any>
|
|
192
198
|
/**
|
|
193
199
|
* Si la genoracion de paginas es dinamica este es el contenido
|
|
194
200
|
*/
|
|
195
|
-
global: FlowPluginGlobal
|
|
196
|
-
extensions: FlowPluginExtension
|
|
197
|
-
utils: FlowPluginUtils
|
|
201
|
+
global: FlowPluginGlobal
|
|
202
|
+
extensions: FlowPluginExtension
|
|
203
|
+
utils: FlowPluginUtils
|
|
198
204
|
}
|
|
199
205
|
|
|
200
206
|
export type RunContextHapi = (ctx: ContextHandler) => Promise<any>;
|
|
201
207
|
|
|
202
208
|
export interface OptionsHapiPage extends OptionsPage {
|
|
203
|
-
options?: RouteOptions
|
|
204
|
-
context?: RunContextHapi
|
|
209
|
+
options?: RouteOptions
|
|
210
|
+
context?: RunContextHapi
|
|
205
211
|
|
|
206
|
-
locales: Record<string, OptionsHapiLocalPage
|
|
207
|
-
rules?: Record<string, unknown
|
|
208
|
-
vhost?: string | string[]
|
|
209
|
-
extensions?: FlowExtensions
|
|
212
|
+
locales: Record<string, OptionsHapiLocalPage>
|
|
213
|
+
rules?: Record<string, unknown>
|
|
214
|
+
vhost?: string | string[]
|
|
215
|
+
extensions?: FlowExtensions
|
|
210
216
|
}
|
|
211
217
|
export interface OptionDynamicLocalePages {
|
|
212
|
-
//Si existe la propiedad contexta asignar a esta propiedad
|
|
213
|
-
assign?: string
|
|
218
|
+
// Si existe la propiedad contexta asignar a esta propiedad
|
|
219
|
+
assign?: string
|
|
214
220
|
pages: (ctx: {
|
|
215
|
-
server: Server
|
|
216
|
-
route: RequestRoute
|
|
217
|
-
locale: string
|
|
218
|
-
}) => Promise<Omit<Flow.Page, 'locale' | 'localeName'>[]
|
|
221
|
+
server: Server
|
|
222
|
+
route: RequestRoute
|
|
223
|
+
locale: string
|
|
224
|
+
}) => Promise<Omit<Flow.Page, 'locale' | 'localeName'>[]>
|
|
219
225
|
}
|
|
220
226
|
export interface OptionsDynamicPages {
|
|
221
227
|
// prefix?: (route: RequestRoute) => string | Promise<string>;
|
|
222
|
-
assign?: string
|
|
228
|
+
assign?: string
|
|
223
229
|
pages: (ctx: {
|
|
224
|
-
server: Server
|
|
225
|
-
route: RequestRoute
|
|
226
|
-
}) => Promise<Flow.StaticPages
|
|
230
|
+
server: Server
|
|
231
|
+
route: RequestRoute
|
|
232
|
+
}) => Promise<Flow.StaticPages>
|
|
227
233
|
}
|
|
228
234
|
export interface ExtraPageOptions {
|
|
229
|
-
dynamic?: OptionsDynamicPages
|
|
235
|
+
dynamic?: OptionsDynamicPages
|
|
230
236
|
}
|
|
231
237
|
// import {} from '..'
|
|
232
238
|
export type RunDefinePage = (configs: Flow.Configs) => ServerRoute[];
|
package/types/index.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export {
|
|
|
12
12
|
ContextHandler,
|
|
13
13
|
OptionsDynamicPages,
|
|
14
14
|
OptionDynamicLocalePages,
|
|
15
|
-
ExtraPageOptions
|
|
15
|
+
ExtraPageOptions,
|
|
16
16
|
} from './flow';
|
|
17
17
|
export {
|
|
18
18
|
FlowExtensions,
|
|
@@ -26,7 +26,7 @@ export {
|
|
|
26
26
|
FlowContextPage,
|
|
27
27
|
FlowEngines,
|
|
28
28
|
FlowStatePlugins,
|
|
29
|
-
FlowServerMethods
|
|
29
|
+
FlowServerMethods,
|
|
30
30
|
} from './interfaces';
|
|
31
31
|
export type GenerateOptions =
|
|
32
32
|
| boolean
|
package/types/interfaces.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-empty-interface */
|
|
2
|
-
import { Request, ResponseToolkit } from '@hapi/hapi';
|
|
3
|
-
import { Flow } from './flow';
|
|
2
|
+
import type { Request, ResponseToolkit } from '@hapi/hapi';
|
|
3
|
+
import type { Flow } from './flow';
|
|
4
4
|
export interface FlowExtensions {}
|
|
5
5
|
export interface FlowPluginExtension {}
|
|
6
|
-
export interface FlowPluginUtils {}
|
|
6
|
+
// export interface FlowPluginUtils {}
|
|
7
7
|
|
|
8
8
|
export interface FlowPluginUtils {
|
|
9
|
-
getLocalUrl: (name: string) => string
|
|
10
|
-
getUrl: (locale: string, name: string) => string
|
|
9
|
+
getLocalUrl: (name: string) => string
|
|
10
|
+
getUrl: (locale: string, name: string) => string
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export interface FlowPluginLocal {}
|
|
@@ -18,26 +18,26 @@ export interface FlowPluginGlobal {}
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
20
|
export interface FlowContextSeo {
|
|
21
|
-
title: string
|
|
22
|
-
description: string
|
|
23
|
-
keywords: string
|
|
24
|
-
url: string
|
|
25
|
-
pageUrl: string
|
|
21
|
+
title: string
|
|
22
|
+
description: string
|
|
23
|
+
keywords: string
|
|
24
|
+
url: string
|
|
25
|
+
pageUrl: string
|
|
26
26
|
}
|
|
27
27
|
export interface FlowContextPage {
|
|
28
|
-
publicPath: string
|
|
29
|
-
path: string
|
|
30
|
-
name: string
|
|
31
|
-
locale: string
|
|
32
|
-
level: string
|
|
33
|
-
template: string
|
|
34
|
-
bundle: string
|
|
35
|
-
language: string
|
|
28
|
+
publicPath: string
|
|
29
|
+
path: string
|
|
30
|
+
name: string
|
|
31
|
+
locale: string
|
|
32
|
+
level: string
|
|
33
|
+
template: string
|
|
34
|
+
bundle: string
|
|
35
|
+
language: string
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
export interface FlowContextView {
|
|
39
|
-
bundle: string
|
|
40
|
-
template: string
|
|
39
|
+
bundle: string
|
|
40
|
+
template: string
|
|
41
41
|
}
|
|
42
42
|
// export interface FlowContextGlobal {}
|
|
43
43
|
|
|
@@ -48,14 +48,14 @@ export namespace Contexts {
|
|
|
48
48
|
export interface View extends FlowContextView {}
|
|
49
49
|
export interface Global extends FlowPluginGlobal {}
|
|
50
50
|
export interface Hapi {
|
|
51
|
-
req: Request
|
|
52
|
-
h: ResponseToolkit
|
|
51
|
+
req: Request
|
|
52
|
+
h: ResponseToolkit
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
export interface FlowEngines {}
|
|
57
57
|
export interface FlowStatePlugins {}
|
|
58
58
|
export interface FlowServerMethods {
|
|
59
|
-
pages: () => Promise<Flow.StaticPages
|
|
60
|
-
getUrl: (locale: string, name: string) => string
|
|
59
|
+
pages: () => Promise<Flow.StaticPages>
|
|
60
|
+
getUrl: (locale: string, name: string) => string
|
|
61
61
|
}
|
package/dist/config.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
declare const pkg: any;
|
|
2
|
-
export declare const logger: import("consola").Consola;
|
|
3
|
-
export declare const dependencies: {
|
|
4
|
-
'@hapi/vision': string;
|
|
5
|
-
};
|
|
6
|
-
export { pkg };
|
|
7
|
-
/**
|
|
8
|
-
export const FULL_NAME_PLUGIN = `@monkeyplus/flow`;
|
|
9
|
-
|
|
10
|
-
export const DEPENDENCIES = {
|
|
11
|
-
// '@hapi/vision': '6.x.x',
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
*
|
|
15
|
-
*/
|