@lovable.dev/vite-tanstack-config 1.4.2 → 1.4.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.
package/dist/index.cjs CHANGED
@@ -130,131 +130,6 @@ function applyWatchDebounceDefaults(config) {
130
130
  }
131
131
  });
132
132
  }
133
- function devClientErrorLogger() {
134
- const VIRTUAL_ID = "virtual:dev-client-error-handler";
135
- const RESOLVED_ID = "\0" + VIRTUAL_ID;
136
- return {
137
- name: "dev-client-error-logger",
138
- apply: "serve",
139
- enforce: "pre",
140
- resolveId(id) {
141
- if (id === VIRTUAL_ID)
142
- return RESOLVED_ID;
143
- return void 0;
144
- },
145
- load(id) {
146
- if (id !== RESOLVED_ID)
147
- return void 0;
148
- return [
149
- "if (typeof window !== 'undefined' && import.meta.hot) {",
150
- " const send = (d) => { try { import.meta.hot.send('client-runtime-error', d) } catch {} };",
151
- " const stripTokenFromUrl = (url) => {",
152
- " try {",
153
- " const parsed = new URL(url);",
154
- " parsed.searchParams.delete('__lovable_token');",
155
- " return parsed.toString();",
156
- " } catch {",
157
- " return url;",
158
- " }",
159
- " };",
160
- " const describeResponse = (res) => {",
161
- " const sanitizedUrl = res.url ? stripTokenFromUrl(res.url) : '';",
162
- " return `Server responded with ${res.status} ${res.statusText || '(no status text)'}${sanitizedUrl ? ` at ${sanitizedUrl}` : ''}`;",
163
- " };",
164
- " window.addEventListener('error', (e) => {",
165
- " send({ type: 'runtime-error', message: e.message, stack: e.error?.stack, filename: e.filename, lineno: e.lineno, colno: e.colno });",
166
- " });",
167
- " window.addEventListener('unhandledrejection', (e) => {",
168
- " const err = e.reason;",
169
- " if (err instanceof Response) {",
170
- " const url = err.url ? stripTokenFromUrl(err.url) : undefined;",
171
- " send({",
172
- " type: 'unhandled-rejection',",
173
- " name: 'Response',",
174
- " message: describeResponse(err),",
175
- " stack: url ? `Response ${err.status} at ${url}` : `Response ${err.status}`,",
176
- " filename: url,",
177
- " url,",
178
- " status: err.status,",
179
- " statusText: err.statusText || undefined,",
180
- " });",
181
- " return;",
182
- " }",
183
- " send({ type: 'unhandled-rejection', name: err?.name, message: err?.message || String(err), stack: err?.stack });",
184
- " });",
185
- "}"
186
- ].join("\n");
187
- },
188
- configureServer(server) {
189
- const origConsoleError = console.error;
190
- let forwarding = false;
191
- console.error = (...args) => {
192
- origConsoleError.apply(console, args);
193
- if (forwarding)
194
- return;
195
- forwarding = true;
196
- try {
197
- const error = args[0];
198
- if (error instanceof Error) {
199
- server.ws.send({
200
- type: "custom",
201
- event: "client-runtime-error",
202
- data: {
203
- source: "ssr",
204
- type: "ssr-render-error",
205
- name: error.name,
206
- message: error.message,
207
- stack: error.stack
208
- }
209
- });
210
- }
211
- } finally {
212
- forwarding = false;
213
- }
214
- };
215
- server.ws.on("client-runtime-error", (data) => {
216
- const type = typeof data.type === "string" ? data.type : "runtime-error";
217
- let message = "Unknown error";
218
- if (typeof data.message === "string") {
219
- message = data.message;
220
- } else if (data.message != null) {
221
- message = JSON.stringify(data.message);
222
- }
223
- const stack = typeof data.stack === "string" ? data.stack : void 0;
224
- const filename = typeof data.filename === "string" ? data.filename : void 0;
225
- const lineno = typeof data.lineno === "number" ? data.lineno : void 0;
226
- const colno = typeof data.colno === "number" ? data.colno : void 0;
227
- const label = type === "unhandled-rejection" ? "Unhandled Rejection" : "Runtime Error";
228
- let loc = "";
229
- if (filename) {
230
- loc = ` at ${filename}`;
231
- if (lineno != null)
232
- loc += `:${lineno}`;
233
- if (colno != null)
234
- loc += `:${colno}`;
235
- }
236
- server.config.logger.error(`
237
- [client] ${label}: ${message}${loc}`);
238
- if (stack) {
239
- server.config.logger.error(stack);
240
- }
241
- server.ws.send({
242
- type: "custom",
243
- event: "client-runtime-error",
244
- data
245
- });
246
- });
247
- },
248
- transform(code, id) {
249
- const normalizedId = id.replace(/\\/g, "/");
250
- if (normalizedId.includes("routes/__root")) {
251
- return `import "${VIRTUAL_ID}";
252
- ${code}`;
253
- }
254
- return void 0;
255
- }
256
- };
257
- }
258
133
  function devServerFnErrorLogger() {
259
134
  const HMR_SEND_KEY = "__TANSTACK_SERVER_FN_HMR_SEND__";
260
135
  return {
@@ -313,7 +188,7 @@ function defineConfig(configOrOptions = {}) {
313
188
  options = { vite: await configOrOptions };
314
189
  } else {
315
190
  const optionObject = configOrOptions && typeof configOrOptions === "object" ? configOrOptions : {};
316
- const hasLovableKey = "vite" in optionObject || "clientErrorLogger" in optionObject || "serverFnErrorLogger" in optionObject || "cloudflare" in optionObject || "tanstackStart" in optionObject || "react" in optionObject || "envDefine" in optionObject || "hmrGate" in optionObject;
191
+ const hasLovableKey = "vite" in optionObject || "serverFnErrorLogger" in optionObject || "cloudflare" in optionObject || "tanstackStart" in optionObject || "react" in optionObject || "envDefine" in optionObject || "hmrGate" in optionObject;
317
192
  options = hasLovableKey ? optionObject : { vite: optionObject };
318
193
  }
319
194
  const internalPlugins = [];
@@ -321,9 +196,6 @@ function defineConfig(configOrOptions = {}) {
321
196
  internalPlugins.push(tailwindcss());
322
197
  const tsConfigPaths = (await import("vite-tsconfig-paths")).default;
323
198
  internalPlugins.push(tsConfigPaths({ projects: ["./tsconfig.json"] }));
324
- if (options.clientErrorLogger !== false) {
325
- internalPlugins.push(devClientErrorLogger());
326
- }
327
199
  if (options.serverFnErrorLogger !== false) {
328
200
  internalPlugins.push(devServerFnErrorLogger());
329
201
  }
package/dist/index.d.cts CHANGED
@@ -3,7 +3,6 @@ import { PluginOption, UserConfig, ConfigEnv, UserConfigFnObject, UserConfigFnPr
3
3
  interface LovableViteTanstackOptions {
4
4
  plugins?: PluginOption[];
5
5
  vite?: UserConfig;
6
- clientErrorLogger?: boolean;
7
6
  serverFnErrorLogger?: boolean;
8
7
  cloudflare?: Record<string, unknown> | false;
9
8
  /** Options forwarded to tanstackStart(). */
package/dist/index.d.ts CHANGED
@@ -3,7 +3,6 @@ import { PluginOption, UserConfig, ConfigEnv, UserConfigFnObject, UserConfigFnPr
3
3
  interface LovableViteTanstackOptions {
4
4
  plugins?: PluginOption[];
5
5
  vite?: UserConfig;
6
- clientErrorLogger?: boolean;
7
6
  serverFnErrorLogger?: boolean;
8
7
  cloudflare?: Record<string, unknown> | false;
9
8
  /** Options forwarded to tanstackStart(). */
package/dist/index.js CHANGED
@@ -96,131 +96,6 @@ function applyWatchDebounceDefaults(config) {
96
96
  }
97
97
  });
98
98
  }
99
- function devClientErrorLogger() {
100
- const VIRTUAL_ID = "virtual:dev-client-error-handler";
101
- const RESOLVED_ID = "\0" + VIRTUAL_ID;
102
- return {
103
- name: "dev-client-error-logger",
104
- apply: "serve",
105
- enforce: "pre",
106
- resolveId(id) {
107
- if (id === VIRTUAL_ID)
108
- return RESOLVED_ID;
109
- return void 0;
110
- },
111
- load(id) {
112
- if (id !== RESOLVED_ID)
113
- return void 0;
114
- return [
115
- "if (typeof window !== 'undefined' && import.meta.hot) {",
116
- " const send = (d) => { try { import.meta.hot.send('client-runtime-error', d) } catch {} };",
117
- " const stripTokenFromUrl = (url) => {",
118
- " try {",
119
- " const parsed = new URL(url);",
120
- " parsed.searchParams.delete('__lovable_token');",
121
- " return parsed.toString();",
122
- " } catch {",
123
- " return url;",
124
- " }",
125
- " };",
126
- " const describeResponse = (res) => {",
127
- " const sanitizedUrl = res.url ? stripTokenFromUrl(res.url) : '';",
128
- " return `Server responded with ${res.status} ${res.statusText || '(no status text)'}${sanitizedUrl ? ` at ${sanitizedUrl}` : ''}`;",
129
- " };",
130
- " window.addEventListener('error', (e) => {",
131
- " send({ type: 'runtime-error', message: e.message, stack: e.error?.stack, filename: e.filename, lineno: e.lineno, colno: e.colno });",
132
- " });",
133
- " window.addEventListener('unhandledrejection', (e) => {",
134
- " const err = e.reason;",
135
- " if (err instanceof Response) {",
136
- " const url = err.url ? stripTokenFromUrl(err.url) : undefined;",
137
- " send({",
138
- " type: 'unhandled-rejection',",
139
- " name: 'Response',",
140
- " message: describeResponse(err),",
141
- " stack: url ? `Response ${err.status} at ${url}` : `Response ${err.status}`,",
142
- " filename: url,",
143
- " url,",
144
- " status: err.status,",
145
- " statusText: err.statusText || undefined,",
146
- " });",
147
- " return;",
148
- " }",
149
- " send({ type: 'unhandled-rejection', name: err?.name, message: err?.message || String(err), stack: err?.stack });",
150
- " });",
151
- "}"
152
- ].join("\n");
153
- },
154
- configureServer(server) {
155
- const origConsoleError = console.error;
156
- let forwarding = false;
157
- console.error = (...args) => {
158
- origConsoleError.apply(console, args);
159
- if (forwarding)
160
- return;
161
- forwarding = true;
162
- try {
163
- const error = args[0];
164
- if (error instanceof Error) {
165
- server.ws.send({
166
- type: "custom",
167
- event: "client-runtime-error",
168
- data: {
169
- source: "ssr",
170
- type: "ssr-render-error",
171
- name: error.name,
172
- message: error.message,
173
- stack: error.stack
174
- }
175
- });
176
- }
177
- } finally {
178
- forwarding = false;
179
- }
180
- };
181
- server.ws.on("client-runtime-error", (data) => {
182
- const type = typeof data.type === "string" ? data.type : "runtime-error";
183
- let message = "Unknown error";
184
- if (typeof data.message === "string") {
185
- message = data.message;
186
- } else if (data.message != null) {
187
- message = JSON.stringify(data.message);
188
- }
189
- const stack = typeof data.stack === "string" ? data.stack : void 0;
190
- const filename = typeof data.filename === "string" ? data.filename : void 0;
191
- const lineno = typeof data.lineno === "number" ? data.lineno : void 0;
192
- const colno = typeof data.colno === "number" ? data.colno : void 0;
193
- const label = type === "unhandled-rejection" ? "Unhandled Rejection" : "Runtime Error";
194
- let loc = "";
195
- if (filename) {
196
- loc = ` at ${filename}`;
197
- if (lineno != null)
198
- loc += `:${lineno}`;
199
- if (colno != null)
200
- loc += `:${colno}`;
201
- }
202
- server.config.logger.error(`
203
- [client] ${label}: ${message}${loc}`);
204
- if (stack) {
205
- server.config.logger.error(stack);
206
- }
207
- server.ws.send({
208
- type: "custom",
209
- event: "client-runtime-error",
210
- data
211
- });
212
- });
213
- },
214
- transform(code, id) {
215
- const normalizedId = id.replace(/\\/g, "/");
216
- if (normalizedId.includes("routes/__root")) {
217
- return `import "${VIRTUAL_ID}";
218
- ${code}`;
219
- }
220
- return void 0;
221
- }
222
- };
223
- }
224
99
  function devServerFnErrorLogger() {
225
100
  const HMR_SEND_KEY = "__TANSTACK_SERVER_FN_HMR_SEND__";
226
101
  return {
@@ -279,7 +154,7 @@ function defineConfig(configOrOptions = {}) {
279
154
  options = { vite: await configOrOptions };
280
155
  } else {
281
156
  const optionObject = configOrOptions && typeof configOrOptions === "object" ? configOrOptions : {};
282
- const hasLovableKey = "vite" in optionObject || "clientErrorLogger" in optionObject || "serverFnErrorLogger" in optionObject || "cloudflare" in optionObject || "tanstackStart" in optionObject || "react" in optionObject || "envDefine" in optionObject || "hmrGate" in optionObject;
157
+ const hasLovableKey = "vite" in optionObject || "serverFnErrorLogger" in optionObject || "cloudflare" in optionObject || "tanstackStart" in optionObject || "react" in optionObject || "envDefine" in optionObject || "hmrGate" in optionObject;
283
158
  options = hasLovableKey ? optionObject : { vite: optionObject };
284
159
  }
285
160
  const internalPlugins = [];
@@ -287,9 +162,6 @@ function defineConfig(configOrOptions = {}) {
287
162
  internalPlugins.push(tailwindcss());
288
163
  const tsConfigPaths = (await import("vite-tsconfig-paths")).default;
289
164
  internalPlugins.push(tsConfigPaths({ projects: ["./tsconfig.json"] }));
290
- if (options.clientErrorLogger !== false) {
291
- internalPlugins.push(devClientErrorLogger());
292
- }
293
165
  if (options.serverFnErrorLogger !== false) {
294
166
  internalPlugins.push(devServerFnErrorLogger());
295
167
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lovable.dev/vite-tanstack-config",
3
- "version": "1.4.2",
3
+ "version": "1.4.3",
4
4
  "description": "Vite config wrapper for Lovable TanStack Start projects",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",