@lovable.dev/vite-tanstack-config 0.0.1 → 1.1.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 +20 -4
- package/dist/index.d.cts +7 -5
- package/dist/index.d.ts +7 -5
- package/dist/index.js +20 -4
- package/package.json +4 -1
package/dist/index.cjs
CHANGED
|
@@ -33,6 +33,7 @@ __export(src_exports, {
|
|
|
33
33
|
defineConfig: () => defineConfig
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(src_exports);
|
|
36
|
+
var import_lovable_tagger = require("lovable-tagger");
|
|
36
37
|
var import_vite = require("vite");
|
|
37
38
|
var SANDBOX_ENV_VAR = "DEV_SERVER__PROJECT_PATH";
|
|
38
39
|
var LOVABLE_SANDBOX_ENV_VAR = "LOVABLE_SANDBOX";
|
|
@@ -71,9 +72,10 @@ function validateProxy(config) {
|
|
|
71
72
|
);
|
|
72
73
|
}
|
|
73
74
|
} else if (proxyConfig) {
|
|
74
|
-
|
|
75
|
+
const target = typeof proxyConfig.target === "string" ? proxyConfig.target : void 0;
|
|
76
|
+
if (target && isExternalUrl(target)) {
|
|
75
77
|
logWarning(
|
|
76
|
-
`Proxy '${path}' targets external URL: ${
|
|
78
|
+
`Proxy '${path}' targets external URL: ${target}. This may cause issues in the sandbox environment.`
|
|
77
79
|
);
|
|
78
80
|
}
|
|
79
81
|
if (proxyConfig.ws) {
|
|
@@ -245,14 +247,28 @@ function devServerFnErrorLogger() {
|
|
|
245
247
|
}
|
|
246
248
|
};
|
|
247
249
|
}
|
|
248
|
-
function defineConfig(
|
|
249
|
-
return async (
|
|
250
|
+
function defineConfig(configOrOptions = {}) {
|
|
251
|
+
return async (env) => {
|
|
252
|
+
const { command, mode } = env;
|
|
250
253
|
const isSandbox = isSandboxEnvironment();
|
|
254
|
+
let options;
|
|
255
|
+
if (typeof configOrOptions === "function") {
|
|
256
|
+
const userConfig = await Promise.resolve(configOrOptions(env));
|
|
257
|
+
options = { vite: userConfig };
|
|
258
|
+
} else if (configOrOptions instanceof Promise) {
|
|
259
|
+
options = { vite: await configOrOptions };
|
|
260
|
+
} else {
|
|
261
|
+
const hasLovableKey = "vite" in configOrOptions || "clientErrorLogger" in configOrOptions || "serverFnErrorLogger" in configOrOptions || "cloudflare" in configOrOptions;
|
|
262
|
+
options = hasLovableKey ? configOrOptions : { vite: configOrOptions };
|
|
263
|
+
}
|
|
251
264
|
const internalPlugins = [];
|
|
252
265
|
const tailwindcss = (await import("@tailwindcss/vite")).default;
|
|
253
266
|
internalPlugins.push(tailwindcss());
|
|
254
267
|
const tsConfigPaths = (await import("vite-tsconfig-paths")).default;
|
|
255
268
|
internalPlugins.push(tsConfigPaths({ projects: ["./tsconfig.json"] }));
|
|
269
|
+
if (command === "serve" && mode === "development") {
|
|
270
|
+
internalPlugins.push((0, import_lovable_tagger.componentTagger)());
|
|
271
|
+
}
|
|
256
272
|
if (options.clientErrorLogger !== false) {
|
|
257
273
|
internalPlugins.push(devClientErrorLogger());
|
|
258
274
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PluginOption, UserConfig } from 'vite';
|
|
1
|
+
import { PluginOption, UserConfig, ConfigEnv, UserConfigFnObject, UserConfigFnPromise, UserConfigFn } from 'vite';
|
|
2
2
|
|
|
3
3
|
interface LovableViteTanstackOptions {
|
|
4
4
|
plugins?: PluginOption[];
|
|
@@ -7,9 +7,11 @@ interface LovableViteTanstackOptions {
|
|
|
7
7
|
serverFnErrorLogger?: boolean;
|
|
8
8
|
cloudflare?: Record<string, unknown> | false;
|
|
9
9
|
}
|
|
10
|
-
declare function defineConfig(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
declare function defineConfig(config: UserConfig): (env: ConfigEnv) => Promise<UserConfig>;
|
|
11
|
+
declare function defineConfig(config: Promise<UserConfig>): (env: ConfigEnv) => Promise<UserConfig>;
|
|
12
|
+
declare function defineConfig(config: UserConfigFnObject): (env: ConfigEnv) => Promise<UserConfig>;
|
|
13
|
+
declare function defineConfig(config: UserConfigFnPromise): (env: ConfigEnv) => Promise<UserConfig>;
|
|
14
|
+
declare function defineConfig(config: UserConfigFn): (env: ConfigEnv) => Promise<UserConfig>;
|
|
15
|
+
declare function defineConfig(options?: LovableViteTanstackOptions): (env: ConfigEnv) => Promise<UserConfig>;
|
|
14
16
|
|
|
15
17
|
export { type LovableViteTanstackOptions, defineConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PluginOption, UserConfig } from 'vite';
|
|
1
|
+
import { PluginOption, UserConfig, ConfigEnv, UserConfigFnObject, UserConfigFnPromise, UserConfigFn } from 'vite';
|
|
2
2
|
|
|
3
3
|
interface LovableViteTanstackOptions {
|
|
4
4
|
plugins?: PluginOption[];
|
|
@@ -7,9 +7,11 @@ interface LovableViteTanstackOptions {
|
|
|
7
7
|
serverFnErrorLogger?: boolean;
|
|
8
8
|
cloudflare?: Record<string, unknown> | false;
|
|
9
9
|
}
|
|
10
|
-
declare function defineConfig(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
declare function defineConfig(config: UserConfig): (env: ConfigEnv) => Promise<UserConfig>;
|
|
11
|
+
declare function defineConfig(config: Promise<UserConfig>): (env: ConfigEnv) => Promise<UserConfig>;
|
|
12
|
+
declare function defineConfig(config: UserConfigFnObject): (env: ConfigEnv) => Promise<UserConfig>;
|
|
13
|
+
declare function defineConfig(config: UserConfigFnPromise): (env: ConfigEnv) => Promise<UserConfig>;
|
|
14
|
+
declare function defineConfig(config: UserConfigFn): (env: ConfigEnv) => Promise<UserConfig>;
|
|
15
|
+
declare function defineConfig(options?: LovableViteTanstackOptions): (env: ConfigEnv) => Promise<UserConfig>;
|
|
14
16
|
|
|
15
17
|
export { type LovableViteTanstackOptions, defineConfig };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
|
+
import { componentTagger } from "lovable-tagger";
|
|
2
3
|
import { mergeConfig } from "vite";
|
|
3
4
|
var SANDBOX_ENV_VAR = "DEV_SERVER__PROJECT_PATH";
|
|
4
5
|
var LOVABLE_SANDBOX_ENV_VAR = "LOVABLE_SANDBOX";
|
|
@@ -37,9 +38,10 @@ function validateProxy(config) {
|
|
|
37
38
|
);
|
|
38
39
|
}
|
|
39
40
|
} else if (proxyConfig) {
|
|
40
|
-
|
|
41
|
+
const target = typeof proxyConfig.target === "string" ? proxyConfig.target : void 0;
|
|
42
|
+
if (target && isExternalUrl(target)) {
|
|
41
43
|
logWarning(
|
|
42
|
-
`Proxy '${path}' targets external URL: ${
|
|
44
|
+
`Proxy '${path}' targets external URL: ${target}. This may cause issues in the sandbox environment.`
|
|
43
45
|
);
|
|
44
46
|
}
|
|
45
47
|
if (proxyConfig.ws) {
|
|
@@ -211,14 +213,28 @@ function devServerFnErrorLogger() {
|
|
|
211
213
|
}
|
|
212
214
|
};
|
|
213
215
|
}
|
|
214
|
-
function defineConfig(
|
|
215
|
-
return async (
|
|
216
|
+
function defineConfig(configOrOptions = {}) {
|
|
217
|
+
return async (env) => {
|
|
218
|
+
const { command, mode } = env;
|
|
216
219
|
const isSandbox = isSandboxEnvironment();
|
|
220
|
+
let options;
|
|
221
|
+
if (typeof configOrOptions === "function") {
|
|
222
|
+
const userConfig = await Promise.resolve(configOrOptions(env));
|
|
223
|
+
options = { vite: userConfig };
|
|
224
|
+
} else if (configOrOptions instanceof Promise) {
|
|
225
|
+
options = { vite: await configOrOptions };
|
|
226
|
+
} else {
|
|
227
|
+
const hasLovableKey = "vite" in configOrOptions || "clientErrorLogger" in configOrOptions || "serverFnErrorLogger" in configOrOptions || "cloudflare" in configOrOptions;
|
|
228
|
+
options = hasLovableKey ? configOrOptions : { vite: configOrOptions };
|
|
229
|
+
}
|
|
217
230
|
const internalPlugins = [];
|
|
218
231
|
const tailwindcss = (await import("@tailwindcss/vite")).default;
|
|
219
232
|
internalPlugins.push(tailwindcss());
|
|
220
233
|
const tsConfigPaths = (await import("vite-tsconfig-paths")).default;
|
|
221
234
|
internalPlugins.push(tsConfigPaths({ projects: ["./tsconfig.json"] }));
|
|
235
|
+
if (command === "serve" && mode === "development") {
|
|
236
|
+
internalPlugins.push(componentTagger());
|
|
237
|
+
}
|
|
222
238
|
if (options.clientErrorLogger !== false) {
|
|
223
239
|
internalPlugins.push(devClientErrorLogger());
|
|
224
240
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lovable.dev/vite-tanstack-config",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Vite config wrapper for Lovable TanStack Start projects",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -25,6 +25,9 @@
|
|
|
25
25
|
"config"
|
|
26
26
|
],
|
|
27
27
|
"license": "MIT",
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"lovable-tagger": "1.1.13"
|
|
30
|
+
},
|
|
28
31
|
"peerDependencies": {
|
|
29
32
|
"vite": ">=5.0.0 <9.0.0",
|
|
30
33
|
"@tailwindcss/vite": ">=4.0.0",
|