getfilepress 0.1.26 → 0.1.27
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/package.json
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import criticalTheme from '$critical-theme';
|
|
4
4
|
import { SiteHeader, SiteFooter, isPathMountHref } from '@filepress/core';
|
|
5
5
|
import config from '$site-config';
|
|
6
|
+
import GenieMount from '$genie-mount';
|
|
6
7
|
|
|
7
8
|
let { children } = $props();
|
|
8
9
|
|
|
@@ -34,8 +35,4 @@
|
|
|
34
35
|
|
|
35
36
|
<SiteFooter site={config} />
|
|
36
37
|
|
|
37
|
-
|
|
38
|
-
{#await import('$lib/genie/GenieHost.svelte') then { default: GenieHost }}
|
|
39
|
-
<GenieHost />
|
|
40
|
-
{/await}
|
|
41
|
-
{/if}
|
|
38
|
+
<GenieMount />
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
2
|
+
import { join } from 'node:path';
|
|
2
3
|
import type { Plugin } from 'vite';
|
|
3
4
|
import {
|
|
4
5
|
applyConfigOnly,
|
|
@@ -30,6 +31,21 @@ function sendJson(res: ServerResponse, status: number, data: unknown) {
|
|
|
30
31
|
res.end(body);
|
|
31
32
|
}
|
|
32
33
|
|
|
34
|
+
/**
|
|
35
|
+
* `$genie-mount` in +layout. A Svelte `{#if import.meta.env.DEV}` + `import()`
|
|
36
|
+
* still emits GenieHost/GeniePanel chunks under Vite 8.2 / Rolldown. Point the
|
|
37
|
+
* alias at a stub during `vite build` so those modules never enter the graph.
|
|
38
|
+
*/
|
|
39
|
+
export function resolveGenieMount(
|
|
40
|
+
appRoot: string,
|
|
41
|
+
opts: { command: string; mode?: string }
|
|
42
|
+
): string {
|
|
43
|
+
const live = join(appRoot, 'src/lib/genie/GenieHost.svelte');
|
|
44
|
+
const stub = join(appRoot, 'src/lib/genie/GenieMount.stub.svelte');
|
|
45
|
+
if (opts.command === 'serve' && opts.mode !== 'production') return live;
|
|
46
|
+
return stub;
|
|
47
|
+
}
|
|
48
|
+
|
|
33
49
|
/**
|
|
34
50
|
* Dev-only Genie Mode API. `apply: 'serve'` keeps this out of `vite build`.
|
|
35
51
|
*/
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
criticalThemePlugin,
|
|
9
9
|
writeCriticalThemeModule
|
|
10
10
|
} from './vite-plugin-critical-theme.ts';
|
|
11
|
-
import { geniePlugin } from './vite-plugin-genie.ts';
|
|
11
|
+
import { geniePlugin, resolveGenieMount } from './vite-plugin-genie.ts';
|
|
12
12
|
import { pathMountsPlugin } from './vite-plugin-path-mounts.ts';
|
|
13
13
|
import { filepressLeaseName, localberthGet } from './localberth-port.ts';
|
|
14
14
|
import type { PathMount } from '../core/src/lib/paths-shared.ts';
|
|
@@ -122,8 +122,9 @@ function resolvePort(): number | undefined {
|
|
|
122
122
|
|
|
123
123
|
const fixedPort = resolvePort();
|
|
124
124
|
|
|
125
|
-
export default defineConfig(async () => {
|
|
125
|
+
export default defineConfig(async ({ command, mode }) => {
|
|
126
126
|
const hints = await loadSiteHints();
|
|
127
|
+
const genieMount = resolveGenieMount(appRoot, { command, mode });
|
|
127
128
|
const pathMounts = hints.paths;
|
|
128
129
|
const sitePreset = resolveSitePreset(hints.theme);
|
|
129
130
|
writeFileSync(
|
|
@@ -146,7 +147,8 @@ export default defineConfig(async () => {
|
|
|
146
147
|
alias: [
|
|
147
148
|
{ find: /^@filepress\/core\/server$/, replacement: coreServer },
|
|
148
149
|
{ find: /^@filepress\/core\/theme$/, replacement: coreTheme },
|
|
149
|
-
{ find: /^@filepress\/core$/, replacement: coreEntry }
|
|
150
|
+
{ find: /^@filepress\/core$/, replacement: coreEntry },
|
|
151
|
+
{ find: /^\$genie-mount$/, replacement: genieMount }
|
|
150
152
|
]
|
|
151
153
|
},
|
|
152
154
|
optimizeDeps: {
|
|
@@ -167,7 +169,8 @@ export default defineConfig(async () => {
|
|
|
167
169
|
'$site-config': siteConfig,
|
|
168
170
|
'$site-theme': siteTheme,
|
|
169
171
|
'$site-preset': sitePreset,
|
|
170
|
-
'$critical-theme': criticalThemeOut
|
|
172
|
+
'$critical-theme': criticalThemeOut,
|
|
173
|
+
'$genie-mount': genieMount
|
|
171
174
|
},
|
|
172
175
|
paths: {
|
|
173
176
|
relative: false
|