@monkeyplus/flow 5.0.0-rc.99 → 6.0.0

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.
Files changed (127) hide show
  1. package/README.md +34 -0
  2. package/entry-server.d.ts +1 -0
  3. package/entry-server.mjs +5 -0
  4. package/modules/content/module.d.ts +6 -0
  5. package/modules/content/module.mjs +32 -0
  6. package/modules/content/query.mjs +104 -0
  7. package/modules/sitemap/handler.mjs +17 -0
  8. package/modules/sitemap/module.d.ts +6 -0
  9. package/modules/sitemap/module.mjs +28 -0
  10. package/modules/strapi/README.md +235 -0
  11. package/modules/strapi/module.d.ts +11 -0
  12. package/modules/strapi/module.mjs +69 -0
  13. package/modules/strapi/proxy.mjs +54 -0
  14. package/modules/strapi/runtime/client.d.ts +30 -0
  15. package/modules/strapi/runtime/client.mjs +248 -0
  16. package/package.json +73 -77
  17. package/server/lib/handler.d.ts +1 -0
  18. package/server/lib/handler.mjs +43 -0
  19. package/server/lib/pages.d.ts +20 -0
  20. package/server/lib/pages.mjs +276 -0
  21. package/server/lib/render.d.ts +7 -0
  22. package/server/lib/render.mjs +156 -0
  23. package/server/plugins/00.lifecycle.d.ts +2 -0
  24. package/server/plugins/00.lifecycle.mjs +9 -0
  25. package/server/renderer.d.ts +3 -0
  26. package/server/renderer.mjs +14 -0
  27. package/server/routes/api/health.get.d.ts +2 -0
  28. package/server/routes/api/health.get.mjs +5 -0
  29. package/server.d.ts +1 -0
  30. package/server.mjs +32 -0
  31. package/src/main.d.ts +1 -0
  32. package/src/main.mjs +29 -0
  33. package/src/public/boot.d.ts +1 -0
  34. package/src/public/components.d.ts +1 -0
  35. package/src/public/components.mjs +1 -0
  36. package/src/public/head.d.ts +1 -0
  37. package/src/public/head.mjs +1 -0
  38. package/src/public/index.d.ts +5 -0
  39. package/src/public/index.mjs +2 -0
  40. package/src/public/modules/content.d.ts +2 -0
  41. package/src/public/modules/content.mjs +1 -0
  42. package/src/public/modules/sitemap.d.ts +2 -0
  43. package/src/public/modules/sitemap.mjs +1 -0
  44. package/src/public/modules/strapi.d.ts +2 -0
  45. package/src/public/modules/strapi.mjs +1 -0
  46. package/src/public/nitro.d.ts +6 -0
  47. package/src/public/nitro.mjs +78 -0
  48. package/src/public/shared.d.ts +2 -0
  49. package/src/public/shared.mjs +18 -0
  50. package/src/public/vite.d.ts +6 -0
  51. package/src/public/vite.mjs +273 -0
  52. package/src/public/vue.d.ts +1 -0
  53. package/src/public/vue.mjs +1 -0
  54. package/src/runtime/boot.d.ts +9 -0
  55. package/src/runtime/components/FlowIsland.d.ts +42 -0
  56. package/src/runtime/components/FlowIsland.mjs +35 -0
  57. package/src/runtime/config.d.ts +73 -0
  58. package/src/runtime/config.mjs +26 -0
  59. package/src/runtime/head.d.ts +3 -0
  60. package/src/runtime/head.mjs +7 -0
  61. package/src/runtime/islands.d.ts +2 -0
  62. package/src/runtime/islands.mjs +52 -0
  63. package/src/runtime/modules.d.ts +12 -0
  64. package/src/runtime/modules.mjs +115 -0
  65. package/src/runtime/page-discovery.d.ts +6 -0
  66. package/src/runtime/page-discovery.mjs +175 -0
  67. package/src/runtime/pages.d.ts +107 -0
  68. package/src/runtime/pages.mjs +3 -0
  69. package/src/runtime/ssg.d.ts +9 -0
  70. package/src/runtime/ssg.mjs +37 -0
  71. package/src/runtime/virtual-pages.d.ts +8 -0
  72. package/src/runtime/virtual-pages.mjs +151 -0
  73. package/src/runtime/virtual.d.ts +103 -0
  74. package/src/runtime/vite-assets.d.ts +9 -0
  75. package/src/runtime/vue.d.ts +6 -0
  76. package/src/runtime/vue.mjs +6 -0
  77. package/src/styles.css +1 -0
  78. package/app.d.ts +0 -1
  79. package/bin/flow.mjs +0 -2
  80. package/dist/app/composables/index.d.ts +0 -5
  81. package/dist/app/composables/index.mjs +0 -12
  82. package/dist/app/entry.async.d.ts +0 -3
  83. package/dist/app/entry.async.mjs +0 -1
  84. package/dist/app/entry.d.ts +0 -3
  85. package/dist/app/entry.mjs +0 -23
  86. package/dist/app/flow.d.ts +0 -80
  87. package/dist/app/flow.mjs +0 -88
  88. package/dist/app/index.d.ts +0 -3
  89. package/dist/app/index.mjs +0 -3
  90. package/dist/chunks/dev-bundler.mjs +0 -247
  91. package/dist/chunks/external.mjs +0 -37
  92. package/dist/chunks/index.mjs +0 -1140
  93. package/dist/chunks/vite-node.mjs +0 -155
  94. package/dist/core/runtime/client.manifest.d.mts +0 -2
  95. package/dist/core/runtime/client.manifest.mjs +0 -6
  96. package/dist/core/runtime/nitro/flow.d.ts +0 -3
  97. package/dist/core/runtime/nitro/flow.mjs +0 -33
  98. package/dist/core/runtime/nitro/paths.d.ts +0 -4
  99. package/dist/core/runtime/nitro/paths.mjs +0 -15
  100. package/dist/core/runtime/nitro/renderer.d.ts +0 -2
  101. package/dist/core/runtime/nitro/renderer.mjs +0 -101
  102. package/dist/core/runtime/vite-node-shared.d.mts +0 -1
  103. package/dist/core/runtime/vite-node-shared.d.ts +0 -8
  104. package/dist/core/runtime/vite-node-shared.mjs +0 -3
  105. package/dist/core/runtime/vite-node.d.mts +0 -2
  106. package/dist/core/runtime/vite-node.mjs +0 -42
  107. package/dist/head/runtime/composables.d.ts +0 -9
  108. package/dist/head/runtime/composables.mjs +0 -2
  109. package/dist/head/runtime/index.d.ts +0 -1
  110. package/dist/head/runtime/index.mjs +0 -1
  111. package/dist/head/runtime/plugin.mjs +0 -5
  112. package/dist/index.d.ts +0 -11
  113. package/dist/index.mjs +0 -27
  114. package/dist/pages/runtime/helpers/index.d.ts +0 -5
  115. package/dist/pages/runtime/helpers/index.mjs +0 -31
  116. package/dist/pages/runtime/index.d.ts +0 -10
  117. package/dist/pages/runtime/index.mjs +0 -13
  118. package/dist/pages/runtime/pages.mjs +0 -100
  119. package/dist/vite-client/runtime/injectManifest.d.ts +0 -26
  120. package/dist/vite-client/runtime/injectManifest.mjs +0 -110
  121. package/dist/vite-client/runtime/plugin.mjs +0 -28
  122. package/types.d.ts +0 -2
  123. /package/{dist/head/runtime/plugin.d.ts → modules/content/query.d.ts} +0 -0
  124. /package/{dist/pages/runtime/pages.d.ts → modules/sitemap/handler.d.ts} +0 -0
  125. /package/{dist/vite-client/runtime/plugin.d.ts → modules/strapi/proxy.d.ts} +0 -0
  126. /package/{dist/pages/runtime/helpers/chunks.d.ts → src/public/boot.mjs} +0 -0
  127. /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
@@ -1,2 +0,0 @@
1
- /// <reference types="nitropack" />
2
- export * from './dist/index';