@monkeyplus/flow 5.0.0-rc.76 → 5.0.0-rc.78
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.mjs
CHANGED
|
@@ -29,7 +29,7 @@ import { isExternal as isExternal$1, ExternalsDefaults } from 'externality';
|
|
|
29
29
|
import { createHash } from 'node:crypto';
|
|
30
30
|
import MagicString from 'magic-string';
|
|
31
31
|
|
|
32
|
-
const version = "5.0.0-rc.
|
|
32
|
+
const version = "5.0.0-rc.78";
|
|
33
33
|
|
|
34
34
|
let _distDir = dirname(fileURLToPath(import.meta.url));
|
|
35
35
|
if (_distDir.endsWith("chunks"))
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { DynamicPage, PageCtx, SimplePage } from '@monkeyplus/flow-schema';
|
|
2
2
|
export declare function definePage<T>(...pages: SimplePage<T>[]): SimplePage<T>[];
|
|
3
3
|
export declare function defineDynamicPage<T>(...pages: DynamicPage<T>[]): DynamicPage<T>[];
|
|
4
|
-
interface SharedContext {
|
|
4
|
+
export interface SharedContext {
|
|
5
5
|
assign?: 'global' | 'local';
|
|
6
6
|
merge?: boolean;
|
|
7
7
|
setup: (cxt: PageCtx) => any;
|
|
8
|
+
locales?: Record<string, (ctx: PageCtx) => any>;
|
|
8
9
|
}
|
|
9
10
|
export declare function defineSharedContext(shared: SharedContext): SharedContext;
|
|
10
|
-
export {};
|
|
@@ -70,7 +70,11 @@ export default defineFlowPlugin(async (flow) => {
|
|
|
70
70
|
return {};
|
|
71
71
|
const _contexts = await Promise.all(entries.map(async ([key, method]) => {
|
|
72
72
|
const data = await method.setup(ctx);
|
|
73
|
-
const
|
|
73
|
+
const setupLocal = method?.locales?.[ctx.locale.code];
|
|
74
|
+
let dataLocal = {};
|
|
75
|
+
if (setupLocal)
|
|
76
|
+
dataLocal = await setupLocal(ctx);
|
|
77
|
+
const obj = method.merge ? { ...data, ...dataLocal } : { [key]: { ...data, ...dataLocal } };
|
|
74
78
|
return obj;
|
|
75
79
|
}));
|
|
76
80
|
return _contexts.reduce((acc, curr) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@monkeyplus/flow",
|
|
3
|
-
"version": "5.0.0-rc.
|
|
3
|
+
"version": "5.0.0-rc.78",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.mjs",
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
"dist"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@monkeyplus/flow-cli": "5.0.0-rc.
|
|
29
|
-
"@monkeyplus/flow-kit": "5.0.0-rc.
|
|
30
|
-
"@monkeyplus/flow-schema": "5.0.0-rc.
|
|
28
|
+
"@monkeyplus/flow-cli": "5.0.0-rc.78",
|
|
29
|
+
"@monkeyplus/flow-kit": "5.0.0-rc.78",
|
|
30
|
+
"@monkeyplus/flow-schema": "5.0.0-rc.78",
|
|
31
31
|
"@rollup/plugin-replace": "^4.0.0",
|
|
32
32
|
"@vueuse/head": "^0.7.6",
|
|
33
33
|
"c12": "^0.2.8",
|