deno.land / x / solidstart@v1.0.0-rc.0 / config / server-components.js

server-components.js
نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
import { decorateExportsPlugin, directives, shimExportsPlugin, wrapExportsPlugin} from "@vinxi/plugin-directives";import { client as clientComponents } from "@vinxi/server-components/client";import { SERVER_REFERENCES_MANIFEST } from "@vinxi/server-components/constants";import { buildServerComponents } from "@vinxi/server-components/server";import { fileURLToPath } from "node:url";import { chunkify } from "vinxi/lib/chunks";import { normalize } from "vinxi/lib/path";
function client() { return clientComponents({ server: "ssr", transpileDeps: [], manifest: SERVER_REFERENCES_MANIFEST });}
function server() { const runtime = normalize(fileURLToPath(new URL("../dist/runtime/server-runtime.js", import.meta.url))); // export function serverComponents({ // resolve = { // conditions: ["react-server"], // }, // runtime = "@vinxi/react-server-dom-vite/runtime", // transpileDeps = ["react", "react-dom", "@vinxi/react-server-dom-vite"], // manifest = SERVER_REFERENCES_MANIFEST, // transforms = undefined, // } = {}) { const serverModules = new Set(); const clientModules = new Set();
function onReference(type, reference) { if (type === "server") { serverModules.add(reference); } else { clientModules.add(reference); } }
return [ directives({ hash: chunkify, runtime, onReference: onReference, transforms: [ shimExportsPlugin({ runtime: { module: runtime, function: "createServerReference" }, onModuleFound: mod => onReference("server", mod), hash: chunkify, apply: (code, id, options) => { return !options.ssr; }, pragma: "use server" }), decorateExportsPlugin({ runtime: { module: runtime, function: "createServerReference" }, onModuleFound: mod => onReference("server", mod), hash: chunkify, apply: (code, id, options) => { return options.ssr; }, pragma: "use server" }), wrapExportsPlugin({ runtime: { module: runtime, function: "createClientReference" }, onModuleFound: mod => onReference("client", mod), hash: chunkify, apply: (code, id, options) => { return options.ssr; }, pragma: "use client" }) ] }), buildServerComponents({ resolve: { conditions: ["solid"] }, transpileDeps: [], manifest: SERVER_REFERENCES_MANIFEST, modules: { server: serverModules, client: clientModules } }) ]; // }}
export const serverComponents = { client, server};
solidstart

Version Info

Tagged at
a month ago