@altafusion/nuxt-base 0.3.5 → 0.4.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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @altafusion/nuxt-base
2
2
 
3
+ ## 0.4.0
4
+
5
+ ### Patch Changes
6
+
7
+ - a5133f5: Allow a linked Fugue checkout in Vite's `server.fs.allow`. With `pnpm link:fugue`, Nuxt Content's `sqlite3.wasm` is served from the checkout's `node_modules`, which Vite blocked (403), so a client-side navigation to a content page failed with "Failed to load content." Installed from npm, nothing changes.
8
+ - @altafusion/eslint-config@0.4.0
9
+
3
10
  ## 0.3.5
4
11
 
5
12
  ### Patch Changes
package/dev/ports.ts CHANGED
@@ -1,5 +1,8 @@
1
1
  /** Canonical local dev HTTP ports — 70xx range so apps can run in parallel. */
2
+ import { existsSync } from 'node:fs'
3
+ import { dirname, join, resolve, sep } from 'node:path'
2
4
  import process from 'node:process'
5
+ import { fileURLToPath } from 'node:url'
3
6
 
4
7
  // Port 7003 is reserved for the first site copied from templates/fugue-content-site (not assigned here).
5
8
  export const devPorts = {
@@ -23,17 +26,41 @@ export function devServerOptions(port: number) {
23
26
  } as const
24
27
  }
25
28
 
29
+ /**
30
+ * Root of the Fugue checkout this package runs from when an app links it (`pnpm link:fugue`), or `null` when the package is
31
+ * installed from npm. A linked checkout sits outside the app's root, so Vite refuses to serve files in its `node_modules`
32
+ * (for example Nuxt Content's `sqlite3.wasm`, which the browser needs to query content on a client-side navigation).
33
+ * Installed from npm, this package lives under the app's own `node_modules`, which Vite already allows.
34
+ */
35
+ export function linkedCheckoutRoot(dir: string = dirname(fileURLToPath(import.meta.url))): string | null {
36
+ const root = resolve(dir, '../../..')
37
+ if (root.split(sep).includes('node_modules'))
38
+ return null
39
+ return existsSync(join(root, 'pnpm-workspace.yaml'))
40
+ ? root
41
+ : null
42
+ }
43
+
26
44
  /**
27
45
  * Vite dev-server opts. The HTTP port stays on `devServer`.
28
46
  * Nuxt attaches the HMR websocket to that same server — do not set
29
47
  * `hmr.port` or `hmr.clientPort` to a different port.
48
+ * When the package is linked from a Fugue checkout, that checkout is added to `fs.allow` (see {@link linkedCheckoutRoot}).
30
49
  */
31
50
  export function devViteServerOptions() {
51
+ const linkedRoot = linkedCheckoutRoot()
32
52
  return {
33
53
  host: 'localhost',
34
54
  strictPort: true,
35
55
  hmr: { host: 'localhost' },
36
- } as const
56
+ ...(linkedRoot
57
+ ? {
58
+ fs: {
59
+ allow: [linkedRoot],
60
+ },
61
+ }
62
+ : {}),
63
+ }
37
64
  }
38
65
 
39
66
  /**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@altafusion/nuxt-base",
3
3
  "type": "module",
4
- "version": "0.3.5",
4
+ "version": "0.4.0",
5
5
  "description": "Base Nuxt layer and configuration for Altafusion packages",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/altafusion/fugue/tree/main/packages-platform/nuxt-base#readme",
@@ -34,7 +34,7 @@
34
34
  "vite": ">=6.0.0"
35
35
  },
36
36
  "dependencies": {
37
- "@altafusion/eslint-config": "0.3.5",
37
+ "@altafusion/eslint-config": "0.4.0",
38
38
  "@nuxt/kit": "^4.7.0",
39
39
  "defu": "^6.1.7",
40
40
  "nuxt": "^4.7.0",