@rpcbase/vite 0.68.0 → 0.70.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/index.js +49 -8
- package/package.json +14 -14
package/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import "./dotEnvExpand.js"
|
|
2
2
|
|
|
3
3
|
import path from "path"
|
|
4
|
+
import { createRequire } from "module"
|
|
5
|
+
import { existsSync, readFileSync } from "node:fs"
|
|
4
6
|
|
|
5
7
|
import nocache from "nocache"
|
|
6
8
|
import {
|
|
@@ -10,13 +12,57 @@ import {
|
|
|
10
12
|
loadEnv,
|
|
11
13
|
} from "vite"
|
|
12
14
|
import { viteSingleFile } from "vite-plugin-singlefile"
|
|
13
|
-
// import react from "@vitejs/plugin-react-swc"
|
|
14
15
|
import react from "@vitejs/plugin-react"
|
|
15
16
|
import { createHtmlPlugin } from "vite-plugin-html"
|
|
16
17
|
import { glob } from "glob"
|
|
17
18
|
|
|
18
19
|
import { posthogSourcemapsPlugin } from "./posthogSourcemapsPlugin.js"
|
|
19
20
|
|
|
21
|
+
|
|
22
|
+
const require = createRequire(import.meta.url)
|
|
23
|
+
|
|
24
|
+
const resolvePackageRoot = (pkg) => {
|
|
25
|
+
// 1) chemin rapide: si le package exporte son package.json
|
|
26
|
+
try {
|
|
27
|
+
const pkgJson = require.resolve(`${pkg}/package.json`)
|
|
28
|
+
return path.dirname(pkgJson)
|
|
29
|
+
} catch (err) {
|
|
30
|
+
// 2) fallback: résoudre l'entrée du package puis remonter jusqu'à sa racine
|
|
31
|
+
const entry = require.resolve(pkg) // ex: .../node_modules/<pkg>/dist/...
|
|
32
|
+
let dir = path.dirname(entry)
|
|
33
|
+
|
|
34
|
+
// remonter jusqu'à un package.json dont "name" === pkg
|
|
35
|
+
while (true) {
|
|
36
|
+
const pkgJsonPath = path.join(dir, "package.json")
|
|
37
|
+
if (existsSync(pkgJsonPath)) {
|
|
38
|
+
try {
|
|
39
|
+
const json = JSON.parse(readFileSync(pkgJsonPath, "utf8"))
|
|
40
|
+
if (json && json.name === pkg) return dir
|
|
41
|
+
} catch {
|
|
42
|
+
// ignore parsing errors
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
const parent = path.dirname(dir)
|
|
46
|
+
if (parent === dir) break
|
|
47
|
+
dir = parent
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// 3) dernier recours: reconstruire depuis le segment node_modules (ok avec pnpm)
|
|
51
|
+
const nmMarker = `${path.sep}node_modules${path.sep}`
|
|
52
|
+
const idx = entry.lastIndexOf(nmMarker)
|
|
53
|
+
if (idx !== -1) {
|
|
54
|
+
const nmRoot = entry.slice(0, idx + nmMarker.length)
|
|
55
|
+
return path.join(nmRoot, pkg)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// si vraiment rien trouvé, relancer l'erreur d'origine
|
|
59
|
+
throw err
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const withTrailingSep = p => (p.endsWith(path.sep) ? p : p + path.sep)
|
|
64
|
+
|
|
65
|
+
|
|
20
66
|
// const isCI = process.env.CI === "true"
|
|
21
67
|
|
|
22
68
|
const isProduction = process.env.NODE_ENV === "production"
|
|
@@ -46,12 +92,6 @@ const resolveAliases = {
|
|
|
46
92
|
"@/shared": path.resolve(process.cwd(), "./src/shared/"),
|
|
47
93
|
"@/types": path.resolve(process.cwd(), "./src/types/"),
|
|
48
94
|
"@": path.resolve(process.cwd(), "./src/client/"),
|
|
49
|
-
//
|
|
50
|
-
cookie: path.resolve(process.cwd(), "./node_modules/cookie"),
|
|
51
|
-
"set-cookie-parser": path.resolve(
|
|
52
|
-
process.cwd(),
|
|
53
|
-
"./node_modules/set-cookie-parser",
|
|
54
|
-
),
|
|
55
95
|
}
|
|
56
96
|
|
|
57
97
|
const integratedPackages = [
|
|
@@ -65,7 +105,8 @@ const integratedPackages = [
|
|
|
65
105
|
|
|
66
106
|
// Add each integrated package to resolveAliases
|
|
67
107
|
integratedPackages.forEach(pkg => {
|
|
68
|
-
|
|
108
|
+
const dir = resolvePackageRoot(pkg)
|
|
109
|
+
resolveAliases[pkg] = withTrailingSep(dir)
|
|
69
110
|
})
|
|
70
111
|
|
|
71
112
|
export {resolveAliases}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rpcbase/vite",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.70.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -25,23 +25,23 @@
|
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@hookform/resolvers": "5.2.2",
|
|
28
|
-
"@posthog/cli": "0.5.
|
|
29
|
-
"@tailwindcss/vite": "4.1.
|
|
30
|
-
"@vitejs/plugin-react": "5.1.
|
|
28
|
+
"@posthog/cli": "0.5.10",
|
|
29
|
+
"@tailwindcss/vite": "4.1.17",
|
|
30
|
+
"@vitejs/plugin-react": "5.1.1",
|
|
31
31
|
"clsx": "2.1.1",
|
|
32
32
|
"glob": "11.0.3",
|
|
33
|
-
"libphonenumber-js": "1.12.
|
|
34
|
-
"lucide-react": "0.
|
|
33
|
+
"libphonenumber-js": "1.12.26",
|
|
34
|
+
"lucide-react": "0.553.0",
|
|
35
35
|
"nocache": "4.0.0",
|
|
36
|
-
"posthog-js": "1.
|
|
37
|
-
"posthog-node": "5.
|
|
38
|
-
"react": "19.
|
|
39
|
-
"react-dom": "19.
|
|
40
|
-
"react-hook-form": "7.
|
|
36
|
+
"posthog-js": "1.292.0",
|
|
37
|
+
"posthog-node": "5.11.2",
|
|
38
|
+
"react": "19.2.0",
|
|
39
|
+
"react-dom": "19.2.0",
|
|
40
|
+
"react-hook-form": "7.66.0",
|
|
41
41
|
"swc-plugin-add-display-name": "0.6.0",
|
|
42
|
-
"tailwindcss": "4.1.
|
|
43
|
-
"validator": "13.15.
|
|
44
|
-
"vite": "7.
|
|
42
|
+
"tailwindcss": "4.1.17",
|
|
43
|
+
"validator": "13.15.23",
|
|
44
|
+
"vite": "7.2.2",
|
|
45
45
|
"vite-plugin-html": "3.2.2",
|
|
46
46
|
"vite-plugin-singlefile": "2.3.0",
|
|
47
47
|
"zod": "4.1.12"
|