@taggor/server 0.3.0 → 0.5.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 +4 -5
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -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`.
|
|
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
|
|
@@ -118,8 +117,8 @@ app.get("/", async (_request, response) => {
|
|
|
118
117
|
|
|
119
118
|
**Plain PHP, over HTTP (no WordPress plugin).** 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.
|
|
122
|
-
|
|
120
|
+
`text/html`, starts with `<tag` and ends with `</tag>`, write the body, otherwise the bare tag. This is a sketch of
|
|
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.
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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.
|
|
3
|
+
"version": "0.5.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",
|