@monkeyplus/flow 5.0.0-rc.105 → 5.0.0-rc.107
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/app/entry.mjs +1 -1
- package/dist/app/flow.d.ts +1 -0
- package/dist/chunks/dev-bundler.mjs +33 -3
- package/dist/core/runtime/nitro/flow.d.ts +1 -0
- package/dist/core/runtime/nitro/flow.mjs +6 -6
- package/dist/core/runtime/nitro/renderer.mjs +2 -2
- package/dist/index.mjs +1106 -26
- package/package.json +35 -35
- package/dist/chunks/external.mjs +0 -37
- package/dist/chunks/index.mjs +0 -1031
- package/dist/chunks/vite-node.mjs +0 -154
package/dist/app/entry.mjs
CHANGED
package/dist/app/flow.d.ts
CHANGED
|
@@ -44,6 +44,7 @@ export interface FlowApp {
|
|
|
44
44
|
render: (view: Record<string, string>, data: any) => Promise<string> | void | string;
|
|
45
45
|
provide: (name: string, value: any) => void;
|
|
46
46
|
setUtil: (name: string, value: any) => void;
|
|
47
|
+
$config: RuntimeConfig;
|
|
47
48
|
[key: string]: any;
|
|
48
49
|
}
|
|
49
50
|
export declare const FlowPluginIndicator = "__flow_plugin";
|
|
@@ -6,12 +6,42 @@ import { genObjectFromRawEntries, genDynamicImport } from 'knitwork';
|
|
|
6
6
|
import fse from 'fs-extra';
|
|
7
7
|
import { debounce } from 'perfect-debounce';
|
|
8
8
|
import { isIgnoredFlow, logger } from '@monkeyplus/flow-kit';
|
|
9
|
-
import {
|
|
9
|
+
import { hash } from 'ohash';
|
|
10
|
+
import { ExternalsDefaults, isExternal } from 'externality';
|
|
10
11
|
import { withTrailingSlash, withoutLeadingSlash } from 'ufo';
|
|
11
12
|
import escapeRE from 'escape-string-regexp';
|
|
12
13
|
import { normalizeViteManifest } from 'vue-bundle-renderer';
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
|
|
15
|
+
function uniq(arr) {
|
|
16
|
+
return Array.from(new Set(arr));
|
|
17
|
+
}
|
|
18
|
+
const IS_CSS_RE = /\.(?:css|scss|sass|postcss|less|stylus|styl)(\?[^.]+)?$/;
|
|
19
|
+
function isCSS(file) {
|
|
20
|
+
return IS_CSS_RE.test(file);
|
|
21
|
+
}
|
|
22
|
+
function hashId(id) {
|
|
23
|
+
return `$id_${hash(id)}`;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function createIsExternal(viteServer, rootDir) {
|
|
27
|
+
const externalOpts = {
|
|
28
|
+
inline: [
|
|
29
|
+
/virtual:/,
|
|
30
|
+
/\.ts$/,
|
|
31
|
+
...ExternalsDefaults.inline || [],
|
|
32
|
+
...viteServer.config.ssr.noExternal
|
|
33
|
+
],
|
|
34
|
+
external: [
|
|
35
|
+
...viteServer.config.ssr.external || [],
|
|
36
|
+
/node_modules/
|
|
37
|
+
],
|
|
38
|
+
resolve: {
|
|
39
|
+
type: "module",
|
|
40
|
+
extensions: [".ts", ".js", ".json", ".vue", ".mjs", ".jsx", ".tsx", ".wasm"]
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
return (id) => isExternal(id, rootDir, externalOpts);
|
|
44
|
+
}
|
|
15
45
|
|
|
16
46
|
async function writeManifest(ctx, css = []) {
|
|
17
47
|
const clientDist = resolve(ctx.nuxt.options.buildDir, "dist/client");
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import "node-fetch-native/polyfill";
|
|
2
|
-
import {
|
|
2
|
+
import { eventHandler } from "h3";
|
|
3
3
|
import { defineCachedFunction, useRuntimeConfig } from "#internal/nitro";
|
|
4
4
|
const getServerApp = cachedImport(() => import("#server"));
|
|
5
|
-
const getFlowRenderer = cachedResult(async () => {
|
|
5
|
+
export const getFlowRenderer = cachedResult(async () => {
|
|
6
6
|
const createFlowApp = await getServerApp();
|
|
7
7
|
if (!createFlowApp)
|
|
8
8
|
throw new Error("Server bundle is not available");
|
|
9
9
|
return createFlowApp(useRuntimeConfig());
|
|
10
10
|
});
|
|
11
|
-
export default
|
|
11
|
+
export default eventHandler(async (event) => {
|
|
12
12
|
const flow = await getFlowRenderer();
|
|
13
|
-
context.flow = flow;
|
|
14
|
-
context.render = flow.render;
|
|
15
|
-
context.defineCachedFunction = defineCachedFunction;
|
|
13
|
+
event.context.flow = flow;
|
|
14
|
+
event.context.render = flow.render;
|
|
15
|
+
event.context.defineCachedFunction = defineCachedFunction;
|
|
16
16
|
});
|
|
17
17
|
function _interopDefault(e) {
|
|
18
18
|
return e && typeof e === "object" && "default" in e ? e.default : e;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { eventHandler,
|
|
1
|
+
import { eventHandler, getQuery } from "h3";
|
|
2
2
|
import { joinURL } from "ufo";
|
|
3
3
|
const normalizeCall = async (seo, ctx) => {
|
|
4
4
|
if (typeof seo === "function")
|
|
@@ -98,7 +98,7 @@ export default eventHandler(async (event) => {
|
|
|
98
98
|
templateContext.getInjectContext = () => {
|
|
99
99
|
return `<script id="__FLOW_DATA__" type="application/json">${JSON.stringify(contextInject)}<\/script>`;
|
|
100
100
|
};
|
|
101
|
-
const query =
|
|
101
|
+
const query = getQuery(event);
|
|
102
102
|
if (query?.context)
|
|
103
103
|
return { ...templateContext, utils: Object.keys(utils) };
|
|
104
104
|
let html;
|