@lovable.dev/vite-tanstack-config 2.19.4 → 2.19.5
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 +23 -15
- package/dist/index.d.cts +12 -1
- package/dist/index.d.ts +12 -1
- package/dist/index.js +23 -15
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -153,7 +153,7 @@ function bundledDevCssUrlShim() {
|
|
|
153
153
|
//#endregion
|
|
154
154
|
//#region package.json
|
|
155
155
|
var name = "@lovable.dev/vite-tanstack-config";
|
|
156
|
-
var version = "2.19.
|
|
156
|
+
var version = "2.19.5";
|
|
157
157
|
//#endregion
|
|
158
158
|
//#region src/logging.ts
|
|
159
159
|
const PACKAGE_NAME = "@lovable.dev/vite-tanstack-config";
|
|
@@ -732,9 +732,14 @@ function lovableBuildErrorDiagnostics() {
|
|
|
732
732
|
}
|
|
733
733
|
};
|
|
734
734
|
}
|
|
735
|
+
function nitroEmitDirs(dirs) {
|
|
736
|
+
if (!dirs) return [SERVER_OUTPUT_DIR];
|
|
737
|
+
const found = [dirs.nitroOutput.serverDir, ...dirs.entryDirs].filter((dir) => !!dir);
|
|
738
|
+
return [...new Set(found)];
|
|
739
|
+
}
|
|
735
740
|
const NODEJS_COMPAT_DEFAULT_ON_DATE = "2026-08-04";
|
|
736
|
-
const
|
|
737
|
-
function stripRedundantNodejsCompatFlag() {
|
|
741
|
+
const NITRO_WRANGLER_CONFIG = "wrangler.json";
|
|
742
|
+
function stripRedundantNodejsCompatFlag(dirs) {
|
|
738
743
|
let root = process.cwd();
|
|
739
744
|
return {
|
|
740
745
|
name: "lovable-strip-redundant-nodejs-compat",
|
|
@@ -746,13 +751,18 @@ function stripRedundantNodejsCompatFlag() {
|
|
|
746
751
|
order: "post",
|
|
747
752
|
handler: async () => {
|
|
748
753
|
const { readFile, writeFile } = await import("node:fs/promises");
|
|
749
|
-
|
|
754
|
+
let configPath;
|
|
750
755
|
let parsed;
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
756
|
+
for (const dir of nitroEmitDirs(dirs)) {
|
|
757
|
+
configPath = (0, node_path.join)((0, node_path.resolve)(root, dir), NITRO_WRANGLER_CONFIG);
|
|
758
|
+
try {
|
|
759
|
+
parsed = JSON.parse(await readFile(configPath, "utf8"));
|
|
760
|
+
break;
|
|
761
|
+
} catch {
|
|
762
|
+
configPath = void 0;
|
|
763
|
+
}
|
|
755
764
|
}
|
|
765
|
+
if (configPath === void 0) return;
|
|
756
766
|
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) return;
|
|
757
767
|
const config = parsed;
|
|
758
768
|
if (typeof config.compatibility_date !== "string") return;
|
|
@@ -771,7 +781,6 @@ function stripRedundantNodejsCompatFlag() {
|
|
|
771
781
|
const NITRO_SERVER_ENTRY = "index.mjs";
|
|
772
782
|
const NITRO_DEFAULT_OUTPUT_DIR = ".output";
|
|
773
783
|
const VITE_DEFAULT_OUTPUT_DIR = "dist";
|
|
774
|
-
const NITRO_WRANGLER_CONFIG = "wrangler.json";
|
|
775
784
|
const DEFAULT_SERVER_ENTRY_NAME = "server";
|
|
776
785
|
const PRERENDER_PREVIEW_HOST = "127.0.0.1";
|
|
777
786
|
const TSS_PRERENDERING_ENV = "TSS_PRERENDERING";
|
|
@@ -859,8 +868,7 @@ function prerenderPreviewShim(state, dirs) {
|
|
|
859
868
|
return false;
|
|
860
869
|
}
|
|
861
870
|
};
|
|
862
|
-
const
|
|
863
|
-
const candidates = [...new Set(found)];
|
|
871
|
+
const candidates = nitroEmitDirs(dirs);
|
|
864
872
|
let entryDir;
|
|
865
873
|
for (const candidate of candidates) {
|
|
866
874
|
const resolved = (0, node_path.resolve)(root, candidate);
|
|
@@ -1154,13 +1162,13 @@ function defineConfig(configOrOptions = {}) {
|
|
|
1154
1162
|
};
|
|
1155
1163
|
}
|
|
1156
1164
|
} 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\" }`.");
|
|
1157
|
-
const
|
|
1165
|
+
const nitroDirs = prerenderEnabled || isSandbox ? prerenderShimDirs(options.vite, nitroOpts) : void 0;
|
|
1158
1166
|
internalPlugins.push(nitro(nitroOpts));
|
|
1159
|
-
if (
|
|
1167
|
+
if (prerenderEnabled && nitroDirs) {
|
|
1160
1168
|
const shimState = {};
|
|
1161
|
-
internalPlugins.push(prerenderPreviewShim(shimState,
|
|
1169
|
+
internalPlugins.push(prerenderPreviewShim(shimState, nitroDirs), prerenderPreviewShimCleanup(shimState));
|
|
1162
1170
|
}
|
|
1163
|
-
if (isSandbox) internalPlugins.push(stripRedundantNodejsCompatFlag());
|
|
1171
|
+
if (isSandbox) internalPlugins.push(stripRedundantNodejsCompatFlag(nitroDirs));
|
|
1164
1172
|
}
|
|
1165
1173
|
}
|
|
1166
1174
|
const viteReact = (await import("@vitejs/plugin-react")).default;
|
package/dist/index.d.cts
CHANGED
|
@@ -18,7 +18,18 @@ type PrerenderPage = {
|
|
|
18
18
|
};
|
|
19
19
|
//#endregion
|
|
20
20
|
//#region src/index.d.ts
|
|
21
|
-
declare function stripRedundantNodejsCompatFlag(): Plugin;
|
|
21
|
+
declare function stripRedundantNodejsCompatFlag(dirs?: PrerenderShimDirs): Plugin;
|
|
22
|
+
type NitroOutput = {
|
|
23
|
+
serverDir?: string;
|
|
24
|
+
};
|
|
25
|
+
type PrerenderShimDirs = {
|
|
26
|
+
/** Where upstream's preview middleware imports the server build from. */
|
|
27
|
+
shimDir: string;
|
|
28
|
+
/** Ordered fallbacks for the directory nitro emitted its entry into. */
|
|
29
|
+
entryDirs: string[];
|
|
30
|
+
/** Filled by nitro's `compiled` hook, which fires inside its own post-order `buildApp`. */
|
|
31
|
+
nitroOutput: NitroOutput;
|
|
32
|
+
};
|
|
22
33
|
interface LovableViteTanstackOptions {
|
|
23
34
|
plugins?: PluginOption[];
|
|
24
35
|
vite?: UserConfig;
|
package/dist/index.d.ts
CHANGED
|
@@ -18,7 +18,18 @@ type PrerenderPage = {
|
|
|
18
18
|
};
|
|
19
19
|
//#endregion
|
|
20
20
|
//#region src/index.d.ts
|
|
21
|
-
declare function stripRedundantNodejsCompatFlag(): Plugin;
|
|
21
|
+
declare function stripRedundantNodejsCompatFlag(dirs?: PrerenderShimDirs): Plugin;
|
|
22
|
+
type NitroOutput = {
|
|
23
|
+
serverDir?: string;
|
|
24
|
+
};
|
|
25
|
+
type PrerenderShimDirs = {
|
|
26
|
+
/** Where upstream's preview middleware imports the server build from. */
|
|
27
|
+
shimDir: string;
|
|
28
|
+
/** Ordered fallbacks for the directory nitro emitted its entry into. */
|
|
29
|
+
entryDirs: string[];
|
|
30
|
+
/** Filled by nitro's `compiled` hook, which fires inside its own post-order `buildApp`. */
|
|
31
|
+
nitroOutput: NitroOutput;
|
|
32
|
+
};
|
|
22
33
|
interface LovableViteTanstackOptions {
|
|
23
34
|
plugins?: PluginOption[];
|
|
24
35
|
vite?: UserConfig;
|
package/dist/index.js
CHANGED
|
@@ -129,7 +129,7 @@ function bundledDevCssUrlShim() {
|
|
|
129
129
|
//#endregion
|
|
130
130
|
//#region package.json
|
|
131
131
|
var name = "@lovable.dev/vite-tanstack-config";
|
|
132
|
-
var version = "2.19.
|
|
132
|
+
var version = "2.19.5";
|
|
133
133
|
//#endregion
|
|
134
134
|
//#region src/logging.ts
|
|
135
135
|
const PACKAGE_NAME = "@lovable.dev/vite-tanstack-config";
|
|
@@ -708,9 +708,14 @@ function lovableBuildErrorDiagnostics() {
|
|
|
708
708
|
}
|
|
709
709
|
};
|
|
710
710
|
}
|
|
711
|
+
function nitroEmitDirs(dirs) {
|
|
712
|
+
if (!dirs) return [SERVER_OUTPUT_DIR];
|
|
713
|
+
const found = [dirs.nitroOutput.serverDir, ...dirs.entryDirs].filter((dir) => !!dir);
|
|
714
|
+
return [...new Set(found)];
|
|
715
|
+
}
|
|
711
716
|
const NODEJS_COMPAT_DEFAULT_ON_DATE = "2026-08-04";
|
|
712
|
-
const
|
|
713
|
-
function stripRedundantNodejsCompatFlag() {
|
|
717
|
+
const NITRO_WRANGLER_CONFIG = "wrangler.json";
|
|
718
|
+
function stripRedundantNodejsCompatFlag(dirs) {
|
|
714
719
|
let root = process.cwd();
|
|
715
720
|
return {
|
|
716
721
|
name: "lovable-strip-redundant-nodejs-compat",
|
|
@@ -722,13 +727,18 @@ function stripRedundantNodejsCompatFlag() {
|
|
|
722
727
|
order: "post",
|
|
723
728
|
handler: async () => {
|
|
724
729
|
const { readFile, writeFile } = await import("node:fs/promises");
|
|
725
|
-
|
|
730
|
+
let configPath;
|
|
726
731
|
let parsed;
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
732
|
+
for (const dir of nitroEmitDirs(dirs)) {
|
|
733
|
+
configPath = join(resolve(root, dir), NITRO_WRANGLER_CONFIG);
|
|
734
|
+
try {
|
|
735
|
+
parsed = JSON.parse(await readFile(configPath, "utf8"));
|
|
736
|
+
break;
|
|
737
|
+
} catch {
|
|
738
|
+
configPath = void 0;
|
|
739
|
+
}
|
|
731
740
|
}
|
|
741
|
+
if (configPath === void 0) return;
|
|
732
742
|
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) return;
|
|
733
743
|
const config = parsed;
|
|
734
744
|
if (typeof config.compatibility_date !== "string") return;
|
|
@@ -747,7 +757,6 @@ function stripRedundantNodejsCompatFlag() {
|
|
|
747
757
|
const NITRO_SERVER_ENTRY = "index.mjs";
|
|
748
758
|
const NITRO_DEFAULT_OUTPUT_DIR = ".output";
|
|
749
759
|
const VITE_DEFAULT_OUTPUT_DIR = "dist";
|
|
750
|
-
const NITRO_WRANGLER_CONFIG = "wrangler.json";
|
|
751
760
|
const DEFAULT_SERVER_ENTRY_NAME = "server";
|
|
752
761
|
const PRERENDER_PREVIEW_HOST = "127.0.0.1";
|
|
753
762
|
const TSS_PRERENDERING_ENV = "TSS_PRERENDERING";
|
|
@@ -835,8 +844,7 @@ function prerenderPreviewShim(state, dirs) {
|
|
|
835
844
|
return false;
|
|
836
845
|
}
|
|
837
846
|
};
|
|
838
|
-
const
|
|
839
|
-
const candidates = [...new Set(found)];
|
|
847
|
+
const candidates = nitroEmitDirs(dirs);
|
|
840
848
|
let entryDir;
|
|
841
849
|
for (const candidate of candidates) {
|
|
842
850
|
const resolved = resolve(root, candidate);
|
|
@@ -1130,13 +1138,13 @@ function defineConfig(configOrOptions = {}) {
|
|
|
1130
1138
|
};
|
|
1131
1139
|
}
|
|
1132
1140
|
} 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\" }`.");
|
|
1133
|
-
const
|
|
1141
|
+
const nitroDirs = prerenderEnabled || isSandbox ? prerenderShimDirs(options.vite, nitroOpts) : void 0;
|
|
1134
1142
|
internalPlugins.push(nitro(nitroOpts));
|
|
1135
|
-
if (
|
|
1143
|
+
if (prerenderEnabled && nitroDirs) {
|
|
1136
1144
|
const shimState = {};
|
|
1137
|
-
internalPlugins.push(prerenderPreviewShim(shimState,
|
|
1145
|
+
internalPlugins.push(prerenderPreviewShim(shimState, nitroDirs), prerenderPreviewShimCleanup(shimState));
|
|
1138
1146
|
}
|
|
1139
|
-
if (isSandbox) internalPlugins.push(stripRedundantNodejsCompatFlag());
|
|
1147
|
+
if (isSandbox) internalPlugins.push(stripRedundantNodejsCompatFlag(nitroDirs));
|
|
1140
1148
|
}
|
|
1141
1149
|
}
|
|
1142
1150
|
const viteReact = (await import("@vitejs/plugin-react")).default;
|