@base44/vite-plugin 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.
@@ -5,19 +5,36 @@ window.addEventListener("unhandledrejection", handleUnhandledRejection);
5
5
  window.addEventListener("error", handleWindowError);
6
6
  let shouldPropagateErrors = true;
7
7
  let suppressionTimer = null;
8
+ let hadSuppressedErrors = false;
8
9
  if (import.meta.hot) {
9
10
  import.meta.hot.on("vite:beforeUpdate", () => {
10
11
  shouldPropagateErrors = false;
12
+ hadSuppressedErrors = false;
11
13
  if (suppressionTimer) {
12
14
  clearTimeout(suppressionTimer);
13
15
  }
14
16
  suppressionTimer = setTimeout(() => {
15
17
  shouldPropagateErrors = true;
16
18
  suppressionTimer = null;
19
+ hadSuppressedErrors = false;
20
+ // No vite:afterUpdate after timeout — treat the stuck update as an error
21
+ window.parent?.postMessage({ type: "sandbox:hmrErrorsSuppressed" }, "*");
17
22
  }, import.meta.env.VITE_HMR_ERROR_SUPPRESSION_DELAY ?? 10000);
18
23
  });
24
+ import.meta.hot.on("vite:afterUpdate", () => {
25
+ shouldPropagateErrors = true;
26
+ if (suppressionTimer) {
27
+ clearTimeout(suppressionTimer);
28
+ suppressionTimer = null;
29
+ }
30
+ if (hadSuppressedErrors) {
31
+ window.parent?.postMessage({ type: "sandbox:hmrErrorsSuppressed" }, "*");
32
+ hadSuppressedErrors = false;
33
+ }
34
+ });
19
35
  import.meta.hot.on("vite:beforeFullReload", () => {
20
36
  shouldPropagateErrors = false;
37
+ hadSuppressedErrors = false;
21
38
  if (suppressionTimer) {
22
39
  clearTimeout(suppressionTimer);
23
40
  suppressionTimer = null;
@@ -25,7 +42,11 @@ if (import.meta.hot) {
25
42
  });
26
43
  }
27
44
  function onAppError({ title, details, componentName, originalError, }) {
28
- if (originalError?.response?.status === 402 || !shouldPropagateErrors) {
45
+ if (originalError?.response?.status === 402) {
46
+ return;
47
+ }
48
+ if (!shouldPropagateErrors) {
49
+ hadSuppressedErrors = true;
29
50
  return;
30
51
  }
31
52
  window.parent?.postMessage({
@@ -1 +1 @@
1
- {"version":3,"file":"unhandled-errors-handlers.js","sourceRoot":"","sources":["../../src/injections/unhandled-errors-handlers.ts"],"names":[],"mappings":"AAAA,qCAAqC;AAErC,MAAM,CAAC,mBAAmB,CAAC,oBAAoB,EAAE,wBAAwB,CAAC,CAAC;AAC3E,MAAM,CAAC,mBAAmB,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC;AAEvD,MAAM,CAAC,gBAAgB,CAAC,oBAAoB,EAAE,wBAAwB,CAAC,CAAC;AACxE,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC;AAEpD,IAAI,qBAAqB,GAAG,IAAI,CAAC;AACjC,IAAI,gBAAgB,GAAyC,IAAI,CAAC;AAElE,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;IACpB,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,mBAAmB,EAAE,GAAG,EAAE;QAC3C,qBAAqB,GAAG,KAAK,CAAC;QAE9B,IAAI,gBAAgB,EAAE,CAAC;YACrB,YAAY,CAAC,gBAAgB,CAAC,CAAC;QACjC,CAAC;QAED,gBAAgB,GAAG,UAAU,CAAC,GAAG,EAAE;YACjC,qBAAqB,GAAG,IAAI,CAAC;YAC7B,gBAAgB,GAAG,IAAI,CAAC;QAC1B,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,gCAAgC,IAAI,KAAK,CAAC,CAAC;IAChE,CAAC,CAAC,CAAC;IACH,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,uBAAuB,EAAE,GAAG,EAAE;QAC/C,qBAAqB,GAAG,KAAK,CAAC;QAC9B,IAAI,gBAAgB,EAAE,CAAC;YACrB,YAAY,CAAC,gBAAgB,CAAC,CAAC;YAC/B,gBAAgB,GAAG,IAAI,CAAC;QAC1B,CAAC;I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,KAAK,MAAM,EAAE,CAAC;QAC5B,YAAY,GAAG,IAAI,CAAC;IACtB,CAAC;IAED,MAAM,GAAG,GAAG,YAAY;QACtB,CAAC,CAAC,MAAM,YAAY,KAAK,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,EAAE;QACjD,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;IAC3B,UAAU,CAAC;QACT,KAAK,EAAE,GAAG;QACV,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE;QAC/B,aAAa,EAAE,YAAY;QAC3B,aAAa,EAAE,KAAK,CAAC,KAAK;KAC3B,CAAC,CAAC;AACL,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base44/vite-plugin",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "The Vite plugin for base44 based applications",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -8,10 +8,12 @@ window.addEventListener("error", handleWindowError);
8
8
 
9
9
  let shouldPropagateErrors = true;
10
10
  let suppressionTimer: ReturnType<typeof setTimeout> | null = null;
11
+ let hadSuppressedErrors = false;
11
12
 
12
13
  if (import.meta.hot) {
13
14
  import.meta.hot.on("vite:beforeUpdate", () => {
14
15
  shouldPropagateErrors = false;
16
+ hadSuppressedErrors = false;
15
17
 
16
18
  if (suppressionTimer) {
17
19
  clearTimeout(suppressionTimer);
@@ -20,10 +22,25 @@ if (import.meta.hot) {
20
22
  suppressionTimer = setTimeout(() => {
21
23
  shouldPropagateErrors = true;
22
24
  suppressionTimer = null;
25
+ hadSuppressedErrors = false;
26
+ // No vite:afterUpdate after timeout — treat the stuck update as an error
27
+ window.parent?.postMessage({ type: "sandbox:hmrErrorsSuppressed" }, "*");
23
28
  }, import.meta.env.VITE_HMR_ERROR_SUPPRESSION_DELAY ?? 10000);
24
29
  });
30
+ import.meta.hot.on("vite:afterUpdate", () => {
31
+ shouldPropagateErrors = true;
32
+ if (suppressionTimer) {
33
+ clearTimeout(suppressionTimer);
34
+ suppressionTimer = null;
35
+ }
36
+ if (hadSuppressedErrors) {
37
+ window.parent?.postMessage({ type: "sandbox:hmrErrorsSuppressed" }, "*");
38
+ hadSuppressedErrors = false;
39
+ }
40
+ });
25
41
  import.meta.hot.on("vite:beforeFullReload", () => {
26
42
  shouldPropagateErrors = false;
43
+ hadSuppressedErrors = false;
27
44
  if (suppressionTimer) {
28
45
  clearTimeout(suppressionTimer);
29
46
  suppressionTimer = null;
@@ -42,7 +59,11 @@ function onAppError({
42
59
  componentName: string;
43
60
  originalError: any;
44
61
  }) {
45
- if (originalError?.response?.status === 402 || !shouldPropagateErrors) {
62
+ if (originalError?.response?.status === 402) {
63
+ return;
64
+ }
65
+ if (!shouldPropagateErrors) {
66
+ hadSuppressedErrors = true;
46
67
  return;
47
68
  }
48
69
  window.parent?.postMessage(