@monkeyplus/flow 4.0.0-beta.8 → 5.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/app.d.ts +1 -0
- package/bin/flow.mjs +2 -0
- package/build.config.ts +25 -0
- package/dist/app/composables/index.d.ts +4 -0
- package/dist/app/composables/index.mjs +12 -0
- package/dist/app/entry.d.ts +3 -0
- package/dist/app/entry.mjs +23 -0
- package/dist/app/flow.d.ts +73 -0
- package/dist/app/flow.mjs +85 -0
- package/dist/app/index.d.ts +3 -0
- package/dist/app/index.mjs +3 -0
- package/dist/core/runtime/nitro/flow.d.ts +3 -0
- package/dist/core/runtime/nitro/flow.mjs +32 -0
- package/dist/core/runtime/nitro/paths.d.ts +4 -0
- package/dist/core/runtime/nitro/paths.mjs +15 -0
- package/dist/core/runtime/nitro/renderer.d.ts +2 -0
- package/dist/core/runtime/nitro/renderer.mjs +59 -0
- package/dist/head/runtime/composables.d.ts +9 -0
- package/dist/head/runtime/composables.mjs +2 -0
- package/dist/head/runtime/index.d.ts +1 -0
- package/dist/head/runtime/index.mjs +1 -0
- package/dist/head/runtime/plugin.d.ts +2 -0
- package/dist/head/runtime/plugin.mjs +6 -0
- package/dist/index.d.ts +8 -61
- package/dist/index.mjs +1275 -954
- package/dist/pages/runtime/helpers/chunks.d.ts +0 -0
- package/dist/pages/runtime/helpers/chunks.mjs +0 -0
- package/dist/pages/runtime/helpers/index.d.ts +5 -0
- package/dist/pages/runtime/helpers/index.mjs +28 -0
- package/dist/pages/runtime/plugin.d.ts +2 -0
- package/dist/pages/runtime/plugin.mjs +51 -0
- package/dist/vite-client/runtime/injectManifest.d.ts +26 -0
- package/dist/vite-client/runtime/injectManifest.mjs +104 -0
- package/dist/vite-client/runtime/plugin.d.ts +2 -0
- package/dist/vite-client/runtime/plugin.mjs +27 -0
- package/package.json +55 -36
- package/src/app/composables/index.ts +20 -0
- package/src/app/entry.ts +36 -0
- package/src/app/flow.ts +157 -0
- package/src/app/index.ts +5 -0
- package/src/auto-imports/module.ts +143 -0
- package/src/auto-imports/presets.ts +49 -0
- package/src/auto-imports/transform.ts +48 -0
- package/src/core/app.ts +90 -0
- package/src/core/builder.ts +59 -0
- package/src/core/flow.ts +93 -0
- package/src/core/modules.ts +32 -0
- package/src/core/nitro.ts +206 -0
- package/src/core/plugins/import-protection.ts +49 -0
- package/src/core/plugins/unctx.ts +31 -0
- package/src/core/runtime/nitro/flow.ts +43 -0
- package/src/core/runtime/nitro/paths.ts +20 -0
- package/src/core/runtime/nitro/renderer.ts +72 -0
- package/src/core/templates.ts +119 -0
- package/src/core/vite/builder/css.ts +28 -0
- package/src/core/vite/builder/dev-bundler.ts +247 -0
- package/src/core/vite/builder/index.ts +92 -0
- package/src/core/vite/builder/manifest.ts +33 -0
- package/src/core/vite/builder/plugins/analyze.ts +32 -0
- package/src/core/vite/builder/plugins/cache-dir.ts +13 -0
- package/src/core/vite/builder/plugins/dynamic-base.ts +64 -0
- package/src/core/vite/builder/plugins/virtual.ts +45 -0
- package/src/core/vite/builder/server.ts +163 -0
- package/src/core/vite/builder/types/index.ts +13 -0
- package/src/core/vite/builder/utils/index.ts +53 -0
- package/src/core/vite/builder/utils/warmup.ts +27 -0
- package/src/core/vite/builder/utils/wpfs.ts +7 -0
- package/src/core/vite/builder/vite-node.ts +110 -0
- package/src/core/vite/client/index.ts +48 -0
- package/src/dirs.ts +8 -0
- package/src/head/module.ts +37 -0
- package/src/head/runtime/composables.ts +16 -0
- package/src/head/runtime/index.ts +1 -0
- package/src/head/runtime/plugin.ts +12 -0
- package/src/index.ts +2 -0
- package/src/pages/module.ts +55 -0
- package/src/pages/runtime/helpers/chunks.ts +0 -0
- package/src/pages/runtime/helpers/index.ts +33 -0
- package/src/pages/runtime/plugin.ts +58 -0
- package/src/pages/templates.ts +20 -0
- package/src/pages/utils.ts +49 -0
- package/src/vite-client/module.ts +70 -0
- package/src/vite-client/runtime/injectManifest.ts +188 -0
- package/src/vite-client/runtime/plugin.ts +33 -0
- package/types.d.ts +2 -0
- package/dist/index.cjs +0 -1061
- package/types/core.d.ts +0 -143
- package/types/flow.d.ts +0 -239
- package/types/index.d.ts +0 -38
- package/types/interfaces.d.ts +0 -61
package/app.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './dist/app';
|
package/bin/flow.mjs
ADDED
package/build.config.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { BuildEntry } from 'unbuild';
|
|
2
|
+
import { defineBuildConfig } from 'unbuild';
|
|
3
|
+
|
|
4
|
+
export default defineBuildConfig({
|
|
5
|
+
declaration: true,
|
|
6
|
+
entries: [
|
|
7
|
+
'src/index',
|
|
8
|
+
{ input: 'src/app/', outDir: 'dist/app/' },
|
|
9
|
+
...[
|
|
10
|
+
'core',
|
|
11
|
+
'head',
|
|
12
|
+
'pages',
|
|
13
|
+
'vite-client',
|
|
14
|
+
].map((name) => ({ input: `src/${name}/runtime/`, outDir: `dist/${name}/runtime`, format: 'esm' } as BuildEntry)),
|
|
15
|
+
// { input: 'src/runtime/', outDir: 'dist/runtime', format: 'esm' },
|
|
16
|
+
],
|
|
17
|
+
dependencies: [
|
|
18
|
+
'@monkeyplus/flow-cli',
|
|
19
|
+
'ohmyfetch',
|
|
20
|
+
|
|
21
|
+
],
|
|
22
|
+
externals: [
|
|
23
|
+
|
|
24
|
+
],
|
|
25
|
+
});
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function useCookie(name: string, _opts?: any): {};
|
|
2
|
+
export declare function refreshNuxtData(keys?: string | string[]): Promise<void>;
|
|
3
|
+
export declare function useAsyncData(key: string, handlers: () => Promise<any>): Promise<any>;
|
|
4
|
+
export declare function useRoute(): {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { config, configure, render } from "eta";
|
|
2
|
+
import { applyPlugins, createFlowApp } from "./flow.mjs";
|
|
3
|
+
import plugins from "#build/plugins";
|
|
4
|
+
export default async (runtimeConfig) => {
|
|
5
|
+
const flow = createFlowApp({ runtimeConfig });
|
|
6
|
+
try {
|
|
7
|
+
await applyPlugins(flow, plugins);
|
|
8
|
+
configure(flow.eta);
|
|
9
|
+
flow.render = (view, data) => {
|
|
10
|
+
const layout = "<%layout(`layouts/${it.view?.layout||'default'}`)%>";
|
|
11
|
+
const getTemplate = flow.engines[view.engine || flow.engine];
|
|
12
|
+
const base = `${layout}
|
|
13
|
+
${getTemplate(view.template)}`;
|
|
14
|
+
return render(base, data || {}, {
|
|
15
|
+
...config,
|
|
16
|
+
async: true
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
} catch (err) {
|
|
20
|
+
console.log(err);
|
|
21
|
+
}
|
|
22
|
+
return flow;
|
|
23
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { RadixRouter } from 'radix3';
|
|
2
|
+
import type { Hookable } from 'hookable';
|
|
3
|
+
import type { FlowPage, RuntimeConfig } from '@monkeyplus/flow-schema';
|
|
4
|
+
declare type HookResult = Promise<void> | void;
|
|
5
|
+
export interface FlowAppHooks {
|
|
6
|
+
'flow:pages': (page: FlowPage[]) => HookResult;
|
|
7
|
+
'eta:plugin': (options: any) => HookResult;
|
|
8
|
+
'page:scripts': (scripts: {
|
|
9
|
+
head: string[];
|
|
10
|
+
bodyEnd: string[];
|
|
11
|
+
bodyStart: string[];
|
|
12
|
+
}) => HookResult;
|
|
13
|
+
'page:links': (links: string[]) => HookResult;
|
|
14
|
+
'page:chunks': (bundle: string, scripts: {
|
|
15
|
+
head: string[];
|
|
16
|
+
body: string[];
|
|
17
|
+
}) => HookResult;
|
|
18
|
+
'page:generate': (generate: any) => HookResult;
|
|
19
|
+
}
|
|
20
|
+
export interface FlowApp {
|
|
21
|
+
router: {
|
|
22
|
+
byUrl: RadixRouter<FlowPage['context']>;
|
|
23
|
+
byName: RadixRouter<FlowPage['context']>;
|
|
24
|
+
};
|
|
25
|
+
hooks: Hookable<FlowAppHooks>;
|
|
26
|
+
hook: FlowApp['hooks']['hook'];
|
|
27
|
+
callHook: FlowApp['hooks']['callHook'];
|
|
28
|
+
eta: any;
|
|
29
|
+
app: {
|
|
30
|
+
utils: Record<string, any>;
|
|
31
|
+
plugins: Record<string, any>;
|
|
32
|
+
globals: Record<string, any>;
|
|
33
|
+
};
|
|
34
|
+
engine: string;
|
|
35
|
+
engines: Record<string, (template: string) => string>;
|
|
36
|
+
generate: boolean;
|
|
37
|
+
render: (view: Record<string, string>, data: any) => Promise<string> | void | string;
|
|
38
|
+
provide: (name: string, value: any) => void;
|
|
39
|
+
setUtil: (name: string, value: any) => void;
|
|
40
|
+
[key: string]: any;
|
|
41
|
+
}
|
|
42
|
+
export declare const FlowPluginIndicator = "__flow_plugin";
|
|
43
|
+
export declare const NuxtPluginIndicator = "__nuxt_plugin";
|
|
44
|
+
export interface Plugin<Injections extends Record<string, any> = Record<string, any>> {
|
|
45
|
+
(flow: FlowApp): Promise<void> | Promise<{
|
|
46
|
+
provide?: Injections;
|
|
47
|
+
}> | void | {
|
|
48
|
+
provide?: Injections;
|
|
49
|
+
};
|
|
50
|
+
[FlowPluginIndicator]?: true;
|
|
51
|
+
}
|
|
52
|
+
interface OptionsApp {
|
|
53
|
+
runtimeConfig: RuntimeConfig;
|
|
54
|
+
}
|
|
55
|
+
export declare function createFlowApp({ runtimeConfig }: OptionsApp): FlowApp;
|
|
56
|
+
export declare function defineFlowPlugin<T>(plugin: Plugin<T>): Plugin<T>;
|
|
57
|
+
export declare function defineNuxtPlugin<T>(plugin: Plugin<T>): Plugin<T>;
|
|
58
|
+
export declare function applyPlugin(flowApp: FlowApp, plugin: Plugin): Promise<void>;
|
|
59
|
+
export declare function applyPlugins(flowApp: FlowApp, plugins: Plugin[]): Promise<void>;
|
|
60
|
+
/**
|
|
61
|
+
* Ensures that the setup function passed in has access to the Nuxt instance via `useNuxt`.
|
|
62
|
+
*
|
|
63
|
+
* @param flow A Flow instance
|
|
64
|
+
* @param setup The function to call
|
|
65
|
+
*/
|
|
66
|
+
export declare function callWithFlow<T extends (...args: any[]) => any>(flow: FlowApp, setup: T, args?: Parameters<T>): Promise<ReturnType<T>>;
|
|
67
|
+
/**
|
|
68
|
+
* Returns the current Nuxt instance.
|
|
69
|
+
*/
|
|
70
|
+
export declare function useFlowApp(): FlowApp;
|
|
71
|
+
export declare function useRuntimeConfig(): RuntimeConfig;
|
|
72
|
+
export declare function resolveFiles(path: string, pattern: string | string[]): Promise<any[]>;
|
|
73
|
+
export {};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { createRouter } from "radix3";
|
|
2
|
+
import { createHooks } from "hookable";
|
|
3
|
+
import { getContext } from "unctx";
|
|
4
|
+
import { globby } from "globby";
|
|
5
|
+
import { join, resolve } from "pathe";
|
|
6
|
+
const flowAppCtx = getContext("flow-app");
|
|
7
|
+
export const FlowPluginIndicator = "__flow_plugin";
|
|
8
|
+
export const NuxtPluginIndicator = "__nuxt_plugin";
|
|
9
|
+
export function createFlowApp({ runtimeConfig }) {
|
|
10
|
+
const viewsDir = join(runtimeConfig.app.rootDir, "views");
|
|
11
|
+
const flowApp = {
|
|
12
|
+
router: { byUrl: createRouter(), byName: createRouter() },
|
|
13
|
+
app: {
|
|
14
|
+
utils: {},
|
|
15
|
+
globals: {}
|
|
16
|
+
},
|
|
17
|
+
eta: {
|
|
18
|
+
views: viewsDir,
|
|
19
|
+
plugins: []
|
|
20
|
+
},
|
|
21
|
+
engine: "eta",
|
|
22
|
+
engines: {},
|
|
23
|
+
generate: runtimeConfig.generate
|
|
24
|
+
};
|
|
25
|
+
flowApp.engines.eta = (template) => {
|
|
26
|
+
return `<%~ await includeFile('templates/${template}',it) %>`;
|
|
27
|
+
};
|
|
28
|
+
flowApp.hooks = createHooks();
|
|
29
|
+
flowApp.hook = flowApp.hooks.hook;
|
|
30
|
+
flowApp.callHook = flowApp.hooks.callHook;
|
|
31
|
+
flowApp.provide = (name, value) => {
|
|
32
|
+
const $name = `$${name}`;
|
|
33
|
+
defineGetter(flowApp, $name, value);
|
|
34
|
+
};
|
|
35
|
+
flowApp.setUtil = (name, method) => {
|
|
36
|
+
flowApp.app.utils[name] = method;
|
|
37
|
+
};
|
|
38
|
+
flowApp.hook("eta:plugin", (_plugin) => {
|
|
39
|
+
flowApp.eta.plugins.push(_plugin);
|
|
40
|
+
});
|
|
41
|
+
flowApp.provide("config", runtimeConfig);
|
|
42
|
+
return flowApp;
|
|
43
|
+
}
|
|
44
|
+
export function defineFlowPlugin(plugin) {
|
|
45
|
+
plugin[FlowPluginIndicator] = true;
|
|
46
|
+
return plugin;
|
|
47
|
+
}
|
|
48
|
+
export function defineNuxtPlugin(plugin) {
|
|
49
|
+
plugin[NuxtPluginIndicator] = true;
|
|
50
|
+
return plugin;
|
|
51
|
+
}
|
|
52
|
+
export async function applyPlugin(flowApp, plugin) {
|
|
53
|
+
if (typeof plugin !== "function")
|
|
54
|
+
return;
|
|
55
|
+
const { provide } = await callWithFlow(flowApp, plugin, [flowApp]) || {};
|
|
56
|
+
if (provide && typeof provide === "object") {
|
|
57
|
+
for (const key in provide)
|
|
58
|
+
flowApp.provide(key, provide[key]);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
export async function applyPlugins(flowApp, plugins) {
|
|
62
|
+
for (const plugin of plugins)
|
|
63
|
+
await applyPlugin(flowApp, plugin);
|
|
64
|
+
}
|
|
65
|
+
export function callWithFlow(flow, setup, args) {
|
|
66
|
+
const fn = () => args ? setup(...args) : setup();
|
|
67
|
+
flowAppCtx.set(flow);
|
|
68
|
+
return flowAppCtx.callAsync(flow, fn);
|
|
69
|
+
}
|
|
70
|
+
export function useFlowApp() {
|
|
71
|
+
const flowAppInstance = flowAppCtx.use();
|
|
72
|
+
if (!flowAppInstance)
|
|
73
|
+
throw new Error("flow instance unavailable");
|
|
74
|
+
return flowAppInstance;
|
|
75
|
+
}
|
|
76
|
+
export function useRuntimeConfig() {
|
|
77
|
+
return useFlowApp().$config;
|
|
78
|
+
}
|
|
79
|
+
function defineGetter(obj, key, val) {
|
|
80
|
+
Object.defineProperty(obj, key, { get: () => val });
|
|
81
|
+
}
|
|
82
|
+
export async function resolveFiles(path, pattern) {
|
|
83
|
+
const files = await globby(pattern, { cwd: path, followSymbolicLinks: true });
|
|
84
|
+
return files.filter((file) => !file.includes("copy.ts")).map((p) => resolve(path, p));
|
|
85
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { defineEventHandler } from "h3";
|
|
2
|
+
import "node-fetch-native/polyfill";
|
|
3
|
+
import { useRuntimeConfig } from "#internal/nitro";
|
|
4
|
+
const getServerApp = cachedImport(() => import("#server"));
|
|
5
|
+
const getFlowRenderer = cachedResult(async () => {
|
|
6
|
+
const createFlowApp = await getServerApp();
|
|
7
|
+
if (!createFlowApp)
|
|
8
|
+
throw new Error("Server bundle is not available");
|
|
9
|
+
return createFlowApp(useRuntimeConfig());
|
|
10
|
+
});
|
|
11
|
+
export default defineEventHandler(async ({ context }) => {
|
|
12
|
+
const flow = await getFlowRenderer();
|
|
13
|
+
context.flow = flow;
|
|
14
|
+
context.render = flow.render;
|
|
15
|
+
});
|
|
16
|
+
function _interopDefault(e) {
|
|
17
|
+
return e && typeof e === "object" && "default" in e ? e.default : e;
|
|
18
|
+
}
|
|
19
|
+
function cachedImport(importer) {
|
|
20
|
+
return cachedResult(() => importer().then(_interopDefault).then(_interopDefault));
|
|
21
|
+
}
|
|
22
|
+
function cachedResult(fn) {
|
|
23
|
+
let res = null;
|
|
24
|
+
return () => {
|
|
25
|
+
if (res === null)
|
|
26
|
+
res = fn().catch((err) => {
|
|
27
|
+
res = null;
|
|
28
|
+
throw err;
|
|
29
|
+
});
|
|
30
|
+
return res;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { joinURL } from "ufo";
|
|
2
|
+
import { useRuntimeConfig } from "#internal/nitro";
|
|
3
|
+
export function baseURL() {
|
|
4
|
+
return useRuntimeConfig().app.baseURL;
|
|
5
|
+
}
|
|
6
|
+
export function buildAssetsDir() {
|
|
7
|
+
return useRuntimeConfig().app.buildAssetsDir;
|
|
8
|
+
}
|
|
9
|
+
export function buildAssetsURL(...path) {
|
|
10
|
+
return joinURL(publicAssetsURL(), useRuntimeConfig().app.buildAssetsDir, ...path);
|
|
11
|
+
}
|
|
12
|
+
export function publicAssetsURL(...path) {
|
|
13
|
+
const publicBase = useRuntimeConfig().app.cdnURL || useRuntimeConfig().app.baseURL;
|
|
14
|
+
return path.length ? joinURL(publicBase, ...path) : publicBase;
|
|
15
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { eventHandler, useQuery } from "h3";
|
|
2
|
+
export default eventHandler(async (event) => {
|
|
3
|
+
const url = event.req.url?.split("?")[0];
|
|
4
|
+
const flow = event.context.flow;
|
|
5
|
+
if (url.includes("_urls")) {
|
|
6
|
+
const urls = await flow.app.utils.getUrls();
|
|
7
|
+
return urls;
|
|
8
|
+
}
|
|
9
|
+
const scripts = { head: [], bodyStart: [], bodyEnd: [] };
|
|
10
|
+
const chunks = { head: [], body: [] };
|
|
11
|
+
const generate = {};
|
|
12
|
+
const { page, locale, params, view } = flow.router.byUrl.lookup(url) || {};
|
|
13
|
+
await flow.callHook("page:scripts", scripts);
|
|
14
|
+
if (view.bundle)
|
|
15
|
+
await flow.callHook("page:chunks", view.bundle, chunks);
|
|
16
|
+
const templateContext = {};
|
|
17
|
+
if (!page)
|
|
18
|
+
return;
|
|
19
|
+
const dynamyc = params?._;
|
|
20
|
+
const contextPage = {};
|
|
21
|
+
const utils = Object.assign({ getLocale: () => locale }, flow.app.utils);
|
|
22
|
+
templateContext.url = url;
|
|
23
|
+
templateContext.locale = locale;
|
|
24
|
+
templateContext.view = view;
|
|
25
|
+
if (dynamyc && page.dynamic) {
|
|
26
|
+
const pages = await page.dynamic.method({ locale, utils });
|
|
27
|
+
const dynamicPage = pages.find((_page) => _page.url === dynamyc);
|
|
28
|
+
if (!dynamicPage)
|
|
29
|
+
return;
|
|
30
|
+
if (page.dynamic.assign)
|
|
31
|
+
templateContext[page.dynamic.assign] = dynamicPage.context;
|
|
32
|
+
contextPage.dynamyc = dynamicPage;
|
|
33
|
+
}
|
|
34
|
+
templateContext.seo = {};
|
|
35
|
+
templateContext.context = {};
|
|
36
|
+
templateContext.sharedContext = {};
|
|
37
|
+
templateContext.utils = utils;
|
|
38
|
+
templateContext.seo = await page.seo?.({ ...contextPage, utils }) || {};
|
|
39
|
+
templateContext.context = await page.context?.({ ...contextPage, utils }) || {};
|
|
40
|
+
templateContext.getHeadScripts = () => {
|
|
41
|
+
return scripts.head.join("\n");
|
|
42
|
+
};
|
|
43
|
+
templateContext.getHeadChunks = () => {
|
|
44
|
+
return chunks.head.join("\n");
|
|
45
|
+
};
|
|
46
|
+
templateContext.getBodyChunks = () => {
|
|
47
|
+
return chunks.body.join("\n");
|
|
48
|
+
};
|
|
49
|
+
const query = useQuery(event);
|
|
50
|
+
if (query?.context)
|
|
51
|
+
return { ...templateContext, utils: Object.keys(utils) };
|
|
52
|
+
const html = await flow.render(view, templateContext);
|
|
53
|
+
event.res.setHeader("Content-Type", "text/html;charset=UTF-8");
|
|
54
|
+
if (flow.generate) {
|
|
55
|
+
await flow.callHook("page:generate", generate);
|
|
56
|
+
globalThis.generate = generate;
|
|
57
|
+
}
|
|
58
|
+
return html;
|
|
59
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { MetaObject } from '@monkeyplus/flow-schema';
|
|
2
|
+
/**
|
|
3
|
+
* You can pass in a meta object, which has keys corresponding to meta tags:
|
|
4
|
+
* `title`, `base`, `script`, `style`, `meta` and `link`, as well as `htmlAttrs` and `bodyAttrs`.
|
|
5
|
+
*
|
|
6
|
+
* Alternatively, for reactive meta state, you can pass in a function
|
|
7
|
+
* that returns a meta object.
|
|
8
|
+
*/
|
|
9
|
+
export declare function useHead(meta: MetaObject): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './composables';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./composables.mjs";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,64 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
export { ContextHandler, Contexts, Extension, Flow, FlowContextPage, FlowContextSeo, FlowContextView, FlowEngines, FlowExtensions, FlowOptionPlugins, FlowOptions, FlowPluginExtension, FlowPluginGlobal, FlowPluginLocal, FlowPluginUtils, FlowServerMethods, FlowStatePlugins, GenerateFolder, OptionDynamicLocalePages, OptionsDynamicPages, OptionsHapiPage, RunDefinePage, RunPreDefinePage } from '../types';
|
|
1
|
+
import { FlowOptions, Flow, FlowConfig } from '@monkeyplus/flow-schema';
|
|
2
|
+
export { FlowConfig } from '@monkeyplus/flow-schema';
|
|
3
|
+
import { LoadFlowOptions } from '@monkeyplus/flow-kit';
|
|
5
4
|
|
|
6
|
-
declare
|
|
7
|
-
declare
|
|
5
|
+
declare function createFlow(options: FlowOptions): Flow;
|
|
6
|
+
declare function loadFlow(opts: LoadFlowOptions): Promise<Flow>;
|
|
7
|
+
declare function defineFlowConfig(config: FlowConfig): FlowConfig;
|
|
8
8
|
|
|
9
|
-
declare
|
|
10
|
-
interface Context {
|
|
11
|
-
server: Server;
|
|
12
|
-
}
|
|
13
|
-
declare type Pages = (ctx: Context) => Promise<HapiPages>;
|
|
9
|
+
declare function build(flow: Flow): Promise<void>;
|
|
14
10
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
declare module '@hapi/hapi' {
|
|
18
|
-
interface ServerApplicationState {
|
|
19
|
-
flow: Flow.AppState;
|
|
20
|
-
}
|
|
21
|
-
interface RouteOptionsApp {
|
|
22
|
-
flow: PageInfo;
|
|
23
|
-
}
|
|
24
|
-
interface HandlerDecorations {
|
|
25
|
-
flow?: Flow.HandlerOptions;
|
|
26
|
-
}
|
|
27
|
-
interface PluginsStates {
|
|
28
|
-
flow: Flow.PluginState;
|
|
29
|
-
}
|
|
30
|
-
interface ResponseToolkit {
|
|
31
|
-
getUrl: (locale: string, name: string) => string;
|
|
32
|
-
}
|
|
33
|
-
interface PluginSpecificConfiguration {
|
|
34
|
-
flow?: {
|
|
35
|
-
proxy?: boolean;
|
|
36
|
-
extensions?: FlowExtensions;
|
|
37
|
-
dynamic?: OptionDynamicLocalePages;
|
|
38
|
-
};
|
|
39
|
-
generate?: GenerateOptions;
|
|
40
|
-
}
|
|
41
|
-
interface Server {
|
|
42
|
-
flow: Flow.Decorate;
|
|
43
|
-
}
|
|
44
|
-
interface ServerMethods {
|
|
45
|
-
flow: FlowServerMethods;
|
|
46
|
-
}
|
|
47
|
-
interface RequestApplicationState {
|
|
48
|
-
dynamic: any;
|
|
49
|
-
}
|
|
50
|
-
interface PluginProperties {
|
|
51
|
-
flow: {
|
|
52
|
-
configs: Flow.Configs;
|
|
53
|
-
helpers: {
|
|
54
|
-
getPath: (...paths: string[]) => string;
|
|
55
|
-
addRedirect: (key: string, urlPath: string) => void;
|
|
56
|
-
addStaticPage: (key: string, url: Flow.Page) => void;
|
|
57
|
-
addDynamicPages: (key: string, method: Flow.DynamicPages['']) => void;
|
|
58
|
-
};
|
|
59
|
-
pages: () => Flow.StaticPages;
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export { Pages, definePage, plugin };
|
|
11
|
+
export { build, createFlow, defineFlowConfig, loadFlow };
|