@gradio/client 1.15.4 → 1.15.6

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.
@@ -159,7 +159,7 @@ export function submit(
159
159
  }
160
160
 
161
161
  const resolve_heartbeat = async (config: Config): Promise<void> => {
162
- await this._resolve_hearbeat(config);
162
+ await this._resolve_heartbeat(config);
163
163
  };
164
164
 
165
165
  async function handle_render_config(render_config: any): Promise<void> {
@@ -597,6 +597,7 @@ export function submit(
597
597
  fire_event({
598
598
  type: "status",
599
599
  stage: "error",
600
+ broken: true,
600
601
  message: BROKEN_CONNECTION_MSG,
601
602
  queue: true,
602
603
  endpoint: _endpoint,
@@ -629,8 +630,12 @@ export function submit(
629
630
  });
630
631
  } else if (type === "complete") {
631
632
  complete = status;
632
- } else if (type == "unexpected_error") {
633
+ } else if (
634
+ type == "unexpected_error" ||
635
+ type == "broken_connection"
636
+ ) {
633
637
  console.error("Unexpected error", status?.message);
638
+ const broken = type === "broken_connection";
634
639
  fire_event({
635
640
  type: "status",
636
641
  stage: "error",
@@ -638,6 +643,8 @@ export function submit(
638
643
  status?.message || "An Unexpected Error Occurred!",
639
644
  queue: true,
640
645
  endpoint: _endpoint,
646
+ broken,
647
+ session_not_found: status?.session_not_found,
641
648
  fn_index,
642
649
  time: new Date()
643
650
  });
package/src/vite-env.d.ts CHANGED
@@ -1 +1,3 @@
1
1
  /// <reference types="vite/client" />
2
+
3
+ declare const BROWSER_BUILD: boolean;
package/vite.config.js CHANGED
@@ -4,17 +4,23 @@ import { svelte } from "@sveltejs/vite-plugin-svelte";
4
4
  const TEST_MODE = process.env.TEST_MODE || "happy-dom";
5
5
 
6
6
  export default defineConfig(({ mode }) => {
7
+ const production = mode === "production";
8
+ const isBrowserBuild = process.env.BROWSER_BUILD === "true";
9
+
7
10
  if (mode === "preview") {
8
11
  return {
9
12
  entry: "index.html"
10
13
  };
11
14
  }
15
+
12
16
  return {
13
17
  build: {
18
+ emptyOutDir: false,
14
19
  lib: {
15
20
  entry: "src/index.ts",
16
21
  formats: ["es"],
17
- fileName: (format) => `index.${format}.js`
22
+ fileName: (format) =>
23
+ isBrowserBuild ? `browser.${format}.js` : `index.${format}.js`
18
24
  },
19
25
  rollupOptions: {
20
26
  input: "src/index.ts",
@@ -24,7 +30,9 @@ export default defineConfig(({ mode }) => {
24
30
  }
25
31
  },
26
32
  plugins: [svelte()],
27
-
33
+ define: {
34
+ BROWSER_BUILD: JSON.stringify(isBrowserBuild)
35
+ },
28
36
  mode: process.env.MODE || "development",
29
37
  test: {
30
38
  include: ["./src/test/*.test.*"],