@samebase/convex-hosting 0.3.1 → 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.
Files changed (193) hide show
  1. package/CHANGELOG.md +10 -128
  2. package/README.md +136 -398
  3. package/dist/cli/convex.d.ts +63 -0
  4. package/dist/cli/convex.js +108 -0
  5. package/dist/cli/convex.js.map +1 -0
  6. package/dist/cli/files.d.ts +18 -0
  7. package/dist/cli/files.js +106 -0
  8. package/dist/cli/files.js.map +1 -0
  9. package/dist/cli/index.d.ts +1 -11
  10. package/dist/cli/index.js +3 -58
  11. package/dist/cli/index.js.map +1 -1
  12. package/dist/cli/main.d.ts +5 -0
  13. package/dist/cli/main.js +346 -0
  14. package/dist/cli/main.js.map +1 -0
  15. package/dist/client/index.d.ts +8 -115
  16. package/dist/client/index.js +65 -254
  17. package/dist/client/index.js.map +1 -1
  18. package/dist/client/types.d.ts +5 -0
  19. package/dist/client/version-module.d.ts +6 -0
  20. package/dist/component/_generated/api.d.ts +0 -5
  21. package/dist/component/_generated/api.js.map +1 -1
  22. package/dist/component/_generated/component.d.ts +20 -18
  23. package/dist/component/_generated/dataModel.d.ts +0 -1
  24. package/dist/component/_generated/server.d.ts +12 -1
  25. package/dist/component/_generated/server.js +2 -0
  26. package/dist/component/_generated/server.js.map +1 -1
  27. package/dist/component/convex.config.d.ts +0 -1
  28. package/dist/component/lib.d.ts +175 -156
  29. package/dist/component/lib.js +396 -710
  30. package/dist/component/lib.js.map +1 -1
  31. package/dist/component/schema.d.ts +76 -72
  32. package/dist/component/schema.js +35 -59
  33. package/dist/component/schema.js.map +1 -1
  34. package/dist/workers-shared/asset-worker/src/analytics.d.ts +39 -0
  35. package/dist/workers-shared/asset-worker/src/analytics.js +86 -0
  36. package/dist/workers-shared/asset-worker/src/analytics.js.map +1 -0
  37. package/dist/workers-shared/asset-worker/src/compatibility-flags.d.ts +19 -0
  38. package/dist/workers-shared/asset-worker/src/compatibility-flags.js +29 -0
  39. package/dist/workers-shared/asset-worker/src/compatibility-flags.js.map +1 -0
  40. package/dist/workers-shared/asset-worker/src/configuration.d.ts +3 -0
  41. package/dist/workers-shared/asset-worker/src/configuration.js +30 -0
  42. package/dist/workers-shared/asset-worker/src/configuration.js.map +1 -0
  43. package/dist/workers-shared/asset-worker/src/constants.d.ts +1 -0
  44. package/dist/workers-shared/asset-worker/src/constants.js +3 -0
  45. package/dist/workers-shared/asset-worker/src/constants.js.map +1 -0
  46. package/dist/workers-shared/asset-worker/src/handler.d.ts +28 -0
  47. package/dist/workers-shared/asset-worker/src/handler.js +717 -0
  48. package/dist/workers-shared/asset-worker/src/handler.js.map +1 -0
  49. package/dist/workers-shared/asset-worker/src/types.d.ts +13 -0
  50. package/dist/workers-shared/asset-worker/src/types.js +2 -0
  51. package/dist/workers-shared/asset-worker/src/types.js.map +1 -0
  52. package/dist/workers-shared/asset-worker/src/utils/base-path.d.ts +29 -0
  53. package/dist/workers-shared/asset-worker/src/utils/base-path.js +56 -0
  54. package/dist/workers-shared/asset-worker/src/utils/base-path.js.map +1 -0
  55. package/dist/workers-shared/asset-worker/src/utils/headers.d.ts +11 -0
  56. package/dist/workers-shared/asset-worker/src/utils/headers.js +77 -0
  57. package/dist/workers-shared/asset-worker/src/utils/headers.js.map +1 -0
  58. package/dist/workers-shared/asset-worker/src/utils/rules-engine.d.ts +23 -0
  59. package/dist/workers-shared/asset-worker/src/utils/rules-engine.js +133 -0
  60. package/dist/workers-shared/asset-worker/src/utils/rules-engine.js.map +1 -0
  61. package/dist/workers-shared/asset-worker/src/worker.d.ts +14 -0
  62. package/dist/workers-shared/asset-worker/src/worker.js +12 -0
  63. package/dist/workers-shared/asset-worker/src/worker.js.map +1 -0
  64. package/dist/workers-shared/utils/base-path.d.ts +32 -0
  65. package/dist/workers-shared/utils/base-path.js +94 -0
  66. package/dist/workers-shared/utils/base-path.js.map +1 -0
  67. package/dist/workers-shared/utils/configuration/constants.d.ts +15 -0
  68. package/dist/workers-shared/utils/configuration/constants.js +16 -0
  69. package/dist/workers-shared/utils/configuration/constants.js.map +1 -0
  70. package/dist/workers-shared/utils/configuration/constructConfiguration.d.ts +12 -0
  71. package/dist/workers-shared/utils/configuration/constructConfiguration.js +103 -0
  72. package/dist/workers-shared/utils/configuration/constructConfiguration.js.map +1 -0
  73. package/dist/workers-shared/utils/configuration/parseHeaders.d.ts +5 -0
  74. package/dist/workers-shared/utils/configuration/parseHeaders.js +181 -0
  75. package/dist/workers-shared/utils/configuration/parseHeaders.js.map +1 -0
  76. package/dist/workers-shared/utils/configuration/parseRedirects.d.ts +8 -0
  77. package/dist/workers-shared/utils/configuration/parseRedirects.js +129 -0
  78. package/dist/workers-shared/utils/configuration/parseRedirects.js.map +1 -0
  79. package/dist/workers-shared/utils/configuration/parseStaticRouting.d.ts +2 -0
  80. package/dist/workers-shared/utils/configuration/parseStaticRouting.js +94 -0
  81. package/dist/workers-shared/utils/configuration/parseStaticRouting.js.map +1 -0
  82. package/dist/workers-shared/utils/configuration/types.d.ts +38 -0
  83. package/dist/workers-shared/utils/configuration/types.js +2 -0
  84. package/dist/workers-shared/utils/configuration/types.js.map +1 -0
  85. package/dist/workers-shared/utils/configuration/validateURL.d.ts +3 -0
  86. package/dist/workers-shared/utils/configuration/validateURL.js +56 -0
  87. package/dist/workers-shared/utils/configuration/validateURL.js.map +1 -0
  88. package/dist/workers-shared/utils/constants.d.ts +28 -0
  89. package/dist/workers-shared/utils/constants.js +34 -0
  90. package/dist/workers-shared/utils/constants.js.map +1 -0
  91. package/dist/workers-shared/utils/helpers.d.ts +22 -0
  92. package/dist/workers-shared/utils/helpers.js +73 -0
  93. package/dist/workers-shared/utils/helpers.js.map +1 -0
  94. package/dist/workers-shared/utils/responses.d.ts +43 -0
  95. package/dist/workers-shared/utils/responses.js +125 -0
  96. package/dist/workers-shared/utils/responses.js.map +1 -0
  97. package/dist/workers-shared/utils/tracing.d.ts +3 -0
  98. package/dist/workers-shared/utils/tracing.js +29 -0
  99. package/dist/workers-shared/utils/tracing.js.map +1 -0
  100. package/dist/workers-shared/utils/types.d.ts +131 -0
  101. package/dist/workers-shared/utils/types.js +72 -0
  102. package/dist/workers-shared/utils/types.js.map +1 -0
  103. package/package.json +16 -32
  104. package/INTEGRATION.md +0 -399
  105. package/dist/cli/args.d.ts +0 -28
  106. package/dist/cli/args.d.ts.map +0 -1
  107. package/dist/cli/args.js +0 -148
  108. package/dist/cli/args.js.map +0 -1
  109. package/dist/cli/argumentChunks.d.ts +0 -3
  110. package/dist/cli/argumentChunks.d.ts.map +0 -1
  111. package/dist/cli/argumentChunks.js +0 -29
  112. package/dist/cli/argumentChunks.js.map +0 -1
  113. package/dist/cli/collectFiles.d.ts +0 -10
  114. package/dist/cli/collectFiles.d.ts.map +0 -1
  115. package/dist/cli/collectFiles.js +0 -53
  116. package/dist/cli/collectFiles.js.map +0 -1
  117. package/dist/cli/commands.d.ts +0 -8
  118. package/dist/cli/commands.d.ts.map +0 -1
  119. package/dist/cli/commands.js +0 -56
  120. package/dist/cli/commands.js.map +0 -1
  121. package/dist/cli/componentName.d.ts +0 -32
  122. package/dist/cli/componentName.d.ts.map +0 -1
  123. package/dist/cli/componentName.js +0 -43
  124. package/dist/cli/componentName.js.map +0 -1
  125. package/dist/cli/deploy.d.ts +0 -16
  126. package/dist/cli/deploy.d.ts.map +0 -1
  127. package/dist/cli/deploy.js +0 -283
  128. package/dist/cli/deploy.js.map +0 -1
  129. package/dist/cli/deployEnvironment.d.ts +0 -10
  130. package/dist/cli/deployEnvironment.d.ts.map +0 -1
  131. package/dist/cli/deployEnvironment.js +0 -12
  132. package/dist/cli/deployEnvironment.js.map +0 -1
  133. package/dist/cli/index.d.ts.map +0 -1
  134. package/dist/cli/upload.d.ts +0 -22
  135. package/dist/cli/upload.d.ts.map +0 -1
  136. package/dist/cli/upload.js +0 -630
  137. package/dist/cli/upload.js.map +0 -1
  138. package/dist/client/_generated/_ignore.d.ts +0 -1
  139. package/dist/client/_generated/_ignore.d.ts.map +0 -1
  140. package/dist/client/_generated/_ignore.js +0 -3
  141. package/dist/client/_generated/_ignore.js.map +0 -1
  142. package/dist/client/index.d.ts.map +0 -1
  143. package/dist/component/_generated/api.d.ts.map +0 -1
  144. package/dist/component/_generated/component.d.ts.map +0 -1
  145. package/dist/component/_generated/dataModel.d.ts.map +0 -1
  146. package/dist/component/_generated/server.d.ts.map +0 -1
  147. package/dist/component/convex.config.d.ts.map +0 -1
  148. package/dist/component/http.d.ts +0 -4
  149. package/dist/component/http.d.ts.map +0 -1
  150. package/dist/component/http.js +0 -125
  151. package/dist/component/http.js.map +0 -1
  152. package/dist/component/lib.d.ts.map +0 -1
  153. package/dist/component/schema.d.ts.map +0 -1
  154. package/dist/component/serving.d.ts +0 -17
  155. package/dist/component/serving.d.ts.map +0 -1
  156. package/dist/component/serving.js +0 -150
  157. package/dist/component/serving.js.map +0 -1
  158. package/dist/react/index.d.ts +0 -59
  159. package/dist/react/index.d.ts.map +0 -1
  160. package/dist/react/index.js +0 -137
  161. package/dist/react/index.js.map +0 -1
  162. package/src/cli/args.test.ts +0 -79
  163. package/src/cli/args.ts +0 -153
  164. package/src/cli/argumentChunks.test.ts +0 -27
  165. package/src/cli/argumentChunks.ts +0 -40
  166. package/src/cli/collectFiles.test.ts +0 -26
  167. package/src/cli/collectFiles.ts +0 -59
  168. package/src/cli/commands.ts +0 -68
  169. package/src/cli/componentName.test.ts +0 -41
  170. package/src/cli/componentName.ts +0 -46
  171. package/src/cli/deploy.ts +0 -336
  172. package/src/cli/deployEnvironment.test.ts +0 -27
  173. package/src/cli/deployEnvironment.ts +0 -17
  174. package/src/cli/index.ts +0 -65
  175. package/src/cli/upload.ts +0 -837
  176. package/src/client/_generated/_ignore.ts +0 -1
  177. package/src/client/index.test.ts +0 -510
  178. package/src/client/index.ts +0 -355
  179. package/src/client/setup.test.ts +0 -22
  180. package/src/component/_generated/api.ts +0 -54
  181. package/src/component/_generated/component.ts +0 -55
  182. package/src/component/_generated/dataModel.ts +0 -60
  183. package/src/component/_generated/server.ts +0 -156
  184. package/src/component/convex.config.ts +0 -3
  185. package/src/component/http.test.ts +0 -223
  186. package/src/component/http.ts +0 -144
  187. package/src/component/lib.test.ts +0 -1007
  188. package/src/component/lib.ts +0 -862
  189. package/src/component/schema.ts +0 -75
  190. package/src/component/serving.ts +0 -158
  191. package/src/component/setup.test.ts +0 -11
  192. package/src/react/index.tsx +0 -197
  193. package/src/test.ts +0 -23
package/CHANGELOG.md CHANGED
@@ -1,133 +1,15 @@
1
1
  # Changelog
2
2
 
3
- ## 0.3.1
3
+ ## 0.4.0
4
4
 
5
- - `upload` and `deploy` no longer upload `_headers` and `_redirects` from the root of `dist/`.
6
- Cloudflare and Netlify read these files as hosting rules. Before this change the site served them
7
- as public files.
5
+ A new install. 0.4 does not read the data of 0.3.x and has no migration: delete the tables of the
6
+ old component by hand, then set up the app as the README says.
8
7
 
9
- ## 0.3.0
8
+ - One command, `convex-hosting deploy`, for production, a preview (`--preview-name <name>`), and the
9
+ development deployment (`--dev`). The push switches the site.
10
+ - Cloudflare's asset handler serves the files, with `_headers`, `_redirects`, `.assetsignore`,
11
+ `html_handling`, and `not_found_handling`.
12
+ - The first request that new code serves marks its version live and deletes the versions live before
13
+ it. A version that never becomes live is deleted when it is a day old.
10
14
 
11
- First release as `@samebase/convex-hosting`, Samebase's fork of `@convex-dev/static-hosting`. See
12
- "Switching from @convex-dev/static-hosting" in the README.
13
-
14
- - The package, the CLI command (`convex-hosting`), the component (`hosting`), the default deployment
15
- query module (`convex/hosting.ts`), and the `CONVEX_HOSTING_BASE_PATH` build variable share one
16
- name. The CLI still finds an instance named `staticHosting`.
17
- - `serveStaticAsset` serves one uploaded file from your own HTTP route, for custom routing and
18
- server rendering.
19
- - `upload --preview-name` uploads to a named preview deployment.
20
- - Replaced files stay available for at least seven days, so pages that are already open can still
21
- load their scripts.
22
- - The `setup` and `init` commands are removed. The README describes the setup steps.
23
-
24
- Versions up to 0.2.1 were released as `@convex-dev/static-hosting`.
25
-
26
- ## 0.2.1
27
-
28
- - Smoother migration story, with more automatic fallbacks to the old component name.
29
-
30
- ## 0.2.0
31
-
32
- Component-owned HTTP and storage.
33
-
34
- **Breaking — redeploy your static assets after upgrading.**
35
-
36
- See the [0.1.x to 0.2.x migration guide](./MIGRATION.md) before upgrading an existing deployment.
37
-
38
- - The component now hosts its own HTTP endpoints and owns the file storage that serves them. Wire it
39
- up with `app.use(staticHosting, { httpPrefix: "/" })` and delete related code in`convex/http.ts` +
40
- the upload-API re-exports from `convex/staticHosting.ts`.
41
- - Removed `exposeUploadApi` from the client API. Uploads and file lifecycle are now handled by
42
- private component functions.
43
- - `registerStaticRoutes` remains as a compatibility mode for apps that need to keep existing auth,
44
- webhook, or API routes at the root. It serves the new component-owned files from the app's
45
- existing `convex/http.ts` catch-all. During a same-name v1→v2 migration it also serves inherited
46
- v1 files straight from the app's own storage, so the live site stays up with no re-upload gap.
47
- Mounting the component's own handler is still the faster default.
48
- - `exposeDeploymentQuery` and `getConvexUrl` remain if you use the UpdateBanner.
49
- - The component is now named `staticHosting` (previously `selfHosting`). The CLI invokes it directly
50
- via `npx convex run --component staticHosting lib:...`. If you mount the component under a
51
- different name, pass `--component <your-name>`. For a smooth upgrade, pass {name: "selfHosting} to
52
- `app.use(staticHosting, { name: "selfHosting" })`
53
- - `useDeploymentUpdates` / `UpdateBanner` use `useQuery_experimental` and default to
54
- `api.staticHosting.getCurrentDeployment`. If you don't surface deployment updates, you no longer
55
- need to expose anything.
56
- - Assets uploaded under 0.1.x lived in the app's storage — the component-owned HTTP handler can't
57
- resolve those references in 0.2.x. Run `npx @convex-dev/static-hosting deploy` to repopulate. (In
58
- app-owned root routing the app-side handler keeps serving those v1 files from app storage until
59
- the first upload replaces them, so that mode has no asset-less window.) The first 0.2.x upload
60
- safely discards those legacy storage references instead of trying to delete them from component
61
- storage. The old blobs remain in app storage until you explicitly clean them up after the rollback
62
- window. Older 0.1.x deploys may also have left historical blobs that the current asset manifest no
63
- longer lists, so follow the migration guide's app-storage audit before cleanup.
64
- - Default setup prefixes your own HTTP routes with `defineApp({ httpPrefix: "/api" })` so the static
65
- site can own the root without the catch-all route shadowing them. Use `registerStaticRoutes` when
66
- those existing root route URLs cannot move.
67
- - SPA fallback is now configurable per deployment. Deploy with `--no-spa` (`deploy` or `upload`) to
68
- make extension-less misses return 404 instead of `index.html`. The setting is stored on the
69
- deployment record, so it travels with the code you ship.
70
- - Hashed-asset caching recognizes Vite's base64url hashes (including `-`) and numeric extensions
71
- such as `.woff2`. HTML always uses revalidation, even if its filename looks content-hashed.
72
- - The `cdnBaseUrl` override remains available in `registerStaticRoutes` compatibility mode.
73
- Component-owned HTTP routes redirect CDN blobs to the deployment's own `{origin}/fs/blobs`.
74
- - `--cdn` is now documented as a legacy option. Its setup guide targeted an old unauthenticated
75
- convex-fs API and does not work with current ConvexFS. New integrations should use Convex storage
76
- until authenticated CDN uploads are designed.
77
- - Storage and legacy CDN assets, deployment settings, and old-file cleanup are published in one
78
- atomic mutation after all uploads finish. New HTML cannot race ahead of its referenced asset
79
- records, and a failed publish leaves the previous deployment live. Replaced CDN blob IDs are
80
- retained for cleanup.
81
- - Upload errors now report the failing file and HTTP status. Oversized manifests fail with a clear
82
- size error, and newly uploaded component files are removed after a failed upload or publish.
83
- - Static handlers decode percent-encoded paths, accept weak or listed ETags, and return a
84
- non-cacheable HTTP 503 setup page until the first upload succeeds.
85
- - Removed the install-time console banner.
86
-
87
- ## 0.1.5
88
-
89
- - Forward-compatibility for 0.2.x rollbacks. The `deploymentInfo` schema and the
90
- `getCurrentDeployment` return validator now allow the optional `spaFallback` (boolean) and
91
- `pendingBlobCleanupCount` (number) fields that 0.2.x writes to the deployment record. 0.1.5
92
- ignores them, but allowing them means a deployment upgraded to 0.2.x and later rolled back to
93
- 0.1.x keeps validating. No behavior change for 0.1.x users; upgrade to 0.1.5 before trying 0.2.x
94
- if you want a clean rollback path. (0.2.x also creates additional tables such as `stagedAssets`
95
- and `cleanupState`; extra tables don't fail 0.1.x schema validation, so they need no entry here.)
96
-
97
- ## 0.1.4
98
-
99
- - Added support for Windows
100
-
101
- ## 0.1.3
102
-
103
- - Fix missing README in published package
104
-
105
- ## 0.1.2
106
-
107
- - Rename package from `@convex-dev/self-hosting` to `@convex-dev/static-hosting`
108
-
109
- ## 0.1.1-alpha.0
110
-
111
- - Add optional convex-fs CDN mode for static asset serving (`--cdn` flag)
112
- - Non-HTML assets can be served from CDN edge network via convex-fs
113
- - New `cdnBaseUrl` option on `registerStaticRoutes`
114
- - Schema: `storageId` now optional, new `blobId` field for CDN assets
115
- - `gcOldAssets` returns `{ deleted, blobIds }` (breaking change from number return)
116
-
117
- ## 0.1.2-alpha.1
118
-
119
- removed cloudflare for now.
120
-
121
- ## 0.1.1
122
-
123
- - Setup wizard now configures custom domains for Cloudflare Workers
124
- - Added note about running `convex dev` for HTTP actions error
125
- - Added documentation for non-Vite bundlers (Expo, Next.js)
126
-
127
- ## 0.1.0
128
-
129
- - Migrated from Cloudflare Pages to Workers Static Assets
130
-
131
- ## 0.0.0
132
-
133
- - Initial release.
15
+ Earlier versions: see the [release history](https://github.com/samebase/convex-hosting/releases).