@rsc-kit/core 0.8.0 → 0.10.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.
Files changed (44) hide show
  1. package/dist/action.d.ts +21 -0
  2. package/dist/action.js +67 -36
  3. package/dist/action.js.map +1 -1
  4. package/dist/apiPrerender.d.ts +25 -0
  5. package/dist/apiPrerender.js +195 -0
  6. package/dist/apiPrerender.js.map +1 -0
  7. package/dist/host.d.ts +12 -0
  8. package/dist/host.js +140 -2
  9. package/dist/host.js.map +1 -1
  10. package/dist/js/RouteErrorBoundary.d.ts +36 -0
  11. package/dist/js/RouteErrorBoundary.js +43 -0
  12. package/dist/js/RouteErrorBoundary.js.map +1 -0
  13. package/dist/js/queryClient.js +21 -1
  14. package/dist/js/queryClient.js.map +1 -1
  15. package/dist/manifest.d.ts +33 -0
  16. package/dist/manifest.js.map +1 -1
  17. package/dist/metadata.d.ts +69 -0
  18. package/dist/metadata.js +17 -0
  19. package/dist/metadata.js.map +1 -0
  20. package/dist/notFound.d.ts +24 -0
  21. package/dist/notFound.js +107 -0
  22. package/dist/notFound.js.map +1 -0
  23. package/dist/prerender.d.ts +48 -4
  24. package/dist/prerender.js +79 -9
  25. package/dist/prerender.js.map +1 -1
  26. package/dist/query.d.ts +23 -0
  27. package/dist/query.js +45 -3
  28. package/dist/query.js.map +1 -1
  29. package/dist/redirect.d.ts +8 -0
  30. package/dist/redirect.js +11 -1
  31. package/dist/redirect.js.map +1 -1
  32. package/dist/request.d.ts +7 -0
  33. package/dist/request.js +31 -6
  34. package/dist/request.js.map +1 -1
  35. package/dist/routeSchema.d.ts +115 -0
  36. package/dist/routeSchema.js +182 -0
  37. package/dist/routeSchema.js.map +1 -0
  38. package/dist/routing.d.ts +20 -1
  39. package/dist/routing.js +30 -7
  40. package/dist/routing.js.map +1 -1
  41. package/dist/vite.js +594 -34
  42. package/dist/vite.js.map +1 -1
  43. package/package.json +18 -6
  44. package/dist/types.d.ts +0 -82
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsc-kit/core",
3
- "version": "0.8.0",
3
+ "version": "0.10.0",
4
4
  "description": "React Server Components on any JavaScript server: a Vite plugin that discovers the route tree, and a host adapter that serves it.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -25,6 +25,14 @@
25
25
  "types": "./dist/runtime.d.ts",
26
26
  "default": "./dist/runtime.js"
27
27
  },
28
+ "./RouteErrorBoundary": {
29
+ "types": "./dist/js/RouteErrorBoundary.d.ts",
30
+ "default": "./dist/js/RouteErrorBoundary.js"
31
+ },
32
+ "./metadata": {
33
+ "types": "./dist/metadata.d.ts",
34
+ "default": "./dist/metadata.js"
35
+ },
28
36
  "./query": {
29
37
  "types": "./dist/query.d.ts",
30
38
  "default": "./dist/query.js"
@@ -69,10 +77,6 @@
69
77
  "types": "./dist/js/createViteRscApp.d.ts",
70
78
  "default": "./dist/js/createViteRscApp.js"
71
79
  },
72
- "./types": {
73
- "types": "./dist/types.d.ts",
74
- "default": "./dist/types.d.ts"
75
- },
76
80
  "./useOnline": {
77
81
  "types": "./dist/js/useOnline.d.ts",
78
82
  "default": "./dist/js/useOnline.js"
@@ -160,6 +164,14 @@
160
164
  "./action": {
161
165
  "types": "./dist/action.d.ts",
162
166
  "default": "./dist/action.js"
167
+ },
168
+ "./not-found": {
169
+ "types": "./dist/notFound.d.ts",
170
+ "default": "./dist/notFound.js"
171
+ },
172
+ "./route-schema": {
173
+ "types": "./dist/routeSchema.d.ts",
174
+ "default": "./dist/routeSchema.js"
163
175
  }
164
176
  },
165
177
  "peerDependencies": {
@@ -196,7 +208,7 @@
196
208
  "scripts": {
197
209
  "test": "bun test tests/js",
198
210
  "typecheck": "tsc --noEmit && tsc --noEmit -p tests/js/routeTypes.tsconfig.json",
199
- "build": "rm -rf dist && tsc -p tsconfig.build.json && cp src/types.d.ts dist/types.d.ts",
211
+ "build": "rm -rf dist && tsc -p tsconfig.build.json",
200
212
  "prepack": "bun run build"
201
213
  },
202
214
  "repository": {
package/dist/types.d.ts DELETED
@@ -1,82 +0,0 @@
1
- // Ambient types for an RSC app. Copied into the project's source directory by
2
- // the host's build, so a page can annotate its metadata without importing
3
- // anything.
4
- //
5
- // The host global (rpc) is NOT declared here: its name is configurable, so the
6
- // host generates that declaration with the name it actually installed. Two
7
- // ambient declarations of the same function would conflict.
8
-
9
- /**
10
- * Page metadata for RSC pages.
11
- *
12
- * @example
13
- * ```tsx
14
- * export const metadata: Metadata = {
15
- * title: 'My Page',
16
- * description: 'Page description',
17
- * keywords: ['react', 'laravel'],
18
- * };
19
- * ```
20
- */
21
- interface IconDescriptor {
22
- url: string | URL;
23
- type?: string;
24
- sizes?: string;
25
- color?: string;
26
- rel?: string;
27
- media?: string;
28
- fetchPriority?: 'high' | 'low' | 'auto';
29
- }
30
-
31
- type IconURL = string | URL;
32
-
33
- interface Icons {
34
- icon?: IconURL | IconDescriptor | (IconURL | IconDescriptor)[];
35
- apple?: IconURL | IconDescriptor | (IconURL | IconDescriptor)[];
36
- shortcut?: IconURL | IconDescriptor | (IconURL | IconDescriptor)[];
37
- other?: IconDescriptor | IconDescriptor[];
38
- }
39
-
40
- /** A layout's title, wrapping the titles of the pages beneath it. */
41
- interface TitleTemplate {
42
- /** `%s` stands in for the page's own title. */
43
- template?: string;
44
- /** Used by a page that exports no title of its own. */
45
- default?: string;
46
- }
47
-
48
- interface Metadata {
49
- /** A string on a page; a template on a layout, applied to the pages below it. */
50
- title?: string | TitleTemplate;
51
- description?: string;
52
- keywords?: string | string[];
53
- author?: string;
54
- robots?: string;
55
- icons?: IconURL | (IconURL | IconDescriptor)[] | Icons | null;
56
- 'og:title'?: string;
57
- 'og:description'?: string;
58
- 'og:image'?: string;
59
- 'og:url'?: string;
60
- 'og:type'?: string;
61
- 'og:site_name'?: string;
62
- 'twitter:card'?: string;
63
- 'twitter:title'?: string;
64
- 'twitter:description'?: string;
65
- 'twitter:image'?: string;
66
- 'twitter:site'?: string;
67
- [key: string]: string | string[] | TitleTemplate | Icons | IconURL | (IconURL | IconDescriptor)[] | null | undefined;
68
- }
69
-
70
- /**
71
- * Metadata that depends on the request.
72
- *
73
- * Receives the same awaitables a page does, so one shape is learned rather
74
- * than two:
75
- *
76
- * export const generateMetadata: GenerateMetadata<{ slug: string }> =
77
- * async ({ params }) => ({ title: (await params).slug })
78
- */
79
- type GenerateMetadata<P = Record<string, string>> = (args: {
80
- params: Promise<P>;
81
- searchParams: Promise<URLSearchParams>;
82
- }) => Metadata | Promise<Metadata>;