@monkeyplus/flow 5.0.0-rc.26 → 5.0.0-rc.28
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.28";
|
|
33
33
|
|
|
34
34
|
let _distDir = dirname(fileURLToPath(import.meta.url));
|
|
35
35
|
if (_distDir.endsWith("chunks"))
|
|
@@ -426,7 +426,10 @@ const viteModule = defineFlowModule({
|
|
|
426
426
|
async getContents() {
|
|
427
427
|
return [
|
|
428
428
|
"import fs from 'fs';",
|
|
429
|
-
`export default ()=>
|
|
429
|
+
`export default ()=>{
|
|
430
|
+
const manifest =JSON.parse(fs.readFileSync("${file}", 'utf8');
|
|
431
|
+
return {manifest,base:'${_options.dir}'}
|
|
432
|
+
})`
|
|
430
433
|
].join("\n");
|
|
431
434
|
}
|
|
432
435
|
});
|
|
@@ -46,17 +46,19 @@ export default defineFlowPlugin(async (flow) => {
|
|
|
46
46
|
async function getUrls(withLocale = false) {
|
|
47
47
|
const urls = [];
|
|
48
48
|
for (const page of allPages) {
|
|
49
|
-
if (
|
|
50
|
-
urls.push(withLocale ? { url: page.path, locale: page.locale.code, name: page.name } : page.path);
|
|
51
|
-
} else {
|
|
49
|
+
if (page.path.includes("/**") && page.page.dynamic) {
|
|
52
50
|
const dPages = await page.page.dynamic.method({
|
|
53
51
|
locale: page.locale,
|
|
54
|
-
utils: Object.assign({ getLocale: () => page.locale }, flow.app.utils)
|
|
52
|
+
utils: Object.assign({ getLocale: () => page.locale }, flow.app.utils),
|
|
53
|
+
chunks: {}
|
|
55
54
|
});
|
|
56
55
|
dPages.forEach((dPage) => {
|
|
57
56
|
const _path = joinURL(page.path.replace("/**", ""), dPage.url);
|
|
58
57
|
urls.push(withLocale ? { url: _path, locale: page.locale.code, name: joinURL(page.name, dPage.name) } : _path);
|
|
59
58
|
});
|
|
59
|
+
} else {
|
|
60
|
+
const url = page.path.replaceAll("*", "");
|
|
61
|
+
urls.push(withLocale ? { url, locale: page.locale.code, name: page.name } : url);
|
|
60
62
|
}
|
|
61
63
|
}
|
|
62
64
|
return urls.sort();
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import logger from "consola";
|
|
2
|
+
import { joinURL } from "ufo";
|
|
2
3
|
import { generateBundle } from "./injectManifest.mjs";
|
|
3
4
|
import { defineFlowPlugin } from "#app";
|
|
4
5
|
import manifest from "#viteManifest";
|
|
@@ -6,7 +7,8 @@ export default defineFlowPlugin((flow) => {
|
|
|
6
7
|
if (typeof manifest === "function") {
|
|
7
8
|
flow.hook("page:chunks", (bundle, chunks) => {
|
|
8
9
|
try {
|
|
9
|
-
const
|
|
10
|
+
const data = manifest();
|
|
11
|
+
const chunk = generateBundle(flow.$config.app || {}, data.manifest, joinURL("/", data.base, `${bundle}.ts`).replace("/", ""));
|
|
10
12
|
if (chunk) {
|
|
11
13
|
chunks.head.push(chunk.head);
|
|
12
14
|
chunks.body.push(chunk.body);
|
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.28",
|
|
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.28",
|
|
29
|
+
"@monkeyplus/flow-kit": "5.0.0-rc.28",
|
|
30
|
+
"@monkeyplus/flow-schema": "5.0.0-rc.28",
|
|
31
31
|
"@rollup/plugin-replace": "^4.0.0",
|
|
32
32
|
"@vueuse/head": "^0.7.6",
|
|
33
33
|
"c12": "^0.2.7",
|