@monkeyplus/flow 4.0.0-beta.9 → 5.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.
Files changed (90) hide show
  1. package/app.d.ts +1 -0
  2. package/bin/flow.mjs +2 -0
  3. package/build.config.ts +25 -0
  4. package/dist/app/composables/index.d.ts +4 -0
  5. package/dist/app/composables/index.mjs +12 -0
  6. package/dist/app/entry.d.ts +3 -0
  7. package/dist/app/entry.mjs +23 -0
  8. package/dist/app/flow.d.ts +73 -0
  9. package/dist/app/flow.mjs +85 -0
  10. package/dist/app/index.d.ts +3 -0
  11. package/dist/app/index.mjs +3 -0
  12. package/dist/core/runtime/nitro/flow.d.ts +3 -0
  13. package/dist/core/runtime/nitro/flow.mjs +32 -0
  14. package/dist/core/runtime/nitro/paths.d.ts +4 -0
  15. package/dist/core/runtime/nitro/paths.mjs +15 -0
  16. package/dist/core/runtime/nitro/renderer.d.ts +2 -0
  17. package/dist/core/runtime/nitro/renderer.mjs +59 -0
  18. package/dist/head/runtime/composables.d.ts +9 -0
  19. package/dist/head/runtime/composables.mjs +2 -0
  20. package/dist/head/runtime/index.d.ts +1 -0
  21. package/dist/head/runtime/index.mjs +1 -0
  22. package/dist/head/runtime/plugin.d.ts +2 -0
  23. package/dist/head/runtime/plugin.mjs +6 -0
  24. package/dist/index.d.ts +8 -61
  25. package/dist/index.mjs +1286 -954
  26. package/dist/pages/runtime/helpers/chunks.d.ts +0 -0
  27. package/dist/pages/runtime/helpers/chunks.mjs +0 -0
  28. package/dist/pages/runtime/helpers/index.d.ts +5 -0
  29. package/dist/pages/runtime/helpers/index.mjs +28 -0
  30. package/dist/pages/runtime/plugin.d.ts +2 -0
  31. package/dist/pages/runtime/plugin.mjs +51 -0
  32. package/dist/vite-client/runtime/injectManifest.d.ts +26 -0
  33. package/dist/vite-client/runtime/injectManifest.mjs +104 -0
  34. package/dist/vite-client/runtime/plugin.d.ts +2 -0
  35. package/dist/vite-client/runtime/plugin.mjs +27 -0
  36. package/package.json +54 -36
  37. package/src/app/composables/index.ts +20 -0
  38. package/src/app/entry.ts +36 -0
  39. package/src/app/flow.ts +157 -0
  40. package/src/app/index.ts +5 -0
  41. package/src/auto-imports/module.ts +143 -0
  42. package/src/auto-imports/presets.ts +49 -0
  43. package/src/auto-imports/transform.ts +48 -0
  44. package/src/core/app.ts +90 -0
  45. package/src/core/builder.ts +60 -0
  46. package/src/core/flow.ts +93 -0
  47. package/src/core/modules.ts +32 -0
  48. package/src/core/nitro.ts +206 -0
  49. package/src/core/plugins/import-protection.ts +49 -0
  50. package/src/core/plugins/unctx.ts +31 -0
  51. package/src/core/runtime/nitro/flow.ts +43 -0
  52. package/src/core/runtime/nitro/paths.ts +20 -0
  53. package/src/core/runtime/nitro/renderer.ts +74 -0
  54. package/src/core/templates.ts +119 -0
  55. package/src/core/vite/builder/css.ts +28 -0
  56. package/src/core/vite/builder/dev-bundler.ts +248 -0
  57. package/src/core/vite/builder/index.ts +96 -0
  58. package/src/core/vite/builder/manifest.ts +33 -0
  59. package/src/core/vite/builder/plugins/analyze.ts +32 -0
  60. package/src/core/vite/builder/plugins/cache-dir.ts +13 -0
  61. package/src/core/vite/builder/plugins/dynamic-base.ts +64 -0
  62. package/src/core/vite/builder/plugins/virtual.ts +45 -0
  63. package/src/core/vite/builder/server.ts +164 -0
  64. package/src/core/vite/builder/types/index.ts +13 -0
  65. package/src/core/vite/builder/utils/index.ts +53 -0
  66. package/src/core/vite/builder/utils/warmup.ts +27 -0
  67. package/src/core/vite/builder/utils/wpfs.ts +7 -0
  68. package/src/core/vite/builder/vite-node.ts +110 -0
  69. package/src/core/vite/client/index.ts +55 -0
  70. package/src/dirs.ts +8 -0
  71. package/src/head/module.ts +37 -0
  72. package/src/head/runtime/composables.ts +16 -0
  73. package/src/head/runtime/index.ts +1 -0
  74. package/src/head/runtime/plugin.ts +12 -0
  75. package/src/index.ts +2 -0
  76. package/src/pages/module.ts +55 -0
  77. package/src/pages/runtime/helpers/chunks.ts +0 -0
  78. package/src/pages/runtime/helpers/index.ts +33 -0
  79. package/src/pages/runtime/plugin.ts +58 -0
  80. package/src/pages/templates.ts +20 -0
  81. package/src/pages/utils.ts +49 -0
  82. package/src/vite-client/module.ts +81 -0
  83. package/src/vite-client/runtime/injectManifest.ts +188 -0
  84. package/src/vite-client/runtime/plugin.ts +33 -0
  85. package/types.d.ts +2 -0
  86. package/dist/index.cjs +0 -1061
  87. package/types/core.d.ts +0 -143
  88. package/types/flow.d.ts +0 -239
  89. package/types/index.d.ts +0 -38
  90. package/types/interfaces.d.ts +0 -61
package/types/core.d.ts DELETED
@@ -1,143 +0,0 @@
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 DELETED
@@ -1,239 +0,0 @@
1
- import type {
2
- Request,
3
- RequestRoute,
4
- ResponseToolkit,
5
- RouteOptions,
6
- Server,
7
- ServerRealm,
8
- ServerRoute,
9
- } from '@hapi/hapi';
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,
21
- FlowPluginExtension,
22
- FlowPluginGlobal,
23
- FlowPluginLocal,
24
- FlowPluginUtils,
25
- FlowStatePlugins,
26
- } from './interfaces';
27
-
28
- // eslint-disable-next-line @typescript-eslint/no-empty-interface
29
- export interface FlowOptionPlugins {}
30
- export interface FlowOptions {
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')[]
41
- }
42
-
43
- export interface GenerateFolder {
44
- prefix: string
45
- relativeTo: string
46
- dirs: string[]
47
- override?: Record<string, string>
48
- type?: string
49
- }
50
- export namespace Extension {
51
- export interface RouteContext {
52
- pageInfo: PageInfo
53
- route: RequestRoute
54
- }
55
- export type RouteMethod<T = any> = (
56
- context: RouteContext,
57
- options: T
58
- ) => void;
59
-
60
- export type InitMethod = () => Promise<void>;
61
- export interface Extension {
62
- state: any
63
- initMethod?: InitMethod
64
- routeMethod?: RouteMethod
65
- }
66
- }
67
- export namespace Flow {
68
- interface Page {
69
- url: string
70
- locale: string
71
- localeName: string
72
- name: string
73
- context?: any
74
- dynamicSlug?: string
75
- }
76
- export type StaticPages = Record<string, Page>;
77
- export type Routes = Record<string, ServerRoute>;
78
- export type Redirects = Record<string, string>;
79
- export type Truncates = Record<string, string>;
80
- export type DynamicContent = Record<string, { path: string; page: PageInfo }>;
81
- export type DynamicPages = Record<string, () => Promise<StaticPages>>;
82
- export interface Pages {
83
- statics: StaticPages
84
- redirects: Redirects
85
- dynamics: DynamicPages
86
- all: StaticPages
87
- }
88
-
89
- export interface PluginState {
90
- local: FlowPluginLocal
91
- global: FlowPluginGlobal
92
- utils: FlowPluginUtils
93
- extensions: FlowPluginExtension
94
- context: Record<
95
- string,
96
- {
97
- assign: 'global' | 'local' | 'seo'
98
- method: any
99
- }
100
- >
101
- }
102
- export interface Helpers {
103
- addRedirect: (key: string, urlPath: string) => void
104
- // addUrl: (key: string, url: Url) => undefined
105
- }
106
- export interface AppState {
107
- routes: Routes
108
- // redirects: Redirects;
109
- // urls: Urls;
110
- pages: Pages
111
- truncates: Truncates
112
- extensions: Record<string, Extension.Extension>
113
- // dynamicPages: DynamicPages;
114
- generate: {
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
122
- }
123
- export interface Configs extends FlowOptions {
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')[]
133
- // redirects: {};
134
- }
135
- export interface GenerateOptions {
136
- assets?: GenerateFolder[]
137
- ommitAssets?: string[]
138
- /**
139
- * Solo aplicable para compilaciones
140
- */
141
- virtualGenerate?: boolean
142
- }
143
-
144
- export interface Decorate {
145
- prepagePackage: () => Promise<unknown>
146
- serverInfo: () => void
147
- init: (proxy?: boolean) => Promise<void>
148
- addPage: (
149
- page: RunDefinePage | OptionsHapiPage,
150
- dynamic?: OptionsDynamicPages
151
- ) => Promise<void>
152
- // getPath: (...path: string[]) => string;
153
- runGenerate: (options?: GenerateOptions) => Promise<void>
154
- assignPluginOptions: <R = any>(
155
- realm: ServerRealm,
156
- options: any,
157
- defaults?: any,
158
- context?: any
159
- ) => R
160
- }
161
- export interface HandlerOptions {
162
- name: string
163
- locale?: string
164
- view: {
165
- template: string
166
- bundle?: Bundle
167
- [key: string]: any
168
- }
169
- context?: RunContextHapi
170
- content?: string
171
- }
172
- }
173
-
174
- export interface OptionsHapiLocalPage extends OptionsLocalPage {
175
- url: string
176
- blogInfo?: BlogInfo
177
- options?: RouteOptions
178
- rules?: Record<string, unknown>
179
- dynamic?: OptionDynamicLocalePages
180
-
181
- context?: RunContextHapi
182
- vhost?: string | string[]
183
- }
184
- export interface ContextHandler {
185
- req: Request
186
- h: ResponseToolkit
187
- page: {
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>
198
- /**
199
- * Si la genoracion de paginas es dinamica este es el contenido
200
- */
201
- global: FlowPluginGlobal
202
- extensions: FlowPluginExtension
203
- utils: FlowPluginUtils
204
- }
205
-
206
- export type RunContextHapi = (ctx: ContextHandler) => Promise<any>;
207
-
208
- export interface OptionsHapiPage extends OptionsPage {
209
- options?: RouteOptions
210
- context?: RunContextHapi
211
-
212
- locales: Record<string, OptionsHapiLocalPage>
213
- rules?: Record<string, unknown>
214
- vhost?: string | string[]
215
- extensions?: FlowExtensions
216
- }
217
- export interface OptionDynamicLocalePages {
218
- // Si existe la propiedad contexta asignar a esta propiedad
219
- assign?: string
220
- pages: (ctx: {
221
- server: Server
222
- route: RequestRoute
223
- locale: string
224
- }) => Promise<Omit<Flow.Page, 'locale' | 'localeName'>[]>
225
- }
226
- export interface OptionsDynamicPages {
227
- // prefix?: (route: RequestRoute) => string | Promise<string>;
228
- assign?: string
229
- pages: (ctx: {
230
- server: Server
231
- route: RequestRoute
232
- }) => Promise<Flow.StaticPages>
233
- }
234
- export interface ExtraPageOptions {
235
- dynamic?: OptionsDynamicPages
236
- }
237
- // import {} from '..'
238
- export type RunDefinePage = (configs: Flow.Configs) => ServerRoute[];
239
- export type RunPreDefinePage = (level?: LevelOptions) => RunDefinePage;
package/types/index.d.ts DELETED
@@ -1,38 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
-
3
- export {
4
- Flow,
5
- FlowOptions,
6
- FlowOptionPlugins,
7
- RunDefinePage,
8
- RunPreDefinePage,
9
- OptionsHapiPage,
10
- GenerateFolder,
11
- Extension,
12
- ContextHandler,
13
- OptionsDynamicPages,
14
- OptionDynamicLocalePages,
15
- ExtraPageOptions,
16
- } from './flow';
17
- export {
18
- FlowExtensions,
19
- FlowPluginExtension,
20
- FlowPluginUtils,
21
- FlowPluginGlobal,
22
- FlowPluginLocal,
23
- Contexts,
24
- FlowContextView,
25
- FlowContextSeo,
26
- FlowContextPage,
27
- FlowEngines,
28
- FlowStatePlugins,
29
- FlowServerMethods,
30
- } from './interfaces';
31
- export type GenerateOptions =
32
- | boolean
33
- | string
34
- | { isAsset: boolean; file: string; type?: string; isRemane?: boolean };
35
-
36
- /**
37
- * Extension method
38
- */
@@ -1,61 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-empty-interface */
2
- import type { Request, ResponseToolkit } from '@hapi/hapi';
3
- import type { Flow } from './flow';
4
- export interface FlowExtensions {}
5
- export interface FlowPluginExtension {}
6
- // export interface FlowPluginUtils {}
7
-
8
- export interface FlowPluginUtils {
9
- getLocalUrl: (name: string) => string
10
- getUrl: (locale: string, name: string) => string
11
- }
12
-
13
- export interface FlowPluginLocal {}
14
- export interface FlowPluginGlobal {}
15
-
16
- /**
17
- * Flow context Seo
18
- */
19
-
20
- export interface FlowContextSeo {
21
- title: string
22
- description: string
23
- keywords: string
24
- url: string
25
- pageUrl: string
26
- }
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
36
- }
37
-
38
- export interface FlowContextView {
39
- bundle: string
40
- template: string
41
- }
42
- // export interface FlowContextGlobal {}
43
-
44
- export namespace Contexts {
45
- export interface Seo extends FlowContextSeo {}
46
- export interface Utils extends FlowPluginUtils {}
47
- export interface Page extends FlowContextPage {}
48
- export interface View extends FlowContextView {}
49
- export interface Global extends FlowPluginGlobal {}
50
- export interface Hapi {
51
- req: Request
52
- h: ResponseToolkit
53
- }
54
- }
55
-
56
- export interface FlowEngines {}
57
- export interface FlowStatePlugins {}
58
- export interface FlowServerMethods {
59
- pages: () => Promise<Flow.StaticPages>
60
- getUrl: (locale: string, name: string) => string
61
- }