@monkeyplus/flow 5.0.0-rc.99 → 6.0.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/README.md +34 -0
- package/entry-server.d.ts +1 -0
- package/entry-server.mjs +5 -0
- package/modules/content/module.d.ts +6 -0
- package/modules/content/module.mjs +32 -0
- package/modules/content/query.mjs +104 -0
- package/modules/sitemap/handler.mjs +17 -0
- package/modules/sitemap/module.d.ts +6 -0
- package/modules/sitemap/module.mjs +28 -0
- package/modules/strapi/README.md +235 -0
- package/modules/strapi/module.d.ts +11 -0
- package/modules/strapi/module.mjs +69 -0
- package/modules/strapi/proxy.mjs +54 -0
- package/modules/strapi/runtime/client.d.ts +30 -0
- package/modules/strapi/runtime/client.mjs +248 -0
- package/package.json +73 -77
- package/server/lib/handler.d.ts +1 -0
- package/server/lib/handler.mjs +43 -0
- package/server/lib/pages.d.ts +20 -0
- package/server/lib/pages.mjs +276 -0
- package/server/lib/render.d.ts +7 -0
- package/server/lib/render.mjs +156 -0
- package/server/plugins/00.lifecycle.d.ts +2 -0
- package/server/plugins/00.lifecycle.mjs +9 -0
- package/server/renderer.d.ts +3 -0
- package/server/renderer.mjs +14 -0
- package/server/routes/api/health.get.d.ts +2 -0
- package/server/routes/api/health.get.mjs +5 -0
- package/server.d.ts +1 -0
- package/server.mjs +32 -0
- package/src/main.d.ts +1 -0
- package/src/main.mjs +29 -0
- package/src/public/boot.d.ts +1 -0
- package/src/public/components.d.ts +1 -0
- package/src/public/components.mjs +1 -0
- package/src/public/head.d.ts +1 -0
- package/src/public/head.mjs +1 -0
- package/src/public/index.d.ts +5 -0
- package/src/public/index.mjs +2 -0
- package/src/public/modules/content.d.ts +2 -0
- package/src/public/modules/content.mjs +1 -0
- package/src/public/modules/sitemap.d.ts +2 -0
- package/src/public/modules/sitemap.mjs +1 -0
- package/src/public/modules/strapi.d.ts +2 -0
- package/src/public/modules/strapi.mjs +1 -0
- package/src/public/nitro.d.ts +6 -0
- package/src/public/nitro.mjs +78 -0
- package/src/public/shared.d.ts +2 -0
- package/src/public/shared.mjs +18 -0
- package/src/public/vite.d.ts +6 -0
- package/src/public/vite.mjs +273 -0
- package/src/public/vue.d.ts +1 -0
- package/src/public/vue.mjs +1 -0
- package/src/runtime/boot.d.ts +9 -0
- package/src/runtime/components/FlowIsland.d.ts +42 -0
- package/src/runtime/components/FlowIsland.mjs +35 -0
- package/src/runtime/config.d.ts +73 -0
- package/src/runtime/config.mjs +26 -0
- package/src/runtime/head.d.ts +3 -0
- package/src/runtime/head.mjs +7 -0
- package/src/runtime/islands.d.ts +2 -0
- package/src/runtime/islands.mjs +52 -0
- package/src/runtime/modules.d.ts +12 -0
- package/src/runtime/modules.mjs +115 -0
- package/src/runtime/page-discovery.d.ts +6 -0
- package/src/runtime/page-discovery.mjs +175 -0
- package/src/runtime/pages.d.ts +107 -0
- package/src/runtime/pages.mjs +3 -0
- package/src/runtime/ssg.d.ts +9 -0
- package/src/runtime/ssg.mjs +37 -0
- package/src/runtime/virtual-pages.d.ts +8 -0
- package/src/runtime/virtual-pages.mjs +151 -0
- package/src/runtime/virtual.d.ts +103 -0
- package/src/runtime/vite-assets.d.ts +9 -0
- package/src/runtime/vue.d.ts +6 -0
- package/src/runtime/vue.mjs +6 -0
- package/src/styles.css +1 -0
- package/app.d.ts +0 -1
- package/bin/flow.mjs +0 -2
- package/dist/app/composables/index.d.ts +0 -5
- package/dist/app/composables/index.mjs +0 -12
- package/dist/app/entry.async.d.ts +0 -3
- package/dist/app/entry.async.mjs +0 -1
- package/dist/app/entry.d.ts +0 -3
- package/dist/app/entry.mjs +0 -23
- package/dist/app/flow.d.ts +0 -80
- package/dist/app/flow.mjs +0 -88
- package/dist/app/index.d.ts +0 -3
- package/dist/app/index.mjs +0 -3
- package/dist/chunks/dev-bundler.mjs +0 -247
- package/dist/chunks/external.mjs +0 -37
- package/dist/chunks/index.mjs +0 -1140
- package/dist/chunks/vite-node.mjs +0 -155
- package/dist/core/runtime/client.manifest.d.mts +0 -2
- package/dist/core/runtime/client.manifest.mjs +0 -6
- package/dist/core/runtime/nitro/flow.d.ts +0 -3
- package/dist/core/runtime/nitro/flow.mjs +0 -33
- package/dist/core/runtime/nitro/paths.d.ts +0 -4
- package/dist/core/runtime/nitro/paths.mjs +0 -15
- package/dist/core/runtime/nitro/renderer.d.ts +0 -2
- package/dist/core/runtime/nitro/renderer.mjs +0 -101
- package/dist/core/runtime/vite-node-shared.d.mts +0 -1
- package/dist/core/runtime/vite-node-shared.d.ts +0 -8
- package/dist/core/runtime/vite-node-shared.mjs +0 -3
- package/dist/core/runtime/vite-node.d.mts +0 -2
- package/dist/core/runtime/vite-node.mjs +0 -42
- package/dist/head/runtime/composables.d.ts +0 -9
- package/dist/head/runtime/composables.mjs +0 -2
- package/dist/head/runtime/index.d.ts +0 -1
- package/dist/head/runtime/index.mjs +0 -1
- package/dist/head/runtime/plugin.mjs +0 -5
- package/dist/index.d.ts +0 -11
- package/dist/index.mjs +0 -27
- package/dist/pages/runtime/helpers/index.d.ts +0 -5
- package/dist/pages/runtime/helpers/index.mjs +0 -31
- package/dist/pages/runtime/index.d.ts +0 -10
- package/dist/pages/runtime/index.mjs +0 -13
- package/dist/pages/runtime/pages.mjs +0 -100
- package/dist/vite-client/runtime/injectManifest.d.ts +0 -26
- package/dist/vite-client/runtime/injectManifest.mjs +0 -110
- package/dist/vite-client/runtime/plugin.mjs +0 -28
- package/types.d.ts +0 -2
- /package/{dist/head/runtime/plugin.d.ts → modules/content/query.d.ts} +0 -0
- /package/{dist/pages/runtime/pages.d.ts → modules/sitemap/handler.d.ts} +0 -0
- /package/{dist/vite-client/runtime/plugin.d.ts → modules/strapi/proxy.d.ts} +0 -0
- /package/{dist/pages/runtime/helpers/chunks.d.ts → src/public/boot.mjs} +0 -0
- /package/{dist/pages/runtime/helpers/chunks.mjs → src/runtime/boot.mjs} +0 -0
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import { joinURL } from "ufo";
|
|
2
|
-
export const generateBundle = (config, bundle, _id) => {
|
|
3
|
-
const analyzedChunk = /* @__PURE__ */ new Map();
|
|
4
|
-
const getImportedChunks = (chunk2, seen = /* @__PURE__ */ new Set()) => {
|
|
5
|
-
const chunks = [];
|
|
6
|
-
chunk2.imports?.forEach((file) => {
|
|
7
|
-
const importee = bundle[file];
|
|
8
|
-
const isChunk = file.startsWith("_") || importee.isEntry;
|
|
9
|
-
if (isChunk && !seen.has(file)) {
|
|
10
|
-
seen.add(file);
|
|
11
|
-
chunks.push(...getImportedChunks(importee, seen));
|
|
12
|
-
chunks.push(importee);
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
return chunks;
|
|
16
|
-
};
|
|
17
|
-
const toScriptTag = (chunk2, publicBase2, isAsync2) => ({
|
|
18
|
-
tag: "script",
|
|
19
|
-
attrs: {
|
|
20
|
-
...isAsync2 ? { async: true } : {},
|
|
21
|
-
type: "module",
|
|
22
|
-
crossorigin: true,
|
|
23
|
-
src: toPublicPath(chunk2.file, publicBase2)
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
const toPreloadTag = (chunk2, publicBase2) => ({
|
|
27
|
-
tag: "link",
|
|
28
|
-
attrs: {
|
|
29
|
-
rel: "modulepreload",
|
|
30
|
-
crossorigin: true,
|
|
31
|
-
href: toPublicPath(chunk2.file, publicBase2)
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
const getCssTagsForChunk = (chunk2, publicBase2, seen = /* @__PURE__ */ new Set()) => {
|
|
35
|
-
const tags = [];
|
|
36
|
-
if (!analyzedChunk.has(chunk2)) {
|
|
37
|
-
analyzedChunk.set(chunk2, 1);
|
|
38
|
-
chunk2.imports?.forEach((file) => {
|
|
39
|
-
const importee = bundle[file];
|
|
40
|
-
if (file.startsWith("_") || importee.isEntry)
|
|
41
|
-
tags.push(...getCssTagsForChunk(importee, publicBase2, seen));
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
chunk2.css?.forEach((file) => {
|
|
45
|
-
if (!seen.has(file)) {
|
|
46
|
-
seen.add(file);
|
|
47
|
-
tags.push({
|
|
48
|
-
tag: "link",
|
|
49
|
-
attrs: {
|
|
50
|
-
rel: "stylesheet",
|
|
51
|
-
href: toPublicPath(file, publicBase2)
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
return tags;
|
|
57
|
-
};
|
|
58
|
-
const publicBase = config.baseURL || "/";
|
|
59
|
-
const isAsync = false;
|
|
60
|
-
const chunk = Object.values(bundle).find(
|
|
61
|
-
(chunk2) => chunk2.isEntry && chunk2.src === _id
|
|
62
|
-
);
|
|
63
|
-
if (chunk) {
|
|
64
|
-
const imports = getImportedChunks(chunk);
|
|
65
|
-
const assetTags = [
|
|
66
|
-
toScriptTag(chunk, publicBase, isAsync),
|
|
67
|
-
...imports.map((i) => toPreloadTag(i, publicBase))
|
|
68
|
-
];
|
|
69
|
-
assetTags.push(...getCssTagsForChunk(chunk, publicBase));
|
|
70
|
-
const tags = serializeTags(assetTags);
|
|
71
|
-
return { head: tags, body: "" };
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
export const externalRE = /^(https?:)?\/\//;
|
|
75
|
-
export const isExternalUrl = (url) => externalRE.test(url);
|
|
76
|
-
function toPublicPath(filename, publicBase) {
|
|
77
|
-
return isExternalUrl(filename) ? filename : joinURL(publicBase, filename);
|
|
78
|
-
}
|
|
79
|
-
const unaryTags = /* @__PURE__ */ new Set(["link", "meta", "base"]);
|
|
80
|
-
function serializeTag({ tag, attrs, children }, indent = "") {
|
|
81
|
-
if (unaryTags.has(tag)) {
|
|
82
|
-
return `<${tag}${serializeAttrs(attrs)}>`;
|
|
83
|
-
} else {
|
|
84
|
-
return `<${tag}${serializeAttrs(attrs)}>${serializeTags(
|
|
85
|
-
children,
|
|
86
|
-
incrementIndent(indent)
|
|
87
|
-
)}</${tag}>`;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
function serializeTags(tags, indent = "") {
|
|
91
|
-
if (typeof tags === "string")
|
|
92
|
-
return tags;
|
|
93
|
-
else if (tags && tags.length)
|
|
94
|
-
return tags.map((tag) => `${indent}${serializeTag(tag, indent)}
|
|
95
|
-
`).join("");
|
|
96
|
-
return "";
|
|
97
|
-
}
|
|
98
|
-
function serializeAttrs(attrs) {
|
|
99
|
-
let res = "";
|
|
100
|
-
for (const key in attrs) {
|
|
101
|
-
if (typeof attrs[key] === "boolean")
|
|
102
|
-
res += attrs[key] ? ` ${key}` : "";
|
|
103
|
-
else
|
|
104
|
-
res += ` ${key}=${JSON.stringify(attrs[key])}`;
|
|
105
|
-
}
|
|
106
|
-
return res;
|
|
107
|
-
}
|
|
108
|
-
function incrementIndent(indent = "") {
|
|
109
|
-
return `${indent}${indent[0] === " " ? " " : " "}`;
|
|
110
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import logger from "consola";
|
|
2
|
-
import { joinURL } from "ufo";
|
|
3
|
-
import { generateBundle } from "./injectManifest.mjs";
|
|
4
|
-
import { defineFlowPlugin } from "#app";
|
|
5
|
-
import manifest from "#viteManifest";
|
|
6
|
-
export default defineFlowPlugin((flow) => {
|
|
7
|
-
if (typeof manifest === "function") {
|
|
8
|
-
flow.hook("page:chunks", (bundle, chunks) => {
|
|
9
|
-
try {
|
|
10
|
-
const data = manifest();
|
|
11
|
-
const chunk = generateBundle(flow.$config.app || {}, data.manifest, joinURL("/", data.base, `${bundle}.ts`).replace("/", ""));
|
|
12
|
-
if (chunk) {
|
|
13
|
-
chunks.head.push(chunk.head);
|
|
14
|
-
chunks.body.push(chunk.body);
|
|
15
|
-
} else {
|
|
16
|
-
logger.warn('Entry "%s" not found ', bundle);
|
|
17
|
-
}
|
|
18
|
-
} catch (error) {
|
|
19
|
-
logger.error("Error in inject %s ", bundle);
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
} else {
|
|
23
|
-
flow.hook("page:chunks", (bundle, chunks) => {
|
|
24
|
-
chunks.head.push(manifest.head());
|
|
25
|
-
chunks.body.push(manifest.body(bundle));
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
});
|
package/types.d.ts
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|