@lovable.dev/vite-tanstack-config 2.10.0 → 2.11.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 +42 -12
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +42 -12
- package/package.json +3 -2
- package/runtime/fetch-entry.mjs +9 -0
package/dist/index.cjs
CHANGED
|
@@ -21,6 +21,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
21
21
|
enumerable: true
|
|
22
22
|
}) : target, mod));
|
|
23
23
|
//#endregion
|
|
24
|
+
let node_url = require("node:url");
|
|
24
25
|
let vite = require("vite");
|
|
25
26
|
let node_https = require("node:https");
|
|
26
27
|
node_https = __toESM(node_https, 1);
|
|
@@ -187,6 +188,20 @@ async function nitroSupportsDefaultPreset() {
|
|
|
187
188
|
return true;
|
|
188
189
|
}
|
|
189
190
|
}
|
|
191
|
+
const LOVABLE_NITRO_PRESETS = ["cloudflare-module", "lovable-fetch-bundle"];
|
|
192
|
+
function lovableFetchBundlePreset() {
|
|
193
|
+
return {
|
|
194
|
+
entry: (0, node_url.fileURLToPath)(new URL("../runtime/fetch-entry.mjs", require("url").pathToFileURL(__filename).href)),
|
|
195
|
+
serveStatic: false,
|
|
196
|
+
noExternals: true,
|
|
197
|
+
inlineDynamicImports: true,
|
|
198
|
+
output: {
|
|
199
|
+
dir: "dist",
|
|
200
|
+
serverDir: "{{ output.dir }}/server",
|
|
201
|
+
publicDir: "{{ output.dir }}/client"
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
}
|
|
190
205
|
function validateHeaders(config) {
|
|
191
206
|
const headers = config.server?.headers;
|
|
192
207
|
if (!headers) return;
|
|
@@ -665,18 +680,33 @@ function defineConfig(configOrOptions = {}) {
|
|
|
665
680
|
...userNitroOpts
|
|
666
681
|
};
|
|
667
682
|
if (isSandbox) {
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
683
|
+
for (const envVar of ["NITRO_PRESET", "SERVER_PRESET"]) if (process.env[envVar]) {
|
|
684
|
+
logWarning(`Ignoring ${envVar} inside the Lovable build environment.`);
|
|
685
|
+
delete process.env[envVar];
|
|
686
|
+
}
|
|
687
|
+
const requestedPreset = process.env.LOVABLE_NITRO_PRESET;
|
|
688
|
+
if (requestedPreset && !LOVABLE_NITRO_PRESETS.includes(requestedPreset)) logWarning(`Ignoring unknown LOVABLE_NITRO_PRESET "${requestedPreset}"; building for cloudflare-module.`);
|
|
689
|
+
if (requestedPreset === "lovable-fetch-bundle") {
|
|
690
|
+
if (!await nitroSupportsDefaultPreset()) throw new Error("[@lovable.dev/vite-tanstack-config] LOVABLE_NITRO_PRESET=lovable-fetch-bundle requires nitro >=3.0.260603-beta.");
|
|
691
|
+
nitroOpts.preset = "";
|
|
692
|
+
delete nitroOpts.cloudflare;
|
|
693
|
+
const fetchBundle = lovableFetchBundlePreset();
|
|
694
|
+
nitroOpts.defaultPreset = fetchBundle;
|
|
695
|
+
Object.assign(nitroOpts, fetchBundle);
|
|
696
|
+
} else {
|
|
697
|
+
delete nitroOpts.defaultPreset;
|
|
698
|
+
nitroOpts.preset = "cloudflare-module";
|
|
699
|
+
nitroOpts.output = {
|
|
700
|
+
dir: "dist",
|
|
701
|
+
serverDir: "dist/server",
|
|
702
|
+
publicDir: "dist/client"
|
|
703
|
+
};
|
|
704
|
+
nitroOpts.cloudflare = {
|
|
705
|
+
nodeCompat: true,
|
|
706
|
+
deployConfig: true,
|
|
707
|
+
...userNitroOpts.cloudflare
|
|
708
|
+
};
|
|
709
|
+
}
|
|
680
710
|
} else if (!nitroOpts.preset && !await nitroSupportsDefaultPreset()) logWarning("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\" }`.");
|
|
681
711
|
internalPlugins.push(nitro(nitroOpts));
|
|
682
712
|
if (isSandbox) internalPlugins.push(stripRedundantNodejsCompatFlag());
|
package/dist/index.d.cts
CHANGED
|
@@ -33,8 +33,8 @@ interface LovableViteTanstackOptions {
|
|
|
33
33
|
* (e.g. `{ preset: "vercel" }`) to hard-pin a target from your own CI.
|
|
34
34
|
* - **`false`**: skip nitro entirely.
|
|
35
35
|
*
|
|
36
|
-
* Inside a Lovable build
|
|
37
|
-
*
|
|
36
|
+
* Inside a Lovable build `LOVABLE_NITRO_PRESET` (Cloudflare by default) pins
|
|
37
|
+
* the preset and output layout; overrides here apply only outside it.
|
|
38
38
|
*
|
|
39
39
|
* The option surface is narrow on purpose — Nitro v3 is still pre-RC, so
|
|
40
40
|
* we only expose stable build-time knobs to reduce churn if
|
package/dist/index.d.ts
CHANGED
|
@@ -33,8 +33,8 @@ interface LovableViteTanstackOptions {
|
|
|
33
33
|
* (e.g. `{ preset: "vercel" }`) to hard-pin a target from your own CI.
|
|
34
34
|
* - **`false`**: skip nitro entirely.
|
|
35
35
|
*
|
|
36
|
-
* Inside a Lovable build
|
|
37
|
-
*
|
|
36
|
+
* Inside a Lovable build `LOVABLE_NITRO_PRESET` (Cloudflare by default) pins
|
|
37
|
+
* the preset and output layout; overrides here apply only outside it.
|
|
38
38
|
*
|
|
39
39
|
* The option surface is narrow on purpose — Nitro v3 is still pre-RC, so
|
|
40
40
|
* we only expose stable build-time knobs to reduce churn if
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { fileURLToPath } from "node:url";
|
|
1
2
|
import { loadEnv, mergeConfig } from "vite";
|
|
2
3
|
import https from "node:https";
|
|
3
4
|
//#region src/assetsProxyPlugin.ts
|
|
@@ -163,6 +164,20 @@ async function nitroSupportsDefaultPreset() {
|
|
|
163
164
|
return true;
|
|
164
165
|
}
|
|
165
166
|
}
|
|
167
|
+
const LOVABLE_NITRO_PRESETS = ["cloudflare-module", "lovable-fetch-bundle"];
|
|
168
|
+
function lovableFetchBundlePreset() {
|
|
169
|
+
return {
|
|
170
|
+
entry: fileURLToPath(new URL("../runtime/fetch-entry.mjs", import.meta.url)),
|
|
171
|
+
serveStatic: false,
|
|
172
|
+
noExternals: true,
|
|
173
|
+
inlineDynamicImports: true,
|
|
174
|
+
output: {
|
|
175
|
+
dir: "dist",
|
|
176
|
+
serverDir: "{{ output.dir }}/server",
|
|
177
|
+
publicDir: "{{ output.dir }}/client"
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
}
|
|
166
181
|
function validateHeaders(config) {
|
|
167
182
|
const headers = config.server?.headers;
|
|
168
183
|
if (!headers) return;
|
|
@@ -641,18 +656,33 @@ function defineConfig(configOrOptions = {}) {
|
|
|
641
656
|
...userNitroOpts
|
|
642
657
|
};
|
|
643
658
|
if (isSandbox) {
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
659
|
+
for (const envVar of ["NITRO_PRESET", "SERVER_PRESET"]) if (process.env[envVar]) {
|
|
660
|
+
logWarning(`Ignoring ${envVar} inside the Lovable build environment.`);
|
|
661
|
+
delete process.env[envVar];
|
|
662
|
+
}
|
|
663
|
+
const requestedPreset = process.env.LOVABLE_NITRO_PRESET;
|
|
664
|
+
if (requestedPreset && !LOVABLE_NITRO_PRESETS.includes(requestedPreset)) logWarning(`Ignoring unknown LOVABLE_NITRO_PRESET "${requestedPreset}"; building for cloudflare-module.`);
|
|
665
|
+
if (requestedPreset === "lovable-fetch-bundle") {
|
|
666
|
+
if (!await nitroSupportsDefaultPreset()) throw new Error("[@lovable.dev/vite-tanstack-config] LOVABLE_NITRO_PRESET=lovable-fetch-bundle requires nitro >=3.0.260603-beta.");
|
|
667
|
+
nitroOpts.preset = "";
|
|
668
|
+
delete nitroOpts.cloudflare;
|
|
669
|
+
const fetchBundle = lovableFetchBundlePreset();
|
|
670
|
+
nitroOpts.defaultPreset = fetchBundle;
|
|
671
|
+
Object.assign(nitroOpts, fetchBundle);
|
|
672
|
+
} else {
|
|
673
|
+
delete nitroOpts.defaultPreset;
|
|
674
|
+
nitroOpts.preset = "cloudflare-module";
|
|
675
|
+
nitroOpts.output = {
|
|
676
|
+
dir: "dist",
|
|
677
|
+
serverDir: "dist/server",
|
|
678
|
+
publicDir: "dist/client"
|
|
679
|
+
};
|
|
680
|
+
nitroOpts.cloudflare = {
|
|
681
|
+
nodeCompat: true,
|
|
682
|
+
deployConfig: true,
|
|
683
|
+
...userNitroOpts.cloudflare
|
|
684
|
+
};
|
|
685
|
+
}
|
|
656
686
|
} else if (!nitroOpts.preset && !await nitroSupportsDefaultPreset()) logWarning("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\" }`.");
|
|
657
687
|
internalPlugins.push(nitro(nitroOpts));
|
|
658
688
|
if (isSandbox) internalPlugins.push(stripRedundantNodejsCompatFlag());
|
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lovable.dev/vite-tanstack-config",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.11.0",
|
|
4
4
|
"description": "Vite config wrapper for Lovable TanStack Start projects",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.js",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"files": [
|
|
10
|
-
"dist"
|
|
10
|
+
"dist",
|
|
11
|
+
"runtime"
|
|
11
12
|
],
|
|
12
13
|
"keywords": [
|
|
13
14
|
"vite",
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// The #nitro virtual import and nitro/app resolve inside nitro's rolldown build, not in this package.
|
|
2
|
+
import "#nitro/virtual/polyfills";
|
|
3
|
+
import { useNitroApp } from "nitro/app";
|
|
4
|
+
|
|
5
|
+
const nitroApp = useNitroApp();
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
fetch: (request) => nitroApp.fetch(request),
|
|
9
|
+
};
|