@lovable.dev/vite-tanstack-config 2.8.7 → 2.9.1

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
@@ -110,7 +110,7 @@ function viteVersionSupportsBundledDev(version) {
110
110
  const match = /^(\d+)\.(\d+)\.(\d+)$/.exec(version);
111
111
  if (!match) return false;
112
112
  const [major, minor] = [Number(match[1]), Number(match[2])];
113
- return major > 8 || major === 8 && minor >= 1;
113
+ return major === 8 && minor === 1;
114
114
  }
115
115
  async function resolveInstalledViteVersion() {
116
116
  try {
@@ -122,6 +122,33 @@ async function resolveInstalledViteVersion() {
122
122
  }
123
123
  }
124
124
  //#endregion
125
+ //#region src/bundledDevCssUrlShim.ts
126
+ const VIRTUAL_PREFIX = "\0lovable-bundled-dev-css-url:";
127
+ const VIRTUAL_SUFFIX = ".shim.js";
128
+ function bundledDevCssUrlShim() {
129
+ return {
130
+ name: "lovable-bundled-dev-css-url-shim",
131
+ apply: "serve",
132
+ enforce: "pre",
133
+ async resolveId(id, importer) {
134
+ if (!id.endsWith(".css?url")) return null;
135
+ const resolved = await this.resolve(id.slice(0, -4), importer, { skipSelf: true });
136
+ if (!resolved) return null;
137
+ return VIRTUAL_PREFIX + resolved.id + VIRTUAL_SUFFIX;
138
+ },
139
+ load(id) {
140
+ if (!id.startsWith(VIRTUAL_PREFIX) || !id.endsWith(VIRTUAL_SUFFIX)) return null;
141
+ const file = id.slice(29, -8);
142
+ const inlineSpecifier = file.includes("?") ? `${file}&inline` : `${file}?inline`;
143
+ return [
144
+ `import css from ${JSON.stringify(inlineSpecifier)};`,
145
+ `const b64 = typeof Buffer !== "undefined" ? Buffer.from(css, "utf8").toString("base64") : btoa(unescape(encodeURIComponent(css)));`,
146
+ `export default "data:text/css;base64," + b64;`
147
+ ].join("\n");
148
+ }
149
+ };
150
+ }
151
+ //#endregion
125
152
  //#region src/index.ts
126
153
  const SANDBOX_ENV_VAR = "DEV_SERVER__PROJECT_PATH";
127
154
  const LOVABLE_SANDBOX_ENV_VAR = "LOVABLE_SANDBOX";
@@ -708,8 +735,11 @@ function defineConfig(configOrOptions = {}) {
708
735
  if (options.vite) config = (0, vite.mergeConfig)(config, options.vite);
709
736
  if (command === "serve" && isSandbox && bundledDevRequested()) {
710
737
  const viteVersion = await resolveInstalledViteVersion();
711
- if (viteVersionSupportsBundledDev(viteVersion)) config = (0, vite.mergeConfig)(config, { experimental: { bundledDev: true } });
712
- else logWarning(`Bundled dev requested (${BUNDLED_DEV_ENV_VAR}) but the installed vite (${viteVersion ?? "unresolved"}) is missing, prerelease, or below 8.1 — starting classic dev.`);
738
+ if (viteVersionSupportsBundledDev(viteVersion)) config = (0, vite.mergeConfig)(config, {
739
+ experimental: { bundledDev: true },
740
+ plugins: [bundledDevCssUrlShim()]
741
+ });
742
+ else logWarning(`Bundled dev requested (${BUNDLED_DEV_ENV_VAR}) but the installed vite (${viteVersion ?? "unresolved"}) is outside the supported 8.1.x range — starting classic dev.`);
713
743
  }
714
744
  if (isSandbox) {
715
745
  validateConfig(config);
package/dist/index.js CHANGED
@@ -86,7 +86,7 @@ function viteVersionSupportsBundledDev(version) {
86
86
  const match = /^(\d+)\.(\d+)\.(\d+)$/.exec(version);
87
87
  if (!match) return false;
88
88
  const [major, minor] = [Number(match[1]), Number(match[2])];
89
- return major > 8 || major === 8 && minor >= 1;
89
+ return major === 8 && minor === 1;
90
90
  }
91
91
  async function resolveInstalledViteVersion() {
92
92
  try {
@@ -98,6 +98,33 @@ async function resolveInstalledViteVersion() {
98
98
  }
99
99
  }
100
100
  //#endregion
101
+ //#region src/bundledDevCssUrlShim.ts
102
+ const VIRTUAL_PREFIX = "\0lovable-bundled-dev-css-url:";
103
+ const VIRTUAL_SUFFIX = ".shim.js";
104
+ function bundledDevCssUrlShim() {
105
+ return {
106
+ name: "lovable-bundled-dev-css-url-shim",
107
+ apply: "serve",
108
+ enforce: "pre",
109
+ async resolveId(id, importer) {
110
+ if (!id.endsWith(".css?url")) return null;
111
+ const resolved = await this.resolve(id.slice(0, -4), importer, { skipSelf: true });
112
+ if (!resolved) return null;
113
+ return VIRTUAL_PREFIX + resolved.id + VIRTUAL_SUFFIX;
114
+ },
115
+ load(id) {
116
+ if (!id.startsWith(VIRTUAL_PREFIX) || !id.endsWith(VIRTUAL_SUFFIX)) return null;
117
+ const file = id.slice(29, -8);
118
+ const inlineSpecifier = file.includes("?") ? `${file}&inline` : `${file}?inline`;
119
+ return [
120
+ `import css from ${JSON.stringify(inlineSpecifier)};`,
121
+ `const b64 = typeof Buffer !== "undefined" ? Buffer.from(css, "utf8").toString("base64") : btoa(unescape(encodeURIComponent(css)));`,
122
+ `export default "data:text/css;base64," + b64;`
123
+ ].join("\n");
124
+ }
125
+ };
126
+ }
127
+ //#endregion
101
128
  //#region src/index.ts
102
129
  const SANDBOX_ENV_VAR = "DEV_SERVER__PROJECT_PATH";
103
130
  const LOVABLE_SANDBOX_ENV_VAR = "LOVABLE_SANDBOX";
@@ -684,8 +711,11 @@ function defineConfig(configOrOptions = {}) {
684
711
  if (options.vite) config = mergeConfig(config, options.vite);
685
712
  if (command === "serve" && isSandbox && bundledDevRequested()) {
686
713
  const viteVersion = await resolveInstalledViteVersion();
687
- if (viteVersionSupportsBundledDev(viteVersion)) config = mergeConfig(config, { experimental: { bundledDev: true } });
688
- else logWarning(`Bundled dev requested (${BUNDLED_DEV_ENV_VAR}) but the installed vite (${viteVersion ?? "unresolved"}) is missing, prerelease, or below 8.1 — starting classic dev.`);
714
+ if (viteVersionSupportsBundledDev(viteVersion)) config = mergeConfig(config, {
715
+ experimental: { bundledDev: true },
716
+ plugins: [bundledDevCssUrlShim()]
717
+ });
718
+ else logWarning(`Bundled dev requested (${BUNDLED_DEV_ENV_VAR}) but the installed vite (${viteVersion ?? "unresolved"}) is outside the supported 8.1.x range — starting classic dev.`);
689
719
  }
690
720
  if (isSandbox) {
691
721
  validateConfig(config);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lovable.dev/vite-tanstack-config",
3
- "version": "2.8.7",
3
+ "version": "2.9.1",
4
4
  "description": "Vite config wrapper for Lovable TanStack Start projects",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
@@ -18,7 +18,7 @@
18
18
  "license": "MIT",
19
19
  "dependencies": {
20
20
  "@lovable.dev/vite-plugin-dev-server-bridge": "^1.2.1",
21
- "@lovable.dev/vite-plugin-hmr-gate": "^1.3.6",
21
+ "@lovable.dev/vite-plugin-hmr-gate": "^1.4.0",
22
22
  "@tanstack/devtools-vite": "^0.8.1",
23
23
  "lightningcss": "^1.30.0"
24
24
  },
@@ -44,7 +44,7 @@
44
44
  "rimraf": "^5.0.0",
45
45
  "tsdown": "^0.22.5",
46
46
  "typescript": "7.0.2",
47
- "vite": "^8.1.5",
47
+ "vite": "^8.2.0",
48
48
  "vite-tsconfig-paths": "^6.0.2",
49
49
  "vitest": "^4.1.5"
50
50
  },