fimo-vite 2.9.0 → 2.10.0-staging.10
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/plugins/server-config.js +1 -3
- package/dist/vite.js +48 -18
- package/package.json +7 -6
|
@@ -18,9 +18,7 @@ export default function serverConfigPlugin() {
|
|
|
18
18
|
return {
|
|
19
19
|
server: {
|
|
20
20
|
...(allowedHosts === true || allowedHosts.length > 0 ? { allowedHosts } : {}),
|
|
21
|
-
hmr: {
|
|
22
|
-
overlay: false,
|
|
23
|
-
},
|
|
21
|
+
hmr: config.server?.hmr === false ? false : { overlay: false },
|
|
24
22
|
watch: {
|
|
25
23
|
ignored: ['**/.worktrees/**', '**/.fimo/config.json', '**/fimo-config.json'],
|
|
26
24
|
},
|
package/dist/vite.js
CHANGED
|
@@ -9,6 +9,13 @@ import seoPlugin from './plugins/seo.js';
|
|
|
9
9
|
import serverConfigPlugin from './plugins/server-config.js';
|
|
10
10
|
import sitemapPlugin from './plugins/sitemap.js';
|
|
11
11
|
import translationsPlugin from './plugins/translations.js';
|
|
12
|
+
// The ids the sibling plugins in ./plugins resolve.
|
|
13
|
+
const FIMO_VIRTUAL_IDS = new Set([
|
|
14
|
+
'virtual:fimo-config',
|
|
15
|
+
'virtual:translations',
|
|
16
|
+
'virtual:fimo-overlay-hmr',
|
|
17
|
+
'virtual:fimo-overlay-runtime',
|
|
18
|
+
]);
|
|
12
19
|
// Force-bundle fimo into the SSR build, and let the dev optimizer pre-bundle
|
|
13
20
|
// it for the client. fimo's runtime imports `virtual:fimo-config` /
|
|
14
21
|
// `virtual:translations` / `virtual:fimo-overlay-*` — Vite-only specifiers
|
|
@@ -30,6 +37,11 @@ import translationsPlugin from './plugins/translations.js';
|
|
|
30
37
|
// dep chunks and resolves bare specifiers through the plugin container,
|
|
31
38
|
// rewriting them to `/@id/` URLs itself. A pre-prefixed path fails that
|
|
32
39
|
// resolve ("Failed to resolve import '/@id/virtual:fimo-config'").
|
|
40
|
+
// Vite 8 optimizes with Rolldown (`rolldownOptions`); Vite 7 with esbuild
|
|
41
|
+
// (`esbuildOptions`), which Vite 8 deprecates with a warning — so the
|
|
42
|
+
// esbuild hook is added only when Vite isn't running Rolldown. Only
|
|
43
|
+
// Fimo's own virtual ids are externalized: claiming every `virtual:` id
|
|
44
|
+
// would stop another plugin's optimizer resolver from seeing its own.
|
|
33
45
|
//
|
|
34
46
|
// Only `fimo` is named here. A framework package that also imports the
|
|
35
47
|
// virtual modules (fimo-react-router does) contributes its own package names
|
|
@@ -37,26 +49,44 @@ import translationsPlugin from './plugins/translations.js';
|
|
|
37
49
|
function bundleFimoIntoSsrPlugin() {
|
|
38
50
|
return {
|
|
39
51
|
name: 'vite-plugin-fimo-ssr-bundle',
|
|
40
|
-
config
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
config() {
|
|
53
|
+
return {
|
|
54
|
+
ssr: { noExternal: ['fimo'] },
|
|
55
|
+
optimizeDeps: {
|
|
56
|
+
// `this` is undefined in Vite 6's config hook (outside the supported
|
|
57
|
+
// range, but it must not crash on load).
|
|
58
|
+
...(this?.meta?.rolldownVersion
|
|
59
|
+
? {}
|
|
60
|
+
: {
|
|
61
|
+
esbuildOptions: {
|
|
62
|
+
plugins: [
|
|
63
|
+
{
|
|
64
|
+
name: 'fimo-externalize-virtuals',
|
|
65
|
+
setup(build) {
|
|
66
|
+
build.onResolve({ filter: /^virtual:/ }, ({ path }) => FIMO_VIRTUAL_IDS.has(path) ? { path, external: true } : undefined);
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
},
|
|
71
|
+
}),
|
|
72
|
+
rolldownOptions: {
|
|
73
|
+
plugins: [
|
|
74
|
+
{
|
|
75
|
+
name: 'fimo-externalize-virtuals',
|
|
76
|
+
resolveId(id) {
|
|
77
|
+
if (FIMO_VIRTUAL_IDS.has(id)) {
|
|
78
|
+
return {
|
|
79
|
+
id,
|
|
80
|
+
external: true,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
},
|
|
54
84
|
},
|
|
55
|
-
|
|
56
|
-
|
|
85
|
+
],
|
|
86
|
+
},
|
|
57
87
|
},
|
|
58
|
-
}
|
|
59
|
-
}
|
|
88
|
+
};
|
|
89
|
+
},
|
|
60
90
|
configEnvironment(name, config) {
|
|
61
91
|
if (name !== 'ssr')
|
|
62
92
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fimo-vite",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.10.0-staging.10",
|
|
4
4
|
"description": "Framework-neutral Fimo Vite plugin. Pairs with the fimo package at the same version.",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist/",
|
|
@@ -31,15 +31,16 @@
|
|
|
31
31
|
"oxc-parser": "^0.118.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@fimo/tsconfig": "2.
|
|
34
|
+
"@fimo/tsconfig": "2.10.0-staging.10",
|
|
35
35
|
"@types/node": "22.18.6",
|
|
36
|
-
"fimo": "2.
|
|
36
|
+
"fimo": "2.10.0-staging.10",
|
|
37
37
|
"typescript": "7.0.2",
|
|
38
|
-
"vite": "8.3.
|
|
39
|
-
"
|
|
38
|
+
"vite": "8.3.5",
|
|
39
|
+
"vite7": "npm:vite@^7.1.7",
|
|
40
|
+
"vitest": "5.0.5"
|
|
40
41
|
},
|
|
41
42
|
"peerDependencies": {
|
|
42
|
-
"fimo": "
|
|
43
|
+
"fimo": "2.10.0-staging.10",
|
|
43
44
|
"vite": "^7.0.0 || ^8.0.0"
|
|
44
45
|
},
|
|
45
46
|
"engines": {
|