@lovable.dev/vite-tanstack-config 2.3.1 → 2.3.2

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
@@ -43,6 +43,25 @@ function isSandboxEnvironment() {
43
43
  function logWarning(message) {
44
44
  console.warn(`[@lovable.dev/vite-tanstack-config] ${message}`);
45
45
  }
46
+ var NITRO_DEFAULT_PRESET_MIN = [3, 0, 260603];
47
+ async function nitroSupportsDefaultPreset() {
48
+ try {
49
+ const { createRequire } = await import("module");
50
+ const require2 = createRequire(`${process.cwd()}/package.json`);
51
+ const { version } = require2("nitro/package.json");
52
+ const match = typeof version === "string" ? /^(\d+)\.(\d+)\.(\d+)/.exec(version) : null;
53
+ if (!match)
54
+ return true;
55
+ const parts = [Number(match[1]), Number(match[2]), Number(match[3])];
56
+ for (let i = 0; i < 3; i++) {
57
+ if (parts[i] !== NITRO_DEFAULT_PRESET_MIN[i])
58
+ return parts[i] > NITRO_DEFAULT_PRESET_MIN[i];
59
+ }
60
+ return true;
61
+ } catch {
62
+ return true;
63
+ }
64
+ }
46
65
  function validateHeaders(config) {
47
66
  const headers = config.server?.headers;
48
67
  if (!headers)
@@ -380,11 +399,16 @@ function defineConfig(configOrOptions = {}) {
380
399
  if (nitroMod) {
381
400
  const { nitro } = nitroMod;
382
401
  const userNitroOpts = typeof options.nitro === "object" && options.nitro ? options.nitro : {};
383
- const nitroOpts = { preset: "cloudflare-module", ...userNitroOpts };
402
+ const nitroOpts = { defaultPreset: "cloudflare-module", ...userNitroOpts };
384
403
  if (isSandbox) {
404
+ delete nitroOpts.defaultPreset;
385
405
  nitroOpts.preset = "cloudflare-module";
386
406
  nitroOpts.output = { dir: "dist", serverDir: "dist/server", publicDir: "dist/client" };
387
407
  nitroOpts.cloudflare = { nodeCompat: true, deployConfig: true, ...userNitroOpts.cloudflare };
408
+ } else if (!nitroOpts.preset && !await nitroSupportsDefaultPreset()) {
409
+ logWarning(
410
+ 'The installed `nitro` predates the `defaultPreset` option (3.0.260603-beta), so the Cloudflare fallback is ignored and a zero-config build may target Node instead. Upgrade nitro to >=3.0.260603-beta, or set an explicit `nitro: { preset: "cloudflare-module" }`.'
411
+ );
388
412
  }
389
413
  internalPlugins.push(nitro(nitroOpts));
390
414
  }
package/dist/index.d.cts CHANGED
@@ -14,9 +14,11 @@ interface LovableViteTanstackOptions {
14
14
  * / `LOVABLE_SANDBOX`). Users who clone their project and self-deploy
15
15
  * on their own infra get a Vite-only build with no Cloudflare-specific
16
16
  * bundling.
17
- * - **`true`**: force-on with the `cloudflare-module` preset.
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.
18
20
  * - **object**: force-on, with these overrides. Set `preset`
19
- * (e.g. `{ preset: "vercel" }`) to host elsewhere from your own CI.
21
+ * (e.g. `{ preset: "vercel" }`) to hard-pin a target from your own CI.
20
22
  * - **`false`**: skip nitro entirely.
21
23
  *
22
24
  * Inside a Lovable build the preset and output layout are forced to
package/dist/index.d.ts CHANGED
@@ -14,9 +14,11 @@ interface LovableViteTanstackOptions {
14
14
  * / `LOVABLE_SANDBOX`). Users who clone their project and self-deploy
15
15
  * on their own infra get a Vite-only build with no Cloudflare-specific
16
16
  * bundling.
17
- * - **`true`**: force-on with the `cloudflare-module` preset.
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.
18
20
  * - **object**: force-on, with these overrides. Set `preset`
19
- * (e.g. `{ preset: "vercel" }`) to host elsewhere from your own CI.
21
+ * (e.g. `{ preset: "vercel" }`) to hard-pin a target from your own CI.
20
22
  * - **`false`**: skip nitro entirely.
21
23
  *
22
24
  * Inside a Lovable build the preset and output layout are forced to
package/dist/index.js CHANGED
@@ -9,6 +9,25 @@ function isSandboxEnvironment() {
9
9
  function logWarning(message) {
10
10
  console.warn(`[@lovable.dev/vite-tanstack-config] ${message}`);
11
11
  }
12
+ var NITRO_DEFAULT_PRESET_MIN = [3, 0, 260603];
13
+ async function nitroSupportsDefaultPreset() {
14
+ try {
15
+ const { createRequire } = await import("module");
16
+ const require2 = createRequire(`${process.cwd()}/package.json`);
17
+ const { version } = require2("nitro/package.json");
18
+ const match = typeof version === "string" ? /^(\d+)\.(\d+)\.(\d+)/.exec(version) : null;
19
+ if (!match)
20
+ return true;
21
+ const parts = [Number(match[1]), Number(match[2]), Number(match[3])];
22
+ for (let i = 0; i < 3; i++) {
23
+ if (parts[i] !== NITRO_DEFAULT_PRESET_MIN[i])
24
+ return parts[i] > NITRO_DEFAULT_PRESET_MIN[i];
25
+ }
26
+ return true;
27
+ } catch {
28
+ return true;
29
+ }
30
+ }
12
31
  function validateHeaders(config) {
13
32
  const headers = config.server?.headers;
14
33
  if (!headers)
@@ -346,11 +365,16 @@ function defineConfig(configOrOptions = {}) {
346
365
  if (nitroMod) {
347
366
  const { nitro } = nitroMod;
348
367
  const userNitroOpts = typeof options.nitro === "object" && options.nitro ? options.nitro : {};
349
- const nitroOpts = { preset: "cloudflare-module", ...userNitroOpts };
368
+ const nitroOpts = { defaultPreset: "cloudflare-module", ...userNitroOpts };
350
369
  if (isSandbox) {
370
+ delete nitroOpts.defaultPreset;
351
371
  nitroOpts.preset = "cloudflare-module";
352
372
  nitroOpts.output = { dir: "dist", serverDir: "dist/server", publicDir: "dist/client" };
353
373
  nitroOpts.cloudflare = { nodeCompat: true, deployConfig: true, ...userNitroOpts.cloudflare };
374
+ } else if (!nitroOpts.preset && !await nitroSupportsDefaultPreset()) {
375
+ logWarning(
376
+ 'The installed `nitro` predates the `defaultPreset` option (3.0.260603-beta), so the Cloudflare fallback is ignored and a zero-config build may target Node instead. Upgrade nitro to >=3.0.260603-beta, or set an explicit `nitro: { preset: "cloudflare-module" }`.'
377
+ );
354
378
  }
355
379
  internalPlugins.push(nitro(nitroOpts));
356
380
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lovable.dev/vite-tanstack-config",
3
- "version": "2.3.1",
3
+ "version": "2.3.2",
4
4
  "description": "Vite config wrapper for Lovable TanStack Start projects",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
@@ -35,7 +35,7 @@
35
35
  "vite": ">=5.0.0 <9.0.0",
36
36
  "@tailwindcss/vite": ">=4.0.0",
37
37
  "vite-tsconfig-paths": ">=6.0.0",
38
- "nitro": ">=3.0.260429-beta",
38
+ "nitro": ">=3.0.260603-beta",
39
39
  "@tanstack/react-start": ">=1.100.0",
40
40
  "@vitejs/plugin-react": ">=4.0.0"
41
41
  },
@@ -45,7 +45,7 @@
45
45
  }
46
46
  },
47
47
  "devDependencies": {
48
- "nitro": "3.0.260429-beta",
48
+ "nitro": "3.0.260603-beta",
49
49
  "@tanstack/react-start": "^1.162.9",
50
50
  "@vitejs/plugin-react": "^4.5.2",
51
51
  "@tailwindcss/vite": "^4.2.1",