@lovable.dev/vite-tanstack-config 2.0.0-rc.1 → 2.0.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
@@ -267,9 +267,16 @@ function defineConfig(configOrOptions = {}) {
267
267
  } else {
268
268
  const optionObject = configOrOptions && typeof configOrOptions === "object" ? configOrOptions : {};
269
269
  if ("cloudflare" in optionObject) {
270
- logWarning(
271
- "The `cloudflare` option was removed in v2. Use `nitro: false` to disable the deploy plugin, or `nitro: { preset: '...' }` to configure it. The `cloudflare` setting is being ignored."
272
- );
270
+ if (optionObject.cloudflare === false && !("nitro" in optionObject)) {
271
+ optionObject.nitro = false;
272
+ logWarning(
273
+ "`cloudflare: false` is deprecated in v2 \u2014 migrated to `nitro: false`. Update your config to drop the warning."
274
+ );
275
+ } else {
276
+ logWarning(
277
+ "The `cloudflare` option was removed in v2. Use `nitro: false` to disable the deploy plugin, or `nitro: { preset: '...' }` to configure it. The `cloudflare` setting is being ignored."
278
+ );
279
+ }
273
280
  }
274
281
  const hasLovableKey = "vite" in optionObject || "serverFnErrorLogger" in optionObject || "ssrErrorLogger" in optionObject || "nitro" in optionObject || "tanstackStart" in optionObject || "react" in optionObject || "envDefine" in optionObject || "hmrGate" in optionObject;
275
282
  options = hasLovableKey ? optionObject : { vite: optionObject };
@@ -297,12 +304,24 @@ function defineConfig(configOrOptions = {}) {
297
304
  };
298
305
  const tanstackStartOptions = (0, import_vite.mergeConfig)(tanstackStartDefaults, options.tanstackStart ?? {});
299
306
  internalPlugins.push(tanstackStart(tanstackStartOptions));
300
- if (options.nitro !== false && command === "build") {
307
+ const explicitNitro = options.nitro === true || typeof options.nitro === "object" && options.nitro !== null;
308
+ const shouldRunNitro = options.nitro !== false && command === "build" && (explicitNitro || isSandbox);
309
+ if (options.nitro === void 0 && command === "build" && !isSandbox) {
310
+ console.info(
311
+ "[@lovable.dev/vite-tanstack-config] No Lovable context detected \u2014 skipping nitro deploy plugin. Pass `nitro: true` (or `nitro: { ... }`) to force-enable."
312
+ );
313
+ }
314
+ if (shouldRunNitro) {
301
315
  try {
302
316
  const { nitro } = await import("nitro/vite");
303
317
  const userNitroOpts = typeof options.nitro === "object" && options.nitro ? options.nitro : {};
304
318
  const preset = userNitroOpts.preset ?? process.env.NITRO_PRESET ?? "cloudflare-module";
305
- const output = { dir: "dist", ...userNitroOpts.output ?? {} };
319
+ const output = {
320
+ dir: "dist",
321
+ serverDir: "dist/server",
322
+ publicDir: "dist/client",
323
+ ...userNitroOpts.output
324
+ };
306
325
  internalPlugins.push(nitro({ ...userNitroOpts, preset, output }));
307
326
  } catch {
308
327
  }
package/dist/index.d.cts CHANGED
@@ -6,18 +6,30 @@ interface LovableViteTanstackOptions {
6
6
  serverFnErrorLogger?: boolean;
7
7
  ssrErrorLogger?: boolean;
8
8
  /**
9
- * Options forwarded to `nitro()` from `nitro/vite`. Set to `false` to skip
10
- * the Nitro build plugin entirely. The preset is selected via `NITRO_PRESET`
11
- * env var or `nitro.preset` here; `output.dir` defaults to `dist`.
9
+ * Options forwarded to `nitro()` from `nitro/vite`.
12
10
  *
13
- * Narrow surface on purpose — Nitro v3 is still pre-RC, so we only expose
14
- * stable build-time knobs to reduce churn if `NitroPluginConfig` schema
15
- * changes. File an issue if you need to set a different field.
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 with package defaults (`cloudflare-module` preset,
18
+ * `dist/server` + `dist/client` layout). Use this in non-Lovable
19
+ * environments where you still want the Nitro deploy bundle.
20
+ * - **object**: force-on, with these overrides on top of the defaults.
21
+ * - **`false`**: skip nitro entirely.
22
+ *
23
+ * The option surface is narrow on purpose — Nitro v3 is still pre-RC, so
24
+ * we only expose stable build-time knobs to reduce churn if
25
+ * `NitroPluginConfig` schema changes. File an issue if you need more.
16
26
  */
17
- nitro?: {
27
+ nitro?: true | {
18
28
  preset?: string;
19
29
  output?: {
20
30
  dir?: string;
31
+ publicDir?: string;
32
+ serverDir?: string;
21
33
  };
22
34
  } | false;
23
35
  /** Options forwarded to tanstackStart(). */
package/dist/index.d.ts CHANGED
@@ -6,18 +6,30 @@ interface LovableViteTanstackOptions {
6
6
  serverFnErrorLogger?: boolean;
7
7
  ssrErrorLogger?: boolean;
8
8
  /**
9
- * Options forwarded to `nitro()` from `nitro/vite`. Set to `false` to skip
10
- * the Nitro build plugin entirely. The preset is selected via `NITRO_PRESET`
11
- * env var or `nitro.preset` here; `output.dir` defaults to `dist`.
9
+ * Options forwarded to `nitro()` from `nitro/vite`.
12
10
  *
13
- * Narrow surface on purpose — Nitro v3 is still pre-RC, so we only expose
14
- * stable build-time knobs to reduce churn if `NitroPluginConfig` schema
15
- * changes. File an issue if you need to set a different field.
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 with package defaults (`cloudflare-module` preset,
18
+ * `dist/server` + `dist/client` layout). Use this in non-Lovable
19
+ * environments where you still want the Nitro deploy bundle.
20
+ * - **object**: force-on, with these overrides on top of the defaults.
21
+ * - **`false`**: skip nitro entirely.
22
+ *
23
+ * The option surface is narrow on purpose — Nitro v3 is still pre-RC, so
24
+ * we only expose stable build-time knobs to reduce churn if
25
+ * `NitroPluginConfig` schema changes. File an issue if you need more.
16
26
  */
17
- nitro?: {
27
+ nitro?: true | {
18
28
  preset?: string;
19
29
  output?: {
20
30
  dir?: string;
31
+ publicDir?: string;
32
+ serverDir?: string;
21
33
  };
22
34
  } | false;
23
35
  /** Options forwarded to tanstackStart(). */
package/dist/index.js CHANGED
@@ -233,9 +233,16 @@ function defineConfig(configOrOptions = {}) {
233
233
  } else {
234
234
  const optionObject = configOrOptions && typeof configOrOptions === "object" ? configOrOptions : {};
235
235
  if ("cloudflare" in optionObject) {
236
- logWarning(
237
- "The `cloudflare` option was removed in v2. Use `nitro: false` to disable the deploy plugin, or `nitro: { preset: '...' }` to configure it. The `cloudflare` setting is being ignored."
238
- );
236
+ if (optionObject.cloudflare === false && !("nitro" in optionObject)) {
237
+ optionObject.nitro = false;
238
+ logWarning(
239
+ "`cloudflare: false` is deprecated in v2 \u2014 migrated to `nitro: false`. Update your config to drop the warning."
240
+ );
241
+ } else {
242
+ logWarning(
243
+ "The `cloudflare` option was removed in v2. Use `nitro: false` to disable the deploy plugin, or `nitro: { preset: '...' }` to configure it. The `cloudflare` setting is being ignored."
244
+ );
245
+ }
239
246
  }
240
247
  const hasLovableKey = "vite" in optionObject || "serverFnErrorLogger" in optionObject || "ssrErrorLogger" in optionObject || "nitro" in optionObject || "tanstackStart" in optionObject || "react" in optionObject || "envDefine" in optionObject || "hmrGate" in optionObject;
241
248
  options = hasLovableKey ? optionObject : { vite: optionObject };
@@ -263,12 +270,24 @@ function defineConfig(configOrOptions = {}) {
263
270
  };
264
271
  const tanstackStartOptions = mergeConfig(tanstackStartDefaults, options.tanstackStart ?? {});
265
272
  internalPlugins.push(tanstackStart(tanstackStartOptions));
266
- if (options.nitro !== false && command === "build") {
273
+ const explicitNitro = options.nitro === true || typeof options.nitro === "object" && options.nitro !== null;
274
+ const shouldRunNitro = options.nitro !== false && command === "build" && (explicitNitro || isSandbox);
275
+ if (options.nitro === void 0 && command === "build" && !isSandbox) {
276
+ console.info(
277
+ "[@lovable.dev/vite-tanstack-config] No Lovable context detected \u2014 skipping nitro deploy plugin. Pass `nitro: true` (or `nitro: { ... }`) to force-enable."
278
+ );
279
+ }
280
+ if (shouldRunNitro) {
267
281
  try {
268
282
  const { nitro } = await import("nitro/vite");
269
283
  const userNitroOpts = typeof options.nitro === "object" && options.nitro ? options.nitro : {};
270
284
  const preset = userNitroOpts.preset ?? process.env.NITRO_PRESET ?? "cloudflare-module";
271
- const output = { dir: "dist", ...userNitroOpts.output ?? {} };
285
+ const output = {
286
+ dir: "dist",
287
+ serverDir: "dist/server",
288
+ publicDir: "dist/client",
289
+ ...userNitroOpts.output
290
+ };
272
291
  internalPlugins.push(nitro({ ...userNitroOpts, preset, output }));
273
292
  } catch {
274
293
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lovable.dev/vite-tanstack-config",
3
- "version": "2.0.0-rc.1",
3
+ "version": "2.0.0",
4
4
  "description": "Vite config wrapper for Lovable TanStack Start projects",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
@@ -9,6 +9,15 @@
9
9
  "files": [
10
10
  "dist"
11
11
  ],
12
+ "scripts": {
13
+ "build": "tsup src/index.ts --format cjs,esm --dts --outDir dist",
14
+ "typecheck": "tsgo --noEmit",
15
+ "dev": "tsup src/index.ts --format cjs,esm --dts --watch",
16
+ "test": "vitest",
17
+ "prepublishOnly": "npm run clean && npm run build",
18
+ "clean": "rimraf dist",
19
+ "coverage": "vitest run --coverage"
20
+ },
12
21
  "keywords": [
13
22
  "vite",
14
23
  "tanstack",
@@ -39,20 +48,12 @@
39
48
  "@tanstack/react-start": "^1.162.9",
40
49
  "@vitejs/plugin-react": "^4.5.2",
41
50
  "@tailwindcss/vite": "^4.2.1",
42
- "@types/node": "22.13.13",
51
+ "@types/node": "catalog:",
43
52
  "rimraf": "^5.0.0",
44
53
  "tsup": "^7.2.0",
45
- "typescript": "^5.9.3",
54
+ "typescript": "catalog:",
46
55
  "vite": "^7.3.1",
47
56
  "vite-tsconfig-paths": "^6.0.2",
48
- "vitest": "^4.1.5"
49
- },
50
- "scripts": {
51
- "build": "tsup src/index.ts --format cjs,esm --dts --outDir dist",
52
- "typecheck": "tsgo --noEmit",
53
- "dev": "tsup src/index.ts --format cjs,esm --dts --watch",
54
- "test": "vitest",
55
- "clean": "rimraf dist",
56
- "coverage": "vitest run --coverage"
57
+ "vitest": "catalog:"
57
58
  }
58
- }
59
+ }