@stacksjs/types 0.75.98 → 0.75.99

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 (2) hide show
  1. package/dist/server.d.ts +36 -0
  2. package/package.json +4 -4
package/dist/server.d.ts CHANGED
@@ -19,6 +19,7 @@ export declare interface ServerConfig {
19
19
  proxy?: ApiProxyOptions
20
20
  redirects?: RedirectsOptions
21
21
  rewrites?: RewritesOptions
22
+ domains?: DomainsOptions
22
23
  cache?: ServerCacheOptions
23
24
  security?: ServerSecurityOptions
24
25
  }
@@ -107,3 +108,38 @@ export type RedirectsOptions = Record<string, string | {
107
108
  * A rewrite whose source is already under `/api/` is ignored.
108
109
  */
109
110
  export type RewritesOptions = Record<string, string>;
111
+ /**
112
+ * Hosts whose home page is a page of the site.
113
+ *
114
+ * ```ts
115
+ * domains: {
116
+ * '{username}.example.com': '/{username}',
117
+ * 'shop.example.com': '/store',
118
+ * }
119
+ * ```
120
+ *
121
+ * `chris.example.com` then renders exactly what `example.com/chris` renders —
122
+ * the same view, `resources/views/[username].stx`, with the same
123
+ * `route.params.username` — while the address bar keeps the host. It is how a
124
+ * profile, a team or a shop gets a domain of its own on a site that is
125
+ * otherwise one app, the way GitHub Pages or a Substack subdomain does.
126
+ *
127
+ * Only the host's root is routed. Every other path on that host (assets,
128
+ * `/api`, the other pages a navigation bar links to) is the site's own,
129
+ * answered as on the main domain, so one page can be given a domain without
130
+ * the rest of the site breaking under it.
131
+ *
132
+ * A label written `{name}` matches exactly one DNS label, so the pattern
133
+ * above matches `chris.example.com` but neither the bare apex nor
134
+ * `a.b.example.com`. Literal hosts win over parameterised ones. The host is
135
+ * read from `X-Forwarded-Host` first, as a gateway in front sends it.
136
+ *
137
+ * Routing the requests here is half of it: the hostnames must also reach the
138
+ * server. With ts-cloud, list `*.example.com` in the site's `aliases` (see
139
+ * `config/cloud.ts`) and the deploy adds the wildcard DNS record, the gateway
140
+ * route and a wildcard certificate.
141
+ *
142
+ * Answered by stx's own router (`serve({ domains })`, stx >= 0.2.410) under
143
+ * both `buddy dev` and `buddy serve`; `buddy dev` prints the routes at boot.
144
+ */
145
+ export type DomainsOptions = Record<string, string>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/types",
3
3
  "type": "module",
4
- "version": "0.75.98",
4
+ "version": "0.75.99",
5
5
  "description": "The Stacks framework types.",
6
6
  "author": "Chris Breuer",
7
7
  "contributors": [
@@ -58,8 +58,8 @@
58
58
  "dependencies": {
59
59
  "@stacksjs/bunpress": "^0.2.15",
60
60
  "@stacksjs/clapp": "^0.2.12",
61
- "@stacksjs/events": "0.75.98",
62
- "@stacksjs/strings": "0.75.98",
61
+ "@stacksjs/events": "0.75.99",
62
+ "@stacksjs/strings": "0.75.99",
63
63
  "@stacksjs/stx": "^0.2.408",
64
64
  "@stacksjs/ts-validation": "^0.5.6",
65
65
  "bun-query-builder": "^0.3.5"
@@ -73,7 +73,7 @@
73
73
  }
74
74
  },
75
75
  "devDependencies": {
76
- "@stacksjs/validation": "0.75.98",
76
+ "@stacksjs/validation": "0.75.99",
77
77
  "better-dx": "^0.2.24",
78
78
  "meilisearch": "^0.62.0"
79
79
  },