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