@lovable.dev/vite-tanstack-config 2.6.2 → 2.6.4-rc.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 +29 -2
- package/dist/index.js +30 -3
- package/package.json +14 -13
package/dist/index.cjs
CHANGED
|
@@ -118,6 +118,7 @@ function lovableAssetsProxyPlugin() {
|
|
|
118
118
|
// src/index.ts
|
|
119
119
|
var SANDBOX_ENV_VAR = "DEV_SERVER__PROJECT_PATH";
|
|
120
120
|
var LOVABLE_SANDBOX_ENV_VAR = "LOVABLE_SANDBOX";
|
|
121
|
+
var JSX_SOURCE_FILE_RE = /\.[jt]sx$/;
|
|
121
122
|
function isSandboxEnvironment() {
|
|
122
123
|
return process.env[LOVABLE_SANDBOX_ENV_VAR] === "1" || !!process.env[SANDBOX_ENV_VAR];
|
|
123
124
|
}
|
|
@@ -608,6 +609,29 @@ function devServerFnErrorLogger() {
|
|
|
608
609
|
}
|
|
609
610
|
};
|
|
610
611
|
}
|
|
612
|
+
function jsxSourceBuildDevPlugin() {
|
|
613
|
+
return {
|
|
614
|
+
name: "lovable-jsx-source-build-dev",
|
|
615
|
+
enforce: "pre",
|
|
616
|
+
apply: "build",
|
|
617
|
+
async transform(code, id, options) {
|
|
618
|
+
if (options?.ssr) {
|
|
619
|
+
return null;
|
|
620
|
+
}
|
|
621
|
+
const sourceFile = id.split("?")[0];
|
|
622
|
+
if (!sourceFile || !JSX_SOURCE_FILE_RE.test(sourceFile) || !code.includes("<")) {
|
|
623
|
+
return null;
|
|
624
|
+
}
|
|
625
|
+
return (0, import_vite.transformWithEsbuild)(code, sourceFile, {
|
|
626
|
+
loader: sourceFile.endsWith(".jsx") ? "jsx" : "tsx",
|
|
627
|
+
jsx: "automatic",
|
|
628
|
+
jsxDev: true,
|
|
629
|
+
sourcemap: true,
|
|
630
|
+
sourcefile: sourceFile
|
|
631
|
+
});
|
|
632
|
+
}
|
|
633
|
+
};
|
|
634
|
+
}
|
|
611
635
|
function defineConfig(configOrOptions = {}) {
|
|
612
636
|
return async (env) => {
|
|
613
637
|
const { command, mode } = env;
|
|
@@ -693,6 +717,9 @@ function defineConfig(configOrOptions = {}) {
|
|
|
693
717
|
internalPlugins.push(nitro(nitroOpts));
|
|
694
718
|
}
|
|
695
719
|
}
|
|
720
|
+
if (isDevBuild) {
|
|
721
|
+
internalPlugins.push(jsxSourceBuildDevPlugin());
|
|
722
|
+
}
|
|
696
723
|
const viteReact = (await import("@vitejs/plugin-react")).default;
|
|
697
724
|
internalPlugins.push(viteReact(options.react));
|
|
698
725
|
if (command === "serve") {
|
|
@@ -711,8 +738,8 @@ function defineConfig(configOrOptions = {}) {
|
|
|
711
738
|
if (command === "serve") {
|
|
712
739
|
internalPlugins.push(lovableAssetsProxyPlugin());
|
|
713
740
|
}
|
|
714
|
-
if (command === "serve" && mode === "development") {
|
|
715
|
-
internalPlugins.push((0, import_lovable_tagger.componentTagger)());
|
|
741
|
+
if ((command === "serve" || command === "build") && mode === "development") {
|
|
742
|
+
internalPlugins.push((0, import_lovable_tagger.componentTagger)({ jsxSource: true }));
|
|
716
743
|
}
|
|
717
744
|
let envDefine = {};
|
|
718
745
|
if (options.envDefine !== false) {
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
2
|
import { componentTagger } from "lovable-tagger";
|
|
3
|
-
import { mergeConfig, loadEnv } from "vite";
|
|
3
|
+
import { mergeConfig, loadEnv, transformWithEsbuild } from "vite";
|
|
4
4
|
|
|
5
5
|
// src/assetsProxyPlugin.ts
|
|
6
6
|
import https from "https";
|
|
@@ -83,6 +83,7 @@ function lovableAssetsProxyPlugin() {
|
|
|
83
83
|
// src/index.ts
|
|
84
84
|
var SANDBOX_ENV_VAR = "DEV_SERVER__PROJECT_PATH";
|
|
85
85
|
var LOVABLE_SANDBOX_ENV_VAR = "LOVABLE_SANDBOX";
|
|
86
|
+
var JSX_SOURCE_FILE_RE = /\.[jt]sx$/;
|
|
86
87
|
function isSandboxEnvironment() {
|
|
87
88
|
return process.env[LOVABLE_SANDBOX_ENV_VAR] === "1" || !!process.env[SANDBOX_ENV_VAR];
|
|
88
89
|
}
|
|
@@ -573,6 +574,29 @@ function devServerFnErrorLogger() {
|
|
|
573
574
|
}
|
|
574
575
|
};
|
|
575
576
|
}
|
|
577
|
+
function jsxSourceBuildDevPlugin() {
|
|
578
|
+
return {
|
|
579
|
+
name: "lovable-jsx-source-build-dev",
|
|
580
|
+
enforce: "pre",
|
|
581
|
+
apply: "build",
|
|
582
|
+
async transform(code, id, options) {
|
|
583
|
+
if (options?.ssr) {
|
|
584
|
+
return null;
|
|
585
|
+
}
|
|
586
|
+
const sourceFile = id.split("?")[0];
|
|
587
|
+
if (!sourceFile || !JSX_SOURCE_FILE_RE.test(sourceFile) || !code.includes("<")) {
|
|
588
|
+
return null;
|
|
589
|
+
}
|
|
590
|
+
return transformWithEsbuild(code, sourceFile, {
|
|
591
|
+
loader: sourceFile.endsWith(".jsx") ? "jsx" : "tsx",
|
|
592
|
+
jsx: "automatic",
|
|
593
|
+
jsxDev: true,
|
|
594
|
+
sourcemap: true,
|
|
595
|
+
sourcefile: sourceFile
|
|
596
|
+
});
|
|
597
|
+
}
|
|
598
|
+
};
|
|
599
|
+
}
|
|
576
600
|
function defineConfig(configOrOptions = {}) {
|
|
577
601
|
return async (env) => {
|
|
578
602
|
const { command, mode } = env;
|
|
@@ -658,6 +682,9 @@ function defineConfig(configOrOptions = {}) {
|
|
|
658
682
|
internalPlugins.push(nitro(nitroOpts));
|
|
659
683
|
}
|
|
660
684
|
}
|
|
685
|
+
if (isDevBuild) {
|
|
686
|
+
internalPlugins.push(jsxSourceBuildDevPlugin());
|
|
687
|
+
}
|
|
661
688
|
const viteReact = (await import("@vitejs/plugin-react")).default;
|
|
662
689
|
internalPlugins.push(viteReact(options.react));
|
|
663
690
|
if (command === "serve") {
|
|
@@ -676,8 +703,8 @@ function defineConfig(configOrOptions = {}) {
|
|
|
676
703
|
if (command === "serve") {
|
|
677
704
|
internalPlugins.push(lovableAssetsProxyPlugin());
|
|
678
705
|
}
|
|
679
|
-
if (command === "serve" && mode === "development") {
|
|
680
|
-
internalPlugins.push(componentTagger());
|
|
706
|
+
if ((command === "serve" || command === "build") && mode === "development") {
|
|
707
|
+
internalPlugins.push(componentTagger({ jsxSource: true }));
|
|
681
708
|
}
|
|
682
709
|
let envDefine = {};
|
|
683
710
|
if (options.envDefine !== false) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lovable.dev/vite-tanstack-config",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.4-rc.0",
|
|
4
4
|
"description": "Vite config wrapper for Lovable TanStack Start projects",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -9,6 +9,15 @@
|
|
|
9
9
|
"files": [
|
|
10
10
|
"dist"
|
|
11
11
|
],
|
|
12
|
+
"scripts": {
|
|
13
|
+
"build": "tsup src/index.ts --format cjs,esm --dts --outDir dist",
|
|
14
|
+
"typecheck": "tsgo --noEmit",
|
|
15
|
+
"dev": "tsup src/index.ts --format cjs,esm --dts --watch",
|
|
16
|
+
"test": "vitest",
|
|
17
|
+
"prepublishOnly": "npm run clean && npm run build",
|
|
18
|
+
"clean": "rimraf dist",
|
|
19
|
+
"coverage": "vitest run --coverage"
|
|
20
|
+
},
|
|
12
21
|
"keywords": [
|
|
13
22
|
"vite",
|
|
14
23
|
"tanstack",
|
|
@@ -40,20 +49,12 @@
|
|
|
40
49
|
"@tanstack/react-start": "^1.167.50",
|
|
41
50
|
"@vitejs/plugin-react": "^5.2.0",
|
|
42
51
|
"@tailwindcss/vite": "^4.3.0",
|
|
43
|
-
"@types/node": "
|
|
52
|
+
"@types/node": "catalog:",
|
|
44
53
|
"rimraf": "^5.0.0",
|
|
45
54
|
"tsup": "^7.2.0",
|
|
46
|
-
"typescript": "
|
|
55
|
+
"typescript": "catalog:",
|
|
47
56
|
"vite": "^8.0.16",
|
|
48
57
|
"vite-tsconfig-paths": "^6.0.2",
|
|
49
|
-
"vitest": "
|
|
50
|
-
},
|
|
51
|
-
"scripts": {
|
|
52
|
-
"build": "tsup src/index.ts --format cjs,esm --dts --outDir dist",
|
|
53
|
-
"typecheck": "tsgo --noEmit",
|
|
54
|
-
"dev": "tsup src/index.ts --format cjs,esm --dts --watch",
|
|
55
|
-
"test": "vitest",
|
|
56
|
-
"clean": "rimraf dist",
|
|
57
|
-
"coverage": "vitest run --coverage"
|
|
58
|
+
"vitest": "catalog:"
|
|
58
59
|
}
|
|
59
|
-
}
|
|
60
|
+
}
|