@monkeyplus/flow 3.7.4 → 4.0.0-beta.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/index.cjs +871 -0
- package/dist/index.d.ts +10 -6
- package/dist/index.mjs +845 -0
- package/package.json +31 -17
- package/types/core.d.ts +143 -0
- package/types/flow.d.ts +133 -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 -176
- 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,47 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@monkeyplus/flow",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-beta.1",
|
|
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
|
-
"
|
|
27
|
-
"chalk": "^4.1.2",
|
|
23
|
+
"chalk": "^5.0.0",
|
|
28
24
|
"consola": "^2.15.3",
|
|
29
25
|
"fs-extra": "^10.0.0",
|
|
30
|
-
"ramda": "^0.
|
|
26
|
+
"ramda": "^0.28.0"
|
|
31
27
|
},
|
|
32
|
-
"
|
|
33
|
-
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@types/fs-extra": "^9.0.13",
|
|
30
|
+
"@types/hapi__hapi": "^20.0.10",
|
|
31
|
+
"@types/ramda": "^0.27.64"
|
|
32
|
+
},
|
|
33
|
+
"peerDependencies": {
|
|
34
|
+
"@hapi/hapi": "^20.x"
|
|
35
|
+
},
|
|
36
|
+
"gitHead": "1d5387b9c77909019f36d360a0ac53ddaa40e4af",
|
|
37
|
+
"scripts": {
|
|
38
|
+
"build": "unbuild",
|
|
39
|
+
"dev": "pnpm stub && pnpm types",
|
|
40
|
+
"stub": "unbuild --stub",
|
|
41
|
+
"types": "tsup ./src/index.ts --dts-only --external types && esno ../../scripts/replace",
|
|
42
|
+
"lint": "eslint --ext .js,.ts .",
|
|
43
|
+
"fix": "eslint --fix --ext .ts .",
|
|
44
|
+
"start": "esno src/index.ts",
|
|
45
|
+
"test": "vitest"
|
|
46
|
+
}
|
|
47
|
+
}
|
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,52 @@
|
|
|
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
|
-
engines?: ('eta' | 'nunjucks')[]
|
|
31
|
+
relativeTo: string
|
|
32
|
+
outputDir?: string
|
|
33
|
+
routeOptions?: RouteOptions
|
|
34
|
+
dirTemplates?: string
|
|
35
|
+
plugins: FlowOptionPlugins
|
|
36
|
+
engines?: ('eta' | 'nunjucks')[]
|
|
36
37
|
}
|
|
37
38
|
|
|
38
39
|
export interface GenerateFolder {
|
|
39
|
-
prefix: string
|
|
40
|
-
relativeTo: string
|
|
41
|
-
dirs: string[]
|
|
42
|
-
override?: Record<string, string
|
|
43
|
-
type?: string
|
|
40
|
+
prefix: string
|
|
41
|
+
relativeTo: string
|
|
42
|
+
dirs: string[]
|
|
43
|
+
override?: Record<string, string>
|
|
44
|
+
type?: string
|
|
44
45
|
}
|
|
45
46
|
export namespace Extension {
|
|
46
47
|
export interface RouteContext {
|
|
47
|
-
pageInfo: PageInfo
|
|
48
|
-
route: RequestRoute
|
|
48
|
+
pageInfo: PageInfo
|
|
49
|
+
route: RequestRoute
|
|
49
50
|
}
|
|
50
51
|
export type RouteMethod<T = any> = (
|
|
51
52
|
context: RouteContext,
|
|
@@ -54,19 +55,19 @@ export namespace Extension {
|
|
|
54
55
|
|
|
55
56
|
export type InitMethod = () => Promise<void>;
|
|
56
57
|
export interface Extension {
|
|
57
|
-
state: any
|
|
58
|
-
initMethod?: InitMethod
|
|
59
|
-
routeMethod?: RouteMethod
|
|
58
|
+
state: any
|
|
59
|
+
initMethod?: InitMethod
|
|
60
|
+
routeMethod?: RouteMethod
|
|
60
61
|
}
|
|
61
62
|
}
|
|
62
63
|
export namespace Flow {
|
|
63
64
|
interface Page {
|
|
64
|
-
url: string
|
|
65
|
-
locale: string
|
|
66
|
-
localeName: string
|
|
67
|
-
name: string
|
|
68
|
-
context?: any
|
|
69
|
-
dynamicSlug?: string
|
|
65
|
+
url: string
|
|
66
|
+
locale: string
|
|
67
|
+
localeName: string
|
|
68
|
+
name: string
|
|
69
|
+
context?: any
|
|
70
|
+
dynamicSlug?: string
|
|
70
71
|
}
|
|
71
72
|
export type StaticPages = Record<string, Page>;
|
|
72
73
|
export type Routes = Record<string, ServerRoute>;
|
|
@@ -74,159 +75,159 @@ export namespace Flow {
|
|
|
74
75
|
export type Truncates = Record<string, string>;
|
|
75
76
|
export type DynamicContent = Record<string, { path: string; page: PageInfo }>;
|
|
76
77
|
export type DynamicPages = Record<string, () => Promise<StaticPages>>;
|
|
77
|
-
export
|
|
78
|
-
statics: StaticPages
|
|
79
|
-
redirects: Redirects
|
|
80
|
-
dynamics: DynamicPages
|
|
81
|
-
all: StaticPages
|
|
82
|
-
}
|
|
78
|
+
export interface Pages {
|
|
79
|
+
statics: StaticPages
|
|
80
|
+
redirects: Redirects
|
|
81
|
+
dynamics: DynamicPages
|
|
82
|
+
all: StaticPages
|
|
83
|
+
}
|
|
83
84
|
|
|
84
85
|
export interface PluginState {
|
|
85
|
-
local: FlowPluginLocal
|
|
86
|
-
global: FlowPluginGlobal
|
|
87
|
-
utils: FlowPluginUtils
|
|
88
|
-
extensions: FlowPluginExtension
|
|
86
|
+
local: FlowPluginLocal
|
|
87
|
+
global: FlowPluginGlobal
|
|
88
|
+
utils: FlowPluginUtils
|
|
89
|
+
extensions: FlowPluginExtension
|
|
89
90
|
context: Record<
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
91
|
+
string,
|
|
92
|
+
{
|
|
93
|
+
assign: 'global' | 'local' | 'seo'
|
|
94
|
+
method: any
|
|
95
|
+
}
|
|
96
|
+
>
|
|
96
97
|
}
|
|
97
98
|
export interface Helpers {
|
|
98
|
-
addRedirect: (key: string, urlPath: string) => void
|
|
99
|
-
addUrl: (key: string, url: Url) => undefined
|
|
99
|
+
addRedirect: (key: string, urlPath: string) => void
|
|
100
|
+
// addUrl: (key: string, url: Url) => undefined
|
|
100
101
|
}
|
|
101
102
|
export interface AppState {
|
|
102
|
-
routes: Routes
|
|
103
|
+
routes: Routes
|
|
103
104
|
// redirects: Redirects;
|
|
104
105
|
// urls: Urls;
|
|
105
|
-
pages: Pages
|
|
106
|
-
truncates: Truncates
|
|
107
|
-
extensions: Record<string, Extension.Extension
|
|
106
|
+
pages: Pages
|
|
107
|
+
truncates: Truncates
|
|
108
|
+
extensions: Record<string, Extension.Extension>
|
|
108
109
|
// dynamicPages: DynamicPages;
|
|
109
110
|
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
|
|
111
|
+
folders: Record<string, GenerateFolder>
|
|
112
|
+
staticFolders: Record<string, boolean>
|
|
113
|
+
beforePackage: Record<string, () => Promise<unknown>>
|
|
114
|
+
postGenerate: Record<string, () => Promise<any>>
|
|
115
|
+
}
|
|
116
|
+
engines: FlowEngines
|
|
117
|
+
plugins: FlowStatePlugins
|
|
117
118
|
}
|
|
118
119
|
export interface Configs extends FlowOptions {
|
|
119
|
-
relativeTo: string
|
|
120
|
-
locales: string[]
|
|
121
|
-
defaultUbication: string
|
|
122
|
-
defaultLanguage: string
|
|
123
|
-
publicPath: string
|
|
124
|
-
locale: string
|
|
125
|
-
url: string
|
|
126
|
-
engines: ('eta' | 'nunjucks')[]
|
|
120
|
+
relativeTo: string
|
|
121
|
+
locales: string[]
|
|
122
|
+
defaultUbication: string
|
|
123
|
+
defaultLanguage: string
|
|
124
|
+
publicPath: string
|
|
125
|
+
locale: string
|
|
126
|
+
url: string
|
|
127
|
+
engines: ('eta' | 'nunjucks')[]
|
|
127
128
|
// redirects: {};
|
|
128
129
|
}
|
|
129
130
|
export interface GenerateOptions {
|
|
130
|
-
assets?: GenerateFolder[]
|
|
131
|
-
ommitAssets?: string[]
|
|
131
|
+
assets?: GenerateFolder[]
|
|
132
|
+
ommitAssets?: string[]
|
|
132
133
|
/**
|
|
133
134
|
* Solo aplicable para compilaciones
|
|
134
135
|
*/
|
|
135
|
-
virtualGenerate?: boolean
|
|
136
|
+
virtualGenerate?: boolean
|
|
136
137
|
}
|
|
137
138
|
|
|
138
139
|
export interface Decorate {
|
|
139
|
-
prepagePackage: () => Promise<unknown
|
|
140
|
-
serverInfo: () => void
|
|
141
|
-
init: (proxy?: boolean) => Promise<void
|
|
140
|
+
prepagePackage: () => Promise<unknown>
|
|
141
|
+
serverInfo: () => void
|
|
142
|
+
init: (proxy?: boolean) => Promise<void>
|
|
142
143
|
addPage: (
|
|
143
144
|
page: RunDefinePage | OptionsHapiPage,
|
|
144
145
|
dynamic?: OptionsDynamicPages
|
|
145
|
-
) => Promise<void
|
|
146
|
+
) => Promise<void>
|
|
146
147
|
// getPath: (...path: string[]) => string;
|
|
147
|
-
runGenerate: (options?: GenerateOptions) => Promise<void
|
|
148
|
+
runGenerate: (options?: GenerateOptions) => Promise<void>
|
|
148
149
|
assignPluginOptions: <R = any>(
|
|
149
150
|
realm: ServerRealm,
|
|
150
151
|
options: any,
|
|
151
152
|
defaults?: any,
|
|
152
153
|
context?: any
|
|
153
|
-
) => R
|
|
154
|
+
) => R
|
|
154
155
|
}
|
|
155
156
|
export interface HandlerOptions {
|
|
156
|
-
name: string
|
|
157
|
-
locale?: string
|
|
157
|
+
name: string
|
|
158
|
+
locale?: string
|
|
158
159
|
view: {
|
|
159
|
-
template: string
|
|
160
|
-
bundle?: Bundle
|
|
161
|
-
[key: string]: any
|
|
162
|
-
}
|
|
163
|
-
context?: RunContextHapi
|
|
164
|
-
content?: string
|
|
160
|
+
template: string
|
|
161
|
+
bundle?: Bundle
|
|
162
|
+
[key: string]: any
|
|
163
|
+
}
|
|
164
|
+
context?: RunContextHapi
|
|
165
|
+
content?: string
|
|
165
166
|
}
|
|
166
167
|
}
|
|
167
168
|
|
|
168
169
|
export interface OptionsHapiLocalPage extends OptionsLocalPage {
|
|
169
|
-
url: string
|
|
170
|
-
blogInfo?: BlogInfo
|
|
171
|
-
options?: RouteOptions
|
|
172
|
-
rules?: Record<string, unknown
|
|
173
|
-
dynamic?: OptionDynamicLocalePages
|
|
170
|
+
url: string
|
|
171
|
+
blogInfo?: BlogInfo
|
|
172
|
+
options?: RouteOptions
|
|
173
|
+
rules?: Record<string, unknown>
|
|
174
|
+
dynamic?: OptionDynamicLocalePages
|
|
174
175
|
|
|
175
|
-
context?: RunContextHapi
|
|
176
|
-
vhost?: string | string[]
|
|
176
|
+
context?: RunContextHapi
|
|
177
|
+
vhost?: string | string[]
|
|
177
178
|
}
|
|
178
179
|
export interface ContextHandler {
|
|
179
|
-
req: Request
|
|
180
|
-
h: ResponseToolkit
|
|
180
|
+
req: Request
|
|
181
|
+
h: ResponseToolkit
|
|
181
182
|
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
|
|
183
|
+
level: string
|
|
184
|
+
name: string
|
|
185
|
+
locale: string
|
|
186
|
+
template: string
|
|
187
|
+
bundle: Bundle
|
|
188
|
+
publicPath: string
|
|
189
|
+
path: string
|
|
190
|
+
dynamicSlug: string
|
|
191
|
+
}
|
|
192
|
+
seo: Record<string, any>
|
|
192
193
|
/**
|
|
193
194
|
* Si la genoracion de paginas es dinamica este es el contenido
|
|
194
195
|
*/
|
|
195
|
-
global: FlowPluginGlobal
|
|
196
|
-
extensions: FlowPluginExtension
|
|
197
|
-
utils: FlowPluginUtils
|
|
196
|
+
global: FlowPluginGlobal
|
|
197
|
+
extensions: FlowPluginExtension
|
|
198
|
+
utils: FlowPluginUtils
|
|
198
199
|
}
|
|
199
200
|
|
|
200
201
|
export type RunContextHapi = (ctx: ContextHandler) => Promise<any>;
|
|
201
202
|
|
|
202
203
|
export interface OptionsHapiPage extends OptionsPage {
|
|
203
|
-
options?: RouteOptions
|
|
204
|
-
context?: RunContextHapi
|
|
204
|
+
options?: RouteOptions
|
|
205
|
+
context?: RunContextHapi
|
|
205
206
|
|
|
206
|
-
locales: Record<string, OptionsHapiLocalPage
|
|
207
|
-
rules?: Record<string, unknown
|
|
208
|
-
vhost?: string | string[]
|
|
209
|
-
extensions?: FlowExtensions
|
|
207
|
+
locales: Record<string, OptionsHapiLocalPage>
|
|
208
|
+
rules?: Record<string, unknown>
|
|
209
|
+
vhost?: string | string[]
|
|
210
|
+
extensions?: FlowExtensions
|
|
210
211
|
}
|
|
211
212
|
export interface OptionDynamicLocalePages {
|
|
212
|
-
//Si existe la propiedad contexta asignar a esta propiedad
|
|
213
|
-
assign?: string
|
|
213
|
+
// Si existe la propiedad contexta asignar a esta propiedad
|
|
214
|
+
assign?: string
|
|
214
215
|
pages: (ctx: {
|
|
215
|
-
server: Server
|
|
216
|
-
route: RequestRoute
|
|
217
|
-
locale: string
|
|
218
|
-
}) => Promise<Omit<Flow.Page, 'locale' | 'localeName'>[]
|
|
216
|
+
server: Server
|
|
217
|
+
route: RequestRoute
|
|
218
|
+
locale: string
|
|
219
|
+
}) => Promise<Omit<Flow.Page, 'locale' | 'localeName'>[]>
|
|
219
220
|
}
|
|
220
221
|
export interface OptionsDynamicPages {
|
|
221
222
|
// prefix?: (route: RequestRoute) => string | Promise<string>;
|
|
222
|
-
assign?: string
|
|
223
|
+
assign?: string
|
|
223
224
|
pages: (ctx: {
|
|
224
|
-
server: Server
|
|
225
|
-
route: RequestRoute
|
|
226
|
-
}) => Promise<Flow.StaticPages
|
|
225
|
+
server: Server
|
|
226
|
+
route: RequestRoute
|
|
227
|
+
}) => Promise<Flow.StaticPages>
|
|
227
228
|
}
|
|
228
229
|
export interface ExtraPageOptions {
|
|
229
|
-
dynamic?: OptionsDynamicPages
|
|
230
|
+
dynamic?: OptionsDynamicPages
|
|
230
231
|
}
|
|
231
232
|
// import {} from '..'
|
|
232
233
|
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
|
-
*/
|