@base44-preview/vite-plugin 1.0.44-pr.131.04821df → 1.0.44-pr.132.10ceed3

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":"base44-runtime-plugin.d.ts","sourceRoot":"","sources":["../src/base44-runtime-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAsFnC,wBAAgB,mBAAmB,IAAI,MAAM,CA0B5C"}
1
+ {"version":3,"file":"base44-runtime-plugin.d.ts","sourceRoot":"","sources":["../src/base44-runtime-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAmFnC,wBAAgB,mBAAmB,IAAI,MAAM,CAyC5C"}
@@ -23,9 +23,6 @@
23
23
  * public import. Without that wrapper (including local dev), TCP fails closed.
24
24
  */
25
25
  const SPECIFIER = "base44:runtime";
26
- // Rollup convention: a resolved virtual id starts with NUL so no other plugin
27
- // (and no filesystem lookup) tries to claim it.
28
- const RESOLVED = "\0base44:runtime";
29
26
  // Reserved so a route importing it fails with an explanation instead of a bare
30
27
  // "failed to resolve import". Actors are never imported — they live in the app's
31
28
  // actors directory, in server routes exactly as in backend functions.
@@ -78,27 +75,45 @@ export const staticEgress = Object.freeze({
78
75
  });
79
76
  `;
80
77
  export function base44RuntimePlugin() {
78
+ const importers = new Map();
81
79
  return {
82
80
  name: "base44-runtime",
83
81
  // Ahead of Vite's own resolution so the bare `base44:` specifier is never
84
82
  // mistaken for a URL protocol.
85
83
  enforce: "pre",
86
- resolveId(id) {
87
- const reason = unsupportedReason(id);
88
- if (reason) {
89
- this.error(`"${id}" is not available in server routes. ${reason}`);
90
- }
91
- if (id !== SPECIFIER)
84
+ // Errors are raised in `load`, never `resolveId`: Vite's dep scanner resolves
85
+ // the raw source of server routes and server-fn handlers in the client
86
+ // environment, before TanStack strips them, and a throw there fails the scan
87
+ // so Vite skips pre-bundling. This relies on the scanner externalizing
88
+ // resolved virtual ids rather than loading them (true of the esbuild scan in
89
+ // Vite 7 and the Rolldown scan in Vite 8); re-check it on a bundler change.
90
+ resolveId(id, importer) {
91
+ if (id !== SPECIFIER && !unsupportedReason(id))
92
+ return null;
93
+ if (importer)
94
+ importers.set(`${this.environment?.name}:${id}`, importer);
95
+ // Rollup convention: a NUL-prefixed id is virtual, so no other plugin
96
+ // (and no filesystem lookup) tries to claim it.
97
+ return `\0${id}`;
98
+ },
99
+ load(id) {
100
+ if (!id.startsWith("\0"))
92
101
  return null;
102
+ const specifier = id.slice(1);
103
+ if (specifier !== SPECIFIER && !unsupportedReason(specifier))
104
+ return null;
105
+ // The failing module is virtual, so name the file that imported it.
106
+ const importer = importers.get(`${this.environment?.name}:${specifier}`);
107
+ const from = importer ? ` Imported from ${importer}.` : "";
108
+ const reason = unsupportedReason(specifier);
109
+ if (reason)
110
+ this.error(`"${specifier}" is not available in server routes. ${reason}${from}`);
93
111
  // `cloudflare:workers` has no browser equivalent, so a client-side import
94
112
  // would bundle a module that cannot run. Fail with the reason instead.
95
113
  if (this.environment?.name === "client") {
96
- this.error(`"${SPECIFIER}" is server-only. Move this import into a server route.`);
114
+ this.error(`"${SPECIFIER}" is server-only. Move this import into a server route.${from}`);
97
115
  }
98
- return RESOLVED;
99
- },
100
- load(id) {
101
- return id === RESOLVED ? RUNTIME_MODULE : null;
116
+ return RUNTIME_MODULE;
102
117
  },
103
118
  };
104
119
  }
@@ -1 +1 @@
1
- {"version":3,"file":"base44-runtime-plugin.js","sourceRoot":"","sources":["../src/base44-runtime-plugin.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,MAAM,SAAS,GAAG,gBAAgB,CAAC;AACnC,8EAA8E;AAC9E,gDAAgD;AAChD,MAAM,QAAQ,GAAG,kBAAkB,CAAC;AAEpC,+EAA+E;AAC/E,iFAAiF;AACjF,sEAAsE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G,QAAQ,CAAC,CAAC,CAAC,kBAAkB,QAAQ,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;YAE3D,MAAM,MAAM,GAAG,iBAAiB,CAAC,SAAS,CAAC,CAAC;YAC5C,IAAI,MAAM;gBAAE,IAAI,CAAC,KAAK,CAAC,IAAI,SAAS,wCAAwC,MAAM,GAAG,IAAI,EAAE,CAAC,CAAC;YAE7F,0EAA0E;YAC1E,uEAAuE;YACvE,IAAI,IAAI,CAAC,WAAW,EAAE,IAAI,KAAK,QAAQ,EAAE,CAAC;gBACxC,IAAI,CAAC,KAAK,CAAC,IAAI,SAAS,0DAA0D,IAAI,EAAE,CAAC,CAAC;YAC5F,CAAC;YACD,OAAO,cAAc,CAAC;QACxB,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"visual-edit-plugin.d.ts","sourceRoot":"","sources":["../src/visual-edit-plugin.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAa,MAAM,EAAc,MAAM,MAAM,CAAC;AAK1D,wBAAgB,gBAAgB,IAkFzB,MAAM,CACZ"}
1
+ {"version":3,"file":"visual-edit-plugin.d.ts","sourceRoot":"","sources":["../src/visual-edit-plugin.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAa,MAAM,EAAc,MAAM,MAAM,CAAC;AAK1D,wBAAgB,gBAAgB,IA+EzB,MAAM,CACZ"}
@@ -25,10 +25,7 @@ export function visualEditPlugin() {
25
25
  if (id.includes("node_modules") || id.includes("visual-edit-agent")) {
26
26
  return null;
27
27
  }
28
- // TanStack Router serves route components as `route.jsx?tsr-split=...` modules;
29
- // other queries (?raw, ?url, ?worker) aren't JSX source.
30
- const [idPath, idQuery] = id.split("?");
31
- if (!/\.(jsx?|tsx?)$/.test(idPath) || (idQuery && !/tsr-(split|shared)/.test(idQuery))) {
28
+ if (!id.match(/\.(jsx?|tsx?)$/)) {
32
29
  return null;
33
30
  }
34
31
  const filename = extractFilename(id);
@@ -1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K,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACjC,6EAA6E;IAC7E,qFAAqF;IACrF,MAAM,QAAQ,GAAG,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAC1C,IAAI,QAAQ,IAAI,CAAC,EAAE,CAAC;QAClB,OAAO,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,iEAAiE;IAC3G,CAAC;IACD,0EAA0E;IAC1E,OAAO,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;AACvC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base44-preview/vite-plugin",
3
- "version": "1.0.44-pr.131.04821df",
3
+ "version": "1.0.44-pr.132.10ceed3",
4
4
  "description": "The Vite plugin for base44 based applications",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -26,9 +26,6 @@ import type { Plugin } from "vite";
26
26
  */
27
27
 
28
28
  const SPECIFIER = "base44:runtime";
29
- // Rollup convention: a resolved virtual id starts with NUL so no other plugin
30
- // (and no filesystem lookup) tries to claim it.
31
- const RESOLVED = "\0base44:runtime";
32
29
 
33
30
  // Reserved so a route importing it fails with an explanation instead of a bare
34
31
  // "failed to resolve import". Actors are never imported — they live in the app's
@@ -85,29 +82,44 @@ export const staticEgress = Object.freeze({
85
82
  `;
86
83
 
87
84
  export function base44RuntimePlugin(): Plugin {
85
+ const importers = new Map<string, string>();
88
86
  return {
89
87
  name: "base44-runtime",
90
88
  // Ahead of Vite's own resolution so the bare `base44:` specifier is never
91
89
  // mistaken for a URL protocol.
92
90
  enforce: "pre",
93
91
 
94
- resolveId(id) {
95
- const reason = unsupportedReason(id);
96
- if (reason) {
97
- this.error(`"${id}" is not available in server routes. ${reason}`);
98
- }
99
- if (id !== SPECIFIER) return null;
92
+ // Errors are raised in `load`, never `resolveId`: Vite's dep scanner resolves
93
+ // the raw source of server routes and server-fn handlers in the client
94
+ // environment, before TanStack strips them, and a throw there fails the scan
95
+ // so Vite skips pre-bundling. This relies on the scanner externalizing
96
+ // resolved virtual ids rather than loading them (true of the esbuild scan in
97
+ // Vite 7 and the Rolldown scan in Vite 8); re-check it on a bundler change.
98
+ resolveId(id, importer) {
99
+ if (id !== SPECIFIER && !unsupportedReason(id)) return null;
100
+ if (importer) importers.set(`${this.environment?.name}:${id}`, importer);
101
+ // Rollup convention: a NUL-prefixed id is virtual, so no other plugin
102
+ // (and no filesystem lookup) tries to claim it.
103
+ return `\0${id}`;
104
+ },
105
+
106
+ load(id) {
107
+ if (!id.startsWith("\0")) return null;
108
+ const specifier = id.slice(1);
109
+ if (specifier !== SPECIFIER && !unsupportedReason(specifier)) return null;
110
+ // The failing module is virtual, so name the file that imported it.
111
+ const importer = importers.get(`${this.environment?.name}:${specifier}`);
112
+ const from = importer ? ` Imported from ${importer}.` : "";
113
+
114
+ const reason = unsupportedReason(specifier);
115
+ if (reason) this.error(`"${specifier}" is not available in server routes. ${reason}${from}`);
100
116
 
101
117
  // `cloudflare:workers` has no browser equivalent, so a client-side import
102
118
  // would bundle a module that cannot run. Fail with the reason instead.
103
119
  if (this.environment?.name === "client") {
104
- this.error(`"${SPECIFIER}" is server-only. Move this import into a server route.`);
120
+ this.error(`"${SPECIFIER}" is server-only. Move this import into a server route.${from}`);
105
121
  }
106
- return RESOLVED;
107
- },
108
-
109
- load(id) {
110
- return id === RESOLVED ? RUNTIME_MODULE : null;
122
+ return RUNTIME_MODULE;
111
123
  },
112
124
  };
113
125
  }
@@ -29,10 +29,7 @@ export function visualEditPlugin() {
29
29
  return null;
30
30
  }
31
31
 
32
- // TanStack Router serves route components as `route.jsx?tsr-split=...` modules;
33
- // other queries (?raw, ?url, ?worker) aren't JSX source.
34
- const [idPath, idQuery] = id.split("?");
35
- if (!/\.(jsx?|tsx?)$/.test(idPath!) || (idQuery && !/tsr-(split|shared)/.test(idQuery))) {
32
+ if (!id.match(/\.(jsx?|tsx?)$/)) {
36
33
  return null;
37
34
  }
38
35