@monkeyplus/flow 5.0.0-rc.217 → 5.0.0-rc.219

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
@@ -24,7 +24,7 @@ import replace from '@rollup/plugin-replace';
24
24
  import { resolveTSConfig } from 'pkg-types';
25
25
  import fse from 'fs-extra';
26
26
 
27
- const version = "5.0.0-rc.217";
27
+ const version = "5.0.0-rc.219";
28
28
 
29
29
  let _distDir = dirname(fileURLToPath(import.meta.url));
30
30
  if (_distDir.match(/(chunks|shared)$/))
@@ -35,6 +35,8 @@ export default defineFlowPlugin(async (flow) => {
35
35
  });
36
36
  });
37
37
  });
38
+ const cache = {};
39
+ const cacheData = {};
38
40
  function replacePath(_path, url) {
39
41
  if (typeof url === "string") {
40
42
  _path = joinURL(_path.replace("/**", ""), url);
@@ -57,9 +59,19 @@ export default defineFlowPlugin(async (flow) => {
57
59
  const base404 = h?.path || "/";
58
60
  if (params?._ && page.dynamic) {
59
61
  if (!cache[path + code]) {
60
- cache[path + code] = this.defineCachedFunction(async (_ctx) => {
61
- return await page.dynamic.method(_ctx);
62
- }, { maxAge: flow.generate ? 60 * 60 : 15, getKey: () => path, swr: false });
62
+ if (flow.generate) {
63
+ cache[path + code] = async (_ctx, _path) => {
64
+ if (cacheData[_path])
65
+ return cacheData[_path];
66
+ const r = await page.dynamic.method(_ctx);
67
+ cacheData[_path] = r;
68
+ return r;
69
+ };
70
+ } else {
71
+ cache[path + code] = this.defineCachedFunction(async (_ctx) => {
72
+ return await page.dynamic.method(_ctx);
73
+ }, { maxAge: 20, getKey: () => path, swr: false });
74
+ }
63
75
  }
64
76
  const fn = cache[path + code];
65
77
  const list = await fn({ utils: this, locale: { ...this.getLocale(), code } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@monkeyplus/flow",
3
- "version": "5.0.0-rc.217",
3
+ "version": "5.0.0-rc.219",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "./dist/index.mjs",
@@ -68,9 +68,9 @@
68
68
  "vite-plugin-checker": "^0.5.1",
69
69
  "vue-bundle-renderer": "^1.0.0",
70
70
  "vue": "^3.2.41",
71
- "@monkeyplus/flow-kit": "5.0.0-rc.217",
72
- "@monkeyplus/flow-cli": "5.0.0-rc.217",
73
- "@monkeyplus/flow-schema": "5.0.0-rc.217"
71
+ "@monkeyplus/flow-cli": "5.0.0-rc.219",
72
+ "@monkeyplus/flow-schema": "5.0.0-rc.219",
73
+ "@monkeyplus/flow-kit": "5.0.0-rc.219"
74
74
  },
75
75
  "devDependencies": {
76
76
  "@types/fs-extra": "^9.0.13",