@rsc-kit/core 0.29.8 → 0.29.10
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/dist/bootPayloads.d.ts +18 -0
- package/dist/bootPayloads.js +81 -0
- package/dist/bootPayloads.js.map +1 -0
- package/dist/crawler.d.ts +2 -0
- package/dist/crawler.js +62 -0
- package/dist/crawler.js.map +1 -0
- package/dist/headers.d.ts +5 -0
- package/dist/headers.js +5 -0
- package/dist/headers.js.map +1 -1
- package/dist/host.d.ts +10 -9
- package/dist/host.js +130 -30
- package/dist/host.js.map +1 -1
- package/dist/hostCalls.js +11 -1
- package/dist/hostCalls.js.map +1 -1
- package/dist/js/SegmentBoundary.js +20 -4
- package/dist/js/SegmentBoundary.js.map +1 -1
- package/dist/js/createViteRscApp.js +8 -1
- package/dist/js/createViteRscApp.js.map +1 -1
- package/dist/js/pagePayload.d.ts +1 -1
- package/dist/js/pagePayload.js +2 -2
- package/dist/js/pagePayload.js.map +1 -1
- package/dist/notFound.d.ts +4 -4
- package/dist/notFound.js +6 -4
- package/dist/notFound.js.map +1 -1
- package/dist/redirect.d.ts +1 -1
- package/dist/redirect.js +1 -1
- package/dist/redirect.js.map +1 -1
- package/dist/request.d.ts +5 -0
- package/dist/request.js +9 -0
- package/dist/request.js.map +1 -1
- package/dist/vite.js +268 -197
- package/dist/vite.js.map +1 -1
- package/package.json +1 -1
- package/dist/shellHead.d.ts +0 -22
- package/dist/shellHead.js +0 -45
- package/dist/shellHead.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsc-kit/core",
|
|
3
|
-
"version": "0.29.
|
|
3
|
+
"version": "0.29.10",
|
|
4
4
|
"description": "React Server Components as a Vite plugin. Routing, streaming, server actions, typed urls and build-time prerendering — deploy to Bun, Node, Workers, Vercel or Deno.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
package/dist/shellHead.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The head of a stored shell, corrected for the url it is served for.
|
|
3
|
-
*
|
|
4
|
-
* A shell for a route that listed no urls is one file for every url the
|
|
5
|
-
* route matches, so its <title> is whatever the build could know without a
|
|
6
|
-
* url: the layouts' metadata, once the page's own generateMetadata was seen
|
|
7
|
-
* to read the params and left out. The host serving it does know the url,
|
|
8
|
-
* and the page's metadata is a function of it - so the title and the
|
|
9
|
-
* description are written into the head here, as a string edit on the way
|
|
10
|
-
* out, before React resumes the holes below. The client's DocumentTitle
|
|
11
|
-
* sets the title again after hydration; this is for the tab before that,
|
|
12
|
-
* and for whoever reads the document without running it.
|
|
13
|
-
*/
|
|
14
|
-
/**
|
|
15
|
-
* `shell` with the given title and description in its head. Only the two
|
|
16
|
-
* that every share preview and every tab reads; the rest of a page's
|
|
17
|
-
* metadata rides with the payload.
|
|
18
|
-
*/
|
|
19
|
-
export declare function withHead(shell: string, metadata: {
|
|
20
|
-
title?: unknown;
|
|
21
|
-
description?: unknown;
|
|
22
|
-
} | null): string;
|
package/dist/shellHead.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The head of a stored shell, corrected for the url it is served for.
|
|
3
|
-
*
|
|
4
|
-
* A shell for a route that listed no urls is one file for every url the
|
|
5
|
-
* route matches, so its <title> is whatever the build could know without a
|
|
6
|
-
* url: the layouts' metadata, once the page's own generateMetadata was seen
|
|
7
|
-
* to read the params and left out. The host serving it does know the url,
|
|
8
|
-
* and the page's metadata is a function of it - so the title and the
|
|
9
|
-
* description are written into the head here, as a string edit on the way
|
|
10
|
-
* out, before React resumes the holes below. The client's DocumentTitle
|
|
11
|
-
* sets the title again after hydration; this is for the tab before that,
|
|
12
|
-
* and for whoever reads the document without running it.
|
|
13
|
-
*/
|
|
14
|
-
function escapeHtml(text) {
|
|
15
|
-
return text
|
|
16
|
-
.replace(/&/g, "&")
|
|
17
|
-
.replace(/</g, "<")
|
|
18
|
-
.replace(/>/g, ">")
|
|
19
|
-
.replace(/"/g, """);
|
|
20
|
-
}
|
|
21
|
-
const TITLE = /<title(?:\s[^>]*)?>[\s\S]*?<\/title>/i;
|
|
22
|
-
const DESCRIPTION = /<meta\s+name=(?:"description"|'description'|description)\s+content=(?:"[^"]*"|'[^']*'|[^\s>]*)\s*\/?>/i;
|
|
23
|
-
const HEAD_END = /<\/head>/i;
|
|
24
|
-
/**
|
|
25
|
-
* `shell` with the given title and description in its head. Only the two
|
|
26
|
-
* that every share preview and every tab reads; the rest of a page's
|
|
27
|
-
* metadata rides with the payload.
|
|
28
|
-
*/
|
|
29
|
-
export function withHead(shell, metadata) {
|
|
30
|
-
if (!metadata)
|
|
31
|
-
return shell;
|
|
32
|
-
let out = shell;
|
|
33
|
-
if (metadata.title != null) {
|
|
34
|
-
const tag = `<title>${escapeHtml(String(metadata.title))}</title>`;
|
|
35
|
-
// Replacers are functions: a string one reads $' and $` in the title as
|
|
36
|
-
// "the rest of the document", and a param in a title can hold them.
|
|
37
|
-
out = TITLE.test(out) ? out.replace(TITLE, () => tag) : out.replace(HEAD_END, () => `${tag}</head>`);
|
|
38
|
-
}
|
|
39
|
-
if (metadata.description != null) {
|
|
40
|
-
const tag = `<meta name="description" content="${escapeHtml(String(metadata.description))}"/>`;
|
|
41
|
-
out = DESCRIPTION.test(out) ? out.replace(DESCRIPTION, () => tag) : out.replace(HEAD_END, () => `${tag}</head>`);
|
|
42
|
-
}
|
|
43
|
-
return out;
|
|
44
|
-
}
|
|
45
|
-
//# sourceMappingURL=shellHead.js.map
|
package/dist/shellHead.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shellHead.js","sourceRoot":"","sources":["../src/shellHead.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,SAAS,UAAU,CAAC,IAAY;IAC9B,OAAO,IAAI;SACR,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC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,SAAS,CAAC,CAAC;IACnH,CAAC;IAED,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["/**\n * The head of a stored shell, corrected for the url it is served for.\n *\n * A shell for a route that listed no urls is one file for every url the\n * route matches, so its <title> is whatever the build could know without a\n * url: the layouts' metadata, once the page's own generateMetadata was seen\n * to read the params and left out. The host serving it does know the url,\n * and the page's metadata is a function of it - so the title and the\n * description are written into the head here, as a string edit on the way\n * out, before React resumes the holes below. The client's DocumentTitle\n * sets the title again after hydration; this is for the tab before that,\n * and for whoever reads the document without running it.\n */\n\nfunction escapeHtml(text: string): string {\n return text\n .replace(/&/g, \"&\")\n .replace(/</g, \"<\")\n .replace(/>/g, \">\")\n .replace(/\"/g, \""\");\n}\n\nconst TITLE = /<title(?:\\s[^>]*)?>[\\s\\S]*?<\\/title>/i;\nconst DESCRIPTION = /<meta\\s+name=(?:\"description\"|'description'|description)\\s+content=(?:\"[^\"]*\"|'[^']*'|[^\\s>]*)\\s*\\/?>/i;\nconst HEAD_END = /<\\/head>/i;\n\n/**\n * `shell` with the given title and description in its head. Only the two\n * that every share preview and every tab reads; the rest of a page's\n * metadata rides with the payload.\n */\nexport function withHead(\n shell: string,\n metadata: { title?: unknown; description?: unknown } | null,\n): string {\n if (!metadata) return shell;\n\n let out = shell;\n\n if (metadata.title != null) {\n const tag = `<title>${escapeHtml(String(metadata.title))}</title>`;\n\n // Replacers are functions: a string one reads $' and $` in the title as\n // \"the rest of the document\", and a param in a title can hold them.\n out = TITLE.test(out) ? out.replace(TITLE, () => tag) : out.replace(HEAD_END, () => `${tag}</head>`);\n }\n\n if (metadata.description != null) {\n const tag = `<meta name=\"description\" content=\"${escapeHtml(String(metadata.description))}\"/>`;\n\n out = DESCRIPTION.test(out) ? out.replace(DESCRIPTION, () => tag) : out.replace(HEAD_END, () => `${tag}</head>`);\n }\n\n return out;\n}\n"]}
|