@byline/storage-local 1.7.0 → 1.7.1

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.
@@ -11,7 +11,14 @@ export interface LocalStorageConfig {
11
11
  * Absolute or project-relative path to the root directory where uploaded
12
12
  * files will be stored.
13
13
  *
14
- * @example `'./public/uploads'`
14
+ * For TanStack Start + Nitro hosts, keep this OUTSIDE `public/` — anything
15
+ * under `public/` is snapshotted into `.output/public/` at build time and
16
+ * served by Nitro's static handler from that snapshot, so files written at
17
+ * runtime won't appear until the next rebuild. Pair `uploadDir` with a
18
+ * runtime handler in your server entry that streams from this directory
19
+ * on every request.
20
+ *
21
+ * @example `'./uploads'`
15
22
  */
16
23
  uploadDir: string;
17
24
  /**
@@ -30,10 +37,18 @@ export interface LocalStorageConfig {
30
37
  * `<collection>/<year>/<month>/<uuid>-<filename>`
31
38
  *
32
39
  * The provider generates a public URL by prepending `baseUrl` to the
33
- * storage path. Pair this with a static file server (e.g. Express
34
- * `express.static`, TanStack Start's static file serving, or nginx) that
40
+ * storage path. Pair this with a runtime file handler (Express
41
+ * `express.static`, an h3 handler, an nginx location block, or a small
42
+ * `Request → Response` shim in your TanStack Start `server.ts`) that
35
43
  * serves the `uploadDir` directory at the `baseUrl` path.
36
44
  *
45
+ * On TanStack Start + Nitro, do NOT use `nitro.publicAssets` for this:
46
+ * `publicAssets` copies into `.output/public/<baseURL>/` at build time
47
+ * and the Nitro static handler reads from a build-time virtual asset
48
+ * registry, so files written after the build never resolve. Use a
49
+ * runtime handler in `src/server.ts` instead — see the host scaffold
50
+ * shipped by `@byline/cli` for a worked example.
51
+ *
37
52
  * @example
38
53
  * ```ts
39
54
  * import { localStorageProvider } from '@byline/storage-local'
@@ -43,7 +58,7 @@ export interface LocalStorageConfig {
43
58
  * ...config,
44
59
  * db: pgAdapter({ connectionString: process.env.DB_CONNECTION_STRING! }),
45
60
  * storage: localStorageProvider({
46
- * uploadDir: './public/uploads',
61
+ * uploadDir: './uploads',
47
62
  * baseUrl: '/uploads',
48
63
  * }),
49
64
  * })
@@ -97,10 +97,18 @@ class LocalStorageProvider {
97
97
  * `<collection>/<year>/<month>/<uuid>-<filename>`
98
98
  *
99
99
  * The provider generates a public URL by prepending `baseUrl` to the
100
- * storage path. Pair this with a static file server (e.g. Express
101
- * `express.static`, TanStack Start's static file serving, or nginx) that
100
+ * storage path. Pair this with a runtime file handler (Express
101
+ * `express.static`, an h3 handler, an nginx location block, or a small
102
+ * `Request → Response` shim in your TanStack Start `server.ts`) that
102
103
  * serves the `uploadDir` directory at the `baseUrl` path.
103
104
  *
105
+ * On TanStack Start + Nitro, do NOT use `nitro.publicAssets` for this:
106
+ * `publicAssets` copies into `.output/public/<baseURL>/` at build time
107
+ * and the Nitro static handler reads from a build-time virtual asset
108
+ * registry, so files written after the build never resolve. Use a
109
+ * runtime handler in `src/server.ts` instead — see the host scaffold
110
+ * shipped by `@byline/cli` for a worked example.
111
+ *
104
112
  * @example
105
113
  * ```ts
106
114
  * import { localStorageProvider } from '@byline/storage-local'
@@ -110,7 +118,7 @@ class LocalStorageProvider {
110
118
  * ...config,
111
119
  * db: pgAdapter({ connectionString: process.env.DB_CONNECTION_STRING! }),
112
120
  * storage: localStorageProvider({
113
- * uploadDir: './public/uploads',
121
+ * uploadDir: './uploads',
114
122
  * baseUrl: '/uploads',
115
123
  * }),
116
124
  * })
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@byline/storage-local",
3
3
  "private": false,
4
4
  "license": "MPL-2.0",
5
- "version": "1.7.0",
5
+ "version": "1.7.1",
6
6
  "engines": {
7
7
  "node": ">=20.9.0"
8
8
  },
@@ -40,7 +40,7 @@
40
40
  "dependencies": {
41
41
  "npm-run-all": "^4.1.5",
42
42
  "uuid": "^14.0.0",
43
- "@byline/core": "1.7.0"
43
+ "@byline/core": "1.7.1"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@biomejs/biome": "2.4.14",