@lovable.dev/vite-tanstack-config 2.5.4-rc.0 → 2.6.0

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
@@ -175,123 +175,6 @@ function isBuildError(error) {
175
175
  const message = typeof e.message === "string" ? e.message : "";
176
176
  return BUILD_ERROR_MESSAGE.test(message);
177
177
  }
178
- var BUILD_DIAGNOSTICS_PLUGIN_NAME = "lovable-build-error-diagnostics";
179
- var MAX_DIAGNOSTIC_STRING_LENGTH = 2e3;
180
- var MAX_DIAGNOSTIC_NESTED_ERRORS = 20;
181
- var MAX_DIAGNOSTIC_DEPTH = 4;
182
- var DIAGNOSTIC_ERROR_FIELDS = [
183
- "name",
184
- "message",
185
- "plugin",
186
- "pluginCode",
187
- "id",
188
- "moduleId",
189
- "hook",
190
- "code",
191
- "loc",
192
- "frame",
193
- "stack",
194
- "cause"
195
- ];
196
- function truncateDiagnosticString(value) {
197
- return value.length > MAX_DIAGNOSTIC_STRING_LENGTH ? `${value.slice(0, MAX_DIAGNOSTIC_STRING_LENGTH)}...[truncated]` : value;
198
- }
199
- function readDiagnosticProperty(value, key) {
200
- try {
201
- return value[key];
202
- } catch (error) {
203
- return `[unreadable: ${error instanceof Error ? error.message : String(error)}]`;
204
- }
205
- }
206
- function serializeOwnDiagnosticProperties(value, depth, seen) {
207
- const keys = Object.keys(value);
208
- const output = {};
209
- for (const key of keys.slice(0, MAX_DIAGNOSTIC_NESTED_ERRORS)) {
210
- const nested = readDiagnosticProperty(value, key);
211
- if (nested == null || nested === "")
212
- continue;
213
- output[key] = serializeDiagnosticValue(nested, depth + 1, seen);
214
- }
215
- if (keys.length > MAX_DIAGNOSTIC_NESTED_ERRORS) {
216
- output.properties_truncated = keys.length - MAX_DIAGNOSTIC_NESTED_ERRORS;
217
- }
218
- return output;
219
- }
220
- function describeDiagnosticPrimitive(value) {
221
- if (typeof value === "symbol")
222
- return value.description ? `Symbol(${value.description})` : "Symbol()";
223
- if (typeof value === "bigint")
224
- return value.toString();
225
- if (typeof value === "function")
226
- return `[function ${value.name || "anonymous"}]`;
227
- return String(value);
228
- }
229
- function describeDiagnosticObject(value) {
230
- const constructorName = value.constructor?.name;
231
- if (typeof constructorName === "string" && constructorName !== "" && constructorName !== "Object") {
232
- return `[${constructorName}]`;
233
- }
234
- return Object.prototype.toString.call(value);
235
- }
236
- function serializeDiagnosticValue(value, depth, seen) {
237
- if (value == null)
238
- return value;
239
- if (typeof value === "string")
240
- return truncateDiagnosticString(value);
241
- if (typeof value === "number" || typeof value === "boolean")
242
- return value;
243
- if (typeof value !== "object")
244
- return describeDiagnosticPrimitive(value);
245
- if (seen.has(value))
246
- return "[circular]";
247
- if (depth >= MAX_DIAGNOSTIC_DEPTH)
248
- return "[max depth]";
249
- seen.add(value);
250
- try {
251
- if (Array.isArray(value)) {
252
- return value.slice(0, MAX_DIAGNOSTIC_NESTED_ERRORS).map((item) => serializeDiagnosticValue(item, depth + 1, seen));
253
- }
254
- const record = value;
255
- const output = {};
256
- for (const field of DIAGNOSTIC_ERROR_FIELDS) {
257
- if (!(field in record))
258
- continue;
259
- const nested = readDiagnosticProperty(record, field);
260
- if (nested == null || nested === "")
261
- continue;
262
- output[field] = serializeDiagnosticValue(nested, depth + 1, seen);
263
- }
264
- const nestedErrors = readDiagnosticProperty(record, "errors");
265
- if (Array.isArray(nestedErrors)) {
266
- output.errors = nestedErrors.slice(0, MAX_DIAGNOSTIC_NESTED_ERRORS).map((item) => serializeDiagnosticValue(item, depth + 1, seen));
267
- if (nestedErrors.length > MAX_DIAGNOSTIC_NESTED_ERRORS) {
268
- output.errors_truncated = nestedErrors.length - MAX_DIAGNOSTIC_NESTED_ERRORS;
269
- }
270
- } else if (nestedErrors != null && nestedErrors !== "") {
271
- output.errors = serializeDiagnosticValue(nestedErrors, depth + 1, seen);
272
- }
273
- if (Object.keys(output).length > 0)
274
- return output;
275
- const ownProperties = serializeOwnDiagnosticProperties(record, depth, seen);
276
- return Object.keys(ownProperties).length > 0 ? ownProperties : describeDiagnosticObject(value);
277
- } finally {
278
- seen.delete(value);
279
- }
280
- }
281
- function lovableBuildErrorDiagnostics() {
282
- return {
283
- name: BUILD_DIAGNOSTICS_PLUGIN_NAME,
284
- apply: "build",
285
- buildEnd(error) {
286
- if (!error)
287
- return;
288
- const diagnostics = serializeDiagnosticValue(error, 0, /* @__PURE__ */ new WeakSet());
289
- console.error("\n[lovable-build-error-diagnostics]");
290
- console.error(JSON.stringify(diagnostics, null, 2));
291
- console.error("[/lovable-build-error-diagnostics]");
292
- }
293
- };
294
- }
295
178
  function devSsrErrorLogger() {
296
179
  let lastCapture;
297
180
  const CAPTURE_TTL_MS = 5e3;
@@ -490,9 +373,6 @@ function defineConfig(configOrOptions = {}) {
490
373
  if (options.ssrErrorLogger !== false) {
491
374
  internalPlugins.push(devSsrErrorLogger());
492
375
  }
493
- if (command === "build" && isSandbox) {
494
- internalPlugins.push(lovableBuildErrorDiagnostics());
495
- }
496
376
  const { tanstackStart } = await import("@tanstack/react-start/plugin/vite");
497
377
  const tanstackStartDefaults = {
498
378
  importProtection: {
@@ -506,12 +386,7 @@ function defineConfig(configOrOptions = {}) {
506
386
  const tanstackStartOptions = (0, import_vite.mergeConfig)(tanstackStartDefaults, options.tanstackStart ?? {});
507
387
  internalPlugins.push(tanstackStart(tanstackStartOptions));
508
388
  const explicitNitro = options.nitro === true || typeof options.nitro === "object" && options.nitro !== null;
509
- const shouldRunNitro = options.nitro !== false && command === "build" && (explicitNitro || isSandbox);
510
- if (options.nitro === void 0 && command === "build" && !isSandbox) {
511
- console.info(
512
- "[@lovable.dev/vite-tanstack-config] No Lovable context detected \u2014 skipping nitro deploy plugin. Pass `nitro: true` (or `nitro: { ... }`) to force-enable."
513
- );
514
- }
389
+ const shouldRunNitro = options.nitro !== false && command === "build";
515
390
  if (shouldRunNitro) {
516
391
  let nitroMod;
517
392
  try {
package/dist/index.d.cts CHANGED
@@ -9,14 +9,13 @@ interface LovableViteTanstackOptions {
9
9
  * Options forwarded to `nitro()` from `nitro/vite`.
10
10
  *
11
11
  * Behavior:
12
- * - **undefined** (default): auto — nitro runs only when a Lovable context
13
- * is detected (sandbox + prod-deploy build via `DEV_SERVER__PROJECT_PATH`
14
- * / `LOVABLE_SANDBOX`). Users who clone their project and self-deploy
15
- * on their own infra get a Vite-only build with no Cloudflare-specific
16
- * bundling.
17
- * - **`true`**: force-on, defaulting to the `cloudflare-module` preset via
18
- * Nitro's `defaultPreset` — zero-config target auto-detection
19
- * (`NITRO_PRESET`, Vercel/Netlify/Cloudflare Pages) still wins.
12
+ * - **undefined** (default): nitro runs on every production build, defaulting
13
+ * to the `cloudflare-module` preset via Nitro's `defaultPreset` — zero-config
14
+ * target auto-detection (`NITRO_PRESET`, Vercel/Netlify/Cloudflare Pages)
15
+ * still wins, so a self-deploy auto-targets its own platform. If the optional
16
+ * `nitro` peer dep isn't installed, it's skipped (no deploy intent to honor).
17
+ * - **`true`**: same as undefined, but fails fast if the `nitro` peer dep is
18
+ * missing — the explicit opt-in signals deploy intent.
20
19
  * - **object**: force-on, with these overrides. Set `preset`
21
20
  * (e.g. `{ preset: "vercel" }`) to hard-pin a target from your own CI.
22
21
  * - **`false`**: skip nitro entirely.
package/dist/index.d.ts CHANGED
@@ -9,14 +9,13 @@ interface LovableViteTanstackOptions {
9
9
  * Options forwarded to `nitro()` from `nitro/vite`.
10
10
  *
11
11
  * Behavior:
12
- * - **undefined** (default): auto — nitro runs only when a Lovable context
13
- * is detected (sandbox + prod-deploy build via `DEV_SERVER__PROJECT_PATH`
14
- * / `LOVABLE_SANDBOX`). Users who clone their project and self-deploy
15
- * on their own infra get a Vite-only build with no Cloudflare-specific
16
- * bundling.
17
- * - **`true`**: force-on, defaulting to the `cloudflare-module` preset via
18
- * Nitro's `defaultPreset` — zero-config target auto-detection
19
- * (`NITRO_PRESET`, Vercel/Netlify/Cloudflare Pages) still wins.
12
+ * - **undefined** (default): nitro runs on every production build, defaulting
13
+ * to the `cloudflare-module` preset via Nitro's `defaultPreset` — zero-config
14
+ * target auto-detection (`NITRO_PRESET`, Vercel/Netlify/Cloudflare Pages)
15
+ * still wins, so a self-deploy auto-targets its own platform. If the optional
16
+ * `nitro` peer dep isn't installed, it's skipped (no deploy intent to honor).
17
+ * - **`true`**: same as undefined, but fails fast if the `nitro` peer dep is
18
+ * missing — the explicit opt-in signals deploy intent.
20
19
  * - **object**: force-on, with these overrides. Set `preset`
21
20
  * (e.g. `{ preset: "vercel" }`) to hard-pin a target from your own CI.
22
21
  * - **`false`**: skip nitro entirely.
package/dist/index.js CHANGED
@@ -141,123 +141,6 @@ function isBuildError(error) {
141
141
  const message = typeof e.message === "string" ? e.message : "";
142
142
  return BUILD_ERROR_MESSAGE.test(message);
143
143
  }
144
- var BUILD_DIAGNOSTICS_PLUGIN_NAME = "lovable-build-error-diagnostics";
145
- var MAX_DIAGNOSTIC_STRING_LENGTH = 2e3;
146
- var MAX_DIAGNOSTIC_NESTED_ERRORS = 20;
147
- var MAX_DIAGNOSTIC_DEPTH = 4;
148
- var DIAGNOSTIC_ERROR_FIELDS = [
149
- "name",
150
- "message",
151
- "plugin",
152
- "pluginCode",
153
- "id",
154
- "moduleId",
155
- "hook",
156
- "code",
157
- "loc",
158
- "frame",
159
- "stack",
160
- "cause"
161
- ];
162
- function truncateDiagnosticString(value) {
163
- return value.length > MAX_DIAGNOSTIC_STRING_LENGTH ? `${value.slice(0, MAX_DIAGNOSTIC_STRING_LENGTH)}...[truncated]` : value;
164
- }
165
- function readDiagnosticProperty(value, key) {
166
- try {
167
- return value[key];
168
- } catch (error) {
169
- return `[unreadable: ${error instanceof Error ? error.message : String(error)}]`;
170
- }
171
- }
172
- function serializeOwnDiagnosticProperties(value, depth, seen) {
173
- const keys = Object.keys(value);
174
- const output = {};
175
- for (const key of keys.slice(0, MAX_DIAGNOSTIC_NESTED_ERRORS)) {
176
- const nested = readDiagnosticProperty(value, key);
177
- if (nested == null || nested === "")
178
- continue;
179
- output[key] = serializeDiagnosticValue(nested, depth + 1, seen);
180
- }
181
- if (keys.length > MAX_DIAGNOSTIC_NESTED_ERRORS) {
182
- output.properties_truncated = keys.length - MAX_DIAGNOSTIC_NESTED_ERRORS;
183
- }
184
- return output;
185
- }
186
- function describeDiagnosticPrimitive(value) {
187
- if (typeof value === "symbol")
188
- return value.description ? `Symbol(${value.description})` : "Symbol()";
189
- if (typeof value === "bigint")
190
- return value.toString();
191
- if (typeof value === "function")
192
- return `[function ${value.name || "anonymous"}]`;
193
- return String(value);
194
- }
195
- function describeDiagnosticObject(value) {
196
- const constructorName = value.constructor?.name;
197
- if (typeof constructorName === "string" && constructorName !== "" && constructorName !== "Object") {
198
- return `[${constructorName}]`;
199
- }
200
- return Object.prototype.toString.call(value);
201
- }
202
- function serializeDiagnosticValue(value, depth, seen) {
203
- if (value == null)
204
- return value;
205
- if (typeof value === "string")
206
- return truncateDiagnosticString(value);
207
- if (typeof value === "number" || typeof value === "boolean")
208
- return value;
209
- if (typeof value !== "object")
210
- return describeDiagnosticPrimitive(value);
211
- if (seen.has(value))
212
- return "[circular]";
213
- if (depth >= MAX_DIAGNOSTIC_DEPTH)
214
- return "[max depth]";
215
- seen.add(value);
216
- try {
217
- if (Array.isArray(value)) {
218
- return value.slice(0, MAX_DIAGNOSTIC_NESTED_ERRORS).map((item) => serializeDiagnosticValue(item, depth + 1, seen));
219
- }
220
- const record = value;
221
- const output = {};
222
- for (const field of DIAGNOSTIC_ERROR_FIELDS) {
223
- if (!(field in record))
224
- continue;
225
- const nested = readDiagnosticProperty(record, field);
226
- if (nested == null || nested === "")
227
- continue;
228
- output[field] = serializeDiagnosticValue(nested, depth + 1, seen);
229
- }
230
- const nestedErrors = readDiagnosticProperty(record, "errors");
231
- if (Array.isArray(nestedErrors)) {
232
- output.errors = nestedErrors.slice(0, MAX_DIAGNOSTIC_NESTED_ERRORS).map((item) => serializeDiagnosticValue(item, depth + 1, seen));
233
- if (nestedErrors.length > MAX_DIAGNOSTIC_NESTED_ERRORS) {
234
- output.errors_truncated = nestedErrors.length - MAX_DIAGNOSTIC_NESTED_ERRORS;
235
- }
236
- } else if (nestedErrors != null && nestedErrors !== "") {
237
- output.errors = serializeDiagnosticValue(nestedErrors, depth + 1, seen);
238
- }
239
- if (Object.keys(output).length > 0)
240
- return output;
241
- const ownProperties = serializeOwnDiagnosticProperties(record, depth, seen);
242
- return Object.keys(ownProperties).length > 0 ? ownProperties : describeDiagnosticObject(value);
243
- } finally {
244
- seen.delete(value);
245
- }
246
- }
247
- function lovableBuildErrorDiagnostics() {
248
- return {
249
- name: BUILD_DIAGNOSTICS_PLUGIN_NAME,
250
- apply: "build",
251
- buildEnd(error) {
252
- if (!error)
253
- return;
254
- const diagnostics = serializeDiagnosticValue(error, 0, /* @__PURE__ */ new WeakSet());
255
- console.error("\n[lovable-build-error-diagnostics]");
256
- console.error(JSON.stringify(diagnostics, null, 2));
257
- console.error("[/lovable-build-error-diagnostics]");
258
- }
259
- };
260
- }
261
144
  function devSsrErrorLogger() {
262
145
  let lastCapture;
263
146
  const CAPTURE_TTL_MS = 5e3;
@@ -456,9 +339,6 @@ function defineConfig(configOrOptions = {}) {
456
339
  if (options.ssrErrorLogger !== false) {
457
340
  internalPlugins.push(devSsrErrorLogger());
458
341
  }
459
- if (command === "build" && isSandbox) {
460
- internalPlugins.push(lovableBuildErrorDiagnostics());
461
- }
462
342
  const { tanstackStart } = await import("@tanstack/react-start/plugin/vite");
463
343
  const tanstackStartDefaults = {
464
344
  importProtection: {
@@ -472,12 +352,7 @@ function defineConfig(configOrOptions = {}) {
472
352
  const tanstackStartOptions = mergeConfig(tanstackStartDefaults, options.tanstackStart ?? {});
473
353
  internalPlugins.push(tanstackStart(tanstackStartOptions));
474
354
  const explicitNitro = options.nitro === true || typeof options.nitro === "object" && options.nitro !== null;
475
- const shouldRunNitro = options.nitro !== false && command === "build" && (explicitNitro || isSandbox);
476
- if (options.nitro === void 0 && command === "build" && !isSandbox) {
477
- console.info(
478
- "[@lovable.dev/vite-tanstack-config] No Lovable context detected \u2014 skipping nitro deploy plugin. Pass `nitro: true` (or `nitro: { ... }`) to force-enable."
479
- );
480
- }
355
+ const shouldRunNitro = options.nitro !== false && command === "build";
481
356
  if (shouldRunNitro) {
482
357
  let nitroMod;
483
358
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lovable.dev/vite-tanstack-config",
3
- "version": "2.5.4-rc.0",
3
+ "version": "2.6.0",
4
4
  "description": "Vite config wrapper for Lovable TanStack Start projects",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",