@monkeyplus/flow 5.0.0-rc.41 → 5.0.0-rc.42

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.
@@ -36,6 +36,9 @@ export interface FlowApp {
36
36
  globals: Record<string, any>;
37
37
  };
38
38
  engine: string;
39
+ site: {
40
+ origin: string;
41
+ };
39
42
  engines: Record<string, (template: string) => string>;
40
43
  generate: boolean;
41
44
  render: (view: Record<string, string>, data: any) => Promise<string> | void | string;
package/dist/app/flow.mjs CHANGED
@@ -20,6 +20,9 @@ export function createFlowApp({ runtimeConfig }) {
20
20
  },
21
21
  engine: "eta",
22
22
  engines: {},
23
+ site: {
24
+ origin: `${process.env.URL || "http://localhost"}`
25
+ },
23
26
  generate: runtimeConfig.generate
24
27
  };
25
28
  flowApp.engines.eta = (template) => {
@@ -1,4 +1,5 @@
1
1
  import { eventHandler, useQuery } from "h3";
2
+ import { joinURL } from "ufo";
2
3
  export default eventHandler(async (event) => {
3
4
  const url = event.req.url?.split("?")[0];
4
5
  const flow = event.context.flow;
@@ -26,6 +27,13 @@ export default eventHandler(async (event) => {
26
27
  const contextHooks = {};
27
28
  await flow.callHook("page:context", { localeCode: locale.code, page: pageName }, utils, contextHooks);
28
29
  templateContext.url = url;
30
+ templateContext.page = {
31
+ name: pageName,
32
+ pathname: url,
33
+ url: joinURL(flow.site.origin, `${url}`),
34
+ origin: flow.site.origin,
35
+ joinOrigin: (_url) => joinURL(flow.site.origin, _url)
36
+ };
29
37
  templateContext.locale = locale;
30
38
  templateContext.view = view;
31
39
  if (dynamic && page.dynamic) {
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.41";
32
+ const version = "5.0.0-rc.42";
33
33
 
34
34
  let _distDir = dirname(fileURLToPath(import.meta.url));
35
35
  if (_distDir.endsWith("chunks"))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@monkeyplus/flow",
3
- "version": "5.0.0-rc.41",
3
+ "version": "5.0.0-rc.42",
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.41",
29
- "@monkeyplus/flow-kit": "5.0.0-rc.41",
30
- "@monkeyplus/flow-schema": "5.0.0-rc.41",
28
+ "@monkeyplus/flow-cli": "5.0.0-rc.42",
29
+ "@monkeyplus/flow-kit": "5.0.0-rc.42",
30
+ "@monkeyplus/flow-schema": "5.0.0-rc.42",
31
31
  "@rollup/plugin-replace": "^4.0.0",
32
32
  "@vueuse/head": "^0.7.6",
33
33
  "c12": "^0.2.7",