@lovable.dev/vite-tanstack-config 1.1.0 → 1.2.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 +25 -5
- package/dist/index.d.cts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +26 -6
- package/package.json +6 -2
package/dist/index.cjs
CHANGED
|
@@ -258,7 +258,7 @@ function defineConfig(configOrOptions = {}) {
|
|
|
258
258
|
} else if (configOrOptions instanceof Promise) {
|
|
259
259
|
options = { vite: await configOrOptions };
|
|
260
260
|
} else {
|
|
261
|
-
const hasLovableKey = "vite" in configOrOptions || "clientErrorLogger" in configOrOptions || "serverFnErrorLogger" in configOrOptions || "cloudflare" in configOrOptions;
|
|
261
|
+
const hasLovableKey = "vite" in configOrOptions || "clientErrorLogger" in configOrOptions || "serverFnErrorLogger" in configOrOptions || "cloudflare" in configOrOptions || "tanstackStart" in configOrOptions || "react" in configOrOptions || "envDefine" in configOrOptions;
|
|
262
262
|
options = hasLovableKey ? configOrOptions : { vite: configOrOptions };
|
|
263
263
|
}
|
|
264
264
|
const internalPlugins = [];
|
|
@@ -266,9 +266,6 @@ function defineConfig(configOrOptions = {}) {
|
|
|
266
266
|
internalPlugins.push(tailwindcss());
|
|
267
267
|
const tsConfigPaths = (await import("vite-tsconfig-paths")).default;
|
|
268
268
|
internalPlugins.push(tsConfigPaths({ projects: ["./tsconfig.json"] }));
|
|
269
|
-
if (command === "serve" && mode === "development") {
|
|
270
|
-
internalPlugins.push((0, import_lovable_tagger.componentTagger)());
|
|
271
|
-
}
|
|
272
269
|
if (options.clientErrorLogger !== false) {
|
|
273
270
|
internalPlugins.push(devClientErrorLogger());
|
|
274
271
|
}
|
|
@@ -285,11 +282,34 @@ function defineConfig(configOrOptions = {}) {
|
|
|
285
282
|
} catch {
|
|
286
283
|
}
|
|
287
284
|
}
|
|
285
|
+
const { tanstackStart } = await import("@tanstack/react-start/plugin/vite");
|
|
286
|
+
internalPlugins.push(tanstackStart(options.tanstackStart));
|
|
287
|
+
const viteReact = (await import("@vitejs/plugin-react")).default;
|
|
288
|
+
internalPlugins.push(viteReact(options.react));
|
|
289
|
+
if (command === "serve" && mode === "development") {
|
|
290
|
+
internalPlugins.push((0, import_lovable_tagger.componentTagger)());
|
|
291
|
+
}
|
|
292
|
+
let envDefine = {};
|
|
293
|
+
if (options.envDefine !== false) {
|
|
294
|
+
const loadedEnv = (0, import_vite.loadEnv)(mode, process.cwd(), "VITE_");
|
|
295
|
+
for (const [key, value] of Object.entries(loadedEnv)) {
|
|
296
|
+
envDefine[`import.meta.env.${key}`] = JSON.stringify(value);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
288
299
|
let config = {
|
|
300
|
+
define: envDefine,
|
|
289
301
|
resolve: {
|
|
290
302
|
alias: {
|
|
291
303
|
"@": `${process.cwd()}/src`
|
|
292
|
-
}
|
|
304
|
+
},
|
|
305
|
+
dedupe: [
|
|
306
|
+
"react",
|
|
307
|
+
"react-dom",
|
|
308
|
+
"react/jsx-runtime",
|
|
309
|
+
"react/jsx-dev-runtime",
|
|
310
|
+
"@tanstack/react-query",
|
|
311
|
+
"@tanstack/query-core"
|
|
312
|
+
]
|
|
293
313
|
},
|
|
294
314
|
plugins: [...internalPlugins, ...options.plugins ?? []]
|
|
295
315
|
};
|
package/dist/index.d.cts
CHANGED
|
@@ -6,6 +6,12 @@ interface LovableViteTanstackOptions {
|
|
|
6
6
|
clientErrorLogger?: boolean;
|
|
7
7
|
serverFnErrorLogger?: boolean;
|
|
8
8
|
cloudflare?: Record<string, unknown> | false;
|
|
9
|
+
/** Options forwarded to tanstackStart(). */
|
|
10
|
+
tanstackStart?: Record<string, unknown>;
|
|
11
|
+
/** Options forwarded to viteReact(). */
|
|
12
|
+
react?: Record<string, unknown>;
|
|
13
|
+
/** Set to false to disable automatic VITE_* env define injection. Default: true. */
|
|
14
|
+
envDefine?: boolean;
|
|
9
15
|
}
|
|
10
16
|
declare function defineConfig(config: UserConfig): (env: ConfigEnv) => Promise<UserConfig>;
|
|
11
17
|
declare function defineConfig(config: Promise<UserConfig>): (env: ConfigEnv) => Promise<UserConfig>;
|
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,12 @@ interface LovableViteTanstackOptions {
|
|
|
6
6
|
clientErrorLogger?: boolean;
|
|
7
7
|
serverFnErrorLogger?: boolean;
|
|
8
8
|
cloudflare?: Record<string, unknown> | false;
|
|
9
|
+
/** Options forwarded to tanstackStart(). */
|
|
10
|
+
tanstackStart?: Record<string, unknown>;
|
|
11
|
+
/** Options forwarded to viteReact(). */
|
|
12
|
+
react?: Record<string, unknown>;
|
|
13
|
+
/** Set to false to disable automatic VITE_* env define injection. Default: true. */
|
|
14
|
+
envDefine?: boolean;
|
|
9
15
|
}
|
|
10
16
|
declare function defineConfig(config: UserConfig): (env: ConfigEnv) => Promise<UserConfig>;
|
|
11
17
|
declare function defineConfig(config: Promise<UserConfig>): (env: ConfigEnv) => Promise<UserConfig>;
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
2
|
import { componentTagger } from "lovable-tagger";
|
|
3
|
-
import { mergeConfig } from "vite";
|
|
3
|
+
import { mergeConfig, loadEnv } from "vite";
|
|
4
4
|
var SANDBOX_ENV_VAR = "DEV_SERVER__PROJECT_PATH";
|
|
5
5
|
var LOVABLE_SANDBOX_ENV_VAR = "LOVABLE_SANDBOX";
|
|
6
6
|
function isSandboxEnvironment() {
|
|
@@ -224,7 +224,7 @@ function defineConfig(configOrOptions = {}) {
|
|
|
224
224
|
} else if (configOrOptions instanceof Promise) {
|
|
225
225
|
options = { vite: await configOrOptions };
|
|
226
226
|
} else {
|
|
227
|
-
const hasLovableKey = "vite" in configOrOptions || "clientErrorLogger" in configOrOptions || "serverFnErrorLogger" in configOrOptions || "cloudflare" in configOrOptions;
|
|
227
|
+
const hasLovableKey = "vite" in configOrOptions || "clientErrorLogger" in configOrOptions || "serverFnErrorLogger" in configOrOptions || "cloudflare" in configOrOptions || "tanstackStart" in configOrOptions || "react" in configOrOptions || "envDefine" in configOrOptions;
|
|
228
228
|
options = hasLovableKey ? configOrOptions : { vite: configOrOptions };
|
|
229
229
|
}
|
|
230
230
|
const internalPlugins = [];
|
|
@@ -232,9 +232,6 @@ function defineConfig(configOrOptions = {}) {
|
|
|
232
232
|
internalPlugins.push(tailwindcss());
|
|
233
233
|
const tsConfigPaths = (await import("vite-tsconfig-paths")).default;
|
|
234
234
|
internalPlugins.push(tsConfigPaths({ projects: ["./tsconfig.json"] }));
|
|
235
|
-
if (command === "serve" && mode === "development") {
|
|
236
|
-
internalPlugins.push(componentTagger());
|
|
237
|
-
}
|
|
238
235
|
if (options.clientErrorLogger !== false) {
|
|
239
236
|
internalPlugins.push(devClientErrorLogger());
|
|
240
237
|
}
|
|
@@ -251,11 +248,34 @@ function defineConfig(configOrOptions = {}) {
|
|
|
251
248
|
} catch {
|
|
252
249
|
}
|
|
253
250
|
}
|
|
251
|
+
const { tanstackStart } = await import("@tanstack/react-start/plugin/vite");
|
|
252
|
+
internalPlugins.push(tanstackStart(options.tanstackStart));
|
|
253
|
+
const viteReact = (await import("@vitejs/plugin-react")).default;
|
|
254
|
+
internalPlugins.push(viteReact(options.react));
|
|
255
|
+
if (command === "serve" && mode === "development") {
|
|
256
|
+
internalPlugins.push(componentTagger());
|
|
257
|
+
}
|
|
258
|
+
let envDefine = {};
|
|
259
|
+
if (options.envDefine !== false) {
|
|
260
|
+
const loadedEnv = loadEnv(mode, process.cwd(), "VITE_");
|
|
261
|
+
for (const [key, value] of Object.entries(loadedEnv)) {
|
|
262
|
+
envDefine[`import.meta.env.${key}`] = JSON.stringify(value);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
254
265
|
let config = {
|
|
266
|
+
define: envDefine,
|
|
255
267
|
resolve: {
|
|
256
268
|
alias: {
|
|
257
269
|
"@": `${process.cwd()}/src`
|
|
258
|
-
}
|
|
270
|
+
},
|
|
271
|
+
dedupe: [
|
|
272
|
+
"react",
|
|
273
|
+
"react-dom",
|
|
274
|
+
"react/jsx-runtime",
|
|
275
|
+
"react/jsx-dev-runtime",
|
|
276
|
+
"@tanstack/react-query",
|
|
277
|
+
"@tanstack/query-core"
|
|
278
|
+
]
|
|
259
279
|
},
|
|
260
280
|
plugins: [...internalPlugins, ...options.plugins ?? []]
|
|
261
281
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lovable.dev/vite-tanstack-config",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Vite config wrapper for Lovable TanStack Start projects",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -32,7 +32,9 @@
|
|
|
32
32
|
"vite": ">=5.0.0 <9.0.0",
|
|
33
33
|
"@tailwindcss/vite": ">=4.0.0",
|
|
34
34
|
"vite-tsconfig-paths": ">=6.0.0",
|
|
35
|
-
"@cloudflare/vite-plugin": ">=1.0.0"
|
|
35
|
+
"@cloudflare/vite-plugin": ">=1.0.0",
|
|
36
|
+
"@tanstack/react-start": ">=1.100.0",
|
|
37
|
+
"@vitejs/plugin-react": ">=4.0.0"
|
|
36
38
|
},
|
|
37
39
|
"peerDependenciesMeta": {
|
|
38
40
|
"@cloudflare/vite-plugin": {
|
|
@@ -41,6 +43,8 @@
|
|
|
41
43
|
},
|
|
42
44
|
"devDependencies": {
|
|
43
45
|
"@cloudflare/vite-plugin": "^1.25.5",
|
|
46
|
+
"@tanstack/react-start": "^1.162.9",
|
|
47
|
+
"@vitejs/plugin-react": "^4.5.2",
|
|
44
48
|
"@tailwindcss/vite": "^4.2.1",
|
|
45
49
|
"@types/node": "catalog:",
|
|
46
50
|
"rimraf": "^5.0.0",
|