getfilepress 0.1.6 → 0.1.8

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "getfilepress",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "FilePress — file-based Markdown blog engine. Link this package from a content-only site (config + posts), then run `filepress build`.",
@@ -91,9 +91,9 @@
91
91
  "build:www": "pnpm filepress build --site getfilepress",
92
92
  "ship": "pnpm build:www && wrangler pages deploy sites/getfilepress/build --project-name getfilepress",
93
93
  "deploy:www": "pnpm ship",
94
- "dev": "node scripts/ensure-lease.mjs demo 5179 && pnpm filepress dev --site demo",
95
- "dev:demo": "node scripts/ensure-lease.mjs demo 5179 && pnpm filepress dev --site demo",
96
- "dev:www": "node scripts/ensure-lease.mjs getfilepress 5180 && pnpm filepress dev --site getfilepress",
94
+ "dev": "node scripts/ensure-lease.mjs demo 5179 && pnpm filepress dev --site demo --host 0.0.0.0",
95
+ "dev:demo": "node scripts/ensure-lease.mjs demo 5179 && pnpm filepress dev --site demo --host 0.0.0.0",
96
+ "dev:www": "node scripts/ensure-lease.mjs getfilepress 5180 && pnpm filepress dev --site getfilepress --host 0.0.0.0",
97
97
  "create-site": "node scripts/create-site.mjs",
98
98
  "sync-siblings": "tsx scripts/sync-sibling-sites.ts",
99
99
  "import": "node scripts/filepress.mjs import",
@@ -1,31 +1,31 @@
1
- {
2
- "name": "@filepress/app",
3
- "private": true,
4
- "version": "0.1.3",
5
- "type": "module",
6
- "description": "The single SvelteKit app for filepress. Sites under sites/* supply config + posts + static; this package owns all routes.",
7
- "scripts": {
8
- "dev": "vite dev",
9
- "build": "vite build",
10
- "preview": "vite preview",
11
- "prepare": "svelte-kit sync || echo ''",
12
- "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
13
- "test": "vitest run --config vitest.config.ts"
14
- },
15
- "dependencies": {
16
- "@filepress/core": "workspace:*",
17
- "@filepress/import": "workspace:*"
18
- },
19
- "devDependencies": {
20
- "@sveltejs/adapter-static": "^3.0.10",
21
- "@sveltejs/kit": "^2.63.0",
22
- "@sveltejs/vite-plugin-svelte": "^7.1.2",
23
- "@types/node": "^26.1.0",
24
- "sirv-cli": "^3.0.1",
25
- "svelte": "^5.56.1",
26
- "svelte-check": "^4.6.0",
27
- "typescript": "^6.0.3",
28
- "vite": "^8.0.16",
29
- "vitest": "^4.1.9"
30
- }
31
- }
1
+ {
2
+ "name": "@filepress/app",
3
+ "private": true,
4
+ "version": "0.1.3",
5
+ "type": "module",
6
+ "description": "The single SvelteKit app for filepress. Sites under sites/* supply config + posts + static; this package owns all routes.",
7
+ "scripts": {
8
+ "dev": "vite dev --host",
9
+ "build": "vite build",
10
+ "preview": "vite preview",
11
+ "prepare": "svelte-kit sync || echo ''",
12
+ "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
13
+ "test": "vitest run --config vitest.config.ts"
14
+ },
15
+ "dependencies": {
16
+ "@filepress/core": "workspace:*",
17
+ "@filepress/import": "workspace:*"
18
+ },
19
+ "devDependencies": {
20
+ "@sveltejs/adapter-static": "^3.0.10",
21
+ "@sveltejs/kit": "^2.63.0",
22
+ "@sveltejs/vite-plugin-svelte": "^7.1.2",
23
+ "@types/node": "^26.1.0",
24
+ "sirv-cli": "^3.0.1",
25
+ "svelte": "^5.56.1",
26
+ "svelte-check": "^4.6.0",
27
+ "typescript": "^6.0.3",
28
+ "vite": "^8.0.16",
29
+ "vitest": "^4.1.9"
30
+ }
31
+ }
@@ -1,14 +1,23 @@
1
1
  <script lang="ts">
2
2
  import '$lib/theme-entry';
3
3
  import criticalTheme from '$critical-theme';
4
- import { SiteHeader, SiteFooter } from '@filepress/core';
4
+ import { SiteHeader, SiteFooter, isPathMountHref } from '@filepress/core';
5
5
  import config from '$site-config';
6
6
  import GenieHost from '$lib/genie/GenieHost.svelte';
7
7
 
8
-
9
8
  let { children } = $props();
9
+
10
+ function markPathMountLink(event: PointerEvent) {
11
+ const a = (event.target as HTMLElement | null)?.closest('a[href]');
12
+ if (!a) return;
13
+ const href = a.getAttribute('href');
14
+ if (!href || !isPathMountHref(href, config.paths)) return;
15
+ a.setAttribute('data-sveltekit-reload', '');
16
+ }
10
17
  </script>
11
18
 
19
+ <svelte:window onpointerdown={markPathMountLink} />
20
+
12
21
  <svelte:head>
13
22
  {#if criticalTheme}
14
23
  {@html `<style data-filepress-critical>${criticalTheme}</style>`}
@@ -102,12 +102,13 @@ export default defineConfig(async () => {
102
102
  `${JSON.stringify(pathMounts, null, '\t')}\n`
103
103
  );
104
104
 
105
+ const host = process.env.HOST?.trim() || '127.0.0.1';
105
106
  return {
106
107
  server: fixedPort
107
- ? { port: fixedPort, strictPort: true }
108
+ ? { host, port: fixedPort, strictPort: true }
108
109
  : undefined,
109
110
  preview: fixedPort
110
- ? { port: fixedPort, strictPort: true }
111
+ ? { host, port: fixedPort, strictPort: true }
111
112
  : undefined,
112
113
  resolve: {
113
114
  alias: [
@@ -1,5 +1,6 @@
1
1
  <script lang="ts">
2
2
  import type { SiteConfig } from '../config';
3
+ import { isPathMountHref } from '../paths-shared';
3
4
  import NavIcon from './NavIcon.svelte';
4
5
 
5
6
  let { site, year = new Date().getFullYear() }: { site: SiteConfig; year?: number } = $props();
@@ -16,7 +17,9 @@
16
17
  class:nav-github={item.icon === 'github'}
17
18
  {...(item.icon === 'github'
18
19
  ? { target: '_blank', rel: 'noopener noreferrer' }
19
- : {})}
20
+ : isPathMountHref(item.href, site.paths)
21
+ ? { 'data-sveltekit-reload': true }
22
+ : {})}
20
23
  >
21
24
  {#if item.icon}
22
25
  <NavIcon name={item.icon} />
@@ -1,5 +1,6 @@
1
1
  <script lang="ts">
2
2
  import type { SiteConfig } from '../config';
3
+ import { isPathMountHref } from '../paths-shared';
3
4
  import NavIcon from './NavIcon.svelte';
4
5
 
5
6
  let { site }: { site: SiteConfig } = $props();
@@ -28,7 +29,9 @@
28
29
  class:nav-github={item.icon === 'github'}
29
30
  {...(item.icon === 'github'
30
31
  ? { target: '_blank', rel: 'noopener noreferrer' }
31
- : {})}
32
+ : isPathMountHref(item.href, site.paths)
33
+ ? { 'data-sveltekit-reload': true }
34
+ : {})}
32
35
  >
33
36
  {#if item.icon}
34
37
  <NavIcon name={item.icon} />
@@ -24,6 +24,8 @@ export type {
24
24
  PathMount
25
25
  } from './config';
26
26
 
27
+ export { isPathMountHref } from './paths-shared';
28
+
27
29
  export { formatDate } from './format';
28
30
 
29
31
  export type { PostMeta, PostSource, RenderedPost, RawFrontmatter } from './content/types';
@@ -87,3 +87,11 @@ export function normalizePathMounts(input: PathMount[] | undefined): PathMount[]
87
87
  export function pathMountReservedSlugs(mounts: PathMount[]): string[] {
88
88
  return mounts.map((m) => m.url.slice(1).split('/')[0]!).filter(Boolean);
89
89
  }
90
+
91
+ /** Same-origin href that belongs to a `paths` mount (e.g. `/docs`, `/docs/install`). */
92
+ export function isPathMountHref(href: string, mounts: PathMount[]): boolean {
93
+ const raw = href.trim();
94
+ if (!raw.startsWith('/')) return false;
95
+ const path = raw.split(/[?#]/)[0] ?? '';
96
+ return mounts.some((m) => path === m.url || path.startsWith(`${m.url}/`));
97
+ }
@@ -12,7 +12,7 @@ import { join, relative, resolve, sep } from 'node:path';
12
12
  import type { PathMount } from './paths-shared';
13
13
 
14
14
  export type { PathMount } from './paths-shared';
15
- export { normalizePathMounts, pathMountReservedSlugs } from './paths-shared';
15
+ export { normalizePathMounts, pathMountReservedSlugs, isPathMountHref } from './paths-shared';
16
16
 
17
17
  /** Absolute filesystem path for a mount's source directory. */
18
18
  export function resolvePathMountDir(siteRoot: string, mount: PathMount): string {
@@ -144,7 +144,7 @@ if (external) {
144
144
  version: '0.0.1',
145
145
  type: 'module',
146
146
  scripts: {
147
- dev: 'filepress dev',
147
+ dev: 'filepress dev --host 0.0.0.0',
148
148
  build: 'filepress build',
149
149
  preview: 'filepress preview',
150
150
  check: 'filepress check'
@@ -59,7 +59,12 @@ function parseArgs(argv) {
59
59
  } else if (a.startsWith('--port=')) {
60
60
  args.port = a.slice('--port='.length);
61
61
  } else if (a === '--host') {
62
- args.host = argv[++i] ?? 'true';
62
+ const next = argv[i + 1];
63
+ if (next && !next.startsWith('-')) {
64
+ args.host = argv[++i];
65
+ } else {
66
+ args.host = '0.0.0.0';
67
+ }
63
68
  } else if (a.startsWith('--host=')) {
64
69
  args.host = a.slice('--host='.length);
65
70
  } else if (a === '--') {
@@ -183,7 +188,7 @@ function runSiteCommand(argv) {
183
188
  ` filepress <${[...COMMANDS].join('|')}> # cwd is the site\n` +
184
189
  ` filepress <${[...COMMANDS].join('|')}> --root <path>\n` +
185
190
  ` filepress preview [--port 27777] # serves <site>/build (default 27777)\n` +
186
- ` filepress dev --port <n> # vite dev; optional fixed port\n` +
191
+ ` filepress dev --port <n> [--host] # vite dev; optional fixed port / LAN\n` +
187
192
  ` filepress import --source <url> [--inspire <url>] …\n` +
188
193
  `monorepo sites: ${listSites().join(', ') || '(none)'}`
189
194
  );
@@ -218,6 +223,9 @@ function runSiteCommand(argv) {
218
223
  ...process.env,
219
224
  FILEPRESS_SITE_ROOT: siteRoot
220
225
  };
226
+ if (args.host !== null) {
227
+ env.HOST = args.host === 'true' ? '0.0.0.0' : args.host;
228
+ }
221
229
 
222
230
  // Preview must serve the site's own build/ — not packages/app/.svelte-kit
223
231
  // (shared across sites; another agent's last build can leak onto vite preview).
@@ -240,7 +248,7 @@ function runSiteCommand(argv) {
240
248
  '--port',
241
249
  String(port),
242
250
  '--host',
243
- args.host && args.host !== 'true' ? args.host : '127.0.0.1'
251
+ args.host && args.host !== 'true' ? args.host : args.host === 'true' ? '0.0.0.0' : '127.0.0.1'
244
252
  ],
245
253
  { cwd: appDir, env }
246
254
  );
@@ -279,7 +287,7 @@ function runSiteCommand(argv) {
279
287
 
280
288
  // dev | build → vite
281
289
  const viteArgs = [command];
282
- if (args.host !== null) viteArgs.push('--host', args.host === 'true' ? 'true' : args.host);
290
+ if (args.host !== null) viteArgs.push('--host', args.host === 'true' ? '0.0.0.0' : args.host);
283
291
  viteArgs.push(...args.extra);
284
292
  runNodeBin('vite', 'vite', viteArgs, {
285
293
  cwd: appDir,