@lovable.dev/vite-tanstack-config 2.0.0-rc.2 → 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 +19 -5
- package/dist/index.d.cts +17 -7
- package/dist/index.d.ts +17 -7
- package/dist/index.js +19 -5
- package/package.json +14 -13
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
|
-
|
|
271
|
-
|
|
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,7 +304,14 @@ function defineConfig(configOrOptions = {}) {
|
|
|
297
304
|
};
|
|
298
305
|
const tanstackStartOptions = (0, import_vite.mergeConfig)(tanstackStartDefaults, options.tanstackStart ?? {});
|
|
299
306
|
internalPlugins.push(tanstackStart(tanstackStartOptions));
|
|
300
|
-
|
|
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 : {};
|
|
@@ -306,7 +320,7 @@ function defineConfig(configOrOptions = {}) {
|
|
|
306
320
|
dir: "dist",
|
|
307
321
|
serverDir: "dist/server",
|
|
308
322
|
publicDir: "dist/client",
|
|
309
|
-
...userNitroOpts.output
|
|
323
|
+
...userNitroOpts.output
|
|
310
324
|
};
|
|
311
325
|
internalPlugins.push(nitro({ ...userNitroOpts, preset, output }));
|
|
312
326
|
} catch {
|
package/dist/index.d.cts
CHANGED
|
@@ -6,15 +6,25 @@ interface LovableViteTanstackOptions {
|
|
|
6
6
|
serverFnErrorLogger?: boolean;
|
|
7
7
|
ssrErrorLogger?: boolean;
|
|
8
8
|
/**
|
|
9
|
-
* Options forwarded to `nitro()` from `nitro/vite`.
|
|
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
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
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;
|
package/dist/index.d.ts
CHANGED
|
@@ -6,15 +6,25 @@ interface LovableViteTanstackOptions {
|
|
|
6
6
|
serverFnErrorLogger?: boolean;
|
|
7
7
|
ssrErrorLogger?: boolean;
|
|
8
8
|
/**
|
|
9
|
-
* Options forwarded to `nitro()` from `nitro/vite`.
|
|
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
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
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;
|
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
|
-
|
|
237
|
-
|
|
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,7 +270,14 @@ function defineConfig(configOrOptions = {}) {
|
|
|
263
270
|
};
|
|
264
271
|
const tanstackStartOptions = mergeConfig(tanstackStartDefaults, options.tanstackStart ?? {});
|
|
265
272
|
internalPlugins.push(tanstackStart(tanstackStartOptions));
|
|
266
|
-
|
|
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 : {};
|
|
@@ -272,7 +286,7 @@ function defineConfig(configOrOptions = {}) {
|
|
|
272
286
|
dir: "dist",
|
|
273
287
|
serverDir: "dist/server",
|
|
274
288
|
publicDir: "dist/client",
|
|
275
|
-
...userNitroOpts.output
|
|
289
|
+
...userNitroOpts.output
|
|
276
290
|
};
|
|
277
291
|
internalPlugins.push(nitro({ ...userNitroOpts, preset, output }));
|
|
278
292
|
} catch {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lovable.dev/vite-tanstack-config",
|
|
3
|
-
"version": "2.0.0
|
|
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": "
|
|
51
|
+
"@types/node": "catalog:",
|
|
43
52
|
"rimraf": "^5.0.0",
|
|
44
53
|
"tsup": "^7.2.0",
|
|
45
|
-
"typescript": "
|
|
54
|
+
"typescript": "catalog:",
|
|
46
55
|
"vite": "^7.3.1",
|
|
47
56
|
"vite-tsconfig-paths": "^6.0.2",
|
|
48
|
-
"vitest": "
|
|
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
|
+
}
|