@base44/vite-plugin 1.0.34 → 1.0.35

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 +1 @@
1
- {"version":3,"file":"error-overlay-plugin.d.ts","sourceRoot":"","sources":["../src/error-overlay-plugin.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAEnC,wBAAgB,kBAAkB,IAc3B,MAAM,CACZ"}
1
+ {"version":3,"file":"error-overlay-plugin.d.ts","sourceRoot":"","sources":["../src/error-overlay-plugin.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AASnC,wBAAgB,kBAAkB,IA2B3B,MAAM,CACZ"}
@@ -1,4 +1,9 @@
1
1
  import { errorOverlayCode } from "./ErrorOverlay.js";
2
+ // Vite <=6 emits `class ErrorOverlay extends HTMLElement`, Vite >=7
3
+ // `var ErrorOverlay = class extends HTMLElement`. This is Vite's bundled output,
4
+ // not an API, so match the shape rather than the version; `\s` so a reformatted
5
+ // or minified emit still matches.
6
+ const VITE_OVERLAY_DECL = /class ErrorOverlay(?=\s+extends)|\b(var|let|const)\s+ErrorOverlay(?=\s*=\s*class)/;
2
7
  export function errorOverlayPlugin() {
3
8
  return {
4
9
  name: "error-overlay",
@@ -8,7 +13,19 @@ export function errorOverlayPlugin() {
8
13
  return;
9
14
  if (!id.includes("vite/dist/client/client.mjs"))
10
15
  return;
11
- return code.replace("class ErrorOverlay", errorOverlayCode + "\nclass OldErrorOverlay");
16
+ const patched = code.replace(VITE_OVERLAY_DECL, (_match, declaration) => errorOverlayCode +
17
+ "\n" +
18
+ (declaration ? `${declaration} OldErrorOverlay` : "class OldErrorOverlay"));
19
+ // replace() returns the input unchanged on a miss, so a new shape would
20
+ // silently restore Vite's red overlay — as it did for every Vite >=7.
21
+ if (patched === code) {
22
+ console.warn("[error-overlay] Could not find Vite's ErrorOverlay declaration in " +
23
+ "client.mjs — Vite's own overlay stays active and app_error will not " +
24
+ "be sent. @base44/vite-plugin needs updating for this Vite version.");
25
+ // Returning the identical string would still cost client.mjs its sourcemap.
26
+ return;
27
+ }
28
+ return patched;
12
29
  },
13
30
  };
14
31
  }
@@ -1 +1 @@
1
- {"version":3,"file":"error-overlay-plugin.js","sourceRoot":"","sources":["../src/error-overlay-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAGrD,MAAM,UAAU,kBAAkB;IAChC,OAAO;QACL,IAAI,EAAE,eAAe;QACrB,KAAK,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,aAAa;QAChD,SAAS,CAAC,IAAI,EAAE,EAAE,EAAE,IAAI,GAAG,EAAE;YAC3B,IAAI,IAAI,EAAE,GAAG;gBAAE,OAAO;YAEtB,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,6BAA6B,CAAC;gBAAE,OAAO;YAExD,OAAO,IAAI,CAAC,OAAO,CACjB,oBAAoB,EACpB,gBAAgB,GAAG,yBAAyB,CAC7C,CAAC;QACJ,CAAC;KACQ,CAAC;AACd,CAAC"}
1
+ {"version":3,"file":"error-overlay-plugin.js","sourceRoot":"","sources":["../src/error-overlay-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAGrD,oEAAoE;AACpE,iFAAiF;AACjF,gFAAgF;AAChF,kCAAkC;AAClC,MAAM,iBAAiB,GACrB,mFAAmF,CAAC;AAEtF,MAAM,UAAU,kBAAkB;IAChC,OAAO;QACL,IAAI,EAAE,eAAe;QACrB,KAAK,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,aAAa;QAChD,SAAS,CAAC,IAAI,EAAE,EAAE,EAAE,IAAI,GAAG,EAAE;YAC3B,IAAI,IAAI,EAAE,GAAG;gBAAE,OAAO;YAEtB,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,6BAA6B,CAAC;gBAAE,OAAO;YAExD,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,iBAAiB,EAAE,CAAC,MAAM,EAAE,WAAW,EAAE,EAAE,CACtE,gBAAgB;gBAChB,IAAI;gBACJ,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,WAAW,kBAAkB,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAC3E,CAAC;YACF,wEAAwE;YACxE,sEAAsE;YACtE,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;gBACrB,OAAO,CAAC,IAAI,CACV,oEAAoE;oBAClE,sEAAsE;oBACtE,oEAAoE,CACvE,CAAC;gBACF,4EAA4E;gBAC5E,OAAO;YACT,CAAC;YACD,OAAO,OAAO,CAAC;QACjB,CAAC;KACQ,CAAC;AACd,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base44/vite-plugin",
3
- "version": "1.0.34",
3
+ "version": "1.0.35",
4
4
  "description": "The Vite plugin for base44 based applications",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -1,6 +1,13 @@
1
1
  import { errorOverlayCode } from "./ErrorOverlay.js";
2
2
  import type { Plugin } from "vite";
3
3
 
4
+ // Vite <=6 emits `class ErrorOverlay extends HTMLElement`, Vite >=7
5
+ // `var ErrorOverlay = class extends HTMLElement`. This is Vite's bundled output,
6
+ // not an API, so match the shape rather than the version; `\s` so a reformatted
7
+ // or minified emit still matches.
8
+ const VITE_OVERLAY_DECL =
9
+ /class ErrorOverlay(?=\s+extends)|\b(var|let|const)\s+ErrorOverlay(?=\s*=\s*class)/;
10
+
4
11
  export function errorOverlayPlugin() {
5
12
  return {
6
13
  name: "error-overlay",
@@ -10,10 +17,23 @@ export function errorOverlayPlugin() {
10
17
 
11
18
  if (!id.includes("vite/dist/client/client.mjs")) return;
12
19
 
13
- return code.replace(
14
- "class ErrorOverlay",
15
- errorOverlayCode + "\nclass OldErrorOverlay"
20
+ const patched = code.replace(VITE_OVERLAY_DECL, (_match, declaration) =>
21
+ errorOverlayCode +
22
+ "\n" +
23
+ (declaration ? `${declaration} OldErrorOverlay` : "class OldErrorOverlay")
16
24
  );
25
+ // replace() returns the input unchanged on a miss, so a new shape would
26
+ // silently restore Vite's red overlay — as it did for every Vite >=7.
27
+ if (patched === code) {
28
+ console.warn(
29
+ "[error-overlay] Could not find Vite's ErrorOverlay declaration in " +
30
+ "client.mjs — Vite's own overlay stays active and app_error will not " +
31
+ "be sent. @base44/vite-plugin needs updating for this Vite version."
32
+ );
33
+ // Returning the identical string would still cost client.mjs its sourcemap.
34
+ return;
35
+ }
36
+ return patched;
17
37
  },
18
38
  } as Plugin;
19
39
  }