@olenbetong/appframe-vite 1.0.2 → 1.0.3

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.
@@ -1,6 +1,6 @@
1
1
  import { Application, RequestHandler, Router } from "express";
2
2
  import { ViteDevServer } from "vite";
3
3
  export declare function createProxyMiddleware(): Promise<Router>;
4
- export declare function createHtmlTransformer(): Promise<(html: string) => string>;
4
+ export declare function createHtmlTransformer(): (html: string) => Promise<string>;
5
5
  export declare function createDevMiddleware(vite: ViteDevServer): Promise<RequestHandler>;
6
6
  export declare function startDevServer(app: Application): Promise<void>;
package/lib/devServer.js CHANGED
@@ -55,7 +55,7 @@ export async function createProxyMiddleware() {
55
55
  });
56
56
  return router;
57
57
  }
58
- export async function createHtmlTransformer() {
58
+ export function createHtmlTransformer() {
59
59
  var _a, _b, _c, _d, _e, _f;
60
60
  const hostname = (_d = (_b = (_a = appframe.proxy) === null || _a === void 0 ? void 0 : _a.hostname) !== null && _b !== void 0 ? _b : (_c = appframe.deploy) === null || _c === void 0 ? void 0 : _c.hostname) !== null && _d !== void 0 ? _d : "dev.obet.no";
61
61
  const { APPFRAME_LOGIN: username, APPFRAME_PWD: password } = process.env;
@@ -63,8 +63,8 @@ export async function createHtmlTransformer() {
63
63
  if (!username || !password) {
64
64
  throw new Error("Your Appframe credentials are not set in the environment variables. Username should be set in APPFRAME_LOGIN and password in APPFRAME_PWD.");
65
65
  }
66
- let userSession = await getUserSession(hostname, username, password);
67
- return (html) => {
66
+ return async (html) => {
67
+ let userSession = await getUserSession(hostname, username, password);
68
68
  return html
69
69
  .replace("<!-- {Appframe} -->", `<script>
70
70
  af = globalThis.af ?? {};
package/lib/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Plugin } from "vite";
2
2
  import { addAppframeBuildConfig } from "./build.js";
3
3
  import { createDevMiddleware, createProxyMiddleware, startDevServer } from "./devServer.js";
4
- export default function appframe(): Promise<Plugin>;
4
+ export default function appframe(): Plugin;
5
5
  export { addAppframeBuildConfig };
6
6
  export { createDevMiddleware, createProxyMiddleware, startDevServer };
package/lib/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { addAppframeBuildConfig } from "./build.js";
2
2
  import { createDevMiddleware, createHtmlTransformer, createProxyMiddleware, startDevServer } from "./devServer.js";
3
- export default async function appframe() {
4
- let transformIndexHtml = await createHtmlTransformer();
3
+ export default function appframe() {
4
+ let transformIndexHtml = createHtmlTransformer();
5
5
  return {
6
6
  name: "appframe",
7
7
  async config(_, { command }) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@olenbetong/appframe-vite",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Tools to use and deploy Vite applications to Appframe",
5
5
  "main": "./lib/index.js",
6
6
  "type": "module",