@taggor/server 0.4.0 → 0.6.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/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  The helper a site with a server uses to put a Taggor component in its first HTML response. One function,
4
4
  no dependency, no framework: the result is a string.
5
5
 
6
- > Where server-side rendering is not switched on for your site (or the site has no server key yet), `render`
6
+ > If the site has no server key, `render`
7
7
  > returns the bare tag, which is what the page has without it, so installing this package changes nothing on
8
8
  > your site. The docs page for server-side rendering is at <https://taggor.dev/docs/ssr/>.
9
9
 
@@ -13,9 +13,9 @@ no dependency, no framework: the result is a string.
13
13
  (`GET <origin>/r/<siteKey>/<tag>?<attributes>`, with the site's server key as `Authorization: Bearer <key>`)
14
14
  and returns HTML to write where the tag would go: the element
15
15
  with its shadow root already filled, which a browser shows before any script. The site's snippet stays as it is;
16
- the Taggor runtime takes over the elements already on the screen. Whatever goes wrong (Taggor slow or down, the
17
- route off, a component that cannot render on a server) it returns the bare tag, and the component renders in
18
- the browser as it always did.
16
+ the Taggor runtime takes over the elements already on the screen. Whatever goes wrong (Taggor slow or down, a
17
+ component that cannot render on a server) it returns the bare tag, and the component renders in
18
+ the browser as it does with the snippet alone.
19
19
 
20
20
  ## Use
21
21
 
@@ -50,7 +50,7 @@ anything the network or Taggor does.
50
50
 
51
51
  ## The server key
52
52
 
53
- The site key is public; the server key is a secret, so only the customer's servers spend the site's server
53
+ The site key is public; the server key is a secret, so only your servers spend the site's server
54
54
  renders. Create it on the site's Install > SSR tab in the portal (or `POST /v1/sites/{site_id}/server-keys`);
55
55
  it is shown once. Put it in the server's environment as `TAGGOR_SERVER_KEY` and never in browser code, the
56
56
  page, a public environment variable or the repository. A site without a key gets no server rendering, and a
@@ -61,8 +61,7 @@ revoke the old one (it stops working within a few minutes at most). The helper s
61
61
  ## Where the HTML goes
62
62
 
63
63
  The result is HTML text and each framework has its own raw HTML output. Below, `taggor` is the helper above
64
- in a module that runs only on the server, with `serverKey: process.env.TAGGOR_SERVER_KEY`. More examples (React Router,
65
- SvelteKit, Flask) come with the docs page when server-side rendering is switched on.
64
+ in a module that runs only on the server, with `serverKey: process.env.TAGGOR_SERVER_KEY`.
66
65
 
67
66
  **Next.js (App Router, a Server Component).** `suppressHydrationWarning` is needed: the browser consumes the
68
67
  `<template>` when it creates the shadow root, so React would log a hydration error in development. Render the
@@ -116,10 +115,10 @@ app.get("/", async (_request, response) => {
116
115
  });
117
116
  ```
118
117
 
119
- **Plain PHP, over HTTP (no WordPress plugin).** Any language can do what the helper does: one request with the
118
+ **Plain PHP, over HTTP.** Any language can do what the helper does: one request with the
120
119
  server key in an `Authorization: Bearer` header (never in the URL) and a short timeout; if the answer is `200`,
121
- `text/html`, starts with `<tag` and ends with `</tag>`, write the body, otherwise the bare tag. **Not run**
122
- (there is no PHP on the machine that wrote this); it is a sketch of that rule.
120
+ `text/html`, starts with `<tag` and ends with `</tag>`, write the body, otherwise the bare tag. This function follows
121
+ that rule.
123
122
 
124
123
  ```php
125
124
  function taggor_render(string $tag, array $attrs = [], string $lang = ''): string {
@@ -163,6 +162,6 @@ spend it; a leaked key spends it until it is revoked.
163
162
  ## Runtimes
164
163
 
165
164
  The package is one file with no dependency and imports nothing, not even a Node built-in. It was checked as a
166
- consumer under Node 26 and Deno 2. Bun is **not tested**.
165
+ consumer under Node 26 and Deno 2.
167
166
 
168
167
  License: MIT
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * `@taggor/server` (SSR spike, ADR 0066): the helper a site with a server uses to put a Taggor
2
+ * `@taggor/server`: the helper a site with a server uses to put a Taggor
3
3
  * component in its first HTML response.
4
4
  *
5
5
  * `render(tag, attributes)` asks the Taggor edge for the component's server-rendered fragment
@@ -10,7 +10,7 @@
10
10
  * the page has without this helper, and the component renders in the browser as it always did.
11
11
  * The site's snippet (`/s/<siteKey>.js`) stays as it is; this adds nothing to the browser.
12
12
  *
13
- * Server key (spike, ADR 0066, no ticket): every request carries the site's server key
13
+ * Server key: every request carries the site's server key
14
14
  * (`tgs_live_…`, created in the portal's Install > SSR tab or through `POST /v1/sites/{id}/server-keys`)
15
15
  * as `Authorization: Bearer <key>`; without a valid one the edge refuses and this helper writes the
16
16
  * bare tag. The key is a server secret: read it from the server's environment
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * `@taggor/server` (SSR spike, ADR 0066): the helper a site with a server uses to put a Taggor
2
+ * `@taggor/server`: the helper a site with a server uses to put a Taggor
3
3
  * component in its first HTML response.
4
4
  *
5
5
  * `render(tag, attributes)` asks the Taggor edge for the component's server-rendered fragment
@@ -10,7 +10,7 @@
10
10
  * the page has without this helper, and the component renders in the browser as it always did.
11
11
  * The site's snippet (`/s/<siteKey>.js`) stays as it is; this adds nothing to the browser.
12
12
  *
13
- * Server key (spike, ADR 0066, no ticket): every request carries the site's server key
13
+ * Server key: every request carries the site's server key
14
14
  * (`tgs_live_…`, created in the portal's Install > SSR tab or through `POST /v1/sites/{id}/server-keys`)
15
15
  * as `Authorization: Bearer <key>`; without a valid one the edge refuses and this helper writes the
16
16
  * bare tag. The key is a server secret: read it from the server's environment
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taggor/server",
3
- "version": "0.4.0",
3
+ "version": "0.6.0",
4
4
  "description": "Server helper for sites that render HTML on a server: asks the Taggor edge for a component's server-rendered fragment and falls back to the bare tag.",
5
5
  "keywords": [
6
6
  "taggor",