@lovable.dev/vite-tanstack-config 1.3.0 → 1.4.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 CHANGED
@@ -275,7 +275,7 @@ function defineConfig(configOrOptions = {}) {
275
275
  } else if (configOrOptions instanceof Promise) {
276
276
  options = { vite: await configOrOptions };
277
277
  } else {
278
- const hasLovableKey = "vite" in configOrOptions || "clientErrorLogger" in configOrOptions || "serverFnErrorLogger" in configOrOptions || "cloudflare" in configOrOptions || "tanstackStart" in configOrOptions || "react" in configOrOptions || "envDefine" in configOrOptions;
278
+ const hasLovableKey = "vite" in configOrOptions || "clientErrorLogger" in configOrOptions || "serverFnErrorLogger" in configOrOptions || "cloudflare" in configOrOptions || "tanstackStart" in configOrOptions || "react" in configOrOptions || "envDefine" in configOrOptions || "hmrGate" in configOrOptions;
279
279
  options = hasLovableKey ? configOrOptions : { vite: configOrOptions };
280
280
  }
281
281
  const internalPlugins = [];
@@ -303,6 +303,15 @@ function defineConfig(configOrOptions = {}) {
303
303
  internalPlugins.push(tanstackStart(options.tanstackStart));
304
304
  const viteReact = (await import("@vitejs/plugin-react")).default;
305
305
  internalPlugins.push(viteReact(options.react));
306
+ if (command === "serve") {
307
+ const hmrGateOpt = options.hmrGate;
308
+ const enableHmrGate = isSandbox ? hmrGateOpt !== false : !!hmrGateOpt;
309
+ if (enableHmrGate) {
310
+ const { hmrGatePlugin } = await import("@lovable.dev/vite-plugin-hmr-gate");
311
+ const hmrGateOptions = typeof hmrGateOpt === "object" ? hmrGateOpt : {};
312
+ internalPlugins.push(hmrGatePlugin(hmrGateOptions));
313
+ }
314
+ }
306
315
  if (command === "serve" && mode === "development") {
307
316
  internalPlugins.push((0, import_lovable_tagger.componentTagger)());
308
317
  }
@@ -343,6 +352,9 @@ function defineConfig(configOrOptions = {}) {
343
352
  } else {
344
353
  config = (0, import_vite.mergeConfig)({ server: { host: "::", port: 8080 } }, config);
345
354
  }
355
+ if (isSandbox) {
356
+ return config;
357
+ }
346
358
  return applyWatchDebounceDefaults(config);
347
359
  };
348
360
  }
package/dist/index.d.cts CHANGED
@@ -1,3 +1,4 @@
1
+ import { HmrGateOptions } from '@lovable.dev/vite-plugin-hmr-gate';
1
2
  import { PluginOption, UserConfig, ConfigEnv, UserConfigFnObject, UserConfigFnPromise, UserConfigFn } from 'vite';
2
3
 
3
4
  interface LovableViteTanstackOptions {
@@ -12,6 +13,12 @@ interface LovableViteTanstackOptions {
12
13
  react?: Record<string, unknown>;
13
14
  /** Set to false to disable automatic VITE_* env define injection. Default: true. */
14
15
  envDefine?: boolean;
16
+ /**
17
+ * Options for the HMR gate plugin (@lovable.dev/vite-plugin-hmr-gate).
18
+ * Enabled by default in sandbox mode. Set to false to disable, or pass options
19
+ * to customise behaviour. Set to true or an options object to enable outside sandbox.
20
+ */
21
+ hmrGate?: boolean | HmrGateOptions;
15
22
  }
16
23
  declare function defineConfig(config: UserConfig): (env: ConfigEnv) => Promise<UserConfig>;
17
24
  declare function defineConfig(config: Promise<UserConfig>): (env: ConfigEnv) => Promise<UserConfig>;
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { HmrGateOptions } from '@lovable.dev/vite-plugin-hmr-gate';
1
2
  import { PluginOption, UserConfig, ConfigEnv, UserConfigFnObject, UserConfigFnPromise, UserConfigFn } from 'vite';
2
3
 
3
4
  interface LovableViteTanstackOptions {
@@ -12,6 +13,12 @@ interface LovableViteTanstackOptions {
12
13
  react?: Record<string, unknown>;
13
14
  /** Set to false to disable automatic VITE_* env define injection. Default: true. */
14
15
  envDefine?: boolean;
16
+ /**
17
+ * Options for the HMR gate plugin (@lovable.dev/vite-plugin-hmr-gate).
18
+ * Enabled by default in sandbox mode. Set to false to disable, or pass options
19
+ * to customise behaviour. Set to true or an options object to enable outside sandbox.
20
+ */
21
+ hmrGate?: boolean | HmrGateOptions;
15
22
  }
16
23
  declare function defineConfig(config: UserConfig): (env: ConfigEnv) => Promise<UserConfig>;
17
24
  declare function defineConfig(config: Promise<UserConfig>): (env: ConfigEnv) => Promise<UserConfig>;
package/dist/index.js CHANGED
@@ -241,7 +241,7 @@ function defineConfig(configOrOptions = {}) {
241
241
  } else if (configOrOptions instanceof Promise) {
242
242
  options = { vite: await configOrOptions };
243
243
  } else {
244
- const hasLovableKey = "vite" in configOrOptions || "clientErrorLogger" in configOrOptions || "serverFnErrorLogger" in configOrOptions || "cloudflare" in configOrOptions || "tanstackStart" in configOrOptions || "react" in configOrOptions || "envDefine" in configOrOptions;
244
+ const hasLovableKey = "vite" in configOrOptions || "clientErrorLogger" in configOrOptions || "serverFnErrorLogger" in configOrOptions || "cloudflare" in configOrOptions || "tanstackStart" in configOrOptions || "react" in configOrOptions || "envDefine" in configOrOptions || "hmrGate" in configOrOptions;
245
245
  options = hasLovableKey ? configOrOptions : { vite: configOrOptions };
246
246
  }
247
247
  const internalPlugins = [];
@@ -269,6 +269,15 @@ function defineConfig(configOrOptions = {}) {
269
269
  internalPlugins.push(tanstackStart(options.tanstackStart));
270
270
  const viteReact = (await import("@vitejs/plugin-react")).default;
271
271
  internalPlugins.push(viteReact(options.react));
272
+ if (command === "serve") {
273
+ const hmrGateOpt = options.hmrGate;
274
+ const enableHmrGate = isSandbox ? hmrGateOpt !== false : !!hmrGateOpt;
275
+ if (enableHmrGate) {
276
+ const { hmrGatePlugin } = await import("@lovable.dev/vite-plugin-hmr-gate");
277
+ const hmrGateOptions = typeof hmrGateOpt === "object" ? hmrGateOpt : {};
278
+ internalPlugins.push(hmrGatePlugin(hmrGateOptions));
279
+ }
280
+ }
272
281
  if (command === "serve" && mode === "development") {
273
282
  internalPlugins.push(componentTagger());
274
283
  }
@@ -309,6 +318,9 @@ function defineConfig(configOrOptions = {}) {
309
318
  } else {
310
319
  config = mergeConfig({ server: { host: "::", port: 8080 } }, config);
311
320
  }
321
+ if (isSandbox) {
322
+ return config;
323
+ }
312
324
  return applyWatchDebounceDefaults(config);
313
325
  };
314
326
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lovable.dev/vite-tanstack-config",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "Vite config wrapper for Lovable TanStack Start projects",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
@@ -26,6 +26,7 @@
26
26
  ],
27
27
  "license": "MIT",
28
28
  "dependencies": {
29
+ "@lovable.dev/vite-plugin-hmr-gate": "^1.0.0",
29
30
  "lovable-tagger": "1.1.13"
30
31
  },
31
32
  "peerDependencies": {